Examples of Instruction


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

    Type jlClass = BcelWorld.makeBcelType(UnresolvedType.JL_CLASS);
    Type jlString = BcelWorld.makeBcelType(UnresolvedType.JL_STRING);
    Type jlClassArray = BcelWorld.makeBcelType(UnresolvedType.JAVA_LANG_CLASS_ARRAY);
    Type jlaAnnotation = BcelWorld.makeBcelType(UnresolvedType.JAVA_LANG_ANNOTATION);

    Instruction pushConstant = fact.createConstant(new ObjectType(toType.getName()));

    if (kind == Shadow.MethodCall || kind == Shadow.MethodExecution || kind == Shadow.PreInitialization
        || kind == Shadow.Initialization || kind == Shadow.ConstructorCall || kind == Shadow.ConstructorExecution
        || kind == Shadow.AdviceExecution ||
        // annotations for fieldset/fieldget when an ITD is involved are stored against a METHOD
View Full Code Here

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

    } else if (fromType.isPrimitiveType()) {
      // assert toType.isPrimitive()
      Type from = BcelWorld.makeBcelType(fromType);
      Type to = BcelWorld.makeBcelType(toType);
      try {
        Instruction i = fact.createCast(from, to);
        if (i != null) {
          il.append(i);
        } else {
          il.append(fact.createCast(from, Type.INT));
          il.append(fact.createCast(Type.INT, to));
View Full Code Here

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

    il.append(fact.createCast(fromType, toType));
    return il;
  }

  public static Instruction createConstant(InstructionFactory fact, int value) {
    Instruction inst;
    switch (value) {
    case -1:
      inst = InstructionConstants.ICONST_M1;
      break;
    case 0:
View Full Code Here

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

        handleRangeInstruction(oldInstructionHandle, exceptionList);
        // just increment ih.
        oldInstructionHandle = oldInstructionHandle.getNext();
      } else {
        // assert map.get(ih) == jh
        Instruction oldInstruction = oldInstructionHandle.getInstruction();
        Instruction newInstruction = newInstructionHandle.getInstruction();

        if (oldInstruction instanceof InstructionBranch) {
          handleBranchInstruction(map, oldInstruction, newInstruction);
        }
View Full Code Here

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

    Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>();
    Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>();
    // OPTIMIZE sort out in here: getRange()/insertHandler() and type of
    // exceptionList
    while (iHandle != null) {
      Instruction inst = iHandle.getInstruction();
      // InstructionHandle nextInst = iHandle.getNext();
      // OPTIMIZE remove this instructionhandle as it now points to
      // nowhere?
      if (inst == Range.RANGEINSTRUCTION) {
        Range r = Range.getRange(iHandle);
View Full Code Here

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

    Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>();
    for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) {
      if (Range.isRangeHandle(ih)) {
        continue;
      }
      Instruction inst = ih.getInstruction();
      Instruction copy = Utility.copyInstruction(inst);

      if (copy instanceof InstructionBranch) {
        map.put(ih, intoList.append((InstructionBranch) copy));
      } else {
        map.put(ih, intoList.append(copy));
View Full Code Here

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

  public Member makeJoinPointSignatureForMonitorExit(LazyClassGen cg, InstructionHandle h) {
    return MemberImpl.monitorExit();
  }

  public Member makeJoinPointSignatureForArrayConstruction(LazyClassGen cg, InstructionHandle handle) {
    Instruction i = handle.getInstruction();
    ConstantPool cpg = cg.getConstantPool();
    Member retval = null;

    if (i.opcode == Constants.ANEWARRAY) {
      // ANEWARRAY arrayInstruction = (ANEWARRAY)i;
      Type ot = i.getType(cpg);
      UnresolvedType ut = fromBcel(ot);
      ut = UnresolvedType.makeArray(ut, 1);
      retval = MemberImpl.method(ut, Modifier.PUBLIC, ResolvedType.VOID, "<init>", new ResolvedType[] { ResolvedType.INT });
    } else if (i instanceof MULTIANEWARRAY) {
      MULTIANEWARRAY arrayInstruction = (MULTIANEWARRAY) i;
      UnresolvedType ut = null;
      short dimensions = arrayInstruction.getDimensions();
      ObjectType ot = arrayInstruction.getLoadClassType(cpg);
      if (ot != null) {
        ut = fromBcel(ot);
        ut = UnresolvedType.makeArray(ut, dimensions);
      } else {
        Type t = arrayInstruction.getType(cpg);
        ut = fromBcel(t);
      }
      ResolvedType[] parms = new ResolvedType[dimensions];
      for (int ii = 0; ii < dimensions; ii++) {
        parms[ii] = ResolvedType.INT;
      }
      retval = MemberImpl.method(ut, Modifier.PUBLIC, ResolvedType.VOID, "<init>", parms);

    } else if (i.opcode == Constants.NEWARRAY) {
      // NEWARRAY arrayInstruction = (NEWARRAY)i;
      Type ot = i.getType();
      UnresolvedType ut = fromBcel(ot);
      retval = MemberImpl.method(ut, Modifier.PUBLIC, ResolvedType.VOID, "<init>", new ResolvedType[] { ResolvedType.INT });
    } else {
      throw new BCException("Cannot create array construction signature for this non-array instruction:" + i);
    }
View Full Code Here

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

      if (realizedCannotInline) {
        // we know we cannot inline this advice so no need for futher handling
        break;
      }
      InstructionHandle next = curr.getNext();
      Instruction inst = curr.getInstruction();

      // open-up method call
      if ((inst instanceof InvokeInstruction)) {
        InvokeInstruction invoke = (InvokeInstruction) inst;
        ResolvedType callee = m_aspectGen.getWorld().resolve(UnresolvedType.forName(invoke.getClassName(cpg)));
View Full Code Here

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

    // first pass: copy the instructions directly, populate the srcToDest
    // map,
    // fix frame instructions
    for (InstructionHandle src = sourceList.getStart(); src != null; src = src.getNext()) {
      Instruction fresh = Utility.copyInstruction(src.getInstruction());
      InstructionHandle dest;

      // OPTIMIZE optimize this stuff?
      if (fresh.isConstantPoolInstruction()) {
        // need to reset index to go to new constant pool. This is
        // totally
        // a computation leak... we're testing this LOTS of times. Sigh.
        if (isAcrossClass) {
          InstructionCP cpi = (InstructionCP) fresh;
          cpi.setIndex(recipientCpg.addConstant(donorCpg.getConstant(cpi.getIndex()), donorCpg));
        }
      }
      if (src.getInstruction() == Range.RANGEINSTRUCTION) {
        dest = ret.append(Range.RANGEINSTRUCTION);
      } else if (fresh.isReturnInstruction()) {
        if (keepReturns) {
          dest = ret.append(fresh);
        } else {
          dest = ret.append(InstructionFactory.createBranchInstruction(Constants.GOTO, end));
        }
      } else if (fresh instanceof InstructionBranch) {
        dest = ret.append((InstructionBranch) fresh);
      } else if (fresh.isLocalVariableInstruction() || fresh instanceof RET) {

        // IndexedInstruction indexed = (IndexedInstruction) fresh;
        int oldIndex = fresh.getIndex();
        int freshIndex;
        if (!frameEnv.hasKey(oldIndex)) {
          freshIndex = recipient.allocateLocal(2);
          frameEnv.put(oldIndex, freshIndex);
        } else {
          freshIndex = frameEnv.get(oldIndex);
        }
        if (fresh instanceof RET) {
          fresh.setIndex(freshIndex);
        } else {
          fresh = ((InstructionLV) fresh).setIndexAndCopyIfNecessary(freshIndex);
        }
        dest = ret.append(fresh);
      } else {
        dest = ret.append(fresh);
      }
      srcToDest.put(src, dest);
    }

    // second pass: retarget branch instructions, copy ranges and tags
    Map<Tag, Tag> tagMap = new HashMap<Tag, Tag>();
    Map<BcelShadow, BcelShadow> shadowMap = new HashMap<BcelShadow, BcelShadow>();
    for (InstructionHandle dest = ret.getStart(), src = sourceList.getStart(); dest != null; dest = dest.getNext(), src = src
        .getNext()) {
      Instruction inst = dest.getInstruction();

      // retarget branches
      if (inst instanceof InstructionBranch) {
        InstructionBranch branch = (InstructionBranch) inst;
        InstructionHandle oldTarget = branch.getTarget();
View Full Code Here

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

    while (true) {
      if (start == null) {
        return null;
      }

      Instruction inst = start.getInstruction();
      if (inst.opcode == Constants.INVOKESPECIAL && ((InvokeInstruction) inst).getName(cpg).equals("<init>")) {
        depth--;
        if (depth == 0) {
          return start;
        }
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.