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
1574 int sve_vec_reg_size_in_bytes) {
1575 assert(sve_vec_reg_size_in_bytes % 16 == 0, "unexpected sve vector reg size");
1576 for (int i = 0; i < sve_vec_reg_size_in_bytes / 16; i++) {
1577 spill_copy128(src_offset, dst_offset);
1578 src_offset += 16;
1579 dst_offset += 16;
1580 }
1581 }
1582 void spill_copy_sve_predicate_stack_to_stack(int src_offset, int dst_offset,
1583 int sve_predicate_reg_size_in_bytes) {
1584 sve_ldr(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, src_offset));
1585 sve_str(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, dst_offset));
1586 reinitialize_ptrue();
1587 }
1588 void cache_wb(Address line);
1589 void cache_wbsync(bool is_pre);
1590
1591 // Code for java.lang.Thread::onSpinWait() intrinsic.
1592 void spin_wait();
1593
1594 void lightweight_lock(Register obj, Register hdr, Register t1, Register t2, Label& slow);
1595 void lightweight_unlock(Register obj, Register hdr, Register t1, Register t2, Label& slow);
1596
1597 private:
1598 // Check the current thread doesn't need a cross modify fence.
1599 void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1600
1601 };
1602
1603 #ifdef ASSERT
1604 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1605 #endif
1606
1607 /**
1608 * class SkipIfEqual:
1609 *
1610 * Instantiating this class will result in assembly code being output that will
1611 * jump around any code emitted between the creation of the instance and it's
1612 * automatic destruction at the end of a scope block, depending on the value of
1613 * the flag passed to the constructor, which will be checked at run-time.
1614 */
1615 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
1576 int sve_vec_reg_size_in_bytes) {
1577 assert(sve_vec_reg_size_in_bytes % 16 == 0, "unexpected sve vector reg size");
1578 for (int i = 0; i < sve_vec_reg_size_in_bytes / 16; i++) {
1579 spill_copy128(src_offset, dst_offset);
1580 src_offset += 16;
1581 dst_offset += 16;
1582 }
1583 }
1584 void spill_copy_sve_predicate_stack_to_stack(int src_offset, int dst_offset,
1585 int sve_predicate_reg_size_in_bytes) {
1586 sve_ldr(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, src_offset));
1587 sve_str(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, dst_offset));
1588 reinitialize_ptrue();
1589 }
1590 void cache_wb(Address line);
1591 void cache_wbsync(bool is_pre);
1592
1593 // Code for java.lang.Thread::onSpinWait() intrinsic.
1594 void spin_wait();
1595
1596 void lightweight_lock(Register obj, Register t1, Register t2, Register t3, Label& slow);
1597 void lightweight_unlock(Register obj, Register t1, Register t2, Register t3, Label& slow);
1598
1599 private:
1600 // Check the current thread doesn't need a cross modify fence.
1601 void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1602
1603 };
1604
1605 #ifdef ASSERT
1606 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1607 #endif
1608
1609 /**
1610 * class SkipIfEqual:
1611 *
1612 * Instantiating this class will result in assembly code being output that will
1613 * jump around any code emitted between the creation of the instance and it's
1614 * automatic destruction at the end of a scope block, depending on the value of
1615 * the flag passed to the constructor, which will be checked at run-time.
1616 */
1617 class SkipIfEqual {
|