29 #include "gc/shared/barrierSet.hpp"
30 #include "gc/shared/barrierSetAssembler.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/universe.hpp"
33 #include "nativeInst_aarch64.hpp"
34 #include "oops/instanceOop.hpp"
35 #include "oops/method.hpp"
36 #include "oops/objArrayKlass.hpp"
37 #include "oops/oop.inline.hpp"
38 #include "prims/methodHandles.hpp"
39 #include "runtime/frame.inline.hpp"
40 #include "runtime/handles.inline.hpp"
41 #include "runtime/sharedRuntime.hpp"
42 #include "runtime/stubCodeGenerator.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "runtime/thread.inline.hpp"
45 #include "utilities/align.hpp"
46 #ifdef COMPILER2
47 #include "opto/runtime.hpp"
48 #endif
49
50 #ifdef BUILTIN_SIM
51 #include "../../../../../../simulator/simulator.hpp"
52 #endif
53
54 // Declaration and definition of StubGenerator (no .hpp file).
55 // For a more detailed description of the stub routine structure
56 // see the comment in stubRoutines.hpp
57
58 #undef __
59 #define __ _masm->
60 #define TIMES_OOP Address::sxtw(exact_log2(UseCompressedOops ? 4 : 8))
61
62 #ifdef PRODUCT
63 #define BLOCK_COMMENT(str) /* nothing */
64 #else
65 #define BLOCK_COMMENT(str) __ block_comment(str)
66 #endif
67
68 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
562 // [tos + 5]: saved rscratch1
563 address generate_verify_oop() {
564
565 StubCodeMark mark(this, "StubRoutines", "verify_oop");
566 address start = __ pc();
567
568 Label exit, error;
569
570 // save c_rarg2 and c_rarg3
571 __ stp(c_rarg3, c_rarg2, Address(__ pre(sp, -16)));
572
573 // __ incrementl(ExternalAddress((address) StubRoutines::verify_oop_count_addr()));
574 __ lea(c_rarg2, ExternalAddress((address) StubRoutines::verify_oop_count_addr()));
575 __ ldr(c_rarg3, Address(c_rarg2));
576 __ add(c_rarg3, c_rarg3, 1);
577 __ str(c_rarg3, Address(c_rarg2));
578
579 // object is in r0
580 // make sure object is 'reasonable'
581 __ cbz(r0, exit); // if obj is NULL it is OK
582
583 // Check if the oop is in the right area of memory
584 __ mov(c_rarg3, (intptr_t) Universe::verify_oop_mask());
585 __ andr(c_rarg2, r0, c_rarg3);
586 __ mov(c_rarg3, (intptr_t) Universe::verify_oop_bits());
587
588 // Compare c_rarg2 and c_rarg3. We don't use a compare
589 // instruction here because the flags register is live.
590 __ eor(c_rarg2, c_rarg2, c_rarg3);
591 __ cbnz(c_rarg2, error);
592
593 // make sure klass is 'reasonable', which is not zero.
594 __ load_klass(r0, r0); // get klass
595 __ cbz(r0, error); // if klass is NULL it is broken
596
597 // return if everything seems ok
598 __ bind(exit);
599
600 __ ldp(c_rarg3, c_rarg2, Address(__ post(sp, 16)));
601 __ ret(lr);
|
29 #include "gc/shared/barrierSet.hpp"
30 #include "gc/shared/barrierSetAssembler.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/universe.hpp"
33 #include "nativeInst_aarch64.hpp"
34 #include "oops/instanceOop.hpp"
35 #include "oops/method.hpp"
36 #include "oops/objArrayKlass.hpp"
37 #include "oops/oop.inline.hpp"
38 #include "prims/methodHandles.hpp"
39 #include "runtime/frame.inline.hpp"
40 #include "runtime/handles.inline.hpp"
41 #include "runtime/sharedRuntime.hpp"
42 #include "runtime/stubCodeGenerator.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "runtime/thread.inline.hpp"
45 #include "utilities/align.hpp"
46 #ifdef COMPILER2
47 #include "opto/runtime.hpp"
48 #endif
49 #if INCLUDE_ZGC
50 #include "gc/z/zThreadLocalData.hpp"
51 #endif
52
53 #ifdef BUILTIN_SIM
54 #include "../../../../../../simulator/simulator.hpp"
55 #endif
56
57 // Declaration and definition of StubGenerator (no .hpp file).
58 // For a more detailed description of the stub routine structure
59 // see the comment in stubRoutines.hpp
60
61 #undef __
62 #define __ _masm->
63 #define TIMES_OOP Address::sxtw(exact_log2(UseCompressedOops ? 4 : 8))
64
65 #ifdef PRODUCT
66 #define BLOCK_COMMENT(str) /* nothing */
67 #else
68 #define BLOCK_COMMENT(str) __ block_comment(str)
69 #endif
70
71 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
565 // [tos + 5]: saved rscratch1
566 address generate_verify_oop() {
567
568 StubCodeMark mark(this, "StubRoutines", "verify_oop");
569 address start = __ pc();
570
571 Label exit, error;
572
573 // save c_rarg2 and c_rarg3
574 __ stp(c_rarg3, c_rarg2, Address(__ pre(sp, -16)));
575
576 // __ incrementl(ExternalAddress((address) StubRoutines::verify_oop_count_addr()));
577 __ lea(c_rarg2, ExternalAddress((address) StubRoutines::verify_oop_count_addr()));
578 __ ldr(c_rarg3, Address(c_rarg2));
579 __ add(c_rarg3, c_rarg3, 1);
580 __ str(c_rarg3, Address(c_rarg2));
581
582 // object is in r0
583 // make sure object is 'reasonable'
584 __ cbz(r0, exit); // if obj is NULL it is OK
585
586 #if INCLUDE_ZGC
587 if (UseZGC) {
588 // Check if mask is good.
589 // verifies that ZAddressBadMask & r0 == 0
590 __ ldr(c_rarg3, Address(rthread, ZThreadLocalData::address_bad_mask_offset()));
591 __ andr(c_rarg2, r0, c_rarg3);
592 __ cbnz(c_rarg2, error);
593 }
594 #endif
595
596 // Check if the oop is in the right area of memory
597 __ mov(c_rarg3, (intptr_t) Universe::verify_oop_mask());
598 __ andr(c_rarg2, r0, c_rarg3);
599 __ mov(c_rarg3, (intptr_t) Universe::verify_oop_bits());
600
601 // Compare c_rarg2 and c_rarg3. We don't use a compare
602 // instruction here because the flags register is live.
603 __ eor(c_rarg2, c_rarg2, c_rarg3);
604 __ cbnz(c_rarg2, error);
605
606 // make sure klass is 'reasonable', which is not zero.
607 __ load_klass(r0, r0); // get klass
608 __ cbz(r0, error); // if klass is NULL it is broken
609
610 // return if everything seems ok
611 __ bind(exit);
612
613 __ ldp(c_rarg3, c_rarg2, Address(__ post(sp, 16)));
614 __ ret(lr);
|