Mercurial > hg > graal-compiler
changeset 5829:0095a9c235c6
incomplete (non XIR) support for inlining virtual dispatch at call sites - all design questions yet to be addressed
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 14 Jul 2012 21:38:19 +0200 |
parents | 143e68e4e4d3 |
children | 610f9e377c70 58a607307306 |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java |
diffstat | 2 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java Sat Jul 14 21:28:23 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java Sat Jul 14 21:38:19 2012 +0200 @@ -273,7 +273,6 @@ public static String HIRLowerCheckcast = ""; public static String HIRLowerNewInstance = ""; public static String HIRLowerNewArray = ""; - public static String HIRLowerInlineVirtualInvokes = ""; /** * Use XIR to lower {@link Invoke} nodes.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sat Jul 14 21:28:23 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sat Jul 14 21:38:19 2012 +0200 @@ -46,6 +46,7 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; +import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.snippets.*; @@ -241,18 +242,24 @@ invoke.node().dependencies().add(tool.createNullCheckGuard(receiver, invoke.leafGraphId())); } - int vtableEntryOffset = 0; - if (matches(graph, GraalOptions.HIRLowerInlineVirtualInvokes) || (GraalOptions.InlineVTableStubs && (GraalOptions.AlwaysInlineVTableStubs || invoke.isMegamorphic()))) { + if (callTarget.invokeKind() == InvokeKind.Virtual && + GraalOptions.InlineVTableStubs && + (GraalOptions.AlwaysInlineVTableStubs || invoke.isMegamorphic())) { + + // TODO (dnsimon) I'm not sure of other invariants of HotSpot's calling conventions that may + // be required for register indirect calls. + assert false : "HotSpot expects the methodOop of the callee to be in rbx - this is yet to be implemented for inline vtable dispatch"; + // TODO: successive inlined invokevirtuals to the same method cause register allocation to fail - fix this! HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod(); if (!hsMethod.holder().isInterface()) { - vtableEntryOffset = hsMethod.vtableEntryOffset(); + int vtableEntryOffset = hsMethod.vtableEntryOffset(); assert vtableEntryOffset != 0; SafeReadNode hub = safeReadHub(graph, receiver, StructuredGraph.INVALID_GRAPH_ID); Kind wordKind = graalRuntime.getTarget().wordKind; Stamp nonNullWordStamp = StampFactory.forWord(wordKind, true); - ReadNode methodOop = graph.add(new ReadNode(hub, LocationNode.create(LocationNode.FINAL_LOCATION, wordKind, vtableEntryOffset, graph), nonNullWordStamp)); - ReadNode compiledEntry = graph.add(new ReadNode(methodOop, LocationNode.create(LocationNode.FINAL_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), nonNullWordStamp)); + ReadNode methodOop = graph.add(new ReadNode(hub, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, vtableEntryOffset, graph), nonNullWordStamp)); + ReadNode compiledEntry = graph.add(new ReadNode(methodOop, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), nonNullWordStamp)); callTarget.setAddress(compiledEntry); graph.addBeforeFixed(invoke.node(), hub);