@Override public void CheckArityInstr(CheckArityInstr checkarityinstr) { if (jvm.methodData().specificArity >= 0) { // no arity check in specific arity path } else { checkArity(checkarityinstr.required, checkarityinstr.opt, checkarityinstr.rest, checkarityinstr.receivesKeywords, checkarityinstr.restKey); } }
@Override public void CheckArityInstr(CheckArityInstr checkarityinstr) { if (jvm.methodData().specificArity >= 0) { // no arity check in specific arity path } else { checkArity(checkarityinstr.required, checkarityinstr.opt, checkarityinstr.rest, checkarityinstr.receivesKeywords, checkarityinstr.restKey); } }
protected void emitVarargsMethodWrapper(IRScope scope, String variableName, String specificName, Signature variableSignature, Signature specificSignature) { jvm.pushmethod(variableName, scope, variableSignature, false); IRBytecodeAdapter m = jvmMethod(); // check arity org.jruby.runtime.Signature scopeSig = scope.getStaticScope().getSignature(); checkArity(scopeSig.required(), scopeSig.opt(), scopeSig.hasRest(), scopeSig.hasKwargs(), scopeSig.keyRest()); // push leading args m.loadContext(); m.loadStaticScope(); m.loadSelf(); // unwrap specific args if (scopeSig.required() > 0) { for (int i = 0; i < scopeSig.required(); i++) { m.loadArgs(); jvmAdapter().pushInt(i); jvmAdapter().aaload(); } } // push trailing args m.loadBlock(); m.loadFrameClass(); m.loadFrameName(); // invoke specific-arity version and return Method specificMethod = new Method(specificName, Type.getType(specificSignature.type().returnType()), IRRuntimeHelpers.typesFromSignature(specificSignature)); jvmAdapter().invokestatic(m.getClassData().clsName, specificName, specificMethod.getDescriptor()); jvmAdapter().areturn(); jvm.popmethod(); }
protected void emitVarargsMethodWrapper(IRScope scope, String variableName, String specificName, Signature variableSignature, Signature specificSignature) { jvm.pushmethod(variableName, scope, variableSignature, false); IRBytecodeAdapter m = jvmMethod(); // check arity org.jruby.runtime.Signature scopeSig = scope.getStaticScope().getSignature(); checkArity(scopeSig.required(), scopeSig.opt(), scopeSig.hasRest(), scopeSig.hasKwargs(), scopeSig.keyRest()); // push leading args m.loadContext(); m.loadStaticScope(); m.loadSelf(); // unwrap specific args if (scopeSig.required() > 0) { for (int i = 0; i < scopeSig.required(); i++) { m.loadArgs(); jvmAdapter().pushInt(i); jvmAdapter().aaload(); } } // push trailing args m.loadBlock(); m.loadFrameClass(); m.loadFrameName(); // invoke specific-arity version and return Method specificMethod = new Method(specificName, Type.getType(specificSignature.type().returnType()), IRRuntimeHelpers.typesFromSignature(specificSignature)); jvmAdapter().invokestatic(m.getClassData().clsName, specificName, specificMethod.getDescriptor()); jvmAdapter().areturn(); jvm.popmethod(); }