1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.interpreter.operations;
11
12 import nl.tudelft.simulation.dsol.interpreter.LocalVariable;
13 import nl.tudelft.simulation.dsol.interpreter.OperandStack;
14 import nl.tudelft.simulation.dsol.interpreter.classfile.Constant;
15
16 /***
17 * The POP2 operation as defined in <a
18 * href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc11.html">
19 * http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc11.html
20 * </a>.
21 * <p>
22 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
23 * University of Technology </a>, the Netherlands. <br>
24 * See for project information <a
25 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
26 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
27 * License (GPL) </a>, no warranty <br>
28 *
29 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
30 * Jacobs </a><a
31 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
32 * Verbraeck </a>
33 * @version 1.3 Apr 6, 2004
34 * @since 1.4
35 */
36
37 public class POP2 extends VoidOperation
38 {
39 /*** OP refers to the operand code */
40 public static final int OP = 88;
41
42 /***
43 * constructs a new POP2
44 */
45 public POP2()
46 {
47 super();
48 }
49
50 /***
51 * @see nl.tudelft.simulation.dsol.interpreter.operations.VoidOperation#execute(
52 * nl.tudelft.simulation.dsol.interpreter.OperandStack,
53 * nl.tudelft.simulation.dsol.interpreter.classfile.Constant[],
54 * nl.tudelft.simulation.dsol.interpreter.LocalVariable[])
55 */
56 public void execute(final OperandStack stack,
57 final Constant[] constantPool, final LocalVariable[] localVariables)
58 {
59 Object value = stack.pop();
60 if (!(value instanceof Double) && !(value instanceof Long))
61 {
62 stack.pop();
63 }
64 }
65
66 /***
67 * @see nl.tudelft.simulation.dsol.interpreter.Operation#getByteLength()
68 */
69 public int getByteLength()
70 {
71 return OPCODE_BYTE_LENGTH;
72 }
73
74 /***
75 * @see nl.tudelft.simulation.dsol.interpreter.Operation#getOpcode()
76 */
77 public int getOpcode()
78 {
79 return POP2.OP;
80 }
81 }