1 21 package proguard.evaluation; 22 23 import proguard.evaluation.value.*; 24 import proguard.classfile.Clazz; 25 import proguard.classfile.attribute.CodeAttribute; 26 27 33 public class BasicBranchUnit 34 implements BranchUnit 35 { 36 private boolean wasCalled; 37 private InstructionOffsetValue traceBranchTargets; 38 39 40 44 public void resetCalled() 45 { 46 wasCalled = false; 47 } 48 49 53 protected void setCalled() 54 { 55 wasCalled = true; 56 } 57 58 61 public boolean wasCalled() 62 { 63 return wasCalled; 64 } 65 66 67 71 public void setTraceBranchTargets(InstructionOffsetValue branchTargets) 72 { 73 this.traceBranchTargets = branchTargets; 74 } 75 76 public InstructionOffsetValue getTraceBranchTargets() 77 { 78 return traceBranchTargets; 79 } 80 81 82 84 public void branch(Clazz clazz, 85 CodeAttribute codeAttribute, 86 int offset, 87 int branchTarget) 88 { 89 traceBranchTargets = new InstructionOffsetValue(branchTarget); 91 92 wasCalled = true; 93 } 94 95 96 public void branchConditionally(Clazz clazz, 97 CodeAttribute codeAttribute, 98 int offset, 99 int branchTarget, 100 int conditional) 101 { 102 traceBranchTargets = 104 traceBranchTargets.generalize(new InstructionOffsetValue(branchTarget)).instructionOffsetValue(); 105 106 wasCalled = true; 107 } 108 109 110 public void returnFromMethod() 111 { 112 traceBranchTargets = InstructionOffsetValue.EMPTY_VALUE; 114 115 wasCalled = true; 116 } 117 118 119 public void throwException() 120 { 121 traceBranchTargets = InstructionOffsetValue.EMPTY_VALUE; 123 124 wasCalled = true; 125 } 126 } 127
| Popular Tags
|