Skip to content

Commit a21302b

Browse files
author
Doug Simon
committed
8351036: [JVMCI] value not an s2: -32776
Reviewed-by: yzheng, dlong
1 parent 0753376 commit a21302b

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ Handle CodeInstaller::read_oop(HotSpotCompiledCodeStream* stream, u1 tag, JVMCI_
388388

389389
ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1 tag, BasicType type, ScopeValue* &second, JVMCI_TRAPS) {
390390
second = nullptr;
391+
bool stack_slot_is_s2 = true;
391392
switch (tag) {
392393
case ILLEGAL: {
393394
if (type != T_ILLEGAL) {
@@ -436,11 +437,17 @@ ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1
436437
return value;
437438
}
438439
}
440+
case STACK_SLOT4_PRIMITIVE:
441+
case STACK_SLOT4_NARROW_OOP:
442+
case STACK_SLOT4_OOP:
443+
case STACK_SLOT4_VECTOR:
444+
stack_slot_is_s2 = false;
445+
// fall through
439446
case STACK_SLOT_PRIMITIVE:
440447
case STACK_SLOT_NARROW_OOP:
441448
case STACK_SLOT_OOP:
442449
case STACK_SLOT_VECTOR: {
443-
jint offset = (jshort) stream->read_s2("offset");
450+
jint offset = stack_slot_is_s2 ? (jshort) stream->read_s2("offset") : stream->read_s4("offset4");
444451
if (stream->read_bool("addRawFrameSize")) {
445452
offset += _total_frame_size;
446453
}
@@ -854,7 +861,7 @@ void CodeInstaller::initialize_fields(HotSpotCompiledCodeStream* stream, u1 code
854861
if (!is_set(code_flags, HCC_HAS_DEOPT_RESCUE_SLOT)) {
855862
_orig_pc_offset = -1;
856863
} else {
857-
_orig_pc_offset = stream->read_s2("offset");
864+
_orig_pc_offset = stream->read_s4("offset");
858865
if (stream->read_bool("addRawFrameSize")) {
859866
_orig_pc_offset += _total_frame_size;
860867
}

src/hotspot/share/jvmci/jvmciCodeInstaller.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ class CodeInstaller : public StackObj {
207207
STACK_SLOT_OOP,
208208
STACK_SLOT_NARROW_OOP,
209209
STACK_SLOT_VECTOR,
210+
STACK_SLOT4_PRIMITIVE,
211+
STACK_SLOT4_OOP,
212+
STACK_SLOT4_NARROW_OOP,
213+
STACK_SLOT4_VECTOR,
210214
VIRTUAL_OBJECT_ID,
211215
VIRTUAL_OBJECT_ID2,
212216
NULL_CONSTANT,

src/hotspot/share/jvmci/vmStructs_jvmci.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,10 @@
585585
declare_constant(CodeInstaller::STACK_SLOT_OOP) \
586586
declare_constant(CodeInstaller::STACK_SLOT_NARROW_OOP) \
587587
declare_constant(CodeInstaller::STACK_SLOT_VECTOR) \
588+
declare_constant(CodeInstaller::STACK_SLOT4_PRIMITIVE) \
589+
declare_constant(CodeInstaller::STACK_SLOT4_OOP) \
590+
declare_constant(CodeInstaller::STACK_SLOT4_NARROW_OOP) \
591+
declare_constant(CodeInstaller::STACK_SLOT4_VECTOR) \
588592
declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID) \
589593
declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID2) \
590594
declare_constant(CodeInstaller::NULL_CONSTANT) \

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_OOP;
6464
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_PRIMITIVE;
6565
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_VECTOR;
66+
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_NARROW_OOP;
67+
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_OOP;
68+
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_PRIMITIVE;
69+
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT4_VECTOR;
6670
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.VIRTUAL_OBJECT_ID;
6771
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.VIRTUAL_OBJECT_ID2;
6872

@@ -178,6 +182,10 @@ enum Tag {
178182
STACK_SLOT_OOP,
179183
STACK_SLOT_NARROW_OOP,
180184
STACK_SLOT_VECTOR,
185+
STACK_SLOT4_PRIMITIVE,
186+
STACK_SLOT4_OOP,
187+
STACK_SLOT4_NARROW_OOP,
188+
STACK_SLOT4_VECTOR,
181189
VIRTUAL_OBJECT_ID,
182190
VIRTUAL_OBJECT_ID2,
183191
NULL_CONSTANT,
@@ -457,8 +465,12 @@ private void writeU2(String name, int value) {
457465
rawWriteU2(name, value);
458466
}
459467

468+
private static boolean isS2(int value) {
469+
return value >= Short.MIN_VALUE && value <= Short.MAX_VALUE;
470+
}
471+
460472
private void writeS2(String name, int value) {
461-
if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
473+
if (!isS2(value)) {
462474
throw error("value not an s2: " + value);
463475
}
464476
rawWriteU2(name, value);
@@ -581,7 +593,8 @@ private String codeDesc() {
581593
writeInt("targetCodeSize", code.targetCodeSize);
582594
writeInt("totalFrameSize", code.totalFrameSize);
583595
if (isSet(flags, HAS_DEOPT_RESCUE_SLOT)) {
584-
writeS2("offset", deoptRescueSlot.getRawOffset());
596+
int offset = deoptRescueSlot.getRawOffset();
597+
writeInt("offset", offset);
585598
writeBoolean("addRawFrameSize", deoptRescueSlot.getRawAddFrameSize());
586599
}
587600
writeInt("dataSectionSize", code.dataSection.length);
@@ -1063,17 +1076,25 @@ private void writeJavaValue(JavaValue value, JavaKind kind) {
10631076
} else if (value instanceof StackSlot) {
10641077
StackSlot slot = (StackSlot) value;
10651078
Tag tag;
1079+
int offset = slot.getRawOffset();
1080+
boolean s2 = isS2(offset);
10661081
if (kind == JavaKind.Object) {
10671082
if (isVector(slot)) {
1068-
tag = STACK_SLOT_VECTOR;
1083+
tag = s2 ? STACK_SLOT_VECTOR : STACK_SLOT4_VECTOR;
1084+
} else if (isNarrowOop(slot)) {
1085+
tag = s2 ? STACK_SLOT_NARROW_OOP : STACK_SLOT4_NARROW_OOP;
10691086
} else {
1070-
tag = isNarrowOop(slot) ? STACK_SLOT_NARROW_OOP : STACK_SLOT_OOP;
1087+
tag = s2 ? STACK_SLOT_OOP : STACK_SLOT4_OOP;
10711088
}
10721089
} else {
1073-
tag = STACK_SLOT_PRIMITIVE;
1090+
tag = s2 ? STACK_SLOT_PRIMITIVE : STACK_SLOT4_PRIMITIVE;
10741091
}
10751092
writeTag(tag);
1076-
writeS2("offset", slot.getRawOffset());
1093+
if (s2) {
1094+
writeS2("offset", slot.getRawOffset());
1095+
} else {
1096+
writeInt("offset4", slot.getRawOffset());
1097+
}
10771098
writeBoolean("addRawFrameSize", slot.getRawAddFrameSize());
10781099
} else if (value instanceof VirtualObject) {
10791100
VirtualObject vo = (VirtualObject) value;

0 commit comments

Comments
 (0)