public boolean canBeDeletedFromScope(IRScope s) { if (!isDeletable()) { return false; } if (this instanceof ResultInstr) { Variable r = ((ResultInstr) this).getResult(); // An escaped binding needs to preserve lvars since // consumers of that binding may access lvars. if (s.bindingHasEscaped()) return !(r instanceof LocalVariable); } return true; }
public boolean canBeDeletedFromScope(IRScope s) { if (!isDeletable()) { return false; } if (this instanceof ResultInstr) { Variable r = ((ResultInstr) this).getResult(); // An escaped binding needs to preserve lvars since // consumers of that binding may access lvars. if (s.bindingHasEscaped()) return !(r instanceof LocalVariable); } return true; }
public boolean needsFrame() { boolean bindingHasEscaped = bindingHasEscaped(); boolean requireFrame = bindingHasEscaped || usesEval(); for (IRFlags flag : getFlags()) { switch (flag) { case BINDING_HAS_ESCAPED: case CAN_CAPTURE_CALLERS_BINDING: case REQUIRES_LASTLINE: case REQUIRES_BACKREF: case REQUIRES_VISIBILITY: case REQUIRES_BLOCK: case REQUIRES_SELF: case REQUIRES_METHODNAME: case REQUIRES_CLASS: case USES_EVAL: case USES_ZSUPER: requireFrame = true; } } return requireFrame; }
public boolean needsFrame() { boolean bindingHasEscaped = bindingHasEscaped(); boolean requireFrame = bindingHasEscaped || usesEval(); for (IRFlags flag : getFlags()) { switch (flag) { case BINDING_HAS_ESCAPED: case CAN_CAPTURE_CALLERS_BINDING: case REQUIRES_LASTLINE: case REQUIRES_BACKREF: case REQUIRES_VISIBILITY: case REQUIRES_BLOCK: case REQUIRES_SELF: case REQUIRES_METHODNAME: case REQUIRES_CLASS: case USES_EVAL: case USES_ZSUPER: requireFrame = true; } } return requireFrame; }
@Override public void applyPreMeetHandler() { in = new BitSet(setSize); if (basicBlock.isExitBB()) { Collection<LocalVariable> lv = problem.getVarsLiveOnScopeExit(); if (lv != null && !lv.isEmpty()) { for (Variable v: lv) { in.set(problem.getDFVar(v)); } } // If this scope's binding has escaped, all variables // should be considered live on exit from the scope. if (problem.getScope().bindingHasEscaped()) { for (Variable x: problem.getNonSelfLocalVars()) { in.set(problem.getDFVar(x)); } } } // System.out.println("Init state for BB " + basicBlock.getID() + " is " + toString()); }
@Override public void applyPreMeetHandler() { in = new BitSet(setSize); if (basicBlock.isExitBB()) { Collection<LocalVariable> lv = problem.getVarsLiveOnScopeExit(); if (lv != null && !lv.isEmpty()) { for (Variable v: lv) { in.set(problem.getDFVar(v)); } } // If this scope's binding has escaped, all variables // should be considered live on exit from the scope. if (problem.getScope().bindingHasEscaped()) { for (Variable x: problem.getNonSelfLocalVars()) { in.set(problem.getDFVar(x)); } } } // System.out.println("Init state for BB " + basicBlock.getID() + " is " + toString()); }
@Override public void applyTransferFunction(Instr i) { IRScope scope = problem.getScope(); boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
@Override public void applyTransferFunction(Instr i) { IRScope scope = problem.getScope(); boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
public boolean applyTransferFunction() { IRScope scope = problem.getScope(); boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
public boolean applyTransferFunction() { IRScope scope = problem.getScope(); boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
public boolean applyTransferFunction() { IRScope scope = problem.getScope(); boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
void markDeadInstructions() { boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
@Override public void applyTransferFunction(Instr i) { boolean scopeBindingHasEscaped = problem.getScope().bindingHasEscaped();
@Override public void applyTransferFunction(Instr i) { boolean scopeBindingHasEscaped = problem.getScope().bindingHasEscaped();
void markDeadInstructions() { boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
public boolean canBeDeleted(IRScope s) { if (hasSideEffects() || getOperation().isDebugOp() || getOperation().canRaiseException() || transfersControl()) { return false; } else if (this instanceof ResultInstr) { Variable r = ((ResultInstr)this).getResult(); if (s.bindingHasEscaped() && !r.getName().equals(Variable.BLOCK)) { // If the binding of this scope has escaped, then we have to preserve writes to // all local variables because anyone who uses the binding might query any of the // local variables from the binding. This is safe, but extremely conservative. return !(r instanceof LocalVariable); } else if (s.usesEval() && r.getName().equals(Variable.BLOCK)) { // If this scope (or any nested scope) has any evals, then the eval might have a yield which // would use %block. In that scenario, we cannot delete the '%block = recv_closure' instruction. // This is safe, but conservative. return false; } else if (s.usesZSuper() && getOperation().isArgReceive()) { // If this scope (or any nested scope) has a ZSuperInstr, then the arguments of this // scope could be used by any of those ZSuper instructions. If so, we cannot delete // the argument receive. return false; } else { return true; } } else { return true; } }
public boolean canBeDeleted(IRScope s) { if (hasSideEffects() || getOperation().isDebugOp() || getOperation().canRaiseException() || transfersControl()) { return false; } else if (this instanceof ResultInstr) { Variable r = ((ResultInstr)this).getResult(); if (s.bindingHasEscaped() && !r.getName().equals(Variable.BLOCK)) { // If the binding of this scope has escaped, then we have to preserve writes to // all local variables because anyone who uses the binding might query any of the // local variables from the binding. This is safe, but extremely conservative. return !(r instanceof LocalVariable); } else if (s.usesEval() && r.getName().equals(Variable.BLOCK)) { // If this scope (or any nested scope) has any evals, then the eval might have a yield which // would use %block. In that scenario, we cannot delete the '%block = recv_closure' instruction. // This is safe, but conservative. return false; } else if (s.usesZSuper() && getOperation().isArgReceive()) { // If this scope (or any nested scope) has a ZSuperInstr, then the arguments of this // scope could be used by any of those ZSuper instructions. If so, we cannot delete // the argument receive. return false; } else { return true; } } else { return true; } }
if (scope.bindingHasEscaped() || scope.usesBackrefOrLastline() || scopeHasLocalVarStores || scopeHasUnrescuedExceptions) {
boolean scopeBindingHasEscaped = scope.bindingHasEscaped();
boolean scopeBindingHasEscaped = scope.bindingHasEscaped();