public class VM
extends java.lang.Object
This class encapsulates the global state of the VM; the universe, object heap, interpreter, etc. It is a Singleton and must be initialized with a call to initialize() before calling getVM().
Many auxiliary classes (i.e., most of the VMObjects) keep needed field offsets in the form of static Field objects. In a debugging system, the VM might be shutdown and re-initialized (on a differently-configured build, i.e., 32- vs. 64-bit), and all old cached state (including fields and field offsets) must be flushed.
An Observer pattern is used to implement the initialization of such classes. Each such class, in its static initializer, registers an Observer with the VM class via VM.registerVMInitializedObserver(). This Observer is guaranteed to be notified whenever the VM is initialized (or re-initialized). To implement the first-time initialization, the observer is also notified when it registers itself with the VM. (For bootstrapping reasons, this implies that the constructor of VM can not instantiate any such objects, since VM.soleInstance will not have been set yet. This is a bootstrapping issue which may have to be revisited later.)
Modifier and Type | Class and Description |
---|---|
static class |
VM.Flag |
Modifier and Type | Method and Description |
---|---|
long |
alignDown(long size,
long alignment)
Utility routine for getting data structure alignment correct
|
long |
alignUp(long size,
long alignment)
Utility routine for getting data structure alignment correct
|
int |
buildIntFromShorts(short low,
short high)
Utility routine for building an int from two "unsigned" 16-bit
shorts
|
long |
buildLongFromIntsPD(int oneHalf,
int otherHalf)
Utility routine for building a long from two "unsigned" 32-bit
ints in platform-dependent order
|
void |
fireVMResumed()
This is only used by the debugging system.
|
void |
fireVMSuspended()
This is only used by the debugging system.
|
long |
getAddressSize() |
static long |
getAddressValue(Address addr) |
Bytes |
getBytes() |
int |
getBytesPerLong()
Get bytes-per-long == long/double natural alignment.
|
int |
getBytesPerWord() |
CodeCache |
getCodeCache()
Returns the code cache; should not be used if is core build
|
VM.Flag |
getCommandLineFlag(java.lang.String name) |
VM.Flag[] |
getCommandLineFlags() |
java.lang.String |
getCPU()
Returns the CPU this VM is running on.
|
JVMDebugger |
getDebugger()
This is only used by the debugging (i.e., non-runtime) system
|
int |
getHeapOopSize() |
int |
getHeapWordSize() |
Interpreter |
getInterpreter() |
long |
getIntSize() |
int |
getInvalidOSREntryBCI()
FIXME: figure out where to stick this
|
int |
getInvocationEntryBCI()
FIXME: figure out where to stick this
|
JNIHandles |
getJNIHandles() |
int |
getKlassPtrSize() |
long |
getLogAddressSize() |
int |
getLogMinObjAlignmentInBytes() |
int |
getMinObjAlignmentInBytes()
Get minimum object alignment in bytes.
|
int |
getObjectAlignmentInBytes() |
ObjectHeap |
getObjectHeap() |
ObjectSynchronizer |
getObjectSynchronizer() |
long |
getOopSize() |
java.lang.String |
getOS()
Returns the OS this VM is running on.
|
int |
getReserveForAllocationPrefetch() |
ReversePtrs |
getRevPtrs() |
Runtime1 |
getRuntime1()
Should only be called for C1 builds
|
long |
getStackBias()
NOTE: this offset is in BYTES in this system!
|
StringTable |
getStringTable() |
StubRoutines |
getStubRoutines() |
SymbolTable |
getSymbolTable() |
SystemDictionary |
getSystemDictionary() |
java.util.Properties |
getSystemProperties() |
java.lang.String |
getSystemProperty(java.lang.String key) |
Threads |
getThreads() |
TypeDataBase |
getTypeDataBase() |
Universe |
getUniverse() |
boolean |
getUseTLAB()
Indicates whether Thread-Local Allocation Buffers are used
|
static VM |
getVM()
This is the primary accessor used by both the debugger and any
potential runtime system
|
java.lang.String |
getVMInternalInfo() |
VMRegImpl |
getVMRegImplInfo() |
java.lang.String |
getVMRelease() |
static void |
initialize(TypeDataBase db,
boolean isBigEndian)
This could be used by a reflective runtime system
|
static void |
initialize(TypeDataBase db,
JVMDebugger debugger)
This is used by the debugging system
|
boolean |
isBigEndian()
Returns true if this is a isBigEndian, false otherwise
|
boolean |
isClientCompiler()
Returns true if this is a C1 build, false otherwise
|
boolean |
isCompressedKlassPointersEnabled() |
boolean |
isCompressedOopsEnabled() |
boolean |
isCore()
Returns true if this is a "core" build, false if either C1 or C2
is present
|
boolean |
isDebugging()
Test to see whether we're in debugging mode (NOTE: this really
should not be tested by this code; currently only used in
StackFrameStream)
|
boolean |
isJavaPCDbg(Address addr)
Indicates whether a given program counter is in Java code.
|
boolean |
isLP64()
Indicates whether the underlying machine supports the LP64 data
model.
|
boolean |
isServerCompiler()
Returns true if this is a C2 build, false otherwise
|
boolean |
isSharingEnabled() |
java.lang.Integer |
lookupIntConstant(java.lang.String name) |
Type |
lookupType(java.lang.String cTypeName) |
static void |
registerVMInitializedObserver(java.util.Observer o)
This is used by both the debugger and any runtime system.
|
void |
registerVMResumedObserver(java.util.Observer o)
This is only used by the debugging system.
|
void |
registerVMSuspendedObserver(java.util.Observer o)
This is only used by the debugging system.
|
void |
setRevPtrs(ReversePtrs rp) |
static void |
shutdown()
This is used by the debugging system
|
boolean |
useDerivedPointerTable()
Returns true if C2 derived pointer table should be used, false otherwise
|
boolean |
wizardMode() |
public static void initialize(TypeDataBase db, boolean isBigEndian)
public static void initialize(TypeDataBase db, JVMDebugger debugger)
public static void shutdown()
public static void registerVMInitializedObserver(java.util.Observer o)
public static VM getVM()
public void registerVMResumedObserver(java.util.Observer o)
registerVMInitializedObserver(java.util.Observer)
(because of the possibility of
race conditions if the observer is added while the VM is being
suspended or resumed).public void registerVMSuspendedObserver(java.util.Observer o)
registerVMInitializedObserver(java.util.Observer)
(because of the possibility of
race conditions if the observer is added while the VM is being
suspended or resumed).public void fireVMResumed()
public void fireVMSuspended()
public java.lang.String getOS()
public java.lang.String getCPU()
public Type lookupType(java.lang.String cTypeName)
public java.lang.Integer lookupIntConstant(java.lang.String name)
public static long getAddressValue(Address addr)
public long getAddressSize()
public long getOopSize()
public long getLogAddressSize()
public long getIntSize()
public long getStackBias()
public boolean isLP64()
public int getBytesPerLong()
public int getBytesPerWord()
public int getMinObjAlignmentInBytes()
public int getLogMinObjAlignmentInBytes()
public int getHeapWordSize()
public int getHeapOopSize()
public int getKlassPtrSize()
public long alignUp(long size, long alignment)
public long alignDown(long size, long alignment)
public int buildIntFromShorts(short low, short high)
public long buildLongFromIntsPD(int oneHalf, int otherHalf)
public TypeDataBase getTypeDataBase()
public Universe getUniverse()
public ObjectHeap getObjectHeap()
public SymbolTable getSymbolTable()
public StringTable getStringTable()
public SystemDictionary getSystemDictionary()
public Threads getThreads()
public ObjectSynchronizer getObjectSynchronizer()
public JNIHandles getJNIHandles()
public Interpreter getInterpreter()
public StubRoutines getStubRoutines()
public VMRegImpl getVMRegImplInfo()
public Bytes getBytes()
public boolean isBigEndian()
public boolean isCore()
public boolean isClientCompiler()
public boolean isServerCompiler()
public boolean useDerivedPointerTable()
public CodeCache getCodeCache()
public Runtime1 getRuntime1()
public boolean isDebugging()
public JVMDebugger getDebugger()
public boolean isJavaPCDbg(Address addr)
public int getInvocationEntryBCI()
public int getInvalidOSREntryBCI()
public boolean wizardMode()
public ReversePtrs getRevPtrs()
public void setRevPtrs(ReversePtrs rp)
public java.lang.String getVMRelease()
public java.lang.String getVMInternalInfo()
public int getReserveForAllocationPrefetch()
public boolean isSharingEnabled()
public boolean isCompressedOopsEnabled()
public boolean isCompressedKlassPointersEnabled()
public int getObjectAlignmentInBytes()
public boolean getUseTLAB()
public VM.Flag[] getCommandLineFlags()
public VM.Flag getCommandLineFlag(java.lang.String name)
public java.lang.String getSystemProperty(java.lang.String key)
public java.util.Properties getSystemProperties()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.