Mercurial > hg > graal-jvmci-8
changeset 22542:15579668ec3a
renamed constant field to UNSAFE
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantPool.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotConstantPool.java Wed Sep 09 15:27:45 2015 +0200 @@ -23,7 +23,7 @@ package jdk.internal.jvmci.hotspot; import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.*; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import java.lang.invoke.*; @@ -277,8 +277,8 @@ private JVM_CONSTANT getTagAt(int index) { assertBounds(index); HotSpotVMConfig config = runtime().getConfig(); - final long metaspaceConstantPoolTags = unsafe.getAddress(getMetaspaceConstantPool() + config.constantPoolTagsOffset); - final int tag = unsafe.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index); + final long metaspaceConstantPoolTags = UNSAFE.getAddress(getMetaspaceConstantPool() + config.constantPoolTagsOffset); + final int tag = UNSAFE.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index); if (tag == 0) { return null; } @@ -293,7 +293,7 @@ */ private long getEntryAt(int index) { assertBounds(index); - return unsafe.getAddress(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); + return UNSAFE.getAddress(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); } /** @@ -304,7 +304,7 @@ */ private int getIntAt(int index) { assertTag(index, JVM_CONSTANT.Integer); - return unsafe.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); + return UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); } /** @@ -315,7 +315,7 @@ */ private long getLongAt(int index) { assertTag(index, JVM_CONSTANT.Long); - return unsafe.getLong(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); + return UNSAFE.getLong(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); } /** @@ -326,7 +326,7 @@ */ private float getFloatAt(int index) { assertTag(index, JVM_CONSTANT.Float); - return unsafe.getFloat(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); + return UNSAFE.getFloat(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); } /** @@ -337,7 +337,7 @@ */ private double getDoubleAt(int index) { assertTag(index, JVM_CONSTANT.Double); - return unsafe.getDouble(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); + return UNSAFE.getDouble(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); } /** @@ -348,7 +348,7 @@ */ private int getNameAndTypeAt(int index) { assertTag(index, JVM_CONSTANT.NameAndType); - return unsafe.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); + return UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); } /** @@ -429,7 +429,7 @@ */ private int getUncachedKlassRefIndexAt(int index) { assertTagIsFieldOrMethod(index); - final int refIndex = unsafe.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); + final int refIndex = UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize); // klass ref index is in the low 16-bits. return refIndex & 0xFFFF; } @@ -467,7 +467,7 @@ @Override public int length() { - return unsafe.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolLengthOffset); + return UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolLengthOffset); } @Override @@ -673,7 +673,7 @@ final HotSpotResolvedObjectTypeImpl type = runtime().getCompilerToVM().resolveTypeInPool(this, index); Class<?> klass = type.mirror(); if (!klass.isPrimitive() && !klass.isArray()) { - unsafe.ensureClassInitialized(klass); + UNSAFE.ensureClassInitialized(klass); } switch (tag) { case MethodRef:
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotInstalledCode.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotInstalledCode.java Wed Sep 09 15:27:45 2015 +0200 @@ -22,7 +22,7 @@ */ package jdk.internal.jvmci.hotspot; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import jdk.internal.jvmci.code.InstalledCode; import jdk.internal.jvmci.inittimer.SuppressFBWarnings; import sun.misc.Unsafe; @@ -66,7 +66,7 @@ return null; } byte[] blob = new byte[size]; - unsafe.copyMemory(null, getAddress(), blob, Unsafe.ARRAY_BYTE_BASE_OFFSET, size); + UNSAFE.copyMemory(null, getAddress(), blob, Unsafe.ARRAY_BYTE_BASE_OFFSET, size); return blob; } @@ -89,7 +89,7 @@ return null; } byte[] code = new byte[codeSize]; - unsafe.copyMemory(null, codeStart, code, Unsafe.ARRAY_BYTE_BASE_OFFSET, codeSize); + UNSAFE.copyMemory(null, codeStart, code, Unsafe.ARRAY_BYTE_BASE_OFFSET, codeSize); return code; } }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java Wed Sep 09 15:27:45 2015 +0200 @@ -22,7 +22,7 @@ */ package jdk.internal.jvmci.hotspot; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import jdk.internal.jvmci.code.TargetDescription; import jdk.internal.jvmci.common.JVMCIError; import jdk.internal.jvmci.hotspot.HotSpotVMConfig.CompressEncoding; @@ -86,13 +86,13 @@ if (base != null) { switch (bits) { case 8: - return unsafe.getByte(base, displacement); + return UNSAFE.getByte(base, displacement); case 16: - return unsafe.getShort(base, displacement); + return UNSAFE.getShort(base, displacement); case 32: - return unsafe.getInt(base, displacement); + return UNSAFE.getInt(base, displacement); case 64: - return unsafe.getLong(base, displacement); + return UNSAFE.getLong(base, displacement); default: throw new JVMCIError("%d", bits); } @@ -100,13 +100,13 @@ long pointer = asRawPointer(baseConstant); switch (bits) { case 8: - return unsafe.getByte(pointer + displacement); + return UNSAFE.getByte(pointer + displacement); case 16: - return unsafe.getShort(pointer + displacement); + return UNSAFE.getShort(pointer + displacement); case 32: - return unsafe.getInt(pointer + displacement); + return UNSAFE.getInt(pointer + displacement); case 64: - return unsafe.getLong(pointer + displacement); + return UNSAFE.getLong(pointer + displacement); default: throw new JVMCIError("%d", bits); } @@ -117,7 +117,7 @@ if (compressed == runtime.getConfig().useCompressedOops) { Object obj = asObject(base); if (obj != null) { - assert expected == unsafe.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject"; + assert expected == UNSAFE.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject"; } } if (base instanceof HotSpotMetaspaceConstant) { @@ -144,7 +144,7 @@ ret = runtime.getCompilerToVM().readUncompressedOop(displacement); } else { assert runtime.getConfig().useCompressedOops == compressed; - ret = unsafe.getObject(base, displacement); + ret = UNSAFE.getObject(base, displacement); } assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed); return ret;
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java Wed Sep 09 15:27:45 2015 +0200 @@ -23,7 +23,7 @@ package jdk.internal.jvmci.hotspot; import static jdk.internal.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import java.lang.reflect.*; @@ -100,7 +100,7 @@ // java.lang.reflect.Field's modifiers should be enough here since VM internal modifier bits // are not used (yet). final int modifiers = reflectionField.getModifiers(); - final long offset = Modifier.isStatic(modifiers) ? unsafe.staticFieldOffset(reflectionField) : unsafe.objectFieldOffset(reflectionField); + final long offset = Modifier.isStatic(modifiers) ? UNSAFE.staticFieldOffset(reflectionField) : UNSAFE.objectFieldOffset(reflectionField); HotSpotResolvedObjectType holder = fromObjectClass(fieldHolder); JavaType type = runtime.fromClass(fieldType);
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMethodData.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMethodData.java Wed Sep 09 15:27:45 2015 +0200 @@ -24,7 +24,7 @@ import static java.lang.String.*; import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.*; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import java.util.*; @@ -78,7 +78,7 @@ * @return value of the MethodData::_data_size field */ private int normalDataSize() { - return unsafe.getInt(metaspaceMethodData + config.methodDataDataSize); + return UNSAFE.getInt(metaspaceMethodData + config.methodDataDataSize); } /** @@ -89,7 +89,7 @@ */ private int extraDataSize() { final int extraDataBase = config.methodDataOopDataOffset + normalDataSize(); - final int extraDataLimit = unsafe.getInt(metaspaceMethodData + config.methodDataSize); + final int extraDataLimit = UNSAFE.getInt(metaspaceMethodData + config.methodDataSize); return extraDataLimit - extraDataBase; } @@ -112,13 +112,13 @@ public int getDeoptimizationCount(DeoptimizationReason reason) { HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); int reasonIndex = metaAccess.convertDeoptReason(reason); - return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; + return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; } public int getOSRDeoptimizationCount(DeoptimizationReason reason) { HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); int reasonIndex = metaAccess.convertDeoptReason(reason); - return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; + return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; } public HotSpotMethodDataAccessor getNormalData(int position) { @@ -160,12 +160,12 @@ private int readUnsignedByte(int position, int offsetInBytes) { long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); - return unsafe.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF; + return UNSAFE.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF; } private int readUnsignedShort(int position, int offsetInBytes) { long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); - return unsafe.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF; + return UNSAFE.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF; } /** @@ -174,7 +174,7 @@ */ private long readUnsignedInt(int position, int offsetInBytes) { long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); - return unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL; + return UNSAFE.getAddress(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL; } private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) { @@ -188,7 +188,7 @@ */ private int readInt(int position, int offsetInBytes) { long fullOffsetInBytes = computeFullOffset(position, offsetInBytes); - return (int) unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes); + return (int) UNSAFE.getAddress(metaspaceMethodData + fullOffsetInBytes); } private HotSpotResolvedJavaMethod readMethod(int position, int offsetInBytes) { @@ -855,10 +855,10 @@ } public void setCompiledIRSize(int size) { - unsafe.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size); + UNSAFE.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size); } public int getCompiledIRSize() { - return unsafe.getInt(metaspaceMethodData + config.methodDataIRSizeOffset); + return UNSAFE.getInt(metaspaceMethodData + config.methodDataIRSizeOffset); } }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java Wed Sep 09 15:27:45 2015 +0200 @@ -24,7 +24,7 @@ import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.*; import static jdk.internal.jvmci.hotspot.HotSpotResolvedJavaMethodImpl.Options.*; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import java.lang.annotation.*; import java.lang.reflect.*; @@ -67,8 +67,8 @@ */ private static HotSpotResolvedObjectTypeImpl getHolder(long metaspaceMethod) { HotSpotVMConfig config = runtime().getConfig(); - final long metaspaceConstMethod = unsafe.getAddress(metaspaceMethod + config.methodConstMethodOffset); - final long metaspaceConstantPool = unsafe.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset); + final long metaspaceConstMethod = UNSAFE.getAddress(metaspaceMethod + config.methodConstMethodOffset); + final long metaspaceConstantPool = UNSAFE.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset); return runtime().getCompilerToVM().getResolvedJavaType(null, metaspaceConstantPool + config.constantPoolHolderOffset, false); } @@ -102,17 +102,17 @@ * signature-polymorphic method handle methods) have their own constant pool instead of the * one from their holder. */ - final long metaspaceConstantPool = unsafe.getAddress(constMethod + config.constMethodConstantsOffset); + final long metaspaceConstantPool = UNSAFE.getAddress(constMethod + config.constMethodConstantsOffset); if (metaspaceConstantPool == holder.getConstantPool().getMetaspaceConstantPool()) { this.constantPool = holder.getConstantPool(); } else { this.constantPool = runtime().getCompilerToVM().getConstantPool(null, constMethod + config.constMethodConstantsOffset); } - final int nameIndex = unsafe.getChar(constMethod + config.constMethodNameIndexOffset); + final int nameIndex = UNSAFE.getChar(constMethod + config.constMethodNameIndexOffset); this.name = constantPool.lookupUtf8(nameIndex); - final int signatureIndex = unsafe.getChar(constMethod + config.constMethodSignatureIndexOffset); + final int signatureIndex = UNSAFE.getChar(constMethod + config.constMethodSignatureIndexOffset); this.signature = (HotSpotSignature) constantPool.lookupSignature(signatureIndex); } @@ -126,7 +126,7 @@ */ private long getConstMethod() { assert metaspaceMethod != 0; - return unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset); + return UNSAFE.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset); } @Override @@ -152,7 +152,7 @@ * @return flags of this method */ private int getFlags() { - return unsafe.getByte(metaspaceMethod + runtime().getConfig().methodFlagsOffset); + return UNSAFE.getByte(metaspaceMethod + runtime().getConfig().methodFlagsOffset); } /** @@ -161,7 +161,7 @@ * @return flags of this method's ConstMethod */ private int getConstMethodFlags() { - return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset); + return UNSAFE.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset); } @Override @@ -194,7 +194,7 @@ * modifiers as well as the HotSpot internal modifiers. */ public int getAllModifiers() { - return unsafe.getInt(metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset); + return UNSAFE.getInt(metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset); } @Override @@ -221,7 +221,7 @@ @Override public int getCodeSize() { - return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodCodeSizeOffset); + return UNSAFE.getChar(getConstMethod() + runtime().getConfig().constMethodCodeSizeOffset); } @Override @@ -237,10 +237,10 @@ long exceptionTableElement = runtime().getCompilerToVM().getExceptionTableStart(this); for (int i = 0; i < exceptionTableLength; i++) { - final int startPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset); - final int endPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementEndPcOffset); - final int handlerPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementHandlerPcOffset); - int catchTypeIndex = unsafe.getChar(exceptionTableElement + config.exceptionTableElementCatchTypeIndexOffset); + final int startPc = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset); + final int endPc = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementEndPcOffset); + final int handlerPc = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementHandlerPcOffset); + int catchTypeIndex = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementCatchTypeIndexOffset); JavaType catchType; if (catchTypeIndex == 0) { @@ -345,7 +345,7 @@ return 0; } HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getChar(getConstMethod() + config.methodMaxLocalsOffset); + return UNSAFE.getChar(getConstMethod() + config.methodMaxLocalsOffset); } @Override @@ -354,7 +354,7 @@ return 0; } HotSpotVMConfig config = runtime().getConfig(); - return config.extraStackEntries + unsafe.getChar(getConstMethod() + config.constMethodMaxStackOffset); + return config.extraStackEntries + UNSAFE.getChar(getConstMethod() + config.constMethodMaxStackOffset); } @Override @@ -394,7 +394,7 @@ */ private long getCompiledCode() { HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getAddress(metaspaceMethod + config.methodCodeOffset); + return UNSAFE.getAddress(metaspaceMethod + config.methodCodeOffset); } /** @@ -413,7 +413,7 @@ public boolean hasCompiledCodeAtLevel(int level) { long compiledCode = getCompiledCode(); if (compiledCode != 0) { - return unsafe.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level; + return UNSAFE.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level; } return false; } @@ -425,7 +425,7 @@ ProfilingInfo info; if (UseProfilingInformation.getValue() && methodData == null) { - long metaspaceMethodData = unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodDataOffset); + long metaspaceMethodData = UNSAFE.getAddress(metaspaceMethod + runtime().getConfig().methodDataOffset); if (metaspaceMethodData != 0) { methodData = new HotSpotMethodData(metaspaceMethodData, this); if (TraceMethodDataFilter != null && this.format("%H.%n").contains(TraceMethodDataFilter)) { @@ -595,11 +595,11 @@ Local[] locals = new Local[localVariableTableLength]; for (int i = 0; i < localVariableTableLength; i++) { - final int startBci = unsafe.getChar(localVariableTableElement + config.localVariableTableElementStartBciOffset); - final int endBci = startBci + unsafe.getChar(localVariableTableElement + config.localVariableTableElementLengthOffset); - final int nameCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementNameCpIndexOffset); - final int typeCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementDescriptorCpIndexOffset); - final int slot = unsafe.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset); + final int startBci = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementStartBciOffset); + final int endBci = startBci + UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementLengthOffset); + final int nameCpIndex = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementNameCpIndexOffset); + final int typeCpIndex = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementDescriptorCpIndexOffset); + final int slot = UNSAFE.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset); String localName = getConstantPool().lookupUtf8(nameCpIndex); String localType = getConstantPool().lookupUtf8(typeCpIndex); @@ -660,7 +660,7 @@ private int getVtableIndex() { assert !holder.isInterface(); HotSpotVMConfig config = runtime().getConfig(); - int result = unsafe.getInt(metaspaceMethod + config.methodVtableIndexOffset); + int result = UNSAFE.getInt(metaspaceMethod + config.methodVtableIndexOffset); assert result >= config.nonvirtualVtableIndex : "must be linked"; return result; } @@ -701,7 +701,7 @@ public int intrinsicId() { HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getByte(metaspaceMethod + config.methodIntrinsicIdOffset) & 0xff; + return UNSAFE.getByte(metaspaceMethod + config.methodIntrinsicIdOffset) & 0xff; } @Override
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Sep 09 15:27:45 2015 +0200 @@ -24,7 +24,7 @@ import static java.util.Objects.*; import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.*; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import java.lang.annotation.*; import java.lang.reflect.*; @@ -110,9 +110,9 @@ */ public long getMetaspaceKlass() { if (HotSpotJVMCIRuntime.getHostWordKind() == JavaKind.Long) { - return unsafe.getLong(javaClass, (long) runtime().getConfig().klassOffset); + return UNSAFE.getLong(javaClass, (long) runtime().getConfig().klassOffset); } - return unsafe.getInt(javaClass, (long) runtime().getConfig().klassOffset) & 0xFFFFFFFFL; + return UNSAFE.getInt(javaClass, (long) runtime().getConfig().klassOffset) & 0xFFFFFFFFL; } public long getMetaspacePointer() { @@ -130,7 +130,7 @@ public int getAccessFlags() { HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getInt(getMetaspaceKlass() + config.klassAccessFlagsOffset); + return UNSAFE.getInt(getMetaspaceKlass() + config.klassAccessFlagsOffset); } @Override @@ -180,7 +180,7 @@ HotSpotResolvedObjectTypeImpl type = this; while (type.isAbstract()) { HotSpotResolvedObjectTypeImpl subklass = type.getSubklass(); - if (subklass == null || unsafe.getAddress(subklass.getMetaspaceKlass() + config.nextSiblingOffset) != 0) { + if (subklass == null || UNSAFE.getAddress(subklass.getMetaspaceKlass() + config.nextSiblingOffset) != 0) { return null; } type = subklass; @@ -336,13 +336,13 @@ */ private int getInitState() { assert !isArray() : "_init_state only exists in InstanceKlass"; - return unsafe.getByte(getMetaspaceKlass() + runtime().getConfig().instanceKlassInitStateOffset) & 0xFF; + return UNSAFE.getByte(getMetaspaceKlass() + runtime().getConfig().instanceKlassInitStateOffset) & 0xFF; } @Override public void initialize() { if (!isInitialized()) { - unsafe.ensureClassInitialized(mirror()); + UNSAFE.ensureClassInitialized(mirror()); assert isInitialized(); } } @@ -439,7 +439,7 @@ public int layoutHelper() { HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getInt(getMetaspaceKlass() + config.klassLayoutHelperOffset); + return UNSAFE.getInt(getMetaspaceKlass() + config.klassLayoutHelperOffset); } synchronized HotSpotResolvedJavaMethod createMethod(long metaspaceMethod) { @@ -463,8 +463,8 @@ /* Everything has the core vtable of java.lang.Object */ return config.baseVtableLength; } - int result = unsafe.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize); - assert result >= config.baseVtableLength : unsafe.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) + " " + config.vtableEntrySize; + int result = UNSAFE.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize); + assert result >= config.baseVtableLength : UNSAFE.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) + " " + config.vtableEntrySize; return result; } @@ -549,7 +549,7 @@ public FieldInfo(int index) { HotSpotVMConfig config = runtime().getConfig(); // Get Klass::_fields - final long metaspaceFields = unsafe.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); + final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code"; metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * Short.BYTES * index; } @@ -579,7 +579,7 @@ * on top an array of Java shorts. */ private int readFieldSlot(int index) { - return unsafe.getChar(metaspaceData + Short.BYTES * index); + return UNSAFE.getChar(metaspaceData + Short.BYTES * index); } /** @@ -708,8 +708,8 @@ */ private int getFieldCount() { HotSpotVMConfig config = runtime().getConfig(); - final long metaspaceFields = unsafe.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); - int metaspaceFieldsLength = unsafe.getInt(metaspaceFields + config.arrayU1LengthOffset); + final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset); + int metaspaceFieldsLength = UNSAFE.getInt(metaspaceFields + config.arrayU1LengthOffset); int fieldCount = 0; for (int i = 0, index = 0; i < metaspaceFieldsLength; i += config.fieldInfoFieldSlots, index++) { @@ -730,7 +730,7 @@ @Override public String getSourceFileName() { HotSpotVMConfig config = runtime().getConfig(); - final int sourceFileNameIndex = unsafe.getChar(getMetaspaceKlass() + config.instanceKlassSourceFileNameIndexOffset); + final int sourceFileNameIndex = UNSAFE.getChar(getMetaspaceKlass() + config.instanceKlassSourceFileNameIndexOffset); if (sourceFileNameIndex == 0) { return null; } @@ -794,7 +794,7 @@ public int superCheckOffset() { HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getInt(getMetaspaceKlass() + config.superCheckOffsetOffset); + return UNSAFE.getInt(getMetaspaceKlass() + config.superCheckOffsetOffset); } public long prototypeMarkWord() { @@ -802,7 +802,7 @@ if (isArray()) { return config.arrayPrototypeMarkWord(); } else { - return unsafe.getAddress(getMetaspaceKlass() + config.prototypeMarkWordOffset); + return UNSAFE.getAddress(getMetaspaceKlass() + config.prototypeMarkWordOffset); } }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVMConfig.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVMConfig.java Wed Sep 09 15:27:45 2015 +0200 @@ -23,7 +23,7 @@ package jdk.internal.jvmci.hotspot; import static jdk.internal.jvmci.common.UnsafeUtil.readCString; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import java.lang.reflect.*; import java.util.*; @@ -76,13 +76,13 @@ oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift, logMinObjAlignment()); klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift, logKlassAlignment); - codeCacheLowBound = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceLowBoundaryOffset); - codeCacheHighBound = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceHighBoundaryOffset); + codeCacheLowBound = UNSAFE.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceLowBoundaryOffset); + codeCacheHighBound = UNSAFE.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceHighBoundaryOffset); - final long barrierSetAddress = unsafe.getAddress(universeCollectedHeap + collectedHeapBarrierSetOffset); - final int kind = unsafe.getInt(barrierSetAddress + barrierSetKindOffset); + final long barrierSetAddress = UNSAFE.getAddress(universeCollectedHeap + collectedHeapBarrierSetOffset); + final int kind = UNSAFE.getInt(barrierSetAddress + barrierSetKindOffset); if ((kind == barrierSetCardTableModRef) || (kind == barrierSetCardTableExtension) || (kind == barrierSetG1SATBCT) || (kind == barrierSetG1SATBCTLogging)) { - final long base = unsafe.getAddress(barrierSetAddress + cardTableModRefBSByteMapBaseOffset); + final long base = UNSAFE.getAddress(barrierSetAddress + cardTableModRefBSByteMapBaseOffset); assert base != 0 : "unexpected byte_map_base: " + base; cardtableStartAddress = base; cardtableShift = cardTableModRefBSCardShift; @@ -95,7 +95,7 @@ cardtableShift = -1; } - inlineCacheMissStub = inlineCacheMissBlob + unsafe.getInt(inlineCacheMissBlob + codeBlobCodeOffsetOffset); + inlineCacheMissStub = inlineCacheMissBlob + UNSAFE.getInt(inlineCacheMissBlob + codeBlobCodeOffsetOffset); assert check(); assert HotSpotVMConfigVerifier.check(); @@ -329,30 +329,30 @@ } public String getTypeName() { - long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeNameOffset); - return readCString(unsafe, typeNameAddress); + long typeNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryTypeNameOffset); + return readCString(UNSAFE, typeNameAddress); } public String getFieldName() { - long fieldNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryFieldNameOffset); - return readCString(unsafe, fieldNameAddress); + long fieldNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryFieldNameOffset); + return readCString(UNSAFE, fieldNameAddress); } public String getTypeString() { - long typeStringAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeStringOffset); - return readCString(unsafe, typeStringAddress); + long typeStringAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryTypeStringOffset); + return readCString(UNSAFE, typeStringAddress); } public boolean isStatic() { - return unsafe.getInt(entryAddress + gHotSpotVMStructEntryIsStaticOffset) != 0; + return UNSAFE.getInt(entryAddress + gHotSpotVMStructEntryIsStaticOffset) != 0; } public long getOffset() { - return unsafe.getLong(entryAddress + gHotSpotVMStructEntryOffsetOffset); + return UNSAFE.getLong(entryAddress + gHotSpotVMStructEntryOffsetOffset); } public long getAddress() { - return unsafe.getAddress(entryAddress + gHotSpotVMStructEntryAddressOffset); + return UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryAddressOffset); } public String getName() { @@ -365,14 +365,14 @@ String type = getTypeString(); switch (type) { case "int": - return unsafe.getInt(getAddress()); + return UNSAFE.getInt(getAddress()); case "address": case "intptr_t": - return unsafe.getAddress(getAddress()); + return UNSAFE.getAddress(getAddress()); default: // All foo* types are addresses. if (type.endsWith("*")) { - return unsafe.getAddress(getAddress()); + return UNSAFE.getAddress(getAddress()); } throw new JVMCIError(type); } @@ -440,29 +440,29 @@ } public String getTypeName() { - long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntryTypeNameOffset); - return readCString(unsafe, typeNameAddress); + long typeNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMTypeEntryTypeNameOffset); + return readCString(UNSAFE, typeNameAddress); } public String getSuperclassName() { - long superclassNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntrySuperclassNameOffset); - return readCString(unsafe, superclassNameAddress); + long superclassNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMTypeEntrySuperclassNameOffset); + return readCString(UNSAFE, superclassNameAddress); } public boolean isOopType() { - return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsOopTypeOffset) != 0; + return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsOopTypeOffset) != 0; } public boolean isIntegerType() { - return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsIntegerTypeOffset) != 0; + return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsIntegerTypeOffset) != 0; } public boolean isUnsigned() { - return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsUnsignedOffset) != 0; + return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsUnsignedOffset) != 0; } public long getSize() { - return unsafe.getLong(entryAddress + gHotSpotVMTypeEntrySizeOffset); + return UNSAFE.getLong(entryAddress + gHotSpotVMTypeEntrySizeOffset); } @Override @@ -486,8 +486,8 @@ } public String getName() { - long nameAddress = unsafe.getAddress(address + nameOffset); - return readCString(unsafe, nameAddress); + long nameAddress = UNSAFE.getAddress(address + nameOffset); + return readCString(UNSAFE, nameAddress); } public abstract long getValue(); @@ -542,7 +542,7 @@ @Override public long getValue() { - return unsafe.getInt(address + valueOffset); + return UNSAFE.getInt(address + valueOffset); } @Override @@ -601,7 +601,7 @@ @Override public long getValue() { - return unsafe.getLong(address + valueOffset); + return UNSAFE.getLong(address + valueOffset); } @Override @@ -665,32 +665,32 @@ } public String getType() { - long typeAddress = unsafe.getAddress(entryAddress + typeOffset); - return readCString(unsafe, typeAddress); + long typeAddress = UNSAFE.getAddress(entryAddress + typeOffset); + return readCString(UNSAFE, typeAddress); } public String getName() { - long nameAddress = unsafe.getAddress(entryAddress + nameOffset); - return readCString(unsafe, nameAddress); + long nameAddress = UNSAFE.getAddress(entryAddress + nameOffset); + return readCString(UNSAFE, nameAddress); } public long getAddr() { - return unsafe.getAddress(entryAddress + addrOffset); + return UNSAFE.getAddress(entryAddress + addrOffset); } public Object getValue() { switch (getType()) { case "bool": - return Boolean.valueOf(unsafe.getByte(getAddr()) != 0); + return Boolean.valueOf(UNSAFE.getByte(getAddr()) != 0); case "intx": case "uintx": case "uint64_t": - return Long.valueOf(unsafe.getLong(getAddr())); + return Long.valueOf(UNSAFE.getLong(getAddr())); case "double": - return Double.valueOf(unsafe.getDouble(getAddr())); + return Double.valueOf(UNSAFE.getDouble(getAddr())); case "ccstr": case "ccstrlist": - return readCString(unsafe, getAddr()); + return readCString(UNSAFE, getAddr()); default: throw new JVMCIError(getType()); }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVmSymbols.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVmSymbols.java Wed Sep 09 15:27:45 2015 +0200 @@ -23,7 +23,7 @@ package jdk.internal.jvmci.hotspot; import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.*; -import static jdk.internal.jvmci.hotspot.UnsafeAccess.unsafe; +import static jdk.internal.jvmci.hotspot.UnsafeAccess.UNSAFE; import sun.misc.*; /** @@ -43,6 +43,6 @@ HotSpotVMConfig config = runtime.getConfig(); assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds"; assert config.symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken"; - return runtime.getCompilerToVM().getSymbol(unsafe.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize)); + return runtime.getCompilerToVM().getSymbol(UNSAFE.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize)); } }
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/UnsafeAccess.java Wed Sep 09 12:22:15 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/UnsafeAccess.java Wed Sep 09 15:27:45 2015 +0200 @@ -31,7 +31,7 @@ */ class UnsafeAccess { - static final Unsafe unsafe = initUnsafe(); + static final Unsafe UNSAFE = initUnsafe(); private static Unsafe initUnsafe() { try {