diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp index 8c2fc490a2ff923afb5dfbea82cfb19b011fcd76..51d6e2088754971cdb965a07e2eb4e9ebfb95360 100644 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -132,8 +132,7 @@ class VM_GenCollectFullConcurrent: public VM_GC_Operation { VM_GenCollectFullConcurrent(unsigned int gc_count_before, unsigned int full_gc_count_before, GCCause::Cause gc_cause) - : VM_GC_Operation(gc_count_before, full_gc_count_before, true /* full */) { - _gc_cause = gc_cause; + : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */) { assert(FullGCCount_lock != NULL, "Error"); assert(UseAsyncConcMarkSweepGC, "Else will hang caller"); } diff --git a/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp b/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp index 1fc31d51dc46d6d59628cc18034e55bac6cca912..825818dd4e67bbcb71d9c311476711bf5e459e4d 100644 --- a/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ protected: public: VM_G1OperationWithAllocRequest(unsigned int gc_count_before, size_t word_size) - : VM_GC_Operation(gc_count_before), + : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), _word_size(word_size), _result(NULL), _pause_succeeded(false) { } HeapWord* result() { return _result; } bool pause_succeeded() { return _pause_succeeded; } @@ -55,9 +55,7 @@ public: VM_G1CollectFull(unsigned int gc_count_before, unsigned int full_gc_count_before, GCCause::Cause cause) - : VM_GC_Operation(gc_count_before, full_gc_count_before) { - _gc_cause = cause; - } + : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { } virtual VMOp_Type type() const { return VMOp_G1CollectFull; } virtual void doit(); virtual const char* name() const { diff --git a/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp b/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp index 0f122a97b577311ae78f2654fb592380ea9639c2..8a8419fef7fef69de50e28fc8c575ea541cee0c1 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ // The following methods are used by the parallel scavenge collector VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t size, bool is_tlab, unsigned int gc_count) : - VM_GC_Operation(gc_count), + VM_GC_Operation(gc_count, GCCause::_allocation_failure), _size(size), _is_tlab(is_tlab), _result(NULL) @@ -57,7 +57,7 @@ void VM_ParallelGCFailedAllocation::doit() { VM_ParallelGCFailedPermanentAllocation::VM_ParallelGCFailedPermanentAllocation(size_t size, unsigned int gc_count, unsigned int full_gc_count) : - VM_GC_Operation(gc_count, full_gc_count, true /* full */), + VM_GC_Operation(gc_count, GCCause::_allocation_failure, full_gc_count, true /* full */), _size(size), _result(NULL) { @@ -80,9 +80,8 @@ void VM_ParallelGCFailedPermanentAllocation::doit() { VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(unsigned int gc_count, unsigned int full_gc_count, GCCause::Cause gc_cause) : - VM_GC_Operation(gc_count, full_gc_count, true /* full */) + VM_GC_Operation(gc_count, gc_cause, full_gc_count, true /* full */) { - _gc_cause = gc_cause; } void VM_ParallelGCSystemGC::doit() { diff --git a/src/share/vm/gc_implementation/shared/vmGCOperations.cpp b/src/share/vm/gc_implementation/shared/vmGCOperations.cpp index 5799550d1140b60e4d104372a83064c741311ac6..0828c9ca7c2a2614f844d24bdca24879e17d1df6 100644 --- a/src/share/vm/gc_implementation/shared/vmGCOperations.cpp +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,6 +87,8 @@ bool VM_GC_Operation::skip_operation() const { bool VM_GC_Operation::doit_prologue() { assert(Thread::current()->is_Java_thread(), "just checking"); + assert(((_gc_cause != GCCause::_no_gc) && + (_gc_cause != GCCause::_no_cause_specified)), "Illegal GCCause"); acquire_pending_list_lock(); // If the GC count has changed someone beat us to the collection diff --git a/src/share/vm/gc_implementation/shared/vmGCOperations.hpp b/src/share/vm/gc_implementation/shared/vmGCOperations.hpp index 1a828facadc953229c44427be8c21ce06e35e9ad..a7dd82ca4a5f6565dc3edeb20b8237796d015c1e 100644 --- a/src/share/vm/gc_implementation/shared/vmGCOperations.hpp +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,6 +85,7 @@ class VM_GC_Operation: public VM_Operation { public: VM_GC_Operation(unsigned int gc_count_before, + GCCause::Cause _cause, unsigned int full_gc_count_before = 0, bool full = false) { _full = full; @@ -92,7 +93,7 @@ class VM_GC_Operation: public VM_Operation { _gc_count_before = gc_count_before; // A subclass constructor will likely overwrite the following - _gc_cause = GCCause::_no_cause_specified; + _gc_cause = _cause; _gc_locked = false; @@ -136,6 +137,7 @@ class VM_GC_HeapInspection: public VM_GC_Operation { VM_GC_HeapInspection(outputStream* out, bool request_full_gc, bool need_prologue) : VM_GC_Operation(0 /* total collections, dummy, ignored */, + GCCause::_heap_inspection /* GC Cause */, 0 /* total full collections, dummy, ignored */, request_full_gc) { _out = out; @@ -160,7 +162,7 @@ class VM_GenCollectForAllocation: public VM_GC_Operation { VM_GenCollectForAllocation(size_t size, bool tlab, unsigned int gc_count_before) - : VM_GC_Operation(gc_count_before), + : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), _size(size), _tlab(tlab) { _res = NULL; @@ -182,9 +184,8 @@ class VM_GenCollectFull: public VM_GC_Operation { unsigned int full_gc_count_before, GCCause::Cause gc_cause, int max_level) - : VM_GC_Operation(gc_count_before, full_gc_count_before, true /* full */), - _max_level(max_level) - { _gc_cause = gc_cause; } + : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */), + _max_level(max_level) { } ~VM_GenCollectFull() {} virtual VMOp_Type type() const { return VMOp_GenCollectFull; } virtual void doit(); @@ -199,7 +200,7 @@ class VM_GenCollectForPermanentAllocation: public VM_GC_Operation { unsigned int gc_count_before, unsigned int full_gc_count_before, GCCause::Cause gc_cause) - : VM_GC_Operation(gc_count_before, full_gc_count_before, true), + : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true), _size(size) { _res = NULL; _gc_cause = gc_cause; diff --git a/src/share/vm/gc_interface/gcCause.cpp b/src/share/vm/gc_interface/gcCause.cpp index 5868cd9c958878fab4eb329cb0ada6b04110ff8b..358b6b19e2f3f0ff1f89e66149eb6523aeadfc2f 100644 --- a/src/share/vm/gc_interface/gcCause.cpp +++ b/src/share/vm/gc_interface/gcCause.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,28 +92,3 @@ const char* GCCause::to_string(GCCause::Cause cause) { } ShouldNotReachHere(); } - -#ifndef PRODUCT - -bool GCCause::is_for_full_collection(GCCause::Cause cause) { - bool result; - - // There are more GCCause::Cause types than listed here. - // For brevity, we list only those that cause full collections. - switch (cause) { - case _allocation_failure: - case _tenured_generation_full: - case _permanent_generation_full: - case _cms_generation_full: - case _last_ditch_collection: - result = true; - break; - - default: - result = false; - break; - } - return result; -} - -#endif // PRODUCT diff --git a/src/share/vm/gc_interface/gcCause.hpp b/src/share/vm/gc_interface/gcCause.hpp index af40d989350dac778fbb301b94865d17321b6902..fc49e306bbc286d228d01f208ffc04b0d7b1620e 100644 --- a/src/share/vm/gc_interface/gcCause.hpp +++ b/src/share/vm/gc_interface/gcCause.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,8 +85,6 @@ class GCCause : public AllStatic { // Return a string describing the GCCause. static const char* to_string(GCCause::Cause cause); - // Return true if the GCCause is for a full collection. - static bool is_for_full_collection(GCCause::Cause cause) PRODUCT_RETURN0; }; #endif // SHARE_VM_GC_INTERFACE_GCCAUSE_HPP diff --git a/src/share/vm/services/heapDumper.cpp b/src/share/vm/services/heapDumper.cpp index be1b778242fa1ccf1f67be6a4d97c905211f3f7c..62c4756a0405c41073fff61bb0399f8953c76b70 100644 --- a/src/share/vm/services/heapDumper.cpp +++ b/src/share/vm/services/heapDumper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1397,6 +1397,7 @@ class VM_HeapDumper : public VM_GC_Operation { public: VM_HeapDumper(DumpWriter* writer, bool gc_before_heap_dump, bool oome) : VM_GC_Operation(0 /* total collections, dummy, ignored */, + GCCause::_heap_dump /* GC Cause */, 0 /* total full collections, dummy, ignored */, gc_before_heap_dump) { _local_writer = writer;