--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java Tue Jan 10 18:48:08 2017 +0000
@@ -397,6 +397,10 @@
return "_aot_narrow_klass_base_address";
}
+ public String getNarrowOopBaseAddressSymbolName() {
+ return "_aot_narrow_oop_base_address";
+ }
+
public String getLogOfHeapRegionGrainBytesSymbolName() {
return "_aot_log_of_heap_region_grain_bytes";
}
@@ -447,6 +451,7 @@
createGotSymbol(getHeapTopAddressSymbolName());
createGotSymbol(getHeapEndAddressSymbolName());
createGotSymbol(getNarrowKlassBaseAddressSymbolName());
+ createGotSymbol(getNarrowOopBaseAddressSymbolName());
createGotSymbol(getPollingPageSymbolName());
createGotSymbol(getLogOfHeapRegionGrainBytesSymbolName());
createGotSymbol(getInlineContiguousAllocationSupportedSymbolName());
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java Tue Jan 10 18:48:08 2017 +0000
@@ -293,12 +293,18 @@
// Record methods holder
methodInfo.addDependentKlassData(binaryContainer, resolvedJavaType);
// Record inlinee classes
- for (ResolvedJavaMethod m : methodInfo.getCompilationResult().getMethods()) {
- methodInfo.addDependentKlassData(binaryContainer, (HotSpotResolvedObjectType) m.getDeclaringClass());
+ ResolvedJavaMethod[] inlinees = methodInfo.getCompilationResult().getMethods();
+ if (inlinees != null) {
+ for (ResolvedJavaMethod m : inlinees) {
+ methodInfo.addDependentKlassData(binaryContainer, (HotSpotResolvedObjectType) m.getDeclaringClass());
+ }
}
// Record classes of fields that were accessed
- for (ResolvedJavaField f : methodInfo.getCompilationResult().getFields()) {
- methodInfo.addDependentKlassData(binaryContainer, (HotSpotResolvedObjectType) f.getDeclaringClass());
+ ResolvedJavaField[] fields = methodInfo.getCompilationResult().getFields();
+ if (fields != null) {
+ for (ResolvedJavaField f : fields) {
+ methodInfo.addDependentKlassData(binaryContainer, (HotSpotResolvedObjectType) f.getDeclaringClass());
+ }
}
}
}
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MarkId.java Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MarkId.java Tue Jan 10 18:48:08 2017 +0000
@@ -48,6 +48,7 @@
HEAP_TOP_ADDRESS("CodeInstaller::HEAP_TOP_ADDRESS"),
HEAP_END_ADDRESS("CodeInstaller::HEAP_END_ADDRESS"),
NARROW_KLASS_BASE_ADDRESS("CodeInstaller::NARROW_KLASS_BASE_ADDRESS"),
+ NARROW_OOP_BASE_ADDRESS("CodeInstaller::NARROW_OOP_BASE_ADDRESS"),
CRC_TABLE_ADDRESS("CodeInstaller::CRC_TABLE_ADDRESS"),
LOG_OF_HEAP_REGION_GRAIN_BYTES("CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES"),
INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED("CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED");
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MarkProcessor.java Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MarkProcessor.java Tue Jan 10 18:48:08 2017 +0000
@@ -57,6 +57,7 @@
case HEAP_TOP_ADDRESS:
case HEAP_END_ADDRESS:
case NARROW_KLASS_BASE_ADDRESS:
+ case NARROW_OOP_BASE_ADDRESS:
case CRC_TABLE_ADDRESS:
case LOG_OF_HEAP_REGION_GRAIN_BYTES:
case INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED:
@@ -78,6 +79,9 @@
case NARROW_KLASS_BASE_ADDRESS:
vmSymbolName = binaryContainer.getNarrowKlassBaseAddressSymbolName();
break;
+ case NARROW_OOP_BASE_ADDRESS:
+ vmSymbolName = binaryContainer.getNarrowOopBaseAddressSymbolName();
+ break;
case CRC_TABLE_ADDRESS:
vmSymbolName = binaryContainer.getCrcTableAddressSymbolName();
break;
--- a/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackend.java Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotBackend.java Tue Jan 10 18:48:08 2017 +0000
@@ -267,10 +267,15 @@
if (config.useCompressedClassPointers) {
Register register = r10;
- AMD64HotSpotMove.decodeKlassPointer(asm, register, providers.getRegisters().getHeapBaseRegister(), src, config.getKlassEncoding());
- if (config.narrowKlassBase != 0) {
- // The heap base register was destroyed above, so restore it
- asm.movq(providers.getRegisters().getHeapBaseRegister(), config.narrowOopBase);
+ AMD64HotSpotMove.decodeKlassPointer(crb, asm, register, providers.getRegisters().getHeapBaseRegister(), src, config);
+ if (GeneratePIC.getValue()) {
+ asm.movq(providers.getRegisters().getHeapBaseRegister(), asm.getPlaceholder(-1));
+ crb.recordMark(config.MARKID_NARROW_OOP_BASE_ADDRESS);
+ } else {
+ if (config.narrowKlassBase != 0) {
+ // The heap base register was destroyed above, so restore it
+ asm.movq(providers.getRegisters().getHeapBaseRegister(), config.narrowOopBase);
+ }
}
asm.cmpq(inlineCacheKlass, register);
} else {
--- a/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotMove.java Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotMove.java Tue Jan 10 18:48:08 2017 +0000
@@ -265,14 +265,21 @@
}
}
- public static void decodeKlassPointer(AMD64MacroAssembler masm, Register register, Register scratch, AMD64Address address, CompressEncoding encoding) {
+ public static void decodeKlassPointer(CompilationResultBuilder crb, AMD64MacroAssembler masm, Register register, Register scratch, AMD64Address address, GraalHotSpotVMConfig config) {
+ CompressEncoding encoding = config.getKlassEncoding();
masm.movl(register, address);
if (encoding.shift != 0) {
assert encoding.alignment == encoding.shift : "Decode algorithm is wrong";
masm.shlq(register, encoding.alignment);
}
- if (encoding.base != 0) {
- masm.movq(scratch, encoding.base);
+ if (GeneratePIC.getValue() || encoding.base != 0) {
+ if (GeneratePIC.getValue()) {
+ masm.movq(scratch, masm.getPlaceholder(-1));
+ crb.recordMark(config.MARKID_NARROW_KLASS_BASE_ADDRESS);
+ } else {
+ assert encoding.base != 0;
+ masm.movq(scratch, encoding.base);
+ }
masm.addq(register, scratch);
}
}
--- a/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/jdk.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java Tue Jan 10 18:48:08 2017 +0000
@@ -773,9 +773,10 @@
public final int MARKID_HEAP_TOP_ADDRESS = getConstant("CodeInstaller::HEAP_TOP_ADDRESS", Integer.class, 17);
public final int MARKID_HEAP_END_ADDRESS = getConstant("CodeInstaller::HEAP_END_ADDRESS", Integer.class, 18);
public final int MARKID_NARROW_KLASS_BASE_ADDRESS = getConstant("CodeInstaller::NARROW_KLASS_BASE_ADDRESS", Integer.class, 19);
- public final int MARKID_CRC_TABLE_ADDRESS = getConstant("CodeInstaller::CRC_TABLE_ADDRESS", Integer.class, 20);
- public final int MARKID_LOG_OF_HEAP_REGION_GRAIN_BYTES = getConstant("CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES", Integer.class, 21);
- public final int MARKID_INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED = getConstant("CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED", Integer.class, 22);
+ public final int MARKID_NARROW_OOP_BASE_ADDRESS = getConstant("CodeInstaller::NARROW_OOP_BASE_ADDRESS", Integer.class, 20);
+ public final int MARKID_CRC_TABLE_ADDRESS = getConstant("CodeInstaller::CRC_TABLE_ADDRESS", Integer.class, 21);
+ public final int MARKID_LOG_OF_HEAP_REGION_GRAIN_BYTES = getConstant("CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES", Integer.class, 22);
+ public final int MARKID_INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED = getConstant("CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED", Integer.class, 23);
// Checkstyle: resume
--- a/hotspot/src/share/vm/aot/aotCodeHeap.cpp Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/share/vm/aot/aotCodeHeap.cpp Tue Jan 10 18:48:08 2017 +0000
@@ -539,6 +539,7 @@
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_heap_end_address", address, (heap->supports_inline_contig_alloc() ? heap->end_addr() : NULL));
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_polling_page", address, os::get_polling_page());
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_narrow_klass_base_address", address, Universe::narrow_klass_base());
+ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_narrow_oop_base_address", address, Universe::narrow_oop_base());
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_log_of_heap_region_grain_bytes", int, HeapRegion::LogOfHRGrainBytes);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_inline_contiguous_allocation_supported", bool, heap->supports_inline_contig_alloc());
link_shared_runtime_symbols();
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Tue Jan 10 18:48:08 2017 +0000
@@ -1258,6 +1258,7 @@
case HEAP_TOP_ADDRESS:
case HEAP_END_ADDRESS:
case NARROW_KLASS_BASE_ADDRESS:
+ case NARROW_OOP_BASE_ADDRESS:
case CRC_TABLE_ADDRESS:
case LOG_OF_HEAP_REGION_GRAIN_BYTES:
case INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED:
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp Tue Jan 10 18:48:08 2017 +0000
@@ -133,9 +133,10 @@
HEAP_TOP_ADDRESS = 17,
HEAP_END_ADDRESS = 18,
NARROW_KLASS_BASE_ADDRESS = 19,
- CRC_TABLE_ADDRESS = 20,
- LOG_OF_HEAP_REGION_GRAIN_BYTES = 21,
- INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED = 22,
+ NARROW_OOP_BASE_ADDRESS = 20,
+ CRC_TABLE_ADDRESS = 21,
+ LOG_OF_HEAP_REGION_GRAIN_BYTES = 22,
+ INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED = 23,
INVOKE_INVALID = -1
};
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp Tue Jan 10 20:45:04 2017 +0300
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp Tue Jan 10 18:48:08 2017 +0000
@@ -429,6 +429,7 @@
declare_constant(CodeInstaller::HEAP_TOP_ADDRESS) \
declare_constant(CodeInstaller::HEAP_END_ADDRESS) \
declare_constant(CodeInstaller::NARROW_KLASS_BASE_ADDRESS) \
+ declare_constant(CodeInstaller::NARROW_OOP_BASE_ADDRESS) \
declare_constant(CodeInstaller::CRC_TABLE_ADDRESS) \
declare_constant(CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES) \
declare_constant(CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED) \