1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.interpreter.operations;
11
12 import java.io.DataInput;
13 import java.io.IOException;
14
15 import nl.tudelft.simulation.dsol.interpreter.Operation;
16
17 /***
18 * The WIDE operation as defined in <a
19 * href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc15.html">
20 * http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc15.html
21 * </a>.
22 * <p>
23 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
24 * University of Technology </a>, the Netherlands. <br>
25 * See for project information <a
26 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
27 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
28 * License (GPL) </a>, no warranty <br>
29 *
30 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
31 * Jacobs </a><a
32 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
33 * Verbraeck </a>
34 * @version 1.3 Apr 6, 2004
35 * @since 1.4
36 */
37 public class WIDE extends Operation
38 {
39 /*** OP refers to the operand code */
40 public static final int OP = 196;
41
42 /*** the index to the target */
43 private Operation target;
44
45 /***
46 * constructs a new WIDE
47 *
48 * @param dataInput the dataInput
49 * @throws IOException on IOfailure
50 */
51 public WIDE(final DataInput dataInput) throws IOException
52 {
53 super();
54 int operand = dataInput.readUnsignedShort();
55 switch (operand)
56 {
57 case ILOAD.OP :
58 this.target = new ILOAD(dataInput, true);
59 break;
60 case FLOAD.OP :
61 this.target = new FLOAD(dataInput, true);
62 break;
63 case ALOAD.OP :
64 this.target = new ALOAD(dataInput, true);
65 break;
66 case LLOAD.OP :
67 this.target = new LLOAD(dataInput, true);
68 break;
69 case DLOAD.OP :
70 this.target = new DLOAD(dataInput, true);
71 break;
72 case ISTORE.OP :
73 this.target = new ISTORE(dataInput, true);
74 break;
75 case FSTORE.OP :
76 this.target = new FSTORE(dataInput, true);
77 break;
78 case ASTORE.OP :
79 this.target = new ASTORE(dataInput, true);
80 break;
81 case LSTORE.OP :
82 this.target = new LSTORE(dataInput, true);
83 break;
84 case DSTORE.OP :
85 this.target = new DSTORE(dataInput, true);
86 break;
87 case RET.OP :
88 this.target = new RET(dataInput, true);
89 break;
90 case IINC.OP :
91 this.target = new IINC(dataInput, true);
92 break;
93 default :
94 throw new IOException("Cannot use operand=" + operand
95 + " in wide");
96 }
97 }
98
99 /***
100 * @see nl.tudelft.simulation.dsol.interpreter.Operation#getByteLength()
101 */
102 public int getByteLength()
103 {
104 return 2 * OPCODE_BYTE_LENGTH + this.target.getByteLength();
105 }
106
107 /***
108 * @see nl.tudelft.simulation.dsol.interpreter.Operation#getOpcode()
109 */
110 public int getOpcode()
111 {
112 return WIDE.OP;
113 }
114
115 /***
116 * @return Returns the target.
117 */
118 public Operation getTarget()
119 {
120 return this.target;
121 }
122
123 }