author | hannesw |
Fri, 24 May 2019 16:53:44 +0200 | |
changeset 58624 | 26867ad686e9 |
parent 57957 | 4364524f8cac |
child 58679 | 9c3209ff7550 |
child 58793 | 81ad1da857f6 |
permissions | -rw-r--r-- |
43972 | 1 |
/* |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
43972 | 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 |
*/ |
|
23 |
package jdk.vm.ci.hotspot; |
|
24 |
||
25 |
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; |
|
26 |
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; |
|
27 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
28 |
import jdk.vm.ci.services.Services; |
43972 | 29 |
import jdk.internal.misc.Unsafe; |
30 |
||
31 |
/** |
|
32 |
* Used to access native configuration details. |
|
33 |
* |
|
34 |
* All non-static, public fields in this class are so that they can be compiled as constants. |
|
35 |
*/ |
|
36 |
class HotSpotVMConfig extends HotSpotVMConfigAccess { |
|
37 |
||
38 |
/** |
|
39 |
* Gets the configuration associated with the singleton {@link HotSpotJVMCIRuntime}. |
|
40 |
*/ |
|
41 |
static HotSpotVMConfig config() { |
|
42 |
return runtime().getConfig(); |
|
43 |
} |
|
44 |
||
45 |
private final String osArch = getHostArchitectureName(); |
|
46 |
||
47 |
HotSpotVMConfig(HotSpotVMConfigStore store) { |
|
48 |
super(store); |
|
49 |
} |
|
50 |
||
51 |
/** |
|
52 |
* Gets the host architecture name for the purpose of finding the corresponding |
|
53 |
* {@linkplain HotSpotJVMCIBackendFactory backend}. |
|
54 |
*/ |
|
55 |
String getHostArchitectureName() { |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
56 |
String arch = Services.getSavedProperty("os.arch"); |
43972 | 57 |
switch (arch) { |
58 |
case "x86_64": |
|
59 |
return "amd64"; |
|
60 |
||
61 |
case "sparcv9": |
|
62 |
return "sparc"; |
|
63 |
default: |
|
64 |
return arch; |
|
65 |
} |
|
66 |
} |
|
67 |
||
68 |
final boolean useDeferredInitBarriers = getFlag("ReduceInitialCardMarks", Boolean.class); |
|
69 |
||
70 |
final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class); |
|
71 |
||
48505
5db30620a3db
8191362: [Graal] gc/g1/TestShrinkAuxiliaryData tests crash with "assert(check_klass_alignment(result)) failed: address not aligned"
thartmann
parents:
47668
diff
changeset
|
72 |
final int objectAlignment = getFlag("ObjectAlignmentInBytes", Integer.class); |
5db30620a3db
8191362: [Graal] gc/g1/TestShrinkAuxiliaryData tests crash with "assert(check_klass_alignment(result)) failed: address not aligned"
thartmann
parents:
47668
diff
changeset
|
73 |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
74 |
final int hubOffset = getFieldOffset("oopDesc::_metadata._klass", Integer.class, "Klass*"); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
75 |
|
57777
90ead0febf56
8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents:
54669
diff
changeset
|
76 |
final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markWord"); |
43972 | 77 |
final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*"); |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
78 |
final int superOffset = getFieldOffset("Klass::_super", Integer.class, "Klass*"); |
43972 | 79 |
final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*"); |
80 |
final int superCheckOffsetOffset = getFieldOffset("Klass::_super_check_offset", Integer.class, "juint"); |
|
81 |
final int secondarySuperCacheOffset = getFieldOffset("Klass::_secondary_super_cache", Integer.class, "Klass*"); |
|
82 |
||
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
83 |
final int classLoaderDataOffset = getFieldOffset("Klass::_class_loader_data", Integer.class, "ClassLoaderData*"); |
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
84 |
|
43972 | 85 |
/** |
86 |
* The offset of the _java_mirror field (of type {@link Class}) in a Klass. |
|
87 |
*/ |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
88 |
final int javaMirrorOffset = getFieldOffset("Klass::_java_mirror", Integer.class, "OopHandle"); |
43972 | 89 |
|
90 |
final int klassAccessFlagsOffset = getFieldOffset("Klass::_access_flags", Integer.class, "AccessFlags"); |
|
91 |
final int klassLayoutHelperOffset = getFieldOffset("Klass::_layout_helper", Integer.class, "jint"); |
|
92 |
||
93 |
final int klassLayoutHelperNeutralValue = getConstant("Klass::_lh_neutral_value", Integer.class); |
|
94 |
final int klassLayoutHelperInstanceSlowPathBit = getConstant("Klass::_lh_instance_slow_path_bit", Integer.class); |
|
95 |
||
96 |
final int vtableEntrySize = getFieldValue("CompilerToVM::Data::sizeof_vtableEntry", Integer.class, "int"); |
|
97 |
final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*"); |
|
98 |
||
99 |
final int instanceKlassSourceFileNameIndexOffset = getFieldOffset("InstanceKlass::_source_file_name_index", Integer.class, "u2"); |
|
100 |
final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1"); |
|
101 |
final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*"); |
|
102 |
final int instanceKlassFieldsOffset = getFieldOffset("InstanceKlass::_fields", Integer.class, "Array<u2>*"); |
|
52645
74cf02d5f6e2
8213907: [JVMCI] avoid Class.getDeclared* methods when converting JVMCI objects to reflection objects
dnsimon
parents:
51444
diff
changeset
|
103 |
final int instanceKlassAnnotationsOffset = getFieldOffset("InstanceKlass::_annotations", Integer.class, "Annotations*"); |
47668 | 104 |
final int instanceKlassMiscFlagsOffset = getFieldOffset("InstanceKlass::_misc_flags", Integer.class, "u2"); |
43972 | 105 |
final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int"); |
106 |
final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int"); |
|
107 |
||
108 |
final int instanceKlassStateLinked = getConstant("InstanceKlass::linked", Integer.class); |
|
109 |
final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class); |
|
51444
3e5d28e6de32
8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents:
50858
diff
changeset
|
110 |
final int instanceKlassMiscIsUnsafeAnonymous = getConstant("InstanceKlass::_misc_is_unsafe_anonymous", Integer.class); |
43972 | 111 |
|
52645
74cf02d5f6e2
8213907: [JVMCI] avoid Class.getDeclared* methods when converting JVMCI objects to reflection objects
dnsimon
parents:
51444
diff
changeset
|
112 |
final int annotationsFieldAnnotationsOffset = getFieldOffset("Annotations::_fields_annotations", Integer.class, "Array<AnnotationArray*>*"); |
74cf02d5f6e2
8213907: [JVMCI] avoid Class.getDeclared* methods when converting JVMCI objects to reflection objects
dnsimon
parents:
51444
diff
changeset
|
113 |
final int fieldsAnnotationsBaseOffset = getFieldValue("CompilerToVM::Data::_fields_annotations_base_offset", Integer.class, "int"); |
74cf02d5f6e2
8213907: [JVMCI] avoid Class.getDeclared* methods when converting JVMCI objects to reflection objects
dnsimon
parents:
51444
diff
changeset
|
114 |
|
43972 | 115 |
final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int"); |
116 |
final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class); |
|
117 |
final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class); |
|
118 |
||
119 |
final int fieldInfoAccessFlagsOffset = getConstant("FieldInfo::access_flags_offset", Integer.class); |
|
120 |
final int fieldInfoNameIndexOffset = getConstant("FieldInfo::name_index_offset", Integer.class); |
|
121 |
final int fieldInfoSignatureIndexOffset = getConstant("FieldInfo::signature_index_offset", Integer.class); |
|
122 |
final int fieldInfoLowPackedOffset = getConstant("FieldInfo::low_packed_offset", Integer.class); |
|
123 |
final int fieldInfoHighPackedOffset = getConstant("FieldInfo::high_packed_offset", Integer.class); |
|
124 |
final int fieldInfoFieldSlots = getConstant("FieldInfo::field_slots", Integer.class); |
|
125 |
||
126 |
final int fieldInfoTagSize = getConstant("FIELDINFO_TAG_SIZE", Integer.class); |
|
127 |
||
128 |
final int jvmAccHasFinalizer = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class); |
|
129 |
final int jvmAccFieldInternal = getConstant("JVM_ACC_FIELD_INTERNAL", Integer.class); |
|
130 |
final int jvmAccFieldStable = getConstant("JVM_ACC_FIELD_STABLE", Integer.class); |
|
131 |
final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class); |
|
132 |
final int jvmAccIsCloneableFast = getConstant("JVM_ACC_IS_CLONEABLE_FAST", Integer.class); |
|
133 |
||
134 |
// These modifiers are not public in Modifier so we get them via vmStructs. |
|
135 |
final int jvmAccSynthetic = getConstant("JVM_ACC_SYNTHETIC", Integer.class); |
|
136 |
final int jvmAccAnnotation = getConstant("JVM_ACC_ANNOTATION", Integer.class); |
|
137 |
final int jvmAccBridge = getConstant("JVM_ACC_BRIDGE", Integer.class); |
|
138 |
final int jvmAccVarargs = getConstant("JVM_ACC_VARARGS", Integer.class); |
|
139 |
final int jvmAccEnum = getConstant("JVM_ACC_ENUM", Integer.class); |
|
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
52645
diff
changeset
|
140 |
final int jvmAccInterface = getConstant("JVM_ACC_INTERFACE", Integer.class); |
43972 | 141 |
|
142 |
// This is only valid on AMD64. |
|
143 |
final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, osArch.equals("amd64") ? null : 0); |
|
144 |
||
57777
90ead0febf56
8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents:
54669
diff
changeset
|
145 |
private final int markWordNoHashInPlace = getConstant("markWord::no_hash_in_place", Integer.class); |
90ead0febf56
8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents:
54669
diff
changeset
|
146 |
private final int markWordNoLockInPlace = getConstant("markWord::no_lock_in_place", Integer.class); |
43972 | 147 |
|
148 |
/** |
|
57777
90ead0febf56
8229258: Rework markOop and markOopDesc into a simpler mark word value carrier
stefank
parents:
54669
diff
changeset
|
149 |
* See {@code markWord::prototype()}. |
43972 | 150 |
*/ |
151 |
long arrayPrototypeMarkWord() { |
|
152 |
return markWordNoHashInPlace | markWordNoLockInPlace; |
|
153 |
} |
|
154 |
||
155 |
final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags"); |
|
156 |
final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*"); |
|
157 |
final int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2"); |
|
158 |
final int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2"); |
|
159 |
final int methodVtableIndexOffset = getFieldOffset("Method::_vtable_index", Integer.class, "int"); |
|
160 |
||
161 |
final int methodDataOffset = getFieldOffset("Method::_method_data", Integer.class, "MethodData*"); |
|
162 |
final int methodCodeOffset = getFieldOffset("Method::_code", Integer.class, "CompiledMethod*"); |
|
163 |
||
164 |
final int methodFlagsCallerSensitive = getConstant("Method::_caller_sensitive", Integer.class); |
|
165 |
final int methodFlagsForceInline = getConstant("Method::_force_inline", Integer.class); |
|
166 |
final int methodFlagsIntrinsicCandidate = getConstant("Method::_intrinsic_candidate", Integer.class); |
|
167 |
final int methodFlagsDontInline = getConstant("Method::_dont_inline", Integer.class); |
|
168 |
final int methodFlagsReservedStackAccess = getConstant("Method::_reserved_stack_access", Integer.class); |
|
169 |
final int nonvirtualVtableIndex = getConstant("Method::nonvirtual_vtable_index", Integer.class); |
|
170 |
final int invalidVtableIndex = getConstant("Method::invalid_vtable_index", Integer.class); |
|
171 |
||
172 |
final int methodDataSize = getFieldOffset("MethodData::_size", Integer.class, "int"); |
|
173 |
final int methodDataDataSize = getFieldOffset("MethodData::_data_size", Integer.class, "int"); |
|
174 |
final int methodDataOopDataOffset = getFieldOffset("MethodData::_data[0]", Integer.class, "intptr_t"); |
|
175 |
final int methodDataOopTrapHistoryOffset = getFieldOffset("MethodData::_trap_hist._array[0]", Integer.class, "u1"); |
|
176 |
final int methodDataIRSizeOffset = getFieldOffset("MethodData::_jvmci_ir_size", Integer.class, "int"); |
|
177 |
||
178 |
final int methodDataDecompiles = getFieldOffset("MethodData::_nof_decompiles", Integer.class, "uint"); |
|
179 |
final int methodDataOverflowRecompiles = getFieldOffset("MethodData::_nof_overflow_recompiles", Integer.class, "uint"); |
|
180 |
final int methodDataOverflowTraps = getFieldOffset("MethodData::_nof_overflow_traps", Integer.class, "uint"); |
|
181 |
||
182 |
final int nmethodCompLevelOffset = getFieldOffset("nmethod::_comp_level", Integer.class, "int"); |
|
183 |
||
184 |
final int compilationLevelNone = getConstant("CompLevel_none", Integer.class); |
|
185 |
final int compilationLevelSimple = getConstant("CompLevel_simple", Integer.class); |
|
186 |
final int compilationLevelLimitedProfile = getConstant("CompLevel_limited_profile", Integer.class); |
|
187 |
final int compilationLevelFullProfile = getConstant("CompLevel_full_profile", Integer.class); |
|
188 |
final int compilationLevelFullOptimization = getConstant("CompLevel_full_optimization", Integer.class); |
|
189 |
||
190 |
final int compLevelAdjustmentNone = getConstant("JVMCIRuntime::none", Integer.class); |
|
191 |
final int compLevelAdjustmentByHolder = getConstant("JVMCIRuntime::by_holder", Integer.class); |
|
192 |
final int compLevelAdjustmentByFullSignature = getConstant("JVMCIRuntime::by_full_signature", Integer.class); |
|
193 |
||
194 |
final int invocationEntryBci = getConstant("InvocationEntryBci", Integer.class); |
|
195 |
||
196 |
final int extraStackEntries = getFieldValue("CompilerToVM::Data::Method_extra_stack_entries", Integer.class, "int"); |
|
197 |
||
198 |
final int constMethodConstantsOffset = getFieldOffset("ConstMethod::_constants", Integer.class, "ConstantPool*"); |
|
199 |
final int constMethodFlagsOffset = getFieldOffset("ConstMethod::_flags", Integer.class, "u2"); |
|
200 |
final int constMethodCodeSizeOffset = getFieldOffset("ConstMethod::_code_size", Integer.class, "u2"); |
|
201 |
final int constMethodNameIndexOffset = getFieldOffset("ConstMethod::_name_index", Integer.class, "u2"); |
|
202 |
final int constMethodSignatureIndexOffset = getFieldOffset("ConstMethod::_signature_index", Integer.class, "u2"); |
|
47668 | 203 |
final int constMethodMethodIdnumOffset = getFieldOffset("ConstMethod::_method_idnum", Integer.class, "u2"); |
43972 | 204 |
final int constMethodMaxStackOffset = getFieldOffset("ConstMethod::_max_stack", Integer.class, "u2"); |
205 |
final int methodMaxLocalsOffset = getFieldOffset("ConstMethod::_max_locals", Integer.class, "u2"); |
|
206 |
||
207 |
final int constMethodHasLineNumberTable = getConstant("ConstMethod::_has_linenumber_table", Integer.class); |
|
208 |
final int constMethodHasLocalVariableTable = getConstant("ConstMethod::_has_localvariable_table", Integer.class); |
|
52645
74cf02d5f6e2
8213907: [JVMCI] avoid Class.getDeclared* methods when converting JVMCI objects to reflection objects
dnsimon
parents:
51444
diff
changeset
|
209 |
final int constMethodHasMethodAnnotations = getConstant("ConstMethod::_has_method_annotations", Integer.class); |
74cf02d5f6e2
8213907: [JVMCI] avoid Class.getDeclared* methods when converting JVMCI objects to reflection objects
dnsimon
parents:
51444
diff
changeset
|
210 |
final int constMethodHasParameterAnnotations = getConstant("ConstMethod::_has_parameter_annotations", Integer.class); |
43972 | 211 |
final int constMethodHasExceptionTable = getConstant("ConstMethod::_has_exception_table", Integer.class); |
212 |
||
213 |
final int exceptionTableElementSize = getFieldValue("CompilerToVM::Data::sizeof_ExceptionTableElement", Integer.class, "int"); |
|
214 |
final int exceptionTableElementStartPcOffset = getFieldOffset("ExceptionTableElement::start_pc", Integer.class, "u2"); |
|
215 |
final int exceptionTableElementEndPcOffset = getFieldOffset("ExceptionTableElement::end_pc", Integer.class, "u2"); |
|
216 |
final int exceptionTableElementHandlerPcOffset = getFieldOffset("ExceptionTableElement::handler_pc", Integer.class, "u2"); |
|
217 |
final int exceptionTableElementCatchTypeIndexOffset = getFieldOffset("ExceptionTableElement::catch_type_index", Integer.class, "u2"); |
|
218 |
||
219 |
final int localVariableTableElementSize = getFieldValue("CompilerToVM::Data::sizeof_LocalVariableTableElement", Integer.class, "int"); |
|
220 |
final int localVariableTableElementStartBciOffset = getFieldOffset("LocalVariableTableElement::start_bci", Integer.class, "u2"); |
|
221 |
final int localVariableTableElementLengthOffset = getFieldOffset("LocalVariableTableElement::length", Integer.class, "u2"); |
|
222 |
final int localVariableTableElementNameCpIndexOffset = getFieldOffset("LocalVariableTableElement::name_cp_index", Integer.class, "u2"); |
|
223 |
final int localVariableTableElementDescriptorCpIndexOffset = getFieldOffset("LocalVariableTableElement::descriptor_cp_index", Integer.class, "u2"); |
|
224 |
final int localVariableTableElementSlotOffset = getFieldOffset("LocalVariableTableElement::slot", Integer.class, "u2"); |
|
225 |
||
226 |
final int constantPoolSize = getFieldValue("CompilerToVM::Data::sizeof_ConstantPool", Integer.class, "int"); |
|
227 |
final int constantPoolTagsOffset = getFieldOffset("ConstantPool::_tags", Integer.class, "Array<u1>*"); |
|
228 |
final int constantPoolHolderOffset = getFieldOffset("ConstantPool::_pool_holder", Integer.class, "InstanceKlass*"); |
|
229 |
final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length", Integer.class, "int"); |
|
48826 | 230 |
final int constantPoolFlagsOffset = getFieldOffset("ConstantPool::_flags", Integer.class, "int"); |
43972 | 231 |
|
232 |
final int constantPoolCpCacheIndexTag = getConstant("ConstantPool::CPCACHE_INDEX_TAG", Integer.class); |
|
48826 | 233 |
final int constantPoolHasDynamicConstant = getConstant("ConstantPool::_has_dynamic_constant", Integer.class); |
43972 | 234 |
|
235 |
final int jvmConstantUtf8 = getConstant("JVM_CONSTANT_Utf8", Integer.class); |
|
236 |
final int jvmConstantInteger = getConstant("JVM_CONSTANT_Integer", Integer.class); |
|
237 |
final int jvmConstantLong = getConstant("JVM_CONSTANT_Long", Integer.class); |
|
238 |
final int jvmConstantFloat = getConstant("JVM_CONSTANT_Float", Integer.class); |
|
239 |
final int jvmConstantDouble = getConstant("JVM_CONSTANT_Double", Integer.class); |
|
240 |
final int jvmConstantClass = getConstant("JVM_CONSTANT_Class", Integer.class); |
|
241 |
final int jvmConstantUnresolvedClass = getConstant("JVM_CONSTANT_UnresolvedClass", Integer.class); |
|
242 |
final int jvmConstantUnresolvedClassInError = getConstant("JVM_CONSTANT_UnresolvedClassInError", Integer.class); |
|
243 |
final int jvmConstantString = getConstant("JVM_CONSTANT_String", Integer.class); |
|
244 |
final int jvmConstantFieldref = getConstant("JVM_CONSTANT_Fieldref", Integer.class); |
|
245 |
final int jvmConstantMethodref = getConstant("JVM_CONSTANT_Methodref", Integer.class); |
|
246 |
final int jvmConstantInterfaceMethodref = getConstant("JVM_CONSTANT_InterfaceMethodref", Integer.class); |
|
247 |
final int jvmConstantNameAndType = getConstant("JVM_CONSTANT_NameAndType", Integer.class); |
|
248 |
final int jvmConstantMethodHandle = getConstant("JVM_CONSTANT_MethodHandle", Integer.class); |
|
249 |
final int jvmConstantMethodHandleInError = getConstant("JVM_CONSTANT_MethodHandleInError", Integer.class); |
|
250 |
final int jvmConstantMethodType = getConstant("JVM_CONSTANT_MethodType", Integer.class); |
|
251 |
final int jvmConstantMethodTypeInError = getConstant("JVM_CONSTANT_MethodTypeInError", Integer.class); |
|
252 |
final int jvmConstantInvokeDynamic = getConstant("JVM_CONSTANT_InvokeDynamic", Integer.class); |
|
253 |
||
254 |
final int jvmConstantExternalMax = getConstant("JVM_CONSTANT_ExternalMax", Integer.class); |
|
255 |
final int jvmConstantInternalMin = getConstant("JVM_CONSTANT_InternalMin", Integer.class); |
|
256 |
final int jvmConstantInternalMax = getConstant("JVM_CONSTANT_InternalMax", Integer.class); |
|
257 |
||
258 |
final int heapWordSize = getConstant("HeapWordSize", Integer.class); |
|
259 |
||
260 |
final long vmSymbolsSymbols = getFieldAddress("vmSymbols::_symbols[0]", "Symbol*"); |
|
261 |
final int vmSymbolsFirstSID = getConstant("vmSymbols::FIRST_SID", Integer.class); |
|
262 |
final int vmSymbolsSIDLimit = getConstant("vmSymbols::SID_LIMIT", Integer.class); |
|
263 |
||
264 |
final long symbolInit = getFieldValue("CompilerToVM::Data::symbol_init", Long.class); |
|
265 |
final long symbolClinit = getFieldValue("CompilerToVM::Data::symbol_clinit", Long.class); |
|
266 |
||
267 |
/** |
|
268 |
* Returns the symbol in the {@code vmSymbols} table at position {@code index} as a |
|
269 |
* {@link String}. |
|
270 |
* |
|
271 |
* @param index position in the symbol table |
|
272 |
* @return the symbol at position id |
|
273 |
*/ |
|
274 |
String symbolAt(int index) { |
|
50858 | 275 |
HotSpotJVMCIRuntime runtime = runtime(); |
43972 | 276 |
assert vmSymbolsFirstSID <= index && index < vmSymbolsSIDLimit : "index " + index + " is out of bounds"; |
52645
74cf02d5f6e2
8213907: [JVMCI] avoid Class.getDeclared* methods when converting JVMCI objects to reflection objects
dnsimon
parents:
51444
diff
changeset
|
277 |
int offset = index * Unsafe.ADDRESS_SIZE; |
43972 | 278 |
return runtime.getCompilerToVM().getSymbol(UNSAFE.getAddress(vmSymbolsSymbols + offset)); |
279 |
} |
|
280 |
||
281 |
final int universeBaseVtableSize = getFieldValue("CompilerToVM::Data::Universe_base_vtable_size", Integer.class, "int"); |
|
282 |
||
283 |
final int baseVtableLength() { |
|
284 |
return universeBaseVtableSize / (vtableEntrySize / heapWordSize); |
|
285 |
} |
|
286 |
||
287 |
final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int"); |
|
288 |
||
289 |
/** |
|
290 |
* The DataLayout header size is the same as the cell size. |
|
291 |
*/ |
|
292 |
final int dataLayoutHeaderSize = getConstant("DataLayout::cell_size", Integer.class); |
|
293 |
final int dataLayoutTagOffset = getFieldOffset("DataLayout::_header._struct._tag", Integer.class, "u1"); |
|
294 |
final int dataLayoutFlagsOffset = getFieldOffset("DataLayout::_header._struct._flags", Integer.class, "u1"); |
|
295 |
final int dataLayoutBCIOffset = getFieldOffset("DataLayout::_header._struct._bci", Integer.class, "u2"); |
|
296 |
final int dataLayoutCellSize = getConstant("DataLayout::cell_size", Integer.class); |
|
297 |
||
298 |
final int dataLayoutNoTag = getConstant("DataLayout::no_tag", Integer.class); |
|
299 |
final int dataLayoutBitDataTag = getConstant("DataLayout::bit_data_tag", Integer.class); |
|
300 |
final int dataLayoutCounterDataTag = getConstant("DataLayout::counter_data_tag", Integer.class); |
|
301 |
final int dataLayoutJumpDataTag = getConstant("DataLayout::jump_data_tag", Integer.class); |
|
302 |
final int dataLayoutReceiverTypeDataTag = getConstant("DataLayout::receiver_type_data_tag", Integer.class); |
|
303 |
final int dataLayoutVirtualCallDataTag = getConstant("DataLayout::virtual_call_data_tag", Integer.class); |
|
304 |
final int dataLayoutRetDataTag = getConstant("DataLayout::ret_data_tag", Integer.class); |
|
305 |
final int dataLayoutBranchDataTag = getConstant("DataLayout::branch_data_tag", Integer.class); |
|
306 |
final int dataLayoutMultiBranchDataTag = getConstant("DataLayout::multi_branch_data_tag", Integer.class); |
|
307 |
final int dataLayoutArgInfoDataTag = getConstant("DataLayout::arg_info_data_tag", Integer.class); |
|
308 |
final int dataLayoutCallTypeDataTag = getConstant("DataLayout::call_type_data_tag", Integer.class); |
|
309 |
final int dataLayoutVirtualCallTypeDataTag = getConstant("DataLayout::virtual_call_type_data_tag", Integer.class); |
|
310 |
final int dataLayoutParametersTypeDataTag = getConstant("DataLayout::parameters_type_data_tag", Integer.class); |
|
311 |
final int dataLayoutSpeculativeTrapDataTag = getConstant("DataLayout::speculative_trap_data_tag", Integer.class); |
|
312 |
||
313 |
final int bciProfileWidth = getFlag("BciProfileWidth", Integer.class); |
|
314 |
final int typeProfileWidth = getFlag("TypeProfileWidth", Integer.class); |
|
315 |
final int methodProfileWidth = getFlag("MethodProfileWidth", Integer.class); |
|
316 |
||
317 |
final int deoptReasonNone = getConstant("Deoptimization::Reason_none", Integer.class); |
|
318 |
final int deoptReasonNullCheck = getConstant("Deoptimization::Reason_null_check", Integer.class); |
|
319 |
final int deoptReasonRangeCheck = getConstant("Deoptimization::Reason_range_check", Integer.class); |
|
320 |
final int deoptReasonClassCheck = getConstant("Deoptimization::Reason_class_check", Integer.class); |
|
321 |
final int deoptReasonArrayCheck = getConstant("Deoptimization::Reason_array_check", Integer.class); |
|
322 |
final int deoptReasonUnreached0 = getConstant("Deoptimization::Reason_unreached0", Integer.class); |
|
323 |
final int deoptReasonTypeCheckInlining = getConstant("Deoptimization::Reason_type_checked_inlining", Integer.class); |
|
324 |
final int deoptReasonOptimizedTypeCheck = getConstant("Deoptimization::Reason_optimized_type_check", Integer.class); |
|
325 |
final int deoptReasonNotCompiledExceptionHandler = getConstant("Deoptimization::Reason_not_compiled_exception_handler", Integer.class); |
|
326 |
final int deoptReasonUnresolved = getConstant("Deoptimization::Reason_unresolved", Integer.class); |
|
327 |
final int deoptReasonJsrMismatch = getConstant("Deoptimization::Reason_jsr_mismatch", Integer.class); |
|
328 |
final int deoptReasonDiv0Check = getConstant("Deoptimization::Reason_div0_check", Integer.class); |
|
329 |
final int deoptReasonConstraint = getConstant("Deoptimization::Reason_constraint", Integer.class); |
|
330 |
final int deoptReasonLoopLimitCheck = getConstant("Deoptimization::Reason_loop_limit_check", Integer.class); |
|
331 |
final int deoptReasonAliasing = getConstant("Deoptimization::Reason_aliasing", Integer.class); |
|
332 |
final int deoptReasonTransferToInterpreter = getConstant("Deoptimization::Reason_transfer_to_interpreter", Integer.class); |
|
333 |
final int deoptReasonOSROffset = getConstant("Deoptimization::Reason_LIMIT", Integer.class); |
|
334 |
||
335 |
final int deoptActionNone = getConstant("Deoptimization::Action_none", Integer.class); |
|
336 |
final int deoptActionMaybeRecompile = getConstant("Deoptimization::Action_maybe_recompile", Integer.class); |
|
337 |
final int deoptActionReinterpret = getConstant("Deoptimization::Action_reinterpret", Integer.class); |
|
338 |
final int deoptActionMakeNotEntrant = getConstant("Deoptimization::Action_make_not_entrant", Integer.class); |
|
339 |
final int deoptActionMakeNotCompilable = getConstant("Deoptimization::Action_make_not_compilable", Integer.class); |
|
340 |
||
341 |
final int deoptimizationActionBits = getConstant("Deoptimization::_action_bits", Integer.class); |
|
342 |
final int deoptimizationReasonBits = getConstant("Deoptimization::_reason_bits", Integer.class); |
|
343 |
final int deoptimizationDebugIdBits = getConstant("Deoptimization::_debug_id_bits", Integer.class); |
|
344 |
final int deoptimizationActionShift = getConstant("Deoptimization::_action_shift", Integer.class); |
|
345 |
final int deoptimizationReasonShift = getConstant("Deoptimization::_reason_shift", Integer.class); |
|
346 |
final int deoptimizationDebugIdShift = getConstant("Deoptimization::_debug_id_shift", Integer.class); |
|
347 |
||
348 |
final int vmIntrinsicInvokeBasic = getConstant("vmIntrinsics::_invokeBasic", Integer.class); |
|
349 |
final int vmIntrinsicLinkToVirtual = getConstant("vmIntrinsics::_linkToVirtual", Integer.class); |
|
350 |
final int vmIntrinsicLinkToStatic = getConstant("vmIntrinsics::_linkToStatic", Integer.class); |
|
351 |
final int vmIntrinsicLinkToSpecial = getConstant("vmIntrinsics::_linkToSpecial", Integer.class); |
|
352 |
final int vmIntrinsicLinkToInterface = getConstant("vmIntrinsics::_linkToInterface", Integer.class); |
|
353 |
||
57957
4364524f8cac
8229797: [JVMCI] Clean up no longer used JVMCI::dependencies_invalid value
pli
parents:
57777
diff
changeset
|
354 |
final int codeInstallResultOk = getConstant("JVMCI::ok", Integer.class); |
4364524f8cac
8229797: [JVMCI] Clean up no longer used JVMCI::dependencies_invalid value
pli
parents:
57777
diff
changeset
|
355 |
final int codeInstallResultDependenciesFailed = getConstant("JVMCI::dependencies_failed", Integer.class); |
4364524f8cac
8229797: [JVMCI] Clean up no longer used JVMCI::dependencies_invalid value
pli
parents:
57777
diff
changeset
|
356 |
final int codeInstallResultCacheFull = getConstant("JVMCI::cache_full", Integer.class); |
4364524f8cac
8229797: [JVMCI] Clean up no longer used JVMCI::dependencies_invalid value
pli
parents:
57777
diff
changeset
|
357 |
final int codeInstallResultCodeTooLarge = getConstant("JVMCI::code_too_large", Integer.class); |
43972 | 358 |
|
359 |
String getCodeInstallResultDescription(int codeInstallResult) { |
|
360 |
if (codeInstallResult == codeInstallResultOk) { |
|
361 |
return "ok"; |
|
362 |
} |
|
363 |
if (codeInstallResult == codeInstallResultDependenciesFailed) { |
|
364 |
return "dependencies failed"; |
|
365 |
} |
|
366 |
if (codeInstallResult == codeInstallResultCacheFull) { |
|
367 |
return "code cache is full"; |
|
368 |
} |
|
369 |
if (codeInstallResult == codeInstallResultCodeTooLarge) { |
|
370 |
return "code is too large"; |
|
371 |
} |
|
372 |
assert false : codeInstallResult; |
|
373 |
return "unknown"; |
|
374 |
} |
|
375 |
||
376 |
final int bitDataExceptionSeenFlag = getConstant("BitData::exception_seen_flag", Integer.class); |
|
377 |
final int bitDataNullSeenFlag = getConstant("BitData::null_seen_flag", Integer.class); |
|
378 |
final int methodDataCountOffset = getConstant("CounterData::count_off", Integer.class); |
|
379 |
final int jumpDataTakenOffset = getConstant("JumpData::taken_off_set", Integer.class); |
|
380 |
final int jumpDataDisplacementOffset = getConstant("JumpData::displacement_off_set", Integer.class); |
|
381 |
final int receiverTypeDataNonprofiledCountOffset = getConstant("ReceiverTypeData::nonprofiled_count_off_set", Integer.class); |
|
382 |
final int receiverTypeDataReceiverTypeRowCellCount = getConstant("ReceiverTypeData::receiver_type_row_cell_count", Integer.class); |
|
383 |
final int receiverTypeDataReceiver0Offset = getConstant("ReceiverTypeData::receiver0_offset", Integer.class); |
|
384 |
final int receiverTypeDataCount0Offset = getConstant("ReceiverTypeData::count0_offset", Integer.class); |
|
385 |
final int branchDataNotTakenOffset = getConstant("BranchData::not_taken_off_set", Integer.class); |
|
386 |
final int arrayDataArrayLenOffset = getConstant("ArrayData::array_len_off_set", Integer.class); |
|
387 |
final int arrayDataArrayStartOffset = getConstant("ArrayData::array_start_off_set", Integer.class); |
|
388 |
final int multiBranchDataPerCaseCellCount = getConstant("MultiBranchData::per_case_cell_count", Integer.class); |
|
389 |
} |