1 /*
   2  * Copyright (c) 2011, 2019, 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  */
  23 
  24 
  25 package org.graalvm.compiler.hotspot;
  26 
  27 import java.lang.reflect.Field;
  28 import java.lang.reflect.Modifier;
  29 import java.util.List;
  30 
  31 import org.graalvm.compiler.core.common.CompressEncoding;
  32 import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;
  33 
  34 import jdk.vm.ci.common.JVMCIError;
  35 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
  36 import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
  37 import jdk.vm.ci.meta.ResolvedJavaMethod;
  38 
  39 /**
  40  * Used to access native configuration details.
  41  */
  42 public class GraalHotSpotVMConfig extends GraalHotSpotVMConfigBase {
  43 
  44     GraalHotSpotVMConfig(HotSpotVMConfigStore store) {
  45         super(store);
  46 
  47         assert narrowKlassShift <= logKlassAlignment;
  48         assert narrowOopShift <= logMinObjAlignment();
  49         oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift);
  50         klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift);
  51 
  52         assert check();
  53     }
  54 
  55     private final CompressEncoding oopEncoding;
  56     private final CompressEncoding klassEncoding;
  57 
  58     public CompressEncoding getOopEncoding() {
  59         return oopEncoding;
  60     }
  61 
  62     public CompressEncoding getKlassEncoding() {
  63         return klassEncoding;
  64     }
  65 
  66     public final boolean cAssertions = getConstant("ASSERT", Boolean.class);
  67 
  68     public final int codeEntryAlignment = getFlag("CodeEntryAlignment", Integer.class);
  69     public final boolean enableContended = getFlag("EnableContended", Boolean.class);
  70     public final boolean restrictContended = getFlag("RestrictContended", Boolean.class);
  71     public final int contendedPaddingWidth = getFlag("ContendedPaddingWidth", Integer.class);
  72     public final int fieldsAllocationStyle = getFlag("FieldsAllocationStyle", Integer.class);
  73     public final boolean compactFields = getFlag("CompactFields", Boolean.class);
  74     public final boolean verifyOops = getFlag("VerifyOops", Boolean.class);
  75     public final boolean ciTime = getFlag("CITime", Boolean.class);
  76     public final boolean ciTimeEach = getFlag("CITimeEach", Boolean.class);
  77     public final boolean dontCompileHugeMethods = getFlag("DontCompileHugeMethods", Boolean.class);
  78     public final int hugeMethodLimit = getFlag("HugeMethodLimit", Integer.class);
  79     public final boolean printInlining = getFlag("PrintInlining", Boolean.class);
  80     public final boolean inline = getFlag("Inline", Boolean.class);
  81     public final boolean inlineNotify = versioned.inlineNotify;
  82     public final boolean useFastLocking = getFlag("JVMCIUseFastLocking", Boolean.class);
  83     public final boolean forceUnreachable = getFlag("ForceUnreachable", Boolean.class);
  84     public final int codeSegmentSize = getFlag("CodeCacheSegmentSize", Integer.class);
  85     public final boolean foldStableValues = getFlag("FoldStableValues", Boolean.class);
  86     public final int maxVectorSize = getFlag("MaxVectorSize", Integer.class);
  87 
  88     public final boolean verifyBeforeGC = getFlag("VerifyBeforeGC", Boolean.class);
  89     public final boolean verifyAfterGC = getFlag("VerifyAfterGC", Boolean.class);
  90 
  91     public final boolean useTLAB = getFlag("UseTLAB", Boolean.class);
  92     public final boolean useBiasedLocking = getFlag("UseBiasedLocking", Boolean.class);
  93     public final boolean usePopCountInstruction = getFlag("UsePopCountInstruction", Boolean.class);
  94     public final boolean useAESIntrinsics = getFlag("UseAESIntrinsics", Boolean.class);
  95     public final boolean useAESCTRIntrinsics = getFlag("UseAESCTRIntrinsics", Boolean.class, false);
  96     public final boolean useCRC32Intrinsics = getFlag("UseCRC32Intrinsics", Boolean.class);
  97     public final boolean useCRC32CIntrinsics = versioned.useCRC32CIntrinsics;
  98     public final boolean threadLocalHandshakes = getFlag("ThreadLocalHandshakes", Boolean.class, false);
  99 
 100     private final boolean useMultiplyToLenIntrinsic = getFlag("UseMultiplyToLenIntrinsic", Boolean.class);
 101     private final boolean useSHA1Intrinsics = getFlag("UseSHA1Intrinsics", Boolean.class);
 102     private final boolean useSHA256Intrinsics = getFlag("UseSHA256Intrinsics", Boolean.class);
 103     private final boolean useSHA512Intrinsics = getFlag("UseSHA512Intrinsics", Boolean.class);
 104     private final boolean useGHASHIntrinsics = getFlag("UseGHASHIntrinsics", Boolean.class, false);
 105     private final boolean useMontgomeryMultiplyIntrinsic = getFlag("UseMontgomeryMultiplyIntrinsic", Boolean.class, false);
 106     private final boolean useMontgomerySquareIntrinsic = getFlag("UseMontgomerySquareIntrinsic", Boolean.class, false);
 107     private final boolean useMulAddIntrinsic = getFlag("UseMulAddIntrinsic", Boolean.class, false);
 108     private final boolean useSquareToLenIntrinsic = getFlag("UseSquareToLenIntrinsic", Boolean.class, false);
 109     public final boolean useVectorizedMismatchIntrinsic = getFlag("UseVectorizedMismatchIntrinsic", Boolean.class, false);
 110 
 111     /*
 112      * These are methods because in some JDKs the flags are visible but the stubs themselves haven't
 113      * been exported so we have to check both if the flag is on and if we have the stub.
 114      */
 115     public boolean useMultiplyToLenIntrinsic() {
 116         return useMultiplyToLenIntrinsic && multiplyToLen != 0;
 117     }
 118 
 119     public boolean useSHA1Intrinsics() {
 120         return useSHA1Intrinsics && sha1ImplCompress != 0 && sha1ImplCompressMultiBlock != 0;
 121     }
 122 
 123     public boolean useSHA256Intrinsics() {
 124         return useSHA256Intrinsics && sha256ImplCompress != 0 && sha256ImplCompressMultiBlock != 0;
 125     }
 126 
 127     public boolean useSHA512Intrinsics() {
 128         return useSHA512Intrinsics && sha512ImplCompress != 0 && sha512ImplCompressMultiBlock != 0;
 129     }
 130 
 131     public boolean useGHASHIntrinsics() {
 132         return useGHASHIntrinsics && ghashProcessBlocks != 0;
 133     }
 134 
 135     public boolean useMontgomeryMultiplyIntrinsic() {
 136         return useMontgomeryMultiplyIntrinsic && montgomeryMultiply != 0;
 137     }
 138 
 139     public boolean useMontgomerySquareIntrinsic() {
 140         return useMontgomerySquareIntrinsic && montgomerySquare != 0;
 141     }
 142 
 143     public boolean useMulAddIntrinsic() {
 144         return useMulAddIntrinsic && mulAdd != 0;
 145     }
 146 
 147     public boolean useSquareToLenIntrinsic() {
 148         return useSquareToLenIntrinsic && squareToLen != 0;
 149     }
 150 
 151     public boolean inlineNotify() {
 152         return inlineNotify && notifyAddress != 0;
 153     }
 154 
 155     public boolean inlineNotifyAll() {
 156         return inlineNotify && notifyAllAddress != 0;
 157     }
 158 
 159     public final boolean useG1GC = getFlag("UseG1GC", Boolean.class);
 160     public final boolean useEpsilonGC = getFlag("UseEpsilonGC", Boolean.class);
 161     public final boolean useCMSGC = getFlag("UseConcMarkSweepGC", Boolean.class);
 162 
 163     public final int allocatePrefetchStyle = getFlag("AllocatePrefetchStyle", Integer.class);
 164     public final int allocatePrefetchInstr = getFlag("AllocatePrefetchInstr", Integer.class);
 165     public final int allocatePrefetchLines = getFlag("AllocatePrefetchLines", Integer.class);
 166     public final int allocateInstancePrefetchLines = getFlag("AllocateInstancePrefetchLines", Integer.class);
 167     public final int allocatePrefetchStepSize = getFlag("AllocatePrefetchStepSize", Integer.class);
 168     public final int allocatePrefetchDistance = getFlag("AllocatePrefetchDistance", Integer.class);
 169 
 170     private final long universeCollectedHeap = getFieldValue("CompilerToVM::Data::Universe_collectedHeap", Long.class, "CollectedHeap*");
 171     private final int collectedHeapTotalCollectionsOffset = getFieldOffset("CollectedHeap::_total_collections", Integer.class, "unsigned int");
 172 
 173     public long gcTotalCollectionsAddress() {
 174         return universeCollectedHeap + collectedHeapTotalCollectionsOffset;
 175     }
 176 
 177     public final boolean useDeferredInitBarriers = getFlag("ReduceInitialCardMarks", Boolean.class);
 178 
 179     // Compressed Oops related values.
 180     public final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
 181     public final boolean useCompressedClassPointers = getFlag("UseCompressedClassPointers", Boolean.class);
 182 
 183     public final long narrowOopBase = getFieldValue("CompilerToVM::Data::Universe_narrow_oop_base", Long.class, "address");
 184     public final int narrowOopShift = getFieldValue("CompilerToVM::Data::Universe_narrow_oop_shift", Integer.class, "int");
 185     public final int objectAlignment = getFlag("ObjectAlignmentInBytes", Integer.class);
 186 
 187     public final int minObjAlignment() {
 188         return objectAlignment / heapWordSize;
 189     }
 190 
 191     public final int logMinObjAlignment() {
 192         return (int) (Math.log(objectAlignment) / Math.log(2));
 193     }
 194 
 195     public final int narrowKlassSize = getFieldValue("CompilerToVM::Data::sizeof_narrowKlass", Integer.class, "int");
 196     public final long narrowKlassBase = getFieldValue("CompilerToVM::Data::Universe_narrow_klass_base", Long.class, "address");
 197     public final int narrowKlassShift = getFieldValue("CompilerToVM::Data::Universe_narrow_klass_shift", Integer.class, "int");
 198     public final int logKlassAlignment = getConstant("LogKlassAlignmentInBytes", Integer.class);
 199 
 200     public final int stackShadowPages = getFlag("StackShadowPages", Integer.class);
 201     public final int stackReservedPages = getFlag("StackReservedPages", Integer.class, 0);
 202     public final boolean useStackBanging = getFlag("UseStackBanging", Boolean.class);
 203     public final int stackBias = getConstant("STACK_BIAS", Integer.class);
 204     public final int vmPageSize = getFieldValue("CompilerToVM::Data::vm_page_size", Integer.class, "int");
 205 
 206     public final int markOffset = getFieldOffset("oopDesc::_mark", Integer.class, "markOop");
 207     public final int hubOffset = getFieldOffset("oopDesc::_metadata._klass", Integer.class, "Klass*");
 208 
 209     public final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markOop");
 210     public final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*");
 211     public final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*");
 212     public final int superCheckOffsetOffset = getFieldOffset("Klass::_super_check_offset", Integer.class, "juint");
 213     public final int secondarySuperCacheOffset = getFieldOffset("Klass::_secondary_super_cache", Integer.class, "Klass*");
 214     public final int secondarySupersOffset = getFieldOffset("Klass::_secondary_supers", Integer.class, "Array<Klass*>*");
 215 
 216     public final boolean classMirrorIsHandle;
 217     public final int classMirrorOffset;
 218     {
 219         String name = "Klass::_java_mirror";
 220         int offset = -1;
 221         boolean isHandle = false;
 222         try {
 223             offset = getFieldOffset(name, Integer.class, "oop");
 224         } catch (JVMCIError e) {
 225 
 226         }
 227         if (offset == -1) {
 228             try {
 229                 offset = getFieldOffset(name, Integer.class, "jobject");
 230                 isHandle = true;
 231             } catch (JVMCIError e) {
 232                 try {
 233                     // JDK-8186777
 234                     offset = getFieldOffset(name, Integer.class, "OopHandle");
 235                     isHandle = true;
 236                 } catch (JVMCIError e2) {
 237                 }
 238             }
 239         }
 240         if (offset == -1) {
 241             throw new JVMCIError("cannot get offset of field " + name + " with type oop, jobject or OopHandle");
 242         }
 243         classMirrorOffset = offset;
 244         classMirrorIsHandle = isHandle;
 245     }
 246 
 247     public final int klassSuperKlassOffset = getFieldOffset("Klass::_super", Integer.class, "Klass*");
 248     public final int klassModifierFlagsOffset = getFieldOffset("Klass::_modifier_flags", Integer.class, "jint");
 249     public final int klassAccessFlagsOffset = getFieldOffset("Klass::_access_flags", Integer.class, "AccessFlags");
 250     public final int klassLayoutHelperOffset = getFieldOffset("Klass::_layout_helper", Integer.class, "jint");
 251 
 252     public final int klassLayoutHelperNeutralValue = getConstant("Klass::_lh_neutral_value", Integer.class);
 253     public final int layoutHelperLog2ElementSizeShift = getConstant("Klass::_lh_log2_element_size_shift", Integer.class);
 254     public final int layoutHelperLog2ElementSizeMask = getConstant("Klass::_lh_log2_element_size_mask", Integer.class);
 255     public final int layoutHelperElementTypeShift = getConstant("Klass::_lh_element_type_shift", Integer.class);
 256     public final int layoutHelperElementTypeMask = getConstant("Klass::_lh_element_type_mask", Integer.class);
 257     public final int layoutHelperHeaderSizeShift = getConstant("Klass::_lh_header_size_shift", Integer.class);
 258     public final int layoutHelperHeaderSizeMask = getConstant("Klass::_lh_header_size_mask", Integer.class);
 259     public final int layoutHelperArrayTagShift = getConstant("Klass::_lh_array_tag_shift", Integer.class);
 260     public final int layoutHelperArrayTagTypeValue = getConstant("Klass::_lh_array_tag_type_value", Integer.class);
 261     public final int layoutHelperArrayTagObjectValue = getConstant("Klass::_lh_array_tag_obj_value", Integer.class);
 262 
 263     /**
 264      * This filters out the bit that differentiates a type array from an object array.
 265      */
 266     public int layoutHelperElementTypePrimitiveInPlace() {
 267         return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift;
 268     }
 269 
 270     public final int vtableEntrySize = getFieldValue("CompilerToVM::Data::sizeof_vtableEntry", Integer.class, "int");
 271     public final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*");
 272 
 273     public final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1");
 274     public final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*");
 275     public final int instanceKlassFieldsOffset = getFieldOffset("InstanceKlass::_fields", Integer.class, "Array<u2>*");
 276     public final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int");
 277     public final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int");
 278 
 279     public final int instanceKlassStateLinked = getConstant("InstanceKlass::linked", Integer.class);
 280     public final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class);
 281 
 282     public final int arrayOopDescSize = getFieldValue("CompilerToVM::Data::sizeof_arrayOopDesc", Integer.class, "int");
 283 
 284     /**
 285      * The offset of the array length word in an array object's header.
 286      *
 287      * See {@code arrayOopDesc::length_offset_in_bytes()}.
 288      */
 289     public final int arrayOopDescLengthOffset() {
 290         return useCompressedClassPointers ? hubOffset + narrowKlassSize : arrayOopDescSize;
 291     }
 292 
 293     public final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int");
 294     public final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class);
 295     public final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class);
 296     public final int metaspaceArrayLengthOffset = getFieldOffset("Array<Klass*>::_length", Integer.class, "int");
 297     public final int metaspaceArrayBaseOffset = getFieldOffset("Array<Klass*>::_data[0]", Integer.class, "Klass*");
 298 
 299     public final int arrayClassElementOffset = getFieldOffset("ObjArrayKlass::_element_klass", Integer.class, "Klass*");
 300 
 301     public final int fieldInfoAccessFlagsOffset = getConstant("FieldInfo::access_flags_offset", Integer.class);
 302     public final int fieldInfoNameIndexOffset = getConstant("FieldInfo::name_index_offset", Integer.class);
 303     public final int fieldInfoSignatureIndexOffset = getConstant("FieldInfo::signature_index_offset", Integer.class);
 304     public final int fieldInfoInitvalIndexOffset = getConstant("FieldInfo::initval_index_offset", Integer.class);
 305     public final int fieldInfoLowPackedOffset = getConstant("FieldInfo::low_packed_offset", Integer.class);
 306     public final int fieldInfoHighPackedOffset = getConstant("FieldInfo::high_packed_offset", Integer.class);
 307     public final int fieldInfoFieldSlots = getConstant("FieldInfo::field_slots", Integer.class);
 308 
 309     public final int fieldInfoTagSize = getConstant("FIELDINFO_TAG_SIZE", Integer.class);
 310 
 311     public final int jvmAccMonitorMatch = getConstant("JVM_ACC_MONITOR_MATCH", Integer.class);
 312     public final int jvmAccHasMonitorBytecodes = getConstant("JVM_ACC_HAS_MONITOR_BYTECODES", Integer.class);
 313     public final int jvmAccHasFinalizer = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class);
 314     public final int jvmAccFieldInternal = getConstant("JVM_ACC_FIELD_INTERNAL", Integer.class);
 315     public final int jvmAccFieldStable = getConstant("JVM_ACC_FIELD_STABLE", Integer.class);
 316     public final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class);
 317     public final int jvmAccWrittenFlags = getConstant("JVM_ACC_WRITTEN_FLAGS", Integer.class);
 318     public final int jvmAccSynthetic = getConstant("JVM_ACC_SYNTHETIC", Integer.class);
 319 
 320     public final int jvmciCompileStateCanPostOnExceptionsOffset = getJvmciJvmtiCapabilityOffset("_jvmti_can_post_on_exceptions");
 321     public final int jvmciCompileStateCanPopFrameOffset = getJvmciJvmtiCapabilityOffset("_jvmti_can_pop_frame");
 322     public final int jvmciCompileStateCanAccessLocalVariablesOffset = getJvmciJvmtiCapabilityOffset("_jvmti_can_access_local_variables");
 323 
 324     // Integer.MIN_VALUE if not available
 325     private int getJvmciJvmtiCapabilityOffset(String name) {
 326         int offset = getFieldOffset("JVMCICompileState::" + name, Integer.class, "jbyte", Integer.MIN_VALUE);
 327         if (offset == Integer.MIN_VALUE) {
 328             // JDK 12
 329             offset = getFieldOffset("JVMCIEnv::" + name, Integer.class, "jbyte", Integer.MIN_VALUE);
 330         }
 331         return offset;
 332     }
 333 
 334     public final int threadTlabOffset = getFieldOffset("Thread::_tlab", Integer.class, "ThreadLocalAllocBuffer");
 335     public final int javaThreadAnchorOffset = getFieldOffset("JavaThread::_anchor", Integer.class, "JavaFrameAnchor");
 336     public final int javaThreadShouldPostOnExceptionsFlagOffset = getFieldOffset("JavaThread::_should_post_on_exceptions_flag", Integer.class, "int", Integer.MIN_VALUE);
 337     public final int threadObjectOffset = getFieldOffset("JavaThread::_threadObj", Integer.class, "oop");
 338     public final int osThreadOffset = getFieldOffset("JavaThread::_osthread", Integer.class, "OSThread*");
 339     public final int threadIsMethodHandleReturnOffset = getFieldOffset("JavaThread::_is_method_handle_return", Integer.class, "int");
 340     public final int threadObjectResultOffset = getFieldOffset("JavaThread::_vm_result", Integer.class, "oop");
 341     public final int jvmciCountersThreadOffset = getFieldOffset("JavaThread::_jvmci_counters", Integer.class, "jlong*");
 342     public final int javaThreadReservedStackActivationOffset = versioned.javaThreadReservedStackActivationOffset;
 343 
 344     public boolean requiresReservedStackCheck(List<ResolvedJavaMethod> methods) {
 345         if (enableStackReservedZoneAddress != 0 && methods != null) {
 346             for (ResolvedJavaMethod method : methods) {
 347                 if (((HotSpotResolvedJavaMethod) method).hasReservedStackAccess()) {
 348                     return true;
 349                 }
 350             }
 351         }
 352         return false;
 353     }
 354 
 355     /**
 356      * An invalid value for {@link #rtldDefault}.
 357      */
 358     public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE;
 359 
 360     /**
 361      * Address of the library lookup routine. The C signature of this routine is:
 362      *
 363      * <pre>
 364      *     void* (const char *filename, char *ebuf, int ebuflen)
 365      * </pre>
 366      */
 367     public final long dllLoad = getAddress("os::dll_load");
 368 
 369     /**
 370      * Address of the library lookup routine. The C signature of this routine is:
 371      *
 372      * <pre>
 373      *     void* (void* handle, const char* name)
 374      * </pre>
 375      */
 376     public final long dllLookup = getAddress("os::dll_lookup");
 377 
 378     /**
 379      * A pseudo-handle which when used as the first argument to {@link #dllLookup} means lookup will
 380      * return the first occurrence of the desired symbol using the default library search order. If
 381      * this field is {@value #INVALID_RTLD_DEFAULT_HANDLE}, then this capability is not supported on
 382      * the current platform.
 383      */
 384     public final long rtldDefault = getAddress("RTLD_DEFAULT", osName.equals("bsd") || osName.equals("linux") ? null : INVALID_RTLD_DEFAULT_HANDLE);
 385 
 386     /**
 387      * This field is used to pass exception objects into and out of the runtime system during
 388      * exception handling for compiled code.
 389      */
 390     public final int threadExceptionOopOffset = getFieldOffset("JavaThread::_exception_oop", Integer.class, "oop");
 391     public final int threadExceptionPcOffset = getFieldOffset("JavaThread::_exception_pc", Integer.class, "address");
 392     public final int pendingExceptionOffset = getFieldOffset("ThreadShadow::_pending_exception", Integer.class, "oop");
 393 
 394     public final int pendingDeoptimizationOffset = getFieldOffset("JavaThread::_pending_deoptimization", Integer.class, "int");
 395     public final int pendingTransferToInterpreterOffset = getFieldOffset("JavaThread::_pending_transfer_to_interpreter", Integer.class, "bool");
 396 
 397     private final int javaFrameAnchorLastJavaSpOffset = getFieldOffset("JavaFrameAnchor::_last_Java_sp", Integer.class, "intptr_t*");
 398     private final int javaFrameAnchorLastJavaPcOffset = getFieldOffset("JavaFrameAnchor::_last_Java_pc", Integer.class, "address");
 399 
 400     public final int pendingFailedSpeculationOffset;
 401     {
 402         String name = "JavaThread::_pending_failed_speculation";
 403         int offset = -1;
 404         try {
 405             offset = getFieldOffset(name, Integer.class, "jlong");
 406         } catch (JVMCIError e) {
 407             try {
 408                 offset = getFieldOffset(name, Integer.class, "long");
 409             } catch (JVMCIError e2) {
 410             }
 411         }
 412         if (offset == -1) {
 413             throw new JVMCIError("cannot get offset of field " + name + " with type long or jlong");
 414         }
 415         pendingFailedSpeculationOffset = offset;
 416     }
 417 
 418     public int threadLastJavaSpOffset() {
 419         return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset;
 420     }
 421 
 422     public int threadLastJavaPcOffset() {
 423         return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset;
 424     }
 425 
 426     public int threadLastJavaFpOffset() {
 427         assert osArch.equals("aarch64") || osArch.equals("amd64");
 428         return javaThreadAnchorOffset + getFieldOffset("JavaFrameAnchor::_last_Java_fp", Integer.class, "intptr_t*");
 429     }
 430 
 431     public int threadJavaFrameAnchorFlagsOffset() {
 432         assert osArch.equals("sparc");
 433         return javaThreadAnchorOffset + getFieldOffset("JavaFrameAnchor::_flags", Integer.class, "int");
 434     }
 435 
 436     public final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, intRequiredOnAMD64);
 437     public final int frameInterpreterFrameSenderSpOffset = getConstant("frame::interpreter_frame_sender_sp_offset", Integer.class, intRequiredOnAMD64);
 438     public final int frameInterpreterFrameLastSpOffset = getConstant("frame::interpreter_frame_last_sp_offset", Integer.class, intRequiredOnAMD64);
 439 
 440     public final int osThreadInterruptedOffset = getFieldOffset("OSThread::_interrupted", Integer.class, "jint");
 441 
 442     public final long markOopDescHashShift = getConstant("markOopDesc::hash_shift", Long.class);
 443 
 444     public final int biasedLockMaskInPlace = getConstant("markOopDesc::biased_lock_mask_in_place", Integer.class);
 445     public final int ageMaskInPlace = getConstant("markOopDesc::age_mask_in_place", Integer.class);
 446     public final int epochMaskInPlace = getConstant("markOopDesc::epoch_mask_in_place", Integer.class);
 447     public final long markOopDescHashMask = getConstant("markOopDesc::hash_mask", Long.class);
 448     public final long markOopDescHashMaskInPlace = getConstant("markOopDesc::hash_mask_in_place", Long.class);
 449 
 450     public final int unlockedMask = getConstant("markOopDesc::unlocked_value", Integer.class);
 451     public final int monitorMask = getConstant("markOopDesc::monitor_value", Integer.class, -1);
 452     public final int biasedLockPattern = getConstant("markOopDesc::biased_lock_pattern", Integer.class);
 453 
 454     // This field has no type in vmStructs.cpp
 455     public final int objectMonitorOwner = getFieldOffset("ObjectMonitor::_owner", Integer.class, null, -1);
 456     public final int objectMonitorRecursions = getFieldOffset("ObjectMonitor::_recursions", Integer.class, "intptr_t", -1);
 457     public final int objectMonitorCxq = getFieldOffset("ObjectMonitor::_cxq", Integer.class, "ObjectWaiter*", -1);
 458     public final int objectMonitorEntryList = getFieldOffset("ObjectMonitor::_EntryList", Integer.class, "ObjectWaiter*", -1);
 459 
 460     public final int markWordNoHashInPlace = getConstant("markOopDesc::no_hash_in_place", Integer.class);
 461     public final int markWordNoLockInPlace = getConstant("markOopDesc::no_lock_in_place", Integer.class);
 462 
 463     /**
 464      * See {@code markOopDesc::prototype()}.
 465      */
 466     public long arrayPrototypeMarkWord() {
 467         return markWordNoHashInPlace | markWordNoLockInPlace;
 468     }
 469 
 470     /**
 471      * See {@code markOopDesc::copy_set_hash()}.
 472      */
 473     public long tlabIntArrayMarkWord() {
 474         long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace);
 475         tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift);
 476         return tmp;
 477     }
 478 
 479     /**
 480      * Mark word right shift to get identity hash code.
 481      */
 482     public final int identityHashCodeShift = getConstant("markOopDesc::hash_shift", Integer.class);
 483 
 484     /**
 485      * Identity hash code value when uninitialized.
 486      */
 487     public final int uninitializedIdentityHashCodeValue = getConstant("markOopDesc::no_hash", Integer.class);
 488 
 489     public final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags");
 490     public final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*");
 491     public final int methodIntrinsicIdOffset = versioned.methodIntrinsicIdOffset;
 492     public final int methodFlagsOffset = versioned.methodFlagsOffset;
 493     public final int methodVtableIndexOffset = getFieldOffset("Method::_vtable_index", Integer.class, "int");
 494 
 495     public final int methodCountersOffset = getFieldOffset("Method::_method_counters", Integer.class, "MethodCounters*");
 496     public final int methodDataOffset = getFieldOffset("Method::_method_data", Integer.class, "MethodData*");
 497     public final int methodCompiledEntryOffset = getFieldOffset("Method::_from_compiled_entry", Integer.class, "address");
 498     public final int methodCodeOffset = versioned.methodCodeOffset;
 499 
 500     public final int methodFlagsCallerSensitive = getConstant("Method::_caller_sensitive", Integer.class);
 501     public final int methodFlagsForceInline = getConstant("Method::_force_inline", Integer.class);
 502     public final int methodFlagsDontInline = getConstant("Method::_dont_inline", Integer.class);
 503     public final int methodFlagsHidden = getConstant("Method::_hidden", Integer.class);
 504     public final int nonvirtualVtableIndex = getConstant("Method::nonvirtual_vtable_index", Integer.class);
 505     public final int invalidVtableIndex = getConstant("Method::invalid_vtable_index", Integer.class);
 506 
 507     public final int invocationCounterOffset = getFieldOffset("MethodCounters::_invocation_counter", Integer.class, "InvocationCounter");
 508     public final int backedgeCounterOffset = getFieldOffset("MethodCounters::_backedge_counter", Integer.class, "InvocationCounter");
 509     public final int invocationCounterIncrement = versioned.invocationCounterIncrement;
 510     public final int invocationCounterShift = versioned.invocationCounterShift;
 511 
 512     public final int nmethodEntryOffset = getFieldOffset("nmethod::_verified_entry_point",
 513                     Integer.class, "address");
 514     public final int compilationLevelFullOptimization = getConstant("CompLevel_full_optimization",
 515                     Integer.class);
 516 
 517     public final int constantPoolSize = getFieldValue("CompilerToVM::Data::sizeof_ConstantPool", Integer.class, "int");
 518     public final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length",
 519                     Integer.class, "int");
 520 
 521     public final int heapWordSize = getConstant("HeapWordSize", Integer.class);
 522 
 523     /**
 524      * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
 525      * are allowed to look like (respectively) the high or low bits of a real oop.
 526      */
 527     public final long nonOopBits = getFieldValue("CompilerToVM::Data::Universe_non_oop_bits", Long.class, "void*");
 528 
 529     public final long verifyOopCounterAddress = getFieldAddress("StubRoutines::_verify_oop_count", "jint");
 530     public final long verifyOopMask = getFieldValue("CompilerToVM::Data::Universe_verify_oop_mask", Long.class, "uintptr_t");
 531     public final long verifyOopBits = getFieldValue("CompilerToVM::Data::Universe_verify_oop_bits", Long.class, "uintptr_t");
 532 
 533     public final int logOfHRGrainBytes = getFieldValue("HeapRegion::LogOfHRGrainBytes", Integer.class, "int");
 534 
 535     public final long cardtableStartAddress = getFieldValue("CompilerToVM::Data::cardtable_start_address", Long.class, "jbyte*");
 536     public final int cardtableShift = getFieldValue("CompilerToVM::Data::cardtable_shift", Integer.class, "int");
 537 
 538     /**
 539      * This is the largest stack offset encodeable in an OopMapValue. Offsets larger than this will
 540      * throw an exception during code installation.
 541      */
 542     public final int maxOopMapStackOffset = getFieldValue("CompilerToVM::Data::_max_oop_map_stack_offset", Integer.class, "int");
 543 
 544     public final long safepointPollingAddress = getFieldValue("os::_polling_page", Long.class, "address");
 545 
 546     // G1 Collector Related Values.
 547 
 548     public final byte dirtyCardValue = versioned.dirtyCardValue;
 549     public final byte g1YoungCardValue = versioned.g1YoungCardValue;
 550 
 551     public final int g1SATBQueueMarkingOffset = versioned.g1SATBQueueMarkingOffset;
 552     public final int g1SATBQueueIndexOffset = versioned.g1SATBQueueIndexOffset;
 553     public final int g1SATBQueueBufferOffset = versioned.g1SATBQueueBufferOffset;
 554     public final int g1CardQueueIndexOffset = versioned.g1CardQueueIndexOffset;
 555     public final int g1CardQueueBufferOffset = versioned.g1CardQueueBufferOffset;
 556 
 557     public final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int");
 558     public final int arrayKlassOffset = getFieldValue("java_lang_Class::_array_klass_offset", Integer.class, "int");
 559 
 560     public final int basicLockSize = getFieldValue("CompilerToVM::Data::sizeof_BasicLock", Integer.class, "int");
 561     public final int basicLockDisplacedHeaderOffset = getFieldOffset("BasicLock::_displaced_header", Integer.class, "markOop");
 562 
 563     public final int threadPollingPageOffset = getFieldOffset("Thread::_polling_page", Integer.class, "address", -1);
 564     public final int threadAllocatedBytesOffset = getFieldOffset("Thread::_allocated_bytes", Integer.class, "jlong");
 565 
 566     public final int tlabRefillWasteIncrement = getFlag("TLABWasteIncrement", Integer.class);
 567 
 568     private final int threadLocalAllocBufferStartOffset = getFieldOffset("ThreadLocalAllocBuffer::_start", Integer.class, "HeapWord*");
 569     private final int threadLocalAllocBufferEndOffset = getFieldOffset("ThreadLocalAllocBuffer::_end", Integer.class, "HeapWord*");
 570     private final int threadLocalAllocBufferTopOffset = getFieldOffset("ThreadLocalAllocBuffer::_top", Integer.class, "HeapWord*");
 571     private final int threadLocalAllocBufferPfTopOffset = getFieldOffset("ThreadLocalAllocBuffer::_pf_top", Integer.class, "HeapWord*");
 572     private final int threadLocalAllocBufferSlowAllocationsOffset = getFieldOffset("ThreadLocalAllocBuffer::_slow_allocations", Integer.class, "unsigned");
 573     private final int threadLocalAllocBufferFastRefillWasteOffset = getFieldOffset("ThreadLocalAllocBuffer::_fast_refill_waste", Integer.class, "unsigned");
 574     private final int threadLocalAllocBufferNumberOfRefillsOffset = getFieldOffset("ThreadLocalAllocBuffer::_number_of_refills", Integer.class, "unsigned");
 575     private final int threadLocalAllocBufferRefillWasteLimitOffset = getFieldOffset("ThreadLocalAllocBuffer::_refill_waste_limit", Integer.class, "size_t");
 576     private final int threadLocalAllocBufferDesiredSizeOffset = getFieldOffset("ThreadLocalAllocBuffer::_desired_size", Integer.class, "size_t");
 577 
 578     public int tlabSlowAllocationsOffset() {
 579         return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset;
 580     }
 581 
 582     public int tlabFastRefillWasteOffset() {
 583         return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset;
 584     }
 585 
 586     public int tlabNumberOfRefillsOffset() {
 587         return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset;
 588     }
 589 
 590     public int tlabRefillWasteLimitOffset() {
 591         return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset;
 592     }
 593 
 594     public int threadTlabSizeOffset() {
 595         return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset;
 596     }
 597 
 598     public int threadTlabStartOffset() {
 599         return threadTlabOffset + threadLocalAllocBufferStartOffset;
 600     }
 601 
 602     public int threadTlabEndOffset() {
 603         return threadTlabOffset + threadLocalAllocBufferEndOffset;
 604     }
 605 
 606     public int threadTlabTopOffset() {
 607         return threadTlabOffset + threadLocalAllocBufferTopOffset;
 608     }
 609 
 610     public int threadTlabPfTopOffset() {
 611         return threadTlabOffset + threadLocalAllocBufferPfTopOffset;
 612     }
 613 
 614     public final int tlabAlignmentReserve = getFieldValue("CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve", Integer.class, "size_t");
 615 
 616     public final boolean tlabStats = getFlag("TLABStats", Boolean.class);
 617 
 618     // FIXME This is only temporary until the GC code is changed.
 619     public final boolean inlineContiguousAllocationSupported = getFieldValue("CompilerToVM::Data::_supports_inline_contig_alloc", Boolean.class);
 620     public final long heapEndAddress = getFieldValue("CompilerToVM::Data::_heap_end_addr", Long.class, "HeapWord**");
 621     public final long heapTopAddress = versioned.heapTopAddress;
 622 
 623     public final boolean cmsIncrementalMode = getFlag("CMSIncrementalMode", Boolean.class, false);
 624 
 625     public final long inlineCacheMissStub = getFieldValue("CompilerToVM::Data::SharedRuntime_ic_miss_stub", Long.class, "address");
 626     public final long handleWrongMethodStub = getFieldValue("CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub", Long.class, "address");
 627 
 628     public final long handleDeoptStub = getFieldValue("CompilerToVM::Data::SharedRuntime_deopt_blob_unpack", Long.class, "address");
 629     public final long uncommonTrapStub = getFieldValue("CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap", Long.class, "address");
 630 
 631     public final long codeCacheLowBound = versioned.codeCacheLowBound;
 632     public final long codeCacheHighBound = versioned.codeCacheHighBound;
 633 
 634     public final long aescryptEncryptBlockStub = getFieldValue("StubRoutines::_aescrypt_encryptBlock", Long.class, "address");
 635     public final long aescryptDecryptBlockStub = getFieldValue("StubRoutines::_aescrypt_decryptBlock", Long.class, "address");
 636     public final long cipherBlockChainingEncryptAESCryptStub = getFieldValue("StubRoutines::_cipherBlockChaining_encryptAESCrypt", Long.class, "address");
 637     public final long cipherBlockChainingDecryptAESCryptStub = getFieldValue("StubRoutines::_cipherBlockChaining_decryptAESCrypt", Long.class, "address");
 638     public final long updateBytesCRC32Stub = getFieldValue("StubRoutines::_updateBytesCRC32", Long.class, "address");
 639     public final long crcTableAddress = getFieldValue("StubRoutines::_crc_table_adr", Long.class, "address");
 640 
 641     public final long sha1ImplCompress = getFieldValue("StubRoutines::_sha1_implCompress", Long.class, "address", 0L);
 642     public final long sha1ImplCompressMultiBlock = getFieldValue("StubRoutines::_sha1_implCompressMB", Long.class, "address", 0L);
 643     public final long sha256ImplCompress = getFieldValue("StubRoutines::_sha256_implCompress", Long.class, "address", 0L);
 644     public final long sha256ImplCompressMultiBlock = getFieldValue("StubRoutines::_sha256_implCompressMB", Long.class, "address", 0L);
 645     public final long sha512ImplCompress = getFieldValue("StubRoutines::_sha512_implCompress", Long.class, "address", 0L);
 646     public final long sha512ImplCompressMultiBlock = getFieldValue("StubRoutines::_sha512_implCompressMB", Long.class, "address", 0L);
 647     public final long multiplyToLen = getFieldValue("StubRoutines::_multiplyToLen", Long.class, "address", longRequiredOnAMD64);
 648 
 649     public final long counterModeAESCrypt = getFieldValue("StubRoutines::_counterMode_AESCrypt", Long.class, "address", 0L);
 650     public final long ghashProcessBlocks = getFieldValue("StubRoutines::_ghash_processBlocks", Long.class, "address", 0L);
 651     public final long crc32cTableTddr = getFieldValue("StubRoutines::_crc32c_table_addr", Long.class, "address", 0L);
 652     public final long updateBytesCRC32C = getFieldValue("StubRoutines::_updateBytesCRC32C", Long.class, "address", 0L);
 653     public final long updateBytesAdler32 = getFieldValue("StubRoutines::_updateBytesAdler32", Long.class, "address", 0L);
 654     public final long squareToLen = getFieldValue("StubRoutines::_squareToLen", Long.class, "address", longRequiredOnAMD64);
 655     public final long mulAdd = getFieldValue("StubRoutines::_mulAdd", Long.class, "address", longRequiredOnAMD64);
 656     public final long montgomeryMultiply = getFieldValue("StubRoutines::_montgomeryMultiply", Long.class, "address", longRequiredOnAMD64);
 657     public final long montgomerySquare = getFieldValue("StubRoutines::_montgomerySquare", Long.class, "address", longRequiredOnAMD64);
 658     public final long vectorizedMismatch = getFieldValue("StubRoutines::_vectorizedMismatch", Long.class, "address", 0L);
 659 
 660     public final long throwDelayedStackOverflowErrorEntry = versioned.throwDelayedStackOverflowErrorEntry;
 661 
 662     public final long jbyteArraycopy = getFieldValue("StubRoutines::_jbyte_arraycopy", Long.class, "address");
 663     public final long jshortArraycopy = getFieldValue("StubRoutines::_jshort_arraycopy", Long.class, "address");
 664     public final long jintArraycopy = getFieldValue("StubRoutines::_jint_arraycopy", Long.class, "address");
 665     public final long jlongArraycopy = getFieldValue("StubRoutines::_jlong_arraycopy", Long.class, "address");
 666     public final long oopArraycopy = getFieldValue("StubRoutines::_oop_arraycopy", Long.class, "address");
 667     public final long oopArraycopyUninit = getFieldValue("StubRoutines::_oop_arraycopy_uninit", Long.class, "address");
 668     public final long jbyteDisjointArraycopy = getFieldValue("StubRoutines::_jbyte_disjoint_arraycopy", Long.class, "address");
 669     public final long jshortDisjointArraycopy = getFieldValue("StubRoutines::_jshort_disjoint_arraycopy", Long.class, "address");
 670     public final long jintDisjointArraycopy = getFieldValue("StubRoutines::_jint_disjoint_arraycopy", Long.class, "address");
 671     public final long jlongDisjointArraycopy = getFieldValue("StubRoutines::_jlong_disjoint_arraycopy", Long.class, "address");
 672     public final long oopDisjointArraycopy = getFieldValue("StubRoutines::_oop_disjoint_arraycopy", Long.class, "address");
 673     public final long oopDisjointArraycopyUninit = getFieldValue("StubRoutines::_oop_disjoint_arraycopy_uninit", Long.class, "address");
 674     public final long jbyteAlignedArraycopy = getFieldValue("StubRoutines::_arrayof_jbyte_arraycopy", Long.class, "address");
 675     public final long jshortAlignedArraycopy = getFieldValue("StubRoutines::_arrayof_jshort_arraycopy", Long.class, "address");
 676     public final long jintAlignedArraycopy = getFieldValue("StubRoutines::_arrayof_jint_arraycopy", Long.class, "address");
 677     public final long jlongAlignedArraycopy = getFieldValue("StubRoutines::_arrayof_jlong_arraycopy", Long.class, "address");
 678     public final long oopAlignedArraycopy = getFieldValue("StubRoutines::_arrayof_oop_arraycopy", Long.class, "address");
 679     public final long oopAlignedArraycopyUninit = getFieldValue("StubRoutines::_arrayof_oop_arraycopy_uninit", Long.class, "address");
 680     public final long jbyteAlignedDisjointArraycopy = getFieldValue("StubRoutines::_arrayof_jbyte_disjoint_arraycopy", Long.class, "address");
 681     public final long jshortAlignedDisjointArraycopy = getFieldValue("StubRoutines::_arrayof_jshort_disjoint_arraycopy", Long.class, "address");
 682     public final long jintAlignedDisjointArraycopy = getFieldValue("StubRoutines::_arrayof_jint_disjoint_arraycopy", Long.class, "address");
 683     public final long jlongAlignedDisjointArraycopy = getFieldValue("StubRoutines::_arrayof_jlong_disjoint_arraycopy", Long.class, "address");
 684     public final long oopAlignedDisjointArraycopy = getFieldValue("StubRoutines::_arrayof_oop_disjoint_arraycopy", Long.class, "address");
 685     public final long oopAlignedDisjointArraycopyUninit = getFieldValue("StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", Long.class, "address");
 686     public final long checkcastArraycopy = getFieldValue("StubRoutines::_checkcast_arraycopy", Long.class, "address");
 687     public final long checkcastArraycopyUninit = getFieldValue("StubRoutines::_checkcast_arraycopy_uninit", Long.class, "address");
 688     public final long unsafeArraycopy = getFieldValue("StubRoutines::_unsafe_arraycopy", Long.class, "address");
 689     public final long genericArraycopy = getFieldValue("StubRoutines::_generic_arraycopy", Long.class, "address");
 690 
 691     // Allocation stubs that throw an exception when allocation fails
 692     public final long newInstanceAddress = getAddress("JVMCIRuntime::new_instance");
 693     public final long newArrayAddress = getAddress("JVMCIRuntime::new_array");
 694     public final long newMultiArrayAddress = getAddress("JVMCIRuntime::new_multi_array");
 695     public final long dynamicNewInstanceAddress = getAddress("JVMCIRuntime::dynamic_new_instance");
 696 
 697     // Allocation stubs that return null when allocation fails
 698     public final long newInstanceOrNullAddress = getAddress("JVMCIRuntime::new_instance_or_null", 0L);
 699     public final long newArrayOrNullAddress = getAddress("JVMCIRuntime::new_array_or_null", 0L);
 700     public final long newMultiArrayOrNullAddress = getAddress("JVMCIRuntime::new_multi_array_or_null", 0L);
 701     public final long dynamicNewInstanceOrNullAddress = getAddress("JVMCIRuntime::dynamic_new_instance_or_null", 0L);
 702 
 703     public boolean areNullAllocationStubsAvailable() {
 704         return newInstanceOrNullAddress != 0L;
 705     }
 706 
 707     /**
 708      * Checks that HotSpot implements all or none of the allocate-or-null stubs.
 709      */
 710     private boolean checkNullAllocationStubs() {
 711         if (newInstanceOrNullAddress == 0L) {
 712             assert newArrayOrNullAddress == 0L;
 713             assert newMultiArrayOrNullAddress == 0L;
 714             assert dynamicNewInstanceOrNullAddress == 0L;
 715         } else {
 716             assert newArrayOrNullAddress != 0L;
 717             assert newMultiArrayOrNullAddress != 0L;
 718             assert dynamicNewInstanceOrNullAddress != 0L;
 719         }
 720         return true;
 721     }
 722 
 723     public final long threadIsInterruptedAddress = getAddress("JVMCIRuntime::thread_is_interrupted");
 724     public final long vmMessageAddress = getAddress("JVMCIRuntime::vm_message");
 725     public final long identityHashCodeAddress = getAddress("JVMCIRuntime::identity_hash_code");
 726     public final long exceptionHandlerForPcAddress = getAddress("JVMCIRuntime::exception_handler_for_pc");
 727     public final long monitorenterAddress = getAddress("JVMCIRuntime::monitorenter");
 728     public final long monitorexitAddress = getAddress("JVMCIRuntime::monitorexit");
 729     public final long notifyAddress = getAddress("JVMCIRuntime::object_notify", 0L);
 730     public final long notifyAllAddress = getAddress("JVMCIRuntime::object_notifyAll", 0L);
 731     public final long throwAndPostJvmtiExceptionAddress = getAddress("JVMCIRuntime::throw_and_post_jvmti_exception");
 732     public final long throwKlassExternalNameExceptionAddress = getAddress("JVMCIRuntime::throw_klass_external_name_exception");
 733     public final long throwClassCastExceptionAddress = getAddress("JVMCIRuntime::throw_class_cast_exception");
 734     public final long logPrimitiveAddress = getAddress("JVMCIRuntime::log_primitive");
 735     public final long logObjectAddress = getAddress("JVMCIRuntime::log_object");
 736     public final long logPrintfAddress = getAddress("JVMCIRuntime::log_printf");
 737     public final long vmErrorAddress = getAddress("JVMCIRuntime::vm_error");
 738     public final long loadAndClearExceptionAddress = getAddress("JVMCIRuntime::load_and_clear_exception");
 739     public final long writeBarrierPreAddress = getAddress("JVMCIRuntime::write_barrier_pre");
 740     public final long writeBarrierPostAddress = getAddress("JVMCIRuntime::write_barrier_post");
 741     public final long validateObject = getAddress("JVMCIRuntime::validate_object");
 742 
 743     public final long testDeoptimizeCallInt = getAddress("JVMCIRuntime::test_deoptimize_call_int");
 744 
 745     public final long registerFinalizerAddress = getAddress("SharedRuntime::register_finalizer");
 746     public final long exceptionHandlerForReturnAddressAddress = getAddress("SharedRuntime::exception_handler_for_return_address");
 747     public final long osrMigrationEndAddress = getAddress("SharedRuntime::OSR_migration_end");
 748     public final long enableStackReservedZoneAddress = versioned.enableStackReservedZoneAddress;
 749 
 750     public final long javaTimeMillisAddress = getAddress("os::javaTimeMillis");
 751     public final long javaTimeNanosAddress = getAddress("os::javaTimeNanos");
 752     public final long arithmeticSinAddress = getFieldValue("CompilerToVM::Data::dsin", Long.class, "address");
 753     public final long arithmeticCosAddress = getFieldValue("CompilerToVM::Data::dcos", Long.class, "address");
 754     public final long arithmeticTanAddress = getFieldValue("CompilerToVM::Data::dtan", Long.class, "address");
 755     public final long arithmeticExpAddress = getFieldValue("CompilerToVM::Data::dexp", Long.class, "address");
 756     public final long arithmeticLogAddress = getFieldValue("CompilerToVM::Data::dlog", Long.class, "address");
 757     public final long arithmeticLog10Address = getFieldValue("CompilerToVM::Data::dlog10", Long.class, "address");
 758     public final long arithmeticPowAddress = getFieldValue("CompilerToVM::Data::dpow", Long.class, "address");
 759 
 760     public final long fremAddress = getAddress("SharedRuntime::frem");
 761     public final long dremAddress = getAddress("SharedRuntime::drem");
 762 
 763     public final int jvmciCountersSize = getFlag("JVMCICounterSize", Integer.class);
 764 
 765     public final long deoptimizationFetchUnrollInfo = getAddress("Deoptimization::fetch_unroll_info");
 766     public final long deoptimizationUncommonTrap = getAddress("Deoptimization::uncommon_trap");
 767     public final long deoptimizationUnpackFrames = getAddress("Deoptimization::unpack_frames");
 768 
 769     public final int deoptimizationUnpackDeopt = getConstant("Deoptimization::Unpack_deopt", Integer.class);
 770     public final int deoptimizationUnpackException = getConstant("Deoptimization::Unpack_exception", Integer.class);
 771     public final int deoptimizationUnpackUncommonTrap = getConstant("Deoptimization::Unpack_uncommon_trap", Integer.class);
 772     public final int deoptimizationUnpackReexecute = getConstant("Deoptimization::Unpack_reexecute", Integer.class);
 773 
 774     public final int deoptimizationUnrollBlockSizeOfDeoptimizedFrameOffset = getFieldOffset("Deoptimization::UnrollBlock::_size_of_deoptimized_frame", Integer.class, "int");
 775     public final int deoptimizationUnrollBlockCallerAdjustmentOffset = getFieldOffset("Deoptimization::UnrollBlock::_caller_adjustment", Integer.class, "int");
 776     public final int deoptimizationUnrollBlockNumberOfFramesOffset = getFieldOffset("Deoptimization::UnrollBlock::_number_of_frames", Integer.class, "int");
 777     public final int deoptimizationUnrollBlockTotalFrameSizesOffset = getFieldOffset("Deoptimization::UnrollBlock::_total_frame_sizes", Integer.class, "int");
 778     public final int deoptimizationUnrollBlockUnpackKindOffset = getFieldOffset("Deoptimization::UnrollBlock::_unpack_kind", Integer.class, "int");
 779     public final int deoptimizationUnrollBlockFrameSizesOffset = getFieldOffset("Deoptimization::UnrollBlock::_frame_sizes", Integer.class, "intptr_t*");
 780     public final int deoptimizationUnrollBlockFramePcsOffset = getFieldOffset("Deoptimization::UnrollBlock::_frame_pcs", Integer.class, "address*");
 781     public final int deoptimizationUnrollBlockInitialInfoOffset = getFieldOffset("Deoptimization::UnrollBlock::_initial_info", Integer.class, "intptr_t");
 782 
 783     // Checkstyle: stop
 784     public final int MARKID_VERIFIED_ENTRY = getConstant("CodeInstaller::VERIFIED_ENTRY", Integer.class);
 785     public final int MARKID_UNVERIFIED_ENTRY = getConstant("CodeInstaller::UNVERIFIED_ENTRY", Integer.class);
 786     public final int MARKID_OSR_ENTRY = getConstant("CodeInstaller::OSR_ENTRY", Integer.class);
 787     public final int MARKID_EXCEPTION_HANDLER_ENTRY = getConstant("CodeInstaller::EXCEPTION_HANDLER_ENTRY", Integer.class);
 788     public final int MARKID_DEOPT_HANDLER_ENTRY = getConstant("CodeInstaller::DEOPT_HANDLER_ENTRY", Integer.class);
 789     public final int MARKID_INVOKEINTERFACE = getConstant("CodeInstaller::INVOKEINTERFACE", Integer.class);
 790     public final int MARKID_INVOKEVIRTUAL = getConstant("CodeInstaller::INVOKEVIRTUAL", Integer.class);
 791     public final int MARKID_INVOKESTATIC = getConstant("CodeInstaller::INVOKESTATIC", Integer.class);
 792     public final int MARKID_INVOKESPECIAL = getConstant("CodeInstaller::INVOKESPECIAL", Integer.class);
 793     public final int MARKID_INLINE_INVOKE = getConstant("CodeInstaller::INLINE_INVOKE", Integer.class);
 794     public final int MARKID_POLL_NEAR = getConstant("CodeInstaller::POLL_NEAR", Integer.class);
 795     public final int MARKID_POLL_RETURN_NEAR = getConstant("CodeInstaller::POLL_RETURN_NEAR", Integer.class);
 796     public final int MARKID_POLL_FAR = getConstant("CodeInstaller::POLL_FAR", Integer.class);
 797     public final int MARKID_POLL_RETURN_FAR = getConstant("CodeInstaller::POLL_RETURN_FAR", Integer.class);
 798     public final int MARKID_CARD_TABLE_SHIFT = getConstant("CodeInstaller::CARD_TABLE_SHIFT", Integer.class);
 799     public final int MARKID_CARD_TABLE_ADDRESS = getConstant("CodeInstaller::CARD_TABLE_ADDRESS", Integer.class);
 800     public final int MARKID_INVOKE_INVALID = getConstant("CodeInstaller::INVOKE_INVALID", Integer.class);
 801 
 802     /**
 803      * The following constants are given default values here since they are missing in the native
 804      * JVMCI-8 code but are still required for {@link GraalHotSpotVMConfigNode#canonical} to work in
 805      * a JDK8 environment.
 806      */
 807     public final int MARKID_HEAP_TOP_ADDRESS = getConstant("CodeInstaller::HEAP_TOP_ADDRESS", Integer.class, 17);
 808     public final int MARKID_HEAP_END_ADDRESS = getConstant("CodeInstaller::HEAP_END_ADDRESS", Integer.class, 18);
 809     public final int MARKID_NARROW_KLASS_BASE_ADDRESS = getConstant("CodeInstaller::NARROW_KLASS_BASE_ADDRESS", Integer.class, 19);
 810     public final int MARKID_NARROW_OOP_BASE_ADDRESS = getConstant("CodeInstaller::NARROW_OOP_BASE_ADDRESS", Integer.class, 20);
 811     public final int MARKID_CRC_TABLE_ADDRESS = getConstant("CodeInstaller::CRC_TABLE_ADDRESS", Integer.class, 21);
 812     public final int MARKID_LOG_OF_HEAP_REGION_GRAIN_BYTES = getConstant("CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES", Integer.class, 22);
 813     public final int MARKID_INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED = getConstant("CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED", Integer.class, 23);
 814 
 815     // Checkstyle: resume
 816 
 817     protected boolean check() {
 818         for (Field f : getClass().getDeclaredFields()) {
 819             int modifiers = f.getModifiers();
 820             if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
 821                 assert Modifier.isFinal(modifiers) : "field should be final: " + f;
 822             }
 823         }
 824 
 825         assert codeEntryAlignment > 0 : codeEntryAlignment;
 826         assert checkNullAllocationStubs();
 827         return true;
 828     }
 829 }