Little bit more work on AllNewSceneObjectPart2
parent
2333de33f1
commit
1d5544a23a
|
@ -32,10 +32,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public uint BaseMask = FULL_MASK_PERMISSIONS;
|
public uint BaseMask = FULL_MASK_PERMISSIONS;
|
||||||
|
|
||||||
protected PrimitiveBaseShape m_Shape;
|
protected PrimitiveBaseShape m_Shape;
|
||||||
|
protected byte[] m_particleSystem = new byte[0];
|
||||||
|
|
||||||
protected AllNewSceneObjectGroup2 m_parentGroup;
|
protected AllNewSceneObjectGroup2 m_parentGroup;
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
protected LLUUID m_uuid;
|
protected LLUUID m_uuid;
|
||||||
|
@ -271,6 +271,35 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Inventory
|
||||||
|
public void GetInventory(IClientAPI client, uint localID)
|
||||||
|
{
|
||||||
|
if (localID == this.m_localID)
|
||||||
|
{
|
||||||
|
client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
|
||||||
|
{
|
||||||
|
this.m_Shape.ExtraParams = new byte[data.Length + 7];
|
||||||
|
int i = 0;
|
||||||
|
uint length = (uint)data.Length;
|
||||||
|
this.m_Shape.ExtraParams[i++] = 1;
|
||||||
|
this.m_Shape.ExtraParams[i++] = (byte)(type % 256);
|
||||||
|
this.m_Shape.ExtraParams[i++] = (byte)((type >> 8) % 256);
|
||||||
|
|
||||||
|
this.m_Shape.ExtraParams[i++] = (byte)(length % 256);
|
||||||
|
this.m_Shape.ExtraParams[i++] = (byte)((length >> 8) % 256);
|
||||||
|
this.m_Shape.ExtraParams[i++] = (byte)((length >> 16) % 256);
|
||||||
|
this.m_Shape.ExtraParams[i++] = (byte)((length >> 24) % 256);
|
||||||
|
Array.Copy(data, 0, this.m_Shape.ExtraParams, i, data.Length);
|
||||||
|
|
||||||
|
//this.ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Texture
|
#region Texture
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -282,6 +311,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem)
|
||||||
|
{
|
||||||
|
this.m_particleSystem = pSystem.GetBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Position
|
#region Position
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
public class ClassInstance : Object
|
public class ClassInstance : Object
|
||||||
{
|
{
|
||||||
public int size;
|
public int Size;
|
||||||
public ClassRecord ClassRec;
|
public ClassRecord ClassRec;
|
||||||
public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
|
public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
|
||||||
|
|
||||||
|
|
|
@ -36,23 +36,23 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
public class ClassRecord
|
public class ClassRecord
|
||||||
{
|
{
|
||||||
private ushort _majorVersion;
|
private ushort m_majorVersion;
|
||||||
private ushort _minorVersion;
|
private ushort m_minorVersion;
|
||||||
private ushort _constantPoolCount;
|
private ushort m_constantPoolCount;
|
||||||
private ushort _accessFlags;
|
private ushort m_accessFlags;
|
||||||
private ushort _thisClass;
|
private ushort m_thisClass;
|
||||||
private ushort _supperClass;
|
private ushort m_supperClass;
|
||||||
private ushort _interfaceCount;
|
private ushort m_interfaceCount;
|
||||||
private ushort _fieldCount;
|
private ushort m_fieldCount;
|
||||||
private ushort _methodCount;
|
private ushort m_methodCount;
|
||||||
//private ushort _attributeCount;
|
//private ushort _attributeCount;
|
||||||
//private string _name;
|
//private string _name;
|
||||||
public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>();
|
public Dictionary<string, BaseType> StaticFields = new Dictionary<string, BaseType>();
|
||||||
public PoolClass mClass;
|
public PoolClass MClass;
|
||||||
|
|
||||||
public List<PoolItem> _constantsPool = new List<PoolItem>();
|
public List<PoolItem> m_constantsPool = new List<PoolItem>();
|
||||||
private List<MethodInfo> _methodsList = new List<MethodInfo>();
|
private List<MethodInfo> m_methodsList = new List<MethodInfo>();
|
||||||
private List<FieldInfo> _fieldList = new List<FieldInfo>();
|
private List<FieldInfo> m_fieldList = new List<FieldInfo>();
|
||||||
|
|
||||||
public ClassRecord()
|
public ClassRecord()
|
||||||
{
|
{
|
||||||
|
@ -80,11 +80,11 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
i += 4;
|
i += 4;
|
||||||
_minorVersion = (ushort)((data[i++] << 8) + data[i++]);
|
m_minorVersion = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
_majorVersion = (ushort)((data[i++] << 8) + data[i++]);
|
m_majorVersion = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]);
|
m_constantPoolCount = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
Console.WriteLine("there should be " + _constantPoolCount + " items in the pool");
|
Console.WriteLine("there should be " + m_constantPoolCount + " items in the pool");
|
||||||
for (int count = 0; count < (_constantPoolCount - 1); count++)
|
for (int count = 0; count < (m_constantPoolCount - 1); count++)
|
||||||
{
|
{
|
||||||
//read in the constant pool
|
//read in the constant pool
|
||||||
byte pooltype = data[i++];
|
byte pooltype = data[i++];
|
||||||
|
@ -98,7 +98,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
// Console.WriteLine("new utf8 type, length is " + uLength);
|
// Console.WriteLine("new utf8 type, length is " + uLength);
|
||||||
PoolUtf8 utf8 = new PoolUtf8();
|
PoolUtf8 utf8 = new PoolUtf8();
|
||||||
utf8.readValue(data, ref i, uLength);
|
utf8.readValue(data, ref i, uLength);
|
||||||
this._constantsPool.Add(utf8);
|
this.m_constantsPool.Add(utf8);
|
||||||
break;
|
break;
|
||||||
case 3: //Int
|
case 3: //Int
|
||||||
break;
|
break;
|
||||||
|
@ -107,74 +107,74 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
case 7: //Class
|
case 7: //Class
|
||||||
PoolClass pClass = new PoolClass(this);
|
PoolClass pClass = new PoolClass(this);
|
||||||
pClass.readValue(data, ref i);
|
pClass.readValue(data, ref i);
|
||||||
this._constantsPool.Add(pClass);
|
this.m_constantsPool.Add(pClass);
|
||||||
break;
|
break;
|
||||||
case 9: //FieldRef
|
case 9: //FieldRef
|
||||||
PoolFieldRef pField = new PoolFieldRef(this);
|
PoolFieldRef pField = new PoolFieldRef(this);
|
||||||
pField.readValue(data, ref i);
|
pField.readValue(data, ref i);
|
||||||
this._constantsPool.Add(pField);
|
this.m_constantsPool.Add(pField);
|
||||||
break;
|
break;
|
||||||
case 10: //Method
|
case 10: //Method
|
||||||
PoolMethodRef pMeth = new PoolMethodRef(this);
|
PoolMethodRef pMeth = new PoolMethodRef(this);
|
||||||
pMeth.readValue(data, ref i);
|
pMeth.readValue(data, ref i);
|
||||||
this._constantsPool.Add(pMeth);
|
this.m_constantsPool.Add(pMeth);
|
||||||
break;
|
break;
|
||||||
case 12: //NamedType
|
case 12: //NamedType
|
||||||
PoolNamedType pNamed = new PoolNamedType(this);
|
PoolNamedType pNamed = new PoolNamedType(this);
|
||||||
pNamed.readValue(data, ref i);
|
pNamed.readValue(data, ref i);
|
||||||
this._constantsPool.Add(pNamed);
|
this.m_constantsPool.Add(pNamed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_accessFlags = (ushort)((data[i++] << 8) + data[i++]);
|
m_accessFlags = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
_thisClass = (ushort)((data[i++] << 8) + data[i++]);
|
m_thisClass = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
_supperClass = (ushort)((data[i++] << 8) + data[i++]);
|
m_supperClass = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
|
|
||||||
if (this._constantsPool[this._thisClass - 1] is PoolClass)
|
if (this.m_constantsPool[this.m_thisClass - 1] is PoolClass)
|
||||||
{
|
{
|
||||||
this.mClass = ((PoolClass)this._constantsPool[this._thisClass - 1]);
|
this.MClass = ((PoolClass)this.m_constantsPool[this.m_thisClass - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_interfaceCount = (ushort)((data[i++] << 8) + data[i++]);
|
m_interfaceCount = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
//should now read in the info for each interface
|
//should now read in the info for each interface
|
||||||
|
|
||||||
_fieldCount = (ushort)((data[i++] << 8) + data[i++]);
|
m_fieldCount = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
//should now read in the info for each field
|
//should now read in the info for each field
|
||||||
for (int count = 0; count < _fieldCount; count++)
|
for (int count = 0; count < m_fieldCount; count++)
|
||||||
{
|
{
|
||||||
FieldInfo fieldInf = new FieldInfo(this);
|
FieldInfo fieldInf = new FieldInfo(this);
|
||||||
fieldInf.ReadData(data, ref i);
|
fieldInf.ReadData(data, ref i);
|
||||||
this._fieldList.Add(fieldInf);
|
this.m_fieldList.Add(fieldInf);
|
||||||
}
|
}
|
||||||
|
|
||||||
_methodCount = (ushort)((data[i++] << 8) + data[i++]);
|
m_methodCount = (ushort)((data[i++] << 8) + data[i++]);
|
||||||
for (int count = 0; count < _methodCount; count++)
|
for (int count = 0; count < m_methodCount; count++)
|
||||||
{
|
{
|
||||||
MethodInfo methInf = new MethodInfo(this);
|
MethodInfo methInf = new MethodInfo(this);
|
||||||
methInf.ReadData(data, ref i);
|
methInf.ReadData(data, ref i);
|
||||||
this._methodsList.Add(methInf);
|
this.m_methodsList.Add(methInf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddMethodsToMemory(MethodMemory memory)
|
public void AddMethodsToMemory(MethodMemory memory)
|
||||||
{
|
{
|
||||||
for (int count = 0; count < _methodCount; count++)
|
for (int count = 0; count < m_methodCount; count++)
|
||||||
{
|
{
|
||||||
this._methodsList[count].AddMethodCode(memory);
|
this.m_methodsList[count].AddMethodCode(memory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool StartMethod(Thread thread, string methodName)
|
public bool StartMethod(Thread thread, string methodName)
|
||||||
{
|
{
|
||||||
for (int count = 0; count < _methodCount; count++)
|
for (int count = 0; count < m_methodCount; count++)
|
||||||
{
|
{
|
||||||
if (this._constantsPool[this._methodsList[count].NameIndex - 1] is PoolUtf8)
|
if (this.m_constantsPool[this.m_methodsList[count].NameIndex - 1] is PoolUtf8)
|
||||||
{
|
{
|
||||||
if (((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value == methodName)
|
if (((PoolUtf8)this.m_constantsPool[this.m_methodsList[count].NameIndex - 1]).Value == methodName)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value);
|
//Console.WriteLine("found method: " + ((PoolUtf8)this._constantsPool[this._methodsList[count].NameIndex - 1]).Value);
|
||||||
thread.SetPC(this._methodsList[count].CodePointer);
|
thread.SetPC(this.m_methodsList[count].CodePointer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,32 +185,32 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
public void PrintToConsole()
|
public void PrintToConsole()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Class File:");
|
Console.WriteLine("Class File:");
|
||||||
Console.WriteLine("Major version: " + _majorVersion);
|
Console.WriteLine("Major version: " + m_majorVersion);
|
||||||
Console.WriteLine("Minor version: " + _minorVersion);
|
Console.WriteLine("Minor version: " + m_minorVersion);
|
||||||
Console.WriteLine("Pool size: " + _constantPoolCount);
|
Console.WriteLine("Pool size: " + m_constantPoolCount);
|
||||||
|
|
||||||
for (int i = 0; i < _constantsPool.Count; i++)
|
for (int i = 0; i < m_constantsPool.Count; i++)
|
||||||
{
|
{
|
||||||
this._constantsPool[i].Print();
|
this.m_constantsPool[i].Print();
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Access flags: " + _accessFlags);
|
Console.WriteLine("Access flags: " + m_accessFlags);
|
||||||
Console.WriteLine("This class: " + _thisClass);
|
Console.WriteLine("This class: " + m_thisClass);
|
||||||
Console.WriteLine("Super class: " + _supperClass);
|
Console.WriteLine("Super class: " + m_supperClass);
|
||||||
|
|
||||||
for (int count = 0; count < _fieldCount; count++)
|
for (int count = 0; count < m_fieldCount; count++)
|
||||||
{
|
{
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
this._fieldList[count].Print();
|
this.m_fieldList[count].Print();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int count = 0; count < _methodCount; count++)
|
for (int count = 0; count < m_methodCount; count++)
|
||||||
{
|
{
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
this._methodsList[count].Print();
|
this.m_methodsList[count].Print();
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("class name is " + this.mClass.Name.Value);
|
Console.WriteLine("class name is " + this.MClass.Name.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] ReadFully(Stream stream)
|
public static byte[] ReadFully(Stream stream)
|
||||||
|
@ -294,9 +294,9 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public override void Print()
|
public override void Print()
|
||||||
{
|
{
|
||||||
this.Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]);
|
this.Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]);
|
||||||
Console.Write("Class type: " + namePointer);
|
Console.Write("Class type: " + namePointer);
|
||||||
Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value);
|
Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,8 +322,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public override void Print()
|
public override void Print()
|
||||||
{
|
{
|
||||||
this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]);
|
this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]);
|
||||||
this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]);
|
this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]);
|
||||||
Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer);
|
Console.WriteLine("FieldRef type: " + classPointer + " , " + nameTypePointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,8 +349,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public override void Print()
|
public override void Print()
|
||||||
{
|
{
|
||||||
this.mNameType = ((PoolNamedType)this.parent._constantsPool[nameTypePointer - 1]);
|
this.mNameType = ((PoolNamedType)this.parent.m_constantsPool[nameTypePointer - 1]);
|
||||||
this.mClass = ((PoolClass)this.parent._constantsPool[classPointer - 1]);
|
this.mClass = ((PoolClass)this.parent.m_constantsPool[classPointer - 1]);
|
||||||
Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer);
|
Console.WriteLine("MethodRef type: " + classPointer + " , " + nameTypePointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,10 +376,10 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public override void Print()
|
public override void Print()
|
||||||
{
|
{
|
||||||
Name = ((PoolUtf8)this.parent._constantsPool[namePointer - 1]);
|
Name = ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]);
|
||||||
Type = ((PoolUtf8)this.parent._constantsPool[typePointer - 1]);
|
Type = ((PoolUtf8)this.parent.m_constantsPool[typePointer - 1]);
|
||||||
Console.Write("Named type: " + namePointer + " , " + typePointer);
|
Console.Write("Named type: " + namePointer + " , " + typePointer);
|
||||||
Console.WriteLine(" // " + ((PoolUtf8)this.parent._constantsPool[namePointer - 1]).Value);
|
Console.WriteLine(" // " + ((PoolUtf8)this.parent.m_constantsPool[namePointer - 1]).Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,8 +426,8 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
Console.WriteLine("Method Info Struct: ");
|
Console.WriteLine("Method Info Struct: ");
|
||||||
Console.WriteLine("AccessFlags: " + AccessFlags);
|
Console.WriteLine("AccessFlags: " + AccessFlags);
|
||||||
Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
|
Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
|
||||||
Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value);
|
Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value);
|
||||||
Console.WriteLine("Attribute Count:" + AttributeCount);
|
Console.WriteLine("Attribute Count:" + AttributeCount);
|
||||||
for (int i = 0; i < AttributeCount; i++)
|
for (int i = 0; i < AttributeCount; i++)
|
||||||
{
|
{
|
||||||
|
@ -480,7 +480,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
public void Print()
|
public void Print()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Method Attribute: ");
|
Console.WriteLine("Method Attribute: ");
|
||||||
Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
|
Console.WriteLine("Name Index: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
|
||||||
Console.WriteLine("Length: " + Length);
|
Console.WriteLine("Length: " + Length);
|
||||||
Console.WriteLine("MaxStack: " + MaxStack);
|
Console.WriteLine("MaxStack: " + MaxStack);
|
||||||
Console.WriteLine("MaxLocals: " + MaxLocals);
|
Console.WriteLine("MaxLocals: " + MaxLocals);
|
||||||
|
@ -522,7 +522,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public void Print()
|
public void Print()
|
||||||
{
|
{
|
||||||
Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
|
Console.WriteLine("SubAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -570,22 +570,22 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
Console.WriteLine("Field Info Struct: ");
|
Console.WriteLine("Field Info Struct: ");
|
||||||
Console.WriteLine("AccessFlags: " + AccessFlags);
|
Console.WriteLine("AccessFlags: " + AccessFlags);
|
||||||
Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
|
Console.WriteLine("NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
|
||||||
Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value);
|
Console.WriteLine("DescriptorIndex: " + DescriptorIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value);
|
||||||
Console.WriteLine("Attribute Count:" + AttributeCount);
|
Console.WriteLine("Attribute Count:" + AttributeCount);
|
||||||
//if static, add to static field list
|
//if static, add to static field list
|
||||||
// if (this.AccessFlags == 9) //public and static
|
// if (this.AccessFlags == 9) //public and static
|
||||||
if ((this.AccessFlags & 0x08) != 0)
|
if ((this.AccessFlags & 0x08) != 0)
|
||||||
{
|
{
|
||||||
switch (((PoolUtf8)this.parent._constantsPool[DescriptorIndex - 1]).Value)
|
switch (((PoolUtf8)this.parent.m_constantsPool[DescriptorIndex - 1]).Value)
|
||||||
{
|
{
|
||||||
case "I":
|
case "I":
|
||||||
Int newin = new Int();
|
Int newin = new Int();
|
||||||
this.parent.StaticFields.Add(((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value, newin);
|
this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newin);
|
||||||
break;
|
break;
|
||||||
case "F":
|
case "F":
|
||||||
Float newfl = new Float();
|
Float newfl = new Float();
|
||||||
this.parent.StaticFields.Add(((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value, newfl);
|
this.parent.StaticFields.Add(((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value, newfl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public void Print()
|
public void Print()
|
||||||
{
|
{
|
||||||
Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent._constantsPool[NameIndex - 1]).Value);
|
Console.WriteLine("FieldAttribute: NameIndex: " + NameIndex + " // " + ((PoolUtf8)this.parent.m_constantsPool[NameIndex - 1]).Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,293 +45,293 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
case (byte)(byte)OpCode.iconst_m1:
|
case (byte)(byte)OpCode.iconst_m1:
|
||||||
Int m_int = new Int();
|
Int m_int = new Int();
|
||||||
m_int.mValue = -1;
|
m_int.mValue = -1;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
this.m_thread.m_currentFrame.OpStack.Push(m_int);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)(byte)OpCode.iconst_0:
|
case (byte)(byte)OpCode.iconst_0:
|
||||||
m_int = new Int();
|
m_int = new Int();
|
||||||
m_int.mValue = 0;
|
m_int.mValue = 0;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
this.m_thread.m_currentFrame.OpStack.Push(m_int);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)(byte)OpCode.iconst_1:
|
case (byte)(byte)OpCode.iconst_1:
|
||||||
m_int = new Int();
|
m_int = new Int();
|
||||||
m_int.mValue = 1;
|
m_int.mValue = 1;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
this.m_thread.m_currentFrame.OpStack.Push(m_int);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)(byte)OpCode.iconst_2:
|
case (byte)(byte)OpCode.iconst_2:
|
||||||
m_int = new Int();
|
m_int = new Int();
|
||||||
m_int.mValue = 2;
|
m_int.mValue = 2;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
this.m_thread.m_currentFrame.OpStack.Push(m_int);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)(byte)OpCode.iconst_3:
|
case (byte)(byte)OpCode.iconst_3:
|
||||||
m_int = new Int();
|
m_int = new Int();
|
||||||
m_int.mValue = 3;
|
m_int.mValue = 3;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
this.m_thread.m_currentFrame.OpStack.Push(m_int);
|
||||||
break;
|
break;
|
||||||
case (byte)(byte)OpCode.iconst_4:
|
case (byte)(byte)OpCode.iconst_4:
|
||||||
m_int = new Int();
|
m_int = new Int();
|
||||||
m_int.mValue = 4;
|
m_int.mValue = 4;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
this.m_thread.m_currentFrame.OpStack.Push(m_int);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.iconst_5:
|
case (byte)OpCode.iconst_5:
|
||||||
m_int = new Int();
|
m_int = new Int();
|
||||||
m_int.mValue = 5;
|
m_int.mValue = 5;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_int);
|
this.m_thread.m_currentFrame.OpStack.Push(m_int);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fconst_0:
|
case (byte)OpCode.fconst_0:
|
||||||
Float m_float = new Float();
|
Float m_float = new Float();
|
||||||
m_float.mValue = 0.0f;
|
m_float.mValue = 0.0f;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
this.m_thread.m_currentFrame.OpStack.Push(m_float);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fconst_1:
|
case (byte)OpCode.fconst_1:
|
||||||
m_float = new Float();
|
m_float = new Float();
|
||||||
m_float.mValue = 1.0f;
|
m_float.mValue = 1.0f;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
this.m_thread.m_currentFrame.OpStack.Push(m_float);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fconst_2:
|
case (byte)OpCode.fconst_2:
|
||||||
m_float = new Float();
|
m_float = new Float();
|
||||||
m_float.mValue = 2.0f;
|
m_float.mValue = 2.0f;
|
||||||
this._mThread.currentFrame.OpStack.Push(m_float);
|
this.m_thread.m_currentFrame.OpStack.Push(m_float);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int?
|
case (byte)OpCode.bipush: //is this right? this should be pushing a byte onto stack not int?
|
||||||
int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC];
|
int pushvalue = (int)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC];
|
||||||
Int pushInt = new Int();
|
Int pushInt = new Int();
|
||||||
pushInt.mValue = pushvalue;
|
pushInt.mValue = pushvalue;
|
||||||
this._mThread.currentFrame.OpStack.Push(pushInt);
|
this.m_thread.m_currentFrame.OpStack.Push(pushInt);
|
||||||
this._mThread.PC++;
|
this.m_thread.PC++;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.sipush:
|
case (byte)OpCode.sipush:
|
||||||
short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
short pushvalue2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
Int pushInt2 = new Int();
|
Int pushInt2 = new Int();
|
||||||
pushInt2.mValue = pushvalue2;
|
pushInt2.mValue = pushvalue2;
|
||||||
this._mThread.currentFrame.OpStack.Push(pushInt2);
|
this.m_thread.m_currentFrame.OpStack.Push(pushInt2);
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fload:
|
case (byte)OpCode.fload:
|
||||||
short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
|
short findex1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]));
|
||||||
Float fload = new Float();
|
Float fload = new Float();
|
||||||
if (this._mThread.currentFrame.LocalVariables[findex1] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[findex1] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[findex1] is Float)
|
if (this.m_thread.m_currentFrame.LocalVariables[findex1] is Float)
|
||||||
{
|
{
|
||||||
fload.mValue = ((Float)this._mThread.currentFrame.LocalVariables[findex1]).mValue;
|
fload.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[findex1]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(fload);
|
this.m_thread.m_currentFrame.OpStack.Push(fload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._mThread.PC++;
|
this.m_thread.PC++;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.iload_0:
|
case (byte)OpCode.iload_0:
|
||||||
if (this._mThread.currentFrame.LocalVariables[0] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[0] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[0] is Int)
|
if (this.m_thread.m_currentFrame.LocalVariables[0] is Int)
|
||||||
{
|
{
|
||||||
Int newInt = new Int();
|
Int newInt = new Int();
|
||||||
newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[0]).mValue;
|
newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[0]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(newInt);
|
this.m_thread.m_currentFrame.OpStack.Push(newInt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.iload_1:
|
case (byte)OpCode.iload_1:
|
||||||
if (this._mThread.currentFrame.LocalVariables[1] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[1] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[1] is Int)
|
if (this.m_thread.m_currentFrame.LocalVariables[1] is Int)
|
||||||
{
|
{
|
||||||
Int newInt = new Int();
|
Int newInt = new Int();
|
||||||
newInt.mValue = ((Int)this._mThread.currentFrame.LocalVariables[1]).mValue;
|
newInt.mValue = ((Int)this.m_thread.m_currentFrame.LocalVariables[1]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(newInt);
|
this.m_thread.m_currentFrame.OpStack.Push(newInt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fload_0:
|
case (byte)OpCode.fload_0:
|
||||||
if (this._mThread.currentFrame.LocalVariables[0] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[0] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[0] is Float)
|
if (this.m_thread.m_currentFrame.LocalVariables[0] is Float)
|
||||||
{
|
{
|
||||||
Float newfloat = new Float();
|
Float newfloat = new Float();
|
||||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[0]).mValue;
|
newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[0]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
this.m_thread.m_currentFrame.OpStack.Push(newfloat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fload_1:
|
case (byte)OpCode.fload_1:
|
||||||
if (this._mThread.currentFrame.LocalVariables[1] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[1] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[1] is Float)
|
if (this.m_thread.m_currentFrame.LocalVariables[1] is Float)
|
||||||
{
|
{
|
||||||
Float newfloat = new Float();
|
Float newfloat = new Float();
|
||||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[1]).mValue;
|
newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[1]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
this.m_thread.m_currentFrame.OpStack.Push(newfloat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fload_2:
|
case (byte)OpCode.fload_2:
|
||||||
if (this._mThread.currentFrame.LocalVariables[2] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[2] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[2] is Float)
|
if (this.m_thread.m_currentFrame.LocalVariables[2] is Float)
|
||||||
{
|
{
|
||||||
Float newfloat = new Float();
|
Float newfloat = new Float();
|
||||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[2]).mValue;
|
newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[2]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
this.m_thread.m_currentFrame.OpStack.Push(newfloat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fload_3:
|
case (byte)OpCode.fload_3:
|
||||||
if (this._mThread.currentFrame.LocalVariables[3] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[3] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[3] is Float)
|
if (this.m_thread.m_currentFrame.LocalVariables[3] is Float)
|
||||||
{
|
{
|
||||||
Float newfloat = new Float();
|
Float newfloat = new Float();
|
||||||
newfloat.mValue = ((Float)this._mThread.currentFrame.LocalVariables[3]).mValue;
|
newfloat.mValue = ((Float)this.m_thread.m_currentFrame.LocalVariables[3]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(newfloat);
|
this.m_thread.m_currentFrame.OpStack.Push(newfloat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.istore:
|
case (byte)OpCode.istore:
|
||||||
short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
|
short findex3 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]));
|
||||||
BaseType istor = this._mThread.currentFrame.OpStack.Pop();
|
BaseType istor = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (istor is Int)
|
if (istor is Int)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[findex3] = (Int)istor;
|
this.m_thread.m_currentFrame.LocalVariables[findex3] = (Int)istor;
|
||||||
}
|
}
|
||||||
this._mThread.PC++;
|
this.m_thread.PC++;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fstore:
|
case (byte)OpCode.fstore:
|
||||||
short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]));
|
short findex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]));
|
||||||
BaseType fstor = this._mThread.currentFrame.OpStack.Pop();
|
BaseType fstor = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (fstor is Float)
|
if (fstor is Float)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[findex] = (Float)fstor;
|
this.m_thread.m_currentFrame.LocalVariables[findex] = (Float)fstor;
|
||||||
}
|
}
|
||||||
this._mThread.PC++;
|
this.m_thread.PC++;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.istore_0:
|
case (byte)OpCode.istore_0:
|
||||||
BaseType baset = this._mThread.currentFrame.OpStack.Pop();
|
BaseType baset = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (baset is Int)
|
if (baset is Int)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[0] = (Int)baset;
|
this.m_thread.m_currentFrame.LocalVariables[0] = (Int)baset;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.istore_1:
|
case (byte)OpCode.istore_1:
|
||||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
baset = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (baset is Int)
|
if (baset is Int)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[1] = (Int)baset;
|
this.m_thread.m_currentFrame.LocalVariables[1] = (Int)baset;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fstore_0:
|
case (byte)OpCode.fstore_0:
|
||||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
baset = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (baset is Float)
|
if (baset is Float)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[0] = (Float)baset;
|
this.m_thread.m_currentFrame.LocalVariables[0] = (Float)baset;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fstore_1:
|
case (byte)OpCode.fstore_1:
|
||||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
baset = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (baset is Float)
|
if (baset is Float)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[1] = (Float)baset;
|
this.m_thread.m_currentFrame.LocalVariables[1] = (Float)baset;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fstore_2:
|
case (byte)OpCode.fstore_2:
|
||||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
baset = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (baset is Float)
|
if (baset is Float)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[2] = (Float)baset;
|
this.m_thread.m_currentFrame.LocalVariables[2] = (Float)baset;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fstore_3:
|
case (byte)OpCode.fstore_3:
|
||||||
baset = this._mThread.currentFrame.OpStack.Pop();
|
baset = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (baset is Float)
|
if (baset is Float)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.LocalVariables[3] = (Float)baset;
|
this.m_thread.m_currentFrame.LocalVariables[3] = (Float)baset;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.pop:
|
case (byte)OpCode.pop:
|
||||||
this._mThread.currentFrame.OpStack.Pop();
|
this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fadd:
|
case (byte)OpCode.fadd:
|
||||||
BaseType bf2 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bf2 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
BaseType bf1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bf1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (bf1 is Float && bf2 is Float)
|
if (bf1 is Float && bf2 is Float)
|
||||||
{
|
{
|
||||||
Float nflt = new Float();
|
Float nflt = new Float();
|
||||||
nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue;
|
nflt.mValue = ((Float)bf1).mValue + ((Float)bf2).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(nflt);
|
this.m_thread.m_currentFrame.OpStack.Push(nflt);
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fsub:
|
case (byte)OpCode.fsub:
|
||||||
BaseType bsf2 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bsf2 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
BaseType bsf1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bsf1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (bsf1 is Float && bsf2 is Float)
|
if (bsf1 is Float && bsf2 is Float)
|
||||||
{
|
{
|
||||||
Float resf = new Float();
|
Float resf = new Float();
|
||||||
resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue;
|
resf.mValue = ((Float)bsf1).mValue - ((Float)bsf2).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(resf);
|
this.m_thread.m_currentFrame.OpStack.Push(resf);
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.imul: //check the order of the two values off the stack is correct
|
case (byte)OpCode.imul: //check the order of the two values off the stack is correct
|
||||||
BaseType bs2 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bs2 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
BaseType bs1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bs1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (bs1 is Int && bs2 is Int)
|
if (bs1 is Int && bs2 is Int)
|
||||||
{
|
{
|
||||||
Int nInt = new Int();
|
Int nInt = new Int();
|
||||||
nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue;
|
nInt.mValue = ((Int)bs1).mValue * ((Int)bs2).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(nInt);
|
this.m_thread.m_currentFrame.OpStack.Push(nInt);
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.iinc:
|
case (byte)OpCode.iinc:
|
||||||
if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] != null)
|
if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] != null)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]] is Int)
|
if (this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]] is Int)
|
||||||
{
|
{
|
||||||
((Int)this._mThread.currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1];
|
((Int)this.m_thread.m_currentFrame.LocalVariables[GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC]]).mValue += (sbyte)GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.f2i:
|
case (byte)OpCode.f2i:
|
||||||
BaseType conv1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType conv1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (conv1 is Float)
|
if (conv1 is Float)
|
||||||
{
|
{
|
||||||
Int newconv = new Int();
|
Int newconv = new Int();
|
||||||
newconv.mValue = (int)((Float)conv1).mValue;
|
newconv.mValue = (int)((Float)conv1).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(newconv);
|
this.m_thread.m_currentFrame.OpStack.Push(newconv);
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fcmpl:
|
case (byte)OpCode.fcmpl:
|
||||||
BaseType flcom2 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType flcom2 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
BaseType flcom1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType flcom1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (flcom1 is Float && flcom2 is Float)
|
if (flcom1 is Float && flcom2 is Float)
|
||||||
{
|
{
|
||||||
Int compres = new Int();
|
Int compres = new Int();
|
||||||
|
@ -347,13 +347,13 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
compres.mValue = 0;
|
compres.mValue = 0;
|
||||||
}
|
}
|
||||||
this._mThread.currentFrame.OpStack.Push(compres);
|
this.m_thread.m_currentFrame.OpStack.Push(compres);
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.fcmpg:
|
case (byte)OpCode.fcmpg:
|
||||||
flcom2 = this._mThread.currentFrame.OpStack.Pop();
|
flcom2 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
flcom1 = this._mThread.currentFrame.OpStack.Pop();
|
flcom1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (flcom1 is Float && flcom2 is Float)
|
if (flcom1 is Float && flcom2 is Float)
|
||||||
{
|
{
|
||||||
Int compres = new Int();
|
Int compres = new Int();
|
||||||
|
@ -369,54 +369,54 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
compres.mValue = 0;
|
compres.mValue = 0;
|
||||||
}
|
}
|
||||||
this._mThread.currentFrame.OpStack.Push(compres);
|
this.m_thread.m_currentFrame.OpStack.Push(compres);
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.ifge:
|
case (byte)OpCode.ifge:
|
||||||
short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
short compareoffset2 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
BaseType compe1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType compe1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (compe1 is Int)
|
if (compe1 is Int)
|
||||||
{
|
{
|
||||||
if (((Int)compe1).mValue >= 0)
|
if (((Int)compe1).mValue >= 0)
|
||||||
{
|
{
|
||||||
this._mThread.PC += -1 + compareoffset2;
|
this.m_thread.PC += -1 + compareoffset2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.ifle:
|
case (byte)OpCode.ifle:
|
||||||
short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
short compareoffset1 = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
BaseType comp1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType comp1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (comp1 is Int)
|
if (comp1 is Int)
|
||||||
{
|
{
|
||||||
if (((Int)comp1).mValue <= 0)
|
if (((Int)comp1).mValue <= 0)
|
||||||
{
|
{
|
||||||
this._mThread.PC += -1 + compareoffset1;
|
this.m_thread.PC += -1 + compareoffset1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.if_icmpge:
|
case (byte)OpCode.if_icmpge:
|
||||||
short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
short compareoffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
BaseType bc2 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bc2 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
BaseType bc1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bc1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (bc1 is Int && bc2 is Int)
|
if (bc1 is Int && bc2 is Int)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
|
//Console.WriteLine("comparing " + ((Int)bc1).mValue + " and " + ((Int)bc2).mValue);
|
||||||
|
@ -424,25 +424,25 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
// Console.WriteLine("branch compare true , offset is " +compareoffset);
|
// Console.WriteLine("branch compare true , offset is " +compareoffset);
|
||||||
// Console.WriteLine("current PC is " + this._mThread.PC);
|
// Console.WriteLine("current PC is " + this._mThread.PC);
|
||||||
this._mThread.PC += -1 + compareoffset;
|
this.m_thread.PC += -1 + compareoffset;
|
||||||
//Console.WriteLine("new PC is " + this._mThread.PC);
|
//Console.WriteLine("new PC is " + this._mThread.PC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Console.WriteLine("branch compare false");
|
//Console.WriteLine("branch compare false");
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.if_icmple:
|
case (byte)OpCode.if_icmple:
|
||||||
short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
short compareloffset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
BaseType bcl2 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bcl2 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
BaseType bcl1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bcl1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (bcl1 is Int && bcl2 is Int)
|
if (bcl1 is Int && bcl2 is Int)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
|
//Console.WriteLine("comparing " + ((Int)bcl1).mValue + " and " + ((Int)bcl2).mValue);
|
||||||
|
@ -450,47 +450,47 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
// Console.WriteLine("branch compare true , offset is " + compareloffset);
|
// Console.WriteLine("branch compare true , offset is " + compareloffset);
|
||||||
// Console.WriteLine("current PC is " + this._mThread.PC);
|
// Console.WriteLine("current PC is " + this._mThread.PC);
|
||||||
this._mThread.PC += -1 + compareloffset;
|
this.m_thread.PC += -1 + compareloffset;
|
||||||
// Console.WriteLine("new PC is " + this._mThread.PC);
|
// Console.WriteLine("new PC is " + this._mThread.PC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Console.WriteLine("branch compare false");
|
//Console.WriteLine("branch compare false");
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode._goto:
|
case (byte)OpCode._goto:
|
||||||
short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
short offset = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
this._mThread.PC += -1 + offset;
|
this.m_thread.PC += -1 + offset;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.getstatic:
|
case (byte)OpCode.getstatic:
|
||||||
short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
short fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
if (this._mThread.currentClass._constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
|
if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
|
||||||
{
|
{
|
||||||
if (((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
|
if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value)
|
||||||
{
|
{
|
||||||
//from this class
|
//from this class
|
||||||
if (this._mThread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
|
if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
|
||||||
{
|
{
|
||||||
if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
|
if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
|
||||||
{
|
{
|
||||||
Float retFloat = new Float();
|
Float retFloat = new Float();
|
||||||
retFloat.mValue = ((Float)this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
|
retFloat.mValue = ((Float)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
|
||||||
this._mThread.currentFrame.OpStack.Push(retFloat);
|
this.m_thread.m_currentFrame.OpStack.Push(retFloat);
|
||||||
}
|
}
|
||||||
else if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
|
else if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
|
||||||
{
|
{
|
||||||
Int retInt = new Int();
|
Int retInt = new Int();
|
||||||
retInt.mValue = ((Int)this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
|
retInt.mValue = ((Int)this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value]).mValue;
|
||||||
// Console.WriteLine("getting static field, " + retInt.mValue);
|
// Console.WriteLine("getting static field, " + retInt.mValue);
|
||||||
this._mThread.currentFrame.OpStack.Push(retInt);
|
this.m_thread.m_currentFrame.OpStack.Push(retInt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,36 +499,36 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
//get from a different class
|
//get from a different class
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case (byte)OpCode.putstatic:
|
case (byte)OpCode.putstatic:
|
||||||
fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC + 1]);
|
fieldrefIndex = (short)((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC + 1]);
|
||||||
BaseType addstatic = this._mThread.currentFrame.OpStack.Pop();
|
BaseType addstatic = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
if (this._mThread.currentClass._constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
|
if (this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1] is ClassRecord.PoolFieldRef)
|
||||||
{
|
{
|
||||||
if (((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this._mThread.currentClass.mClass.Name.Value)
|
if (((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value)
|
||||||
{
|
{
|
||||||
// this class
|
// this class
|
||||||
if (this._mThread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
|
if (this.m_thread.currentClass.StaticFields.ContainsKey(((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value))
|
||||||
{
|
{
|
||||||
if (addstatic is Float)
|
if (addstatic is Float)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
|
if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Float)
|
||||||
{
|
{
|
||||||
Float newf = new Float();
|
Float newf = new Float();
|
||||||
newf.mValue = ((Float)addstatic).mValue;
|
newf.mValue = ((Float)addstatic).mValue;
|
||||||
this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf;
|
this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (addstatic is Int)
|
else if (addstatic is Int)
|
||||||
{
|
{
|
||||||
if (this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
|
if (this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] is Int)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("setting static field to " + ((Int)addstatic).mValue);
|
//Console.WriteLine("setting static field to " + ((Int)addstatic).mValue);
|
||||||
Int newi = new Int();
|
Int newi = new Int();
|
||||||
newi.mValue = ((Int)addstatic).mValue;
|
newi.mValue = ((Int)addstatic).mValue;
|
||||||
this._mThread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this._mThread.currentClass._constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi;
|
this.m_thread.currentClass.StaticFields[((ClassRecord.PoolFieldRef)this.m_thread.currentClass.m_constantsPool[fieldrefIndex - 1]).mNameType.Name.Value] = newi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
// a different class
|
// a different class
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,10 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
switch (opcode)
|
switch (opcode)
|
||||||
{
|
{
|
||||||
case 184:
|
case 184:
|
||||||
short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC+1]);
|
short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]);
|
||||||
if (this._mThread.currentClass._constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
|
if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
|
||||||
{
|
{
|
||||||
string typ = ((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Type.Value;
|
string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value;
|
||||||
string typeparam = "";
|
string typeparam = "";
|
||||||
string typereturn = "";
|
string typereturn = "";
|
||||||
int firstbrak = 0;
|
int firstbrak = 0;
|
||||||
|
@ -58,16 +58,16 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
secondbrak = typ.LastIndexOf(')');
|
secondbrak = typ.LastIndexOf(')');
|
||||||
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
|
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
|
||||||
typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 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)
|
if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value)
|
||||||
{
|
{
|
||||||
//calling a method in this class
|
//calling a method in this class
|
||||||
if (typeparam.Length == 0)
|
if (typeparam.Length == 0)
|
||||||
{
|
{
|
||||||
this._mThread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, (this._mThread.PC + 2));
|
this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this._mThread.PC + 2));
|
this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -75,15 +75,15 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
//calling a method of a different class
|
//calling a method of a different class
|
||||||
|
|
||||||
// OpenSimAPI Class
|
// OpenSimAPI Class
|
||||||
if (((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
|
if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
|
||||||
{
|
{
|
||||||
this._mThread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this._mThread.currentClass._constantsPool[refIndex - 1]).mNameType.Name.Value, null);
|
this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this._mThread.PC += 2;
|
this.m_thread.PC += 2;
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,17 +37,17 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
private partial class Interpreter
|
private partial class Interpreter
|
||||||
{
|
{
|
||||||
private Thread _mThread;
|
private Thread m_thread;
|
||||||
|
|
||||||
public Interpreter(Thread parentThread)
|
public Interpreter(Thread parentThread)
|
||||||
{
|
{
|
||||||
_mThread = parentThread;
|
m_thread = parentThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Excute()
|
public bool Excute()
|
||||||
{
|
{
|
||||||
bool run = true;
|
bool run = true;
|
||||||
byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++];
|
byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++];
|
||||||
// Console.WriteLine("opCode is: " + currentOpCode);
|
// Console.WriteLine("opCode is: " + currentOpCode);
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
|
@ -60,64 +60,64 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
if (currentOpCode == 172)
|
if (currentOpCode == 172)
|
||||||
{
|
{
|
||||||
if (this._mThread.stack.StackFrames.Count > 1)
|
if (this.m_thread.stack.StackFrames.Count > 1)
|
||||||
{
|
{
|
||||||
Console.WriteLine("returning int from function");
|
Console.WriteLine("returning int from function");
|
||||||
int retPC1 = this._mThread.currentFrame.ReturnPC;
|
int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
|
||||||
BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
this._mThread.stack.StackFrames.Pop();
|
this.m_thread.stack.StackFrames.Pop();
|
||||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
|
||||||
this._mThread.PC = retPC1;
|
this.m_thread.PC = retPC1;
|
||||||
if (bas1 is Int)
|
if (bas1 is Int)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.OpStack.Push((Int)bas1);
|
this.m_thread.m_currentFrame.OpStack.Push((Int)bas1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Console.WriteLine("No parent function so ending program");
|
// Console.WriteLine("No parent function so ending program");
|
||||||
this._mThread.stack.StackFrames.Pop();
|
this.m_thread.stack.StackFrames.Pop();
|
||||||
run = false;
|
run = false;
|
||||||
}
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
if (currentOpCode == 174)
|
if (currentOpCode == 174)
|
||||||
{
|
{
|
||||||
if (this._mThread.stack.StackFrames.Count > 1)
|
if (this.m_thread.stack.StackFrames.Count > 1)
|
||||||
{
|
{
|
||||||
Console.WriteLine("returning float from function");
|
Console.WriteLine("returning float from function");
|
||||||
int retPC1 = this._mThread.currentFrame.ReturnPC;
|
int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
|
||||||
BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
|
BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
|
||||||
this._mThread.stack.StackFrames.Pop();
|
this.m_thread.stack.StackFrames.Pop();
|
||||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
|
||||||
this._mThread.PC = retPC1;
|
this.m_thread.PC = retPC1;
|
||||||
if (bas1 is Float)
|
if (bas1 is Float)
|
||||||
{
|
{
|
||||||
this._mThread.currentFrame.OpStack.Push((Float)bas1);
|
this.m_thread.m_currentFrame.OpStack.Push((Float)bas1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Console.WriteLine("No parent function so ending program");
|
// Console.WriteLine("No parent function so ending program");
|
||||||
this._mThread.stack.StackFrames.Pop();
|
this.m_thread.stack.StackFrames.Pop();
|
||||||
run = false;
|
run = false;
|
||||||
}
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
if (currentOpCode == 177)
|
if (currentOpCode == 177)
|
||||||
{
|
{
|
||||||
if (this._mThread.stack.StackFrames.Count > 1)
|
if (this.m_thread.stack.StackFrames.Count > 1)
|
||||||
{
|
{
|
||||||
Console.WriteLine("returning from function");
|
Console.WriteLine("returning from function");
|
||||||
int retPC = this._mThread.currentFrame.ReturnPC;
|
int retPC = this.m_thread.m_currentFrame.ReturnPC;
|
||||||
this._mThread.stack.StackFrames.Pop();
|
this.m_thread.stack.StackFrames.Pop();
|
||||||
this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
|
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
|
||||||
this._mThread.PC = retPC;
|
this.m_thread.PC = retPC;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Console.WriteLine("No parent function so ending program");
|
// Console.WriteLine("No parent function so ending program");
|
||||||
this._mThread.stack.StackFrames.Pop();
|
this.m_thread.stack.StackFrames.Pop();
|
||||||
run = false;
|
run = false;
|
||||||
}
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
|
|
|
@ -44,10 +44,10 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
public static Scene World;
|
public static Scene World;
|
||||||
private int PC = 0;
|
private int PC = 0;
|
||||||
private Stack stack;
|
private Stack stack;
|
||||||
private Interpreter mInterpreter;
|
private Interpreter m_Interpreter;
|
||||||
public ClassRecord currentClass;
|
public ClassRecord currentClass;
|
||||||
public ClassInstance currentInstance;
|
public ClassInstance currentInstance;
|
||||||
private StackFrame currentFrame;
|
private StackFrame m_currentFrame;
|
||||||
public int excutionCounter = 0;
|
public int excutionCounter = 0;
|
||||||
public bool running = false;
|
public bool running = false;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public Thread()
|
public Thread()
|
||||||
{
|
{
|
||||||
this.mInterpreter = new Interpreter(this);
|
this.m_Interpreter = new Interpreter(this);
|
||||||
this.stack = new Stack();
|
this.stack = new Stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,24 +67,24 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
|
|
||||||
public void StartMethod(ClassRecord rec, string methName)
|
public void StartMethod(ClassRecord rec, string methName)
|
||||||
{
|
{
|
||||||
currentFrame = new StackFrame();
|
m_currentFrame = new StackFrame();
|
||||||
this.stack.StackFrames.Push(currentFrame);
|
this.stack.StackFrames.Push(m_currentFrame);
|
||||||
this.currentClass = rec;
|
this.currentClass = rec;
|
||||||
currentClass.StartMethod(this, methName);
|
currentClass.StartMethod(this, methName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartMethod( string methName)
|
public void StartMethod( string methName)
|
||||||
{
|
{
|
||||||
currentFrame = new StackFrame();
|
m_currentFrame = new StackFrame();
|
||||||
this.stack.StackFrames.Push(currentFrame);
|
this.stack.StackFrames.Push(m_currentFrame);
|
||||||
currentClass.StartMethod(this, methName);
|
currentClass.StartMethod(this, methName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void JumpToStaticVoidMethod(string methName, int returnPC)
|
public void JumpToStaticVoidMethod(string methName, int returnPC)
|
||||||
{
|
{
|
||||||
currentFrame = new StackFrame();
|
m_currentFrame = new StackFrame();
|
||||||
currentFrame.ReturnPC = returnPC;
|
m_currentFrame.ReturnPC = returnPC;
|
||||||
this.stack.StackFrames.Push(currentFrame);
|
this.stack.StackFrames.Push(m_currentFrame);
|
||||||
currentClass.StartMethod(this, methName);
|
currentClass.StartMethod(this, methName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,11 +92,11 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
{
|
{
|
||||||
if (param == "I")
|
if (param == "I")
|
||||||
{
|
{
|
||||||
BaseType bs1 = currentFrame.OpStack.Pop();
|
BaseType bs1 = m_currentFrame.OpStack.Pop();
|
||||||
currentFrame = new StackFrame();
|
m_currentFrame = new StackFrame();
|
||||||
currentFrame.ReturnPC = returnPC;
|
m_currentFrame.ReturnPC = returnPC;
|
||||||
this.stack.StackFrames.Push(currentFrame);
|
this.stack.StackFrames.Push(m_currentFrame);
|
||||||
currentFrame.LocalVariables[0] = ((Int)bs1);
|
m_currentFrame.LocalVariables[0] = ((Int)bs1);
|
||||||
currentClass.StartMethod(this, methName);
|
currentClass.StartMethod(this, methName);
|
||||||
}
|
}
|
||||||
if (param == "F")
|
if (param == "F")
|
||||||
|
@ -113,7 +113,7 @@ namespace OpenSim.Region.Scripting.EmbeddedJVM
|
||||||
public bool Excute()
|
public bool Excute()
|
||||||
{
|
{
|
||||||
excutionCounter++;
|
excutionCounter++;
|
||||||
return this.mInterpreter.Excute();
|
return this.m_Interpreter.Excute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
*/
|
*/
|
||||||
/* Original code: Tedd Hansen */
|
/* Original code: Tedd Hansen */
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
|
||||||
namespace OpenSim.Region.Scripting.LSL
|
namespace OpenSim.Region.Scripting.LSL
|
||||||
{
|
{
|
||||||
partial class LSO_Parser
|
partial class LSO_Parser
|
||||||
{
|
{
|
||||||
//LSO_Enums MyLSO_Enums = new LSO_Enums();
|
//LSO_Enums MyLSO_Enums = new LSO_Enums();
|
||||||
|
@ -348,4 +348,4 @@ using System;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
*/
|
*/
|
||||||
/* Original code: Tedd Hansen */
|
/* Original code: Tedd Hansen */
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
|
||||||
namespace OpenSim.Region.Scripting.LSL
|
namespace OpenSim.Region.Scripting.LSL
|
||||||
{
|
{
|
||||||
partial class LSO_Parser
|
partial class LSO_Parser
|
||||||
{
|
{
|
||||||
private FileStream fs;
|
private FileStream fs;
|
||||||
|
@ -144,7 +144,9 @@ using System;
|
||||||
{
|
{
|
||||||
// If GFR and SR are at same position then there is no fuction block
|
// If GFR and SR are at same position then there is no fuction block
|
||||||
Common.SendToDebug("No FUNCTION BLOCK found");
|
Common.SendToDebug("No FUNCTION BLOCK found");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Common.SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR);
|
Common.SendToDebug("Reading FUNCTION BLOCK at: " + myHeader.GFR);
|
||||||
fs.Seek(myHeader.GFR, SeekOrigin.Begin);
|
fs.Seek(myHeader.GFR, SeekOrigin.Begin);
|
||||||
myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0);
|
myFunctionBlock.FunctionCount = BitConverter.ToUInt32(br_read(4), 0);
|
||||||
|
@ -176,7 +178,7 @@ using System;
|
||||||
myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount];
|
myStateFrameBlock.StatePointer = new LSO_Struct.StatePointerBlock[myStateFrameBlock.StateCount];
|
||||||
for (int i = 0; i < myStateFrameBlock.StateCount; i++)
|
for (int i = 0; i < myStateFrameBlock.StateCount; i++)
|
||||||
{
|
{
|
||||||
Common.SendToDebug("Reading STATE POINTER BLOCK " + (i+1) + " at: " + fs.Position);
|
Common.SendToDebug("Reading STATE POINTER BLOCK " + (i + 1) + " at: " + fs.Position);
|
||||||
// Position is relative to state frame
|
// Position is relative to state frame
|
||||||
myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
|
myStateFrameBlock.StatePointer[i].Location = myHeader.SR + BitConverter.ToUInt32(br_read(4), 0);
|
||||||
myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8));
|
myStateFrameBlock.StatePointer[i].EventMask = new System.Collections.BitArray(br_read(8));
|
||||||
|
@ -232,7 +234,7 @@ using System;
|
||||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0);
|
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer = myStateFrameBlock.StatePointer[i].StateBlock.EndPos + BitConverter.ToUInt32(br_read(4), 0);
|
||||||
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0);
|
myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize = BitConverter.ToUInt32(br_read(4), 0);
|
||||||
Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer);
|
Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Code Chunk Pointer: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CodeChunkPointer);
|
||||||
Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize );
|
Common.SendToDebug("Reading STATE BLOCK " + (i + 1) + " HANDLER EVENT MASK " + ii + " (" + ((LSO_Enums.Event_Mask_Values)ii).ToString() + ") Call Frame Size: " + myStateFrameBlock.StatePointer[i].StateBlock.StateBlockHandlers[ii].CallFrameSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +409,7 @@ using System;
|
||||||
Common.SendToDebug("Reading Function Code Chunk at: " + pos);
|
Common.SendToDebug("Reading Function Code Chunk at: " + pos);
|
||||||
fs.Seek(pos, SeekOrigin.Begin);
|
fs.Seek(pos, SeekOrigin.Begin);
|
||||||
myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0);
|
myCodeChunk.CodeChunkHeaderSize = BitConverter.ToUInt32(br_read(4), 0);
|
||||||
Common.SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize );
|
Common.SendToDebug("CodeChunk Header Size: " + myCodeChunk.CodeChunkHeaderSize);
|
||||||
// Read until null
|
// Read until null
|
||||||
myCodeChunk.Comment = Read_String();
|
myCodeChunk.Comment = Read_String();
|
||||||
Common.SendToDebug("Function comment: " + myCodeChunk.Comment);
|
Common.SendToDebug("Function comment: " + myCodeChunk.Comment);
|
||||||
|
|
Loading…
Reference in New Issue