Skip to content

Commit 5146ebc

Browse files
authored
Update (2022.11.19)
28685: LA port of 8293939: Move continuation_enter_setup and friends 28677: Use correct register in fast_unlock()
1 parent 5513c29 commit 5146ebc

File tree

3 files changed

+68
-82
lines changed

3 files changed

+68
-82
lines changed

src/hotspot/cpu/loongarch/c2_MacroAssembler_loongarch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void C2_MacroAssembler::fast_unlock(Register oop, Register box, Register flag,
152152

153153
// Handle existing monitor.
154154
ld_d(tmp, oop, oopDesc::mark_offset_in_bytes());
155-
andi(AT, disp_hdr, markWord::monitor_value);
155+
andi(AT, tmp, markWord::monitor_value);
156156
bnez(AT, object_has_monitor);
157157

158158
if (!UseHeavyMonitors) {

src/hotspot/cpu/loongarch/sharedRuntime_loongarch_64.cpp

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,10 +1056,73 @@ static void verify_oop_args(MacroAssembler* masm,
10561056
}
10571057
}
10581058

1059-
// defined in stubGenerator_loongarch.cpp
1060-
OopMap* continuation_enter_setup(MacroAssembler* masm, int& stack_slots);
1061-
void fill_continuation_entry(MacroAssembler* masm);
1062-
void continuation_enter_cleanup(MacroAssembler* masm);
1059+
// on exit, sp points to the ContinuationEntry
1060+
OopMap* continuation_enter_setup(MacroAssembler* masm, int& stack_slots) {
1061+
assert(ContinuationEntry::size() % VMRegImpl::stack_slot_size == 0, "");
1062+
assert(in_bytes(ContinuationEntry::cont_offset()) % VMRegImpl::stack_slot_size == 0, "");
1063+
assert(in_bytes(ContinuationEntry::chunk_offset()) % VMRegImpl::stack_slot_size == 0, "");
1064+
1065+
stack_slots += checked_cast<int>(ContinuationEntry::size()) / wordSize;
1066+
__ li(AT, checked_cast<int>(ContinuationEntry::size()));
1067+
__ sub_d(SP, SP, AT);
1068+
1069+
OopMap* map = new OopMap(((int)ContinuationEntry::size() + wordSize) / VMRegImpl::stack_slot_size, 0 /* arg_slots*/);
1070+
ContinuationEntry::setup_oopmap(map);
1071+
1072+
__ ld_d(AT, Address(TREG, JavaThread::cont_entry_offset()));
1073+
__ st_d(AT, Address(SP, ContinuationEntry::parent_offset()));
1074+
__ st_d(SP, Address(TREG, JavaThread::cont_entry_offset()));
1075+
1076+
return map;
1077+
}
1078+
1079+
// on entry j_rarg0 points to the continuation
1080+
// SP points to ContinuationEntry
1081+
// j_rarg2 -- isVirtualThread
1082+
void fill_continuation_entry(MacroAssembler* masm) {
1083+
#ifdef ASSERT
1084+
__ li(AT, ContinuationEntry::cookie_value());
1085+
__ st_w(AT, Address(SP, ContinuationEntry::cookie_offset()));
1086+
#endif
1087+
1088+
__ st_d(j_rarg0, Address(SP, ContinuationEntry::cont_offset()));
1089+
__ st_w(j_rarg2, Address(SP, ContinuationEntry::flags_offset()));
1090+
__ st_d(R0, Address(SP, ContinuationEntry::chunk_offset()));
1091+
__ st_w(R0, Address(SP, ContinuationEntry::argsize_offset()));
1092+
__ st_w(R0, Address(SP, ContinuationEntry::pin_count_offset()));
1093+
1094+
__ ld_d(AT, Address(TREG, JavaThread::cont_fastpath_offset()));
1095+
__ st_d(AT, Address(SP, ContinuationEntry::parent_cont_fastpath_offset()));
1096+
__ ld_d(AT, Address(TREG, JavaThread::held_monitor_count_offset()));
1097+
__ st_d(AT, Address(SP, ContinuationEntry::parent_held_monitor_count_offset()));
1098+
1099+
__ st_d(R0, Address(TREG, JavaThread::cont_fastpath_offset()));
1100+
__ st_d(R0, Address(TREG, JavaThread::held_monitor_count_offset()));
1101+
}
1102+
1103+
// on entry, sp points to the ContinuationEntry
1104+
// on exit, fp points to the spilled fp + 2 * wordSize in the entry frame
1105+
void continuation_enter_cleanup(MacroAssembler* masm) {
1106+
#ifndef PRODUCT
1107+
Label OK;
1108+
__ ld_d(AT, Address(TREG, JavaThread::cont_entry_offset()));
1109+
__ beq(SP, AT, OK);
1110+
__ stop("incorrect sp for cleanup");
1111+
__ bind(OK);
1112+
#endif
1113+
1114+
__ ld_d(AT, Address(SP, ContinuationEntry::parent_cont_fastpath_offset()));
1115+
__ st_d(AT, Address(TREG, JavaThread::cont_fastpath_offset()));
1116+
__ ld_d(AT, Address(SP, ContinuationEntry::parent_held_monitor_count_offset()));
1117+
__ st_d(AT, Address(TREG, JavaThread::held_monitor_count_offset()));
1118+
1119+
__ ld_d(AT, Address(SP, ContinuationEntry::parent_offset()));
1120+
__ st_d(AT, Address(TREG, JavaThread::cont_entry_offset()));
1121+
1122+
// add 2 extra words to match up with leave()
1123+
__ li(AT, (int)ContinuationEntry::size() + 2 * wordSize);
1124+
__ add_d(FP, SP, AT);
1125+
}
10631126

10641127
// enterSpecial(Continuation c, boolean isContinue, boolean isVirtualThread)
10651128
// On entry: j_rarg0 (T0) -- the continuation object

src/hotspot/cpu/loongarch/stubGenerator_loongarch_64.cpp

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@
6969
//#define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
7070
const int MXCSR_MASK = 0xFFC0; // Mask out any pending exceptions
7171

72-
OopMap* continuation_enter_setup(MacroAssembler* masm, int& stack_slots);
73-
void fill_continuation_entry(MacroAssembler* masm);
74-
void continuation_enter_cleanup(MacroAssembler* masm);
75-
7672
// Stub Code definitions
7773

7874
class StubGenerator: public StubCodeGenerator {
@@ -5585,76 +5581,3 @@ void StubGenerator_generate(CodeBuffer* code, int phase) {
55855581
}
55865582
StubGenerator g(code, phase);
55875583
}
5588-
5589-
#undef __
5590-
#define __ masm->
5591-
5592-
// on exit, sp points to the ContinuationEntry
5593-
OopMap* continuation_enter_setup(MacroAssembler* masm, int& stack_slots) {
5594-
assert(ContinuationEntry::size() % VMRegImpl::stack_slot_size == 0, "");
5595-
assert(in_bytes(ContinuationEntry::cont_offset()) % VMRegImpl::stack_slot_size == 0, "");
5596-
assert(in_bytes(ContinuationEntry::chunk_offset()) % VMRegImpl::stack_slot_size == 0, "");
5597-
5598-
stack_slots += checked_cast<int>(ContinuationEntry::size()) / wordSize;
5599-
__ li(AT, checked_cast<int>(ContinuationEntry::size()));
5600-
__ sub_d(SP, SP, AT);
5601-
5602-
OopMap* map = new OopMap(((int)ContinuationEntry::size() + wordSize) / VMRegImpl::stack_slot_size, 0 /* arg_slots*/);
5603-
ContinuationEntry::setup_oopmap(map);
5604-
5605-
__ ld_d(AT, Address(TREG, JavaThread::cont_entry_offset()));
5606-
__ st_d(AT, Address(SP, ContinuationEntry::parent_offset()));
5607-
__ st_d(SP, Address(TREG, JavaThread::cont_entry_offset()));
5608-
5609-
return map;
5610-
}
5611-
5612-
// on entry j_rarg0 points to the continuation
5613-
// SP points to ContinuationEntry
5614-
// j_rarg2 -- isVirtualThread
5615-
void fill_continuation_entry(MacroAssembler* masm) {
5616-
#ifdef ASSERT
5617-
__ li(AT, ContinuationEntry::cookie_value());
5618-
__ st_w(AT, Address(SP, ContinuationEntry::cookie_offset()));
5619-
#endif
5620-
5621-
__ st_d(j_rarg0, Address(SP, ContinuationEntry::cont_offset()));
5622-
__ st_w(j_rarg2, Address(SP, ContinuationEntry::flags_offset()));
5623-
__ st_d(R0, Address(SP, ContinuationEntry::chunk_offset()));
5624-
__ st_w(R0, Address(SP, ContinuationEntry::argsize_offset()));
5625-
__ st_w(R0, Address(SP, ContinuationEntry::pin_count_offset()));
5626-
5627-
__ ld_d(AT, Address(TREG, JavaThread::cont_fastpath_offset()));
5628-
__ st_d(AT, Address(SP, ContinuationEntry::parent_cont_fastpath_offset()));
5629-
__ ld_d(AT, Address(TREG, JavaThread::held_monitor_count_offset()));
5630-
__ st_d(AT, Address(SP, ContinuationEntry::parent_held_monitor_count_offset()));
5631-
5632-
__ st_d(R0, Address(TREG, JavaThread::cont_fastpath_offset()));
5633-
__ st_d(R0, Address(TREG, JavaThread::held_monitor_count_offset()));
5634-
}
5635-
5636-
// on entry, sp points to the ContinuationEntry
5637-
// on exit, fp points to the spilled fp + 2 * wordSize in the entry frame
5638-
void continuation_enter_cleanup(MacroAssembler* masm) {
5639-
#ifndef PRODUCT
5640-
Label OK;
5641-
__ ld_d(AT, Address(TREG, JavaThread::cont_entry_offset()));
5642-
__ beq(SP, AT, OK);
5643-
__ stop("incorrect sp for cleanup");
5644-
__ bind(OK);
5645-
#endif
5646-
5647-
__ ld_d(AT, Address(SP, ContinuationEntry::parent_cont_fastpath_offset()));
5648-
__ st_d(AT, Address(TREG, JavaThread::cont_fastpath_offset()));
5649-
__ ld_d(AT, Address(SP, ContinuationEntry::parent_held_monitor_count_offset()));
5650-
__ st_d(AT, Address(TREG, JavaThread::held_monitor_count_offset()));
5651-
5652-
__ ld_d(AT, Address(SP, ContinuationEntry::parent_offset()));
5653-
__ st_d(AT, Address(TREG, JavaThread::cont_entry_offset()));
5654-
5655-
// add 2 extra words to match up with leave()
5656-
__ li(AT, (int)ContinuationEntry::size() + 2 * wordSize);
5657-
__ add_d(FP, SP, AT);
5658-
}
5659-
5660-
#undef __

0 commit comments

Comments
 (0)