}
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(newIRClassBody); // handle
// add'l args for CompiledIRMethod constructor
a.ldc(newIRClassBody.getName());
a.ldc(newIRClassBody.getFileName());
a.ldc(newIRClassBody.getLineNumber());
// construct class with RuntimeHelpers.newClassForIR
a.aload(0); // ThreadContext
a.ldc(newIRClassBody.getName()); // class name
m.loadLocal(2); // self
// create class
m.loadLocal(0);
visit(defineclassinstr.getContainer());
m.invokeHelper("checkIsRubyModule", RubyModule.class, ThreadContext.class, Object.class);
// superclass
if (defineclassinstr.getSuperClass() instanceof Nil) {
a.aconst_null();
} else {
visit(defineclassinstr.getSuperClass());
}
// is meta?
a.ldc(newIRClassBody instanceof IRMetaClassBody);
m.invokeHelper("newClassForIR", RubyClass.class, ThreadContext.class, String.class, IRubyObject.class, RubyModule.class, Object.class, boolean.class);
//// static scope
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;");
a.swap();
// set into StaticScope
a.dup2();
a.invokevirtual(p(StaticScope.class), "setModule", sig(void.class, RubyModule.class));
a.getstatic(p(Visibility.class), "PUBLIC", ci(Visibility.class));
a.swap();
// invoke constructor
a.invokespecial(p(CompiledIRMethod.class), "<init>", "(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/String;ILorg/jruby/parser/StaticScope;Lorg/jruby/runtime/Visibility;Lorg/jruby/RubyModule;)V");
// store
jvmStoreLocal(defineclassinstr.getResult());
}