class VirtualizerToolImpl extends Object implements VirtualizerTool, CanonicalizerTool
| Modifier and Type | Field and Description |
|---|---|
private PartialEscapeClosure<?> |
closure |
private ConstantReflectionProvider |
constantReflection |
private ValueNode |
current |
private boolean |
deleted |
private GraphEffectList |
effects |
private MetaAccessProvider |
metaAccess |
private FixedNode |
position |
private PartialEscapeBlockState<?> |
state |
| Constructor and Description |
|---|
VirtualizerToolImpl(MetaAccessProvider metaAccess,
ConstantReflectionProvider constantReflection,
PartialEscapeClosure<?> closure) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLock(VirtualObjectNode virtualObject,
MonitorIdNode monitorId) |
void |
addNode(ValueNode node)
Adds the given node to the graph.This action will only be performed when, and if, the changes
are committed.
|
boolean |
allUsagesAvailable()
If this method returns false, not all
usages of a node are yet
available. |
boolean |
canonicalizeReads() |
void |
createVirtualObject(VirtualObjectNode virtualObject,
ValueNode[] entryState,
List<MonitorIdNode> locks,
boolean ensureVirtualized)
Introduces a new virtual object to the current state.
|
void |
delete()
Deletes the current node.
|
ValueNode |
getAlias(ValueNode value)
Returns a VirtualObjectNode if the given value is aliased with a virtual object that is still
virtual, the materialized value of the given value is aliased with a virtual object that was
materialized, the replacement if the give value was replaced, otherwise the given value.
|
ConstantReflectionProvider |
getConstantReflection() |
ConstantReflectionProvider |
getConstantReflectionProvider() |
boolean |
getEnsureVirtualized(VirtualObjectNode virtualObject) |
ValueNode |
getEntry(VirtualObjectNode virtualObject,
int index) |
int |
getMaximumEntryCount()
This method should be used to query the maximum size of virtualized objects before attempting
virtualization.
|
MetaAccessProvider |
getMetaAccess() |
MetaAccessProvider |
getMetaAccessProvider() |
boolean |
isDeleted() |
private static boolean |
isObjectEntry(ValueNode value) |
MonitorIdNode |
removeLock(VirtualObjectNode virtualObject) |
void |
replaceFirstInput(Node oldInput,
Node replacement)
Replaces an input of the current node.
|
void |
replaceWith(ValueNode node)
This method performs either
VirtualizerTool.replaceWithValue(ValueNode) or
VirtualizerTool.replaceWithVirtual(VirtualObjectNode), depending on the given value. |
void |
replaceWithValue(ValueNode replacement)
Deletes the current node and replaces it with the given value.
|
void |
replaceWithVirtual(VirtualObjectNode virtual)
Deletes the current node and replaces it with the given virtualized object.
|
void |
reset(PartialEscapeBlockState<?> newState,
ValueNode newCurrent,
FixedNode newPosition,
GraphEffectList newEffects) |
void |
setEnsureVirtualized(VirtualObjectNode virtualObject,
boolean ensureVirtualized) |
void |
setVirtualEntry(VirtualObjectNode virtual,
int index,
ValueNode value,
boolean unsafe)
Sets the entry (field or array element) with the given index in the virtualized object.
|
private final MetaAccessProvider metaAccess
private final ConstantReflectionProvider constantReflection
private final PartialEscapeClosure<?> closure
private boolean deleted
private PartialEscapeBlockState<?> state
private GraphEffectList effects
VirtualizerToolImpl(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, PartialEscapeClosure<?> closure)
public MetaAccessProvider getMetaAccessProvider()
getMetaAccessProvider in interface VirtualizerToolMetaAccessProvider associated with the current compilation.public ConstantReflectionProvider getConstantReflectionProvider()
getConstantReflectionProvider in interface VirtualizerToolConstantReflectionProvider associated with the current compilation, which
can be used to access JavaConstants.public void reset(PartialEscapeBlockState<?> newState, ValueNode newCurrent, FixedNode newPosition, GraphEffectList newEffects)
public boolean isDeleted()
public ValueNode getAlias(ValueNode value)
VirtualizerToolVirtualizerTool.replaceWithValue(ValueNode) are not immediately committed. This
method can be used to determine if a value was replaced by another one (e.g., a load field by
the loaded value).getAlias in interface VirtualizerToolpublic ValueNode getEntry(VirtualObjectNode virtualObject, int index)
getEntry in interface VirtualizerToolpublic void setVirtualEntry(VirtualObjectNode virtual, int index, ValueNode value, boolean unsafe)
VirtualizerToolsetVirtualEntry in interface VirtualizerToolindex - the index to be set.value - the new value for the given index.unsafe - if true, then mismatching value Kinds will be accepted.public void setEnsureVirtualized(VirtualObjectNode virtualObject, boolean ensureVirtualized)
setEnsureVirtualized in interface VirtualizerToolpublic boolean getEnsureVirtualized(VirtualObjectNode virtualObject)
getEnsureVirtualized in interface VirtualizerToolprivate static boolean isObjectEntry(ValueNode value)
public void replaceWithVirtual(VirtualObjectNode virtual)
VirtualizerToolreplaceWithVirtual in interface VirtualizerToolvirtual - the virtualized object that should replace the current node.public void replaceWithValue(ValueNode replacement)
VirtualizerToolreplaceWithValue in interface VirtualizerToolreplacement - the value that should replace the current node.public void delete()
VirtualizerTooldelete in interface VirtualizerToolpublic void replaceFirstInput(Node oldInput, Node replacement)
VirtualizerToolreplaceFirstInput in interface VirtualizerToololdInput - the old input value.replacement - the new input value.public void addNode(ValueNode node)
VirtualizerTooladdNode in interface VirtualizerToolnode - the node to add.public void createVirtualObject(VirtualObjectNode virtualObject, ValueNode[] entryState, List<MonitorIdNode> locks, boolean ensureVirtualized)
VirtualizerToolcreateVirtualObject in interface VirtualizerToolvirtualObject - the new virtual object.entryState - the initial state of the virtual object's fields.locks - the initial locking depths.ensureVirtualized - true if this object needs to stay virtualpublic int getMaximumEntryCount()
VirtualizerToolgetMaximumEntryCount in interface VirtualizerToolpublic void replaceWith(ValueNode node)
VirtualizerToolVirtualizerTool.replaceWithValue(ValueNode) or
VirtualizerTool.replaceWithVirtual(VirtualObjectNode), depending on the given value.replaceWith in interface VirtualizerToolnode - the replacement valuepublic void addLock(VirtualObjectNode virtualObject, MonitorIdNode monitorId)
addLock in interface VirtualizerToolpublic MonitorIdNode removeLock(VirtualObjectNode virtualObject)
removeLock in interface VirtualizerToolpublic MetaAccessProvider getMetaAccess()
getMetaAccess in interface CanonicalizerToolpublic ConstantReflectionProvider getConstantReflection()
getConstantReflection in interface CanonicalizerToolpublic boolean canonicalizeReads()
canonicalizeReads in interface CanonicalizerToolpublic boolean allUsagesAvailable()
CanonicalizerToolusages of a node are yet
available. So a node must not be canonicalized base on, e.g., information returned from
Node.hasNoUsages().allUsagesAvailable in interface CanonicalizerTool