aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
parent* Deleted .user file (diff)
downloadopensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs')
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs454
1 files changed, 261 insertions, 193 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
index 6b8930e..b172562 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
@@ -25,9 +25,6 @@
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*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 28using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 29using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33 30
@@ -42,304 +39,313 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
42 bool result = false; 39 bool result = false;
43 switch (opcode) 40 switch (opcode)
44 { 41 {
45 case (byte)(byte)OpCode.iconst_m1: 42 case (byte) (byte) OpCode.iconst_m1:
46 Int m_int = new Int(); 43 Int m_int = new Int();
47 m_int.mValue = -1; 44 m_int.mValue = -1;
48 this.m_thread.m_currentFrame.OpStack.Push(m_int); 45 m_thread.m_currentFrame.OpStack.Push(m_int);
49 result = true; 46 result = true;
50 break; 47 break;
51 case (byte)(byte)OpCode.iconst_0: 48 case (byte) (byte) OpCode.iconst_0:
52 m_int = new Int(); 49 m_int = new Int();
53 m_int.mValue = 0; 50 m_int.mValue = 0;
54 this.m_thread.m_currentFrame.OpStack.Push(m_int); 51 m_thread.m_currentFrame.OpStack.Push(m_int);
55 result = true; 52 result = true;
56 break; 53 break;
57 case (byte)(byte)OpCode.iconst_1: 54 case (byte) (byte) OpCode.iconst_1:
58 m_int = new Int(); 55 m_int = new Int();
59 m_int.mValue = 1; 56 m_int.mValue = 1;
60 this.m_thread.m_currentFrame.OpStack.Push(m_int); 57 m_thread.m_currentFrame.OpStack.Push(m_int);
61 result = true; 58 result = true;
62 break; 59 break;
63 case (byte)(byte)OpCode.iconst_2: 60 case (byte) (byte) OpCode.iconst_2:
64 m_int = new Int(); 61 m_int = new Int();
65 m_int.mValue = 2; 62 m_int.mValue = 2;
66 this.m_thread.m_currentFrame.OpStack.Push(m_int); 63 m_thread.m_currentFrame.OpStack.Push(m_int);
67 result = true; 64 result = true;
68 break; 65 break;
69 case (byte)(byte)OpCode.iconst_3: 66 case (byte) (byte) OpCode.iconst_3:
70 m_int = new Int(); 67 m_int = new Int();
71 m_int.mValue = 3; 68 m_int.mValue = 3;
72 this.m_thread.m_currentFrame.OpStack.Push(m_int); 69 m_thread.m_currentFrame.OpStack.Push(m_int);
73 break; 70 break;
74 case (byte)(byte)OpCode.iconst_4: 71 case (byte) (byte) OpCode.iconst_4:
75 m_int = new Int(); 72 m_int = new Int();
76 m_int.mValue = 4; 73 m_int.mValue = 4;
77 this.m_thread.m_currentFrame.OpStack.Push(m_int); 74 m_thread.m_currentFrame.OpStack.Push(m_int);
78 result = true; 75 result = true;
79 break; 76 break;
80 case (byte)OpCode.iconst_5: 77 case (byte) OpCode.iconst_5:
81 m_int = new Int(); 78 m_int = new Int();
82 m_int.mValue = 5; 79 m_int.mValue = 5;
83 this.m_thread.m_currentFrame.OpStack.Push(m_int); 80 m_thread.m_currentFrame.OpStack.Push(m_int);
84 result = true; 81 result = true;
85 break; 82 break;
86 case (byte)OpCode.fconst_0: 83 case (byte) OpCode.fconst_0:
87 Float m_float = new Float(); 84 Float m_float = new Float();
88 m_float.mValue = 0.0f; 85 m_float.mValue = 0.0f;
89 this.m_thread.m_currentFrame.OpStack.Push(m_float); 86 m_thread.m_currentFrame.OpStack.Push(m_float);
90 result = true; 87 result = true;
91 break; 88 break;
92 case (byte)OpCode.fconst_1: 89 case (byte) OpCode.fconst_1:
93 m_float = new Float(); 90 m_float = new Float();
94 m_float.mValue = 1.0f; 91 m_float.mValue = 1.0f;
95 this.m_thread.m_currentFrame.OpStack.Push(m_float); 92 m_thread.m_currentFrame.OpStack.Push(m_float);
96 result = true; 93 result = true;
97 break; 94 break;
98 case (byte)OpCode.fconst_2: 95 case (byte) OpCode.fconst_2:
99 m_float = new Float(); 96 m_float = new Float();
100 m_float.mValue = 2.0f; 97 m_float.mValue = 2.0f;
101 this.m_thread.m_currentFrame.OpStack.Push(m_float); 98 m_thread.m_currentFrame.OpStack.Push(m_float);
102 result = true; 99 result = true;
103 break; 100 break;
104 case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? 101 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.m_thread.PC]; 102 int pushvalue = (int) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC];
106 Int pushInt = new Int(); 103 Int pushInt = new Int();
107 pushInt.mValue = pushvalue; 104 pushInt.mValue = pushvalue;
108 this.m_thread.m_currentFrame.OpStack.Push(pushInt); 105 m_thread.m_currentFrame.OpStack.Push(pushInt);
109 this.m_thread.PC++; 106 m_thread.PC++;
110 result = true; 107 result = true;
111 break; 108 break;
112 case (byte)OpCode.sipush: 109 case (byte) OpCode.sipush:
113 short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 110 short pushvalue2 =
111 (short)
112 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
113 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
114 Int pushInt2 = new Int(); 114 Int pushInt2 = new Int();
115 pushInt2.mValue = pushvalue2; 115 pushInt2.mValue = pushvalue2;
116 this.m_thread.m_currentFrame.OpStack.Push(pushInt2); 116 m_thread.m_currentFrame.OpStack.Push(pushInt2);
117 this.m_thread.PC += 2; 117 m_thread.PC += 2;
118 result = true; 118 result = true;
119 break; 119 break;
120 case (byte)OpCode.fload: 120 case (byte) OpCode.fload:
121 short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 121 short findex1 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]));
122 Float fload = new Float(); 122 Float fload = new Float();
123 if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null) 123 if (m_thread.m_currentFrame.LocalVariables[findex1] != null)
124 { 124 {
125 if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) 125 if (m_thread.m_currentFrame.LocalVariables[findex1] is Float)
126 { 126 {
127 fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue; 127 fload.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[findex1]).mValue;
128 this.m_thread.m_currentFrame.OpStack.Push(fload); 128 m_thread.m_currentFrame.OpStack.Push(fload);
129 } 129 }
130 } 130 }
131 this.m_thread.PC++; 131 m_thread.PC++;
132 result = true; 132 result = true;
133 break; 133 break;
134 case (byte)OpCode.iload_0: 134 case (byte) OpCode.iload_0:
135 if (this.m_thread.m_currentFrame.LocalVariables[0] != null) 135 if (m_thread.m_currentFrame.LocalVariables[0] != null)
136 { 136 {
137 if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) 137 if (m_thread.m_currentFrame.LocalVariables[0] is Int)
138 { 138 {
139 Int newInt = new Int(); 139 Int newInt = new Int();
140 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; 140 newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[0]).mValue;
141 this.m_thread.m_currentFrame.OpStack.Push(newInt); 141 m_thread.m_currentFrame.OpStack.Push(newInt);
142 } 142 }
143 } 143 }
144 result = true; 144 result = true;
145 break; 145 break;
146 case (byte)OpCode.iload_1: 146 case (byte) OpCode.iload_1:
147 if (this.m_thread.m_currentFrame.LocalVariables[1] != null) 147 if (m_thread.m_currentFrame.LocalVariables[1] != null)
148 { 148 {
149 if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) 149 if (m_thread.m_currentFrame.LocalVariables[1] is Int)
150 { 150 {
151 Int newInt = new Int(); 151 Int newInt = new Int();
152 newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; 152 newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[1]).mValue;
153 this.m_thread.m_currentFrame.OpStack.Push(newInt); 153 m_thread.m_currentFrame.OpStack.Push(newInt);
154 } 154 }
155 } 155 }
156 result = true; 156 result = true;
157 break; 157 break;
158 case (byte)OpCode.fload_0: 158 case (byte) OpCode.fload_0:
159 if (this.m_thread.m_currentFrame.LocalVariables[0] != null) 159 if (m_thread.m_currentFrame.LocalVariables[0] != null)
160 { 160 {
161 if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) 161 if (m_thread.m_currentFrame.LocalVariables[0] is Float)
162 { 162 {
163 Float newfloat = new Float(); 163 Float newfloat = new Float();
164 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; 164 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[0]).mValue;
165 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 165 m_thread.m_currentFrame.OpStack.Push(newfloat);
166 } 166 }
167 } 167 }
168 result = true; 168 result = true;
169 break; 169 break;
170 case (byte)OpCode.fload_1: 170 case (byte) OpCode.fload_1:
171 if (this.m_thread.m_currentFrame.LocalVariables[1] != null) 171 if (m_thread.m_currentFrame.LocalVariables[1] != null)
172 { 172 {
173 if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) 173 if (m_thread.m_currentFrame.LocalVariables[1] is Float)
174 { 174 {
175 Float newfloat = new Float(); 175 Float newfloat = new Float();
176 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; 176 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[1]).mValue;
177 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 177 m_thread.m_currentFrame.OpStack.Push(newfloat);
178 } 178 }
179 } 179 }
180 result = true; 180 result = true;
181 break; 181 break;
182 case (byte)OpCode.fload_2: 182 case (byte) OpCode.fload_2:
183 if (this.m_thread.m_currentFrame.LocalVariables[2] != null) 183 if (m_thread.m_currentFrame.LocalVariables[2] != null)
184 { 184 {
185 if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) 185 if (m_thread.m_currentFrame.LocalVariables[2] is Float)
186 { 186 {
187 Float newfloat = new Float(); 187 Float newfloat = new Float();
188 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue; 188 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[2]).mValue;
189 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 189 m_thread.m_currentFrame.OpStack.Push(newfloat);
190 } 190 }
191 } 191 }
192 result = true; 192 result = true;
193 break; 193 break;
194 case (byte)OpCode.fload_3: 194 case (byte) OpCode.fload_3:
195 if (this.m_thread.m_currentFrame.LocalVariables[3] != null) 195 if (m_thread.m_currentFrame.LocalVariables[3] != null)
196 { 196 {
197 if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) 197 if (m_thread.m_currentFrame.LocalVariables[3] is Float)
198 { 198 {
199 Float newfloat = new Float(); 199 Float newfloat = new Float();
200 newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue; 200 newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[3]).mValue;
201 this.m_thread.m_currentFrame.OpStack.Push(newfloat); 201 m_thread.m_currentFrame.OpStack.Push(newfloat);
202 } 202 }
203 } 203 }
204 result = true; 204 result = true;
205 break; 205 break;
206 case (byte)OpCode.istore: 206 case (byte) OpCode.istore:
207 short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 207 short findex3 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]));
208 BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); 208 BaseType istor = m_thread.m_currentFrame.OpStack.Pop();
209 if (istor is Int) 209 if (istor is Int)
210 { 210 {
211 this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor; 211 m_thread.m_currentFrame.LocalVariables[findex3] = (Int) istor;
212 } 212 }
213 this.m_thread.PC++; 213 m_thread.PC++;
214 result = true; 214 result = true;
215 break; 215 break;
216 case (byte)OpCode.fstore: 216 case (byte) OpCode.fstore:
217 short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); 217 short findex = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]));
218 BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); 218 BaseType fstor = m_thread.m_currentFrame.OpStack.Pop();
219 if (fstor is Float) 219 if (fstor is Float)
220 { 220 {
221 this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor; 221 m_thread.m_currentFrame.LocalVariables[findex] = (Float) fstor;
222 } 222 }
223 this.m_thread.PC++; 223 m_thread.PC++;
224 result = true; 224 result = true;
225 break; 225 break;
226 case (byte)OpCode.istore_0: 226 case (byte) OpCode.istore_0:
227 BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop(); 227 BaseType baset = m_thread.m_currentFrame.OpStack.Pop();
228 if (baset is Int) 228 if (baset is Int)
229 { 229 {
230 this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset; 230 m_thread.m_currentFrame.LocalVariables[0] = (Int) baset;
231 } 231 }
232 result = true; 232 result = true;
233 break; 233 break;
234 case (byte)OpCode.istore_1: 234 case (byte) OpCode.istore_1:
235 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 235 baset = m_thread.m_currentFrame.OpStack.Pop();
236 if (baset is Int) 236 if (baset is Int)
237 { 237 {
238 this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset; 238 m_thread.m_currentFrame.LocalVariables[1] = (Int) baset;
239 } 239 }
240 result = true; 240 result = true;
241 break; 241 break;
242 case (byte)OpCode.fstore_0: 242 case (byte) OpCode.fstore_0:
243 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 243 baset = m_thread.m_currentFrame.OpStack.Pop();
244 if (baset is Float) 244 if (baset is Float)
245 { 245 {
246 this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset; 246 m_thread.m_currentFrame.LocalVariables[0] = (Float) baset;
247 } 247 }
248 result = true; 248 result = true;
249 break; 249 break;
250 case (byte)OpCode.fstore_1: 250 case (byte) OpCode.fstore_1:
251 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 251 baset = m_thread.m_currentFrame.OpStack.Pop();
252 if (baset is Float) 252 if (baset is Float)
253 { 253 {
254 this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset; 254 m_thread.m_currentFrame.LocalVariables[1] = (Float) baset;
255 } 255 }
256 result = true; 256 result = true;
257 break; 257 break;
258 case (byte)OpCode.fstore_2: 258 case (byte) OpCode.fstore_2:
259 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 259 baset = m_thread.m_currentFrame.OpStack.Pop();
260 if (baset is Float) 260 if (baset is Float)
261 { 261 {
262 this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset; 262 m_thread.m_currentFrame.LocalVariables[2] = (Float) baset;
263 } 263 }
264 result = true; 264 result = true;
265 break; 265 break;
266 case (byte)OpCode.fstore_3: 266 case (byte) OpCode.fstore_3:
267 baset = this.m_thread.m_currentFrame.OpStack.Pop(); 267 baset = m_thread.m_currentFrame.OpStack.Pop();
268 if (baset is Float) 268 if (baset is Float)
269 { 269 {
270 this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset; 270 m_thread.m_currentFrame.LocalVariables[3] = (Float) baset;
271 } 271 }
272 result = true; 272 result = true;
273 break; 273 break;
274 case (byte)OpCode.pop: 274 case (byte) OpCode.pop:
275 this.m_thread.m_currentFrame.OpStack.Pop(); 275 m_thread.m_currentFrame.OpStack.Pop();
276 result = true; 276 result = true;
277 break; 277 break;
278 case (byte)OpCode.fadd: 278 case (byte) OpCode.fadd:
279 BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop(); 279 BaseType bf2 = m_thread.m_currentFrame.OpStack.Pop();
280 BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); 280 BaseType bf1 = m_thread.m_currentFrame.OpStack.Pop();
281 if (bf1 is Float && bf2 is Float) 281 if (bf1 is Float && bf2 is Float)
282 { 282 {
283 Float nflt = new Float(); 283 Float nflt = new Float();
284 nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; 284 nflt.mValue = ((Float) bf1).mValue + ((Float) bf2).mValue;
285 this.m_thread.m_currentFrame.OpStack.Push(nflt); 285 m_thread.m_currentFrame.OpStack.Push(nflt);
286 } 286 }
287 result = true; 287 result = true;
288 break; 288 break;
289 case (byte)OpCode.fsub: 289 case (byte) OpCode.fsub:
290 BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop(); 290 BaseType bsf2 = m_thread.m_currentFrame.OpStack.Pop();
291 BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); 291 BaseType bsf1 = m_thread.m_currentFrame.OpStack.Pop();
292 if (bsf1 is Float && bsf2 is Float) 292 if (bsf1 is Float && bsf2 is Float)
293 { 293 {
294 Float resf = new Float(); 294 Float resf = new Float();
295 resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; 295 resf.mValue = ((Float) bsf1).mValue - ((Float) bsf2).mValue;
296 this.m_thread.m_currentFrame.OpStack.Push(resf); 296 m_thread.m_currentFrame.OpStack.Push(resf);
297 } 297 }
298 result = true; 298 result = true;
299 break; 299 break;
300 case (byte)OpCode.imul: //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
301 BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop(); 301 BaseType bs2 = m_thread.m_currentFrame.OpStack.Pop();
302 BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); 302 BaseType bs1 = m_thread.m_currentFrame.OpStack.Pop();
303 if (bs1 is Int && bs2 is Int) 303 if (bs1 is Int && bs2 is Int)
304 { 304 {
305 Int nInt = new Int(); 305 Int nInt = new Int();
306 nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; 306 nInt.mValue = ((Int) bs1).mValue*((Int) bs2).mValue;
307 this.m_thread.m_currentFrame.OpStack.Push(nInt); 307 m_thread.m_currentFrame.OpStack.Push(nInt);
308 } 308 }
309 result = true; 309 result = true;
310 break; 310 break;
311 case (byte)OpCode.iinc: 311 case (byte) OpCode.iinc:
312 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null) 312 if (m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]] !=
313 null)
313 { 314 {
314 if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) 315 if (
316 m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]
317 ] is Int)
315 { 318 {
316 ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]; 319 ((Int)
320 m_thread.m_currentFrame.LocalVariables[
321 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]]).mValue +=
322 (sbyte) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1];
317 } 323 }
318 } 324 }
319 this.m_thread.PC += 2; 325 m_thread.PC += 2;
320 result = true; 326 result = true;
321 break; 327 break;
322 case (byte)OpCode.f2i: 328 case (byte) OpCode.f2i:
323 BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); 329 BaseType conv1 = m_thread.m_currentFrame.OpStack.Pop();
324 if (conv1 is Float) 330 if (conv1 is Float)
325 { 331 {
326 Int newconv = new Int(); 332 Int newconv = new Int();
327 newconv.mValue = (int)((Float)conv1).mValue; 333 newconv.mValue = (int) ((Float) conv1).mValue;
328 this.m_thread.m_currentFrame.OpStack.Push(newconv); 334 m_thread.m_currentFrame.OpStack.Push(newconv);
329 } 335 }
330 result = true; 336 result = true;
331 break; 337 break;
332 case (byte)OpCode.fcmpl: 338 case (byte) OpCode.fcmpl:
333 BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); 339 BaseType flcom2 = m_thread.m_currentFrame.OpStack.Pop();
334 BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); 340 BaseType flcom1 = m_thread.m_currentFrame.OpStack.Pop();
335 if (flcom1 is Float && flcom2 is Float) 341 if (flcom1 is Float && flcom2 is Float)
336 { 342 {
337 Int compres = new Int(); 343 Int compres = new Int();
338 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 344 if (((Float) flcom1).mValue < ((Float) flcom2).mValue)
339 { 345 {
340 compres.mValue = -1; 346 compres.mValue = -1;
341 } 347 }
342 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 348 else if (((Float) flcom1).mValue > ((Float) flcom2).mValue)
343 { 349 {
344 compres.mValue = 1; 350 compres.mValue = 1;
345 } 351 }
@@ -347,21 +353,21 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
347 { 353 {
348 compres.mValue = 0; 354 compres.mValue = 0;
349 } 355 }
350 this.m_thread.m_currentFrame.OpStack.Push(compres); 356 m_thread.m_currentFrame.OpStack.Push(compres);
351 } 357 }
352 result = true; 358 result = true;
353 break; 359 break;
354 case (byte)OpCode.fcmpg: 360 case (byte) OpCode.fcmpg:
355 flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); 361 flcom2 = m_thread.m_currentFrame.OpStack.Pop();
356 flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); 362 flcom1 = m_thread.m_currentFrame.OpStack.Pop();
357 if (flcom1 is Float && flcom2 is Float) 363 if (flcom1 is Float && flcom2 is Float)
358 { 364 {
359 Int compres = new Int(); 365 Int compres = new Int();
360 if (((Float)flcom1).mValue < ((Float)flcom2).mValue) 366 if (((Float) flcom1).mValue < ((Float) flcom2).mValue)
361 { 367 {
362 compres.mValue = -1; 368 compres.mValue = -1;
363 } 369 }
364 else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) 370 else if (((Float) flcom1).mValue > ((Float) flcom2).mValue)
365 { 371 {
366 compres.mValue = 1; 372 compres.mValue = 1;
367 } 373 }
@@ -369,128 +375,169 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
369 { 375 {
370 compres.mValue = 0; 376 compres.mValue = 0;
371 } 377 }
372 this.m_thread.m_currentFrame.OpStack.Push(compres); 378 m_thread.m_currentFrame.OpStack.Push(compres);
373 } 379 }
374 result = true; 380 result = true;
375 break; 381 break;
376 case (byte)OpCode.ifge: 382 case (byte) OpCode.ifge:
377 short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 383 short compareoffset2 =
378 BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); 384 (short)
385 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
386 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
387 BaseType compe1 = m_thread.m_currentFrame.OpStack.Pop();
379 if (compe1 is Int) 388 if (compe1 is Int)
380 { 389 {
381 if (((Int)compe1).mValue >= 0) 390 if (((Int) compe1).mValue >= 0)
382 { 391 {
383 this.m_thread.PC += -1 + compareoffset2; 392 m_thread.PC += -1 + compareoffset2;
384 } 393 }
385 else 394 else
386 { 395 {
387 this.m_thread.PC += 2; 396 m_thread.PC += 2;
388 } 397 }
389 } 398 }
390 else 399 else
391 { 400 {
392 this.m_thread.PC += 2; 401 m_thread.PC += 2;
393 } 402 }
394 result = true; 403 result = true;
395 break; 404 break;
396 case (byte)OpCode.ifle: 405 case (byte) OpCode.ifle:
397 short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 406 short compareoffset1 =
398 BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); 407 (short)
408 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
409 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
410 BaseType comp1 = m_thread.m_currentFrame.OpStack.Pop();
399 if (comp1 is Int) 411 if (comp1 is Int)
400 { 412 {
401 if (((Int)comp1).mValue <= 0) 413 if (((Int) comp1).mValue <= 0)
402 { 414 {
403 this.m_thread.PC += -1 + compareoffset1; 415 m_thread.PC += -1 + compareoffset1;
404 } 416 }
405 else 417 else
406 { 418 {
407 this.m_thread.PC += 2; 419 m_thread.PC += 2;
408 } 420 }
409 } 421 }
410 else 422 else
411 { 423 {
412 this.m_thread.PC += 2; 424 m_thread.PC += 2;
413 } 425 }
414 result = true; 426 result = true;
415 break; 427 break;
416 case (byte)OpCode.if_icmpge: 428 case (byte) OpCode.if_icmpge:
417 short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 429 short compareoffset =
418 BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); 430 (short)
419 BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); 431 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
432 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
433 BaseType bc2 = m_thread.m_currentFrame.OpStack.Pop();
434 BaseType bc1 = m_thread.m_currentFrame.OpStack.Pop();
420 if (bc1 is Int && bc2 is Int) 435 if (bc1 is Int && bc2 is Int)
421 { 436 {
422 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); 437 //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
423 if (((Int)bc1).mValue >= ((Int)bc2).mValue) 438 if (((Int) bc1).mValue >= ((Int) bc2).mValue)
424 { 439 {
425 // Console.WriteLine("branch compare true , offset is " +compareoffset); 440 // Console.WriteLine("branch compare true , offset is " +compareoffset);
426 // Console.WriteLine("current PC is " + this._mThread.PC); 441 // Console.WriteLine("current PC is " + this._mThread.PC);
427 this.m_thread.PC += -1 + compareoffset; 442 m_thread.PC += -1 + compareoffset;
428 //Console.WriteLine("new PC is " + this._mThread.PC); 443 //Console.WriteLine("new PC is " + this._mThread.PC);
429 } 444 }
430 else 445 else
431 { 446 {
432 //Console.WriteLine("branch compare false"); 447 //Console.WriteLine("branch compare false");
433 this.m_thread.PC += 2; 448 m_thread.PC += 2;
434 } 449 }
435 } 450 }
436 else 451 else
437 { 452 {
438 this.m_thread.PC += 2; 453 m_thread.PC += 2;
439 } 454 }
440 result = true; 455 result = true;
441 break; 456 break;
442 case (byte)OpCode.if_icmple: 457 case (byte) OpCode.if_icmple:
443 short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 458 short compareloffset =
444 BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); 459 (short)
445 BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); 460 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
461 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
462 BaseType bcl2 = m_thread.m_currentFrame.OpStack.Pop();
463 BaseType bcl1 = m_thread.m_currentFrame.OpStack.Pop();
446 if (bcl1 is Int && bcl2 is Int) 464 if (bcl1 is Int && bcl2 is Int)
447 { 465 {
448 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); 466 //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
449 if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) 467 if (((Int) bcl1).mValue <= ((Int) bcl2).mValue)
450 { 468 {
451 // Console.WriteLine("branch compare true , offset is " + compareloffset); 469 // Console.WriteLine("branch compare true , offset is " + compareloffset);
452 // Console.WriteLine("current PC is " + this._mThread.PC); 470 // Console.WriteLine("current PC is " + this._mThread.PC);
453 this.m_thread.PC += -1 + compareloffset; 471 m_thread.PC += -1 + compareloffset;
454 // Console.WriteLine("new PC is " + this._mThread.PC); 472 // Console.WriteLine("new PC is " + this._mThread.PC);
455 } 473 }
456 else 474 else
457 { 475 {
458 //Console.WriteLine("branch compare false"); 476 //Console.WriteLine("branch compare false");
459 this.m_thread.PC += 2; 477 m_thread.PC += 2;
460 } 478 }
461 } 479 }
462 else 480 else
463 { 481 {
464 this.m_thread.PC += 2; 482 m_thread.PC += 2;
465 } 483 }
466 result = true; 484 result = true;
467 break; 485 break;
468 case (byte)OpCode._goto: 486 case (byte) OpCode._goto:
469 short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 487 short offset =
470 this.m_thread.PC += -1 + offset; 488 (short)
489 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
490 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
491 m_thread.PC += -1 + offset;
471 result = true; 492 result = true;
472 break; 493 break;
473 case (byte)OpCode.getstatic: 494 case (byte) OpCode.getstatic:
474 short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 495 short fieldrefIndex =
475 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) 496 (short)
497 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
498 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
499 if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
476 { 500 {
477 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 501 if (
502 ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).
503 mClass.Name.Value == m_thread.currentClass.MClass.Name.Value)
478 { 504 {
479 //from this class 505 //from this class
480 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) 506 if (
507 m_thread.currentClass.StaticFields.ContainsKey(
508 ((ClassRecord.PoolFieldRef)
509 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
481 { 510 {
482 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) 511 if (
512 m_thread.currentClass.StaticFields[
513 ((ClassRecord.PoolFieldRef)
514 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.
515 Value] is Float)
483 { 516 {
484 Float retFloat = new Float(); 517 Float retFloat = new Float();
485 retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; 518 retFloat.mValue =
486 this.m_thread.m_currentFrame.OpStack.Push(retFloat); 519 ((Float)
520 m_thread.currentClass.StaticFields[
521 ((ClassRecord.PoolFieldRef)
522 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
523 Name.Value]).mValue;
524 m_thread.m_currentFrame.OpStack.Push(retFloat);
487 } 525 }
488 else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) 526 else if (
527 m_thread.currentClass.StaticFields[
528 ((ClassRecord.PoolFieldRef)
529 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
530 Name.Value] is Int)
489 { 531 {
490 Int retInt = new Int(); 532 Int retInt = new Int();
491 retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; 533 retInt.mValue =
534 ((Int)
535 m_thread.currentClass.StaticFields[
536 ((ClassRecord.PoolFieldRef)
537 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).
538 mNameType.Name.Value]).mValue;
492 // Console.WriteLine("getting static field, " + retInt.mValue); 539 // Console.WriteLine("getting static field, " + retInt.mValue);
493 this.m_thread.m_currentFrame.OpStack.Push(retInt); 540 m_thread.m_currentFrame.OpStack.Push(retInt);
494 } 541 }
495 } 542 }
496 } 543 }
@@ -499,36 +546,58 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
499 //get from a different class 546 //get from a different class
500 } 547 }
501 } 548 }
502 this.m_thread.PC += 2; 549 m_thread.PC += 2;
503 result = true; 550 result = true;
504 break; 551 break;
505 case (byte)OpCode.putstatic: 552 case (byte) OpCode.putstatic:
506 fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); 553 fieldrefIndex =
507 BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); 554 (short)
508 if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) 555 ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) +
556 GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]);
557 BaseType addstatic = m_thread.m_currentFrame.OpStack.Pop();
558 if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
509 { 559 {
510 if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) 560 if (
561 ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).
562 mClass.Name.Value == m_thread.currentClass.MClass.Name.Value)
511 { 563 {
512 // this class 564 // this class
513 if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) 565 if (
566 m_thread.currentClass.StaticFields.ContainsKey(
567 ((ClassRecord.PoolFieldRef)
568 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
514 { 569 {
515 if (addstatic is Float) 570 if (addstatic is Float)
516 { 571 {
517 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) 572 if (
573 m_thread.currentClass.StaticFields[
574 ((ClassRecord.PoolFieldRef)
575 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
576 Name.Value] is Float)
518 { 577 {
519 Float newf = new Float(); 578 Float newf = new Float();
520 newf.mValue = ((Float)addstatic).mValue; 579 newf.mValue = ((Float) addstatic).mValue;
521 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; 580 m_thread.currentClass.StaticFields[
581 ((ClassRecord.PoolFieldRef)
582 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
583 Name.Value] = newf;
522 } 584 }
523 } 585 }
524 else if (addstatic is Int) 586 else if (addstatic is Int)
525 { 587 {
526 if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) 588 if (
589 m_thread.currentClass.StaticFields[
590 ((ClassRecord.PoolFieldRef)
591 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
592 Name.Value] is Int)
527 { 593 {
528 //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); 594 //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue);
529 Int newi = new Int(); 595 Int newi = new Int();
530 newi.mValue = ((Int)addstatic).mValue; 596 newi.mValue = ((Int) addstatic).mValue;
531 this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; 597 m_thread.currentClass.StaticFields[
598 ((ClassRecord.PoolFieldRef)
599 m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.
600 Name.Value] = newi;
532 } 601 }
533 } 602 }
534 } 603 }
@@ -538,10 +607,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
538 // a different class 607 // a different class
539 } 608 }
540 } 609 }
541 this.m_thread.PC += 2; 610 m_thread.PC += 2;
542 result = true; 611 result = true;
543 break; 612 break;
544
545 } 613 }
546 614
547 return result; 615 return result;