Mercurial > hg > truffle
comparison src/share/vm/memory/referenceProcessor.hpp @ 17976:8e20ef014b08
8043239: G1: Missing post barrier in processing of j.l.ref.Reference objects
Summary: Removed all write barriers during reference processing and added explicit write barriers when iterating through the discovered list.
Reviewed-by: pliden, jmasa, tschatzl
author | brutisso |
---|---|
date | Wed, 11 Jun 2014 10:46:47 +0200 |
parents | d60ecdb2773e |
children | 52b4284cb496 0982ec23da03 01dcaba9b3f3 |
comparison
equal
deleted
inserted
replaced
17975:bd4d69d9cb7d | 17976:8e20ef014b08 |
---|---|
97 oop _next; | 97 oop _next; |
98 HeapWord* _referent_addr; | 98 HeapWord* _referent_addr; |
99 oop _referent; | 99 oop _referent; |
100 OopClosure* _keep_alive; | 100 OopClosure* _keep_alive; |
101 BoolObjectClosure* _is_alive; | 101 BoolObjectClosure* _is_alive; |
102 bool _discovered_list_needs_post_barrier; | |
103 | 102 |
104 DEBUG_ONLY( | 103 DEBUG_ONLY( |
105 oop _first_seen; // cyclic linked list check | 104 oop _first_seen; // cyclic linked list check |
106 ) | 105 ) |
107 | 106 |
111 ) | 110 ) |
112 | 111 |
113 public: | 112 public: |
114 inline DiscoveredListIterator(DiscoveredList& refs_list, | 113 inline DiscoveredListIterator(DiscoveredList& refs_list, |
115 OopClosure* keep_alive, | 114 OopClosure* keep_alive, |
116 BoolObjectClosure* is_alive, | 115 BoolObjectClosure* is_alive): |
117 bool discovered_list_needs_post_barrier = false): | |
118 _refs_list(refs_list), | 116 _refs_list(refs_list), |
119 _prev_next(refs_list.adr_head()), | 117 _prev_next(refs_list.adr_head()), |
120 _prev(NULL), | 118 _prev(NULL), |
121 _ref(refs_list.head()), | 119 _ref(refs_list.head()), |
122 #ifdef ASSERT | 120 #ifdef ASSERT |
126 _processed(0), | 124 _processed(0), |
127 _removed(0), | 125 _removed(0), |
128 #endif | 126 #endif |
129 _next(NULL), | 127 _next(NULL), |
130 _keep_alive(keep_alive), | 128 _keep_alive(keep_alive), |
131 _is_alive(is_alive), | 129 _is_alive(is_alive) |
132 _discovered_list_needs_post_barrier(discovered_list_needs_post_barrier) | |
133 { } | 130 { } |
134 | 131 |
135 // End Of List. | 132 // End Of List. |
136 inline bool has_next() const { return _ref != NULL; } | 133 inline bool has_next() const { return _ref != NULL; } |
137 | 134 |
227 | 224 |
228 bool _discovering_refs; // true when discovery enabled | 225 bool _discovering_refs; // true when discovery enabled |
229 bool _discovery_is_atomic; // if discovery is atomic wrt | 226 bool _discovery_is_atomic; // if discovery is atomic wrt |
230 // other collectors in configuration | 227 // other collectors in configuration |
231 bool _discovery_is_mt; // true if reference discovery is MT. | 228 bool _discovery_is_mt; // true if reference discovery is MT. |
232 | |
233 // If true, setting "next" field of a discovered refs list requires | |
234 // write post barrier. (Must be true if used in a collector in which | |
235 // elements of a discovered list may be moved during discovery: for | |
236 // example, a collector like Garbage-First that moves objects during a | |
237 // long-term concurrent marking phase that does weak reference | |
238 // discovery.) | |
239 bool _discovered_list_needs_post_barrier; | |
240 | 229 |
241 bool _enqueuing_is_done; // true if all weak references enqueued | 230 bool _enqueuing_is_done; // true if all weak references enqueued |
242 bool _processing_is_mt; // true during phases when | 231 bool _processing_is_mt; // true during phases when |
243 // reference processing is MT. | 232 // reference processing is MT. |
244 uint _next_id; // round-robin mod _num_q counter in | 233 uint _next_id; // round-robin mod _num_q counter in |
380 const char* list_name(uint i); | 369 const char* list_name(uint i); |
381 | 370 |
382 void enqueue_discovered_reflists(HeapWord* pending_list_addr, AbstractRefProcTaskExecutor* task_executor); | 371 void enqueue_discovered_reflists(HeapWord* pending_list_addr, AbstractRefProcTaskExecutor* task_executor); |
383 | 372 |
384 protected: | 373 protected: |
385 // Set the 'discovered' field of the given reference to | |
386 // the given value - emitting post barriers depending upon | |
387 // the value of _discovered_list_needs_post_barrier. | |
388 void set_discovered(oop ref, oop value); | |
389 | |
390 // "Preclean" the given discovered reference list | 374 // "Preclean" the given discovered reference list |
391 // by removing references with strongly reachable referents. | 375 // by removing references with strongly reachable referents. |
392 // Currently used in support of CMS only. | 376 // Currently used in support of CMS only. |
393 void preclean_discovered_reflist(DiscoveredList& refs_list, | 377 void preclean_discovered_reflist(DiscoveredList& refs_list, |
394 BoolObjectClosure* is_alive, | 378 BoolObjectClosure* is_alive, |
425 // Default parameters give you a vanilla reference processor. | 409 // Default parameters give you a vanilla reference processor. |
426 ReferenceProcessor(MemRegion span, | 410 ReferenceProcessor(MemRegion span, |
427 bool mt_processing = false, uint mt_processing_degree = 1, | 411 bool mt_processing = false, uint mt_processing_degree = 1, |
428 bool mt_discovery = false, uint mt_discovery_degree = 1, | 412 bool mt_discovery = false, uint mt_discovery_degree = 1, |
429 bool atomic_discovery = true, | 413 bool atomic_discovery = true, |
430 BoolObjectClosure* is_alive_non_header = NULL, | 414 BoolObjectClosure* is_alive_non_header = NULL); |
431 bool discovered_list_needs_post_barrier = false); | |
432 | 415 |
433 // RefDiscoveryPolicy values | 416 // RefDiscoveryPolicy values |
434 enum DiscoveryPolicy { | 417 enum DiscoveryPolicy { |
435 ReferenceBasedDiscovery = 0, | 418 ReferenceBasedDiscovery = 0, |
436 ReferentBasedDiscovery = 1, | 419 ReferentBasedDiscovery = 1, |