Skip to content

Commit 2baf251

Browse files
committedSep 14, 2022
8293654: Improve SharedRuntime handling of continuation helper out-arguments
Reviewed-by: dlong, kvn
1 parent 60f59a4 commit 2baf251

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed
 

‎src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

+19-9
Original file line numberDiff line numberDiff line change
@@ -1126,11 +1126,9 @@ static void gen_continuation_yield(MacroAssembler* masm,
11261126
const methodHandle& method,
11271127
const BasicType* sig_bt,
11281128
const VMRegPair* regs,
1129-
int& exception_offset,
11301129
OopMapSet* oop_maps,
11311130
int& frame_complete,
11321131
int& stack_slots,
1133-
int& interpreted_entry_offset,
11341132
int& compiled_entry_offset) {
11351133
enum layout {
11361134
rfp_off1,
@@ -1263,12 +1261,12 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
12631261
VMRegPair* in_regs,
12641262
BasicType ret_type) {
12651263
if (method->is_continuation_native_intrinsic()) {
1266-
int vep_offset = 0;
1267-
int exception_offset = 0;
1268-
int frame_complete = 0;
1269-
int stack_slots = 0;
1270-
OopMapSet* oop_maps = new OopMapSet();
1264+
int exception_offset = -1;
1265+
OopMapSet* oop_maps = new OopMapSet();
1266+
int frame_complete = -1;
1267+
int stack_slots = -1;
12711268
int interpreted_entry_offset = -1;
1269+
int vep_offset = -1;
12721270
if (method->is_continuation_enter_intrinsic()) {
12731271
gen_continuation_enter(masm,
12741272
method,
@@ -1285,15 +1283,27 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
12851283
method,
12861284
in_sig_bt,
12871285
in_regs,
1288-
exception_offset,
12891286
oop_maps,
12901287
frame_complete,
12911288
stack_slots,
1292-
interpreted_entry_offset,
12931289
vep_offset);
12941290
} else {
12951291
guarantee(false, "Unknown Continuation native intrinsic");
12961292
}
1293+
1294+
#ifdef ASSERT
1295+
if (method->is_continuation_enter_intrinsic()) {
1296+
assert(interpreted_entry_offset != -1, "Must be set");
1297+
assert(exception_offset != -1, "Must be set");
1298+
} else {
1299+
assert(interpreted_entry_offset == -1, "Must be unset");
1300+
assert(exception_offset == -1, "Must be unset");
1301+
}
1302+
assert(frame_complete != -1, "Must be set");
1303+
assert(stack_slots != -1, "Must be set");
1304+
assert(vep_offset != -1, "Must be set");
1305+
#endif
1306+
12971307
__ flush();
12981308
nmethod* nm = nmethod::new_native_nmethod(method,
12991309
compile_id,

‎src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp

+18-8
Original file line numberDiff line numberDiff line change
@@ -1447,11 +1447,9 @@ static void gen_continuation_enter(MacroAssembler* masm,
14471447

14481448
static void gen_continuation_yield(MacroAssembler* masm,
14491449
const VMRegPair* regs,
1450-
int& exception_offset,
14511450
OopMapSet* oop_maps,
14521451
int& frame_complete,
14531452
int& stack_slots,
1454-
int& interpreted_entry_offset,
14551453
int& compiled_entry_offset) {
14561454
enum layout {
14571455
rbp_off,
@@ -1585,12 +1583,12 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
15851583
VMRegPair* in_regs,
15861584
BasicType ret_type) {
15871585
if (method->is_continuation_native_intrinsic()) {
1588-
int vep_offset = 0;
1589-
int exception_offset = 0;
1590-
int frame_complete = 0;
1591-
int stack_slots = 0;
1586+
int exception_offset = -1;
15921587
OopMapSet* oop_maps = new OopMapSet();
1588+
int frame_complete = -1;
1589+
int stack_slots = -1;
15931590
int interpreted_entry_offset = -1;
1591+
int vep_offset = -1;
15941592
if (method->is_continuation_enter_intrinsic()) {
15951593
gen_continuation_enter(masm,
15961594
in_regs,
@@ -1603,15 +1601,27 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
16031601
} else if (method->is_continuation_yield_intrinsic()) {
16041602
gen_continuation_yield(masm,
16051603
in_regs,
1606-
exception_offset,
16071604
oop_maps,
16081605
frame_complete,
16091606
stack_slots,
1610-
interpreted_entry_offset,
16111607
vep_offset);
16121608
} else {
16131609
guarantee(false, "Unknown Continuation native intrinsic");
16141610
}
1611+
1612+
#ifdef ASSERT
1613+
if (method->is_continuation_enter_intrinsic()) {
1614+
assert(interpreted_entry_offset != -1, "Must be set");
1615+
assert(exception_offset != -1, "Must be set");
1616+
} else {
1617+
assert(interpreted_entry_offset == -1, "Must be unset");
1618+
assert(exception_offset == -1, "Must be unset");
1619+
}
1620+
assert(frame_complete != -1, "Must be set");
1621+
assert(stack_slots != -1, "Must be set");
1622+
assert(vep_offset != -1, "Must be set");
1623+
#endif
1624+
16151625
__ flush();
16161626
nmethod* nm = nmethod::new_native_nmethod(method,
16171627
compile_id,

0 commit comments

Comments
 (0)
Please sign in to comment.