Examples of Instruction


Examples of net.sf.rej.java.instruction.Instruction

      Code code = codeAttr.getCode();
      DecompilationContext dc = code.createDecompilationContext();
      List instructions = code.getInstructions();
      dc.setPosition(0);
      for (int j = 0; j < instructions.size(); j++) {
        Instruction instruction = (Instruction) instructions.get(j);

        if (instruction instanceof Label) {
          LabelRow lr = new LabelRow((Label) instruction, mdr);
          lr.setParentCode(code);
          list.add(lr);
View Full Code Here

Examples of objot.bytecode.Instruction

    Procedure p = new Procedure(cons);
    p.setModifier(Mod2.FINAL);
    p.setNameCi(cons.getCprocName(get0Ci));
    p.setDescCi(cons.getCprocDesc(get0Ci));
    int i0 = csn - 1;
    Instruction s = new Instruction(cons, 250);
    s.ins0(ALOAD0); // this
    s.ins0(ILOAD1);
    long sw = s.insSwitchTable( -i0, i0);
    s.switchTableHere(sw, -1);
    s.switchTableHere(sw, i0);
    int sw0 = s.addr;
    s.ins0(ACONSTNULL);
    s.ins0(ARETURN);

    int swObj = s.addr;
    s.insU2(GETSTATIC, ossCi);
    s.ins0(ILOAD1);
    s.ins0(AALOAD);
    s.ins0(ICONST0);
    s.ins0(AALOAD); // oss[i][0]
    s.ins0(ARETURN);
    int swObj_ = s.addr;
    s.insU2(GETSTATIC, ossCi);
    s.ins0(ILOAD1);
    s.ins0(INEG);
    s.ins0(AALOAD);
    s.ins0(ICONST0);
    s.ins0(AALOAD); // oss[-i][0]
    s.ins0(ARETURN);
    int circle = s.addr;
    s.insU2(NEW, cons.addClass(ClassCircularityError.class));
    s.ins0(DUPI);
    s.ins0(SWAP);
    s.insU2(INVOKESPECIAL, cons.addProc(Class2.ctor(ClassCircularityError.class,
      String.class)));
    s.ins0(ATHROW);

    int maxParamN = 0;
    for (int i = 1; i < csn; i++) // always actual bind
    {
      Bind.Clazz c = cs[i];
      maxParamN = Math.max(maxParamN, c.maxParamN);
      if (c.cla == Container.class)
      {
        s.switchTableHere(sw, i0 + i);
        s.switchTable(sw, i0 - i, sw0); // never happen
        s.ins0(ARETURN);
      }
      else if (c.mode == null) // static object
      {
        s.switchTable(sw, i0 + i, oss[i][0] == null ? sw0 : swObj);
        s.switchTable(sw, i0 - i, oss[i][0] == null ? sw0 : swObj_);
      }
      else if (c.t != null) // New and Single
      {
        s.switchTableHere(sw, i0 + i);
        if (c.mode == Single.class)
        {
          s.ins0(DUP);
          s.insU2(GETFIELD, fCis[i]);
          s.ins0(DUP);
          int j = s.insJump(IFNULL);
          s.ins0(ARETURN);
          s.jumpHere(j);
          s.ins0(POP);
        }
        s.switchTableHere(sw, i0 - i);
        s.insU2(NEW, cons.putClass(c.cla));
        s.ins0(DUP);
        int x = 1;
        for (int cb = 0; cb < c.t.ps.length; cb++)
          x = makeGet0_fp(i, s, c.t.ps[cb], oss[i], x);
        s.insU2(INVOKESPECIAL, cons.putProc(c.t.t));
        if (c.mode == Single.class)
        {
          s.ins0(ILOAD1);
          int j = s.insJump(IFIL0);
          if (c.t.ps.length > 0)
          { // never happen if ctor no parameter
            s.ins0(ALOAD0);
            s.insU2(GETFIELD, fCis[i]);
            int jj = s.insJump(IFNULL);
            s.insU2(LDCW, cons.addString(c.cla.getName()));
            s.jump(s.insJump(GOTO), circle);
            s.jumpHere(jj);
          }
          s.ins0(DUP);
          s.ins0(ALOAD0);
          s.ins0(SWAP); // o, this, o
          s.insU2(PUTFIELD, fCis[i]); // single
          s.jumpHere(j);
        }
        for (Bind.FM fm: c.fms)
          if (fm.f != null)
          {
            s.ins0(DUP);
            x = makeGet0_fp(i, s, fm, oss[i], x);
            s.insU2(PUTFIELD, cons.addField(fm.f));
          }
          else
          {
            s.ins0(DUP);
            for (Bind mp: fm.ps)
              x = makeGet0_fp(i, s, mp, oss[i], x);
            s.insU2(INVOKEVIRTUAL, cons.addProc(fm.m));
          }
        s.ins0(ARETURN);
      }
      else if (c.mode == Set.class)
      {
        s.switchTableHere(sw, i0 + i);
        s.switchTableHere(sw, i0 - i);
        s.insU2(GETFIELD, fCis[i]);
        s.ins0(ARETURN);
      }
      else if (c.mode == Parent.class)
      {
        s.switchTableHere(sw, i0 - i);
        s.ins0(DUP);
        s.insU2(GETFIELD, fCis[i]);
        s.ins0(DUP);
        int j = s.insJump(IFNULL);
        s.ins0(ARETURN);
        s.jumpHere(j);
        s.ins0(POP);

        s.switchTableHere(sw, i0 + i);
        int loop = s.addr; // n
        s.insU2(GETFIELD, parentCi); // n
        s.ins0(DUP);
        s.insU2(LDCW, cCis[i]);
        s.insU2(INVOKEVIRTUAL, indexCi); // n, j
        s.ins0(DUP);
        s.ins0(ISTORE2);
        s.jump(s.insJump(IFIE0), loop);
        s.ins0(ILOAD1);
        j = s.insJump(IFIL0);
        s.ins0(ILOAD2);
        s.ins0(INEG); // -j
        s.insU2(INVOKEVIRTUAL, get0Ci); // get0
        s.ins0(ARETURN);
        s.jumpHere(j);

        s.ins0(ILOAD2); // j
        s.insU2(INVOKEVIRTUAL, get0Ci); // get0
        s.ins0(DUP);
        s.ins0(ILOAD2);
        j = s.insJump(IFIL0);
        s.ins0(ALOAD0);
        s.ins0(SWAP); // o, this, o
        s.insU2(PUTFIELD, fCis[i]); // cache
        s.ins0(ARETURN);
        s.jumpHere(j);
        s.ins0(ARETURN);
      }
      else
        throw new AssertionError();
    }
    p.getCode().setIns(s, false);
View Full Code Here

Examples of org.apache.bcel.generic.Instruction

        logger.info("Found a logger instruction.");
        InstructionHandle lastLogHandle = handle;

        InvokeInstruction invokeInterface = null;
        Instruction inst = null;
        while (true) {
            handle = handle.getNext();
            if (handle == null) {
                logger.warn("No matching invokeInterface found.");
                throw new NoMatchingInvokeInterfaceInstruction("No matching invokeInterface found.");
View Full Code Here

Examples of org.apache.bcel.generic.Instruction

                    + " is a special method and won't be modified.");
            return orig;
        }
        InstructionList il = null;
        InstructionHandle handle = null;
        Instruction inst = null;

        GETSTATIC getStatic = null;

        Method m = null;

        try {
            il = mg.getInstructionList();
            handle = il.getStart();
            if (level_enters == SIMPLEENTER) {

                insertEnter(mg, il, handle, cp);
                insertFork(il, il.getStart(), handle.getPrev(), cp);
            }

            for (; handle != null; handle = handle.getNext()) {
                inst = handle.getInstruction();
                logger.info("next instruction: " + inst);
                if (level_exits == SIMPLEEXIT
                    && inst instanceof ReturnInstruction) {
                    InstructionHandle lastLogHandle = handle;
                    logger.info(
                        "Found a ReturnInstruction of type: "
                            + inst.toString());
                    int stackSize =
                        inst.consumeStack(cp) - inst.produceStack(cp);
                    while (stackSize != 0) {
                        handle = handle.getPrev();
                        inst = handle.getInstruction();
                        logger.info("prev instruction: " + inst);
                        stackSize += inst.consumeStack(cp)
                            - inst.produceStack(cp);
                    }

                    InstructionHandle insertHandle =
                        insertExit(mg, il, handle, cp);
                    if (insertHandle != null) {
View Full Code Here

Examples of org.apache.cocoon.template.instruction.Instruction

    public void endElement(String namespaceURI, String localName, String raw)
            throws SAXException {
        Event start = (Event) stack.pop();
        Event newEvent = null;
        if (start instanceof Instruction) {
            Instruction startInstruction = (Instruction) start;
            EndInstruction endInstruction = new EndInstruction(locator,
                    startInstruction);
            newEvent = endInstruction;
            addEvent(newEvent);
            startInstruction.endNotify();
        } else {
            StartElement startElement = (StartElement) start;
            newEvent = new EndElement(locator, startElement);
            startElement.setEndElement((EndElement) newEvent);
            addEvent(newEvent);
View Full Code Here

Examples of org.apache.flex.abc.semantics.Instruction

            InstructionList result = createInstructionList(iNode);

            result.addAll(replicate(this.runtimeQualifier));

            //  Ensure the last instruction is an OP_coerce to Namespace.
            Instruction last = result.lastElement();

            if  (
                    last.getOpcode() != OP_coerce ||
                    last.getOperandCount() == 0 ||
                    ! namespaceType.equals(last.getOperand(0))
                )
            {
                result.addInstruction(OP_coerce, namespaceType);
            }
View Full Code Here

Examples of org.aspectj.apache.bcel.generic.Instruction

    int depth = 1;
    InstructionHandle ih = range.getStart();

    // Go back from where we are looking for 'NEW' that takes us to a stack depth of 0. INVOKESPECIAL <init>
    while (true) {
      Instruction inst = ih.getInstruction();
      if (inst.opcode == Constants.INVOKESPECIAL && ((InvokeInstruction) inst).getName(cpg).equals("<init>")) {
        depth++;
      } else if (inst.opcode == Constants.NEW) {
        depth--;
        if (depth == 0) {
View Full Code Here

Examples of org.aspectj.apache.bcel.generic.Instruction

  private BcelVar generateReturnInstructions(List<InstructionHandle> returns, InstructionList returnInstructions) {
    BcelVar returnValueVar = null;
    if (this.hasANonVoidReturnType()) {
      // Find the last *correct* return - this is a method with a non-void return type
      // so ignore RETURN
      Instruction newReturnInstruction = null;
      int i = returns.size() - 1;
      while (newReturnInstruction == null && i >= 0) {
        InstructionHandle ih = returns.get(i);
        if (ih.getInstruction().opcode != Constants.RETURN) {
          newReturnInstruction = Utility.copyInstruction(ih.getInstruction());
        }
        i--;
      }
      returnValueVar = genTempVar(this.getReturnType());
      returnValueVar.appendLoad(returnInstructions, getFactory());
      returnInstructions.append(newReturnInstruction);
    } else {
      InstructionHandle lastReturnHandle = returns.get(returns.size() - 1);
      Instruction newReturnInstruction = Utility.copyInstruction(lastReturnHandle.getInstruction());
      returnInstructions.append(newReturnInstruction);
    }
    return returnValueVar;
  }
View Full Code Here

Examples of org.aspectj.apache.bcel.generic.Instruction

      InstructionHandle curr = localAdviceMethod.getBody().getStart();
      InstructionHandle end = localAdviceMethod.getBody().getEnd();
      ConstantPool cpg = localAdviceMethod.getEnclosingClass().getConstantPool();
      while (curr != end) {
        InstructionHandle next = curr.getNext();
        Instruction inst = curr.getInstruction();
        if ((inst.opcode == Constants.INVOKESTATIC) && proceedName.equals(((InvokeInstruction) inst).getMethodName(cpg))) {

          localAdviceMethod.getBody().append(curr,
              getRedoneProceedCall(fact, extractedShadowMethod, munger, localAdviceMethod, proceedVarList));
          Utility.deleteInstruction(curr, localAdviceMethod);
        }
        curr = next;
      }
      // and that's it.
    } else {
      // ATAJ inlining support for @AJ aspects
      // [TODO document @AJ code rule: don't manipulate 2 jps proceed at the same time.. in an advice body]
      InstructionHandle curr = localAdviceMethod.getBody().getStart();
      InstructionHandle end = localAdviceMethod.getBody().getEnd();
      ConstantPool cpg = localAdviceMethod.getEnclosingClass().getConstantPool();
      while (curr != end) {
        InstructionHandle next = curr.getNext();
        Instruction inst = curr.getInstruction();
        if ((inst instanceof INVOKEINTERFACE) && "proceed".equals(((INVOKEINTERFACE) inst).getMethodName(cpg))) {
          final boolean isProceedWithArgs;
          if (((INVOKEINTERFACE) inst).getArgumentTypes(cpg).length == 1) {
            // proceed with args as a boxed Object[]
            isProceedWithArgs = true;
View Full Code Here

Examples of org.aspectj.apache.bcel.generic.Instruction

      InstructionHandle curr = adviceMethod.getBody().getStart();
      InstructionHandle end = adviceMethod.getBody().getEnd();
      ConstantPool cpg = adviceMethod.getEnclosingClass().getConstantPool();
      while (curr != end) {
        InstructionHandle next = curr.getNext();
        Instruction inst = curr.getInstruction();
        if ((inst instanceof InvokeInstruction)
            && ((InvokeInstruction) inst).getSignature(cpg).indexOf("Lorg/aspectj/lang/ProceedingJoinPoint;") > 0) {
          // we may want to refine to exclude stuff returning jp ?
          // does code style skip inline if i write dump(thisJoinPoint) ?
          canSeeProceedPassedToOther = true;// we see one pjp passed around - dangerous
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.