01: package net.sf.jdec.jvminstructions.commands;
02:
03: import java.util.ArrayList;
04:
05: import net.sf.jdec.constantpool.ClassDescription;
06: import net.sf.jdec.constantpool.FieldRef;
07: import net.sf.jdec.core.Operand;
08: import net.sf.jdec.core.OperandStack;
09: import net.sf.jdec.reflection.Behaviour;
10: import net.sf.jdec.util.Util;
11:
12: public class GetfieldCommand extends AbstractInstructionCommand {
13:
14: public GetfieldCommand(Behaviour context) {
15: super (context);
16:
17: }
18:
19: public int getSkipBytes() {
20: return 2;
21: }
22:
23: public void execute() {
24: OperandStack opStack = getStack();
25: Operand op = (Operand) opStack.pop();
26: int currentForIndex = getCurrentInstPosInCode();
27: int i = currentForIndex;
28:
29: int classIndex = getGenericFinder().getOffset(i);// (temp1 << 8) |
30: // temp2);
31:
32: // if(classIndex < 0)classIndex=(temp1+1)*256-Math.abs(temp2);
33: ClassDescription cd = getContext().getClassRef().getCd();
34: FieldRef fref = cd.getFieldRefAtCPoolPosition(classIndex);
35: // NameAndType ninfo=cd.getNameAndTypeAtCPoolPosition(classIndex);
36: Operand op2 = new Operand();
37: op2.setOperandValue(op.getOperandValue() + "."
38: + fref.getFieldName());
39: boolean r = false;// checkIFLoadInstIsPartOFTernaryCond(currentForIndex);
40: if (r) {
41: if (opStack.size() > 0) {
42: java.lang.String str = opStack.getTopOfStack()
43: .getOperandValue();
44: str = str + op2.getOperandValue();
45: op2.setOperandValue(str);
46: }
47: }
48: opStack.push(op2);
49: Util.parseReturnType(fref.getTypeoffield());
50: ArrayList returntype = Util.getreturnSignatureAsList();
51: if (returntype.size() > 0)
52: op2.setClassType((java.lang.String) returntype.get(0));
53: }
54:
55: }
|