hotspot/src/share/vm/gc/shared/collectedHeap.cpp
changeset 35915 5808cd93abfc
parent 35529 39376b4613b5
child 35939 05df7e64ecfc
equal deleted inserted replaced
35914:aab83fe79386 35915:5808cd93abfc
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2016, 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.
   569 
   569 
   570     ThreadLocalAllocBuffer::resize_all_tlabs();
   570     ThreadLocalAllocBuffer::resize_all_tlabs();
   571   }
   571   }
   572 }
   572 }
   573 
   573 
   574 void CollectedHeap::full_gc_dump(GCTimer* timer, const char* when) {
   574 void CollectedHeap::full_gc_dump(GCTimer* timer, bool before) {
   575   if (HeapDumpBeforeFullGC || HeapDumpAfterFullGC) {
   575   if ((HeapDumpBeforeFullGC && before) || (HeapDumpAfterFullGC && !before)) {
   576     GCIdMarkAndRestore gc_id_mark;
   576     GCIdMarkAndRestore gc_id_mark;
   577     FormatBuffer<> title("Heap Dump (%s full gc)", when);
   577     FormatBuffer<> title("Heap Dump (%s full gc)", before ? "before" : "after");
   578     GCTraceTime(Info, gc) tm(title.buffer(), timer);
   578     GCTraceTime(Info, gc) tm(title.buffer(), timer);
   579     HeapDumper::dump_heap();
   579     HeapDumper::dump_heap();
   580   }
   580   }
   581   LogHandle(gc, classhisto) log;
   581   LogHandle(gc, classhisto) log;
   582   if (log.is_trace()) {
   582   if (log.is_trace()) {
   583     ResourceMark rm;
   583     ResourceMark rm;
   584     GCIdMarkAndRestore gc_id_mark;
   584     GCIdMarkAndRestore gc_id_mark;
   585     FormatBuffer<> title("Class Histogram (%s full gc)", when);
   585     FormatBuffer<> title("Class Histogram (%s full gc)",
       
   586                          before ? "before" : "after");
   586     GCTraceTime(Trace, gc, classhisto) tm(title.buffer(), timer);
   587     GCTraceTime(Trace, gc, classhisto) tm(title.buffer(), timer);
   587     VM_GC_HeapInspection inspector(log.trace_stream(), false /* ! full gc */);
   588     VM_GC_HeapInspection inspector(log.trace_stream(), false /* ! full gc */);
   588     inspector.doit();
   589     inspector.doit();
   589   }
   590   }
   590 }
   591 }
   591 
   592 
   592 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) {
   593 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) {
   593   full_gc_dump(timer, "before");
   594   full_gc_dump(timer, true);
   594 }
   595 }
   595 
   596 
   596 void CollectedHeap::post_full_gc_dump(GCTimer* timer) {
   597 void CollectedHeap::post_full_gc_dump(GCTimer* timer) {
   597   full_gc_dump(timer, "after");
   598   full_gc_dump(timer, false);
   598 }
   599 }
   599 
   600 
   600 void CollectedHeap::initialize_reserved_region(HeapWord *start, HeapWord *end) {
   601 void CollectedHeap::initialize_reserved_region(HeapWord *start, HeapWord *end) {
   601   // It is important to do this in a way such that concurrent readers can't
   602   // It is important to do this in a way such that concurrent readers can't
   602   // temporarily think something is in the heap.  (Seen this happen in asserts.)
   603   // temporarily think something is in the heap.  (Seen this happen in asserts.)