author | stefank |
Thu, 22 Feb 2018 18:36:07 +0100 | |
changeset 49047 | 8f004146e407 |
parent 48168 | cb5d2d4453d0 |
child 49982 | 9042ffe5b7fe |
permissions | -rw-r--r-- |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
1 |
/* |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
4 |
* |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
8 |
* |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
13 |
* accompanied this code). |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
14 |
* |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
18 |
* |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
21 |
* questions. |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
22 |
* |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
23 |
*/ |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
24 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
26 |
#include "gc/serial/defNewGeneration.hpp" |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
27 |
#include "gc/shared/generation.hpp" |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
28 |
#include "gc/shared/genMemoryPools.hpp" |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
29 |
#include "gc/shared/space.hpp" |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
30 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
31 |
ContiguousSpacePool::ContiguousSpacePool(ContiguousSpace* space, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
32 |
const char* name, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
33 |
size_t max_size, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
34 |
bool support_usage_threshold) : |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
35 |
CollectedMemoryPool(name, space->capacity(), max_size, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
36 |
support_usage_threshold), _space(space) { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
37 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
38 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
39 |
size_t ContiguousSpacePool::used_in_bytes() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
40 |
return space()->used(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
41 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
42 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
43 |
MemoryUsage ContiguousSpacePool::get_memory_usage() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
44 |
size_t maxSize = (available_for_allocation() ? max_size() : 0); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
45 |
size_t used = used_in_bytes(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
46 |
size_t committed = _space->capacity(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
47 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
48 |
return MemoryUsage(initial_size(), used, committed, maxSize); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
49 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
50 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
51 |
SurvivorContiguousSpacePool::SurvivorContiguousSpacePool(DefNewGeneration* young_gen, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
52 |
const char* name, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
53 |
size_t max_size, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
54 |
bool support_usage_threshold) : |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
55 |
CollectedMemoryPool(name, young_gen->from()->capacity(), max_size, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
56 |
support_usage_threshold), _young_gen(young_gen) { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
57 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
58 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
59 |
size_t SurvivorContiguousSpacePool::used_in_bytes() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
60 |
return _young_gen->from()->used(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
61 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
62 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
63 |
size_t SurvivorContiguousSpacePool::committed_in_bytes() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
64 |
return _young_gen->from()->capacity(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
65 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
66 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
67 |
MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
68 |
size_t maxSize = (available_for_allocation() ? max_size() : 0); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
69 |
size_t used = used_in_bytes(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
70 |
size_t committed = committed_in_bytes(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
71 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
72 |
return MemoryUsage(initial_size(), used, committed, maxSize); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
73 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
74 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
75 |
GenerationPool::GenerationPool(Generation* gen, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
76 |
const char* name, |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
77 |
bool support_usage_threshold) : |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
78 |
CollectedMemoryPool(name, gen->capacity(), gen->max_capacity(), |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
79 |
support_usage_threshold), _gen(gen) { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
80 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
81 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
82 |
size_t GenerationPool::used_in_bytes() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
83 |
return _gen->used(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
84 |
} |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
85 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
86 |
MemoryUsage GenerationPool::get_memory_usage() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
87 |
size_t used = used_in_bytes(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
88 |
size_t committed = _gen->capacity(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
89 |
size_t maxSize = (available_for_allocation() ? max_size() : 0); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
90 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
91 |
return MemoryUsage(initial_size(), used, committed, maxSize); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
diff
changeset
|
92 |
} |