1 /*
2 * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
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.
832
833 void reset_last_Java_frame(Register thread);
834
835 // thread in the default location (rthread)
836 void reset_last_Java_frame(bool clear_fp);
837
838 // Stores
839 void store_check(Register obj); // store check for obj - register is destroyed afterwards
840 void store_check(Register obj, Address dst); // same as above, dst is exact store location (reg. is destroyed)
841
842 void resolve_jobject(Register value, Register tmp1, Register tmp2);
843 void resolve_global_jobject(Register value, Register tmp1, Register tmp2);
844
845 // C 'boolean' to Java boolean: x == 0 ? 0 : 1
846 void c2bool(Register x);
847
848 void load_method_holder_cld(Register rresult, Register rmethod);
849 void load_method_holder(Register holder, Register method);
850
851 // oop manipulations
852 void load_klass(Register dst, Register src);
853 void store_klass(Register dst, Register src);
854 void cmp_klass(Register oop, Register trial_klass, Register tmp);
855
856 void resolve_weak_handle(Register result, Register tmp1, Register tmp2);
857 void resolve_oop_handle(Register result, Register tmp1, Register tmp2);
858 void load_mirror(Register dst, Register method, Register tmp1, Register tmp2);
859
860 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
861 Register tmp1, Register tmp2);
862
863 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
864 Register tmp1, Register tmp2, Register tmp3);
865
866 void load_heap_oop(Register dst, Address src, Register tmp1,
867 Register tmp2, DecoratorSet decorators = 0);
868
869 void load_heap_oop_not_null(Register dst, Address src, Register tmp1,
870 Register tmp2, DecoratorSet decorators = 0);
871 void store_heap_oop(Address dst, Register val, Register tmp1,
872 Register tmp2, Register tmp3, DecoratorSet decorators = 0);
873
874 // currently unimplemented
1565 int sve_vec_reg_size_in_bytes) {
1566 assert(sve_vec_reg_size_in_bytes % 16 == 0, "unexpected sve vector reg size");
1567 for (int i = 0; i < sve_vec_reg_size_in_bytes / 16; i++) {
1568 spill_copy128(src_offset, dst_offset);
1569 src_offset += 16;
1570 dst_offset += 16;
1571 }
1572 }
1573 void spill_copy_sve_predicate_stack_to_stack(int src_offset, int dst_offset,
1574 int sve_predicate_reg_size_in_bytes) {
1575 sve_ldr(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, src_offset));
1576 sve_str(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, dst_offset));
1577 reinitialize_ptrue();
1578 }
1579 void cache_wb(Address line);
1580 void cache_wbsync(bool is_pre);
1581
1582 // Code for java.lang.Thread::onSpinWait() intrinsic.
1583 void spin_wait();
1584
1585 void lightweight_lock(Register obj, Register hdr, Register t1, Register t2, Label& slow);
1586 void lightweight_unlock(Register obj, Register hdr, Register t1, Register t2, Label& slow);
1587
1588 private:
1589 // Check the current thread doesn't need a cross modify fence.
1590 void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1591
1592 };
1593
1594 #ifdef ASSERT
1595 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1596 #endif
1597
1598 /**
1599 * class SkipIfEqual:
1600 *
1601 * Instantiating this class will result in assembly code being output that will
1602 * jump around any code emitted between the creation of the instance and it's
1603 * automatic destruction at the end of a scope block, depending on the value of
1604 * the flag passed to the constructor, which will be checked at run-time.
1605 */
1606 class SkipIfEqual {
|
1 /*
2 * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
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.
832
833 void reset_last_Java_frame(Register thread);
834
835 // thread in the default location (rthread)
836 void reset_last_Java_frame(bool clear_fp);
837
838 // Stores
839 void store_check(Register obj); // store check for obj - register is destroyed afterwards
840 void store_check(Register obj, Address dst); // same as above, dst is exact store location (reg. is destroyed)
841
842 void resolve_jobject(Register value, Register tmp1, Register tmp2);
843 void resolve_global_jobject(Register value, Register tmp1, Register tmp2);
844
845 // C 'boolean' to Java boolean: x == 0 ? 0 : 1
846 void c2bool(Register x);
847
848 void load_method_holder_cld(Register rresult, Register rmethod);
849 void load_method_holder(Register holder, Register method);
850
851 // oop manipulations
852 void load_nklass_compact(Register dst, Register src);
853 void load_klass(Register dst, Register src);
854 void store_klass(Register dst, Register src);
855 void cmp_klass(Register oop, Register trial_klass, Register tmp);
856 void cmp_klass(Register src, Register dst, Register tmp1, Register tmp2);
857
858 void resolve_weak_handle(Register result, Register tmp1, Register tmp2);
859 void resolve_oop_handle(Register result, Register tmp1, Register tmp2);
860 void load_mirror(Register dst, Register method, Register tmp1, Register tmp2);
861
862 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
863 Register tmp1, Register tmp2);
864
865 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
866 Register tmp1, Register tmp2, Register tmp3);
867
868 void load_heap_oop(Register dst, Address src, Register tmp1,
869 Register tmp2, DecoratorSet decorators = 0);
870
871 void load_heap_oop_not_null(Register dst, Address src, Register tmp1,
872 Register tmp2, DecoratorSet decorators = 0);
873 void store_heap_oop(Address dst, Register val, Register tmp1,
874 Register tmp2, Register tmp3, DecoratorSet decorators = 0);
875
876 // currently unimplemented
1567 int sve_vec_reg_size_in_bytes) {
1568 assert(sve_vec_reg_size_in_bytes % 16 == 0, "unexpected sve vector reg size");
1569 for (int i = 0; i < sve_vec_reg_size_in_bytes / 16; i++) {
1570 spill_copy128(src_offset, dst_offset);
1571 src_offset += 16;
1572 dst_offset += 16;
1573 }
1574 }
1575 void spill_copy_sve_predicate_stack_to_stack(int src_offset, int dst_offset,
1576 int sve_predicate_reg_size_in_bytes) {
1577 sve_ldr(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, src_offset));
1578 sve_str(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, dst_offset));
1579 reinitialize_ptrue();
1580 }
1581 void cache_wb(Address line);
1582 void cache_wbsync(bool is_pre);
1583
1584 // Code for java.lang.Thread::onSpinWait() intrinsic.
1585 void spin_wait();
1586
1587 void lightweight_lock(Register obj, Register t1, Register t2, Register t3, Label& slow);
1588 void lightweight_unlock(Register obj, Register t1, Register t2, Register t3, Label& slow);
1589
1590 private:
1591 // Check the current thread doesn't need a cross modify fence.
1592 void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1593
1594 };
1595
1596 #ifdef ASSERT
1597 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1598 #endif
1599
1600 /**
1601 * class SkipIfEqual:
1602 *
1603 * Instantiating this class will result in assembly code being output that will
1604 * jump around any code emitted between the creation of the instance and it's
1605 * automatic destruction at the end of a scope block, depending on the value of
1606 * the flag passed to the constructor, which will be checked at run-time.
1607 */
1608 class SkipIfEqual {
|