# HG changeset patch # User Gilles Duboscq # Date 1352395171 -3600 # Node ID 363968be1018c56c27024af0dd3d01fb0307ef88 # Parent dbe065c2c5bf98491727d6c38de01ecdaee099f1 Do not inline vtable lookup when the method's holder is not yet linked (no vtable offset available) diff -r dbe065c2c5bf -r 363968be1018 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- 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); + } } }