--- old/src/hotspot/cpu/sparc/sparc.ad 2017-10-11 15:25:15.502467921 +0200 +++ new/src/hotspot/cpu/sparc/sparc.ad 2017-10-11 15:25:15.262457616 +0200 @@ -1206,7 +1206,11 @@ Compile* C = ra_->C; if(do_polling() && ra_->C->is_method_compilation()) { - st->print("SETHI #PollAddr,L0\t! Load Polling address\n\t"); + if (SafepointMechanism::uses_global_page_poll()) { + st->print("SETHI #PollAddr,L0\t! Load Polling address\n\t"); + } else { + st->print("LDX [R_G2 + #poll_offset],L0\t! Load local polling address\n\t"); + } st->print("LDX [L0],G0\t!Poll for Safepointing\n\t"); } @@ -1233,8 +1237,12 @@ // If this does safepoint polling, then do it here if(do_polling() && ra_->C->is_method_compilation()) { - AddressLiteral polling_page(os::get_polling_page()); - __ sethi(polling_page, L0); + if (SafepointMechanism::uses_thread_local_poll()) { + __ ld_ptr(Address(G2_thread, Thread::polling_page_offset()), L0); + } else { + AddressLiteral polling_page(os::get_polling_page()); + __ sethi(polling_page, L0); + } __ relocate(relocInfo::poll_return_type); __ ld_ptr(L0, 0, G0); } @@ -1266,6 +1274,7 @@ } int MachEpilogNode::safepoint_offset() const { + assert(SafepointMechanism::uses_global_page_poll(), "sanity"); assert( do_polling(), "no return for this epilog node"); return MacroAssembler::insts_for_sethi(os::get_polling_page()) * BytesPerInstWord; }