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