1 /*
2 * Copyright (c) 1997, 2021, 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.
806 Register scratch);
807
808 void reset_last_Java_frame(Register thread);
809
810 // thread in the default location (rthread)
811 void reset_last_Java_frame(bool clear_fp);
812
813 // Stores
814 void store_check(Register obj); // store check for obj - register is destroyed afterwards
815 void store_check(Register obj, Address dst); // same as above, dst is exact store location (reg. is destroyed)
816
817 void resolve_jobject(Register value, Register thread, Register tmp);
818
819 // C 'boolean' to Java boolean: x == 0 ? 0 : 1
820 void c2bool(Register x);
821
822 void load_method_holder_cld(Register rresult, Register rmethod);
823 void load_method_holder(Register holder, Register method);
824
825 // oop manipulations
826 void load_klass(Register dst, Register src);
827 void store_klass(Register dst, Register src);
828 void cmp_klass(Register oop, Register trial_klass, Register tmp);
829
830 void resolve_weak_handle(Register result, Register tmp);
831 void resolve_oop_handle(Register result, Register tmp = r5);
832 void load_mirror(Register dst, Register method, Register tmp = r5);
833
834 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
835 Register tmp1, Register tmp_thread);
836
837 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
838 Register tmp1, Register tmp_thread);
839
840 void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
841 Register thread_tmp = noreg, DecoratorSet decorators = 0);
842
843 void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
844 Register thread_tmp = noreg, DecoratorSet decorators = 0);
845 void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
846 Register tmp_thread = noreg, DecoratorSet decorators = 0);
847
848 // currently unimplemented
849 // Used for storing NULL. All other oop constants should be
850 // stored using routines that take a jobject.
851 void store_heap_oop_null(Address dst);
852
853 void load_prototype_header(Register dst, Register src);
854
855 void store_klass_gap(Register dst, Register src);
856
857 // This dummy is to prevent a call to store_heap_oop from
858 // converting a zero (like NULL) into a Register by giving
859 // the compiler two choices it can't resolve
860
861 void store_heap_oop(Address dst, void* dummy);
862
863 void encode_heap_oop(Register d, Register s);
864 void encode_heap_oop(Register r) { encode_heap_oop(r, r); }
865 void decode_heap_oop(Register d, Register s);
866 void decode_heap_oop(Register r) { decode_heap_oop(r, r); }
867 void encode_heap_oop_not_null(Register r);
868 void decode_heap_oop_not_null(Register r);
869 void encode_heap_oop_not_null(Register dst, Register src);
870 void decode_heap_oop_not_null(Register dst, Register src);
871
872 void set_narrow_oop(Register dst, jobject obj);
873
874 void encode_klass_not_null(Register r);
875 void decode_klass_not_null(Register r);
876 void encode_klass_not_null(Register dst, Register src);
1406 spill(tmp1, true, dst_offset);
1407 unspill(tmp1, true, src_offset+8);
1408 spill(tmp1, true, dst_offset+8);
1409 }
1410 }
1411 void spill_copy_sve_vector_stack_to_stack(int src_offset, int dst_offset,
1412 int sve_vec_reg_size_in_bytes) {
1413 assert(sve_vec_reg_size_in_bytes % 16 == 0, "unexpected sve vector reg size");
1414 for (int i = 0; i < sve_vec_reg_size_in_bytes / 16; i++) {
1415 spill_copy128(src_offset, dst_offset);
1416 src_offset += 16;
1417 dst_offset += 16;
1418 }
1419 }
1420 void cache_wb(Address line);
1421 void cache_wbsync(bool is_pre);
1422
1423 // Code for java.lang.Thread::onSpinWait() intrinsic.
1424 void spin_wait();
1425
1426 private:
1427 // Check the current thread doesn't need a cross modify fence.
1428 void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1429
1430 };
1431
1432 #ifdef ASSERT
1433 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1434 #endif
1435
1436 /**
1437 * class SkipIfEqual:
1438 *
1439 * Instantiating this class will result in assembly code being output that will
1440 * jump around any code emitted between the creation of the instance and it's
1441 * automatic destruction at the end of a scope block, depending on the value of
1442 * the flag passed to the constructor, which will be checked at run-time.
1443 */
1444 class SkipIfEqual {
1445 private:
|
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.
806 Register scratch);
807
808 void reset_last_Java_frame(Register thread);
809
810 // thread in the default location (rthread)
811 void reset_last_Java_frame(bool clear_fp);
812
813 // Stores
814 void store_check(Register obj); // store check for obj - register is destroyed afterwards
815 void store_check(Register obj, Address dst); // same as above, dst is exact store location (reg. is destroyed)
816
817 void resolve_jobject(Register value, Register thread, Register tmp);
818
819 // C 'boolean' to Java boolean: x == 0 ? 0 : 1
820 void c2bool(Register x);
821
822 void load_method_holder_cld(Register rresult, Register rmethod);
823 void load_method_holder(Register holder, Register method);
824
825 // oop manipulations
826 void load_nklass(Register dst, Register src);
827 void load_klass(Register dst, Register src, bool null_check = false);
828 void store_klass(Register dst, Register src);
829 void cmp_klass(Register oop, Register trial_klass, Register tmp);
830
831 void resolve_weak_handle(Register result, Register tmp);
832 void resolve_oop_handle(Register result, Register tmp = r5);
833 void load_mirror(Register dst, Register method, Register tmp = r5);
834
835 void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
836 Register tmp1, Register tmp_thread);
837
838 void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
839 Register tmp1, Register tmp_thread);
840
841 void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
842 Register thread_tmp = noreg, DecoratorSet decorators = 0);
843
844 void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
845 Register thread_tmp = noreg, DecoratorSet decorators = 0);
846 void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
847 Register tmp_thread = noreg, DecoratorSet decorators = 0);
848
849 // currently unimplemented
850 // Used for storing NULL. All other oop constants should be
851 // stored using routines that take a jobject.
852 void store_heap_oop_null(Address dst);
853
854 void store_klass_gap(Register dst, Register src);
855
856 void load_prototype_header(Register dst, Register src);
857
858 // This dummy is to prevent a call to store_heap_oop from
859 // converting a zero (like NULL) into a Register by giving
860 // the compiler two choices it can't resolve
861
862 void store_heap_oop(Address dst, void* dummy);
863
864 void encode_heap_oop(Register d, Register s);
865 void encode_heap_oop(Register r) { encode_heap_oop(r, r); }
866 void decode_heap_oop(Register d, Register s);
867 void decode_heap_oop(Register r) { decode_heap_oop(r, r); }
868 void encode_heap_oop_not_null(Register r);
869 void decode_heap_oop_not_null(Register r);
870 void encode_heap_oop_not_null(Register dst, Register src);
871 void decode_heap_oop_not_null(Register dst, Register src);
872
873 void set_narrow_oop(Register dst, jobject obj);
874
875 void encode_klass_not_null(Register r);
876 void decode_klass_not_null(Register r);
877 void encode_klass_not_null(Register dst, Register src);
1407 spill(tmp1, true, dst_offset);
1408 unspill(tmp1, true, src_offset+8);
1409 spill(tmp1, true, dst_offset+8);
1410 }
1411 }
1412 void spill_copy_sve_vector_stack_to_stack(int src_offset, int dst_offset,
1413 int sve_vec_reg_size_in_bytes) {
1414 assert(sve_vec_reg_size_in_bytes % 16 == 0, "unexpected sve vector reg size");
1415 for (int i = 0; i < sve_vec_reg_size_in_bytes / 16; i++) {
1416 spill_copy128(src_offset, dst_offset);
1417 src_offset += 16;
1418 dst_offset += 16;
1419 }
1420 }
1421 void cache_wb(Address line);
1422 void cache_wbsync(bool is_pre);
1423
1424 // Code for java.lang.Thread::onSpinWait() intrinsic.
1425 void spin_wait();
1426
1427 void lightweight_lock(Register obj, Register t1, Register t2, Register t3, Label& slow);
1428 void lightweight_unlock(Register obj, Register t1, Register t2, Register t3, Label& slow);
1429
1430 private:
1431 // Check the current thread doesn't need a cross modify fence.
1432 void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1433
1434 };
1435
1436 #ifdef ASSERT
1437 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1438 #endif
1439
1440 /**
1441 * class SkipIfEqual:
1442 *
1443 * Instantiating this class will result in assembly code being output that will
1444 * jump around any code emitted between the creation of the instance and it's
1445 * automatic destruction at the end of a scope block, depending on the value of
1446 * the flag passed to the constructor, which will be checked at run-time.
1447 */
1448 class SkipIfEqual {
1449 private:
|