Package org.jreversepro.ast.expression

Examples of org.jreversepro.ast.expression.Expression


   * net.sf.jrevpro.decompile.evaluator.AbstractInstructionEvaluator#evaluate
   * (net.sf.jrevpro.reflect.instruction.Instruction)
   */
  @Override
  void evaluate(Instruction ins) {
    Expression lhs = evalMachine.pop();

    RelationalOperator op = RelationalOperator.EQ;

    switch (ins.opcode) {
    case OPCODE_IFNULL:
View Full Code Here


    String methodType = className;
    // possibly a constructor.
    // then the type is the same as className
    List<Expression> argValues = this.getArguments(popMax);

    Expression accessTarget = evalMachine.pop();

    MethodAccessExpression mex = new InstanceMethodAccessExpression(
        accessTarget, methodName, methodType, argValues);
    evalMachine.push(mex);
  }
View Full Code Here

   * net.sf.jrevpro.decompile.evaluator.AbstractInstructionEvaluator#evaluate
   * (net.sf.jrevpro.reflect.instruction.Instruction)
   */
  @Override
  void evaluate(Instruction ins) {
    Expression rhs = evalMachine.pop();
    Expression lhs = evalMachine.pop();

    RelationalOperator op = RelationalOperator.EQ;
    switch (ins.opcode) {
    case OPCODE_IF_ICMPEQ:
    case OPCODE_IF_ACMPEQ:
View Full Code Here

   * net.sf.jrevpro.decompile.evaluator.AbstractInstructionEvaluator#evaluate
   * (net.sf.jrevpro.reflect.instruction.Instruction)
   */
  @Override
  void evaluate(Instruction ins) {
    Expression rhs = evalMachine.pop();
    Expression lhs = evalMachine.pop();

    evalMachine.conditionExpression = new ConditionExpression(lhs, rhs,
        RelationalOperator.EQ);

    evalMachine.push(Constant.VALUE_1);
View Full Code Here

    super(context);
  }

  @Override
  void evaluate(Instruction ins) {
    Expression value = evalMachine.pop();
    Expression subscript = evalMachine.pop();
    Expression arrayObject = evalMachine.pop();

    ArrayMemberReferenceExpression arr = new ArrayMemberReferenceExpression(
        arrayObject, subscript, TypeInferrer.getArrayMemberType(arrayObject
            .getType()));

    statements.append(new CompleteLine(ins, new Assignment(arr, value)));
  }
View Full Code Here

   * (net.sf.jrevpro.reflect.instruction.Instruction)
   */
  @Override
  void evaluate(Instruction ins) {
    if (ins.opcode == OPCODE_POP) {
      Expression op1 = evalMachine.pop();
      statements.append(new CompleteLine(ins, op1));
    } else if (ins.opcode == OPCODE_POP2) {
      // To Assess its use properly.
      Expression op1 = evalMachine.pop();
      if (op1.isCategory1()) {
        evalMachine.pop();
      }
    } else {
      throw new UnsupportedOperationException("Unsupported opcode");
    }
View Full Code Here

    // Equals Number of Arguments

    String methodType = TypeInferrer.getReturnType(argsList);

    List<Expression> argValues = this.getArguments(popMax);
    Expression accessTarget = evalMachine.pop();

    MethodAccessExpression mex = new InstanceMethodAccessExpression(
        accessTarget, methodName, methodType, argValues);

    if (!methodType.equals(String.valueOf(JVM_TYPE_VOID))) {
View Full Code Here

  }

  @Override
  void evaluate(Instruction ins) {
    int indexToSymbolTable = getIndexToSymbolTable(ins);
    Expression rhs = evalMachine.pop();
    Variable lhs = new Variable(varTable, rhs.getType(), indexToSymbolTable,
        ins.currentPc);

    statements.append(new CompleteLine(ins, new Assignment(lhs, rhs)));

    // Hint to the symbol table about the type.
    varTable.recordLocalDatatypeReference(indexToSymbolTable, rhs.getType(),
        ins.currentPc);

  }
View Full Code Here

  void evaluate(Instruction ins) {
    ArrayInstantiationExpression expr = null;
    switch (ins.opcode) {
    case OPCODE_NEWARRAY: {
      int atype = ins.getArgByte();
      Expression arraySize = evalMachine.pop();
      char jvmtype = JVM_TYPE_UNDEFINED;

      switch (atype) {
      case 4:
        jvmtype = JVM_TYPE_BOOLEAN;
        break;
      case 5:
        jvmtype = JVM_TYPE_CHAR;
        break;
      case 6:
        jvmtype = JVM_TYPE_FLOAT;
        break;
      case 7:
        jvmtype = JVM_TYPE_DOUBLE;
        break;
      case 8:
        jvmtype = JVM_TYPE_BYTE;
        break;
      case 9:
        jvmtype = JVM_TYPE_SHORT;
        break;
      case 10:
        jvmtype = JVM_TYPE_INT;
        break;
      case 11:
        jvmtype = JVM_TYPE_LONG;
        break;
      default:
        throw new UnsupportedOperationException("Type  " + atype
            + " not supported as argument of opcode OPCODE_NEWARRAY");
      }
      expr = new ArrayInstantiationExpression(jvmtype, arraySize);
      break;
    }
    case OPCODE_ANEWARRAY: {
      int offset = ins.getArgUnsignedShort();
      String classType = pool.getClassName(offset);

      Expression arraySize1 = evalMachine.pop();
      expr = new ArrayInstantiationExpression(classType, arraySize1);
      break;
    }
    case OPCODE_MULTIANEWARRAY: {
      int offset = ins.getArgUnsignedShort();

      // Dimensions. Max 255.
      int dimensions = ins.getArgUnsignedByte(2);
      if (dimensions > 255) {
        throw new IllegalArgumentException(
            "OPCODE_MULTIANEWARRAY: Max. Number of dimensions is 255. Received "
                + dimensions);
      }
      Expression arrayIndices[] = new Expression[dimensions];

      // ClassType
      String classType = TypeInferrer.getJLSType(pool.getClassName(offset),
          false);
View Full Code Here

  void evaluate(Instruction ins) {
    ReturnExpression expr = null;
    if (ins.opcode == OPCODE_RETURN) {
      expr = new ReturnExpression();
    } else {
      Expression op1 = evalMachine.pop();

      switch (ins.opcode) {
      case OPCODE_IRETURN:
        expr = new ReturnExpression(op1, methodReturnType);
        break;
View Full Code Here

TOP

Related Classes of org.jreversepro.ast.expression.Expression

Copyright © 2018 www.massapicom. 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.