aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
diff options
context:
space:
mode:
authorUbitUmarov2019-04-16 17:28:09 +0100
committerUbitUmarov2019-04-16 17:28:09 +0100
commit37fb937e0d3b6a7e19c46c2fb6e06894c6bf7918 (patch)
tree1a521d5819005c28c4a53f9ab0e86d1e12137657 /OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
parenttypo on a debug message format (diff)
downloadopensim-SC-37fb937e0d3b6a7e19c46c2fb6e06894c6bf7918.zip
opensim-SC-37fb937e0d3b6a7e19c46c2fb6e06894c6bf7918.tar.gz
opensim-SC-37fb937e0d3b6a7e19c46c2fb6e06894c6bf7918.tar.bz2
opensim-SC-37fb937e0d3b6a7e19c46c2fb6e06894c6bf7918.tar.xz
Yengine: rename a field, do some updates using interlocked
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs36
1 files changed, 18 insertions, 18 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
index 65bdf51..dec775f 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
60 public Delegate[][] iarSDTIntfObjs; 60 public Delegate[][] iarSDTIntfObjs;
61 61
62 private XMRInstAbstract instance; 62 private XMRInstAbstract instance;
63 private int heapUse; 63 private int arraysHeapUse;
64 64
65 private static readonly XMR_Array[] noArrays = new XMR_Array[0]; 65 private static readonly XMR_Array[] noArrays = new XMR_Array[0];
66 private static readonly char[] noChars = new char[0]; 66 private static readonly char[] noChars = new char[0];
@@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
81 81
82 ~XMRInstArrays() 82 ~XMRInstArrays()
83 { 83 {
84 heapUse = instance.UpdateHeapUse(heapUse, 0); 84 arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, 0);
85 } 85 }
86 86
87 public void Clear() 87 public void Clear()
@@ -109,13 +109,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine
109 if (iarVectors != null) 109 if (iarVectors != null)
110 newheapUse += iarVectors.Length * HeapTrackerObject.HT_VEC; 110 newheapUse += iarVectors.Length * HeapTrackerObject.HT_VEC;
111 111
112 heapUse = instance.UpdateHeapUse(0, newheapUse); 112 arraysHeapUse = instance.UpdateHeapUse(0, newheapUse);
113 } 113 }
114 114
115 public void AllocVarArrays(XMRInstArSizes ars) 115 public void AllocVarArrays(XMRInstArSizes ars)
116 { 116 {
117 ClearOldArrays(); 117 ClearOldArrays();
118 int newuse = heapUse + 118 int newuse = arraysHeapUse +
119 ars.iasChars* HeapTrackerObject.HT_CHAR + 119 ars.iasChars* HeapTrackerObject.HT_CHAR +
120 ars.iasFloats * HeapTrackerObject.HT_SFLT + 120 ars.iasFloats * HeapTrackerObject.HT_SFLT +
121 ars.iasIntegers * HeapTrackerObject.HT_INT + 121 ars.iasIntegers * HeapTrackerObject.HT_INT +
@@ -123,7 +123,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
123 ars.iasVectors * HeapTrackerObject.HT_VEC + 123 ars.iasVectors * HeapTrackerObject.HT_VEC +
124 ars.iasSDTIntfObjs * HeapTrackerObject.HT_DELE; 124 ars.iasSDTIntfObjs * HeapTrackerObject.HT_DELE;
125 125
126 heapUse = instance.UpdateHeapUse(heapUse, newuse); 126 arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, newuse);
127 127
128 iarArrays = (ars.iasArrays > 0) ? new XMR_Array[ars.iasArrays] : noArrays; 128 iarArrays = (ars.iasArrays > 0) ? new XMR_Array[ars.iasArrays] : noArrays;
129 iarChars = (ars.iasChars > 0) ? new char[ars.iasChars] : noChars; 129 iarChars = (ars.iasChars > 0) ? new char[ars.iasChars] : noChars;
@@ -143,9 +143,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
143 */ 143 */
144 public void PopList(int index, LSL_List lis) 144 public void PopList(int index, LSL_List lis)
145 { 145 {
146 LSL_List old = iarLists[index]; 146 int delta = HeapTrackerObject.Size(lis) - HeapTrackerObject.Size(iarLists[index]);
147 int newheapuse = heapUse + HeapTrackerList.Size(lis) - HeapTrackerList.Size(old); 147 instance.UpdateHeapUse(0, delta);
148 heapUse = instance.UpdateHeapUse(heapUse, newheapuse); 148 Interlocked.Add(ref arraysHeapUse, delta);
149 iarLists[index] = lis; 149 iarLists[index] = lis;
150 } 150 }
151 151
@@ -154,9 +154,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
154 */ 154 */
155 public void PopObject(int index, object obj) 155 public void PopObject(int index, object obj)
156 { 156 {
157 object old = iarObjects[index]; 157 int delta = HeapTrackerObject.Size(obj) - HeapTrackerObject.Size(iarObjects[index]);
158 int newheapuse = heapUse + HeapTrackerObject.Size(obj) - HeapTrackerObject.Size(old); 158 instance.UpdateHeapUse(0, delta);
159 heapUse = instance.UpdateHeapUse(heapUse, newheapuse); 159 Interlocked.Add(ref arraysHeapUse, delta);
160 iarObjects[index] = obj; 160 iarObjects[index] = obj;
161 } 161 }
162 162
@@ -165,9 +165,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
165 */ 165 */
166 public void PopString(int index, string str) 166 public void PopString(int index, string str)
167 { 167 {
168 string old = iarStrings[index]; 168 int delta = HeapTrackerString.Size(str) - HeapTrackerString.Size(iarStrings[index]);
169 int newheapuse = heapUse + HeapTrackerString.Size(str) - HeapTrackerString.Size(old); 169 instance.UpdateHeapUse(0, delta);
170 heapUse = instance.UpdateHeapUse(heapUse, newheapuse); 170 Interlocked.Add(ref arraysHeapUse, delta);
171 iarStrings[index] = str; 171 iarStrings[index] = str;
172 } 172 }
173 173
@@ -210,7 +210,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
210 iarSDTClObjs = (XMRSDTypeClObj[])recver(); 210 iarSDTClObjs = (XMRSDTypeClObj[])recver();
211 Delegate[][] dels = (Delegate[][])recver(); 211 Delegate[][] dels = (Delegate[][])recver();
212 212
213 int newheapuse = heapUse; 213 int newheapuse = arraysHeapUse;
214 214
215 // value types simply are the size of the value * number of values 215 // value types simply are the size of the value * number of values
216 newheapuse += chrs.Length * HeapTrackerObject.HT_CHAR; 216 newheapuse += chrs.Length * HeapTrackerObject.HT_CHAR;
@@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
233 // others (XMR_Array, XMRSDTypeClObj) keep track of their own heap usage 233 // others (XMR_Array, XMRSDTypeClObj) keep track of their own heap usage
234 234
235 // update script heap usage, throwing an exception before finalizing changes 235 // update script heap usage, throwing an exception before finalizing changes
236 heapUse = instance.UpdateHeapUse(heapUse, newheapuse); 236 arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, newheapuse);
237 237
238 iarChars = chrs; 238 iarChars = chrs;
239 iarFloats = flts; 239 iarFloats = flts;
@@ -248,7 +248,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
248 248
249 private void ClearOldArrays() 249 private void ClearOldArrays()
250 { 250 {
251 int newheapuse = heapUse; 251 int newheapuse = arraysHeapUse;
252 252
253 iarArrays = null; 253 iarArrays = null;
254 if(iarChars != null) 254 if(iarChars != null)
@@ -301,7 +301,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
301 iarSDTIntfObjs = null; 301 iarSDTIntfObjs = null;
302 } 302 }
303 303
304 heapUse = instance.UpdateHeapUse(heapUse, newheapuse); 304 arraysHeapUse = instance.UpdateHeapUse(arraysHeapUse, newheapuse);
305 } 305 }
306 } 306 }
307 307