Package org.apache.bcel.util

Examples of org.apache.bcel.util.InstructionFinder.search()


                    InstructionList il = gen.getInstructionList();
                    if (il == null) {
                        continue;
                    }
                    InstructionFinder f = new InstructionFinder(il);
                    Iterator e = f.search("GETSTATIC GETFIELD ICONST IALOAD LDC ISHR ISTORE GETSTATIC GETFIELD ICONST IALOAD LDC");
                    if (e.hasNext()) {
                        InstructionHandle[] handles = (InstructionHandle[]) e.next();
                        String queueX = ((GETFIELD) handles[8].getInstruction()).getFieldName(cpg);
                        String queueY = ((GETFIELD) handles[1].getInstruction()).getFieldName(cpg);
                        RSClass characterClass = data.getProperClass("Character");
View Full Code Here


              m.getArgumentTypes().length == 0){
            ConstantPoolGen cpg = c.getValue().getConstantPool();
            MethodGen mg = new MethodGen(m, c.getValue().getClassName(), cpg);
            InstructionList il = mg.getInstructionList();
            InstructionFinder f = new InstructionFinder(il);
            Iterator e = f.search("INVOKEVIRTUAL CHECKCAST GETFIELD ASTORE ALOAD GETFIELD IFEQ");
            if(e.hasNext()){
              InstructionHandle[] handles = (InstructionHandle[]) e.next();
              String getHits = ((GETFIELD) handles[5].getInstruction()).getFieldName(cpg);
              InstructionSearcher iS = new InstructionSearcher(il, cpg);
              iS.nextGETSTATIC();
View Full Code Here

                if (il == null) {
                   continue;
                }
                InstructionFinder f = new InstructionFinder(il);
                            // ISTORE GETSTATIC ISTORE GETSTATIC
                Iterator e = f.search("GETSTATIC ISTORE GETSTATIC ICONST IADD PUTSTATIC GETSTATIC ISTORE GETSTATIC");
                if (e.hasNext()) {
                  InstructionHandle[] handles = (InstructionHandle[]) e.next();
                      String menuX = ((GETSTATIC) handles[6].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC) handles[6].getInstruction()).getFieldName(cpg);
                      String menuY = ((GETSTATIC) handles[8].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC) handles[8].getInstruction()).getFieldName(cpg);
                      data.addField("MenuX", menuX);
View Full Code Here

  InstructionHandle ih;
  String pattern;

  // LoadInstruction, POP => (removed)
  pattern = "LoadInstruction POP";
  for (Iterator iter = find.search(pattern); iter.hasNext();) {
      InstructionHandle[] match = (InstructionHandle[]) iter.next();
      try {
    if (!match[0].hasTargeters() && !match[1].hasTargeters()) {
                    il.delete(match[0], match[1]);
                }
View Full Code Here

            }
  }
       
  // ILOAD_N, ILOAD_N, SWAP, ISTORE_N => ILOAD_N
  pattern = "ILOAD ILOAD SWAP ISTORE";
  for (Iterator iter = find.search(pattern); iter.hasNext();) {
            InstructionHandle[] match = (InstructionHandle[]) iter.next();
            try {             
                org.apache.bcel.generic.ILOAD iload1 =
                    (org.apache.bcel.generic.ILOAD) match[0].getInstruction();
                org.apache.bcel.generic.ILOAD iload2 =
View Full Code Here

            }
        }

        // LoadInstruction_N, LoadInstruction_M, SWAP => LoadInstruction_M, LoadInstruction_N
  pattern = "LoadInstruction LoadInstruction SWAP";
  for (Iterator iter = find.search(pattern); iter.hasNext();) {
            InstructionHandle[] match = (InstructionHandle[])iter.next();
            try {
                if (!match[0].hasTargeters() &&
                    !match[1].hasTargeters() &&
                    !match[2].hasTargeters())
View Full Code Here

            }
        }
               
        // ALOAD_N ALOAD_N => ALOAD_N DUP
  pattern = "ALOAD ALOAD";
        for (Iterator iter = find.search(pattern); iter.hasNext();) {
            InstructionHandle[] match = (InstructionHandle[])iter.next();
            try {
                if (!match[1].hasTargeters()) {
                    org.apache.bcel.generic.ALOAD aload1 =
                        (org.apache.bcel.generic.ALOAD) match[0].getInstruction();
View Full Code Here

     */
    private void peepHoleOptimization(MethodGenerator methodGen) {
  final String pattern = "`aload'`pop'`instruction'";
  final InstructionList il = methodGen.getInstructionList();
  final InstructionFinder find = new InstructionFinder(il);
  for(Iterator iter=find.search(pattern); iter.hasNext(); ) {
      InstructionHandle[] match = (InstructionHandle[])iter.next();
      try {
    il.delete(match[0], match[1]);
      }
      catch (TargetLostException e) {
View Full Code Here

     */
    private void peepHoleOptimization(MethodGenerator methodGen) {
  final String pattern = "`aload'`pop'`instruction'";
  final InstructionList il = methodGen.getInstructionList();
  final InstructionFinder find = new InstructionFinder(il);
  for(Iterator iter=find.search(pattern); iter.hasNext(); ) {
      InstructionHandle[] match = (InstructionHandle[])iter.next();
      try {
    il.delete(match[0], match[1]);
      }
      catch (TargetLostException e) {
View Full Code Here

  InstructionHandle ih;
  String pattern;

  // LoadInstruction, POP => (removed)
  pattern = "LoadInstruction POP";
  for (Iterator iter = find.search(pattern); iter.hasNext();) {
      InstructionHandle[] match = (InstructionHandle[]) iter.next();
      try {
    if (!match[0].hasTargeters() && !match[1].hasTargeters()) {
                    il.delete(match[0], match[1]);
                }
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.