01: /*
02: * DremCommand.java Copyright (c) 2006,07 Swaroop Belur
03: *
04: * This program is free software; you can redistribute it and/itor
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08:
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13:
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17: *
18: */
19: package net.sf.jdec.jvminstructions.commands;
20:
21: import net.sf.jdec.core.Operand;
22: import net.sf.jdec.core.OperandStack;
23: import net.sf.jdec.reflection.Behaviour;
24:
25: public class DremCommand extends AbstractInstructionCommand {
26:
27: public DremCommand(Behaviour context) {
28: super (context);
29:
30: }
31:
32: public int getSkipBytes() {
33: return 0;
34: }
35:
36: public void execute() {
37: OperandStack stack = getStack();
38: Operand op = (Operand) stack.pop();
39: Operand op1 = (Operand) stack.pop();
40:
41: Operand op2 = new Operand();
42: // op2.setCategory(Constants.CATEGORY1);
43:
44: op2.setOperandValue("(" + op.getOperandValue() + " % "
45: + op1.getOperandValue() + ")");
46: boolean r = false;// checkIFLoadInstIsPartOFTernaryCond(currentForIndex);
47: if (r) {
48: if (stack.size() > 0) {
49: java.lang.String str = stack.getTopOfStack()
50: .getOperandValue();
51: str = str + op2.getOperandValue();
52: op2.setOperandValue(str);
53: }
54: }
55: stack.push(op2);
56: }
57:
58: }
|