super.DefineClassMethodInstr(defineclassmethodinstr); //To change body of overridden methods use File | Settings | File Templates.
}
@Override
public void DefineInstanceMethodInstr(DefineInstanceMethodInstr defineinstancemethodinstr) {
IRMethod method = defineinstancemethodinstr.getMethod();
StaticScope scope = method.getStaticScope();
if (scope.getRequiredArgs() > 3 || scope.getRestArg() >= 0 || scope.getOptionalArgs() != 0) {
throw new RuntimeException("can't compile variable method: " + this);
}
String scopeString = RuntimeHelpers.encodeScope(scope);
IRBytecodeAdapter m = jvm.method();
SkinnyMethodAdapter a = m.adapter;
// preamble for addMethod below
a.aload(0);
a.invokevirtual(p(ThreadContext.class), "getRubyClass", "()Lorg/jruby/RubyModule;");
a.ldc(method.getName());
// new CompiledIRMethod
a.newobj(p(CompiledIRMethod.class));
a.dup();
// emit method body and get handle
emit(method); // handle
// add'l args for CompiledIRMethod constructor
a.ldc(method.getName());
a.ldc(method.getFileName());
a.ldc(method.getLineNumber());
a.aload(0);
a.aload(1);
a.ldc(scopeString);
a.invokestatic(p(RuntimeHelpers.class), "decodeScope", "(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/parser/StaticScope;Ljava/lang/String;)Lorg/jruby/parser/StaticScope;");