@@ -1381,7 +1381,6 @@ void MacroAssembler::call_VM_leaf_base(address entry_point,
13811381 bind (*retaddr);
13821382
13831383 ldp (rscratch1, rmethod, Address (post (sp, 2 * wordSize)));
1384- maybe_isb ();
13851384}
13861385
13871386void MacroAssembler::call_VM_leaf (address entry_point, int number_of_arguments) {
@@ -4387,10 +4386,15 @@ void MacroAssembler::get_polling_page(Register dest, relocInfo::relocType rtype)
43874386// Read the polling page. The address of the polling page must
43884387// already be in r.
43894388address MacroAssembler::read_polling_page (Register r, relocInfo::relocType rtype) {
4390- InstructionMark im (this );
4391- code_section ()->relocate (inst_mark (), rtype);
4392- ldrw (zr, Address (r, 0 ));
4393- return inst_mark ();
4389+ address mark;
4390+ {
4391+ InstructionMark im (this );
4392+ code_section ()->relocate (inst_mark (), rtype);
4393+ ldrw (zr, Address (r, 0 ));
4394+ mark = inst_mark ();
4395+ }
4396+ verify_cross_modify_fence_not_required ();
4397+ return mark;
43944398}
43954399
43964400void MacroAssembler::adrp (Register reg1, const Address &dest, uint64_t &byte_offset) {
@@ -4455,6 +4459,7 @@ void MacroAssembler::build_frame(int framesize) {
44554459 sub (sp, sp, rscratch1);
44564460 }
44574461 }
4462+ verify_cross_modify_fence_not_required ();
44584463}
44594464
44604465void MacroAssembler::remove_frame (int framesize) {
@@ -5315,3 +5320,29 @@ void MacroAssembler::verify_ptrue() {
53155320 stop (" Error: the preserved predicate register (p7) elements are not all true" );
53165321 bind (verify_ok);
53175322}
5323+
5324+ void MacroAssembler::safepoint_isb () {
5325+ isb ();
5326+ #ifndef PRODUCT
5327+ if (VerifyCrossModifyFence) {
5328+ // Clear the thread state.
5329+ strb (zr, Address (rthread, in_bytes (JavaThread::requires_cross_modify_fence_offset ())));
5330+ }
5331+ #endif
5332+ }
5333+
5334+ #ifndef PRODUCT
5335+ void MacroAssembler::verify_cross_modify_fence_not_required () {
5336+ if (VerifyCrossModifyFence) {
5337+ // Check if thread needs a cross modify fence.
5338+ ldrb (rscratch1, Address (rthread, in_bytes (JavaThread::requires_cross_modify_fence_offset ())));
5339+ Label fence_not_required;
5340+ cbz (rscratch1, fence_not_required);
5341+ // If it does then fail.
5342+ lea (rscratch1, CAST_FROM_FN_PTR (address, JavaThread::verify_cross_modify_fence_failure));
5343+ mov (c_rarg0, rthread);
5344+ blr (rscratch1);
5345+ bind (fence_not_required);
5346+ }
5347+ }
5348+ #endif
0 commit comments