comparison src/share/vm/memory/referenceProcessor.hpp @ 10408:836a62f43af9

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 10:45:56 +0200
parents ebb32c4589f3 f2110083203d
children f22cbff51c12
comparison
equal deleted inserted replaced
10086:e0fb8a213650 10408:836a62f43af9
1 /* 1 /*
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2013, 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.
24 24
25 #ifndef SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP 25 #ifndef SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP
26 #define SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP 26 #define SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP
27 27
28 #include "memory/referencePolicy.hpp" 28 #include "memory/referencePolicy.hpp"
29 #include "memory/referenceProcessorStats.hpp"
30 #include "memory/referenceType.hpp"
29 #include "oops/instanceRefKlass.hpp" 31 #include "oops/instanceRefKlass.hpp"
32
33 class GCTimer;
30 34
31 // ReferenceProcessor class encapsulates the per-"collector" processing 35 // ReferenceProcessor class encapsulates the per-"collector" processing
32 // of java.lang.Reference objects for GC. The interface is useful for supporting 36 // of java.lang.Reference objects for GC. The interface is useful for supporting
33 // a generational abstraction, in particular when there are multiple 37 // a generational abstraction, in particular when there are multiple
34 // generations that are being independently collected -- possibly 38 // generations that are being independently collected -- possibly
202 NOT_PRODUCT(_processed++); 206 NOT_PRODUCT(_processed++);
203 } 207 }
204 }; 208 };
205 209
206 class ReferenceProcessor : public CHeapObj<mtGC> { 210 class ReferenceProcessor : public CHeapObj<mtGC> {
211
212 private:
213 size_t total_count(DiscoveredList lists[]);
214
207 protected: 215 protected:
208 // Compatibility with pre-4965777 JDK's 216 // Compatibility with pre-4965777 JDK's
209 static bool _pending_list_uses_discovered_field; 217 static bool _pending_list_uses_discovered_field;
210 218
211 // The SoftReference master timestamp clock 219 // The SoftReference master timestamp clock
280 _current_soft_ref_policy->setup(); // snapshot the policy threshold 288 _current_soft_ref_policy->setup(); // snapshot the policy threshold
281 return _current_soft_ref_policy; 289 return _current_soft_ref_policy;
282 } 290 }
283 291
284 // Process references with a certain reachability level. 292 // Process references with a certain reachability level.
285 void process_discovered_reflist(DiscoveredList refs_lists[], 293 size_t process_discovered_reflist(DiscoveredList refs_lists[],
286 ReferencePolicy* policy, 294 ReferencePolicy* policy,
287 bool clear_referent, 295 bool clear_referent,
288 BoolObjectClosure* is_alive, 296 BoolObjectClosure* is_alive,
289 OopClosure* keep_alive, 297 OopClosure* keep_alive,
290 VoidClosure* complete_gc, 298 VoidClosure* complete_gc,
291 AbstractRefProcTaskExecutor* task_executor); 299 AbstractRefProcTaskExecutor* task_executor);
292 300
293 void process_phaseJNI(BoolObjectClosure* is_alive, 301 void process_phaseJNI(BoolObjectClosure* is_alive,
294 OopClosure* keep_alive, 302 OopClosure* keep_alive,
295 VoidClosure* complete_gc); 303 VoidClosure* complete_gc);
296 #ifdef GRAAL 304 #ifdef GRAAL
351 // (or predicates involved) by other threads. Currently 359 // (or predicates involved) by other threads. Currently
352 // only used by the CMS collector. 360 // only used by the CMS collector.
353 void preclean_discovered_references(BoolObjectClosure* is_alive, 361 void preclean_discovered_references(BoolObjectClosure* is_alive,
354 OopClosure* keep_alive, 362 OopClosure* keep_alive,
355 VoidClosure* complete_gc, 363 VoidClosure* complete_gc,
356 YieldClosure* yield); 364 YieldClosure* yield,
365 GCTimer* gc_timer);
357 366
358 // Delete entries in the discovered lists that have 367 // Delete entries in the discovered lists that have
359 // either a null referent or are not active. Such 368 // either a null referent or are not active. Such
360 // Reference objects can result from the clearing 369 // Reference objects can result from the clearing
361 // or enqueueing of Reference objects concurrent 370 // or enqueueing of Reference objects concurrent
502 511
503 // Discover a Reference object, using appropriate discovery criteria 512 // Discover a Reference object, using appropriate discovery criteria
504 bool discover_reference(oop obj, ReferenceType rt); 513 bool discover_reference(oop obj, ReferenceType rt);
505 514
506 // Process references found during GC (called by the garbage collector) 515 // Process references found during GC (called by the garbage collector)
507 void process_discovered_references(BoolObjectClosure* is_alive, 516 ReferenceProcessorStats
508 OopClosure* keep_alive, 517 process_discovered_references(BoolObjectClosure* is_alive,
509 VoidClosure* complete_gc, 518 OopClosure* keep_alive,
510 AbstractRefProcTaskExecutor* task_executor); 519 VoidClosure* complete_gc,
511 520 AbstractRefProcTaskExecutor* task_executor,
512 public: 521 GCTimer *gc_timer);
522
513 // Enqueue references at end of GC (called by the garbage collector) 523 // Enqueue references at end of GC (called by the garbage collector)
514 bool enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL); 524 bool enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL);
515 525
516 // If a discovery is in process that is being superceded, abandon it: all 526 // If a discovery is in process that is being superceded, abandon it: all
517 // the discovered lists will be empty, and all the objects on them will 527 // the discovered lists will be empty, and all the objects on them will