11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef CPU_PPC_MACROASSEMBLER_PPC_HPP
27 #define CPU_PPC_MACROASSEMBLER_PPC_HPP
28
29 #include "asm/assembler.hpp"
30 #include "oops/accessDecorators.hpp"
31 #include "runtime/rtmLocking.hpp"
32 #include "utilities/macros.hpp"
33
34 // MacroAssembler extends Assembler by a few frequently used macros.
35
36 class ciTypeArray;
37 class OopMap;
38
39 class MacroAssembler: public Assembler {
40 public:
41 MacroAssembler(CodeBuffer* code) : Assembler(code) {}
42
43 // Indicates whether and, if so, which registers must be preserved when calling runtime code.
44 enum PreservationLevel {
45 PRESERVATION_NONE,
46 PRESERVATION_FRAME_LR,
47 PRESERVATION_FRAME_LR_GP_REGS,
48 PRESERVATION_FRAME_LR_GP_FP_REGS
49 };
50
51 //
590 // Falls through on failure.
591 void check_klass_subtype(Register sub_klass,
592 Register super_klass,
593 Register temp1_reg,
594 Register temp2_reg,
595 Label& L_success);
596
597 void clinit_barrier(Register klass,
598 Register thread,
599 Label* L_fast_path = nullptr,
600 Label* L_slow_path = nullptr);
601
602 // Method handle support (JSR 292).
603 RegisterOrConstant argument_offset(RegisterOrConstant arg_slot, Register temp_reg, int extra_slot_offset = 0);
604
605 void push_cont_fastpath();
606 void pop_cont_fastpath();
607 void inc_held_monitor_count(Register tmp);
608 void dec_held_monitor_count(Register tmp);
609 void atomically_flip_locked_state(bool is_unlock, Register obj, Register tmp, Label& failed, int semantics);
610 void lightweight_lock(Register obj, Register hdr, Register t1, Label& slow);
611 void lightweight_unlock(Register obj, Register hdr, Label& slow);
612
613 // allocation (for C1)
614 void tlab_allocate(
615 Register obj, // result: pointer to object after successful allocation
616 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise
617 int con_size_in_bytes, // object size in bytes if known at compile time
618 Register t1, // temp register
619 Label& slow_case // continuation point if fast allocation fails
620 );
621 void incr_allocated_bytes(RegisterOrConstant size_in_bytes, Register t1, Register t2);
622
623 enum { trampoline_stub_size = 6 * 4 };
624 address emit_trampoline_stub(int destination_toc_offset, int insts_call_instruction_offset, Register Rtoc = noreg);
625
626 void atomic_inc_ptr(Register addr, Register result, int simm16 = 1);
627 void atomic_ori_int(Register addr, Register result, int uimm16);
628
629 #if INCLUDE_RTM_OPT
630 void rtm_counters_update(Register abort_status, Register rtm_counters);
631 void branch_on_random_using_tb(Register tmp, int count, Label& brLabel);
632 void rtm_abort_ratio_calculation(Register rtm_counters_reg, RTMLockingCounters* rtm_counters,
633 Metadata* method_data);
634 void rtm_profiling(Register abort_status_Reg, Register temp_Reg,
635 RTMLockingCounters* rtm_counters, Metadata* method_data, bool profile_rtm);
636 void rtm_retry_lock_on_abort(Register retry_count, Register abort_status,
637 Label& retryLabel, Label* checkRetry = nullptr);
638 void rtm_retry_lock_on_busy(Register retry_count, Register owner_addr, Label& retryLabel);
639 void rtm_stack_locking(ConditionRegister flag, Register obj, Register mark_word, Register tmp,
640 Register retry_on_abort_count,
641 RTMLockingCounters* stack_rtm_counters,
642 Metadata* method_data, bool profile_rtm,
643 Label& DONE_LABEL, Label& IsInflated);
644 void rtm_inflated_locking(ConditionRegister flag, Register obj, Register mark_word, Register box,
645 Register retry_on_busy_count, Register retry_on_abort_count,
646 RTMLockingCounters* rtm_counters,
647 Metadata* method_data, bool profile_rtm,
648 Label& DONE_LABEL);
649 #endif
650
651 void compiler_fast_lock_object(ConditionRegister flag, Register oop, Register box,
652 Register tmp1, Register tmp2, Register tmp3,
653 RTMLockingCounters* rtm_counters = nullptr,
654 RTMLockingCounters* stack_rtm_counters = nullptr,
655 Metadata* method_data = nullptr,
656 bool use_rtm = false, bool profile_rtm = false);
657
658 void compiler_fast_unlock_object(ConditionRegister flag, Register oop, Register box,
659 Register tmp1, Register tmp2, Register tmp3,
660 bool use_rtm = false);
661
662 // Check if safepoint requested and if so branch
663 void safepoint_poll(Label& slow_path, Register temp, bool at_return, bool in_nmethod);
664
665 void resolve_jobject(Register value, Register tmp1, Register tmp2,
666 MacroAssembler::PreservationLevel preservation_level);
667 void resolve_global_jobject(Register value, Register tmp1, Register tmp2,
668 MacroAssembler::PreservationLevel preservation_level);
669
670 // Support for managing the JavaThread pointer (i.e.; the reference to
671 // thread-local information).
672
673 // Support for last Java frame (but use call_VM instead where possible):
674 // access R16_thread->last_Java_sp.
675 void set_last_Java_frame(Register last_java_sp, Register last_Java_pc);
676 void reset_last_Java_frame(void);
677 void set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1);
678
679 // Read vm result from thread: oop_result = R16_thread->result;
680 void get_vm_result (Register oop_result);
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef CPU_PPC_MACROASSEMBLER_PPC_HPP
27 #define CPU_PPC_MACROASSEMBLER_PPC_HPP
28
29 #include "asm/assembler.hpp"
30 #include "oops/accessDecorators.hpp"
31 #include "utilities/macros.hpp"
32
33 // MacroAssembler extends Assembler by a few frequently used macros.
34
35 class ciTypeArray;
36 class OopMap;
37
38 class MacroAssembler: public Assembler {
39 public:
40 MacroAssembler(CodeBuffer* code) : Assembler(code) {}
41
42 // Indicates whether and, if so, which registers must be preserved when calling runtime code.
43 enum PreservationLevel {
44 PRESERVATION_NONE,
45 PRESERVATION_FRAME_LR,
46 PRESERVATION_FRAME_LR_GP_REGS,
47 PRESERVATION_FRAME_LR_GP_FP_REGS
48 };
49
50 //
589 // Falls through on failure.
590 void check_klass_subtype(Register sub_klass,
591 Register super_klass,
592 Register temp1_reg,
593 Register temp2_reg,
594 Label& L_success);
595
596 void clinit_barrier(Register klass,
597 Register thread,
598 Label* L_fast_path = nullptr,
599 Label* L_slow_path = nullptr);
600
601 // Method handle support (JSR 292).
602 RegisterOrConstant argument_offset(RegisterOrConstant arg_slot, Register temp_reg, int extra_slot_offset = 0);
603
604 void push_cont_fastpath();
605 void pop_cont_fastpath();
606 void inc_held_monitor_count(Register tmp);
607 void dec_held_monitor_count(Register tmp);
608 void atomically_flip_locked_state(bool is_unlock, Register obj, Register tmp, Label& failed, int semantics);
609 void lightweight_lock(Register obj, Register t1, Register t2, Label& slow);
610 void lightweight_unlock(Register obj, Register t1, Label& slow);
611
612 // allocation (for C1)
613 void tlab_allocate(
614 Register obj, // result: pointer to object after successful allocation
615 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise
616 int con_size_in_bytes, // object size in bytes if known at compile time
617 Register t1, // temp register
618 Label& slow_case // continuation point if fast allocation fails
619 );
620 void incr_allocated_bytes(RegisterOrConstant size_in_bytes, Register t1, Register t2);
621
622 enum { trampoline_stub_size = 6 * 4 };
623 address emit_trampoline_stub(int destination_toc_offset, int insts_call_instruction_offset, Register Rtoc = noreg);
624
625 void compiler_fast_lock_object(ConditionRegister flag, Register oop, Register box,
626 Register tmp1, Register tmp2, Register tmp3);
627
628 void compiler_fast_unlock_object(ConditionRegister flag, Register oop, Register box,
629 Register tmp1, Register tmp2, Register tmp3);
630
631 void compiler_fast_lock_lightweight_object(ConditionRegister flag, Register oop, Register tmp1,
632 Register tmp2, Register tmp3);
633
634 void compiler_fast_unlock_lightweight_object(ConditionRegister flag, Register oop, Register tmp1,
635 Register tmp2, Register tmp3);
636
637 // Check if safepoint requested and if so branch
638 void safepoint_poll(Label& slow_path, Register temp, bool at_return, bool in_nmethod);
639
640 void resolve_jobject(Register value, Register tmp1, Register tmp2,
641 MacroAssembler::PreservationLevel preservation_level);
642 void resolve_global_jobject(Register value, Register tmp1, Register tmp2,
643 MacroAssembler::PreservationLevel preservation_level);
644
645 // Support for managing the JavaThread pointer (i.e.; the reference to
646 // thread-local information).
647
648 // Support for last Java frame (but use call_VM instead where possible):
649 // access R16_thread->last_Java_sp.
650 void set_last_Java_frame(Register last_java_sp, Register last_Java_pc);
651 void reset_last_Java_frame(void);
652 void set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1);
653
654 // Read vm result from thread: oop_result = R16_thread->result;
655 void get_vm_result (Register oop_result);
|