Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/DataSection.java @ 22740:22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 26 Nov 2015 00:47:01 +0100 |
parents | 1bbd4a7c274b |
children | 8c8c7e8b7ab2 |
rev | line source |
---|---|
22054 | 1 /* |
2 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. | |
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 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
23 package jdk.vm.ci.code; |
22054 | 24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
25 import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString; |
22054 | 26 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22565
diff
changeset
|
27 import java.nio.ByteBuffer; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22565
diff
changeset
|
28 import java.util.ArrayList; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22565
diff
changeset
|
29 import java.util.Iterator; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22565
diff
changeset
|
30 import java.util.Objects; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22565
diff
changeset
|
31 import java.util.function.Consumer; |
22054 | 32 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
33 import jdk.vm.ci.code.CompilationResult.DataPatch; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
34 import jdk.vm.ci.code.CompilationResult.DataSectionReference; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
35 import jdk.vm.ci.code.DataSection.Data; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
36 import jdk.vm.ci.meta.SerializableConstant; |
22054 | 37 |
38 public final class DataSection implements Iterable<Data> { | |
39 | |
40 @FunctionalInterface | |
41 public interface DataBuilder { | |
42 | |
43 void emit(ByteBuffer buffer, Consumer<DataPatch> patch); | |
44 | |
45 static DataBuilder raw(byte[] data) { | |
46 return (buffer, patch) -> buffer.put(data); | |
47 } | |
48 | |
49 static DataBuilder serializable(SerializableConstant c) { | |
50 return (buffer, patch) -> c.serialize(buffer); | |
51 } | |
52 | |
53 static DataBuilder zero(int size) { | |
54 switch (size) { | |
55 case 1: | |
56 return (buffer, patch) -> buffer.put((byte) 0); | |
57 case 2: | |
58 return (buffer, patch) -> buffer.putShort((short) 0); | |
59 case 4: | |
60 return (buffer, patch) -> buffer.putInt(0); | |
61 case 8: | |
62 return (buffer, patch) -> buffer.putLong(0L); | |
63 default: | |
64 return (buffer, patch) -> { | |
65 int rest = size; | |
66 while (rest > 8) { | |
67 buffer.putLong(0L); | |
68 rest -= 8; | |
69 } | |
70 while (rest > 0) { | |
71 buffer.put((byte) 0); | |
72 rest--; | |
73 } | |
74 }; | |
75 } | |
76 } | |
77 } | |
78 | |
79 public static final class Data { | |
80 | |
81 private int alignment; | |
82 private final int size; | |
83 private final DataBuilder builder; | |
84 | |
85 private DataSectionReference ref; | |
86 | |
87 public Data(int alignment, int size, DataBuilder builder) { | |
88 this.alignment = alignment; | |
89 this.size = size; | |
90 this.builder = builder; | |
91 | |
92 // initialized in DataSection.insertData(Data) | |
93 ref = null; | |
94 } | |
95 | |
96 public void updateAlignment(int newAlignment) { | |
97 if (newAlignment == alignment) { | |
98 return; | |
99 } | |
100 alignment = lcm(alignment, newAlignment); | |
101 } | |
102 | |
103 public int getAlignment() { | |
104 return alignment; | |
105 } | |
106 | |
107 public int getSize() { | |
108 return size; | |
109 } | |
110 | |
111 public DataBuilder getBuilder() { | |
112 return builder; | |
113 } | |
114 | |
115 @Override | |
116 public int hashCode() { | |
117 // Data instances should not be used as hash map keys | |
118 throw new UnsupportedOperationException("hashCode"); | |
119 } | |
120 | |
121 @Override | |
122 public String toString() { | |
123 return identityHashCodeString(this); | |
124 } | |
125 | |
126 @Override | |
127 public boolean equals(Object obj) { | |
128 assert ref != null; | |
129 if (obj == this) { | |
130 return true; | |
131 } | |
132 if (obj instanceof Data) { | |
133 Data that = (Data) obj; | |
134 if (this.alignment == that.alignment && this.size == that.size && this.ref.equals(that.ref)) { | |
135 return true; | |
136 } | |
137 } | |
138 return false; | |
139 } | |
140 } | |
141 | |
142 private final ArrayList<Data> dataItems = new ArrayList<>(); | |
143 | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
144 private boolean closed; |
22054 | 145 private int sectionAlignment; |
146 private int sectionSize; | |
147 | |
148 @Override | |
149 public int hashCode() { | |
150 // DataSection instances should not be used as hash map keys | |
151 throw new UnsupportedOperationException("hashCode"); | |
152 } | |
153 | |
154 @Override | |
155 public String toString() { | |
156 return identityHashCodeString(this); | |
157 } | |
158 | |
159 @Override | |
160 public boolean equals(Object obj) { | |
161 if (this == obj) { | |
162 return true; | |
163 } | |
164 if (obj instanceof DataSection) { | |
165 DataSection that = (DataSection) obj; | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
166 if (this.closed == that.closed && this.sectionAlignment == that.sectionAlignment && this.sectionSize == that.sectionSize && Objects.equals(this.dataItems, that.dataItems)) { |
22054 | 167 return true; |
168 } | |
169 } | |
170 return false; | |
171 } | |
172 | |
173 /** | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
174 * Inserts a {@link Data} item into the data section. If the item is already in the data |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
175 * section, the same {@link DataSectionReference} is returned. |
22054 | 176 * |
177 * @param data the {@link Data} item to be inserted | |
178 * @return a unique {@link DataSectionReference} identifying the {@link Data} item | |
179 */ | |
180 public DataSectionReference insertData(Data data) { | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
181 checkOpen(); |
22564
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
182 synchronized (data) { |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
183 if (data.ref == null) { |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
184 data.ref = new DataSectionReference(); |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
185 dataItems.add(data); |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
186 } |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
187 return data.ref; |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
188 } |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
189 } |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
190 |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
191 /** |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
192 * Transfers all {@link Data} from the provided other {@link DataSection} to this |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
193 * {@link DataSection}, and empties the other section. |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
194 */ |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
195 public void addAll(DataSection other) { |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
196 checkOpen(); |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
197 other.checkOpen(); |
22564
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
198 |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
199 for (Data data : other.dataItems) { |
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
200 assert data.ref != null; |
22054 | 201 dataItems.add(data); |
202 } | |
22564
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
203 other.dataItems.clear(); |
22054 | 204 } |
205 | |
206 /** | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
207 * Determines if this object has been {@link #close() closed}. |
22054 | 208 */ |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
209 public boolean closed() { |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
210 return closed; |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
211 } |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
212 |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
213 /** |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
214 * Computes the layout of the data section and closes this object to further updates. |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
215 * |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
216 * This must be called exactly once. |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
217 */ |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
218 void close() { |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
219 checkOpen(); |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
220 closed = true; |
22054 | 221 |
222 // simple heuristic: put items with larger alignment requirement first | |
223 dataItems.sort((a, b) -> a.alignment - b.alignment); | |
224 | |
225 int position = 0; | |
22564
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
226 int alignment = 1; |
22054 | 227 for (Data d : dataItems) { |
22564
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
228 alignment = lcm(alignment, d.alignment); |
22054 | 229 position = align(position, d.alignment); |
230 | |
231 d.ref.setOffset(position); | |
232 position += d.size; | |
233 } | |
234 | |
22564
118f9560e0ea
Allow merging of DataSection, provide basic thread safety for adding Data to DataSection
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22411
diff
changeset
|
235 sectionAlignment = alignment; |
22054 | 236 sectionSize = position; |
237 } | |
238 | |
239 /** | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
240 * Gets the size of the data section. |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
241 * |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
242 * This must only be called once this object has been {@linkplain #closed() closed}. |
22054 | 243 */ |
244 public int getSectionSize() { | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
245 checkClosed(); |
22054 | 246 return sectionSize; |
247 } | |
248 | |
249 /** | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
250 * Gets the minimum alignment requirement of the data section. |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
251 * |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
252 * This must only be called once this object has been {@linkplain #closed() closed}. |
22054 | 253 */ |
254 public int getSectionAlignment() { | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
255 checkClosed(); |
22054 | 256 return sectionAlignment; |
257 } | |
258 | |
259 /** | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
260 * Builds the data section into a given buffer. |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
261 * |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
262 * This must only be called once this object has been {@linkplain #closed() closed}. |
22054 | 263 * |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
264 * @param buffer the {@link ByteBuffer} where the data section should be built. The buffer must |
22054 | 265 * hold at least {@link #getSectionSize()} bytes. |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
266 * @param patch a {@link Consumer} to receive {@link DataPatch data patches} for relocations in |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
267 * the data section |
22054 | 268 */ |
269 public void buildDataSection(ByteBuffer buffer, Consumer<DataPatch> patch) { | |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
270 checkClosed(); |
22054 | 271 for (Data d : dataItems) { |
272 buffer.position(d.ref.getOffset()); | |
273 d.builder.emit(buffer, patch); | |
274 } | |
275 } | |
276 | |
277 public Data findData(DataSectionReference ref) { | |
278 for (Data d : dataItems) { | |
279 if (d.ref == ref) { | |
280 return d; | |
281 } | |
282 } | |
283 return null; | |
284 } | |
285 | |
286 public Iterator<Data> iterator() { | |
287 return dataItems.iterator(); | |
288 } | |
289 | |
22411
78c691145967
Support putting multiple constants next to each other in DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents:
22113
diff
changeset
|
290 public static int lcm(int x, int y) { |
22054 | 291 if (x == 0) { |
292 return y; | |
293 } else if (y == 0) { | |
294 return x; | |
295 } | |
296 | |
297 int a = Math.max(x, y); | |
298 int b = Math.min(x, y); | |
299 while (b > 0) { | |
300 int tmp = a % b; | |
301 a = b; | |
302 b = tmp; | |
303 } | |
304 | |
305 int gcd = a; | |
306 return x * y / gcd; | |
307 } | |
308 | |
309 private static int align(int position, int alignment) { | |
310 return ((position + alignment - 1) / alignment) * alignment; | |
311 } | |
22113
598c75a3d1d1
Clear DataSection too, when CompilationResult is cleared
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22054
diff
changeset
|
312 |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
313 private void checkClosed() { |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
314 if (!closed) { |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
315 throw new IllegalStateException(); |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
316 } |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
317 } |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
318 |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
319 private void checkOpen() { |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
320 if (closed) { |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
321 throw new IllegalStateException(); |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
322 } |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
323 } |
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
324 |
22113
598c75a3d1d1
Clear DataSection too, when CompilationResult is cleared
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22054
diff
changeset
|
325 public void clear() { |
22740
22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
326 checkOpen(); |
22113
598c75a3d1d1
Clear DataSection too, when CompilationResult is cleared
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22054
diff
changeset
|
327 this.dataItems.clear(); |
598c75a3d1d1
Clear DataSection too, when CompilationResult is cleared
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22054
diff
changeset
|
328 this.sectionAlignment = 0; |
598c75a3d1d1
Clear DataSection too, when CompilationResult is cleared
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22054
diff
changeset
|
329 this.sectionSize = 0; |
598c75a3d1d1
Clear DataSection too, when CompilationResult is cleared
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22054
diff
changeset
|
330 } |
22054 | 331 } |