< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
rev 47413 : Introduce SafepointMechanism
rev 47414 : Move polling page allocation to SafepointMechanism initialization
rev 47415 : Add Thread Local handshakes and thread local polling
@@ -63,10 +63,11 @@
#include "runtime/commandLineFlagWriteableList.hpp"
#include "runtime/commandLineFlagRangeList.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/globals.hpp"
+#include "runtime/handshake.hpp"
#include "runtime/init.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniPeriodicChecker.hpp"
@@ -75,10 +76,11 @@
#include "runtime/mutexLocker.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/osThread.hpp"
#include "runtime/safepoint.hpp"
+#include "runtime/safepointMechanism.inline.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/statSampler.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/sweeper.hpp"
#include "runtime/task.hpp"
@@ -1492,10 +1494,14 @@
_popframe_condition = popframe_inactive;
_popframe_preserved_args = NULL;
_popframe_preserved_args_size = 0;
_frames_to_pop_failed_realloc = 0;
+ if (SafepointMechanism::uses_thread_local_poll()) {
+ SafepointMechanism::initialize_header(this);
+ }
+
pd_initialize();
}
#if INCLUDE_ALL_GCS
SATBMarkQueueSet JavaThread::_satb_mark_queue_set;
@@ -1908,10 +1914,15 @@
exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
os::current_thread_id());
// Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
Threads::remove(this);
+
+ // If someone set a handshake on us just as we entered exit path, we simple cancel it.
+ if (ThreadLocalHandshakes) {
+ cancel_handshake();
+ }
}
#if INCLUDE_ALL_GCS
// Flush G1-related queues.
void JavaThread::flush_barrier_queues() {
@@ -2370,15 +2381,11 @@
thread->set_thread_state(state);
InterfaceSupport::serialize_thread_state_with_handler(thread);
}
- if (SafepointSynchronize::do_call_back()) {
- // If we are safepointing, then block the caller which may not be
- // the same as the target thread (see above).
- SafepointSynchronize::block(curJT);
- }
+ SafepointMechanism::block_if_requested(curJT);
if (thread->is_deopt_suspend()) {
thread->clear_deopt_suspend();
RegisterMap map(thread, false);
frame f = thread->last_frame();
@@ -3552,10 +3559,12 @@
HOTSPOT_VM_INIT_BEGIN();
// Timing (must come after argument parsing)
TraceTime timer("Create VM", TRACETIME_LOG(Info, startuptime));
+ SafepointMechanism::initialize();
+
// Initialize the os module after parsing the args
jint os_init_2_result = os::init_2();
if (os_init_2_result != JNI_OK) return os_init_2_result;
jint adjust_after_os_result = Arguments::adjust_after_os();
< prev index next >