BasicAMD64Test

Doug Simon doug.simon at oracle.com
Tue May 21 09:24:04 PDT 2013


Hi Vasanth,

On May 21, 2013, at 5:43 PM, "Venkatachalam, Vasanth" <Vasanth.Venkatachalam at amd.com> wrote:

> 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?

Recent changes have removed this assertion. Please let me know if you still get this (or a similar) error after pulling the most recent changes.

> Also is there a way we can get the AMD64 backend to display the disassembled generated code?

What is not working with the (commented out) disassembler call in your attached 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.

I assume you are talking about non-backend-specific tests. In that case, can't you just create a project similar to com.oracle.graal.compiler.test or com.oracle.graal.hotspot.test? 

-Doug

> 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