static { try { MetaAccessProvider runtime = Graal.getRequiredCapability(MetaAccessProvider.class); LOCALS_FIELD = runtime.lookupJavaField(FrameWithoutBoxing.class.getDeclaredField("locals")); PRIMITIVELOCALS_FIELD = runtime.lookupJavaField(FrameWithoutBoxing.class.getDeclaredField("primitiveLocals")); TAGS_FIELD = runtime.lookupJavaField(FrameWithoutBoxing.class.getDeclaredField("tags")); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } }
protected InstalledCode assembleMethod(Method m, CodeGenTest test) { ResolvedJavaMethod method = codeCache.lookupJavaMethod(m); RegisterConfig registerConfig = codeCache.lookupRegisterConfig(); CallingConvention cc = CodeUtil.getCallingConvention(codeCache, CallingConvention.Type.JavaCallee, method, false); CompilationResult compResult = new CompilationResult(); Buffer codeBuffer = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc); compResult.setTargetCode(codeBuffer.close(true), codeBuffer.position()); InstalledCode code = codeCache.addMethod(method, compResult); DisassemblerProvider dis = Graal.getRuntime().getCapability(DisassemblerProvider.class); if (dis != null) { String disasm = dis.disassemble(code); Assert.assertTrue(code.toString(), disasm == null || disasm.length() > 0); } return code; }
public AssemblerTest() { this.codeCache = Graal.getRequiredCapability(CodeCacheProvider.class); }