01: package net.sf.jdec.jvminstructions.commands;
02:
03: import net.sf.jdec.core.DecompilerHelper;
04: import net.sf.jdec.core.LocalVariable;
05: import net.sf.jdec.core.Operand;
06: import net.sf.jdec.core.OperandStack;
07: import net.sf.jdec.reflection.Behaviour;
08:
09: public class ILoadCommand extends AbstractInstructionCommand {
10:
11: public ILoadCommand(Behaviour context) {
12: super (context);
13:
14: }
15:
16: public int getSkipBytes() {
17: return 1;
18: }
19:
20: public void execute() {
21: int i = getCurrentInstPosInCode();
22: byte[] info = getCode();
23: int opValueI = info[++i];
24: handleComplexIload(opValueI, info);
25: }
26:
27: private void handleComplexIload(int opValueI, byte[] info) {
28: int currentForIndex = getCurrentInstPosInCode();
29: OperandStack opStack = getStack();
30: LocalVariable local = DecompilerHelper.getLocalVariable(
31: opValueI, "load", "int", false, currentForIndex);
32: if (local != null) {
33: boolean terEnd = false;//isLoadTernaryEnd(currentForIndex);
34:
35: Operand op = new Operand();
36: boolean bo = getGenericFinder().isPrevInstIINC(
37: currentForIndex, opValueI);
38: StringBuffer addsub = new StringBuffer("");
39: boolean bo2 = false;
40:
41: if (!bo) {
42: bo = getGenericFinder().isNextInstIINC(currentForIndex,
43: opValueI, "complex");
44: }
45: if (!bo) {
46: bo = DecompilerHelper.checkForPostIncrForLoadCase(info,
47: currentForIndex, "category1", true, opValueI,
48: addsub);
49: bo2 = bo;
50: }
51: java.lang.String ltmp = local.getTempVarName();
52: if (!terEnd) {
53: if (bo && ltmp != null) {
54: op.setOperandValue(ltmp);
55: } else {
56: if (!bo2)
57: op.setOperandValue(local.getVarName());
58: else {
59: op.setOperandValue(local.getVarName()
60: + addsub.toString());
61: }
62: }
63: } else {
64: java.lang.String v1 = opStack.getTopOfStack()
65: .getOperandValue();
66: if (bo && ltmp != null) {
67: op.setOperandValue(v1 + ltmp);
68: } else {
69: op.setOperandValue(v1 + local.getVarName());
70: }
71: }
72:
73: op.setLocalVarIndex(opValueI);
74: op.setLocalVarType(local.getDataType());
75: boolean r = false;//checkIFLoadInstIsPartOFTernaryCond(currentForIndex);
76: if (r) {
77: if (opStack.size() > 0) {
78: java.lang.String str = opStack.getTopOfStack()
79: .getOperandValue();
80: str = str + op.getOperandValue();
81: op.setOperandValue(str);
82: }
83: }
84: opStack.push(op);
85: }
86: }
87:
88: }
|