changeset 22672:f1c68b102fef

Avoid unnecessary array copy.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 22 Sep 2015 17:54:55 +0200
parents 37d7baeb6d7a
children 328bab1ca9e8
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java
diffstat 1 files changed, 2 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Sep 22 17:30:09 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Sep 22 17:54:55 2015 +0200
@@ -45,7 +45,6 @@
 import jdk.internal.jvmci.hotspot.CompilerToVM;
 import jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime;
 import jdk.internal.jvmci.hotspot.HotSpotProxified;
-import jdk.internal.jvmci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.internal.jvmci.hotspot.HotSpotStackFrameReference;
 import jdk.internal.jvmci.hotspot.HotSpotVMConfig;
 import jdk.internal.jvmci.inittimer.InitTimer;
@@ -226,35 +225,18 @@
 
     @Override
     public <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor) {
-        final HotSpotResolvedJavaMethod[] initialMetaMethods = toHotSpotResolvedJavaMethods(initialMethods);
-        final HotSpotResolvedJavaMethod[] matchingMetaMethods = toHotSpotResolvedJavaMethods(matchingMethods);
-
         CompilerToVM compilerToVM = runtime().getCompilerToVM();
-        HotSpotStackFrameReference current = compilerToVM.getNextStackFrame(null, initialMetaMethods, initialSkip);
+        HotSpotStackFrameReference current = compilerToVM.getNextStackFrame(null, initialMethods, initialSkip);
         while (current != null) {
             T result = visitor.visitFrame(current);
             if (result != null) {
                 return result;
             }
-            current = compilerToVM.getNextStackFrame(current, matchingMetaMethods, 0);
+            current = compilerToVM.getNextStackFrame(current, matchingMethods, 0);
         }
         return null;
     }
 
-    private static HotSpotResolvedJavaMethod[] toHotSpotResolvedJavaMethods(ResolvedJavaMethod[] methods) {
-        if (methods == null) {
-            return null;
-        } else if (methods instanceof HotSpotResolvedJavaMethod[]) {
-            return (HotSpotResolvedJavaMethod[]) methods;
-        } else {
-            HotSpotResolvedJavaMethod[] result = new HotSpotResolvedJavaMethod[methods.length];
-            for (int i = 0; i < result.length; i++) {
-                result[i] = (HotSpotResolvedJavaMethod) methods[i];
-            }
-            return result;
-        }
-    }
-
     private long runtimeStartTime;
 
     /**