21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/assembler.hpp"
27 #include "asm/assembler.inline.hpp"
28 #include "compiler/disassembler.hpp"
29 #include "gc/shared/cardTableModRefBS.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "memory/universe.hpp"
34 #include "oops/klass.inline.hpp"
35 #include "prims/jvm.h"
36 #include "prims/methodHandles.hpp"
37 #include "runtime/biasedLocking.hpp"
38 #include "runtime/interfaceSupport.hpp"
39 #include "runtime/objectMonitor.hpp"
40 #include "runtime/os.hpp"
41 #include "runtime/sharedRuntime.hpp"
42 #include "runtime/stubRoutines.hpp"
43 #include "runtime/thread.hpp"
44 #include "utilities/macros.hpp"
45 #if INCLUDE_ALL_GCS
46 #include "gc/g1/g1CollectedHeap.inline.hpp"
47 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
48 #include "gc/g1/heapRegion.hpp"
49 #endif // INCLUDE_ALL_GCS
50 #include "crc32c.h"
51 #ifdef COMPILER2
52 #include "opto/intrinsicnode.hpp"
53 #endif
54
55 #ifdef PRODUCT
56 #define BLOCK_COMMENT(str) /* nothing */
57 #define STOP(error) stop(error)
58 #else
59 #define BLOCK_COMMENT(str) block_comment(str)
60 #define STOP(error) block_comment(error); stop(error)
3726 void MacroAssembler::save_rax(Register tmp) {
3727 if (tmp == noreg) push(rax);
3728 else if (tmp != rax) mov(tmp, rax);
3729 }
3730
3731 // Write serialization page so VM thread can do a pseudo remote membar.
3732 // We use the current thread pointer to calculate a thread specific
3733 // offset to write to within the page. This minimizes bus traffic
3734 // due to cache line collision.
3735 void MacroAssembler::serialize_memory(Register thread, Register tmp) {
3736 movl(tmp, thread);
3737 shrl(tmp, os::get_serialize_page_shift_count());
3738 andl(tmp, (os::vm_page_size() - sizeof(int)));
3739
3740 Address index(noreg, tmp, Address::times_1);
3741 ExternalAddress page(os::get_memory_serialize_page());
3742
3743 // Size of store must match masking code above
3744 movl(as_Address(ArrayAddress(page, index)), tmp);
3745 }
3746
3747 // Calls to C land
3748 //
3749 // When entering C land, the rbp, & rsp of the last Java frame have to be recorded
3750 // in the (thread-local) JavaThread object. When leaving C land, the last Java fp
3751 // has to be reset to 0. This is required to allow proper stack traversal.
3752 void MacroAssembler::set_last_Java_frame(Register java_thread,
3753 Register last_java_sp,
3754 Register last_java_fp,
3755 address last_java_pc) {
3756 vzeroupper();
3757 // determine java_thread register
3758 if (!java_thread->is_valid()) {
3759 java_thread = rdi;
3760 get_thread(java_thread);
3761 }
3762 // determine last_java_sp register
3763 if (!last_java_sp->is_valid()) {
3764 last_java_sp = rsp;
3765 }
|
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "asm/assembler.hpp"
27 #include "asm/assembler.inline.hpp"
28 #include "compiler/disassembler.hpp"
29 #include "gc/shared/cardTableModRefBS.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "memory/universe.hpp"
34 #include "oops/klass.inline.hpp"
35 #include "prims/jvm.h"
36 #include "prims/methodHandles.hpp"
37 #include "runtime/biasedLocking.hpp"
38 #include "runtime/interfaceSupport.hpp"
39 #include "runtime/objectMonitor.hpp"
40 #include "runtime/os.hpp"
41 #include "runtime/safepoint.hpp"
42 #include "runtime/safepointMechanism.hpp"
43 #include "runtime/sharedRuntime.hpp"
44 #include "runtime/stubRoutines.hpp"
45 #include "runtime/thread.hpp"
46 #include "utilities/macros.hpp"
47 #if INCLUDE_ALL_GCS
48 #include "gc/g1/g1CollectedHeap.inline.hpp"
49 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
50 #include "gc/g1/heapRegion.hpp"
51 #endif // INCLUDE_ALL_GCS
52 #include "crc32c.h"
53 #ifdef COMPILER2
54 #include "opto/intrinsicnode.hpp"
55 #endif
56
57 #ifdef PRODUCT
58 #define BLOCK_COMMENT(str) /* nothing */
59 #define STOP(error) stop(error)
60 #else
61 #define BLOCK_COMMENT(str) block_comment(str)
62 #define STOP(error) block_comment(error); stop(error)
3728 void MacroAssembler::save_rax(Register tmp) {
3729 if (tmp == noreg) push(rax);
3730 else if (tmp != rax) mov(tmp, rax);
3731 }
3732
3733 // Write serialization page so VM thread can do a pseudo remote membar.
3734 // We use the current thread pointer to calculate a thread specific
3735 // offset to write to within the page. This minimizes bus traffic
3736 // due to cache line collision.
3737 void MacroAssembler::serialize_memory(Register thread, Register tmp) {
3738 movl(tmp, thread);
3739 shrl(tmp, os::get_serialize_page_shift_count());
3740 andl(tmp, (os::vm_page_size() - sizeof(int)));
3741
3742 Address index(noreg, tmp, Address::times_1);
3743 ExternalAddress page(os::get_memory_serialize_page());
3744
3745 // Size of store must match masking code above
3746 movl(as_Address(ArrayAddress(page, index)), tmp);
3747 }
3748
3749 #ifdef _LP64
3750 void MacroAssembler::safepoint_poll(Label& slow_path, Register thread_reg, Register temp_reg) {
3751 if (SafepointMechanism::uses_thread_local_poll()) {
3752 testb(Address(r15_thread, Thread::polling_page_offset()), SafepointMechanism::poll_bit());
3753 jcc(Assembler::notZero, slow_path); // handshake bit set implies poll
3754 } else {
3755 cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
3756 SafepointSynchronize::_not_synchronized);
3757 jcc(Assembler::notEqual, slow_path);
3758 }
3759 }
3760 #else
3761 void MacroAssembler::safepoint_poll(Label& slow_path) {
3762 cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
3763 SafepointSynchronize::_not_synchronized);
3764 jcc(Assembler::notEqual, slow_path);
3765 }
3766 #endif
3767
3768 // Calls to C land
3769 //
3770 // When entering C land, the rbp, & rsp of the last Java frame have to be recorded
3771 // in the (thread-local) JavaThread object. When leaving C land, the last Java fp
3772 // has to be reset to 0. This is required to allow proper stack traversal.
3773 void MacroAssembler::set_last_Java_frame(Register java_thread,
3774 Register last_java_sp,
3775 Register last_java_fp,
3776 address last_java_pc) {
3777 vzeroupper();
3778 // determine java_thread register
3779 if (!java_thread->is_valid()) {
3780 java_thread = rdi;
3781 get_thread(java_thread);
3782 }
3783 // determine last_java_sp register
3784 if (!last_java_sp->is_valid()) {
3785 last_java_sp = rsp;
3786 }
|