jvmStoreLocal(definemetaclassinstr.getResult());
}
@Override
public void DefineModuleInstr(DefineModuleInstr definemoduleinstr) {
IRModuleBody newIRModuleBody = definemoduleinstr.getNewIRModuleBody();
StaticScope scope = newIRModuleBody.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;
// new CompiledIRMethod
a.newobj(p(CompiledIRMethod.class));
a.dup();
// emit method body and get handle
emit(newIRModuleBody); // handle
// add'l args for CompiledIRMethod constructor
a.ldc(newIRModuleBody.getName());
a.ldc(newIRModuleBody.getFileName());
a.ldc(newIRModuleBody.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;");
// create module
m.loadLocal(0);
visit(definemoduleinstr.getContainer());
m.invokeHelper("checkIsRubyModule", RubyModule.class, ThreadContext.class, Object.class);
a.ldc(newIRModuleBody.getName());
a.invokevirtual(p(RubyModule.class), "defineOrGetModuleUnder", sig(RubyModule.class, String.class));
// set into StaticScope
a.dup2();
a.invokevirtual(p(StaticScope.class), "setModule", sig(void.class, RubyModule.class));