YEngine: reduce calls to CheckRunLockInvariants

This commit is contained in:
UbitUmarov
2023-08-22 18:37:17 +01:00
parent 28ffa3e2c0
commit 29b8191225
4 changed files with 9 additions and 23 deletions

View File

@@ -85,7 +85,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
lock(m_RunLock)
{
//m_RunOnePhase = "GetExecutionState enter";
CheckRunLockInvariants(true);
//CheckRunLockInvariants(true);
// Get copy of script globals and stack in relocateable form.
Byte[] snapshotBytes;
@@ -100,21 +100,18 @@ namespace OpenSim.Region.ScriptEngine.Yengine
snapshotN.AppendChild(doc.CreateTextNode(snapshotString));
scriptStateN.AppendChild(snapshotN);
//m_RunOnePhase = "GetExecutionState B";
CheckRunLockInvariants(true);
// "Running" says whether or not we are accepting new events.
XmlElement runningN = doc.CreateElement("", "Running", "");
runningN.AppendChild(doc.CreateTextNode(m_Running.ToString()));
scriptStateN.AppendChild(runningN);
//m_RunOnePhase = "GetExecutionState C";
CheckRunLockInvariants(true);
// "DoGblInit" says whether or not default:state_entry() will init global vars.
XmlElement doGblInitN = doc.CreateElement("", "DoGblInit", "");
doGblInitN.AppendChild(doc.CreateTextNode(doGblInit.ToString()));
scriptStateN.AppendChild(doGblInitN);
//m_RunOnePhase = "GetExecutionState D";
CheckRunLockInvariants(true);
if(m_XMRLSLApi is not null)
{
@@ -130,7 +127,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
minEventDelayN.AppendChild(doc.CreateTextNode(m_minEventDelay.ToString()));
scriptStateN.AppendChild(minEventDelayN);
//m_RunOnePhase = "GetExecutionState D";
CheckRunLockInvariants(true);
}
// More misc data.
@@ -145,7 +141,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
maskA.Value = m_Item.PermsMask.ToString();
permissionsN.Attributes.Append(maskA);
//m_RunOnePhase = "GetExecutionState E";
CheckRunLockInvariants(true);
// "DetectParams" are returned by llDetected...() script functions
// for the currently active event, if any.
@@ -157,7 +152,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
scriptStateN.AppendChild(detParArrayN);
}
//m_RunOnePhase = "GetExecutionState F";
CheckRunLockInvariants(true);
// Save any events we have in the queue.
// <EventQueue>
@@ -181,7 +175,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
}
scriptStateN.AppendChild(queuedEventsN);
//m_RunOnePhase = "GetExecutionState G";
CheckRunLockInvariants(true);
// "Plugins" indicate enabled timers and listens, etc.
Object[] pluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID);
@@ -190,13 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Yengine
AppendXMLObjectArray(doc, plugins, pluginData, "plugin");
scriptStateN.AppendChild(plugins);
//m_RunOnePhase = "GetExecutionState H";
CheckRunLockInvariants(true);
// Let script run again.
suspendOnCheckRunHold = false;
//m_RunOnePhase = "GetExecutionState leave";
CheckRunLockInvariants(true);
}
// scriptStateN represents the contents of the .state file so

View File

@@ -895,8 +895,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
glblVars.iarObjects = XMRInstArrays.noObjects;
glblVars.iarSDTClObjs = XMRInstArrays.noSDTClObjs;
glblVars.iarSDTIntfObjs = XMRInstArrays.noSDTIntfObjs;
CheckRunLockInvariants(true);
}
lock (m_QueueLock)
@@ -957,9 +955,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
if (itemType == "OpenMetaverse.UUID")
{
UUID val = new UUID();
UUID.TryParse(tag.InnerText, out val);
UUID.TryParse(tag.InnerText, out UUID val);
return val;
}
@@ -1148,7 +1144,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
this.MigrateIn(br);
//m_RunOnePhase = "MigrateInEventHandler finished";
CheckRunLockInvariants(true);
//CheckRunLockInvariants(true);
}
}
}

View File

@@ -314,8 +314,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
}
//m_RunOnePhase = "resume old event handler";
CheckRunLockInvariants(true);
m_LastRanAt = now;
m_InstEHSlice++;
callMode = CallMode_NORMAL;
@@ -391,8 +389,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
// finishes or it calls CheckRun().
//m_RunOnePhase = "start event handler";
CheckRunLockInvariants(true);
m_DetectParams = evt.DetectParams;
m_LastRanAt = now;
m_InstEHEvent++;
@@ -417,7 +413,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
m_DetectParams = null;
//m_RunOnePhase += "; checking exit invariants and unlocking";
CheckRunLockInvariants(false);
Monitor.Exit(m_RunLock);
}
@@ -796,8 +791,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
// This thread transitioned the instance to RESETTING so reset it.
lock(m_RunLock)
{
CheckRunLockInvariants(true);
// No other thread should have transitioned it from RESETTING.
if (m_IState != XMRInstState.SUSPENDED)
{

View File

@@ -72,6 +72,12 @@ namespace OpenSim.Region.ScriptEngine.Yengine
public Exception ResumeEx()
{
// Resume script from captured stack.
if (stackFrames is null)
{
m_log.Error($"ResumeEx: eventcode: None, stackFrame is null");
throw new Exception("ResumeEx: stackFrame is null");
}
callMode = XMRInstance.CallMode_RESTORE;
suspendOnCheckRunTemp = true;
try