//VmByteCode code = loadByteCode(className, "arithOptIntx");
//VmByteCode code = loadByteCode(className, "simpleWhile");
//VmByteCode code = loadByteCode(className, "terniary2");
VmX86Architecture32 arch = new VmX86Architecture32();
VmSystemClassLoader loader = new VmSystemClassLoader(new URL[]{
new File("core/build/classes").toURL(),
new File("distr/build/classes").toURL(),
new File("local/classlib").toURL()
}, arch);
new VmImpl("?", arch, loader.getSharedStatics(), true, loader, null);
VmType.initializeForBootImage(loader);
VmType<?> type = loader.loadClass(className, true);
VmMethod arithMethod = null;
int nMethods = type.getNoDeclaredMethods();
for (int i = 0; i < nMethods; i += 1) {
VmMethod method1 = type.getDeclaredMethod(i);
if ("terniary22".equals(method1.getName())) {
// if ("darken".equals(method1.getName())) {
arithMethod = method1;
break;
}
}
VmMethod method = arithMethod;
VmByteCode code = method.getBytecode();
//VmByteCode code = loadByteCode(className, "appel");
EntryPoints context = new EntryPoints(loader, VmUtils.getVm().getHeapManager(), 1);
X86CompilerHelper helper = new X86CompilerHelper(os, null, context, true);
CompiledMethod cm = new CompiledMethod(1);
TypeSizeInfo typeSizeInfo = loader.getArchitecture().getTypeSizeInfo();
helper.setMethod(method);
X86StackFrame stackFrame = new X86StackFrame(os, helper, method, context, cm);
X86CodeGenerator x86cg = new X86CodeGenerator(method, os, code.getLength(), typeSizeInfo, stackFrame);
generateCode(os, code, x86cg, stackFrame, arithMethod, typeSizeInfo);