comparison src/share/vm/memory/referenceProcessor.hpp @ 10405:f2110083203d

8005849: JEP 167: Event-Based JVM Tracing Reviewed-by: acorn, coleenp, sla Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents da91efe96a93
children 836a62f43af9 fbc1677398c0
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
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 304
347 // (or predicates involved) by other threads. Currently 355 // (or predicates involved) by other threads. Currently
348 // only used by the CMS collector. 356 // only used by the CMS collector.
349 void preclean_discovered_references(BoolObjectClosure* is_alive, 357 void preclean_discovered_references(BoolObjectClosure* is_alive,
350 OopClosure* keep_alive, 358 OopClosure* keep_alive,
351 VoidClosure* complete_gc, 359 VoidClosure* complete_gc,
352 YieldClosure* yield); 360 YieldClosure* yield,
361 GCTimer* gc_timer);
353 362
354 // Delete entries in the discovered lists that have 363 // Delete entries in the discovered lists that have
355 // either a null referent or are not active. Such 364 // either a null referent or are not active. Such
356 // Reference objects can result from the clearing 365 // Reference objects can result from the clearing
357 // or enqueueing of Reference objects concurrent 366 // or enqueueing of Reference objects concurrent
498 507
499 // Discover a Reference object, using appropriate discovery criteria 508 // Discover a Reference object, using appropriate discovery criteria
500 bool discover_reference(oop obj, ReferenceType rt); 509 bool discover_reference(oop obj, ReferenceType rt);
501 510
502 // Process references found during GC (called by the garbage collector) 511 // Process references found during GC (called by the garbage collector)
503 void process_discovered_references(BoolObjectClosure* is_alive, 512 ReferenceProcessorStats
504 OopClosure* keep_alive, 513 process_discovered_references(BoolObjectClosure* is_alive,
505 VoidClosure* complete_gc, 514 OopClosure* keep_alive,
506 AbstractRefProcTaskExecutor* task_executor); 515 VoidClosure* complete_gc,
507 516 AbstractRefProcTaskExecutor* task_executor,
508 public: 517 GCTimer *gc_timer);
518
509 // Enqueue references at end of GC (called by the garbage collector) 519 // Enqueue references at end of GC (called by the garbage collector)
510 bool enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL); 520 bool enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL);
511 521
512 // If a discovery is in process that is being superceded, abandon it: all 522 // If a discovery is in process that is being superceded, abandon it: all
513 // the discovered lists will be empty, and all the objects on them will 523 // the discovered lists will be empty, and all the objects on them will