001/*
002 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package jdk.internal.jvmci.hotspot;
024
025import static jdk.internal.jvmci.common.UnsafeAccess.*;
026
027import java.lang.reflect.*;
028import java.util.*;
029
030import jdk.internal.jvmci.common.*;
031import jdk.internal.jvmci.hotspotvmconfig.*;
032
033//JaCoCo Exclude
034
035/**
036 * Used to access native configuration details.
037 *
038 * All non-static, public fields in this class are so that they can be compiled as constants.
039 */
040public class HotSpotVMConfig {
041
042    /**
043     * Determines if the current architecture is included in a given architecture set specification.
044     *
045     * @param currentArch
046     * @param archsSpecification specifies a set of architectures. A zero length value implies all
047     *            architectures.
048     */
049    private static boolean isRequired(String currentArch, String[] archsSpecification) {
050        if (archsSpecification.length == 0) {
051            return true;
052        }
053        for (String arch : archsSpecification) {
054            if (arch.equals(currentArch)) {
055                return true;
056            }
057        }
058        return false;
059    }
060
061    /**
062     * Maximum allowed size of allocated area for a frame.
063     */
064    public final int maxFrameSize = 16 * 1024;
065
066    @Override
067    public String toString() {
068        return getClass().getSimpleName();
069    }
070
071    public HotSpotVMConfig(CompilerToVM compilerToVm) {
072        compilerToVm.initializeConfiguration(this);
073        assert verifyInitialization();
074
075        oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift, logMinObjAlignment());
076        klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift, logKlassAlignment);
077
078        codeCacheLowBoundary = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceLowBoundaryOffset);
079        codeCacheHighBoundary = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceHighBoundaryOffset);
080
081        final long barrierSetAddress = unsafe.getAddress(universeCollectedHeap + collectedHeapBarrierSetOffset);
082        final int kind = unsafe.getInt(barrierSetAddress + barrierSetKindOffset);
083        if ((kind == barrierSetCardTableModRef) || (kind == barrierSetCardTableExtension) || (kind == barrierSetG1SATBCT) || (kind == barrierSetG1SATBCTLogging)) {
084            final long base = unsafe.getAddress(barrierSetAddress + cardTableModRefBSByteMapBaseOffset);
085            assert base != 0 : "unexpected byte_map_base: " + base;
086            cardtableStartAddress = base;
087            cardtableShift = cardTableModRefBSCardShift;
088        } else if ((kind == barrierSetModRef) || (kind == barrierSetOther)) {
089            // No post barriers
090            cardtableStartAddress = 0;
091            cardtableShift = 0;
092        } else {
093            cardtableStartAddress = -1;
094            cardtableShift = -1;
095        }
096
097        inlineCacheMissStub = inlineCacheMissBlob + unsafe.getInt(inlineCacheMissBlob + codeBlobCodeOffsetOffset);
098
099        assert check();
100        assert HotSpotVMConfigVerifier.check();
101    }
102
103    /**
104     * Check that the initialization produces the same result as the values captured through
105     * vmStructs.
106     */
107    private boolean verifyInitialization() {
108        /** These fields are set in {@link CompilerToVM#initializeConfiguration}. */
109        assert gHotSpotVMStructs != 0;
110        assert gHotSpotVMTypes != 0;
111        assert gHotSpotVMIntConstants != 0;
112        assert gHotSpotVMLongConstants != 0;
113
114        // Fill the VM fields hash map.
115        HashMap<String, VMFields.Field> vmFields = new HashMap<>();
116        for (VMFields.Field e : new VMFields(gHotSpotVMStructs)) {
117            vmFields.put(e.getName(), e);
118        }
119
120        // Fill the VM types hash map.
121        HashMap<String, VMTypes.Type> vmTypes = new HashMap<>();
122        for (VMTypes.Type e : new VMTypes(gHotSpotVMTypes)) {
123            vmTypes.put(e.getTypeName(), e);
124        }
125
126        // Fill the VM constants hash map.
127        HashMap<String, AbstractConstant> vmConstants = new HashMap<>();
128        for (AbstractConstant e : new VMIntConstants(gHotSpotVMIntConstants)) {
129            vmConstants.put(e.getName(), e);
130        }
131        for (AbstractConstant e : new VMLongConstants(gHotSpotVMLongConstants)) {
132            vmConstants.put(e.getName(), e);
133        }
134
135        // Fill the flags hash map.
136        HashMap<String, Flags.Flag> flags = new HashMap<>();
137        for (Flags.Flag e : new Flags(vmFields, vmTypes)) {
138            flags.put(e.getName(), e);
139        }
140
141        String currentArch = getHostArchitectureName();
142
143        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
144            if (f.isAnnotationPresent(HotSpotVMField.class)) {
145                HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
146                String name = annotation.name();
147                String type = annotation.type();
148                VMFields.Field entry = vmFields.get(name);
149                if (entry == null) {
150                    if (!isRequired(currentArch, annotation.archs())) {
151                        continue;
152                    }
153                    throw new IllegalArgumentException("field not found: " + name);
154                }
155
156                // Make sure the native type is still the type we expect.
157                if (!type.equals("")) {
158                    if (!type.equals(entry.getTypeString())) {
159                        throw new IllegalArgumentException("compiler expects type " + type + " but field " + name + " is of type " + entry.getTypeString());
160                    }
161                }
162
163                switch (annotation.get()) {
164                    case OFFSET:
165                        checkField(f, entry.getOffset());
166                        break;
167                    case ADDRESS:
168                        checkField(f, entry.getAddress());
169                        break;
170                    case VALUE:
171                        checkField(f, entry.getValue());
172                        break;
173                    default:
174                        throw new JVMCIError("unknown kind %s", annotation.get());
175                }
176            } else if (f.isAnnotationPresent(HotSpotVMType.class)) {
177                HotSpotVMType annotation = f.getAnnotation(HotSpotVMType.class);
178                String name = annotation.name();
179                VMTypes.Type entry = vmTypes.get(name);
180                if (entry == null) {
181                    throw new IllegalArgumentException("type not found: " + name);
182                }
183                switch (annotation.get()) {
184                    case SIZE:
185                        checkField(f, entry.getSize());
186                        break;
187                    default:
188                        throw new JVMCIError("unknown kind %s", annotation.get());
189                }
190            } else if (f.isAnnotationPresent(HotSpotVMConstant.class)) {
191                HotSpotVMConstant annotation = f.getAnnotation(HotSpotVMConstant.class);
192                String name = annotation.name();
193                AbstractConstant entry = vmConstants.get(name);
194                if (entry == null) {
195                    if (!isRequired(currentArch, annotation.archs())) {
196                        continue;
197                    }
198                    throw new IllegalArgumentException("constant not found: " + name);
199                }
200                checkField(f, entry.getValue());
201            } else if (f.isAnnotationPresent(HotSpotVMFlag.class)) {
202                HotSpotVMFlag annotation = f.getAnnotation(HotSpotVMFlag.class);
203                String name = annotation.name();
204                Flags.Flag entry = flags.get(name);
205                if (entry == null) {
206                    if (annotation.optional() || !isRequired(currentArch, annotation.archs())) {
207                        continue;
208                    }
209                    throw new IllegalArgumentException("flag not found: " + name);
210
211                }
212                checkField(f, entry.getValue());
213            }
214        }
215        return true;
216    }
217
218    private final CompressEncoding oopEncoding;
219    private final CompressEncoding klassEncoding;
220
221    public CompressEncoding getOopEncoding() {
222        return oopEncoding;
223    }
224
225    public CompressEncoding getKlassEncoding() {
226        return klassEncoding;
227    }
228
229    private void checkField(Field field, Object value) {
230        try {
231            Class<?> fieldType = field.getType();
232            if (fieldType == boolean.class) {
233                if (value instanceof String) {
234                    assert field.getBoolean(this) == Boolean.valueOf((String) value) : field + " " + value + " " + field.getBoolean(this);
235                } else if (value instanceof Boolean) {
236                    assert field.getBoolean(this) == (boolean) value : field + " " + value + " " + field.getBoolean(this);
237                } else if (value instanceof Long) {
238                    assert field.getBoolean(this) == (((long) value) != 0) : field + " " + value + " " + field.getBoolean(this);
239                } else {
240                    throw new JVMCIError(value.getClass().getSimpleName());
241                }
242            } else if (fieldType == int.class) {
243                if (value instanceof Integer) {
244                    assert field.getInt(this) == (int) value : field + " " + value + " " + field.getInt(this);
245                } else if (value instanceof Long) {
246                    assert field.getInt(this) == (int) (long) value : field + " " + value + " " + field.getInt(this);
247                } else {
248                    throw new JVMCIError(value.getClass().getSimpleName());
249                }
250            } else if (fieldType == long.class) {
251                assert field.getLong(this) == (long) value : field + " " + value + " " + field.getLong(this);
252            } else {
253                throw new JVMCIError(field.toString());
254            }
255        } catch (IllegalAccessException e) {
256            throw new JVMCIError("%s: %s", field, e);
257        }
258    }
259
260    /**
261     * Gets the host architecture name for the purpose of finding the corresponding
262     * {@linkplain HotSpotJVMCIBackendFactory backend}.
263     */
264    public String getHostArchitectureName() {
265        String arch = System.getProperty("os.arch");
266        switch (arch) {
267            case "x86_64":
268                arch = "amd64";
269                break;
270            case "sparcv9":
271                arch = "sparc";
272                break;
273        }
274        return arch;
275    }
276
277    /**
278     * VMStructEntry (see vmStructs.hpp).
279     */
280    @HotSpotVMValue(expression = "gHotSpotVMStructs", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMStructs;
281    @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeNameOffset") @Stable private long gHotSpotVMStructEntryTypeNameOffset;
282    @HotSpotVMValue(expression = "gHotSpotVMStructEntryFieldNameOffset") @Stable private long gHotSpotVMStructEntryFieldNameOffset;
283    @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeStringOffset") @Stable private long gHotSpotVMStructEntryTypeStringOffset;
284    @HotSpotVMValue(expression = "gHotSpotVMStructEntryIsStaticOffset") @Stable private long gHotSpotVMStructEntryIsStaticOffset;
285    @HotSpotVMValue(expression = "gHotSpotVMStructEntryOffsetOffset") @Stable private long gHotSpotVMStructEntryOffsetOffset;
286    @HotSpotVMValue(expression = "gHotSpotVMStructEntryAddressOffset") @Stable private long gHotSpotVMStructEntryAddressOffset;
287    @HotSpotVMValue(expression = "gHotSpotVMStructEntryArrayStride") @Stable private long gHotSpotVMStructEntryArrayStride;
288
289    class VMFields implements Iterable<VMFields.Field> {
290
291        private long address;
292
293        public VMFields(long address) {
294            this.address = address;
295        }
296
297        public Iterator<VMFields.Field> iterator() {
298            return new Iterator<VMFields.Field>() {
299
300                private int index = 0;
301
302                private Field current() {
303                    return new Field(address + gHotSpotVMStructEntryArrayStride * index);
304                }
305
306                /**
307                 * The last entry is identified by a NULL fieldName.
308                 */
309                public boolean hasNext() {
310                    Field entry = current();
311                    return entry.getFieldName() != null;
312                }
313
314                public Field next() {
315                    Field entry = current();
316                    index++;
317                    return entry;
318                }
319            };
320        }
321
322        class Field {
323
324            private long entryAddress;
325
326            Field(long address) {
327                this.entryAddress = address;
328            }
329
330            public String getTypeName() {
331                long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeNameOffset);
332                return readCString(typeNameAddress);
333            }
334
335            public String getFieldName() {
336                long fieldNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryFieldNameOffset);
337                return readCString(fieldNameAddress);
338            }
339
340            public String getTypeString() {
341                long typeStringAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeStringOffset);
342                return readCString(typeStringAddress);
343            }
344
345            public boolean isStatic() {
346                return unsafe.getInt(entryAddress + gHotSpotVMStructEntryIsStaticOffset) != 0;
347            }
348
349            public long getOffset() {
350                return unsafe.getLong(entryAddress + gHotSpotVMStructEntryOffsetOffset);
351            }
352
353            public long getAddress() {
354                return unsafe.getAddress(entryAddress + gHotSpotVMStructEntryAddressOffset);
355            }
356
357            public String getName() {
358                String typeName = getTypeName();
359                String fieldName = getFieldName();
360                return typeName + "::" + fieldName;
361            }
362
363            public long getValue() {
364                String type = getTypeString();
365                switch (type) {
366                    case "int":
367                        return unsafe.getInt(getAddress());
368                    case "address":
369                    case "intptr_t":
370                        return unsafe.getAddress(getAddress());
371                    default:
372                        // All foo* types are addresses.
373                        if (type.endsWith("*")) {
374                            return unsafe.getAddress(getAddress());
375                        }
376                        throw new JVMCIError(type);
377                }
378            }
379
380            @Override
381            public String toString() {
382                return String.format("Field[typeName=%s, fieldName=%s, typeString=%s, isStatic=%b, offset=%d, address=0x%x]", getTypeName(), getFieldName(), getTypeString(), isStatic(), getOffset(),
383                                getAddress());
384            }
385        }
386    }
387
388    /**
389     * VMTypeEntry (see vmStructs.hpp).
390     */
391    @HotSpotVMValue(expression = "gHotSpotVMTypes", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMTypes;
392    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryTypeNameOffset") @Stable private long gHotSpotVMTypeEntryTypeNameOffset;
393    @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySuperclassNameOffset") @Stable private long gHotSpotVMTypeEntrySuperclassNameOffset;
394    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsOopTypeOffset") @Stable private long gHotSpotVMTypeEntryIsOopTypeOffset;
395    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsIntegerTypeOffset") @Stable private long gHotSpotVMTypeEntryIsIntegerTypeOffset;
396    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsUnsignedOffset") @Stable private long gHotSpotVMTypeEntryIsUnsignedOffset;
397    @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySizeOffset") @Stable private long gHotSpotVMTypeEntrySizeOffset;
398    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryArrayStride") @Stable private long gHotSpotVMTypeEntryArrayStride;
399
400    class VMTypes implements Iterable<VMTypes.Type> {
401
402        private long address;
403
404        public VMTypes(long address) {
405            this.address = address;
406        }
407
408        public Iterator<VMTypes.Type> iterator() {
409            return new Iterator<VMTypes.Type>() {
410
411                private int index = 0;
412
413                private Type current() {
414                    return new Type(address + gHotSpotVMTypeEntryArrayStride * index);
415                }
416
417                /**
418                 * The last entry is identified by a NULL type name.
419                 */
420                public boolean hasNext() {
421                    Type entry = current();
422                    return entry.getTypeName() != null;
423                }
424
425                public Type next() {
426                    Type entry = current();
427                    index++;
428                    return entry;
429                }
430            };
431        }
432
433        class Type {
434
435            private long entryAddress;
436
437            Type(long address) {
438                this.entryAddress = address;
439            }
440
441            public String getTypeName() {
442                long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntryTypeNameOffset);
443                return readCString(typeNameAddress);
444            }
445
446            public String getSuperclassName() {
447                long superclassNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntrySuperclassNameOffset);
448                return readCString(superclassNameAddress);
449            }
450
451            public boolean isOopType() {
452                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsOopTypeOffset) != 0;
453            }
454
455            public boolean isIntegerType() {
456                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsIntegerTypeOffset) != 0;
457            }
458
459            public boolean isUnsigned() {
460                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsUnsignedOffset) != 0;
461            }
462
463            public long getSize() {
464                return unsafe.getLong(entryAddress + gHotSpotVMTypeEntrySizeOffset);
465            }
466
467            @Override
468            public String toString() {
469                return String.format("Type[typeName=%s, superclassName=%s, isOopType=%b, isIntegerType=%b, isUnsigned=%b, size=%d]", getTypeName(), getSuperclassName(), isOopType(), isIntegerType(),
470                                isUnsigned(), getSize());
471            }
472        }
473    }
474
475    public abstract class AbstractConstant {
476
477        protected long address;
478        protected long nameOffset;
479        protected long valueOffset;
480
481        AbstractConstant(long address, long nameOffset, long valueOffset) {
482            this.address = address;
483            this.nameOffset = nameOffset;
484            this.valueOffset = valueOffset;
485        }
486
487        public String getName() {
488            long nameAddress = unsafe.getAddress(address + nameOffset);
489            return readCString(nameAddress);
490        }
491
492        public abstract long getValue();
493    }
494
495    /**
496     * VMIntConstantEntry (see vmStructs.hpp).
497     */
498    @HotSpotVMValue(expression = "gHotSpotVMIntConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMIntConstants;
499    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryNameOffset") @Stable private long gHotSpotVMIntConstantEntryNameOffset;
500    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryValueOffset") @Stable private long gHotSpotVMIntConstantEntryValueOffset;
501    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryArrayStride") @Stable private long gHotSpotVMIntConstantEntryArrayStride;
502
503    class VMIntConstants implements Iterable<VMIntConstants.Constant> {
504
505        private long address;
506
507        public VMIntConstants(long address) {
508            this.address = address;
509        }
510
511        public Iterator<VMIntConstants.Constant> iterator() {
512            return new Iterator<VMIntConstants.Constant>() {
513
514                private int index = 0;
515
516                private Constant current() {
517                    return new Constant(address + gHotSpotVMIntConstantEntryArrayStride * index);
518                }
519
520                /**
521                 * The last entry is identified by a NULL name.
522                 */
523                public boolean hasNext() {
524                    Constant entry = current();
525                    return entry.getName() != null;
526                }
527
528                public Constant next() {
529                    Constant entry = current();
530                    index++;
531                    return entry;
532                }
533            };
534        }
535
536        class Constant extends AbstractConstant {
537
538            Constant(long address) {
539                super(address, gHotSpotVMIntConstantEntryNameOffset, gHotSpotVMIntConstantEntryValueOffset);
540            }
541
542            @Override
543            public long getValue() {
544                return unsafe.getInt(address + valueOffset);
545            }
546
547            @Override
548            public String toString() {
549                return String.format("IntConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
550            }
551        }
552    }
553
554    /**
555     * VMLongConstantEntry (see vmStructs.hpp).
556     */
557    @HotSpotVMValue(expression = "gHotSpotVMLongConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMLongConstants;
558    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryNameOffset") @Stable private long gHotSpotVMLongConstantEntryNameOffset;
559    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryValueOffset") @Stable private long gHotSpotVMLongConstantEntryValueOffset;
560    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryArrayStride") @Stable private long gHotSpotVMLongConstantEntryArrayStride;
561
562    class VMLongConstants implements Iterable<VMLongConstants.Constant> {
563
564        private long address;
565
566        public VMLongConstants(long address) {
567            this.address = address;
568        }
569
570        public Iterator<VMLongConstants.Constant> iterator() {
571            return new Iterator<VMLongConstants.Constant>() {
572
573                private int index = 0;
574
575                private Constant currentEntry() {
576                    return new Constant(address + gHotSpotVMLongConstantEntryArrayStride * index);
577                }
578
579                /**
580                 * The last entry is identified by a NULL name.
581                 */
582                public boolean hasNext() {
583                    Constant entry = currentEntry();
584                    return entry.getName() != null;
585                }
586
587                public Constant next() {
588                    Constant entry = currentEntry();
589                    index++;
590                    return entry;
591                }
592            };
593        }
594
595        class Constant extends AbstractConstant {
596
597            Constant(long address) {
598                super(address, gHotSpotVMLongConstantEntryNameOffset, gHotSpotVMLongConstantEntryValueOffset);
599            }
600
601            @Override
602            public long getValue() {
603                return unsafe.getLong(address + valueOffset);
604            }
605
606            @Override
607            public String toString() {
608                return String.format("LongConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
609            }
610        }
611    }
612
613    class Flags implements Iterable<Flags.Flag> {
614
615        private long address;
616        private long entrySize;
617        private long typeOffset;
618        private long nameOffset;
619        private long addrOffset;
620
621        public Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
622            address = vmStructs.get("Flag::flags").getValue();
623            entrySize = vmTypes.get("Flag").getSize();
624            typeOffset = vmStructs.get("Flag::_type").getOffset();
625            nameOffset = vmStructs.get("Flag::_name").getOffset();
626            addrOffset = vmStructs.get("Flag::_addr").getOffset();
627
628            assert vmTypes.get("bool").getSize() == Byte.BYTES;
629            assert vmTypes.get("intx").getSize() == Long.BYTES;
630            assert vmTypes.get("uintx").getSize() == Long.BYTES;
631        }
632
633        public Iterator<Flags.Flag> iterator() {
634            return new Iterator<Flags.Flag>() {
635
636                private int index = 0;
637
638                private Flag current() {
639                    return new Flag(address + entrySize * index);
640                }
641
642                /**
643                 * The last entry is identified by a NULL name.
644                 */
645                public boolean hasNext() {
646                    Flag entry = current();
647                    return entry.getName() != null;
648                }
649
650                public Flag next() {
651                    Flag entry = current();
652                    index++;
653                    return entry;
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 new JVMCIError(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 = "CompileTheWorldStartAt", optional = true) @Stable public int compileTheWorldStartAt;
714    @HotSpotVMFlag(name = "CompileTheWorldStopAt", optional = true) @Stable public int compileTheWorldStopAt;
715    @HotSpotVMFlag(name = "DontCompileHugeMethods") @Stable public boolean dontCompileHugeMethods;
716    @HotSpotVMFlag(name = "HugeMethodLimit") @Stable public int hugeMethodLimit;
717    @HotSpotVMFlag(name = "PrintInlining") @Stable public boolean printInlining;
718    @HotSpotVMFlag(name = "JVMCIUseFastLocking") @Stable public boolean useFastLocking;
719    @HotSpotVMFlag(name = "ForceUnreachable") @Stable public boolean forceUnreachable;
720
721    @HotSpotVMFlag(name = "UseTLAB") @Stable public boolean useTLAB;
722    @HotSpotVMFlag(name = "UseBiasedLocking") @Stable public boolean useBiasedLocking;
723    @HotSpotVMFlag(name = "UsePopCountInstruction") @Stable public boolean usePopCountInstruction;
724    @HotSpotVMFlag(name = "UseCountLeadingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountLeadingZerosInstruction;
725    @HotSpotVMFlag(name = "UseCountTrailingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountTrailingZerosInstruction;
726    @HotSpotVMFlag(name = "UseAESIntrinsics") @Stable public boolean useAESIntrinsics;
727    @HotSpotVMFlag(name = "UseCRC32Intrinsics") @Stable public boolean useCRC32Intrinsics;
728    @HotSpotVMFlag(name = "UseG1GC") @Stable public boolean useG1GC;
729    @HotSpotVMFlag(name = "UseConcMarkSweepGC") @Stable public boolean useCMSGC;
730
731    @HotSpotVMFlag(name = "AllocatePrefetchStyle") @Stable public int allocatePrefetchStyle;
732    @HotSpotVMFlag(name = "AllocatePrefetchInstr") @Stable public int allocatePrefetchInstr;
733    @HotSpotVMFlag(name = "AllocatePrefetchLines") @Stable public int allocatePrefetchLines;
734    @HotSpotVMFlag(name = "AllocateInstancePrefetchLines") @Stable public int allocateInstancePrefetchLines;
735    @HotSpotVMFlag(name = "AllocatePrefetchStepSize") @Stable public int allocatePrefetchStepSize;
736    @HotSpotVMFlag(name = "AllocatePrefetchDistance") @Stable public int allocatePrefetchDistance;
737
738    @HotSpotVMFlag(name = "FlightRecorder", optional = true) @Stable public boolean flightRecorder;
739
740    @HotSpotVMField(name = "Universe::_collectedHeap", type = "CollectedHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long universeCollectedHeap;
741    @HotSpotVMField(name = "CollectedHeap::_total_collections", type = "unsigned int", get = HotSpotVMField.Type.OFFSET) @Stable private int collectedHeapTotalCollectionsOffset;
742
743    public long gcTotalCollectionsAddress() {
744        return universeCollectedHeap + collectedHeapTotalCollectionsOffset;
745    }
746
747    @HotSpotVMFlag(name = "JVMCIDeferredInitBarriers") @Stable public boolean useDeferredInitBarriers;
748    @HotSpotVMFlag(name = "JVMCIHProfEnabled") @Stable public boolean useHeapProfiler;
749
750    // Compressed Oops related values.
751    @HotSpotVMFlag(name = "UseCompressedOops") @Stable public boolean useCompressedOops;
752    @HotSpotVMFlag(name = "UseCompressedClassPointers") @Stable public boolean useCompressedClassPointers;
753
754    @HotSpotVMField(name = "Universe::_narrow_oop._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowOopBase;
755    @HotSpotVMField(name = "Universe::_narrow_oop._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowOopShift;
756    @HotSpotVMFlag(name = "ObjectAlignmentInBytes") @Stable public int objectAlignment;
757
758    public int logMinObjAlignment() {
759        return (int) (Math.log(objectAlignment) / Math.log(2));
760    }
761
762    @HotSpotVMField(name = "Universe::_narrow_klass._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowKlassBase;
763    @HotSpotVMField(name = "Universe::_narrow_klass._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowKlassShift;
764    @HotSpotVMConstant(name = "LogKlassAlignmentInBytes") @Stable public int logKlassAlignment;
765
766    // CPU capabilities
767    @HotSpotVMFlag(name = "UseSSE") @Stable public int useSSE;
768    @HotSpotVMFlag(name = "UseAVX", archs = {"amd64"}) @Stable public int useAVX;
769
770    // X86 specific values
771    @HotSpotVMField(name = "VM_Version::_cpuFeatures", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"amd64"}) @Stable public int x86CPUFeatures;
772    @HotSpotVMConstant(name = "VM_Version::CPU_CX8", archs = {"amd64"}) @Stable public int cpuCX8;
773    @HotSpotVMConstant(name = "VM_Version::CPU_CMOV", archs = {"amd64"}) @Stable public int cpuCMOV;
774    @HotSpotVMConstant(name = "VM_Version::CPU_FXSR", archs = {"amd64"}) @Stable public int cpuFXSR;
775    @HotSpotVMConstant(name = "VM_Version::CPU_HT", archs = {"amd64"}) @Stable public int cpuHT;
776    @HotSpotVMConstant(name = "VM_Version::CPU_MMX", archs = {"amd64"}) @Stable public int cpuMMX;
777    @HotSpotVMConstant(name = "VM_Version::CPU_3DNOW_PREFETCH", archs = {"amd64"}) @Stable public int cpu3DNOWPREFETCH;
778    @HotSpotVMConstant(name = "VM_Version::CPU_SSE", archs = {"amd64"}) @Stable public int cpuSSE;
779    @HotSpotVMConstant(name = "VM_Version::CPU_SSE2", archs = {"amd64"}) @Stable public int cpuSSE2;
780    @HotSpotVMConstant(name = "VM_Version::CPU_SSE3", archs = {"amd64"}) @Stable public int cpuSSE3;
781    @HotSpotVMConstant(name = "VM_Version::CPU_SSSE3", archs = {"amd64"}) @Stable public int cpuSSSE3;
782    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4A", archs = {"amd64"}) @Stable public int cpuSSE4A;
783    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_1", archs = {"amd64"}) @Stable public int cpuSSE41;
784    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_2", archs = {"amd64"}) @Stable public int cpuSSE42;
785    @HotSpotVMConstant(name = "VM_Version::CPU_POPCNT", archs = {"amd64"}) @Stable public int cpuPOPCNT;
786    @HotSpotVMConstant(name = "VM_Version::CPU_LZCNT", archs = {"amd64"}) @Stable public int cpuLZCNT;
787    @HotSpotVMConstant(name = "VM_Version::CPU_TSC", archs = {"amd64"}) @Stable public int cpuTSC;
788    @HotSpotVMConstant(name = "VM_Version::CPU_TSCINV", archs = {"amd64"}) @Stable public int cpuTSCINV;
789    @HotSpotVMConstant(name = "VM_Version::CPU_AVX", archs = {"amd64"}) @Stable public int cpuAVX;
790    @HotSpotVMConstant(name = "VM_Version::CPU_AVX2", archs = {"amd64"}) @Stable public int cpuAVX2;
791    @HotSpotVMConstant(name = "VM_Version::CPU_AES", archs = {"amd64"}) @Stable public int cpuAES;
792    @HotSpotVMConstant(name = "VM_Version::CPU_ERMS", archs = {"amd64"}) @Stable public int cpuERMS;
793    @HotSpotVMConstant(name = "VM_Version::CPU_CLMUL", archs = {"amd64"}) @Stable public int cpuCLMUL;
794    @HotSpotVMConstant(name = "VM_Version::CPU_BMI1", archs = {"amd64"}) @Stable public int cpuBMI1;
795
796    // SPARC specific values
797    @HotSpotVMField(name = "VM_Version::_features", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"sparc"}) @Stable public int sparcFeatures;
798    @HotSpotVMConstant(name = "VM_Version::vis3_instructions_m", archs = {"sparc"}) @Stable public int vis3Instructions;
799    @HotSpotVMConstant(name = "VM_Version::vis2_instructions_m", archs = {"sparc"}) @Stable public int vis2Instructions;
800    @HotSpotVMConstant(name = "VM_Version::vis1_instructions_m", archs = {"sparc"}) @Stable public int vis1Instructions;
801    @HotSpotVMConstant(name = "VM_Version::cbcond_instructions_m", archs = {"sparc"}) @Stable public int cbcondInstructions;
802
803    // offsets, ...
804    @HotSpotVMFlag(name = "StackShadowPages") @Stable public int stackShadowPages;
805    @HotSpotVMFlag(name = "UseStackBanging") @Stable public boolean useStackBanging;
806    @HotSpotVMConstant(name = "STACK_BIAS") @Stable public int stackBias;
807
808    @HotSpotVMField(name = "oopDesc::_mark", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int markOffset;
809    @HotSpotVMField(name = "oopDesc::_metadata._klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int hubOffset;
810
811    @HotSpotVMField(name = "Handle::_handle", type = "oop*", get = HotSpotVMField.Type.OFFSET) @Stable public int handleHandleOffset;
812
813    @HotSpotVMField(name = "Klass::_prototype_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int prototypeMarkWordOffset;
814    @HotSpotVMField(name = "Klass::_subklass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int subklassOffset;
815    @HotSpotVMField(name = "Klass::_next_sibling", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int nextSiblingOffset;
816    @HotSpotVMField(name = "Klass::_super_check_offset", type = "juint", get = HotSpotVMField.Type.OFFSET) @Stable public int superCheckOffsetOffset;
817    @HotSpotVMField(name = "Klass::_secondary_super_cache", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySuperCacheOffset;
818    @HotSpotVMField(name = "Klass::_secondary_supers", type = "Array<Klass*>*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySupersOffset;
819
820    /**
821     * The offset of the _java_mirror field (of type {@link Class}) in a Klass.
822     */
823    @HotSpotVMField(name = "Klass::_java_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int classMirrorOffset;
824
825    @HotSpotVMField(name = "Klass::_super", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassSuperKlassOffset;
826    @HotSpotVMField(name = "Klass::_modifier_flags", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassModifierFlagsOffset;
827    @HotSpotVMField(name = "Klass::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int klassAccessFlagsOffset;
828    @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassLayoutHelperOffset;
829
830    @HotSpotVMConstant(name = "Klass::_lh_neutral_value") @Stable public int klassLayoutHelperNeutralValue;
831    @HotSpotVMConstant(name = "Klass::_lh_instance_slow_path_bit") @Stable public int klassLayoutHelperInstanceSlowPathBit;
832    @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_shift") @Stable public int layoutHelperLog2ElementSizeShift;
833    @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_mask") @Stable public int layoutHelperLog2ElementSizeMask;
834    @HotSpotVMConstant(name = "Klass::_lh_element_type_shift") @Stable public int layoutHelperElementTypeShift;
835    @HotSpotVMConstant(name = "Klass::_lh_element_type_mask") @Stable public int layoutHelperElementTypeMask;
836    @HotSpotVMConstant(name = "Klass::_lh_header_size_shift") @Stable public int layoutHelperHeaderSizeShift;
837    @HotSpotVMConstant(name = "Klass::_lh_header_size_mask") @Stable public int layoutHelperHeaderSizeMask;
838    @HotSpotVMConstant(name = "Klass::_lh_array_tag_shift") @Stable public int layoutHelperArrayTagShift;
839    @HotSpotVMConstant(name = "Klass::_lh_array_tag_type_value") @Stable public int layoutHelperArrayTagTypeValue;
840    @HotSpotVMConstant(name = "Klass::_lh_array_tag_obj_value") @Stable public int layoutHelperArrayTagObjectValue;
841
842    /**
843     * This filters out the bit that differentiates a type array from an object array.
844     */
845    public int layoutHelperElementTypePrimitiveInPlace() {
846        return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift;
847    }
848
849    /**
850     * Bit pattern in the klass layout helper that can be used to identify arrays.
851     */
852    public final int arrayKlassLayoutHelperIdentifier = 0x80000000;
853
854    @HotSpotVMField(name = "ArrayKlass::_component_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayKlassComponentMirrorOffset;
855
856    @HotSpotVMType(name = "vtableEntry", get = HotSpotVMType.Type.SIZE) @Stable public int vtableEntrySize;
857    @HotSpotVMField(name = "vtableEntry::_method", type = "Method*", get = HotSpotVMField.Type.OFFSET) @Stable public int vtableEntryMethodOffset;
858    @HotSpotVMValue(expression = "InstanceKlass::vtable_start_offset() * HeapWordSize") @Stable public int instanceKlassVtableStartOffset;
859    @HotSpotVMValue(expression = "InstanceKlass::vtable_length_offset() * HeapWordSize") @Stable public int instanceKlassVtableLengthOffset;
860    @HotSpotVMValue(expression = "Universe::base_vtable_size() / vtableEntry::size()") @Stable public int baseVtableLength;
861
862    /**
863     * The offset of the array length word in an array object's header.
864     */
865    @HotSpotVMValue(expression = "arrayOopDesc::length_offset_in_bytes()") @Stable public int arrayLengthOffset;
866
867    @HotSpotVMField(name = "Array<int>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1LengthOffset;
868    @HotSpotVMField(name = "Array<u1>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1DataOffset;
869    @HotSpotVMField(name = "Array<u2>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU2DataOffset;
870    @HotSpotVMField(name = "Array<Klass*>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayLengthOffset;
871    @HotSpotVMField(name = "Array<Klass*>::_data[0]", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayBaseOffset;
872
873    @HotSpotVMField(name = "InstanceKlass::_source_file_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassSourceFileNameIndexOffset;
874    @HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset;
875    @HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset;
876    @HotSpotVMField(name = "InstanceKlass::_fields", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassFieldsOffset;
877
878    @HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked;
879    @HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized;
880
881    @HotSpotVMField(name = "ObjArrayKlass::_element_klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayClassElementOffset;
882
883    @HotSpotVMConstant(name = "FieldInfo::access_flags_offset") @Stable public int fieldInfoAccessFlagsOffset;
884    @HotSpotVMConstant(name = "FieldInfo::name_index_offset") @Stable public int fieldInfoNameIndexOffset;
885    @HotSpotVMConstant(name = "FieldInfo::signature_index_offset") @Stable public int fieldInfoSignatureIndexOffset;
886    @HotSpotVMConstant(name = "FieldInfo::initval_index_offset") @Stable public int fieldInfoInitvalIndexOffset;
887    @HotSpotVMConstant(name = "FieldInfo::low_packed_offset") @Stable public int fieldInfoLowPackedOffset;
888    @HotSpotVMConstant(name = "FieldInfo::high_packed_offset") @Stable public int fieldInfoHighPackedOffset;
889    @HotSpotVMConstant(name = "FieldInfo::field_slots") @Stable public int fieldInfoFieldSlots;
890
891    @HotSpotVMConstant(name = "FIELDINFO_TAG_SIZE") @Stable public int fieldInfoTagSize;
892
893    @HotSpotVMConstant(name = "JVM_ACC_FIELD_INTERNAL") @Stable public int jvmAccFieldInternal;
894    @HotSpotVMConstant(name = "JVM_ACC_FIELD_STABLE") @Stable public int jvmAccFieldStable;
895    @HotSpotVMConstant(name = "JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE") @Stable public int jvmAccFieldHasGenericSignature;
896    @HotSpotVMConstant(name = "JVM_ACC_WRITTEN_FLAGS") @Stable public int jvmAccWrittenFlags;
897
898    @HotSpotVMField(name = "Thread::_tlab", type = "ThreadLocalAllocBuffer", get = HotSpotVMField.Type.OFFSET) @Stable public int threadTlabOffset;
899
900    @HotSpotVMField(name = "JavaThread::_anchor", type = "JavaFrameAnchor", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadAnchorOffset;
901    @HotSpotVMField(name = "JavaThread::_threadObj", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectOffset;
902    @HotSpotVMField(name = "JavaThread::_osthread", type = "OSThread*", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadOffset;
903    @HotSpotVMField(name = "JavaThread::_dirty_card_queue", type = "DirtyCardQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadDirtyCardQueueOffset;
904    @HotSpotVMField(name = "JavaThread::_is_method_handle_return", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int threadIsMethodHandleReturnOffset;
905    @HotSpotVMField(name = "JavaThread::_satb_mark_queue", type = "ObjPtrQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadSatbMarkQueueOffset;
906    @HotSpotVMField(name = "JavaThread::_vm_result", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectResultOffset;
907    @HotSpotVMValue(expression = "in_bytes(JavaThread::jvmci_counters_offset())") @Stable public int jvmciCountersThreadOffset;
908
909    /**
910     * An invalid value for {@link #rtldDefault}.
911     */
912    public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE;
913
914    /**
915     * Address of the library lookup routine. The C signature of this routine is:
916     *
917     * <pre>
918     *     void* (const char *filename, char *ebuf, int ebuflen)
919     * </pre>
920     */
921    @HotSpotVMValue(expression = "os::dll_load", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLoad;
922
923    /**
924     * Address of the library lookup routine. The C signature of this routine is:
925     *
926     * <pre>
927     *     void* (void* handle, const char* name)
928     * </pre>
929     */
930    @HotSpotVMValue(expression = "os::dll_lookup", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLookup;
931
932    /**
933     * A pseudo-handle which when used as the first argument to {@link #dllLookup} means lookup will
934     * return the first occurrence of the desired symbol using the default library search order. If
935     * this field is {@value #INVALID_RTLD_DEFAULT_HANDLE}, then this capability is not supported on
936     * the current platform.
937     */
938    @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;
939
940    /**
941     * This field is used to pass exception objects into and out of the runtime system during
942     * exception handling for compiled code.
943     * <p>
944     * <b>NOTE: This is not the same as {@link #pendingExceptionOffset}.</b>
945     */
946    @HotSpotVMField(name = "JavaThread::_exception_oop", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionOopOffset;
947    @HotSpotVMField(name = "JavaThread::_exception_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionPcOffset;
948
949    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_sp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaSpOffset;
950    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaPcOffset;
951    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_fp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET, archs = {"amd64"}) @Stable private int javaFrameAnchorLastJavaFpOffset;
952    @HotSpotVMField(name = "JavaFrameAnchor::_flags", type = "int", get = HotSpotVMField.Type.OFFSET, archs = {"sparc"}) @Stable private int javaFrameAnchorFlagsOffset;
953
954    public int threadLastJavaSpOffset() {
955        return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset;
956    }
957
958    public int threadLastJavaPcOffset() {
959        return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset;
960    }
961
962    /**
963     * This value is only valid on AMD64.
964     */
965    public int threadLastJavaFpOffset() {
966        // TODO add an assert for AMD64
967        return javaThreadAnchorOffset + javaFrameAnchorLastJavaFpOffset;
968    }
969
970    /**
971     * This value is only valid on SPARC.
972     */
973    public int threadJavaFrameAnchorFlagsOffset() {
974        // TODO add an assert for SPARC
975        return javaThreadAnchorOffset + javaFrameAnchorFlagsOffset;
976    }
977
978    // These are only valid on AMD64.
979    @HotSpotVMConstant(name = "frame::arg_reg_save_area_bytes", archs = {"amd64"}) @Stable public int runtimeCallStackSize;
980    @HotSpotVMConstant(name = "frame::interpreter_frame_sender_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameSenderSpOffset;
981    @HotSpotVMConstant(name = "frame::interpreter_frame_last_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameLastSpOffset;
982
983    @HotSpotVMField(name = "PtrQueue::_active", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueActiveOffset;
984    @HotSpotVMField(name = "PtrQueue::_buf", type = "void**", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueBufferOffset;
985    @HotSpotVMField(name = "PtrQueue::_index", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueIndexOffset;
986
987    @HotSpotVMField(name = "OSThread::_interrupted", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadInterruptedOffset;
988
989    @HotSpotVMConstant(name = "markOopDesc::unlocked_value") @Stable public int unlockedMask;
990    @HotSpotVMConstant(name = "markOopDesc::biased_lock_mask_in_place") @Stable public int biasedLockMaskInPlace;
991    @HotSpotVMConstant(name = "markOopDesc::age_mask_in_place") @Stable public int ageMaskInPlace;
992    @HotSpotVMConstant(name = "markOopDesc::epoch_mask_in_place") @Stable public int epochMaskInPlace;
993
994    @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public long markOopDescHashShift;
995    @HotSpotVMConstant(name = "markOopDesc::hash_mask") @Stable public long markOopDescHashMask;
996    @HotSpotVMConstant(name = "markOopDesc::hash_mask_in_place") @Stable public long markOopDescHashMaskInPlace;
997
998    @HotSpotVMConstant(name = "markOopDesc::biased_lock_pattern") @Stable public int biasedLockPattern;
999    @HotSpotVMConstant(name = "markOopDesc::no_hash_in_place") @Stable public int markWordNoHashInPlace;
1000    @HotSpotVMConstant(name = "markOopDesc::no_lock_in_place") @Stable public int markWordNoLockInPlace;
1001
1002    /**
1003     * See markOopDesc::prototype().
1004     */
1005    public long arrayPrototypeMarkWord() {
1006        return markWordNoHashInPlace | markWordNoLockInPlace;
1007    }
1008
1009    /**
1010     * See markOopDesc::copy_set_hash().
1011     */
1012    public long tlabIntArrayMarkWord() {
1013        long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace);
1014        tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift);
1015        return tmp;
1016    }
1017
1018    /**
1019     * Offset of the _pending_exception field in ThreadShadow (defined in exceptions.hpp). This
1020     * field is used to propagate exceptions through C/C++ calls.
1021     * <p>
1022     * <b>NOTE: This is not the same as {@link #threadExceptionOopOffset}.</b>
1023     */
1024    @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset;
1025    @HotSpotVMField(name = "ThreadShadow::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset;
1026    @HotSpotVMField(name = "ThreadShadow::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset;
1027    @HotSpotVMField(name = "ThreadShadow::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset;
1028
1029    /**
1030     * Mark word right shift to get identity hash code.
1031     */
1032    @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public int identityHashCodeShift;
1033
1034    /**
1035     * Identity hash code value when uninitialized.
1036     */
1037    @HotSpotVMConstant(name = "markOopDesc::no_hash") @Stable public int uninitializedIdentityHashCodeValue;
1038
1039    @HotSpotVMField(name = "Method::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int methodAccessFlagsOffset;
1040    @HotSpotVMField(name = "Method::_constMethod", type = "ConstMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodConstMethodOffset;
1041    @HotSpotVMField(name = "Method::_intrinsic_id", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodIntrinsicIdOffset;
1042    @HotSpotVMField(name = "Method::_flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodFlagsOffset;
1043    @HotSpotVMField(name = "Method::_vtable_index", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodVtableIndexOffset;
1044
1045    @HotSpotVMConstant(name = "Method::_jfr_towrite") @Stable public int methodFlagsJfrTowrite;
1046    @HotSpotVMConstant(name = "Method::_caller_sensitive") @Stable public int methodFlagsCallerSensitive;
1047    @HotSpotVMConstant(name = "Method::_force_inline") @Stable public int methodFlagsForceInline;
1048    @HotSpotVMConstant(name = "Method::_dont_inline") @Stable public int methodFlagsDontInline;
1049    @HotSpotVMConstant(name = "Method::_hidden") @Stable public int methodFlagsHidden;
1050    @HotSpotVMConstant(name = "Method::nonvirtual_vtable_index") @Stable public int nonvirtualVtableIndex;
1051    @HotSpotVMConstant(name = "Method::invalid_vtable_index") @Stable public int invalidVtableIndex;
1052
1053    @HotSpotVMConstant(name = "InvocationEntryBci") @Stable public int invocationEntryBci;
1054
1055    @HotSpotVMConstant(name = "JVM_ACC_MONITOR_MATCH") @Stable public int jvmAccMonitorMatch;
1056    @HotSpotVMConstant(name = "JVM_ACC_HAS_MONITOR_BYTECODES") @Stable public int jvmAccHasMonitorBytecodes;
1057
1058    @HotSpotVMField(name = "JVMCIEnv::_task", type = "CompileTask*", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvTaskOffset;
1059    @HotSpotVMField(name = "JVMCIEnv::_jvmti_can_hotswap_or_post_breakpoint", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset;
1060    @HotSpotVMField(name = "CompileTask::_num_inlined_bytecodes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int compileTaskNumInlinedBytecodesOffset;
1061
1062    /**
1063     * Value of Method::extra_stack_entries().
1064     */
1065    @HotSpotVMValue(expression = "Method::extra_stack_entries()") @Stable public int extraStackEntries;
1066
1067    @HotSpotVMField(name = "ConstMethod::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodConstantsOffset;
1068    @HotSpotVMField(name = "ConstMethod::_flags", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodFlagsOffset;
1069    @HotSpotVMField(name = "ConstMethod::_code_size", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodCodeSizeOffset;
1070    @HotSpotVMField(name = "ConstMethod::_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodNameIndexOffset;
1071    @HotSpotVMField(name = "ConstMethod::_signature_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodSignatureIndexOffset;
1072    @HotSpotVMField(name = "ConstMethod::_max_stack", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodMaxStackOffset;
1073    @HotSpotVMField(name = "ConstMethod::_max_locals", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodMaxLocalsOffset;
1074
1075    @HotSpotVMConstant(name = "ConstMethod::_has_linenumber_table") @Stable public int constMethodHasLineNumberTable;
1076    @HotSpotVMConstant(name = "ConstMethod::_has_localvariable_table") @Stable public int constMethodHasLocalVariableTable;
1077    @HotSpotVMConstant(name = "ConstMethod::_has_exception_table") @Stable public int constMethodHasExceptionTable;
1078
1079    @HotSpotVMType(name = "ExceptionTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int exceptionTableElementSize;
1080    @HotSpotVMField(name = "ExceptionTableElement::start_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementStartPcOffset;
1081    @HotSpotVMField(name = "ExceptionTableElement::end_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementEndPcOffset;
1082    @HotSpotVMField(name = "ExceptionTableElement::handler_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementHandlerPcOffset;
1083    @HotSpotVMField(name = "ExceptionTableElement::catch_type_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementCatchTypeIndexOffset;
1084
1085    @HotSpotVMType(name = "LocalVariableTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int localVariableTableElementSize;
1086    @HotSpotVMField(name = "LocalVariableTableElement::start_bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementStartBciOffset;
1087    @HotSpotVMField(name = "LocalVariableTableElement::length", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementLengthOffset;
1088    @HotSpotVMField(name = "LocalVariableTableElement::name_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementNameCpIndexOffset;
1089    @HotSpotVMField(name = "LocalVariableTableElement::descriptor_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementDescriptorCpIndexOffset;
1090    @HotSpotVMField(name = "LocalVariableTableElement::signature_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSignatureCpIndexOffset;
1091    @HotSpotVMField(name = "LocalVariableTableElement::slot", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSlotOffset;
1092
1093    @HotSpotVMType(name = "ConstantPool", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolSize;
1094    @HotSpotVMField(name = "ConstantPool::_tags", type = "Array<u1>*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolTagsOffset;
1095    @HotSpotVMField(name = "ConstantPool::_cache", type = "ConstantPoolCache*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolCacheOffset;
1096    @HotSpotVMField(name = "ConstantPool::_pool_holder", type = "InstanceKlass*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolHolderOffset;
1097    @HotSpotVMField(name = "ConstantPool::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolLengthOffset;
1098    @HotSpotVMField(name = "ConstantPool::_resolved_references", type = "jobject", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolResolvedReferencesOffset;
1099    @HotSpotVMField(name = "ConstantPool::_reference_map", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolReferenceMapOffset;
1100
1101    @HotSpotVMConstant(name = "ConstantPool::CPCACHE_INDEX_TAG") @Stable public int constantPoolCpCacheIndexTag;
1102
1103    @HotSpotVMType(name = "ConstantPoolCache", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolCacheSize;
1104    @HotSpotVMField(name = "ConstantPoolCache::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolCacheLengthOffset;
1105
1106    @HotSpotVMType(name = "ConstantPoolCacheEntry", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolCacheEntrySize;
1107    @HotSpotVMField(name = "ConstantPoolCacheEntry::_indices", type = "intx", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolCacheEntryIndicesOffset;
1108    @HotSpotVMField(name = "ConstantPoolCacheEntry::_f1", type = "volatile Metadata*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolCacheEntryF1Offset;
1109    @HotSpotVMField(name = "ConstantPoolCacheEntry::_f2", type = "intx", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolCacheEntryF2Offset;
1110    @HotSpotVMField(name = "ConstantPoolCacheEntry::_flags", type = "intx", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolCacheEntryFlagsOffset;
1111
1112    @HotSpotVMConstant(name = "ConstantPoolCacheEntry::has_appendix_shift") @Stable public int constantPoolCacheEntryHasAppendixShift;
1113
1114    @HotSpotVMConstant(name = "ConstantPoolCacheEntry::cp_index_mask") @Stable public int constantPoolCacheEntryCpIndexMask;
1115
1116    @HotSpotVMConstant(name = "ConstantPoolCacheEntry::_indy_resolved_references_appendix_offset") @Stable public int constantPoolCacheEntryIndyResolvedReferencesAppendixOffset;
1117
1118    @HotSpotVMConstant(name = "JVM_CONSTANT_Utf8") @Stable public int jvmConstantUtf8;
1119    @HotSpotVMConstant(name = "JVM_CONSTANT_Integer") @Stable public int jvmConstantInteger;
1120    @HotSpotVMConstant(name = "JVM_CONSTANT_Long") @Stable public int jvmConstantLong;
1121    @HotSpotVMConstant(name = "JVM_CONSTANT_Float") @Stable public int jvmConstantFloat;
1122    @HotSpotVMConstant(name = "JVM_CONSTANT_Double") @Stable public int jvmConstantDouble;
1123    @HotSpotVMConstant(name = "JVM_CONSTANT_Class") @Stable public int jvmConstantClass;
1124    @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClass") @Stable public int jvmConstantUnresolvedClass;
1125    @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClassInError") @Stable public int jvmConstantUnresolvedClassInError;
1126    @HotSpotVMConstant(name = "JVM_CONSTANT_String") @Stable public int jvmConstantString;
1127    @HotSpotVMConstant(name = "JVM_CONSTANT_Fieldref") @Stable public int jvmConstantFieldref;
1128    @HotSpotVMConstant(name = "JVM_CONSTANT_Methodref") @Stable public int jvmConstantMethodref;
1129    @HotSpotVMConstant(name = "JVM_CONSTANT_InterfaceMethodref") @Stable public int jvmConstantInterfaceMethodref;
1130    @HotSpotVMConstant(name = "JVM_CONSTANT_NameAndType") @Stable public int jvmConstantNameAndType;
1131    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandle") @Stable public int jvmConstantMethodHandle;
1132    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandleInError") @Stable public int jvmConstantMethodHandleInError;
1133    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodType") @Stable public int jvmConstantMethodType;
1134    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodTypeInError") @Stable public int jvmConstantMethodTypeInError;
1135    @HotSpotVMConstant(name = "JVM_CONSTANT_InvokeDynamic") @Stable public int jvmConstantInvokeDynamic;
1136
1137    @HotSpotVMConstant(name = "JVM_CONSTANT_ExternalMax") @Stable public int jvmConstantExternalMax;
1138    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMin") @Stable public int jvmConstantInternalMin;
1139    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMax") @Stable public int jvmConstantInternalMax;
1140
1141    @HotSpotVMConstant(name = "HeapWordSize") @Stable public int heapWordSize;
1142
1143    @HotSpotVMType(name = "Symbol*", get = HotSpotVMType.Type.SIZE) @Stable public int symbolPointerSize;
1144    @HotSpotVMField(name = "Symbol::_length", type = "unsigned short", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolLengthOffset;
1145    @HotSpotVMField(name = "Symbol::_body[0]", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolBodyOffset;
1146
1147    @HotSpotVMField(name = "vmSymbols::_symbols[0]", type = "Symbol*", get = HotSpotVMField.Type.ADDRESS) @Stable public long vmSymbolsSymbols;
1148    @HotSpotVMConstant(name = "vmSymbols::FIRST_SID") @Stable public int vmSymbolsFirstSID;
1149    @HotSpotVMConstant(name = "vmSymbols::SID_LIMIT") @Stable public int vmSymbolsSIDLimit;
1150
1151    @HotSpotVMConstant(name = "JVM_ACC_HAS_FINALIZER") @Stable public int klassHasFinalizerFlag;
1152
1153    // Modifier.SYNTHETIC is not public so we get it via vmStructs.
1154    @HotSpotVMConstant(name = "JVM_ACC_SYNTHETIC") @Stable public int syntheticFlag;
1155
1156    /**
1157     * @see HotSpotResolvedObjectTypeImpl#createField
1158     */
1159    @HotSpotVMConstant(name = "JVM_RECOGNIZED_FIELD_MODIFIERS") @Stable public int recognizedFieldModifiers;
1160
1161    /**
1162     * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
1163     * are allowed to look like (respectively) the high or low bits of a real oop.
1164     */
1165    @HotSpotVMField(name = "Universe::_non_oop_bits", type = "intptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long nonOopBits;
1166
1167    @HotSpotVMField(name = "StubRoutines::_verify_oop_count", type = "jint", get = HotSpotVMField.Type.ADDRESS) @Stable public long verifyOopCounterAddress;
1168    @HotSpotVMValue(expression = "Universe::verify_oop_mask()") @Stable public long verifyOopMask;
1169    @HotSpotVMValue(expression = "Universe::verify_oop_bits()") @Stable public long verifyOopBits;
1170
1171    @HotSpotVMField(name = "CollectedHeap::_barrier_set", type = "BarrierSet*", get = HotSpotVMField.Type.OFFSET) @Stable public int collectedHeapBarrierSetOffset;
1172
1173    @HotSpotVMField(name = "HeapRegion::LogOfHRGrainBytes", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int logOfHRGrainBytes;
1174
1175    @HotSpotVMField(name = "BarrierSet::_kind", type = "BarrierSet::Name", get = HotSpotVMField.Type.OFFSET) @Stable private int barrierSetKindOffset;
1176    @HotSpotVMConstant(name = "BarrierSet::CardTableModRef") @Stable public int barrierSetCardTableModRef;
1177    @HotSpotVMConstant(name = "BarrierSet::CardTableExtension") @Stable public int barrierSetCardTableExtension;
1178    @HotSpotVMConstant(name = "BarrierSet::G1SATBCT") @Stable public int barrierSetG1SATBCT;
1179    @HotSpotVMConstant(name = "BarrierSet::G1SATBCTLogging") @Stable public int barrierSetG1SATBCTLogging;
1180    @HotSpotVMConstant(name = "BarrierSet::ModRef") @Stable public int barrierSetModRef;
1181    @HotSpotVMConstant(name = "BarrierSet::Other") @Stable public int barrierSetOther;
1182
1183    @HotSpotVMField(name = "CardTableModRefBS::byte_map_base", type = "jbyte*", get = HotSpotVMField.Type.OFFSET) @Stable private int cardTableModRefBSByteMapBaseOffset;
1184    @HotSpotVMConstant(name = "CardTableModRefBS::card_shift") @Stable public int cardTableModRefBSCardShift;
1185
1186    @HotSpotVMValue(expression = "(jbyte)CardTableModRefBS::dirty_card_val()") @Stable public byte dirtyCardValue;
1187    @HotSpotVMValue(expression = "(jbyte)G1SATBCardTableModRefBS::g1_young_card_val()") @Stable public byte g1YoungCardValue;
1188
1189    private final long cardtableStartAddress;
1190    private final int cardtableShift;
1191
1192    public long cardtableStartAddress() {
1193        if (cardtableStartAddress == -1) {
1194            throw JVMCIError.shouldNotReachHere();
1195        }
1196        return cardtableStartAddress;
1197    }
1198
1199    public int cardtableShift() {
1200        if (cardtableShift == -1) {
1201            throw JVMCIError.shouldNotReachHere();
1202        }
1203        return cardtableShift;
1204    }
1205
1206    @HotSpotVMField(name = "os::_polling_page", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long safepointPollingAddress;
1207
1208    // G1 Collector Related Values.
1209
1210    public int g1CardQueueIndexOffset() {
1211        return javaThreadDirtyCardQueueOffset + ptrQueueIndexOffset;
1212    }
1213
1214    public int g1CardQueueBufferOffset() {
1215        return javaThreadDirtyCardQueueOffset + ptrQueueBufferOffset;
1216    }
1217
1218    public int g1SATBQueueMarkingOffset() {
1219        return javaThreadSatbMarkQueueOffset + ptrQueueActiveOffset;
1220    }
1221
1222    public int g1SATBQueueIndexOffset() {
1223        return javaThreadSatbMarkQueueOffset + ptrQueueIndexOffset;
1224    }
1225
1226    public int g1SATBQueueBufferOffset() {
1227        return javaThreadSatbMarkQueueOffset + ptrQueueBufferOffset;
1228    }
1229
1230    @HotSpotVMField(name = "java_lang_Class::_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassOffset;
1231    @HotSpotVMField(name = "java_lang_Class::_array_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int arrayKlassOffset;
1232
1233    @HotSpotVMField(name = "Method::_method_data", type = "MethodData*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOffset;
1234    @HotSpotVMField(name = "Method::_from_compiled_entry", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCompiledEntryOffset;
1235    @HotSpotVMField(name = "Method::_code", type = "nmethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset;
1236
1237    @HotSpotVMField(name = "MethodData::_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataSize;
1238    @HotSpotVMField(name = "MethodData::_data_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataDataSize;
1239    @HotSpotVMField(name = "MethodData::_data[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopDataOffset;
1240    @HotSpotVMField(name = "MethodData::_trap_hist._array[0]", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopTrapHistoryOffset;
1241    @HotSpotVMField(name = "MethodData::_jvmci_ir_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataIRSizeOffset;
1242
1243    @HotSpotVMField(name = "nmethod::_verified_entry_point", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodEntryOffset;
1244    @HotSpotVMField(name = "nmethod::_comp_level", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodCompLevelOffset;
1245
1246    @HotSpotVMConstant(name = "CompLevel_full_optimization") @Stable public int compilationLevelFullOptimization;
1247
1248    @HotSpotVMType(name = "BasicLock", get = HotSpotVMType.Type.SIZE) @Stable public int basicLockSize;
1249    @HotSpotVMField(name = "BasicLock::_displaced_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int basicLockDisplacedHeaderOffset;
1250
1251    @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->end_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapEndAddress;
1252    @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->top_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapTopAddress;
1253
1254    @HotSpotVMField(name = "Thread::_allocated_bytes", type = "jlong", get = HotSpotVMField.Type.OFFSET) @Stable public int threadAllocatedBytesOffset;
1255
1256    @HotSpotVMFlag(name = "TLABWasteIncrement") @Stable public int tlabRefillWasteIncrement;
1257    @HotSpotVMValue(expression = "ThreadLocalAllocBuffer::alignment_reserve()") @Stable public int tlabAlignmentReserve;
1258
1259    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_start", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferStartOffset;
1260    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_end", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferEndOffset;
1261    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferTopOffset;
1262    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_pf_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferPfTopOffset;
1263    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_slow_allocations", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferSlowAllocationsOffset;
1264    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_fast_refill_waste", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferFastRefillWasteOffset;
1265    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_number_of_refills", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferNumberOfRefillsOffset;
1266    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_refill_waste_limit", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferRefillWasteLimitOffset;
1267    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_desired_size", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferDesiredSizeOffset;
1268
1269    public int tlabSlowAllocationsOffset() {
1270        return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset;
1271    }
1272
1273    public int tlabFastRefillWasteOffset() {
1274        return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset;
1275    }
1276
1277    public int tlabNumberOfRefillsOffset() {
1278        return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset;
1279    }
1280
1281    public int tlabRefillWasteLimitOffset() {
1282        return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset;
1283    }
1284
1285    public int threadTlabSizeOffset() {
1286        return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset;
1287    }
1288
1289    public int threadTlabStartOffset() {
1290        return threadTlabOffset + threadLocalAllocBufferStartOffset;
1291    }
1292
1293    public int threadTlabEndOffset() {
1294        return threadTlabOffset + threadLocalAllocBufferEndOffset;
1295    }
1296
1297    public int threadTlabTopOffset() {
1298        return threadTlabOffset + threadLocalAllocBufferTopOffset;
1299    }
1300
1301    public int threadTlabPfTopOffset() {
1302        return threadTlabOffset + threadLocalAllocBufferPfTopOffset;
1303    }
1304
1305    @HotSpotVMFlag(name = "TLABStats") @Stable public boolean tlabStats;
1306    @HotSpotVMValue(expression = " !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc()") @Stable public boolean inlineContiguousAllocationSupported;
1307
1308    /**
1309     * The DataLayout header size is the same as the cell size.
1310     */
1311    @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutHeaderSize;
1312    @HotSpotVMField(name = "DataLayout::_header._struct._tag", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutTagOffset;
1313    @HotSpotVMField(name = "DataLayout::_header._struct._flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutFlagsOffset;
1314    @HotSpotVMField(name = "DataLayout::_header._struct._bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutBCIOffset;
1315    @HotSpotVMField(name = "DataLayout::_cells[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutCellsOffset;
1316    @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutCellSize;
1317
1318    @HotSpotVMConstant(name = "DataLayout::no_tag") @Stable public int dataLayoutNoTag;
1319    @HotSpotVMConstant(name = "DataLayout::bit_data_tag") @Stable public int dataLayoutBitDataTag;
1320    @HotSpotVMConstant(name = "DataLayout::counter_data_tag") @Stable public int dataLayoutCounterDataTag;
1321    @HotSpotVMConstant(name = "DataLayout::jump_data_tag") @Stable public int dataLayoutJumpDataTag;
1322    @HotSpotVMConstant(name = "DataLayout::receiver_type_data_tag") @Stable public int dataLayoutReceiverTypeDataTag;
1323    @HotSpotVMConstant(name = "DataLayout::virtual_call_data_tag") @Stable public int dataLayoutVirtualCallDataTag;
1324    @HotSpotVMConstant(name = "DataLayout::ret_data_tag") @Stable public int dataLayoutRetDataTag;
1325    @HotSpotVMConstant(name = "DataLayout::branch_data_tag") @Stable public int dataLayoutBranchDataTag;
1326    @HotSpotVMConstant(name = "DataLayout::multi_branch_data_tag") @Stable public int dataLayoutMultiBranchDataTag;
1327    @HotSpotVMConstant(name = "DataLayout::arg_info_data_tag") @Stable public int dataLayoutArgInfoDataTag;
1328    @HotSpotVMConstant(name = "DataLayout::call_type_data_tag") @Stable public int dataLayoutCallTypeDataTag;
1329    @HotSpotVMConstant(name = "DataLayout::virtual_call_type_data_tag") @Stable public int dataLayoutVirtualCallTypeDataTag;
1330    @HotSpotVMConstant(name = "DataLayout::parameters_type_data_tag") @Stable public int dataLayoutParametersTypeDataTag;
1331    @HotSpotVMConstant(name = "DataLayout::speculative_trap_data_tag") @Stable public int dataLayoutSpeculativeTrapDataTag;
1332
1333    @HotSpotVMFlag(name = "BciProfileWidth") @Stable public int bciProfileWidth;
1334    @HotSpotVMFlag(name = "TypeProfileWidth") @Stable public int typeProfileWidth;
1335    @HotSpotVMFlag(name = "MethodProfileWidth") @Stable public int methodProfileWidth;
1336
1337    @HotSpotVMField(name = "CodeBlob::_code_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int codeBlobCodeOffsetOffset;
1338    @HotSpotVMField(name = "SharedRuntime::_ic_miss_blob", type = "RuntimeStub*", get = HotSpotVMField.Type.VALUE) @Stable private long inlineCacheMissBlob;
1339
1340    @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->unpack()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long handleDeoptStub;
1341    @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->uncommon_trap()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long uncommonTrapStub;
1342
1343    private final long inlineCacheMissStub;
1344
1345    public long inlineCacheMissStub() {
1346        return inlineCacheMissStub;
1347    }
1348
1349    @HotSpotVMField(name = "CodeCache::_heap", type = "CodeHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long codeCacheHeap;
1350    @HotSpotVMField(name = "CodeHeap::_memory", type = "VirtualSpace", get = HotSpotVMField.Type.OFFSET) @Stable private int codeHeapMemoryOffset;
1351    @HotSpotVMField(name = "VirtualSpace::_low_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceLowBoundaryOffset;
1352    @HotSpotVMField(name = "VirtualSpace::_high_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceHighBoundaryOffset;
1353
1354    private final long codeCacheLowBoundary;
1355    private final long codeCacheHighBoundary;
1356
1357    /**
1358     * @return CodeCache::_heap-&gt;_memory._low_boundary
1359     */
1360    public long codeCacheLowBoundary() {
1361        return codeCacheLowBoundary;
1362    }
1363
1364    /**
1365     * @return CodeCache::_heap-&gt;_memory._high_boundary
1366     */
1367    public long codeCacheHighBoundary() {
1368        return codeCacheHighBoundary;
1369    }
1370
1371    @HotSpotVMField(name = "StubRoutines::_aescrypt_encryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptEncryptBlockStub;
1372    @HotSpotVMField(name = "StubRoutines::_aescrypt_decryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptDecryptBlockStub;
1373    @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_encryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingEncryptAESCryptStub;
1374    @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_decryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingDecryptAESCryptStub;
1375    @HotSpotVMField(name = "StubRoutines::_updateBytesCRC32", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long updateBytesCRC32Stub;
1376    @HotSpotVMField(name = "StubRoutines::_crc_table_adr", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long crcTableAddress;
1377
1378    @HotSpotVMField(name = "StubRoutines::_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteArraycopy;
1379    @HotSpotVMField(name = "StubRoutines::_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortArraycopy;
1380    @HotSpotVMField(name = "StubRoutines::_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintArraycopy;
1381    @HotSpotVMField(name = "StubRoutines::_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongArraycopy;
1382    @HotSpotVMField(name = "StubRoutines::_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopy;
1383    @HotSpotVMField(name = "StubRoutines::_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopyUninit;
1384    @HotSpotVMField(name = "StubRoutines::_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteDisjointArraycopy;
1385    @HotSpotVMField(name = "StubRoutines::_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortDisjointArraycopy;
1386    @HotSpotVMField(name = "StubRoutines::_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintDisjointArraycopy;
1387    @HotSpotVMField(name = "StubRoutines::_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongDisjointArraycopy;
1388    @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopy;
1389    @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopyUninit;
1390    @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedArraycopy;
1391    @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedArraycopy;
1392    @HotSpotVMField(name = "StubRoutines::_arrayof_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedArraycopy;
1393    @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedArraycopy;
1394    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopy;
1395    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopyUninit;
1396    @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedDisjointArraycopy;
1397    @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedDisjointArraycopy;
1398    @HotSpotVMField(name = "StubRoutines::_arrayof_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedDisjointArraycopy;
1399    @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedDisjointArraycopy;
1400    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopy;
1401    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopyUninit;
1402    @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopy;
1403    @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopyUninit;
1404    @HotSpotVMField(name = "StubRoutines::_unsafe_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long unsafeArraycopy;
1405    @HotSpotVMField(name = "StubRoutines::_generic_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long genericArraycopy;
1406
1407    @HotSpotVMValue(expression = "JVMCIRuntime::new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newInstanceAddress;
1408    @HotSpotVMValue(expression = "JVMCIRuntime::new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newArrayAddress;
1409    @HotSpotVMValue(expression = "JVMCIRuntime::new_multi_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newMultiArrayAddress;
1410    @HotSpotVMValue(expression = "JVMCIRuntime::dynamic_new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewArrayAddress;
1411    @HotSpotVMValue(expression = "JVMCIRuntime::dynamic_new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewInstanceAddress;
1412    @HotSpotVMValue(expression = "JVMCIRuntime::thread_is_interrupted", get = HotSpotVMValue.Type.ADDRESS) @Stable public long threadIsInterruptedAddress;
1413    @HotSpotVMValue(expression = "JVMCIRuntime::vm_message", signature = "(unsigned char, long, long, long, long)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmMessageAddress;
1414    @HotSpotVMValue(expression = "JVMCIRuntime::identity_hash_code", get = HotSpotVMValue.Type.ADDRESS) @Stable public long identityHashCodeAddress;
1415    @HotSpotVMValue(expression = "JVMCIRuntime::exception_handler_for_pc", signature = "(JavaThread*)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForPcAddress;
1416    @HotSpotVMValue(expression = "JVMCIRuntime::monitorenter", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorenterAddress;
1417    @HotSpotVMValue(expression = "JVMCIRuntime::monitorexit", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorexitAddress;
1418    @HotSpotVMValue(expression = "JVMCIRuntime::create_null_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long createNullPointerExceptionAddress;
1419    @HotSpotVMValue(expression = "JVMCIRuntime::create_out_of_bounds_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long createOutOfBoundsExceptionAddress;
1420    @HotSpotVMValue(expression = "JVMCIRuntime::log_primitive", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrimitiveAddress;
1421    @HotSpotVMValue(expression = "JVMCIRuntime::log_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logObjectAddress;
1422    @HotSpotVMValue(expression = "JVMCIRuntime::log_printf", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrintfAddress;
1423    @HotSpotVMValue(expression = "JVMCIRuntime::vm_error", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmErrorAddress;
1424    @HotSpotVMValue(expression = "JVMCIRuntime::load_and_clear_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long loadAndClearExceptionAddress;
1425    @HotSpotVMValue(expression = "JVMCIRuntime::write_barrier_pre", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPreAddress;
1426    @HotSpotVMValue(expression = "JVMCIRuntime::write_barrier_post", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPostAddress;
1427    @HotSpotVMValue(expression = "JVMCIRuntime::validate_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long validateObject;
1428
1429    @HotSpotVMValue(expression = "JVMCIRuntime::test_deoptimize_call_int", get = HotSpotVMValue.Type.ADDRESS) @Stable public long testDeoptimizeCallInt;
1430
1431    @HotSpotVMValue(expression = "SharedRuntime::register_finalizer", get = HotSpotVMValue.Type.ADDRESS) @Stable public long registerFinalizerAddress;
1432    @HotSpotVMValue(expression = "SharedRuntime::exception_handler_for_return_address", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForReturnAddressAddress;
1433    @HotSpotVMValue(expression = "SharedRuntime::OSR_migration_end", get = HotSpotVMValue.Type.ADDRESS) @Stable public long osrMigrationEndAddress;
1434
1435    @HotSpotVMValue(expression = "os::javaTimeMillis", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeMillisAddress;
1436    @HotSpotVMValue(expression = "os::javaTimeNanos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeNanosAddress;
1437    @HotSpotVMValue(expression = "SharedRuntime::dsin", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticSinAddress;
1438    @HotSpotVMValue(expression = "SharedRuntime::dcos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticCosAddress;
1439    @HotSpotVMValue(expression = "SharedRuntime::dtan", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticTanAddress;
1440    @HotSpotVMValue(expression = "SharedRuntime::dexp", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticExpAddress;
1441    @HotSpotVMValue(expression = "SharedRuntime::dlog", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLogAddress;
1442    @HotSpotVMValue(expression = "SharedRuntime::dlog10", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLog10Address;
1443    @HotSpotVMValue(expression = "SharedRuntime::dpow", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticPowAddress;
1444
1445    @HotSpotVMValue(expression = "(jint) JVMCICounterSize") @Stable public int jvmciCountersSize;
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_unreached0") @Stable public int deoptReasonUnreached0;
1457    @HotSpotVMConstant(name = "Deoptimization::Reason_type_checked_inlining") @Stable public int deoptReasonTypeCheckInlining;
1458    @HotSpotVMConstant(name = "Deoptimization::Reason_optimized_type_check") @Stable public int deoptReasonOptimizedTypeCheck;
1459    @HotSpotVMConstant(name = "Deoptimization::Reason_not_compiled_exception_handler") @Stable public int deoptReasonNotCompiledExceptionHandler;
1460    @HotSpotVMConstant(name = "Deoptimization::Reason_unresolved") @Stable public int deoptReasonUnresolved;
1461    @HotSpotVMConstant(name = "Deoptimization::Reason_jsr_mismatch") @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 = "JVMCIEnv::ok") @Stable public int codeInstallResultOk;
1502    @HotSpotVMConstant(name = "JVMCIEnv::dependencies_failed") @Stable public int codeInstallResultDependenciesFailed;
1503    @HotSpotVMConstant(name = "JVMCIEnv::dependencies_invalid") @Stable public int codeInstallResultDependenciesInvalid;
1504    @HotSpotVMConstant(name = "JVMCIEnv::cache_full") @Stable public int codeInstallResultCacheFull;
1505    @HotSpotVMConstant(name = "JVMCIEnv::code_too_large") @Stable public int codeInstallResultCodeTooLarge;
1506
1507    public String getCodeInstallResultDescription(int codeInstallResult) {
1508        if (codeInstallResult == codeInstallResultOk) {
1509            return "ok";
1510        }
1511        if (codeInstallResult == codeInstallResultDependenciesFailed) {
1512            return "dependencies failed";
1513        }
1514        if (codeInstallResult == codeInstallResultDependenciesInvalid) {
1515            return "dependencies invalid";
1516        }
1517        if (codeInstallResult == codeInstallResultCacheFull) {
1518            return "code cache is full";
1519        }
1520        if (codeInstallResult == codeInstallResultCodeTooLarge) {
1521            return "code is too large";
1522        }
1523        assert false : codeInstallResult;
1524        return "unknown";
1525    }
1526
1527    @HotSpotVMConstant(name = "CompilerToVM::KLASS_TAG") @Stable public int compilerToVMKlassTag;
1528    @HotSpotVMConstant(name = "CompilerToVM::SYMBOL_TAG") @Stable public int compilerToVMSymbolTag;
1529
1530    // Checkstyle: stop
1531    @HotSpotVMConstant(name = "CodeInstaller::VERIFIED_ENTRY") @Stable public int MARKID_VERIFIED_ENTRY;
1532    @HotSpotVMConstant(name = "CodeInstaller::UNVERIFIED_ENTRY") @Stable public int MARKID_UNVERIFIED_ENTRY;
1533    @HotSpotVMConstant(name = "CodeInstaller::OSR_ENTRY") @Stable public int MARKID_OSR_ENTRY;
1534    @HotSpotVMConstant(name = "CodeInstaller::EXCEPTION_HANDLER_ENTRY") @Stable public int MARKID_EXCEPTION_HANDLER_ENTRY;
1535    @HotSpotVMConstant(name = "CodeInstaller::DEOPT_HANDLER_ENTRY") @Stable public int MARKID_DEOPT_HANDLER_ENTRY;
1536    @HotSpotVMConstant(name = "CodeInstaller::INVOKEINTERFACE") @Stable public int MARKID_INVOKEINTERFACE;
1537    @HotSpotVMConstant(name = "CodeInstaller::INVOKEVIRTUAL") @Stable public int MARKID_INVOKEVIRTUAL;
1538    @HotSpotVMConstant(name = "CodeInstaller::INVOKESTATIC") @Stable public int MARKID_INVOKESTATIC;
1539    @HotSpotVMConstant(name = "CodeInstaller::INVOKESPECIAL") @Stable public int MARKID_INVOKESPECIAL;
1540    @HotSpotVMConstant(name = "CodeInstaller::INLINE_INVOKE") @Stable public int MARKID_INLINE_INVOKE;
1541    @HotSpotVMConstant(name = "CodeInstaller::POLL_NEAR") @Stable public int MARKID_POLL_NEAR;
1542    @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int MARKID_POLL_RETURN_NEAR;
1543    @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int MARKID_POLL_FAR;
1544    @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int MARKID_POLL_RETURN_FAR;
1545    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_SHIFT") @Stable public int MARKID_CARD_TABLE_SHIFT;
1546    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_ADDRESS") @Stable public int MARKID_CARD_TABLE_ADDRESS;
1547    @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int MARKID_INVOKE_INVALID;
1548
1549    // Checkstyle: resume
1550
1551    public boolean check() {
1552        for (Field f : getClass().getDeclaredFields()) {
1553            int modifiers = f.getModifiers();
1554            if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
1555                assert Modifier.isFinal(modifiers) || f.getAnnotation(Stable.class) != null : "field should either be final or @Stable: " + f;
1556            }
1557        }
1558
1559        assert codeEntryAlignment > 0 : codeEntryAlignment;
1560        assert (layoutHelperArrayTagObjectValue & (1 << (Integer.SIZE - 1))) != 0 : "object array must have first bit set";
1561        assert (layoutHelperArrayTagTypeValue & (1 << (Integer.SIZE - 1))) != 0 : "type array must have first bit set";
1562
1563        return true;
1564    }
1565
1566    /**
1567     * A compact representation of the different encoding strategies for Objects and metadata.
1568     */
1569    public static class CompressEncoding {
1570        public final long base;
1571        public final int shift;
1572        public final int alignment;
1573
1574        CompressEncoding(long base, int shift, int alignment) {
1575            this.base = base;
1576            this.shift = shift;
1577            this.alignment = alignment;
1578        }
1579
1580        public int compress(long ptr) {
1581            if (ptr == 0L) {
1582                return 0;
1583            } else {
1584                return (int) ((ptr - base) >>> shift);
1585            }
1586        }
1587
1588        public long uncompress(int ptr) {
1589            if (ptr == 0) {
1590                return 0L;
1591            } else {
1592                return ((ptr & 0xFFFFFFFFL) << shift) + base;
1593            }
1594        }
1595
1596        @Override
1597        public String toString() {
1598            return "base: " + base + " shift: " + shift + " alignment: " + alignment;
1599        }
1600
1601        @Override
1602        public int hashCode() {
1603            final int prime = 31;
1604            int result = 1;
1605            result = prime * result + alignment;
1606            result = prime * result + (int) (base ^ (base >>> 32));
1607            result = prime * result + shift;
1608            return result;
1609        }
1610
1611        @Override
1612        public boolean equals(Object obj) {
1613            if (obj instanceof CompressEncoding) {
1614                CompressEncoding other = (CompressEncoding) obj;
1615                return alignment == other.alignment && base == other.base && shift == other.shift;
1616            } else {
1617                return false;
1618            }
1619        }
1620    }
1621
1622    /**
1623     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMValue annotation) with
1624     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
1625     * the provided address.
1626     *
1627     * @param value value of the field
1628     * @return C/C++ symbol name or null
1629     */
1630    public String getVMValueCSymbol(long value) {
1631        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
1632            if (f.isAnnotationPresent(HotSpotVMValue.class)) {
1633                HotSpotVMValue annotation = f.getAnnotation(HotSpotVMValue.class);
1634
1635                if (annotation.get() == HotSpotVMValue.Type.ADDRESS) {
1636                    try {
1637                        if (value == f.getLong(this)) {
1638                            return (annotation.expression() + annotation.signature());
1639                        }
1640                    } catch (IllegalArgumentException e1) {
1641                        // TODO Auto-generated catch block
1642                        e1.printStackTrace();
1643                    } catch (IllegalAccessException e1) {
1644                        // TODO Auto-generated catch block
1645                        e1.printStackTrace();
1646                    }
1647                }
1648            }
1649        }
1650        return null;
1651    }
1652
1653    /**
1654     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMField annotation) with
1655     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
1656     * the provided address.
1657     *
1658     * @param value value of the field
1659     * @return C/C++ symbol name or null
1660     */
1661    public String getVMFieldCSymbol(long value) {
1662        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
1663            if (f.isAnnotationPresent(HotSpotVMField.class)) {
1664                HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
1665
1666                if (annotation.get() == HotSpotVMField.Type.VALUE) {
1667                    try {
1668                        if (value == f.getLong(this)) {
1669                            return (annotation.name());
1670                        }
1671                    } catch (IllegalArgumentException e1) {
1672                        // TODO Auto-generated catch block
1673                        e1.printStackTrace();
1674                    } catch (IllegalAccessException e1) {
1675                        // TODO Auto-generated catch block
1676                        e1.printStackTrace();
1677                    }
1678                }
1679            }
1680        }
1681        return null;
1682    }
1683}