Examples of StatementIntermediate


Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

    else {
      //if it is currently not declared... create the declaration.
      left = new Declaration(context.getCurrentInstruction(), variable, assignment);
    }
   
    StatementIntermediate cl = new StatementIntermediate(context.getCurrentInstruction(), left);
    context.pushIntermediateToInstruction(cl);

    LOG.debug("Stored.");
  }
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

    Expression arrayReference = context.getExpressions().pop();
   
    ArrayAccess arrayPositionReference = new ArrayAccess(context.getCurrentInstruction(), arrayReference, arrayPosition);
    Assignment assignment = new Assignment(context.getCurrentInstruction(), arrayPositionReference, value);
   
    StatementIntermediate si = new StatementIntermediate(context.getCurrentInstruction(), assignment);
   
    //add it to the intermediate lines.
    context.pushIntermediateToInstruction(si);
  }
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

     
    }
  }
 
  public void collectConstantAssignments(AbstractIntermediate current, Map<Integer, Expression> assignments) {
    StatementIntermediate si = (StatementIntermediate)current;
   
    //get the assignment...
    Assignment assignment = extractConstantArrayAssignment(si.getExpression());
    if(assignment == null) {
      return;
    }
   
    Expression right = assignment.getRightHandSide();
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

   
    if(!(successors.get(0) instanceof StatementIntermediate)) {
      return null;
    }
   
    StatementIntermediate si = (StatementIntermediate)successors.get(0);
   
    if(si.getExpression() instanceof Declaration)  {
      return (Declaration)si.getExpression();
    }
   
    return null;
  }
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

 
  public void visitATHROW(ATHROW instruction) {
    Expression expression = context.getExpressions().pop();
    Throw throwException = new Throw(context.getCurrentInstruction(), expression);
   
    StatementIntermediate complete = new StatementIntermediate(context.getCurrentInstruction(), throwException);
    context.pushIntermediateToInstruction(complete);
  }
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

  public void visitWhileIntermediate(WhileIntermediate line) {
    List<AbstractIntermediate> predecessors = Graphs.predecessorListOf(igc.getGraph(), line);
   
    //look at the predecessor lines;  validate there are only 2 predecessors.
    if(predecessors.size() == 2) {
      StatementIntermediate declaration = null;
      StatementIntermediate iteration = null;
     
      for(AbstractIntermediate predecessor : predecessors) {
        if(comparator.before(predecessor, line)) {
          //should be declaration.
         
          if(predecessor instanceof StatementIntermediate) {
            declaration = (StatementIntermediate)predecessor;
            continue;
          }
          else {
            //the line before the while should be a statement if this is
            //a for loop.
            return;
          }
        }
       
        //if the
        if(comparator.after(predecessor, line)) {
         
          if(predecessor instanceof StatementIntermediate) {
            iteration = (StatementIntermediate)predecessor;
          }
          else {
            return;
          }
        }
      }
     
      //at this point, both should be set.
      if(declaration != null && iteration != null) {
        //now, check the expression and validate these are correct via AST.
       
        if(declaration.getExpression() instanceof Declaration) {
          Declaration declarationExpression = (Declaration)declaration.getExpression();
         
          if(iteration.getExpression() instanceof Increment) {
            Increment incrementExpression = (Increment)iteration.getExpression();
           
            if(incrementExpression.getVariable().getType().equals(declarationExpression.getVariable().getType())) {
             
              //now check names.
              if(incrementExpression.getVariable().getName().equals(declarationExpression.getVariable().getName())) {
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

      }
    }
   
    //great; at this point we know the pattern matches.  check the next statement to see if the transformation is possible.
    //format should be: 40 : GENERATED_ARRAY_REFERENCE_TYPE i = GENERATED_ARRAY_REFERENCE[ARRAY_ITERATOR_VALUE] |
    StatementIntermediate childDeclarationStatement = ((StatementIntermediate)firstChild);
    Declaration childDeclaration = (Declaration)childDeclarationStatement.getExpression();
   
    if(firstMatchesGeneratedVariables(childDeclarationStatement, generatedArrayReference, arrayIteratorValue)) {
     
      LOG.debug("Likely a enhanced for loop for array: "+generatedArrayLength + " , "+ generatedArrayReference);
     
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

    }
  }
 
  private Expression extractExpressionFromGeneratedArrayAssignment(AbstractIntermediate declaration) {
    if(declaration instanceof StatementIntermediate) {
      StatementIntermediate si = (StatementIntermediate)declaration;
     
      Declaration dec = (Declaration)si.getExpression();
      return dec.getAssignment().getRightHandSide();
    }
   
    return null;
  }
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

    return null;
  }
 
  private GeneratedVariable extractGeneratedVariableDeclaration(AbstractIntermediate declaration) {
    if(declaration instanceof StatementIntermediate) {
      StatementIntermediate si = (StatementIntermediate)declaration;
      return extractGeneratedVariableDeclaration(si.getExpression());
    }
   
    return null;
  }
View Full Code Here

Examples of org.candle.decompiler.intermediate.code.StatementIntermediate

    AbstractIntermediate catchDeclaration = igc.getOrderedIntermediate().ceiling(new NullIntermediate(ceg.getHandlerPC()));
   
    LOG.debug("Catch Declaration:"+catchDeclaration);
   
    if(catchDeclaration instanceof StatementIntermediate) {
      StatementIntermediate declarationStatement = (StatementIntermediate)catchDeclaration;
      if(declarationStatement.getExpression() instanceof Declaration) {
        Declaration declaration = (Declaration)declarationStatement.getExpression();
       
        //now, we can convert this into a catch block.
        CatchIntermediate catchIntermediate = new CatchIntermediate(declarationStatement.getInstruction(), ceg, declaration.getVariable());
        igc.getGraph().addVertex(catchIntermediate);
       
        //redirect statement to catch.
        igc.redirectPredecessors(declarationStatement, catchIntermediate);
        igc.redirectSuccessors(declarationStatement, catchIntermediate);
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.