diff options
Diffstat (limited to '')
22 files changed, 486 insertions, 484 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs index 6100c67..3f09099 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 30 | ||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 31 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
@@ -40,7 +38,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
40 | 38 | ||
41 | public ClassInstance() | 39 | public ClassInstance() |
42 | { | 40 | { |
43 | |||
44 | } | 41 | } |
45 | } | 42 | } |
46 | } | 43 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs index 5c3629c..3bcc824 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs | |||
@@ -26,9 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | 30 | using System.IO; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
33 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
34 | 33 | ||
@@ -56,7 +55,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
56 | 55 | ||
57 | public ClassRecord() | 56 | public ClassRecord() |
58 | { | 57 | { |
59 | |||
60 | } | 58 | } |
61 | 59 | ||
62 | public ClassInstance CreateNewInstance() | 60 | public ClassInstance CreateNewInstance() |
@@ -72,7 +70,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
72 | { | 70 | { |
73 | Console.WriteLine("loading script " + fileName); | 71 | Console.WriteLine("loading script " + fileName); |
74 | FileStream fs = File.OpenRead(fileName); | 72 | FileStream fs = File.OpenRead(fileName); |
75 | this.LoadClassFromBytes(ReadFully(fs)); | 73 | LoadClassFromBytes(ReadFully(fs)); |
76 | fs.Close(); | 74 | fs.Close(); |
77 | } | 75 | } |
78 | 76 | ||
@@ -80,9 +78,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
80 | { | 78 | { |
81 | int i = 0; | 79 | int i = 0; |
82 | i += 4; | 80 | i += 4; |
83 | m_minorVersion = (ushort)((data[i++] << 8) + data[i++]); | 81 | m_minorVersion = (ushort) ((data[i++] << 8) + data[i++]); |
84 | m_majorVersion = (ushort)((data[i++] << 8) + data[i++]); | 82 | m_majorVersion = (ushort) ((data[i++] << 8) + data[i++]); |
85 | m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]); | 83 | m_constantPoolCount = (ushort) ((data[i++] << 8) + data[i++]); |
86 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); | 84 | Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool"); |
87 | for (int count = 0; count < (m_constantPoolCount - 1); count++) | 85 | for (int count = 0; count < (m_constantPoolCount - 1); count++) |
88 | { | 86 | { |
@@ -92,13 +90,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
92 | //Console.WriteLine("start position is: " + i); | 90 | //Console.WriteLine("start position is: " + i); |
93 | switch (pooltype) | 91 | switch (pooltype) |
94 | { | 92 | { |
95 | case 1: //Utf8 | 93 | case 1: //Utf8 |
96 | ushort uLength = (ushort)((data[i++] << 8) + data[i++]); | 94 | ushort uLength = (ushort) ((data[i++] << 8) + data[i++]); |
97 | 95 | ||
98 | // Console.WriteLine("new utf8 type, length is " + uLength); | 96 | // Console.WriteLine("new utf8 type, length is " + uLength); |
99 | PoolUtf8 utf8 = new PoolUtf8(); | 97 | PoolUtf8 utf8 = new PoolUtf8(); |
100 | utf8.readValue(data, ref i, uLength); | 98 | utf8.readValue(data, ref i, uLength); |
101 | this.m_constantsPool.Add(utf8); | 99 | m_constantsPool.Add(utf8); |
102 | break; | 100 | break; |
103 | case 3: //Int | 101 | case 3: //Int |
104 | break; | 102 | break; |
@@ -107,53 +105,53 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
107 | case 7: //Class | 105 | case 7: //Class |
108 | PoolClass pClass = new PoolClass(this); | 106 | PoolClass pClass = new PoolClass(this); |
109 | pClass.readValue(data, ref i); | 107 | pClass.readValue(data, ref i); |
110 | this.m_constantsPool.Add(pClass); | 108 | m_constantsPool.Add(pClass); |
111 | break; | 109 | break; |
112 | case 9: //FieldRef | 110 | case 9: //FieldRef |
113 | PoolFieldRef pField = new PoolFieldRef(this); | 111 | PoolFieldRef pField = new PoolFieldRef(this); |
114 | pField.readValue(data, ref i); | 112 | pField.readValue(data, ref i); |
115 | this.m_constantsPool.Add(pField); | 113 | m_constantsPool.Add(pField); |
116 | break; | 114 | break; |
117 | case 10: //Method | 115 | case 10: //Method |
118 | PoolMethodRef pMeth = new PoolMethodRef(this); | 116 | PoolMethodRef pMeth = new PoolMethodRef(this); |
119 | pMeth.readValue(data, ref i); | 117 | pMeth.readValue(data, ref i); |
120 | this.m_constantsPool.Add(pMeth); | 118 | m_constantsPool.Add(pMeth); |
121 | break; | 119 | break; |
122 | case 12: //NamedType | 120 | case 12: //NamedType |
123 | PoolNamedType pNamed = new PoolNamedType(this); | 121 | PoolNamedType pNamed = new PoolNamedType(this); |
124 | pNamed.readValue(data, ref i); | 122 | pNamed.readValue(data, ref i); |
125 | this.m_constantsPool.Add(pNamed); | 123 | m_constantsPool.Add(pNamed); |
126 | break; | 124 | break; |
127 | } | 125 | } |
128 | } | 126 | } |
129 | 127 | ||
130 | m_accessFlags = (ushort)((data[i++] << 8) + data[i++]); | 128 | m_accessFlags = (ushort) ((data[i++] << 8) + data[i++]); |
131 | m_thisClass = (ushort)((data[i++] << 8) + data[i++]); | 129 | m_thisClass = (ushort) ((data[i++] << 8) + data[i++]); |
132 | m_supperClass = (ushort)((data[i++] << 8) + data[i++]); | 130 | m_supperClass = (ushort) ((data[i++] << 8) + data[i++]); |
133 | 131 | ||
134 | if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass) | 132 | if (m_constantsPool[m_thisClass - 1] is PoolClass) |
135 | { | 133 | { |
136 | this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]); | 134 | MClass = ((PoolClass) m_constantsPool[m_thisClass - 1]); |
137 | } | 135 | } |
138 | 136 | ||
139 | m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]); | 137 | m_interfaceCount = (ushort) ((data[i++] << 8) + data[i++]); |
140 | //should now read in the info for each interface | 138 | //should now read in the info for each interface |
141 | 139 | ||
142 | m_fieldCount = (ushort)((data[i++] << 8) + data[i++]); | 140 | m_fieldCount = (ushort) ((data[i++] << 8) + data[i++]); |
143 | //should now read in the info for each field | 141 | //should now read in the info for each field |
144 | for (int count = 0; count < m_fieldCount; count++) | 142 | for (int count = 0; count < m_fieldCount; count++) |
145 | { | 143 | { |
146 | FieldInfo fieldInf = new FieldInfo(this); | 144 | FieldInfo fieldInf = new FieldInfo(this); |
147 | fieldInf.ReadData(data, ref i); | 145 | fieldInf.ReadData(data, ref i); |
148 | this.m_fieldList.Add(fieldInf); | 146 | m_fieldList.Add(fieldInf); |
149 | } | 147 | } |
150 | 148 | ||
151 | m_methodCount = (ushort)((data[i++] << 8) + data[i++]); | 149 | m_methodCount = (ushort) ((data[i++] << 8) + data[i++]); |
152 | for (int count = 0; count < m_methodCount; count++) | 150 | for (int count = 0; count < m_methodCount; count++) |
153 | { | 151 | { |
154 | MethodInfo methInf = new MethodInfo(this); | 152 | MethodInfo methInf = new MethodInfo(this); |
155 | methInf.ReadData(data, ref i); | 153 | methInf.ReadData(data, ref i); |
156 | this.m_methodsList.Add(methInf); | 154 | m_methodsList.Add(methInf); |
157 | } | 155 | } |
158 | } | 156 | } |
159 | 157 | ||
@@ -161,7 +159,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
161 | { | 159 | { |
162 | for (int count = 0; count < m_methodCount; count++) | 160 | for (int count = 0; count < m_methodCount; count++) |
163 | { | 161 | { |
164 | this.m_methodsList[count].AddMethodCode(memory); | 162 | m_methodsList[count].AddMethodCode(memory); |
165 | } | 163 | } |
166 | } | 164 | } |
167 | 165 | ||
@@ -169,12 +167,12 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
169 | { | 167 | { |
170 | for (int count = 0; count < m_methodCount; count++) | 168 | for (int count = 0; count < m_methodCount; count++) |
171 | { | 169 | { |
172 | if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8) | 170 | if (m_constantsPool[m_methodsList[count].NameIndex - 1] is PoolUtf8) |
173 | { | 171 | { |
174 | if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName) | 172 | if (((PoolUtf8) m_constantsPool[m_methodsList[count].NameIndex - 1]).Value == methodName) |
175 | { | 173 | { |
176 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); | 174 | //Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value); |
177 | thread.SetPC(this.m_methodsList[count].CodePointer); | 175 | thread.SetPC(m_methodsList[count].CodePointer); |
178 | return true; | 176 | return true; |
179 | } | 177 | } |
180 | } | 178 | } |
@@ -191,7 +189,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
191 | 189 | ||
192 | for (int i = 0; i < m_constantsPool.Count; i++) | 190 | for (int i = 0; i < m_constantsPool.Count; i++) |
193 | { | 191 | { |
194 | this.m_constantsPool[i].Print(); | 192 | m_constantsPool[i].Print(); |
195 | } | 193 | } |
196 | 194 | ||
197 | Console.WriteLine("Access flags: " + m_accessFlags); | 195 | Console.WriteLine("Access flags: " + m_accessFlags); |
@@ -201,16 +199,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
201 | for (int count = 0; count < m_fieldCount; count++) | 199 | for (int count = 0; count < m_fieldCount; count++) |
202 | { | 200 | { |
203 | Console.WriteLine(); | 201 | Console.WriteLine(); |
204 | this.m_fieldList[count].Print(); | 202 | m_fieldList[count].Print(); |
205 | } | 203 | } |
206 | 204 | ||
207 | for (int count = 0; count < m_methodCount; count++) | 205 | for (int count = 0; count < m_methodCount; count++) |
208 | { | 206 | { |
209 | Console.WriteLine(); | 207 | Console.WriteLine(); |
210 | this.m_methodsList[count].Print(); | 208 | m_methodsList[count].Print(); |
211 | } | 209 | } |
212 | 210 | ||
213 | Console.WriteLine("class name is " + this.MClass.Name.Value); | 211 | Console.WriteLine("class name is " + MClass.Name.Value); |
214 | } | 212 | } |
215 | 213 | ||
216 | public static byte[] ReadFully(Stream stream) | 214 | public static byte[] ReadFully(Stream stream) |
@@ -229,11 +227,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
229 | } | 227 | } |
230 | 228 | ||
231 | #region nested classes | 229 | #region nested classes |
230 | |||
232 | public class PoolItem | 231 | public class PoolItem |
233 | { | 232 | { |
234 | public virtual void Print() | 233 | public virtual void Print() |
235 | { | 234 | { |
236 | |||
237 | } | 235 | } |
238 | } | 236 | } |
239 | 237 | ||
@@ -245,21 +243,21 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
245 | { | 243 | { |
246 | for (int i = 0; i < length; i++) | 244 | for (int i = 0; i < length; i++) |
247 | { | 245 | { |
248 | int a = (int)data[pointer++]; | 246 | int a = (int) data[pointer++]; |
249 | if ((a & 0x80) == 0) | 247 | if ((a & 0x80) == 0) |
250 | { | 248 | { |
251 | Value = Value + (char)a; | 249 | Value = Value + (char) a; |
252 | } | 250 | } |
253 | else if ((a & 0x20) == 0) | 251 | else if ((a & 0x20) == 0) |
254 | { | 252 | { |
255 | int b = (int)data[pointer++]; | 253 | int b = (int) data[pointer++]; |
256 | Value = Value + (char)(((a & 0x1f) << 6) + (b & 0x3f)); | 254 | Value = Value + (char) (((a & 0x1f) << 6) + (b & 0x3f)); |
257 | } | 255 | } |
258 | else | 256 | else |
259 | { | 257 | { |
260 | int b = (int)data[pointer++]; | 258 | int b = (int) data[pointer++]; |
261 | int c = (int)data[pointer++]; | 259 | int c = (int) data[pointer++]; |
262 | Value = Value + (char)(((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); | 260 | Value = Value + (char) (((a & 0xf) << 12) + ((b & 0x3f) << 6) + (c & 0x3f)); |
263 | } | 261 | } |
264 | } | 262 | } |
265 | } | 263 | } |
@@ -272,7 +270,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
272 | 270 | ||
273 | private class PoolInt : PoolItem | 271 | private class PoolInt : PoolItem |
274 | { | 272 | { |
275 | |||
276 | } | 273 | } |
277 | 274 | ||
278 | public class PoolClass : PoolItem | 275 | public class PoolClass : PoolItem |
@@ -289,15 +286,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
289 | 286 | ||
290 | public void readValue(byte[] data, ref int pointer) | 287 | public void readValue(byte[] data, ref int pointer) |
291 | { | 288 | { |
292 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 289 | namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
293 | } | 290 | } |
294 | 291 | ||
295 | public override void Print() | 292 | public override void Print() |
296 | { | 293 | { |
297 | this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); | 294 | Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]); |
298 | Console.Write("Class type: " + namePointer); | 295 | Console.Write("Class type: " + namePointer); |
299 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); | 296 | Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value); |
300 | |||
301 | } | 297 | } |
302 | } | 298 | } |
303 | 299 | ||
@@ -316,14 +312,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
316 | 312 | ||
317 | public void readValue(byte[] data, ref int pointer) | 313 | public void readValue(byte[] data, ref int pointer) |
318 | { | 314 | { |
319 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 315 | classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
320 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 316 | nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
321 | } | 317 | } |
322 | 318 | ||
323 | public override void Print() | 319 | public override void Print() |
324 | { | 320 | { |
325 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); | 321 | mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]); |
326 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); | 322 | mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]); |
327 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); | 323 | Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer); |
328 | } | 324 | } |
329 | } | 325 | } |
@@ -343,14 +339,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
343 | 339 | ||
344 | public void readValue(byte[] data, ref int pointer) | 340 | public void readValue(byte[] data, ref int pointer) |
345 | { | 341 | { |
346 | classPointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 342 | classPointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
347 | nameTypePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 343 | nameTypePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
348 | } | 344 | } |
349 | 345 | ||
350 | public override void Print() | 346 | public override void Print() |
351 | { | 347 | { |
352 | this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]); | 348 | mNameType = ((PoolNamedType) parent.m_constantsPool[nameTypePointer - 1]); |
353 | this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]); | 349 | mClass = ((PoolClass) parent.m_constantsPool[classPointer - 1]); |
354 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); | 350 | Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer); |
355 | } | 351 | } |
356 | } | 352 | } |
@@ -370,16 +366,16 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
370 | 366 | ||
371 | public void readValue(byte[] data, ref int pointer) | 367 | public void readValue(byte[] data, ref int pointer) |
372 | { | 368 | { |
373 | namePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 369 | namePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
374 | typePointer = (ushort)((data[pointer++] << 8) + data[pointer++]); | 370 | typePointer = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
375 | } | 371 | } |
376 | 372 | ||
377 | public override void Print() | 373 | public override void Print() |
378 | { | 374 | { |
379 | Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]); | 375 | Name = ((PoolUtf8) parent.m_constantsPool[namePointer - 1]); |
380 | Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]); | 376 | Type = ((PoolUtf8) parent.m_constantsPool[typePointer - 1]); |
381 | Console.Write("Named type: " + namePointer + " , " + typePointer); | 377 | Console.Write("Named type: " + namePointer + " , " + typePointer); |
382 | Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value); | 378 | Console.WriteLine(" // " + ((PoolUtf8) parent.m_constantsPool[namePointer - 1]).Value); |
383 | } | 379 | } |
384 | } | 380 | } |
385 | 381 | ||
@@ -402,23 +398,23 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
402 | 398 | ||
403 | public void AddMethodCode(MethodMemory memory) | 399 | public void AddMethodCode(MethodMemory memory) |
404 | { | 400 | { |
405 | Array.Copy(this.Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, this.Attributes[0].Code.Length); | 401 | Array.Copy(Attributes[0].Code, 0, memory.MethodBuffer, memory.NextMethodPC, Attributes[0].Code.Length); |
406 | memory.Methodcount++; | 402 | memory.Methodcount++; |
407 | this.CodePointer = memory.NextMethodPC; | 403 | CodePointer = memory.NextMethodPC; |
408 | memory.NextMethodPC += this.Attributes[0].Code.Length; | 404 | memory.NextMethodPC += Attributes[0].Code.Length; |
409 | } | 405 | } |
410 | 406 | ||
411 | public void ReadData(byte[] data, ref int pointer) | 407 | public void ReadData(byte[] data, ref int pointer) |
412 | { | 408 | { |
413 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | 409 | AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
414 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 410 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
415 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 411 | DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
416 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 412 | AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
417 | for (int i = 0; i < AttributeCount; i++) | 413 | for (int i = 0; i < AttributeCount; i++) |
418 | { | 414 | { |
419 | MethodAttribute attri = new MethodAttribute(this.parent); | 415 | MethodAttribute attri = new MethodAttribute(parent); |
420 | attri.ReadData(data, ref pointer); | 416 | attri.ReadData(data, ref pointer); |
421 | this.Attributes.Add(attri); | 417 | Attributes.Add(attri); |
422 | } | 418 | } |
423 | } | 419 | } |
424 | 420 | ||
@@ -426,12 +422,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
426 | { | 422 | { |
427 | Console.WriteLine("Method Info Struct: "); | 423 | Console.WriteLine("Method Info Struct: "); |
428 | Console.WriteLine("AccessFlags: " + AccessFlags); | 424 | Console.WriteLine("AccessFlags: " + AccessFlags); |
429 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 425 | Console.WriteLine("NameIndex: " + NameIndex + " // " + |
430 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); | 426 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); |
427 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + | ||
428 | ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value); | ||
431 | Console.WriteLine("Attribute Count:" + AttributeCount); | 429 | Console.WriteLine("Attribute Count:" + AttributeCount); |
432 | for (int i = 0; i < AttributeCount; i++) | 430 | for (int i = 0; i < AttributeCount; i++) |
433 | { | 431 | { |
434 | this.Attributes[i].Print(); | 432 | Attributes[i].Print(); |
435 | } | 433 | } |
436 | } | 434 | } |
437 | 435 | ||
@@ -457,30 +455,35 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
457 | 455 | ||
458 | public void ReadData(byte[] data, ref int pointer) | 456 | public void ReadData(byte[] data, ref int pointer) |
459 | { | 457 | { |
460 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 458 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
461 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 459 | Length = |
462 | MaxStack = (ushort)((data[pointer++] << 8) + data[pointer++]); | 460 | (Int32) |
463 | MaxLocals = (ushort)((data[pointer++] << 8) + data[pointer++]); | 461 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); |
464 | CodeLength = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 462 | MaxStack = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
463 | MaxLocals = (ushort) ((data[pointer++] << 8) + data[pointer++]); | ||
464 | CodeLength = | ||
465 | (Int32) | ||
466 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
465 | Code = new byte[CodeLength]; | 467 | Code = new byte[CodeLength]; |
466 | for (int i = 0; i < CodeLength; i++) | 468 | for (int i = 0; i < CodeLength; i++) |
467 | { | 469 | { |
468 | Code[i] = data[pointer++]; | 470 | Code[i] = data[pointer++]; |
469 | } | 471 | } |
470 | ExceptionTableLength = (ushort)((data[pointer++] << 8) + data[pointer++]); | 472 | ExceptionTableLength = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
471 | SubAttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 473 | SubAttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
472 | for (int i = 0; i < SubAttributeCount; i++) | 474 | for (int i = 0; i < SubAttributeCount; i++) |
473 | { | 475 | { |
474 | SubAttribute subAttri = new SubAttribute(this.parent); | 476 | SubAttribute subAttri = new SubAttribute(parent); |
475 | subAttri.ReadData(data, ref pointer); | 477 | subAttri.ReadData(data, ref pointer); |
476 | this.SubAttributes.Add(subAttri); | 478 | SubAttributes.Add(subAttri); |
477 | } | 479 | } |
478 | } | 480 | } |
479 | 481 | ||
480 | public void Print() | 482 | public void Print() |
481 | { | 483 | { |
482 | Console.WriteLine("Method Attribute: "); | 484 | Console.WriteLine("Method Attribute: "); |
483 | Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 485 | Console.WriteLine("Name Index: " + NameIndex + " // " + |
486 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
484 | Console.WriteLine("Length: " + Length); | 487 | Console.WriteLine("Length: " + Length); |
485 | Console.WriteLine("MaxStack: " + MaxStack); | 488 | Console.WriteLine("MaxStack: " + MaxStack); |
486 | Console.WriteLine("MaxLocals: " + MaxLocals); | 489 | Console.WriteLine("MaxLocals: " + MaxLocals); |
@@ -492,7 +495,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
492 | Console.WriteLine("SubAttributes: " + SubAttributeCount); | 495 | Console.WriteLine("SubAttributes: " + SubAttributeCount); |
493 | for (int i = 0; i < SubAttributeCount; i++) | 496 | for (int i = 0; i < SubAttributeCount; i++) |
494 | { | 497 | { |
495 | this.SubAttributes[i].Print(); | 498 | SubAttributes[i].Print(); |
496 | } | 499 | } |
497 | } | 500 | } |
498 | 501 | ||
@@ -511,8 +514,11 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
511 | 514 | ||
512 | public void ReadData(byte[] data, ref int pointer) | 515 | public void ReadData(byte[] data, ref int pointer) |
513 | { | 516 | { |
514 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 517 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
515 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 518 | Length = |
519 | (Int32) | ||
520 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + | ||
521 | data[pointer++]); | ||
516 | Data = new byte[Length]; | 522 | Data = new byte[Length]; |
517 | for (int i = 0; i < Length; i++) | 523 | for (int i = 0; i < Length; i++) |
518 | { | 524 | { |
@@ -522,18 +528,17 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
522 | 528 | ||
523 | public void Print() | 529 | public void Print() |
524 | { | 530 | { |
525 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 531 | Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + |
532 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
526 | } | 533 | } |
527 | |||
528 | } | 534 | } |
529 | } | 535 | } |
530 | |||
531 | } | 536 | } |
537 | |||
532 | private class InterfaceInfo | 538 | private class InterfaceInfo |
533 | { | 539 | { |
534 | public void ReadData(byte[] data, ref int i) | 540 | public void ReadData(byte[] data, ref int i) |
535 | { | 541 | { |
536 | |||
537 | } | 542 | } |
538 | } | 543 | } |
539 | 544 | ||
@@ -554,15 +559,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
554 | 559 | ||
555 | public void ReadData(byte[] data, ref int pointer) | 560 | public void ReadData(byte[] data, ref int pointer) |
556 | { | 561 | { |
557 | AccessFlags = (ushort)((data[pointer++] << 8) + data[pointer++]); | 562 | AccessFlags = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
558 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 563 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
559 | DescriptorIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 564 | DescriptorIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
560 | AttributeCount = (ushort)((data[pointer++] << 8) + data[pointer++]); | 565 | AttributeCount = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
561 | for (int i = 0; i < AttributeCount; i++) | 566 | for (int i = 0; i < AttributeCount; i++) |
562 | { | 567 | { |
563 | FieldAttribute attri = new FieldAttribute(this.parent); | 568 | FieldAttribute attri = new FieldAttribute(parent); |
564 | attri.ReadData(data, ref pointer); | 569 | attri.ReadData(data, ref pointer); |
565 | this.Attributes.Add(attri); | 570 | Attributes.Add(attri); |
566 | } | 571 | } |
567 | } | 572 | } |
568 | 573 | ||
@@ -570,29 +575,30 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
570 | { | 575 | { |
571 | Console.WriteLine("Field Info Struct: "); | 576 | Console.WriteLine("Field Info Struct: "); |
572 | Console.WriteLine("AccessFlags: " + AccessFlags); | 577 | Console.WriteLine("AccessFlags: " + AccessFlags); |
573 | Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 578 | Console.WriteLine("NameIndex: " + NameIndex + " // " + |
574 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value); | 579 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); |
580 | Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + | ||
581 | ((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value); | ||
575 | Console.WriteLine("Attribute Count:" + AttributeCount); | 582 | Console.WriteLine("Attribute Count:" + AttributeCount); |
576 | //if static, add to static field list | 583 | //if static, add to static field list |
577 | // if (this.AccessFlags == 9) //public and static | 584 | // if (this.AccessFlags == 9) //public and static |
578 | if ((this.AccessFlags & 0x08) != 0) | 585 | if ((AccessFlags & 0x08) != 0) |
579 | { | 586 | { |
580 | switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value) | 587 | switch (((PoolUtf8) parent.m_constantsPool[DescriptorIndex - 1]).Value) |
581 | { | 588 | { |
582 | case "I": | 589 | case "I": |
583 | Int newin = new Int(); | 590 | Int newin = new Int(); |
584 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin); | 591 | parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newin); |
585 | break; | 592 | break; |
586 | case "F": | 593 | case "F": |
587 | Float newfl = new Float(); | 594 | Float newfl = new Float(); |
588 | this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl); | 595 | parent.StaticFields.Add(((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value, newfl); |
589 | break; | 596 | break; |
590 | } | 597 | } |
591 | |||
592 | } | 598 | } |
593 | for (int i = 0; i < AttributeCount; i++) | 599 | for (int i = 0; i < AttributeCount; i++) |
594 | { | 600 | { |
595 | this.Attributes[i].Print(); | 601 | Attributes[i].Print(); |
596 | } | 602 | } |
597 | } | 603 | } |
598 | 604 | ||
@@ -611,8 +617,10 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
611 | 617 | ||
612 | public void ReadData(byte[] data, ref int pointer) | 618 | public void ReadData(byte[] data, ref int pointer) |
613 | { | 619 | { |
614 | NameIndex = (ushort)((data[pointer++] << 8) + data[pointer++]); | 620 | NameIndex = (ushort) ((data[pointer++] << 8) + data[pointer++]); |
615 | Length = (Int32)((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | 621 | Length = |
622 | (Int32) | ||
623 | ((data[pointer++] << 24) + (data[pointer++] << 16) + (data[pointer++] << 8) + data[pointer++]); | ||
616 | Data = new byte[Length]; | 624 | Data = new byte[Length]; |
617 | for (int i = 0; i < Length; i++) | 625 | for (int i = 0; i < Length; i++) |
618 | { | 626 | { |
@@ -622,7 +630,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
622 | 630 | ||
623 | public void Print() | 631 | public void Print() |
624 | { | 632 | { |
625 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value); | 633 | Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + |
634 | ((PoolUtf8) parent.m_constantsPool[NameIndex - 1]).Value); | ||
626 | } | 635 | } |
627 | } | 636 | } |
628 | } | 637 | } |
@@ -631,10 +640,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
631 | { | 640 | { |
632 | public void ReadData(byte[] data, ref int i) | 641 | public void ReadData(byte[] data, ref int i) |
633 | { | 642 | { |
634 | |||
635 | } | 643 | } |
636 | } | 644 | } |
637 | #endregion | ||
638 | 645 | ||
646 | #endregion | ||
639 | } | 647 | } |
640 | } \ No newline at end of file | 648 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs index c76767a..9876caa 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | 29 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 30 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 31 | { |
@@ -37,7 +35,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
37 | 35 | ||
38 | public Heap() | 36 | public Heap() |
39 | { | 37 | { |
40 | |||
41 | } | 38 | } |
42 | } | 39 | } |
43 | } | 40 | } \ No newline at end of file |
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 | */ |
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 28 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 29 | using 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; |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs index a5bd48b..b27630a 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs | |||
@@ -25,15 +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 | */ |
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
35 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | ||
36 | |||
37 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
38 | { | 29 | { |
39 | partial class Thread | 30 | partial class Thread |
@@ -46,10 +37,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
46 | switch (opcode) | 37 | switch (opcode) |
47 | { | 38 | { |
48 | case 184: | 39 | case 184: |
49 | short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); | 40 | short refIndex = |
50 | if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | 41 | (short) |
42 | ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + | ||
43 | GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); | ||
44 | if (m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) | ||
51 | { | 45 | { |
52 | string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; | 46 | string typ = |
47 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]). | ||
48 | mNameType.Type.Value; | ||
53 | string typeparam = ""; | 49 | string typeparam = ""; |
54 | string typereturn = ""; | 50 | string typereturn = ""; |
55 | int firstbrak = 0; | 51 | int firstbrak = 0; |
@@ -58,16 +54,22 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
58 | secondbrak = typ.LastIndexOf(')'); | 54 | secondbrak = typ.LastIndexOf(')'); |
59 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); | 55 | typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); |
60 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); | 56 | typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); |
61 | if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) | 57 | if ( |
58 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass | ||
59 | .Name.Value == m_thread.currentClass.MClass.Name.Value) | ||
62 | { | 60 | { |
63 | //calling a method in this class | 61 | //calling a method in this class |
64 | if (typeparam.Length == 0) | 62 | if (typeparam.Length == 0) |
65 | { | 63 | { |
66 | this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); | 64 | m_thread.JumpToStaticVoidMethod( |
65 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
66 | .mNameType.Name.Value, (m_thread.PC + 2)); | ||
67 | } | 67 | } |
68 | else | 68 | else |
69 | { | 69 | { |
70 | this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); | 70 | m_thread.JumpToStaticParamMethod( |
71 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
72 | .mNameType.Name.Value, typeparam, (m_thread.PC + 2)); | ||
71 | } | 73 | } |
72 | } | 74 | } |
73 | else | 75 | else |
@@ -75,15 +77,19 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
75 | //calling a method of a different class | 77 | //calling a method of a different class |
76 | 78 | ||
77 | // OpenSimAPI Class | 79 | // OpenSimAPI Class |
78 | if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") | 80 | if ( |
81 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]). | ||
82 | mClass.Name.Value == "OpenSimAPI") | ||
79 | { | 83 | { |
80 | this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); | 84 | m_thread.scriptInfo.api.CallMethod( |
85 | ((ClassRecord.PoolMethodRef) m_thread.currentClass.m_constantsPool[refIndex - 1]) | ||
86 | .mNameType.Name.Value, null); | ||
81 | } | 87 | } |
82 | } | 88 | } |
83 | } | 89 | } |
84 | else | 90 | else |
85 | { | 91 | { |
86 | this.m_thread.PC += 2; | 92 | m_thread.PC += 2; |
87 | } | 93 | } |
88 | result = true; | 94 | result = true; |
89 | break; | 95 | break; |
@@ -93,4 +99,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
93 | } | 99 | } |
94 | } | 100 | } |
95 | } | 101 | } |
96 | } | 102 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs index 5a42285..2814720 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs | |||
@@ -25,10 +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 | */ |
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 29 | { |
34 | partial class Thread | 30 | partial class Thread |
@@ -37,4 +33,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
37 | { | 33 | { |
38 | } | 34 | } |
39 | } | 35 | } |
40 | } | 36 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs index 698a518..4e7351e 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs | |||
@@ -26,8 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 30 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | 31 | ||
@@ -47,77 +45,77 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
47 | public bool Excute() | 45 | public bool Excute() |
48 | { | 46 | { |
49 | bool run = true; | 47 | bool run = true; |
50 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; | 48 | byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[m_thread.PC++]; |
51 | // Console.WriteLine("opCode is: " + currentOpCode); | 49 | // Console.WriteLine("opCode is: " + currentOpCode); |
52 | bool handled = false; | 50 | bool handled = false; |
53 | 51 | ||
54 | handled = this.IsLogicOpCode(currentOpCode); | 52 | handled = IsLogicOpCode(currentOpCode); |
55 | if (!handled) | 53 | if (!handled) |
56 | { | 54 | { |
57 | handled = this.IsMethodOpCode(currentOpCode); | 55 | handled = IsMethodOpCode(currentOpCode); |
58 | } | 56 | } |
59 | if (!handled) | 57 | if (!handled) |
60 | { | 58 | { |
61 | if (currentOpCode == 172) | 59 | if (currentOpCode == 172) |
62 | { | 60 | { |
63 | if (this.m_thread.stack.StackFrames.Count > 1) | 61 | if (m_thread.stack.StackFrames.Count > 1) |
64 | { | 62 | { |
65 | Console.WriteLine("returning int from function"); | 63 | Console.WriteLine("returning int from function"); |
66 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; | 64 | int retPC1 = m_thread.m_currentFrame.ReturnPC; |
67 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 65 | BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop(); |
68 | this.m_thread.stack.StackFrames.Pop(); | 66 | m_thread.stack.StackFrames.Pop(); |
69 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 67 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); |
70 | this.m_thread.PC = retPC1; | 68 | m_thread.PC = retPC1; |
71 | if (bas1 is Int) | 69 | if (bas1 is Int) |
72 | { | 70 | { |
73 | this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); | 71 | m_thread.m_currentFrame.OpStack.Push((Int) bas1); |
74 | } | 72 | } |
75 | } | 73 | } |
76 | else | 74 | else |
77 | { | 75 | { |
78 | // Console.WriteLine("No parent function so ending program"); | 76 | // Console.WriteLine("No parent function so ending program"); |
79 | this.m_thread.stack.StackFrames.Pop(); | 77 | m_thread.stack.StackFrames.Pop(); |
80 | run = false; | 78 | run = false; |
81 | } | 79 | } |
82 | handled = true; | 80 | handled = true; |
83 | } | 81 | } |
84 | if (currentOpCode == 174) | 82 | if (currentOpCode == 174) |
85 | { | 83 | { |
86 | if (this.m_thread.stack.StackFrames.Count > 1) | 84 | if (m_thread.stack.StackFrames.Count > 1) |
87 | { | 85 | { |
88 | Console.WriteLine("returning float from function"); | 86 | Console.WriteLine("returning float from function"); |
89 | int retPC1 = this.m_thread.m_currentFrame.ReturnPC; | 87 | int retPC1 = m_thread.m_currentFrame.ReturnPC; |
90 | BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); | 88 | BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop(); |
91 | this.m_thread.stack.StackFrames.Pop(); | 89 | m_thread.stack.StackFrames.Pop(); |
92 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 90 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); |
93 | this.m_thread.PC = retPC1; | 91 | m_thread.PC = retPC1; |
94 | if (bas1 is Float) | 92 | if (bas1 is Float) |
95 | { | 93 | { |
96 | this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); | 94 | m_thread.m_currentFrame.OpStack.Push((Float) bas1); |
97 | } | 95 | } |
98 | } | 96 | } |
99 | else | 97 | else |
100 | { | 98 | { |
101 | // Console.WriteLine("No parent function so ending program"); | 99 | // Console.WriteLine("No parent function so ending program"); |
102 | this.m_thread.stack.StackFrames.Pop(); | 100 | m_thread.stack.StackFrames.Pop(); |
103 | run = false; | 101 | run = false; |
104 | } | 102 | } |
105 | handled = true; | 103 | handled = true; |
106 | } | 104 | } |
107 | if (currentOpCode == 177) | 105 | if (currentOpCode == 177) |
108 | { | 106 | { |
109 | if (this.m_thread.stack.StackFrames.Count > 1) | 107 | if (m_thread.stack.StackFrames.Count > 1) |
110 | { | 108 | { |
111 | Console.WriteLine("returning from function"); | 109 | Console.WriteLine("returning from function"); |
112 | int retPC = this.m_thread.m_currentFrame.ReturnPC; | 110 | int retPC = m_thread.m_currentFrame.ReturnPC; |
113 | this.m_thread.stack.StackFrames.Pop(); | 111 | m_thread.stack.StackFrames.Pop(); |
114 | this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); | 112 | m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek(); |
115 | this.m_thread.PC = retPC; | 113 | m_thread.PC = retPC; |
116 | } | 114 | } |
117 | else | 115 | else |
118 | { | 116 | { |
119 | // Console.WriteLine("No parent function so ending program"); | 117 | // Console.WriteLine("No parent function so ending program"); |
120 | this.m_thread.stack.StackFrames.Pop(); | 118 | m_thread.stack.StackFrames.Pop(); |
121 | run = false; | 119 | run = false; |
122 | } | 120 | } |
123 | handled = true; | 121 | handled = true; |
@@ -128,8 +126,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
128 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); | 126 | Console.WriteLine("opcode " + currentOpCode + " not been handled "); |
129 | } | 127 | } |
130 | return run; | 128 | return run; |
131 | |||
132 | } | 129 | } |
133 | } | 130 | } |
134 | } | 131 | } |
135 | } | 132 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs index 34d4fc5..adad1a8 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs | |||
@@ -25,21 +25,17 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 29 | { |
34 | public class MainMemory | 30 | public class MainMemory |
35 | { | 31 | { |
36 | public Heap HeapArea; | 32 | public Heap HeapArea; |
37 | public MethodMemory MethodArea; | 33 | public MethodMemory MethodArea; |
38 | 34 | ||
39 | public MainMemory() | 35 | public MainMemory() |
40 | { | 36 | { |
41 | MethodArea = new MethodMemory(); | 37 | MethodArea = new MethodMemory(); |
42 | HeapArea = new Heap(); | 38 | HeapArea = new Heap(); |
43 | } | 39 | } |
44 | } | 40 | } |
45 | } | 41 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs index f470583..86df4c2 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | 29 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 30 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 31 | { |
@@ -43,4 +41,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
43 | MethodBuffer = new byte[20000]; | 41 | MethodBuffer = new byte[20000]; |
44 | } | 42 | } |
45 | } | 43 | } |
46 | } | 44 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs index 21e467a..1d9cabb 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs | |||
@@ -25,13 +25,9 @@ | |||
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; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | |||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 28 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 29 | { |
34 | public class Object | 30 | public class Object |
35 | { | 31 | { |
36 | } | 32 | } |
37 | } | 33 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs index 9fcec49..616b64e 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/OpCodes.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
34 | { | 30 | { |
35 | public enum OpCode : byte | 31 | public enum OpCode : byte |
@@ -81,4 +77,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
81 | getstatic = 178, | 77 | getstatic = 178, |
82 | putstatic = 179 | 78 | putstatic = 179 |
83 | } | 79 | } |
84 | } | 80 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs index 56e02ff..4f6c1e7 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | 29 | ||
32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 30 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
33 | { | 31 | { |
@@ -39,4 +37,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
39 | { | 37 | { |
40 | } | 38 | } |
41 | } | 39 | } |
42 | } | 40 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs index a5f9029..306a70d 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs | |||
@@ -25,9 +25,7 @@ | |||
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; | ||
29 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | 30 | ||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 31 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
@@ -44,6 +42,5 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
44 | { | 42 | { |
45 | LocalVariables = new BaseType[20]; | 43 | LocalVariables = new BaseType[20]; |
46 | } | 44 | } |
47 | |||
48 | } | 45 | } |
49 | } | 46 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs index b810676..64093ef 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs | |||
@@ -25,15 +25,9 @@ | |||
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 OpenSim.Region.Environment.Scenes; |
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | 29 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; |
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; | 30 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; |
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Region.Environment.Scenes; | ||
36 | using OpenSim.Region.ExtensionsScriptModule; | ||
37 | 31 | ||
38 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | 32 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM |
39 | { | 33 | { |
@@ -55,8 +49,8 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
55 | 49 | ||
56 | public Thread() | 50 | public Thread() |
57 | { | 51 | { |
58 | this.m_Interpreter = new Interpreter(this); | 52 | m_Interpreter = new Interpreter(this); |
59 | this.stack = new Stack(); | 53 | stack = new Stack(); |
60 | } | 54 | } |
61 | 55 | ||
62 | public void SetPC(int methodpointer) | 56 | public void SetPC(int methodpointer) |
@@ -68,15 +62,15 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
68 | public void StartMethod(ClassRecord rec, string methName) | 62 | public void StartMethod(ClassRecord rec, string methName) |
69 | { | 63 | { |
70 | m_currentFrame = new StackFrame(); | 64 | m_currentFrame = new StackFrame(); |
71 | this.stack.StackFrames.Push(m_currentFrame); | 65 | stack.StackFrames.Push(m_currentFrame); |
72 | this.currentClass = rec; | 66 | currentClass = rec; |
73 | currentClass.StartMethod(this, methName); | 67 | currentClass.StartMethod(this, methName); |
74 | } | 68 | } |
75 | 69 | ||
76 | public void StartMethod( string methName) | 70 | public void StartMethod(string methName) |
77 | { | 71 | { |
78 | m_currentFrame = new StackFrame(); | 72 | m_currentFrame = new StackFrame(); |
79 | this.stack.StackFrames.Push(m_currentFrame); | 73 | stack.StackFrames.Push(m_currentFrame); |
80 | currentClass.StartMethod(this, methName); | 74 | currentClass.StartMethod(this, methName); |
81 | } | 75 | } |
82 | 76 | ||
@@ -84,7 +78,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
84 | { | 78 | { |
85 | m_currentFrame = new StackFrame(); | 79 | m_currentFrame = new StackFrame(); |
86 | m_currentFrame.ReturnPC = returnPC; | 80 | m_currentFrame.ReturnPC = returnPC; |
87 | this.stack.StackFrames.Push(m_currentFrame); | 81 | stack.StackFrames.Push(m_currentFrame); |
88 | currentClass.StartMethod(this, methName); | 82 | currentClass.StartMethod(this, methName); |
89 | } | 83 | } |
90 | 84 | ||
@@ -95,25 +89,23 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM | |||
95 | BaseType bs1 = m_currentFrame.OpStack.Pop(); | 89 | BaseType bs1 = m_currentFrame.OpStack.Pop(); |
96 | m_currentFrame = new StackFrame(); | 90 | m_currentFrame = new StackFrame(); |
97 | m_currentFrame.ReturnPC = returnPC; | 91 | m_currentFrame.ReturnPC = returnPC; |
98 | this.stack.StackFrames.Push(m_currentFrame); | 92 | stack.StackFrames.Push(m_currentFrame); |
99 | m_currentFrame.LocalVariables[0] = ((Int)bs1); | 93 | m_currentFrame.LocalVariables[0] = ((Int) bs1); |
100 | currentClass.StartMethod(this, methName); | 94 | currentClass.StartMethod(this, methName); |
101 | } | 95 | } |
102 | if (param == "F") | 96 | if (param == "F") |
103 | { | 97 | { |
104 | |||
105 | } | 98 | } |
106 | } | 99 | } |
107 | 100 | ||
108 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) | 101 | public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) |
109 | { | 102 | { |
110 | |||
111 | } | 103 | } |
112 | 104 | ||
113 | public bool Excute() | 105 | public bool Excute() |
114 | { | 106 | { |
115 | excutionCounter++; | 107 | excutionCounter++; |
116 | return this.m_Interpreter.Excute(); | 108 | return m_Interpreter.Excute(); |
117 | } | 109 | } |
118 | } | 110 | } |
119 | } | 111 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs index 0f0ff16..ea99626 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JavaEngine.cs | |||
@@ -26,11 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
31 | using System.Text; | ||
32 | |||
33 | using OpenSim.Region.ExtensionsScriptModule; | ||
34 | 30 | ||
35 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | 31 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine |
36 | { | 32 | { |
@@ -53,4 +49,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
53 | return returns; | 49 | return returns; |
54 | } | 50 | } |
55 | } | 51 | } |
56 | } | 52 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs index b1258f6..274932a 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs | |||
@@ -27,15 +27,11 @@ | |||
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.Diagnostics; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Threading; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Interfaces; | ||
35 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
36 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; |
38 | using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; | ||
39 | 35 | ||
40 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | 36 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine |
41 | { | 37 | { |
@@ -45,14 +41,14 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
45 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); | 41 | private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); |
46 | private MainMemory _mainMemory; | 42 | private MainMemory _mainMemory; |
47 | 43 | ||
48 | ScriptInfo scriptInfo; | 44 | private ScriptInfo scriptInfo; |
49 | 45 | ||
50 | public void Initialise(ScriptInfo info) | 46 | public void Initialise(ScriptInfo info) |
51 | { | 47 | { |
52 | scriptInfo = info; | 48 | scriptInfo = info; |
53 | 49 | ||
54 | _mainMemory = new MainMemory(); | 50 | _mainMemory = new MainMemory(); |
55 | Thread.GlobalMemory = this._mainMemory; | 51 | Thread.GlobalMemory = _mainMemory; |
56 | Thread.World = info.world; | 52 | Thread.World = info.world; |
57 | CompileScript(); | 53 | CompileScript(); |
58 | 54 | ||
@@ -60,33 +56,33 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
60 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); | 56 | scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); |
61 | } | 57 | } |
62 | 58 | ||
63 | void events_OnNewPresence(ScenePresence presence) | 59 | private void events_OnNewPresence(ScenePresence presence) |
64 | { | 60 | { |
65 | for (int i = 0; i < this._threads.Count; i++) | 61 | for (int i = 0; i < _threads.Count; i++) |
66 | { | 62 | { |
67 | if (!this._threads[i].running) | 63 | if (!_threads[i].running) |
68 | { | 64 | { |
69 | this._threads[i].StartMethod("OnNewPresence"); | 65 | _threads[i].StartMethod("OnNewPresence"); |
70 | bool run = true; | 66 | bool run = true; |
71 | while (run) | 67 | while (run) |
72 | { | 68 | { |
73 | run = this._threads[i].Excute(); | 69 | run = _threads[i].Excute(); |
74 | } | 70 | } |
75 | } | 71 | } |
76 | } | 72 | } |
77 | } | 73 | } |
78 | 74 | ||
79 | void events_OnFrame() | 75 | private void events_OnFrame() |
80 | { | 76 | { |
81 | for (int i = 0; i < this._threads.Count; i++) | 77 | for (int i = 0; i < _threads.Count; i++) |
82 | { | 78 | { |
83 | if (!this._threads[i].running) | 79 | if (!_threads[i].running) |
84 | { | 80 | { |
85 | this._threads[i].StartMethod("OnFrame"); | 81 | _threads[i].StartMethod("OnFrame"); |
86 | bool run = true; | 82 | bool run = true; |
87 | while (run) | 83 | while (run) |
88 | { | 84 | { |
89 | run = this._threads[i].Excute(); | 85 | run = _threads[i].Excute(); |
90 | } | 86 | } |
91 | } | 87 | } |
92 | } | 88 | } |
@@ -103,12 +99,12 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
103 | CompileInfo comp = new CompileInfo(); | 99 | CompileInfo comp = new CompileInfo(); |
104 | comp.script = script; | 100 | comp.script = script; |
105 | comp.scriptName = script; | 101 | comp.scriptName = script; |
106 | this.CompileScripts.Enqueue(comp); | 102 | CompileScripts.Enqueue(comp); |
107 | } | 103 | } |
108 | 104 | ||
109 | public void CompileScript() | 105 | public void CompileScript() |
110 | { | 106 | { |
111 | CompileInfo comp = this.CompileScripts.Dequeue(); | 107 | CompileInfo comp = CompileScripts.Dequeue(); |
112 | string script = comp.script; | 108 | string script = comp.script; |
113 | string scriptName = comp.scriptName; | 109 | string scriptName = comp.scriptName; |
114 | try | 110 | try |
@@ -121,13 +117,13 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
121 | tw.Close(); | 117 | tw.Close(); |
122 | 118 | ||
123 | //now compile | 119 | //now compile |
124 | System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); | 120 | ProcessStartInfo psi = new ProcessStartInfo("javac.exe", "*.java"); |
125 | // psi.RedirectStandardOutput = true; | 121 | // psi.RedirectStandardOutput = true; |
126 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | 122 | psi.WindowStyle = ProcessWindowStyle.Hidden; |
127 | psi.UseShellExecute = false; | 123 | psi.UseShellExecute = false; |
128 | 124 | ||
129 | System.Diagnostics.Process javacomp; | 125 | Process javacomp; |
130 | javacomp = System.Diagnostics.Process.Start(psi); | 126 | javacomp = Process.Start(psi); |
131 | javacomp.WaitForExit(); | 127 | javacomp.WaitForExit(); |
132 | 128 | ||
133 | 129 | ||
@@ -136,17 +132,17 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
136 | class1.LoadClassFromFile(scriptName + ".class"); | 132 | class1.LoadClassFromFile(scriptName + ".class"); |
137 | class1.PrintToConsole(); | 133 | class1.PrintToConsole(); |
138 | //Console.WriteLine(); | 134 | //Console.WriteLine(); |
139 | this._mainMemory.MethodArea.Classes.Add(class1); | 135 | _mainMemory.MethodArea.Classes.Add(class1); |
140 | class1.AddMethodsToMemory(this._mainMemory.MethodArea); | 136 | class1.AddMethodsToMemory(_mainMemory.MethodArea); |
141 | 137 | ||
142 | Thread newThread = new Thread(); | 138 | Thread newThread = new Thread(); |
143 | this._threads.Add(newThread); | 139 | _threads.Add(newThread); |
144 | newThread.currentClass = class1; | 140 | newThread.currentClass = class1; |
145 | newThread.scriptInfo = scriptInfo; | 141 | newThread.scriptInfo = scriptInfo; |
146 | 142 | ||
147 | //now delete the created files | 143 | //now delete the created files |
148 | System.IO.File.Delete(scriptName + ".java"); | 144 | File.Delete(scriptName + ".java"); |
149 | System.IO.File.Delete(scriptName + ".class"); | 145 | File.Delete(scriptName + ".class"); |
150 | //this.OnFrame(); | 146 | //this.OnFrame(); |
151 | } | 147 | } |
152 | catch (Exception e) | 148 | catch (Exception e) |
@@ -164,8 +160,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine | |||
164 | 160 | ||
165 | public CompileInfo() | 161 | public CompileInfo() |
166 | { | 162 | { |
167 | |||
168 | } | 163 | } |
169 | } | 164 | } |
170 | } | 165 | } |
171 | } | 166 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs index a36ad77..3c82952 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ArrayReference.cs | |||
@@ -26,13 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types |
34 | { | 30 | { |
35 | public class ArrayReference :BaseType | 31 | public class ArrayReference : BaseType |
36 | { | 32 | { |
37 | } | 33 | } |
38 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs index 5921446..4026c10 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/ObjectReference.cs | |||
@@ -26,10 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types |
34 | { | 30 | { |
35 | public class ObjectReference : BaseType | 31 | public class ObjectReference : BaseType |
@@ -38,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types | |||
38 | 34 | ||
39 | public ObjectReference() | 35 | public ObjectReference() |
40 | { | 36 | { |
41 | |||
42 | } | 37 | } |
43 | } | 38 | } |
44 | } | 39 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs index aa59681..de1aa87 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Byte.cs | |||
@@ -26,14 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Byte : BaseType | 31 | public class Byte : BaseType |
37 | { | 32 | { |
38 | } | 33 | } |
39 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs index 1cef150..0e17057 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Char.cs | |||
@@ -26,14 +26,9 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Char : BaseType | 31 | public class Char : BaseType |
37 | { | 32 | { |
38 | } | 33 | } |
39 | } | 34 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs index 0614dfd..ce8648c 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Float.cs | |||
@@ -26,11 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Float : BaseType | 31 | public class Float : BaseType |
@@ -39,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | |||
39 | 34 | ||
40 | public Float() | 35 | public Float() |
41 | { | 36 | { |
42 | |||
43 | } | 37 | } |
44 | } | 38 | } |
45 | } | 39 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs index 35f9822..251b736 100644 --- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs +++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/Types/PrimitiveTypes/Int.cs | |||
@@ -26,11 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; | ||
33 | |||
34 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | 29 | namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes |
35 | { | 30 | { |
36 | public class Int : BaseType | 31 | public class Int : BaseType |
@@ -39,7 +34,6 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes | |||
39 | 34 | ||
40 | public Int() | 35 | public Int() |
41 | { | 36 | { |
42 | |||
43 | } | 37 | } |
44 | } | 38 | } |
45 | } | 39 | } \ No newline at end of file |