HotSpotVMConfig.java revision 12651:6ef01bd40ce2
1138569Ssam/*
2138569Ssam * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
3139530Ssam * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4138569Ssam *
5138569Ssam * This code is free software; you can redistribute it and/or modify it
6138569Ssam * under the terms of the GNU General Public License version 2 only, as
7138569Ssam * published by the Free Software Foundation.
8138569Ssam *
9138569Ssam * This code is distributed in the hope that it will be useful, but WITHOUT
10138569Ssam * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11138569Ssam * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12138569Ssam * version 2 for more details (a copy is included in the LICENSE file that
13138569Ssam * accompanied this code).
14138569Ssam *
15138569Ssam * You should have received a copy of the GNU General Public License version
16138569Ssam * 2 along with this work; if not, write to the Free Software Foundation,
17138569Ssam * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18138569Ssam *
19138569Ssam * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20138569Ssam * or visit www.oracle.com if you need additional information or have any
21138569Ssam * questions.
22138569Ssam */
23138569Ssampackage jdk.vm.ci.hotspot;
24138569Ssam
25138569Ssamimport static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
26138569Ssamimport static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
27138569Ssam
28138569Ssamimport jdk.internal.misc.Unsafe;
29138569Ssam
30138569Ssam/**
31138569Ssam * Used to access native configuration details.
32138569Ssam *
33138569Ssam * All non-static, public fields in this class are so that they can be compiled as constants.
34138569Ssam */
35138569Ssamclass HotSpotVMConfig extends HotSpotVMConfigAccess {
36138569Ssam
37138569Ssam    /**
38138569Ssam     * Gets the configuration associated with the singleton {@link HotSpotJVMCIRuntime}.
39138569Ssam     */
40138569Ssam    static HotSpotVMConfig config() {
41138569Ssam        return runtime().getConfig();
42138569Ssam    }
43138569Ssam
44138569Ssam    private final String osArch = getHostArchitectureName();
45138569Ssam
46138569Ssam    HotSpotVMConfig(HotSpotVMConfigStore store) {
47138569Ssam        super(store);
48138569Ssam    }
49178354Ssam
50138569Ssam    /**
51138569Ssam     * Gets the host architecture name for the purpose of finding the corresponding
52138569Ssam     * {@linkplain HotSpotJVMCIBackendFactory backend}.
53138569Ssam     */
54138569Ssam    String getHostArchitectureName() {
55138569Ssam        String arch = System.getProperty("os.arch");
56138569Ssam        switch (arch) {
57138569Ssam            case "x86_64":
58138569Ssam                return "amd64";
59138569Ssam
60138569Ssam            case "sparcv9":
61138569Ssam                return "sparc";
62138569Ssam            default:
63138569Ssam                return arch;
64138569Ssam        }
65138569Ssam    }
66138569Ssam
67138569Ssam    final boolean useDeferredInitBarriers = getFlag("ReduceInitialCardMarks", Boolean.class);
68138569Ssam
69138569Ssam    final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
70138569Ssam
71138569Ssam    final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markOop");
72138569Ssam    final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*");
73138569Ssam    final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*");
74138569Ssam    final int superCheckOffsetOffset = getFieldOffset("Klass::_super_check_offset", Integer.class, "juint");
75138569Ssam    final int secondarySuperCacheOffset = getFieldOffset("Klass::_secondary_super_cache", Integer.class, "Klass*");
76138569Ssam
77138569Ssam    /**
78138569Ssam     * The offset of the _java_mirror field (of type {@link Class}) in a Klass.
79138569Ssam     */
80185522Ssam    final int classMirrorOffset = getFieldOffset("Klass::_java_mirror", Integer.class, "oop");
81138569Ssam
82138569Ssam    final int klassAccessFlagsOffset = getFieldOffset("Klass::_access_flags", Integer.class, "AccessFlags");
83138569Ssam    final int klassLayoutHelperOffset = getFieldOffset("Klass::_layout_helper", Integer.class, "jint");
84138569Ssam
85138569Ssam    final int klassLayoutHelperNeutralValue = getConstant("Klass::_lh_neutral_value", Integer.class);
86138569Ssam    final int klassLayoutHelperInstanceSlowPathBit = getConstant("Klass::_lh_instance_slow_path_bit", Integer.class);
87138569Ssam
88138569Ssam    final int vtableEntrySize = getFieldValue("CompilerToVM::Data::sizeof_vtableEntry", Integer.class, "int");
89138569Ssam    final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*");
90138569Ssam
91138569Ssam    final int instanceKlassSourceFileNameIndexOffset = getFieldOffset("InstanceKlass::_source_file_name_index", Integer.class, "u2");
92138569Ssam    final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1");
93138569Ssam    final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*");
94138569Ssam    final int instanceKlassFieldsOffset = getFieldOffset("InstanceKlass::_fields", Integer.class, "Array<u2>*");
95138569Ssam    final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int");
96138569Ssam    final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int");
97138569Ssam
98138569Ssam    final int instanceKlassStateLinked = getConstant("InstanceKlass::linked", Integer.class);
99138569Ssam    final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class);
100138569Ssam
101138569Ssam    final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int");
102138569Ssam    final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class);
103138569Ssam    final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class);
104144546Ssam
105138569Ssam    final int fieldInfoAccessFlagsOffset = getConstant("FieldInfo::access_flags_offset", Integer.class);
106138569Ssam    final int fieldInfoNameIndexOffset = getConstant("FieldInfo::name_index_offset", Integer.class);
107138569Ssam    final int fieldInfoSignatureIndexOffset = getConstant("FieldInfo::signature_index_offset", Integer.class);
108138569Ssam    final int fieldInfoLowPackedOffset = getConstant("FieldInfo::low_packed_offset", Integer.class);
109138569Ssam    final int fieldInfoHighPackedOffset = getConstant("FieldInfo::high_packed_offset", Integer.class);
110138569Ssam    final int fieldInfoFieldSlots = getConstant("FieldInfo::field_slots", Integer.class);
111138569Ssam
112138569Ssam    final int fieldInfoTagSize = getConstant("FIELDINFO_TAG_SIZE", Integer.class);
113138569Ssam
114138569Ssam    final int jvmAccHasFinalizer = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class);
115138569Ssam    final int jvmAccFieldInternal = getConstant("JVM_ACC_FIELD_INTERNAL", Integer.class);
116138569Ssam    final int jvmAccFieldStable = getConstant("JVM_ACC_FIELD_STABLE", Integer.class);
117218160Sadrian    final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class);
118218160Sadrian    final int jvmAccIsCloneableFast = getConstant("JVM_ACC_IS_CLONEABLE_FAST", Integer.class);
119218160Sadrian
120218160Sadrian    // These modifiers are not public in Modifier so we get them via vmStructs.
121218160Sadrian    final int jvmAccSynthetic = getConstant("JVM_ACC_SYNTHETIC", Integer.class);
122218160Sadrian    final int jvmAccAnnotation = getConstant("JVM_ACC_ANNOTATION", Integer.class);
123138569Ssam    final int jvmAccBridge = getConstant("JVM_ACC_BRIDGE", Integer.class);
124218160Sadrian    final int jvmAccVarargs = getConstant("JVM_ACC_VARARGS", Integer.class);
125227364Sadrian    final int jvmAccEnum = getConstant("JVM_ACC_ENUM", Integer.class);
126218160Sadrian
127218160Sadrian    // This is only valid on AMD64.
128218160Sadrian    final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, osArch.equals("amd64") ? null : 0);
129227364Sadrian
130218160Sadrian    private final int markWordNoHashInPlace = getConstant("markOopDesc::no_hash_in_place", Integer.class);
131227364Sadrian    private final int markWordNoLockInPlace = getConstant("markOopDesc::no_lock_in_place", Integer.class);
132227364Sadrian
133227364Sadrian    /**
134227364Sadrian     * See {@code markOopDesc::prototype()}.
135227364Sadrian     */
136227364Sadrian    long arrayPrototypeMarkWord() {
137227364Sadrian        return markWordNoHashInPlace | markWordNoLockInPlace;
138227364Sadrian    }
139227364Sadrian
140218160Sadrian    final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags");
141218160Sadrian    final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*");
142218160Sadrian    final int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2");
143218160Sadrian    final int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2");
144138569Ssam    final int methodVtableIndexOffset = getFieldOffset("Method::_vtable_index", Integer.class, "int");
145144546Ssam
146138569Ssam    final int methodDataOffset = getFieldOffset("Method::_method_data", Integer.class, "MethodData*");
147138569Ssam    final int methodCodeOffset = getFieldOffset("Method::_code", Integer.class, "CompiledMethod*");
148138569Ssam
149138569Ssam    final int methodFlagsCallerSensitive = getConstant("Method::_caller_sensitive", Integer.class);
150138569Ssam    final int methodFlagsForceInline = getConstant("Method::_force_inline", Integer.class);
151138569Ssam    final int methodFlagsIntrinsicCandidate = getConstant("Method::_intrinsic_candidate", Integer.class);
152138569Ssam    final int methodFlagsDontInline = getConstant("Method::_dont_inline", Integer.class);
153138569Ssam    final int methodFlagsReservedStackAccess = getConstant("Method::_reserved_stack_access", Integer.class);
154138569Ssam    final int nonvirtualVtableIndex = getConstant("Method::nonvirtual_vtable_index", Integer.class);
155138569Ssam    final int invalidVtableIndex = getConstant("Method::invalid_vtable_index", Integer.class);
156138569Ssam
157144347Ssam    final int methodDataSize = getFieldOffset("MethodData::_size", Integer.class, "int");
158227364Sadrian    final int methodDataDataSize = getFieldOffset("MethodData::_data_size", Integer.class, "int");
159227364Sadrian    final int methodDataOopDataOffset = getFieldOffset("MethodData::_data[0]", Integer.class, "intptr_t");
160138569Ssam    final int methodDataOopTrapHistoryOffset = getFieldOffset("MethodData::_trap_hist._array[0]", Integer.class, "u1");
161138569Ssam    final int methodDataIRSizeOffset = getFieldOffset("MethodData::_jvmci_ir_size", Integer.class, "int");
162165185Ssam
163165185Ssam    final int methodDataDecompiles = getFieldOffset("MethodData::_nof_decompiles", Integer.class, "uint");
164138569Ssam    final int methodDataOverflowRecompiles = getFieldOffset("MethodData::_nof_overflow_recompiles", Integer.class, "uint");
165138569Ssam    final int methodDataOverflowTraps = getFieldOffset("MethodData::_nof_overflow_traps", Integer.class, "uint");
166138569Ssam
167138569Ssam    final int nmethodCompLevelOffset = getFieldOffset("nmethod::_comp_level", Integer.class, "int");
168138569Ssam
169138569Ssam    final int compilationLevelNone = getConstant("CompLevel_none", Integer.class);
170138569Ssam    final int compilationLevelSimple = getConstant("CompLevel_simple", Integer.class);
171138569Ssam    final int compilationLevelLimitedProfile = getConstant("CompLevel_limited_profile", Integer.class);
172138569Ssam    final int compilationLevelFullProfile = getConstant("CompLevel_full_profile", Integer.class);
173138569Ssam    final int compilationLevelFullOptimization = getConstant("CompLevel_full_optimization", Integer.class);
174138569Ssam
175138569Ssam    final int compLevelAdjustmentNone = getConstant("JVMCIRuntime::none", Integer.class);
176138569Ssam    final int compLevelAdjustmentByHolder = getConstant("JVMCIRuntime::by_holder", Integer.class);
177138569Ssam    final int compLevelAdjustmentByFullSignature = getConstant("JVMCIRuntime::by_full_signature", Integer.class);
178138569Ssam
179138569Ssam    final int invocationEntryBci = getConstant("InvocationEntryBci", Integer.class);
180138569Ssam
181138569Ssam    final int extraStackEntries = getFieldValue("CompilerToVM::Data::Method_extra_stack_entries", Integer.class, "int");
182178354Ssam
183178354Ssam    final int constMethodConstantsOffset = getFieldOffset("ConstMethod::_constants", Integer.class, "ConstantPool*");
184178354Ssam    final int constMethodFlagsOffset = getFieldOffset("ConstMethod::_flags", Integer.class, "u2");
185178354Ssam    final int constMethodCodeSizeOffset = getFieldOffset("ConstMethod::_code_size", Integer.class, "u2");
186178354Ssam    final int constMethodNameIndexOffset = getFieldOffset("ConstMethod::_name_index", Integer.class, "u2");
187138569Ssam    final int constMethodSignatureIndexOffset = getFieldOffset("ConstMethod::_signature_index", Integer.class, "u2");
188138569Ssam    final int constMethodMaxStackOffset = getFieldOffset("ConstMethod::_max_stack", Integer.class, "u2");
189138569Ssam    final int methodMaxLocalsOffset = getFieldOffset("ConstMethod::_max_locals", Integer.class, "u2");
190138569Ssam
191138569Ssam    final int constMethodHasLineNumberTable = getConstant("ConstMethod::_has_linenumber_table", Integer.class);
192138569Ssam    final int constMethodHasLocalVariableTable = getConstant("ConstMethod::_has_localvariable_table", Integer.class);
193138569Ssam    final int constMethodHasExceptionTable = getConstant("ConstMethod::_has_exception_table", Integer.class);
194138569Ssam
195138569Ssam    final int exceptionTableElementSize = getFieldValue("CompilerToVM::Data::sizeof_ExceptionTableElement", Integer.class, "int");
196138569Ssam    final int exceptionTableElementStartPcOffset = getFieldOffset("ExceptionTableElement::start_pc", Integer.class, "u2");
197178354Ssam    final int exceptionTableElementEndPcOffset = getFieldOffset("ExceptionTableElement::end_pc", Integer.class, "u2");
198138569Ssam    final int exceptionTableElementHandlerPcOffset = getFieldOffset("ExceptionTableElement::handler_pc", Integer.class, "u2");
199138569Ssam    final int exceptionTableElementCatchTypeIndexOffset = getFieldOffset("ExceptionTableElement::catch_type_index", Integer.class, "u2");
200138569Ssam
201138569Ssam    final int localVariableTableElementSize = getFieldValue("CompilerToVM::Data::sizeof_LocalVariableTableElement", Integer.class, "int");
202138569Ssam    final int localVariableTableElementStartBciOffset = getFieldOffset("LocalVariableTableElement::start_bci", Integer.class, "u2");
203138569Ssam    final int localVariableTableElementLengthOffset = getFieldOffset("LocalVariableTableElement::length", Integer.class, "u2");
204138569Ssam    final int localVariableTableElementNameCpIndexOffset = getFieldOffset("LocalVariableTableElement::name_cp_index", Integer.class, "u2");
205138569Ssam    final int localVariableTableElementDescriptorCpIndexOffset = getFieldOffset("LocalVariableTableElement::descriptor_cp_index", Integer.class, "u2");
206138569Ssam    final int localVariableTableElementSlotOffset = getFieldOffset("LocalVariableTableElement::slot", Integer.class, "u2");
207138569Ssam
208138569Ssam    final int constantPoolSize = getFieldValue("CompilerToVM::Data::sizeof_ConstantPool", Integer.class, "int");
209138569Ssam    final int constantPoolTagsOffset = getFieldOffset("ConstantPool::_tags", Integer.class, "Array<u1>*");
210138569Ssam    final int constantPoolHolderOffset = getFieldOffset("ConstantPool::_pool_holder", Integer.class, "InstanceKlass*");
211138569Ssam    final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length", Integer.class, "int");
212138569Ssam
213138569Ssam    final int constantPoolCpCacheIndexTag = getConstant("ConstantPool::CPCACHE_INDEX_TAG", Integer.class);
214138569Ssam
215138569Ssam    final int jvmConstantUtf8 = getConstant("JVM_CONSTANT_Utf8", Integer.class);
216138569Ssam    final int jvmConstantInteger = getConstant("JVM_CONSTANT_Integer", Integer.class);
217138569Ssam    final int jvmConstantLong = getConstant("JVM_CONSTANT_Long", Integer.class);
218138569Ssam    final int jvmConstantFloat = getConstant("JVM_CONSTANT_Float", Integer.class);
219138569Ssam    final int jvmConstantDouble = getConstant("JVM_CONSTANT_Double", Integer.class);
220138569Ssam    final int jvmConstantClass = getConstant("JVM_CONSTANT_Class", Integer.class);
221178354Ssam    final int jvmConstantUnresolvedClass = getConstant("JVM_CONSTANT_UnresolvedClass", Integer.class);
222138569Ssam    final int jvmConstantUnresolvedClassInError = getConstant("JVM_CONSTANT_UnresolvedClassInError", Integer.class);
223138569Ssam    final int jvmConstantString = getConstant("JVM_CONSTANT_String", Integer.class);
224138569Ssam    final int jvmConstantFieldref = getConstant("JVM_CONSTANT_Fieldref", Integer.class);
225138569Ssam    final int jvmConstantMethodref = getConstant("JVM_CONSTANT_Methodref", Integer.class);
226138569Ssam    final int jvmConstantInterfaceMethodref = getConstant("JVM_CONSTANT_InterfaceMethodref", Integer.class);
227178354Ssam    final int jvmConstantNameAndType = getConstant("JVM_CONSTANT_NameAndType", Integer.class);
228178354Ssam    final int jvmConstantMethodHandle = getConstant("JVM_CONSTANT_MethodHandle", Integer.class);
229138569Ssam    final int jvmConstantMethodHandleInError = getConstant("JVM_CONSTANT_MethodHandleInError", Integer.class);
230138569Ssam    final int jvmConstantMethodType = getConstant("JVM_CONSTANT_MethodType", Integer.class);
231138569Ssam    final int jvmConstantMethodTypeInError = getConstant("JVM_CONSTANT_MethodTypeInError", Integer.class);
232178354Ssam    final int jvmConstantInvokeDynamic = getConstant("JVM_CONSTANT_InvokeDynamic", Integer.class);
233138569Ssam
234138569Ssam    final int jvmConstantExternalMax = getConstant("JVM_CONSTANT_ExternalMax", Integer.class);
235138569Ssam    final int jvmConstantInternalMin = getConstant("JVM_CONSTANT_InternalMin", Integer.class);
236138569Ssam    final int jvmConstantInternalMax = getConstant("JVM_CONSTANT_InternalMax", Integer.class);
237138569Ssam
238138569Ssam    final int heapWordSize = getConstant("HeapWordSize", Integer.class);
239138569Ssam
240138569Ssam    final int symbolPointerSize = getFieldValue("CompilerToVM::Data::sizeof_SymbolPointer", Integer.class, "int");
241178354Ssam
242178354Ssam    final long vmSymbolsSymbols = getFieldAddress("vmSymbols::_symbols[0]", "Symbol*");
243138569Ssam    final int vmSymbolsFirstSID = getConstant("vmSymbols::FIRST_SID", Integer.class);
244138569Ssam    final int vmSymbolsSIDLimit = getConstant("vmSymbols::SID_LIMIT", Integer.class);
245138569Ssam
246138569Ssam    final long symbolInit = getFieldValue("CompilerToVM::Data::symbol_init", Long.class);
247138569Ssam    final long symbolClinit = getFieldValue("CompilerToVM::Data::symbol_clinit", Long.class);
248138569Ssam
249138569Ssam    /**
250138569Ssam     * Returns the symbol in the {@code vmSymbols} table at position {@code index} as a
251138569Ssam     * {@link String}.
252138569Ssam     *
253138569Ssam     * @param index position in the symbol table
254138569Ssam     * @return the symbol at position id
255138569Ssam     */
256138569Ssam    String symbolAt(int index) {
257138569Ssam        HotSpotJVMCIRuntimeProvider runtime = runtime();
258138569Ssam        assert vmSymbolsFirstSID <= index && index < vmSymbolsSIDLimit : "index " + index + " is out of bounds";
259138569Ssam        assert symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken";
260138569Ssam        int offset = index * symbolPointerSize;
261138569Ssam        return runtime.getCompilerToVM().getSymbol(UNSAFE.getAddress(vmSymbolsSymbols + offset));
262138569Ssam    }
263138569Ssam
264138569Ssam    final int universeBaseVtableSize = getFieldValue("CompilerToVM::Data::Universe_base_vtable_size", Integer.class, "int");
265138569Ssam
266138569Ssam    final int baseVtableLength() {
267138569Ssam        return universeBaseVtableSize / (vtableEntrySize / heapWordSize);
268138569Ssam    }
269138569Ssam
270138569Ssam    final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int");
271138569Ssam
272138569Ssam    /**
273155477Ssam     * The DataLayout header size is the same as the cell size.
274138569Ssam     */
275138569Ssam    final int dataLayoutHeaderSize = getConstant("DataLayout::cell_size", Integer.class);
276138569Ssam    final int dataLayoutTagOffset = getFieldOffset("DataLayout::_header._struct._tag", Integer.class, "u1");
277138569Ssam    final int dataLayoutFlagsOffset = getFieldOffset("DataLayout::_header._struct._flags", Integer.class, "u1");
278138569Ssam    final int dataLayoutBCIOffset = getFieldOffset("DataLayout::_header._struct._bci", Integer.class, "u2");
279138569Ssam    final int dataLayoutCellSize = getConstant("DataLayout::cell_size", Integer.class);
280138569Ssam
281138569Ssam    final int dataLayoutNoTag = getConstant("DataLayout::no_tag", Integer.class);
282138569Ssam    final int dataLayoutBitDataTag = getConstant("DataLayout::bit_data_tag", Integer.class);
283138569Ssam    final int dataLayoutCounterDataTag = getConstant("DataLayout::counter_data_tag", Integer.class);
284138569Ssam    final int dataLayoutJumpDataTag = getConstant("DataLayout::jump_data_tag", Integer.class);
285138569Ssam    final int dataLayoutReceiverTypeDataTag = getConstant("DataLayout::receiver_type_data_tag", Integer.class);
286138569Ssam    final int dataLayoutVirtualCallDataTag = getConstant("DataLayout::virtual_call_data_tag", Integer.class);
287138569Ssam    final int dataLayoutRetDataTag = getConstant("DataLayout::ret_data_tag", Integer.class);
288138569Ssam    final int dataLayoutBranchDataTag = getConstant("DataLayout::branch_data_tag", Integer.class);
289138569Ssam    final int dataLayoutMultiBranchDataTag = getConstant("DataLayout::multi_branch_data_tag", Integer.class);
290178354Ssam    final int dataLayoutArgInfoDataTag = getConstant("DataLayout::arg_info_data_tag", Integer.class);
291178354Ssam    final int dataLayoutCallTypeDataTag = getConstant("DataLayout::call_type_data_tag", Integer.class);
292178354Ssam    final int dataLayoutVirtualCallTypeDataTag = getConstant("DataLayout::virtual_call_type_data_tag", Integer.class);
293178354Ssam    final int dataLayoutParametersTypeDataTag = getConstant("DataLayout::parameters_type_data_tag", Integer.class);
294178354Ssam    final int dataLayoutSpeculativeTrapDataTag = getConstant("DataLayout::speculative_trap_data_tag", Integer.class);
295178354Ssam
296138569Ssam    final int bciProfileWidth = getFlag("BciProfileWidth", Integer.class);
297138569Ssam    final int typeProfileWidth = getFlag("TypeProfileWidth", Integer.class);
298138569Ssam    final int methodProfileWidth = getFlag("MethodProfileWidth", Integer.class);
299138569Ssam
300138569Ssam    final int deoptReasonNone = getConstant("Deoptimization::Reason_none", Integer.class);
301138569Ssam    final int deoptReasonNullCheck = getConstant("Deoptimization::Reason_null_check", Integer.class);
302138569Ssam    final int deoptReasonRangeCheck = getConstant("Deoptimization::Reason_range_check", Integer.class);
303138569Ssam    final int deoptReasonClassCheck = getConstant("Deoptimization::Reason_class_check", Integer.class);
304138569Ssam    final int deoptReasonArrayCheck = getConstant("Deoptimization::Reason_array_check", Integer.class);
305184347Ssam    final int deoptReasonUnreached0 = getConstant("Deoptimization::Reason_unreached0", Integer.class);
306138569Ssam    final int deoptReasonTypeCheckInlining = getConstant("Deoptimization::Reason_type_checked_inlining", Integer.class);
307138569Ssam    final int deoptReasonOptimizedTypeCheck = getConstant("Deoptimization::Reason_optimized_type_check", Integer.class);
308138569Ssam    final int deoptReasonNotCompiledExceptionHandler = getConstant("Deoptimization::Reason_not_compiled_exception_handler", Integer.class);
309178354Ssam    final int deoptReasonUnresolved = getConstant("Deoptimization::Reason_unresolved", Integer.class);
310138569Ssam    final int deoptReasonJsrMismatch = getConstant("Deoptimization::Reason_jsr_mismatch", Integer.class);
311138569Ssam    final int deoptReasonDiv0Check = getConstant("Deoptimization::Reason_div0_check", Integer.class);
312138569Ssam    final int deoptReasonConstraint = getConstant("Deoptimization::Reason_constraint", Integer.class);
313138569Ssam    final int deoptReasonLoopLimitCheck = getConstant("Deoptimization::Reason_loop_limit_check", Integer.class);
314138569Ssam    final int deoptReasonAliasing = getConstant("Deoptimization::Reason_aliasing", Integer.class);
315138569Ssam    final int deoptReasonTransferToInterpreter = getConstant("Deoptimization::Reason_transfer_to_interpreter", Integer.class);
316138569Ssam    final int deoptReasonOSROffset = getConstant("Deoptimization::Reason_LIMIT", Integer.class);
317138569Ssam
318138569Ssam    final int deoptActionNone = getConstant("Deoptimization::Action_none", Integer.class);
319138569Ssam    final int deoptActionMaybeRecompile = getConstant("Deoptimization::Action_maybe_recompile", Integer.class);
320138569Ssam    final int deoptActionReinterpret = getConstant("Deoptimization::Action_reinterpret", Integer.class);
321138569Ssam    final int deoptActionMakeNotEntrant = getConstant("Deoptimization::Action_make_not_entrant", Integer.class);
322138569Ssam    final int deoptActionMakeNotCompilable = getConstant("Deoptimization::Action_make_not_compilable", Integer.class);
323138569Ssam
324138569Ssam    final int deoptimizationActionBits = getConstant("Deoptimization::_action_bits", Integer.class);
325138569Ssam    final int deoptimizationReasonBits = getConstant("Deoptimization::_reason_bits", Integer.class);
326138569Ssam    final int deoptimizationDebugIdBits = getConstant("Deoptimization::_debug_id_bits", Integer.class);
327170530Ssam    final int deoptimizationActionShift = getConstant("Deoptimization::_action_shift", Integer.class);
328170530Ssam    final int deoptimizationReasonShift = getConstant("Deoptimization::_reason_shift", Integer.class);
329138569Ssam    final int deoptimizationDebugIdShift = getConstant("Deoptimization::_debug_id_shift", Integer.class);
330138569Ssam
331138569Ssam    final int vmIntrinsicInvokeBasic = getConstant("vmIntrinsics::_invokeBasic", Integer.class);
332138569Ssam    final int vmIntrinsicLinkToVirtual = getConstant("vmIntrinsics::_linkToVirtual", Integer.class);
333138569Ssam    final int vmIntrinsicLinkToStatic = getConstant("vmIntrinsics::_linkToStatic", Integer.class);
334138569Ssam    final int vmIntrinsicLinkToSpecial = getConstant("vmIntrinsics::_linkToSpecial", Integer.class);
335178354Ssam    final int vmIntrinsicLinkToInterface = getConstant("vmIntrinsics::_linkToInterface", Integer.class);
336138569Ssam
337138569Ssam    final int codeInstallResultOk = getConstant("JVMCIEnv::ok", Integer.class);
338170530Ssam    final int codeInstallResultDependenciesFailed = getConstant("JVMCIEnv::dependencies_failed", Integer.class);
339170530Ssam    final int codeInstallResultDependenciesInvalid = getConstant("JVMCIEnv::dependencies_invalid", Integer.class);
340170530Ssam    final int codeInstallResultCacheFull = getConstant("JVMCIEnv::cache_full", Integer.class);
341170530Ssam    final int codeInstallResultCodeTooLarge = getConstant("JVMCIEnv::code_too_large", Integer.class);
342170530Ssam
343170530Ssam    String getCodeInstallResultDescription(int codeInstallResult) {
344170530Ssam        if (codeInstallResult == codeInstallResultOk) {
345138569Ssam            return "ok";
346138569Ssam        }
347138569Ssam        if (codeInstallResult == codeInstallResultDependenciesFailed) {
348138569Ssam            return "dependencies failed";
349138569Ssam        }
350138569Ssam        if (codeInstallResult == codeInstallResultDependenciesInvalid) {
351138569Ssam            return "dependencies invalid";
352138569Ssam        }
353138569Ssam        if (codeInstallResult == codeInstallResultCacheFull) {
354138569Ssam            return "code cache is full";
355138569Ssam        }
356178354Ssam        if (codeInstallResult == codeInstallResultCodeTooLarge) {
357138569Ssam            return "code is too large";
358138569Ssam        }
359138569Ssam        assert false : codeInstallResult;
360138569Ssam        return "unknown";
361138569Ssam    }
362138569Ssam
363138569Ssam    final int bitDataExceptionSeenFlag = getConstant("BitData::exception_seen_flag", Integer.class);
364138569Ssam    final int bitDataNullSeenFlag = getConstant("BitData::null_seen_flag", Integer.class);
365178354Ssam    final int methodDataCountOffset = getConstant("CounterData::count_off", Integer.class);
366138569Ssam    final int jumpDataTakenOffset = getConstant("JumpData::taken_off_set", Integer.class);
367178354Ssam    final int jumpDataDisplacementOffset = getConstant("JumpData::displacement_off_set", Integer.class);
368178354Ssam    final int receiverTypeDataNonprofiledCountOffset = getConstant("ReceiverTypeData::nonprofiled_count_off_set", Integer.class);
369178354Ssam    final int receiverTypeDataReceiverTypeRowCellCount = getConstant("ReceiverTypeData::receiver_type_row_cell_count", Integer.class);
370178354Ssam    final int receiverTypeDataReceiver0Offset = getConstant("ReceiverTypeData::receiver0_offset", Integer.class);
371138569Ssam    final int receiverTypeDataCount0Offset = getConstant("ReceiverTypeData::count0_offset", Integer.class);
372138569Ssam    final int branchDataNotTakenOffset = getConstant("BranchData::not_taken_off_set", Integer.class);
373138569Ssam    final int arrayDataArrayLenOffset = getConstant("ArrayData::array_len_off_set", Integer.class);
374178354Ssam    final int arrayDataArrayStartOffset = getConstant("ArrayData::array_start_off_set", Integer.class);
375138569Ssam    final int multiBranchDataPerCaseCellCount = getConstant("MultiBranchData::per_case_cell_count", Integer.class);
376138569Ssam}
377178354Ssam