author | kbarrett |
Tue, 30 Aug 2016 23:48:16 -0400 | |
changeset 40892 | 330a02d935ad |
parent 35079 | edab77f91231 |
permissions | -rw-r--r-- |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
1 |
/* |
30764 | 2 |
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
4 |
* |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
8 |
* |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
13 |
* accompanied this code). |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
14 |
* |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
18 |
* |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
21 |
* questions. |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
22 |
* |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
23 |
*/ |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
24 |
|
30764 | 25 |
#ifndef SHARE_VM_GC_G1_G1HRPRINTER_HPP |
26 |
#define SHARE_VM_GC_G1_G1HRPRINTER_HPP |
|
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
27 |
|
30764 | 28 |
#include "gc/g1/heapRegion.hpp" |
35061 | 29 |
#include "logging/log.hpp" |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
30 |
#include "memory/allocation.hpp" |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
31 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
32 |
#define SKIP_RETIRED_FULL_REGIONS 1 |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
33 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
34 |
class G1HRPrinter VALUE_OBJ_CLASS_SPEC { |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
35 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
36 |
private: |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
37 |
|
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
38 |
// Print an action event. |
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
39 |
static void print(const char* action, HeapRegion* hr) { |
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
40 |
log_trace(gc, region)("G1HR %s(%s) [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT "]", |
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
41 |
action, hr->get_type_str(), p2i(hr->bottom()), p2i(hr->top()), p2i(hr->end())); |
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
42 |
} |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
43 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
44 |
public: |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
45 |
// In some places we iterate over a list in order to generate output |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
46 |
// for the list's elements. By exposing this we can avoid this |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
47 |
// iteration if the printer is not active. |
35061 | 48 |
const bool is_active() { return log_is_enabled(Trace, gc, region); } |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
49 |
|
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
50 |
// The methods below are convenient wrappers for the print() method. |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
51 |
|
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
52 |
void alloc(HeapRegion* hr, bool force = false) { |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
53 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
54 |
print((force) ? "ALLOC-FORCE" : "ALLOC", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
55 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
56 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
57 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
58 |
void retire(HeapRegion* hr) { |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
59 |
if (is_active()) { |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
60 |
if (!SKIP_RETIRED_FULL_REGIONS || hr->top() < hr->end()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
61 |
print("RETIRE", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
62 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
63 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
64 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
65 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
66 |
void reuse(HeapRegion* hr) { |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
67 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
68 |
print("REUSE", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
69 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
70 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
71 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
72 |
void cset(HeapRegion* hr) { |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
73 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
74 |
print("CSET", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
75 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
76 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
77 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
78 |
void evac_failure(HeapRegion* hr) { |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
79 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
80 |
print("EVAC-FAILURE", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
81 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
82 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
83 |
|
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
84 |
void cleanup(HeapRegion* hr) { |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
85 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
86 |
print("CLEANUP", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
87 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
88 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
89 |
|
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
90 |
void post_compaction(HeapRegion* hr) { |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
91 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
92 |
print("POST-COMPACTION", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
93 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
94 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
95 |
|
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
96 |
void commit(HeapRegion* hr) { |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
97 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
98 |
print("COMMIT", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
99 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
100 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
101 |
|
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
102 |
void uncommit(HeapRegion* hr) { |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
103 |
if (is_active()) { |
35079
edab77f91231
8145301: Improve and unify the printout format for the g1HRPrinter.
david
parents:
35061
diff
changeset
|
104 |
print("UNCOMMIT", hr); |
10001
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
105 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
106 |
} |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
107 |
}; |
8aa7f885326e
7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff
changeset
|
108 |
|
30764 | 109 |
#endif // SHARE_VM_GC_G1_G1HRPRINTER_HPP |