From 67e12b95ea7b68f4904a7484d77ecfd787d16d0c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 30 Oct 2007 09:05:31 +0000 Subject: * Optimized usings * Shortened type references * Removed redundant 'this' qualifier --- .../Engines/JVMEngine/JVM/Interpreter.Logic.cs | 454 ++++++++++++--------- 1 file changed, 261 insertions(+), 193 deletions(-) (limited to 'OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs') 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 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; -using System.Text; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; @@ -42,304 +39,313 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM bool result = false; switch (opcode) { - case (byte)(byte)OpCode.iconst_m1: + case (byte) (byte) OpCode.iconst_m1: Int m_int = new Int(); m_int.mValue = -1; - this.m_thread.m_currentFrame.OpStack.Push(m_int); + m_thread.m_currentFrame.OpStack.Push(m_int); result = true; break; - case (byte)(byte)OpCode.iconst_0: + case (byte) (byte) OpCode.iconst_0: m_int = new Int(); m_int.mValue = 0; - this.m_thread.m_currentFrame.OpStack.Push(m_int); + m_thread.m_currentFrame.OpStack.Push(m_int); result = true; break; - case (byte)(byte)OpCode.iconst_1: + case (byte) (byte) OpCode.iconst_1: m_int = new Int(); m_int.mValue = 1; - this.m_thread.m_currentFrame.OpStack.Push(m_int); + m_thread.m_currentFrame.OpStack.Push(m_int); result = true; break; - case (byte)(byte)OpCode.iconst_2: + case (byte) (byte) OpCode.iconst_2: m_int = new Int(); m_int.mValue = 2; - this.m_thread.m_currentFrame.OpStack.Push(m_int); + m_thread.m_currentFrame.OpStack.Push(m_int); result = true; break; - case (byte)(byte)OpCode.iconst_3: + case (byte) (byte) OpCode.iconst_3: m_int = new Int(); m_int.mValue = 3; - this.m_thread.m_currentFrame.OpStack.Push(m_int); + m_thread.m_currentFrame.OpStack.Push(m_int); break; - case (byte)(byte)OpCode.iconst_4: + case (byte) (byte) OpCode.iconst_4: m_int = new Int(); m_int.mValue = 4; - this.m_thread.m_currentFrame.OpStack.Push(m_int); + m_thread.m_currentFrame.OpStack.Push(m_int); result = true; break; - case (byte)OpCode.iconst_5: + case (byte) OpCode.iconst_5: m_int = new Int(); m_int.mValue = 5; - this.m_thread.m_currentFrame.OpStack.Push(m_int); + m_thread.m_currentFrame.OpStack.Push(m_int); result = true; break; - case (byte)OpCode.fconst_0: + case (byte) OpCode.fconst_0: Float m_float = new Float(); m_float.mValue = 0.0f; - this.m_thread.m_currentFrame.OpStack.Push(m_float); + m_thread.m_currentFrame.OpStack.Push(m_float); result = true; break; - case (byte)OpCode.fconst_1: + case (byte) OpCode.fconst_1: m_float = new Float(); m_float.mValue = 1.0f; - this.m_thread.m_currentFrame.OpStack.Push(m_float); + m_thread.m_currentFrame.OpStack.Push(m_float); result = true; break; - case (byte)OpCode.fconst_2: + case (byte) OpCode.fconst_2: m_float = new Float(); m_float.mValue = 2.0f; - this.m_thread.m_currentFrame.OpStack.Push(m_float); + m_thread.m_currentFrame.OpStack.Push(m_float); result = true; break; - case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? - int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]; + case (byte) OpCode.bipush: //is this right? this should be pushing a byte onto stack not int? + int pushvalue = (int) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]; Int pushInt = new Int(); pushInt.mValue = pushvalue; - this.m_thread.m_currentFrame.OpStack.Push(pushInt); - this.m_thread.PC++; + m_thread.m_currentFrame.OpStack.Push(pushInt); + m_thread.PC++; result = true; break; - case (byte)OpCode.sipush: - short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); + case (byte) OpCode.sipush: + short pushvalue2 = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); Int pushInt2 = new Int(); pushInt2.mValue = pushvalue2; - this.m_thread.m_currentFrame.OpStack.Push(pushInt2); - this.m_thread.PC += 2; + m_thread.m_currentFrame.OpStack.Push(pushInt2); + m_thread.PC += 2; result = true; break; - case (byte)OpCode.fload: - short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); + case (byte) OpCode.fload: + short findex1 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC])); Float fload = new Float(); - if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null) + if (m_thread.m_currentFrame.LocalVariables[findex1] != null) { - if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float) + if (m_thread.m_currentFrame.LocalVariables[findex1] is Float) { - fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(fload); + fload.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[findex1]).mValue; + m_thread.m_currentFrame.OpStack.Push(fload); } } - this.m_thread.PC++; + m_thread.PC++; result = true; break; - case (byte)OpCode.iload_0: - if (this.m_thread.m_currentFrame.LocalVariables[0] != null) + case (byte) OpCode.iload_0: + if (m_thread.m_currentFrame.LocalVariables[0] != null) { - if (this.m_thread.m_currentFrame.LocalVariables[0] is Int) + if (m_thread.m_currentFrame.LocalVariables[0] is Int) { Int newInt = new Int(); - newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newInt); + newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[0]).mValue; + m_thread.m_currentFrame.OpStack.Push(newInt); } } result = true; break; - case (byte)OpCode.iload_1: - if (this.m_thread.m_currentFrame.LocalVariables[1] != null) + case (byte) OpCode.iload_1: + if (m_thread.m_currentFrame.LocalVariables[1] != null) { - if (this.m_thread.m_currentFrame.LocalVariables[1] is Int) + if (m_thread.m_currentFrame.LocalVariables[1] is Int) { Int newInt = new Int(); - newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newInt); + newInt.mValue = ((Int) m_thread.m_currentFrame.LocalVariables[1]).mValue; + m_thread.m_currentFrame.OpStack.Push(newInt); } } result = true; break; - case (byte)OpCode.fload_0: - if (this.m_thread.m_currentFrame.LocalVariables[0] != null) + case (byte) OpCode.fload_0: + if (m_thread.m_currentFrame.LocalVariables[0] != null) { - if (this.m_thread.m_currentFrame.LocalVariables[0] is Float) + if (m_thread.m_currentFrame.LocalVariables[0] is Float) { Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); + newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[0]).mValue; + m_thread.m_currentFrame.OpStack.Push(newfloat); } } result = true; break; - case (byte)OpCode.fload_1: - if (this.m_thread.m_currentFrame.LocalVariables[1] != null) + case (byte) OpCode.fload_1: + if (m_thread.m_currentFrame.LocalVariables[1] != null) { - if (this.m_thread.m_currentFrame.LocalVariables[1] is Float) + if (m_thread.m_currentFrame.LocalVariables[1] is Float) { Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); + newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[1]).mValue; + m_thread.m_currentFrame.OpStack.Push(newfloat); } } result = true; break; - case (byte)OpCode.fload_2: - if (this.m_thread.m_currentFrame.LocalVariables[2] != null) + case (byte) OpCode.fload_2: + if (m_thread.m_currentFrame.LocalVariables[2] != null) { - if (this.m_thread.m_currentFrame.LocalVariables[2] is Float) + if (m_thread.m_currentFrame.LocalVariables[2] is Float) { Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); + newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[2]).mValue; + m_thread.m_currentFrame.OpStack.Push(newfloat); } } result = true; break; - case (byte)OpCode.fload_3: - if (this.m_thread.m_currentFrame.LocalVariables[3] != null) + case (byte) OpCode.fload_3: + if (m_thread.m_currentFrame.LocalVariables[3] != null) { - if (this.m_thread.m_currentFrame.LocalVariables[3] is Float) + if (m_thread.m_currentFrame.LocalVariables[3] is Float) { Float newfloat = new Float(); - newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newfloat); + newfloat.mValue = ((Float) m_thread.m_currentFrame.LocalVariables[3]).mValue; + m_thread.m_currentFrame.OpStack.Push(newfloat); } } result = true; break; - case (byte)OpCode.istore: - short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); - BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.istore: + short findex3 = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC])); + BaseType istor = m_thread.m_currentFrame.OpStack.Pop(); if (istor is Int) { - this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor; + m_thread.m_currentFrame.LocalVariables[findex3] = (Int) istor; } - this.m_thread.PC++; + m_thread.PC++; result = true; break; - case (byte)OpCode.fstore: - short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC])); - BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fstore: + short findex = (short) ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC])); + BaseType fstor = m_thread.m_currentFrame.OpStack.Pop(); if (fstor is Float) { - this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor; + m_thread.m_currentFrame.LocalVariables[findex] = (Float) fstor; } - this.m_thread.PC++; + m_thread.PC++; result = true; break; - case (byte)OpCode.istore_0: - BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.istore_0: + BaseType baset = m_thread.m_currentFrame.OpStack.Pop(); if (baset is Int) { - this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset; + m_thread.m_currentFrame.LocalVariables[0] = (Int) baset; } result = true; break; - case (byte)OpCode.istore_1: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.istore_1: + baset = m_thread.m_currentFrame.OpStack.Pop(); if (baset is Int) { - this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset; + m_thread.m_currentFrame.LocalVariables[1] = (Int) baset; } result = true; break; - case (byte)OpCode.fstore_0: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fstore_0: + baset = m_thread.m_currentFrame.OpStack.Pop(); if (baset is Float) { - this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset; + m_thread.m_currentFrame.LocalVariables[0] = (Float) baset; } result = true; break; - case (byte)OpCode.fstore_1: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fstore_1: + baset = m_thread.m_currentFrame.OpStack.Pop(); if (baset is Float) { - this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset; + m_thread.m_currentFrame.LocalVariables[1] = (Float) baset; } result = true; break; - case (byte)OpCode.fstore_2: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fstore_2: + baset = m_thread.m_currentFrame.OpStack.Pop(); if (baset is Float) { - this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset; + m_thread.m_currentFrame.LocalVariables[2] = (Float) baset; } result = true; break; - case (byte)OpCode.fstore_3: - baset = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fstore_3: + baset = m_thread.m_currentFrame.OpStack.Pop(); if (baset is Float) { - this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset; + m_thread.m_currentFrame.LocalVariables[3] = (Float) baset; } result = true; break; - case (byte)OpCode.pop: - this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.pop: + m_thread.m_currentFrame.OpStack.Pop(); result = true; break; - case (byte)OpCode.fadd: - BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fadd: + BaseType bf2 = m_thread.m_currentFrame.OpStack.Pop(); + BaseType bf1 = m_thread.m_currentFrame.OpStack.Pop(); if (bf1 is Float && bf2 is Float) { Float nflt = new Float(); - nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue; - this.m_thread.m_currentFrame.OpStack.Push(nflt); + nflt.mValue = ((Float) bf1).mValue + ((Float) bf2).mValue; + m_thread.m_currentFrame.OpStack.Push(nflt); } result = true; break; - case (byte)OpCode.fsub: - BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fsub: + BaseType bsf2 = m_thread.m_currentFrame.OpStack.Pop(); + BaseType bsf1 = m_thread.m_currentFrame.OpStack.Pop(); if (bsf1 is Float && bsf2 is Float) { Float resf = new Float(); - resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue; - this.m_thread.m_currentFrame.OpStack.Push(resf); + resf.mValue = ((Float) bsf1).mValue - ((Float) bsf2).mValue; + m_thread.m_currentFrame.OpStack.Push(resf); } result = true; break; - case (byte)OpCode.imul: //check the order of the two values off the stack is correct - BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.imul: //check the order of the two values off the stack is correct + BaseType bs2 = m_thread.m_currentFrame.OpStack.Pop(); + BaseType bs1 = m_thread.m_currentFrame.OpStack.Pop(); if (bs1 is Int && bs2 is Int) { Int nInt = new Int(); - nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue; - this.m_thread.m_currentFrame.OpStack.Push(nInt); + nInt.mValue = ((Int) bs1).mValue*((Int) bs2).mValue; + m_thread.m_currentFrame.OpStack.Push(nInt); } result = true; break; - case (byte)OpCode.iinc: - if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null) + case (byte) OpCode.iinc: + if (m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]] != + null) { - if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int) + if ( + m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] + ] is Int) { - ((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]; + ((Int) + m_thread.m_currentFrame.LocalVariables[ + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC]]).mValue += + (sbyte) GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]; } } - this.m_thread.PC += 2; + m_thread.PC += 2; result = true; break; - case (byte)OpCode.f2i: - BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.f2i: + BaseType conv1 = m_thread.m_currentFrame.OpStack.Pop(); if (conv1 is Float) { Int newconv = new Int(); - newconv.mValue = (int)((Float)conv1).mValue; - this.m_thread.m_currentFrame.OpStack.Push(newconv); + newconv.mValue = (int) ((Float) conv1).mValue; + m_thread.m_currentFrame.OpStack.Push(newconv); } result = true; break; - case (byte)OpCode.fcmpl: - BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fcmpl: + BaseType flcom2 = m_thread.m_currentFrame.OpStack.Pop(); + BaseType flcom1 = m_thread.m_currentFrame.OpStack.Pop(); if (flcom1 is Float && flcom2 is Float) { Int compres = new Int(); - if (((Float)flcom1).mValue < ((Float)flcom2).mValue) + if (((Float) flcom1).mValue < ((Float) flcom2).mValue) { compres.mValue = -1; } - else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) + else if (((Float) flcom1).mValue > ((Float) flcom2).mValue) { compres.mValue = 1; } @@ -347,21 +353,21 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM { compres.mValue = 0; } - this.m_thread.m_currentFrame.OpStack.Push(compres); + m_thread.m_currentFrame.OpStack.Push(compres); } result = true; break; - case (byte)OpCode.fcmpg: - flcom2 = this.m_thread.m_currentFrame.OpStack.Pop(); - flcom1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.fcmpg: + flcom2 = m_thread.m_currentFrame.OpStack.Pop(); + flcom1 = m_thread.m_currentFrame.OpStack.Pop(); if (flcom1 is Float && flcom2 is Float) { Int compres = new Int(); - if (((Float)flcom1).mValue < ((Float)flcom2).mValue) + if (((Float) flcom1).mValue < ((Float) flcom2).mValue) { compres.mValue = -1; } - else if (((Float)flcom1).mValue > ((Float)flcom2).mValue) + else if (((Float) flcom1).mValue > ((Float) flcom2).mValue) { compres.mValue = 1; } @@ -369,128 +375,169 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM { compres.mValue = 0; } - this.m_thread.m_currentFrame.OpStack.Push(compres); + m_thread.m_currentFrame.OpStack.Push(compres); } result = true; break; - case (byte)OpCode.ifge: - short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.ifge: + short compareoffset2 = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); + BaseType compe1 = m_thread.m_currentFrame.OpStack.Pop(); if (compe1 is Int) { - if (((Int)compe1).mValue >= 0) + if (((Int) compe1).mValue >= 0) { - this.m_thread.PC += -1 + compareoffset2; + m_thread.PC += -1 + compareoffset2; } else { - this.m_thread.PC += 2; + m_thread.PC += 2; } } else { - this.m_thread.PC += 2; + m_thread.PC += 2; } result = true; break; - case (byte)OpCode.ifle: - short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.ifle: + short compareoffset1 = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); + BaseType comp1 = m_thread.m_currentFrame.OpStack.Pop(); if (comp1 is Int) { - if (((Int)comp1).mValue <= 0) + if (((Int) comp1).mValue <= 0) { - this.m_thread.PC += -1 + compareoffset1; + m_thread.PC += -1 + compareoffset1; } else { - this.m_thread.PC += 2; + m_thread.PC += 2; } } else { - this.m_thread.PC += 2; + m_thread.PC += 2; } result = true; break; - case (byte)OpCode.if_icmpge: - short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.if_icmpge: + short compareoffset = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); + BaseType bc2 = m_thread.m_currentFrame.OpStack.Pop(); + BaseType bc1 = m_thread.m_currentFrame.OpStack.Pop(); if (bc1 is Int && bc2 is Int) { //Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue); - if (((Int)bc1).mValue >= ((Int)bc2).mValue) + if (((Int) bc1).mValue >= ((Int) bc2).mValue) { // Console.WriteLine("branch compare true , offset is " +compareoffset); // Console.WriteLine("current PC is " + this._mThread.PC); - this.m_thread.PC += -1 + compareoffset; + m_thread.PC += -1 + compareoffset; //Console.WriteLine("new PC is " + this._mThread.PC); } else { //Console.WriteLine("branch compare false"); - this.m_thread.PC += 2; + m_thread.PC += 2; } } else { - this.m_thread.PC += 2; + m_thread.PC += 2; } result = true; break; - case (byte)OpCode.if_icmple: - short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop(); - BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop(); + case (byte) OpCode.if_icmple: + short compareloffset = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); + BaseType bcl2 = m_thread.m_currentFrame.OpStack.Pop(); + BaseType bcl1 = m_thread.m_currentFrame.OpStack.Pop(); if (bcl1 is Int && bcl2 is Int) { //Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue); - if (((Int)bcl1).mValue <= ((Int)bcl2).mValue) + if (((Int) bcl1).mValue <= ((Int) bcl2).mValue) { // Console.WriteLine("branch compare true , offset is " + compareloffset); // Console.WriteLine("current PC is " + this._mThread.PC); - this.m_thread.PC += -1 + compareloffset; + m_thread.PC += -1 + compareloffset; // Console.WriteLine("new PC is " + this._mThread.PC); } else { //Console.WriteLine("branch compare false"); - this.m_thread.PC += 2; + m_thread.PC += 2; } } else { - this.m_thread.PC += 2; + m_thread.PC += 2; } result = true; break; - case (byte)OpCode._goto: - short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - this.m_thread.PC += -1 + offset; + case (byte) OpCode._goto: + short offset = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); + m_thread.PC += -1 + offset; result = true; break; - case (byte)OpCode.getstatic: - short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) + case (byte) OpCode.getstatic: + short fieldrefIndex = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); + if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) { - if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) + if ( + ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). + mClass.Name.Value == m_thread.currentClass.MClass.Name.Value) { //from this class - if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) + if ( + m_thread.currentClass.StaticFields.ContainsKey( + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) { - if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) + if ( + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name. + Value] is Float) { Float retFloat = new Float(); - retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; - this.m_thread.m_currentFrame.OpStack.Push(retFloat); + retFloat.mValue = + ((Float) + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. + Name.Value]).mValue; + m_thread.m_currentFrame.OpStack.Push(retFloat); } - else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) + else if ( + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. + Name.Value] is Int) { Int retInt = new Int(); - retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue; + retInt.mValue = + ((Int) + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). + mNameType.Name.Value]).mValue; // Console.WriteLine("getting static field, " + retInt.mValue); - this.m_thread.m_currentFrame.OpStack.Push(retInt); + m_thread.m_currentFrame.OpStack.Push(retInt); } } } @@ -499,36 +546,58 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM //get from a different class } } - this.m_thread.PC += 2; + m_thread.PC += 2; result = true; break; - case (byte)OpCode.putstatic: - fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]); - BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop(); - if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) + case (byte) OpCode.putstatic: + fieldrefIndex = + (short) + ((GlobalMemory.MethodArea.MethodBuffer[m_thread.PC] << 8) + + GlobalMemory.MethodArea.MethodBuffer[m_thread.PC + 1]); + BaseType addstatic = m_thread.m_currentFrame.OpStack.Pop(); + if (m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef) { - if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) + if ( + ((ClassRecord.PoolFieldRef) m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]). + mClass.Name.Value == m_thread.currentClass.MClass.Name.Value) { // this class - if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) + if ( + m_thread.currentClass.StaticFields.ContainsKey( + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value)) { if (addstatic is Float) { - if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float) + if ( + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. + Name.Value] is Float) { Float newf = new Float(); - newf.mValue = ((Float)addstatic).mValue; - this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf; + newf.mValue = ((Float) addstatic).mValue; + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. + Name.Value] = newf; } } else if (addstatic is Int) { - if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int) + if ( + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. + Name.Value] is Int) { //Console.WriteLine("setting static field to " + ((Int)addstatic).mValue); Int newi = new Int(); - newi.mValue = ((Int)addstatic).mValue; - this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi; + newi.mValue = ((Int) addstatic).mValue; + m_thread.currentClass.StaticFields[ + ((ClassRecord.PoolFieldRef) + m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType. + Name.Value] = newi; } } } @@ -538,10 +607,9 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM // a different class } } - this.m_thread.PC += 2; + m_thread.PC += 2; result = true; break; - } return result; -- cgit v1.1