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 VirtualizerTool
MetaAccessProvider
associated with the current compilation.public ConstantReflectionProvider getConstantReflectionProvider()
getConstantReflectionProvider
in interface VirtualizerTool
ConstantReflectionProvider
associated with the current compilation, which
can be used to access JavaConstant
s.public void reset(PartialEscapeBlockState<?> newState, ValueNode newCurrent, FixedNode newPosition, GraphEffectList newEffects)
public boolean isDeleted()
public ValueNode getAlias(ValueNode value)
VirtualizerTool
VirtualizerTool.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 VirtualizerTool
public ValueNode getEntry(VirtualObjectNode virtualObject, int index)
getEntry
in interface VirtualizerTool
public void setVirtualEntry(VirtualObjectNode virtual, int index, ValueNode value, boolean unsafe)
VirtualizerTool
setVirtualEntry
in interface VirtualizerTool
index
- the index to be set.value
- the new value for the given index.unsafe
- if true, then mismatching value Kind
s will be accepted.public void setEnsureVirtualized(VirtualObjectNode virtualObject, boolean ensureVirtualized)
setEnsureVirtualized
in interface VirtualizerTool
public boolean getEnsureVirtualized(VirtualObjectNode virtualObject)
getEnsureVirtualized
in interface VirtualizerTool
private static boolean isObjectEntry(ValueNode value)
public void replaceWithVirtual(VirtualObjectNode virtual)
VirtualizerTool
replaceWithVirtual
in interface VirtualizerTool
virtual
- the virtualized object that should replace the current node.public void replaceWithValue(ValueNode replacement)
VirtualizerTool
replaceWithValue
in interface VirtualizerTool
replacement
- the value that should replace the current node.public void delete()
VirtualizerTool
delete
in interface VirtualizerTool
public void replaceFirstInput(Node oldInput, Node replacement)
VirtualizerTool
replaceFirstInput
in interface VirtualizerTool
oldInput
- the old input value.replacement
- the new input value.public void addNode(ValueNode node)
VirtualizerTool
addNode
in interface VirtualizerTool
node
- the node to add.public void createVirtualObject(VirtualObjectNode virtualObject, ValueNode[] entryState, List<MonitorIdNode> locks, boolean ensureVirtualized)
VirtualizerTool
createVirtualObject
in interface VirtualizerTool
virtualObject
- 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()
VirtualizerTool
getMaximumEntryCount
in interface VirtualizerTool
public void replaceWith(ValueNode node)
VirtualizerTool
VirtualizerTool.replaceWithValue(ValueNode)
or
VirtualizerTool.replaceWithVirtual(VirtualObjectNode)
, depending on the given value.replaceWith
in interface VirtualizerTool
node
- the replacement valuepublic void addLock(VirtualObjectNode virtualObject, MonitorIdNode monitorId)
addLock
in interface VirtualizerTool
public MonitorIdNode removeLock(VirtualObjectNode virtualObject)
removeLock
in interface VirtualizerTool
public MetaAccessProvider getMetaAccess()
getMetaAccess
in interface CanonicalizerTool
public ConstantReflectionProvider getConstantReflection()
getConstantReflection
in interface CanonicalizerTool
public boolean canonicalizeReads()
canonicalizeReads
in interface CanonicalizerTool
public boolean allUsagesAvailable()
CanonicalizerTool
usages 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