@@ -4403,10 +4403,15 @@ void MacroAssembler::get_polling_page(Register dest, relocInfo::relocType rtype)
44034403// Read the polling page. The address of the polling page must
44044404// already be in r.
44054405address MacroAssembler::read_polling_page (Register r, relocInfo::relocType rtype) {
4406- InstructionMark im (this );
4407- code_section ()->relocate (inst_mark (), rtype);
4408- ldrw (zr, Address (r, 0 ));
4409- return inst_mark ();
4406+ address mark;
4407+ {
4408+ InstructionMark im (this );
4409+ code_section ()->relocate (inst_mark (), rtype);
4410+ ldrw (zr, Address (r, 0 ));
4411+ mark = inst_mark ();
4412+ }
4413+ verify_cross_modify_fence_not_required ();
4414+ return mark;
44104415}
44114416
44124417void MacroAssembler::adrp (Register reg1, const Address &dest, uint64_t &byte_offset) {
@@ -4471,6 +4476,7 @@ void MacroAssembler::build_frame(int framesize) {
44714476 sub (sp, sp, rscratch1);
44724477 }
44734478 }
4479+ verify_cross_modify_fence_not_required ();
44744480}
44754481
44764482void MacroAssembler::remove_frame (int framesize) {
@@ -5298,3 +5304,29 @@ void MacroAssembler::verify_ptrue() {
52985304 stop (" Error: the preserved predicate register (p7) elements are not all true" );
52995305 bind (verify_ok);
53005306}
5307+
5308+ void MacroAssembler::safepoint_isb () {
5309+ isb ();
5310+ #ifndef PRODUCT
5311+ if (VerifyCrossModifyFence) {
5312+ // Clear the thread state.
5313+ strb (zr, Address (rthread, in_bytes (JavaThread::requires_cross_modify_fence_offset ())));
5314+ }
5315+ #endif
5316+ }
5317+
5318+ #ifndef PRODUCT
5319+ void MacroAssembler::verify_cross_modify_fence_not_required () {
5320+ if (VerifyCrossModifyFence) {
5321+ // Check if thread needs a cross modify fence.
5322+ ldrb (rscratch1, Address (rthread, in_bytes (JavaThread::requires_cross_modify_fence_offset ())));
5323+ Label fence_not_required;
5324+ cbz (rscratch1, fence_not_required);
5325+ // If it does then fail.
5326+ lea (rscratch1, CAST_FROM_FN_PTR (address, JavaThread::verify_cross_modify_fence_failure));
5327+ mov (c_rarg0, rthread);
5328+ blr (rscratch1);
5329+ bind (fence_not_required);
5330+ }
5331+ }
5332+ #endif
0 commit comments