67 good_page_val = reinterpret_cast<intptr_t>(good_page); 68 poll_armed_value |= bad_page_val; 69 poll_disarmed_value |= good_page_val; 70 } 71 72 _poll_armed_value = reinterpret_cast<void*>(poll_armed_value); 73 _poll_disarmed_value = reinterpret_cast<void*>(poll_disarmed_value); 74 } else { 75 const size_t page_size = os::vm_page_size(); 76 char* polling_page = os::reserve_memory(page_size, NULL, page_size); 77 os::commit_memory_or_exit(polling_page, page_size, false, "Unable to commit Safepoint polling page"); 78 os::protect_memory(polling_page, page_size, os::MEM_PROT_READ); 79 MemTracker::record_virtual_memory_type((address)polling_page, mtSafepoint); 80 81 log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page)); 82 os::set_polling_page((address)(polling_page)); 83 } 84 } 85 86 void SafepointMechanism::block_if_requested_slow(JavaThread *thread) { 87 if (uses_thread_local_poll()) { 88 // local poll already checked 89 if (global_poll()) { 90 SafepointSynchronize::block(thread); 91 } 92 if (thread->has_handshake()) { 93 thread->handshake_process_by_self(); 94 } 95 } else { 96 // If we don't have per thread poll this could a handshake or a safepoint 97 if (global_poll()) { 98 SafepointSynchronize::block(thread); 99 } 100 } 101 } 102 103 void SafepointMechanism::initialize_header(JavaThread* thread) { 104 disarm_local_poll(thread); 105 } 106 107 void SafepointMechanism::initialize() { 108 pd_initialize(); 109 } | 67 good_page_val = reinterpret_cast<intptr_t>(good_page); 68 poll_armed_value |= bad_page_val; 69 poll_disarmed_value |= good_page_val; 70 } 71 72 _poll_armed_value = reinterpret_cast<void*>(poll_armed_value); 73 _poll_disarmed_value = reinterpret_cast<void*>(poll_disarmed_value); 74 } else { 75 const size_t page_size = os::vm_page_size(); 76 char* polling_page = os::reserve_memory(page_size, NULL, page_size); 77 os::commit_memory_or_exit(polling_page, page_size, false, "Unable to commit Safepoint polling page"); 78 os::protect_memory(polling_page, page_size, os::MEM_PROT_READ); 79 MemTracker::record_virtual_memory_type((address)polling_page, mtSafepoint); 80 81 log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page)); 82 os::set_polling_page((address)(polling_page)); 83 } 84 } 85 86 void SafepointMechanism::block_if_requested_slow(JavaThread *thread) { 87 // local poll already checked, if used. 88 if (global_poll()) { 89 SafepointSynchronize::block(thread); 90 } 91 if (uses_thread_local_poll() && thread->has_handshake()) { 92 thread->handshake_process_by_self(); 93 } 94 } 95 96 void SafepointMechanism::initialize_header(JavaThread* thread) { 97 disarm_local_poll(thread); 98 } 99 100 void SafepointMechanism::initialize() { 101 pd_initialize(); 102 } |