mantis 8551: Simplify Yengine heap usage control

This commit is contained in:
UbitUmarov
2019-11-18 17:33:02 +00:00
parent 496a2228f5
commit bf0697d5f4
5 changed files with 66 additions and 108 deletions

View File

@@ -70,7 +70,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
private static FieldInfo listValueField = typeof(HeapTrackerList).GetField("value");
private static MethodInfo listSaveMethod = typeof(HeapTrackerList).GetMethod("Save");
private static MethodInfo listRestoreMethod = typeof(HeapTrackerList).GetMethod("Restore");
private static MethodInfo listFreeMethod = typeof(HeapTrackerList).GetMethod("Free");
public LSL_List value;
@@ -91,11 +90,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
ilGen.Emit(errorAt, OpCodes.Call, listRestoreMethod);
}
public static void GenFree(Token errorAt, ScriptMyILGen ilGen)
{
ilGen.Emit(errorAt, OpCodes.Call, listFreeMethod);
}
// generate CIL code to push the value on the CIL stack
// input:
// 'this' pointer already pushed on CIL stack
@@ -127,13 +121,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
usage = 0;
}
public void Free()
{
usage = instance.UpdateHeapUse(usage, 0);
value = null;
instance = null;
}
//private static int counter = 5;
public static int Size(LSL_List lis)
{
@@ -156,7 +143,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
private static FieldInfo objectValueField = typeof(HeapTrackerObject).GetField("value");
private static MethodInfo objectSaveMethod = typeof(HeapTrackerObject).GetMethod("Save");
private static MethodInfo objectRestoreMethod = typeof(HeapTrackerObject).GetMethod("Restore");
private static MethodInfo objectFreeMethod = typeof(HeapTrackerObject).GetMethod("Free");
public const int HT_CHAR = 2;
public const int HT_DELE = 8;
@@ -189,11 +175,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
ilGen.Emit(errorAt, OpCodes.Call, objectRestoreMethod);
}
public static void GenFree(Token errorAt, ScriptMyILGen ilGen)
{
ilGen.Emit(errorAt, OpCodes.Call, objectFreeMethod);
}
// generate CIL code to push the value on the CIL stack
// input:
// 'this' pointer already pushed on CIL stack
@@ -220,13 +201,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
usage = Size(obj);
}
public void Free()
{
usage = instance.UpdateHeapUse(usage, 0);
value = null;
instance = null;
}
// public so it can be used by XMRArray
public static int Size(object obj)
{
@@ -293,7 +267,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
private static FieldInfo stringValueField = typeof(HeapTrackerString).GetField("value");
private static MethodInfo stringRestoreMethod = typeof(HeapTrackerString).GetMethod("Restore");
private static MethodInfo stringSaveMethod = typeof(HeapTrackerString).GetMethod("Save");
private static MethodInfo stringFreeMethod = typeof(HeapTrackerString).GetMethod("Free");
public string value;
@@ -316,11 +289,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
{
ilGen.Emit(errorAt, OpCodes.Call, stringRestoreMethod);
}
public static void GenFree(Token errorAt, ScriptMyILGen ilGen)
{
ilGen.Emit(errorAt, OpCodes.Call, stringFreeMethod);
}
// generate CIL code to push the value on the CIL stack
// input:
@@ -348,13 +316,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
usage = Size(str);
}
public void Free()
{
usage = instance.UpdateHeapUse(usage, 0);
value = null;
instance = null;
}
public static int Size(string str)
{
return (str == null) ? 0 : str.Length * HeapTrackerObject.HT_CHAR;