diff options
Some more work on SceneObject/primitive rewrites (AllNewSceneObjectGroup2 /Part2).
Updated the JavaVM to a later version I did (basically some clean up and a little bit more functional).
Added SendLoadURL method to IClientAPI.
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 | 222 |
1 files changed, 173 insertions, 49 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 56135d3..6f8d70c 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 | |||
@@ -42,66 +42,66 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
42 | bool result = false; | 42 | bool result = false; |
43 | switch (opcode) | 43 | switch (opcode) |
44 | { | 44 | { |
45 | case 2: | 45 | case (byte)(byte)OpCode.iconst_m1: |
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 (byte)(byte)OpCode.iconst_0: |
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 (byte)(byte)OpCode.iconst_1: |
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 (byte)(byte)OpCode.iconst_2: |
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 (byte)(byte)OpCode.iconst_3: |
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 (byte)(byte)OpCode.iconst_4: |
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 (byte)OpCode.iconst_5: |
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 (byte)OpCode.fconst_0: |
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 (byte)OpCode.fconst_1: |
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 (byte)OpCode.fconst_2: |
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 (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? |
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; |
@@ -109,7 +109,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
109 | this._mThread.PC++; | 109 | this._mThread.PC++; |
110 | result = true; | 110 | result = true; |
111 | break; | 111 | break; |
112 | case 17: | 112 | case (byte)OpCode.sipush: |
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; |
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
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 (byte)OpCode.fload: |
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) |
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
131 | this._mThread.PC++; | 131 | this._mThread.PC++; |
132 | result = true; | 132 | result = true; |
133 | break; | 133 | break; |
134 | case 26: | 134 | case (byte)OpCode.iload_0: |
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) |
@@ -143,7 +143,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
143 | } | 143 | } |
144 | result = true; | 144 | result = true; |
145 | break; | 145 | break; |
146 | case 27: | 146 | case (byte)OpCode.iload_1: |
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) |
@@ -155,7 +155,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
155 | } | 155 | } |
156 | result = true; | 156 | result = true; |
157 | break; | 157 | break; |
158 | case 34: | 158 | case (byte)OpCode.fload_0: |
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) |
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
167 | } | 167 | } |
168 | result = true; | 168 | result = true; |
169 | break; | 169 | break; |
170 | case 35: | 170 | case (byte)OpCode.fload_1: |
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) |
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
179 | } | 179 | } |
180 | result = true; | 180 | result = true; |
181 | break; | 181 | break; |
182 | case 36: | 182 | case (byte)OpCode.fload_2: |
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) |
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
191 | } | 191 | } |
192 | result = true; | 192 | result = true; |
193 | break; | 193 | break; |
194 | case 37: | 194 | case (byte)OpCode.fload_3: |
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) |
@@ -203,8 +203,18 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
203 | } | 203 | } |
204 | result = true; | 204 | result = true; |
205 | break; | 205 | break; |
206 | case 56: | 206 | case (byte)OpCode.istore: |
207 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] )); | 207 | short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); |
208 | BaseType istor = this._mThread.currentFrame.OpStack.Pop(); | ||
209 | if (istor is Int) | ||
210 | { | ||
211 | this._mThread.currentFrame.LocalVariables[findex3] = (Int)istor; | ||
212 | } | ||
213 | this._mThread.PC++; | ||
214 | result = true; | ||
215 | break; | ||
216 | case (byte)OpCode.fstore: | ||
217 | short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC])); | ||
208 | BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); | 218 | BaseType fstor = this._mThread.currentFrame.OpStack.Pop(); |
209 | if (fstor is Float) | 219 | if (fstor is Float) |
210 | { | 220 | { |
@@ -213,7 +223,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
213 | this._mThread.PC++; | 223 | this._mThread.PC++; |
214 | result = true; | 224 | result = true; |
215 | break; | 225 | break; |
216 | case 59: | 226 | case (byte)OpCode.istore_0: |
217 | BaseType baset = this._mThread.currentFrame.OpStack.Pop(); | 227 | BaseType baset = this._mThread.currentFrame.OpStack.Pop(); |
218 | if (baset is Int) | 228 | if (baset is Int) |
219 | { | 229 | { |
@@ -221,7 +231,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
221 | } | 231 | } |
222 | result = true; | 232 | result = true; |
223 | break; | 233 | break; |
224 | case 60: | 234 | case (byte)OpCode.istore_1: |
225 | baset = this._mThread.currentFrame.OpStack.Pop(); | 235 | baset = this._mThread.currentFrame.OpStack.Pop(); |
226 | if (baset is Int) | 236 | if (baset is Int) |
227 | { | 237 | { |
@@ -229,7 +239,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
229 | } | 239 | } |
230 | result = true; | 240 | result = true; |
231 | break; | 241 | break; |
232 | case 67: | 242 | case (byte)OpCode.fstore_0: |
233 | baset = this._mThread.currentFrame.OpStack.Pop(); | 243 | baset = this._mThread.currentFrame.OpStack.Pop(); |
234 | if (baset is Float) | 244 | if (baset is Float) |
235 | { | 245 | { |
@@ -237,7 +247,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
237 | } | 247 | } |
238 | result = true; | 248 | result = true; |
239 | break; | 249 | break; |
240 | case 68: | 250 | case (byte)OpCode.fstore_1: |
241 | baset = this._mThread.currentFrame.OpStack.Pop(); | 251 | baset = this._mThread.currentFrame.OpStack.Pop(); |
242 | if (baset is Float) | 252 | if (baset is Float) |
243 | { | 253 | { |
@@ -245,7 +255,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
245 | } | 255 | } |
246 | result = true; | 256 | result = true; |
247 | break; | 257 | break; |
248 | case 69: | 258 | case (byte)OpCode.fstore_2: |
249 | baset = this._mThread.currentFrame.OpStack.Pop(); | 259 | baset = this._mThread.currentFrame.OpStack.Pop(); |
250 | if (baset is Float) | 260 | if (baset is Float) |
251 | { | 261 | { |
@@ -253,7 +263,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
253 | } | 263 | } |
254 | result = true; | 264 | result = true; |
255 | break; | 265 | break; |
256 | case 70: | 266 | case (byte)OpCode.fstore_3: |
257 | baset = this._mThread.currentFrame.OpStack.Pop(); | 267 | baset = this._mThread.currentFrame.OpStack.Pop(); |
258 | if (baset is Float) | 268 | if (baset is Float) |
259 | { | 269 | { |
@@ -261,11 +271,11 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
261 | } | 271 | } |
262 | result = true; | 272 | result = true; |
263 | break; | 273 | break; |
264 | case 87: | 274 | case (byte)OpCode.pop: |
265 | this._mThread.currentFrame.OpStack.Pop(); | 275 | this._mThread.currentFrame.OpStack.Pop(); |
266 | result = true; | 276 | result = true; |
267 | break; | 277 | break; |
268 | case 98: | 278 | case (byte)OpCode.fadd: |
269 | BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); | 279 | BaseType bf2 = this._mThread.currentFrame.OpStack.Pop(); |
270 | BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); | 280 | BaseType bf1 = this._mThread.currentFrame.OpStack.Pop(); |
271 | if (bf1 is Float && bf2 is Float) | 281 | if (bf1 is Float && bf2 is Float) |
@@ -276,7 +286,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
276 | } | 286 | } |
277 | result = true; | 287 | result = true; |
278 | break; | 288 | break; |
279 | case 102: | 289 | case (byte)OpCode.fsub: |
280 | BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); | 290 | BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop(); |
281 | BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); | 291 | BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop(); |
282 | if (bsf1 is Float && bsf2 is Float) | 292 | if (bsf1 is Float && bsf2 is Float) |
@@ -287,7 +297,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
287 | } | 297 | } |
288 | result = true; | 298 | result = true; |
289 | break; | 299 | break; |
290 | case 104: //check the order of the two values off the stack is correct | 300 | case (byte)OpCode.imul: //check the order of the two values off the stack is correct |
291 | BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); | 301 | BaseType bs2 = this._mThread.currentFrame.OpStack.Pop(); |
292 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); | 302 | BaseType bs1 = this._mThread.currentFrame.OpStack.Pop(); |
293 | if (bs1 is Int && bs2 is Int) | 303 | if (bs1 is Int && bs2 is Int) |
@@ -298,18 +308,18 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
298 | } | 308 | } |
299 | result = true; | 309 | result = true; |
300 | break; | 310 | break; |
301 | case 132: | 311 | case (byte)OpCode.iinc: |
302 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) | 312 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null) |
303 | { | 313 | { |
304 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) | 314 | if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int) |
305 | { | 315 | { |
306 | ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; | 316 | ((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]; |
307 | } | 317 | } |
308 | } | 318 | } |
309 | this._mThread.PC += 2; | 319 | this._mThread.PC += 2; |
310 | result = true; | 320 | result = true; |
311 | break; | 321 | break; |
312 | case 139: | 322 | case (byte)OpCode.f2i: |
313 | BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); | 323 | BaseType conv1 = this._mThread.currentFrame.OpStack.Pop(); |
314 | if (conv1 is Float) | 324 | if (conv1 is Float) |
315 | { | 325 | { |
@@ -319,7 +329,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
319 | } | 329 | } |
320 | result = true; | 330 | result = true; |
321 | break; | 331 | break; |
322 | case 149: | 332 | case (byte)OpCode.fcmpl: |
323 | BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); | 333 | BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop(); |
324 | BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); | 334 | BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop(); |
325 | if (flcom1 is Float && flcom2 is Float) | 335 | if (flcom1 is Float && flcom2 is Float) |
@@ -341,7 +351,49 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
341 | } | 351 | } |
342 | result = true; | 352 | result = true; |
343 | break; | 353 | break; |
344 | case 158: | 354 | case (byte)OpCode.fcmpg: |
355 | flcom2 = this._mThread.currentFrame.OpStack.Pop(); | ||
356 | flcom1 = this._mThread.currentFrame.OpStack.Pop(); | ||
357 | if (flcom1 is Float && flcom2 is Float) | ||
358 | { | ||
359 | Int compres = new Int(); | ||
360 | if (((Float)flcom1).mValue < ((Float)flcom2).mValue) | ||
361 | { | ||
362 | compres.mValue = -1; | ||
363 | } | ||
364 | else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) | ||
365 | { | ||
366 | compres.mValue = 1; | ||
367 | } | ||
368 | else | ||
369 | { | ||
370 | compres.mValue = 0; | ||
371 | } | ||
372 | this._mThread.currentFrame.OpStack.Push(compres); | ||
373 | } | ||
374 | result = true; | ||
375 | break; | ||
376 | case (byte)OpCode.ifge: | ||
377 | short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
378 | BaseType compe1 = this._mThread.currentFrame.OpStack.Pop(); | ||
379 | if (compe1 is Int) | ||
380 | { | ||
381 | if (((Int)compe1).mValue >= 0) | ||
382 | { | ||
383 | this._mThread.PC += -1 + compareoffset2; | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | this._mThread.PC += 2; | ||
388 | } | ||
389 | } | ||
390 | else | ||
391 | { | ||
392 | this._mThread.PC += 2; | ||
393 | } | ||
394 | result = true; | ||
395 | break; | ||
396 | case (byte)OpCode.ifle: | ||
345 | short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | 397 | 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(); | 398 | BaseType comp1 = this._mThread.currentFrame.OpStack.Pop(); |
347 | if (comp1 is Int) | 399 | if (comp1 is Int) |
@@ -361,7 +413,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
361 | } | 413 | } |
362 | result = true; | 414 | result = true; |
363 | break; | 415 | break; |
364 | case 162: | 416 | case (byte)OpCode.if_icmpge: |
365 | short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | 417 | 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(); | 418 | BaseType bc2 = this._mThread.currentFrame.OpStack.Pop(); |
367 | BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); | 419 | BaseType bc1 = this._mThread.currentFrame.OpStack.Pop(); |
@@ -370,8 +422,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
370 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); | 422 | //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); |
371 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) | 423 | if (((Int)bc1).mValue >= ((Int)bc2).mValue) |
372 | { | 424 | { |
373 | // Console.WriteLine("branch compare true , offset is " +compareoffset); | 425 | // Console.WriteLine("branch compare true , offset is " +compareoffset); |
374 | // Console.WriteLine("current PC is " + this._mThread.PC); | 426 | // Console.WriteLine("current PC is " + this._mThread.PC); |
375 | this._mThread.PC += -1 + compareoffset; | 427 | this._mThread.PC += -1 + compareoffset; |
376 | //Console.WriteLine("new PC is " + this._mThread.PC); | 428 | //Console.WriteLine("new PC is " + this._mThread.PC); |
377 | } | 429 | } |
@@ -387,7 +439,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
387 | } | 439 | } |
388 | result = true; | 440 | result = true; |
389 | break; | 441 | break; |
390 | case 164: | 442 | case (byte)OpCode.if_icmple: |
391 | short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | 443 | 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(); | 444 | BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop(); |
393 | BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); | 445 | BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop(); |
@@ -396,10 +448,10 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
396 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); | 448 | //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); |
397 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) | 449 | if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) |
398 | { | 450 | { |
399 | // Console.WriteLine("branch compare true , offset is " + compareloffset); | 451 | // Console.WriteLine("branch compare true , offset is " + compareloffset); |
400 | // Console.WriteLine("current PC is " + this._mThread.PC); | 452 | // Console.WriteLine("current PC is " + this._mThread.PC); |
401 | this._mThread.PC += -1 + compareloffset; | 453 | this._mThread.PC += -1 + compareloffset; |
402 | // Console.WriteLine("new PC is " + this._mThread.PC); | 454 | // Console.WriteLine("new PC is " + this._mThread.PC); |
403 | } | 455 | } |
404 | else | 456 | else |
405 | { | 457 | { |
@@ -413,15 +465,87 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM | |||
413 | } | 465 | } |
414 | result = true; | 466 | result = true; |
415 | break; | 467 | break; |
416 | case 167: | 468 | case (byte)OpCode._goto: |
417 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]); | 469 | short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); |
418 | this._mThread.PC += -1 + offset; | 470 | this._mThread.PC += -1 + offset; |
419 | result = true; | 471 | result = true; |
420 | break; | 472 | break; |
473 | case (byte)OpCode.getstatic: | ||
474 | short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
475 | if (this._mThread.currentClass._constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | ||
476 | { | ||
477 | if (((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value) | ||
478 | { | ||
479 | //from this class | ||
480 | if (this._mThread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | ||
481 | { | ||
482 | if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) | ||
483 | { | ||
484 | Float retFloat = new Float(); | ||
485 | retFloat.mValue = ((Float)this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; | ||
486 | this._mThread.currentFrame.OpStack.Push(retFloat); | ||
487 | } | ||
488 | else if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) | ||
489 | { | ||
490 | Int retInt = new Int(); | ||
491 | retInt.mValue = ((Int)this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; | ||
492 | // Console.WriteLine("getting static field, " + retInt.mValue); | ||
493 | this._mThread.currentFrame.OpStack.Push(retInt); | ||
494 | } | ||
495 | } | ||
496 | } | ||
497 | else | ||
498 | { | ||
499 | //get from a different class | ||
500 | } | ||
501 | } | ||
502 | this._mThread.PC += 2; | ||
503 | result = true; | ||
504 | break; | ||
505 | case (byte)OpCode.putstatic: | ||
506 | fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]); | ||
507 | BaseType addstatic = this._mThread.currentFrame.OpStack.Pop(); | ||
508 | if (this._mThread.currentClass._constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) | ||
509 | { | ||
510 | if (((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value) | ||
511 | { | ||
512 | // this class | ||
513 | if (this._mThread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) | ||
514 | { | ||
515 | if (addstatic is Float) | ||
516 | { | ||
517 | if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) | ||
518 | { | ||
519 | Float newf = new Float(); | ||
520 | newf.mValue = ((Float)addstatic).mValue; | ||
521 | this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; | ||
522 | } | ||
523 | } | ||
524 | else if (addstatic is Int) | ||
525 | { | ||
526 | if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) | ||
527 | { | ||
528 | //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); | ||
529 | Int newi = new Int(); | ||
530 | newi.mValue = ((Int)addstatic).mValue; | ||
531 | this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; | ||
532 | } | ||
533 | } | ||
534 | } | ||
535 | } | ||
536 | else | ||
537 | { | ||
538 | // a different class | ||
539 | } | ||
540 | } | ||
541 | this._mThread.PC += 2; | ||
542 | result = true; | ||
543 | break; | ||
544 | |||
421 | } | 545 | } |
422 | 546 | ||
423 | return result; | 547 | return result; |
424 | } | 548 | } |
425 | } | 549 | } |
426 | } | 550 | } |
427 | } | 551 | } \ No newline at end of file |