changeset 17134:63b359cf25ad

Allow customization by subclasses
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 16 Sep 2014 18:52:39 -0700
parents 1a02fc45776f
children ceb34d2d124e
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Tue Sep 16 18:52:01 2014 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Tue Sep 16 18:52:39 2014 -0700
@@ -346,9 +346,9 @@
                 int entryCount = virtual.entryCount();
                 AbstractNewObjectNode newObject;
                 if (virtual instanceof VirtualInstanceNode) {
-                    newObject = graph.add(NewInstanceNode.create(virtual.type(), true));
+                    newObject = graph.add(createNewInstanceFromVirtual(virtual));
                 } else {
-                    newObject = graph.add(NewArrayNode.create(((VirtualArrayNode) virtual).componentType(), ConstantNode.forInt(entryCount, graph), true));
+                    newObject = graph.add(createNewArrayFromVirtual(virtual, ConstantNode.forInt(entryCount, graph)));
                 }
                 recursiveLowerings.add(newObject);
                 graph.addBeforeFixed(commit, newObject);
@@ -433,6 +433,14 @@
         }
     }
 
+    public NewInstanceNode createNewInstanceFromVirtual(VirtualObjectNode virtual) {
+        return NewInstanceNode.create(virtual.type(), true);
+    }
+
+    protected NewArrayNode createNewArrayFromVirtual(VirtualObjectNode virtual, ValueNode length) {
+        return NewArrayNode.create(((VirtualArrayNode) virtual).componentType(), length, true);
+    }
+
     public static void finishAllocatedObjects(LoweringTool tool, CommitAllocationNode commit, ValueNode[] allocations) {
         StructuredGraph graph = commit.graph();
         for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) {