mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
changed to native line ending encoding
This commit is contained in:
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class ClassInstance : Object
|
||||
{
|
||||
public int size;
|
||||
public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
|
||||
|
||||
public ClassInstance()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class ClassInstance : Object
|
||||
{
|
||||
public int size;
|
||||
public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
|
||||
|
||||
public ClassInstance()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,43 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class Heap
|
||||
{
|
||||
public List<ClassInstance> ClassObjects = new List<ClassInstance>();
|
||||
|
||||
public Heap()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class Heap
|
||||
{
|
||||
public List<ClassInstance> ClassObjects = new List<ClassInstance>();
|
||||
|
||||
public Heap()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,427 +1,427 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private bool IsLogicOpCode(byte opcode)
|
||||
{
|
||||
bool result = false;
|
||||
switch (opcode)
|
||||
{
|
||||
case 2:
|
||||
Int m_int= new Int();
|
||||
m_int.mValue = -1;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 3:
|
||||
m_int= new Int();
|
||||
m_int.mValue = 0;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 4:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 1;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 5:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 2;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 6:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 3;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
break;
|
||||
case 7:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 4;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 8:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 5;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 11:
|
||||
Float m_float = new Float();
|
||||
m_float.mValue = 0.0f;
|
||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
||||
result = true;
|
||||
break;
|
||||
case 12:
|
||||
m_float = new Float();
|
||||
m_float.mValue = 1.0f;
|
||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
||||
result = true;
|
||||
break;
|
||||
case 13:
|
||||
m_float = new Float();
|
||||
m_float.mValue = 2.0f;
|
||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
||||
result = true;
|
||||
break;
|
||||
case 16:
|
||||
int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC];
|
||||
Int pushInt = new Int();
|
||||
pushInt.mValue = pushvalue;
|
||||
this._mThread.currentFrame.OpStack.Push(pushInt);
|
||||
this._mThread.PC++;
|
||||
result = true;
|
||||
break;
|
||||
case 17:
|
||||
short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
Int pushInt2 = new Int();
|
||||
pushInt2.mValue = pushvalue2;
|
||||
this._mThread.currentFrame.OpStack.Push(pushInt2);
|
||||
this._mThread.PC += 2;
|
||||
result = true;
|
||||
break;
|
||||
case 23:
|
||||
short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
|
||||
Float fload = new Float();
|
||||
if (this._mThread.currentFrame.LocalVariables[findex1] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[findex1] is Float)
|
||||
{
|
||||
fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(fload);
|
||||
}
|
||||
}
|
||||
this._mThread.PC++;
|
||||
result = true;
|
||||
break;
|
||||
case 26:
|
||||
if (this._mThread.currentFrame.LocalVariables[0] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[0] is Int)
|
||||
{
|
||||
Int newInt = new Int();
|
||||
newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newInt);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 27:
|
||||
if (this._mThread.currentFrame.LocalVariables[1] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[1] is Int)
|
||||
{
|
||||
Int newInt = new Int();
|
||||
newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newInt);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 34:
|
||||
if (this._mThread.currentFrame.LocalVariables[0] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[0] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 35:
|
||||
if (this._mThread.currentFrame.LocalVariables[1] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[1] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 36:
|
||||
if (this._mThread.currentFrame.LocalVariables[2] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[2] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 37:
|
||||
if (this._mThread.currentFrame.LocalVariables[3] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[3] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 56:
|
||||
short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] ));
|
||||
BaseType fstor = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (fstor is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor;
|
||||
}
|
||||
this._mThread.PC++;
|
||||
result = true;
|
||||
break;
|
||||
case 59:
|
||||
BaseType baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Int)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[0] = (Int)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 60:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Int)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[1] = (Int)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 67:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[0] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 68:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[1] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 69:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[2] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 70:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[3] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 87:
|
||||
this._mThread.currentFrame.OpStack.Pop();
|
||||
result = true;
|
||||
break;
|
||||
case 98:
|
||||
BaseType bf2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bf1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (bf1 is Float && bf2 is Float)
|
||||
{
|
||||
Float nflt = new Float();
|
||||
nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(nflt);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 102:
|
||||
BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (bsf1 is Float && bsf2 is Float)
|
||||
{
|
||||
Float resf = new Float();
|
||||
resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(resf);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 104: //check the order of the two values off the stack is correct
|
||||
BaseType bs2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bs1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (bs1 is Int && bs2 is Int)
|
||||
{
|
||||
Int nInt = new Int();
|
||||
nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(nInt);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 132:
|
||||
if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int)
|
||||
{
|
||||
((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1];
|
||||
}
|
||||
}
|
||||
this._mThread.PC += 2;
|
||||
result = true;
|
||||
break;
|
||||
case 139:
|
||||
BaseType conv1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (conv1 is Float)
|
||||
{
|
||||
Int newconv = new Int();
|
||||
newconv.mValue = (int)((Float)conv1).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newconv);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 149:
|
||||
BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (flcom1 is Float && flcom2 is Float)
|
||||
{
|
||||
Int compres = new Int();
|
||||
if (((Float)flcom1).mValue < ((Float)flcom2).mValue)
|
||||
{
|
||||
compres.mValue = -1;
|
||||
}
|
||||
else if (((Float)flcom1).mValue > ((Float)flcom2).mValue)
|
||||
{
|
||||
compres.mValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
compres.mValue = 0;
|
||||
}
|
||||
this._mThread.currentFrame.OpStack.Push(compres);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 158:
|
||||
short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
BaseType comp1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (comp1 is Int)
|
||||
{
|
||||
if (((Int)comp1).mValue <= 0)
|
||||
{
|
||||
this._mThread.PC += -1 + compareoffset1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 162:
|
||||
short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
BaseType bc2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bc1 = this._mThread.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)
|
||||
{
|
||||
// Console.WriteLine("branch compare true , offset is " +compareoffset);
|
||||
// Console.WriteLine("current PC is " + this._mThread.PC);
|
||||
this._mThread.PC += -1 + compareoffset;
|
||||
//Console.WriteLine("new PC is " + this._mThread.PC);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("branch compare false");
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 164:
|
||||
short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bcl1 = this._mThread.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)
|
||||
{
|
||||
// Console.WriteLine("branch compare true , offset is " + compareloffset);
|
||||
// Console.WriteLine("current PC is " + this._mThread.PC);
|
||||
this._mThread.PC += -1 + compareloffset;
|
||||
// Console.WriteLine("new PC is " + this._mThread.PC);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("branch compare false");
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 167:
|
||||
short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
|
||||
this._mThread.PC += -1 + offset;
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private bool IsLogicOpCode(byte opcode)
|
||||
{
|
||||
bool result = false;
|
||||
switch (opcode)
|
||||
{
|
||||
case 2:
|
||||
Int m_int= new Int();
|
||||
m_int.mValue = -1;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 3:
|
||||
m_int= new Int();
|
||||
m_int.mValue = 0;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 4:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 1;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 5:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 2;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 6:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 3;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
break;
|
||||
case 7:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 4;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 8:
|
||||
m_int = new Int();
|
||||
m_int.mValue = 5;
|
||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
||||
result = true;
|
||||
break;
|
||||
case 11:
|
||||
Float m_float = new Float();
|
||||
m_float.mValue = 0.0f;
|
||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
||||
result = true;
|
||||
break;
|
||||
case 12:
|
||||
m_float = new Float();
|
||||
m_float.mValue = 1.0f;
|
||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
||||
result = true;
|
||||
break;
|
||||
case 13:
|
||||
m_float = new Float();
|
||||
m_float.mValue = 2.0f;
|
||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
||||
result = true;
|
||||
break;
|
||||
case 16:
|
||||
int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC];
|
||||
Int pushInt = new Int();
|
||||
pushInt.mValue = pushvalue;
|
||||
this._mThread.currentFrame.OpStack.Push(pushInt);
|
||||
this._mThread.PC++;
|
||||
result = true;
|
||||
break;
|
||||
case 17:
|
||||
short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
Int pushInt2 = new Int();
|
||||
pushInt2.mValue = pushvalue2;
|
||||
this._mThread.currentFrame.OpStack.Push(pushInt2);
|
||||
this._mThread.PC += 2;
|
||||
result = true;
|
||||
break;
|
||||
case 23:
|
||||
short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
|
||||
Float fload = new Float();
|
||||
if (this._mThread.currentFrame.LocalVariables[findex1] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[findex1] is Float)
|
||||
{
|
||||
fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(fload);
|
||||
}
|
||||
}
|
||||
this._mThread.PC++;
|
||||
result = true;
|
||||
break;
|
||||
case 26:
|
||||
if (this._mThread.currentFrame.LocalVariables[0] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[0] is Int)
|
||||
{
|
||||
Int newInt = new Int();
|
||||
newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newInt);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 27:
|
||||
if (this._mThread.currentFrame.LocalVariables[1] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[1] is Int)
|
||||
{
|
||||
Int newInt = new Int();
|
||||
newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newInt);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 34:
|
||||
if (this._mThread.currentFrame.LocalVariables[0] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[0] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 35:
|
||||
if (this._mThread.currentFrame.LocalVariables[1] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[1] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 36:
|
||||
if (this._mThread.currentFrame.LocalVariables[2] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[2] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 37:
|
||||
if (this._mThread.currentFrame.LocalVariables[3] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[3] is Float)
|
||||
{
|
||||
Float newfloat = new Float();
|
||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 56:
|
||||
short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] ));
|
||||
BaseType fstor = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (fstor is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor;
|
||||
}
|
||||
this._mThread.PC++;
|
||||
result = true;
|
||||
break;
|
||||
case 59:
|
||||
BaseType baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Int)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[0] = (Int)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 60:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Int)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[1] = (Int)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 67:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[0] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 68:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[1] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 69:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[2] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 70:
|
||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (baset is Float)
|
||||
{
|
||||
this._mThread.currentFrame.LocalVariables[3] = (Float)baset;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 87:
|
||||
this._mThread.currentFrame.OpStack.Pop();
|
||||
result = true;
|
||||
break;
|
||||
case 98:
|
||||
BaseType bf2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bf1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (bf1 is Float && bf2 is Float)
|
||||
{
|
||||
Float nflt = new Float();
|
||||
nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(nflt);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 102:
|
||||
BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (bsf1 is Float && bsf2 is Float)
|
||||
{
|
||||
Float resf = new Float();
|
||||
resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(resf);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 104: //check the order of the two values off the stack is correct
|
||||
BaseType bs2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bs1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (bs1 is Int && bs2 is Int)
|
||||
{
|
||||
Int nInt = new Int();
|
||||
nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(nInt);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 132:
|
||||
if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null)
|
||||
{
|
||||
if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int)
|
||||
{
|
||||
((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte) GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1];
|
||||
}
|
||||
}
|
||||
this._mThread.PC += 2;
|
||||
result = true;
|
||||
break;
|
||||
case 139:
|
||||
BaseType conv1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (conv1 is Float)
|
||||
{
|
||||
Int newconv = new Int();
|
||||
newconv.mValue = (int)((Float)conv1).mValue;
|
||||
this._mThread.currentFrame.OpStack.Push(newconv);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 149:
|
||||
BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (flcom1 is Float && flcom2 is Float)
|
||||
{
|
||||
Int compres = new Int();
|
||||
if (((Float)flcom1).mValue < ((Float)flcom2).mValue)
|
||||
{
|
||||
compres.mValue = -1;
|
||||
}
|
||||
else if (((Float)flcom1).mValue > ((Float)flcom2).mValue)
|
||||
{
|
||||
compres.mValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
compres.mValue = 0;
|
||||
}
|
||||
this._mThread.currentFrame.OpStack.Push(compres);
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 158:
|
||||
short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
BaseType comp1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
if (comp1 is Int)
|
||||
{
|
||||
if (((Int)comp1).mValue <= 0)
|
||||
{
|
||||
this._mThread.PC += -1 + compareoffset1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 162:
|
||||
short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
BaseType bc2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bc1 = this._mThread.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)
|
||||
{
|
||||
// Console.WriteLine("branch compare true , offset is " +compareoffset);
|
||||
// Console.WriteLine("current PC is " + this._mThread.PC);
|
||||
this._mThread.PC += -1 + compareoffset;
|
||||
//Console.WriteLine("new PC is " + this._mThread.PC);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("branch compare false");
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 164:
|
||||
short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
||||
BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop();
|
||||
BaseType bcl1 = this._mThread.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)
|
||||
{
|
||||
// Console.WriteLine("branch compare true , offset is " + compareloffset);
|
||||
// Console.WriteLine("current PC is " + this._mThread.PC);
|
||||
this._mThread.PC += -1 + compareloffset;
|
||||
// Console.WriteLine("new PC is " + this._mThread.PC);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("branch compare false");
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
case 167:
|
||||
short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
|
||||
this._mThread.PC += -1 + offset;
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Types;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private bool IsMethodOpCode(byte opcode)
|
||||
{
|
||||
bool result = false;
|
||||
switch (opcode)
|
||||
{
|
||||
case 184:
|
||||
short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
|
||||
if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
|
||||
{
|
||||
string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value;
|
||||
string typeparam = "";
|
||||
string typereturn = "";
|
||||
int firstbrak = 0;
|
||||
int secondbrak = 0;
|
||||
firstbrak = typ.LastIndexOf('(');
|
||||
secondbrak = typ.LastIndexOf(')');
|
||||
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
|
||||
typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
|
||||
if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
|
||||
{
|
||||
//calling a method in this class
|
||||
if (typeparam.Length == 0)
|
||||
{
|
||||
this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//calling a method of a different class
|
||||
|
||||
// OpenSimAPI Class
|
||||
if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
|
||||
{
|
||||
this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Types;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private bool IsMethodOpCode(byte opcode)
|
||||
{
|
||||
bool result = false;
|
||||
switch (opcode)
|
||||
{
|
||||
case 184:
|
||||
short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
|
||||
if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
|
||||
{
|
||||
string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value;
|
||||
string typeparam = "";
|
||||
string typereturn = "";
|
||||
int firstbrak = 0;
|
||||
int secondbrak = 0;
|
||||
firstbrak = typ.LastIndexOf('(');
|
||||
secondbrak = typ.LastIndexOf(')');
|
||||
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
|
||||
typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
|
||||
if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
|
||||
{
|
||||
//calling a method in this class
|
||||
if (typeparam.Length == 0)
|
||||
{
|
||||
this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//calling a method of a different class
|
||||
|
||||
// OpenSimAPI Class
|
||||
if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
|
||||
{
|
||||
this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mThread.PC += 2;
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,135 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private Thread _mThread;
|
||||
|
||||
public Interpreter(Thread parentThread)
|
||||
{
|
||||
_mThread = parentThread;
|
||||
}
|
||||
|
||||
public bool Excute()
|
||||
{
|
||||
bool run = true;
|
||||
byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++];
|
||||
// Console.WriteLine("opCode is: " + currentOpCode);
|
||||
bool handled = false;
|
||||
|
||||
handled = this.IsLogicOpCode(currentOpCode);
|
||||
if (!handled)
|
||||
{
|
||||
handled = this.IsMethodOpCode(currentOpCode);
|
||||
}
|
||||
if (!handled)
|
||||
{
|
||||
if (currentOpCode == 172)
|
||||
{
|
||||
if (this._mThread.stack.StackFrames.Count > 1)
|
||||
{
|
||||
Console.WriteLine("returning int from function");
|
||||
int retPC1 = this._mThread.currentFrame.ReturnPC;
|
||||
BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
||||
this._mThread.PC = retPC1;
|
||||
if (bas1 is Int)
|
||||
{
|
||||
this._mThread.currentFrame.OpStack.Push((Int)bas1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Console.WriteLine("No parent function so ending program");
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
run = false;
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
if (currentOpCode == 174)
|
||||
{
|
||||
if (this._mThread.stack.StackFrames.Count > 1)
|
||||
{
|
||||
Console.WriteLine("returning float from function");
|
||||
int retPC1 = this._mThread.currentFrame.ReturnPC;
|
||||
BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
||||
this._mThread.PC = retPC1;
|
||||
if (bas1 is Float)
|
||||
{
|
||||
this._mThread.currentFrame.OpStack.Push((Float)bas1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Console.WriteLine("No parent function so ending program");
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
run = false;
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
if (currentOpCode == 177)
|
||||
{
|
||||
if (this._mThread.stack.StackFrames.Count > 1)
|
||||
{
|
||||
Console.WriteLine("returning from function");
|
||||
int retPC = this._mThread.currentFrame.ReturnPC;
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
||||
this._mThread.PC = retPC;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Console.WriteLine("No parent function so ending program");
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
run = false;
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
if (!handled)
|
||||
{
|
||||
Console.WriteLine("opcode " + currentOpCode + " not been handled ");
|
||||
}
|
||||
return run;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
partial class Thread
|
||||
{
|
||||
private partial class Interpreter
|
||||
{
|
||||
private Thread _mThread;
|
||||
|
||||
public Interpreter(Thread parentThread)
|
||||
{
|
||||
_mThread = parentThread;
|
||||
}
|
||||
|
||||
public bool Excute()
|
||||
{
|
||||
bool run = true;
|
||||
byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++];
|
||||
// Console.WriteLine("opCode is: " + currentOpCode);
|
||||
bool handled = false;
|
||||
|
||||
handled = this.IsLogicOpCode(currentOpCode);
|
||||
if (!handled)
|
||||
{
|
||||
handled = this.IsMethodOpCode(currentOpCode);
|
||||
}
|
||||
if (!handled)
|
||||
{
|
||||
if (currentOpCode == 172)
|
||||
{
|
||||
if (this._mThread.stack.StackFrames.Count > 1)
|
||||
{
|
||||
Console.WriteLine("returning int from function");
|
||||
int retPC1 = this._mThread.currentFrame.ReturnPC;
|
||||
BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
||||
this._mThread.PC = retPC1;
|
||||
if (bas1 is Int)
|
||||
{
|
||||
this._mThread.currentFrame.OpStack.Push((Int)bas1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Console.WriteLine("No parent function so ending program");
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
run = false;
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
if (currentOpCode == 174)
|
||||
{
|
||||
if (this._mThread.stack.StackFrames.Count > 1)
|
||||
{
|
||||
Console.WriteLine("returning float from function");
|
||||
int retPC1 = this._mThread.currentFrame.ReturnPC;
|
||||
BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
||||
this._mThread.PC = retPC1;
|
||||
if (bas1 is Float)
|
||||
{
|
||||
this._mThread.currentFrame.OpStack.Push((Float)bas1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Console.WriteLine("No parent function so ending program");
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
run = false;
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
if (currentOpCode == 177)
|
||||
{
|
||||
if (this._mThread.stack.StackFrames.Count > 1)
|
||||
{
|
||||
Console.WriteLine("returning from function");
|
||||
int retPC = this._mThread.currentFrame.ReturnPC;
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
||||
this._mThread.PC = retPC;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Console.WriteLine("No parent function so ending program");
|
||||
this._mThread.stack.StackFrames.Pop();
|
||||
run = false;
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
if (!handled)
|
||||
{
|
||||
Console.WriteLine("opcode " + currentOpCode + " not been handled ");
|
||||
}
|
||||
return run;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class MainMemory
|
||||
{
|
||||
public Heap HeapArea;
|
||||
public MethodMemory MethodArea;
|
||||
|
||||
public MainMemory()
|
||||
{
|
||||
MethodArea = new MethodMemory();
|
||||
HeapArea = new Heap();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class MainMemory
|
||||
{
|
||||
public Heap HeapArea;
|
||||
public MethodMemory MethodArea;
|
||||
|
||||
public MainMemory()
|
||||
{
|
||||
MethodArea = new MethodMemory();
|
||||
HeapArea = new Heap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class MethodMemory
|
||||
{
|
||||
public byte[] MethodBuffer;
|
||||
public List<ClassRecord> Classes = new List<ClassRecord>();
|
||||
public int NextMethodPC = 0;
|
||||
public int Methodcount = 0;
|
||||
|
||||
public MethodMemory()
|
||||
{
|
||||
MethodBuffer = new byte[20000];
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class MethodMemory
|
||||
{
|
||||
public byte[] MethodBuffer;
|
||||
public List<ClassRecord> Classes = new List<ClassRecord>();
|
||||
public int NextMethodPC = 0;
|
||||
public int Methodcount = 0;
|
||||
|
||||
public MethodMemory()
|
||||
{
|
||||
MethodBuffer = new byte[20000];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class Object
|
||||
{
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class Object
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class Stack
|
||||
{
|
||||
public Stack<StackFrame> StackFrames = new Stack<StackFrame>();
|
||||
|
||||
public Stack()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class Stack
|
||||
{
|
||||
public Stack<StackFrame> StackFrames = new Stack<StackFrame>();
|
||||
|
||||
public Stack()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class StackFrame
|
||||
{
|
||||
public BaseType[] LocalVariables;
|
||||
public Stack<BaseType> OpStack = new Stack<BaseType>();
|
||||
|
||||
public int ReturnPC = 0;
|
||||
public ClassRecord CallingClass = null;
|
||||
|
||||
public StackFrame()
|
||||
{
|
||||
LocalVariables = new BaseType[20];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class StackFrame
|
||||
{
|
||||
public BaseType[] LocalVariables;
|
||||
public Stack<BaseType> OpStack = new Stack<BaseType>();
|
||||
|
||||
public int ReturnPC = 0;
|
||||
public ClassRecord CallingClass = null;
|
||||
|
||||
public StackFrame()
|
||||
{
|
||||
LocalVariables = new BaseType[20];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,119 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Scripting;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public partial class Thread
|
||||
{
|
||||
// Is this smart?
|
||||
public static MainMemory GlobalMemory;
|
||||
public static Scene World;
|
||||
private int PC = 0;
|
||||
private Stack stack;
|
||||
private Interpreter mInterpreter;
|
||||
public ClassRecord currentClass;
|
||||
public ClassInstance currentInstance;
|
||||
private StackFrame currentFrame;
|
||||
public int excutionCounter = 0;
|
||||
public bool running = false;
|
||||
|
||||
public ScriptInfo scriptInfo;
|
||||
|
||||
public Thread()
|
||||
{
|
||||
this.mInterpreter = new Interpreter(this);
|
||||
this.stack = new Stack();
|
||||
}
|
||||
|
||||
public void SetPC(int methodpointer)
|
||||
{
|
||||
//Console.WriteLine("Thread PC has been set to " + methodpointer);
|
||||
PC = methodpointer;
|
||||
}
|
||||
|
||||
public void StartMethod(ClassRecord rec, string methName)
|
||||
{
|
||||
currentFrame = new StackFrame();
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
this.currentClass = rec;
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
|
||||
public void StartMethod( string methName)
|
||||
{
|
||||
currentFrame = new StackFrame();
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
|
||||
public void JumpToStaticVoidMethod(string methName, int returnPC)
|
||||
{
|
||||
currentFrame = new StackFrame();
|
||||
currentFrame.ReturnPC = returnPC;
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
|
||||
public void JumpToStaticParamMethod(string methName, string param, int returnPC)
|
||||
{
|
||||
if (param == "I")
|
||||
{
|
||||
BaseType bs1 = currentFrame.OpStack.Pop();
|
||||
currentFrame = new StackFrame();
|
||||
currentFrame.ReturnPC = returnPC;
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
currentFrame.LocalVariables[0] = ((Int)bs1);
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
if (param == "F")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool Excute()
|
||||
{
|
||||
excutionCounter++;
|
||||
return this.mInterpreter.Excute();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Scripting;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public partial class Thread
|
||||
{
|
||||
// Is this smart?
|
||||
public static MainMemory GlobalMemory;
|
||||
public static Scene World;
|
||||
private int PC = 0;
|
||||
private Stack stack;
|
||||
private Interpreter mInterpreter;
|
||||
public ClassRecord currentClass;
|
||||
public ClassInstance currentInstance;
|
||||
private StackFrame currentFrame;
|
||||
public int excutionCounter = 0;
|
||||
public bool running = false;
|
||||
|
||||
public ScriptInfo scriptInfo;
|
||||
|
||||
public Thread()
|
||||
{
|
||||
this.mInterpreter = new Interpreter(this);
|
||||
this.stack = new Stack();
|
||||
}
|
||||
|
||||
public void SetPC(int methodpointer)
|
||||
{
|
||||
//Console.WriteLine("Thread PC has been set to " + methodpointer);
|
||||
PC = methodpointer;
|
||||
}
|
||||
|
||||
public void StartMethod(ClassRecord rec, string methName)
|
||||
{
|
||||
currentFrame = new StackFrame();
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
this.currentClass = rec;
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
|
||||
public void StartMethod( string methName)
|
||||
{
|
||||
currentFrame = new StackFrame();
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
|
||||
public void JumpToStaticVoidMethod(string methName, int returnPC)
|
||||
{
|
||||
currentFrame = new StackFrame();
|
||||
currentFrame.ReturnPC = returnPC;
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
|
||||
public void JumpToStaticParamMethod(string methName, string param, int returnPC)
|
||||
{
|
||||
if (param == "I")
|
||||
{
|
||||
BaseType bs1 = currentFrame.OpStack.Pop();
|
||||
currentFrame = new StackFrame();
|
||||
currentFrame.ReturnPC = returnPC;
|
||||
this.stack.StackFrames.Push(currentFrame);
|
||||
currentFrame.LocalVariables[0] = ((Int)bs1);
|
||||
currentClass.StartMethod(this, methName);
|
||||
}
|
||||
if (param == "F")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool Excute()
|
||||
{
|
||||
excutionCounter++;
|
||||
return this.mInterpreter.Excute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using OpenSim.Region.Scripting;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM;
|
||||
|
||||
namespace OpenSim.Region.Scripting
|
||||
{
|
||||
public class JavaEngine : IScriptCompiler
|
||||
{
|
||||
public string FileExt()
|
||||
{
|
||||
return ".java";
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
JVMScript script = new JVMScript();
|
||||
Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
|
||||
|
||||
script.LoadScript(filename);
|
||||
|
||||
returns.Add(filename, script);
|
||||
|
||||
return returns;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using OpenSim.Region.Scripting;
|
||||
using OpenSim.Region.Scripting.EmbeddedJVM;
|
||||
|
||||
namespace OpenSim.Region.Scripting
|
||||
{
|
||||
public class JavaEngine : IScriptCompiler
|
||||
{
|
||||
public string FileExt()
|
||||
{
|
||||
return ".java";
|
||||
}
|
||||
|
||||
public Dictionary<string, IScript> compile(string filename)
|
||||
{
|
||||
JVMScript script = new JVMScript();
|
||||
Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
|
||||
|
||||
script.LoadScript(filename);
|
||||
|
||||
returns.Add(filename, script);
|
||||
|
||||
return returns;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,170 +1,170 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Region.Scripting;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class JVMScript : IScript
|
||||
{
|
||||
private List<Thread> _threads = new List<Thread>();
|
||||
private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
|
||||
private MainMemory _mainMemory;
|
||||
|
||||
ScriptInfo scriptInfo;
|
||||
|
||||
public void Initialise(ScriptInfo info)
|
||||
{
|
||||
scriptInfo = info;
|
||||
|
||||
_mainMemory = new MainMemory();
|
||||
Thread.GlobalMemory = this._mainMemory;
|
||||
Thread.World = info.world;
|
||||
CompileScript();
|
||||
|
||||
scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
|
||||
scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
|
||||
}
|
||||
|
||||
void events_OnNewPresence(ScenePresence presence)
|
||||
{
|
||||
for (int i = 0; i < this._threads.Count; i++)
|
||||
{
|
||||
if (!this._threads[i].running)
|
||||
{
|
||||
this._threads[i].StartMethod("OnNewPresence");
|
||||
bool run = true;
|
||||
while (run)
|
||||
{
|
||||
run = this._threads[i].Excute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void events_OnFrame()
|
||||
{
|
||||
for (int i = 0; i < this._threads.Count; i++)
|
||||
{
|
||||
if (!this._threads[i].running)
|
||||
{
|
||||
this._threads[i].StartMethod("OnFrame");
|
||||
bool run = true;
|
||||
while (run)
|
||||
{
|
||||
run = this._threads[i].Excute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string getName()
|
||||
{
|
||||
return "JVM Scripting Engine";
|
||||
}
|
||||
|
||||
public void LoadScript(string script)
|
||||
{
|
||||
Console.WriteLine("OpenSimJVM - loading new script: " + script);
|
||||
CompileInfo comp = new CompileInfo();
|
||||
comp.script = script;
|
||||
comp.scriptName = script;
|
||||
this.CompileScripts.Enqueue(comp);
|
||||
}
|
||||
|
||||
public void CompileScript()
|
||||
{
|
||||
CompileInfo comp = this.CompileScripts.Dequeue();
|
||||
string script = comp.script;
|
||||
string scriptName = comp.scriptName;
|
||||
try
|
||||
{
|
||||
//need to compile the script into a java class file
|
||||
|
||||
//first save it to a java source file
|
||||
TextWriter tw = new StreamWriter(scriptName + ".java");
|
||||
tw.WriteLine(script);
|
||||
tw.Close();
|
||||
|
||||
//now compile
|
||||
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java");
|
||||
// psi.RedirectStandardOutput = true;
|
||||
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||
psi.UseShellExecute = false;
|
||||
|
||||
System.Diagnostics.Process javacomp;
|
||||
javacomp = System.Diagnostics.Process.Start(psi);
|
||||
javacomp.WaitForExit();
|
||||
|
||||
|
||||
//now load in class file
|
||||
ClassRecord class1 = new ClassRecord();
|
||||
class1.LoadClassFromFile(scriptName + ".class");
|
||||
class1.PrintToConsole();
|
||||
//Console.WriteLine();
|
||||
this._mainMemory.MethodArea.Classes.Add(class1);
|
||||
class1.AddMethodsToMemory(this._mainMemory.MethodArea);
|
||||
|
||||
Thread newThread = new Thread();
|
||||
this._threads.Add(newThread);
|
||||
newThread.currentClass = class1;
|
||||
newThread.scriptInfo = scriptInfo;
|
||||
|
||||
//now delete the created files
|
||||
System.IO.File.Delete(scriptName + ".java");
|
||||
System.IO.File.Delete(scriptName + ".class");
|
||||
//this.OnFrame();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("exception");
|
||||
Console.WriteLine(e.StackTrace);
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private class CompileInfo
|
||||
{
|
||||
public string script;
|
||||
public string scriptName;
|
||||
|
||||
public CompileInfo()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Region.Scripting;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||
{
|
||||
public class JVMScript : IScript
|
||||
{
|
||||
private List<Thread> _threads = new List<Thread>();
|
||||
private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
|
||||
private MainMemory _mainMemory;
|
||||
|
||||
ScriptInfo scriptInfo;
|
||||
|
||||
public void Initialise(ScriptInfo info)
|
||||
{
|
||||
scriptInfo = info;
|
||||
|
||||
_mainMemory = new MainMemory();
|
||||
Thread.GlobalMemory = this._mainMemory;
|
||||
Thread.World = info.world;
|
||||
CompileScript();
|
||||
|
||||
scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
|
||||
scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
|
||||
}
|
||||
|
||||
void events_OnNewPresence(ScenePresence presence)
|
||||
{
|
||||
for (int i = 0; i < this._threads.Count; i++)
|
||||
{
|
||||
if (!this._threads[i].running)
|
||||
{
|
||||
this._threads[i].StartMethod("OnNewPresence");
|
||||
bool run = true;
|
||||
while (run)
|
||||
{
|
||||
run = this._threads[i].Excute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void events_OnFrame()
|
||||
{
|
||||
for (int i = 0; i < this._threads.Count; i++)
|
||||
{
|
||||
if (!this._threads[i].running)
|
||||
{
|
||||
this._threads[i].StartMethod("OnFrame");
|
||||
bool run = true;
|
||||
while (run)
|
||||
{
|
||||
run = this._threads[i].Excute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string getName()
|
||||
{
|
||||
return "JVM Scripting Engine";
|
||||
}
|
||||
|
||||
public void LoadScript(string script)
|
||||
{
|
||||
Console.WriteLine("OpenSimJVM - loading new script: " + script);
|
||||
CompileInfo comp = new CompileInfo();
|
||||
comp.script = script;
|
||||
comp.scriptName = script;
|
||||
this.CompileScripts.Enqueue(comp);
|
||||
}
|
||||
|
||||
public void CompileScript()
|
||||
{
|
||||
CompileInfo comp = this.CompileScripts.Dequeue();
|
||||
string script = comp.script;
|
||||
string scriptName = comp.scriptName;
|
||||
try
|
||||
{
|
||||
//need to compile the script into a java class file
|
||||
|
||||
//first save it to a java source file
|
||||
TextWriter tw = new StreamWriter(scriptName + ".java");
|
||||
tw.WriteLine(script);
|
||||
tw.Close();
|
||||
|
||||
//now compile
|
||||
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java");
|
||||
// psi.RedirectStandardOutput = true;
|
||||
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
|
||||
psi.UseShellExecute = false;
|
||||
|
||||
System.Diagnostics.Process javacomp;
|
||||
javacomp = System.Diagnostics.Process.Start(psi);
|
||||
javacomp.WaitForExit();
|
||||
|
||||
|
||||
//now load in class file
|
||||
ClassRecord class1 = new ClassRecord();
|
||||
class1.LoadClassFromFile(scriptName + ".class");
|
||||
class1.PrintToConsole();
|
||||
//Console.WriteLine();
|
||||
this._mainMemory.MethodArea.Classes.Add(class1);
|
||||
class1.AddMethodsToMemory(this._mainMemory.MethodArea);
|
||||
|
||||
Thread newThread = new Thread();
|
||||
this._threads.Add(newThread);
|
||||
newThread.currentClass = class1;
|
||||
newThread.scriptInfo = scriptInfo;
|
||||
|
||||
//now delete the created files
|
||||
System.IO.File.Delete(scriptName + ".java");
|
||||
System.IO.File.Delete(scriptName + ".class");
|
||||
//this.OnFrame();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("exception");
|
||||
Console.WriteLine(e.StackTrace);
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private class CompileInfo
|
||||
{
|
||||
public string script;
|
||||
public string scriptName;
|
||||
|
||||
public CompileInfo()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
|
||||
{
|
||||
public class ArrayReference :BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
|
||||
{
|
||||
public class ArrayReference :BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
|
||||
{
|
||||
public class BaseType : Object
|
||||
{
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
|
||||
{
|
||||
public class BaseType : Object
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
|
||||
{
|
||||
public class ObjectReference : BaseType
|
||||
{
|
||||
public ushort Reference;
|
||||
|
||||
public ObjectReference()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types
|
||||
{
|
||||
public class ObjectReference : BaseType
|
||||
{
|
||||
public ushort Reference;
|
||||
|
||||
public ObjectReference()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Byte : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Byte : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Char : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Char : BaseType
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Float : BaseType
|
||||
{
|
||||
public float mValue = 0;
|
||||
|
||||
public Float()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Float : BaseType
|
||||
{
|
||||
public float mValue = 0;
|
||||
|
||||
public Float()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Int : BaseType
|
||||
{
|
||||
public int mValue = 0;
|
||||
|
||||
public Int()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Region.Scripting.EmbeddedJVM.Types.PrimitiveTypes
|
||||
{
|
||||
public class Int : BaseType
|
||||
{
|
||||
public int mValue = 0;
|
||||
|
||||
public Int()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user