1 18 19 package alt.jiapi.instrumentor; 20 21 import java.util.ArrayList ; 22 import java.util.List ; 23 24 import alt.jiapi.reflect.Instruction; 25 import alt.jiapi.reflect.InstructionList; 26 import alt.jiapi.reflect.instruction.Opcodes; 27 28 40 public class MethodEntryStrategy extends AbstractStrategy { 41 43 public MethodEntryStrategy() { 44 this("*"); 45 } 46 47 51 public MethodEntryStrategy(String matcher) { 52 super(matcher); 53 } 54 55 60 public MethodEntryStrategy(String [] matchers, boolean reverse) { 61 super(matchers, reverse); 62 } 63 64 73 public List findHotSpots(InstructionList il) { 74 List hotSpots = new ArrayList (); 75 int index = 0; 76 77 String name = il.getDeclaringMethod().getName(); 78 79 if (name.equals("<init>")) { 80 index = il.indexOf(Opcodes.INVOKESPECIAL); 82 if (index == -1) { 83 index = 0; 84 } 85 else { 86 index++; 87 } 88 } 89 90 if (match(name)) { 92 HotSpot h = new HotSpot(index, index); 93 96 Instrumentation i = getInstrumentation(); 97 i.setTargetName(name); 98 hotSpots.add(h); 99 } 100 101 return hotSpots; 102 } 103 } 104 | Popular Tags |