Skip to content

Commit 57dbffe

Browse files
committed
8225788: Dead code in thread and safepoint
Reviewed-by: dholmes, dcubed, coleenp
1 parent 6af89d6 commit 57dbffe

File tree

9 files changed

+7
-186
lines changed

9 files changed

+7
-186
lines changed

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,6 @@ void CompileBroker::wait_for_completion(CompileTask* task) {
15461546
assert(task->is_blocking(), "can only wait on blocking task");
15471547

15481548
JavaThread* thread = JavaThread::current();
1549-
thread->set_blocked_on_compilation(true);
15501549

15511550
methodHandle method(thread, task->method());
15521551
bool free_task;
@@ -1564,7 +1563,6 @@ void CompileBroker::wait_for_completion(CompileTask* task) {
15641563
}
15651564
}
15661565

1567-
thread->set_blocked_on_compilation(false);
15681566
if (free_task) {
15691567
if (is_compilation_disabled_forever()) {
15701568
CompileTask::free(task);

src/hotspot/share/runtime/safepoint.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -952,8 +952,7 @@ void SafepointSynchronize::print_safepoint_timeout() {
952952

953953
ThreadSafepointState::ThreadSafepointState(JavaThread *thread)
954954
: _at_poll_safepoint(false), _thread(thread), _safepoint_safe(false),
955-
_safepoint_id(SafepointSynchronize::InactiveSafepointCounter),
956-
_orig_thread_state(_thread_uninitialized), _next(NULL) {
955+
_safepoint_id(SafepointSynchronize::InactiveSafepointCounter), _next(NULL) {
957956
}
958957

959958
void ThreadSafepointState::create(JavaThread *thread) {
@@ -990,9 +989,6 @@ void ThreadSafepointState::examine_state_of_thread(uint64_t safepoint_count) {
990989
return;
991990
}
992991

993-
// Save the state at the start of safepoint processing.
994-
_orig_thread_state = stable_state;
995-
996992
// Check for a thread that is suspended. Note that thread resume tries
997993
// to grab the Threads_lock which we own here, so a thread cannot be
998994
// resumed during safepoint synchronization.
@@ -1060,8 +1056,6 @@ void ThreadSafepointState::print_on(outputStream *st) const {
10601056
_thread->print_thread_state_on(st);
10611057
}
10621058

1063-
void ThreadSafepointState::print() const { print_on(tty); }
1064-
10651059
// ---------------------------------------------------------------------------------------------------------------------
10661060

10671061
// Block the thread at poll or poll return for safepoint/handshake.

src/hotspot/share/runtime/safepoint.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,6 @@ class SafepointSynchronize : AllStatic {
112112
static long _end_of_last_safepoint; // Time of last safepoint in milliseconds
113113
static julong _coalesced_vmop_count; // coalesced vmop count
114114

115-
// Statistics
116-
static void begin_statistics(int nof_threads, int nof_running);
117-
static void update_statistics_on_spin_end();
118-
static void update_statistics_on_sync_end(jlong end_time);
119-
static void update_statistics_on_cleanup_end(jlong end_time);
120-
static void end_statistics(jlong end_time);
121-
static void print_statistics();
122-
123115
// For debug long safepoint
124116
static void print_safepoint_timeout();
125117

@@ -215,7 +207,6 @@ class ThreadSafepointState: public CHeapObj<mtThread> {
215207
JavaThread* _thread;
216208
bool _safepoint_safe;
217209
volatile uint64_t _safepoint_id;
218-
JavaThreadState _orig_thread_state;
219210

220211
ThreadSafepointState* _next;
221212

@@ -241,8 +232,6 @@ class ThreadSafepointState: public CHeapObj<mtThread> {
241232
void reset_safepoint_id();
242233
void set_safepoint_id(uint64_t sid);
243234

244-
JavaThreadState orig_thread_state() const { return _orig_thread_state; }
245-
246235
// Support for safepoint timeout (debugging)
247236
bool is_at_poll_safepoint() { return _at_poll_safepoint; }
248237
void set_at_poll_safepoint(bool val) { _at_poll_safepoint = val; }
@@ -251,7 +240,6 @@ class ThreadSafepointState: public CHeapObj<mtThread> {
251240

252241
// debugging
253242
void print_on(outputStream* st) const;
254-
void print() const;
255243

256244
// Initialize
257245
static void create(JavaThread *thread);

src/hotspot/share/runtime/thread.cpp

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ Thread::Thread() {
223223
// stack and get_thread
224224
set_stack_base(NULL);
225225
set_stack_size(0);
226-
set_self_raw_id(0);
227226
set_lgrp_id(-1);
228227
DEBUG_ONLY(clear_suspendible_thread();)
229228

@@ -859,23 +858,6 @@ JavaThread::is_thread_fully_suspended(bool wait_for_suspend, uint32_t *bits) {
859858
return true;
860859
}
861860

862-
#ifndef PRODUCT
863-
void JavaThread::record_jump(address target, address instr, const char* file,
864-
int line) {
865-
866-
// This should not need to be atomic as the only way for simultaneous
867-
// updates is via interrupts. Even then this should be rare or non-existent
868-
// and we don't care that much anyway.
869-
870-
int index = _jmp_ring_index;
871-
_jmp_ring_index = (index + 1) & (jump_ring_buffer_size - 1);
872-
_jmp_ring[index]._target = (intptr_t) target;
873-
_jmp_ring[index]._instruction = (intptr_t) instr;
874-
_jmp_ring[index]._file = file;
875-
_jmp_ring[index]._line = line;
876-
}
877-
#endif // PRODUCT
878-
879861
void Thread::interrupt(Thread* thread) {
880862
debug_only(check_for_dangling_thread_pointer(thread);)
881863
os::interrupt(thread);
@@ -1001,15 +983,6 @@ void Thread::print_owned_locks_on(outputStream* st) const {
1001983
}
1002984
}
1003985

1004-
static int ref_use_count = 0;
1005-
1006-
bool Thread::owns_locks_but_compiled_lock() const {
1007-
for (Monitor *cur = _owned_locks; cur; cur = cur->next()) {
1008-
if (cur != Compile_lock) return true;
1009-
}
1010-
return false;
1011-
}
1012-
1013986
// Checks safepoint allowed and clears unhandled oops at potential safepoints.
1014987
void Thread::check_possible_safepoint() {
1015988
if (!is_Java_thread()) return;
@@ -1688,7 +1661,6 @@ void JavaThread::initialize() {
16881661
set_deferred_locals(NULL);
16891662
set_deopt_mark(NULL);
16901663
set_deopt_compiled_method(NULL);
1691-
clear_must_deopt_id();
16921664
set_monitor_chunks(NULL);
16931665
_on_thread_list = false;
16941666
set_thread_state(_thread_new);
@@ -1723,20 +1695,12 @@ void JavaThread::initialize() {
17231695
_pending_async_exception = NULL;
17241696
_thread_stat = NULL;
17251697
_thread_stat = new ThreadStatistics();
1726-
_blocked_on_compilation = false;
17271698
_jni_active_critical = 0;
17281699
_pending_jni_exception_check_fn = NULL;
17291700
_do_not_unlock_if_synchronized = false;
17301701
_cached_monitor_info = NULL;
17311702
_parker = Parker::Allocate(this);
17321703

1733-
#ifndef PRODUCT
1734-
_jmp_ring_index = 0;
1735-
for (int ji = 0; ji < jump_ring_buffer_size; ji++) {
1736-
record_jump(NULL, NULL, NULL, 0);
1737-
}
1738-
#endif // PRODUCT
1739-
17401704
// Setup safepoint state info for this thread
17411705
ThreadSafepointState::create(this);
17421706

@@ -3048,9 +3012,6 @@ const char* _get_thread_state_name(JavaThreadState _thread_state) {
30483012
void JavaThread::print_thread_state_on(outputStream *st) const {
30493013
st->print_cr(" JavaThread state: %s", _get_thread_state_name(_thread_state));
30503014
};
3051-
void JavaThread::print_thread_state() const {
3052-
print_thread_state_on(tty);
3053-
}
30543015
#endif // PRODUCT
30553016

30563017
// Called by Threads::print() for VM_PrintThreads operation
@@ -3171,47 +3132,10 @@ const char* JavaThread::get_thread_name_string(char* buf, int buflen) const {
31713132
return name_str;
31723133
}
31733134

3174-
3175-
const char* JavaThread::get_threadgroup_name() const {
3176-
debug_only(if (JavaThread::current() != this) assert_locked_or_safepoint(Threads_lock);)
3177-
oop thread_obj = threadObj();
3178-
if (thread_obj != NULL) {
3179-
oop thread_group = java_lang_Thread::threadGroup(thread_obj);
3180-
if (thread_group != NULL) {
3181-
// ThreadGroup.name can be null
3182-
return java_lang_ThreadGroup::name(thread_group);
3183-
}
3184-
}
3185-
return NULL;
3186-
}
3187-
3188-
const char* JavaThread::get_parent_name() const {
3189-
debug_only(if (JavaThread::current() != this) assert_locked_or_safepoint(Threads_lock);)
3190-
oop thread_obj = threadObj();
3191-
if (thread_obj != NULL) {
3192-
oop thread_group = java_lang_Thread::threadGroup(thread_obj);
3193-
if (thread_group != NULL) {
3194-
oop parent = java_lang_ThreadGroup::parent(thread_group);
3195-
if (parent != NULL) {
3196-
// ThreadGroup.name can be null
3197-
return java_lang_ThreadGroup::name(parent);
3198-
}
3199-
}
3200-
}
3201-
return NULL;
3202-
}
3203-
3204-
ThreadPriority JavaThread::java_priority() const {
3205-
oop thr_oop = threadObj();
3206-
if (thr_oop == NULL) return NormPriority; // Bootstrapping
3207-
ThreadPriority priority = java_lang_Thread::priority(thr_oop);
3208-
assert(MinPriority <= priority && priority <= MaxPriority, "sanity check");
3209-
return priority;
3210-
}
3211-
32123135
void JavaThread::prepare(jobject jni_thread, ThreadPriority prio) {
32133136

32143137
assert(Threads_lock->owner() == Thread::current(), "must have threads lock");
3138+
assert(NoPriority <= prio && prio <= MaxPriority, "sanity check");
32153139
// Link Java Thread object <-> C++ Thread
32163140

32173141
// Get the C++ thread object (an oop) from the JNI handle (a jthread)
@@ -3351,23 +3275,6 @@ class PrintAndVerifyOopClosure: public OopClosure {
33513275
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
33523276
};
33533277

3354-
3355-
static void oops_print(frame* f, const RegisterMap *map) {
3356-
PrintAndVerifyOopClosure print;
3357-
f->print_value();
3358-
f->oops_do(&print, NULL, (RegisterMap*)map);
3359-
}
3360-
3361-
// Print our all the locations that contain oops and whether they are
3362-
// valid or not. This useful when trying to find the oldest frame
3363-
// where an oop has gone bad since the frame walk is from youngest to
3364-
// oldest.
3365-
void JavaThread::trace_oops() {
3366-
tty->print_cr("[Trace oops]");
3367-
frames_do(oops_print);
3368-
}
3369-
3370-
33713278
#ifdef ASSERT
33723279
// Print or validate the layout of stack frames
33733280
void JavaThread::print_frame_layout(int depth, bool validate_only) {

0 commit comments

Comments
 (0)