use of org.springframework.asm.Label in project spring-framework by spring-projects.
the class OpOr method generateCode.
@Override
public void generateCode(MethodVisitor mv, CodeFlow cf) {
// pseudo: if (leftOperandValue) { result=true; } else { result=rightOperandValue; }
Label elseTarget = new Label();
Label endOfIf = new Label();
cf.enterCompilationScope();
getLeftOperand().generateCode(mv, cf);
cf.unboxBooleanIfNecessary(mv);
cf.exitCompilationScope();
mv.visitJumpInsn(IFEQ, elseTarget);
// TRUE
mv.visitLdcInsn(1);
mv.visitJumpInsn(GOTO, endOfIf);
mv.visitLabel(elseTarget);
cf.enterCompilationScope();
getRightOperand().generateCode(mv, cf);
cf.unboxBooleanIfNecessary(mv);
cf.exitCompilationScope();
mv.visitLabel(endOfIf);
cf.pushDescriptor(this.exitTypeDescriptor);
}
use of org.springframework.asm.Label in project spring-framework by spring-projects.
the class OpAnd method generateCode.
@Override
public void generateCode(MethodVisitor mv, CodeFlow cf) {
// Pseudo: if (!leftOperandValue) { result=false; } else { result=rightOperandValue; }
Label elseTarget = new Label();
Label endOfIf = new Label();
cf.enterCompilationScope();
getLeftOperand().generateCode(mv, cf);
cf.unboxBooleanIfNecessary(mv);
cf.exitCompilationScope();
mv.visitJumpInsn(IFNE, elseTarget);
// FALSE
mv.visitLdcInsn(0);
mv.visitJumpInsn(GOTO, endOfIf);
mv.visitLabel(elseTarget);
cf.enterCompilationScope();
getRightOperand().generateCode(mv, cf);
cf.unboxBooleanIfNecessary(mv);
cf.exitCompilationScope();
mv.visitLabel(endOfIf);
cf.pushDescriptor(this.exitTypeDescriptor);
}
use of org.springframework.asm.Label in project spring-framework by spring-projects.
the class Enhancer method emitGetCallback.
private void emitGetCallback(ClassEmitter ce, int[] keys) {
final CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, GET_CALLBACK, null);
e.load_this();
e.invoke_static_this(BIND_CALLBACKS);
e.load_this();
e.load_arg(0);
e.process_switch(keys, new ProcessSwitchCallback() {
public void processCase(int key, Label end) {
e.getfield(getCallbackField(key));
e.goTo(end);
}
public void processDefault() {
// stack height
e.pop();
e.aconst_null();
}
});
e.return_value();
e.end_method();
}
use of org.springframework.asm.Label in project spring-framework by spring-projects.
the class Enhancer method emitCurrentCallback.
private void emitCurrentCallback(CodeEmitter e, int index) {
e.load_this();
e.getfield(getCallbackField(index));
e.dup();
Label end = e.make_label();
e.ifnonnull(end);
// stack height
e.pop();
e.load_this();
e.invoke_static_this(BIND_CALLBACKS);
e.load_this();
e.getfield(getCallbackField(index));
e.mark(end);
}
Aggregations