Mercurial > hg > truffle
annotate src/share/vm/memory/memRegion.cpp @ 20543:e7d0505c8a30
8059758: Footprint regressions with JDK-8038423
Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything.
Reviewed-by: jwilhelm, brutisso
author | tschatzl |
---|---|
date | Fri, 10 Oct 2014 15:51:58 +0200 |
parents | 833b0f92429a |
children |
rev | line source |
---|---|
0 | 1 /* |
20360 | 2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
10271 | 26 #include "memory/allocation.hpp" |
27 #include "memory/allocation.inline.hpp" | |
1972 | 28 #include "memory/memRegion.hpp" |
29 #include "runtime/globals.hpp" | |
30 | |
0 | 31 // A very simple data structure representing a contigous word-aligned |
32 // region of address space. | |
33 | |
34 MemRegion MemRegion::intersection(const MemRegion mr2) const { | |
35 MemRegion res; | |
36 HeapWord* res_start = MAX2(start(), mr2.start()); | |
37 HeapWord* res_end = MIN2(end(), mr2.end()); | |
38 if (res_start < res_end) { | |
39 res.set_start(res_start); | |
40 res.set_end(res_end); | |
41 } | |
42 return res; | |
43 } | |
44 | |
45 MemRegion MemRegion::_union(const MemRegion mr2) const { | |
46 // If one region is empty, return the other | |
47 if (is_empty()) return mr2; | |
48 if (mr2.is_empty()) return MemRegion(start(), end()); | |
49 | |
50 // Otherwise, regions must overlap or be adjacent | |
51 assert(((start() <= mr2.start()) && (end() >= mr2.start())) || | |
52 ((mr2.start() <= start()) && (mr2.end() >= start())), | |
53 "non-adjacent or overlapping regions"); | |
54 MemRegion res; | |
55 HeapWord* res_start = MIN2(start(), mr2.start()); | |
56 HeapWord* res_end = MAX2(end(), mr2.end()); | |
57 res.set_start(res_start); | |
58 res.set_end(res_end); | |
59 return res; | |
60 } | |
61 | |
62 MemRegion MemRegion::minus(const MemRegion mr2) const { | |
63 // There seem to be 6 cases: | |
64 // |this MemRegion| | |
65 // |strictly below| | |
66 // |overlap beginning| | |
67 // |interior| | |
68 // |overlap ending| | |
69 // |strictly above| | |
70 // |completely overlapping| | |
71 // We can't deal with an interior case because it would | |
72 // produce two disjoint regions as a result. | |
73 // We aren't trying to be optimal in the number of tests below, | |
74 // but the order is important to distinguish the strictly cases | |
75 // from the overlapping cases. | |
76 if (mr2.end() <= start()) { | |
77 // strictly below | |
78 return MemRegion(start(), end()); | |
79 } | |
80 if (mr2.start() <= start() && mr2.end() <= end()) { | |
81 // overlap beginning | |
82 return MemRegion(mr2.end(), end()); | |
83 } | |
84 if (mr2.start() >= end()) { | |
85 // strictly above | |
86 return MemRegion(start(), end()); | |
87 } | |
88 if (mr2.start() >= start() && mr2.end() >= end()) { | |
89 // overlap ending | |
90 return MemRegion(start(), mr2.start()); | |
91 } | |
92 if (mr2.start() <= start() && mr2.end() >= end()) { | |
93 // completely overlapping | |
94 return MemRegion(); | |
95 } | |
96 if (mr2.start() > start() && mr2.end() < end()) { | |
97 // interior | |
98 guarantee(false, "MemRegion::minus, but interior"); | |
99 return MemRegion(); | |
100 } | |
101 ShouldNotReachHere(); | |
102 return MemRegion(); | |
103 } | |
10271 | 104 |
12146
9758d9f36299
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
10271
diff
changeset
|
105 void* MemRegion::operator new(size_t size) throw() { |
20360 | 106 return (address)AllocateHeap(size, mtGC, CURRENT_PC, |
107 AllocFailStrategy::RETURN_NULL); | |
10271 | 108 } |
109 | |
12146
9758d9f36299
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
10271
diff
changeset
|
110 void* MemRegion::operator new [](size_t size) throw() { |
20360 | 111 return (address)AllocateHeap(size, mtGC, CURRENT_PC, |
112 AllocFailStrategy::RETURN_NULL); | |
10271 | 113 } |
114 void MemRegion::operator delete(void* p) { | |
115 FreeHeap(p, mtGC); | |
116 } | |
117 | |
118 void MemRegion::operator delete [](void* p) { | |
119 FreeHeap(p, mtGC); | |
120 } | |
121 |