public org.objectweb.asm.Label newLabel() { return new org.objectweb.asm.Label(); } public SkinnyMethodAdapter adapter;
public SkinnyMethodAdapter(ClassVisitor cv, int flags, String name, String signature, String something, String[] exceptions) { super(ASM4); setMethodVisitor(cv.visitMethod(flags, name, signature, something, exceptions)); this.cv = cv; this.name = name; this.start = new Label(); this.end = new Label(); }
public SkinnyMethodAdapter(ClassVisitor cv, int flags, String name, String signature, String something, String[] exceptions) { super(ASM4); setMethodVisitor(cv.visitMethod(flags, name, signature, something, exceptions)); this.cv = cv; this.name = name; this.start = new Label(); this.end = new Label(); }
public SkinnyMethodAdapter(ClassVisitor cv, int flags, String name, String signature, String something, String[] exceptions) { super(ASM4); setMethodVisitor(cv.visitMethod(flags, name, signature, something, exceptions)); this.cv = cv; this.name = name; this.start = new Label(); this.end = new Label(); }
public void line(int line) { Label label = new Label(); label(label); visitLineNumber(line, label); }
public void line(int line) { Label label = new Label(); label(label); visitLineNumber(line, label); }
public void line(int line) { Label label = new Label(); label(label); visitLineNumber(line, label); }
public void performBooleanBranch2(BranchCallback trueBranch, BranchCallback falseBranch) { Label afterJmp = new Label(); Label falseJmp = new Label(); method.ifeq(falseJmp); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(afterJmp); // FIXME: optimize for cases where we have no false branch method.label(falseJmp); falseBranch.branch(this); method.label(afterJmp); }
@Override public void endBody() { // return last value from execution method.areturn(); Label end = new Label(); method.label(end); method.end(); }
public void beginMethod(CompilerCallback args, StaticScope scope) { method.start(); if (scope == null) { // not using a new scope, use saved one for a flat closure variableCompiler.beginFlatClosure(args, this.scope); } else { // normal closure variableCompiler.beginClosure(args, scope); } redoJump = new Label(); method.label(scopeStart); }
public void isInstanceOf(Class clazz, BranchCallback trueBranch, BranchCallback falseBranch) { method.instance_of(p(clazz)); Label falseJmp = new Label(); Label afterJmp = new Label(); method.ifeq(falseJmp); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(afterJmp); method.label(falseJmp); falseBranch.branch(this); method.label(afterJmp); }
public void isNil(BranchCallback trueBranch, BranchCallback falseBranch) { method.invokeinterface(p(IRubyObject.class), "isNil", sig(boolean.class)); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); }
public void isNil(BranchCallback trueBranch, BranchCallback falseBranch) { method.invokeinterface(p(IRubyObject.class), "isNil", sig(boolean.class)); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); }
public void typeCheckBranch(Class type, BranchCallback trueCallback, BranchCallback falseCallback) { Label elseLabel = new Label(); Label done = new Label(); method.dup(); method.instance_of(p(type)); method.ifeq(elseLabel); trueCallback.branch(this); method.go_to(done); method.label(elseLabel); falseCallback.branch(this); method.label(done); }
public void hasBlock(BranchCallback trueBranch, BranchCallback falseBranch) { loadBlock(); method.invokevirtual(p(Block.class), "isGiven", sig(boolean.class)); Label falseLabel = new Label(); Label exitLabel = new Label(); method.ifeq(falseLabel); // EQ == 0 (i.e. false) trueBranch.branch(this); method.go_to(exitLabel); method.label(falseLabel); falseBranch.branch(this); method.label(exitLabel); }
public void isClassVarDefined(String name, BranchCallback trueBranch, BranchCallback falseBranch) { method.ldc(name); method.invokevirtual(p(RubyModule.class), "isClassVarDefined", sig(boolean.class, params(String.class))); Label trueLabel = new Label(); Label exitLabel = new Label(); method.ifne(trueLabel); falseBranch.branch(this); method.go_to(exitLabel); method.label(trueLabel); trueBranch.branch(this); method.label(exitLabel); }
public void isPrivate(Object gotoToken, int toConsume) { method.getstatic(p(Visibility.class), "PRIVATE", ci(Visibility.class)); Label temp = new Label(); method.if_acmpne(temp); while ((toConsume--) > 0) { method.pop(); } method.go_to((Label) gotoToken); method.label(temp); }
@Override public void SValue(SValue svalue) { visit(svalue.getArray()); jvmAdapter().dup(); jvmAdapter().instance_of(p(RubyArray.class)); org.objectweb.asm.Label after = new org.objectweb.asm.Label(); jvmAdapter().iftrue(after); jvmAdapter().pop(); jvmMethod().pushNil(); jvmAdapter().label(after); }
@Override public void SValue(SValue svalue) { visit(svalue.getArray()); jvmAdapter().dup(); jvmAdapter().instance_of(p(RubyArray.class)); org.objectweb.asm.Label after = new org.objectweb.asm.Label(); jvmAdapter().iftrue(after); jvmAdapter().pop(); jvmMethod().pushNil(); jvmAdapter().label(after); }