@Override public void Nil(Nil nil) { jvmMethod().pushNil(); }
@Override public void Nil(Nil nil) { jvm.method().pushNil(); }
/** * Branch to label if value at top of stack is nil * * stack: obj to check for nilness */ public void branchIfNil(Label label) { pushNil(); adapter.if_acmpeq(label); }
@Override public void Nil(Nil nil) { jvmMethod().pushNil(); }
/** * Branch to label if value at top of stack is nil * * stack: obj to check for nilness */ public void branchIfNil(Label label) { pushNil(); adapter.if_acmpeq(label); }
@Override public void Nil(Nil nil) { jvm.method().pushNil(); }
switch (location) { case 0: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueZeroDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; case 1: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueOneDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; case 2: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueTwoDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; case 3: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueThreeDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; default: m.adapter.pushInt(location); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueDepthZeroOrNil", sig(IRubyObject.class, int.class, IRubyObject.class)); return; m.adapter.pushInt(location); m.adapter.pushInt(depth); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueOrNil", sig(IRubyObject.class, int.class, int.class, IRubyObject.class));
switch (location) { case 0: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueZeroDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; case 1: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueOneDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; case 2: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueTwoDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; case 3: m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueThreeDepthZeroOrNil", sig(IRubyObject.class, IRubyObject.class)); return; default: m.adapter.pushInt(location); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueDepthZeroOrNil", sig(IRubyObject.class, int.class, IRubyObject.class)); return; m.adapter.pushInt(location); m.adapter.pushInt(depth); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueOrNil", sig(IRubyObject.class, int.class, int.class, IRubyObject.class));
m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), DynamicScopeGenerator.SPECIALIZED_GETS_OR_NIL.get(location), sig(IRubyObject.class, IRubyObject.class)); } else { m.adapter.pushInt(location); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueDepthZeroOrNil", sig(IRubyObject.class, int.class, IRubyObject.class)); m.adapter.pushInt(location); m.adapter.pushInt(depth); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueOrNil", sig(IRubyObject.class, int.class, int.class, IRubyObject.class));
m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), DynamicScopeGenerator.SPECIALIZED_GETS_OR_NIL.get(location), sig(IRubyObject.class, IRubyObject.class)); } else { m.adapter.pushInt(location); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueDepthZeroOrNil", sig(IRubyObject.class, int.class, IRubyObject.class)); m.adapter.pushInt(location); m.adapter.pushInt(depth); m.pushNil(); m.adapter.invokevirtual(p(DynamicScope.class), "getValueOrNil", sig(IRubyObject.class, int.class, int.class, IRubyObject.class));
@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); }
@Override public void BreakInstr(BreakInstr breakInstr) { IRBytecodeAdapter m = jvm.method(); SkinnyMethodAdapter a = m.adapter; m.loadLocal(0); // context a.aload(1); // current scope // FIXME: This can also be done in the helper itself m.invokeVirtual(Type.getType(IRScope.class), Method.getMethod("org.jruby.ir.IRScope getIRScope()")); a.ldc(breakInstr.getScopeToReturnTo().getScopeId()); visit(breakInstr.getReturnValue()); // FIXME: emit block-type for the scope that is currently executing // For now, it is null m.pushNil(); a.invokestatic(p(IRubyObject.class), "initiateBreak", sig(ThreadContext.class, IRScope.class, IRScope.class, IRubyObject.class, Block.Type.class)); }
@Override public void BreakInstr(BreakInstr breakInstr) { IRBytecodeAdapter m = jvm.method(); SkinnyMethodAdapter a = m.adapter; m.loadLocal(0); // context a.aload(1); // current scope // FIXME: This can also be done in the helper itself m.invokeVirtual(Type.getType(IRScope.class), Method.getMethod("org.jruby.ir.IRScope getIRScope()")); a.ldc(breakInstr.getScopeToReturnTo().getScopeId()); visit(breakInstr.getReturnValue()); // FIXME: emit block-type for the scope that is currently executing // For now, it is null m.pushNil(); a.invokestatic(p(IRubyObject.class), "initiateBreak", sig(ThreadContext.class, IRScope.class, IRScope.class, IRubyObject.class, Block.Type.class)); }
@Override public void BuildLambdaInstr(BuildLambdaInstr buildlambdainstr) { jvmMethod().loadRuntime(); IRClosure body = ((WrappedIRClosure)buildlambdainstr.getLambdaBody()).getClosure(); if (body == null) { jvmMethod().pushNil(); } else { visit(buildlambdainstr.getLambdaBody()); } jvmAdapter().getstatic(p(Block.Type.class), "LAMBDA", ci(Block.Type.class)); jvmAdapter().ldc(buildlambdainstr.getFile()); jvmAdapter().pushInt(buildlambdainstr.getLine()); jvmAdapter().invokestatic(p(RubyProc.class), "newProc", sig(RubyProc.class, Ruby.class, Block.class, Block.Type.class, String.class, int.class)); jvmStoreLocal(buildlambdainstr.getResult()); }
@Override public void BuildLambdaInstr(BuildLambdaInstr buildlambdainstr) { jvmMethod().loadRuntime(); IRClosure body = ((WrappedIRClosure)buildlambdainstr.getLambdaBody()).getClosure(); if (body == null) { jvmMethod().pushNil(); } else { visit(buildlambdainstr.getLambdaBody()); } jvmAdapter().getstatic(p(Block.Type.class), "LAMBDA", ci(Block.Type.class)); jvmAdapter().ldc(buildlambdainstr.getFile()); jvmAdapter().pushInt(buildlambdainstr.getLine()); jvmAdapter().invokestatic(p(RubyProc.class), "newProc", sig(RubyProc.class, Ruby.class, Block.class, Block.Type.class, String.class, int.class)); jvmStoreLocal(buildlambdainstr.getResult()); }