changeset 22498:280b0fbd8a40

adapt JVMCI changes for safe class redefinition
author Doug Simon <doug.simon@oracle.com>
date Mon, 24 Aug 2015 11:12:01 +0200
parents 32ccf2d5ed49
children 0e912e7580f9
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java mx.graal/suite.py
diffstat 6 files changed, 12 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Mon Aug 24 09:28:29 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Mon Aug 24 11:12:01 2015 +0200
@@ -249,7 +249,9 @@
             if ((config.ciTime || config.ciTimeEach) && installedCode != null) {
                 long timeUnitsPerSecond = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS);
                 CompilerToVM c2vm = jvmciRuntime.getCompilerToVM();
-                c2vm.notifyCompilationStatistics(id, method, entryBCI != Compiler.INVOCATION_ENTRY_BCI, compiledBytecodes, compilationTime, timeUnitsPerSecond, installedCode);
+                HotSpotResolvedJavaMethodImpl methodImpl = (HotSpotResolvedJavaMethodImpl) method;
+                c2vm.notifyCompilationStatistics(id, methodImpl, entryBCI != Compiler.INVOCATION_ENTRY_BCI, compiledBytecodes, compilationTime, timeUnitsPerSecond,
+                                installedCode);
             }
         }
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Mon Aug 24 09:28:29 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Mon Aug 24 11:12:01 2015 +0200
@@ -368,7 +368,7 @@
                         // Pre-load all classes in the constant pool.
                         try {
                             HotSpotResolvedObjectType objectType = HotSpotResolvedObjectTypeImpl.fromObjectClass(javaClass);
-                            ConstantPool constantPool = objectType.constantPool();
+                            ConstantPool constantPool = objectType.getConstantPool();
                             for (int cpi = 1; cpi < constantPool.length(); cpi++) {
                                 constantPool.loadReferencedType(cpi, HotSpotConstantPool.Bytecodes.LDC);
                             }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Mon Aug 24 09:28:29 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Mon Aug 24 11:12:01 2015 +0200
@@ -289,8 +289,8 @@
 
     @Override
     public <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor) {
-        final long[] initialMetaMethods = toMeta(initialMethods);
-        final long[] matchingMetaMethods = toMeta(matchingMethods);
+        final HotSpotResolvedJavaMethodImpl[] initialMetaMethods = toHotSpotResolvedJavaMethodImpls(initialMethods);
+        final HotSpotResolvedJavaMethodImpl[] matchingMetaMethods = toHotSpotResolvedJavaMethodImpls(matchingMethods);
 
         CompilerToVM compilerToVM = getCompilerToVM();
         HotSpotStackFrameReference current = compilerToVM.getNextStackFrame(null, initialMetaMethods, initialSkip);
@@ -304,13 +304,15 @@
         return null;
     }
 
-    private static long[] toMeta(ResolvedJavaMethod[] methods) {
+    private static HotSpotResolvedJavaMethodImpl[] toHotSpotResolvedJavaMethodImpls(ResolvedJavaMethod[] methods) {
         if (methods == null) {
             return null;
+        } else if (methods instanceof HotSpotResolvedJavaMethodImpl[]) {
+            return (HotSpotResolvedJavaMethodImpl[]) methods;
         } else {
-            long[] result = new long[methods.length];
+            HotSpotResolvedJavaMethodImpl[] result = new HotSpotResolvedJavaMethodImpl[methods.length];
             for (int i = 0; i < result.length; i++) {
-                result[i] = ((HotSpotResolvedJavaMethodImpl) methods[i]).getMetaspaceMethod();
+                result[i] = (HotSpotResolvedJavaMethodImpl) methods[i];
             }
             return result;
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java	Mon Aug 24 09:28:29 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.replacements;
-
-import jdk.internal.jvmci.hotspot.*;
-
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.word.*;
-
-/**
- * Substitutions for {@link CompilerToVMImpl} methods.
- */
-@ClassSubstitution(jdk.internal.jvmci.hotspot.CompilerToVMImpl.class)
-public class CompilerToVMImplSubstitutions {
-
-    @MethodSubstitution(isStatic = false)
-    public static Class<?> getJavaMirror(@SuppressWarnings("unused") CompilerToVMImpl impl, long metaspaceklass) {
-        return HotSpotClassSubstitutions.readJavaMirror(KlassPointer.fromWord(Word.unsigned(metaspaceklass)));
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Mon Aug 24 09:28:29 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Mon Aug 24 11:12:01 2015 +0200
@@ -23,7 +23,6 @@
 package com.oracle.graal.hotspot.replacements;
 
 import jdk.internal.jvmci.code.*;
-import jdk.internal.jvmci.hotspot.*;
 import jdk.internal.jvmci.meta.*;
 import jdk.internal.jvmci.service.*;
 import sun.reflect.*;
@@ -41,6 +40,5 @@
         replacements.registerSubstitutions(Thread.class, ThreadSubstitutions.class);
         replacements.registerSubstitutions(Reflection.class, ReflectionSubstitutions.class);
         replacements.registerSubstitutions(ConstantPool.class, ConstantPoolSubstitutions.class);
-        replacements.registerSubstitutions(CompilerToVMImpl.class, CompilerToVMImplSubstitutions.class);
     }
 }
--- a/mx.graal/suite.py	Mon Aug 24 09:28:29 2015 +0200
+++ b/mx.graal/suite.py	Mon Aug 24 11:12:01 2015 +0200
@@ -6,7 +6,7 @@
     "suites": [
             {
                "name" : "jvmci",
-               "version" : "ccfb5d9c5fc8ebebe6c02c9e58d17b9665b0bbcb",
+               "version" : "7ad03bf3d4a9a49a5207ca141426e0d31971889d",
                "urls" : [
                     {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"},
                     {"url" : "http://lafo.ssw.uni-linz.ac.at/nexus/content/repositories/snapshots", "kind" : "binary"},