1 /* |
1 /* |
2 * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
83 // . the current policy below is either one of the above |
83 // . the current policy below is either one of the above |
84 ReferencePolicy* _current_soft_ref_policy; |
84 ReferencePolicy* _current_soft_ref_policy; |
85 |
85 |
86 // The discovered ref lists themselves |
86 // The discovered ref lists themselves |
87 |
87 |
88 // The MT'ness degree of the queues below |
88 // The active MT'ness degree of the queues below |
89 int _num_q; |
89 int _num_q; |
|
90 // The maximum MT'ness degree of the queues below |
|
91 int _max_num_q; |
90 // Arrays of lists of oops, one per thread |
92 // Arrays of lists of oops, one per thread |
91 DiscoveredList* _discoveredSoftRefs; |
93 DiscoveredList* _discoveredSoftRefs; |
92 DiscoveredList* _discoveredWeakRefs; |
94 DiscoveredList* _discoveredWeakRefs; |
93 DiscoveredList* _discoveredFinalRefs; |
95 DiscoveredList* _discoveredFinalRefs; |
94 DiscoveredList* _discoveredPhantomRefs; |
96 DiscoveredList* _discoveredPhantomRefs; |
95 |
97 |
96 public: |
98 public: |
97 int num_q() { return _num_q; } |
99 int num_q() { return _num_q; } |
|
100 void set_mt_degree(int v) { _num_q = v; } |
98 DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } |
101 DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } |
99 static oop sentinel_ref() { return _sentinelRef; } |
102 static oop sentinel_ref() { return _sentinelRef; } |
100 static oop* adr_sentinel_ref() { return &_sentinelRef; } |
103 static oop* adr_sentinel_ref() { return &_sentinelRef; } |
101 ReferencePolicy* setup_policy(bool always_clear) { |
104 ReferencePolicy* setup_policy(bool always_clear) { |
102 _current_soft_ref_policy = always_clear ? |
105 _current_soft_ref_policy = always_clear ? |
242 _discovery_is_mt(false), |
245 _discovery_is_mt(false), |
243 _discovered_list_needs_barrier(false), |
246 _discovered_list_needs_barrier(false), |
244 _bs(NULL), |
247 _bs(NULL), |
245 _is_alive_non_header(NULL), |
248 _is_alive_non_header(NULL), |
246 _num_q(0), |
249 _num_q(0), |
|
250 _max_num_q(0), |
247 _processing_is_mt(false), |
251 _processing_is_mt(false), |
248 _next_id(0) |
252 _next_id(0) |
249 {} |
253 {} |
250 |
254 |
251 ReferenceProcessor(MemRegion span, bool atomic_discovery, |
255 ReferenceProcessor(MemRegion span, bool atomic_discovery, |
309 void set_enqueuing_is_done(bool v) { _enqueuing_is_done = v; } |
313 void set_enqueuing_is_done(bool v) { _enqueuing_is_done = v; } |
310 |
314 |
311 // iterate over oops |
315 // iterate over oops |
312 void weak_oops_do(OopClosure* f); // weak roots |
316 void weak_oops_do(OopClosure* f); // weak roots |
313 static void oops_do(OopClosure* f); // strong root(s) |
317 static void oops_do(OopClosure* f); // strong root(s) |
|
318 |
|
319 // Balance each of the discovered lists. |
|
320 void balance_all_queues(); |
314 |
321 |
315 // Discover a Reference object, using appropriate discovery criteria |
322 // Discover a Reference object, using appropriate discovery criteria |
316 bool discover_reference(oop obj, ReferenceType rt); |
323 bool discover_reference(oop obj, ReferenceType rt); |
317 |
324 |
318 // Process references found during GC (called by the garbage collector) |
325 // Process references found during GC (called by the garbage collector) |