01: package net.sf.jdec.jvminstructions.commands;
02:
03: import java.util.Iterator;
04: import java.util.Map;
05:
06: import net.sf.jdec.core.GlobalVariableStore;
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 FreturnCommand extends AbstractInstructionCommand {
13:
14: public FreturnCommand(Behaviour context) {
15: super (context);
16:
17: }
18:
19: public int getSkipBytes() {
20: return 0;
21: }
22:
23: public void execute() {
24: int currentForIndex = getCurrentInstPosInCode();
25: int i = currentForIndex;
26: boolean oktoadd = true;
27: Behaviour behaviour = getContext();
28: Iterator mapIT = GlobalVariableStore.getReturnsAtI().entrySet()
29: .iterator();
30: while (mapIT.hasNext()) {
31: Map.Entry entry = (Map.Entry) mapIT.next();
32: Object key = entry.getKey();
33: Object retStatus = entry.getValue().toString();
34: if (key instanceof Integer) {
35: Integer pos = (Integer) key;
36: int temp = pos.intValue();
37: if (temp == i) {
38: if (retStatus.equals("true")) {
39:
40: oktoadd = false;
41: break;
42: }
43: }
44: }
45:
46: }
47:
48: if (!oktoadd) {
49: GlobalVariableStore.getReturnsAtI().remove(new Integer(i));
50: }
51: OperandStack opStack = getStack();
52:
53: if (oktoadd && opStack.size() > 0) {
54: Operand op = (Operand) opStack.pop();
55: String tempString = "return "
56: + op.getOperandValue().toString() + ";\n";
57: behaviour.appendToBuffer(Util
58: .formatDecompiledStatement(tempString));
59: }
60:
61: }
62:
63: }
|