Mercurial > hg > truffle
changeset 20084:e6235961d404
AssemblerTest: add method and code cache provider to scope to enable dumping.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 30 Mar 2015 17:00:08 +0200 |
parents | 82246de10a9f |
children | e4bb07ed276c |
files | graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java |
diffstat | 1 files changed, 18 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Mon Mar 30 17:31:48 2015 +0200 +++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Mon Mar 30 17:00:08 2015 +0200 @@ -29,6 +29,8 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.api.runtime.*; +import com.oracle.graal.debug.*; +import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.phases.util.*; import com.oracle.graal.runtime.*; import com.oracle.graal.test.*; @@ -54,21 +56,25 @@ protected InstalledCode assembleMethod(Method m, CodeGenTest test) { ResolvedJavaMethod method = getMetaAccess().lookupJavaMethod(m); - RegisterConfig registerConfig = codeCache.getRegisterConfig(); - CallingConvention cc = CodeUtil.getCallingConvention(codeCache, CallingConvention.Type.JavaCallee, method, false); + try (Scope s = Debug.scope("assembleMethod", method, codeCache)) { + RegisterConfig registerConfig = codeCache.getRegisterConfig(); + CallingConvention cc = CodeUtil.getCallingConvention(codeCache, CallingConvention.Type.JavaCallee, method, false); - CompilationResult compResult = new CompilationResult(); - byte[] targetCode = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc); - compResult.setTargetCode(targetCode, targetCode.length); + CompilationResult compResult = new CompilationResult(); + byte[] targetCode = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc); + compResult.setTargetCode(targetCode, targetCode.length); + + InstalledCode code = codeCache.addMethod(method, compResult, null, null); - InstalledCode code = codeCache.addMethod(method, compResult, null, null); - - DisassemblerProvider dis = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getDisassembler(); - if (dis != null) { - String disasm = dis.disassemble(code); - Assert.assertTrue(code.toString(), disasm == null || disasm.length() > 0); + DisassemblerProvider dis = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getDisassembler(); + if (dis != null) { + String disasm = dis.disassemble(code); + Assert.assertTrue(code.toString(), disasm == null || disasm.length() > 0); + } + return code; + } catch (Throwable e) { + throw Debug.handle(e); } - return code; } protected Object runTest(String methodName, CodeGenTest test, Object... args) {