1 /*
   2  * Copyright (c) 2011, 2015, 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 jdk.vm.ci.hotspot;
  24 
  25 import static jdk.vm.ci.common.UnsafeUtil.readCString;
  26 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
  27 
  28 import java.lang.reflect.*;
  29 import java.util.*;
  30 
  31 import sun.misc.*;
  32 import jdk.vm.ci.common.*;
  33 import jdk.vm.ci.hotspotvmconfig.*;
  34 
  35 //JaCoCo Exclude
  36 
  37 /**
  38  * Used to access native configuration details.
  39  *
  40  * All non-static, public fields in this class are so that they can be compiled as constants.
  41  */
  42 public class HotSpotVMConfig {
  43 
  44     /**
  45      * Maximum allowed size of allocated area for a frame.
  46      */
  47     public final int maxFrameSize = 16 * 1024;
  48 
  49     public HotSpotVMConfig(CompilerToVM compilerToVm) {
  50         // Get raw pointer to the array that contains all gHotSpotVM values.
  51         final long gHotSpotVMData = compilerToVm.initializeConfiguration();
  52         assert gHotSpotVMData != 0;
  53 
  54         // Make FindBugs happy.
  55         gHotSpotVMStructs = 0;
  56         gHotSpotVMTypes = 0;
  57         gHotSpotVMIntConstants = 0;
  58         gHotSpotVMLongConstants = 0;
  59         gHotSpotVMAddresses = 0;
  60 
  61         // Initialize the gHotSpotVM fields.
  62         for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
  63             if (f.isAnnotationPresent(HotSpotVMData.class)) {
  64                 HotSpotVMData annotation = f.getAnnotation(HotSpotVMData.class);
  65                 final int index = annotation.index();
  66                 final long value = UNSAFE.getAddress(gHotSpotVMData + Unsafe.ADDRESS_SIZE * index);
  67                 try {
  68                     f.setLong(this, value);
  69                 } catch (IllegalAccessException e) {
  70                     throw new JVMCIError("index " + index, e);
  71                 }
  72             }
  73         }
  74 
  75         // Quick sanity check.
  76         assert gHotSpotVMStructs != 0;
  77         assert gHotSpotVMTypes != 0;
  78         assert gHotSpotVMIntConstants != 0;
  79         assert gHotSpotVMLongConstants != 0;
  80         assert gHotSpotVMAddresses != 0;
  81 
  82         initialize();
  83 
  84         oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift, logMinObjAlignment());
  85         klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift, logKlassAlignment);
  86 
  87         final long barrierSetAddress = UNSAFE.getAddress(universeCollectedHeap + collectedHeapBarrierSetOffset);
  88         final int kind = UNSAFE.getInt(barrierSetAddress + barrierSetFakeRttiOffset + fakeRttiConcreteTagOffset);
  89         if ((kind == barrierSetCardTableModRef) || (kind == barrierSetCardTableForRS) || (kind == barrierSetCardTableExtension) || (kind == barrierSetG1SATBCT) || (kind == barrierSetG1SATBCTLogging)) {
  90             final long base = UNSAFE.getAddress(barrierSetAddress + cardTableModRefBSByteMapBaseOffset);
  91             assert base != 0 : "unexpected byte_map_base: " + base;
  92             cardtableStartAddress = base;
  93             cardtableShift = cardTableModRefBSCardShift;
  94         } else if (kind == barrierSetModRef) {
  95             // No post barriers
  96             cardtableStartAddress = 0;
  97             cardtableShift = 0;
  98         } else {
  99             cardtableStartAddress = -1;
 100             cardtableShift = -1;
 101         }
 102 
 103         // Now handle all HotSpotVMManual fields.
 104         inlineCacheMissStub = inlineCacheMissBlob + UNSAFE.getInt(inlineCacheMissBlob + codeBlobCodeOffsetOffset);
 105         handleWrongMethodStub = wrongMethodBlob + UNSAFE.getInt(wrongMethodBlob + codeBlobCodeOffsetOffset);
 106         handleDeoptStub = deoptBlob + UNSAFE.getInt(deoptBlob + codeBlobCodeOffsetOffset) + UNSAFE.getInt(deoptBlob + deoptimizationBlobUnpackOffsetOffset);
 107         uncommonTrapStub = deoptBlob + UNSAFE.getInt(deoptBlob + codeBlobCodeOffsetOffset) + UNSAFE.getInt(deoptBlob + deoptimizationBlobUncommonTrapOffsetOffset);
 108 
 109         assert check();
 110         assert HotSpotVMConfigVerifier.check();
 111     }
 112 
 113     @Override
 114     public String toString() {
 115         return getClass().getSimpleName();
 116     }
 117 
 118     /**
 119      * Initialize fields by reading their values from vmStructs.
 120      */
 121     private void initialize() {
 122         // Fill the VM fields hash map.
 123         HashMap<String, VMFields.Field> vmFields = new HashMap<>();
 124         for (VMFields.Field e : new VMFields(gHotSpotVMStructs)) {
 125             vmFields.put(e.getName(), e);
 126         }
 127 
 128         // Fill the VM types hash map.
 129         HashMap<String, VMTypes.Type> vmTypes = new HashMap<>();
 130         for (VMTypes.Type e : new VMTypes(gHotSpotVMTypes)) {
 131             vmTypes.put(e.getTypeName(), e);
 132         }
 133 
 134         // Fill the VM constants hash map.
 135         HashMap<String, AbstractConstant> vmConstants = new HashMap<>();
 136         for (AbstractConstant e : new VMIntConstants(gHotSpotVMIntConstants)) {
 137             vmConstants.put(e.getName(), e);
 138         }
 139         for (AbstractConstant e : new VMAddresses(gHotSpotVMLongConstants)) {
 140             vmConstants.put(e.getName(), e);
 141         }
 142 
 143         // Fill the VM addresses hash map.
 144         HashMap<String, VMAddresses.Address> vmAddresses = new HashMap<>();
 145         for (VMAddresses.Address e : new VMAddresses(gHotSpotVMAddresses)) {
 146             vmAddresses.put(e.getName(), e);
 147         }
 148 
 149         // Fill the flags hash map.
 150         HashMap<String, Flags.Flag> flags = new HashMap<>();
 151         for (Flags.Flag e : new Flags(vmFields, vmTypes)) {
 152             flags.put(e.getName(), e);
 153         }
 154 
 155         String osName = getHostOSName();
 156         String osArch = getHostArchitectureName();
 157 
 158         for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
 159             if (f.isAnnotationPresent(HotSpotVMField.class)) {
 160                 HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
 161                 String name = annotation.name();
 162                 String type = annotation.type();
 163                 VMFields.Field entry = vmFields.get(name);
 164                 if (entry == null) {
 165                     if (!isRequired(osArch, annotation.archs())) {
 166                         continue;
 167                     }
 168                     throw new JVMCIError(f.getName() + ": expected VM field not found: " + name);
 169                 }
 170 
 171                 // Make sure the native type is still the type we expect.
 172                 if (!type.isEmpty()) {
 173                     if (!type.equals(entry.getTypeString())) {
 174                         throw new JVMCIError(f.getName() + ": compiler expects type " + type + " but VM field " + name + " is of type " + entry.getTypeString());
 175                     }
 176                 }
 177 
 178                 switch (annotation.get()) {
 179                     case OFFSET:
 180                         setField(f, entry.getOffset());
 181                         break;
 182                     case ADDRESS:
 183                         setField(f, entry.getAddress());
 184                         break;
 185                     case VALUE:
 186                         setField(f, entry.getValue());
 187                         break;
 188                     default:
 189                         throw new JVMCIError(f.getName() + ": unknown kind: " + annotation.get());
 190                 }
 191             } else if (f.isAnnotationPresent(HotSpotVMType.class)) {
 192                 HotSpotVMType annotation = f.getAnnotation(HotSpotVMType.class);
 193                 String name = annotation.name();
 194                 VMTypes.Type entry = vmTypes.get(name);
 195                 if (entry == null) {
 196                     throw new JVMCIError(f.getName() + ": expected VM type not found: " + name);
 197                 }
 198                 switch (annotation.get()) {
 199                     case SIZE:
 200                         setField(f, entry.getSize());
 201                         break;
 202                     default:
 203                         throw new JVMCIError(f.getName() + ": unknown kind: " + annotation.get());
 204                 }
 205             } else if (f.isAnnotationPresent(HotSpotVMConstant.class)) {
 206                 HotSpotVMConstant annotation = f.getAnnotation(HotSpotVMConstant.class);
 207                 String name = annotation.name();
 208                 AbstractConstant entry = vmConstants.get(name);
 209                 if (entry == null) {
 210                     if (!isRequired(osArch, annotation.archs())) {
 211                         continue;
 212                     }
 213                     throw new JVMCIError(f.getName() + ": expected VM constant not found: " + name);
 214                 }
 215                 setField(f, entry.getValue());
 216             } else if (f.isAnnotationPresent(HotSpotVMAddress.class)) {
 217                 HotSpotVMAddress annotation = f.getAnnotation(HotSpotVMAddress.class);
 218                 String name = annotation.name();
 219                 VMAddresses.Address entry = vmAddresses.get(name);
 220                 if (entry == null) {
 221                     if (!isRequired(osName, annotation.os())) {
 222                         continue;
 223                     }
 224                     throw new JVMCIError(f.getName() + ": expected VM address not found: " + name);
 225                 }
 226                 setField(f, entry.getValue());
 227             } else if (f.isAnnotationPresent(HotSpotVMFlag.class)) {
 228                 HotSpotVMFlag annotation = f.getAnnotation(HotSpotVMFlag.class);
 229                 String name = annotation.name();
 230                 Flags.Flag entry = flags.get(name);
 231                 if (entry == null) {
 232                     if (annotation.optional() || !isRequired(osArch, annotation.archs())) {
 233                         continue;
 234                     }
 235                     throw new JVMCIError(f.getName() + ": expected VM flag not found: " + name);
 236 
 237                 }
 238                 setField(f, entry.getValue());
 239             }
 240         }
 241     }
 242 
 243     private final CompressEncoding oopEncoding;
 244     private final CompressEncoding klassEncoding;
 245 
 246     public CompressEncoding getOopEncoding() {
 247         return oopEncoding;
 248     }
 249 
 250     public CompressEncoding getKlassEncoding() {
 251         return klassEncoding;
 252     }
 253 
 254     private void setField(Field field, Object value) {
 255         try {
 256             Class<?> fieldType = field.getType();
 257             if (fieldType == boolean.class) {
 258                 if (value instanceof String) {
 259                     field.setBoolean(this, Boolean.valueOf((String) value));
 260                 } else if (value instanceof Boolean) {
 261                     field.setBoolean(this, (boolean) value);
 262                 } else if (value instanceof Long) {
 263                     field.setBoolean(this, ((long) value) != 0);
 264                 } else {
 265                     throw new JVMCIError(value.getClass().getSimpleName());
 266                 }
 267             } else if (fieldType == byte.class) {
 268                 if (value instanceof Long) {
 269                     field.setByte(this, (byte) (long) value);
 270                 } else {
 271                     throw new JVMCIError(value.getClass().getSimpleName());
 272                 }
 273             } else if (fieldType == int.class) {
 274                 if (value instanceof Integer) {
 275                     field.setInt(this, (int) value);
 276                 } else if (value instanceof Long) {
 277                     field.setInt(this, (int) (long) value);
 278                 } else {
 279                     throw new JVMCIError(value.getClass().getSimpleName());
 280                 }
 281             } else if (fieldType == long.class) {
 282                 field.setLong(this, (long) value);
 283             } else {
 284                 throw new JVMCIError(field.toString());
 285             }
 286         } catch (IllegalAccessException e) {
 287             throw new JVMCIError("%s: %s", field, e);
 288         }
 289     }
 290 
 291     /**
 292      * Gets the host operating system name.
 293      */
 294     private static String getHostOSName() {
 295         String osName = System.getProperty("os.name");
 296         switch (osName) {
 297             case "Linux":
 298                 osName = "linux";
 299                 break;
 300             case "SunOS":
 301                 osName = "solaris";
 302                 break;
 303             case "Mac OS X":
 304                 osName = "bsd";
 305                 break;
 306             default:
 307                 // Of course Windows is different...
 308                 if (osName.startsWith("Windows")) {
 309                     osName = "windows";
 310                 } else {
 311                     throw new JVMCIError("Unexpected OS name: " + osName);
 312                 }
 313         }
 314         return osName;
 315     }
 316 
 317     /**
 318      * Gets the host architecture name for the purpose of finding the corresponding
 319      * {@linkplain HotSpotJVMCIBackendFactory backend}.
 320      */
 321     public String getHostArchitectureName() {
 322         String arch = System.getProperty("os.arch");
 323         switch (arch) {
 324             case "x86_64":
 325                 arch = "amd64";
 326                 break;
 327             case "sparcv9":
 328                 arch = "sparc";
 329                 break;
 330         }
 331         return arch;
 332     }
 333 
 334     /**
 335      * Determines if the current specification is included in a given set of specifications.
 336      *
 337      * @param current
 338      * @param specification specifies a set of specifications, e.g. architectures or operating
 339      *            systems. A zero length value implies all.
 340      */
 341     private static boolean isRequired(String current, String[] specification) {
 342         if (specification.length == 0) {
 343             return true;
 344         }
 345         for (String arch : specification) {
 346             if (arch.equals(current)) {
 347                 return true;
 348             }
 349         }
 350         return false;
 351     }
 352 
 353     /**
 354      * VMStructEntry (see {@code vmStructs.hpp}).
 355      */
 356     @HotSpotVMData(index = 0) @Stable private long gHotSpotVMStructs;
 357     @HotSpotVMData(index = 1) @Stable private long gHotSpotVMStructEntryTypeNameOffset;
 358     @HotSpotVMData(index = 2) @Stable private long gHotSpotVMStructEntryFieldNameOffset;
 359     @HotSpotVMData(index = 3) @Stable private long gHotSpotVMStructEntryTypeStringOffset;
 360     @HotSpotVMData(index = 4) @Stable private long gHotSpotVMStructEntryIsStaticOffset;
 361     @HotSpotVMData(index = 5) @Stable private long gHotSpotVMStructEntryOffsetOffset;
 362     @HotSpotVMData(index = 6) @Stable private long gHotSpotVMStructEntryAddressOffset;
 363     @HotSpotVMData(index = 7) @Stable private long gHotSpotVMStructEntryArrayStride;
 364 
 365     final class VMFields implements Iterable<VMFields.Field> {
 366 
 367         private final long address;
 368 
 369         public VMFields(long address) {
 370             this.address = address;
 371         }
 372 
 373         public Iterator<VMFields.Field> iterator() {
 374             return new Iterator<VMFields.Field>() {
 375 
 376                 private int index = 0;
 377 
 378                 private Field current() {
 379                     return new Field(address + gHotSpotVMStructEntryArrayStride * index);
 380                 }
 381 
 382                 /**
 383                  * The last entry is identified by a NULL fieldName.
 384                  */
 385                 public boolean hasNext() {
 386                     Field entry = current();
 387                     return entry.getFieldName() != null;
 388                 }
 389 
 390                 public Field next() {
 391                     Field entry = current();
 392                     index++;
 393                     return entry;
 394                 }
 395             };
 396         }
 397 
 398         final class Field {
 399 
 400             private final long entryAddress;
 401 
 402             Field(long address) {
 403                 this.entryAddress = address;
 404             }
 405 
 406             public String getTypeName() {
 407                 long typeNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryTypeNameOffset);
 408                 return readCString(UNSAFE, typeNameAddress);
 409             }
 410 
 411             public String getFieldName() {
 412                 long fieldNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryFieldNameOffset);
 413                 return readCString(UNSAFE, fieldNameAddress);
 414             }
 415 
 416             public String getTypeString() {
 417                 long typeStringAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryTypeStringOffset);
 418                 return readCString(UNSAFE, typeStringAddress);
 419             }
 420 
 421             public boolean isStatic() {
 422                 return UNSAFE.getInt(entryAddress + gHotSpotVMStructEntryIsStaticOffset) != 0;
 423             }
 424 
 425             public long getOffset() {
 426                 return UNSAFE.getLong(entryAddress + gHotSpotVMStructEntryOffsetOffset);
 427             }
 428 
 429             public long getAddress() {
 430                 return UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryAddressOffset);
 431             }
 432 
 433             public String getName() {
 434                 String typeName = getTypeName();
 435                 String fieldName = getFieldName();
 436                 return typeName + "::" + fieldName;
 437             }
 438 
 439             public long getValue() {
 440                 String type = getTypeString();
 441                 switch (type) {
 442                     case "bool":
 443                         return UNSAFE.getByte(getAddress());
 444                     case "int":
 445                         return UNSAFE.getInt(getAddress());
 446                     case "uint64_t":
 447                         return UNSAFE.getLong(getAddress());
 448                     case "address":
 449                     case "intptr_t":
 450                     case "uintptr_t":
 451                         return UNSAFE.getAddress(getAddress());
 452                     default:
 453                         // All foo* types are addresses.
 454                         if (type.endsWith("*")) {
 455                             return UNSAFE.getAddress(getAddress());
 456                         }
 457                         throw new JVMCIError(type);
 458                 }
 459             }
 460 
 461             @Override
 462             public String toString() {
 463                 return String.format("Field[typeName=%s, fieldName=%s, typeString=%s, isStatic=%b, offset=%d, address=0x%x]", getTypeName(), getFieldName(), getTypeString(), isStatic(), getOffset(),
 464                                 getAddress());
 465             }
 466         }
 467     }
 468 
 469     /**
 470      * VMTypeEntry (see vmStructs.hpp).
 471      */
 472     @HotSpotVMData(index = 8) @Stable private long gHotSpotVMTypes;
 473     @HotSpotVMData(index = 9) @Stable private long gHotSpotVMTypeEntryTypeNameOffset;
 474     @HotSpotVMData(index = 10) @Stable private long gHotSpotVMTypeEntrySuperclassNameOffset;
 475     @HotSpotVMData(index = 11) @Stable private long gHotSpotVMTypeEntryIsOopTypeOffset;
 476     @HotSpotVMData(index = 12) @Stable private long gHotSpotVMTypeEntryIsIntegerTypeOffset;
 477     @HotSpotVMData(index = 13) @Stable private long gHotSpotVMTypeEntryIsUnsignedOffset;
 478     @HotSpotVMData(index = 14) @Stable private long gHotSpotVMTypeEntrySizeOffset;
 479     @HotSpotVMData(index = 15) @Stable private long gHotSpotVMTypeEntryArrayStride;
 480 
 481     final class VMTypes implements Iterable<VMTypes.Type> {
 482 
 483         private final long address;
 484 
 485         public VMTypes(long address) {
 486             this.address = address;
 487         }
 488 
 489         public Iterator<VMTypes.Type> iterator() {
 490             return new Iterator<VMTypes.Type>() {
 491 
 492                 private int index = 0;
 493 
 494                 private Type current() {
 495                     return new Type(address + gHotSpotVMTypeEntryArrayStride * index);
 496                 }
 497 
 498                 /**
 499                  * The last entry is identified by a NULL type name.
 500                  */
 501                 public boolean hasNext() {
 502                     Type entry = current();
 503                     return entry.getTypeName() != null;
 504                 }
 505 
 506                 public Type next() {
 507                     Type entry = current();
 508                     index++;
 509                     return entry;
 510                 }
 511             };
 512         }
 513 
 514         final class Type {
 515 
 516             private final long entryAddress;
 517 
 518             Type(long address) {
 519                 this.entryAddress = address;
 520             }
 521 
 522             public String getTypeName() {
 523                 long typeNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMTypeEntryTypeNameOffset);
 524                 return readCString(UNSAFE, typeNameAddress);
 525             }
 526 
 527             public String getSuperclassName() {
 528                 long superclassNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMTypeEntrySuperclassNameOffset);
 529                 return readCString(UNSAFE, superclassNameAddress);
 530             }
 531 
 532             public boolean isOopType() {
 533                 return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsOopTypeOffset) != 0;
 534             }
 535 
 536             public boolean isIntegerType() {
 537                 return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsIntegerTypeOffset) != 0;
 538             }
 539 
 540             public boolean isUnsigned() {
 541                 return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsUnsignedOffset) != 0;
 542             }
 543 
 544             public long getSize() {
 545                 return UNSAFE.getLong(entryAddress + gHotSpotVMTypeEntrySizeOffset);
 546             }
 547 
 548             @Override
 549             public String toString() {
 550                 return String.format("Type[typeName=%s, superclassName=%s, isOopType=%b, isIntegerType=%b, isUnsigned=%b, size=%d]", getTypeName(), getSuperclassName(), isOopType(), isIntegerType(),
 551                                 isUnsigned(), getSize());
 552             }
 553         }
 554     }
 555 
 556     public abstract class AbstractConstant {
 557 
 558         protected final long address;
 559         protected final long nameOffset;
 560         protected final long valueOffset;
 561 
 562         AbstractConstant(long address, long nameOffset, long valueOffset) {
 563             this.address = address;
 564             this.nameOffset = nameOffset;
 565             this.valueOffset = valueOffset;
 566         }
 567 
 568         public String getName() {
 569             long nameAddress = UNSAFE.getAddress(address + nameOffset);
 570             return readCString(UNSAFE, nameAddress);
 571         }
 572 
 573         public abstract long getValue();
 574     }
 575 
 576     /**
 577      * VMIntConstantEntry (see vmStructs.hpp).
 578      */
 579     @HotSpotVMData(index = 16) @Stable private long gHotSpotVMIntConstants;
 580     @HotSpotVMData(index = 17) @Stable private long gHotSpotVMIntConstantEntryNameOffset;
 581     @HotSpotVMData(index = 18) @Stable private long gHotSpotVMIntConstantEntryValueOffset;
 582     @HotSpotVMData(index = 19) @Stable private long gHotSpotVMIntConstantEntryArrayStride;
 583 
 584     final class VMIntConstants implements Iterable<VMIntConstants.Constant> {
 585 
 586         private final long address;
 587 
 588         public VMIntConstants(long address) {
 589             this.address = address;
 590         }
 591 
 592         public Iterator<VMIntConstants.Constant> iterator() {
 593             return new Iterator<VMIntConstants.Constant>() {
 594 
 595                 private int index = 0;
 596 
 597                 private Constant current() {
 598                     return new Constant(address + gHotSpotVMIntConstantEntryArrayStride * index);
 599                 }
 600 
 601                 /**
 602                  * The last entry is identified by a NULL name.
 603                  */
 604                 public boolean hasNext() {
 605                     Constant entry = current();
 606                     return entry.getName() != null;
 607                 }
 608 
 609                 public Constant next() {
 610                     Constant entry = current();
 611                     index++;
 612                     return entry;
 613                 }
 614             };
 615         }
 616 
 617         final class Constant extends AbstractConstant {
 618 
 619             Constant(long address) {
 620                 super(address, gHotSpotVMIntConstantEntryNameOffset, gHotSpotVMIntConstantEntryValueOffset);
 621             }
 622 
 623             @Override
 624             public long getValue() {
 625                 return UNSAFE.getInt(address + valueOffset);
 626             }
 627 
 628             @Override
 629             public String toString() {
 630                 return String.format("IntConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
 631             }
 632         }
 633     }
 634 
 635     /**
 636      * VMLongConstantEntry (see vmStructs.hpp).
 637      */
 638     @HotSpotVMData(index = 20) @Stable private long gHotSpotVMLongConstants;
 639     @HotSpotVMData(index = 21) @Stable private long gHotSpotVMLongConstantEntryNameOffset;
 640     @HotSpotVMData(index = 22) @Stable private long gHotSpotVMLongConstantEntryValueOffset;
 641     @HotSpotVMData(index = 23) @Stable private long gHotSpotVMLongConstantEntryArrayStride;
 642 
 643     final class VMLongConstants implements Iterable<VMLongConstants.Constant> {
 644 
 645         private final long address;
 646 
 647         public VMLongConstants(long address) {
 648             this.address = address;
 649         }
 650 
 651         public Iterator<VMLongConstants.Constant> iterator() {
 652             return new Iterator<VMLongConstants.Constant>() {
 653 
 654                 private int index = 0;
 655 
 656                 private Constant currentEntry() {
 657                     return new Constant(address + gHotSpotVMLongConstantEntryArrayStride * index);
 658                 }
 659 
 660                 /**
 661                  * The last entry is identified by a NULL name.
 662                  */
 663                 public boolean hasNext() {
 664                     Constant entry = currentEntry();
 665                     return entry.getName() != null;
 666                 }
 667 
 668                 public Constant next() {
 669                     Constant entry = currentEntry();
 670                     index++;
 671                     return entry;
 672                 }
 673             };
 674         }
 675 
 676         final class Constant extends AbstractConstant {
 677 
 678             Constant(long address) {
 679                 super(address, gHotSpotVMLongConstantEntryNameOffset, gHotSpotVMLongConstantEntryValueOffset);
 680             }
 681 
 682             @Override
 683             public long getValue() {
 684                 return UNSAFE.getLong(address + valueOffset);
 685             }
 686 
 687             @Override
 688             public String toString() {
 689                 return String.format("LongConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
 690             }
 691         }
 692     }
 693 
 694     /**
 695      * VMAddressEntry (see vmStructs.hpp).
 696      */
 697     @HotSpotVMData(index = 24) @Stable private long gHotSpotVMAddresses;
 698     @HotSpotVMData(index = 25) @Stable private long gHotSpotVMAddressEntryNameOffset;
 699     @HotSpotVMData(index = 26) @Stable private long gHotSpotVMAddressEntryValueOffset;
 700     @HotSpotVMData(index = 27) @Stable private long gHotSpotVMAddressEntryArrayStride;
 701 
 702     final class VMAddresses implements Iterable<VMAddresses.Address> {
 703 
 704         private final long address;
 705 
 706         public VMAddresses(long address) {
 707             this.address = address;
 708         }
 709 
 710         public Iterator<VMAddresses.Address> iterator() {
 711             return new Iterator<VMAddresses.Address>() {
 712 
 713                 private int index = 0;
 714 
 715                 private Address currentEntry() {
 716                     return new Address(address + gHotSpotVMAddressEntryArrayStride * index);
 717                 }
 718 
 719                 /**
 720                  * The last entry is identified by a NULL name.
 721                  */
 722                 public boolean hasNext() {
 723                     Address entry = currentEntry();
 724                     return entry.getName() != null;
 725                 }
 726 
 727                 public Address next() {
 728                     Address entry = currentEntry();
 729                     index++;
 730                     return entry;
 731                 }
 732             };
 733         }
 734 
 735         final class Address extends AbstractConstant {
 736 
 737             Address(long address) {
 738                 super(address, gHotSpotVMAddressEntryNameOffset, gHotSpotVMAddressEntryValueOffset);
 739             }
 740 
 741             @Override
 742             public long getValue() {
 743                 return UNSAFE.getLong(address + valueOffset);
 744             }
 745 
 746             @Override
 747             public String toString() {
 748                 return String.format("Address[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
 749             }
 750         }
 751     }
 752 
 753     final class Flags implements Iterable<Flags.Flag> {
 754 
 755         private final long address;
 756         private final long entrySize;
 757         private final long typeOffset;
 758         private final long nameOffset;
 759         private final long addrOffset;
 760 
 761         public Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
 762             address = vmStructs.get("Flag::flags").getValue();
 763             entrySize = vmTypes.get("Flag").getSize();
 764             typeOffset = vmStructs.get("Flag::_type").getOffset();
 765             nameOffset = vmStructs.get("Flag::_name").getOffset();
 766             addrOffset = vmStructs.get("Flag::_addr").getOffset();
 767 
 768             assert vmTypes.get("bool").getSize() == Byte.BYTES;
 769             assert vmTypes.get("intx").getSize() == Long.BYTES;
 770             assert vmTypes.get("uintx").getSize() == Long.BYTES;
 771         }
 772 
 773         public Iterator<Flags.Flag> iterator() {
 774             return new Iterator<Flags.Flag>() {
 775 
 776                 private int index = 0;
 777 
 778                 private Flag current() {
 779                     return new Flag(address + entrySize * index);
 780                 }
 781 
 782                 /**
 783                  * The last entry is identified by a NULL name.
 784                  */
 785                 public boolean hasNext() {
 786                     Flag entry = current();
 787                     return entry.getName() != null;
 788                 }
 789 
 790                 public Flag next() {
 791                     Flag entry = current();
 792                     index++;
 793                     return entry;
 794                 }
 795             };
 796         }
 797 
 798         final class Flag {
 799 
 800             private final long entryAddress;
 801 
 802             Flag(long address) {
 803                 this.entryAddress = address;
 804             }
 805 
 806             public String getType() {
 807                 long typeAddress = UNSAFE.getAddress(entryAddress + typeOffset);
 808                 return readCString(UNSAFE, typeAddress);
 809             }
 810 
 811             public String getName() {
 812                 long nameAddress = UNSAFE.getAddress(entryAddress + nameOffset);
 813                 return readCString(UNSAFE, nameAddress);
 814             }
 815 
 816             public long getAddr() {
 817                 return UNSAFE.getAddress(entryAddress + addrOffset);
 818             }
 819 
 820             public Object getValue() {
 821                 switch (getType()) {
 822                     case "bool":
 823                         return Boolean.valueOf(UNSAFE.getByte(getAddr()) != 0);
 824                     case "intx":
 825                     case "uintx":
 826                     case "uint64_t":
 827                         return Long.valueOf(UNSAFE.getLong(getAddr()));
 828                     case "double":
 829                         return Double.valueOf(UNSAFE.getDouble(getAddr()));
 830                     case "ccstr":
 831                     case "ccstrlist":
 832                         return readCString(UNSAFE, getAddr());
 833                     default:
 834                         throw new JVMCIError(getType());
 835                 }
 836             }
 837 
 838             @Override
 839             public String toString() {
 840                 return String.format("Flag[type=%s, name=%s, value=%s]", getType(), getName(), getValue());
 841             }
 842         }
 843     }
 844 
 845     @HotSpotVMConstant(name = "ASSERT") @Stable public boolean cAssertions;
 846     public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows");
 847 
 848     @HotSpotVMFlag(name = "CodeEntryAlignment") @Stable public int codeEntryAlignment;
 849     @HotSpotVMFlag(name = "VerifyOops") @Stable public boolean verifyOops;
 850     @HotSpotVMFlag(name = "CITime") @Stable public boolean ciTime;
 851     @HotSpotVMFlag(name = "CITimeEach") @Stable public boolean ciTimeEach;
 852     @HotSpotVMFlag(name = "CompileTheWorldStartAt", optional = true) @Stable public int compileTheWorldStartAt;
 853     @HotSpotVMFlag(name = "CompileTheWorldStopAt", optional = true) @Stable public int compileTheWorldStopAt;
 854     @HotSpotVMFlag(name = "DontCompileHugeMethods") @Stable public boolean dontCompileHugeMethods;
 855     @HotSpotVMFlag(name = "HugeMethodLimit") @Stable public int hugeMethodLimit;
 856     @HotSpotVMFlag(name = "PrintInlining") @Stable public boolean printInlining;
 857     @HotSpotVMFlag(name = "JVMCIUseFastLocking") @Stable public boolean useFastLocking;
 858     @HotSpotVMFlag(name = "ForceUnreachable") @Stable public boolean forceUnreachable;
 859     @HotSpotVMFlag(name = "CodeCacheSegmentSize") @Stable public int codeSegmentSize;
 860 
 861     @HotSpotVMFlag(name = "UseTLAB") @Stable public boolean useTLAB;
 862     @HotSpotVMFlag(name = "UseBiasedLocking") @Stable public boolean useBiasedLocking;
 863     @HotSpotVMFlag(name = "UsePopCountInstruction") @Stable public boolean usePopCountInstruction;
 864     @HotSpotVMFlag(name = "UseCountLeadingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountLeadingZerosInstruction;
 865     @HotSpotVMFlag(name = "UseCountTrailingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountTrailingZerosInstruction;
 866     @HotSpotVMFlag(name = "UseAESIntrinsics") @Stable public boolean useAESIntrinsics;
 867     @HotSpotVMFlag(name = "UseCRC32Intrinsics") @Stable public boolean useCRC32Intrinsics;
 868     @HotSpotVMFlag(name = "UseG1GC") @Stable public boolean useG1GC;
 869     @HotSpotVMFlag(name = "UseConcMarkSweepGC") @Stable public boolean useCMSGC;
 870 
 871     @HotSpotVMFlag(name = "AllocatePrefetchStyle") @Stable public int allocatePrefetchStyle;
 872     @HotSpotVMFlag(name = "AllocatePrefetchInstr") @Stable public int allocatePrefetchInstr;
 873     @HotSpotVMFlag(name = "AllocatePrefetchLines") @Stable public int allocatePrefetchLines;
 874     @HotSpotVMFlag(name = "AllocateInstancePrefetchLines") @Stable public int allocateInstancePrefetchLines;
 875     @HotSpotVMFlag(name = "AllocatePrefetchStepSize") @Stable public int allocatePrefetchStepSize;
 876     @HotSpotVMFlag(name = "AllocatePrefetchDistance") @Stable public int allocatePrefetchDistance;
 877 
 878     @HotSpotVMFlag(name = "FlightRecorder", optional = true) @Stable public boolean flightRecorder;
 879 
 880     @HotSpotVMField(name = "Universe::_collectedHeap", type = "CollectedHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long universeCollectedHeap;
 881     @HotSpotVMField(name = "CollectedHeap::_total_collections", type = "unsigned int", get = HotSpotVMField.Type.OFFSET) @Stable private int collectedHeapTotalCollectionsOffset;
 882 
 883     public long gcTotalCollectionsAddress() {
 884         return universeCollectedHeap + collectedHeapTotalCollectionsOffset;
 885     }
 886 
 887     @HotSpotVMFlag(name = "ReduceInitialCardMarks") @Stable public boolean useDeferredInitBarriers;
 888 
 889     // Compressed Oops related values.
 890     @HotSpotVMFlag(name = "UseCompressedOops") @Stable public boolean useCompressedOops;
 891     @HotSpotVMFlag(name = "UseCompressedClassPointers") @Stable public boolean useCompressedClassPointers;
 892 
 893     @HotSpotVMField(name = "Universe::_narrow_oop._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowOopBase;
 894     @HotSpotVMField(name = "Universe::_narrow_oop._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowOopShift;
 895     @HotSpotVMFlag(name = "ObjectAlignmentInBytes") @Stable public int objectAlignment;
 896 
 897     public final int minObjAlignment() {
 898         return objectAlignment / heapWordSize;
 899     }
 900 
 901     public final int logMinObjAlignment() {
 902         return (int) (Math.log(objectAlignment) / Math.log(2));
 903     }
 904 
 905     @HotSpotVMType(name = "narrowKlass", get = HotSpotVMType.Type.SIZE) @Stable public int narrowKlassSize;
 906     @HotSpotVMField(name = "Universe::_narrow_klass._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowKlassBase;
 907     @HotSpotVMField(name = "Universe::_narrow_klass._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowKlassShift;
 908     @HotSpotVMConstant(name = "LogKlassAlignmentInBytes") @Stable public int logKlassAlignment;
 909 
 910     // CPU capabilities
 911     @HotSpotVMFlag(name = "UseSSE") @Stable public int useSSE;
 912     @HotSpotVMFlag(name = "UseAVX", archs = {"amd64"}) @Stable public int useAVX;
 913 
 914     @HotSpotVMField(name = "Abstract_VM_Version::_reserve_for_allocation_prefetch", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int abstractVmVersionReserveForAllocationPrefetch;
 915 
 916     // X86 specific values
 917     @HotSpotVMField(name = "VM_Version::_cpuFeatures", type = "uint64_t", get = HotSpotVMField.Type.VALUE, archs = {"amd64"}) @Stable public long x86CPUFeatures;
 918     @HotSpotVMConstant(name = "VM_Version::CPU_CX8", archs = {"amd64"}) @Stable public long cpuCX8;
 919     @HotSpotVMConstant(name = "VM_Version::CPU_CMOV", archs = {"amd64"}) @Stable public long cpuCMOV;
 920     @HotSpotVMConstant(name = "VM_Version::CPU_FXSR", archs = {"amd64"}) @Stable public long cpuFXSR;
 921     @HotSpotVMConstant(name = "VM_Version::CPU_HT", archs = {"amd64"}) @Stable public long cpuHT;
 922     @HotSpotVMConstant(name = "VM_Version::CPU_MMX", archs = {"amd64"}) @Stable public long cpuMMX;
 923     @HotSpotVMConstant(name = "VM_Version::CPU_3DNOW_PREFETCH", archs = {"amd64"}) @Stable public long cpu3DNOWPREFETCH;
 924     @HotSpotVMConstant(name = "VM_Version::CPU_SSE", archs = {"amd64"}) @Stable public long cpuSSE;
 925     @HotSpotVMConstant(name = "VM_Version::CPU_SSE2", archs = {"amd64"}) @Stable public long cpuSSE2;
 926     @HotSpotVMConstant(name = "VM_Version::CPU_SSE3", archs = {"amd64"}) @Stable public long cpuSSE3;
 927     @HotSpotVMConstant(name = "VM_Version::CPU_SSSE3", archs = {"amd64"}) @Stable public long cpuSSSE3;
 928     @HotSpotVMConstant(name = "VM_Version::CPU_SSE4A", archs = {"amd64"}) @Stable public long cpuSSE4A;
 929     @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_1", archs = {"amd64"}) @Stable public long cpuSSE41;
 930     @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_2", archs = {"amd64"}) @Stable public long cpuSSE42;
 931     @HotSpotVMConstant(name = "VM_Version::CPU_POPCNT", archs = {"amd64"}) @Stable public long cpuPOPCNT;
 932     @HotSpotVMConstant(name = "VM_Version::CPU_LZCNT", archs = {"amd64"}) @Stable public long cpuLZCNT;
 933     @HotSpotVMConstant(name = "VM_Version::CPU_TSC", archs = {"amd64"}) @Stable public long cpuTSC;
 934     @HotSpotVMConstant(name = "VM_Version::CPU_TSCINV", archs = {"amd64"}) @Stable public long cpuTSCINV;
 935     @HotSpotVMConstant(name = "VM_Version::CPU_AVX", archs = {"amd64"}) @Stable public long cpuAVX;
 936     @HotSpotVMConstant(name = "VM_Version::CPU_AVX2", archs = {"amd64"}) @Stable public long cpuAVX2;
 937     @HotSpotVMConstant(name = "VM_Version::CPU_AES", archs = {"amd64"}) @Stable public long cpuAES;
 938     @HotSpotVMConstant(name = "VM_Version::CPU_ERMS", archs = {"amd64"}) @Stable public long cpuERMS;
 939     @HotSpotVMConstant(name = "VM_Version::CPU_CLMUL", archs = {"amd64"}) @Stable public long cpuCLMUL;
 940     @HotSpotVMConstant(name = "VM_Version::CPU_BMI1", archs = {"amd64"}) @Stable public long cpuBMI1;
 941 
 942     // SPARC specific values
 943     @HotSpotVMField(name = "VM_Version::_features", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"sparc"}) @Stable public int sparcFeatures;
 944     @HotSpotVMConstant(name = "VM_Version::vis3_instructions_m", archs = {"sparc"}) @Stable public int vis3Instructions;
 945     @HotSpotVMConstant(name = "VM_Version::vis2_instructions_m", archs = {"sparc"}) @Stable public int vis2Instructions;
 946     @HotSpotVMConstant(name = "VM_Version::vis1_instructions_m", archs = {"sparc"}) @Stable public int vis1Instructions;
 947     @HotSpotVMConstant(name = "VM_Version::cbcond_instructions_m", archs = {"sparc"}) @Stable public int cbcondInstructions;
 948     @HotSpotVMFlag(name = "UseBlockZeroing", archs = {"sparc"}) @Stable public boolean useBlockZeroing;
 949     @HotSpotVMFlag(name = "BlockZeroingLowLimit", archs = {"sparc"}) @Stable public int blockZeroingLowLimit;
 950 
 951     // offsets, ...
 952     @HotSpotVMFlag(name = "StackShadowPages") @Stable public int stackShadowPages;
 953     @HotSpotVMFlag(name = "UseStackBanging") @Stable public boolean useStackBanging;
 954     @HotSpotVMConstant(name = "STACK_BIAS") @Stable public int stackBias;
 955 
 956     @HotSpotVMField(name = "oopDesc::_mark", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int markOffset;
 957     @HotSpotVMField(name = "oopDesc::_metadata._klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int hubOffset;
 958 
 959     @HotSpotVMField(name = "Klass::_prototype_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int prototypeMarkWordOffset;
 960     @HotSpotVMField(name = "Klass::_subklass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int subklassOffset;
 961     @HotSpotVMField(name = "Klass::_next_sibling", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int nextSiblingOffset;
 962     @HotSpotVMField(name = "Klass::_super_check_offset", type = "juint", get = HotSpotVMField.Type.OFFSET) @Stable public int superCheckOffsetOffset;
 963     @HotSpotVMField(name = "Klass::_secondary_super_cache", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySuperCacheOffset;
 964     @HotSpotVMField(name = "Klass::_secondary_supers", type = "Array<Klass*>*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySupersOffset;
 965 
 966     /**
 967      * The offset of the _java_mirror field (of type {@link Class}) in a Klass.
 968      */
 969     @HotSpotVMField(name = "Klass::_java_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int classMirrorOffset;
 970 
 971     @HotSpotVMField(name = "Klass::_super", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassSuperKlassOffset;
 972     @HotSpotVMField(name = "Klass::_modifier_flags", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassModifierFlagsOffset;
 973     @HotSpotVMField(name = "Klass::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int klassAccessFlagsOffset;
 974     @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassLayoutHelperOffset;
 975 
 976     @HotSpotVMConstant(name = "Klass::_lh_neutral_value") @Stable public int klassLayoutHelperNeutralValue;
 977     @HotSpotVMConstant(name = "Klass::_lh_instance_slow_path_bit") @Stable public int klassLayoutHelperInstanceSlowPathBit;
 978     @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_shift") @Stable public int layoutHelperLog2ElementSizeShift;
 979     @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_mask") @Stable public int layoutHelperLog2ElementSizeMask;
 980     @HotSpotVMConstant(name = "Klass::_lh_element_type_shift") @Stable public int layoutHelperElementTypeShift;
 981     @HotSpotVMConstant(name = "Klass::_lh_element_type_mask") @Stable public int layoutHelperElementTypeMask;
 982     @HotSpotVMConstant(name = "Klass::_lh_header_size_shift") @Stable public int layoutHelperHeaderSizeShift;
 983     @HotSpotVMConstant(name = "Klass::_lh_header_size_mask") @Stable public int layoutHelperHeaderSizeMask;
 984     @HotSpotVMConstant(name = "Klass::_lh_array_tag_shift") @Stable public int layoutHelperArrayTagShift;
 985     @HotSpotVMConstant(name = "Klass::_lh_array_tag_type_value") @Stable public int layoutHelperArrayTagTypeValue;
 986     @HotSpotVMConstant(name = "Klass::_lh_array_tag_obj_value") @Stable public int layoutHelperArrayTagObjectValue;
 987 
 988     /**
 989      * This filters out the bit that differentiates a type array from an object array.
 990      */
 991     public int layoutHelperElementTypePrimitiveInPlace() {
 992         return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift;
 993     }
 994 
 995     /**
 996      * Bit pattern in the klass layout helper that can be used to identify arrays.
 997      */
 998     public final int arrayKlassLayoutHelperIdentifier = 0x80000000;
 999 
1000     @HotSpotVMType(name = "vtableEntry", get = HotSpotVMType.Type.SIZE) @Stable public int vtableEntrySize;
1001     @HotSpotVMField(name = "vtableEntry::_method", type = "Method*", get = HotSpotVMField.Type.OFFSET) @Stable public int vtableEntryMethodOffset;
1002 
1003     @HotSpotVMType(name = "InstanceKlass", get = HotSpotVMType.Type.SIZE) @Stable public int instanceKlassSize;
1004     @HotSpotVMField(name = "InstanceKlass::_source_file_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassSourceFileNameIndexOffset;
1005     @HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset;
1006     @HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset;
1007     @HotSpotVMField(name = "InstanceKlass::_fields", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassFieldsOffset;
1008     @HotSpotVMField(name = "InstanceKlass::_vtable_len", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassVtableLengthOffset;
1009 
1010     @HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked;
1011     @HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized;
1012 
1013     /**
1014      * See {@code InstanceKlass::vtable_start_offset()}.
1015      */
1016     public final int instanceKlassVtableStartOffset() {
1017         return roundUp(instanceKlassSize, heapWordSize);
1018     }
1019 
1020     // TODO use CodeUtil method once it's moved from NumUtil
1021     private static int roundUp(int number, int mod) {
1022         return ((number + mod - 1) / mod) * mod;
1023     }
1024 
1025     @HotSpotVMType(name = "arrayOopDesc", get = HotSpotVMType.Type.SIZE) @Stable public int arrayOopDescSize;
1026 
1027     /**
1028      * The offset of the array length word in an array object's header.
1029      *
1030      * See {@code arrayOopDesc::length_offset_in_bytes()}.
1031      */
1032     public final int arrayOopDescLengthOffset() {
1033         return useCompressedClassPointers ? hubOffset + narrowKlassSize : arrayOopDescSize;
1034     }
1035 
1036     @HotSpotVMField(name = "Array<int>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1LengthOffset;
1037     @HotSpotVMField(name = "Array<u1>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1DataOffset;
1038     @HotSpotVMField(name = "Array<u2>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU2DataOffset;
1039     @HotSpotVMField(name = "Array<Klass*>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayLengthOffset;
1040     @HotSpotVMField(name = "Array<Klass*>::_data[0]", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayBaseOffset;
1041 
1042     @HotSpotVMField(name = "ObjArrayKlass::_element_klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayClassElementOffset;
1043 
1044     @HotSpotVMConstant(name = "FieldInfo::access_flags_offset") @Stable public int fieldInfoAccessFlagsOffset;
1045     @HotSpotVMConstant(name = "FieldInfo::name_index_offset") @Stable public int fieldInfoNameIndexOffset;
1046     @HotSpotVMConstant(name = "FieldInfo::signature_index_offset") @Stable public int fieldInfoSignatureIndexOffset;
1047     @HotSpotVMConstant(name = "FieldInfo::initval_index_offset") @Stable public int fieldInfoInitvalIndexOffset;
1048     @HotSpotVMConstant(name = "FieldInfo::low_packed_offset") @Stable public int fieldInfoLowPackedOffset;
1049     @HotSpotVMConstant(name = "FieldInfo::high_packed_offset") @Stable public int fieldInfoHighPackedOffset;
1050     @HotSpotVMConstant(name = "FieldInfo::field_slots") @Stable public int fieldInfoFieldSlots;
1051 
1052     @HotSpotVMConstant(name = "FIELDINFO_TAG_SIZE") @Stable public int fieldInfoTagSize;
1053 
1054     @HotSpotVMConstant(name = "JVM_ACC_FIELD_INTERNAL") @Stable public int jvmAccFieldInternal;
1055     @HotSpotVMConstant(name = "JVM_ACC_FIELD_STABLE") @Stable public int jvmAccFieldStable;
1056     @HotSpotVMConstant(name = "JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE") @Stable public int jvmAccFieldHasGenericSignature;
1057     @HotSpotVMConstant(name = "JVM_ACC_WRITTEN_FLAGS") @Stable public int jvmAccWrittenFlags;
1058 
1059     @HotSpotVMField(name = "Thread::_tlab", type = "ThreadLocalAllocBuffer", get = HotSpotVMField.Type.OFFSET) @Stable public int threadTlabOffset;
1060 
1061     @HotSpotVMField(name = "JavaThread::_anchor", type = "JavaFrameAnchor", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadAnchorOffset;
1062     @HotSpotVMField(name = "JavaThread::_threadObj", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectOffset;
1063     @HotSpotVMField(name = "JavaThread::_osthread", type = "OSThread*", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadOffset;
1064     @HotSpotVMField(name = "JavaThread::_dirty_card_queue", type = "DirtyCardQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadDirtyCardQueueOffset;
1065     @HotSpotVMField(name = "JavaThread::_is_method_handle_return", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int threadIsMethodHandleReturnOffset;
1066     @HotSpotVMField(name = "JavaThread::_satb_mark_queue", type = "ObjPtrQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadSatbMarkQueueOffset;
1067     @HotSpotVMField(name = "JavaThread::_vm_result", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectResultOffset;
1068     @HotSpotVMField(name = "JavaThread::_jvmci_counters", type = "jlong*", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciCountersThreadOffset;
1069 
1070     /**
1071      * An invalid value for {@link #rtldDefault}.
1072      */
1073     public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE;
1074 
1075     /**
1076      * Address of the library lookup routine. The C signature of this routine is:
1077      *
1078      * <pre>
1079      *     void* (const char *filename, char *ebuf, int ebuflen)
1080      * </pre>
1081      */
1082     @HotSpotVMAddress(name = "os::dll_load") @Stable public long dllLoad;
1083 
1084     /**
1085      * Address of the library lookup routine. The C signature of this routine is:
1086      *
1087      * <pre>
1088      *     void* (void* handle, const char* name)
1089      * </pre>
1090      */
1091     @HotSpotVMAddress(name = "os::dll_lookup") @Stable public long dllLookup;
1092 
1093     /**
1094      * A pseudo-handle which when used as the first argument to {@link #dllLookup} means lookup will
1095      * return the first occurrence of the desired symbol using the default library search order. If
1096      * this field is {@value #INVALID_RTLD_DEFAULT_HANDLE}, then this capability is not supported on
1097      * the current platform.
1098      */
1099     @HotSpotVMAddress(name = "RTLD_DEFAULT", os = {"bsd", "linux"}) @Stable public long rtldDefault = INVALID_RTLD_DEFAULT_HANDLE;
1100 
1101     /**
1102      * This field is used to pass exception objects into and out of the runtime system during
1103      * exception handling for compiled code.
1104      */
1105     @HotSpotVMField(name = "JavaThread::_exception_oop", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionOopOffset;
1106     @HotSpotVMField(name = "JavaThread::_exception_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionPcOffset;
1107     @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset;
1108 
1109     @HotSpotVMField(name = "JavaThread::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset;
1110     @HotSpotVMField(name = "JavaThread::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset;
1111     @HotSpotVMField(name = "JavaThread::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset;
1112 
1113     @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_sp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaSpOffset;
1114     @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaPcOffset;
1115     @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_fp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET, archs = {"amd64"}) @Stable private int javaFrameAnchorLastJavaFpOffset;
1116     @HotSpotVMField(name = "JavaFrameAnchor::_flags", type = "int", get = HotSpotVMField.Type.OFFSET, archs = {"sparc"}) @Stable private int javaFrameAnchorFlagsOffset;
1117 
1118     public int threadLastJavaSpOffset() {
1119         return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset;
1120     }
1121 
1122     public int threadLastJavaPcOffset() {
1123         return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset;
1124     }
1125 
1126     /**
1127      * This value is only valid on AMD64.
1128      */
1129     public int threadLastJavaFpOffset() {
1130         // TODO add an assert for AMD64
1131         return javaThreadAnchorOffset + javaFrameAnchorLastJavaFpOffset;
1132     }
1133 
1134     /**
1135      * This value is only valid on SPARC.
1136      */
1137     public int threadJavaFrameAnchorFlagsOffset() {
1138         // TODO add an assert for SPARC
1139         return javaThreadAnchorOffset + javaFrameAnchorFlagsOffset;
1140     }
1141 
1142     // These are only valid on AMD64.
1143     @HotSpotVMConstant(name = "frame::arg_reg_save_area_bytes", archs = {"amd64"}) @Stable public int runtimeCallStackSize;
1144     @HotSpotVMConstant(name = "frame::interpreter_frame_sender_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameSenderSpOffset;
1145     @HotSpotVMConstant(name = "frame::interpreter_frame_last_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameLastSpOffset;
1146 
1147     @HotSpotVMField(name = "PtrQueue::_active", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueActiveOffset;
1148     @HotSpotVMField(name = "PtrQueue::_buf", type = "void**", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueBufferOffset;
1149     @HotSpotVMField(name = "PtrQueue::_index", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueIndexOffset;
1150 
1151     @HotSpotVMField(name = "OSThread::_interrupted", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadInterruptedOffset;
1152 
1153     @HotSpotVMConstant(name = "markOopDesc::unlocked_value") @Stable public int unlockedMask;
1154     @HotSpotVMConstant(name = "markOopDesc::biased_lock_mask_in_place") @Stable public int biasedLockMaskInPlace;
1155     @HotSpotVMConstant(name = "markOopDesc::age_mask_in_place") @Stable public int ageMaskInPlace;
1156     @HotSpotVMConstant(name = "markOopDesc::epoch_mask_in_place") @Stable public int epochMaskInPlace;
1157 
1158     @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public long markOopDescHashShift;
1159     @HotSpotVMConstant(name = "markOopDesc::hash_mask") @Stable public long markOopDescHashMask;
1160     @HotSpotVMConstant(name = "markOopDesc::hash_mask_in_place") @Stable public long markOopDescHashMaskInPlace;
1161 
1162     @HotSpotVMConstant(name = "markOopDesc::biased_lock_pattern") @Stable public int biasedLockPattern;
1163     @HotSpotVMConstant(name = "markOopDesc::no_hash_in_place") @Stable public int markWordNoHashInPlace;
1164     @HotSpotVMConstant(name = "markOopDesc::no_lock_in_place") @Stable public int markWordNoLockInPlace;
1165 
1166     /**
1167      * See {@code markOopDesc::prototype()}.
1168      */
1169     public long arrayPrototypeMarkWord() {
1170         return markWordNoHashInPlace | markWordNoLockInPlace;
1171     }
1172 
1173     /**
1174      * See {@code markOopDesc::copy_set_hash()}.
1175      */
1176     public long tlabIntArrayMarkWord() {
1177         long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace);
1178         tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift);
1179         return tmp;
1180     }
1181 
1182     /**
1183      * Mark word right shift to get identity hash code.
1184      */
1185     @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public int identityHashCodeShift;
1186 
1187     /**
1188      * Identity hash code value when uninitialized.
1189      */
1190     @HotSpotVMConstant(name = "markOopDesc::no_hash") @Stable public int uninitializedIdentityHashCodeValue;
1191 
1192     @HotSpotVMField(name = "Method::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int methodAccessFlagsOffset;
1193     @HotSpotVMField(name = "Method::_constMethod", type = "ConstMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodConstMethodOffset;
1194     @HotSpotVMField(name = "Method::_intrinsic_id", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodIntrinsicIdOffset;
1195     @HotSpotVMField(name = "Method::_flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodFlagsOffset;
1196     @HotSpotVMField(name = "Method::_vtable_index", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodVtableIndexOffset;
1197 
1198     @HotSpotVMConstant(name = "Method::_jfr_towrite") @Stable public int methodFlagsJfrTowrite;
1199     @HotSpotVMConstant(name = "Method::_caller_sensitive") @Stable public int methodFlagsCallerSensitive;
1200     @HotSpotVMConstant(name = "Method::_force_inline") @Stable public int methodFlagsForceInline;
1201     @HotSpotVMConstant(name = "Method::_dont_inline") @Stable public int methodFlagsDontInline;
1202     @HotSpotVMConstant(name = "Method::_hidden") @Stable public int methodFlagsHidden;
1203     @HotSpotVMConstant(name = "Method::nonvirtual_vtable_index") @Stable public int nonvirtualVtableIndex;
1204     @HotSpotVMConstant(name = "Method::invalid_vtable_index") @Stable public int invalidVtableIndex;
1205 
1206     @HotSpotVMConstant(name = "InvocationEntryBci") @Stable public int invocationEntryBci;
1207 
1208     @HotSpotVMField(name = "JVMCIEnv::_task", type = "CompileTask*", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvTaskOffset;
1209     @HotSpotVMField(name = "JVMCIEnv::_jvmti_can_hotswap_or_post_breakpoint", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset;
1210     @HotSpotVMField(name = "CompileTask::_num_inlined_bytecodes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int compileTaskNumInlinedBytecodesOffset;
1211 
1212     /**
1213      * See {@code Method::extra_stack_entries()}.
1214      */
1215     @HotSpotVMConstant(name = "Method::extra_stack_entries_for_jsr292") @Stable public int extraStackEntries;
1216 
1217     @HotSpotVMField(name = "ConstMethod::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodConstantsOffset;
1218     @HotSpotVMField(name = "ConstMethod::_flags", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodFlagsOffset;
1219     @HotSpotVMField(name = "ConstMethod::_code_size", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodCodeSizeOffset;
1220     @HotSpotVMField(name = "ConstMethod::_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodNameIndexOffset;
1221     @HotSpotVMField(name = "ConstMethod::_signature_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodSignatureIndexOffset;
1222     @HotSpotVMField(name = "ConstMethod::_max_stack", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodMaxStackOffset;
1223     @HotSpotVMField(name = "ConstMethod::_max_locals", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodMaxLocalsOffset;
1224 
1225     @HotSpotVMConstant(name = "ConstMethod::_has_linenumber_table") @Stable public int constMethodHasLineNumberTable;
1226     @HotSpotVMConstant(name = "ConstMethod::_has_localvariable_table") @Stable public int constMethodHasLocalVariableTable;
1227     @HotSpotVMConstant(name = "ConstMethod::_has_exception_table") @Stable public int constMethodHasExceptionTable;
1228 
1229     @HotSpotVMType(name = "ExceptionTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int exceptionTableElementSize;
1230     @HotSpotVMField(name = "ExceptionTableElement::start_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementStartPcOffset;
1231     @HotSpotVMField(name = "ExceptionTableElement::end_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementEndPcOffset;
1232     @HotSpotVMField(name = "ExceptionTableElement::handler_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementHandlerPcOffset;
1233     @HotSpotVMField(name = "ExceptionTableElement::catch_type_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementCatchTypeIndexOffset;
1234 
1235     @HotSpotVMType(name = "LocalVariableTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int localVariableTableElementSize;
1236     @HotSpotVMField(name = "LocalVariableTableElement::start_bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementStartBciOffset;
1237     @HotSpotVMField(name = "LocalVariableTableElement::length", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementLengthOffset;
1238     @HotSpotVMField(name = "LocalVariableTableElement::name_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementNameCpIndexOffset;
1239     @HotSpotVMField(name = "LocalVariableTableElement::descriptor_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementDescriptorCpIndexOffset;
1240     @HotSpotVMField(name = "LocalVariableTableElement::signature_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSignatureCpIndexOffset;
1241     @HotSpotVMField(name = "LocalVariableTableElement::slot", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSlotOffset;
1242 
1243     @HotSpotVMType(name = "ConstantPool", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolSize;
1244     @HotSpotVMField(name = "ConstantPool::_tags", type = "Array<u1>*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolTagsOffset;
1245     @HotSpotVMField(name = "ConstantPool::_pool_holder", type = "InstanceKlass*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolHolderOffset;
1246     @HotSpotVMField(name = "ConstantPool::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolLengthOffset;
1247 
1248     @HotSpotVMConstant(name = "ConstantPool::CPCACHE_INDEX_TAG") @Stable public int constantPoolCpCacheIndexTag;
1249 
1250     @HotSpotVMConstant(name = "JVM_CONSTANT_Utf8") @Stable public int jvmConstantUtf8;
1251     @HotSpotVMConstant(name = "JVM_CONSTANT_Integer") @Stable public int jvmConstantInteger;
1252     @HotSpotVMConstant(name = "JVM_CONSTANT_Long") @Stable public int jvmConstantLong;
1253     @HotSpotVMConstant(name = "JVM_CONSTANT_Float") @Stable public int jvmConstantFloat;
1254     @HotSpotVMConstant(name = "JVM_CONSTANT_Double") @Stable public int jvmConstantDouble;
1255     @HotSpotVMConstant(name = "JVM_CONSTANT_Class") @Stable public int jvmConstantClass;
1256     @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClass") @Stable public int jvmConstantUnresolvedClass;
1257     @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClassInError") @Stable public int jvmConstantUnresolvedClassInError;
1258     @HotSpotVMConstant(name = "JVM_CONSTANT_String") @Stable public int jvmConstantString;
1259     @HotSpotVMConstant(name = "JVM_CONSTANT_Fieldref") @Stable public int jvmConstantFieldref;
1260     @HotSpotVMConstant(name = "JVM_CONSTANT_Methodref") @Stable public int jvmConstantMethodref;
1261     @HotSpotVMConstant(name = "JVM_CONSTANT_InterfaceMethodref") @Stable public int jvmConstantInterfaceMethodref;
1262     @HotSpotVMConstant(name = "JVM_CONSTANT_NameAndType") @Stable public int jvmConstantNameAndType;
1263     @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandle") @Stable public int jvmConstantMethodHandle;
1264     @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandleInError") @Stable public int jvmConstantMethodHandleInError;
1265     @HotSpotVMConstant(name = "JVM_CONSTANT_MethodType") @Stable public int jvmConstantMethodType;
1266     @HotSpotVMConstant(name = "JVM_CONSTANT_MethodTypeInError") @Stable public int jvmConstantMethodTypeInError;
1267     @HotSpotVMConstant(name = "JVM_CONSTANT_InvokeDynamic") @Stable public int jvmConstantInvokeDynamic;
1268 
1269     @HotSpotVMConstant(name = "JVM_CONSTANT_ExternalMax") @Stable public int jvmConstantExternalMax;
1270     @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMin") @Stable public int jvmConstantInternalMin;
1271     @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMax") @Stable public int jvmConstantInternalMax;
1272 
1273     @HotSpotVMConstant(name = "HeapWordSize") @Stable public int heapWordSize;
1274 
1275     @HotSpotVMType(name = "Symbol*", get = HotSpotVMType.Type.SIZE) @Stable public int symbolPointerSize;
1276     @HotSpotVMField(name = "Symbol::_length", type = "unsigned short", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolLengthOffset;
1277     @HotSpotVMField(name = "Symbol::_body[0]", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolBodyOffset;
1278 
1279     @HotSpotVMField(name = "vmSymbols::_symbols[0]", type = "Symbol*", get = HotSpotVMField.Type.ADDRESS) @Stable public long vmSymbolsSymbols;
1280     @HotSpotVMConstant(name = "vmSymbols::FIRST_SID") @Stable public int vmSymbolsFirstSID;
1281     @HotSpotVMConstant(name = "vmSymbols::SID_LIMIT") @Stable public int vmSymbolsSIDLimit;
1282 
1283     @HotSpotVMConstant(name = "JVM_ACC_HAS_FINALIZER") @Stable public int klassHasFinalizerFlag;
1284 
1285     // Modifier.SYNTHETIC is not public so we get it via vmStructs.
1286     @HotSpotVMConstant(name = "JVM_ACC_SYNTHETIC") @Stable public int syntheticFlag;
1287 
1288     /**
1289      * @see HotSpotResolvedObjectTypeImpl#createField
1290      */
1291     @HotSpotVMConstant(name = "JVM_RECOGNIZED_FIELD_MODIFIERS") @Stable public int recognizedFieldModifiers;
1292 
1293     /**
1294      * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
1295      * are allowed to look like (respectively) the high or low bits of a real oop.
1296      */
1297     @HotSpotVMField(name = "Universe::_non_oop_bits", type = "intptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long nonOopBits;
1298 
1299     @HotSpotVMField(name = "StubRoutines::_verify_oop_count", type = "jint", get = HotSpotVMField.Type.ADDRESS) @Stable public long verifyOopCounterAddress;
1300     @HotSpotVMField(name = "Universe::_verify_oop_mask", type = "uintptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long verifyOopMask;
1301     @HotSpotVMField(name = "Universe::_verify_oop_bits", type = "uintptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long verifyOopBits;
1302     @HotSpotVMField(name = "Universe::_base_vtable_size", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int universeBaseVtableSize;
1303 
1304     public final int baseVtableLength() {
1305         return universeBaseVtableSize / vtableEntrySize;
1306     }
1307 
1308     @HotSpotVMField(name = "CollectedHeap::_barrier_set", type = "BarrierSet*", get = HotSpotVMField.Type.OFFSET) @Stable public int collectedHeapBarrierSetOffset;
1309 
1310     @HotSpotVMField(name = "HeapRegion::LogOfHRGrainBytes", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int logOfHRGrainBytes;
1311 
1312     @HotSpotVMField(name = "BarrierSet::_fake_rtti", type = "BarrierSet::FakeRtti", get = HotSpotVMField.Type.OFFSET) @Stable private int barrierSetFakeRttiOffset;
1313     @HotSpotVMConstant(name = "BarrierSet::CardTableModRef") @Stable public int barrierSetCardTableModRef;
1314     @HotSpotVMConstant(name = "BarrierSet::CardTableForRS") @Stable public int barrierSetCardTableForRS;
1315     @HotSpotVMConstant(name = "BarrierSet::CardTableExtension") @Stable public int barrierSetCardTableExtension;
1316     @HotSpotVMConstant(name = "BarrierSet::G1SATBCT") @Stable public int barrierSetG1SATBCT;
1317     @HotSpotVMConstant(name = "BarrierSet::G1SATBCTLogging") @Stable public int barrierSetG1SATBCTLogging;
1318     @HotSpotVMConstant(name = "BarrierSet::ModRef") @Stable public int barrierSetModRef;
1319 
1320     @HotSpotVMField(name = "BarrierSet::FakeRtti::_concrete_tag", type = "BarrierSet::Name", get = HotSpotVMField.Type.OFFSET) @Stable private int fakeRttiConcreteTagOffset;
1321 
1322     @HotSpotVMField(name = "CardTableModRefBS::byte_map_base", type = "jbyte*", get = HotSpotVMField.Type.OFFSET) @Stable private int cardTableModRefBSByteMapBaseOffset;
1323     @HotSpotVMConstant(name = "CardTableModRefBS::card_shift") @Stable public int cardTableModRefBSCardShift;
1324 
1325     @HotSpotVMConstant(name = "CardTableModRefBS::dirty_card") @Stable public byte dirtyCardValue;
1326     @HotSpotVMConstant(name = "G1SATBCardTableModRefBS::g1_young_gen") @Stable public byte g1YoungCardValue;
1327 
1328     private final long cardtableStartAddress;
1329     private final int cardtableShift;
1330 
1331     public long cardtableStartAddress() {
1332         if (cardtableStartAddress == -1) {
1333             throw JVMCIError.shouldNotReachHere();
1334         }
1335         return cardtableStartAddress;
1336     }
1337 
1338     public int cardtableShift() {
1339         if (cardtableShift == -1) {
1340             throw JVMCIError.shouldNotReachHere();
1341         }
1342         return cardtableShift;
1343     }
1344 
1345     @HotSpotVMField(name = "os::_polling_page", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long safepointPollingAddress;
1346 
1347     // G1 Collector Related Values.
1348 
1349     public int g1CardQueueIndexOffset() {
1350         return javaThreadDirtyCardQueueOffset + ptrQueueIndexOffset;
1351     }
1352 
1353     public int g1CardQueueBufferOffset() {
1354         return javaThreadDirtyCardQueueOffset + ptrQueueBufferOffset;
1355     }
1356 
1357     public int g1SATBQueueMarkingOffset() {
1358         return javaThreadSatbMarkQueueOffset + ptrQueueActiveOffset;
1359     }
1360 
1361     public int g1SATBQueueIndexOffset() {
1362         return javaThreadSatbMarkQueueOffset + ptrQueueIndexOffset;
1363     }
1364 
1365     public int g1SATBQueueBufferOffset() {
1366         return javaThreadSatbMarkQueueOffset + ptrQueueBufferOffset;
1367     }
1368 
1369     @HotSpotVMField(name = "java_lang_Class::_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassOffset;
1370     @HotSpotVMField(name = "java_lang_Class::_array_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int arrayKlassOffset;
1371 
1372     @HotSpotVMField(name = "Method::_method_counters", type = "MethodCounters*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCountersOffset;
1373     @HotSpotVMField(name = "Method::_method_data", type = "MethodData*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOffset;
1374     @HotSpotVMField(name = "Method::_from_compiled_entry", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCompiledEntryOffset;
1375     @HotSpotVMField(name = "Method::_code", type = "nmethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset;
1376 
1377     @HotSpotVMField(name = "MethodCounters::_invocation_counter", type = "InvocationCounter", get = HotSpotVMField.Type.OFFSET) @Stable public int invocationCounterOffset;
1378     @HotSpotVMField(name = "MethodCounters::_backedge_counter", type = "InvocationCounter", get = HotSpotVMField.Type.OFFSET) @Stable public int backedgeCounterOffset;
1379     @HotSpotVMConstant(name = "InvocationCounter::count_increment") @Stable public int invocationCounterIncrement;
1380     @HotSpotVMConstant(name = "InvocationCounter::count_shift") @Stable public int invocationCounterShift;
1381 
1382     @HotSpotVMField(name = "MethodData::_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataSize;
1383     @HotSpotVMField(name = "MethodData::_data_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataDataSize;
1384     @HotSpotVMField(name = "MethodData::_data[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopDataOffset;
1385     @HotSpotVMField(name = "MethodData::_trap_hist._array[0]", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopTrapHistoryOffset;
1386     @HotSpotVMField(name = "MethodData::_jvmci_ir_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataIRSizeOffset;
1387 
1388     @HotSpotVMField(name = "nmethod::_verified_entry_point", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodEntryOffset;
1389     @HotSpotVMField(name = "nmethod::_comp_level", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodCompLevelOffset;
1390 
1391     @HotSpotVMConstant(name = "CompLevel_full_optimization") @Stable public int compilationLevelFullOptimization;
1392 
1393     @HotSpotVMType(name = "BasicLock", get = HotSpotVMType.Type.SIZE) @Stable public int basicLockSize;
1394     @HotSpotVMField(name = "BasicLock::_displaced_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int basicLockDisplacedHeaderOffset;
1395 
1396     @HotSpotVMField(name = "Thread::_allocated_bytes", type = "jlong", get = HotSpotVMField.Type.OFFSET) @Stable public int threadAllocatedBytesOffset;
1397 
1398     @HotSpotVMFlag(name = "TLABWasteIncrement") @Stable public int tlabRefillWasteIncrement;
1399 
1400     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_start", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferStartOffset;
1401     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_end", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferEndOffset;
1402     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferTopOffset;
1403     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_pf_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferPfTopOffset;
1404     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_slow_allocations", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferSlowAllocationsOffset;
1405     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_fast_refill_waste", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferFastRefillWasteOffset;
1406     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_number_of_refills", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferNumberOfRefillsOffset;
1407     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_refill_waste_limit", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferRefillWasteLimitOffset;
1408     @HotSpotVMField(name = "ThreadLocalAllocBuffer::_desired_size", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferDesiredSizeOffset;
1409 
1410     public int tlabSlowAllocationsOffset() {
1411         return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset;
1412     }
1413 
1414     public int tlabFastRefillWasteOffset() {
1415         return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset;
1416     }
1417 
1418     public int tlabNumberOfRefillsOffset() {
1419         return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset;
1420     }
1421 
1422     public int tlabRefillWasteLimitOffset() {
1423         return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset;
1424     }
1425 
1426     public int threadTlabSizeOffset() {
1427         return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset;
1428     }
1429 
1430     public int threadTlabStartOffset() {
1431         return threadTlabOffset + threadLocalAllocBufferStartOffset;
1432     }
1433 
1434     public int threadTlabEndOffset() {
1435         return threadTlabOffset + threadLocalAllocBufferEndOffset;
1436     }
1437 
1438     public int threadTlabTopOffset() {
1439         return threadTlabOffset + threadLocalAllocBufferTopOffset;
1440     }
1441 
1442     public int threadTlabPfTopOffset() {
1443         return threadTlabOffset + threadLocalAllocBufferPfTopOffset;
1444     }
1445 
1446     /**
1447      * See: {@code ThreadLocalAllocBuffer::end_reserve()}.
1448      */
1449     public final int threadLocalAllocBufferEndReserve() {
1450         final int typeSizeInBytes = roundUp(arrayOopDescLengthOffset() + Integer.BYTES, heapWordSize);
1451         // T_INT arrays need not be 8 byte aligned.
1452         final int reserveSize = typeSizeInBytes / heapWordSize;
1453         return Integer.max(reserveSize, abstractVmVersionReserveForAllocationPrefetch);
1454     }
1455 
1456     /**
1457      * See: {@code ThreadLocalAllocBuffer::alignment_reserve()}.
1458      */
1459     public final int tlabAlignmentReserve() {
1460         return roundUp(threadLocalAllocBufferEndReserve(), minObjAlignment());
1461     }
1462 
1463     @HotSpotVMFlag(name = "TLABStats") @Stable public boolean tlabStats;
1464 
1465     // FIXME This is only temporary until the GC code is changed.
1466     @HotSpotVMField(name = "CompilerToVM::_supports_inline_contig_alloc", type = "bool", get = HotSpotVMField.Type.VALUE) @Stable public boolean inlineContiguousAllocationSupported;
1467     @HotSpotVMField(name = "CompilerToVM::_heap_end_addr", type = "HeapWord**", get = HotSpotVMField.Type.VALUE) @Stable public long heapEndAddress;
1468     @HotSpotVMField(name = "CompilerToVM::_heap_top_addr", type = "HeapWord**", get = HotSpotVMField.Type.VALUE) @Stable public long heapTopAddress;
1469 
1470     /**
1471      * The DataLayout header size is the same as the cell size.
1472      */
1473     @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutHeaderSize;
1474     @HotSpotVMField(name = "DataLayout::_header._struct._tag", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutTagOffset;
1475     @HotSpotVMField(name = "DataLayout::_header._struct._flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutFlagsOffset;
1476     @HotSpotVMField(name = "DataLayout::_header._struct._bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutBCIOffset;
1477     @HotSpotVMField(name = "DataLayout::_cells[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutCellsOffset;
1478     @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutCellSize;
1479 
1480     @HotSpotVMConstant(name = "DataLayout::no_tag") @Stable public int dataLayoutNoTag;
1481     @HotSpotVMConstant(name = "DataLayout::bit_data_tag") @Stable public int dataLayoutBitDataTag;
1482     @HotSpotVMConstant(name = "DataLayout::counter_data_tag") @Stable public int dataLayoutCounterDataTag;
1483     @HotSpotVMConstant(name = "DataLayout::jump_data_tag") @Stable public int dataLayoutJumpDataTag;
1484     @HotSpotVMConstant(name = "DataLayout::receiver_type_data_tag") @Stable public int dataLayoutReceiverTypeDataTag;
1485     @HotSpotVMConstant(name = "DataLayout::virtual_call_data_tag") @Stable public int dataLayoutVirtualCallDataTag;
1486     @HotSpotVMConstant(name = "DataLayout::ret_data_tag") @Stable public int dataLayoutRetDataTag;
1487     @HotSpotVMConstant(name = "DataLayout::branch_data_tag") @Stable public int dataLayoutBranchDataTag;
1488     @HotSpotVMConstant(name = "DataLayout::multi_branch_data_tag") @Stable public int dataLayoutMultiBranchDataTag;
1489     @HotSpotVMConstant(name = "DataLayout::arg_info_data_tag") @Stable public int dataLayoutArgInfoDataTag;
1490     @HotSpotVMConstant(name = "DataLayout::call_type_data_tag") @Stable public int dataLayoutCallTypeDataTag;
1491     @HotSpotVMConstant(name = "DataLayout::virtual_call_type_data_tag") @Stable public int dataLayoutVirtualCallTypeDataTag;
1492     @HotSpotVMConstant(name = "DataLayout::parameters_type_data_tag") @Stable public int dataLayoutParametersTypeDataTag;
1493     @HotSpotVMConstant(name = "DataLayout::speculative_trap_data_tag") @Stable public int dataLayoutSpeculativeTrapDataTag;
1494 
1495     @HotSpotVMFlag(name = "BciProfileWidth") @Stable public int bciProfileWidth;
1496     @HotSpotVMFlag(name = "TypeProfileWidth") @Stable public int typeProfileWidth;
1497     @HotSpotVMFlag(name = "MethodProfileWidth") @Stable public int methodProfileWidth;
1498 
1499     @HotSpotVMField(name = "CodeBlob::_code_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int codeBlobCodeOffsetOffset;
1500     @HotSpotVMField(name = "DeoptimizationBlob::_unpack_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int deoptimizationBlobUnpackOffsetOffset;
1501     @HotSpotVMField(name = "DeoptimizationBlob::_uncommon_trap_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int deoptimizationBlobUncommonTrapOffsetOffset;
1502 
1503     @HotSpotVMField(name = "SharedRuntime::_ic_miss_blob", type = "RuntimeStub*", get = HotSpotVMField.Type.VALUE) @Stable private long inlineCacheMissBlob;
1504     @HotSpotVMField(name = "SharedRuntime::_wrong_method_blob", type = "RuntimeStub*", get = HotSpotVMField.Type.VALUE) @Stable private long wrongMethodBlob;
1505     @HotSpotVMField(name = "SharedRuntime::_deopt_blob", type = "DeoptimizationBlob*", get = HotSpotVMField.Type.VALUE) @Stable private long deoptBlob;
1506 
1507     @HotSpotVMManual(name = "SharedRuntime::get_ic_miss_stub()") public final long inlineCacheMissStub;
1508     @HotSpotVMManual(name = "SharedRuntime::get_handle_wrong_method_stub()") public final long handleWrongMethodStub;
1509 
1510     @HotSpotVMManual(name = "SharedRuntime::deopt_blob()->unpack()") public final long handleDeoptStub;
1511     @HotSpotVMManual(name = "SharedRuntime::deopt_blob()->uncommon_trap()") public final long uncommonTrapStub;
1512 
1513     @HotSpotVMField(name = "CodeCache::_low_bound", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long codeCacheLowBound;
1514     @HotSpotVMField(name = "CodeCache::_high_bound", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long codeCacheHighBound;
1515 
1516     @HotSpotVMField(name = "StubRoutines::_aescrypt_encryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptEncryptBlockStub;
1517     @HotSpotVMField(name = "StubRoutines::_aescrypt_decryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptDecryptBlockStub;
1518     @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_encryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingEncryptAESCryptStub;
1519     @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_decryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingDecryptAESCryptStub;
1520     @HotSpotVMField(name = "StubRoutines::_updateBytesCRC32", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long updateBytesCRC32Stub;
1521     @HotSpotVMField(name = "StubRoutines::_crc_table_adr", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long crcTableAddress;
1522 
1523     @HotSpotVMField(name = "StubRoutines::_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteArraycopy;
1524     @HotSpotVMField(name = "StubRoutines::_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortArraycopy;
1525     @HotSpotVMField(name = "StubRoutines::_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintArraycopy;
1526     @HotSpotVMField(name = "StubRoutines::_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongArraycopy;
1527     @HotSpotVMField(name = "StubRoutines::_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopy;
1528     @HotSpotVMField(name = "StubRoutines::_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopyUninit;
1529     @HotSpotVMField(name = "StubRoutines::_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteDisjointArraycopy;
1530     @HotSpotVMField(name = "StubRoutines::_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortDisjointArraycopy;
1531     @HotSpotVMField(name = "StubRoutines::_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintDisjointArraycopy;
1532     @HotSpotVMField(name = "StubRoutines::_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongDisjointArraycopy;
1533     @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopy;
1534     @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopyUninit;
1535     @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedArraycopy;
1536     @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedArraycopy;
1537     @HotSpotVMField(name = "StubRoutines::_arrayof_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedArraycopy;
1538     @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedArraycopy;
1539     @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopy;
1540     @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopyUninit;
1541     @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedDisjointArraycopy;
1542     @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedDisjointArraycopy;
1543     @HotSpotVMField(name = "StubRoutines::_arrayof_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedDisjointArraycopy;
1544     @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedDisjointArraycopy;
1545     @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopy;
1546     @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopyUninit;
1547     @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopy;
1548     @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopyUninit;
1549     @HotSpotVMField(name = "StubRoutines::_unsafe_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long unsafeArraycopy;
1550     @HotSpotVMField(name = "StubRoutines::_generic_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long genericArraycopy;
1551 
1552     @HotSpotVMAddress(name = "JVMCIRuntime::new_instance") @Stable public long newInstanceAddress;
1553     @HotSpotVMAddress(name = "JVMCIRuntime::new_array") @Stable public long newArrayAddress;
1554     @HotSpotVMAddress(name = "JVMCIRuntime::new_multi_array") @Stable public long newMultiArrayAddress;
1555     @HotSpotVMAddress(name = "JVMCIRuntime::dynamic_new_array") @Stable public long dynamicNewArrayAddress;
1556     @HotSpotVMAddress(name = "JVMCIRuntime::dynamic_new_instance") @Stable public long dynamicNewInstanceAddress;
1557 
1558     @HotSpotVMAddress(name = "JVMCIRuntime::thread_is_interrupted") @Stable public long threadIsInterruptedAddress;
1559     @HotSpotVMAddress(name = "JVMCIRuntime::vm_message") @Stable public long vmMessageAddress;
1560     @HotSpotVMAddress(name = "JVMCIRuntime::identity_hash_code") @Stable public long identityHashCodeAddress;
1561     @HotSpotVMAddress(name = "JVMCIRuntime::exception_handler_for_pc") @Stable public long exceptionHandlerForPcAddress;
1562     @HotSpotVMAddress(name = "JVMCIRuntime::monitorenter") @Stable public long monitorenterAddress;
1563     @HotSpotVMAddress(name = "JVMCIRuntime::monitorexit") @Stable public long monitorexitAddress;
1564     @HotSpotVMAddress(name = "JVMCIRuntime::create_null_exception") @Stable public long createNullPointerExceptionAddress;
1565     @HotSpotVMAddress(name = "JVMCIRuntime::create_out_of_bounds_exception") @Stable public long createOutOfBoundsExceptionAddress;
1566     @HotSpotVMAddress(name = "JVMCIRuntime::log_primitive") @Stable public long logPrimitiveAddress;
1567     @HotSpotVMAddress(name = "JVMCIRuntime::log_object") @Stable public long logObjectAddress;
1568     @HotSpotVMAddress(name = "JVMCIRuntime::log_printf") @Stable public long logPrintfAddress;
1569     @HotSpotVMAddress(name = "JVMCIRuntime::vm_error") @Stable public long vmErrorAddress;
1570     @HotSpotVMAddress(name = "JVMCIRuntime::load_and_clear_exception") @Stable public long loadAndClearExceptionAddress;
1571     @HotSpotVMAddress(name = "JVMCIRuntime::write_barrier_pre") @Stable public long writeBarrierPreAddress;
1572     @HotSpotVMAddress(name = "JVMCIRuntime::write_barrier_post") @Stable public long writeBarrierPostAddress;
1573     @HotSpotVMAddress(name = "JVMCIRuntime::validate_object") @Stable public long validateObject;
1574 
1575     @HotSpotVMAddress(name = "JVMCIRuntime::test_deoptimize_call_int") @Stable public long testDeoptimizeCallInt;
1576 
1577     @HotSpotVMAddress(name = "SharedRuntime::register_finalizer") @Stable public long registerFinalizerAddress;
1578     @HotSpotVMAddress(name = "SharedRuntime::exception_handler_for_return_address") @Stable public long exceptionHandlerForReturnAddressAddress;
1579     @HotSpotVMAddress(name = "SharedRuntime::OSR_migration_end") @Stable public long osrMigrationEndAddress;
1580 
1581     @HotSpotVMAddress(name = "os::javaTimeMillis") @Stable public long javaTimeMillisAddress;
1582     @HotSpotVMAddress(name = "os::javaTimeNanos") @Stable public long javaTimeNanosAddress;
1583     @HotSpotVMAddress(name = "SharedRuntime::dsin") @Stable public long arithmeticSinAddress;
1584     @HotSpotVMAddress(name = "SharedRuntime::dcos") @Stable public long arithmeticCosAddress;
1585     @HotSpotVMAddress(name = "SharedRuntime::dtan") @Stable public long arithmeticTanAddress;
1586     @HotSpotVMAddress(name = "SharedRuntime::dexp") @Stable public long arithmeticExpAddress;
1587     @HotSpotVMAddress(name = "SharedRuntime::dlog") @Stable public long arithmeticLogAddress;
1588     @HotSpotVMAddress(name = "SharedRuntime::dlog10") @Stable public long arithmeticLog10Address;
1589     @HotSpotVMAddress(name = "SharedRuntime::dpow") @Stable public long arithmeticPowAddress;
1590 
1591     @HotSpotVMFlag(name = "JVMCICounterSize") @Stable public int jvmciCountersSize;
1592 
1593     @HotSpotVMAddress(name = "Deoptimization::fetch_unroll_info") @Stable public long deoptimizationFetchUnrollInfo;
1594     @HotSpotVMAddress(name = "Deoptimization::uncommon_trap") @Stable public long deoptimizationUncommonTrap;
1595     @HotSpotVMAddress(name = "Deoptimization::unpack_frames") @Stable public long deoptimizationUnpackFrames;
1596 
1597     @HotSpotVMConstant(name = "Deoptimization::Reason_none") @Stable public int deoptReasonNone;
1598     @HotSpotVMConstant(name = "Deoptimization::Reason_null_check") @Stable public int deoptReasonNullCheck;
1599     @HotSpotVMConstant(name = "Deoptimization::Reason_range_check") @Stable public int deoptReasonRangeCheck;
1600     @HotSpotVMConstant(name = "Deoptimization::Reason_class_check") @Stable public int deoptReasonClassCheck;
1601     @HotSpotVMConstant(name = "Deoptimization::Reason_array_check") @Stable public int deoptReasonArrayCheck;
1602     @HotSpotVMConstant(name = "Deoptimization::Reason_unreached0") @Stable public int deoptReasonUnreached0;
1603     @HotSpotVMConstant(name = "Deoptimization::Reason_type_checked_inlining") @Stable public int deoptReasonTypeCheckInlining;
1604     @HotSpotVMConstant(name = "Deoptimization::Reason_optimized_type_check") @Stable public int deoptReasonOptimizedTypeCheck;
1605     @HotSpotVMConstant(name = "Deoptimization::Reason_not_compiled_exception_handler") @Stable public int deoptReasonNotCompiledExceptionHandler;
1606     @HotSpotVMConstant(name = "Deoptimization::Reason_unresolved") @Stable public int deoptReasonUnresolved;
1607     @HotSpotVMConstant(name = "Deoptimization::Reason_jsr_mismatch") @Stable public int deoptReasonJsrMismatch;
1608     @HotSpotVMConstant(name = "Deoptimization::Reason_div0_check") @Stable public int deoptReasonDiv0Check;
1609     @HotSpotVMConstant(name = "Deoptimization::Reason_constraint") @Stable public int deoptReasonConstraint;
1610     @HotSpotVMConstant(name = "Deoptimization::Reason_loop_limit_check") @Stable public int deoptReasonLoopLimitCheck;
1611     @HotSpotVMConstant(name = "Deoptimization::Reason_aliasing") @Stable public int deoptReasonAliasing;
1612     @HotSpotVMConstant(name = "Deoptimization::Reason_transfer_to_interpreter") @Stable public int deoptReasonTransferToInterpreter;
1613     @HotSpotVMConstant(name = "Deoptimization::Reason_LIMIT") @Stable public int deoptReasonOSROffset;
1614 
1615     @HotSpotVMConstant(name = "Deoptimization::Action_none") @Stable public int deoptActionNone;
1616     @HotSpotVMConstant(name = "Deoptimization::Action_maybe_recompile") @Stable public int deoptActionMaybeRecompile;
1617     @HotSpotVMConstant(name = "Deoptimization::Action_reinterpret") @Stable public int deoptActionReinterpret;
1618     @HotSpotVMConstant(name = "Deoptimization::Action_make_not_entrant") @Stable public int deoptActionMakeNotEntrant;
1619     @HotSpotVMConstant(name = "Deoptimization::Action_make_not_compilable") @Stable public int deoptActionMakeNotCompilable;
1620 
1621     @HotSpotVMConstant(name = "Deoptimization::_action_bits") @Stable public int deoptimizationActionBits;
1622     @HotSpotVMConstant(name = "Deoptimization::_reason_bits") @Stable public int deoptimizationReasonBits;
1623     @HotSpotVMConstant(name = "Deoptimization::_debug_id_bits") @Stable public int deoptimizationDebugIdBits;
1624     @HotSpotVMConstant(name = "Deoptimization::_action_shift") @Stable public int deoptimizationActionShift;
1625     @HotSpotVMConstant(name = "Deoptimization::_reason_shift") @Stable public int deoptimizationReasonShift;
1626     @HotSpotVMConstant(name = "Deoptimization::_debug_id_shift") @Stable public int deoptimizationDebugIdShift;
1627 
1628     @HotSpotVMConstant(name = "Deoptimization::Unpack_deopt") @Stable public int deoptimizationUnpackDeopt;
1629     @HotSpotVMConstant(name = "Deoptimization::Unpack_exception") @Stable public int deoptimizationUnpackException;
1630     @HotSpotVMConstant(name = "Deoptimization::Unpack_uncommon_trap") @Stable public int deoptimizationUnpackUncommonTrap;
1631     @HotSpotVMConstant(name = "Deoptimization::Unpack_reexecute") @Stable public int deoptimizationUnpackReexecute;
1632 
1633     @HotSpotVMField(name = "Deoptimization::UnrollBlock::_size_of_deoptimized_frame", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockSizeOfDeoptimizedFrameOffset;
1634     @HotSpotVMField(name = "Deoptimization::UnrollBlock::_caller_adjustment", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockCallerAdjustmentOffset;
1635     @HotSpotVMField(name = "Deoptimization::UnrollBlock::_number_of_frames", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockNumberOfFramesOffset;
1636     @HotSpotVMField(name = "Deoptimization::UnrollBlock::_total_frame_sizes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockTotalFrameSizesOffset;
1637     @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_sizes", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFrameSizesOffset;
1638     @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_pcs", type = "address*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFramePcsOffset;
1639     @HotSpotVMField(name = "Deoptimization::UnrollBlock::_initial_info", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockInitialInfoOffset;
1640 
1641     @HotSpotVMConstant(name = "vmIntrinsics::_invokeBasic") @Stable public int vmIntrinsicInvokeBasic;
1642     @HotSpotVMConstant(name = "vmIntrinsics::_linkToVirtual") @Stable public int vmIntrinsicLinkToVirtual;
1643     @HotSpotVMConstant(name = "vmIntrinsics::_linkToStatic") @Stable public int vmIntrinsicLinkToStatic;
1644     @HotSpotVMConstant(name = "vmIntrinsics::_linkToSpecial") @Stable public int vmIntrinsicLinkToSpecial;
1645     @HotSpotVMConstant(name = "vmIntrinsics::_linkToInterface") @Stable public int vmIntrinsicLinkToInterface;
1646 
1647     @HotSpotVMConstant(name = "JVMCIEnv::ok") @Stable public int codeInstallResultOk;
1648     @HotSpotVMConstant(name = "JVMCIEnv::dependencies_failed") @Stable public int codeInstallResultDependenciesFailed;
1649     @HotSpotVMConstant(name = "JVMCIEnv::dependencies_invalid") @Stable public int codeInstallResultDependenciesInvalid;
1650     @HotSpotVMConstant(name = "JVMCIEnv::cache_full") @Stable public int codeInstallResultCacheFull;
1651     @HotSpotVMConstant(name = "JVMCIEnv::code_too_large") @Stable public int codeInstallResultCodeTooLarge;
1652 
1653     public String getCodeInstallResultDescription(int codeInstallResult) {
1654         if (codeInstallResult == codeInstallResultOk) {
1655             return "ok";
1656         }
1657         if (codeInstallResult == codeInstallResultDependenciesFailed) {
1658             return "dependencies failed";
1659         }
1660         if (codeInstallResult == codeInstallResultDependenciesInvalid) {
1661             return "dependencies invalid";
1662         }
1663         if (codeInstallResult == codeInstallResultCacheFull) {
1664             return "code cache is full";
1665         }
1666         if (codeInstallResult == codeInstallResultCodeTooLarge) {
1667             return "code is too large";
1668         }
1669         assert false : codeInstallResult;
1670         return "unknown";
1671     }
1672 
1673     @HotSpotVMConstant(name = "CompilerToVM::KLASS_TAG") @Stable public int compilerToVMKlassTag;
1674     @HotSpotVMConstant(name = "CompilerToVM::SYMBOL_TAG") @Stable public int compilerToVMSymbolTag;
1675 
1676     // Checkstyle: stop
1677     @HotSpotVMConstant(name = "CodeInstaller::VERIFIED_ENTRY") @Stable public int MARKID_VERIFIED_ENTRY;
1678     @HotSpotVMConstant(name = "CodeInstaller::UNVERIFIED_ENTRY") @Stable public int MARKID_UNVERIFIED_ENTRY;
1679     @HotSpotVMConstant(name = "CodeInstaller::OSR_ENTRY") @Stable public int MARKID_OSR_ENTRY;
1680     @HotSpotVMConstant(name = "CodeInstaller::EXCEPTION_HANDLER_ENTRY") @Stable public int MARKID_EXCEPTION_HANDLER_ENTRY;
1681     @HotSpotVMConstant(name = "CodeInstaller::DEOPT_HANDLER_ENTRY") @Stable public int MARKID_DEOPT_HANDLER_ENTRY;
1682     @HotSpotVMConstant(name = "CodeInstaller::INVOKEINTERFACE") @Stable public int MARKID_INVOKEINTERFACE;
1683     @HotSpotVMConstant(name = "CodeInstaller::INVOKEVIRTUAL") @Stable public int MARKID_INVOKEVIRTUAL;
1684     @HotSpotVMConstant(name = "CodeInstaller::INVOKESTATIC") @Stable public int MARKID_INVOKESTATIC;
1685     @HotSpotVMConstant(name = "CodeInstaller::INVOKESPECIAL") @Stable public int MARKID_INVOKESPECIAL;
1686     @HotSpotVMConstant(name = "CodeInstaller::INLINE_INVOKE") @Stable public int MARKID_INLINE_INVOKE;
1687     @HotSpotVMConstant(name = "CodeInstaller::POLL_NEAR") @Stable public int MARKID_POLL_NEAR;
1688     @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int MARKID_POLL_RETURN_NEAR;
1689     @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int MARKID_POLL_FAR;
1690     @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int MARKID_POLL_RETURN_FAR;
1691     @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_ADDRESS") @Stable public int MARKID_CARD_TABLE_ADDRESS;
1692     @HotSpotVMConstant(name = "CodeInstaller::HEAP_TOP_ADDRESS") @Stable public int MARKID_HEAP_TOP_ADDRESS;
1693     @HotSpotVMConstant(name = "CodeInstaller::HEAP_END_ADDRESS") @Stable public int MARKID_HEAP_END_ADDRESS;
1694     @HotSpotVMConstant(name = "CodeInstaller::NARROW_KLASS_BASE_ADDRESS") @Stable public int MARKID_NARROW_KLASS_BASE_ADDRESS;
1695     @HotSpotVMConstant(name = "CodeInstaller::CRC_TABLE_ADDRESS") @Stable public int MARKID_CRC_TABLE_ADDRESS;
1696     @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int MARKID_INVOKE_INVALID;
1697 
1698     // Checkstyle: resume
1699 
1700     private boolean check() {
1701         for (Field f : getClass().getDeclaredFields()) {
1702             int modifiers = f.getModifiers();
1703             if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
1704                 assert Modifier.isFinal(modifiers) || f.getAnnotation(Stable.class) != null : "field should either be final or @Stable: " + f;
1705             }
1706         }
1707 
1708         assert codeEntryAlignment > 0 : codeEntryAlignment;
1709         assert (layoutHelperArrayTagObjectValue & (1 << (Integer.SIZE - 1))) != 0 : "object array must have first bit set";
1710         assert (layoutHelperArrayTagTypeValue & (1 << (Integer.SIZE - 1))) != 0 : "type array must have first bit set";
1711 
1712         return true;
1713     }
1714 
1715     /**
1716      * A compact representation of the different encoding strategies for Objects and metadata.
1717      */
1718     public static class CompressEncoding {
1719         public final long base;
1720         public final int shift;
1721         public final int alignment;
1722 
1723         CompressEncoding(long base, int shift, int alignment) {
1724             this.base = base;
1725             this.shift = shift;
1726             this.alignment = alignment;
1727         }
1728 
1729         public int compress(long ptr) {
1730             if (ptr == 0L) {
1731                 return 0;
1732             } else {
1733                 return (int) ((ptr - base) >>> shift);
1734             }
1735         }
1736 
1737         public long uncompress(int ptr) {
1738             if (ptr == 0) {
1739                 return 0L;
1740             } else {
1741                 return ((ptr & 0xFFFFFFFFL) << shift) + base;
1742             }
1743         }
1744 
1745         @Override
1746         public String toString() {
1747             return "base: " + base + " shift: " + shift + " alignment: " + alignment;
1748         }
1749 
1750         @Override
1751         public int hashCode() {
1752             final int prime = 31;
1753             int result = 1;
1754             result = prime * result + alignment;
1755             result = prime * result + (int) (base ^ (base >>> 32));
1756             result = prime * result + shift;
1757             return result;
1758         }
1759 
1760         @Override
1761         public boolean equals(Object obj) {
1762             if (obj instanceof CompressEncoding) {
1763                 CompressEncoding other = (CompressEncoding) obj;
1764                 return alignment == other.alignment && base == other.base && shift == other.shift;
1765             } else {
1766                 return false;
1767             }
1768         }
1769     }
1770 
1771 }