|
|
@ -24,6 +24,7 @@ public class PutFieldOperator extends StoreInstruction { |
|
|
|
CodeAnalyzer codeAnalyzer; |
|
|
|
CodeAnalyzer codeAnalyzer; |
|
|
|
boolean staticFlag; |
|
|
|
boolean staticFlag; |
|
|
|
CpoolRef field; |
|
|
|
CpoolRef field; |
|
|
|
|
|
|
|
Type classType; |
|
|
|
|
|
|
|
|
|
|
|
public PutFieldOperator(CodeAnalyzer codeAnalyzer, boolean staticFlag, |
|
|
|
public PutFieldOperator(CodeAnalyzer codeAnalyzer, boolean staticFlag, |
|
|
|
CpoolRef field) { |
|
|
|
CpoolRef field) { |
|
|
@ -31,6 +32,9 @@ public class PutFieldOperator extends StoreInstruction { |
|
|
|
this.codeAnalyzer = codeAnalyzer; |
|
|
|
this.codeAnalyzer = codeAnalyzer; |
|
|
|
this.staticFlag = staticFlag; |
|
|
|
this.staticFlag = staticFlag; |
|
|
|
this.field = field; |
|
|
|
this.field = field; |
|
|
|
|
|
|
|
classType = Type.tClass(field.getCpoolClass().getName().getString()); |
|
|
|
|
|
|
|
if (staticFlag) |
|
|
|
|
|
|
|
classType.useType(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean matches(Operator loadop) { |
|
|
|
public boolean matches(Operator loadop) { |
|
|
@ -43,45 +47,25 @@ public class PutFieldOperator extends StoreInstruction { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getLValueOperandPriority(int i) { |
|
|
|
public int getLValueOperandPriority(int i) { |
|
|
|
if (staticFlag) { |
|
|
|
|
|
|
|
/* shouldn't be called */ |
|
|
|
|
|
|
|
throw new RuntimeException("Field is static"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return 900; |
|
|
|
return 900; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Type getLValueOperandType(int i) { |
|
|
|
public Type getLValueOperandType(int i) { |
|
|
|
if (staticFlag) { |
|
|
|
return classType; |
|
|
|
/* shouldn't be called */ |
|
|
|
|
|
|
|
throw new AssertError("Field is static"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Type.tClass(field.getCpoolClass() |
|
|
|
|
|
|
|
.getName().getString()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setLValueOperandType(Type[] t) { |
|
|
|
public void setLValueOperandType(Type[] t) { |
|
|
|
if (staticFlag) { |
|
|
|
|
|
|
|
/* shouldn't be called */ |
|
|
|
|
|
|
|
throw new AssertError("Field is static"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getLValueString(String[] operands) { |
|
|
|
public String getLValueString(String[] operands) { |
|
|
|
String object; |
|
|
|
String fieldName = field.getNameAndType().getName().getString(); |
|
|
|
if (staticFlag) { |
|
|
|
return staticFlag |
|
|
|
if (field.getCpoolClass().getName().getString() |
|
|
|
? (classType.equals(Type.tType(codeAnalyzer.getClazz())) |
|
|
|
.replace(java.io.File.separatorChar, '.') |
|
|
|
? fieldName |
|
|
|
.equals(codeAnalyzer.getClazz().getName())) |
|
|
|
: classType.toString() + "." + fieldName) |
|
|
|
return field.getNameAndType().getName().getString(); |
|
|
|
: (operands[0].equals("this") |
|
|
|
object = codeAnalyzer.getTypeString |
|
|
|
? fieldName |
|
|
|
(Type.tClass(field.getCpoolClass().getName().getString())); |
|
|
|
: operands[0] + "." + fieldName); |
|
|
|
} else { |
|
|
|
|
|
|
|
if (operands[0].equals("this")) |
|
|
|
|
|
|
|
return field.getNameAndType().getName().getString(); |
|
|
|
|
|
|
|
object = operands[0]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return object + "." + field.getNameAndType().getName().getString(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean equals(Object o) { |
|
|
|
public boolean equals(Object o) { |
|
|
|