704 emit_d32(cbuf, framesize);
705 } else if (framesize) {
706 emit_opcode(cbuf, 0x83); // add SP, #framesize
707 emit_rm(cbuf, 0x3, 0x00, ESP_enc);
708 emit_d8(cbuf, framesize);
709 }
710
711 emit_opcode(cbuf, 0x58 | EBP_enc);
712
713 if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
714 __ reserved_stack_check();
715 }
716
717 if (do_polling() && C->is_method_compilation()) {
718 Register thread = as_Register(EBX_enc);
719 MacroAssembler masm(&cbuf);
720 __ get_thread(thread);
721 Label dummy_label;
722 Label* code_stub = &dummy_label;
723 if (!C->output()->in_scratch_emit_size()) {
724 code_stub = &C->output()->safepoint_poll_table()->add_safepoint(__ offset());
725 }
726 __ relocate(relocInfo::poll_return_type);
727 __ safepoint_poll(*code_stub, thread, true /* at_return */, true /* in_nmethod */);
728 }
729 }
730
731 uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
732 return MachNode::size(ra_); // too many variables; just compute it
733 // the hard way
734 }
735
736 int MachEpilogNode::reloc() const {
737 return 0; // a large enough number
738 }
739
740 const Pipeline * MachEpilogNode::pipeline() const {
741 return MachNode::pipeline_class();
742 }
743
744 //=============================================================================
13678 ins_encode();
13679 ins_pipe( empty );
13680 %}
13681
13682
13683 // Rethrow exception:
13684 // The exception oop will come in the first argument position.
13685 // Then JUMP (not call) to the rethrow stub code.
13686 instruct RethrowException()
13687 %{
13688 match(Rethrow);
13689
13690 // use the following format syntax
13691 format %{ "JMP rethrow_stub" %}
13692 ins_encode(enc_rethrow);
13693 ins_pipe( pipe_jmp );
13694 %}
13695
13696 // inlined locking and unlocking
13697
13698 instruct cmpFastLockRTM(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eDXRegI scr, rRegI cx1, rRegI cx2) %{
13699 predicate(Compile::current()->use_rtm());
13700 match(Set cr (FastLock object box));
13701 effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box);
13702 ins_cost(300);
13703 format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
13704 ins_encode %{
13705 __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13706 $scr$$Register, $cx1$$Register, $cx2$$Register,
13707 _counters, _rtm_counters, _stack_rtm_counters,
13708 ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
13709 true, ra_->C->profile_rtm());
13710 %}
13711 ins_pipe(pipe_slow);
13712 %}
13713
13714 instruct cmpFastLock(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eRegP scr) %{
13715 predicate(!Compile::current()->use_rtm());
13716 match(Set cr (FastLock object box));
13717 effect(TEMP tmp, TEMP scr, USE_KILL box);
13718 ins_cost(300);
13719 format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr" %}
13720 ins_encode %{
13721 __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13722 $scr$$Register, noreg, noreg, _counters, NULL, NULL, NULL, false, false);
13723 %}
13724 ins_pipe(pipe_slow);
13725 %}
13726
13727 instruct cmpFastUnlock(eFlagsReg cr, eRegP object, eAXRegP box, eRegP tmp ) %{
13728 match(Set cr (FastUnlock object box));
13729 effect(TEMP tmp, USE_KILL box);
13730 ins_cost(300);
13731 format %{ "FASTUNLOCK $object,$box\t! kills $box,$tmp" %}
13732 ins_encode %{
13733 __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
13734 %}
13735 ins_pipe(pipe_slow);
13736 %}
13737
13738
13739
13740 // ============================================================================
13741 // Safepoint Instruction
13742 instruct safePoint_poll_tls(eFlagsReg cr, eRegP_no_EBP poll) %{
|
704 emit_d32(cbuf, framesize);
705 } else if (framesize) {
706 emit_opcode(cbuf, 0x83); // add SP, #framesize
707 emit_rm(cbuf, 0x3, 0x00, ESP_enc);
708 emit_d8(cbuf, framesize);
709 }
710
711 emit_opcode(cbuf, 0x58 | EBP_enc);
712
713 if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
714 __ reserved_stack_check();
715 }
716
717 if (do_polling() && C->is_method_compilation()) {
718 Register thread = as_Register(EBX_enc);
719 MacroAssembler masm(&cbuf);
720 __ get_thread(thread);
721 Label dummy_label;
722 Label* code_stub = &dummy_label;
723 if (!C->output()->in_scratch_emit_size()) {
724 C2SafepointPollStub* stub = new (C->comp_arena()) C2SafepointPollStub(__ offset());
725 C->output()->add_stub(stub);
726 code_stub = &stub->entry();
727 }
728 __ relocate(relocInfo::poll_return_type);
729 __ safepoint_poll(*code_stub, thread, true /* at_return */, true /* in_nmethod */);
730 }
731 }
732
733 uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
734 return MachNode::size(ra_); // too many variables; just compute it
735 // the hard way
736 }
737
738 int MachEpilogNode::reloc() const {
739 return 0; // a large enough number
740 }
741
742 const Pipeline * MachEpilogNode::pipeline() const {
743 return MachNode::pipeline_class();
744 }
745
746 //=============================================================================
13680 ins_encode();
13681 ins_pipe( empty );
13682 %}
13683
13684
13685 // Rethrow exception:
13686 // The exception oop will come in the first argument position.
13687 // Then JUMP (not call) to the rethrow stub code.
13688 instruct RethrowException()
13689 %{
13690 match(Rethrow);
13691
13692 // use the following format syntax
13693 format %{ "JMP rethrow_stub" %}
13694 ins_encode(enc_rethrow);
13695 ins_pipe( pipe_jmp );
13696 %}
13697
13698 // inlined locking and unlocking
13699
13700 instruct cmpFastLockRTM(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eDXRegI scr, rRegI cx1, rRegI cx2, eRegP thread) %{
13701 predicate(Compile::current()->use_rtm());
13702 match(Set cr (FastLock object box));
13703 effect(TEMP tmp, TEMP scr, TEMP cx1, TEMP cx2, USE_KILL box, TEMP thread);
13704 ins_cost(300);
13705 format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr,$cx1,$cx2" %}
13706 ins_encode %{
13707 __ get_thread($thread$$Register);
13708 __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13709 $scr$$Register, $cx1$$Register, $cx2$$Register, $thread$$Register,
13710 _counters, _rtm_counters, _stack_rtm_counters,
13711 ((Method*)(ra_->C->method()->constant_encoding()))->method_data(),
13712 true, ra_->C->profile_rtm());
13713 %}
13714 ins_pipe(pipe_slow);
13715 %}
13716
13717 instruct cmpFastLock(eFlagsReg cr, eRegP object, eBXRegP box, eAXRegI tmp, eRegP scr, eRegP thread) %{
13718 predicate(!Compile::current()->use_rtm());
13719 match(Set cr (FastLock object box));
13720 effect(TEMP tmp, TEMP scr, USE_KILL box, TEMP thread);
13721 ins_cost(300);
13722 format %{ "FASTLOCK $object,$box\t! kills $box,$tmp,$scr" %}
13723 ins_encode %{
13724 __ get_thread($thread$$Register);
13725 __ fast_lock($object$$Register, $box$$Register, $tmp$$Register,
13726 $scr$$Register, noreg, noreg, $thread$$Register, _counters, NULL, NULL, NULL, false, false);
13727 %}
13728 ins_pipe(pipe_slow);
13729 %}
13730
13731 instruct cmpFastUnlock(eFlagsReg cr, eRegP object, eAXRegP box, eRegP tmp ) %{
13732 match(Set cr (FastUnlock object box));
13733 effect(TEMP tmp, USE_KILL box);
13734 ins_cost(300);
13735 format %{ "FASTUNLOCK $object,$box\t! kills $box,$tmp" %}
13736 ins_encode %{
13737 __ fast_unlock($object$$Register, $box$$Register, $tmp$$Register, ra_->C->use_rtm());
13738 %}
13739 ins_pipe(pipe_slow);
13740 %}
13741
13742
13743
13744 // ============================================================================
13745 // Safepoint Instruction
13746 instruct safePoint_poll_tls(eFlagsReg cr, eRegP_no_EBP poll) %{
|