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