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