Пример #1
0
 @Override
 public void createVirtualObject(
     VirtualObjectNode virtualObject, ValueNode[] entryState, int[] locks) {
   VirtualUtil.trace("{{%s}} ", current);
   if (virtualObject.isAlive()) {
     state.addAndMarkAlias(virtualObject, virtualObject, usages);
   } else {
     effects.addFloatingNode(virtualObject, "newVirtualObject");
   }
   for (int i = 0; i < entryState.length; i++) {
     entryState[i] = state.getScalarAlias(entryState[i]);
   }
   state.addObject(
       virtualObject, new ObjectState(virtualObject, entryState, EscapeState.Virtual, locks));
   state.addAndMarkAlias(virtualObject, virtualObject, usages);
   PartialEscapeClosure.METRIC_ALLOCATION_REMOVED.increment();
 }
Пример #2
0
 @Override
 public void replaceWithVirtual(VirtualObjectNode virtual) {
   state.addAndMarkAlias(virtual, current, usages);
   if (current instanceof FixedWithNextNode) {
     effects.deleteFixedNode((FixedWithNextNode) current);
   }
   deleted = true;
 }
Пример #3
0
 @Override
 public void setVirtualEntry(State objectState, int index, ValueNode value) {
   ObjectState obj = (ObjectState) objectState;
   assert obj != null && obj.isVirtual() : "not virtual: " + obj;
   ObjectState valueState = state.getObjectState(value);
   ValueNode newValue = value;
   if (valueState == null) {
     newValue = getReplacedValue(value);
     assert obj.getEntry(index) == null
         || obj.getEntry(index).kind() == newValue.kind()
         || (isObjectEntry(obj.getEntry(index)) && isObjectEntry(newValue));
   } else {
     if (valueState.getState() != EscapeState.Virtual) {
       newValue = valueState.getMaterializedValue();
       assert newValue.kind() == Kind.Object;
     } else {
       newValue = valueState.getVirtualObject();
     }
     assert obj.getEntry(index) == null || isObjectEntry(obj.getEntry(index));
   }
   obj.setEntry(index, newValue);
 }
Пример #4
0
 @Override
 public State getObjectState(ValueNode value) {
   return state.getObjectState(value);
 }
Пример #5
0
 @Override
 public void replaceWithValue(ValueNode replacement) {
   effects.replaceAtUsages(current, state.getScalarAlias(replacement));
   state.addScalarAlias(current, replacement);
   deleted = true;
 }
Пример #6
0
 @Override
 public ValueNode getReplacedValue(ValueNode original) {
   return state.getScalarAlias(original);
 }
Пример #7
0
 @Override
 public ValueNode getMaterializedValue(ValueNode value) {
   ObjectState obj = state.getObjectState(value);
   return obj != null && !obj.isVirtual() ? obj.getMaterializedValue() : null;
 }