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