BasicAMD64Test
Venkatachalam, Vasanth
Vasanth.Venkatachalam at amd.com
Tue May 21 08:43:37 PDT 2013
Hi,
The below test case for the AMD64 backend used to work, but after a recent merge it now fails with the error:
Java.lang.AssertionError: linkage without and address must be a stub - forgot to register a Stub associated with exceptionHandler(Object,Word) void.
Can someone explain what we need to do to get this working again?
Also is there a way we can get the AMD64 backend to display the disassembled generated code?
Also it would be useful if we could write our test cases in one central location and run them in any backend (AMD64, PTX, HSAIL etc) instead of duplicating them into the test directories for each of the backends.
BasicAMD64Test.java
public class BasicAMD64Test extends GraalCompilerTest {
@Test
public void testArray2() {
test("testArrayVarSnippet");
}
public static int testArrayVarSnippet(int[] array, int n) {
return array[n];
}
private CompilationResult test(String snippet) {
StructuredGraph graph = parse(snippet);
Debug.dump(graph, "Graph");
TargetDescription target = new TargetDescription(new AMD64(4, 1), true, 1, 0, true);
AMD64HotSpotBackend amd64Backend = new AMD64HotSpotBackend(new AMD64HotSpotGraalRuntime().getRuntime(), target);
PhasePlan phasePlan = new PhasePlan();
GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE);
phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
phasePlan.addPhase(PhasePosition.AFTER_PARSING, new AMD64Phase());
new AMD64Phase().apply(graph);
CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(), amd64Backend, target, null, phasePlan,
OptimisticOptimizations.NONE, new SpeculationLog());
DisassemblerProvider dis = Graal.getRuntime().getCapability(DisassemblerProvider.class);
/******
* if (dis != null) { String disasm = dis.disassemble(result); }
**********/
if (true) {
String disasm = new AMD64HotSpotGraalRuntime().getRuntime().disassemble(result, null);
System.out.println("code for snippet " + snippet + " " + disasm);
}
return result;
}
private static class AMD64Phase extends Phase {
@Override
protected void run(StructuredGraph graph) {
for (LocalNode local : graph.getNodes(LocalNode.class)) {
if (local.kind() == Kind.Object) {
local.setStamp(StampFactory.declaredNonNull(local.objectStamp().type()));
}
}
}
}
More information about the graal-dev
mailing list