From 16b6bbd253c18d056dd4ec586dd6b28904401924 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 9 Feb 2023 12:11:18 +0000 Subject: [PATCH] a few changes fo yengine exec time check points on function calls --- .../Shared/Api/Implementation/LSL_Api.cs | 4 +- .../Shared/Api/Runtime/LSL_Constants.cs | 2 +- .../ScriptEngine/YEngine/MMRScriptInlines.cs | 95 ++++++++----------- 3 files changed, 42 insertions(+), 59 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index be30eaf65e..46c2d5eee9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -16801,13 +16801,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSetSoundQueueing(int queue) { - if (m_SoundModule != null) + if (m_SoundModule is not null) m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value); } public void llLinkSetSoundQueueing(int linknumber, int queue) { - if (m_SoundModule != null) + if (m_SoundModule is not null) { foreach (SceneObjectPart sop in GetLinkParts(linknumber)) m_SoundModule.SetSoundQueueing(sop.UUID, queue == ScriptBaseClass.TRUE.value); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index cbf1212558..d44c58126a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public partial class ScriptBaseClass { // SCRIPTS CONSTANTS - public static readonly LSLInteger OS_APIVERSION = 21; + public static readonly LSLInteger OS_APIVERSION = 22; public static readonly LSLInteger TRUE = 1; public static readonly LSLInteger FALSE = 0; diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs index 51fab38d6d..26bc9a53e2 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs @@ -65,42 +65,49 @@ namespace OpenSim.Region.ScriptEngine.Yengine * For all others, we generate the call then a call to CheckRun(). */ noCheckRuns = new HashSet() { - "llBase64ToString", - "llCSV2List", - "llDeleteSubList", - "llDeleteSubString", - "llDumpList2String", - "llEscapeURL", - "llEuler2Rot", + "llAcos", + "llAsin", + "llAtan2", + "llCeil", + "llChar", + "llCos", + "llDetectedGrab", + "llDetectedGroup", + "llDetectedKey", + "llDetectedLinkNumber", + "llDetectedName", + "llDetectedOwner", + "llDetectedPos", + "llDetectedRot", + "llDetectedTouchBinormal", + "llDetectedTouchFace", + "llDetectedTouchNormal", + "llDetectedTouchPos", + "llDetectedTouchST", + "llDetectedTouchUV", + "llDetectedType", + "llDetectedVel", + "llFabs", + "llFloor", + "llFrand", + "llLog", + "llLog10", + "llPow", + "llSin", + "llSqrt", + "llTan", + "llGetAccel", + "llGetGMTClock", + "llGetKey", "llGetListEntryType", - "llGetListLength", - "llGetSubString", + "llGetOwner", "llGetUnixTime", - "llInsertString", - "llList2CSV", "llList2Float", "llList2Integer", "llList2Key", - "llList2List", - "llList2ListStrided", "llList2Rot", - "llList2String", "llList2Vector", - "llListFindList", - "llListInsertList", - "llListRandomize", - "llListReplaceList", - "llListSort", - "llListStatistics", - "llMD5String", - "llParseString2List", - "llParseStringKeepNulls", - "llRot2Euler", "llStringLength", - "llStringToBase64", - "llStringTrim", - "llSubStringIndex", - "llUnescapeURL", "osGetSitActiveRange", "osIsNotValidNumber", "osSlerp", @@ -151,25 +158,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine VarDict ifd = new VarDict(false); Type[] oneDoub = new Type[] { typeof(double) }; Type[] twoDoubs = new Type[] { typeof(double), typeof(double) }; - - /* - * Mono generates an FPU instruction for many math calls. - */ - /* just use lsl api alos this have cast issues - new TokenDeclInline_LLAbs(ifd); - new TokenDeclInline_Math(ifd, "llAcos(float)", "Acos", oneDoub); - new TokenDeclInline_Math(ifd, "llAsin(float)", "Asin", oneDoub); - new TokenDeclInline_Math(ifd, "llAtan2(float,float)", "Atan2", twoDoubs); - new TokenDeclInline_Math(ifd, "llCos(float)", "Cos", oneDoub); - new TokenDeclInline_Math(ifd, "llFabs(float)", "Abs", oneDoub); - new TokenDeclInline_Math(ifd, "llLog(float)", "Log", oneDoub); - new TokenDeclInline_Math(ifd, "llLog10(float)", "Log10", oneDoub); - new TokenDeclInline_Math(ifd, "llPow(float,float)", "Pow", twoDoubs); - new TokenDeclInline_LLRound(ifd); - new TokenDeclInline_Math(ifd, "llSin(float)", "Sin", oneDoub); - new TokenDeclInline_Math(ifd, "llSqrt(float)", "Sqrt", oneDoub); - new TokenDeclInline_Math(ifd, "llTan(float)", "Tan", oneDoub); - */ + /* * Something weird about the code generation for these calls, so they all have their own handwritten code generators. */ @@ -212,14 +201,11 @@ namespace OpenSim.Region.ScriptEngine.Yengine // this one accepts all methods given to it public static void AddInterfaceMethods(VarDict ifd, IEnumerator ifaceMethods, FieldInfo acf) { - if(ifd == null) - ifd = inlineFunctions; + ifd ??= inlineFunctions; for(ifaceMethods.Reset(); ifaceMethods.MoveNext();) { MethodInfo ifaceMethod = ifaceMethods.Current; - string key = ifaceMethod.Name; - try { /* @@ -228,9 +214,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine * If function begins with xmr, assume we will not call CheckRun() * Otherwise, assume we will call CheckRun() */ - bool dcr = !key.StartsWith("xmr"); - if(dcr && noCheckRuns.Contains(key)) - dcr = false; + bool dcr = !(ifaceMethod.Name.StartsWith("xmr") || noCheckRuns.Contains(ifaceMethod.Name)); /* * Add function to dictionary. @@ -305,8 +289,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine triviality = (doCheckRun || isTaggedCallsCheckRun) ? Triviality.complex : Triviality.trivial; location = new CompValuInline(this); - if(ifd == null) - ifd = inlineFunctions; + ifd ??= inlineFunctions; ifd.AddEntry(this); }