Top Description Inners Fields Constructors Methods
sun.jvm.hotspot.runtime

public Class VM

extends Object
Class Inheritance
Imports
java.io.*, java.net.*, java.util.*, java.util.regex.*, sun.jvm.hotspot.code.*, sun.jvm.hotspot.code.*, sun.jvm.hotspot.c1.*, sun.jvm.hotspot.debugger.*, sun.jvm.hotspot.interpreter.*, sun.jvm.hotspot.memory.*, sun.jvm.hotspot.oops.*, sun.jvm.hotspot.types.*, sun.jvm.hotspot.utilities.*, .Observable, .Observer, sun.jvm.hotspot.runtime.*, sun.jvm.hotspot.classfile.*

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.)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private static CIntegerType
private Bytes
private int
private int
private ClassLoaderDataGraph
private static final String[]
private CodeCache
codeCache

This is only present in a non-core build

private VM.Flag[]
private Boolean
private Boolean
private TypeDataBase
private JVMDebugger
debugger

This is only present if in a debugging system

private SystemDictionary
private static final boolean
private FileMapInfo
public static int
public static int
public static int
public static int
Flags_DEFAULT

-XX flags (value origin)

public static int
public static int
public static int
public static int
public static int
private static int
private static int
private Map<String, VM.Flag>
private JNIHandles
private ObjectHeap
private int
private int
private Interpreter
private static Type
private static Type
private int
invocationEntryBCI

These constants come from globalDefinitions.hpp

private boolean
private boolean
isJvmtiSupported

Flag indicating if JVMTI support is included in the build

private boolean
isLP64

alignment constants

private int
private long
private int
private int
private int
private int
private int
private int
private ReversePtrs
private Runtime1
runtime1

This is only present in a C1 build

private static final Properties
private Boolean
private static Type
private static VM
private StubRoutines
private ObjectSynchronizer
private Properties
private Threads
private static Type
private static Type
private static Type
private Universe
private boolean
usingClientCompiler

Flags indicating whether we are attached to a core, C1, or C2 build

private boolean
private static List<Observer>
private String
private VMRegImpl
private String
private List<Observer>
private List<Observer>

Constructor Summary

AccessConstructor and Description
private
VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian)

Method Summary

Modifier and TypeMethod and Description
public long
alignDown(long size, long alignment)

Utility routine for getting data structure alignment correct

public long
alignUp(long size, long alignment)

Utility routine for getting data structure alignment correct

public int
buildIntFromShorts(short low, short high)

Utility routine for building an int from two "unsigned" 16-bit shorts

private static void
public void
fireVMResumed()

This is only used by the debugging system.

public void
fireVMSuspended()

This is only used by the debugging system.

public long
public static long
public Bytes
public int
getBytesPerLong()

Get bytes-per-long == long/double natural alignment.

public int
public ClassLoaderDataGraph
public CodeCache
getCodeCache()

Returns the code cache; should not be used if is core build

public boolean
public VM.Flag
public VM.Flag[]
public String
getCPU()

Returns the CPU this VM is running on.

public JVMDebugger
getDebugger()

This is only used by the debugging (i.e., non-runtime) system

public FileMapInfo
private String
getFlagTypeAsString(int typeIndex)

public int
public int
public Interpreter
public long
public int
getInvocationEntryBCI()

FIXME: figure out where to stick this

public JNIHandles
public int
public long
public int
public int
public int
getMinObjAlignmentInBytes()

Get minimum object alignment in bytes.

public int
public ObjectHeap
public ObjectSynchronizer
public long
public String
getOS()

Returns the OS this VM is running on.

public int
public ReversePtrs
public Runtime1
getRuntime1()

Should only be called for C1 builds

public StubRoutines
public SystemDictionary
public Properties
public String
public Threads
public TypeDataBase
public Universe
public boolean
getUseTLAB()

Indicates whether Thread-Local Allocation Buffers are used

public static VM
getVM()

This is the primary accessor used by both the debugger and any potential runtime system

public String
public VMRegImpl
public String
public static void
initialize(TypeDataBase db, boolean isBigEndian)

This could be used by a reflective runtime system

public static void
initialize(TypeDataBase db, JVMDebugger debugger)

This is used by the debugging system

public boolean
isBigEndian()

Returns true if this is a isBigEndian, false otherwise

public boolean
isClientCompiler()

Returns true if this is a C1 build, false otherwise

public boolean
public boolean
public boolean
isCore()

Returns true if this is a "core" build, false if either C1 or C2 is present

public 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)

public boolean
isJavaPCDbg(Address addr)

Indicates whether a given program counter is in Java code.

public boolean
isJvmtiSupported()

Returns true if JVMTI is supported, false otherwise

public boolean
isLP64()

Indicates whether the underlying machine supports the LP64 data model.

public boolean
isServerCompiler()

Returns true if this is a C2 build, false otherwise

public boolean
public Integer
public Type
lookupType(String cTypeName)

private void
private void
public static void
registerVMInitializedObserver(Observer o)

This is used by both the debugger and any runtime system.

public void
registerVMResumedObserver(Observer o)

This is only used by the debugging system.

public void
registerVMSuspendedObserver(Observer o)

This is only used by the debugging system.

public void
public static void
shutdown()

This is used by the debugging system

public boolean
useDerivedPointerTable()

Returns true if C2 derived pointer table should be used, false otherwise

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

boolTypeback to summary
private static CIntegerType boolType
bytesback to summary
private Bytes bytes
bytesPerLongback to summary
private int bytesPerLong
bytesPerWordback to summary
private int bytesPerWord
cldGraphback to summary
private ClassLoaderDataGraph cldGraph
cmdFlagTypesback to summary
private static final String[] cmdFlagTypes
codeCacheback to summary
private CodeCache codeCache

This is only present in a non-core build

commandLineFlagsback to summary
private VM.Flag[] commandLineFlags
compressedKlassPointersEnabledback to summary
private Boolean compressedKlassPointersEnabled
compressedOopsEnabledback to summary
private Boolean compressedOopsEnabled
dbback to summary
private TypeDataBase db
debuggerback to summary
private JVMDebugger debugger

This is only present if in a debugging system

dictback to summary
private SystemDictionary dict
disableDerivedPointerTableCheckback to summary
private static final boolean disableDerivedPointerTableCheck
fileMapInfoback to summary
private FileMapInfo fileMapInfo
Flags_ATTACH_ON_DEMANDback to summary
public static int Flags_ATTACH_ON_DEMAND
Flags_COMMAND_LINEback to summary
public static int Flags_COMMAND_LINE
Flags_CONFIG_FILEback to summary
public static int Flags_CONFIG_FILE
Flags_DEFAULTback to summary
public static int Flags_DEFAULT

-XX flags (value origin)

Flags_ENVIRON_VARback to summary
public static int Flags_ENVIRON_VAR
Flags_ERGONOMICback to summary
public static int Flags_ERGONOMIC
Flags_INTERNALback to summary
public static int Flags_INTERNAL
Flags_JIMAGE_RESOURCEback to summary
public static int Flags_JIMAGE_RESOURCE
Flags_MANAGEMENTback to summary
public static int Flags_MANAGEMENT
Flags_VALUE_ORIGIN_MASKback to summary
private static int Flags_VALUE_ORIGIN_MASK
Flags_WAS_SET_ON_COMMAND_LINEback to summary
private static int Flags_WAS_SET_ON_COMMAND_LINE
flagsMapback to summary
private Map<String, VM.Flag> flagsMap
handlesback to summary
private JNIHandles handles
heapback to summary
private ObjectHeap heap
heapOopSizeback to summary
private int heapOopSize
heapWordSizeback to summary
private int heapWordSize
interpreterback to summary
private Interpreter interpreter
intTypeback to summary
private static Type intType
intxTypeback to summary
private static Type intxType
invocationEntryBCIback to summary
private int invocationEntryBCI

These constants come from globalDefinitions.hpp

isBigEndianback to summary
private boolean isBigEndian
isJvmtiSupportedback to summary
private boolean isJvmtiSupported

Flag indicating if JVMTI support is included in the build

isLP64back to summary
private boolean isLP64

alignment constants

klassPtrSizeback to summary
private int klassPtrSize
logAddressSizeback to summary
private long logAddressSize
logBytesPerWordback to summary
private int logBytesPerWord
logMinObjAlignmentInBytesback to summary
private int logMinObjAlignmentInBytes
minObjAlignmentInBytesback to summary
private int minObjAlignmentInBytes
objectAlignmentInBytesback to summary
private int objectAlignmentInBytes
oopSizeback to summary
private int oopSize
reserveForAllocationPrefetchback to summary
private int reserveForAllocationPrefetch
revPtrsback to summary
private ReversePtrs revPtrs
runtime1back to summary
private Runtime1 runtime1

This is only present in a C1 build

saPropsback to summary
private static final Properties saProps
sharingEnabledback to summary
private Boolean sharingEnabled
sizetTypeback to summary
private static Type sizetType
soleInstanceback to summary
private static VM soleInstance
stubRoutinesback to summary
private StubRoutines stubRoutines
synchronizerback to summary
private ObjectSynchronizer synchronizer
sysPropsback to summary
private Properties sysProps
threadsback to summary
private Threads threads
uint64tTypeback to summary
private static Type uint64tType
uintTypeback to summary
private static Type uintType
uintxTypeback to summary
private static Type uintxType
universeback to summary
private Universe universe
usingClientCompilerback to summary
private boolean usingClientCompiler

Flags indicating whether we are attached to a core, C1, or C2 build

usingServerCompilerback to summary
private boolean usingServerCompiler
vmInitializedObserversback to summary
private static List<Observer> vmInitializedObservers
vmInternalInfoback to summary
private String vmInternalInfo
vmregImplback to summary
private VMRegImpl vmregImpl
vmReleaseback to summary
private String vmRelease
vmResumedObserversback to summary
private List<Observer> vmResumedObservers
vmSuspendedObserversback to summary
private List<Observer> vmSuspendedObservers

Constructor Detail

VMback to summary
private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian)

Method Detail

alignDownback to summary
public long alignDown(long size, long alignment)

Utility routine for getting data structure alignment correct

alignUpback to summary
public long alignUp(long size, long alignment)

Utility routine for getting data structure alignment correct

buildIntFromShortsback to summary
public int buildIntFromShorts(short low, short high)

Utility routine for building an int from two "unsigned" 16-bit shorts

checkVMVersionback to summary
private static void checkVMVersion(String vmRelease)
fireVMResumedback to summary
public void fireVMResumed()

This is only used by the debugging system. Informs all registered resumption observers that the VM has been resumed. The application is responsible for actually having performed the resumption. No OopHandles must be used after this point, as they may move in the target address space due to garbage collection.

fireVMSuspendedback to summary
public void fireVMSuspended()

This is only used by the debugging system. Informs all registered suspension observers that the VM has been suspended. The application is responsible for actually having performed the suspension. Garbage collection must be forbidden at this point; for example, a JPDA-level suspension is not adequate since the VM thread may still be running.

getAddressSizeback to summary
public long getAddressSize()
getAddressValueback to summary
public static long getAddressValue(Address addr)
getBytesback to summary
public Bytes getBytes()
getBytesPerLongback to summary
public int getBytesPerLong()

Get bytes-per-long == long/double natural alignment.

getBytesPerWordback to summary
public int getBytesPerWord()
getClassLoaderDataGraphback to summary
public ClassLoaderDataGraph getClassLoaderDataGraph()
getCodeCacheback to summary
public CodeCache getCodeCache()

Returns the code cache; should not be used if is core build

getCommandLineBooleanFlagback to summary
public boolean getCommandLineBooleanFlag(String name)
getCommandLineFlagback to summary
public VM.Flag getCommandLineFlag(String name)
getCommandLineFlagsback to summary
public VM.Flag[] getCommandLineFlags()
getCPUback to summary
public String getCPU()

Returns the CPU this VM is running on. Notice that by delegating to the debugger we can transparently support remote debugging.

getDebuggerback to summary
public JVMDebugger getDebugger()

This is only used by the debugging (i.e., non-runtime) system

getFileMapInfoback to summary
public FileMapInfo getFileMapInfo()
getFlagTypeAsStringback to summary
private String getFlagTypeAsString(int typeIndex)
getHeapOopSizeback to summary
public int getHeapOopSize()
getHeapWordSizeback to summary
public int getHeapWordSize()
getInterpreterback to summary
public Interpreter getInterpreter()
getIntSizeback to summary
public long getIntSize()
getInvocationEntryBCIback to summary
public int getInvocationEntryBCI()

FIXME: figure out where to stick this

getJNIHandlesback to summary
public JNIHandles getJNIHandles()
getKlassPtrSizeback to summary
public int getKlassPtrSize()
getLogAddressSizeback to summary
public long getLogAddressSize()
getLogBytesPerWordback to summary
public int getLogBytesPerWord()
getLogMinObjAlignmentInBytesback to summary
public int getLogMinObjAlignmentInBytes()
getMinObjAlignmentInBytesback to summary
public int getMinObjAlignmentInBytes()

Get minimum object alignment in bytes.

getObjectAlignmentInBytesback to summary
public int getObjectAlignmentInBytes()
getObjectHeapback to summary
public ObjectHeap getObjectHeap()
getObjectSynchronizerback to summary
public ObjectSynchronizer getObjectSynchronizer()
getOopSizeback to summary
public long getOopSize()
getOSback to summary
public String getOS()

Returns the OS this VM is running on. Notice that by delegating to the debugger we can transparently support remote debugging.

getReserveForAllocationPrefetchback to summary
public int getReserveForAllocationPrefetch()
getRevPtrsback to summary
public ReversePtrs getRevPtrs()
getRuntime1back to summary
public Runtime1 getRuntime1()

Should only be called for C1 builds

getStubRoutinesback to summary
public StubRoutines getStubRoutines()
getSystemDictionaryback to summary
public SystemDictionary getSystemDictionary()
getSystemPropertiesback to summary
public Properties getSystemProperties()
getSystemPropertyback to summary
public String getSystemProperty(String key)
getThreadsback to summary
public Threads getThreads()
getTypeDataBaseback to summary
public TypeDataBase getTypeDataBase()
getUniverseback to summary
public Universe getUniverse()
getUseTLABback to summary
public boolean getUseTLAB()

Indicates whether Thread-Local Allocation Buffers are used

getVMback to summary
public static VM getVM()

This is the primary accessor used by both the debugger and any potential runtime system

getVMInternalInfoback to summary
public String getVMInternalInfo()
getVMRegImplInfoback to summary
public VMRegImpl getVMRegImplInfo()
getVMReleaseback to summary
public String getVMRelease()
initializeback to summary
public static void initialize(TypeDataBase db, boolean isBigEndian)

This could be used by a reflective runtime system

initializeback to summary
public static void initialize(TypeDataBase db, JVMDebugger debugger)

This is used by the debugging system

isBigEndianback to summary
public boolean isBigEndian()

Returns true if this is a isBigEndian, false otherwise

isClientCompilerback to summary
public boolean isClientCompiler()

Returns true if this is a C1 build, false otherwise

isCompressedKlassPointersEnabledback to summary
public boolean isCompressedKlassPointersEnabled()
isCompressedOopsEnabledback to summary
public boolean isCompressedOopsEnabled()
isCoreback to summary
public boolean isCore()

Returns true if this is a "core" build, false if either C1 or C2 is present

isDebuggingback to summary
public 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)

isJavaPCDbgback to summary
public boolean isJavaPCDbg(Address addr)

Indicates whether a given program counter is in Java code. This includes but is not spanned by the interpreter and code cache. Only used in the debugging system, for implementing JavaThread.currentFrameGuess() on x86.

isJvmtiSupportedback to summary
public boolean isJvmtiSupported()

Returns true if JVMTI is supported, false otherwise

isLP64back to summary
public boolean isLP64()

Indicates whether the underlying machine supports the LP64 data model. This is needed for conditionalizing code in a few places

isServerCompilerback to summary
public boolean isServerCompiler()

Returns true if this is a C2 build, false otherwise

isSharingEnabledback to summary
public boolean isSharingEnabled()
lookupIntConstantback to summary
public Integer lookupIntConstant(String name)
lookupTypeback to summary
public Type lookupType(String cTypeName)
readCommandLineFlagsback to summary
private void readCommandLineFlags()
readSystemPropertiesback to summary
private void readSystemProperties()
registerVMInitializedObserverback to summary
public static void registerVMInitializedObserver(Observer o)

This is used by both the debugger and any runtime system. It is the basic mechanism by which classes which mimic underlying VM functionality cause themselves to be initialized. The given observer will be notified (with arguments (null, null)) when the VM is re-initialized, as well as when it registers itself with the VM.

registerVMResumedObserverback to summary
public void registerVMResumedObserver(Observer o)

This is only used by the debugging system. The given observer will be notified if the underlying VM resumes execution. NOTE that the given observer is not triggered if the VM is currently running and therefore differs in behavior from registerVMInitializedObserver (because of the possibility of race conditions if the observer is added while the VM is being suspended or resumed).

registerVMSuspendedObserverback to summary
public void registerVMSuspendedObserver(Observer o)

This is only used by the debugging system. The given observer will be notified if the underlying VM suspends execution. NOTE that the given observer is not triggered if the VM is currently suspended and therefore differs in behavior from registerVMInitializedObserver (because of the possibility of race conditions if the observer is added while the VM is being suspended or resumed).

setRevPtrsback to summary
public void setRevPtrs(ReversePtrs rp)
shutdownback to summary
public static void shutdown()

This is used by the debugging system

useDerivedPointerTableback to summary
public boolean useDerivedPointerTable()

Returns true if C2 derived pointer table should be used, false otherwise

wizardModeback to summary
public boolean wizardMode()
sun.jvm.hotspot.runtime back to summary

public final Class VM.Flag

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Address
private int
private String
private String

Constructor Summary

AccessConstructor and Description
private
Flag(String type, String name, Address addr, int flags)

Method Summary

Modifier and TypeMethod and Description
public Address
public boolean
public String
public String
public double
public long
public long
public String
public int
public String
public long
public String
public long
public long
public long
public String
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addrback to summary
private Address addr
flagsback to summary
private int flags
nameback to summary
private String name
typeback to summary
private String type

Constructor Detail

Flagback to summary
private Flag(String type, String name, Address addr, int flags)

Method Detail

getAddressback to summary
public Address getAddress()
getBoolback to summary
public boolean getBool()
getCcstrback to summary
public String getCcstr()
getCcstrlistback to summary
public String getCcstrlist()
getDoubleback to summary
public double getDouble()
getIntback to summary
public long getInt()
getIntxback to summary
public long getIntx()
getNameback to summary
public String getName()
getOriginback to summary
public int getOrigin()
getOriginStringback to summary
public String getOriginString()
getSizetback to summary
public long getSizet()
getTypeback to summary
public String getType()
getUIntback to summary
public long getUInt()
getUint64tback to summary
public long getUint64t()
getUIntxback to summary
public long getUIntx()
getValueback to summary
public String getValue()
isBoolback to summary
public boolean isBool()
isCcstrback to summary
public boolean isCcstr()
isCcstrlistback to summary
public boolean isCcstrlist()
isDoubleback to summary
public boolean isDouble()
isIntback to summary
public boolean isInt()
isIntxback to summary
public boolean isIntx()
isSizetback to summary
public boolean isSizet()
isUIntback to summary
public boolean isUInt()
isUint64tback to summary
public boolean isUint64t()
isUIntxback to summary
public boolean isUIntx()