< prev index next >

src/hotspot/cpu/x86/x86_32.ad

Print this page
rev 48494 : 8195112: x86 (32 bit): implementation for Thread-local handshakes
Reviewed-by:

*** 315,325 **** } // Indicate if the safepoint node needs the polling page as an input. // Since x86 does have absolute addressing, it doesn't. bool SafePointNode::needs_polling_address_input() { ! return false; } // // Compute padding required for nodes which need alignment // --- 315,325 ---- } // Indicate if the safepoint node needs the polling page as an input. // Since x86 does have absolute addressing, it doesn't. bool SafePointNode::needs_polling_address_input() { ! return SafepointMechanism::uses_thread_local_poll(); } // // Compute padding required for nodes which need alignment //
*** 704,741 **** if (StackReservedPages > 0 && C->has_reserved_stack_access()) { __ reserved_stack_check(); } if (do_polling() && C->is_method_compilation()) { cbuf.relocate(cbuf.insts_end(), relocInfo::poll_return_type, 0); emit_opcode(cbuf,0x85); emit_rm(cbuf, 0x0, EAX_enc, 0x5); // EAX emit_d32(cbuf, (intptr_t)os::get_polling_page()); } } uint MachEpilogNode::size(PhaseRegAlloc *ra_) const { ! Compile *C = ra_->C; ! // If method set FPU control word, restore to standard control word ! int size = C->in_24_bit_fp_mode() ? 6 : 0; ! if (C->max_vector_size() > 16) size += 3; // vzeroupper ! if (do_polling() && C->is_method_compilation()) size += 6; ! ! int framesize = C->frame_size_in_bytes(); ! assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); ! // Remove two words for return addr and rbp, ! framesize -= 2*wordSize; ! ! size++; // popl rbp, ! ! if (framesize >= 128) { ! size += 6; ! } else { ! size += framesize ? 3 : 0; ! } ! size += 64; // added to support ReservedStackAccess ! return size; } int MachEpilogNode::reloc() const { return 0; // a large enough number } --- 704,732 ---- if (StackReservedPages > 0 && C->has_reserved_stack_access()) { __ reserved_stack_check(); } if (do_polling() && C->is_method_compilation()) { + if (SafepointMechanism::uses_thread_local_poll()) { + Register pollReg = as_Register(EBX_enc); + MacroAssembler masm(&cbuf); + masm.get_thread(pollReg); + masm.movl(pollReg, Address(pollReg, in_bytes(Thread::polling_page_offset()))); + masm.relocate(relocInfo::poll_return_type); + masm.testl(rax, Address(pollReg, 0)); + } else { cbuf.relocate(cbuf.insts_end(), relocInfo::poll_return_type, 0); emit_opcode(cbuf,0x85); emit_rm(cbuf, 0x0, EAX_enc, 0x5); // EAX emit_d32(cbuf, (intptr_t)os::get_polling_page()); } + } } uint MachEpilogNode::size(PhaseRegAlloc *ra_) const { ! return MachNode::size(ra_); // too many variables; just compute it ! // the hard way } int MachEpilogNode::reloc() const { return 0; // a large enough number }
*** 13334,13343 **** --- 13325,13335 ---- // ============================================================================ // Safepoint Instruction instruct safePoint_poll(eFlagsReg cr) %{ + predicate(SafepointMechanism::uses_global_page_poll()); match(SafePoint); effect(KILL cr); // TODO-FIXME: we currently poll at offset 0 of the safepoint polling page. // On SPARC that might be acceptable as we can generate the address with
*** 13352,13361 **** --- 13344,13372 ---- size(6) ; ins_encode( Safepoint_Poll() ); ins_pipe( ialu_reg_mem ); %} + instruct safePoint_poll_tls(eFlagsReg cr, eRegP_no_EBP poll) %{ + predicate(SafepointMechanism::uses_thread_local_poll()); + match(SafePoint poll); + effect(KILL cr, USE poll); + + format %{ "TSTL #EAX,[$poll]\t! Safepoint: poll for GC" %} + ins_cost(125); + // EBP would need size(3) + size(2); /* setting an explicit size will cause debug builds to assert if size is incorrect */ + ins_encode %{ + __ relocate(relocInfo::poll_type); + address pre_pc = __ pc(); + __ testl(rax, Address($poll$$Register, 0)); + address post_pc = __ pc(); + guarantee(pre_pc[0] == 0x85, "must emit test-ax [reg]"); + %} + ins_pipe(ialu_reg_mem); + %} + // ============================================================================ // This name is KNOWN by the ADLC and cannot be changed. // The ADLC forces a 'TypeRawPtr::BOTTOM' output type // for this guy.
< prev index next >