public final class VM extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
contendedPaddingWidth()
Returns the number of bytes used to pad the fields/classes annotated with
Contended. |
static boolean |
enableContended()
Checks if
@Contended annotations are enabled. |
static int |
getObjectAlignmentInBytes()
Retrieve the object alignment in bytes from the JVM.
|
static sun.misc.Unsafe |
getUnsafe()
Returns
Unsafe if it is available. |
static boolean |
hasUnsafe()
Checks if
Unsafe is available. |
static boolean |
is32Bits()
Checks if the JVM is a 32 bits one.
|
static boolean |
isPreJava12JVM()
Checks if the JVM is a pre-Java 12 version.
|
static void |
printOffsets(Object obj)
Utility method using
Unsafe to print the field offset for debugging. |
static boolean |
restrictContended()
Checks if the JVM restricts the use of
@Contended to internal classes. |
static boolean |
useCompressedClassPointers()
Checks if the JVM uses compressed class pointers.
|
static boolean |
useCompressedOops()
Checks if the JVM uses compressed reference.
|
static boolean |
useEmptySlotsInSuper()
Checks if the JVM uses more aggressive optimizations to avoid unused gaps in instances.
|
public static int getObjectAlignmentInBytes()
public static boolean useCompressedOops()
true if the JVM use compressed references false otherwise.public static boolean useCompressedClassPointers()
true if the JVM use compressed class pointers false otherwise.public static boolean useEmptySlotsInSuper()
true if the JVM use empty slots in super class false otherwise.public static boolean restrictContended()
@Contended to internal classes.true if the JVM restricts the use of @Contended to internal classes, false otherwise.public static boolean enableContended()
@Contended annotations are enabled.true if @Contended annotations are enabled, false otherwise.public static int contendedPaddingWidth()
Contended.
The value will be between 0 and 8192 (inclusive) and will be a multiple of 8.
Contended.public static boolean is32Bits()
true if the JVM is a 32 bits version, false otherwise.public static boolean isPreJava12JVM()
true if the JVM is a pre-Java 12 version, false otherwise.public static boolean hasUnsafe()
Unsafe is available.true if unsafe is available, false otherwise.public static sun.misc.Unsafe getUnsafe()
Unsafe if it is available.Unsafe if it is available, null otherwise.public static void printOffsets(Object obj)
Unsafe to print the field offset for debugging.obj - the object to analyzeCopyright © 2023. All rights reserved.