Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.Instruction


    public Subroutine[] subSubs(){
      Set h = new HashSet();

      Iterator i = instructions.iterator();
      while (i.hasNext()){
        Instruction inst = ((InstructionHandle) i.next()).getInstruction();
        if (inst instanceof JsrInstruction){
          InstructionHandle targ = ((JsrInstruction) inst).getTarget();
          h.add(getSubroutine(targ));
        }
      }
View Full Code Here


      int size = executionPredecessors.size();
      int retcount = 0;
     
      for (int i=size-1; i>=0; i--){
        InstructionContextImpl current = (InstructionContextImpl) (executionPredecessors.get(i));
        Instruction currentlast = current.getInstruction().getInstruction();
        if (currentlast instanceof RET) {
                    retcount++;
                }
        if (currentlast instanceof JsrInstruction){
          retcount--;
View Full Code Here

    private InstructionHandle[] _getSuccessors(){
      final InstructionHandle[] empty = new InstructionHandle[0];
      final InstructionHandle[] single = new InstructionHandle[1];
      final InstructionHandle[] pair = new InstructionHandle[2];
   
      Instruction inst = getInstruction().getInstruction();
   
      if (inst instanceof RET){
        Subroutine s = subroutines.subroutineOf(getInstruction());
        if (s==null){ //return empty; // RET in dead code. "empty" would be the correct answer, but we know something about the surrounding project...
          throw new AssertionViolatedException("Asking for successors of a RET in dead code?!");
View Full Code Here

    TOPLEVEL = new SubroutineImpl();

    // Calculate "real" subroutines.
    Set sub_leaders = new HashSet(); // Elements: InstructionHandle
    for (int i=0; i<all.length; i++){
      Instruction inst = all[i].getInstruction();
      if (inst instanceof JsrInstruction){
        sub_leaders.add(((JsrInstruction) inst).getTarget());
      }
    }
    // Build up the database.
    Iterator iter = sub_leaders.iterator();
    while (iter.hasNext()){
      SubroutineImpl sr = new SubroutineImpl();
      InstructionHandle astore = (InstructionHandle) (iter.next());
      sr.setLocalVariable( ((ASTORE) (astore.getInstruction())).getIndex() );
      subroutines.put(astore, sr);
    }

    // Fake it a bit. We want a virtual "TopLevel" subroutine.
    subroutines.put(all[0], TOPLEVEL);
    sub_leaders.add(all[0]);

    // Tell the subroutines about their JsrInstructions.
    // Note that there cannot be a JSR targeting the top-level
    // since "Jsr 0" is disallowed in Pass 3a.
    // Instructions shared by a subroutine and the toplevel are
    // disallowed and checked below, after the BFS.
    for (int i=0; i<all.length; i++){
      Instruction inst = all[i].getInstruction();
      if (inst instanceof JsrInstruction){
        InstructionHandle leader = ((JsrInstruction) inst).getTarget();
        ((SubroutineImpl) getSubroutine(leader)).addEnteringJsrInstruction(all[i]);
      }
    }
View Full Code Here

  private static InstructionHandle[] getSuccessors(InstructionHandle instruction){
    final InstructionHandle[] empty = new InstructionHandle[0];
    final InstructionHandle[] single = new InstructionHandle[1];
    final InstructionHandle[] pair = new InstructionHandle[2];
   
    Instruction inst = instruction.getInstruction();
   
    if (inst instanceof RET){
      return empty;
    }
   
View Full Code Here

        CFG cfg = classContext.getCFG(method);
        LockDataflow lockDataflow = classContext.getLockDataflow(method);

        for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
            Location location = i.next();
            Instruction ins = location.getHandle().getInstruction();

            if (!(ins instanceof INVOKESTATIC)) {
                continue;
            }
View Full Code Here

        for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
            Location location = i.next();
            InstructionHandle handle = location.getHandle();
            int pc = handle.getPosition();
            Instruction ins = handle.getInstruction();

            if (!(ins instanceof InvokeInstruction)) {
                continue;
            }
View Full Code Here

        if (!fact.isValid()) {
            return;
        }
        Location location = new Location(handle, basicBlock);

        Instruction i = handle.getInstruction();
        if (i instanceof InvokeInstruction) {
            InvokeInstruction ii = (InvokeInstruction) i;
            XMethod m = XFactory.createXMethod(ii, cpg);
            if (TypeQualifierDataflowAnalysis.isIdentifyFunctionForTypeQualifiers(m)) {
                ValueNumberFrame vnaFrameAtLocation = vnaDataflow.getFactAtLocation(location);
View Full Code Here

    @Override
    public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock, LockSet fact)
            throws DataflowAnalysisException {

        Instruction ins = handle.getInstruction();
        short opcode = ins.getOpcode();
        if (opcode == Constants.MONITORENTER || opcode == Constants.MONITOREXIT) {
            ValueNumberFrame frame = vnaDataflow.getFactAtLocation(new Location(handle, basicBlock));

            modifyLock(frame, fact, opcode == Constants.MONITORENTER ? 1 : -1);
View Full Code Here

            throws DataflowAnalysisException {
        if (!isFactValid(fact)) {
            return;
        }

        Instruction ins = handle.getInstruction();

        if (ins instanceof StoreInstruction) {
            // Local is stored: any live stores on paths leading
            // to this instruction are now dead
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.Instruction

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.