diff graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java @ 9377:0f4041cc6be1

First draft of node for loading a method from the vtable of a hub.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 27 Apr 2013 22:03:54 +0200
parents ee75b4f569ed
children ee8cd087a731
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Sat Apr 27 21:41:44 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Sat Apr 27 22:03:54 2013 +0200
@@ -674,6 +674,18 @@
             ReadNode hub = graph.add(new ReadNode(object, location, StampFactory.forKind(wordKind())));
             tool.createNullCheckGuard(hub.dependencies(), object);
             graph.replaceFixed(loadHub, hub);
+        } else if (n instanceof LoadMethodNode) {
+            LoadMethodNode loadMethodNode = (LoadMethodNode) n;
+            HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) loadMethodNode.getMethod();
+            assert !hsMethod.getDeclaringClass().isInterface();
+
+            int vtableEntryOffset = hsMethod.vtableEntryOffset();
+            assert vtableEntryOffset > 0;
+            // We use LocationNode.ANY_LOCATION for the reads that access the vtable
+            // entry as HotSpot does not guarantee that this is a final value.
+            ReadNode metaspaceMethod = graph.add(new ReadNode(loadMethodNode.getHub(), ConstantLocationNode.create(LocationNode.ANY_LOCATION, wordKind, vtableEntryOffset, graph),
+                            StampFactory.forKind(wordKind())));
+            graph.replaceFixed(loadMethodNode, metaspaceMethod);
         } else if (n instanceof FixedGuardNode) {
             FixedGuardNode node = (FixedGuardNode) n;
             ValueAnchorNode newAnchor = graph.add(new ValueAnchorNode(tool.createGuard(node.condition(), node.getReason(), node.getAction(), node.isNegated())));