Package org.aspectj.apache.bcel.generic

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


  }

  public void visit(FieldGetCall fieldGetCall) {
    Member field = fieldGetCall.getField();
    Member method = fieldGetCall.getMethod();
    InstructionList il = new InstructionList();
    il.append(Utility.createGet(fact, field));
    // assert !method.isStatic()
    Expr[] args = fieldGetCall.getArgs();
    // System.out.println("args: " + Arrays.asList(args));
    il.append(renderExprs(fact, world, args));
    // System.out.println("rendered args: " + callIl);
    il.append(Utility.createInvoke(fact, world, method));
    il.append(createJumpBasedOnBooleanOnStack());
    instructions.insert(il);
  }
View Full Code Here


  public void visit(CallExpr call) {
    Member method = call.getMethod();
    // assert method.isStatic()
    Expr[] args = call.getArgs();
    InstructionList callIl = renderExprs(fact, world, args);
    callIl.append(Utility.createInvoke(fact, world, method));
    instructions.insert(callIl);
  }
View Full Code Here

      ShadowRange range = getRange();
      range.insert(InstructionConstants.NOP, Range.InsideAfter);
    } else if (getKind() == ExceptionHandler) {

      ShadowRange range = getRange();
      InstructionList body = range.getBody();
      InstructionHandle start = range.getStart();

      // Create a store instruction to put the value from the top of the
      // stack into a local variable slot. This is a trimmed version of
      // what is in initializeArgVars() (since there is only one argument
View Full Code Here

  // ---- factory methods

  public static BcelShadow makeConstructorExecution(BcelWorld world, LazyMethodGen enclosingMethod,
      InstructionHandle justBeforeStart) {
    final InstructionList body = enclosingMethod.getBody();
    BcelShadow s = new BcelShadow(world, ConstructorExecution, world.makeJoinPointSignatureFromMethod(enclosingMethod,
        Member.CONSTRUCTOR), enclosingMethod, null);
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(s);
    r.associateWithTargets(Range.genStart(body, justBeforeStart.getNext()), Range.genEnd(body));
View Full Code Here

    r.associateWithTargets(Range.genStart(body, justBeforeStart.getNext()), Range.genEnd(body));
    return s;
  }

  public static BcelShadow makeStaticInitialization(BcelWorld world, LazyMethodGen enclosingMethod) {
    InstructionList body = enclosingMethod.getBody();
    // move the start past ajc$preClinit
    InstructionHandle clinitStart = body.getStart();
    if (clinitStart.getInstruction() instanceof InvokeInstruction) {
      InvokeInstruction ii = (InvokeInstruction) clinitStart.getInstruction();
      if (ii.getName(enclosingMethod.getEnclosingClass().getConstantPool()).equals(NameMangler.AJC_PRE_CLINIT_NAME)) {
        clinitStart = clinitStart.getNext();
      }
    }

    InstructionHandle clinitEnd = body.getEnd();

    // XXX should move the end before the postClinit, but the return is then tricky...
    // if (clinitEnd.getInstruction() instanceof InvokeInstruction) {
    // InvokeInstruction ii = (InvokeInstruction)clinitEnd.getInstruction();
    // if (ii.getName(enclosingMethod.getEnclosingClass().getConstantPool()).equals(NameMangler.AJC_POST_CLINIT_NAME)) {
View Full Code Here

   * Make the shadow for an exception handler. Currently makes an empty shadow that only allows before advice to be woven into it.
   */

  public static BcelShadow makeExceptionHandler(BcelWorld world, ExceptionRange exceptionRange, LazyMethodGen enclosingMethod,
      InstructionHandle startOfHandler, BcelShadow enclosingShadow) {
    InstructionList body = enclosingMethod.getBody();
    UnresolvedType catchType = exceptionRange.getCatchType();
    UnresolvedType inType = enclosingMethod.getEnclosingClass().getType();

    ResolvedMemberImpl sig = MemberImpl.makeExceptionHandlerSignature(inType, catchType);
    sig.setParameterNames(new String[] { findHandlerParamName(startOfHandler) });
View Full Code Here

    // r.associateWithTargets(start, end);
    return s;
  }

  public void initIfaceInitializer(InstructionHandle end) {
    final InstructionList body = enclosingMethod.getBody();
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(this);
    InstructionHandle nop = body.insert(end, InstructionConstants.NOP);

    r.associateWithTargets(Range.genStart(body, nop), Range.genEnd(body, nop));
  }
View Full Code Here

  public void init() {
    if (range != null) {
      return;
    }

    final InstructionList body = enclosingMethod.getBody();
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(this);
    r.associateWithTargets(Range.genStart(body), Range.genEnd(body));
  }
View Full Code Here

  public static BcelShadow makeMethodExecution(BcelWorld world, LazyMethodGen enclosingMethod) {
    return makeShadowForMethod(world, enclosingMethod, MethodExecution, enclosingMethod.getMemberView());
  }

  public static BcelShadow makeShadowForMethod(BcelWorld world, LazyMethodGen enclosingMethod, Shadow.Kind kind, Member sig) {
    final InstructionList body = enclosingMethod.getBody();
    BcelShadow s = new BcelShadow(world, kind, sig, enclosingMethod, null);
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(s);
    r.associateWithTargets(// OPTIMIZE this occurs lots of times for all jp kinds...
        Range.genStart(body), Range.genEnd(body));
View Full Code Here

        Range.genStart(body), Range.genEnd(body));
    return s;
  }

  public static BcelShadow makeAdviceExecution(BcelWorld world, LazyMethodGen enclosingMethod) {
    final InstructionList body = enclosingMethod.getBody();
    BcelShadow s = new BcelShadow(world, AdviceExecution, world
        .makeJoinPointSignatureFromMethod(enclosingMethod, Member.ADVICE), enclosingMethod, null);
    ShadowRange r = new ShadowRange(body);
    r.associateWithShadow(s);
    r.associateWithTargets(Range.genStart(body), Range.genEnd(body));
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.generic.InstructionList

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.