Examples of StackElement


Examples of bytecodeparser.analysis.stack.StackElement

          result[nbParams - 1] = getLocalVariableName(varargs[i]) + "(" + varargs[i] + ")";
        }
        stackIndex++;
      }
      while(nbParams > 0) {
        StackElement se = frame.stackBefore.stack.get(stackIndex++);
        if(se instanceof TOP)
          se = frame.stackBefore.stack.get(stackIndex++);
        result[nbParams - 1] = getLocalVariableName(se) + "(" + se + ")";
        nbParams--;
      }
View Full Code Here

Examples of bytecodeparser.analysis.stack.StackElement

 
  @Override
  public void simulate(Stack stack) {
    int size = -1;
    if(dimensions == 1) {
      StackElement se = stack.pop();
      if(se instanceof IntegerConstant) {
        IntegerConstant ic = (IntegerConstant) se;
        size = ic.getValue();
      }
    } else {
View Full Code Here

Examples of bytecodeparser.analysis.stack.StackElement

  }
 
  @Override
  public void simulate(Stack stack) {
    boolean isAutoboxing = isAutoboxing();
    StackElement se = null;
    for(int i = 0; i < pops.length; i++) {
      if(pops[i] == DOUBLE)
        se = stack.pop2();
      else se = stack.pop();
    }
    if(op.as(MethodInvocationOpcode.class).isInstanceMethod())
      stack.pop();
    if(returnTypeLength != null) {
      if(returnTypeLength == DOUBLE)
        stack.push2(isAutoboxing ? se.copy() : new Whatever());
      else stack.push(isAutoboxing ? se.copy() : new Whatever());
    }
  }
View Full Code Here

Examples of bytecodeparser.analysis.stack.StackElement

        TrackableArray trackableArray = (TrackableArray) frame.stackBefore.stack.get(stackIndex);
        varargs = resolveParameters(Arrays.asList(trackableArray.elements), trackableArray.elements.length, true);
      }
    }
    if(decoded.op.as(MethodInvocationOpcode.class).isInstanceMethod()) {
      StackElement subjectSE = frame.stackBefore.stack.get(StackElementLength.add(decoded.pops));
      LocalVariable lv = getLocalVariableIfAvailable(subjectSE);
      return new MethodParams(lv != null ? new MethodParam(lv.name, lv.type) : new MethodParam(null, null), params, varargs);
    }
    return new MethodParams(null, params, varargs);
  }
View Full Code Here

Examples of bytecodeparser.analysis.stack.StackElement

  private static MethodParam[] resolveParameters(final Iterable<StackElement> stack, final int elements, boolean reverse) {
    MethodParam[] result = new MethodParam[elements];
    Iterator<StackElement> it = stack.iterator();
    int i = 0;
    while(it.hasNext() && i < elements) {
      StackElement se = it.next();
      if(se instanceof TOP)
        se = it.next();
      LocalVariable lv = getLocalVariableIfAvailable(se);
      if(lv != null) {
        result[reverse ? i : elements - i - 1] = new MethodParam(lv.name, lv.type);
View Full Code Here

Examples of bytecodeparser.analysis.stack.StackElement

  @Override
  public void simulate(Stack stack) {
    if(op.code != Opcode.IINC) {
      ValueFromLocalVariable toPush = new ValueFromLocalVariable(localVariable);
      if(!load) {
        StackElement poppedSe;
        if(doubleLength)
          poppedSe = stack.pop2();
        else poppedSe = stack.pop();
        /* when a name is null while LocalVariableTable is present, it is likely that this class has been
         * previously enhanced and this local variable is just a variable proxy, so grab the original local
View Full Code Here

Examples of bytecodeparser.analysis.stack.StackElement

  }
  @Override
  public void simulate(Stack stack) {
    if(!this.op.as(ArrayOpcode.class).isLoad) {
      StackElementLength[] pops = Arrays.copyOf(getPops(), getPops().length - 1);
      StackElement subject = stack.getFromTop(StackElementLength.add(pops));
      if(subject instanceof TrackableArray) {
        TrackableArray array = (TrackableArray) subject;
        StackElement i = stack.getFromTop(StackElementLength.add(array.componentLength));
        if(i instanceof IntegerConstant) {
          StackElement value = stack.peek(array.componentLength);
          array.set(((IntegerConstant) i).getValue(), value);
        } else {
          array.isDirty = true;
        }
      }
View Full Code Here

Examples of net.sf.joafip.store.entity.proxy.StackElement

    return interprete(OPCODE_DESC_ARRAY[opcode], currentStackElement);
  }

  private StackElement interprete(final OpcodeDesc opcodeDesc,
      final StackElement currentStackElement) throws EnhanceException {
    StackElement pointer = currentStackElement;
    final EnumType[] popTypes = opcodeDesc.getPopTypes();
    for (int index = popTypes.length - 1; index >= 0; index--) {
      pointer = pop(pointer, popTypes[index]);
    }
    final EnumType pushType = opcodeDesc.getPushType();
View Full Code Here

Examples of net.sf.joafip.store.entity.proxy.StackElement

    EnumStackEltType stackEltType = pointer.getType();
    if (!stackEltType.equals(type.getLowType())) {
      throw new EnhanceException("type mismatch " + stackEltType
          + " in the stack for " + type.getLowType() + " expected");
    }
    StackElement newPointer = pointer.getPrevious();
    if (type.getCategory() == 2) {
      if (newPointer == null) {
        throw new EnhanceException(EMPTY_STACK);
      }
      stackEltType = newPointer.getType();
      if (!stackEltType.equals(type.getHighType())) {
        throw new EnhanceException("type mismatch " + stackEltType
            + " in the stack for " + type.getHighType()
            + " expected");
      }
      newPointer = newPointer.getPrevious();
    }
    return newPointer;
  }
View Full Code Here

Examples of net.sf.joafip.store.entity.proxy.StackElement

    return newPointer;
  }

  private StackElement push(final StackElement pointer,
      final EnumType pushType) {
    final StackElement previous;
    if (pushType.getCategory() == 2) {
      previous = new StackElement(pointer, pushType.getHighType());
    } else {
      previous = pointer;
    }
    return new StackElement(previous, pushType.getLowType());
  }
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.