3 Commitit 2736d36391 ... 4d552360dd

Tekijä SHA1 Viesti Päivämäärä
  UbitUmarov 4d552360dd also incremenet os_apiversion 2 viikkoa sitten
  UbitUmarov c39fa1e776 mantis 9125: change yengine object file version to force recompiles; Wrap calls to some framework methods to reduce exagerated yobj dependencies on local runtime, like the ones reported. 2 viikkoa sitten
  UbitUmarov 7c3e09f7d3 cosmetics 2 viikkoa sitten

+ 0 - 3
OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs

@@ -101,9 +101,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
 
         public virtual void PostInitialise()
         {
-            if (!m_Enabled)
-                return;
-
         }
 
         public virtual void RegionLoaded(Scene scene)

+ 4 - 0
OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs

@@ -555,6 +555,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
                 case 3:
                     Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
                     break;
+                default:
+                    return;
             }
 
             Scene.RegionInfo.RegionSettings.Save();
@@ -582,6 +584,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
                     Scene.RegionInfo.RegionSettings.Elevation1NE = lowValue;
                     Scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
                     break;
+                default:
+                    return;
             }
 
             Scene.RegionInfo.RegionSettings.Save();

+ 1 - 1
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 = 22;
+        public static readonly LSLInteger OS_APIVERSION = 23;
 
         public static readonly LSLInteger TRUE = 1;
         public static readonly LSLInteger FALSE = 0;

+ 107 - 59
OpenSim/Region/ScriptEngine/YEngine/MMRScriptBinOpStr.cs

@@ -25,14 +25,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
-using OpenSim.Region.ScriptEngine.Yengine;
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Reflection;
 using System.Reflection.Emit;
-using System.Text;
+using System.Runtime.CompilerServices;
 using System.Text.RegularExpressions;
 using OpenSim.Region.ScriptEngine.Shared;
 
@@ -83,48 +80,48 @@ namespace OpenSim.Region.ScriptEngine.Yengine
         private static TokenTypeStr tokenTypeStr = new TokenTypeStr(null);
         private static TokenTypeVec tokenTypeVec = new TokenTypeVec(null);
 
-        private static MethodInfo stringAddStringMethInfo = ScriptCodeGen.GetStaticMethod(typeof(string), "Concat", new Type[] { typeof(string), typeof(string) });
-        private static MethodInfo stringCmpStringMethInfo = ScriptCodeGen.GetStaticMethod(typeof(string), "Compare", new Type[] { typeof(string), typeof(string), typeof(StringComparison) });
-
-        private static MethodInfo infoMethListAddFloat = GetBinOpsMethod("MethListAddFloat", new Type[] { typeof(LSL_List), typeof(double) });
-        private static MethodInfo infoMethListAddInt = GetBinOpsMethod("MethListAddInt", new Type[] { typeof(LSL_List), typeof(int) });
-        private static MethodInfo infoMethListAddKey = GetBinOpsMethod("MethListAddKey", new Type[] { typeof(LSL_List), typeof(string) });
-        private static MethodInfo infoMethListAddRot = GetBinOpsMethod("MethListAddRot", new Type[] { typeof(LSL_List), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethListAddStr = GetBinOpsMethod("MethListAddStr", new Type[] { typeof(LSL_List), typeof(string) });
-        private static MethodInfo infoMethListAddVec = GetBinOpsMethod("MethListAddVec", new Type[] { typeof(LSL_List), typeof(LSL_Vector) });
-        private static MethodInfo infoMethListAddList = GetBinOpsMethod("MethListAddList", new Type[] { typeof(LSL_List), typeof(LSL_List) });
-        private static MethodInfo infoMethFloatAddList = GetBinOpsMethod("MethFloatAddList", new Type[] { typeof(double), typeof(LSL_List) });
-        private static MethodInfo infoMethIntAddList = GetBinOpsMethod("MethIntAddList", new Type[] { typeof(int), typeof(LSL_List) });
-        private static MethodInfo infoMethKeyAddList = GetBinOpsMethod("MethKeyAddList", new Type[] { typeof(string), typeof(LSL_List) });
-        private static MethodInfo infoMethRotAddList = GetBinOpsMethod("MethRotAddList", new Type[] { typeof(LSL_Rotation), typeof(LSL_List) });
-        private static MethodInfo infoMethStrAddList = GetBinOpsMethod("MethStrAddList", new Type[] { typeof(string), typeof(LSL_List) });
-        private static MethodInfo infoMethVecAddList = GetBinOpsMethod("MethVecAddList", new Type[] { typeof(LSL_Vector), typeof(LSL_List) });
-        private static MethodInfo infoMethListEqList = GetBinOpsMethod("MethListEqList", new Type[] { typeof(LSL_List), typeof(LSL_List) });
-        private static MethodInfo infoMethListNeList = GetBinOpsMethod("MethListNeList", new Type[] { typeof(LSL_List), typeof(LSL_List) });
-        private static MethodInfo infoMethRotEqRot = GetBinOpsMethod("MethRotEqRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethRotNeRot = GetBinOpsMethod("MethRotNeRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethRotAddRot = GetBinOpsMethod("MethRotAddRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethRotSubRot = GetBinOpsMethod("MethRotSubRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethRotMulRot = GetBinOpsMethod("MethRotMulRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethRotDivRot = GetBinOpsMethod("MethRotDivRot", new Type[] { typeof(LSL_Rotation), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethVecEqVec = GetBinOpsMethod("MethVecEqVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecNeVec = GetBinOpsMethod("MethVecNeVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecAddVec = GetBinOpsMethod("MethVecAddVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecSubVec = GetBinOpsMethod("MethVecSubVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecMulVec = GetBinOpsMethod("MethVecMulVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecModVec = GetBinOpsMethod("MethVecModVec", new Type[] { typeof(LSL_Vector), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecMulFloat = GetBinOpsMethod("MethVecMulFloat", new Type[] { typeof(LSL_Vector), typeof(double) });
-        private static MethodInfo infoMethFloatMulVec = GetBinOpsMethod("MethFloatMulVec", new Type[] { typeof(double), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecDivFloat = GetBinOpsMethod("MethVecDivFloat", new Type[] { typeof(LSL_Vector), typeof(double) });
-        private static MethodInfo infoMethVecMulInt = GetBinOpsMethod("MethVecMulInt", new Type[] { typeof(LSL_Vector), typeof(int) });
-        private static MethodInfo infoMethIntMulVec = GetBinOpsMethod("MethIntMulVec", new Type[] { typeof(int), typeof(LSL_Vector) });
-        private static MethodInfo infoMethVecDivInt = GetBinOpsMethod("MethVecDivInt", new Type[] { typeof(LSL_Vector), typeof(int) });
-        private static MethodInfo infoMethVecMulRot = GetBinOpsMethod("MethVecMulRot", new Type[] { typeof(LSL_Vector), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethVecDivRot = GetBinOpsMethod("MethVecDivRot", new Type[] { typeof(LSL_Vector), typeof(LSL_Rotation) });
-        private static MethodInfo infoMethDoubleDivDouble = GetBinOpsMethod("MethDoubleDivDouble", new Type[] { typeof(Double), typeof(Double) });
-        private static MethodInfo infoMethLongDivLong = GetBinOpsMethod("MethLongDivLong", new Type[] { typeof(long), typeof(long) });
-        private static MethodInfo infoMethDoubleModDouble = GetBinOpsMethod("MethDoubleModDouble", new Type[] { typeof(Double), typeof(Double) });
-        private static MethodInfo infoMethLongModLong = GetBinOpsMethod("MethLongModLong", new Type[] { typeof(long), typeof(long) });
+        private static MethodInfo stringAddStringMethInfo = GetBinOpsMethod("StringConcat", [typeof(string), typeof(string)]);
+        private static MethodInfo stringCmpStringMethInfo = GetBinOpsMethod("StringCompareOrdinal", [typeof(string), typeof(string)]);
+
+        private static MethodInfo infoMethListAddFloat = GetBinOpsMethod("MethListAddFloat", [typeof(LSL_List), typeof(double)]);
+        private static MethodInfo infoMethListAddInt = GetBinOpsMethod("MethListAddInt", [typeof(LSL_List), typeof(int)]);
+        private static MethodInfo infoMethListAddKey = GetBinOpsMethod("MethListAddKey", [typeof(LSL_List), typeof(string)]);
+        private static MethodInfo infoMethListAddRot = GetBinOpsMethod("MethListAddRot", [typeof(LSL_List), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethListAddStr = GetBinOpsMethod("MethListAddStr", [typeof(LSL_List), typeof(string)]);
+        private static MethodInfo infoMethListAddVec = GetBinOpsMethod("MethListAddVec", [typeof(LSL_List), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethListAddList = GetBinOpsMethod("MethListAddList", [typeof(LSL_List), typeof(LSL_List)]);
+        private static MethodInfo infoMethFloatAddList = GetBinOpsMethod("MethFloatAddList", [typeof(double), typeof(LSL_List)]);
+        private static MethodInfo infoMethIntAddList = GetBinOpsMethod("MethIntAddList", [typeof(int), typeof(LSL_List)]);
+        private static MethodInfo infoMethKeyAddList = GetBinOpsMethod("MethKeyAddList", [typeof(string), typeof(LSL_List)]);
+        private static MethodInfo infoMethRotAddList = GetBinOpsMethod("MethRotAddList", [typeof(LSL_Rotation), typeof(LSL_List)]);
+        private static MethodInfo infoMethStrAddList = GetBinOpsMethod("MethStrAddList", [typeof(string), typeof(LSL_List)]);
+        private static MethodInfo infoMethVecAddList = GetBinOpsMethod("MethVecAddList", [typeof(LSL_Vector), typeof(LSL_List)]);
+        private static MethodInfo infoMethListEqList = GetBinOpsMethod("MethListEqList", [typeof(LSL_List), typeof(LSL_List)]);
+        private static MethodInfo infoMethListNeList = GetBinOpsMethod("MethListNeList", [typeof(LSL_List), typeof(LSL_List)]);
+        private static MethodInfo infoMethRotEqRot = GetBinOpsMethod("MethRotEqRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethRotNeRot = GetBinOpsMethod("MethRotNeRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethRotAddRot = GetBinOpsMethod("MethRotAddRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethRotSubRot = GetBinOpsMethod("MethRotSubRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethRotMulRot = GetBinOpsMethod("MethRotMulRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethRotDivRot = GetBinOpsMethod("MethRotDivRot", [typeof(LSL_Rotation), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethVecEqVec = GetBinOpsMethod("MethVecEqVec", [typeof(LSL_Vector), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecNeVec = GetBinOpsMethod("MethVecNeVec", [typeof(LSL_Vector), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecAddVec = GetBinOpsMethod("MethVecAddVec", [typeof(LSL_Vector), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecSubVec = GetBinOpsMethod("MethVecSubVec", [typeof(LSL_Vector), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecMulVec = GetBinOpsMethod("MethVecMulVec", [typeof(LSL_Vector), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecModVec = GetBinOpsMethod("MethVecModVec", [typeof(LSL_Vector), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecMulFloat = GetBinOpsMethod("MethVecMulFloat", [typeof(LSL_Vector), typeof(double)]);
+        private static MethodInfo infoMethFloatMulVec = GetBinOpsMethod("MethFloatMulVec", [typeof(double), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecDivFloat = GetBinOpsMethod("MethVecDivFloat", [typeof(LSL_Vector), typeof(double)]);
+        private static MethodInfo infoMethVecMulInt = GetBinOpsMethod("MethVecMulInt", [typeof(LSL_Vector), typeof(int)]);
+        private static MethodInfo infoMethIntMulVec = GetBinOpsMethod("MethIntMulVec", [typeof(int), typeof(LSL_Vector)]);
+        private static MethodInfo infoMethVecDivInt = GetBinOpsMethod("MethVecDivInt", [typeof(LSL_Vector), typeof(int)]);
+        private static MethodInfo infoMethVecMulRot = GetBinOpsMethod("MethVecMulRot", [typeof(LSL_Vector), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethVecDivRot = GetBinOpsMethod("MethVecDivRot", [typeof(LSL_Vector), typeof(LSL_Rotation)]);
+        private static MethodInfo infoMethDoubleDivDouble = GetBinOpsMethod("MethDoubleDivDouble", [typeof(double), typeof(double)]);
+        private static MethodInfo infoMethLongDivLong = GetBinOpsMethod("MethLongDivLong", [typeof(long), typeof(long)]);
+        private static MethodInfo infoMethDoubleModDouble = GetBinOpsMethod("MethDoubleModDouble", [typeof(double), typeof(double)]);
+        private static MethodInfo infoMethLongModLong = GetBinOpsMethod("MethLongModLong", [typeof(long), typeof(long)]);
 
         private static MethodInfo GetBinOpsMethod(string name, Type[] types)
         {
@@ -144,7 +141,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
         {
             Dictionary<string, BinOpStr> bos = new Dictionary<string, BinOpStr>();
 
-            string[] booltypes = new string[] { "bool", "char", "float", "integer", "key", "list", "string" };
+            string[] booltypes = ["bool", "char", "float", "integer", "key", "list", "string"];
 
             /*
              * Get the && and || all out of the way...
@@ -154,10 +151,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             {
                 for(int j = 0; j < booltypes.Length; j++)
                 {
-                    bos.Add(booltypes[i] + "&&" + booltypes[j],
-                             new BinOpStr(typeof(bool), BinOpStrAndAnd));
-                    bos.Add(booltypes[i] + "||" + booltypes[j],
-                             new BinOpStr(typeof(bool), BinOpStrOrOr));
+                    bos.Add(booltypes[i] + "&&" + booltypes[j], new BinOpStr(typeof(bool), BinOpStrAndAnd));
+                    bos.Add(booltypes[i] + "||" + booltypes[j], new BinOpStr(typeof(bool), BinOpStrOrOr));
                 }
             }
 
@@ -970,7 +965,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0);
             scg.ilGen.Emit(errorAt, OpCodes.Ceq);
@@ -982,7 +976,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0);
             scg.ilGen.Emit(errorAt, OpCodes.Ceq);
@@ -1185,7 +1178,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0);
             scg.ilGen.Emit(errorAt, OpCodes.Ceq);
@@ -1197,7 +1189,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0);
             scg.ilGen.Emit(errorAt, OpCodes.Ceq);
@@ -1211,7 +1202,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0);
             scg.ilGen.Emit(errorAt, OpCodes.Clt);
@@ -1223,7 +1213,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_1);
             scg.ilGen.Emit(errorAt, OpCodes.Clt);
@@ -1235,7 +1224,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_0);
             scg.ilGen.Emit(errorAt, OpCodes.Cgt);
@@ -1247,7 +1235,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.PopPre(scg, errorAt);
             left.PushVal(scg, errorAt, tokenTypeStr);
             right.PushVal(scg, errorAt, tokenTypeStr);
-            scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             scg.ilGen.Emit(errorAt, OpCodes.Call, stringCmpStringMethInfo);
             scg.ilGen.Emit(errorAt, OpCodes.Ldc_I4_M1);
             scg.ilGen.Emit(errorAt, OpCodes.Cgt);
@@ -1395,26 +1382,58 @@ namespace OpenSim.Region.ScriptEngine.Yengine
          *        Needed to pick up functionality defined by overloaded operators of LSL_ types.
          *        They need to be marked public or runtime says they are inaccessible.
          */
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static string StringConcat(string str1, string str2)
+        {
+            return string.Concat(str1, str2);
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static string StringConcat(string str1, string str2, string str3)
+        {
+            return string.Concat(str1, str2, str3);
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static string StringConcat(string str1, string str2, string str3, string str4)
+        {
+            return string.Concat(str1, str2, str3, str4);
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static int StringCompareOrdinal(string str1, string str2)
+        {
+            return string.Compare(str1, str2, StringComparison.Ordinal);
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethListAddFloat(LSL_List left, double right)
         {
             return MethListAddObj(left, new LSL_Float(right));
         }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethListAddInt(LSL_List left, int right)
         {
             return MethListAddObj(left, new LSL_Integer(right));
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethListAddKey(LSL_List left, string right)
         {
             return MethListAddObj(left, new LSL_Key(right));
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethListAddRot(LSL_List left, LSL_Rotation right)
         {
             return MethListAddObj(left, right);
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethListAddStr(LSL_List left, string right)
         {
             return MethListAddObj(left, new LSL_String(right));
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethListAddVec(LSL_List left, LSL_Vector right)
         {
             return MethListAddObj(left, right);
@@ -1438,26 +1457,32 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             return new LSL_List(newarr);
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethFloatAddList(double left, LSL_List right)
         {
             return MethObjAddList(new LSL_Float(left), right);
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethIntAddList(int left, LSL_List right)
         {
             return MethObjAddList(new LSL_Integer(left), right);
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethKeyAddList(string left, LSL_List right)
         {
             return MethObjAddList(new LSL_Key(left), right);
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethRotAddList(LSL_Rotation left, LSL_List right)
         {
             return MethObjAddList(left, right);
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethStrAddList(string left, LSL_List right)
         {
             return MethObjAddList(new LSL_String(left), right);
         }
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_List MethVecAddList(LSL_Vector left, LSL_List right)
         {
             return MethObjAddList(left, right);
@@ -1471,6 +1496,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             return new LSL_List(newarr);
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool MethListEqList(LSL_List left, LSL_List right)
         {
             return left == right;
@@ -1478,6 +1504,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
 
         // According to http://wiki.secondlife.com/wiki/LlGetListLength
         // jackassed LSL allows 'somelist != []' to get the length of a list
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static int MethListNeList(LSL_List left, LSL_List right)
         {
             int leftlen = left.Length;
@@ -1485,106 +1512,127 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             return leftlen - ritelen;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool MethRotEqRot(LSL_Rotation left, LSL_Rotation right)
         {
             return left == right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool MethRotNeRot(LSL_Rotation left, LSL_Rotation right)
         {
             return left != right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Rotation MethRotAddRot(LSL_Rotation left, LSL_Rotation right)
         {
             return left + right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Rotation MethRotSubRot(LSL_Rotation left, LSL_Rotation right)
         {
             return left - right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Rotation MethRotMulRot(LSL_Rotation left, LSL_Rotation right)
         {
             return left * right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Rotation MethRotDivRot(LSL_Rotation left, LSL_Rotation right)
         {
             return left / right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool MethVecEqVec(LSL_Vector left, LSL_Vector right)
         {
             return left == right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool MethVecNeVec(LSL_Vector left, LSL_Vector right)
         {
             return left != right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecAddVec(LSL_Vector left, LSL_Vector right)
         {
             return left + right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecSubVec(LSL_Vector left, LSL_Vector right)
         {
             return left - right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static double MethVecMulVec(LSL_Vector left, LSL_Vector right)
         {
             return (double)(left * right).value;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecModVec(LSL_Vector left, LSL_Vector right)
         {
             return left % right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecMulFloat(LSL_Vector left, double right)
         {
             return left * right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethFloatMulVec(double left, LSL_Vector right)
         {
             return left * right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecDivFloat(LSL_Vector left, double right)
         {
             return left / right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecMulInt(LSL_Vector left, int right)
         {
             return left * right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethIntMulVec(int left, LSL_Vector right)
         {
             return left * right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecDivInt(LSL_Vector left, int right)
         {
             return left / right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecMulRot(LSL_Vector left, LSL_Rotation right)
         {
             return left * right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static LSL_Vector MethVecDivRot(LSL_Vector left, LSL_Rotation right)
         {
             return left / right;
         }
 
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static double MethDoubleDivDouble(double a, double b)
         {
             double r = a / b;

+ 39 - 42
OpenSim/Region/ScriptEngine/YEngine/MMRScriptCodeGen.cs

@@ -65,7 +65,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
     {
         public static readonly string OBJECT_CODE_MAGIC = "YObjectCode";
         // reserve positive version values for original xmr
-        public static int COMPILED_VERSION_VALUE = -9;  // decremented when compiler or object file changes
+        public static int COMPILED_VERSION_VALUE = -10;  // decremented when compiler or object file changes
 
         public static readonly int CALL_FRAME_MEMUSE = 64;
         public static readonly int STRING_LEN_TO_MEMUSE = 2;
@@ -85,21 +85,21 @@ namespace OpenSim.Region.ScriptEngine.Yengine
         private static readonly TokenTypeRot tokenTypeRot = new(null);
         private static readonly TokenTypeStr tokenTypeStr = new(null);
         private static readonly TokenTypeVec tokenTypeVec = new(null);
-        private static readonly Type[] instanceTypeArg = new Type[] { typeof(XMRInstAbstract) };
-        private static readonly string[] instanceNameArg = new string[] { "$xmrthis" };
-
-        private static readonly ConstructorInfo lslFloatConstructorInfo = typeof(LSL_Float).GetConstructor(new Type[] { typeof(double) });
-        private static readonly ConstructorInfo lslIntegerConstructorInfo = typeof(LSL_Integer).GetConstructor(new Type[] { typeof(int) });
-        private static readonly ConstructorInfo lslListConstructorInfo = typeof(LSL_List).GetConstructor(new Type[] { typeof(object[]) });
-        public static  readonly ConstructorInfo lslRotationConstructorInfo = typeof(LSL_Rotation).GetConstructor(new Type[] { typeof(double), typeof(double), typeof(double), typeof(double) });
-        private static readonly ConstructorInfo lslStringConstructorInfo = typeof(LSL_String).GetConstructor(new Type[] { typeof(string) });
-        public static readonly ConstructorInfo lslVectorConstructorInfo = typeof(LSL_Vector).GetConstructor(new Type[] { typeof(double), typeof(double), typeof(double) });
-        private static readonly ConstructorInfo scriptBadCallNoExceptionConstructorInfo = typeof(ScriptBadCallNoException).GetConstructor(new Type[] { typeof(int) });
-        private static readonly ConstructorInfo scriptChangeStateExceptionConstructorInfo = typeof(ScriptChangeStateException).GetConstructor(new Type[] { typeof(int) });
-        private static readonly ConstructorInfo scriptRestoreCatchExceptionConstructorInfo = typeof(ScriptRestoreCatchException).GetConstructor(new Type[] { typeof(Exception) });
-        private static readonly ConstructorInfo scriptUndefinedStateExceptionConstructorInfo = typeof(ScriptUndefinedStateException).GetConstructor(new Type[] { typeof(string) });
-        private static readonly ConstructorInfo sdtClassConstructorInfo = typeof(XMRSDTypeClObj).GetConstructor(new Type[] { typeof(XMRInstAbstract), typeof(int) });
-        private static readonly ConstructorInfo xmrArrayConstructorInfo = typeof(XMR_Array).GetConstructor(new Type[] { typeof(XMRInstAbstract) });
+        private static readonly Type[] instanceTypeArg = [typeof(XMRInstAbstract)];
+        private static readonly string[] instanceNameArg = ["$xmrthis"];
+
+        private static readonly ConstructorInfo lslFloatConstructorInfo = typeof(LSL_Float).GetConstructor([typeof(double)]);
+        private static readonly ConstructorInfo lslIntegerConstructorInfo = typeof(LSL_Integer).GetConstructor([typeof(int)]);
+        private static readonly ConstructorInfo lslListConstructorInfo = typeof(LSL_List).GetConstructor([typeof(object[])]);
+        public static  readonly ConstructorInfo lslRotationConstructorInfo = typeof(LSL_Rotation).GetConstructor([typeof(double), typeof(double), typeof(double), typeof(double)]);
+        private static readonly ConstructorInfo lslStringConstructorInfo = typeof(LSL_String).GetConstructor([typeof(string)]);
+        public static readonly ConstructorInfo lslVectorConstructorInfo = typeof(LSL_Vector).GetConstructor([typeof(double), typeof(double), typeof(double)]);
+        private static readonly ConstructorInfo scriptBadCallNoExceptionConstructorInfo = typeof(ScriptBadCallNoException).GetConstructor([typeof(int)]);
+        private static readonly ConstructorInfo scriptChangeStateExceptionConstructorInfo = typeof(ScriptChangeStateException).GetConstructor([typeof(int)]);
+        private static readonly ConstructorInfo scriptRestoreCatchExceptionConstructorInfo = typeof(ScriptRestoreCatchException).GetConstructor([typeof(Exception)]);
+        private static readonly ConstructorInfo scriptUndefinedStateExceptionConstructorInfo = typeof(ScriptUndefinedStateException).GetConstructor([typeof(string)]);
+        private static readonly ConstructorInfo sdtClassConstructorInfo = typeof(XMRSDTypeClObj).GetConstructor([typeof(XMRInstAbstract), typeof(int)]);
+        private static readonly ConstructorInfo xmrArrayConstructorInfo = typeof(XMR_Array).GetConstructor([typeof(XMRInstAbstract)]);
         private static readonly FieldInfo callModeFieldInfo = typeof(XMRInstAbstract).GetField("callMode");
         private static readonly FieldInfo doGblInitFieldInfo = typeof(XMRInstAbstract).GetField("doGblInit");
         private static readonly FieldInfo ehArgsFieldInfo = typeof(XMRInstAbstract).GetField("ehArgs");
@@ -116,29 +116,29 @@ namespace OpenSim.Region.ScriptEngine.Yengine
 
         private static readonly MethodInfo arrayClearMethodInfo = typeof(XMR_Array).GetMethod("__pub_clear", Array.Empty<Type>());
         private static readonly MethodInfo arrayCountMethodInfo = typeof(XMR_Array).GetMethod("__pub_count", Array.Empty<Type>());
-        private static readonly MethodInfo arrayIndexMethodInfo = typeof(XMR_Array).GetMethod("__pub_index", new Type[] { typeof(int) });
-        private static readonly MethodInfo arrayValueMethodInfo = typeof(XMR_Array).GetMethod("__pub_value", new Type[] { typeof(int) });
+        private static readonly MethodInfo arrayIndexMethodInfo = typeof(XMR_Array).GetMethod("__pub_index", [typeof(int)]);
+        private static readonly MethodInfo arrayValueMethodInfo = typeof(XMR_Array).GetMethod("__pub_value", [typeof(int)]);
         private static readonly MethodInfo checkRunStackMethInfo = typeof(XMRInstAbstract).GetMethod("CheckRunStack", Array.Empty<Type>());
         private static readonly MethodInfo checkRunQuickMethInfo = typeof(XMRInstAbstract).GetMethod("CheckRunQuick", Array.Empty<Type>());
-        private static readonly MethodInfo ehArgUnwrapFloat = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapFloat", new Type[] { typeof(object) });
-        private static readonly MethodInfo ehArgUnwrapInteger = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapInteger", new Type[] { typeof(object) });
-        private static readonly MethodInfo ehArgUnwrapRotation = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapRotation", new Type[] { typeof(object) });
-        private static readonly MethodInfo ehArgUnwrapString = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapString", new Type[] { typeof(object) });
-        private static readonly MethodInfo ehArgUnwrapVector = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapVector", new Type[] { typeof(object) });
-        private static readonly MethodInfo xmrArrPubIndexMethod = typeof(XMR_Array).GetMethod("__pub_index", new Type[] { typeof(int) });
-        private static readonly MethodInfo xmrArrPubValueMethod = typeof(XMR_Array).GetMethod("__pub_value", new Type[] { typeof(int) });
-        private static readonly MethodInfo captureStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("CaptureStackFrame", new Type[] { typeof(string), typeof(int), typeof(int) });
-        private static readonly MethodInfo restoreStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("RestoreStackFrame", new Type[] { typeof(string), typeof(int).MakeByRefType() });
-        private static readonly MethodInfo stringCompareMethodInfo = GetStaticMethod(typeof(String), "Compare", new Type[] { typeof(string), typeof(string), typeof(StringComparison) });
-        private static readonly MethodInfo stringConcat2MethodInfo = GetStaticMethod(typeof(String), "Concat", new Type[] { typeof(string), typeof(string) });
-        private static readonly MethodInfo stringConcat3MethodInfo = GetStaticMethod(typeof(String), "Concat", new Type[] { typeof(string), typeof(string), typeof(string) });
-        private static readonly MethodInfo stringConcat4MethodInfo = GetStaticMethod(typeof(String), "Concat", new Type[] { typeof(string), typeof(string), typeof(string), typeof(string) });
-        private static readonly MethodInfo lslRotationNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLRotationNegate", new Type[] { typeof(LSL_Rotation) });
-        private static readonly MethodInfo lslVectorNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLVectorNegate", new Type[] { typeof(LSL_Vector) });
-        private static readonly MethodInfo scriptRestoreCatchExceptionUnwrap = GetStaticMethod(typeof(ScriptRestoreCatchException), "Unwrap", new Type[] { typeof(Exception) });
-        private static readonly MethodInfo thrownExceptionWrapMethodInfo = GetStaticMethod(typeof(ScriptThrownException), "Wrap", new Type[] { typeof(object) });
-        private static readonly MethodInfo catchExcToStrMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "CatchExcToStr", new Type[] { typeof(Exception) });
-        private static readonly MethodInfo consoleWriteMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "ConsoleWrite", new Type[] { typeof(object) });
+        private static readonly MethodInfo ehArgUnwrapFloat = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapFloat", [typeof(object)]);
+        private static readonly MethodInfo ehArgUnwrapInteger = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapInteger", [typeof(object)]);
+        private static readonly MethodInfo ehArgUnwrapRotation = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapRotation", [typeof(object)]);
+        private static readonly MethodInfo ehArgUnwrapString = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapString", [typeof(object)]);
+        private static readonly MethodInfo ehArgUnwrapVector = GetStaticMethod(typeof(TypeCast), "EHArgUnwrapVector", [typeof(object)]);
+        private static readonly MethodInfo xmrArrPubIndexMethod = typeof(XMR_Array).GetMethod("__pub_index", [typeof(int)]);
+        private static readonly MethodInfo xmrArrPubValueMethod = typeof(XMR_Array).GetMethod("__pub_value", [typeof(int)]);
+        private static readonly MethodInfo captureStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("CaptureStackFrame", [typeof(string), typeof(int), typeof(int)]);
+        private static readonly MethodInfo restoreStackFrameMethodInfo = typeof(XMRInstAbstract).GetMethod("RestoreStackFrame", [typeof(string), typeof(int).MakeByRefType()]);
+        private static readonly MethodInfo stringCompareMethodInfo = GetStaticMethod(typeof(BinOpStr), "StringCompareOrdinal", [typeof(string), typeof(string)]);
+        private static readonly MethodInfo stringConcat2MethodInfo = GetStaticMethod(typeof(BinOpStr), "StringConcat", [typeof(string), typeof(string)]);
+        private static readonly MethodInfo stringConcat3MethodInfo = GetStaticMethod(typeof(BinOpStr), "StringConcat", [typeof(string), typeof(string), typeof(string)]);
+        private static readonly MethodInfo stringConcat4MethodInfo = GetStaticMethod(typeof(BinOpStr), "StringConcat", [typeof(string), typeof(string), typeof(string), typeof(string)]);
+        private static readonly MethodInfo lslRotationNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLRotationNegate", [typeof(LSL_Rotation)]);
+        private static readonly MethodInfo lslVectorNegateMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "LSLVectorNegate", [typeof(LSL_Vector)]);
+        private static readonly MethodInfo scriptRestoreCatchExceptionUnwrap = GetStaticMethod(typeof(ScriptRestoreCatchException), "Unwrap", [typeof(Exception)]);
+        private static readonly MethodInfo thrownExceptionWrapMethodInfo = GetStaticMethod(typeof(ScriptThrownException), "Wrap", [typeof(object)]);
+        private static readonly MethodInfo catchExcToStrMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "CatchExcToStr", [typeof(Exception)]);
+        private static readonly MethodInfo consoleWriteMethodInfo = GetStaticMethod(typeof(ScriptCodeGen), "ConsoleWrite", [typeof(object)]);
         public static void ConsoleWrite(object o)
         {
             o ??= "<<null>>";
@@ -3005,7 +3005,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             {
                 testRVal.PushVal(this, thisCase, tokenTypeStr);
                 ilGen.Emit(thisCase, OpCodes.Ldstr, thisCase.str1);
-                ilGen.Emit(thisCase, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
                 ilGen.Emit(thisCase, OpCodes.Call, stringCompareMethodInfo);
                 ilGen.Emit(thisCase, OpCodes.Brfalse, thisCase.label);
                 ilGen.Emit(thisCase, OpCodes.Br, defaultLabel);
@@ -3030,7 +3029,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
              // Maybe save comparison result in a temp.
             testRVal.PushVal(this, thisCase, tokenTypeStr);
             ilGen.Emit(thisCase, OpCodes.Ldstr, thisCase.str1);
-            ilGen.Emit(thisCase, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
             ilGen.Emit(thisCase, OpCodes.Call, stringCompareMethodInfo);
             if(cmpv1 != null)
             {
@@ -3046,7 +3044,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             {
                 testRVal.PushVal(this, thisCase, tokenTypeStr);
                 ilGen.Emit(thisCase, OpCodes.Ldstr, thisCase.str2);
-                ilGen.Emit(thisCase, OpCodes.Ldc_I4, (int)StringComparison.Ordinal);
                 ilGen.Emit(thisCase, OpCodes.Call, stringCompareMethodInfo);
             }
             else
@@ -4296,7 +4293,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             if((leftType is TokenTypeSDTypeClass sdtType) && right.type is not TokenTypeUndef)
             {
                 TokenDeclSDTypeClass sdtDecl = sdtType.decl;
-                TokenType[] argsig = new TokenType[] { right.type };
+                TokenType[] argsig = [right.type];
                 TokenName funcName = new (token.opcode, "$op" + opcodeIndex);
                 TokenDeclVar declFunc = FindThisMember(sdtDecl, funcName, argsig);
                 if(declFunc != null)
@@ -4304,7 +4301,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
                     CheckAccess(declFunc, funcName);
                     left = GenerateFromRVal(token.rValLeft);
                     CompValu method = AccessInstanceMember(declFunc, left, token, false);
-                    CompValu[] argRVals = new CompValu[] { right };
+                    CompValu[] argRVals = [right];
                     return GenerateACall(method, argRVals, token);
                 }
             }

+ 3 - 1
OpenSim/Region/ScriptEngine/YEngine/MMRScriptInlines.cs

@@ -532,6 +532,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
      * @param args = type/location of arguments (types match function definition)
      */
 
+    /*
     public class TokenDeclInline_LLAbs: TokenDeclInline
     {
         public TokenDeclInline_LLAbs(VarDict ifd)
@@ -589,7 +590,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.Pop(scg, errorAt, new TokenTypeFloat(null));
         }
     }
-
+    */
     public class TokenDeclInline_GetFreeMemory: TokenDeclInline
     {
         private static readonly MethodInfo getFreeMemMethInfo = typeof(XMRInstAbstract).GetMethod("xmrHeapLeft", new Type[] { });
@@ -623,6 +624,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
             result.Pop(scg, errorAt, new TokenTypeInt(null));
         }
     }
+ 
 
     /**
      * @brief Generate code for the usual ll...() functions.

+ 1 - 1
OpenSim/Services/HypergridService/HGInstantMessageService.cs

@@ -89,7 +89,7 @@ namespace OpenSim.Services.HypergridService
                 if (string.IsNullOrEmpty(userAgentService))
                     m_log.WarnFormat("[HG IM SERVICE]: UserAgentService not set in [HGInstantMessageService]");
 
-                object[] args = new object[] { config };
+                object[] args = [ config ];
                 try
                 {
                     m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);

+ 9 - 9
OpenSim/Services/Interfaces/IPresenceService.cs

@@ -43,19 +43,19 @@ namespace OpenSim.Services.Interfaces
 
         public PresenceInfo(Dictionary<string, object> kvp)
         {
-            if (kvp.ContainsKey("UserID"))
-                UserID = kvp["UserID"].ToString();
-            if (kvp.ContainsKey("RegionID"))
-                UUID.TryParse(kvp["RegionID"].ToString(), out RegionID);
+            if (kvp.TryGetValue("UserID", out object ouid))
+                UserID = ouid.ToString();
+            if (kvp.TryGetValue("RegionID", out object orid))
+                _ = UUID.TryParse(orid.ToString(), out RegionID);
         }
 
         public Dictionary<string, object> ToKeyValuePairs()
         {
-            Dictionary<string, object> result = new Dictionary<string, object>();
-            result["UserID"] = UserID;
-            result["RegionID"] = RegionID.ToString();
-
-            return result;
+            return new Dictionary<string, object>
+            {
+                ["UserID"] = UserID,
+                ["RegionID"] = RegionID.ToString()
+            };
         }
     }