diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs | 854 |
1 files changed, 427 insertions, 427 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs index ef6b805..56135d3 100644 --- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Interpreter.Logic.cs | |||
@@ -1,427 +1,427 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; | 31 | using OpenSim.Region.Scripting.EmbeddedJVM.Types; |
32 | using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; | 32 | using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes; |
33 | 33 | ||
34 | namespace OpenSim.Region.Scripting.EmbeddedJVM | 34 | namespace OpenSim.Region.Scripting.EmbeddedJVM |
35 | { | 35 | { |
36 | partial class Thread | 36 | partial class Thread |
37 | { | 37 | { |
38 | private partial class Interpreter | 38 | private partial class Interpreter |
39 | { | 39 | { |
40 | private bool IsLogicOpCode(byte opcode) | 40 | private bool IsLogicOpCode(byte opcode) |
41 | { | 41 | { |
42 | bool result = false; | 42 | bool result = false; |
43 | switch (opcode) | 43 | switch (opcode) |
44 | { | 44 | { |
45 | case 2: | 45 | case 2: |
46 | Int m_int= new Int(); | 46 | Int m_int= new Int(); |
47 | m_int.mValue = -1; | 47 | m_int.mValue = -1; |
48 | this._mThread.currentFrame.OpStack.Push(m_int); | 48 | this._mThread.currentFrame.OpStack.Push(m_int); |
49 | result = true; | 49 | result = true; |
50 | break; | 50 | break; |
51 | case 3: | 51 | case 3: |
52 | m_int= new Int(); | 52 | m_int= new Int(); |
53 | m_int.mValue = 0; | 53 | m_int.mValue = 0; |
54 | this._mThread.currentFrame.OpStack.Push(m_int); | 54 | this._mThread.currentFrame.OpStack.Push(m_int); |
55 | result = true; | 55 | result = true; |
56 | break; | 56 | break; |
57 | case 4: | 57 | case 4: |
58 | m_int = new Int(); | 58 | m_int = new Int(); |
59 | m_int.mValue = 1; | 59 | m_int.mValue = 1; |
60 | this._mThread.currentFrame.OpStack.Push(m_int); | 60 | this._mThread.currentFrame.OpStack.Push(m_int); |
61 | result = true; | 61 | result = true; |
62 | break; | 62 | break; |
63 | case 5: | 63 | case 5: |
64 | m_int = new Int(); | 64 | m_int = new Int(); |
65 | m_int.mValue = 2; | 65 | m_int.mValue = 2; |
66 | this._mThread.currentFrame.OpStack.Push(m_int); | 66 | this._mThread.currentFrame.OpStack.Push(m_int); |
67 | result = true; | 67 | result = true; |
68 | break; | 68 | break; |
69 | case 6: | 69 | case 6: |
70 | m_int = new Int(); | 70 | m_int = new Int(); |
71 | m_int.mValue = 3; | 71 | m_int.mValue = 3; |
72 | this._mThread.currentFrame.OpStack.Push(m_int); | 72 | this._mThread.currentFrame.OpStack.Push(m_int); |
73 | break; | 73 | break; |
74 | case 7: | 74 | case 7: |
75 | m_int = new Int(); | 75 | m_int = new Int(); |
76 | m_int.mValue = 4; | 76 | m_int.mValue = 4; |
77 | this._mThread.currentFrame.OpStack.Push(m_int); | 77 | this._mThread.currentFrame.OpStack.Push(m_int); |
78 | result = true; | 78 | result = true; |
79 | break; | 79 | break; |
80 | case 8: | 80 | case 8: |
81 | m_int = new Int(); | 81 | m_int = new Int(); |
82 | m_int.mValue = 5; | 82 | m_int.mValue = 5; |
83 | this._mThread.currentFrame.OpStack.Push(m_int); | 83 | this._mThread.currentFrame.OpStack.Push(m_int); |
84 | result = true; | 84 | result = true; |
85 | break; | 85 | break; |
86 | case 11: | 86 | case 11: |
87 | Float m_float = new Float(); | 87 | Float m_float = new Float(); |
88 | m_float.mValue = 0.0f; | 88 | m_float.mValue = 0.0f; |
89 | this._mThread.currentFrame.OpStack.Push(m_float); | 89 | this._mThread.currentFrame.OpStack.Push(m_float); |
90 | result = true; | 90 | result = true; |
91 | break; | 91 | break; |
92 | case 12: | 92 | case 12: |
93 | m_float = new Float(); | 93 | m_float = new Float(); |
94 | m_float.mValue = 1.0f; | 94 | m_float.mValue = 1.0f; |
95 | this._mThread.currentFrame.OpStack.Push(m_float); | 95 | this._mThread.currentFrame.OpStack.Push(m_float); |
96 | result = true; | 96 | result = true; |
97 | break; | 97 | break; |
98 | case 13: | 98 | case 13: |
99 | m_float = new Float(); | 99 | m_float = new Float(); |
100 | m_float.mValue = 2.0f; | 100 | m_float.mValue = 2.0f; |
101 | this._mThread.currentFrame.OpStack.Push(m_float); | 101 | this._mThread.currentFrame.OpStack.Push(m_float); |
102 | result = true; | 102 | result = true; |
103 | break; | 103 | break; |
104 | case 16: | 104 | case 16: |
105 | int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; | 105 | int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]; |
106 | Int pushInt = new Int(); | 106 | Int pushInt = new Int(); |
107 | pushInt.mValue = pushvalue; | 107 | pushInt.mValue = pushvalue; |
108 | this._mThread.currentFrame.OpStack.Push(pushInt); | 108 | this._mThread.currentFrame.OpStack.Push(pushInt); |
109 | this._mThread.PC++; | 109 | this._mThread.PC++; |
110 | result = true; | 110 | result = true; |
111 | break; | 111 | break; |
112 | case 17: | 112 | case 17: |
113 | short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | 113 | short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); |
114 | Int pushInt2 = new Int(); | 114 | Int pushInt2 = new Int(); |
115 | pushInt2.mValue = pushvalue2; | 115 | pushInt2.mValue = pushvalue2; |
116 | this._mThread.currentFrame.OpStack.Push(pushInt2); | 116 | this._mThread.currentFrame.OpStack.Push(pushInt2); |
117 | this._mThread.PC += 2; | 117 | this._mThread.PC += 2; |
118 | result = true; | 118 | result = true; |
119 | break; | 119 | break; |
120 | case 23: | 120 | case 23: |
121 | short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); | 121 | short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); |
122 | Float fload = new Float(); | 122 | Float fload = new Float(); |
123 | if (this._mThread.currentFrame.LocalVariables[findex1] != null) | 123 | if (this._mThread.currentFrame.LocalVariables[findex1] != null) |
124 | { | 124 | { |
125 | if (this._mThread.currentFrame.LocalVariables[findex1] is Float) | 125 | if (this._mThread.currentFrame.LocalVariables[findex1] is Float) |
126 | { | 126 | { |
127 | fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue; | 127 | fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue; |
128 | this._mThread.currentFrame.OpStack.Push(fload); | 128 | this._mThread.currentFrame.OpStack.Push(fload); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | this._mThread.PC++; | 131 | this._mThread.PC++; |
132 | result = true; | 132 | result = true; |
133 | break; | 133 | break; |
134 | case 26: | 134 | case 26: |
135 | if (this._mThread.currentFrame.LocalVariables[0] != null) | 135 | if (this._mThread.currentFrame.LocalVariables[0] != null) |
136 | { | 136 | { |
137 | if (this._mThread.currentFrame.LocalVariables[0] is Int) | 137 | if (this._mThread.currentFrame.LocalVariables[0] is Int) |
138 | { | 138 | { |
139 | Int newInt = new Int(); | 139 | Int newInt = new Int(); |
140 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue; | 140 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue; |
141 | this._mThread.currentFrame.OpStack.Push(newInt); | 141 | this._mThread.currentFrame.OpStack.Push(newInt); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | result = true; | 144 | result = true; |
145 | break; | 145 | break; |
146 | case 27: | 146 | case 27: |
147 | if (this._mThread.currentFrame.LocalVariables[1] != null) | 147 | if (this._mThread.currentFrame.LocalVariables[1] != null) |
148 | { | 148 | { |
149 | if (this._mThread.currentFrame.LocalVariables[1] is Int) | 149 | if (this._mThread.currentFrame.LocalVariables[1] is Int) |
150 | { | 150 | { |
151 | Int newInt = new Int(); | 151 | Int newInt = new Int(); |
152 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue; | 152 | newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue; |
153 | this._mThread.currentFrame.OpStack.Push(newInt); | 153 | this._mThread.currentFrame.OpStack.Push(newInt); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | result = true; | 156 | result = true; |
157 | break; | 157 | break; |
158 | case 34: | 158 | case 34: |
159 | if (this._mThread.currentFrame.LocalVariables[0] != null) | 159 | if (this._mThread.currentFrame.LocalVariables[0] != null) |
160 | { | 160 | { |
161 | if (this._mThread.currentFrame.LocalVariables[0] is Float) | 161 | if (this._mThread.currentFrame.LocalVariables[0] is Float) |
162 | { | 162 | { |
163 | Float newfloat = new Float(); | 163 | Float newfloat = new Float(); |
164 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue; | 164 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue; |
165 | this._mThread.currentFrame.OpStack.Push(newfloat); | 165 | this._mThread.currentFrame.OpStack.Push(newfloat); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | result = true; | 168 | result = true; |
169 | break; | 169 | break; |
170 | case 35: | 170 | case 35: |
171 | if (this._mThread.currentFrame.LocalVariables[1] != null) | 171 | if (this._mThread.currentFrame.LocalVariables[1] != null) |
172 | { | 172 | { |
173 | if (this._mThread.currentFrame.LocalVariables[1] is Float) | 173 | if (this._mThread.currentFrame.LocalVariables[1] is Float) |
174 | { | 174 | { |
175 | Float newfloat = new Float(); | 175 | Float newfloat = new Float(); |
176 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue; | 176 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue; |
177 | this._mThread.currentFrame.OpStack.Push(newfloat); | 177 | this._mThread.currentFrame.OpStack.Push(newfloat); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | result = true; | 180 | result = true; |
181 | break; | 181 | break; |
182 | case 36: | 182 | case 36: |
183 | if (this._mThread.currentFrame.LocalVariables[2] != null) | 183 | if (this._mThread.currentFrame.LocalVariables[2] != null) |
184 | { | 184 | { |
185 | if (this._mThread.currentFrame.LocalVariables[2] is Float) | 185 | if (this._mThread.currentFrame.LocalVariables[2] is Float) |
186 | { | 186 | { |
187 | Float newfloat = new Float(); | 187 | Float newfloat = new Float(); |
188 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue; | 188 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue; |
189 | this._mThread.currentFrame.OpStack.Push(newfloat); | 189 | this._mThread.currentFrame.OpStack.Push(newfloat); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | result = true; | 192 | result = true; |
193 | break; | 193 | break; |
194 | case 37: | 194 | case 37: |
195 | if (this._mThread.currentFrame.LocalVariables[3] != null) | 195 | if (this._mThread.currentFrame.LocalVariables[3] != null) |
196 | { | 196 | { |
197 | if (this._mThread.currentFrame.LocalVariables[3] is Float) | 197 | if (this._mThread.currentFrame.LocalVariables[3] is Float) |
198 | { | 198 | { |
199 | Float newfloat = new Float(); | 199 | Float newfloat = new Float(); |
200 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue; | 200 | newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue; |
201 | this._mThread.currentFrame.OpStack.Push(newfloat); | 201 | this._mThread.currentFrame.OpStack.Push(newfloat); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | result = true; | 204 | result = true; |
205 | break; | 205 | break; |
206 | case 56: | 206 | case 56: |
207 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); | 207 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); |
208 | BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); | 208 | BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); |
209 | if (fstor is Float) | 209 | if (fstor is Float) |
210 | { | 210 | { |
211 | this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor; | 211 | this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor; |
212 | } | 212 | } |
213 | this._mThread.PC++; | 213 | this._mThread.PC++; |
214 | result = true; | 214 | result = true; |
215 | break; | 215 | break; |
216 | case 59: | 216 | case 59: |
217 | BaseType baset = this._mThread.currentFrame.OpStack.Pop(); | 217 | BaseType baset = this._mThread.currentFrame.OpStack.Pop(); |
218 | if (baset is Int) | 218 | if (baset is Int) |
219 | { | 219 | { |
220 | this._mThread.currentFrame.LocalVariables[0] = (Int)baset; | 220 | this._mThread.currentFrame.LocalVariables[0] = (Int)baset; |
221 | } | 221 | } |
222 | result = true; | 222 | result = true; |
223 | break; | 223 | break; |
224 | case 60: | 224 | case 60: |
225 | baset = this._mThread.currentFrame.OpStack.Pop(); | 225 | baset = this._mThread.currentFrame.OpStack.Pop(); |
226 | if (baset is Int) | 226 | if (baset is Int) |
227 | { | 227 | { |
228 | this._mThread.currentFrame.LocalVariables[1] = (Int)baset; | 228 | this._mThread.currentFrame.LocalVariables[1] = (Int)baset; |
229 | } | 229 | } |
230 | result = true; | 230 | result = true; |
231 | break; | 231 | break; |
232 | case 67: | 232 | case 67: |
233 | baset = this._mThread.currentFrame.OpStack.Pop(); | 233 | baset = this._mThread.currentFrame.OpStack.Pop(); |
234 | if (baset is Float) | 234 | if (baset is Float) |
235 | { | 235 | { |
236 | this._mThread.currentFrame.LocalVariables[0] = (Float)baset; | 236 | this._mThread.currentFrame.LocalVariables[0] = (Float)baset; |
237 | } | 237 | } |
238 | result = true; | 238 | result = true; |
239 | break; | 239 | break; |
240 | case 68: | 240 | case 68: |
241 | baset = this._mThread.currentFrame.OpStack.Pop(); | 241 | baset = this._mThread.currentFrame.OpStack.Pop(); |
242 | if (baset is Float) | 242 | if (baset is Float) |
243 | { | 243 | { |
244 | this._mThread.currentFrame.LocalVariables[1] = (Float)baset; | 244 | this._mThread.currentFrame.LocalVariables[1] = (Float)baset; |
245 | } | 245 | } |
246 | result = true; | 246 | result = true; |
247 | break; | 247 | break; |
248 | case 69: | 248 | case 69: |
249 | baset = this._mThread.currentFrame.OpStack.Pop(); | 249 | baset = this._mThread.currentFrame.OpStack.Pop(); |
250 | if (baset is Float) | 250 | if (baset is Float) |
251 | { | 251 | { |
252 | this._mThread.currentFrame.LocalVariables[2] = (Float)baset; | 252 | this._mThread.currentFrame.LocalVariables[2] = (Float)baset; |
253 | } | 253 | } |
254 | result = true; | 254 | result = true; |
255 | break; | 255 | break; |
256 | case 70: | 256 | case 70: |
257 | baset = this._mThread.currentFrame.OpStack.Pop(); | 257 | baset = this._mThread.currentFrame.OpStack.Pop(); |
258 | if (baset is Float) | 258 | if (baset is Float) |
259 | { | 259 | { |
260 | this._mThread.currentFrame.LocalVariables[3] = (Float)baset; | 260 | this._mThread.currentFrame.LocalVariables[3] = (Float)baset; |
261 | } | 261 | } |
262 | result = true; | 262 | result = true; |
263 | break; | 263 | break; |
264 | case 87: | 264 | case 87: |
265 | this._mThread.currentFrame.OpStack.Pop(); | 265 | this._mThread.currentFrame.OpStack.Pop(); |
266 | result = true; | 266 | result = true; |
267 | break; | 267 | break; |
268 | case 98: | 268 | case 98: |
269 | BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); | 269 | BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); |
270 | BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); | 270 | BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); |
271 | if (bf1 is Float && bf2 is Float) | 271 | if (bf1 is Float && bf2 is Float) |
272 | { | 272 | { |
273 | Float nflt = new Float(); | 273 | Float nflt = new Float(); |
274 | nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; | 274 | nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; |
275 | this._mThread.currentFrame.OpStack.Push(nflt); | 275 | this._mThread.currentFrame.OpStack.Push(nflt); |
276 | } | 276 | } |
277 | result = true; | 277 | result = true; |
278 | break; | 278 | break; |
279 | case 102: | 279 | case 102: |
280 | BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); | 280 | BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); |
281 | BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); | 281 | BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); |
282 | if (bsf1 is Float && bsf2 is Float) | 282 | if (bsf1 is Float && bsf2 is Float) |
283 | { | 283 | { |
284 | Float resf = new Float(); | 284 | Float resf = new Float(); |
285 | resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; | 285 | resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; |
286 | this._mThread.currentFrame.OpStack.Push(resf); | 286 | this._mThread.currentFrame.OpStack.Push(resf); |
287 | } | 287 | } |
288 | result = true; | 288 | result = true; |
289 | break; | 289 | break; |
290 | case 104: //check the order of the two values off the stack is correct | 290 | case 104: //check the order of the two values off the stack is correct |
291 | BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); | 291 | BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); |
292 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); | 292 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); |
293 | if (bs1 is Int && bs2 is Int) | 293 | if (bs1 is Int && bs2 is Int) |
294 | { | 294 | { |
295 | Int nInt = new Int(); | 295 | Int nInt = new Int(); |
296 | nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; | 296 | nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; |
297 | this._mThread.currentFrame.OpStack.Push(nInt); | 297 | this._mThread.currentFrame.OpStack.Push(nInt); |
298 | } | 298 | } |
299 | result = true; | 299 | result = true; |
300 | break; | 300 | break; |
301 | case 132: | 301 | case 132: |
302 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) | 302 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) |
303 | { | 303 | { |
304 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) | 304 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) |
305 | { | 305 | { |
306 | ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; | 306 | ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; |
307 | } | 307 | } |
308 | } | 308 | } |
309 | this._mThread.PC += 2; | 309 | this._mThread.PC += 2; |
310 | result = true; | 310 | result = true; |
311 | break; | 311 | break; |
312 | case 139: | 312 | case 139: |
313 | BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); | 313 | BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); |
314 | if (conv1 is Float) | 314 | if (conv1 is Float) |
315 | { | 315 | { |
316 | Int newconv = new Int(); | 316 | Int newconv = new Int(); |
317 | newconv.mValue = (int)((Float)conv1).mValue; | 317 | newconv.mValue = (int)((Float)conv1).mValue; |
318 | this._mThread.currentFrame.OpStack.Push(newconv); | 318 | this._mThread.currentFrame.OpStack.Push(newconv); |
319 | } | 319 | } |
320 | result = true; | 320 | result = true; |
321 | break; | 321 | break; |
322 | case 149: | 322 | case 149: |
323 | BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); | 323 | BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); |
324 | BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); | 324 | BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); |
325 | if (flcom1 is Float && flcom2 is Float) | 325 | if (flcom1 is Float && flcom2 is Float) |
326 | { | 326 | { |
327 | Int compres = new Int(); | 327 | Int compres = new Int(); |
328 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | 328 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) |
329 | { | 329 | { |
330 | compres.mValue = -1; | 330 | compres.mValue = -1; |
331 | } | 331 | } |
332 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | 332 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) |
333 | { | 333 | { |
334 | compres.mValue = 1; | 334 | compres.mValue = 1; |
335 | } | 335 | } |
336 | else | 336 | else |
337 | { | 337 | { |
338 | compres.mValue = 0; | 338 | compres.mValue = 0; |
339 | } | 339 | } |
340 | this._mThread.currentFrame.OpStack.Push(compres); | 340 | this._mThread.currentFrame.OpStack.Push(compres); |
341 | } | 341 | } |
342 | result = true; | 342 | result = true; |
343 | break; | 343 | break; |
344 | case 158: | 344 | case 158: |
345 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | 345 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); |
346 | BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); | 346 | BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); |
347 | if (comp1 is Int) | 347 | if (comp1 is Int) |
348 | { | 348 | { |
349 | if (((Int)comp1).mValue <= 0) | 349 | if (((Int)comp1).mValue <= 0) |
350 | { | 350 | { |
351 | this._mThread.PC += -1 + compareoffset1; | 351 | this._mThread.PC += -1 + compareoffset1; |
352 | } | 352 | } |
353 | else | 353 | else |
354 | { | 354 | { |
355 | this._mThread.PC += 2; | 355 | this._mThread.PC += 2; |
356 | } | 356 | } |
357 | } | 357 | } |
358 | else | 358 | else |
359 | { | 359 | { |
360 | this._mThread.PC += 2; | 360 | this._mThread.PC += 2; |
361 | } | 361 | } |
362 | result = true; | 362 | result = true; |
363 | break; | 363 | break; |
364 | case 162: | 364 | case 162: |
365 | short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | 365 | short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); |
366 | BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); | 366 | BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); |
367 | BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); | 367 | BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); |
368 | if (bc1 is Int && bc2 is Int) | 368 | if (bc1 is Int && bc2 is Int) |
369 | { | 369 | { |
370 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); | 370 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); |
371 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) | 371 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) |
372 | { | 372 | { |
373 | // Console.WriteLine("branch compare true , offset is " +compareoffset); | 373 | // Console.WriteLine("branch compare true , offset is " +compareoffset); |
374 | // Console.WriteLine("current PC is " + this._mThread.PC); | 374 | // Console.WriteLine("current PC is " + this._mThread.PC); |
375 | this._mThread.PC += -1 + compareoffset; | 375 | this._mThread.PC += -1 + compareoffset; |
376 | //Console.WriteLine("new PC is " + this._mThread.PC); | 376 | //Console.WriteLine("new PC is " + this._mThread.PC); |
377 | } | 377 | } |
378 | else | 378 | else |
379 | { | 379 | { |
380 | //Console.WriteLine("branch compare false"); | 380 | //Console.WriteLine("branch compare false"); |
381 | this._mThread.PC += 2; | 381 | this._mThread.PC += 2; |
382 | } | 382 | } |
383 | } | 383 | } |
384 | else | 384 | else |
385 | { | 385 | { |
386 | this._mThread.PC += 2; | 386 | this._mThread.PC += 2; |
387 | } | 387 | } |
388 | result = true; | 388 | result = true; |
389 | break; | 389 | break; |
390 | case 164: | 390 | case 164: |
391 | short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | 391 | short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); |
392 | BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); | 392 | BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); |
393 | BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); | 393 | BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); |
394 | if (bcl1 is Int && bcl2 is Int) | 394 | if (bcl1 is Int && bcl2 is Int) |
395 | { | 395 | { |
396 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); | 396 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); |
397 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) | 397 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) |
398 | { | 398 | { |
399 | // Console.WriteLine("branch compare true , offset is " + compareloffset); | 399 | // Console.WriteLine("branch compare true , offset is " + compareloffset); |
400 | // Console.WriteLine("current PC is " + this._mThread.PC); | 400 | // Console.WriteLine("current PC is " + this._mThread.PC); |
401 | this._mThread.PC += -1 + compareloffset; | 401 | this._mThread.PC += -1 + compareloffset; |
402 | // Console.WriteLine("new PC is " + this._mThread.PC); | 402 | // Console.WriteLine("new PC is " + this._mThread.PC); |
403 | } | 403 | } |
404 | else | 404 | else |
405 | { | 405 | { |
406 | //Console.WriteLine("branch compare false"); | 406 | //Console.WriteLine("branch compare false"); |
407 | this._mThread.PC += 2; | 407 | this._mThread.PC += 2; |
408 | } | 408 | } |
409 | } | 409 | } |
410 | else | 410 | else |
411 | { | 411 | { |
412 | this._mThread.PC += 2; | 412 | this._mThread.PC += 2; |
413 | } | 413 | } |
414 | result = true; | 414 | result = true; |
415 | break; | 415 | break; |
416 | case 167: | 416 | case 167: |
417 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); | 417 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); |
418 | this._mThread.PC += -1 + offset; | 418 | this._mThread.PC += -1 + offset; |
419 | result = true; | 419 | result = true; |
420 | break; | 420 | break; |
421 | } | 421 | } |
422 | 422 | ||
423 | return result; | 423 | return result; |
424 | } | 424 | } |
425 | } | 425 | } |
426 | } | 426 | } |
427 | } | 427 | } |