equal
deleted
inserted
replaced
23 |
23 |
24 |
24 |
25 |
25 |
26 package jdk.tools.jaotc; |
26 package jdk.tools.jaotc; |
27 |
27 |
|
28 import java.util.HashMap; |
28 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
29 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
29 |
30 |
30 /** |
31 /** |
31 * Constants used to mark special positions in code being installed into the code cache by Graal C++ |
32 * Constants used to mark special positions in code being installed into the code cache by Graal C++ |
32 * code. |
33 * code. |
54 CRC_TABLE_ADDRESS("CodeInstaller::CRC_TABLE_ADDRESS"), |
55 CRC_TABLE_ADDRESS("CodeInstaller::CRC_TABLE_ADDRESS"), |
55 LOG_OF_HEAP_REGION_GRAIN_BYTES("CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES"), |
56 LOG_OF_HEAP_REGION_GRAIN_BYTES("CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES"), |
56 INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED("CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED"); |
57 INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED("CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED"); |
57 |
58 |
58 private final int value; |
59 private final int value; |
|
60 private static HashMap<Integer, MarkId> lookup = new HashMap<Integer, MarkId>(); |
59 |
61 |
|
62 static { |
|
63 for (MarkId e : values()) { |
|
64 lookup.put(e.value, e); |
|
65 } |
|
66 } |
60 MarkId(String name) { |
67 MarkId(String name) { |
61 this.value = (int) (long) HotSpotJVMCIRuntime.runtime().getConfigStore().getConstants().get(name); |
68 this.value = (int) (long) HotSpotJVMCIRuntime.runtime().getConfigStore().getConstants().get(name); |
62 } |
69 } |
63 |
70 |
64 static MarkId getEnum(int value) { |
71 static MarkId getEnum(int value) { |
65 for (MarkId e : values()) { |
72 MarkId e = lookup.get(value); |
66 if (e.value == value) { |
73 if (e == null) { |
67 return e; |
74 throw new InternalError("Unknown enum value: " + value); |
68 } |
|
69 } |
75 } |
70 throw new InternalError("Unknown enum value: " + value); |
76 return e; |
71 } |
77 } |
72 } |
78 } |