# HG changeset patch # User Thomas Wuerthinger # Date 1339283868 -7200 # Node ID 70f715dfbb41381de9c0b072e0790a776dd94d73 # Parent 511612d1b5c1fb6e4d339dd897277da3a2ad8679 Bring Java renamings and restructurings to the C++ part. diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Sun Jun 10 01:17:48 2012 +0200 @@ -49,16 +49,16 @@ private final HotSpotGraalRuntime compiler; private final PhasePlan plan; - private final HotSpotMethodResolved method; + private final HotSpotResolvedJavaMethod method; private final OptimisticOptimizations optimisticOpts; private final int id; private final int priority; - public static CompilationTask create(HotSpotGraalRuntime compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) { + public static CompilationTask create(HotSpotGraalRuntime compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotResolvedJavaMethod method, int id, int priority) { return new CompilationTask(compiler, plan, optimisticOpts, method, id, priority); } - private CompilationTask(HotSpotGraalRuntime compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) { + private CompilationTask(HotSpotGraalRuntime compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotResolvedJavaMethod method, int id, int priority) { this.compiler = compiler; this.plan = plan; this.method = method; diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Sun Jun 10 01:17:48 2012 +0200 @@ -142,7 +142,7 @@ return vmToCompiler; } - public JavaType lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve) { + public JavaType lookupType(String returnType, HotSpotResolvedJavaType accessingClass, boolean eagerResolve) { if (returnType.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) { VMToCompilerImpl exitsNative = (VMToCompilerImpl) vmToCompiler; Kind kind = Kind.fromPrimitiveOrVoidTypeChar(returnType.charAt(0)); @@ -173,7 +173,7 @@ return exitsNative.typeVoid; } } - return compilerToVm.RiSignature_lookupType(returnType, accessingClass, eagerResolve); + return compilerToVm.Signature_lookupType(returnType, accessingClass, eagerResolve); } public HotSpotRuntime getRuntime() { diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotKlassOop.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotKlassOop.java Sun Jun 10 01:17:48 2012 +0200 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2012, 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; + +/** + * A mechanism for safely conveying a HotSpot klassOop value from the compiler to the C++ code. + * Such values should not be directly exposed to Java code as they are not real Java + * objects. For instance, invoking a method on them or using them in an instanceof + * expression will most likely crash the VM. + */ +public class HotSpotKlassOop extends CompilerObject { + + private static final long serialVersionUID = -5445542223575839143L; + + /** + * The Java object from which the klassOop value can be derived (by the C++ code). + */ + public final Class javaMirror; + + public HotSpotKlassOop(Class javaMirror) { + this.javaMirror = javaMirror; + } + + @Override + public String toString() { + return "HotSpotKlassOop<" + javaMirror.getName() + ">"; + } +} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java Sun Jun 10 01:17:48 2012 +0200 @@ -36,13 +36,13 @@ private static final long serialVersionUID = 7807321392203253218L; public final CompilationResult targetMethod; - public final HotSpotMethodResolved method; // used only for methods + public final HotSpotResolvedJavaMethod method; // used only for methods public final String name; // used only for stubs public final Site[] sites; public final ExceptionHandler[] exceptionHandlers; - public HotSpotTargetMethod(HotSpotMethodResolved method, CompilationResult targetMethod) { + public HotSpotTargetMethod(HotSpotResolvedJavaMethod method, CompilationResult targetMethod) { this.method = method; this.targetMethod = targetMethod; this.name = null; diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Sun Jun 10 01:17:48 2012 +0200 @@ -37,83 +37,83 @@ // Checkstyle: stop - byte[] RiMethod_code(HotSpotMethodResolved method); + byte[] JavaMethod_code(HotSpotResolvedJavaMethod method); - String RiMethod_signature(HotSpotMethodResolved method); + String JavaMethod_signature(HotSpotResolvedJavaMethod method); - ExceptionHandler[] RiMethod_exceptionHandlers(HotSpotMethodResolved method); + ExceptionHandler[] JavaMethod_exceptionHandlers(HotSpotResolvedJavaMethod method); - boolean RiMethod_hasBalancedMonitors(HotSpotMethodResolved method); + boolean JavaMethod_hasBalancedMonitors(HotSpotResolvedJavaMethod method); - JavaMethod RiMethod_uniqueConcreteMethod(HotSpotMethodResolved method); + JavaMethod JavaMethod_uniqueConcreteMethod(HotSpotResolvedJavaMethod method); - int RiMethod_invocationCount(HotSpotMethodResolved method); + int JavaMethod_invocationCount(HotSpotResolvedJavaMethod method); - HotSpotMethodData RiMethod_methodData(HotSpotMethodResolved method); + HotSpotMethodData JavaMethod_methodData(HotSpotResolvedJavaMethod method); - JavaType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve); + JavaType Signature_lookupType(String returnType, HotSpotResolvedJavaType accessingClass, boolean eagerResolve); - Object RiConstantPool_lookupConstant(HotSpotTypeResolved pool, int cpi); + Object ConstantPool_lookupConstant(HotSpotResolvedJavaType pool, int cpi); - JavaMethod RiConstantPool_lookupMethod(HotSpotTypeResolved pool, int cpi, byte byteCode); + JavaMethod ConstantPool_lookupMethod(HotSpotResolvedJavaType pool, int cpi, byte byteCode); - JavaType RiConstantPool_lookupType(HotSpotTypeResolved pool, int cpi); + JavaType ConstantPool_lookupType(HotSpotResolvedJavaType pool, int cpi); - JavaField RiConstantPool_lookupField(HotSpotTypeResolved pool, int cpi, byte byteCode); + JavaField ConstantPool_lookupField(HotSpotResolvedJavaType pool, int cpi, byte byteCode); - void RiConstantPool_loadReferencedType(HotSpotTypeResolved pool, int cpi, byte byteCode); + void ConstantPool_loadReferencedType(HotSpotResolvedJavaType pool, int cpi, byte byteCode); HotSpotCompiledMethod installMethod(HotSpotTargetMethod targetMethod, boolean makeDefault, HotSpotCodeInfo info); HotSpotVMConfig getConfiguration(); - JavaMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); + JavaMethod JavaType_resolveMethodImpl(HotSpotResolvedJavaType klass, String name, String signature); - boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, JavaType other); + boolean JavaType_isSubtypeOf(HotSpotResolvedJavaType klass, JavaType other); - JavaType RiType_leastCommonAncestor(HotSpotTypeResolved thisType, HotSpotTypeResolved otherType); + JavaType JavaType_leastCommonAncestor(HotSpotResolvedJavaType thisType, HotSpotResolvedJavaType otherType); JavaType getPrimitiveArrayType(Kind kind); - JavaType RiType_arrayOf(HotSpotTypeResolved klass); + JavaType JavaType_arrayOf(HotSpotResolvedJavaType klass); - JavaType RiType_componentType(HotSpotTypeResolved klass); + JavaType JavaType_componentType(HotSpotResolvedJavaType klass); - boolean RiType_isInitialized(HotSpotTypeResolved klass); + boolean JavaType_isInitialized(HotSpotResolvedJavaType klass); JavaType getType(Class javaClass); - JavaType RiType_uniqueConcreteSubtype(HotSpotTypeResolved klass); + JavaType JavaType_uniqueConcreteSubtype(HotSpotResolvedJavaType klass); - JavaType RiType_superType(HotSpotTypeResolved klass); + JavaType JavaType_superType(HotSpotResolvedJavaType klass); int getArrayLength(Constant array); boolean compareConstantObjects(Constant x, Constant y); - JavaType getRiType(Constant constant); + JavaType getJavaType(Constant constant); - ResolvedJavaField[] RiType_fields(HotSpotTypeResolved klass); + ResolvedJavaField[] JavaType_fields(HotSpotResolvedJavaType klass); - boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); + boolean JavaMethod_hasCompiledCode(HotSpotResolvedJavaMethod method); - int RiMethod_getCompiledCodeSize(HotSpotMethodResolved method); + int JavaMethod_getCompiledCodeSize(HotSpotResolvedJavaMethod method); - JavaMethod getRiMethod(Method reflectionMethod); + JavaMethod getJavaMethod(Method reflectionMethod); long getMaxCallTargetOffset(RuntimeCall rtcall); String disassembleNative(byte[] code, long address); - String disassembleJava(HotSpotMethodResolved method); + String disassembleJava(HotSpotResolvedJavaMethod method); - StackTraceElement RiMethod_toStackTraceElement(HotSpotMethodResolved method, int bci); + StackTraceElement JavaMethod_toStackTraceElement(HotSpotResolvedJavaMethod method, int bci); Object executeCompiledMethod(HotSpotCompiledMethod method, Object arg1, Object arg2, Object arg3); Object executeCompiledMethodVarargs(HotSpotCompiledMethod method, Object... args); - int RiMethod_vtableEntryOffset(HotSpotMethodResolved method); + int JavaMethod_vtableEntryOffset(HotSpotResolvedJavaMethod method); long[] getDeoptedLeafGraphIds(); diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Sun Jun 10 01:17:48 2012 +0200 @@ -38,43 +38,43 @@ // Checkstyle: stop @Override - public native JavaMethod getRiMethod(Method reflectionMethod); + public native JavaMethod getJavaMethod(Method reflectionMethod); @Override - public native byte[] RiMethod_code(HotSpotMethodResolved method); + public native byte[] JavaMethod_code(HotSpotResolvedJavaMethod method); @Override - public native String RiMethod_signature(HotSpotMethodResolved method); + public native String JavaMethod_signature(HotSpotResolvedJavaMethod method); @Override - public native ExceptionHandler[] RiMethod_exceptionHandlers(HotSpotMethodResolved method); + public native ExceptionHandler[] JavaMethod_exceptionHandlers(HotSpotResolvedJavaMethod method); @Override - public native boolean RiMethod_hasBalancedMonitors(HotSpotMethodResolved method); + public native boolean JavaMethod_hasBalancedMonitors(HotSpotResolvedJavaMethod method); @Override - public native JavaMethod RiMethod_uniqueConcreteMethod(HotSpotMethodResolved method); + public native JavaMethod JavaMethod_uniqueConcreteMethod(HotSpotResolvedJavaMethod method); @Override - public native int RiMethod_invocationCount(HotSpotMethodResolved method); + public native int JavaMethod_invocationCount(HotSpotResolvedJavaMethod method); @Override - public native JavaType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve); + public native JavaType Signature_lookupType(String returnType, HotSpotResolvedJavaType accessingClass, boolean eagerResolve); @Override - public native Object RiConstantPool_lookupConstant(HotSpotTypeResolved pool, int cpi); + public native Object ConstantPool_lookupConstant(HotSpotResolvedJavaType pool, int cpi); @Override - public native JavaMethod RiConstantPool_lookupMethod(HotSpotTypeResolved pool, int cpi, byte byteCode); + public native JavaMethod ConstantPool_lookupMethod(HotSpotResolvedJavaType pool, int cpi, byte byteCode); @Override - public native JavaType RiConstantPool_lookupType(HotSpotTypeResolved pool, int cpi); + public native JavaType ConstantPool_lookupType(HotSpotResolvedJavaType pool, int cpi); @Override - public native void RiConstantPool_loadReferencedType(HotSpotTypeResolved pool, int cpi, byte byteCode); + public native void ConstantPool_loadReferencedType(HotSpotResolvedJavaType pool, int cpi, byte byteCode); @Override - public native JavaField RiConstantPool_lookupField(HotSpotTypeResolved pool, int cpi, byte byteCode); + public native JavaField ConstantPool_lookupField(HotSpotResolvedJavaType pool, int cpi, byte byteCode); @Override public native HotSpotCompiledMethod installMethod(HotSpotTargetMethod targetMethod, boolean makeDefault, HotSpotCodeInfo info); @@ -83,34 +83,34 @@ public native HotSpotVMConfig getConfiguration(); @Override - public native JavaMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); + public native JavaMethod JavaType_resolveMethodImpl(HotSpotResolvedJavaType klass, String name, String signature); @Override - public native boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, JavaType other); + public native boolean JavaType_isSubtypeOf(HotSpotResolvedJavaType klass, JavaType other); @Override - public native JavaType RiType_leastCommonAncestor(HotSpotTypeResolved thisType, HotSpotTypeResolved otherType); + public native JavaType JavaType_leastCommonAncestor(HotSpotResolvedJavaType thisType, HotSpotResolvedJavaType otherType); @Override public native JavaType getPrimitiveArrayType(Kind kind); @Override - public native JavaType RiType_arrayOf(HotSpotTypeResolved klass); + public native JavaType JavaType_arrayOf(HotSpotResolvedJavaType klass); @Override - public native JavaType RiType_componentType(HotSpotTypeResolved klass); + public native JavaType JavaType_componentType(HotSpotResolvedJavaType klass); @Override - public native JavaType RiType_uniqueConcreteSubtype(HotSpotTypeResolved klass); + public native JavaType JavaType_uniqueConcreteSubtype(HotSpotResolvedJavaType klass); @Override - public native JavaType RiType_superType(HotSpotTypeResolved klass); + public native JavaType JavaType_superType(HotSpotResolvedJavaType klass); @Override - public native boolean RiType_isInitialized(HotSpotTypeResolved klass); + public native boolean JavaType_isInitialized(HotSpotResolvedJavaType klass); @Override - public native HotSpotMethodData RiMethod_methodData(HotSpotMethodResolved method); + public native HotSpotMethodData JavaMethod_methodData(HotSpotResolvedJavaMethod method); @Override public native JavaType getType(Class javaClass); @@ -126,7 +126,7 @@ } @Override - public JavaType getRiType(Constant constant) { + public JavaType getJavaType(Constant constant) { Object o = constant.asObject(); if (o == null) { return null; @@ -135,13 +135,13 @@ } @Override - public native ResolvedJavaField[] RiType_fields(HotSpotTypeResolved klass); + public native ResolvedJavaField[] JavaType_fields(HotSpotResolvedJavaType klass); @Override - public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); + public native boolean JavaMethod_hasCompiledCode(HotSpotResolvedJavaMethod method); @Override - public native int RiMethod_getCompiledCodeSize(HotSpotMethodResolved method); + public native int JavaMethod_getCompiledCodeSize(HotSpotResolvedJavaMethod method); @Override public native long getMaxCallTargetOffset(RuntimeCall rtcall); @@ -150,10 +150,10 @@ public native String disassembleNative(byte[] code, long address); @Override - public native String disassembleJava(HotSpotMethodResolved method); + public native String disassembleJava(HotSpotResolvedJavaMethod method); @Override - public native StackTraceElement RiMethod_toStackTraceElement(HotSpotMethodResolved method, int bci); + public native StackTraceElement JavaMethod_toStackTraceElement(HotSpotResolvedJavaMethod method, int bci); @Override public native Object executeCompiledMethod(HotSpotCompiledMethod method, Object arg1, Object arg2, Object arg3); @@ -162,7 +162,7 @@ public native Object executeCompiledMethodVarargs(HotSpotCompiledMethod method, Object... args); @Override - public native int RiMethod_vtableEntryOffset(HotSpotMethodResolved method); + public native int JavaMethod_vtableEntryOffset(HotSpotResolvedJavaMethod method); @Override public native long[] getDeoptedLeafGraphIds(); diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java Sun Jun 10 01:17:48 2012 +0200 @@ -35,7 +35,7 @@ */ public interface VMToCompiler { - boolean compileMethod(HotSpotMethodResolved method, int entryBCI, boolean blocking, int priority) throws Throwable; + boolean compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, boolean blocking, int priority) throws Throwable; void shutdownCompiler() throws Throwable; @@ -45,25 +45,23 @@ PrintStream log(); - JavaMethod createRiMethodUnresolved(String name, String signature, JavaType holder); + JavaMethod createJavaMethod(String name, String signature, JavaType holder); - Signature createRiSignature(String signature); + Signature createSignature(String signature); - JavaField createRiField(JavaType holder, String name, JavaType type, int offset, int flags); + JavaField createJavaField(JavaType holder, String name, JavaType type, int offset, int flags); - JavaType createRiType(HotSpotConstantPool pool, String name); - - JavaType createRiTypePrimitive(int basicType); + JavaType createPrimitiveJavaType(int basicType); - JavaType createRiTypeUnresolved(String name); + JavaType createJavaType(String name); - Constant createCiConstant(Kind kind, long value); + Constant createConstant(Kind kind, long value); - Constant createCiConstantFloat(float value); + Constant createConstantFloat(float value); - Constant createCiConstantDouble(double value); + Constant createConstantDouble(double value); - Constant createCiConstantObject(Object object); + Constant createConstantObject(Object object); PhasePlan createPhasePlan(OptimisticOptimizations optimisticOpts); } diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Sun Jun 10 01:17:48 2012 +0200 @@ -223,8 +223,8 @@ private void enqueue(Method m) throws Throwable { JavaMethod riMethod = compiler.getRuntime().getResolvedJavaMethod(m); - assert !Modifier.isAbstract(((HotSpotMethodResolved) riMethod).accessFlags()) && !Modifier.isNative(((HotSpotMethodResolved) riMethod).accessFlags()) : riMethod; - compileMethod((HotSpotMethodResolved) riMethod, 0, false, 10); + assert !Modifier.isAbstract(((HotSpotResolvedJavaMethod) riMethod).accessFlags()) && !Modifier.isNative(((HotSpotResolvedJavaMethod) riMethod).accessFlags()) : riMethod; + compileMethod((HotSpotResolvedJavaMethod) riMethod, 0, false, 10); } private static void shutdownCompileQueue(ThreadPoolExecutor queue) throws InterruptedException { @@ -349,7 +349,7 @@ } @Override - public boolean compileMethod(final HotSpotMethodResolved method, final int entryBCI, boolean blocking, int priority) throws Throwable { + public boolean compileMethod(final HotSpotResolvedJavaMethod method, final int entryBCI, boolean blocking, int priority) throws Throwable { if (CompilationTask.withinEnqueue.get()) { // This is required to avoid deadlocking a compiler thread. The issue is that a // java.util.concurrent.BlockingQueue is used to implement the compilation worker @@ -396,31 +396,26 @@ } @Override - public JavaMethod createRiMethodUnresolved(String name, String signature, JavaType holder) { + public JavaMethod createJavaMethod(String name, String signature, JavaType holder) { return new HotSpotMethodUnresolved(name, signature, holder); } @Override - public Signature createRiSignature(String signature) { + public Signature createSignature(String signature) { return new HotSpotSignature(signature); } @Override - public JavaField createRiField(JavaType holder, String name, JavaType type, int offset, int flags) { + public JavaField createJavaField(JavaType holder, String name, JavaType type, int offset, int flags) { if (offset != -1) { - HotSpotTypeResolved resolved = (HotSpotTypeResolved) holder; + HotSpotResolvedJavaType resolved = (HotSpotResolvedJavaType) holder; return resolved.createRiField(name, type, offset, flags); } return new BaseUnresolvedField(holder, name, type); } @Override - public JavaType createRiType(HotSpotConstantPool pool, String name) { - throw new RuntimeException("not implemented"); - } - - @Override - public JavaType createRiTypePrimitive(int basicType) { + public ResolvedJavaType createPrimitiveJavaType(int basicType) { switch (basicType) { case 4: return typeBoolean; @@ -446,12 +441,12 @@ } @Override - public JavaType createRiTypeUnresolved(String name) { + public JavaType createJavaType(String name) { return new HotSpotTypeUnresolved(name); } @Override - public Constant createCiConstant(Kind kind, long value) { + public Constant createConstant(Kind kind, long value) { if (kind == Kind.Long) { return Constant.forLong(value); } else if (kind == Kind.Int) { @@ -470,17 +465,17 @@ } @Override - public Constant createCiConstantFloat(float value) { + public Constant createConstantFloat(float value) { return Constant.forFloat(value); } @Override - public Constant createCiConstantDouble(double value) { + public Constant createConstantDouble(double value) { return Constant.forDouble(value); } @Override - public Constant createCiConstantObject(Object object) { + public Constant createConstantObject(Object object) { return Constant.forObject(object); } diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java Sun Jun 10 01:17:48 2012 +0200 @@ -36,9 +36,9 @@ private long start; private byte[] code; public final CompilationResult targetMethod; - private HotSpotMethodResolved method; + private HotSpotResolvedJavaMethod method; - public HotSpotCodeInfo(CompilationResult targetMethod, HotSpotMethodResolved method) { + public HotSpotCodeInfo(CompilationResult targetMethod, HotSpotResolvedJavaMethod method) { assert targetMethod != null; this.method = method; this.targetMethod = targetMethod; diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java Sun Jun 10 01:17:48 2012 +0200 @@ -32,15 +32,15 @@ private static final long serialVersionUID = -5443206401485234850L; - private final HotSpotTypeResolvedImpl type; + private final HotSpotResolvedJavaType type; - public HotSpotConstantPool(HotSpotTypeResolvedImpl type) { + public HotSpotConstantPool(HotSpotResolvedJavaType type) { this.type = type; } @Override public Object lookupConstant(int cpi) { - Object constant = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupConstant(type, cpi); + Object constant = HotSpotGraalRuntime.getInstance().getCompilerToVM().ConstantPool_lookupConstant(type, cpi); return constant; } @@ -51,21 +51,21 @@ @Override public JavaMethod lookupMethod(int cpi, int byteCode) { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupMethod(type, cpi, (byte) byteCode); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().ConstantPool_lookupMethod(type, cpi, (byte) byteCode); } @Override public JavaType lookupType(int cpi, int opcode) { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupType(type, cpi); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().ConstantPool_lookupType(type, cpi); } @Override public JavaField lookupField(int cpi, int opcode) { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupField(type, cpi, (byte) opcode); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().ConstantPool_lookupField(type, cpi, (byte) opcode); } @Override public void loadReferencedType(int cpi, int bytecode) { - HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_loadReferencedType(type, cpi, (byte) bytecode); + HotSpotGraalRuntime.getInstance().getCompilerToVM().ConstantPool_loadReferencedType(type, cpi, (byte) bytecode); } } diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotField.java Sat Jun 09 22:50:50 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2011, 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.meta; - -import java.lang.annotation.*; -import java.lang.reflect.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaType.*; -import com.oracle.graal.compiler.*; -import com.oracle.graal.hotspot.*; - -/** - * Represents a field in a HotSpot type. - */ -public class HotSpotField extends CompilerObject implements ResolvedJavaField { - - private static final long serialVersionUID = 7692985878836955683L; - private final ResolvedJavaType holder; - private final String name; - private final JavaType type; - private final int offset; - private final int accessFlags; - private Constant constant; // Constant part only valid for static fields. - - public HotSpotField(ResolvedJavaType holder, String name, JavaType type, int offset, int accessFlags) { - this.holder = holder; - this.name = name; - this.type = type; - assert offset != -1; - this.offset = offset; - this.accessFlags = accessFlags; - } - - @Override - public int accessFlags() { - return accessFlags; - } - - @Override - public Constant constantValue(Constant receiver) { - if (receiver == null) { - assert Modifier.isStatic(accessFlags); - if (constant == null) { - if (holder.isInitialized() && holder.toJava() != System.class) { - if (Modifier.isFinal(accessFlags()) || assumeStaticFieldsFinal(holder.toJava())) { - Constant encoding = holder.getEncoding(Representation.StaticFields); - constant = this.kind().readUnsafeConstant(encoding.asObject(), offset); - } - } - } - return constant; - } else { - assert !Modifier.isStatic(accessFlags); - // TODO (chaeubl) HotSpot does not trust final non-static fields (see ciField.cpp) - if (Modifier.isFinal(accessFlags())) { - return this.kind().readUnsafeConstant(receiver.asObject(), offset); - } - } - return null; - } - - private static boolean assumeStaticFieldsFinal(Class< ? > clazz) { - return clazz == GraalOptions.class; - } - - @Override - public ResolvedJavaType holder() { - return holder; - } - - @Override - public Kind kind() { - return type().kind(); - } - - @Override - public String name() { - return name; - } - - @Override - public JavaType type() { - return type; - } - - public int offset() { - return offset; - } - - @Override - public String toString() { - return "HotSpotField<" + CodeUtil.format("%h.%n", this) + ":" + offset + ">"; - } - - @Override - public T getAnnotation(Class annotationClass) { - Field javaField = toJava(); - if (javaField != null) { - return javaField.getAnnotation(annotationClass); - } - return null; - } - - private Field toJava() { - try { - return holder.toJava().getDeclaredField(name); - } catch (NoSuchFieldException e) { - return null; - } - } -} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java Sun Jun 10 01:17:48 2012 +0200 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2011, 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.meta; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.hotspot.*; + +/** + * Common interface for all HotSpot RiType-implementations. + */ +public abstract class HotSpotJavaType extends CompilerObject implements JavaType { + private static final long serialVersionUID = -4252886265301910771L; + protected String name; + + @Override + public final String name() { + return name; + } + + /** + * Gets the object representing the C++ klassOop for this type. + * Such a value cannot be safely exposed to Java code. + */ + public abstract HotSpotKlassOop klassOop(); +} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotKlassOop.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotKlassOop.java Sat Jun 09 22:50:50 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2012, 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.meta; - -import com.oracle.graal.hotspot.*; - -/** - * A mechanism for safely conveying a HotSpot klassOop value from the compiler to the C++ code. - * Such values should not be directly exposed to Java code as they are not real Java - * objects. For instance, invoking a method on them or using them in an instanceof - * expression will most likely crash the VM. - */ -public class HotSpotKlassOop extends CompilerObject { - - private static final long serialVersionUID = -5445542223575839143L; - - /** - * The Java object from which the klassOop value can be derived (by the C++ code). - */ - public final Class javaMirror; - - public HotSpotKlassOop(Class javaMirror) { - this.javaMirror = javaMirror; - } - - @Override - public String toString() { - return "HotSpotKlassOop<" + javaMirror.getName() + ">"; - } -} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodResolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodResolved.java Sat Jun 09 22:50:50 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2011, 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.meta; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; - -public interface HotSpotMethodResolved extends ResolvedJavaMethod { - - ResolvedJavaMethod uniqueConcreteMethod(); - int vtableEntryOffset(); - - void setCurrentTask(CompilationTask task); - CompilationTask currentTask(); -} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodResolvedImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodResolvedImpl.java Sat Jun 09 22:50:50 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2011, 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.meta; - -import java.io.*; -import java.lang.annotation.*; -import java.lang.reflect.*; -import java.util.*; -import java.util.concurrent.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.*; -import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.counters.*; -import com.oracle.graal.java.bytecode.*; -import com.oracle.max.criutils.*; - -/** - * Implementation of RiMethod for resolved HotSpot methods. - */ -public final class HotSpotMethodResolvedImpl extends HotSpotMethod implements HotSpotMethodResolved { - - private static final long serialVersionUID = -5486975070147586588L; - - /** DO NOT USE IN JAVA CODE! */ - @SuppressWarnings("unused") - @Deprecated - private Object javaMirror; - - // cached values - private final int codeSize; - private final int accessFlags; - private final int maxLocals; - private final int maxStackSize; - private Signature signature; - private Boolean hasBalancedMonitors; - private Map compilerStorage; - private ResolvedJavaType holder; - private HotSpotMethodData methodData; - private byte[] code; - private boolean canBeInlined; - private int compilationComplexity; - - private CompilationTask currentTask; - - private HotSpotMethodResolvedImpl() { - throw new IllegalStateException("this constructor is never actually called, because the objects are allocated from within the VM"); - } - - @Override - public ResolvedJavaType holder() { - return holder; - } - - @Override - public int accessFlags() { - return accessFlags; - } - - @Override - public boolean canBeStaticallyBound() { - return isLeafMethod() || Modifier.isStatic(accessFlags()); - } - - @Override - public byte[] code() { - if (code == null) { - code = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_code(this); - assert code.length == codeSize : "expected: " + codeSize + ", actual: " + code.length; - } - return code; - } - - @Override - public int codeSize() { - return codeSize; - } - - @Override - public ExceptionHandler[] exceptionHandlers() { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_exceptionHandlers(this); - } - - @Override - public boolean hasBalancedMonitors() { - if (hasBalancedMonitors == null) { - hasBalancedMonitors = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_hasBalancedMonitors(this); - } - return hasBalancedMonitors; - } - - @Override - public boolean isClassInitializer() { - return "".equals(name) && Modifier.isStatic(accessFlags()); - } - - @Override - public boolean isConstructor() { - return "".equals(name) && !Modifier.isStatic(accessFlags()); - } - - @Override - public boolean isLeafMethod() { - return Modifier.isFinal(accessFlags()) || Modifier.isPrivate(accessFlags()); - } - - @Override - public String jniSymbol() { - throw new UnsupportedOperationException("jniSymbol"); - } - - @Override - public int maxLocals() { - return maxLocals; - } - - @Override - public int maxStackSize() { - return maxStackSize; - } - - @Override - public StackTraceElement toStackTraceElement(int bci) { - if (bci < 0 || bci >= codeSize) { - // HotSpot code can only construct stack trace elements for valid bcis - StackTraceElement ste = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, 0); - return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1); - } - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, bci); - } - - @Override - public ResolvedJavaMethod uniqueConcreteMethod() { - return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_uniqueConcreteMethod(this); - } - - @Override - public Signature signature() { - if (signature == null) { - signature = new HotSpotSignature(HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_signature(this)); - } - return signature; - } - - @Override - public String toString() { - return "HotSpotMethod<" + CodeUtil.format("%h.%n", this) + ">"; - } - - public boolean hasCompiledCode() { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_hasCompiledCode(this); - } - - public int compiledCodeSize() { - int result = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_getCompiledCodeSize(this); - if (result > 0) { - assert result > MethodEntryCounters.getCodeSize(); - result = result - MethodEntryCounters.getCodeSize(); - } - return result; - } - - @Override - public int invocationCount() { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_invocationCount(this); - } - - @Override - public int compilationComplexity() { - if (compilationComplexity <= 0 && codeSize() > 0) { - BytecodeStream s = new BytecodeStream(code()); - int result = 0; - int currentBC; - while ((currentBC = s.currentBC()) != Bytecodes.END) { - result += Bytecodes.compilationComplexity(currentBC); - s.next(); - } - assert result > 0; - compilationComplexity = result; - } - return compilationComplexity; - } - - private static final MethodFilter profilingInfoFilter = GraalOptions.PIFilter == null ? null : new MethodFilter(GraalOptions.PIFilter); - - /** - * Determines if the profiling info cache should be used for this method. - */ - private boolean useProfilingInfoCache() { - return GraalOptions.PICache != null && (profilingInfoFilter == null || profilingInfoFilter.matches(this)); - } - - private ProfilingInfo loadProfilingInfo() { - if (!useProfilingInfoCache()) { - return null; - } - synchronized (this) { - File file = new File(GraalOptions.PICache, JniMangle.mangleMethod(holder, name, signature(), false)); - if (file.exists()) { - try { - SnapshotProfilingInfo snapshot = SnapshotProfilingInfo.load(file, HotSpotGraalRuntime.getInstance().getRuntime()); - if (snapshot.codeSize() != codeSize) { - // The class file was probably changed - ignore the saved profile - return null; - } - return snapshot; - } catch (Exception e) { - // ignore - } - } - return null; - } - } - - private void saveProfilingInfo(ProfilingInfo info) { - if (useProfilingInfoCache()) { - synchronized (this) { - String base = JniMangle.mangleMethod(holder, name, signature(), false); - File file = new File(GraalOptions.PICache, base); - File txtFile = new File(GraalOptions.PICache, base + ".txt"); - SnapshotProfilingInfo snapshot = info instanceof SnapshotProfilingInfo ? (SnapshotProfilingInfo) info : new SnapshotProfilingInfo(info); - try { - snapshot.save(file, txtFile); - } catch (IOException e) { - // ignore - } - } - } - } - - @Override - public ProfilingInfo profilingInfo() { - ProfilingInfo info = loadProfilingInfo(); - if (info != null) { - return info; - } - - if (GraalOptions.UseProfilingInformation && methodData == null) { - methodData = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_methodData(this); - } - - if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { - // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in case of a deoptimization. - info = BaseProfilingInfo.get(ExceptionSeen.FALSE); - } else { - info = new HotSpotProfilingInfo(methodData, codeSize); - saveProfilingInfo(info); - } - return info; - } - - @Override - public Map compilerStorage() { - if (compilerStorage == null) { - compilerStorage = new ConcurrentHashMap<>(); - } - return compilerStorage; - } - - @Override - public ConstantPool getConstantPool() { - return ((HotSpotTypeResolvedImpl) holder()).constantPool(); - } - - @Override - public Annotation[][] getParameterAnnotations() { - if (isConstructor()) { - Constructor javaConstructor = toJavaConstructor(); - return javaConstructor == null ? null : javaConstructor.getParameterAnnotations(); - } - Method javaMethod = toJava(); - return javaMethod == null ? null : javaMethod.getParameterAnnotations(); - } - - @Override - public T getAnnotation(Class annotationClass) { - if (isConstructor()) { - Constructor javaConstructor = toJavaConstructor(); - return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass); - } - Method javaMethod = toJava(); - return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass); - } - - @Override - public Type[] getGenericParameterTypes() { - if (isConstructor()) { - Constructor javaConstructor = toJavaConstructor(); - return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes(); - } - Method javaMethod = toJava(); - return javaMethod == null ? null : javaMethod.getGenericParameterTypes(); - } - - private Method toJava() { - try { - return holder.toJava().getDeclaredMethod(name, CodeUtil.signatureToTypes(signature(), holder)); - } catch (NoSuchMethodException e) { - return null; - } - } - - private Constructor toJavaConstructor() { - try { - return holder.toJava().getDeclaredConstructor(CodeUtil.signatureToTypes(signature(), holder)); - } catch (NoSuchMethodException e) { - return null; - } - } - - @Override - public boolean canBeInlined() { - return canBeInlined; - } - - @Override - public int vtableEntryOffset() { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_vtableEntryOffset(this); - } - - @Override - public void setCurrentTask(CompilationTask task) { - currentTask = task; - } - - @Override - public CompilationTask currentTask() { - return currentTask; - } -} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Sun Jun 10 01:17:48 2012 +0200 @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2011, 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.meta; + +import java.lang.annotation.*; +import java.lang.reflect.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.meta.JavaType.*; +import com.oracle.graal.compiler.*; +import com.oracle.graal.hotspot.*; + +/** + * Represents a field in a HotSpot type. + */ +public class HotSpotResolvedJavaField extends CompilerObject implements ResolvedJavaField { + + private static final long serialVersionUID = 7692985878836955683L; + private final ResolvedJavaType holder; + private final String name; + private final JavaType type; + private final int offset; + private final int accessFlags; + private Constant constant; // Constant part only valid for static fields. + + public HotSpotResolvedJavaField(ResolvedJavaType holder, String name, JavaType type, int offset, int accessFlags) { + this.holder = holder; + this.name = name; + this.type = type; + assert offset != -1; + this.offset = offset; + this.accessFlags = accessFlags; + } + + @Override + public int accessFlags() { + return accessFlags; + } + + @Override + public Constant constantValue(Constant receiver) { + if (receiver == null) { + assert Modifier.isStatic(accessFlags); + if (constant == null) { + if (holder.isInitialized() && holder.toJava() != System.class) { + if (Modifier.isFinal(accessFlags()) || assumeStaticFieldsFinal(holder.toJava())) { + Constant encoding = holder.getEncoding(Representation.StaticFields); + constant = this.kind().readUnsafeConstant(encoding.asObject(), offset); + } + } + } + return constant; + } else { + assert !Modifier.isStatic(accessFlags); + // TODO (chaeubl) HotSpot does not trust final non-static fields (see ciField.cpp) + if (Modifier.isFinal(accessFlags())) { + return this.kind().readUnsafeConstant(receiver.asObject(), offset); + } + } + return null; + } + + private static boolean assumeStaticFieldsFinal(Class< ? > clazz) { + return clazz == GraalOptions.class; + } + + @Override + public ResolvedJavaType holder() { + return holder; + } + + @Override + public Kind kind() { + return type().kind(); + } + + @Override + public String name() { + return name; + } + + @Override + public JavaType type() { + return type; + } + + public int offset() { + return offset; + } + + @Override + public String toString() { + return "HotSpotField<" + CodeUtil.format("%h.%n", this) + ":" + offset + ">"; + } + + @Override + public T getAnnotation(Class annotationClass) { + Field javaField = toJava(); + if (javaField != null) { + return javaField.getAnnotation(annotationClass); + } + return null; + } + + private Field toJava() { + try { + return holder.toJava().getDeclaredField(name); + } catch (NoSuchFieldException e) { + return null; + } + } +} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Sun Jun 10 01:17:48 2012 +0200 @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2011, 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.meta; + +import java.io.*; +import java.lang.annotation.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.concurrent.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.*; +import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.counters.*; +import com.oracle.graal.java.bytecode.*; +import com.oracle.max.criutils.*; + +/** + * Implementation of RiMethod for resolved HotSpot methods. + */ +public final class HotSpotResolvedJavaMethod extends HotSpotMethod implements ResolvedJavaMethod { + + private static final long serialVersionUID = -5486975070147586588L; + + /** DO NOT USE IN JAVA CODE! */ + @SuppressWarnings("unused") + @Deprecated + private Object javaMirror; + + // cached values + private final int codeSize; + private final int accessFlags; + private final int maxLocals; + private final int maxStackSize; + private Signature signature; + private Boolean hasBalancedMonitors; + private Map compilerStorage; + private ResolvedJavaType holder; + private HotSpotMethodData methodData; + private byte[] code; + private boolean canBeInlined; + private int compilationComplexity; + + private CompilationTask currentTask; + + private HotSpotResolvedJavaMethod() { + throw new IllegalStateException("this constructor is never actually called, because the objects are allocated from within the VM"); + } + + @Override + public ResolvedJavaType holder() { + return holder; + } + + @Override + public int accessFlags() { + return accessFlags; + } + + @Override + public boolean canBeStaticallyBound() { + return isLeafMethod() || Modifier.isStatic(accessFlags()); + } + + @Override + public byte[] code() { + if (code == null) { + code = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_code(this); + assert code.length == codeSize : "expected: " + codeSize + ", actual: " + code.length; + } + return code; + } + + @Override + public int codeSize() { + return codeSize; + } + + @Override + public ExceptionHandler[] exceptionHandlers() { + return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_exceptionHandlers(this); + } + + @Override + public boolean hasBalancedMonitors() { + if (hasBalancedMonitors == null) { + hasBalancedMonitors = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_hasBalancedMonitors(this); + } + return hasBalancedMonitors; + } + + @Override + public boolean isClassInitializer() { + return "".equals(name) && Modifier.isStatic(accessFlags()); + } + + @Override + public boolean isConstructor() { + return "".equals(name) && !Modifier.isStatic(accessFlags()); + } + + @Override + public boolean isLeafMethod() { + return Modifier.isFinal(accessFlags()) || Modifier.isPrivate(accessFlags()); + } + + @Override + public String jniSymbol() { + throw new UnsupportedOperationException("jniSymbol"); + } + + @Override + public int maxLocals() { + return maxLocals; + } + + @Override + public int maxStackSize() { + return maxStackSize; + } + + @Override + public StackTraceElement toStackTraceElement(int bci) { + if (bci < 0 || bci >= codeSize) { + // HotSpot code can only construct stack trace elements for valid bcis + StackTraceElement ste = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_toStackTraceElement(this, 0); + return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1); + } + return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_toStackTraceElement(this, bci); + } + + public ResolvedJavaMethod uniqueConcreteMethod() { + return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_uniqueConcreteMethod(this); + } + + @Override + public Signature signature() { + if (signature == null) { + signature = new HotSpotSignature(HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_signature(this)); + } + return signature; + } + + @Override + public String toString() { + return "HotSpotMethod<" + CodeUtil.format("%h.%n", this) + ">"; + } + + public boolean hasCompiledCode() { + return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_hasCompiledCode(this); + } + + public int compiledCodeSize() { + int result = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_getCompiledCodeSize(this); + if (result > 0) { + assert result > MethodEntryCounters.getCodeSize(); + result = result - MethodEntryCounters.getCodeSize(); + } + return result; + } + + @Override + public int invocationCount() { + return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_invocationCount(this); + } + + @Override + public int compilationComplexity() { + if (compilationComplexity <= 0 && codeSize() > 0) { + BytecodeStream s = new BytecodeStream(code()); + int result = 0; + int currentBC; + while ((currentBC = s.currentBC()) != Bytecodes.END) { + result += Bytecodes.compilationComplexity(currentBC); + s.next(); + } + assert result > 0; + compilationComplexity = result; + } + return compilationComplexity; + } + + private static final MethodFilter profilingInfoFilter = GraalOptions.PIFilter == null ? null : new MethodFilter(GraalOptions.PIFilter); + + /** + * Determines if the profiling info cache should be used for this method. + */ + private boolean useProfilingInfoCache() { + return GraalOptions.PICache != null && (profilingInfoFilter == null || profilingInfoFilter.matches(this)); + } + + private ProfilingInfo loadProfilingInfo() { + if (!useProfilingInfoCache()) { + return null; + } + synchronized (this) { + File file = new File(GraalOptions.PICache, JniMangle.mangleMethod(holder, name, signature(), false)); + if (file.exists()) { + try { + SnapshotProfilingInfo snapshot = SnapshotProfilingInfo.load(file, HotSpotGraalRuntime.getInstance().getRuntime()); + if (snapshot.codeSize() != codeSize) { + // The class file was probably changed - ignore the saved profile + return null; + } + return snapshot; + } catch (Exception e) { + // ignore + } + } + return null; + } + } + + private void saveProfilingInfo(ProfilingInfo info) { + if (useProfilingInfoCache()) { + synchronized (this) { + String base = JniMangle.mangleMethod(holder, name, signature(), false); + File file = new File(GraalOptions.PICache, base); + File txtFile = new File(GraalOptions.PICache, base + ".txt"); + SnapshotProfilingInfo snapshot = info instanceof SnapshotProfilingInfo ? (SnapshotProfilingInfo) info : new SnapshotProfilingInfo(info); + try { + snapshot.save(file, txtFile); + } catch (IOException e) { + // ignore + } + } + } + } + + @Override + public ProfilingInfo profilingInfo() { + ProfilingInfo info = loadProfilingInfo(); + if (info != null) { + return info; + } + + if (GraalOptions.UseProfilingInformation && methodData == null) { + methodData = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_methodData(this); + } + + if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { + // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in case of a deoptimization. + info = BaseProfilingInfo.get(ExceptionSeen.FALSE); + } else { + info = new HotSpotProfilingInfo(methodData, codeSize); + saveProfilingInfo(info); + } + return info; + } + + @Override + public Map compilerStorage() { + if (compilerStorage == null) { + compilerStorage = new ConcurrentHashMap<>(); + } + return compilerStorage; + } + + @Override + public ConstantPool getConstantPool() { + return ((HotSpotResolvedJavaType) holder()).constantPool(); + } + + @Override + public Annotation[][] getParameterAnnotations() { + if (isConstructor()) { + Constructor javaConstructor = toJavaConstructor(); + return javaConstructor == null ? null : javaConstructor.getParameterAnnotations(); + } + Method javaMethod = toJava(); + return javaMethod == null ? null : javaMethod.getParameterAnnotations(); + } + + @Override + public T getAnnotation(Class annotationClass) { + if (isConstructor()) { + Constructor javaConstructor = toJavaConstructor(); + return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass); + } + Method javaMethod = toJava(); + return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass); + } + + @Override + public Type[] getGenericParameterTypes() { + if (isConstructor()) { + Constructor javaConstructor = toJavaConstructor(); + return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes(); + } + Method javaMethod = toJava(); + return javaMethod == null ? null : javaMethod.getGenericParameterTypes(); + } + + private Method toJava() { + try { + return holder.toJava().getDeclaredMethod(name, CodeUtil.signatureToTypes(signature(), holder)); + } catch (NoSuchMethodException e) { + return null; + } + } + + private Constructor toJavaConstructor() { + try { + return holder.toJava().getDeclaredConstructor(CodeUtil.signatureToTypes(signature(), holder)); + } catch (NoSuchMethodException e) { + return null; + } + } + + @Override + public boolean canBeInlined() { + return canBeInlined; + } + + public int vtableEntryOffset() { + return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_vtableEntryOffset(this); + } + + public void setCurrentTask(CompilationTask task) { + currentTask = task; + } + + public CompilationTask currentTask() { + return currentTask; + } +} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Sun Jun 10 01:17:48 2012 +0200 @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2011, 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.meta; + +import java.lang.annotation.*; +import java.lang.reflect.*; +import java.util.*; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.hotspot.*; + +/** + * Implementation of RiType for resolved non-primitive HotSpot classes. + */ +public final class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType { + + private static final long serialVersionUID = 3481514353553840471L; + + private Class javaMirror; + private String simpleName; + private int accessFlags; + private boolean hasFinalizer; + private boolean hasFinalizableSubclass; + private int superCheckOffset; + private boolean isArrayClass; + private boolean isInstanceClass; + private boolean isInterface; + private int instanceSize; + private HashMap fieldCache; + private ResolvedJavaType superType; + private boolean superTypeSet; + private ResolvedJavaField[] fields; + private ConstantPool constantPool; + private boolean isInitialized; + private ResolvedJavaType arrayOfType; + + private HotSpotResolvedJavaType() { + } + + @Override + public int accessFlags() { + return accessFlags; + } + + @Override + public ResolvedJavaType arrayOf() { + if (arrayOfType == null) { + arrayOfType = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_arrayOf(this); + } + return arrayOfType; + } + + @Override + public ResolvedJavaType componentType() { + assert isArrayClass(); + return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_componentType(this); + } + + @Override + public ResolvedJavaType uniqueConcreteSubtype() { + if (isArrayClass()) { + return Modifier.isFinal(componentType().accessFlags()) ? this : null; + } else { + return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_uniqueConcreteSubtype(this); + } + } + + @Override + public ResolvedJavaType superType() { + if (!superTypeSet) { + superType = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_superType(this); + superTypeSet = true; + } + return superType; + } + + @Override + public ResolvedJavaType leastCommonAncestor(ResolvedJavaType otherType) { + if (otherType instanceof HotSpotTypePrimitive) { + return null; + } else { + return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_leastCommonAncestor(this, (HotSpotResolvedJavaType) otherType); + } + } + + @Override + public ResolvedJavaType exactType() { + if (Modifier.isFinal(accessFlags)) { + return this; + } + return null; + } + + @Override + public Constant getEncoding(Representation r) { + switch (r) { + case JavaClass: + return Constant.forObject(javaMirror); + case ObjectHub: + return Constant.forObject(klassOop()); + case StaticFields: + return Constant.forObject(javaMirror); + default: + return null; + } + } + + @Override + public Kind getRepresentationKind(Representation r) { + return Kind.Object; + } + + @Override + public boolean hasFinalizableSubclass() { + return hasFinalizableSubclass; + } + + @Override + public boolean hasFinalizer() { + return hasFinalizer; + } + + @Override + public boolean isArrayClass() { + return isArrayClass; + } + + @Override + public boolean isInitialized() { + if (!isInitialized) { + isInitialized = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_isInitialized(this); + } + return isInitialized; + } + + @Override + public boolean isInstance(Constant obj) { + return javaMirror.isInstance(obj); + } + + @Override + public boolean isInstanceClass() { + return isInstanceClass; + } + + @Override + public boolean isInterface() { + return isInterface; + } + + @Override + public boolean isSubtypeOf(ResolvedJavaType other) { + if (other instanceof HotSpotResolvedJavaType) { + return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_isSubtypeOf(this, other); + } + // No resolved type is a subtype of an unresolved type. + return false; + } + + @Override + public Kind kind() { + return Kind.Object; + } + + @Override + public ResolvedJavaMethod resolveMethodImpl(ResolvedJavaMethod method) { + assert method instanceof HotSpotMethod; + return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_resolveMethodImpl(this, method.name(), method.signature().asString()); + } + + @Override + public String toString() { + return "HotSpotType<" + simpleName + ", resolved>"; + } + + public ConstantPool constantPool() { + if (constantPool == null) { + constantPool = new HotSpotConstantPool(this); + } + return constantPool; + } + + public int instanceSize() { + return instanceSize; + } + + public synchronized ResolvedJavaField createRiField(String fieldName, JavaType type, int offset, int flags) { + ResolvedJavaField result = null; + + long id = offset + ((long) flags << 32); + + // (thomaswue) Must cache the fields, because the local load elimination only works if the objects from two field lookups are identical. + if (fieldCache == null) { + fieldCache = new HashMap<>(8); + } else { + result = fieldCache.get(id); + } + + if (result == null) { + result = new HotSpotResolvedJavaField(this, fieldName, type, offset, flags); + fieldCache.put(id, result); + } else { + assert result.name().equals(fieldName); + assert result.accessFlags() == flags; + } + + return result; + } + + @Override + public ResolvedJavaMethod uniqueConcreteMethod(ResolvedJavaMethod method) { + return ((HotSpotResolvedJavaMethod) method).uniqueConcreteMethod(); + } + + @Override + public ResolvedJavaField[] declaredFields() { + if (fields == null) { + fields = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_fields(this); + } + return fields; + } + + @Override + public Class< ? > toJava() { + return javaMirror; + } + + @Override + public T getAnnotation(Class annotationClass) { + return toJava().getAnnotation(annotationClass); + } + + @Override + public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { + return this; + } + + // this value may require identity semantics so cache it + private HotSpotKlassOop klassOopCache; + + @Override + public synchronized HotSpotKlassOop klassOop() { + if (klassOopCache == null) { + klassOopCache = new HotSpotKlassOop(javaMirror); + } + return klassOopCache; + } + + private static final int SECONDARY_SUPER_CACHE_OFFSET = HotSpotGraalRuntime.getInstance().getConfig().secondarySuperCacheOffset; + + public boolean isPrimaryType() { + return SECONDARY_SUPER_CACHE_OFFSET != superCheckOffset; + } + + public int superCheckOffset() { + return superCheckOffset; + } +} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sun Jun 10 01:17:48 2012 +0200 @@ -175,7 +175,7 @@ @Override public String disassemble(ResolvedJavaMethod method) { - return compiler.getCompilerToVM().disassembleJava((HotSpotMethodResolved) method); + return compiler.getCompilerToVM().disassembleJava((HotSpotResolvedJavaMethod) method); } @Override @@ -185,7 +185,7 @@ @Override public ResolvedJavaType getTypeOf(Constant constant) { - return (ResolvedJavaType) compiler.getCompilerToVM().getRiType(constant); + return (ResolvedJavaType) compiler.getCompilerToVM().getJavaType(constant); } @Override @@ -233,7 +233,7 @@ graph.replaceFixedWithFixed(arrayLengthNode, safeReadArrayLength); } else if (n instanceof LoadFieldNode) { LoadFieldNode field = (LoadFieldNode) n; - int displacement = ((HotSpotField) field.field()).offset(); + int displacement = ((HotSpotResolvedJavaField) field.field()).offset(); assert field.kind() != Kind.Illegal; ReadNode memoryRead = graph.add(new ReadNode(field.object(), LocationNode.create(field.field(), field.field().kind(), displacement, graph), field.stamp())); memoryRead.dependencies().add(tool.createNullCheckGuard(field.object(), field.leafGraphId())); @@ -246,7 +246,7 @@ } } else if (n instanceof StoreFieldNode) { StoreFieldNode storeField = (StoreFieldNode) n; - HotSpotField field = (HotSpotField) storeField.field(); + HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) storeField.field(); WriteNode memoryWrite = graph.add(new WriteNode(storeField.object(), storeField.value(), LocationNode.create(storeField.field(), storeField.field().kind(), field.offset(), graph))); memoryWrite.dependencies().add(tool.createNullCheckGuard(storeField.object(), storeField.leafGraphId())); memoryWrite.setStateAfter(storeField.stateAfter()); @@ -462,13 +462,13 @@ } public ResolvedJavaMethod getResolvedJavaMethod(Method reflectionMethod) { - return (ResolvedJavaMethod) compiler.getCompilerToVM().getRiMethod(reflectionMethod); + return (ResolvedJavaMethod) compiler.getCompilerToVM().getJavaMethod(reflectionMethod); } private static HotSpotCodeInfo makeInfo(ResolvedJavaMethod method, CompilationResult code, CodeInfo[] info) { HotSpotCodeInfo hsInfo = null; if (info != null && info.length > 0) { - hsInfo = new HotSpotCodeInfo(code, (HotSpotMethodResolved) method); + hsInfo = new HotSpotCodeInfo(code, (HotSpotResolvedJavaMethod) method); info[0] = hsInfo; } return hsInfo; @@ -476,13 +476,13 @@ public void installMethod(ResolvedJavaMethod method, CompilationResult code, CodeInfo[] info) { HotSpotCodeInfo hsInfo = makeInfo(method, code, info); - compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod((HotSpotMethodResolved) method, code), true, hsInfo); + compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod((HotSpotResolvedJavaMethod) method, code), true, hsInfo); } @Override public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult code, CodeInfo[] info) { HotSpotCodeInfo hsInfo = makeInfo(method, code, info); - return compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod((HotSpotMethodResolved) method, code), false, hsInfo); + return compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod((HotSpotResolvedJavaMethod) method, code), false, hsInfo); } @Override diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Sun Jun 10 01:17:48 2012 +0200 @@ -117,7 +117,7 @@ } JavaType type = argumentTypes[index]; if (type == null || !(type instanceof ResolvedJavaType)) { - type = HotSpotGraalRuntime.getInstance().lookupType(arguments.get(index), (HotSpotTypeResolved) accessingClass, true); + type = HotSpotGraalRuntime.getInstance().lookupType(arguments.get(index), (HotSpotResolvedJavaType) accessingClass, true); argumentTypes[index] = type; } return type; @@ -136,7 +136,7 @@ @Override public JavaType returnType(JavaType accessingClass) { if (returnTypeCache == null) { - returnTypeCache = HotSpotGraalRuntime.getInstance().lookupType(returnType, (HotSpotTypeResolved) accessingClass, false); + returnTypeCache = HotSpotGraalRuntime.getInstance().lookupType(returnType, (HotSpotResolvedJavaType) accessingClass, false); } return returnTypeCache; } diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotType.java Sat Jun 09 22:50:50 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2011, 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.meta; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; - -/** - * Common interface for all HotSpot RiType-implementations. - */ -public abstract class HotSpotType extends CompilerObject implements JavaType { - private static final long serialVersionUID = -4252886265301910771L; - protected String name; - - @Override - public final String name() { - return name; - } - - /** - * Gets the object representing the C++ klassOop for this type. - * Such a value cannot be safely exposed to Java code. - */ - public abstract HotSpotKlassOop klassOop(); -} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypePrimitive.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypePrimitive.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypePrimitive.java Sun Jun 10 01:17:48 2012 +0200 @@ -32,7 +32,7 @@ /** * Implementation of RiType for primitive HotSpot types. */ -public final class HotSpotTypePrimitive extends HotSpotType implements ResolvedJavaType { +public final class HotSpotTypePrimitive extends HotSpotJavaType implements ResolvedJavaType { private static final long serialVersionUID = -6208552348908071473L; private Kind kind; diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeResolvedImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeResolvedImpl.java Sat Jun 09 22:50:50 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,281 +0,0 @@ -/* - * Copyright (c) 2011, 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.meta; - -import java.lang.annotation.*; -import java.lang.reflect.*; -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; - -/** - * Implementation of RiType for resolved non-primitive HotSpot classes. - */ -public final class HotSpotTypeResolvedImpl extends HotSpotType implements HotSpotTypeResolved { - - private static final long serialVersionUID = 3481514353553840471L; - - private Class javaMirror; - private String simpleName; - private int accessFlags; - private boolean hasFinalizer; - private boolean hasFinalizableSubclass; - private int superCheckOffset; - private boolean isArrayClass; - private boolean isInstanceClass; - private boolean isInterface; - private int instanceSize; - private HashMap fieldCache; - private ResolvedJavaType superType; - private boolean superTypeSet; - private ResolvedJavaField[] fields; - private ConstantPool constantPool; - private boolean isInitialized; - private ResolvedJavaType arrayOfType; - - private HotSpotTypeResolvedImpl() { - } - - @Override - public int accessFlags() { - return accessFlags; - } - - @Override - public ResolvedJavaType arrayOf() { - if (arrayOfType == null) { - arrayOfType = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_arrayOf(this); - } - return arrayOfType; - } - - @Override - public ResolvedJavaType componentType() { - assert isArrayClass(); - return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_componentType(this); - } - - @Override - public ResolvedJavaType uniqueConcreteSubtype() { - if (isArrayClass()) { - return Modifier.isFinal(componentType().accessFlags()) ? this : null; - } else { - return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_uniqueConcreteSubtype(this); - } - } - - @Override - public ResolvedJavaType superType() { - if (!superTypeSet) { - superType = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_superType(this); - superTypeSet = true; - } - return superType; - } - - @Override - public ResolvedJavaType leastCommonAncestor(ResolvedJavaType otherType) { - if (otherType instanceof HotSpotTypePrimitive) { - return null; - } else { - return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_leastCommonAncestor(this, (HotSpotTypeResolved) otherType); - } - } - - @Override - public ResolvedJavaType exactType() { - if (Modifier.isFinal(accessFlags)) { - return this; - } - return null; - } - - @Override - public Constant getEncoding(Representation r) { - switch (r) { - case JavaClass: - return Constant.forObject(javaMirror); - case ObjectHub: - return Constant.forObject(klassOop()); - case StaticFields: - return Constant.forObject(javaMirror); - default: - return null; - } - } - - @Override - public Kind getRepresentationKind(Representation r) { - return Kind.Object; - } - - @Override - public boolean hasFinalizableSubclass() { - return hasFinalizableSubclass; - } - - @Override - public boolean hasFinalizer() { - return hasFinalizer; - } - - @Override - public boolean isArrayClass() { - return isArrayClass; - } - - @Override - public boolean isInitialized() { - if (!isInitialized) { - isInitialized = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_isInitialized(this); - } - return isInitialized; - } - - @Override - public boolean isInstance(Constant obj) { - return javaMirror.isInstance(obj); - } - - @Override - public boolean isInstanceClass() { - return isInstanceClass; - } - - @Override - public boolean isInterface() { - return isInterface; - } - - @Override - public boolean isSubtypeOf(ResolvedJavaType other) { - if (other instanceof HotSpotTypeResolved) { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_isSubtypeOf(this, other); - } - // No resolved type is a subtype of an unresolved type. - return false; - } - - @Override - public Kind kind() { - return Kind.Object; - } - - @Override - public ResolvedJavaMethod resolveMethodImpl(ResolvedJavaMethod method) { - assert method instanceof HotSpotMethod; - return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_resolveMethodImpl(this, method.name(), method.signature().asString()); - } - - @Override - public String toString() { - return "HotSpotType<" + simpleName + ", resolved>"; - } - - @Override - public ConstantPool constantPool() { - if (constantPool == null) { - constantPool = new HotSpotConstantPool(this); - } - return constantPool; - } - - @Override - public int instanceSize() { - return instanceSize; - } - - @Override - public synchronized ResolvedJavaField createRiField(String fieldName, JavaType type, int offset, int flags) { - ResolvedJavaField result = null; - - long id = offset + ((long) flags << 32); - - // (thomaswue) Must cache the fields, because the local load elimination only works if the objects from two field lookups are identical. - if (fieldCache == null) { - fieldCache = new HashMap<>(8); - } else { - result = fieldCache.get(id); - } - - if (result == null) { - result = new HotSpotField(this, fieldName, type, offset, flags); - fieldCache.put(id, result); - } else { - assert result.name().equals(fieldName); - assert result.accessFlags() == flags; - } - - return result; - } - - @Override - public ResolvedJavaMethod uniqueConcreteMethod(ResolvedJavaMethod method) { - return ((HotSpotMethodResolved) method).uniqueConcreteMethod(); - } - - @Override - public ResolvedJavaField[] declaredFields() { - if (fields == null) { - fields = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_fields(this); - } - return fields; - } - - @Override - public Class< ? > toJava() { - return javaMirror; - } - - @Override - public T getAnnotation(Class annotationClass) { - return toJava().getAnnotation(annotationClass); - } - - @Override - public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { - return this; - } - - // this value may require identity semantics so cache it - private HotSpotKlassOop klassOopCache; - - @Override - public synchronized HotSpotKlassOop klassOop() { - if (klassOopCache == null) { - klassOopCache = new HotSpotKlassOop(javaMirror); - } - return klassOopCache; - } - - private static final int SECONDARY_SUPER_CACHE_OFFSET = HotSpotGraalRuntime.getInstance().getConfig().secondarySuperCacheOffset; - - public boolean isPrimaryType() { - return SECONDARY_SUPER_CACHE_OFFSET != superCheckOffset; - } - - public int superCheckOffset() { - return superCheckOffset; - } -} diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeUnresolved.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeUnresolved.java Sun Jun 10 01:17:48 2012 +0200 @@ -29,7 +29,7 @@ /** * Implementation of RiType for unresolved HotSpot classes. */ -public class HotSpotTypeUnresolved extends HotSpotType { +public class HotSpotTypeUnresolved extends HotSpotJavaType { private static final long serialVersionUID = -2320936267633521314L; public final String simpleName; @@ -115,7 +115,7 @@ @Override public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { - return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().lookupType(name, (HotSpotTypeResolved) accessingClass, true); + return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().lookupType(name, (HotSpotResolvedJavaType) accessingClass, true); } @Override diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotXirGenerator.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotXirGenerator.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotXirGenerator.java Sun Jun 10 01:17:48 2012 +0200 @@ -747,7 +747,7 @@ int vtableEntryOffset = 0; if (GraalOptions.InlineVTableStubs && (GraalOptions.AlwaysInlineVTableStubs || megamorph)) { - HotSpotMethodResolved hsMethod = (HotSpotMethodResolved) method; + HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method; if (!hsMethod.holder().isInterface()) { vtableEntryOffset = hsMethod.vtableEntryOffset(); } @@ -781,7 +781,7 @@ @Override public XirSnippet genNewInstance(XirSite site, JavaType type) { - HotSpotTypeResolved resolvedType = (HotSpotTypeResolved) type; + HotSpotResolvedJavaType resolvedType = (HotSpotResolvedJavaType) type; int instanceSize = resolvedType.instanceSize(); return new XirSnippet(newInstanceTemplates.get(site, instanceSize), XirArgument.forObject(resolvedType.klassOop())); } @@ -790,18 +790,18 @@ public XirSnippet genNewArray(XirSite site, XirArgument length, Kind elementKind, JavaType componentType, JavaType arrayType) { if (elementKind == Kind.Object) { assert arrayType instanceof ResolvedJavaType; - return new XirSnippet(newObjectArrayTemplates.get(site), length, XirArgument.forObject(((HotSpotType) arrayType).klassOop())); + return new XirSnippet(newObjectArrayTemplates.get(site), length, XirArgument.forObject(((HotSpotJavaType) arrayType).klassOop())); } else { assert arrayType == null; JavaType primitiveArrayType = compiler.getCompilerToVM().getPrimitiveArrayType(elementKind); - return new XirSnippet(newTypeArrayTemplates.get(site, elementKind), length, XirArgument.forObject(((HotSpotType) primitiveArrayType).klassOop())); + return new XirSnippet(newTypeArrayTemplates.get(site, elementKind), length, XirArgument.forObject(((HotSpotJavaType) primitiveArrayType).klassOop())); } } @Override public XirSnippet genNewMultiArray(XirSite site, XirArgument[] lengths, JavaType type) { XirArgument[] params = Arrays.copyOf(lengths, lengths.length + 1); - params[lengths.length] = XirArgument.forObject(((HotSpotType) type).klassOop()); + params[lengths.length] = XirArgument.forObject(((HotSpotJavaType) type).klassOop()); return new XirSnippet(multiNewArrayTemplate.get(site, lengths.length), params); } @@ -833,7 +833,7 @@ params[i++] = hub; } for (ResolvedJavaType hint : hints.types) { - params[i++] = XirArgument.forObject(((HotSpotType) hint).klassOop()); + params[i++] = XirArgument.forObject(((HotSpotJavaType) hint).klassOop()); } XirTemplate template = hints.exact ? checkCastTemplates.get(site, hintsLength, EXACT_HINTS) : checkCastTemplates.get(site, hintsLength); return new XirSnippet(template, params); @@ -854,7 +854,7 @@ params[i++] = hub; } for (ResolvedJavaType hint : hints.types) { - params[i++] = XirArgument.forObject(((HotSpotType) hint).klassOop()); + params[i++] = XirArgument.forObject(((HotSpotJavaType) hint).klassOop()); } XirTemplate template = hints.exact ? instanceOfTemplates.get(site, hintsLength, EXACT_HINTS) : instanceOfTemplates.get(site, hintsLength); return new XirSnippet(template, params); @@ -877,7 +877,7 @@ params[i++] = trueValue; params[i++] = falseValue; for (ResolvedJavaType hint : hints.types) { - params[i++] = XirArgument.forObject(((HotSpotType) hint).klassOop()); + params[i++] = XirArgument.forObject(((HotSpotJavaType) hint).klassOop()); } XirTemplate template = hints.exact ? materializeInstanceOfTemplates.get(site, hintsLength, EXACT_HINTS) : materializeInstanceOfTemplates.get(site, hintsLength); return new XirSnippet(template, params); diff -r 511612d1b5c1 -r 70f715dfbb41 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Sat Jun 09 22:50:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Sun Jun 10 01:17:48 2012 +0200 @@ -359,7 +359,7 @@ ValueNode hub = checkcast.targetClassInstruction(); ValueNode object = checkcast.object(); TypeCheckHints hintInfo = new TypeCheckHints(checkcast.targetClass(), checkcast.profile(), tool.assumptions(), GraalOptions.CheckcastMinHintHitProbability, GraalOptions.CheckcastMaxHints); - final HotSpotTypeResolvedImpl target = (HotSpotTypeResolvedImpl) checkcast.targetClass(); + final HotSpotResolvedJavaType target = (HotSpotResolvedJavaType) checkcast.targetClass(); boolean checkNull = !object.stamp().nonNull(); Arguments arguments; Key key; @@ -391,7 +391,7 @@ private static HotSpotKlassOop[] createHints(TypeCheckHints hints) { HotSpotKlassOop[] hintHubs = new HotSpotKlassOop[hints.types.length]; for (int i = 0; i < hintHubs.length; i++) { - hintHubs[i] = ((HotSpotType) hints.types[i]).klassOop(); + hintHubs[i] = ((HotSpotJavaType) hints.types[i]).klassOop(); } return hintHubs; } diff -r 511612d1b5c1 -r 70f715dfbb41 src/cpu/x86/vm/c1_Runtime1_x86.cpp --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp Sun Jun 10 01:17:48 2012 +0200 @@ -1006,9 +1006,9 @@ Handle callback(_callback); Handle argument(_argument); - KlassHandle klass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_max_cri_ci_CiGenericCallback(), SystemDictionary::java_system_loader(), NULL, thread); + KlassHandle klass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_api_code_GenericCallback(), SystemDictionary::java_system_loader(), NULL, thread); if (klass.is_null()) { - tty->print_cr("couldn't resolve com_oracle_max_cri_ci_CiGenericCallback"); + tty->print_cr("couldn't resolve com_oracle_graal_api_code_GenericCallback"); } JavaValue result(T_OBJECT); diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/classfile/systemDictionary.hpp --- a/src/share/vm/classfile/systemDictionary.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/classfile/systemDictionary.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -186,47 +186,49 @@ template(Short_klass, java_lang_Short, Pre) \ template(Integer_klass, java_lang_Integer, Pre) \ template(Long_klass, java_lang_Long, Pre) \ - \ - /* Support for Graal */ \ - template(HotSpotTypeResolved_klass, com_oracle_graal_hotspot_HotSpotTypeResolved, Opt) \ + \ + /* Support for Graal */ \ + template(GraalBitMap_klass, java_util_BitSet, Opt) \ + /* graal.hotspot */ \ template(HotSpotKlassOop_klass, com_oracle_graal_hotspot_HotSpotKlassOop, Opt) \ - template(HotSpotType_klass, com_oracle_graal_hotspot_HotSpotType, Opt) \ - template(HotSpotField_klass, com_oracle_graal_hotspot_HotSpotField, Opt) \ - template(HotSpotCompiledMethod_klass, com_oracle_graal_hotspot_HotSpotCompiledMethod, Opt) \ - template(HotSpotCodeInfo_klass, com_oracle_graal_hotspot_HotSpotCodeInfo, Opt) \ - template(HotSpotMethodResolved_klass, com_oracle_graal_hotspot_ri_HotSpotMethodResolved, Opt) \ - template(HotSpotMethodData_klass, com_oracle_graal_hotspot_ri_HotSpotMethodData, Opt) \ - template(HotSpotTargetMethod_klass, com_oracle_graal_hotspot_HotSpotTargetMethod, Opt) \ template(HotSpotProxy_klass, com_oracle_graal_hotspot_HotSpotProxy, Opt) \ - template(CiAssumptions_klass, com_oracle_max_cri_ci_CiAssumptions, Opt) \ - template(CiAssumptions_MethodContents_klass, com_oracle_max_cri_ci_CiAssumptions_MethodContents, Opt) \ - template(CiAssumptions_ConcreteSubtype_klass, com_oracle_max_cri_ci_CiAssumptions_ConcreteSubtype, Opt) \ - template(CiAssumptions_ConcreteMethod_klass, com_oracle_max_cri_ci_CiAssumptions_ConcreteMethod, Opt) \ - template(CiTargetMethod_klass, com_oracle_max_cri_ci_CiTargetMethod, Opt) \ - template(CiTargetMethod_Site_klass, com_oracle_max_cri_ci_CiTargetMethod_Site, Opt) \ - template(CiTargetMethod_Call_klass, com_oracle_max_cri_ci_CiTargetMethod_Call, Opt) \ - template(CiTargetMethod_DataPatch_klass, com_oracle_max_cri_ci_CiTargetMethod_DataPatch, Opt) \ - template(CiTargetMethod_Safepoint_klass, com_oracle_max_cri_ci_CiTargetMethod_Safepoint, Opt) \ - template(CiTargetMethod_ExceptionHandler_klass, com_oracle_max_cri_ci_CiTargetMethod_ExceptionHandler, Opt) \ - template(CiTargetMethod_Mark_klass, com_oracle_max_cri_ci_CiTargetMethod_Mark, Opt) \ - template(GraalBitMap_klass, com_oracle_max_cri_ci_CiBitMap, Opt) \ - template(CiDebugInfo_klass, com_oracle_max_cri_ci_CiDebugInfo, Opt) \ - template(CiFrame_klass, com_oracle_max_cri_ci_CiFrame, Opt) \ - template(CiValue_klass, com_oracle_max_cri_ci_CiValue, Opt) \ - template(CiStackSlot_klass, com_oracle_max_cri_ci_CiStackSlot, Opt) \ - template(CiRegisterValue_klass, com_oracle_max_cri_ci_CiRegisterValue, Opt) \ - template(CiRegister_klass, com_oracle_max_cri_ci_CiRegister, Opt) \ - template(CiCodePos_klass, com_oracle_max_cri_ci_CiCodePos, Opt) \ - template(CiConstant_klass, com_oracle_max_cri_ci_CiConstant, Opt) \ - template(CiVirtualObject_klass, com_oracle_max_cri_ci_CiVirtualObject, Opt) \ - template(CiMonitorValue_klass, com_oracle_max_cri_ci_CiMonitorValue, Opt) \ - template(CiKind_klass, com_oracle_max_cri_ci_CiKind, Opt) \ - template(CiRuntimeCall_klass, com_oracle_max_cri_ci_CiRuntimeCall, Opt) \ - template(RiMethod_klass, com_oracle_max_cri_ri_RiMethod, Opt) \ - template(RiType_klass, com_oracle_max_cri_ri_RiType, Opt) \ - template(RiResolvedField_klass, com_oracle_max_cri_ri_RiResolvedField, Opt) \ - template(RiExceptionHandler_klass, com_oracle_max_cri_ri_RiExceptionHandler, Opt) \ - + template(HotSpotTargetMethod_klass, com_oracle_graal_hotspot_HotSpotTargetMethod, Opt) \ + template(HotSpotCodeInfo_klass, com_oracle_graal_hotspot_meta_HotSpotCodeInfo, Opt) \ + template(HotSpotCompiledMethod_klass, com_oracle_graal_hotspot_meta_HotSpotCompiledMethod, Opt) \ + template(HotSpotJavaType_klass, com_oracle_graal_hotspot_meta_HotSpotJavaType, Opt) \ + template(HotSpotMethodData_klass, com_oracle_graal_hotspot_meta_HotSpotMethodData, Opt) \ + template(HotSpotResolvedJavaField_klass, com_oracle_graal_hotspot_meta_HotSpotResolvedJavaField, Opt) \ + template(HotSpotResolvedJavaMethod_klass, com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethod, Opt) \ + template(HotSpotResolvedJavaType_klass, com_oracle_graal_hotspot_meta_HotSpotResolvedJavaType, Opt) \ + /* graal.api.code */ \ + template(Assumptions_klass, com_oracle_graal_api_code_Assumptions, Opt) \ + template(Assumptions_ConcreteMethod_klass, com_oracle_graal_api_code_Assumptions_ConcreteMethod, Opt) \ + template(Assumptions_ConcreteSubtype_klass, com_oracle_graal_api_code_Assumptions_ConcreteSubtype, Opt) \ + template(Assumptions_MethodContents_klass, com_oracle_graal_api_code_Assumptions_MethodContents, Opt) \ + template(BytecodePosition_klass, com_oracle_graal_api_code_BytecodePosition, Opt) \ + template(DebugInfo_klass, com_oracle_graal_api_code_DebugInfo, Opt) \ + template(BytecodeFrame_klass, com_oracle_graal_api_code_BytecodeFrame, Opt) \ + template(InstalledCode_klass, com_oracle_graal_api_code_InstalledCode, Opt) \ + template(InstalledCode_Call_klass, com_oracle_graal_api_code_InstalledCode_Call, Opt) \ + template(InstalledCode_DataPatch_klass, com_oracle_graal_api_code_InstalledCode_DataPatch, Opt) \ + template(InstalledCode_ExceptionHandler_klass, com_oracle_graal_api_code_InstalledCode_ExceptionHandler, Opt) \ + template(InstalledCode_Mark_klass, com_oracle_graal_api_code_InstalledCode_Mark, Opt) \ + template(InstalledCode_Safepoint_klass, com_oracle_graal_api_code_InstalledCode_Safepoint, Opt) \ + template(InstalledCode_Site_klass, com_oracle_graal_api_code_InstalledCode_Site, Opt) \ + template(code_MonitorValue_klass, com_oracle_graal_api_code_MonitorValue, Opt) \ + template(code_Register_klass, com_oracle_graal_api_code_Register, Opt) \ + template(RegisterValue_klass, com_oracle_graal_api_code_RegisterValue, Opt) \ + template(RuntimeCall_klass, com_oracle_graal_api_code_RuntimeCall, Opt) \ + template(StackSlot_klass, com_oracle_graal_api_code_StackSlot, Opt) \ + template(VirtualObject_klass, com_oracle_graal_api_code_VirtualObject, Opt) \ + /* graal.api.meta */ \ + template(Constant_klass, com_oracle_graal_api_meta_Constant, Opt) \ + template(ExceptionHandler_klass, com_oracle_graal_api_meta_ExceptionHandler, Opt) \ + template(Kind_klass, com_oracle_graal_api_meta_Kind, Opt) \ + template(JavaMethod_klass, com_oracle_graal_api_meta_JavaMethod, Opt) \ + template(JavaType_klass, com_oracle_graal_api_meta_JavaType, Opt) \ + template(ResolvedJavaField_klass, com_oracle_graal_api_meta_ResolvedJavaField, Opt) \ + template(Value_klass, com_oracle_graal_api_meta_Value, Opt) \ /*end*/ diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/classfile/vmSymbols.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -267,91 +267,92 @@ NOT_LP64( do_alias(intptr_signature, int_signature) ) \ LP64_ONLY( do_alias(intptr_signature, long_signature) ) \ template(selectAlternative_signature, "(ZLjava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;)Ljava/lang/invoke/MethodHandle;") \ - \ - /* Support for Graal */ \ - template(com_oracle_graal_hotspot_bridge_VMToCompiler, "com/oracle/graal/hotspot/bridge/VMToCompiler") \ - template(com_oracle_graal_hotspot_ri_HotSpotMethodResolved, "com/oracle/graal/hotspot/meta/HotSpotMethodResolvedImpl") \ - template(com_oracle_graal_hotspot_HotSpotTargetMethod, "com/oracle/graal/hotspot/HotSpotTargetMethod") \ - template(com_oracle_graal_hotspot_ri_HotSpotMethodData, "com/oracle/graal/hotspot/meta/HotSpotMethodData") \ - template(com_oracle_graal_hotspot_HotSpotCodeInfo, "com/oracle/graal/hotspot/meta/HotSpotCodeInfo") \ - template(com_oracle_graal_hotspot_HotSpotField, "com/oracle/graal/hotspot/meta/HotSpotField") \ - template(com_oracle_graal_hotspot_HotSpotCompiledMethod, "com/oracle/graal/hotspot/meta/HotSpotCompiledMethod") \ - template(com_oracle_graal_hotspot_HotSpotOptions, "com/oracle/graal/hotspot/HotSpotOptions") \ - template(com_oracle_graal_hotspot_HotSpotTypeResolved, "com/oracle/graal/hotspot/meta/HotSpotTypeResolvedImpl") \ - template(com_oracle_graal_hotspot_HotSpotType, "com/oracle/graal/hotspot/meta/HotSpotType") \ - template(com_oracle_graal_hotspot_HotSpotKlassOop, "com/oracle/graal/hotspot/meta/HotSpotKlassOop") \ - template(com_oracle_graal_hotspot_HotSpotProxy, "com/oracle/graal/hotspot/HotSpotProxy") \ - template(com_oracle_graal_hotspot_CompilerImpl, "com/oracle/graal/hotspot/HotSpotGraalRuntime") \ - template(com_oracle_max_cri_ri_RiMethod, "com/oracle/graal/api/meta/JavaMethod") \ - template(com_oracle_max_cri_ri_RiResolvedField, "com/oracle/graal/api/meta/ResolvedJavaField") \ - template(com_oracle_max_cri_ri_RiType, "com/oracle/graal/api/meta/JavaType") \ - template(com_oracle_max_cri_ri_RiConstantPool, "com/oracle/graal/api/meta/ConstantPool") \ - template(com_oracle_max_cri_ri_RiExceptionHandler, "com/oracle/graal/api/meta/ExceptionHandler") \ - template(com_oracle_max_cri_ci_CiAssumptions, "com/oracle/graal/api/code/Assumptions") \ - template(com_oracle_max_cri_ci_CiAssumptions_MethodContents, "com/oracle/graal/api/code/Assumptions$MethodContents") \ - template(com_oracle_max_cri_ci_CiAssumptions_ConcreteSubtype, "com/oracle/graal/api/code/Assumptions$ConcreteSubtype") \ - template(com_oracle_max_cri_ci_CiAssumptions_ConcreteMethod, "com/oracle/graal/api/code/Assumptions$ConcreteMethod") \ - template(com_oracle_max_cri_ci_CiGenericCallback, "com/oracle/graal/api/code/GenericCallback") \ - template(com_oracle_max_cri_ci_CiTargetMethod, "com/oracle/graal/api/code/CompilationResult") \ - template(com_oracle_max_cri_ci_CiTargetMethod_Site, "com/oracle/graal/api/code/CompilationResult$Site") \ - template(com_oracle_max_cri_ci_CiTargetMethod_Call, "com/oracle/graal/api/code/CompilationResult$Call") \ - template(com_oracle_max_cri_ci_CiTargetMethod_DataPatch, "com/oracle/graal/api/code/CompilationResult$DataPatch") \ - template(com_oracle_max_cri_ci_CiTargetMethod_Safepoint, "com/oracle/graal/api/code/CompilationResult$Safepoint") \ - template(com_oracle_max_cri_ci_CiTargetMethod_ExceptionHandler, "com/oracle/graal/api/code/CompilationResult$ExceptionHandler") \ - template(com_oracle_max_cri_ci_CiTargetMethod_Mark, "com/oracle/graal/api/code/CompilationResult$Mark") \ - template(com_oracle_max_cri_ci_CiBitMap, "java/util/BitSet") \ - template(com_oracle_max_cri_ci_CiDebugInfo, "com/oracle/graal/api/code/DebugInfo") \ - template(com_oracle_max_cri_ci_CiFrame, "com/oracle/graal/api/code/BytecodeFrame") \ - template(com_oracle_max_cri_ci_CiValue, "com/oracle/graal/api/meta/Value") \ - template(com_oracle_max_cri_ci_CiStackSlot, "com/oracle/graal/api/code/StackSlot") \ - template(com_oracle_max_cri_ci_CiRegisterValue, "com/oracle/graal/api/code/RegisterValue") \ - template(com_oracle_max_cri_ci_CiRegister, "com/oracle/graal/api/code/Register") \ - template(com_oracle_max_cri_ci_CiCodePos, "com/oracle/graal/api/code/BytecodePosition") \ - template(com_oracle_max_cri_ci_CiConstant, "com/oracle/graal/api/meta/Constant") \ - template(com_oracle_max_cri_ci_CiVirtualObject, "com/oracle/graal/api/code/VirtualObject") \ - template(com_oracle_max_cri_ci_CiMonitorValue, "com/oracle/graal/api/code/MonitorValue") \ - template(com_oracle_max_cri_ci_CiKind, "com/oracle/graal/api/meta/Kind") \ - template(com_oracle_max_cri_ci_CiRuntimeCall, "com/oracle/graal/api/code/RuntimeCall") \ - template(startCompiler_name, "startCompiler") \ - template(bootstrap_name, "bootstrap") \ - template(shutdownCompiler_name, "shutdownCompiler") \ - template(compileMethod_name, "compileMethod") \ - template(compileMethod_signature, "(Lcom/oracle/graal/hotspot/meta/HotSpotMethodResolved;IZI)Z") \ - template(setOption_name, "setOption") \ - template(setDefaultOptions_name, "setDefaultOptions") \ - template(setOption_signature, "(Ljava/lang/String;)Z") \ - template(createRiMethodResolved_name, "createRiMethodResolved") \ - template(createRiMethodResolved_signature, "(JLjava/lang/String;)Lcom/oracle/graal/api/meta/JavaMethod;") \ - template(createRiMethodUnresolved_name, "createRiMethodUnresolved") \ - template(createRiMethodUnresolved_signature, "(Ljava/lang/String;Ljava/lang/String;Lcom/oracle/graal/api/meta/JavaType;)Lcom/oracle/graal/api/meta/JavaMethod;") \ - template(createRiSignature_name, "createRiSignature") \ - template(createRiSignature_signature, "(Ljava/lang/String;)Lcom/oracle/graal/api/meta/Signature;") \ - template(createRiField_name, "createRiField") \ - template(createRiField_signature, "(Lcom/oracle/graal/api/meta/JavaType;Ljava/lang/String;Lcom/oracle/graal/api/meta/JavaType;II)Lcom/oracle/graal/api/meta/JavaField;") \ - template(createRiType_name, "createRiType") \ - template(createRiType_signature, "(JLjava/lang/String;)Lcom/oracle/graal/api/meta/JavaType;") \ - template(createRiTypePrimitive_name, "createRiTypePrimitive") \ - template(createRiTypePrimitive_signature, "(I)Lcom/oracle/graal/api/meta/JavaType;") \ - template(createRiTypeUnresolved_name, "createRiTypeUnresolved") \ - template(createRiTypeUnresolved_signature, "(Ljava/lang/String;)Lcom/oracle/graal/api/meta/JavaType;") \ - template(createCiConstant_name, "createCiConstant") \ - template(createCiConstant_signature, "(Lcom/oracle/graal/api/meta/Kind;J)Lcom/oracle/graal/api/meta/Constant;") \ - template(createCiConstantFloat_name, "createCiConstantFloat") \ - template(createCiConstantFloat_signature, "(F)Lcom/oracle/graal/api/meta/Constant;") \ - template(createCiConstantDouble_name, "createCiConstantDouble") \ - template(createCiConstantDouble_signature, "(D)Lcom/oracle/graal/api/meta/Constant;") \ - template(createCiConstantObject_name, "createCiConstantObject") \ - template(createCiConstantObject_signature, "(Ljava/lang/Object;)Lcom/oracle/graal/api/meta/Constant;") \ - template(getVMToCompiler_name, "getVMToCompiler") \ - template(getVMToCompiler_signature, "()Lcom/oracle/graal/hotspot/bridge/VMToCompiler;") \ - template(getInstance_name, "getInstance") \ - template(initialize_name, "initialize") \ - template(getInstance_signature, "()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;") \ - template(forObject_name, "forObject") \ - template(callbackInternal_name, "callbackInternal") \ - template(callback_signature, "(Ljava/lang/Object;)Ljava/lang/Object;") \ - template(MethodInvalidatedException, "com/oracle/graal/api/meta/InstalledCode$MethodInvalidatedException") \ - \ + \ + /* Support for Graal */ \ + template(java_util_BitSet, "java/util/BitSet") \ + /* graal.hotspot */ \ + template(com_oracle_graal_hotspot_HotSpotGraalRuntime, "com/oracle/graal/hotspot/HotSpotGraalRuntime") \ + template(com_oracle_graal_hotspot_HotSpotKlassOop, "com/oracle/graal/hotspot/HotSpotKlassOop") \ + template(com_oracle_graal_hotspot_HotSpotOptions, "com/oracle/graal/hotspot/HotSpotOptions") \ + template(com_oracle_graal_hotspot_HotSpotProxy, "com/oracle/graal/hotspot/HotSpotProxy") \ + template(com_oracle_graal_hotspot_HotSpotTargetMethod, "com/oracle/graal/hotspot/HotSpotTargetMethod") \ + template(com_oracle_graal_hotspot_bridge_VMToCompiler, "com/oracle/graal/hotspot/bridge/VMToCompiler") \ + template(com_oracle_graal_hotspot_meta_HotSpotCodeInfo, "com/oracle/graal/hotspot/meta/HotSpotCodeInfo") \ + template(com_oracle_graal_hotspot_meta_HotSpotCompiledMethod, "com/oracle/graal/hotspot/meta/HotSpotCompiledMethod") \ + template(com_oracle_graal_hotspot_meta_HotSpotJavaType, "com/oracle/graal/hotspot/meta/HotSpotJavaType") \ + template(com_oracle_graal_hotspot_meta_HotSpotMethodData, "com/oracle/graal/hotspot/meta/HotSpotMethodData") \ + template(com_oracle_graal_hotspot_meta_HotSpotResolvedJavaField, "com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField") \ + template(com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethod, "com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod") \ + template(com_oracle_graal_hotspot_meta_HotSpotResolvedJavaType, "com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType") \ + /* graal.api.meta */ \ + template(com_oracle_graal_api_meta_Constant, "com/oracle/graal/api/meta/Constant") \ + template(com_oracle_graal_api_meta_ConstantPool, "com/oracle/graal/api/meta/ConstantPool") \ + template(com_oracle_graal_api_meta_ExceptionHandler, "com/oracle/graal/api/meta/ExceptionHandler") \ + template(com_oracle_graal_api_meta_JavaMethod, "com/oracle/graal/api/meta/JavaMethod") \ + template(com_oracle_graal_api_meta_JavaType, "com/oracle/graal/api/meta/JavaType") \ + template(com_oracle_graal_api_meta_Kind, "com/oracle/graal/api/meta/Kind") \ + template(com_oracle_graal_api_meta_ResolvedJavaField, "com/oracle/graal/api/meta/ResolvedJavaField") \ + template(com_oracle_graal_api_meta_Value, "com/oracle/graal/api/meta/Value") \ + /* graal.api.code */ \ + template(com_oracle_graal_api_code_Assumptions, "com/oracle/graal/api/code/Assumptions") \ + template(com_oracle_graal_api_code_Assumptions_MethodContents, "com/oracle/graal/api/code/Assumptions$MethodContents") \ + template(com_oracle_graal_api_code_Assumptions_ConcreteSubtype, "com/oracle/graal/api/code/Assumptions$ConcreteSubtype") \ + template(com_oracle_graal_api_code_Assumptions_ConcreteMethod, "com/oracle/graal/api/code/Assumptions$ConcreteMethod") \ + template(com_oracle_graal_api_code_GenericCallback, "com/oracle/graal/api/code/GenericCallback") \ + template(com_oracle_graal_api_code_InstalledCode, "com/oracle/graal/api/code/CompilationResult") \ + template(com_oracle_graal_api_code_InstalledCode_Call, "com/oracle/graal/api/code/CompilationResult$Call") \ + template(com_oracle_graal_api_code_InstalledCode_DataPatch, "com/oracle/graal/api/code/CompilationResult$DataPatch") \ + template(com_oracle_graal_api_code_InstalledCode_ExceptionHandler, "com/oracle/graal/api/code/CompilationResult$ExceptionHandler") \ + template(com_oracle_graal_api_code_InstalledCode_Mark, "com/oracle/graal/api/code/CompilationResult$Mark") \ + template(com_oracle_graal_api_code_InstalledCode_Safepoint, "com/oracle/graal/api/code/CompilationResult$Safepoint") \ + template(com_oracle_graal_api_code_InstalledCode_Site, "com/oracle/graal/api/code/CompilationResult$Site") \ + template(com_oracle_graal_api_code_BytecodeFrame, "com/oracle/graal/api/code/BytecodeFrame") \ + template(com_oracle_graal_api_code_BytecodePosition, "com/oracle/graal/api/code/BytecodePosition") \ + template(com_oracle_graal_api_code_DebugInfo, "com/oracle/graal/api/code/DebugInfo") \ + template(com_oracle_graal_api_code_MonitorValue, "com/oracle/graal/api/code/MonitorValue") \ + template(com_oracle_graal_api_code_Register, "com/oracle/graal/api/code/Register") \ + template(com_oracle_graal_api_code_RegisterValue, "com/oracle/graal/api/code/RegisterValue") \ + template(com_oracle_graal_api_code_RuntimeCall, "com/oracle/graal/api/code/RuntimeCall") \ + template(com_oracle_graal_api_code_StackSlot, "com/oracle/graal/api/code/StackSlot") \ + template(com_oracle_graal_api_code_VirtualObject, "com/oracle/graal/api/code/VirtualObject") \ + template(startCompiler_name, "startCompiler") \ + template(bootstrap_name, "bootstrap") \ + template(shutdownCompiler_name, "shutdownCompiler") \ + template(compileMethod_name, "compileMethod") \ + template(compileMethod_signature, "(Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;IZI)Z") \ + template(setOption_name, "setOption") \ + template(setDefaultOptions_name, "setDefaultOptions") \ + template(setOption_signature, "(Ljava/lang/String;)Z") \ + template(createResolvedJavaMethod_name, "createResolvedJavaMethod") \ + template(createResolvedJavaMethod_signature, "(JLjava/lang/String;)Lcom/oracle/graal/api/meta/JavaMethod;") \ + template(createJavaMethod_name, "createJavaMethod") \ + template(createJavaMethod_signature, "(Ljava/lang/String;Ljava/lang/String;Lcom/oracle/graal/api/meta/JavaType;)Lcom/oracle/graal/api/meta/JavaMethod;") \ + template(createSignature_name, "createSignature") \ + template(createSignature_signature, "(Ljava/lang/String;)Lcom/oracle/graal/api/meta/Signature;") \ + template(createJavaField_name, "createJavaField") \ + template(createJavaField_signature, "(Lcom/oracle/graal/api/meta/JavaType;Ljava/lang/String;Lcom/oracle/graal/api/meta/JavaType;II)Lcom/oracle/graal/api/meta/JavaField;") \ + template(createJavaType_name, "createJavaType") \ + template(createJavaType_signature, "(Ljava/lang/String;)Lcom/oracle/graal/api/meta/JavaType;") \ + template(createPrimitiveJavaType_name, "createPrimitiveJavaType") \ + template(createPrimitiveJavaType_signature, "(I)Lcom/oracle/graal/api/meta/JavaType;") \ + template(createConstant_name, "createConstant") \ + template(createConstant_signature, "(Lcom/oracle/graal/api/meta/Kind;J)Lcom/oracle/graal/api/meta/Constant;") \ + template(createConstantFloat_name, "createConstantFloat") \ + template(createConstantFloat_signature, "(F)Lcom/oracle/graal/api/meta/Constant;") \ + template(createConstantDouble_name, "createConstantDouble") \ + template(createConstantDouble_signature, "(D)Lcom/oracle/graal/api/meta/Constant;") \ + template(createConstantObject_name, "createConstantObject") \ + template(createConstantObject_signature, "(Ljava/lang/Object;)Lcom/oracle/graal/api/meta/Constant;") \ + template(getVMToCompiler_name, "getVMToCompiler") \ + template(getVMToCompiler_signature, "()Lcom/oracle/graal/hotspot/bridge/VMToCompiler;") \ + template(getInstance_name, "getInstance") \ + template(initialize_name, "initialize") \ + template(getInstance_signature, "()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;") \ + template(forObject_name, "forObject") \ + template(callbackInternal_name, "callbackInternal") \ + template(callback_signature, "(Ljava/lang/Object;)Ljava/lang/Object;") \ + template(MethodInvalidatedException, "com/oracle/graal/api/meta/InstalledCode$MethodInvalidatedException") \ + \ \ /* common method and field names */ \ template(object_initializer_name, "") \ diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Sun Jun 10 01:17:48 2012 +0200 @@ -68,11 +68,11 @@ return arr->length() * MapWordBits; } -// creates a hotspot oop map out of the byte arrays provided by CiDebugInfo +// creates a hotspot oop map out of the byte arrays provided by DebugInfo static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) { OopMap* map = new OopMap(total_frame_size, parameter_count); - oop register_map = (oop) CiDebugInfo::registerRefMap(debug_info); - oop frame_map = (oop) CiDebugInfo::frameRefMap(debug_info); + oop register_map = (oop) DebugInfo::registerRefMap(debug_info); + oop frame_map = (oop) DebugInfo::frameRefMap(debug_info); if (register_map != NULL) { for (jint i = 0; i < NUM_CPU_REGS; i++) { @@ -104,16 +104,16 @@ // TODO: finish this - graal doesn't provide any scope values at the moment static ScopeValue* get_hotspot_value(oop value, int total_frame_size, GrowableArray* objects, ScopeValue* &second) { second = NULL; - if (value == CiValue::IllegalValue()) { + if (value == Value::IllegalValue()) { return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); } - BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(CiValue::kind(value))); + BasicType type = GraalCompiler::kindToBasicType(Kind::typeChar(Value::kind(value))); Location::Type locationType = Location::normal; if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop; - if (value->is_a(CiRegisterValue::klass())) { - jint number = CiRegister::number(CiRegisterValue::reg(value)); + if (value->is_a(RegisterValue::klass())) { + jint number = code_Register::number(RegisterValue::reg(value)); if (number < 16) { if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE || type == T_ADDRESS) { locationType = Location::int_in_long; @@ -141,14 +141,14 @@ } return value; } - } else if (value->is_a(CiStackSlot::klass())) { + } else if (value->is_a(StackSlot::klass())) { if (type == T_DOUBLE) { locationType = Location::dbl; } else if (type == T_LONG) { locationType = Location::lng; } - jint offset = CiStackSlot::offset(value); - if (CiStackSlot::addFrameSize(value)) { + jint offset = StackSlot::offset(value); + if (StackSlot::addFrameSize(value)) { offset += total_frame_size; } ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); @@ -156,16 +156,16 @@ second = value; } return value; - } else if (value->is_a(CiConstant::klass())){ - oop obj = CiConstant::object(value); - jlong prim = CiConstant::primitive(value); + } else if (value->is_a(Constant::klass())){ + oop obj = Constant::object(value); + jlong prim = Constant::primitive(value); if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { return new ConstantIntValue(*(jint*)&prim); } else if (type == T_LONG || type == T_DOUBLE) { second = new ConstantIntValue(0); return new ConstantLongValue(prim); } else if (type == T_OBJECT) { - oop obj = CiConstant::object(value); + oop obj = Constant::object(value); if (obj == NULL) { return new ConstantOopWriteValue(NULL); } else { @@ -175,10 +175,10 @@ return new ConstantLongValue(prim); } tty->print("%i", type); - } else if (value->is_a(CiVirtualObject::klass())) { - oop type = CiVirtualObject::type(value); - int id = CiVirtualObject::id(value); - klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)); + } else if (value->is_a(VirtualObject::klass())) { + oop type = VirtualObject::type(value); + int id = VirtualObject::id(value); + klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)); bool isLongArray = klass == Universe::longArrayKlassObj(); for (jint i = 0; i < objects->length(); i++) { @@ -190,7 +190,7 @@ ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), klass))); - arrayOop values = (arrayOop) CiVirtualObject::values(value); + arrayOop values = (arrayOop) VirtualObject::values(value); for (jint i = 0; i < values->length(); i++) { ((oop*) values->base(T_OBJECT))[i]; } @@ -226,19 +226,19 @@ } static MonitorValue* get_monitor_value(oop value, int total_frame_size, GrowableArray* objects) { - guarantee(value->is_a(CiMonitorValue::klass()), "Monitors must be of type CiMonitorValue"); + guarantee(value->is_a(code_MonitorValue::klass()), "Monitors must be of type MonitorValue"); ScopeValue* second = NULL; - ScopeValue* owner_value = get_hotspot_value(CiMonitorValue::owner(value), total_frame_size, objects, second); + ScopeValue* owner_value = get_hotspot_value(code_MonitorValue::owner(value), total_frame_size, objects, second); assert(second == NULL, "monitor cannot occupy two stack slots"); - ScopeValue* lock_data_value = get_hotspot_value(CiMonitorValue::lockData(value), total_frame_size, objects, second); + ScopeValue* lock_data_value = get_hotspot_value(code_MonitorValue::lockData(value), total_frame_size, objects, second); assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots"); assert(lock_data_value->is_location(), "invalid monitor location"); Location lock_data_loc = ((LocationValue*)lock_data_value)->location(); bool eliminated = false; - if (CiMonitorValue::eliminated(value)) { + if (code_MonitorValue::eliminated(value)) { eliminated = true; } @@ -250,18 +250,18 @@ _env->set_oop_recorder(_oop_recorder); _env->set_dependencies(_dependencies); _dependencies = new Dependencies(_env); - Handle assumptions_handle = CiTargetMethod::assumptions(HotSpotTargetMethod::targetMethod(target_method)); + Handle assumptions_handle = InstalledCode::assumptions(HotSpotTargetMethod::targetMethod(target_method)); if (!assumptions_handle.is_null()) { - objArrayHandle assumptions(Thread::current(), (objArrayOop)CiAssumptions::list(assumptions_handle())); + objArrayHandle assumptions(Thread::current(), (objArrayOop)Assumptions::list(assumptions_handle())); int length = assumptions->length(); for (int i = 0; i < length; ++i) { Handle assumption = assumptions->obj_at(i); if (!assumption.is_null()) { - if (assumption->klass() == CiAssumptions_MethodContents::klass()) { + if (assumption->klass() == Assumptions_MethodContents::klass()) { assumption_MethodContents(assumption); - } else if (assumption->klass() == CiAssumptions_ConcreteSubtype::klass()) { + } else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) { assumption_ConcreteSubtype(assumption); - } else if (assumption->klass() == CiAssumptions_ConcreteMethod::klass()) { + } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) { assumption_ConcreteMethod(assumption); } else { assumption->print(); @@ -327,11 +327,11 @@ _sites = (arrayOop) HotSpotTargetMethod::sites(target_method); _exception_handlers = (arrayOop) HotSpotTargetMethod::exceptionHandlers(target_method); - _code = (arrayOop) CiTargetMethod::targetCode(_citarget_method); - _code_size = CiTargetMethod::targetCodeSize(_citarget_method); + _code = (arrayOop) InstalledCode::targetCode(_citarget_method); + _code_size = InstalledCode::targetCodeSize(_citarget_method); // The frame size we get from the target method does not include the return address, so add one word for it here. - _total_frame_size = CiTargetMethod::frameSize(_citarget_method) + HeapWordSize; - _custom_stack_area_offset = CiTargetMethod::customStackAreaOffset(_citarget_method); + _total_frame_size = InstalledCode::frameSize(_citarget_method) + HeapWordSize; + _custom_stack_area_offset = InstalledCode::customStackAreaOffset(_citarget_method); // (very) conservative estimate: each site needs a constant section entry @@ -365,18 +365,18 @@ oop* sites = (oop*) _sites->base(T_OBJECT); for (int i = 0; i < _sites->length(); i++) { oop site = sites[i]; - jint pc_offset = CiTargetMethod_Site::pcOffset(site); + jint pc_offset = InstalledCode_Site::pcOffset(site); - if (site->is_a(CiTargetMethod_Call::klass())) { + if (site->is_a(InstalledCode_Call::klass())) { TRACE_graal_4("call at %i", pc_offset); site_Call(buffer, pc_offset, site); - } else if (site->is_a(CiTargetMethod_Safepoint::klass())) { + } else if (site->is_a(InstalledCode_Safepoint::klass())) { TRACE_graal_4("safepoint at %i", pc_offset); site_Safepoint(buffer, pc_offset, site); - } else if (site->is_a(CiTargetMethod_DataPatch::klass())) { + } else if (site->is_a(InstalledCode_DataPatch::klass())) { TRACE_graal_4("datapatch at %i", pc_offset); site_DataPatch(buffer, pc_offset, site); - } else if (site->is_a(CiTargetMethod_Mark::klass())) { + } else if (site->is_a(InstalledCode_Mark::klass())) { TRACE_graal_4("mark at %i", pc_offset); site_Mark(buffer, pc_offset, site); } else { @@ -386,7 +386,7 @@ } void CodeInstaller::assumption_MethodContents(Handle assumption) { - Handle method_handle = CiAssumptions_MethodContents::method(assumption()); + Handle method_handle = Assumptions_MethodContents::method(assumption()); methodHandle method = getMethodFromHotSpotMethod(method_handle()); ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(method()); @@ -394,11 +394,11 @@ } void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) { - Handle context_handle = CiAssumptions_ConcreteSubtype::context(assumption()); - ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(context_handle))); + Handle context_handle = Assumptions_ConcreteSubtype::context(assumption()); + ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(context_handle))); - Handle type_handle = CiAssumptions_ConcreteSubtype::subtype(assumption()); - ciKlass* type = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type_handle))); + Handle type_handle = Assumptions_ConcreteSubtype::subtype(assumption()); + ciKlass* type = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type_handle))); _dependencies->assert_leaf_type(type); if (context != type) { @@ -408,12 +408,12 @@ } void CodeInstaller::assumption_ConcreteMethod(Handle assumption) { - Handle impl_handle = CiAssumptions_ConcreteMethod::impl(assumption()); + Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption()); methodHandle impl = getMethodFromHotSpotMethod(impl_handle()); ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(impl()); - Handle context_handle = CiAssumptions_ConcreteMethod::context(assumption()); - ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(context_handle))); + Handle context_handle = Assumptions_ConcreteMethod::context(assumption()); + ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(context_handle))); _dependencies->assert_unique_concrete_method(context, m); } @@ -428,8 +428,8 @@ oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT); for (int i = 0; i < _exception_handlers->length(); i++) { oop exc = exception_handlers[i]; - jint pc_offset = CiTargetMethod_Site::pcOffset(exc); - jint handler_offset = CiTargetMethod_ExceptionHandler::handlerPos(exc); + jint pc_offset = InstalledCode_Site::pcOffset(exc); + jint handler_offset = InstalledCode_ExceptionHandler::handlerPos(exc); // Subtable header _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); @@ -441,15 +441,15 @@ } void CodeInstaller::record_scope(jint pc_offset, oop frame, GrowableArray* objects) { - assert(frame->klass() == CiFrame::klass(), "CiFrame expected"); - oop caller_frame = CiCodePos::caller(frame); + assert(frame->klass() == BytecodeFrame::klass(), "BytecodeFrame expected"); + oop caller_frame = BytecodePosition::caller(frame); if (caller_frame != NULL) { record_scope(pc_offset, caller_frame, objects); } - oop hotspot_method = CiCodePos::method(frame); + oop hotspot_method = BytecodePosition::method(frame); methodOop method = getMethodFromHotSpotMethod(hotspot_method); - jint bci = CiCodePos::bci(frame); + jint bci = BytecodePosition::bci(frame); bool reexecute; if (bci == -1) { reexecute = false; @@ -457,7 +457,7 @@ Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci)); reexecute = Interpreter::bytecode_should_reexecute(code); if (frame != NULL) { - reexecute = (CiFrame::duringCall(frame) == 0); + reexecute = (BytecodeFrame::duringCall(frame) == 0); } } @@ -465,10 +465,10 @@ tty->print_cr("Recording scope pc_offset=%d bci=%d frame=%d", pc_offset, bci, frame); } - jint local_count = CiFrame::numLocals(frame); - jint expression_count = CiFrame::numStack(frame); - jint monitor_count = CiFrame::numLocks(frame); - arrayOop values = (arrayOop) CiFrame::values(frame); + jint local_count = BytecodeFrame::numLocals(frame); + jint expression_count = BytecodeFrame::numStack(frame); + jint monitor_count = BytecodeFrame::numLocks(frame); + arrayOop values = (arrayOop) BytecodeFrame::values(frame); assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length"); @@ -502,8 +502,8 @@ } if (second != NULL) { i++; - assert(i < values->length(), "double-slot value not followed by CiValue.IllegalValue"); - assert(((oop*) values->base(T_OBJECT))[i] == CiValue::IllegalValue(), "double-slot value not followed by CiValue.IllegalValue"); + assert(i < values->length(), "double-slot value not followed by Value.IllegalValue"); + assert(((oop*) values->base(T_OBJECT))[i] == Value::IllegalValue(), "double-slot value not followed by Value.IllegalValue"); } } @@ -514,7 +514,7 @@ DebugToken* monitors_token = _debug_recorder->create_monitor_values(monitors); bool throw_exception = false; - if (CiFrame::rethrowException(frame)) { + if (BytecodeFrame::rethrowException(frame)) { throw_exception = true; } @@ -522,14 +522,14 @@ } void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) { - oop debug_info = CiTargetMethod_Safepoint::debugInfo(site); + oop debug_info = InstalledCode_Safepoint::debugInfo(site); assert(debug_info != NULL, "debug info expected"); // address instruction = _instructions->start() + pc_offset; // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); _debug_recorder->add_safepoint(pc_offset, -1, create_oop_map(_total_frame_size, _parameter_count, debug_info)); - oop code_pos = CiDebugInfo::bytecodePosition(debug_info); + oop code_pos = DebugInfo::bytecodePosition(debug_info); record_scope(pc_offset, code_pos, new GrowableArray()); _debug_recorder->end_safepoint(pc_offset); @@ -537,50 +537,50 @@ address CodeInstaller::runtime_call_target_address(oop runtime_call) { address target_addr = 0x0; - if (runtime_call == CiRuntimeCall::Debug()) { - TRACE_graal_3("CiRuntimeCall::Debug()"); - } else if (runtime_call == CiRuntimeCall::UnwindException()) { + if (runtime_call == RuntimeCall::Debug()) { + TRACE_graal_3("RuntimeCall::Debug()"); + } else if (runtime_call == RuntimeCall::UnwindException()) { target_addr = Runtime1::entry_for(Runtime1::graal_unwind_exception_call_id); - TRACE_graal_3("CiRuntimeCall::UnwindException()"); - } else if (runtime_call == CiRuntimeCall::SetDeoptInfo()) { + TRACE_graal_3("RuntimeCall::UnwindException()"); + } else if (runtime_call == RuntimeCall::SetDeoptInfo()) { target_addr = Runtime1::entry_for(Runtime1::graal_set_deopt_info_id); - TRACE_graal_3("CiRuntimeCall::SetDeoptInfo()"); - } else if (runtime_call == CiRuntimeCall::CreateNullPointerException()) { + TRACE_graal_3("RuntimeCall::SetDeoptInfo()"); + } else if (runtime_call == RuntimeCall::CreateNullPointerException()) { target_addr = Runtime1::entry_for(Runtime1::graal_create_null_pointer_exception_id); - TRACE_graal_3("CiRuntimeCall::CreateNullPointerException()"); - } else if (runtime_call == CiRuntimeCall::CreateOutOfBoundsException()) { + TRACE_graal_3("RuntimeCall::CreateNullPointerException()"); + } else if (runtime_call == RuntimeCall::CreateOutOfBoundsException()) { target_addr = Runtime1::entry_for(Runtime1::graal_create_out_of_bounds_exception_id); - TRACE_graal_3("CiRuntimeCall::CreateOutOfBoundsException()"); - } else if (runtime_call == CiRuntimeCall::JavaTimeMillis()) { + TRACE_graal_3("RuntimeCall::CreateOutOfBoundsException()"); + } else if (runtime_call == RuntimeCall::JavaTimeMillis()) { target_addr = CAST_FROM_FN_PTR(address, os::javaTimeMillis); - TRACE_graal_3("CiRuntimeCall::JavaTimeMillis()"); - } else if (runtime_call == CiRuntimeCall::JavaTimeNanos()) { + TRACE_graal_3("RuntimeCall::JavaTimeMillis()"); + } else if (runtime_call == RuntimeCall::JavaTimeNanos()) { target_addr = CAST_FROM_FN_PTR(address, os::javaTimeNanos); - TRACE_graal_3("CiRuntimeCall::JavaTimeNanos()"); - } else if (runtime_call == CiRuntimeCall::ArithmeticFrem()) { + TRACE_graal_3("RuntimeCall::JavaTimeNanos()"); + } else if (runtime_call == RuntimeCall::ArithmeticFrem()) { target_addr = Runtime1::entry_for(Runtime1::graal_arithmetic_frem_id); - TRACE_graal_3("CiRuntimeCall::ArithmeticFrem()"); - } else if (runtime_call == CiRuntimeCall::ArithmeticDrem()) { + TRACE_graal_3("RuntimeCall::ArithmeticFrem()"); + } else if (runtime_call == RuntimeCall::ArithmeticDrem()) { target_addr = Runtime1::entry_for(Runtime1::graal_arithmetic_drem_id); - TRACE_graal_3("CiRuntimeCall::ArithmeticDrem()"); - } else if (runtime_call == CiRuntimeCall::ArithmeticSin()) { + TRACE_graal_3("RuntimeCall::ArithmeticDrem()"); + } else if (runtime_call == RuntimeCall::ArithmeticSin()) { target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dsin); - TRACE_graal_3("CiRuntimeCall::ArithmeticSin()"); - } else if (runtime_call == CiRuntimeCall::ArithmeticCos()) { + TRACE_graal_3("RuntimeCall::ArithmeticSin()"); + } else if (runtime_call == RuntimeCall::ArithmeticCos()) { target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dcos); - TRACE_graal_3("CiRuntimeCall::ArithmeticCos()"); - } else if (runtime_call == CiRuntimeCall::ArithmeticTan()) { + TRACE_graal_3("RuntimeCall::ArithmeticCos()"); + } else if (runtime_call == RuntimeCall::ArithmeticTan()) { target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dtan); - TRACE_graal_3("CiRuntimeCall::ArithmeticTan()"); - } else if (runtime_call == CiRuntimeCall::RegisterFinalizer()) { + TRACE_graal_3("RuntimeCall::ArithmeticTan()"); + } else if (runtime_call == RuntimeCall::RegisterFinalizer()) { target_addr = Runtime1::entry_for(Runtime1::register_finalizer_id); - TRACE_graal_3("CiRuntimeCall::RegisterFinalizer()"); - } else if (runtime_call == CiRuntimeCall::Deoptimize()) { + TRACE_graal_3("RuntimeCall::RegisterFinalizer()"); + } else if (runtime_call == RuntimeCall::Deoptimize()) { target_addr = SharedRuntime::deopt_blob()->uncommon_trap(); - TRACE_graal_3("CiRuntimeCall::Deoptimize()"); - } else if (runtime_call == CiRuntimeCall::GenericCallback()) { + TRACE_graal_3("RuntimeCall::Deoptimize()"); + } else if (runtime_call == RuntimeCall::GenericCallback()) { target_addr = Runtime1::entry_for(Runtime1::graal_generic_callback_id); - TRACE_graal_3("CiRuntimeCall::GenericCallback()"); + TRACE_graal_3("RuntimeCall::GenericCallback()"); } else { runtime_call->print(); fatal("runtime_call not implemented"); @@ -589,22 +589,22 @@ } void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) { - oop target = CiTargetMethod_Call::target(site); + oop target = InstalledCode_Call::target(site); instanceKlass* target_klass = instanceKlass::cast(target->klass()); - oop runtime_call = NULL; // CiRuntimeCall - oop hotspot_method = NULL; // RiMethod + oop runtime_call = NULL; // RuntimeCall + oop hotspot_method = NULL; // JavaMethod oop global_stub = NULL; if (target_klass->is_subclass_of(SystemDictionary::Long_klass())) { global_stub = target; - } else if (target_klass->name() == vmSymbols::com_oracle_max_cri_ci_CiRuntimeCall()) { + } else if (target_klass->name() == vmSymbols::com_oracle_graal_api_code_RuntimeCall()) { runtime_call = target; } else { hotspot_method = target; } - oop debug_info = CiTargetMethod_Call::debugInfo(site); + oop debug_info = InstalledCode_Call::debugInfo(site); assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type"); @@ -641,13 +641,13 @@ } if (debug_info != NULL) { - oop frame = CiDebugInfo::bytecodePosition(debug_info); - _debug_recorder->add_safepoint(next_pc_offset, CiFrame::leafGraphId(frame), create_oop_map(_total_frame_size, _parameter_count, debug_info)); + oop frame = DebugInfo::bytecodePosition(debug_info); + _debug_recorder->add_safepoint(next_pc_offset, BytecodeFrame::leafGraphId(frame), create_oop_map(_total_frame_size, _parameter_count, debug_info)); record_scope(next_pc_offset, frame, new GrowableArray()); } if (runtime_call != NULL) { - if (runtime_call != CiRuntimeCall::Debug()) { + if (runtime_call != RuntimeCall::Debug()) { address target_addr = runtime_call_target_address(runtime_call); if (inst->is_call()) { @@ -676,12 +676,12 @@ _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand); TRACE_graal_3("relocating (stub) at %016x", inst); } else { // method != NULL - assert(hotspot_method != NULL, "unexpected RiMethod"); + assert(hotspot_method != NULL, "unexpected JavaMethod"); assert(debug_info != NULL, "debug info expected"); methodOop method = NULL; // we need to check, this might also be an unresolved method - if (hotspot_method->is_a(HotSpotMethodResolved::klass())) { + if (hotspot_method->is_a(HotSpotResolvedJavaMethod::klass())) { method = getMethodFromHotSpotMethod(hotspot_method); } @@ -730,13 +730,13 @@ } void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) { - oop constant = CiTargetMethod_DataPatch::constant(site); - int alignment = CiTargetMethod_DataPatch::alignment(site); - oop kind = CiConstant::kind(constant); + oop constant = InstalledCode_DataPatch::constant(site); + int alignment = InstalledCode_DataPatch::alignment(site); + oop kind = Constant::kind(constant); address instruction = _instructions->start() + pc_offset; - char typeChar = CiKind::typeChar(kind); + char typeChar = Kind::typeChar(kind); switch (typeChar) { case 'z': case 'b': @@ -758,7 +758,7 @@ // we don't care if this is a long/double/etc., the primitive field contains the right bits address dest = _constants->start() + size; _constants->set_end(dest + BytesPerLong); - *(jlong*) dest = CiConstant::primitive(constant); + *(jlong*) dest = Constant::primitive(constant); long disp = dest - next_instruction; assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); @@ -770,13 +770,13 @@ } case 'a': { address operand = Assembler::locate_operand(instruction, Assembler::imm_operand); - Handle obj = CiConstant::object(constant); + Handle obj = Constant::object(constant); if (obj->is_a(HotSpotKlassOop::klass())) { assert(!obj.is_null(), ""); *((jobject*) operand) = JNIHandles::make_local(java_lang_Class::as_klassOop(HotSpotKlassOop::javaMirror(obj))); _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); - TRACE_graal_3("relocating (HotSpotType) at %016x/%016x", instruction, operand); + TRACE_graal_3("relocating (HotSpotJavaType) at %016x/%016x", instruction, operand); } else { jobject value = JNIHandles::make_local(obj()); if (obj() == HotSpotProxy::DUMMY_CONSTANT_OBJ()) { @@ -789,14 +789,14 @@ break; } default: - fatal("unexpected CiKind in DataPatch"); + fatal("unexpected Kind in DataPatch"); break; } } void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) { - oop id_obj = CiTargetMethod_Mark::id(site); - arrayOop references = (arrayOop) CiTargetMethod_Mark::references(site); + oop id_obj = InstalledCode_Mark::id(site); + arrayOop references = (arrayOop) InstalledCode_Mark::references(site); if (id_obj != NULL) { assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected"); @@ -823,7 +823,7 @@ case MARK_STATIC_CALL_STUB: { assert(references->length() == 1, "static call stub needs one reference"); oop ref = ((oop*) references->base(T_OBJECT))[0]; - address call_pc = _instructions->start() + CiTargetMethod_Site::pcOffset(ref); + address call_pc = _instructions->start() + InstalledCode_Site::pcOffset(ref); _instructions->relocate(instruction, static_stub_Relocation::spec(call_pc)); _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); break; @@ -868,14 +868,14 @@ assert(references->length() == 2, "MARK_KLASS_PATCHING/MARK_ACCESS_FIELD_PATCHING needs 2 references"); oop ref1 = ((oop*) references->base(T_OBJECT))[0]; oop ref2 = ((oop*) references->base(T_OBJECT))[1]; - int i_byte_count = CiTargetMethod_Site::pcOffset(ref2) - CiTargetMethod_Site::pcOffset(ref1); + int i_byte_count = InstalledCode_Site::pcOffset(ref2) - InstalledCode_Site::pcOffset(ref1); assert(i_byte_count == (unsigned char)i_byte_count, "invalid offset"); *byte_count = i_byte_count; *being_initialized_entry_offset = *byte_count + *byte_skip; // we need to correct the offset of a field access - it's created with MAX_INT to ensure the correct size, and hotspot expects 0 if (id == MARK_ACCESS_FIELD_PATCHING) { - NativeMovRegMem* inst = nativeMovRegMem_at(_instructions->start() + CiTargetMethod_Site::pcOffset(ref1)); + NativeMovRegMem* inst = nativeMovRegMem_at(_instructions->start() + InstalledCode_Site::pcOffset(ref1)); assert(inst->offset() == max_jint, "unexpected offset value"); inst->set_offset(0); } diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalCodeInstaller.hpp --- a/src/share/vm/graal/graalCodeInstaller.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -22,7 +22,7 @@ */ /* - * This class handles the conversion from a CiTargetMethod to a CodeBlob or an nmethod. + * This class handles the conversion from a InstalledCode to a CodeBlob or an nmethod. */ class CodeInstaller { private: @@ -90,7 +90,7 @@ static address runtime_call_target_address(oop runtime_call); private: - // extract the fields of the CiTargetMethod + // extract the fields of the InstalledCode void initialize_fields(oop target_method); void initialize_assumptions(oop target_method); diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalCompiler.cpp Sun Jun 10 01:17:48 2012 +0200 @@ -162,7 +162,7 @@ ciEnv* current_env = JavaThread::current()->env(); JavaThread::current()->set_env(NULL); JavaThread::current()->set_compiling(true); - Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK); + Handle hotspot_method = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK); jboolean success = VMToCompiler::compileMethod(hotspot_method, entry_bci, blocking, method->graal_priority()); JavaThread::current()->set_compiling(false); JavaThread::current()->set_env(current_env); @@ -188,11 +188,11 @@ TRACE_graal_1("GraalCompiler::print_timers"); } -Handle GraalCompiler::get_RiType(Symbol* klass_name, TRAPS) { - return VMToCompiler::createRiTypeUnresolved(VmIds::toString(klass_name, THREAD), THREAD); +Handle GraalCompiler::get_JavaType(Symbol* klass_name, TRAPS) { + return VMToCompiler::createJavaType(VmIds::toString(klass_name, THREAD), THREAD); } -Handle GraalCompiler::get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { +Handle GraalCompiler::get_JavaTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { Symbol* signature = cp->symbol_at(index); BasicType field_type = FieldType::basic_type(signature); @@ -201,16 +201,16 @@ if (field_type == T_OBJECT || field_type == T_ARRAY) { KlassHandle handle = GraalEnv::get_klass_by_name(loading_klass, signature, false); if (handle.is_null()) { - return get_RiType(signature, CHECK_NULL); + return get_JavaType(signature, CHECK_NULL); } else { - return get_RiType(handle, CHECK_NULL); + return get_JavaType(handle, CHECK_NULL); } } else { - return VMToCompiler::createRiTypePrimitive(field_type, CHECK_NULL); + return VMToCompiler::createPrimitiveJavaType(field_type, CHECK_NULL); } } -Handle GraalCompiler::get_RiType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { +Handle GraalCompiler::get_JavaType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { bool is_accessible = false; KlassHandle klass = GraalEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); @@ -225,98 +225,98 @@ if (tag.is_klass()) { // The klass has been inserted into the constant pool // very recently. - return GraalCompiler::get_RiType(cp->resolved_klass_at(index), CHECK_NULL); + return GraalCompiler::get_JavaType(cp->resolved_klass_at(index), CHECK_NULL); } else if (tag.is_symbol()) { klass_name = cp->symbol_at(index); } else { assert(cp->tag_at(index).is_unresolved_klass(), "wrong tag"); klass_name = cp->unresolved_klass_at(index); } - return GraalCompiler::get_RiType(klass_name, CHECK_NULL); + return GraalCompiler::get_JavaType(klass_name, CHECK_NULL); } else { - return GraalCompiler::get_RiType(klass, CHECK_NULL); + return GraalCompiler::get_JavaType(klass, CHECK_NULL); } } -Handle GraalCompiler::get_RiType(KlassHandle klass, TRAPS) { +Handle GraalCompiler::get_JavaType(KlassHandle klass, TRAPS) { Handle name = VmIds::toString(klass->name(), THREAD); - return createHotSpotTypeResolved(klass, name, CHECK_NULL); + return createHotSpotResolvedJavaType(klass, name, CHECK_NULL); } -Handle GraalCompiler::get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) { +Handle GraalCompiler::get_JavaField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) { Handle name = VmIds::toString(field_name, CHECK_NULL); - return VMToCompiler::createRiField(field_holder, name, field_type, offset, flags, CHECK_NULL); + return VMToCompiler::createJavaField(field_holder, name, field_type, offset, flags, CHECK_NULL); } -Handle GraalCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) { +Handle GraalCompiler::createHotSpotResolvedJavaType(KlassHandle klass, Handle name, TRAPS) { ObjectLocker ol(klass, THREAD); if (klass->graal_mirror() != NULL) { return klass->graal_mirror(); } - instanceKlass::cast(HotSpotTypeResolved::klass())->initialize(CHECK_NULL); - Handle obj = instanceKlass::cast(HotSpotTypeResolved::klass())->allocate_instance(CHECK_NULL); + instanceKlass::cast(HotSpotResolvedJavaType::klass())->initialize(CHECK_NULL); + Handle obj = instanceKlass::cast(HotSpotResolvedJavaType::klass())->allocate_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); if (klass->oop_is_instance()) { ResourceMark rm; instanceKlass* ik = (instanceKlass*)klass()->klass_part(); Handle full_name = java_lang_String::create_from_str(ik->signature_name(), CHECK_NULL); - HotSpotType::set_name(obj, full_name()); + HotSpotJavaType::set_name(obj, full_name()); } else { - HotSpotType::set_name(obj, name()); + HotSpotJavaType::set_name(obj, name()); } - HotSpotTypeResolved::set_javaMirror(obj, klass->java_mirror()); - HotSpotTypeResolved::set_simpleName(obj, name()); - HotSpotTypeResolved::set_accessFlags(obj, klass->access_flags().as_int()); - HotSpotTypeResolved::set_isInterface(obj, klass->is_interface()); - HotSpotTypeResolved::set_superCheckOffset(obj, klass->super_check_offset()); - HotSpotTypeResolved::set_isInstanceClass(obj, klass->oop_is_instance()); + HotSpotResolvedJavaType::set_javaMirror(obj, klass->java_mirror()); + HotSpotResolvedJavaType::set_simpleName(obj, name()); + HotSpotResolvedJavaType::set_accessFlags(obj, klass->access_flags().as_int()); + HotSpotResolvedJavaType::set_isInterface(obj, klass->is_interface()); + HotSpotResolvedJavaType::set_superCheckOffset(obj, klass->super_check_offset()); + HotSpotResolvedJavaType::set_isInstanceClass(obj, klass->oop_is_instance()); if (klass->oop_is_javaArray()) { - HotSpotTypeResolved::set_isArrayClass(obj, true); + HotSpotResolvedJavaType::set_isArrayClass(obj, true); } else { - HotSpotTypeResolved::set_isArrayClass(obj, false); - HotSpotTypeResolved::set_instanceSize(obj, instanceKlass::cast(klass())->size_helper() * HeapWordSize); - HotSpotTypeResolved::set_hasFinalizer(obj, klass->has_finalizer()); + HotSpotResolvedJavaType::set_isArrayClass(obj, false); + HotSpotResolvedJavaType::set_instanceSize(obj, instanceKlass::cast(klass())->size_helper() * HeapWordSize); + HotSpotResolvedJavaType::set_hasFinalizer(obj, klass->has_finalizer()); } // TODO replace these with correct values - HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false); + HotSpotResolvedJavaType::set_hasFinalizableSubclass(obj, false); klass->set_graal_mirror(obj()); return obj; } -Handle GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) { +Handle GraalCompiler::createHotSpotResolvedJavaMethod(methodHandle method, TRAPS) { if (method->graal_mirror() != NULL) { - assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class..."); + assert(method->graal_mirror()->is_a(HotSpotResolvedJavaMethod::klass()), "unexpected class..."); return method->graal_mirror(); } Handle name = VmIds::toString(method->name(), CHECK_NULL); - instanceKlass::cast(HotSpotMethodResolved::klass())->initialize(CHECK_NULL); - Handle obj = instanceKlass::cast(HotSpotMethodResolved::klass())->allocate_instance(CHECK_NULL); + instanceKlass::cast(HotSpotResolvedJavaMethod::klass())->initialize(CHECK_NULL); + Handle obj = instanceKlass::cast(HotSpotResolvedJavaMethod::klass())->allocate_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); // (thomaswue) Cannot use reflection here, because the compiler thread could dead lock with the running application. // oop reflected = getReflectedMethod(method(), CHECK_NULL); - HotSpotMethodResolved::set_javaMirror(obj, method()); - HotSpotMethodResolved::set_name(obj, name()); + HotSpotResolvedJavaMethod::set_javaMirror(obj, method()); + HotSpotResolvedJavaMethod::set_name(obj, name()); KlassHandle klass = method->method_holder(); Handle holder_name = VmIds::toString(klass->name(), CHECK_NULL); - Handle holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL); - HotSpotMethodResolved::set_holder(obj, holder()); + Handle holder = GraalCompiler::createHotSpotResolvedJavaType(klass, holder_name, CHECK_NULL); + HotSpotResolvedJavaMethod::set_holder(obj, holder()); - HotSpotMethodResolved::set_codeSize(obj, method->code_size()); - HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int()); - HotSpotMethodResolved::set_maxLocals(obj, method->max_locals()); - HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack()); - HotSpotMethodResolved::set_canBeInlined(obj, !method->is_not_compilable() && !CompilerOracle::should_not_inline(method)); + HotSpotResolvedJavaMethod::set_codeSize(obj, method->code_size()); + HotSpotResolvedJavaMethod::set_accessFlags(obj, method->access_flags().as_int()); + HotSpotResolvedJavaMethod::set_maxLocals(obj, method->max_locals()); + HotSpotResolvedJavaMethod::set_maxStackSize(obj, method->max_stack()); + HotSpotResolvedJavaMethod::set_canBeInlined(obj, !method->is_not_compilable() && !CompilerOracle::should_not_inline(method)); method->set_graal_mirror(obj()); return obj; @@ -354,7 +354,7 @@ case 'r': return T_ADDRESS; case '-': return T_ILLEGAL; default: - fatal(err_msg("unexpected CiKind: %c", ch)); + fatal(err_msg("unexpected Kind: %c", ch)); break; } return T_ILLEGAL; diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalCompiler.hpp --- a/src/share/vm/graal/graalCompiler.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalCompiler.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -67,14 +67,14 @@ // Print compilation timers and statistics virtual void print_timers(); - static Handle get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS); - static Handle get_RiType(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS); - static Handle get_RiType(Symbol* klass_name, TRAPS); - static Handle get_RiType(KlassHandle klass, TRAPS); - static Handle get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS); + static Handle get_JavaTypeFromSignature(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS); + static Handle get_JavaType(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS); + static Handle get_JavaType(Symbol* klass_name, TRAPS); + static Handle get_JavaType(KlassHandle klass, TRAPS); + static Handle get_JavaField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS); - static Handle createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS); - static Handle createHotSpotMethodResolved(methodHandle method, TRAPS); + static Handle createHotSpotResolvedJavaType(KlassHandle klass, Handle name, TRAPS); + static Handle createHotSpotResolvedJavaMethod(methodHandle method, TRAPS); static Handle createHotSpotMethodData(methodDataHandle method_data, TRAPS); void exit(); diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Sun Jun 10 01:17:48 2012 +0200 @@ -41,16 +41,16 @@ } methodOop getMethodFromHotSpotMethod(oop hotspot_method) { - return (methodOop)HotSpotMethodResolved::javaMirror(hotspot_method); + return (methodOop)HotSpotResolvedJavaMethod::javaMirror(hotspot_method); } methodDataOop getMethodDataFromHotSpotMethodData(jobject hotspot_method_data) { return (methodDataOop)HotSpotMethodData::hotspotMirror(JNIHandles::resolve(hotspot_method_data)); } -// public byte[] RiMethod_code(HotSpotResolvedMethod method); -JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_code"); +// public byte[] JavaMethod_code(HotSpotResolvedMethod method); +JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_code"); methodHandle method = getMethodFromHotSpotMethod(hotspot_method); // copy all bytecodes @@ -85,48 +85,48 @@ return result; } -// public String RiMethod_signature(HotSpotResolvedMethod method); -JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_signature"); +// public String JavaMethod_signature(HotSpotResolvedMethod method); +JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_signature"); VM_ENTRY_MARK methodOop method = getMethodFromHotSpotMethod(hotspot_method); assert(method != NULL && method->signature() != NULL, "signature required"); return VmIds::toString(method->signature(), THREAD); } -// public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId); -JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_exceptionHandlers"); +// public ExceptionHandler[] JavaMethod_exceptionHandlers(long vmId); +JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_exceptionHandlers"); VM_ENTRY_MARK ResourceMark rm; methodHandle method = getMethodFromHotSpotMethod(hotspot_method); typeArrayHandle handlers = method->exception_table(); int handler_count = handlers.is_null() ? 0 : handlers->length() / 4; - instanceKlass::cast(RiExceptionHandler::klass())->initialize(CHECK_NULL); - objArrayHandle array = oopFactory::new_objArray(SystemDictionary::RiExceptionHandler_klass(), handler_count, CHECK_NULL); + instanceKlass::cast(ExceptionHandler::klass())->initialize(CHECK_NULL); + objArrayHandle array = oopFactory::new_objArray(SystemDictionary::ExceptionHandler_klass(), handler_count, CHECK_NULL); for (int i = 0; i < handler_count; i++) { // exception handlers are stored as four integers: start bci, end bci, handler bci, catch class constant pool index int base = i * 4; - Handle entry = instanceKlass::cast(RiExceptionHandler::klass())->allocate_instance(CHECK_NULL); - RiExceptionHandler::set_startBCI(entry, handlers->int_at(base + 0)); - RiExceptionHandler::set_endBCI(entry, handlers->int_at(base + 1)); - RiExceptionHandler::set_handlerBCI(entry, handlers->int_at(base + 2)); + Handle entry = instanceKlass::cast(ExceptionHandler::klass())->allocate_instance(CHECK_NULL); + ExceptionHandler::set_startBCI(entry, handlers->int_at(base + 0)); + ExceptionHandler::set_endBCI(entry, handlers->int_at(base + 1)); + ExceptionHandler::set_handlerBCI(entry, handlers->int_at(base + 2)); int catch_class_index = handlers->int_at(base + 3); - RiExceptionHandler::set_catchTypeCPI(entry, catch_class_index); + ExceptionHandler::set_catchTypeCPI(entry, catch_class_index); if (catch_class_index == 0) { - RiExceptionHandler::set_catchType(entry, NULL); + ExceptionHandler::set_catchType(entry, NULL); } else { constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); KlassHandle loading_klass = method->method_holder(); - Handle catch_class = GraalCompiler::get_RiType(cp, catch_class_index, loading_klass, CHECK_NULL); - if (catch_class->klass() == HotSpotTypeResolved::klass() && java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { - RiExceptionHandler::set_catchType(entry, NULL); - RiExceptionHandler::set_catchTypeCPI(entry, 0); + Handle catch_class = GraalCompiler::get_JavaType(cp, catch_class_index, loading_klass, CHECK_NULL); + if (catch_class->klass() == HotSpotResolvedJavaType::klass() && java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { + ExceptionHandler::set_catchType(entry, NULL); + ExceptionHandler::set_catchTypeCPI(entry, 0); } else { - RiExceptionHandler::set_catchType(entry, catch_class()); + ExceptionHandler::set_catchType(entry, catch_class()); } } array->obj_at_put(i, entry()); @@ -135,9 +135,9 @@ return (jobjectArray) JNIHandles::make_local(array()); } -// public boolean RiMethod_hasBalancedMonitors(long vmId); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_hasBalancedMonitors"); +// public boolean JavaMethod_hasBalancedMonitors(long vmId); +JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_hasBalancedMonitors"); VM_ENTRY_MARK; @@ -163,22 +163,22 @@ return true; } -// public RiMethod getRiMethod(java.lang.reflect.Method reflectionMethod); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getRiMethod(JNIEnv *, jobject, jobject reflection_method_handle) { - TRACE_graal_3("CompilerToVM::getRiMethod"); +// public JavaMethod getJavaMethod(java.lang.reflect.Method reflectionMethod); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getJavaMethod(JNIEnv *, jobject, jobject reflection_method_handle) { + TRACE_graal_3("CompilerToVM::getJavaMethod"); VM_ENTRY_MARK; oop reflection_method = JNIHandles::resolve(reflection_method_handle); oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); int slot = java_lang_reflect_Method::slot(reflection_method); klassOop holder = java_lang_Class::as_klassOop(reflection_holder); methodOop method = instanceKlass::cast(holder)->method_with_idnum(slot); - Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); + Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); return JNIHandles::make_local(THREAD, ret()); } -// public boolean RiMethod_uniqueConcreteMethod(long vmId); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_uniqueConcreteMethod"); +// public boolean JavaMethod_uniqueConcreteMethod(long vmId); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_uniqueConcreteMethod"); VM_ENTRY_MARK; methodHandle method = getMethodFromHotSpotMethod(hotspot_method); @@ -202,20 +202,20 @@ if (unique_concrete.is_null()) { return NULL; } else { - Handle method_resolved = GraalCompiler::createHotSpotMethodResolved(unique_concrete, CHECK_NULL); + Handle method_resolved = GraalCompiler::createHotSpotResolvedJavaMethod(unique_concrete, CHECK_NULL); return JNIHandles::make_local(THREAD, method_resolved()); } } -// public native int RiMethod_invocationCount(long vmId); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_invocationCount"); +// public native int JavaMethod_invocationCount(long vmId); +JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_invocationCount"); return getMethodFromHotSpotMethod(hotspot_method)->invocation_count(); } -// public native HotSpotMethodData RiMethod_methodData(HotSpotMethodResolved method); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1methodData(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_methodData"); +// public native HotSpotMethodData JavaMethod_methodData(HotSpotResolvedJavaMethod method); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1methodData(JNIEnv *, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_methodData"); VM_ENTRY_MARK; methodDataHandle method_data = getMethodFromHotSpotMethod(hotspot_method)->method_data(); @@ -253,22 +253,22 @@ return count; } -// public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); -JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_hasCompiledCode"); +// public native boolean JavaMethod_hasCompiledCode(HotSpotResolvedJavaMethod method); +JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_hasCompiledCode"); return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code(); } -// public native int RiMethod_getCompiledCodeSize(HotSpotMethodResolved method); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1getCompiledCodeSize(JNIEnv *env, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_getCompiledCodeSize"); +// public native int JavaMethod_getCompiledCodeSize(HotSpotResolvedJavaMethod method); +JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1getCompiledCodeSize(JNIEnv *env, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_getCompiledCodeSize"); nmethod* code = getMethodFromHotSpotMethod(hotspot_method)->code(); return code == NULL ? 0 : code->insts_size(); } -// public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve) { - TRACE_graal_3("CompilerToVM::RiSignature_lookupType"); +// public JavaType Signature_lookupType(String returnType, HotSpotResolvedJavaType accessingClass); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_Signature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve) { + TRACE_graal_3("CompilerToVM::Signature_lookupType"); VM_ENTRY_MARK; ResourceMark rm; @@ -277,21 +277,21 @@ oop result; if (nameSymbol == vmSymbols::int_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_INT, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_INT, THREAD); } else if (nameSymbol == vmSymbols::long_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_LONG, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_LONG, THREAD); } else if (nameSymbol == vmSymbols::bool_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_BOOLEAN, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_BOOLEAN, THREAD); } else if (nameSymbol == vmSymbols::char_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_CHAR, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_CHAR, THREAD); } else if (nameSymbol == vmSymbols::short_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_SHORT, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_SHORT, THREAD); } else if (nameSymbol == vmSymbols::byte_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_BYTE, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_BYTE, THREAD); } else if (nameSymbol == vmSymbols::double_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_DOUBLE, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_DOUBLE, THREAD); } else if (nameSymbol == vmSymbols::float_signature()) { - result = VMToCompiler::createRiTypePrimitive((int) T_FLOAT, THREAD); + result = VMToCompiler::createPrimitiveJavaType((int) T_FLOAT, THREAD); } else { klassOop resolved_type = NULL; // if the name isn't in the symbol table then the class isn't loaded anyway... @@ -299,8 +299,8 @@ Handle classloader; Handle protectionDomain; if (JNIHandles::resolve(accessingClass) != NULL) { - classloader = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(accessingClass))->klass_part()->class_loader(); - protectionDomain = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(accessingClass))->klass_part()->protection_domain(); + classloader = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->class_loader(); + protectionDomain = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->protection_domain(); } if (eagerResolve) { resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); @@ -321,10 +321,10 @@ } } if (resolved_type != NULL) { - Handle type = GraalCompiler::createHotSpotTypeResolved(resolved_type, name, CHECK_NULL); + Handle type = GraalCompiler::createHotSpotResolvedJavaType(resolved_type, name, CHECK_NULL); result = type(); } else { - Handle type = VMToCompiler::createRiTypeUnresolved(name, THREAD); + Handle type = VMToCompiler::createJavaType(name, THREAD); result = type(); } } @@ -332,23 +332,23 @@ return JNIHandles::make_local(THREAD, result); } -// public Object RiConstantPool_lookupConstant(HotSpotTypeResolved type, int cpi); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { - TRACE_graal_3("CompilerToVM::RiConstantPool_lookupConstant"); +// public Object ConstantPool_lookupConstant(HotSpotResolvedJavaType type, int cpi); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { + TRACE_graal_3("CompilerToVM::ConstantPool_lookupConstant"); VM_ENTRY_MARK; - constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); + constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); oop result = NULL; constantTag tag = cp->tag_at(index); if (tag.is_int()) { - result = VMToCompiler::createCiConstant(CiKind::Int(), cp->int_at(index), CHECK_0); + result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_0); } else if (tag.is_long()) { - result = VMToCompiler::createCiConstant(CiKind::Long(), cp->long_at(index), CHECK_0); + result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_0); } else if (tag.is_float()) { - result = VMToCompiler::createCiConstantFloat(cp->float_at(index), CHECK_0); + result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_0); } else if (tag.is_double()) { - result = VMToCompiler::createCiConstantDouble(cp->double_at(index), CHECK_0); + result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_0); } else if (tag.is_string() || tag.is_unresolved_string()) { oop string = NULL; if (cp->is_pseudo_string_at(index)) { @@ -362,14 +362,14 @@ return NULL; } } - result = VMToCompiler::createCiConstantObject(string, CHECK_0); + result = VMToCompiler::createConstantObject(string, CHECK_0); } else if (tag.is_klass() || tag.is_unresolved_klass()) { - Handle type = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); + Handle type = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); result = type(); } else if (tag.is_object()) { oop obj = cp->object_at(index); assert(obj->is_instance(), "must be an instance"); - result = VMToCompiler::createCiConstantObject(obj, CHECK_NULL); + result = VMToCompiler::createConstantObject(obj, CHECK_NULL); } else { ShouldNotReachHere(); } @@ -377,45 +377,45 @@ return JNIHandles::make_local(THREAD, result); } -// public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { - TRACE_graal_3("CompilerToVM::RiConstantPool_lookupMethod"); +// public JavaMethod ConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { + TRACE_graal_3("CompilerToVM::ConstantPool_lookupMethod"); VM_ENTRY_MARK; index = GraalCompiler::to_cp_index_u2(index); - constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); + constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); instanceKlassHandle pool_holder(cp->pool_holder()); Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder); if (!method.is_null()) { - Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); + Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); return JNIHandles::make_local(THREAD, ret()); } else { // Get the method's name and signature. Handle name = VmIds::toString(cp->name_ref_at(index), CHECK_NULL); Handle signature = VmIds::toString(cp->signature_ref_at(index), CHECK_NULL); int holder_index = cp->klass_ref_index_at(index); - Handle type = GraalCompiler::get_RiType(cp, holder_index, cp->pool_holder(), CHECK_NULL); - return JNIHandles::make_local(THREAD, VMToCompiler::createRiMethodUnresolved(name, signature, type, THREAD)); + Handle type = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); + return JNIHandles::make_local(THREAD, VMToCompiler::createJavaMethod(name, signature, type, THREAD)); } } -// public RiType RiConstantPool_lookupType(long vmId, int cpi); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { - TRACE_graal_3("CompilerToVM::RiConstantPool_lookupType"); +// public JavaType ConstantPool_lookupType(long vmId, int cpi); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { + TRACE_graal_3("CompilerToVM::ConstantPool_lookupType"); VM_ENTRY_MARK; - constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); - Handle result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); + constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); + Handle result = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); return JNIHandles::make_local(THREAD, result()); } -// public void RiConstantPool_loadReferencedType(long vmId, int cpi); -JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { - TRACE_graal_3("CompilerToVM::RiConstantPool_loadReferencedType"); +// public void ConstantPool_loadReferencedType(long vmId, int cpi); +JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { + TRACE_graal_3("CompilerToVM::ConstantPool_loadReferencedType"); VM_ENTRY_MARK; - constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); + constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); int byteCode = (op & 0xFF); if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray && byteCode != Bytecodes::_multianewarray && byteCode != Bytecodes::_ldc && byteCode != Bytecodes::_ldc_w && byteCode != Bytecodes::_ldc2_w) @@ -436,14 +436,14 @@ } } -// public RiField RiConstantPool_lookupField(long vmId, int cpi); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { - TRACE_graal_3("CompilerToVM::RiConstantPool_lookupField"); +// public JavaField ConstantPool_lookupField(long vmId, int cpi); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { + TRACE_graal_3("CompilerToVM::ConstantPool_lookupField"); VM_ENTRY_MARK; ResourceMark rm; index = GraalCompiler::to_cp_index_u2(index); - constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(constantPoolHolder)))->constants(); + constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(constantPoolHolder)))->constants(); int nt_index = cp->name_and_type_ref_index_at(index); int sig_index = cp->signature_ref_index_at(nt_index); @@ -451,14 +451,14 @@ int name_index = cp->name_ref_index_at(nt_index); Symbol* name = cp->symbol_at(name_index); int holder_index = cp->klass_ref_index_at(index); - Handle holder = GraalCompiler::get_RiType(cp, holder_index, cp->pool_holder(), CHECK_NULL); + Handle holder = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); instanceKlassHandle holder_klass; Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); int offset = -1; AccessFlags flags; BasicType basic_type; - if (holder->klass() == SystemDictionary::HotSpotTypeResolved_klass()) { + if (holder->klass() == SystemDictionary::HotSpotResolvedJavaType_klass()) { FieldAccessInfo result; LinkResolver::resolve_field(result, cp, index, Bytecodes::java_code(code), @@ -470,12 +470,12 @@ flags = result.access_flags(); holder_klass = result.klass()->as_klassOop(); basic_type = result.field_type(); - holder = GraalCompiler::get_RiType(holder_klass, CHECK_NULL); + holder = GraalCompiler::get_JavaType(holder_klass, CHECK_NULL); } } - Handle type = GraalCompiler::get_RiTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); - Handle field_handle = GraalCompiler::get_RiField(offset, flags.as_int(), name, holder, type, code, THREAD); + Handle type = GraalCompiler::get_JavaTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); + Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, code, THREAD); oop constant_object = NULL; // Check to see if the field is constant. @@ -507,31 +507,31 @@ switch(basic_type) { case T_OBJECT: case T_ARRAY: - constant_object = VMToCompiler::createCiConstantObject(mirror->obj_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstantObject(mirror->obj_field(offset), CHECK_0); break; case T_DOUBLE: - constant_object = VMToCompiler::createCiConstantDouble(mirror->double_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstantDouble(mirror->double_field(offset), CHECK_0); break; case T_FLOAT: - constant_object = VMToCompiler::createCiConstantFloat(mirror->float_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstantFloat(mirror->float_field(offset), CHECK_0); break; case T_LONG: - constant_object = VMToCompiler::createCiConstant(CiKind::Long(), mirror->long_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstant(Kind::Long(), mirror->long_field(offset), CHECK_0); break; case T_INT: - constant_object = VMToCompiler::createCiConstant(CiKind::Int(), mirror->int_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstant(Kind::Int(), mirror->int_field(offset), CHECK_0); break; case T_SHORT: - constant_object = VMToCompiler::createCiConstant(CiKind::Short(), mirror->short_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstant(Kind::Short(), mirror->short_field(offset), CHECK_0); break; case T_CHAR: - constant_object = VMToCompiler::createCiConstant(CiKind::Char(), mirror->char_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstant(Kind::Char(), mirror->char_field(offset), CHECK_0); break; case T_BYTE: - constant_object = VMToCompiler::createCiConstant(CiKind::Byte(), mirror->byte_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstant(Kind::Byte(), mirror->byte_field(offset), CHECK_0); break; case T_BOOLEAN: - constant_object = VMToCompiler::createCiConstant(CiKind::Boolean(), mirror->bool_field(offset), CHECK_0); + constant_object = VMToCompiler::createConstant(Kind::Boolean(), mirror->bool_field(offset), CHECK_0); break; default: fatal("Unhandled constant"); @@ -540,18 +540,18 @@ } } if (constant_object != NULL) { - HotSpotField::set_constant(field_handle, constant_object); + HotSpotResolvedJavaField::set_constant(field_handle, constant_object); } return JNIHandles::make_local(THREAD, field_handle()); } -// public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { - TRACE_graal_3("CompilerToVM::RiType_resolveMethodImpl"); +// public JavaMethod JavaType_resolveMethodImpl(HotSpotResolvedJavaType klass, String name, String signature); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { + TRACE_graal_3("CompilerToVM::JavaType_resolveMethodImpl"); VM_ENTRY_MARK; assert(JNIHandles::resolve(resolved_type) != NULL, ""); - klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type)); + klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(resolved_type)); Symbol* name_symbol = VmIds::toSymbol(name); Symbol* signature_symbol = VmIds::toSymbol(signature); methodHandle method = klass->klass_part()->lookup_method(name_symbol, signature_symbol); @@ -562,20 +562,20 @@ } return NULL; } - Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); + Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); return JNIHandles::make_local(THREAD, ret()); } -// public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other); -JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { - TRACE_graal_3("CompilerToVM::RiType_isSubtypeOf"); +// public boolean JavaType_isSubtypeOf(HotSpotResolvedJavaType klass, JavaType other); +JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { + TRACE_graal_3("CompilerToVM::JavaType_isSubtypeOf"); VM_ENTRY_MARK; oop other = JNIHandles::resolve(jother); - assert(other->is_a(HotSpotTypeResolved::klass()), "resolved hotspot type expected"); + assert(other->is_a(HotSpotResolvedJavaType::klass()), "resolved hotspot type expected"); assert(JNIHandles::resolve(klass) != NULL, ""); - klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); - klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(other)); + klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); + klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other)); if (thisKlass->klass_part()->oop_is_instance_slow()) { return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass); } else if (thisKlass->klass_part()->oop_is_array()) { @@ -586,39 +586,39 @@ } } -// public RiType RiType_leastCommonAncestor(HotSpotTypeResolved thisType, HotSpotTypeResolved otherType); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_2leastCommonAncestor(JNIEnv *, jobject, jobject this_type, jobject other_type) { - TRACE_graal_3("CompilerToVM::RiType_leastCommonAncestor"); +// public JavaType JavaType_leastCommonAncestor(HotSpotResolvedJavaType thisType, HotSpotResolvedJavaType otherType); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2leastCommonAncestor(JNIEnv *, jobject, jobject this_type, jobject other_type) { + TRACE_graal_3("CompilerToVM::JavaType_leastCommonAncestor"); VM_ENTRY_MARK; - Klass* this_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(this_type))->klass_part(); - Klass* other_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(other_type))->klass_part(); + Klass* this_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(this_type))->klass_part(); + Klass* other_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other_type))->klass_part(); Klass* lca = this_klass->LCA(other_klass); - return JNIHandles::make_local(GraalCompiler::get_RiType(lca, THREAD)()); + return JNIHandles::make_local(GraalCompiler::get_JavaType(lca, THREAD)()); } -// public RiType RiType_componentType(HotSpotResolvedType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1componentType(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::RiType_componentType"); +// public JavaType JavaType_componentType(HotSpotResolvedType klass); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1componentType(JNIEnv *, jobject, jobject klass) { + TRACE_graal_3("CompilerToVM::JavaType_componentType"); VM_ENTRY_MARK; - KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); + KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); if(array_klass->oop_is_typeArray()) { BasicType t = typeArrayKlass::cast(array_klass())->element_type(); - oop primitive_type = VMToCompiler::createRiTypePrimitive((int) t, CHECK_NULL); + oop primitive_type = VMToCompiler::createPrimitiveJavaType((int) t, CHECK_NULL); return JNIHandles::make_local(primitive_type); } assert(array_klass->oop_is_objArray(), "just checking"); klassOop element_type = objArrayKlass::cast(array_klass())->element_klass(); assert(JNIHandles::resolve(klass) != NULL, ""); - return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD)()); + return JNIHandles::make_local(GraalCompiler::get_JavaType(element_type, THREAD)()); } -// public RiType RiType_superType(HotSpotResolvedType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1superType(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::RiType_superType"); +// public JavaType JavaType_superType(HotSpotResolvedType klass); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1superType(JNIEnv *, jobject, jobject klass) { + TRACE_graal_3("CompilerToVM::JavaType_superType"); VM_ENTRY_MARK; - KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); + KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); klassOop k; if (klass_handle->oop_is_array()) { @@ -629,51 +629,51 @@ } if (k != NULL) { - return JNIHandles::make_local(GraalCompiler::get_RiType(k, THREAD)()); + return JNIHandles::make_local(GraalCompiler::get_JavaType(k, THREAD)()); } else { return NULL; } } -// public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::RiType_uniqueConcreteSubtype"); +// public JavaType JavaType_uniqueConcreteSubtype(HotSpotResolvedType klass); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { + TRACE_graal_3("CompilerToVM::JavaType_uniqueConcreteSubtype"); VM_ENTRY_MARK; - KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); + KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); Klass *up_cast = klass_handle->up_cast_abstract(); if (up_cast->is_leaf_class()) { - return JNIHandles::make_local(GraalCompiler::get_RiType(up_cast, THREAD)()); + return JNIHandles::make_local(GraalCompiler::get_JavaType(up_cast, THREAD)()); } return NULL; } -// public bool RiType_isInitialized(HotSpotResolvedType klass); -JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { - TRACE_graal_3("CompilerToVM::RiType_isInitialized"); - klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(hotspot_klass)); +// public bool JavaType_isInitialized(HotSpotResolvedType klass); +JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { + TRACE_graal_3("CompilerToVM::JavaType_isInitialized"); + klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); assert(klass != NULL, "method must not be called for primitive types"); return instanceKlass::cast(klass)->is_initialized(); } -// public RiType RiType_arrayOf(HotSpotTypeResolved klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::RiType_arrayOf"); +// public JavaType JavaType_arrayOf(HotSpotResolvedJavaType klass); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1arrayOf(JNIEnv *, jobject, jobject klass) { + TRACE_graal_3("CompilerToVM::JavaType_arrayOf"); VM_ENTRY_MARK; - KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); + KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); KlassHandle arr = klass_handle->array_klass(THREAD); Handle name = VmIds::toString(arr->name(), CHECK_NULL); assert(arr->oop_is_array(), ""); - return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotTypeResolved(arr, name, THREAD)()); + return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotResolvedJavaType(arr, name, THREAD)()); } -// public ResolvedJavaField[] RiType_fields(HotSpotTypeResolved klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1fields(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::RiType_fields"); +// public ResolvedJavaField[] JavaType_fields(HotSpotResolvedJavaType klass); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1fields(JNIEnv *, jobject, jobject klass) { + TRACE_graal_3("CompilerToVM::JavaType_fields"); VM_ENTRY_MARK; ResourceMark rm; - instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); + instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); class MyFieldClosure : public FieldClosure { public: instanceKlassHandle _holder; @@ -685,8 +685,8 @@ virtual void do_field(fieldDescriptor* fd) { if (!Thread::current()->has_pending_exception()) { if (fd->field_holder() == _holder()) { - Handle type = GraalCompiler::get_RiTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); - Handle field = VMToCompiler::createRiField(_resolved_type_holder, VmIds::toString(fd->name(), Thread::current()), type, fd->offset(), fd->access_flags().as_int(), Thread::current()); + Handle type = GraalCompiler::get_JavaTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); + Handle field = VMToCompiler::createJavaField(_resolved_type_holder, VmIds::toString(fd->name(), Thread::current()), type, fd->offset(), fd->access_flags().as_int(), Thread::current()); _field_array.append(field()); } } @@ -694,24 +694,24 @@ }; MyFieldClosure closure(k, JNIHandles::resolve(klass)); k->do_nonstatic_fields(&closure); - objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::RiResolvedField_klass(), closure._field_array.length(), CHECK_NULL); + objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::ResolvedJavaField_klass(), closure._field_array.length(), CHECK_NULL); for (int i=0; iobj_at_put(i, closure._field_array.at(i)()); } return JNIHandles::make_local(field_array()); } -// public RiType getPrimitiveArrayType(CiKind kind); +// public JavaType getPrimitiveArrayType(Kind kind); JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { TRACE_graal_3("CompilerToVM::getPrimitiveArrayType"); VM_ENTRY_MARK; - BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind)); + BasicType type = GraalCompiler::kindToBasicType(Kind::typeChar(kind)); assert(type != T_OBJECT, "primitive type expecteds"); - Handle result = GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), CHECK_NULL); + Handle result = GraalCompiler::get_JavaType(Universe::typeArrayKlassObj(type), CHECK_NULL); return JNIHandles::make_local(THREAD, result()); } -// public long getMaxCallTargetOffset(CiRuntimeCall rtcall); +// public long getMaxCallTargetOffset(RuntimeCall rtcall); JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { TRACE_graal_3("CompilerToVM::getMaxCallTargetOffset"); VM_ENTRY_MARK; @@ -725,7 +725,7 @@ return -1; } -// public RiType getType(Class javaClass); +// public JavaType getType(Class javaClass); JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) { TRACE_graal_3("CompilerToVM::getType"); VM_ENTRY_MARK; @@ -735,12 +735,12 @@ return NULL; } else if (java_lang_Class::is_primitive(javaClassOop)) { BasicType basicType = java_lang_Class::primitive_type(javaClassOop); - return JNIHandles::make_local(THREAD, VMToCompiler::createRiTypePrimitive((int) basicType, THREAD)); + return JNIHandles::make_local(THREAD, VMToCompiler::createPrimitiveJavaType((int) basicType, THREAD)); } else { KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop); Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL); - Handle type = GraalCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL); + Handle type = GraalCompiler::createHotSpotResolvedJavaType(klass, name, CHECK_NULL); return JNIHandles::make_local(THREAD, type()); } } @@ -929,7 +929,7 @@ return JNIHandles::make_local(result()); } -// public String disassembleJava(HotSpotMethodResolved method); +// public String disassembleJava(HotSpotResolvedJavaMethod method); JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_disassembleJava(JNIEnv *env, jobject, jobject hotspot_method) { TRACE_graal_3("CompilerToVM::disassembleJava"); @@ -948,9 +948,9 @@ return JNIHandles::make_local(result()); } -// public StackTraceElement RiMethod_toStackTraceElement(HotSpotMethodResolved method, int bci); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1toStackTraceElement(JNIEnv *env, jobject, jobject hotspot_method, int bci) { - TRACE_graal_3("CompilerToVM::RiMethod_toStackTraceElement"); +// public StackTraceElement JavaMethod_toStackTraceElement(HotSpotResolvedJavaMethod method, int bci); +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1toStackTraceElement(JNIEnv *env, jobject, jobject hotspot_method, int bci) { + TRACE_graal_3("CompilerToVM::JavaMethod_toStackTraceElement"); VM_ENTRY_MARK; ResourceMark rm; @@ -1062,9 +1062,9 @@ return JNIHandles::make_local((oop) result.get_jobject()); } -// public native int RiMethod_vtableEntryOffset(HotSpotMethodResolved method); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_vtableEntryOffset(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::RiMethod_vtableEntryOffset"); +// public native int JavaMethod_vtableEntryOffset(HotSpotResolvedJavaMethod method); +JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_vtableEntryOffset(JNIEnv *, jobject, jobject hotspot_method) { + TRACE_graal_3("CompilerToVM::JavaMethod_vtableEntryOffset"); methodOop method = getMethodFromHotSpotMethod(hotspot_method); assert(!instanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); @@ -1122,9 +1122,9 @@ #define PROXY "J" #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" -#define RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotTypeResolved;" +#define RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaType;" #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;" -#define RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotMethodResolved;" +#define RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;" #define REFLECT_METHOD "Ljava/lang/reflect/Method;" #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" @@ -1146,31 +1146,31 @@ #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" JNINativeMethod CompilerToVM_methods[] = { - {CC"RiMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(RiMethod_1code)}, - {CC"RiMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(RiMethod_1signature)}, - {CC"RiMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(RiMethod_1exceptionHandlers)}, - {CC"RiMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(RiMethod_1hasBalancedMonitors)}, - {CC"RiMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(RiMethod_1uniqueConcreteMethod)}, - {CC"getRiMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getRiMethod)}, - {CC"RiMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(RiMethod_1methodData)}, - {CC"RiMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_1invocationCount)}, - {CC"RiMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(RiMethod_1hasCompiledCode)}, - {CC"RiMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_1getCompiledCodeSize)}, - {CC"RiSignature_lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(RiSignature_1lookupType)}, - {CC"RiConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(RiConstantPool_1lookupConstant)}, - {CC"RiConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(RiConstantPool_1lookupMethod)}, - {CC"RiConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(RiConstantPool_1lookupType)}, - {CC"RiConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(RiConstantPool_1loadReferencedType)}, - {CC"RiConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(RiConstantPool_1lookupField)}, - {CC"RiType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(RiType_3resolveMethodImpl)}, - {CC"RiType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(RiType_2isSubtypeOf)}, - {CC"RiType_leastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(RiType_2leastCommonAncestor)}, - {CC"RiType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1componentType)}, - {CC"RiType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1uniqueConcreteSubtype)}, - {CC"RiType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1superType)}, - {CC"RiType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1arrayOf)}, - {CC"RiType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(RiType_1fields)}, - {CC"RiType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(RiType_1isInitialized)}, + {CC"JavaMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(JavaMethod_1code)}, + {CC"JavaMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(JavaMethod_1signature)}, + {CC"JavaMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(JavaMethod_1exceptionHandlers)}, + {CC"JavaMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasBalancedMonitors)}, + {CC"JavaMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(JavaMethod_1uniqueConcreteMethod)}, + {CC"getJavaMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getJavaMethod)}, + {CC"JavaMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(JavaMethod_1methodData)}, + {CC"JavaMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1invocationCount)}, + {CC"JavaMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasCompiledCode)}, + {CC"JavaMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1getCompiledCodeSize)}, + {CC"Signature_lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(Signature_1lookupType)}, + {CC"ConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(ConstantPool_1lookupConstant)}, + {CC"ConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(ConstantPool_1lookupMethod)}, + {CC"ConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(ConstantPool_1lookupType)}, + {CC"ConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(ConstantPool_1loadReferencedType)}, + {CC"ConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(ConstantPool_1lookupField)}, + {CC"JavaType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(JavaType_3resolveMethodImpl)}, + {CC"JavaType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(JavaType_2isSubtypeOf)}, + {CC"JavaType_leastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_2leastCommonAncestor)}, + {CC"JavaType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1componentType)}, + {CC"JavaType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1uniqueConcreteSubtype)}, + {CC"JavaType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1superType)}, + {CC"JavaType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1arrayOf)}, + {CC"JavaType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(JavaType_1fields)}, + {CC"JavaType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(JavaType_1isInitialized)}, {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, {CC"getMaxCallTargetOffset", CC"("CI_RUNTIME_CALL")J", FN_PTR(getMaxCallTargetOffset)}, {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, @@ -1178,10 +1178,10 @@ {CC"installMethod", CC"("TARGET_METHOD"Z"HS_CODE_INFO")"HS_COMP_METHOD, FN_PTR(installMethod)}, {CC"disassembleNative", CC"([BJ)"STRING, FN_PTR(disassembleNative)}, {CC"disassembleJava", CC"("RESOLVED_METHOD")"STRING, FN_PTR(disassembleJava)}, - {CC"RiMethod_toStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(RiMethod_1toStackTraceElement)}, + {CC"JavaMethod_toStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(JavaMethod_1toStackTraceElement)}, {CC"executeCompiledMethod", CC"("HS_COMP_METHOD OBJECT OBJECT OBJECT")"OBJECT, FN_PTR(executeCompiledMethod)}, {CC"executeCompiledMethodVarargs", CC"("HS_COMP_METHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, - {CC"RiMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_vtableEntryOffset)}, + {CC"JavaMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_vtableEntryOffset)}, {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, }; diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -26,12 +26,12 @@ #include "classfile/systemDictionary.hpp" #include "oops/instanceMirrorKlass.hpp" -/* This macro defines the structure of the CiTargetMethod - classes. +/* This macro defines the structure of the InstalledCode - classes. * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles. * * The public interface of these classes will look like this: - * class CiStackSlot : AllStatic { + * class StackSlot : AllStatic { * public: * static klassOop klass(); * static jint index(oop obj); @@ -45,43 +45,43 @@ */ #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, float_field, oop_field, static_oop_field) \ - start_class(HotSpotTypeResolved) \ - oop_field(HotSpotTypeResolved, javaMirror, "Ljava/lang/Class;") \ - oop_field(HotSpotTypeResolved, simpleName, "Ljava/lang/String;") \ - int_field(HotSpotTypeResolved, accessFlags) \ - boolean_field(HotSpotTypeResolved, hasFinalizer) \ - boolean_field(HotSpotTypeResolved, hasFinalizableSubclass) \ - int_field(HotSpotTypeResolved, superCheckOffset) \ - boolean_field(HotSpotTypeResolved, isArrayClass) \ - boolean_field(HotSpotTypeResolved, isInstanceClass) \ - boolean_field(HotSpotTypeResolved, isInterface) \ - int_field(HotSpotTypeResolved, instanceSize) \ + start_class(HotSpotResolvedJavaType) \ + oop_field(HotSpotResolvedJavaType, javaMirror, "Ljava/lang/Class;") \ + oop_field(HotSpotResolvedJavaType, simpleName, "Ljava/lang/String;") \ + int_field(HotSpotResolvedJavaType, accessFlags) \ + boolean_field(HotSpotResolvedJavaType, hasFinalizer) \ + boolean_field(HotSpotResolvedJavaType, hasFinalizableSubclass) \ + int_field(HotSpotResolvedJavaType, superCheckOffset) \ + boolean_field(HotSpotResolvedJavaType, isArrayClass) \ + boolean_field(HotSpotResolvedJavaType, isInstanceClass) \ + boolean_field(HotSpotResolvedJavaType, isInterface) \ + int_field(HotSpotResolvedJavaType, instanceSize) \ end_class \ start_class(HotSpotKlassOop) \ oop_field(HotSpotKlassOop, javaMirror, "Ljava/lang/Class;") \ end_class \ - start_class(HotSpotMethodResolved) \ - oop_field(HotSpotMethodResolved, name, "Ljava/lang/String;") \ - oop_field(HotSpotMethodResolved, holder, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ - oop_field(HotSpotMethodResolved, javaMirror, "Ljava/lang/Object;") \ - int_field(HotSpotMethodResolved, codeSize) \ - int_field(HotSpotMethodResolved, accessFlags) \ - int_field(HotSpotMethodResolved, maxLocals) \ - int_field(HotSpotMethodResolved, maxStackSize) \ - boolean_field(HotSpotMethodResolved, canBeInlined) \ + start_class(HotSpotResolvedJavaMethod) \ + oop_field(HotSpotResolvedJavaMethod, name, "Ljava/lang/String;") \ + oop_field(HotSpotResolvedJavaMethod, holder, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ + oop_field(HotSpotResolvedJavaMethod, javaMirror, "Ljava/lang/Object;") \ + int_field(HotSpotResolvedJavaMethod, codeSize) \ + int_field(HotSpotResolvedJavaMethod, accessFlags) \ + int_field(HotSpotResolvedJavaMethod, maxLocals) \ + int_field(HotSpotResolvedJavaMethod, maxStackSize) \ + boolean_field(HotSpotResolvedJavaMethod, canBeInlined) \ end_class \ start_class(HotSpotMethodData) \ oop_field(HotSpotMethodData, hotspotMirror, "Ljava/lang/Object;") \ int_field(HotSpotMethodData, normalDataSize) \ int_field(HotSpotMethodData, extraDataSize) \ end_class \ - start_class(HotSpotType) \ - oop_field(HotSpotType, name, "Ljava/lang/String;") \ + start_class(HotSpotJavaType) \ + oop_field(HotSpotJavaType, name, "Ljava/lang/String;") \ end_class \ - start_class(HotSpotField) \ - oop_field(HotSpotField, constant, "Lcom/oracle/graal/api/meta/Constant;") \ - int_field(HotSpotField, offset) \ - int_field(HotSpotField, accessFlags) \ + start_class(HotSpotResolvedJavaField) \ + oop_field(HotSpotResolvedJavaField, constant, "Lcom/oracle/graal/api/meta/Constant;") \ + int_field(HotSpotResolvedJavaField, offset) \ + int_field(HotSpotResolvedJavaField, accessFlags) \ end_class \ start_class(HotSpotCompiledMethod) \ long_field(HotSpotCompiledMethod, nmethod) \ @@ -96,139 +96,139 @@ end_class \ start_class(HotSpotTargetMethod) \ oop_field(HotSpotTargetMethod, targetMethod, "Lcom/oracle/graal/api/code/CompilationResult;") \ - oop_field(HotSpotTargetMethod, method, "Lcom/oracle/graal/hotspot/meta/HotSpotMethodResolved;") \ + oop_field(HotSpotTargetMethod, method, "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;") \ oop_field(HotSpotTargetMethod, name, "Ljava/lang/String;") \ oop_field(HotSpotTargetMethod, sites, "[Lcom/oracle/graal/api/code/CompilationResult$Site;") \ oop_field(HotSpotTargetMethod, exceptionHandlers, "[Lcom/oracle/graal/api/code/CompilationResult$ExceptionHandler;") \ end_class \ - start_class(RiExceptionHandler) \ - int_field(RiExceptionHandler, startBCI) \ - int_field(RiExceptionHandler, endBCI) \ - int_field(RiExceptionHandler, handlerBCI) \ - int_field(RiExceptionHandler, catchTypeCPI) \ - oop_field(RiExceptionHandler, catchType, "Lcom/oracle/graal/api/meta/JavaType;") \ + start_class(ExceptionHandler) \ + int_field(ExceptionHandler, startBCI) \ + int_field(ExceptionHandler, endBCI) \ + int_field(ExceptionHandler, handlerBCI) \ + int_field(ExceptionHandler, catchTypeCPI) \ + oop_field(ExceptionHandler, catchType, "Lcom/oracle/graal/api/meta/JavaType;") \ end_class \ - start_class(CiTargetMethod) \ - int_field(CiTargetMethod, frameSize) \ - int_field(CiTargetMethod, customStackAreaOffset) \ - oop_field(CiTargetMethod, targetCode, "[B") \ - oop_field(CiTargetMethod, assumptions, "Lcom/oracle/graal/api/code/Assumptions;") \ - int_field(CiTargetMethod, targetCodeSize) \ + start_class(InstalledCode) \ + int_field(InstalledCode, frameSize) \ + int_field(InstalledCode, customStackAreaOffset) \ + oop_field(InstalledCode, targetCode, "[B") \ + oop_field(InstalledCode, assumptions, "Lcom/oracle/graal/api/code/Assumptions;") \ + int_field(InstalledCode, targetCodeSize) \ end_class \ - start_class(CiAssumptions) \ - oop_field(CiAssumptions, list, "[Lcom/oracle/graal/api/code/Assumptions$Assumption;") \ + start_class(Assumptions) \ + oop_field(Assumptions, list, "[Lcom/oracle/graal/api/code/Assumptions$Assumption;") \ end_class \ - start_class(CiAssumptions_MethodContents) \ - oop_field(CiAssumptions_MethodContents, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ + start_class(Assumptions_MethodContents) \ + oop_field(Assumptions_MethodContents, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ end_class \ - start_class(CiAssumptions_ConcreteSubtype) \ - oop_field(CiAssumptions_ConcreteSubtype, context, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ - oop_field(CiAssumptions_ConcreteSubtype, subtype, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ + start_class(Assumptions_ConcreteSubtype) \ + oop_field(Assumptions_ConcreteSubtype, context, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ + oop_field(Assumptions_ConcreteSubtype, subtype, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ end_class \ - start_class(CiAssumptions_ConcreteMethod) \ - oop_field(CiAssumptions_ConcreteMethod, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ - oop_field(CiAssumptions_ConcreteMethod, context, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ - oop_field(CiAssumptions_ConcreteMethod, impl, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ + start_class(Assumptions_ConcreteMethod) \ + oop_field(Assumptions_ConcreteMethod, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ + oop_field(Assumptions_ConcreteMethod, context, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ + oop_field(Assumptions_ConcreteMethod, impl, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ end_class \ - start_class(CiTargetMethod_Site) \ - int_field(CiTargetMethod_Site, pcOffset) \ + start_class(InstalledCode_Site) \ + int_field(InstalledCode_Site, pcOffset) \ end_class \ - start_class(CiTargetMethod_Call) \ - oop_field(CiTargetMethod_Call, target, "Ljava/lang/Object;") \ - oop_field(CiTargetMethod_Call, debugInfo, "Lcom/oracle/graal/api/code/DebugInfo;") \ + start_class(InstalledCode_Call) \ + oop_field(InstalledCode_Call, target, "Ljava/lang/Object;") \ + oop_field(InstalledCode_Call, debugInfo, "Lcom/oracle/graal/api/code/DebugInfo;") \ end_class \ - start_class(CiTargetMethod_DataPatch) \ - oop_field(CiTargetMethod_DataPatch, constant, "Lcom/oracle/graal/api/meta/Constant;") \ - int_field(CiTargetMethod_DataPatch, alignment) \ + start_class(InstalledCode_DataPatch) \ + oop_field(InstalledCode_DataPatch, constant, "Lcom/oracle/graal/api/meta/Constant;") \ + int_field(InstalledCode_DataPatch, alignment) \ end_class \ - start_class(CiTargetMethod_Safepoint) \ - oop_field(CiTargetMethod_Safepoint, debugInfo, "Lcom/oracle/graal/api/code/DebugInfo;") \ + start_class(InstalledCode_Safepoint) \ + oop_field(InstalledCode_Safepoint, debugInfo, "Lcom/oracle/graal/api/code/DebugInfo;") \ end_class \ - start_class(CiTargetMethod_ExceptionHandler) \ - int_field(CiTargetMethod_ExceptionHandler, handlerPos) \ + start_class(InstalledCode_ExceptionHandler) \ + int_field(InstalledCode_ExceptionHandler, handlerPos) \ end_class \ - start_class(CiTargetMethod_Mark) \ - oop_field(CiTargetMethod_Mark, id, "Ljava/lang/Object;") \ - oop_field(CiTargetMethod_Mark, references, "[Lcom/oracle/graal/api/code/CompilationResult$Mark;") \ + start_class(InstalledCode_Mark) \ + oop_field(InstalledCode_Mark, id, "Ljava/lang/Object;") \ + oop_field(InstalledCode_Mark, references, "[Lcom/oracle/graal/api/code/CompilationResult$Mark;") \ end_class \ - start_class(CiDebugInfo) \ - oop_field(CiDebugInfo, bytecodePosition, "Lcom/oracle/graal/api/code/BytecodePosition;") \ - oop_field(CiDebugInfo, registerRefMap, "Ljava/util/BitSet;") \ - oop_field(CiDebugInfo, frameRefMap, "Ljava/util/BitSet;") \ + start_class(DebugInfo) \ + oop_field(DebugInfo, bytecodePosition, "Lcom/oracle/graal/api/code/BytecodePosition;") \ + oop_field(DebugInfo, registerRefMap, "Ljava/util/BitSet;") \ + oop_field(DebugInfo, frameRefMap, "Ljava/util/BitSet;") \ end_class \ start_class(GraalBitMap) \ oop_field(GraalBitMap, words, "[J") \ end_class \ - start_class(CiFrame) \ - oop_field(CiFrame, values, "[Lcom/oracle/graal/api/meta/Value;") \ - int_field(CiFrame, numLocals) \ - int_field(CiFrame, numStack) \ - int_field(CiFrame, numLocks) \ - long_field(CiFrame, leafGraphId) \ - boolean_field(CiFrame, rethrowException) \ - boolean_field(CiFrame, duringCall) \ + start_class(BytecodeFrame) \ + oop_field(BytecodeFrame, values, "[Lcom/oracle/graal/api/meta/Value;") \ + int_field(BytecodeFrame, numLocals) \ + int_field(BytecodeFrame, numStack) \ + int_field(BytecodeFrame, numLocks) \ + long_field(BytecodeFrame, leafGraphId) \ + boolean_field(BytecodeFrame, rethrowException) \ + boolean_field(BytecodeFrame, duringCall) \ end_class \ - start_class(CiCodePos) \ - oop_field(CiCodePos, caller, "Lcom/oracle/graal/api/code/BytecodePosition;") \ - oop_field(CiCodePos, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ - int_field(CiCodePos, bci) \ + start_class(BytecodePosition) \ + oop_field(BytecodePosition, caller, "Lcom/oracle/graal/api/code/BytecodePosition;") \ + oop_field(BytecodePosition, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ + int_field(BytecodePosition, bci) \ end_class \ - start_class(CiConstant) \ - oop_field(CiConstant, kind, "Lcom/oracle/graal/api/meta/Kind;") \ - oop_field(CiConstant, object, "Ljava/lang/Object;") \ - long_field(CiConstant, primitive) \ + start_class(Constant) \ + oop_field(Constant, kind, "Lcom/oracle/graal/api/meta/Kind;") \ + oop_field(Constant, object, "Ljava/lang/Object;") \ + long_field(Constant, primitive) \ end_class \ - start_class(CiKind) \ - char_field(CiKind, typeChar) \ - static_oop_field(CiKind, Boolean, "Lcom/oracle/graal/api/meta/Kind;"); \ - static_oop_field(CiKind, Byte, "Lcom/oracle/graal/api/meta/Kind;"); \ - static_oop_field(CiKind, Char, "Lcom/oracle/graal/api/meta/Kind;"); \ - static_oop_field(CiKind, Short, "Lcom/oracle/graal/api/meta/Kind;"); \ - static_oop_field(CiKind, Int, "Lcom/oracle/graal/api/meta/Kind;"); \ - static_oop_field(CiKind, Long, "Lcom/oracle/graal/api/meta/Kind;"); \ + start_class(Kind) \ + char_field(Kind, typeChar) \ + static_oop_field(Kind, Boolean, "Lcom/oracle/graal/api/meta/Kind;"); \ + static_oop_field(Kind, Byte, "Lcom/oracle/graal/api/meta/Kind;"); \ + static_oop_field(Kind, Char, "Lcom/oracle/graal/api/meta/Kind;"); \ + static_oop_field(Kind, Short, "Lcom/oracle/graal/api/meta/Kind;"); \ + static_oop_field(Kind, Int, "Lcom/oracle/graal/api/meta/Kind;"); \ + static_oop_field(Kind, Long, "Lcom/oracle/graal/api/meta/Kind;"); \ end_class \ - start_class(CiRuntimeCall) \ - static_oop_field(CiRuntimeCall, UnwindException, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, RegisterFinalizer, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, SetDeoptInfo, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, CreateNullPointerException, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, CreateOutOfBoundsException, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, JavaTimeMillis, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, JavaTimeNanos, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, Debug, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticFrem, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticDrem, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticCos, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticTan, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, ArithmeticSin, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, Deoptimize, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ - static_oop_field(CiRuntimeCall, GenericCallback, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + start_class(RuntimeCall) \ + static_oop_field(RuntimeCall, UnwindException, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, RegisterFinalizer, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, SetDeoptInfo, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, CreateNullPointerException, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, CreateOutOfBoundsException, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, JavaTimeMillis, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, JavaTimeNanos, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, Debug, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, ArithmeticFrem, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, ArithmeticDrem, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, ArithmeticCos, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, ArithmeticTan, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, ArithmeticSin, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, Deoptimize, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ + static_oop_field(RuntimeCall, GenericCallback, "Lcom/oracle/graal/api/code/RuntimeCall;"); \ end_class \ - start_class(RiMethod) \ + start_class(JavaMethod) \ end_class \ - start_class(CiValue) \ - oop_field(CiValue, kind, "Lcom/oracle/graal/api/meta/Kind;") \ - static_oop_field(CiValue, IllegalValue, "Lcom/oracle/graal/api/meta/Value;"); \ + start_class(Value) \ + oop_field(Value, kind, "Lcom/oracle/graal/api/meta/Kind;") \ + static_oop_field(Value, IllegalValue, "Lcom/oracle/graal/api/meta/Value;"); \ end_class \ - start_class(CiRegisterValue) \ - oop_field(CiRegisterValue, reg, "Lcom/oracle/graal/api/code/Register;") \ + start_class(RegisterValue) \ + oop_field(RegisterValue, reg, "Lcom/oracle/graal/api/code/Register;") \ end_class \ - start_class(CiRegister) \ - int_field(CiRegister, number) \ + start_class(code_Register) \ + int_field(code_Register, number) \ end_class \ - start_class(CiStackSlot) \ - int_field(CiStackSlot, offset) \ - boolean_field(CiStackSlot, addFrameSize) \ + start_class(StackSlot) \ + int_field(StackSlot, offset) \ + boolean_field(StackSlot, addFrameSize) \ end_class \ - start_class(CiVirtualObject) \ - int_field(CiVirtualObject, id) \ - oop_field(CiVirtualObject, type, "Lcom/oracle/graal/api/meta/JavaType;") \ - oop_field(CiVirtualObject, values, "[Lcom/oracle/graal/api/meta/Value;") \ + start_class(VirtualObject) \ + int_field(VirtualObject, id) \ + oop_field(VirtualObject, type, "Lcom/oracle/graal/api/meta/JavaType;") \ + oop_field(VirtualObject, values, "[Lcom/oracle/graal/api/meta/Value;") \ end_class \ - start_class(CiMonitorValue) \ - oop_field(CiMonitorValue, owner, "Lcom/oracle/graal/api/meta/Value;") \ - oop_field(CiMonitorValue, lockData, "Lcom/oracle/graal/api/meta/Value;") \ - boolean_field(CiMonitorValue, eliminated) \ + start_class(code_MonitorValue) \ + oop_field(code_MonitorValue, owner, "Lcom/oracle/graal/api/meta/Value;") \ + oop_field(code_MonitorValue, lockData, "Lcom/oracle/graal/api/meta/Value;") \ + boolean_field(code_MonitorValue, eliminated) \ end_class \ /* end*/ diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalVMToCompiler.cpp --- a/src/share/vm/graal/graalVMToCompiler.cpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalVMToCompiler.cpp Sun Jun 10 01:17:48 2012 +0200 @@ -40,7 +40,7 @@ Handle VMToCompiler::compilerInstance() { if (JNIHandles::resolve(_compilerPermObject) == NULL) { - KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); + KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_HotSpotGraalRuntime(), SystemDictionary::java_system_loader(), NULL, Thread::current()); check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.HotSpotGraalRuntime"); JavaValue result(T_OBJECT); @@ -53,7 +53,7 @@ Handle VMToCompiler::instance() { if (JNIHandles::resolve(_vmToCompilerPermObject) == NULL) { - KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); + KlassHandle compilerKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_HotSpotGraalRuntime(), SystemDictionary::java_system_loader(), NULL, Thread::current()); check_not_null(compilerKlass(), "Couldn't find class com.sun.hotspot.graal.Compiler"); JavaValue result(T_OBJECT); @@ -141,19 +141,19 @@ check_pending_exception("Error while calling boostrap"); } -oop VMToCompiler::createRiMethodResolved(jlong vmId, Handle name, TRAPS) { +oop VMToCompiler::createResolvedJavaMethod(jlong vmId, Handle name, TRAPS) { assert(!name.is_null(), "just checking"); JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(instance()); args.push_long(vmId); args.push_oop(name); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiMethodResolved_name(), vmSymbols::createRiMethodResolved_signature(), &args, THREAD); - check_pending_exception("Error while calling createRiMethodResolved"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createResolvedJavaMethod_name(), vmSymbols::createResolvedJavaMethod_signature(), &args, THREAD); + check_pending_exception("Error while calling createResolvedJavaMethod"); return (oop) result.get_jobject(); } -oop VMToCompiler::createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS) { +oop VMToCompiler::createJavaMethod(Handle name, Handle signature, Handle holder, TRAPS) { assert(!name.is_null(), "just checking"); JavaValue result(T_OBJECT); JavaCallArguments args; @@ -161,12 +161,12 @@ args.push_oop(name); args.push_oop(signature); args.push_oop(holder); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiMethodUnresolved_name(), vmSymbols::createRiMethodUnresolved_signature(), &args, THREAD); - check_pending_exception("Error while calling createRiMethodUnresolved"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createJavaMethod_name(), vmSymbols::createJavaMethod_signature(), &args, THREAD); + check_pending_exception("Error while calling createJavaMethod"); return (oop) result.get_jobject(); } -oop VMToCompiler::createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS) { +oop VMToCompiler::createJavaField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS) { assert(!holder.is_null(), "just checking"); assert(!name.is_null(), "just checking"); assert(!type.is_null(), "just checking"); @@ -178,95 +178,83 @@ args.push_oop(type); args.push_int(index); args.push_int(flags); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiField_name(), vmSymbols::createRiField_signature(), &args, THREAD); - check_pending_exception("Error while calling createRiField"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createJavaField_name(), vmSymbols::createJavaField_signature(), &args, THREAD); + check_pending_exception("Error while calling createJavaField"); assert(result.get_type() == T_OBJECT, "just checking"); return (oop) result.get_jobject(); } -oop VMToCompiler::createRiType(jlong vmId, Handle name, TRAPS) { - assert(!name.is_null(), "just checking"); - JavaValue result(T_OBJECT); - JavaCallArguments args; - args.push_oop(instance()); - args.push_long(vmId); - args.push_oop(name); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiType_name(), vmSymbols::createRiType_signature(), &args, THREAD); - check_pending_exception("Error while calling createRiType"); - return (oop) result.get_jobject(); -} - -oop VMToCompiler::createRiTypePrimitive(int basic_type, TRAPS) { +oop VMToCompiler::createPrimitiveJavaType(int basic_type, TRAPS) { JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(instance()); args.push_int(basic_type); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiTypePrimitive_name(), vmSymbols::createRiTypePrimitive_signature(), &args, THREAD); - check_pending_exception("Error while calling createRiTypePrimitive"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createPrimitiveJavaType_name(), vmSymbols::createPrimitiveJavaType_signature(), &args, THREAD); + check_pending_exception("Error while calling createPrimitiveJavaType"); return (oop) result.get_jobject(); } -oop VMToCompiler::createRiTypeUnresolved(Handle name, TRAPS) { +oop VMToCompiler::createJavaType(Handle name, TRAPS) { assert(!name.is_null(), "just checking"); JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(instance()); args.push_oop(name); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiTypeUnresolved_name(), vmSymbols::createRiTypeUnresolved_signature(), &args, THREAD); - check_pending_exception("Error while calling createRiTypeUnresolved"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createJavaType_name(), vmSymbols::createJavaType_signature(), &args, THREAD); + check_pending_exception("Error while calling createJavaType"); return (oop) result.get_jobject(); } -oop VMToCompiler::createRiSignature(Handle name, TRAPS) { +oop VMToCompiler::createSignature(Handle name, TRAPS) { assert(!name.is_null(), "just checking"); JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(instance()); args.push_oop(name); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createRiSignature_name(), vmSymbols::createRiSignature_signature(), &args, THREAD); - check_pending_exception("Error while calling createRiSignature"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createSignature_name(), vmSymbols::createSignature_signature(), &args, THREAD); + check_pending_exception("Error while calling createSignature"); return (oop) result.get_jobject(); } -oop VMToCompiler::createCiConstant(Handle kind, jlong value, TRAPS) { +oop VMToCompiler::createConstant(Handle kind, jlong value, TRAPS) { JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(instance()); args.push_oop(kind()); args.push_long(value); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createCiConstant_name(), vmSymbols::createCiConstant_signature(), &args, THREAD); - check_pending_exception("Error while calling createCiConstantFloat"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createConstant_name(), vmSymbols::createConstant_signature(), &args, THREAD); + check_pending_exception("Error while calling createConstantFloat"); return (oop) result.get_jobject(); } -oop VMToCompiler::createCiConstantFloat(jfloat value, TRAPS) { +oop VMToCompiler::createConstantFloat(jfloat value, TRAPS) { JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(instance()); args.push_float(value); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createCiConstantFloat_name(), vmSymbols::createCiConstantFloat_signature(), &args, THREAD); - check_pending_exception("Error while calling createCiConstantFloat"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createConstantFloat_name(), vmSymbols::createConstantFloat_signature(), &args, THREAD); + check_pending_exception("Error while calling createConstantFloat"); return (oop) result.get_jobject(); } -oop VMToCompiler::createCiConstantDouble(jdouble value, TRAPS) { +oop VMToCompiler::createConstantDouble(jdouble value, TRAPS) { JavaValue result(T_OBJECT); JavaCallArguments args; args.push_oop(instance()); args.push_double(value); - JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createCiConstantDouble_name(), vmSymbols::createCiConstantDouble_signature(), &args, THREAD); - check_pending_exception("Error while calling createCiConstantDouble"); + JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createConstantDouble_name(), vmSymbols::createConstantDouble_signature(), &args, THREAD); + check_pending_exception("Error while calling createConstantDouble"); return (oop) result.get_jobject(); } -oop VMToCompiler::createCiConstantObject(Handle object, TRAPS) { +oop VMToCompiler::createConstantObject(Handle object, TRAPS) { JavaValue result(T_OBJECT); JavaCallArguments args; - KlassHandle klass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_max_cri_ci_CiConstant(), SystemDictionary::java_system_loader(), NULL, Thread::current()); - JavaCalls::call_static(&result, klass(), vmSymbols::forObject_name(), vmSymbols::createCiConstantObject_signature(), object, THREAD); - check_pending_exception("Error while calling CiConstant.forObject"); + KlassHandle klass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_api_meta_Constant(), SystemDictionary::java_system_loader(), NULL, Thread::current()); + JavaCalls::call_static(&result, klass(), vmSymbols::forObject_name(), vmSymbols::createConstantObject_signature(), object, THREAD); + check_pending_exception("Error while calling Constant.forObject"); return (oop) result.get_jobject(); } diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/graal/graalVMToCompiler.hpp --- a/src/share/vm/graal/graalVMToCompiler.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/graal/graalVMToCompiler.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -64,38 +64,35 @@ // public abstract void bootstrap(); static void bootstrap(); - // public abstract RiMethod createRiMethodResolved(long vmId, String name); - static oop createRiMethodResolved(jlong vmId, Handle name, TRAPS); + // public abstract JavaMethod createResolvedJavaMethod(long vmId, String name); + static oop createResolvedJavaMethod(jlong vmId, Handle name, TRAPS); - // public abstract RiMethod createRiMethodUnresolved(String name, String signature, RiType holder); - static oop createRiMethodUnresolved(Handle name, Handle signature, Handle holder, TRAPS); + // public abstract JavaMethod createJavaMethod(String name, String signature, JavaType holder); + static oop createJavaMethod(Handle name, Handle signature, Handle holder, TRAPS); - // public abstract RiField createRiField(RiType holder, String name, RiType type, int flags, int offset); - static oop createRiField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS); + // public abstract JavaField createJavaField(JavaType holder, String name, JavaType type, int flags, int offset); + static oop createJavaField(Handle holder, Handle name, Handle type, int index, int flags, TRAPS); - // public abstract RiType createRiType(long vmId, String name); - static oop createRiType(jlong vmId, Handle name, TRAPS); + // public abstract JavaType createJavaType(String name); + static oop createJavaType(Handle name, TRAPS); - // public abstract RiType createRiTypeUnresolved(String name); - static oop createRiTypeUnresolved(Handle name, TRAPS); + // public abstract JavaType createPrimitiveJavaType(int basicType); + static oop createPrimitiveJavaType(int basicType, TRAPS); - // public abstract RiType createRiTypePrimitive(int basicType); - static oop createRiTypePrimitive(int basicType, TRAPS); + // public abstract Signature createSignature(String signature); + static oop createSignature(Handle name, TRAPS); - // public abstract RiSignature createRiSignature(String signature); - static oop createRiSignature(Handle name, TRAPS); - - // public abstract CiConstant createCiConstant(CiKind kind, long value); - static oop createCiConstant(Handle kind, jlong value, TRAPS); + // public abstract Constant createConstant(Kind kind, long value); + static oop createConstant(Handle kind, jlong value, TRAPS); - // public abstract CiConstant createCiConstantFloat(float value); - static oop createCiConstantFloat(jfloat value, TRAPS); + // public abstract Constant createConstantFloat(float value); + static oop createConstantFloat(jfloat value, TRAPS); - // public abstract CiConstant createCiConstantDouble(double value); - static oop createCiConstantDouble(jdouble value, TRAPS); + // public abstract Constant createConstantDouble(double value); + static oop createConstantDouble(jdouble value, TRAPS); - // public abstract CiConstant createCiConstantObject(long vmId); - static oop createCiConstantObject(Handle object, TRAPS); + // public abstract Constant createConstantObject(long vmId); + static oop createConstantObject(Handle object, TRAPS); }; inline void check_pending_exception(const char* message, bool dump_core = false) { diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/oops/klass.hpp --- a/src/share/vm/oops/klass.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/oops/klass.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -239,7 +239,7 @@ klassOop _primary_supers[_primary_super_limit]; // java/lang/Class instance mirroring this class oop _java_mirror; - // com/oracle/graal/hotspot/HotSpotTypeResolved mirroring this class + // com/oracle/graal/hotspot/HotSpotResolvedJavaType mirroring this class oop _graal_mirror; // Superclass klassOop _super; diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/oops/methodOop.cpp --- a/src/share/vm/oops/methodOop.cpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/oops/methodOop.cpp Sun Jun 10 01:17:48 2012 +0200 @@ -665,7 +665,7 @@ #ifdef GRAAL oop graal_mirror = this->graal_mirror(); if (graal_mirror != NULL) { - HotSpotMethodResolved::set_canBeInlined(graal_mirror, false); + HotSpotResolvedJavaMethod::set_canBeInlined(graal_mirror, false); } #endif } diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/oops/methodOop.hpp --- a/src/share/vm/oops/methodOop.hpp Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/oops/methodOop.hpp Sun Jun 10 01:17:48 2012 +0200 @@ -132,7 +132,7 @@ InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations #ifdef GRAAL - oop _graal_mirror; // com/oracle/graal/hotspot/HotSpotMethodResolved mirroring this method + oop _graal_mirror; // com/oracle/graal/hotspot/HotSpotResolvedJavaMethod mirroring this method jlong _graal_invocation_time; int _graal_priority; #endif diff -r 511612d1b5c1 -r 70f715dfbb41 src/share/vm/prims/jvmtiLib.xsl --- a/src/share/vm/prims/jvmtiLib.xsl Sat Jun 09 22:50:50 2012 +0200 +++ b/src/share/vm/prims/jvmtiLib.xsl Sun Jun 10 01:17:48 2012 +0200 @@ -753,7 +753,7 @@ - + @@ -777,7 +777,7 @@ - + @@ -789,7 +789,7 @@ - + JavaThread* @@ -800,23 +800,23 @@ - + JvmtiRawMonitor * - + jint - + methodOop - + fieldDescriptor* - +