comparison src/share/vm/memory/referenceProcessor.cpp @ 14309:63a4eb8bcd23

8025856: Fix typos in the GC code Summary: Fix about 440 typos in comments in the VM code Reviewed-by: mgerdin, tschatzl, coleenp, kmo, jcoomes
author jwilhelm
date Thu, 23 Jan 2014 14:47:23 +0100
parents fbc1677398c0
children 2cff20331ca2
comparison
equal deleted inserted replaced
14308:870aedf4ba4f 14309:63a4eb8bcd23
43 void referenceProcessor_init() { 43 void referenceProcessor_init() {
44 ReferenceProcessor::init_statics(); 44 ReferenceProcessor::init_statics();
45 } 45 }
46 46
47 void ReferenceProcessor::init_statics() { 47 void ReferenceProcessor::init_statics() {
48 // We need a monotonically non-deccreasing time in ms but 48 // We need a monotonically non-decreasing time in ms but
49 // os::javaTimeMillis() does not guarantee monotonicity. 49 // os::javaTimeMillis() does not guarantee monotonicity.
50 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; 50 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
51 51
52 // Initialize the soft ref timestamp clock. 52 // Initialize the soft ref timestamp clock.
53 _soft_ref_timestamp_clock = now; 53 _soft_ref_timestamp_clock = now;
150 150
151 void ReferenceProcessor::update_soft_ref_master_clock() { 151 void ReferenceProcessor::update_soft_ref_master_clock() {
152 // Update (advance) the soft ref master clock field. This must be done 152 // Update (advance) the soft ref master clock field. This must be done
153 // after processing the soft ref list. 153 // after processing the soft ref list.
154 154
155 // We need a monotonically non-deccreasing time in ms but 155 // We need a monotonically non-decreasing time in ms but
156 // os::javaTimeMillis() does not guarantee monotonicity. 156 // os::javaTimeMillis() does not guarantee monotonicity.
157 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; 157 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
158 jlong soft_ref_clock = java_lang_ref_SoftReference::clock(); 158 jlong soft_ref_clock = java_lang_ref_SoftReference::clock();
159 assert(soft_ref_clock == _soft_ref_timestamp_clock, "soft ref clocks out of sync"); 159 assert(soft_ref_clock == _soft_ref_timestamp_clock, "soft ref clocks out of sync");
160 160
166 ) 166 )
167 // The values of now and _soft_ref_timestamp_clock are set using 167 // The values of now and _soft_ref_timestamp_clock are set using
168 // javaTimeNanos(), which is guaranteed to be monotonically 168 // javaTimeNanos(), which is guaranteed to be monotonically
169 // non-decreasing provided the underlying platform provides such 169 // non-decreasing provided the underlying platform provides such
170 // a time source (and it is bug free). 170 // a time source (and it is bug free).
171 // In product mode, however, protect ourselves from non-monotonicty. 171 // In product mode, however, protect ourselves from non-monotonicity.
172 if (now > _soft_ref_timestamp_clock) { 172 if (now > _soft_ref_timestamp_clock) {
173 _soft_ref_timestamp_clock = now; 173 _soft_ref_timestamp_clock = now;
174 java_lang_ref_SoftReference::set_clock(now); 174 java_lang_ref_SoftReference::set_clock(now);
175 } 175 }
176 // Else leave clock stalled at its old value until time progresses 176 // Else leave clock stalled at its old value until time progresses
347 INTPTR_FORMAT, (address)refs_list.head()); 347 INTPTR_FORMAT, (address)refs_list.head());
348 } 348 }
349 349
350 oop obj = NULL; 350 oop obj = NULL;
351 oop next_d = refs_list.head(); 351 oop next_d = refs_list.head();
352 if (pending_list_uses_discovered_field()) { // New behaviour 352 if (pending_list_uses_discovered_field()) { // New behavior
353 // Walk down the list, self-looping the next field 353 // Walk down the list, self-looping the next field
354 // so that the References are not considered active. 354 // so that the References are not considered active.
355 while (obj != next_d) { 355 while (obj != next_d) {
356 obj = next_d; 356 obj = next_d;
357 assert(obj->is_instanceRef(), "should be reference object"); 357 assert(obj->is_instanceRef(), "should be reference object");
364 "Reference not active; should not be discovered"); 364 "Reference not active; should not be discovered");
365 // Self-loop next, so as to make Ref not active. 365 // Self-loop next, so as to make Ref not active.
366 // Post-barrier not needed when looping to self. 366 // Post-barrier not needed when looping to self.
367 java_lang_ref_Reference::set_next_raw(obj, obj); 367 java_lang_ref_Reference::set_next_raw(obj, obj);
368 if (next_d == obj) { // obj is last 368 if (next_d == obj) { // obj is last
369 // Swap refs_list into pendling_list_addr and 369 // Swap refs_list into pending_list_addr and
370 // set obj's discovered to what we read from pending_list_addr. 370 // set obj's discovered to what we read from pending_list_addr.
371 oop old = oopDesc::atomic_exchange_oop(refs_list.head(), pending_list_addr); 371 oop old = oopDesc::atomic_exchange_oop(refs_list.head(), pending_list_addr);
372 // Need post-barrier on pending_list_addr above; 372 // Need post-barrier on pending_list_addr above;
373 // see special post-barrier code at the end of 373 // see special post-barrier code at the end of
374 // enqueue_discovered_reflists() further below. 374 // enqueue_discovered_reflists() further below.
375 java_lang_ref_Reference::set_discovered_raw(obj, old); // old may be NULL 375 java_lang_ref_Reference::set_discovered_raw(obj, old); // old may be NULL
376 oopDesc::bs()->write_ref_field(java_lang_ref_Reference::discovered_addr(obj), old); 376 oopDesc::bs()->write_ref_field(java_lang_ref_Reference::discovered_addr(obj), old);
377 } 377 }
378 } 378 }
379 } else { // Old behaviour 379 } else { // Old behavior
380 // Walk down the list, copying the discovered field into 380 // Walk down the list, copying the discovered field into
381 // the next field and clearing the discovered field. 381 // the next field and clearing the discovered field.
382 while (obj != next_d) { 382 while (obj != next_d) {
383 obj = next_d; 383 obj = next_d;
384 assert(obj->is_instanceRef(), "should be reference object"); 384 assert(obj->is_instanceRef(), "should be reference object");
388 (void *)obj, (void *)next_d); 388 (void *)obj, (void *)next_d);
389 } 389 }
390 assert(java_lang_ref_Reference::next(obj) == NULL, 390 assert(java_lang_ref_Reference::next(obj) == NULL,
391 "The reference should not be enqueued"); 391 "The reference should not be enqueued");
392 if (next_d == obj) { // obj is last 392 if (next_d == obj) { // obj is last
393 // Swap refs_list into pendling_list_addr and 393 // Swap refs_list into pending_list_addr and
394 // set obj's next to what we read from pending_list_addr. 394 // set obj's next to what we read from pending_list_addr.
395 oop old = oopDesc::atomic_exchange_oop(refs_list.head(), pending_list_addr); 395 oop old = oopDesc::atomic_exchange_oop(refs_list.head(), pending_list_addr);
396 // Need oop_check on pending_list_addr above; 396 // Need oop_check on pending_list_addr above;
397 // see special oop-check code at the end of 397 // see special oop-check code at the end of
398 // enqueue_discovered_reflists() further below. 398 // enqueue_discovered_reflists() further below.
1339 1339
1340 // Walk the given discovered ref list, and remove all reference objects 1340 // Walk the given discovered ref list, and remove all reference objects
1341 // whose referents are still alive, whose referents are NULL or which 1341 // whose referents are still alive, whose referents are NULL or which
1342 // are not active (have a non-NULL next field). NOTE: When we are 1342 // are not active (have a non-NULL next field). NOTE: When we are
1343 // thus precleaning the ref lists (which happens single-threaded today), 1343 // thus precleaning the ref lists (which happens single-threaded today),
1344 // we do not disable refs discovery to honour the correct semantics of 1344 // we do not disable refs discovery to honor the correct semantics of
1345 // java.lang.Reference. As a result, we need to be careful below 1345 // java.lang.Reference. As a result, we need to be careful below
1346 // that ref removal steps interleave safely with ref discovery steps 1346 // that ref removal steps interleave safely with ref discovery steps
1347 // (in this thread). 1347 // (in this thread).
1348 void 1348 void
1349 ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, 1349 ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list,