Examples of UnconditionalFlowInfo


Examples of org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo

    flowContext.tagBits |= FlowContext.INSIDE_NEGATION; // this affects syntactic analysis for fields in EqualExpression
  FlowInfo conditionFlowInfo = argument.analyseCode(currentScope, flowContext, flowInfo.copy());
  flowContext.extendTimeToLiveForNullCheckedField(2); // survive this assert as a MessageSend and as a Statement
  flowContext.tagBits = tagBitsSave;

  UnconditionalFlowInfo assertWhenPassInfo;
  FlowInfo assertWhenFailInfo;
  boolean isOptimizedPassing;
  boolean isOptimizedFailing;
  if (passOnTrue) {
    assertWhenPassInfo = conditionFlowInfo.initsWhenTrue().unconditionalInits();
    assertWhenFailInfo = conditionFlowInfo.initsWhenFalse();
    isOptimizedPassing = isOptimizedTrueAssertion;
    isOptimizedFailing = isOptimizedFalseAssertion;
  } else {
    assertWhenPassInfo = conditionFlowInfo.initsWhenFalse().unconditionalInits();
    assertWhenFailInfo = conditionFlowInfo.initsWhenTrue();
    isOptimizedPassing = isOptimizedFalseAssertion;
    isOptimizedFailing = isOptimizedTrueAssertion;
  }
  if (isOptimizedPassing) {
    assertWhenFailInfo.setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
  }
  if (!isOptimizedFailing) {
    // if assertion is not failing for sure, only then it makes sense to carry the flow info ahead.
    // if the code does reach ahead, it means the assert didn't cause an exit, and so
    // the expression inside it shouldn't change the prior flowinfo
    // viz. org.eclipse.core.runtime.Assert.isLegal(false && o != null)
   
    // keep the merge from the initial code for the definite assignment
    // analysis, tweak the null part to influence nulls downstream
    flowInfo = flowInfo.mergedWith(assertWhenFailInfo.nullInfoLessUnconditionalCopy()).
      addInitializationsFrom(assertWhenPassInfo.discardInitializationInfo());
  }
  return flowInfo;
}
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo

    // process the action
    LoopingFlowContext loopingContext =
      new LoopingFlowContext(flowContext, flowInfo, this, this.breakLabel,
        this.continueLabel, this.scope, true);
    UnconditionalFlowInfo actionInfo =
      condInfo.nullInfoLessUnconditionalCopy();
    actionInfo.markAsDefinitelyUnknown(elementVarBinding);
    if (currentScope.compilerOptions().isAnnotationBasedNullAnalysisEnabled) {
      int elementNullStatus = FlowInfo.tagBitsToNullStatus(this.collectionElementType.tagBits);
      int nullStatus = NullAnnotationMatching.checkAssignment(currentScope, flowContext, elementVarBinding, elementNullStatus,
                                    this.collection, this.collectionElementType);
      if ((elementVarBinding.type.tagBits & TagBits.IsBaseType) == 0) {
        actionInfo.markNullStatus(elementVarBinding, nullStatus);
      }
    }
    FlowInfo exitBranch;
    if (!(this.action == null || (this.action.isEmptyBlock()
        && currentScope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_3))) {

      if (this.action.complainIfUnreachable(actionInfo, this.scope, initialComplaintLevel, true) < Statement.COMPLAINED_UNREACHABLE) {
        actionInfo = this.action.analyseCode(this.scope, loopingContext, actionInfo).unconditionalCopy();
      }

      // code generation can be optimized when no need to continue in the loop
      exitBranch = flowInfo.unconditionalCopy().
          addInitializationsFrom(condInfo.initsWhenFalse());
      // TODO (maxime) no need to test when false: can optimize (same for action being unreachable above)
      if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits &
          FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
        this.continueLabel = null;
      } else {
        actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue);
        loopingContext.complainOnDeferredFinalChecks(this.scope, actionInfo);
        exitBranch.addPotentialInitializationsFrom(actionInfo);
      }
    } else {
      exitBranch = condInfo.initsWhenFalse();
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo

    // process the action
    LoopingFlowContext loopingContext =
      new LoopingFlowContext(flowContext, flowInfo, this, this.breakLabel,
        this.continueLabel, this.scope, true);
    UnconditionalFlowInfo actionInfo =
      condInfo.nullInfoLessUnconditionalCopy();
    actionInfo.markAsDefinitelyUnknown(elementVarBinding);
    if (currentScope.compilerOptions().isAnnotationBasedNullAnalysisEnabled) {
      // this currently produces an unavoidable warning against all @NonNull element vars:
      int nullStatus = this.elementVariable.checkAssignmentAgainstNullAnnotation(currentScope, flowContext,
                              elementVarBinding, FlowInfo.UNKNOWN, this.collection, this.collectionElementType);
      // TODO (stephan):   once we have JSR 308 fetch nullStatus from the collection element type
      //                and feed the result into the above check (instead of FlowInfo.UNKNOWN)
      if ((elementVarBinding.type.tagBits & TagBits.IsBaseType) == 0) {
        actionInfo.markNullStatus(elementVarBinding, nullStatus);
      }
    }
    FlowInfo exitBranch;
    if (!(this.action == null || (this.action.isEmptyBlock()
        && currentScope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_3))) {

      if (this.action.complainIfUnreachable(actionInfo, this.scope, initialComplaintLevel, true) < Statement.COMPLAINED_UNREACHABLE) {
        actionInfo = this.action.analyseCode(this.scope, loopingContext, actionInfo).unconditionalCopy();
      }

      // code generation can be optimized when no need to continue in the loop
      exitBranch = flowInfo.unconditionalCopy().
          addInitializationsFrom(condInfo.initsWhenFalse());
      // TODO (maxime) no need to test when false: can optimize (same for action being unreachable above)
      if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits &
          FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
        this.continueLabel = null;
      } else {
        actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue);
        loopingContext.complainOnDeferredFinalChecks(this.scope, actionInfo);
        exitBranch.addPotentialInitializationsFrom(actionInfo);
      }
    } else {
      exitBranch = condInfo.initsWhenFalse();
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo

    flowContext.tagBits |= FlowContext.INSIDE_NEGATION; // this affects syntactic analysis for fields in EqualExpression
  FlowInfo conditionFlowInfo = argument.analyseCode(currentScope, flowContext, flowInfo.copy());
  flowContext.extendTimeToLiveForNullCheckedField(2); // survive this assert as a MessageSend and as a Statement
  flowContext.tagBits = tagBitsSave;

  UnconditionalFlowInfo assertWhenPassInfo;
  FlowInfo assertWhenFailInfo;
  boolean isOptimizedPassing;
  boolean isOptimizedFailing;
  if (passOnTrue) {
    assertWhenPassInfo = conditionFlowInfo.initsWhenTrue().unconditionalInits();
    assertWhenFailInfo = conditionFlowInfo.initsWhenFalse();
    isOptimizedPassing = isOptimizedTrueAssertion;
    isOptimizedFailing = isOptimizedFalseAssertion;
  } else {
    assertWhenPassInfo = conditionFlowInfo.initsWhenFalse().unconditionalInits();
    assertWhenFailInfo = conditionFlowInfo.initsWhenTrue();
    isOptimizedPassing = isOptimizedFalseAssertion;
    isOptimizedFailing = isOptimizedTrueAssertion;
  }
  if (isOptimizedPassing) {
    assertWhenFailInfo.setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
  }
  if (!isOptimizedFailing) {
    // if assertion is not failing for sure, only then it makes sense to carry the flow info ahead.
    // if the code does reach ahead, it means the assert didn't cause an exit, and so
    // the expression inside it shouldn't change the prior flowinfo
    // viz. org.eclipse.core.runtime.Assert.isLegal(false && o != null)
   
    // keep the merge from the initial code for the definite assignment
    // analysis, tweak the null part to influence nulls downstream
    flowInfo = flowInfo.mergedWith(assertWhenFailInfo.nullInfoLessUnconditionalCopy()).
      addInitializationsFrom(assertWhenPassInfo.discardInitializationInfo());
  }
  return flowInfo;
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.