# HG changeset patch # User Doug Simon # Date 1440407200 -7200 # Node ID 7ad03bf3d4a9a49a5207ca141426e0d31971889d # Parent 76af33d4d504c8eae9c3e494ceba79dfb482c8a9 renames related to using metaspace wrappers instead of raw metaspace values diff -r 76af33d4d504 -r 7ad03bf3d4a9 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java Fri Aug 21 11:57:29 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java Mon Aug 24 11:06:40 2015 +0200 @@ -31,9 +31,9 @@ import sun.misc.*; /** - * Calls from Java into HotSpot. The behavior of all the methods in this class that take a metaspace - * pointer as an argument (e.g., {@link #getExceptionTableStart(HotSpotResolvedJavaMethodImpl)}) is - * undefined if the argument does not denote a valid metaspace object. + * Calls from Java into HotSpot. The behavior of all the methods in this class that take a native + * pointer as an argument (e.g., {@link #getSymbol(long)}) is undefined if the argument does not + * denote a valid native object. */ public interface CompilerToVM { @@ -97,18 +97,18 @@ * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}. * * @param method the method on which to base the search - * @param actualHolderKlass the best known type of receiver + * @param actualHolderType the best known type of receiver * @return the method result or 0 is there is no unique concrete method for {@code method} */ - HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderKlass, HotSpotResolvedJavaMethodImpl method); + HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderType, HotSpotResolvedJavaMethodImpl method); /** - * Gets the implementor for the interface class {@code metaspaceKlass}. + * Gets the implementor for the interface class {@code type}. * * @return the implementor if there is a single implementor, 0 if there is no implementor, or - * {@code metaspaceKlass} itself if there is more than one implementor + * {@code type} itself if there is more than one implementor */ - HotSpotResolvedObjectTypeImpl getKlassImplementor(HotSpotResolvedObjectTypeImpl klass); + HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type); /** * Determines if {@code method} is ignored by security stack walks. @@ -116,14 +116,13 @@ boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethodImpl method); /** - * Converts a name to a metaspace Klass. + * Converts a name to a type. * * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format * @param accessingClass the context of resolution (must not be null) * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will * either return a {@link ResolvedJavaType} or throw an exception - * @return the metaspace Klass for {@code name} or 0 if resolution failed and - * {@code resolve == false} + * @return the type for {@code name} or 0 if resolution failed and {@code resolve == false} * @throws LinkageError if {@code resolve == true} and the resolution failed */ HotSpotResolvedObjectTypeImpl lookupType(String name, Class accessingClass, boolean resolve); @@ -188,7 +187,7 @@ * The behavior of this method is undefined if {@code cpi} does not denote a * {@code JVM_CONSTANT_Class} entry. * - * @return a HotSpotResolvedObjectTypeImpl for a resolved class entry or a String otherwise + * @return the resolved class entry or a String otherwise */ Object lookupKlassInPool(HotSpotConstantPool constantPool, int cpi); @@ -203,7 +202,7 @@ * {@code -1}. If non-negative, then resolution checks specific to the bytecode it * denotes are performed if the method is already resolved. Should any of these * checks fail, 0 is returned. - * @return a metaspace Method for a resolved method entry, 0 otherwise + * @return the resolved method entry, 0 otherwise */ HotSpotResolvedJavaMethodImpl lookupMethodInPool(HotSpotConstantPool constantPool, int cpi, byte opcode); @@ -228,15 +227,14 @@ void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi); /** - * Gets the resolved metaspace Klass denoted by the entry at index {@code cpi} in - * {@code constantPool}. + * Gets the resolved type denoted by the entry at index {@code cpi} in {@code constantPool}. * * The behavior of this method is undefined if {@code cpi} does not denote an entry representing * a class. * * @throws LinkageError if resolution failed */ - HotSpotResolvedObjectTypeImpl resolveKlassInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError; + HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError; /** * Looks up and attempts to resolve the {@code JVM_CONSTANT_Field} entry at index {@code cpi} in @@ -251,7 +249,7 @@ * {@code JVM_CONSTANT_Field} entry. * * @param info an array in which the details of the field are returned - * @return the metaspace Klass defining the field if resolution is successful, 0 otherwise + * @return the type defining the field if resolution is successful, 0 otherwise */ HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantPool constantPool, int cpi, byte opcode, long[] info); @@ -310,27 +308,27 @@ /** * Resolves the implementation of {@code method} for virtual dispatches on objects of dynamic - * type {@code metaspaceKlassExactReceiver}. This resolution process only searches "up" the - * class hierarchy of {@code metaspaceKlassExactReceiver}. + * type {@code exactReceiver}. This resolution process only searches "up" the class hierarchy of + * {@code exactReceiver}. * - * @param klassCaller the caller or context type used to perform access checks + * @param caller the caller or context type used to perform access checks * @return the link-time resolved method (might be abstract) or {@code 0} if it can not be * linked */ - HotSpotResolvedJavaMethodImpl resolveMethod(HotSpotResolvedObjectTypeImpl klassExactReceiver, HotSpotResolvedJavaMethodImpl method, HotSpotResolvedObjectTypeImpl klassCaller); + HotSpotResolvedJavaMethodImpl resolveMethod(HotSpotResolvedObjectTypeImpl exactReceiver, HotSpotResolvedJavaMethodImpl method, HotSpotResolvedObjectTypeImpl caller); /** - * Gets the static initializer of {@code metaspaceKlass}. + * Gets the static initializer of {@code type}. * - * @return 0 if {@code metaspaceKlass} has no static initialize + * @return 0 if {@code type} has no static initializer */ - HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl klass); + HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl type); /** - * Determines if {@code metaspaceKlass} or any of its currently loaded subclasses overrides + * Determines if {@code type} or any of its currently loaded subclasses overrides * {@code Object.finalize()}. */ - boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl klass); + boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl type); /** * Gets the method corresponding to {@code holder} and slot number {@code slot} (i.e. @@ -404,11 +402,6 @@ long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method); /** - * Gets the {@link Class} mirror associated with {@code metaspaceKlass}. - */ - Class getJavaMirror(HotSpotResolvedObjectTypeImpl klass); - - /** * Reads an object pointer within a VM data structure. That is, any {@link HotSpotVMField} whose * {@link HotSpotVMField#type() type} is {@code "oop"} (e.g., * {@code ArrayKlass::_component_mirror}, {@code Klass::_java_mirror}, @@ -484,8 +477,7 @@ * Looks for the next Java stack frame matching an entry in {@code methods}. * * @param frame the starting point of the search, where {@code null} refers to the topmost frame - * @param methods the metaspace methods to look for, where {@code null} means that any frame is - * returned + * @param methods the methods to look for, where {@code null} means that any frame is returned * @return the frame, or {@code null} if the end of the stack was reached during the search */ HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, HotSpotResolvedJavaMethodImpl[] methods, int initialSkip); @@ -499,11 +491,11 @@ void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate); /** - * Gets the v-table index for interface method {@code method} in the receiver type - * {@code metaspaceKlass} or {@link HotSpotVMConfig#invalidVtableIndex} if {@code method} is not - * in {@code metaspaceKlass}'s v-table. + * Gets the v-table index for interface method {@code method} in the receiver {@code type} or + * {@link HotSpotVMConfig#invalidVtableIndex} if {@code method} is not in {@code type}'s + * v-table. */ - int getVtableIndexForInterface(HotSpotResolvedObjectTypeImpl klass, HotSpotResolvedJavaMethodImpl method); + int getVtableIndexForInterface(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method); /** * Determines if debug info should also be emitted at non-safepoint locations. diff -r 76af33d4d504 -r 7ad03bf3d4a9 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java Fri Aug 21 11:57:29 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java Mon Aug 24 11:06:40 2015 +0200 @@ -64,10 +64,10 @@ public native boolean hasBalancedMonitors(HotSpotResolvedJavaMethodImpl method); @Override - public native HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderKlass, HotSpotResolvedJavaMethodImpl method); + public native HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(HotSpotResolvedObjectTypeImpl actualHolderType, HotSpotResolvedJavaMethodImpl method); @Override - public native HotSpotResolvedObjectTypeImpl getKlassImplementor(HotSpotResolvedObjectTypeImpl klass); + public native HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type); @Override public native HotSpotResolvedObjectTypeImpl lookupType(String name, Class accessingClass, boolean eagerResolve); @@ -108,7 +108,7 @@ private native int lookupKlassRefIndexInPool0(HotSpotConstantPool constantPool, int cpi); - public native HotSpotResolvedObjectTypeImpl resolveKlassInPool(HotSpotConstantPool constantPool, int cpi); + public native HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi); @Override public native Object lookupKlassInPool(HotSpotConstantPool constantPool, int cpi); @@ -141,12 +141,12 @@ public native HotSpotResolvedJavaMethodImpl resolveMethod(HotSpotResolvedObjectTypeImpl klassExactReceiver, HotSpotResolvedJavaMethodImpl method, HotSpotResolvedObjectTypeImpl klassCaller); @Override - public native boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl klass); + public native boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl type); public native boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethodImpl method); @Override - public native HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl klass); + public native HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl type); @Override public native long getMaxCallTargetOffset(long address); @@ -177,9 +177,6 @@ public native void invalidateInstalledCode(InstalledCode hotspotInstalledCode); @Override - public native Class getJavaMirror(HotSpotResolvedObjectTypeImpl klass); - - @Override public native Object readUncompressedOop(long address); @Override @@ -223,7 +220,7 @@ public native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int index); - public native int getVtableIndexForInterface(HotSpotResolvedObjectTypeImpl klass, HotSpotResolvedJavaMethodImpl method); + public native int getVtableIndexForInterface(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method); public native boolean shouldDebugNonSafepoints(); diff -r 76af33d4d504 -r 7ad03bf3d4a9 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantPool.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantPool.java Fri Aug 21 11:57:29 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantPool.java Mon Aug 24 11:06:40 2015 +0200 @@ -882,8 +882,8 @@ return new HotSpotMethodUnresolved(name, signature, holder); } else { final int klassIndex = getKlassRefIndexAt(index); - final Object metaspacePointer = runtime().getCompilerToVM().lookupKlassInPool(this, klassIndex); - JavaType holder = getJavaType(metaspacePointer); + final Object type = runtime().getCompilerToVM().lookupKlassInPool(this, klassIndex); + JavaType holder = getJavaType(type); return new HotSpotMethodUnresolved(name, signature, holder); } } @@ -919,9 +919,9 @@ if (holder instanceof HotSpotResolvedObjectTypeImpl) { long[] info = new long[2]; - HotSpotResolvedObjectTypeImpl metaspaceKlass; + HotSpotResolvedObjectTypeImpl resolvedHolder; try { - metaspaceKlass = runtime().getCompilerToVM().resolveFieldInPool(this, index, (byte) opcode, info); + resolvedHolder = runtime().getCompilerToVM().resolveFieldInPool(this, index, (byte) opcode, info); } catch (Throwable t) { /* * If there was an exception resolving the field we give up and return an unresolved @@ -929,7 +929,6 @@ */ return new HotSpotUnresolvedField(holder, name, type); } - HotSpotResolvedObjectTypeImpl resolvedHolder = metaspaceKlass; final int flags = (int) info[0]; final long offset = info[1]; HotSpotResolvedJavaField result = resolvedHolder.createField(name, type, offset, flags); @@ -1010,8 +1009,7 @@ case Class: case UnresolvedClass: case UnresolvedClassInError: - final HotSpotResolvedObjectTypeImpl metaspaceKlass = runtime().getCompilerToVM().resolveKlassInPool(this, index); - HotSpotResolvedObjectTypeImpl type = metaspaceKlass; + final HotSpotResolvedObjectTypeImpl type = runtime().getCompilerToVM().resolveTypeInPool(this, index); Class klass = type.mirror(); if (!klass.isPrimitive() && !klass.isArray()) { unsafe.ensureClassInitialized(klass); diff -r 76af33d4d504 -r 7ad03bf3d4a9 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Fri Aug 21 11:57:29 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Mon Aug 24 11:06:40 2015 +0200 @@ -69,8 +69,8 @@ * * Called from the VM. * - * @param javaClass a metaspace Klass object - * @return the {@link ResolvedJavaType} corresponding to {@code metaspaceKlass} + * @param javaClass a {@link Class} object + * @return the {@link ResolvedJavaType} corresponding to {@code javaClass} */ @SuppressWarnings("unused") private static HotSpotResolvedObjectTypeImpl fromMetaspace(Class javaClass) { @@ -242,7 +242,7 @@ if (!isInterface()) { throw new JVMCIError("Cannot call getSingleImplementor() on a non-interface type: %s", this); } - return runtime().getCompilerToVM().getKlassImplementor(this); + return runtime().getCompilerToVM().getImplementor(this); } public HotSpotResolvedObjectTypeImpl getSupertype() { diff -r 76af33d4d504 -r 7ad03bf3d4a9 jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/MetaspaceWrapperObject.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/MetaspaceWrapperObject.java Fri Aug 21 11:57:29 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/MetaspaceWrapperObject.java Mon Aug 24 11:06:40 2015 +0200 @@ -23,9 +23,10 @@ package jdk.internal.jvmci.hotspot; /** - * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object. It - * would preferable if this were the base class containing the pointer but that would require mixins - * since most of the wrapper types have complex supertype hierarchies. + * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object. + * + * It would preferable if this were the base class containing the pointer but that would require + * mixins since most of the wrapper types have complex supertype hierarchies. */ public interface MetaspaceWrapperObject { diff -r 76af33d4d504 -r 7ad03bf3d4a9 src/share/vm/jvmci/jvmciCompilerToVM.cpp --- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp Fri Aug 21 11:57:29 2015 -0700 +++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp Mon Aug 24 11:06:40 2015 +0200 @@ -280,7 +280,7 @@ return JNIHandles::make_local(THREAD, result); C2V_END -C2V_VMENTRY(jobject, getKlassImplementor, (JNIEnv *, jobject, jobject jvmci_type)) +C2V_VMENTRY(jobject, getImplementor, (JNIEnv *, jobject, jobject jvmci_type)) InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type); oop implementor = CompilerToVM::get_jvmci_type(klass->implementor(), CHECK_NULL); return JNIHandles::make_local(THREAD, implementor); @@ -390,7 +390,7 @@ return cp->klass_ref_index_at(index); C2V_END -C2V_VMENTRY(jobject, resolveKlassInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) +C2V_VMENTRY(jobject, resolveTypeInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index)) constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool); Klass* resolved_klass = cp->klass_at(index, CHECK_NULL); Handle klass = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL); @@ -806,11 +806,6 @@ InstalledCode::set_address(hotspotInstalledCode, 0); C2V_END -C2V_VMENTRY(jobject, getJavaMirror, (JNIEnv* env, jobject, jobject jvmci_type)) - Klass* klass = CompilerToVM::asKlass(jvmci_type); - return JNIHandles::make_local(THREAD, klass->java_mirror()); -C2V_END - C2V_VMENTRY(jobject, readUncompressedOop, (JNIEnv*, jobject, jlong addr)) oop ret = oopDesc::load_decode_heap_oop((oop*)(address)addr); return JNIHandles::make_local(THREAD, ret); @@ -846,8 +841,8 @@ return tty->time_stamp().milliseconds(); C2V_END -C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong metaspaceSymbol)) - Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)metaspaceSymbol, CHECK_NULL); +C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong symbol)) + Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)symbol, CHECK_NULL); return JNIHandles::make_local(THREAD, sym()); C2V_END @@ -1149,7 +1144,7 @@ {CC"getExceptionTableLength", CC"("HS_RESOLVED_METHOD")I", FN_PTR(getExceptionTableLength)}, {CC"hasBalancedMonitors", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(hasBalancedMonitors)}, {CC"findUniqueConcreteMethod", CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")"HS_RESOLVED_METHOD, FN_PTR(findUniqueConcreteMethod)}, - {CC"getKlassImplementor", CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_KLASS, FN_PTR(getKlassImplementor)}, + {CC"getImplementor", CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_KLASS, FN_PTR(getImplementor)}, {CC"getStackTraceElement", CC"("HS_RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)}, {CC"methodIsIgnoredBySecurityStackWalk", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(methodIsIgnoredBySecurityStackWalk)}, {CC"doNotInlineOrCompile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(doNotInlineOrCompile)}, @@ -1166,7 +1161,7 @@ {CC"constantPoolRemapInstructionOperandFromCache0",CC"("HS_CONSTANT_POOL"I)I", FN_PTR(constantPoolRemapInstructionOperandFromCache)}, {CC"resolveConstantInPool", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolveConstantInPool)}, {CC"resolvePossiblyCachedConstantInPool0", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)}, - {CC"resolveKlassInPool", CC"("HS_CONSTANT_POOL"I)"HS_RESOLVED_KLASS, FN_PTR(resolveKlassInPool)}, + {CC"resolveTypeInPool", CC"("HS_CONSTANT_POOL"I)"HS_RESOLVED_KLASS, FN_PTR(resolveTypeInPool)}, {CC"resolveFieldInPool", CC"("HS_CONSTANT_POOL"IB[J)"HS_RESOLVED_KLASS, FN_PTR(resolveFieldInPool)}, {CC"resolveInvokeDynamicInPool", CC"("HS_CONSTANT_POOL"I)V", FN_PTR(resolveInvokeDynamicInPool)}, {CC"resolveInvokeHandleInPool", CC"("HS_CONSTANT_POOL"I)V", FN_PTR(resolveInvokeHandleInPool)}, @@ -1190,7 +1185,6 @@ {CC"getLocalVariableTableLength", CC"("HS_RESOLVED_METHOD")I", FN_PTR(getLocalVariableTableLength)}, {CC"reprofile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(reprofile)}, {CC"invalidateInstalledCode", CC"("INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)}, - {CC"getJavaMirror", CC"("HS_RESOLVED_KLASS")"CLASS, FN_PTR(getJavaMirror)}, {CC"readUncompressedOop", CC"(J)"OBJECT, FN_PTR(readUncompressedOop)}, {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)}, {CC"allocateCompileId", CC"("HS_RESOLVED_METHOD"I)I", FN_PTR(allocateCompileId)},