Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java @ 22741:e9424bc1e288
bug fix for 8143730
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 26 Nov 2015 02:28:38 +0100 |
parents | 22110ef74a40 |
children | 9273bb6ba33e |
comparison
equal
deleted
inserted
replaced
22740:22110ef74a40 | 22741:e9424bc1e288 |
---|---|
43 import jdk.vm.ci.code.CompilationResult.JumpTable; | 43 import jdk.vm.ci.code.CompilationResult.JumpTable; |
44 import jdk.vm.ci.code.CompilationResult.Mark; | 44 import jdk.vm.ci.code.CompilationResult.Mark; |
45 import jdk.vm.ci.code.CompilationResult.Site; | 45 import jdk.vm.ci.code.CompilationResult.Site; |
46 import jdk.vm.ci.code.DataSection; | 46 import jdk.vm.ci.code.DataSection; |
47 import jdk.vm.ci.code.InfopointReason; | 47 import jdk.vm.ci.code.InfopointReason; |
48 import jdk.vm.ci.common.JVMCIError; | |
48 import jdk.vm.ci.meta.Assumptions.Assumption; | 49 import jdk.vm.ci.meta.Assumptions.Assumption; |
49 import jdk.vm.ci.meta.ResolvedJavaMethod; | 50 import jdk.vm.ci.meta.ResolvedJavaMethod; |
50 | 51 |
51 /** | 52 /** |
52 * A {@link CompilationResult} with additional HotSpot-specific information required for installing | 53 * A {@link CompilationResult} with additional HotSpot-specific information required for installing |
156 static class SiteComparator implements Comparator<Site> { | 157 static class SiteComparator implements Comparator<Site> { |
157 | 158 |
158 /** | 159 /** |
159 * Defines an order for sorting {@link Infopoint}s based on their | 160 * Defines an order for sorting {@link Infopoint}s based on their |
160 * {@linkplain Infopoint#reason reasons}. This is used to choose which infopoint to preserve | 161 * {@linkplain Infopoint#reason reasons}. This is used to choose which infopoint to preserve |
161 * when multiple infopoints collide on the same PC offset. | 162 * when multiple infopoints collide on the same PC offset. A negative order value implies a |
163 * non-optional infopoint (i.e., must be preserved). | |
162 */ | 164 */ |
163 static final Map<InfopointReason, Integer> HOTSPOT_INFOPOINT_SORT_ORDER = new EnumMap<>(InfopointReason.class); | 165 static final Map<InfopointReason, Integer> HOTSPOT_INFOPOINT_SORT_ORDER = new EnumMap<>(InfopointReason.class); |
164 static { | 166 static { |
165 int order = 0; | 167 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.SAFEPOINT, -4); |
166 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.SAFEPOINT, ++order); | 168 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.CALL, -3); |
167 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.CALL, ++order); | 169 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.IMPLICIT_EXCEPTION, -2); |
168 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.IMPLICIT_EXCEPTION, ++order); | 170 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_START, 2); |
169 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_START, ++order); | 171 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_END, 3); |
170 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_END, ++order); | 172 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.BYTECODE_POSITION, 4); |
171 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.BYTECODE_POSITION, ++order); | 173 } |
172 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.SAFEPOINT, ++order); | 174 |
175 static int ord(Infopoint info) { | |
176 return HOTSPOT_INFOPOINT_SORT_ORDER.get(info.reason); | |
177 } | |
178 | |
179 static int checkCollision(Infopoint i1, Infopoint i2) { | |
180 int o1 = ord(i1); | |
181 int o2 = ord(i2); | |
182 if (o1 < 0 && o2 < 0) { | |
183 throw new JVMCIError("Non optional infopoints cannot collide: %s and %s", i1, i2); | |
184 } | |
185 return o1 - o2; | |
173 } | 186 } |
174 | 187 |
175 /** | 188 /** |
176 * Records whether any two {@link Infopoint}s had the same {@link Infopoint#pcOffset}. | 189 * Records whether any two {@link Infopoint}s had the same {@link Infopoint#pcOffset}. |
177 */ | 190 */ |
195 if (s1IsInfopoint != s2IsInfopoint) { | 208 if (s1IsInfopoint != s2IsInfopoint) { |
196 return s1IsInfopoint ? 1 : -1; | 209 return s1IsInfopoint ? 1 : -1; |
197 } | 210 } |
198 | 211 |
199 if (s1IsInfopoint) { | 212 if (s1IsInfopoint) { |
200 assert s2IsInfopoint; | |
201 Infopoint s1Info = (Infopoint) s1; | |
202 Infopoint s2Info = (Infopoint) s2; | |
203 sawCollidingInfopoints = true; | 213 sawCollidingInfopoints = true; |
204 return HOTSPOT_INFOPOINT_SORT_ORDER.get(s1Info.reason) - HOTSPOT_INFOPOINT_SORT_ORDER.get(s2Info.reason); | 214 return checkCollision((Infopoint) s1, (Infopoint) s2); |
205 } | 215 } |
206 } | 216 } |
207 return s1.pcOffset - s2.pcOffset; | 217 return s1.pcOffset - s2.pcOffset; |
208 } | 218 } |
209 } | 219 } |
237 if (lastInfopoint == null || lastInfopoint.pcOffset != info.pcOffset) { | 247 if (lastInfopoint == null || lastInfopoint.pcOffset != info.pcOffset) { |
238 lastInfopoint = info; | 248 lastInfopoint = info; |
239 copy.add(info); | 249 copy.add(info); |
240 } else { | 250 } else { |
241 // Omit this colliding infopoint | 251 // Omit this colliding infopoint |
242 assert lastInfopoint.reason.compareTo(info.reason) < 0; | 252 assert lastInfopoint.reason.compareTo(info.reason) <= 0; |
243 } | 253 } |
244 } else { | 254 } else { |
245 copy.add(result[i]); | 255 copy.add(result[i]); |
246 } | 256 } |
247 } | 257 } |