Examples of InstructionFinder


Examples of org.apache.bcel.util.InstructionFinder

     * Peephole optimization: Remove sequences of [ALOAD, POP].
     */
    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

Examples of org.apache.bcel.util.InstructionFinder

                    MethodGen gen = new MethodGen(m, c.getValue().getClassName(), cpg);
                    InstructionList il = gen.getInstructionList();
                    if (il == null) {
                        continue;
                    }
                    InstructionFinder f = new InstructionFinder(il);
                    Iterator e = f.search("GETSTATIC GETFIELD ISTORE (GETSTATIC GETFIELD BIPUSH ISHR GETSTATIC IADD ISTORE)+");
                    if (e.hasNext()) {
                        InstructionHandle[] handles = (InstructionHandle[]) e.next();
                        String myplayer = ((GETSTATIC) handles[0].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC) handles[0].getInstruction()).getFieldName(cpg);
                        String animable = ((GETFIELD) handles[1].getInstruction()).getClassName(cpg);
                        String plane = ((GETFIELD) handles[1].getInstruction()).getFieldName(cpg);
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

                        if (t instanceof ArrayType && ((ArrayType)t).getDimensions() == 3 && ((ArrayType)t).getBasicType().getSignature().startsWith("L")) {
                            ConstantPoolGen cpg = c.getValue().getConstantPool();
                            MethodGen gen = new MethodGen(m,c.getValue().getClassName(),cpg);
                            InstructionList il = gen.getInstructionList();
                            if (il == null) continue;
                            InstructionFinder f = new InstructionFinder(il);
                            Iterator e = f.search("GETSTATIC GETSTATIC AALOAD ILOAD AALOAD ILOAD BALOAD ICONST IAND");
                            if (e.hasNext()) {
                              InstructionHandle[] handles = (InstructionHandle[]) e.next();
                                String gba = ((GETSTATIC)handles[0].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC)handles[0].getInstruction()).getFieldName(cpg);
                                data.addField("GroundSettingsArray", gba);
                                e = f.search("GETSTATIC (ICONST)+ GETSTATIC IADD AALOAD");
                                //System.out.println("Found method. Class: "+c.getValue().getClassName() + ", method: "+m.getName());
                                if (e.hasNext()) {
                                    handles = (InstructionHandle[]) e.next();
                                    String planearray = ((GETSTATIC)handles[0].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC)handles[0].getInstruction()).getFieldName(cpg);
                                    String curplane = ((GETSTATIC)handles[2].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC)handles[2].getInstruction()).getFieldName(cpg);
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

                if (m.isStatic()) {
                    ConstantPoolGen cpg = c.getValue().getConstantPool();
                    MethodGen gen = new MethodGen(m,c.getValue().getClassName(),cpg);
                    InstructionList il = gen.getInstructionList();
                    if (il == null) continue;
                    InstructionFinder f = new InstructionFinder(il);
                    Iterator e = f.search("BASTORE GETSTATIC ILOAD ILOAD ILOAD ILOAD INVOKEVIRTUAL");
                    if (e.hasNext()) {
                        InstructionHandle[] handles = (InstructionHandle[]) e.next();
                        String curtoolkit = ((GETSTATIC)handles[1].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC)handles[1].getInstruction()).getFieldName(cpg);
                        String toolkit = ((GETSTATIC)handles[1].getInstruction()).getSignature(cpg).replaceAll("L|;","");
                        data.addClass("Toolkit", toolkit);
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

                        count++;
                        if(count==7){
                          fi = iS.nextGETSTATIC();
                          sDestX = fi.getClassName(cpg)+'.'+fi.getFieldName(cpg);
                          data.addField("DestX", sDestX);
                          InstructionFinder f = new InstructionFinder(il);
                          Iterator e = f.search("IF_ICMPNE ICONST_M1 PUTSTATIC ICONST_M1 PUTSTATIC");
                              if(e.hasNext()){
                                InstructionHandle[] handles = (InstructionHandle[]) e.next();
                                String temp = ((FieldInstruction) ((PUTSTATIC) handles[2].getInstruction())).getClassName(cpg) + "." + ((PUTSTATIC) handles[2].getInstruction()).getFieldName(cpg);
                                if(!temp.equals(sDestX)){
                                  data.addField("DestY", temp);
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

                for (Method m : c.getMethods()) {
                    if (m.isStatic()) {
                        MethodGen gen = new MethodGen(m,c.getClassName(),cpg);
                        InstructionList il = gen.getInstructionList();
                        if (il == null) continue;
                        InstructionFinder f = new InstructionFinder(il);
                        Iterator e = f.search("GETSTATIC LDC FSUB PUTSTATIC");
                        if (e.hasNext()) {
                            InstructionHandle[] handles = (InstructionHandle[]) e.next();
                            data.addField("MapAngle", ((GETSTATIC)handles[0].getInstruction()).getClassName(cpg) + "." + ((GETSTATIC)handles[0].getInstruction()).getFieldName(cpg));
                            return SearchResult.Success;
                        }
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

                      MethodGen gen = new MethodGen(m, c.getValue().getClassName(), cpg);
                      InstructionList il = gen.getInstructionList();
                      if (il == null) {
                          continue;
                      }
                      InstructionFinder f = new InstructionFinder(il);
                      Iterator e = f.search("INVOKESTATIC IFEQ GETSTATIC ICONST_2 IF_ICMPLE");
                      if (e.hasNext()) {
                          InstructionHandle[] handles = (InstructionHandle[]) e.next();
                          String opCount = ((GETSTATIC) handles[2].getInstruction()).getClassName(cpg)+'.'+((GETSTATIC) handles[2].getInstruction()).getFieldName(cpg);
                          data.addField("MenuOptionCount", opCount);
                          return SearchResult.Success;
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

                                MethodGen gen = new MethodGen(m, clazz.getClassName(), cpg);
                                InstructionList il = gen.getInstructionList();
                                if (il == null) {
                                    continue;
                                }
                                InstructionFinder f = new InstructionFinder(il);
                                Iterator e = f.search("ALOAD GETFIELD GETFIELD ALOAD GETFIELD GETFIELD");
                                if (e.hasNext()) {
                                    InstructionHandle[] handles = (InstructionHandle[]) e.next();
                                    String getviewport = ((GETFIELD) handles[1].getInstruction()).getFieldName(cpg);
                                    e = f.search("ILOAD ALOAD GETFIELD if_icmplt ILOAD ALOAD GETFIELD if_icmple", handles[handles.length - 1]);
                                    if (e.hasNext()) {
                                        handles = (InstructionHandle[]) e.next();
                                        String zmin = ((GETFIELD) handles[2].getInstruction()).getFieldName(cpg);
                                        String zmax = ((GETFIELD) handles[6].getInstruction()).getFieldName(cpg);
                                        e = f.search("ALOAD GETFIELD ALOAD GETFIELD GETFIELD ALOAD GETFIELD GETFIELD", handles[handles.length - 1]);
                                        if (e.hasNext()) {
                                            handles = (InstructionHandle[]) e.next();
                                            String xscale = ((GETFIELD) handles[1].getInstruction()).getFieldName(cpg);
                                            e = f.search("ALOAD GETFIELD ALOAD GETFIELD GETFIELD ALOAD GETFIELD GETFIELD", handles[handles.length - 1]);
                                            if (e.hasNext()) {
                                                handles = (InstructionHandle[]) e.next();
                                                String yscale = ((GETFIELD) handles[1].getInstruction()).getFieldName(cpg);
                                                e = f.search("ILOAD ALOAD GETFIELD if_icmplt ILOAD ALOAD GETFIELD if_icmpgt", handles[handles.length - 1]);
                                                if (e.hasNext()) {
                                                    handles = (InstructionHandle[]) e.next();
                                                    String xmin = ((GETFIELD) handles[2].getInstruction()).getFieldName(cpg);
                                                    String xmax = ((GETFIELD) handles[6].getInstruction()).getFieldName(cpg);
                                                    e = f.search("ILOAD ALOAD GETFIELD if_icmplt ILOAD ALOAD GETFIELD if_icmpgt", handles[handles.length - 1]);
                                                    if (e.hasNext()) {
                                                        handles = (InstructionHandle[]) e.next();
                                                        String ymin = ((GETFIELD) handles[2].getInstruction()).getFieldName(cpg);
                                                        String ymax = ((GETFIELD) handles[6].getInstruction()).getFieldName(cpg);
                                                        sdtoolkit.addField("xMin", xmin);
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

        }
        if(m.getName().equals("<init>")){
          InstructionList il = mg.getInstructionList();
          if(il == null || il.getInstructions().length != 6)
            continue;
          InstructionFinder f = new InstructionFinder(il);
                    Iterator e = f.search("ALOAD INVOKESPECIAL ALOAD ICONST PUTFIELD");
                    if (e.hasNext()) {
                      matches++;
                    }
        }
      }
View Full Code Here

Examples of org.apache.bcel.util.InstructionFinder

                if (!m.isStatic()) {
                    ConstantPoolGen cpg = c.getValue().getConstantPool();
                    MethodGen gen = new MethodGen(m,c.getValue().getClassName(),cpg);
                    InstructionList il = gen.getInstructionList();
                    if (il == null) continue;
                    InstructionFinder f = new InstructionFinder(il);
                    Iterator e = f.search("(ALOAD ICONST ALOAD GETFIELD ALOAD GETFIELD ILOAD IMUL ALOAD GETFIELD ILOAD IMUL IADD ALOAD GETFIELD ILOAD IMUL IADD BIPUSH ISHR IADD IASTORE)+");
                    if (e.hasNext()) {
                        InstructionHandle[] handles = (InstructionHandle[]) e.next();
                        String sdviewport = ((GETFIELD)handles[3].getInstruction()).getClassName(cpg);
                        if (!sdviewport.equals(c.getKey())) continue;
                        data.addClass("Viewport",classes.get(sdviewport).getSuperclassName());
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.