changeset 12741:a5b5e1ebab81

Merge
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Sat, 09 Nov 2013 21:34:07 +0100
parents ad2434911b69 (diff) bb85b81258a0 (current diff)
children 40924dbc623b
files graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java
diffstat 7 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java	Sat Nov 09 12:04:24 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java	Sat Nov 09 21:34:07 2013 +0100
@@ -47,7 +47,11 @@
 
     @Override
     protected ResolvedJavaMethod registerMethodSubstitution(Member originalMethod, Method substituteMethod) {
-        if (substituteMethod.getDeclaringClass() == IntegerSubstitutions.class || substituteMethod.getDeclaringClass() == LongSubstitutions.class) {
+        if (substituteMethod.getDeclaringClass().getDeclaringClass() == BoxingSubstitutions.class) {
+            if (config.useHeapProfiler) {
+                return null;
+            }
+        } else if (substituteMethod.getDeclaringClass() == IntegerSubstitutions.class || substituteMethod.getDeclaringClass() == LongSubstitutions.class) {
             if (substituteMethod.getName().equals("bitCount")) {
                 if (!config.usePopCountInstruction) {
                     return null;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Sat Nov 09 12:04:24 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Sat Nov 09 21:34:07 2013 +0100
@@ -671,6 +671,7 @@
     }
 
     @HotSpotVMFlag(name = "GraalDeferredInitBarriers") @Stable public boolean useDeferredInitBarriers;
+    @HotSpotVMFlag(name = "GraalHProfEnabled") @Stable public boolean useHeapProfiler;
 
     // Compressed Oops related values.
     @HotSpotVMFlag(name = "UseCompressedOops") @Stable public boolean useCompressedOops;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java	Sat Nov 09 12:04:24 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopySnippets.java	Sat Nov 09 21:34:07 2013 +0100
@@ -98,7 +98,7 @@
                 srcOffset -= VECTOR_SIZE;
                 destOffset -= VECTOR_SIZE;
                 Long a = UnsafeLoadNode.load(src, arrayBaseOffset + srcOffset, VECTOR_KIND, locationIdentity);
-                UnsafeStoreNode.store(dest, arrayBaseOffset + destOffset, a.longValue(), VECTOR_KIND, locationIdentity);
+                UnsafeStoreNode.store(dest, arrayBaseOffset + destOffset, a, VECTOR_KIND, locationIdentity);
             }
             // Pre-loop
             for (long i = 0; i < preLoopBytes; i += elementSize) {
@@ -118,7 +118,7 @@
             // Main-loop
             for (long i = 0; i < mainLoopBytes; i += VECTOR_SIZE) {
                 Long a = UnsafeLoadNode.load(src, arrayBaseOffset + srcOffset, VECTOR_KIND, locationIdentity);
-                UnsafeStoreNode.store(dest, arrayBaseOffset + destOffset, a.longValue(), VECTOR_KIND, locationIdentity);
+                UnsafeStoreNode.store(dest, arrayBaseOffset + destOffset, a, VECTOR_KIND, locationIdentity);
                 srcOffset += VECTOR_SIZE;
                 destOffset += VECTOR_SIZE;
             }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java	Sat Nov 09 12:04:24 2013 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java	Sat Nov 09 21:34:07 2013 +0100
@@ -350,6 +350,13 @@
             unbox.replaceAtUsages(intrinsifiedNode);
             graph.removeFloating(unbox);
             Debug.log("%s: Removed an UnboxNode", Debug.contextSnapshot(JavaMethod.class));
+        } else if (usage instanceof UnsafeStoreNode) {
+            UnsafeStoreNode store = (UnsafeStoreNode) usage;
+            store.replaceFirstInput(input, intrinsifiedNode);
+        } else if (usage instanceof LoadFieldNode) {
+            LoadFieldNode load = (LoadFieldNode) usage;
+            load.replaceAtUsages(intrinsifiedNode);
+            graph.removeFixed(load);
         } else if (usage instanceof MethodCallTargetNode) {
             MethodCallTargetNode checkCastCallTarget = (MethodCallTargetNode) usage;
             assert checkCastCallTarget.targetMethod().getAnnotation(NodeIntrinsic.class) != null : "checkcast at " + sourceLocation(input) +
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Sat Nov 09 12:04:24 2013 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Sat Nov 09 21:34:07 2013 +0100
@@ -516,6 +516,7 @@
         Debug.dump(snippetCopy, "Before specialization");
         if (!nodeReplacements.isEmpty()) {
             // Do deferred intrinsification of node intrinsics
+            new CanonicalizerPhase(true).apply(snippetCopy, phaseContext);
             new NodeIntrinsificationPhase(providers).apply(snippetCopy);
             new CanonicalizerPhase(true).apply(snippetCopy, phaseContext);
         }
--- a/src/share/vm/graal/graalGlobals.hpp	Sat Nov 09 12:04:24 2013 +0100
+++ b/src/share/vm/graal/graalGlobals.hpp	Sat Nov 09 21:34:07 2013 +0100
@@ -58,6 +58,9 @@
   product(bool, GraalDeferredInitBarriers, true,                            \
           "Defer write barriers of young objects")                          \
                                                                             \
+  product(bool, GraalHProfEnabled, false,                                   \
+          "Is Heap  Profiler enabled")                                      \
+                                                                            \
   develop(bool, GraalUseFastLocking, true,                                  \
           "Use fast inlined locking code")                                  \
                                                                             \
--- a/src/share/vm/runtime/arguments.cpp	Sat Nov 09 12:04:24 2013 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Sat Nov 09 21:34:07 2013 +0100
@@ -2632,6 +2632,11 @@
           return JNI_ERR;
         }
 #endif // !INCLUDE_JVMTI
+#if defined(GRAAL)
+        if (strcmp(name, "hprof") == 0) {
+          FLAG_SET_CMDLINE(bool, GraalHProfEnabled, true);
+        }
+#endif
         add_init_library(name, options);
       }
     // -agentlib and -agentpath
@@ -2654,6 +2659,12 @@
           return JNI_ERR;
         }
 #endif // !INCLUDE_JVMTI
+#if defined(GRAAL)
+        if (valid_hprof_or_jdwp_agent(name, is_absolute_path)) {
+          FLAG_SET_CMDLINE(bool, GraalHProfEnabled, true);
+        }
+#endif
+
         add_init_agent(name, options, is_absolute_path);
       }
     // -javaagent