@@ -653,8 +653,9 @@ void MachEpilogNode::format( PhaseRegAlloc *ra_, outputStream* st ) const {
653
653
}
654
654
st->print_cr("POPL EBP"); st->print("\t");
655
655
if (do_polling() && C->is_method_compilation()) {
656
- st->print("TEST PollPage,EAX\t! Poll Safepoint");
657
- st->cr(); st->print("\t");
656
+ st->print("CMPL rsp, poll_offset[thread] \n\t"
657
+ "JA #safepoint_stub\t"
658
+ "# Safepoint: poll for GC");
658
659
}
659
660
}
660
661
#endif
@@ -697,12 +698,16 @@ void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
697
698
}
698
699
699
700
if (do_polling() && C->is_method_compilation()) {
700
- Register pollReg = as_Register(EBX_enc);
701
+ Register thread = as_Register(EBX_enc);
701
702
MacroAssembler masm(&cbuf);
702
- masm.get_thread(pollReg);
703
- masm.movl(pollReg, Address(pollReg, in_bytes(Thread::polling_page_offset())));
704
- masm.relocate(relocInfo::poll_return_type);
705
- masm.testl(rax, Address(pollReg, 0));
703
+ __ get_thread(thread);
704
+ Label dummy_label;
705
+ Label* code_stub = &dummy_label;
706
+ if (!C->output()->in_scratch_emit_size()) {
707
+ code_stub = &C->output()->safepoint_poll_table()->add_safepoint(__ offset());
708
+ }
709
+ __ relocate(relocInfo::poll_return_type);
710
+ __ safepoint_poll(*code_stub, thread, true /* at_return */, true /* in_nmethod */);
706
711
}
707
712
}
708
713
0 commit comments