diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptReduce.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptReduce.cs index d31cca6a5b..b31681ad38 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptReduce.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptReduce.cs @@ -3426,19 +3426,35 @@ namespace OpenSim.Region.ScriptEngine.Yengine } } - // If doing local vars, each var goes in its own var frame, - // to make sure no code before this point can reference it. - if(currentStmtBlock != null) + // If doing local vars, each var goes in its own var frame, + // to make sure no code before this point can reference it. + if (currentStmtBlock != null) { tokenScript.PushVarFrame(true); } - - // Can't be same name already in block. - if(!tokenScript.AddVarEntry(tokenDeclVar)) + /* + ScriptConst scriptConst = ScriptConst.Lookup(tokenDeclVar.name.val); + if (scriptConst != null) + { + ErrorMsg(tokenDeclVar, "reserved constant name " + tokenDeclVar.name.val); + return null; + } + */ + // Can't be same name already in block. + if (!tokenScript.AddVarEntry(tokenDeclVar)) { ErrorMsg(tokenDeclVar, "duplicate variable " + tokenDeclVar.name.val); return null; } + + /* + if (TokenDeclInline.inlineFunctions.HasAnyExact(tokenDeclVar.name.val)) + { + ErrorMsg(tokenDeclVar, "reserved name " + tokenDeclVar.name.val); + return null; + } + */ + return tokenDeclVar; } diff --git a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptVarDict.cs b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptVarDict.cs index a0bc7ba41d..662a09fc60 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/MMRScriptVarDict.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/MMRScriptVarDict.cs @@ -232,14 +232,20 @@ namespace OpenSim.Region.ScriptEngine.Yengine return (found.Count > 0) ? found.ToArray() : null; } + public bool HasAnyExact(string name) + { + return master.TryGetValue(name, out Dictionary typedic); + } + /** - * @brief Find exact matching function/variable - * @param name = name of function to look for - * @param argTypes = argument types the function was declared with - * null to look for a variable - * @returns null: no matching function/variable found - * else: the matching function/variable - */ + * @brief Find exact matching function/variable + * @param name = name of function to look for + * @param argTypes = argument types the function was declared with + * null to look for a variable + * @returns null: no matching function/variable found + * else: the matching function/variable + */ + public TokenDeclVar FindExact(string name, TokenType[] argTypes) { // Look for list of stuff that matches the given name. diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs index b0b9bce729..f0beb6bf5a 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs @@ -507,21 +507,19 @@ namespace OpenSim.Region.ScriptEngine.Yengine protected int heapLimit; public int m_localsHeapUsed; - public int m_arraysHeapUsed; public virtual int UpdateLocalsHeapUse(int olduse, int newuse) { int newtotal = Interlocked.Add(ref m_localsHeapUsed, newuse - olduse); if (newtotal + glblVars.arraysHeapUse > heapLimit) - throw new OutOfHeapException(m_arraysHeapUsed + newtotal + olduse - newuse, newtotal, heapLimit); + throw new OutOfHeapException(glblVars.arraysHeapUse + newtotal + olduse - newuse, newtotal + glblVars.arraysHeapUse, heapLimit); return newuse; } // not in use public virtual int UpdateArraysHeapUse(int olduse, int newuse) { - //int newtotal = Interlocked.Add(ref m_arraysheapUsed, newuse - olduse); if(newuse + glblVars.arraysHeapUse > heapLimit) - throw new OutOfHeapException(m_arraysHeapUsed + newuse + olduse - newuse, newuse, heapLimit); + throw new OutOfHeapException(glblVars.arraysHeapUse, glblVars.arraysHeapUse + newuse, heapLimit); return newuse; } @@ -530,11 +528,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine Interlocked.Add(ref m_localsHeapUsed, delta); } - public virtual void AddArraysHeapUse(int delta) - { - Interlocked.Add(ref m_arraysHeapUsed, delta); - } - public int xmrHeapLeft() { return heapLimit - m_localsHeapUsed - glblVars.arraysHeapUse; diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs index 26d5dbd0d3..d88ef02a40 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstCtor.cs @@ -87,7 +87,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine m_StackLeft = stackSize; m_HeapSize = heapSize; m_localsHeapUsed = 0; - m_arraysHeapUsed = 0; m_CompilerErrors = errors; m_StateFileName = GetStateFileName(scriptBasePath, m_ItemID); @@ -901,7 +900,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine glblVars.iarSDTClObjs = XMRInstArrays.noSDTClObjs; glblVars.iarSDTIntfObjs = XMRInstArrays.noSDTIntfObjs; - AddArraysHeapUse(heapsz); CheckRunLockInvariants(true); } diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index 561a74472a..9a10e953ad 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -877,7 +877,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine m_ResetCount++; // has been reset once more m_localsHeapUsed = 0; - m_arraysHeapUsed = 0; glblVars.Clear(); // Tell next call to 'default state_entry()' to reset all global