changeset 6686:363968be1018

Do not inline vtable lookup when the method's holder is not yet linked (no vtable offset available)
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 08 Nov 2012 18:19:31 +0100
parents dbe065c2c5bf
children a14a452cf154
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Nov 08 18:18:18 2012 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Nov 08 18:19:31 2012 +0100
@@ -386,21 +386,22 @@
 
                     HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
                     if (!hsMethod.getDeclaringClass().isInterface()) {
-                        // We use LocationNode.ANY_LOCATION for the reads that access the vtable entry and the compiled code entry
-                        // as HotSpot does not guarantee they are final values.
                         int vtableEntryOffset = hsMethod.vtableEntryOffset();
-                        assert vtableEntryOffset > 0;
-                        LoadHubNode hub = graph.add(new LoadHubNode(receiver));
-                        Kind wordKind = graalRuntime.getTarget().wordKind;
-                        Stamp nonNullWordStamp = StampFactory.forWord(wordKind, true);
-                        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));
+                        if (vtableEntryOffset > 0) {
+                            // We use LocationNode.ANY_LOCATION for the reads that access the vtable entry and the compiled code entry
+                            // as HotSpot does not guarantee they are final values.
+                            LoadHubNode hub = graph.add(new LoadHubNode(receiver));
+                            Kind wordKind = graalRuntime.getTarget().wordKind;
+                            Stamp nonNullWordStamp = StampFactory.forWord(wordKind, true);
+                            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));
 
-                        loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(methodOop, compiledEntry, parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall));
+                            loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(methodOop, compiledEntry, parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall));
 
-                        graph.addBeforeFixed(invoke.node(), hub);
-                        graph.addAfterFixed(hub, methodOop);
-                        graph.addAfterFixed(methodOop, compiledEntry);
+                            graph.addBeforeFixed(invoke.node(), hub);
+                            graph.addAfterFixed(hub, methodOop);
+                            graph.addAfterFixed(methodOop, compiledEntry);
+                        }
                     }
                 }