1 package org.kit.furia.fragment.asm;
2
3 import org.objectweb.asm.tree.AbstractInsnNode;
4 import org.objectweb.asm.tree.analysis.Value;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 public class FunctionValue extends AbstractFunction {
30
31 private AbstractInsnNode insn;
32
33 private static String[] functionNameCache = new String[10000];
34
35 public FunctionValue(AbstractInsnNode insn) {
36 super();
37 this.insn = insn;
38 }
39
40 protected boolean equalFunctions(Value x){
41 if(x == this){
42 return true;
43 }else if(x instanceof FunctionValue){
44 FunctionValue comp = (FunctionValue)x;
45 return insn.getOpcode() == comp.insn.getOpcode();
46 }else{
47 return false;
48 }
49 }
50
51
52
53
54 protected int hashCodeFunctionName(){
55 return insn.getOpcode();
56 }
57
58 protected String printFunctionName(){
59
60 if(functionNameCache[insn.getOpcode()] == null){
61 String fName = (new Integer(insn.getOpcode())).toString()
62 .replace("1", "a")
63 .replace("2", "b")
64 .replace("3", "c")
65 .replace("4", "d")
66 .replace("5", "e")
67 .replace("6", "f")
68 .replace("7", "g")
69 .replace("8", "h")
70 .replace("9", "i")
71 .replace("0", "j")
72 ;
73 functionNameCache[insn.getOpcode()] = fName;
74 }
75
76
77 return functionNameCache[insn.getOpcode()];
78 }
79 }