Mercurial > hg > truffle
annotate src/share/vm/memory/space.inline.hpp @ 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 | c49dcaf78a65 |
children |
rev | line source |
---|---|
0 | 1 /* |
6842
b9a9ed0f8eeb
7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents:
6048
diff
changeset
|
2 * Copyright (c) 2000, 2012, 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:
342
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
342
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:
342
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_MEMORY_SPACE_INLINE_HPP |
26 #define SHARE_VM_MEMORY_SPACE_INLINE_HPP | |
27 | |
28 #include "gc_interface/collectedHeap.hpp" | |
29 #include "memory/space.hpp" | |
30 #include "memory/universe.hpp" | |
20198
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
31 #include "runtime/prefetch.inline.hpp" |
1972 | 32 #include "runtime/safepoint.hpp" |
33 | |
342 | 34 inline HeapWord* Space::block_start(const void* p) { |
35 return block_start_const(p); | |
36 } | |
37 | |
20198
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
38 #define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
39 /* Compute the new addresses for the live objects and store it in the mark \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
40 * Used by universe::mark_sweep_phase2() \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
41 */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
42 HeapWord* compact_top; /* This is where we are currently compacting to. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
43 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
44 /* We're sure to be here before any objects are compacted into this \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
45 * space, so this is a good time to initialize this: \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
46 */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
47 set_compaction_top(bottom()); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
48 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
49 if (cp->space == NULL) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
50 assert(cp->gen != NULL, "need a generation"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
51 assert(cp->threshold == NULL, "just checking"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
52 assert(cp->gen->first_compaction_space() == this, "just checking"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
53 cp->space = cp->gen->first_compaction_space(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
54 compact_top = cp->space->bottom(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
55 cp->space->set_compaction_top(compact_top); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
56 cp->threshold = cp->space->initialize_threshold(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
57 } else { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
58 compact_top = cp->space->compaction_top(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
59 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
60 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
61 /* We allow some amount of garbage towards the bottom of the space, so \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
62 * we don't start compacting before there is a significant gain to be made.\ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
63 * Occasionally, we want to ensure a full compaction, which is determined \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
64 * by the MarkSweepAlwaysCompactCount parameter. \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
65 */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
66 uint invocations = MarkSweep::total_invocations(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
67 bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
68 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
69 size_t allowed_deadspace = 0; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
70 if (skip_dead) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
71 const size_t ratio = allowed_dead_ratio(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
72 allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
73 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
74 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
75 HeapWord* q = bottom(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
76 HeapWord* t = scan_limit(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
77 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
78 HeapWord* end_of_live= q; /* One byte beyond the last byte of the last \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
79 live object. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
80 HeapWord* first_dead = end();/* The first dead object. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
81 LiveRange* liveRange = NULL; /* The current live range, recorded in the \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
82 first header of preceding free area. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
83 _first_dead = first_dead; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
84 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
85 const intx interval = PrefetchScanIntervalInBytes; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
86 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
87 while (q < t) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
88 assert(!block_is_obj(q) || \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
89 oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() || \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
90 oop(q)->mark()->has_bias_pattern(), \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
91 "these are the only valid states during a mark sweep"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
92 if (block_is_obj(q) && oop(q)->is_gc_marked()) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
93 /* prefetch beyond q */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
94 Prefetch::write(q, interval); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
95 size_t size = block_size(q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
96 compact_top = cp->space->forward(oop(q), size, cp, compact_top); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
97 q += size; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
98 end_of_live = q; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
99 } else { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
100 /* run over all the contiguous dead objects */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
101 HeapWord* end = q; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
102 do { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
103 /* prefetch beyond end */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
104 Prefetch::write(end, interval); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
105 end += block_size(end); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
106 } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
107 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
108 /* see if we might want to pretend this object is alive so that \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
109 * we don't have to compact quite as often. \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
110 */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
111 if (allowed_deadspace > 0 && q == compact_top) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
112 size_t sz = pointer_delta(end, q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
113 if (insert_deadspace(allowed_deadspace, q, sz)) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
114 compact_top = cp->space->forward(oop(q), sz, cp, compact_top); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
115 q = end; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
116 end_of_live = end; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
117 continue; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
118 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
119 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
120 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
121 /* otherwise, it really is a free region. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
122 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
123 /* for the previous LiveRange, record the end of the live objects. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
124 if (liveRange) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
125 liveRange->set_end(q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
126 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
127 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
128 /* record the current LiveRange object. \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
129 * liveRange->start() is overlaid on the mark word. \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
130 */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
131 liveRange = (LiveRange*)q; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
132 liveRange->set_start(end); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
133 liveRange->set_end(end); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
134 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
135 /* see if this is the first dead region. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
136 if (q < first_dead) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
137 first_dead = q; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
138 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
139 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
140 /* move on to the next object */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
141 q = end; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
142 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
143 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
144 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
145 assert(q == t, "just checking"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
146 if (liveRange != NULL) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
147 liveRange->set_end(q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
148 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
149 _end_of_live = end_of_live; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
150 if (end_of_live < first_dead) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
151 first_dead = end_of_live; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
152 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
153 _first_dead = first_dead; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
154 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
155 /* save the compaction_top of the compaction space. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
156 cp->space->set_compaction_top(compact_top); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
157 } |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
158 |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
159 #define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
160 /* adjust all the interior pointers to point at the new locations of objects \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
161 * Used by MarkSweep::mark_sweep_phase3() */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
162 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
163 HeapWord* q = bottom(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
164 HeapWord* t = _end_of_live; /* Established by "prepare_for_compaction". */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
165 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
166 assert(_first_dead <= _end_of_live, "Stands to reason, no?"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
167 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
168 if (q < t && _first_dead > q && \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
169 !oop(q)->is_gc_marked()) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
170 /* we have a chunk of the space which hasn't moved and we've \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
171 * reinitialized the mark word during the previous pass, so we can't \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
172 * use is_gc_marked for the traversal. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
173 HeapWord* end = _first_dead; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
174 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
175 while (q < end) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
176 /* I originally tried to conjoin "block_start(q) == q" to the \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
177 * assertion below, but that doesn't work, because you can't \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
178 * accurately traverse previous objects to get to the current one \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
179 * after their pointers have been \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
180 * updated, until the actual compaction is done. dld, 4/00 */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
181 assert(block_is_obj(q), \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
182 "should be at block boundaries, and should be looking at objs"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
183 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
184 /* point all the oops to the new location */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
185 size_t size = oop(q)->adjust_pointers(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
186 size = adjust_obj_size(size); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
187 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
188 q += size; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
189 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
190 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
191 if (_first_dead == t) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
192 q = t; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
193 } else { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
194 /* $$$ This is funky. Using this to read the previously written \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
195 * LiveRange. See also use below. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
196 q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
197 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
198 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
199 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
200 const intx interval = PrefetchScanIntervalInBytes; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
201 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
202 debug_only(HeapWord* prev_q = NULL); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
203 while (q < t) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
204 /* prefetch beyond q */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
205 Prefetch::write(q, interval); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
206 if (oop(q)->is_gc_marked()) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
207 /* q is alive */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
208 /* point all the oops to the new location */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
209 size_t size = oop(q)->adjust_pointers(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
210 size = adjust_obj_size(size); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
211 debug_only(prev_q = q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
212 q += size; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
213 } else { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
214 /* q is not a live object, so its mark should point at the next \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
215 * live object */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
216 debug_only(prev_q = q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
217 q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
218 assert(q > prev_q, "we should be moving forward through memory"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
219 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
220 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
221 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
222 assert(q == t, "just checking"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
223 } |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
224 |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
225 #define SCAN_AND_COMPACT(obj_size) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
226 /* Copy all live objects to their new location \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
227 * Used by MarkSweep::mark_sweep_phase4() */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
228 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
229 HeapWord* q = bottom(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
230 HeapWord* const t = _end_of_live; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
231 debug_only(HeapWord* prev_q = NULL); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
232 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
233 if (q < t && _first_dead > q && \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
234 !oop(q)->is_gc_marked()) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
235 debug_only( \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
236 /* we have a chunk of the space which hasn't moved and we've reinitialized \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
237 * the mark word during the previous pass, so we can't use is_gc_marked for \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
238 * the traversal. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
239 HeapWord* const end = _first_dead; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
240 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
241 while (q < end) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
242 size_t size = obj_size(q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
243 assert(!oop(q)->is_gc_marked(), \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
244 "should be unmarked (special dense prefix handling)"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
245 debug_only(prev_q = q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
246 q += size; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
247 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
248 ) /* debug_only */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
249 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
250 if (_first_dead == t) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
251 q = t; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
252 } else { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
253 /* $$$ Funky */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
254 q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
255 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
256 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
257 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
258 const intx scan_interval = PrefetchScanIntervalInBytes; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
259 const intx copy_interval = PrefetchCopyIntervalInBytes; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
260 while (q < t) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
261 if (!oop(q)->is_gc_marked()) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
262 /* mark is pointer to next marked oop */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
263 debug_only(prev_q = q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
264 q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
265 assert(q > prev_q, "we should be moving forward through memory"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
266 } else { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
267 /* prefetch beyond q */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
268 Prefetch::read(q, scan_interval); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
269 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
270 /* size and destination */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
271 size_t size = obj_size(q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
272 HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
273 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
274 /* prefetch beyond compaction_top */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
275 Prefetch::write(compaction_top, copy_interval); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
276 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
277 /* copy object and reinit its mark */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
278 assert(q != compaction_top, "everything in this pass should be moving"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
279 Copy::aligned_conjoint_words(q, compaction_top, size); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
280 oop(compaction_top)->init_mark(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
281 assert(oop(compaction_top)->klass() != NULL, "should have a class"); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
282 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
283 debug_only(prev_q = q); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
284 q += size; \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
285 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
286 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
287 \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
288 /* Let's remember if we were empty before we did the compaction. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
289 bool was_empty = used_region().is_empty(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
290 /* Reset space after compaction is complete */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
291 reset_after_compaction(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
292 /* We do this clear, below, since it has overloaded meanings for some */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
293 /* space subtypes. For example, OffsetTableContigSpace's that were */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
294 /* compacted into will have had their offset table thresholds updated */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
295 /* continuously, but those that weren't need to have their thresholds */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
296 /* re-initialized. Also mangles unused area for debugging. */ \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
297 if (used_region().is_empty()) { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
298 if (!was_empty) clear(SpaceDecorator::Mangle); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
299 } else { \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
300 if (ZapUnusedHeapArea) mangle_unused_area(); \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
301 } \ |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
302 } |
c49dcaf78a65
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
6842
diff
changeset
|
303 |
0 | 304 inline HeapWord* OffsetTableContigSpace::allocate(size_t size) { |
305 HeapWord* res = ContiguousSpace::allocate(size); | |
306 if (res != NULL) { | |
307 _offsets.alloc_block(res, size); | |
308 } | |
309 return res; | |
310 } | |
311 | |
312 // Because of the requirement of keeping "_offsets" up to date with the | |
313 // allocations, we sequentialize these with a lock. Therefore, best if | |
314 // this is used for larger LAB allocations only. | |
315 inline HeapWord* OffsetTableContigSpace::par_allocate(size_t size) { | |
316 MutexLocker x(&_par_alloc_lock); | |
317 // This ought to be just "allocate", because of the lock above, but that | |
318 // ContiguousSpace::allocate asserts that either the allocating thread | |
319 // holds the heap lock or it is the VM thread and we're at a safepoint. | |
320 // The best I (dld) could figure was to put a field in ContiguousSpace | |
321 // meaning "locking at safepoint taken care of", and set/reset that | |
322 // here. But this will do for now, especially in light of the comment | |
323 // above. Perhaps in the future some lock-free manner of keeping the | |
324 // coordination. | |
325 HeapWord* res = ContiguousSpace::par_allocate(size); | |
326 if (res != NULL) { | |
327 _offsets.alloc_block(res, size); | |
328 } | |
329 return res; | |
330 } | |
331 | |
342 | 332 inline HeapWord* |
333 OffsetTableContigSpace::block_start_const(const void* p) const { | |
0 | 334 return _offsets.block_start(p); |
335 } | |
336 | |
1972 | 337 #endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP |