diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp index 1732719d64c07..79aaacec8098b 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp @@ -388,6 +388,7 @@ Handle CodeInstaller::read_oop(HotSpotCompiledCodeStream* stream, u1 tag, JVMCI_ ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1 tag, BasicType type, ScopeValue* &second, JVMCI_TRAPS) { second = nullptr; + bool stack_slot_is_s2 = true; switch (tag) { case ILLEGAL: { if (type != T_ILLEGAL) { @@ -436,11 +437,17 @@ ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1 return value; } } + case STACK_SLOT4_PRIMITIVE: + case STACK_SLOT4_NARROW_OOP: + case STACK_SLOT4_OOP: + case STACK_SLOT4_VECTOR: + stack_slot_is_s2 = false; + // fall through case STACK_SLOT_PRIMITIVE: case STACK_SLOT_NARROW_OOP: case STACK_SLOT_OOP: case STACK_SLOT_VECTOR: { - jint offset = (jshort) stream->read_s2("offset"); + jint offset = stack_slot_is_s2 ? (jshort) stream->read_s2("offset") : stream->read_s4("offset4"); if (stream->read_bool("addRawFrameSize")) { offset += _total_frame_size; } @@ -854,7 +861,7 @@ void CodeInstaller::initialize_fields(HotSpotCompiledCodeStream* stream, u1 code if (!is_set(code_flags, HCC_HAS_DEOPT_RESCUE_SLOT)) { _orig_pc_offset = -1; } else { - _orig_pc_offset = stream->read_s2("offset"); + _orig_pc_offset = stream->read_s4("offset"); if (stream->read_bool("addRawFrameSize")) { _orig_pc_offset += _total_frame_size; } diff --git a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp index b493c48e3486a..a8279e99dc2ee 100644 --- a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp +++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp @@ -207,6 +207,10 @@ class CodeInstaller : public StackObj { STACK_SLOT_OOP, STACK_SLOT_NARROW_OOP, STACK_SLOT_VECTOR, + STACK_SLOT4_PRIMITIVE, + STACK_SLOT4_OOP, + STACK_SLOT4_NARROW_OOP, + STACK_SLOT4_VECTOR, VIRTUAL_OBJECT_ID, VIRTUAL_OBJECT_ID2, NULL_CONSTANT, diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp index 8c964b5693169..aa1c65dccb029 100644 --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -579,6 +579,10 @@ declare_constant(CodeInstaller::STACK_SLOT_OOP) \ declare_constant(CodeInstaller::STACK_SLOT_NARROW_OOP) \ declare_constant(CodeInstaller::STACK_SLOT_VECTOR) \ + declare_constant(CodeInstaller::STACK_SLOT4_PRIMITIVE) \ + declare_constant(CodeInstaller::STACK_SLOT4_OOP) \ + declare_constant(CodeInstaller::STACK_SLOT4_NARROW_OOP) \ + declare_constant(CodeInstaller::STACK_SLOT4_VECTOR) \ declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID) \ declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID2) \ declare_constant(CodeInstaller::NULL_CONSTANT) \ diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java index 49dfdcea5a219..2cd5e839ee80e 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java @@ -63,6 +63,10 @@ import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_OOP; import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_PRIMITIVE; import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_VECTOR; +import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_NARROW_OOP; +import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_OOP; +import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_PRIMITIVE; +import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_VECTOR; import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.VIRTUAL_OBJECT_ID; import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.VIRTUAL_OBJECT_ID2; @@ -178,6 +182,10 @@ enum Tag { STACK_SLOT_OOP, STACK_SLOT_NARROW_OOP, STACK_SLOT_VECTOR, + STACK_SLOT4_PRIMITIVE, + STACK_SLOT4_OOP, + STACK_SLOT4_NARROW_OOP, + STACK_SLOT4_VECTOR, VIRTUAL_OBJECT_ID, VIRTUAL_OBJECT_ID2, NULL_CONSTANT, @@ -457,8 +465,12 @@ private void writeU2(String name, int value) { rawWriteU2(name, value); } + private static boolean isS2(int value) { + return value >= Short.MIN_VALUE && value <= Short.MAX_VALUE; + } + private void writeS2(String name, int value) { - if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { + if (!isS2(value)) { throw error("value not an s2: " + value); } rawWriteU2(name, value); @@ -581,7 +593,8 @@ private String codeDesc() { writeInt("targetCodeSize", code.targetCodeSize); writeInt("totalFrameSize", code.totalFrameSize); if (isSet(flags, HAS_DEOPT_RESCUE_SLOT)) { - writeS2("offset", deoptRescueSlot.getRawOffset()); + int offset = deoptRescueSlot.getRawOffset(); + writeInt("offset", offset); writeBoolean("addRawFrameSize", deoptRescueSlot.getRawAddFrameSize()); } writeInt("dataSectionSize", code.dataSection.length); @@ -1063,17 +1076,25 @@ private void writeJavaValue(JavaValue value, JavaKind kind) { } else if (value instanceof StackSlot) { StackSlot slot = (StackSlot) value; Tag tag; + int offset = slot.getRawOffset(); + boolean s2 = isS2(offset); if (kind == JavaKind.Object) { if (isVector(slot)) { - tag = STACK_SLOT_VECTOR; + tag = s2 ? STACK_SLOT_VECTOR : STACK_SLOT4_VECTOR; + } else if (isNarrowOop(slot)) { + tag = s2 ? STACK_SLOT_NARROW_OOP : STACK_SLOT4_NARROW_OOP; } else { - tag = isNarrowOop(slot) ? STACK_SLOT_NARROW_OOP : STACK_SLOT_OOP; + tag = s2 ? STACK_SLOT_OOP : STACK_SLOT4_OOP; } } else { - tag = STACK_SLOT_PRIMITIVE; + tag = s2 ? STACK_SLOT_PRIMITIVE : STACK_SLOT4_PRIMITIVE; } writeTag(tag); - writeS2("offset", slot.getRawOffset()); + if (s2) { + writeS2("offset", slot.getRawOffset()); + } else { + writeInt("offset4", slot.getRawOffset()); + } writeBoolean("addRawFrameSize", slot.getRawAddFrameSize()); } else if (value instanceof VirtualObject) { VirtualObject vo = (VirtualObject) value;