Mercurial > hg > graal-jvmci-8
changeset 22941:e3d76b57a655
Merge
author | roland |
---|---|
date | Thu, 09 Apr 2015 16:41:40 +0000 |
parents | cff166f839f6 (diff) dc2f15e0caee (current diff) |
children | 5b2cd065dfc6 |
files | |
diffstat | 17 files changed, 163 insertions(+), 133 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -130,8 +130,8 @@ class VM_GenCollectFullConcurrent: public VM_GC_Operation { bool _disabled_icms; public: - VM_GenCollectFullConcurrent(unsigned int gc_count_before, - unsigned int full_gc_count_before, + VM_GenCollectFullConcurrent(uint gc_count_before, + uint full_gc_count_before, GCCause::Cause gc_cause) : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */), _disabled_icms(false)
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -353,7 +353,7 @@ HeapRegion* lists[] = {_head, _survivor_head}; const char* names[] = {"YOUNG", "SURVIVOR"}; - for (unsigned int list = 0; list < ARRAY_SIZE(lists); ++list) { + for (uint list = 0; list < ARRAY_SIZE(lists); ++list) { gclog_or_tty->print_cr("%s LIST CONTENTS", names[list]); HeapRegion *curr = lists[list]; if (curr == NULL) @@ -827,8 +827,8 @@ assert_heap_not_locked_and_not_at_safepoint(); assert(!isHumongous(word_size), "we do not allow humongous TLABs"); - unsigned int dummy_gc_count_before; - int dummy_gclocker_retry_count = 0; + uint dummy_gc_count_before; + uint dummy_gclocker_retry_count = 0; return attempt_allocation(word_size, &dummy_gc_count_before, &dummy_gclocker_retry_count); } @@ -838,8 +838,8 @@ assert_heap_not_locked_and_not_at_safepoint(); // Loop until the allocation is satisfied, or unsatisfied after GC. - for (int try_count = 1, gclocker_retry_count = 0; /* we'll return */; try_count += 1) { - unsigned int gc_count_before; + for (uint try_count = 1, gclocker_retry_count = 0; /* we'll return */; try_count += 1) { + uint gc_count_before; HeapWord* result = NULL; if (!isHumongous(word_size)) { @@ -891,8 +891,8 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size, AllocationContext_t context, - unsigned int *gc_count_before_ret, - int* gclocker_retry_count_ret) { + uint* gc_count_before_ret, + uint* gclocker_retry_count_ret) { // Make sure you read the note in attempt_allocation_humongous(). assert_heap_not_locked_and_not_at_safepoint(); @@ -909,7 +909,7 @@ HeapWord* result = NULL; for (int try_count = 1; /* we'll return */; try_count += 1) { bool should_try_gc; - unsigned int gc_count_before; + uint gc_count_before; { MutexLockerEx x(Heap_lock); @@ -953,7 +953,7 @@ if (should_try_gc) { bool succeeded; result = do_collection_pause(word_size, gc_count_before, &succeeded, - GCCause::_g1_inc_collection_pause); + GCCause::_g1_inc_collection_pause); if (result != NULL) { assert(succeeded, "only way to get back a non-NULL result"); return result; @@ -1007,8 +1007,8 @@ } HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size, - unsigned int * gc_count_before_ret, - int* gclocker_retry_count_ret) { + uint* gc_count_before_ret, + uint* gclocker_retry_count_ret) { // The structure of this method has a lot of similarities to // attempt_allocation_slow(). The reason these two were not merged // into a single one is that such a method would require several "if @@ -1041,7 +1041,7 @@ HeapWord* result = NULL; for (int try_count = 1; /* we'll return */; try_count += 1) { bool should_try_gc; - unsigned int gc_count_before; + uint gc_count_before; { MutexLockerEx x(Heap_lock); @@ -1079,7 +1079,7 @@ bool succeeded; result = do_collection_pause(word_size, gc_count_before, &succeeded, - GCCause::_g1_humongous_allocation); + GCCause::_g1_humongous_allocation); if (result != NULL) { assert(succeeded, "only way to get back a non-NULL result"); return result; @@ -1887,7 +1887,7 @@ assert(n_rem_sets > 0, "Invariant."); _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC); - _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues, mtGC); + _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(uint, n_queues, mtGC); _evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC); for (int i = 0; i < n_queues; i++) { @@ -2473,9 +2473,9 @@ void G1CollectedHeap::collect(GCCause::Cause cause) { assert_heap_not_locked(); - unsigned int gc_count_before; - unsigned int old_marking_count_before; - unsigned int full_gc_count_before; + uint gc_count_before; + uint old_marking_count_before; + uint full_gc_count_before; bool retry_gc; do { @@ -3613,7 +3613,7 @@ } HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size, - unsigned int gc_count_before, + uint gc_count_before, bool* succeeded, GCCause::Cause gc_cause) { assert_heap_not_locked_and_not_at_safepoint();
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -343,11 +343,11 @@ // Keeps track of how many "old marking cycles" (i.e., Full GCs or // concurrent cycles) we have started. - volatile unsigned int _old_marking_cycles_started; + volatile uint _old_marking_cycles_started; // Keeps track of how many "old marking cycles" (i.e., Full GCs or // concurrent cycles) we have completed. - volatile unsigned int _old_marking_cycles_completed; + volatile uint _old_marking_cycles_completed; bool _concurrent_cycle_started; bool _heap_summary_sent; @@ -515,22 +515,22 @@ // the mutator alloc region without taking the Heap_lock. This // should only be used for non-humongous allocations. inline HeapWord* attempt_allocation(size_t word_size, - unsigned int* gc_count_before_ret, - int* gclocker_retry_count_ret); + uint* gc_count_before_ret, + uint* gclocker_retry_count_ret); // Second-level mutator allocation attempt: take the Heap_lock and // retry the allocation attempt, potentially scheduling a GC // pause. This should only be used for non-humongous allocations. HeapWord* attempt_allocation_slow(size_t word_size, AllocationContext_t context, - unsigned int* gc_count_before_ret, - int* gclocker_retry_count_ret); + uint* gc_count_before_ret, + uint* gclocker_retry_count_ret); // Takes the Heap_lock and attempts a humongous allocation. It can // potentially schedule a GC pause. HeapWord* attempt_allocation_humongous(size_t word_size, - unsigned int* gc_count_before_ret, - int* gclocker_retry_count_ret); + uint* gc_count_before_ret, + uint* gclocker_retry_count_ret); // Allocation attempt that should be called during safepoints (e.g., // at the end of a successful GC). expect_null_mutator_alloc_region @@ -701,7 +701,7 @@ // +ExplicitGCInvokesConcurrent). void increment_old_marking_cycles_completed(bool concurrent); - unsigned int old_marking_cycles_completed() { + uint old_marking_cycles_completed() { return _old_marking_cycles_completed; } @@ -760,7 +760,7 @@ // methods that call do_collection_pause() release the Heap_lock // before the call, so it's easy to read gc_count_before just before. HeapWord* do_collection_pause(size_t word_size, - unsigned int gc_count_before, + uint gc_count_before, bool* succeeded, GCCause::Cause gc_cause); @@ -983,7 +983,7 @@ // The heap region entry for a given worker is valid iff // the associated time stamp value matches the current value // of G1CollectedHeap::_gc_time_stamp. - unsigned int* _worker_cset_start_region_time_stamp; + uint* _worker_cset_start_region_time_stamp; volatile bool _free_regions_coming;
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -131,8 +131,8 @@ } inline HeapWord* G1CollectedHeap::attempt_allocation(size_t word_size, - unsigned int* gc_count_before_ret, - int* gclocker_retry_count_ret) { + uint* gc_count_before_ret, + uint* gclocker_retry_count_ret) { assert_heap_not_locked_and_not_at_safepoint(); assert(!isHumongous(word_size), "attempt_allocation() should not " "be called for humongous allocation requests");
--- a/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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,12 +34,11 @@ #include "gc_implementation/g1/vm_operations_g1.hpp" #include "runtime/interfaceSupport.hpp" -VM_G1CollectForAllocation::VM_G1CollectForAllocation( - unsigned int gc_count_before, - size_t word_size) +VM_G1CollectForAllocation::VM_G1CollectForAllocation(uint gc_count_before, + size_t word_size) : VM_G1OperationWithAllocRequest(gc_count_before, word_size, GCCause::_allocation_failure) { - guarantee(word_size > 0, "an allocation should always be requested"); + guarantee(word_size != 0, "An allocation should always be requested with this operation."); } void VM_G1CollectForAllocation::doit() { @@ -57,12 +56,11 @@ g1h->do_full_collection(false /* clear_all_soft_refs */); } -VM_G1IncCollectionPause::VM_G1IncCollectionPause( - unsigned int gc_count_before, - size_t word_size, - bool should_initiate_conc_mark, - double target_pause_time_ms, - GCCause::Cause gc_cause) +VM_G1IncCollectionPause::VM_G1IncCollectionPause(uint gc_count_before, + size_t word_size, + bool should_initiate_conc_mark, + double target_pause_time_ms, + GCCause::Cause gc_cause) : VM_G1OperationWithAllocRequest(gc_count_before, word_size, gc_cause), _should_initiate_conc_mark(should_initiate_conc_mark), _target_pause_time_ms(target_pause_time_ms), @@ -75,7 +73,7 @@ } bool VM_G1IncCollectionPause::doit_prologue() { - bool res = VM_GC_Operation::doit_prologue(); + bool res = VM_G1OperationWithAllocRequest::doit_prologue(); if (!res) { if (_should_initiate_conc_mark) { // The prologue can fail for a couple of reasons. The first is that another GC @@ -169,7 +167,7 @@ } void VM_G1IncCollectionPause::doit_epilogue() { - VM_GC_Operation::doit_epilogue(); + VM_G1OperationWithAllocRequest::doit_epilogue(); // If the pause was initiated by a System.gc() and // +ExplicitGCInvokesConcurrent, we have to wait here for the cycle
--- a/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -36,20 +36,17 @@ // - VM_G1CollectForAllocation // - VM_G1IncCollectionPause -class VM_G1OperationWithAllocRequest: public VM_GC_Operation { +class VM_G1OperationWithAllocRequest : public VM_CollectForAllocation { protected: - size_t _word_size; - HeapWord* _result; bool _pause_succeeded; AllocationContext_t _allocation_context; public: - VM_G1OperationWithAllocRequest(unsigned int gc_count_before, - size_t word_size, + VM_G1OperationWithAllocRequest(uint gc_count_before, + size_t word_size, GCCause::Cause gc_cause) - : VM_GC_Operation(gc_count_before, gc_cause), - _word_size(word_size), _result(NULL), _pause_succeeded(false) { } - HeapWord* result() { return _result; } + : VM_CollectForAllocation(word_size, gc_count_before, gc_cause), + _pause_succeeded(false) {} bool pause_succeeded() { return _pause_succeeded; } void set_allocation_context(AllocationContext_t context) { _allocation_context = context; } AllocationContext_t allocation_context() { return _allocation_context; } @@ -57,8 +54,8 @@ class VM_G1CollectFull: public VM_GC_Operation { public: - VM_G1CollectFull(unsigned int gc_count_before, - unsigned int full_gc_count_before, + VM_G1CollectFull(uint gc_count_before, + uint full_gc_count_before, GCCause::Cause cause) : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } virtual VMOp_Type type() const { return VMOp_G1CollectFull; } @@ -70,7 +67,7 @@ class VM_G1CollectForAllocation: public VM_G1OperationWithAllocRequest { public: - VM_G1CollectForAllocation(unsigned int gc_count_before, + VM_G1CollectForAllocation(uint gc_count_before, size_t word_size); virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } virtual void doit(); @@ -84,9 +81,9 @@ bool _should_initiate_conc_mark; bool _should_retry_gc; double _target_pause_time_ms; - unsigned int _old_marking_cycles_completed_before; + uint _old_marking_cycles_completed_before; public: - VM_G1IncCollectionPause(unsigned int gc_count_before, + VM_G1IncCollectionPause(uint gc_count_before, size_t word_size, bool should_initiate_conc_mark, double target_pause_time_ms,
--- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -261,7 +261,7 @@ uint loop_count = 0; uint gc_count = 0; - int gclocker_stalled_count = 0; + uint gclocker_stalled_count = 0; while (result == NULL) { // We don't want to have multiple collections for a single filled generation. @@ -521,8 +521,8 @@ assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock"); - unsigned int gc_count = 0; - unsigned int full_gc_count = 0; + uint gc_count = 0; + uint full_gc_count = 0; { MutexLocker ml(Heap_lock); // This value is guarded by the Heap_lock
--- a/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -32,12 +32,10 @@ #include "utilities/dtrace.hpp" // The following methods are used by the parallel scavenge collector -VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t size, - unsigned int gc_count) : - VM_GC_Operation(gc_count, GCCause::_allocation_failure), - _size(size), - _result(NULL) -{ +VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t word_size, + uint gc_count) : + VM_CollectForAllocation(word_size, gc_count, GCCause::_allocation_failure) { + assert(word_size != 0, "An allocation should always be requested with this operation."); } void VM_ParallelGCFailedAllocation::doit() { @@ -47,7 +45,7 @@ assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "must be a ParallelScavengeHeap"); GCCauseSetter gccs(heap, _gc_cause); - _result = heap->failed_mem_allocate(_size); + _result = heap->failed_mem_allocate(_word_size); if (_result == NULL && GC_locker::is_active_and_needs_gc()) { set_gc_locked(); @@ -55,8 +53,8 @@ } // Only used for System.gc() calls -VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(unsigned int gc_count, - unsigned int full_gc_count, +VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(uint gc_count, + uint full_gc_count, GCCause::Cause gc_cause) : VM_GC_Operation(gc_count, gc_cause, full_gc_count, true /* full */) {
--- a/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, 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 @@ -29,26 +29,19 @@ #include "gc_implementation/shared/vmGCOperations.hpp" #include "gc_interface/gcCause.hpp" -class VM_ParallelGCFailedAllocation: public VM_GC_Operation { - private: - size_t _size; - HeapWord* _result; - +class VM_ParallelGCFailedAllocation : public VM_CollectForAllocation { public: - VM_ParallelGCFailedAllocation(size_t size, unsigned int gc_count); + VM_ParallelGCFailedAllocation(size_t word_size, uint gc_count); virtual VMOp_Type type() const { return VMOp_ParallelGCFailedAllocation; } virtual void doit(); - - HeapWord* result() const { return _result; } }; class VM_ParallelGCSystemGC: public VM_GC_Operation { public: - VM_ParallelGCSystemGC(unsigned int gc_count, unsigned int full_gc_count, - GCCause::Cause gc_cause); + VM_ParallelGCSystemGC(uint gc_count, uint full_gc_count, GCCause::Cause gc_cause); virtual VMOp_Type type() const { return VMOp_ParallelGCSystemGC; } virtual void doit(); };
--- a/src/share/vm/gc_implementation/shared/vmGCOperations.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -193,10 +193,10 @@ GenCollectedHeap* gch = GenCollectedHeap::heap(); GCCauseSetter gccs(gch, _gc_cause); - _res = gch->satisfy_failed_allocation(_size, _tlab); - assert(gch->is_in_reserved_or_null(_res), "result not in heap"); + _result = gch->satisfy_failed_allocation(_word_size, _tlab); + assert(gch->is_in_reserved_or_null(_result), "result not in heap"); - if (_res == NULL && GC_locker::is_active_and_needs_gc()) { + if (_result == NULL && GC_locker::is_active_and_needs_gc()) { set_gc_locked(); } } @@ -209,6 +209,18 @@ gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level); } +VM_CollectForMetadataAllocation::VM_CollectForMetadataAllocation(ClassLoaderData* loader_data, + size_t size, + Metaspace::MetadataType mdtype, + uint gc_count_before, + uint full_gc_count_before, + GCCause::Cause gc_cause) + : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true), + _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) { + assert(_size != 0, "An allocation should always be requested with this operation."); + AllocTracer::send_allocation_requiring_gc_event(_size * HeapWordSize, GCId::peek()); +} + // Returns true iff concurrent GCs unloads metadata. bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() { #if INCLUDE_ALL_GCS @@ -313,3 +325,11 @@ set_gc_locked(); } } + +VM_CollectForAllocation::VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause) + : VM_GC_Operation(gc_count_before, cause), _result(NULL), _word_size(word_size) { + // Only report if operation was really caused by an allocation. + if (_word_size != 0) { + AllocTracer::send_allocation_requiring_gc_event(_word_size * HeapWordSize, GCId::peek()); + } +}
--- a/src/share/vm/gc_implementation/shared/vmGCOperations.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, 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 @@ -25,6 +25,7 @@ #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP #define SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP +#include "gc_implementation/shared/gcId.hpp" #include "memory/heapInspection.hpp" #include "runtime/handles.hpp" #include "runtime/jniHandles.hpp" @@ -38,11 +39,12 @@ // VM_Operation // VM_GC_Operation // VM_GC_HeapInspection -// VM_GenCollectForAllocation // VM_GenCollectFull // VM_GenCollectFullConcurrent -// VM_ParallelGCFailedAllocation // VM_ParallelGCSystemGC +// VM_CollectForAllocation +// VM_GenCollectForAllocation +// VM_ParallelGCFailedAllocation // VM_GC_Operation // - implements methods common to all classes in the hierarchy: // prevents multiple gc requests and manages lock on heap; @@ -51,6 +53,7 @@ // - prints class histogram on SIGBREAK if PrintClassHistogram // is specified; and also the attach "inspectheap" operation // +// VM_CollectForAllocation // VM_GenCollectForAllocation // VM_ParallelGCFailedAllocation // - this operation is invoked when allocation is failed; @@ -66,13 +69,13 @@ class VM_GC_Operation: public VM_Operation { protected: - BasicLock _pending_list_basic_lock; // for refs pending list notification (PLL) - unsigned int _gc_count_before; // gc count before acquiring PLL - unsigned int _full_gc_count_before; // full gc count before acquiring PLL - bool _full; // whether a "full" collection - bool _prologue_succeeded; // whether doit_prologue succeeded + BasicLock _pending_list_basic_lock; // for refs pending list notification (PLL) + uint _gc_count_before; // gc count before acquiring PLL + uint _full_gc_count_before; // full gc count before acquiring PLL + bool _full; // whether a "full" collection + bool _prologue_succeeded; // whether doit_prologue succeeded GCCause::Cause _gc_cause; // the putative cause for this gc op - bool _gc_locked; // will be set if gc was locked + bool _gc_locked; // will be set if gc was locked virtual bool skip_operation() const; @@ -81,9 +84,9 @@ void release_and_notify_pending_list_lock(); public: - VM_GC_Operation(unsigned int gc_count_before, + VM_GC_Operation(uint gc_count_before, GCCause::Cause _cause, - unsigned int full_gc_count_before = 0, + uint full_gc_count_before = 0, bool full = false) { _full = full; _prologue_succeeded = false; @@ -160,38 +163,45 @@ bool collect(); }; +class VM_CollectForAllocation : public VM_GC_Operation { + protected: + size_t _word_size; // Size of object to be allocated (in number of words) + HeapWord* _result; // Allocation result (NULL if allocation failed) -class VM_GenCollectForAllocation: public VM_GC_Operation { + public: + VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause); + + HeapWord* result() const { + return _result; + } +}; + +class VM_GenCollectForAllocation : public VM_CollectForAllocation { private: - HeapWord* _res; - size_t _size; // size of object to be allocated. bool _tlab; // alloc is of a tlab. public: - VM_GenCollectForAllocation(size_t size, + VM_GenCollectForAllocation(size_t word_size, bool tlab, - unsigned int gc_count_before) - : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), - _size(size), + uint gc_count_before) + : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure), _tlab(tlab) { - _res = NULL; + assert(word_size != 0, "An allocation should always be requested with this operation."); } ~VM_GenCollectForAllocation() {} virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; } virtual void doit(); - HeapWord* result() const { return _res; } }; - // VM operation to invoke a collection of the heap as a // GenCollectedHeap heap. class VM_GenCollectFull: public VM_GC_Operation { private: int _max_level; public: - VM_GenCollectFull(unsigned int gc_count_before, - unsigned int full_gc_count_before, + VM_GenCollectFull(uint gc_count_before, + uint full_gc_count_before, GCCause::Cause gc_cause, - int max_level) + int max_level) : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */), _max_level(max_level) { } ~VM_GenCollectFull() {} @@ -208,12 +218,9 @@ public: VM_CollectForMetadataAllocation(ClassLoaderData* loader_data, size_t size, Metaspace::MetadataType mdtype, - unsigned int gc_count_before, - unsigned int full_gc_count_before, - GCCause::Cause gc_cause) - : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true), - _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) { - } + uint gc_count_before, + uint full_gc_count_before, + GCCause::Cause gc_cause); virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; } virtual void doit(); MetaWord* result() const { return _result; }
--- a/src/share/vm/gc_interface/allocTracer.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_interface/allocTracer.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "gc_implementation/shared/gcId.hpp" #include "gc_interface/allocTracer.hpp" #include "trace/tracing.hpp" #include "runtime/handles.hpp" @@ -46,3 +47,12 @@ event.commit(); } } + +void AllocTracer::send_allocation_requiring_gc_event(size_t size, const GCId& gcId) { + EventAllocationRequiringGC event; + if (event.should_commit()) { + event.set_gcId(gcId.id()); + event.set_size(size); + event.commit(); + } +}
--- a/src/share/vm/gc_interface/allocTracer.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/gc_interface/allocTracer.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -32,6 +32,7 @@ public: static void send_allocation_outside_tlab_event(KlassHandle klass, size_t alloc_size); static void send_allocation_in_new_tlab_event(KlassHandle klass, size_t tlab_size, size_t alloc_size); + static void send_allocation_requiring_gc_event(size_t size, const GCId& gcId); }; #endif /* SHARE_VM_GC_INTERFACE_ALLOCTRACER_HPP */
--- a/src/share/vm/memory/collectorPolicy.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/memory/collectorPolicy.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, 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 @@ -656,7 +656,7 @@ // Loop until the allocation is satisified, // or unsatisfied after GC. - for (int try_count = 1, gclocker_stalled_count = 0; /* return or throw */; try_count += 1) { + for (uint try_count = 1, gclocker_stalled_count = 0; /* return or throw */; try_count += 1) { HandleMark hm; // discard any handles allocated in each iteration // First allocation attempt is lock-free. @@ -670,7 +670,7 @@ return result; } } - unsigned int gc_count_before; // read inside the Heap_lock locked region + uint gc_count_before; // read inside the Heap_lock locked region { MutexLocker ml(Heap_lock); if (PrintGC && Verbose) {
--- a/src/share/vm/runtime/globals.hpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/runtime/globals.hpp Thu Apr 09 16:41:40 2015 +0000 @@ -1494,7 +1494,7 @@ "How much the GC can expand the eden by while the GC locker " \ "is active (as a percentage)") \ \ - diagnostic(intx, GCLockerRetryAllocationCount, 2, \ + diagnostic(uintx, GCLockerRetryAllocationCount, 2, \ "Number of times to retry allocations when " \ "blocked by the GC locker") \ \
--- a/src/share/vm/runtime/mutexLocker.cpp Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/runtime/mutexLocker.cpp Thu Apr 09 16:41:40 2015 +0000 @@ -282,10 +282,10 @@ #ifdef INCLUDE_TRACE def(JfrMsg_lock , Monitor, leaf, true); - def(JfrBuffer_lock , Mutex, nonleaf+1, true); - def(JfrThreadGroups_lock , Mutex, nonleaf+1, true); - def(JfrStream_lock , Mutex, nonleaf+2, true); - def(JfrStacktrace_lock , Mutex, special, true ); + def(JfrBuffer_lock , Mutex, leaf, true); + def(JfrThreadGroups_lock , Mutex, leaf, true); + def(JfrStream_lock , Mutex, nonleaf, true); + def(JfrStacktrace_lock , Mutex, special, true); #endif #ifndef SUPPORTS_NATIVE_CX8
--- a/src/share/vm/trace/trace.xml Thu Mar 12 14:15:09 2015 +0100 +++ b/src/share/vm/trace/trace.xml Thu Apr 09 16:41:40 2015 +0000 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2012, 2015, 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 @@ -352,6 +352,12 @@ <value type="UTF8" field="name" label="Name" /> </event> + <event id="AllocationRequiringGC" path="vm/gc/detailed/allocation_requiring_gc" label="Allocation Requiring GC" + has_thread="true" has_stacktrace="true" is_instant="true"> + <value type="UINT" field="gcId" label="Pending GC ID" relation="GC_ID" /> + <value type="BYTES64" field="size" label="Allocation Size" /> + </event> + <!-- Compiler events --> <event id="Compilation" path="vm/compiler/compilation" label="Compilation"