@@ -81,14 +81,6 @@ void ReferenceProcessor::enable_discovery(bool check_no_refs) {
81
81
}
82
82
#endif // ASSERT
83
83
84
- // Someone could have modified the value of the static
85
- // field in the j.l.r.SoftReference class that holds the
86
- // soft reference timestamp clock using reflection or
87
- // Unsafe between GCs. Unconditionally update the static
88
- // field in ReferenceProcessor here so that we use the new
89
- // value during reference discovery.
90
-
91
- _soft_ref_timestamp_clock = java_lang_ref_SoftReference::clock ();
92
84
_discovering_refs = true ;
93
85
}
94
86
@@ -156,8 +148,6 @@ void ReferenceProcessor::update_soft_ref_master_clock() {
156
148
// We need a monotonically non-decreasing time in ms but
157
149
// os::javaTimeMillis() does not guarantee monotonicity.
158
150
jlong now = os::javaTimeNanos () / NANOSECS_PER_MILLISEC;
159
- jlong soft_ref_clock = java_lang_ref_SoftReference::clock ();
160
- assert (soft_ref_clock == _soft_ref_timestamp_clock, " soft ref clocks out of sync" );
161
151
162
152
NOT_PRODUCT (
163
153
if (now < _soft_ref_timestamp_clock) {
@@ -201,26 +191,11 @@ ReferenceProcessorStats ReferenceProcessor::process_discovered_references(RefPro
201
191
// Stop treating discovered references specially.
202
192
disable_discovery ();
203
193
204
- // If discovery was concurrent, someone could have modified
205
- // the value of the static field in the j.l.r.SoftReference
206
- // class that holds the soft reference timestamp clock using
207
- // reflection or Unsafe between when discovery was enabled and
208
- // now. Unconditionally update the static field in ReferenceProcessor
209
- // here so that we use the new value during processing of the
210
- // discovered soft refs.
211
-
212
- _soft_ref_timestamp_clock = java_lang_ref_SoftReference::clock ();
213
-
214
194
ReferenceProcessorStats stats (total_count (_discoveredSoftRefs),
215
195
total_count (_discoveredWeakRefs),
216
196
total_count (_discoveredFinalRefs),
217
197
total_count (_discoveredPhantomRefs));
218
198
219
- {
220
- RefProcTotalPhaseTimesTracker tt (RefPhase1, &phase_times);
221
- process_soft_ref_reconsider (proxy_task, phase_times);
222
- }
223
-
224
199
update_soft_ref_master_clock ();
225
200
226
201
{
@@ -329,37 +304,6 @@ inline void log_enqueued_ref(const DiscoveredListIterator& iter, const char* rea
329
304
assert (oopDesc::is_oop (iter.obj ()), " Adding a bad reference" );
330
305
}
331
306
332
- size_t ReferenceProcessor::process_soft_ref_reconsider_work (DiscoveredList& refs_list,
333
- ReferencePolicy* policy,
334
- BoolObjectClosure* is_alive,
335
- OopClosure* keep_alive,
336
- VoidClosure* complete_gc) {
337
- assert (policy != NULL , " Must have a non-NULL policy" );
338
- DiscoveredListIterator iter (refs_list, keep_alive, is_alive);
339
- // Decide which softly reachable refs should be kept alive.
340
- while (iter.has_next ()) {
341
- iter.load_ptrs (DEBUG_ONLY (!discovery_is_atomic () /* allow_null_referent */ ));
342
- bool referent_is_dead = (iter.referent () != NULL ) && !iter.is_referent_alive ();
343
- if (referent_is_dead &&
344
- !policy->should_clear_reference (iter.obj (), _soft_ref_timestamp_clock)) {
345
- log_dropped_ref (iter, " by policy" );
346
- // Remove Reference object from list
347
- iter.remove ();
348
- // keep the referent around
349
- iter.make_referent_alive ();
350
- iter.move_to_next ();
351
- } else {
352
- iter.next ();
353
- }
354
- }
355
- // Close the reachable set
356
- complete_gc->do_void ();
357
-
358
- log_develop_trace (gc, ref)(" Dropped " SIZE_FORMAT " dead Refs out of " SIZE_FORMAT " discovered Refs by policy, from list " INTPTR_FORMAT,
359
- iter.removed (), iter.processed (), p2i (&refs_list));
360
- return iter.removed ();
361
- }
362
-
363
307
size_t ReferenceProcessor::process_soft_weak_final_refs_work (DiscoveredList& refs_list,
364
308
BoolObjectClosure* is_alive,
365
309
OopClosure* keep_alive,
@@ -508,34 +452,6 @@ size_t ReferenceProcessor::total_reference_count(ReferenceType type) const {
508
452
}
509
453
510
454
511
-
512
- class RefProcPhase1Task : public RefProcTask {
513
- public:
514
- RefProcPhase1Task (ReferenceProcessor& ref_processor,
515
- ReferenceProcessorPhaseTimes* phase_times,
516
- ReferencePolicy* policy)
517
- : RefProcTask(ref_processor,
518
- phase_times),
519
- _policy (policy) { }
520
-
521
- void rp_work (uint worker_id,
522
- BoolObjectClosure* is_alive,
523
- OopClosure* keep_alive,
524
- VoidClosure* complete_gc) override {
525
- ResourceMark rm;
526
- RefProcSubPhasesWorkerTimeTracker tt (ReferenceProcessor::SoftRefSubPhase1, _phase_times, tracker_id (worker_id));
527
- size_t const removed = _ref_processor.process_soft_ref_reconsider_work (_ref_processor._discoveredSoftRefs [worker_id],
528
- _policy,
529
- is_alive,
530
- keep_alive,
531
- complete_gc);
532
- _phase_times->add_ref_cleared (REF_SOFT, removed);
533
- }
534
-
535
- private:
536
- ReferencePolicy* _policy;
537
- };
538
-
539
455
class RefProcPhase2Task : public RefProcTask {
540
456
void run_phase2 (uint worker_id,
541
457
DiscoveredList list[],
@@ -791,38 +707,6 @@ void ReferenceProcessor::run_task(RefProcTask& task, RefProcProxyTask& proxy_tas
791
707
}
792
708
}
793
709
794
- void ReferenceProcessor::process_soft_ref_reconsider (RefProcProxyTask& proxy_task,
795
- ReferenceProcessorPhaseTimes& phase_times) {
796
-
797
- size_t const num_soft_refs = total_count (_discoveredSoftRefs);
798
- phase_times.set_ref_discovered (REF_SOFT, num_soft_refs);
799
- phase_times.set_processing_is_mt (processing_is_mt ());
800
-
801
- if (num_soft_refs == 0 ) {
802
- log_debug (gc, ref)(" Skipped phase 1 of Reference Processing: no references" );
803
- return ;
804
- }
805
-
806
- if (_current_soft_ref_policy == NULL ) {
807
- log_debug (gc, ref)(" Skipped phase 1 of Reference Processing: no policy" );
808
- return ;
809
- }
810
-
811
- RefProcMTDegreeAdjuster a (this , RefPhase1, num_soft_refs);
812
-
813
- if (processing_is_mt ()) {
814
- RefProcBalanceQueuesTimeTracker tt (RefPhase1, &phase_times);
815
- maybe_balance_queues (_discoveredSoftRefs);
816
- }
817
-
818
- RefProcPhaseTimeTracker tt (RefPhase1, &phase_times);
819
-
820
- log_reflist (" Phase 1 Soft before" , _discoveredSoftRefs, _max_num_queues);
821
- RefProcPhase1Task phase1 (*this , &phase_times, _current_soft_ref_policy);
822
- run_task (phase1, proxy_task, true );
823
- log_reflist (" Phase 1 Soft after" , _discoveredSoftRefs, _max_num_queues);
824
- }
825
-
826
710
void ReferenceProcessor::process_soft_weak_final_refs (RefProcProxyTask& proxy_task,
827
711
ReferenceProcessorPhaseTimes& phase_times) {
828
712
@@ -1305,8 +1189,8 @@ uint RefProcMTDegreeAdjuster::ergo_proc_thread_count(size_t ref_count,
1305
1189
}
1306
1190
1307
1191
bool RefProcMTDegreeAdjuster::use_max_threads (RefProcPhases phase) const {
1308
- // Even a small number of references in either of those cases could produce large amounts of work.
1309
- return ( phase == ReferenceProcessor::RefPhase1 || phase == ReferenceProcessor:: RefPhase3) ;
1192
+ // Even a small number of references in this phase could produce large amounts of work.
1193
+ return phase == ReferenceProcessor::RefPhase3;
1310
1194
}
1311
1195
1312
1196
RefProcMTDegreeAdjuster::RefProcMTDegreeAdjuster (ReferenceProcessor* rp,
0 commit comments