Skip to content

Commit d2cd358

Browse files
author
duke
committedJul 13, 2020
Automatic merge of jdk:master into master
2 parents 72a0c3d + 7436ef2 commit d2cd358

14 files changed

+145
-631
lines changed
 

‎src/hotspot/share/runtime/globals.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,6 @@ const size_t minimumSymbolTableSize = 1024;
688688
"Disable the use of stack guard pages if the JVM is loaded " \
689689
"on the primordial process thread") \
690690
\
691-
diagnostic(bool, AsyncDeflateIdleMonitors, true, \
692-
"Deflate idle monitors using the ServiceThread.") \
693-
\
694691
/* notice: the max range value here is max_jint, not max_intx */ \
695692
/* because of overflow issue */ \
696693
diagnostic(intx, AsyncDeflationInterval, 250, \

‎src/hotspot/share/runtime/init.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,8 @@ void exit_globals() {
170170
if (log_is_enabled(Info, monitorinflation)) {
171171
// The ObjectMonitor subsystem uses perf counters so
172172
// do this before perfMemory_exit().
173-
// These other two audit_and_print_stats() calls are done at the
173+
// This other audit_and_print_stats() call is done at the
174174
// Debug level at a safepoint:
175-
// - for safepoint based deflation auditing:
176-
// ObjectSynchronizer::finish_deflate_idle_monitors()
177175
// - for async deflation auditing:
178176
// ObjectSynchronizer::do_safepoint_work()
179177
ObjectSynchronizer::audit_and_print_stats(true /* on_exit */);

‎src/hotspot/share/runtime/objectMonitor.cpp

+14-23
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ bool ObjectMonitor::enter(TRAPS) {
290290
JavaThread * jt = (JavaThread *) Self;
291291
assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
292292
assert(jt->thread_state() != _thread_blocked, "invariant");
293-
assert(AsyncDeflateIdleMonitors || this->object() != NULL, "invariant");
294-
assert(AsyncDeflateIdleMonitors || contentions() >= 0, "must not be negative: contentions=%d", contentions());
295293

296294
// Keep track of contention for JVM/TI and M&M queries.
297295
add_to_contentions(1);
@@ -455,12 +453,12 @@ void ObjectMonitor::install_displaced_markword_in_object(const oop obj) {
455453
// deflation so we're done here.
456454
return;
457455
}
458-
ADIM_guarantee(l_object == obj, "object=" INTPTR_FORMAT " must equal obj="
459-
INTPTR_FORMAT, p2i(l_object), p2i(obj));
456+
assert(l_object == obj, "object=" INTPTR_FORMAT " must equal obj="
457+
INTPTR_FORMAT, p2i(l_object), p2i(obj));
460458

461459
markWord dmw = header();
462460
// The dmw has to be neutral (not NULL, not locked and not marked).
463-
ADIM_guarantee(dmw.is_neutral(), "must be neutral: dmw=" INTPTR_FORMAT, dmw.value());
461+
assert(dmw.is_neutral(), "must be neutral: dmw=" INTPTR_FORMAT, dmw.value());
464462

465463
// Install displaced mark word if the object's header still points
466464
// to this ObjectMonitor. More than one racing caller to this function
@@ -487,22 +485,17 @@ void ObjectMonitor::install_displaced_markword_in_object(const oop obj) {
487485
// used for diagnostic output.
488486
const char* ObjectMonitor::is_busy_to_string(stringStream* ss) {
489487
ss->print("is_busy: waiters=%d, ", _waiters);
490-
if (!AsyncDeflateIdleMonitors) {
488+
if (contentions() > 0) {
491489
ss->print("contentions=%d, ", contentions());
490+
} else {
491+
ss->print("contentions=0");
492+
}
493+
if (_owner != DEFLATER_MARKER) {
492494
ss->print("owner=" INTPTR_FORMAT, p2i(_owner));
493495
} else {
494-
if (contentions() > 0) {
495-
ss->print("contentions=%d, ", contentions());
496-
} else {
497-
ss->print("contentions=0");
498-
}
499-
if (_owner != DEFLATER_MARKER) {
500-
ss->print("owner=" INTPTR_FORMAT, p2i(_owner));
501-
} else {
502-
// We report NULL instead of DEFLATER_MARKER here because is_busy()
503-
// ignores DEFLATER_MARKER values.
504-
ss->print("owner=" INTPTR_FORMAT, NULL);
505-
}
496+
// We report NULL instead of DEFLATER_MARKER here because is_busy()
497+
// ignores DEFLATER_MARKER values.
498+
ss->print("owner=" INTPTR_FORMAT, NULL);
506499
}
507500
ss->print(", cxq=" INTPTR_FORMAT ", EntryList=" INTPTR_FORMAT, p2i(_cxq),
508501
p2i(_EntryList));
@@ -524,8 +517,7 @@ void ObjectMonitor::EnterI(TRAPS) {
524517
return;
525518
}
526519

527-
if (AsyncDeflateIdleMonitors &&
528-
try_set_owner_from(DEFLATER_MARKER, Self) == DEFLATER_MARKER) {
520+
if (try_set_owner_from(DEFLATER_MARKER, Self) == DEFLATER_MARKER) {
529521
// Cancelled the in-progress async deflation by changing owner from
530522
// DEFLATER_MARKER to Self. As part of the contended enter protocol,
531523
// contentions was incremented to a positive value before EnterI()
@@ -659,8 +651,7 @@ void ObjectMonitor::EnterI(TRAPS) {
659651

660652
if (TryLock(Self) > 0) break;
661653

662-
if (AsyncDeflateIdleMonitors &&
663-
try_set_owner_from(DEFLATER_MARKER, Self) == DEFLATER_MARKER) {
654+
if (try_set_owner_from(DEFLATER_MARKER, Self) == DEFLATER_MARKER) {
664655
// Cancelled the in-progress async deflation by changing owner from
665656
// DEFLATER_MARKER to Self. As part of the contended enter protocol,
666657
// contentions was incremented to a positive value before EnterI()
@@ -1007,8 +998,8 @@ void ObjectMonitor::exit(bool not_suspended, TRAPS) {
1007998
" is exiting an ObjectMonitor it does not own.", p2i(THREAD));
1008999
lsh.print_cr("The imbalance is possibly caused by JNI locking.");
10091000
print_debug_style_on(&lsh);
1010-
#endif
10111001
assert(false, "Non-balanced monitor enter/exit!");
1002+
#endif
10121003
return;
10131004
}
10141005
}

‎src/hotspot/share/runtime/objectMonitor.hpp

+7-22
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class ObjectMonitor {
175175
jint _contentions; // Number of active contentions in enter(). It is used by is_busy()
176176
// along with other fields to determine if an ObjectMonitor can be
177177
// deflated. It is also used by the async deflation protocol. See
178-
// ObjectSynchronizer::deflate_monitor() and deflate_monitor_using_JT().
178+
// ObjectSynchronizer::deflate_monitor_using_JT().
179179
protected:
180180
ObjectWaiter* volatile _WaitSet; // LL of threads wait()ing on the monitor
181181
volatile jint _waiters; // number of waiting threads
@@ -243,15 +243,11 @@ class ObjectMonitor {
243243
intptr_t is_busy() const {
244244
// TODO-FIXME: assert _owner == null implies _recursions = 0
245245
intptr_t ret_code = _waiters | intptr_t(_cxq) | intptr_t(_EntryList);
246-
if (!AsyncDeflateIdleMonitors) {
247-
ret_code |= contentions() | intptr_t(_owner);
248-
} else {
249-
if (contentions() > 0) {
250-
ret_code |= contentions();
251-
}
252-
if (_owner != DEFLATER_MARKER) {
253-
ret_code |= intptr_t(_owner);
254-
}
246+
if (contentions() > 0) {
247+
ret_code |= contentions();
248+
}
249+
if (_owner != DEFLATER_MARKER) {
250+
ret_code |= intptr_t(_owner);
255251
}
256252
return ret_code;
257253
}
@@ -315,9 +311,9 @@ class ObjectMonitor {
315311
// _recursions == 0 _WaitSet == NULL
316312
#ifdef ASSERT
317313
stringStream ss;
318-
#endif
319314
assert((is_busy() | _recursions) == 0, "freeing in-use monitor: %s, "
320315
"recursions=" INTX_FORMAT, is_busy_to_string(&ss), _recursions);
316+
#endif
321317
_succ = NULL;
322318
_EntryList = NULL;
323319
_cxq = NULL;
@@ -374,15 +370,4 @@ class ObjectMonitor {
374370
void install_displaced_markword_in_object(const oop obj);
375371
};
376372

377-
// Macro to use guarantee() for more strict AsyncDeflateIdleMonitors
378-
// checks and assert() otherwise.
379-
#define ADIM_guarantee(p, ...) \
380-
do { \
381-
if (AsyncDeflateIdleMonitors) { \
382-
guarantee(p, __VA_ARGS__); \
383-
} else { \
384-
assert(p, __VA_ARGS__); \
385-
} \
386-
} while (0)
387-
388373
#endif // SHARE_RUNTIME_OBJECTMONITOR_HPP

‎src/hotspot/share/runtime/objectMonitor.inline.hpp

+26-22
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ inline bool ObjectMonitor::owner_is_DEFLATER_MARKER() {
6767

6868
// Returns true if 'this' is being async deflated and false otherwise.
6969
inline bool ObjectMonitor::is_being_async_deflated() {
70-
return AsyncDeflateIdleMonitors && contentions() < 0;
70+
return contentions() < 0;
7171
}
7272

7373
inline void ObjectMonitor::clear() {
@@ -80,17 +80,15 @@ inline void ObjectMonitor::clear() {
8080
}
8181

8282
inline void ObjectMonitor::clear_common() {
83-
if (AsyncDeflateIdleMonitors) {
84-
// Async deflation protocol uses the header, owner and contentions
85-
// fields. While the ObjectMonitor being deflated is on the global
86-
// free list, we leave those three fields alone; contentions < 0
87-
// will force any racing threads to retry. The header field is used
88-
// by install_displaced_markword_in_object() to restore the object's
89-
// header so we cannot check its value here.
90-
guarantee(_owner == NULL || _owner == DEFLATER_MARKER,
91-
"must be NULL or DEFLATER_MARKER: owner=" INTPTR_FORMAT,
92-
p2i(_owner));
93-
}
83+
// Async deflation protocol uses the header, owner and contentions
84+
// fields. While the ObjectMonitor being deflated is on the global
85+
// free list, we leave those three fields alone; contentions < 0
86+
// will force any racing threads to retry. The header field is used
87+
// by install_displaced_markword_in_object() to restore the object's
88+
// header so we cannot check its value here.
89+
guarantee(_owner == NULL || _owner == DEFLATER_MARKER,
90+
"must be NULL or DEFLATER_MARKER: owner=" INTPTR_FORMAT,
91+
p2i(_owner));
9492
assert(contentions() <= 0, "must not be positive: contentions=%d", contentions());
9593
assert(_waiters == 0, "must be 0: waiters=%d", _waiters);
9694
assert(_recursions == 0, "must be 0: recursions=" INTX_FORMAT, _recursions);
@@ -124,9 +122,11 @@ inline void ObjectMonitor::add_to_contentions(jint value) {
124122

125123
// Clear _owner field; current value must match old_value.
126124
inline void ObjectMonitor::release_clear_owner(void* old_value) {
125+
#ifdef ASSERT
127126
void* prev = Atomic::load(&_owner);
128-
ADIM_guarantee(prev == old_value, "unexpected prev owner=" INTPTR_FORMAT
129-
", expected=" INTPTR_FORMAT, p2i(prev), p2i(old_value));
127+
assert(prev == old_value, "unexpected prev owner=" INTPTR_FORMAT
128+
", expected=" INTPTR_FORMAT, p2i(prev), p2i(old_value));
129+
#endif
130130
Atomic::release_store(&_owner, (void*)NULL);
131131
log_trace(monitorinflation, owner)("release_clear_owner(): mid="
132132
INTPTR_FORMAT ", old_value=" INTPTR_FORMAT,
@@ -136,9 +136,11 @@ inline void ObjectMonitor::release_clear_owner(void* old_value) {
136136
// Simply set _owner field to new_value; current value must match old_value.
137137
// (Simple means no memory sync needed.)
138138
inline void ObjectMonitor::set_owner_from(void* old_value, void* new_value) {
139+
#ifdef ASSERT
139140
void* prev = Atomic::load(&_owner);
140-
ADIM_guarantee(prev == old_value, "unexpected prev owner=" INTPTR_FORMAT
141-
", expected=" INTPTR_FORMAT, p2i(prev), p2i(old_value));
141+
assert(prev == old_value, "unexpected prev owner=" INTPTR_FORMAT
142+
", expected=" INTPTR_FORMAT, p2i(prev), p2i(old_value));
143+
#endif
142144
Atomic::store(&_owner, new_value);
143145
log_trace(monitorinflation, owner)("set_owner_from(): mid="
144146
INTPTR_FORMAT ", old_value=" INTPTR_FORMAT
@@ -150,10 +152,10 @@ inline void ObjectMonitor::set_owner_from(void* old_value, void* new_value) {
150152
// (Simple means no memory sync needed.)
151153
inline void ObjectMonitor::set_owner_from(void* old_value1, void* old_value2, void* new_value) {
152154
void* prev = Atomic::load(&_owner);
153-
ADIM_guarantee(prev == old_value1 || prev == old_value2,
154-
"unexpected prev owner=" INTPTR_FORMAT ", expected1="
155-
INTPTR_FORMAT " or expected2=" INTPTR_FORMAT, p2i(prev),
156-
p2i(old_value1), p2i(old_value2));
155+
assert(prev == old_value1 || prev == old_value2,
156+
"unexpected prev owner=" INTPTR_FORMAT ", expected1="
157+
INTPTR_FORMAT " or expected2=" INTPTR_FORMAT, p2i(prev),
158+
p2i(old_value1), p2i(old_value2));
157159
_owner = new_value;
158160
log_trace(monitorinflation, owner)("set_owner_from(old1=" INTPTR_FORMAT
159161
", old2=" INTPTR_FORMAT "): mid="
@@ -165,9 +167,11 @@ inline void ObjectMonitor::set_owner_from(void* old_value1, void* old_value2, vo
165167

166168
// Simply set _owner field to self; current value must match basic_lock_p.
167169
inline void ObjectMonitor::set_owner_from_BasicLock(void* basic_lock_p, Thread* self) {
170+
#ifdef ASSERT
168171
void* prev = Atomic::load(&_owner);
169-
ADIM_guarantee(prev == basic_lock_p, "unexpected prev owner=" INTPTR_FORMAT
170-
", expected=" INTPTR_FORMAT, p2i(prev), p2i(basic_lock_p));
172+
assert(prev == basic_lock_p, "unexpected prev owner=" INTPTR_FORMAT
173+
", expected=" INTPTR_FORMAT, p2i(prev), p2i(basic_lock_p));
174+
#endif
171175
// Non-null owner field to non-null owner field is safe without
172176
// cmpxchg() as long as all readers can tolerate either flavor.
173177
Atomic::store(&_owner, self);

‎src/hotspot/share/runtime/safepoint.cpp

+6-45
Original file line numberDiff line numberDiff line change
@@ -490,61 +490,31 @@ void SafepointSynchronize::end() {
490490
}
491491

492492
bool SafepointSynchronize::is_cleanup_needed() {
493-
// Need a cleanup safepoint if there are too many monitors in use
494-
// and the monitor deflation needs to be done at a safepoint.
495-
if (ObjectSynchronizer::is_safepoint_deflation_needed()) return true;
496493
// Need a safepoint if some inline cache buffers is non-empty
497494
if (!InlineCacheBuffer::is_empty()) return true;
498495
if (StringTable::needs_rehashing()) return true;
499496
if (SymbolTable::needs_rehashing()) return true;
500497
return false;
501498
}
502499

503-
class ParallelSPCleanupThreadClosure : public ThreadClosure {
504-
private:
505-
DeflateMonitorCounters* _counters;
506-
507-
public:
508-
ParallelSPCleanupThreadClosure(DeflateMonitorCounters* counters) :
509-
_counters(counters) {}
510-
511-
void do_thread(Thread* thread) {
512-
// deflate_thread_local_monitors() handles or requests deflation of
513-
// this thread's idle monitors. If !AsyncDeflateIdleMonitors or if
514-
// there is a special cleanup request, deflation is handled now.
515-
// Otherwise, async deflation is requested via a flag.
516-
ObjectSynchronizer::deflate_thread_local_monitors(thread, _counters);
517-
}
518-
};
519-
520500
class ParallelSPCleanupTask : public AbstractGangTask {
521501
private:
522502
SubTasksDone _subtasks;
523-
ParallelSPCleanupThreadClosure _cleanup_threads_cl;
524503
uint _num_workers;
525-
DeflateMonitorCounters* _counters;
526504
public:
527-
ParallelSPCleanupTask(uint num_workers, DeflateMonitorCounters* counters) :
505+
ParallelSPCleanupTask(uint num_workers) :
528506
AbstractGangTask("Parallel Safepoint Cleanup"),
529507
_subtasks(SafepointSynchronize::SAFEPOINT_CLEANUP_NUM_TASKS),
530-
_cleanup_threads_cl(ParallelSPCleanupThreadClosure(counters)),
531-
_num_workers(num_workers),
532-
_counters(counters) {}
508+
_num_workers(num_workers) {}
533509

534510
void work(uint worker_id) {
535511
uint64_t safepoint_id = SafepointSynchronize::safepoint_id();
536-
// All threads deflate monitors and mark nmethods (if necessary).
537-
Threads::possibly_parallel_threads_do(true, &_cleanup_threads_cl);
538512

539513
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
540-
const char* name = "deflating global idle monitors";
514+
const char* name = "deflating idle monitors";
541515
EventSafepointCleanupTask event;
542516
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
543-
// AsyncDeflateIdleMonitors only uses DeflateMonitorCounters
544-
// when a special cleanup has been requested.
545-
// Note: This logging output will include global idle monitor
546-
// elapsed times, but not global idle monitor deflation count.
547-
ObjectSynchronizer::do_safepoint_work(_counters);
517+
ObjectSynchronizer::do_safepoint_work();
548518

549519
post_safepoint_cleanup_task_event(event, safepoint_id, name);
550520
}
@@ -615,23 +585,17 @@ void SafepointSynchronize::do_cleanup_tasks() {
615585

616586
TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
617587

618-
// Prepare for monitor deflation.
619-
DeflateMonitorCounters deflate_counters;
620-
ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
621-
622588
CollectedHeap* heap = Universe::heap();
623589
assert(heap != NULL, "heap not initialized yet?");
624590
WorkGang* cleanup_workers = heap->get_safepoint_workers();
625591
if (cleanup_workers != NULL) {
626592
// Parallel cleanup using GC provided thread pool.
627593
uint num_cleanup_workers = cleanup_workers->active_workers();
628-
ParallelSPCleanupTask cleanup(num_cleanup_workers, &deflate_counters);
629-
StrongRootsScope srs(num_cleanup_workers);
594+
ParallelSPCleanupTask cleanup(num_cleanup_workers);
630595
cleanup_workers->run_task(&cleanup);
631596
} else {
632597
// Serial cleanup using VMThread.
633-
ParallelSPCleanupTask cleanup(1, &deflate_counters);
634-
StrongRootsScope srs(1);
598+
ParallelSPCleanupTask cleanup(1);
635599
cleanup.work(0);
636600
}
637601

@@ -644,9 +608,6 @@ void SafepointSynchronize::do_cleanup_tasks() {
644608
ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces();
645609
}
646610

647-
// Finish monitor deflation.
648-
ObjectSynchronizer::finish_deflate_idle_monitors(&deflate_counters);
649-
650611
assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
651612
}
652613

‎src/hotspot/share/runtime/serviceThread.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
142142
(deflate_idle_monitors = ObjectSynchronizer::is_async_deflation_needed())
143143
) == 0) {
144144
// Wait until notified that there is some work to do.
145-
// If AsyncDeflateIdleMonitors, then we wait for
146-
// GuaranteedSafepointInterval so that is_async_deflation_needed()
147-
// is checked at the same interval.
148-
ml.wait(AsyncDeflateIdleMonitors ? GuaranteedSafepointInterval : 0);
145+
// We wait for GuaranteedSafepointInterval so that
146+
// is_async_deflation_needed() is checked at the same interval.
147+
ml.wait(GuaranteedSafepointInterval);
149148
}
150149

151150
if (has_jvmti_events) {

‎src/hotspot/share/runtime/synchronizer.cpp

+77-434
Large diffs are not rendered by default.

‎src/hotspot/share/runtime/synchronizer.hpp

+2-23
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ class ThreadsList;
4242

4343
typedef PaddedEnd<ObjectMonitor, OM_CACHE_LINE_SIZE> PaddedObjectMonitor;
4444

45-
struct DeflateMonitorCounters {
46-
volatile int n_in_use; // currently associated with objects
47-
volatile int n_in_circulation; // extant
48-
volatile int n_scavenged; // reclaimed (global and per-thread)
49-
volatile int per_thread_scavenged; // per-thread scavenge total
50-
double per_thread_times; // per-thread scavenge times
51-
};
52-
5345
class ObjectSynchronizer : AllStatic {
5446
friend class VMStructs;
5547
public:
@@ -131,35 +123,22 @@ class ObjectSynchronizer : AllStatic {
131123
// GC: we current use aggressive monitor deflation policy
132124
// Basically we deflate all monitors that are not busy.
133125
// An adaptive profile-based deflation policy could be used if needed
134-
static void deflate_idle_monitors(DeflateMonitorCounters* counters);
135126
static void deflate_idle_monitors_using_JT();
136127
static void deflate_global_idle_monitors_using_JT();
137128
static void deflate_per_thread_idle_monitors_using_JT(JavaThread* target);
138129
static void deflate_common_idle_monitors_using_JT(bool is_global, JavaThread* target);
139-
static void deflate_thread_local_monitors(Thread* thread, DeflateMonitorCounters* counters);
140-
static void prepare_deflate_idle_monitors(DeflateMonitorCounters* counters);
141-
static void finish_deflate_idle_monitors(DeflateMonitorCounters* counters);
142-
143-
// For a given monitor list: global or per-thread, deflate idle monitors
144-
static int deflate_monitor_list(ObjectMonitor** list_p,
145-
int* count_p,
146-
ObjectMonitor** free_head_p,
147-
ObjectMonitor** free_tail_p);
130+
148131
// For a given in-use monitor list: global or per-thread, deflate idle
149132
// monitors using a JavaThread.
150133
static int deflate_monitor_list_using_JT(ObjectMonitor** list_p,
151134
int* count_p,
152135
ObjectMonitor** free_head_p,
153136
ObjectMonitor** free_tail_p,
154137
ObjectMonitor** saved_mid_in_use_p);
155-
static bool deflate_monitor(ObjectMonitor* mid, oop obj,
156-
ObjectMonitor** free_head_p,
157-
ObjectMonitor** free_tail_p);
158138
static bool deflate_monitor_using_JT(ObjectMonitor* mid,
159139
ObjectMonitor** free_head_p,
160140
ObjectMonitor** free_tail_p);
161141
static bool is_async_deflation_needed();
162-
static bool is_safepoint_deflation_needed();
163142
static bool is_async_deflation_requested() { return _is_async_deflation_requested; }
164143
static jlong last_async_deflation_time_ns() { return _last_async_deflation_time_ns; }
165144
static bool request_deflate_idle_monitors(); // for whitebox test support and VM exit logging
@@ -191,7 +170,7 @@ class ObjectSynchronizer : AllStatic {
191170
static int log_monitor_list_counts(outputStream * out);
192171
static int verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
193172

194-
static void do_safepoint_work(DeflateMonitorCounters* counters);
173+
static void do_safepoint_work();
195174

196175
private:
197176
friend class SynchronizerTest;

‎src/hotspot/share/runtime/vmOperations.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,10 @@ int VM_Exit::wait_for_threads_in_native_to_block() {
431431
}
432432

433433
bool VM_Exit::doit_prologue() {
434-
if (AsyncDeflateIdleMonitors && log_is_enabled(Info, monitorinflation)) {
435-
// AsyncDeflateIdleMonitors does a special deflation in order
436-
// to reduce the in-use monitor population that is reported by
437-
// ObjectSynchronizer::log_in_use_monitor_details() at VM exit.
434+
if (log_is_enabled(Info, monitorinflation)) {
435+
// Do a deflation in order to reduce the in-use monitor population
436+
// that is reported by ObjectSynchronizer::log_in_use_monitor_details()
437+
// at VM exit.
438438
ObjectSynchronizer::request_deflate_idle_monitors();
439439
}
440440
return true;

‎src/hotspot/share/runtime/vmThread.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ void VMThread::run() {
260260
assert(should_terminate(), "termination flag must be set");
261261
}
262262

263-
if (AsyncDeflateIdleMonitors && log_is_enabled(Info, monitorinflation)) {
264-
// AsyncDeflateIdleMonitors does a special deflation in order
265-
// to reduce the in-use monitor population that is reported by
266-
// ObjectSynchronizer::log_in_use_monitor_details() at VM exit.
263+
if (log_is_enabled(Info, monitorinflation)) {
264+
// Do a deflation in order to reduce the in-use monitor population
265+
// that is reported by ObjectSynchronizer::log_in_use_monitor_details()
266+
// at VM exit.
267267
ObjectSynchronizer::request_deflate_idle_monitors();
268268
}
269269

‎src/hotspot/share/services/threadService.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,11 @@ Handle ThreadService::get_current_contended_monitor(JavaThread* thread) {
222222
if (wait_obj != NULL) {
223223
// thread is doing an Object.wait() call
224224
obj = (oop) wait_obj->object();
225-
assert(AsyncDeflateIdleMonitors || obj != NULL, "Object.wait() should have an object");
226225
} else {
227226
ObjectMonitor *enter_obj = thread->current_pending_monitor();
228227
if (enter_obj != NULL) {
229228
// thread is trying to enter() an ObjectMonitor.
230229
obj = (oop) enter_obj->object();
231-
assert(AsyncDeflateIdleMonitors || obj != NULL, "ObjectMonitor should have an associated object!");
232230
}
233231
}
234232

‎test/hotspot/gtest/oops/test_markWord.cpp

-14
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,5 @@ TEST_VM(markWord, printing) {
138138
assert_test_pattern(h_obj, "monitor");
139139
done.wait_with_safepoint_check(THREAD); // wait till the thread is done.
140140
}
141-
142-
if (!AsyncDeflateIdleMonitors) {
143-
// With AsyncDeflateIdleMonitors, the collect() call below
144-
// does not guarantee monitor deflation.
145-
// Make the object older. Not all GCs use this field.
146-
Universe::heap()->collect(GCCause::_java_lang_system_gc);
147-
if (UseParallelGC) {
148-
assert_test_pattern(h_obj, "is_neutral no_hash age 1");
149-
}
150-
151-
// Hash the object then print it.
152-
intx hash = h_obj->identity_hash();
153-
assert_test_pattern(h_obj, "is_neutral hash=0x");
154-
}
155141
}
156142
#endif // PRODUCT

‎test/hotspot/jtreg/runtime/logging/SafepointCleanupTest.java

+1-28
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,17 @@
2929
* @modules java.base/jdk.internal.misc
3030
* java.management
3131
* @run driver SafepointCleanupTest
32-
* @run driver SafepointCleanupTest -XX:+AsyncDeflateIdleMonitors
3332
*/
3433

3534
import jdk.test.lib.process.OutputAnalyzer;
3635
import jdk.test.lib.process.ProcessTools;
3736

3837
public class SafepointCleanupTest {
39-
static final String ASYNC_DISABLE_OPTION = "-XX:-AsyncDeflateIdleMonitors";
40-
static final String ASYNC_ENABLE_OPTION = "-XX:+AsyncDeflateIdleMonitors";
41-
static final String UNLOCK_DIAG_OPTION = "-XX:+UnlockDiagnosticVMOptions";
42-
4338
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
4439
OutputAnalyzer output = new OutputAnalyzer(pb.start());
4540
output.shouldContain("[safepoint,cleanup]");
4641
output.shouldContain("safepoint cleanup tasks");
47-
output.shouldContain("deflating global idle monitors");
48-
output.shouldContain("deflating per-thread idle monitors");
42+
output.shouldContain("deflating idle monitors");
4943
output.shouldContain("updating inline caches");
5044
output.shouldContain("compilation policy safepoint handler");
5145
output.shouldHaveExitValue(0);
@@ -58,40 +52,19 @@ static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
5852
}
5953

6054
public static void main(String[] args) throws Exception {
61-
String async_option;
62-
if (args.length == 0) {
63-
// By default test deflating idle monitors at a safepoint.
64-
async_option = ASYNC_DISABLE_OPTION;
65-
} else {
66-
async_option = args[0];
67-
}
68-
if (!async_option.equals(ASYNC_DISABLE_OPTION) &&
69-
!async_option.equals(ASYNC_ENABLE_OPTION)) {
70-
throw new RuntimeException("Unknown async_option value: '"
71-
+ async_option + "'");
72-
}
73-
7455
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=info",
75-
UNLOCK_DIAG_OPTION,
76-
async_option,
7756
InnerClass.class.getName());
7857
analyzeOutputOn(pb);
7958

8059
pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceSafepointCleanupTime",
81-
UNLOCK_DIAG_OPTION,
82-
async_option,
8360
InnerClass.class.getName());
8461
analyzeOutputOn(pb);
8562

8663
pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=off",
87-
UNLOCK_DIAG_OPTION,
88-
async_option,
8964
InnerClass.class.getName());
9065
analyzeOutputOff(pb);
9166

9267
pb = ProcessTools.createJavaProcessBuilder("-XX:-TraceSafepointCleanupTime",
93-
UNLOCK_DIAG_OPTION,
94-
async_option,
9568
InnerClass.class.getName());
9669
analyzeOutputOff(pb);
9770
}

0 commit comments

Comments
 (0)
Please sign in to comment.