12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHARED_COLLECTEDHEAP_HPP
26 #define SHARE_GC_SHARED_COLLECTEDHEAP_HPP
27
28 #include "gc/shared/gcCause.hpp"
29 #include "gc/shared/gcWhen.hpp"
30 #include "gc/shared/verifyOption.hpp"
31 #include "memory/allocation.hpp"
32 #include "runtime/handles.hpp"
33 #include "runtime/perfData.hpp"
34 #include "runtime/safepoint.hpp"
35 #include "services/memoryUsage.hpp"
36 #include "utilities/debug.hpp"
37 #include "utilities/events.hpp"
38 #include "utilities/formatBuffer.hpp"
39 #include "utilities/growableArray.hpp"
40
41 // A "CollectedHeap" is an implementation of a java heap for HotSpot. This
42 // is an abstract class: there may be many different kinds of heaps. This
43 // class defines the functions that a heap must implement, and contains
44 // infrastructure common to all heaps.
45
46 class AdaptiveSizePolicy;
47 class BarrierSet;
48 class GCHeapSummary;
49 class GCTimer;
50 class GCTracer;
51 class GCMemoryManager;
349 guarantee(false, "thread-local allocation buffers not supported");
350 return 0;
351 }
352
353 // Perform a collection of the heap; intended for use in implementing
354 // "System.gc". This probably implies as full a collection as the
355 // "CollectedHeap" supports.
356 virtual void collect(GCCause::Cause cause) = 0;
357
358 // Perform a full collection
359 virtual void do_full_collection(bool clear_all_soft_refs) = 0;
360
361 // This interface assumes that it's being called by the
362 // vm thread. It collects the heap assuming that the
363 // heap lock is already held and that we are executing in
364 // the context of the vm thread.
365 virtual void collect_as_vm_thread(GCCause::Cause cause);
366
367 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
368 size_t size,
369 Metaspace::MetadataType mdtype);
370
371 // Returns "true" iff there is a stop-world GC in progress. (I assume
372 // that it should answer "false" for the concurrent part of a concurrent
373 // collector -- dld).
374 bool is_gc_active() const { return _is_gc_active; }
375
376 // Total number of GC collections (started)
377 unsigned int total_collections() const { return _total_collections; }
378 unsigned int total_full_collections() const { return _total_full_collections;}
379
380 // Increment total number of GC collections (started)
381 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
382 void increment_total_collections(bool full = false) {
383 _total_collections++;
384 if (full) {
385 increment_total_full_collections();
386 }
387 }
388
389 void increment_total_full_collections() { _total_full_collections++; }
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHARED_COLLECTEDHEAP_HPP
26 #define SHARE_GC_SHARED_COLLECTEDHEAP_HPP
27
28 #include "gc/shared/gcCause.hpp"
29 #include "gc/shared/gcWhen.hpp"
30 #include "gc/shared/verifyOption.hpp"
31 #include "memory/allocation.hpp"
32 #include "memory/metaspace/metaspaceEnums.hpp"
33 #include "runtime/handles.hpp"
34 #include "runtime/perfData.hpp"
35 #include "runtime/safepoint.hpp"
36 #include "services/memoryUsage.hpp"
37 #include "utilities/debug.hpp"
38 #include "utilities/events.hpp"
39 #include "utilities/formatBuffer.hpp"
40 #include "utilities/growableArray.hpp"
41
42 // A "CollectedHeap" is an implementation of a java heap for HotSpot. This
43 // is an abstract class: there may be many different kinds of heaps. This
44 // class defines the functions that a heap must implement, and contains
45 // infrastructure common to all heaps.
46
47 class AdaptiveSizePolicy;
48 class BarrierSet;
49 class GCHeapSummary;
50 class GCTimer;
51 class GCTracer;
52 class GCMemoryManager;
350 guarantee(false, "thread-local allocation buffers not supported");
351 return 0;
352 }
353
354 // Perform a collection of the heap; intended for use in implementing
355 // "System.gc". This probably implies as full a collection as the
356 // "CollectedHeap" supports.
357 virtual void collect(GCCause::Cause cause) = 0;
358
359 // Perform a full collection
360 virtual void do_full_collection(bool clear_all_soft_refs) = 0;
361
362 // This interface assumes that it's being called by the
363 // vm thread. It collects the heap assuming that the
364 // heap lock is already held and that we are executing in
365 // the context of the vm thread.
366 virtual void collect_as_vm_thread(GCCause::Cause cause);
367
368 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
369 size_t size,
370 metaspace::MetadataType mdtype);
371
372 // Returns "true" iff there is a stop-world GC in progress. (I assume
373 // that it should answer "false" for the concurrent part of a concurrent
374 // collector -- dld).
375 bool is_gc_active() const { return _is_gc_active; }
376
377 // Total number of GC collections (started)
378 unsigned int total_collections() const { return _total_collections; }
379 unsigned int total_full_collections() const { return _total_full_collections;}
380
381 // Increment total number of GC collections (started)
382 // Should be protected but used by PSMarkSweep - cleanup for 1.4.2
383 void increment_total_collections(bool full = false) {
384 _total_collections++;
385 if (full) {
386 increment_total_full_collections();
387 }
388 }
389
390 void increment_total_full_collections() { _total_full_collections++; }
|