aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorTedd Hansen2007-08-22 19:33:10 +0000
committerTedd Hansen2007-08-22 19:33:10 +0000
commit4beef91d006ed18cb7dc4a6ee8f2dc4e2a71ab6f (patch)
tree2a05a2b6191cc8e483b9a1695d87e5d9338716aa /OpenSim/Region/ScriptEngine
parentAdded OnRemoveScript event handler to ScriptEngine. Fixed event queuing of em... (diff)
downloadopensim-SC-4beef91d006ed18cb7dc4a6ee8f2dc4e2a71ab6f.zip
opensim-SC-4beef91d006ed18cb7dc4a6ee8f2dc4e2a71ab6f.tar.gz
opensim-SC-4beef91d006ed18cb7dc4a6ee8f2dc4e2a71ab6f.tar.bz2
opensim-SC-4beef91d006ed18cb7dc4a6ee8f2dc4e2a71ab6f.tar.xz
GC.GetTotalMemory(true) was blocking.
We now support individual scripts on individual prims. Do the script dance... \o/ \o\ /o/ \o/ .o.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs11
4 files changed, 17 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
index 49f6712..3319783 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
58 /// <returns>Free AppDomain</returns> 58 /// <returns>Free AppDomain</returns>
59 private AppDomainStructure GetFreeAppDomain() 59 private AppDomainStructure GetFreeAppDomain()
60 { 60 {
61 Console.WriteLine("Finding free AppDomain");
61 FreeAppDomains(); // Outsite lock, has its own GetLock 62 FreeAppDomains(); // Outsite lock, has its own GetLock
62 lock (GetLock) 63 lock (GetLock)
63 { 64 {
@@ -141,8 +142,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
141 // Find next available AppDomain to put it in 142 // Find next available AppDomain to put it in
142 AppDomainStructure FreeAppDomain = GetFreeAppDomain(); 143 AppDomainStructure FreeAppDomain = GetFreeAppDomain();
143 144
144 if (FreeAppDomain == null) Console.WriteLine("FreeAppDomain == null"); 145 //if (FreeAppDomain == null) Console.WriteLine("FreeAppDomain == null");
145 if (FreeAppDomain.CurrentAppDomain == null) Console.WriteLine("FreeAppDomain.CurrentAppDomain == null"); 146 //if (FreeAppDomain.CurrentAppDomain == null) Console.WriteLine("FreeAppDomain.CurrentAppDomain == null");
147 Console.WriteLine("Loading into AppDomain: " + FileName);
146 LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); 148 LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script");
147 //Type mytype = mbrt.GetType(); 149 //Type mytype = mbrt.GetType();
148 Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); 150 Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt));
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index 4343ea1..a20a95a 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
51 // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager 51 // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager
52 52
53 // Hook up a test event to our test form 53 // Hook up a test event to our test form
54 //myScriptEngine.Log.Verbose("ScriptEngine", "EventManager Hooking up to server events"); 54 myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events");
55 myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start); 55 myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start);
56 myScriptEngine.World.EventManager.OnRezScript += new OpenSim.Region.Environment.Scenes.EventManager.NewRezScript(OnRezScript); 56 myScriptEngine.World.EventManager.OnRezScript += new OpenSim.Region.Environment.Scenes.EventManager.NewRezScript(OnRezScript);
57 myScriptEngine.World.EventManager.OnRemoveScript += new OpenSim.Region.Environment.Scenes.EventManager.RemoveScript(OnRemoveScript); 57 myScriptEngine.World.EventManager.OnRemoveScript += new OpenSim.Region.Environment.Scenes.EventManager.RemoveScript(OnRemoveScript);
@@ -62,6 +62,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
62 { 62 {
63 // Add to queue for all scripts in ObjectID object 63 // Add to queue for all scripts in ObjectID object
64 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); 64 //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
65 Console.WriteLine("touch_start localID: " + localID);
65 myScriptEngine.myEventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); 66 myScriptEngine.myEventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 });
66 } 67 }
67 public void OnRezScript(uint localID, LLUUID itemID, string script) 68 public void OnRezScript(uint localID, LLUUID itemID, string script)
@@ -75,11 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
75 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() 76 // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
76 //); 77 //);
77 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); 78 Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length);
78 myScriptEngine.myScriptManager.StartScript( 79 myScriptEngine.myScriptManager.StartScript(localID, itemID, script);
79 localID,
80 itemID,
81 script
82 );
83 80
84 } 81 }
85 public void OnRemoveScript(uint localID, LLUUID itemID) 82 public void OnRemoveScript(uint localID, LLUUID itemID)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 23cd4e8..a436bff 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -241,7 +241,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
241 241
242 // Do we have any scripts in this object at all? If not, return 242 // Do we have any scripts in this object at all? If not, return
243 if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false) 243 if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false)
244 {
245 Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID.");
244 return; 246 return;
247 }
245 248
246 foreach (LLUUID itemID in myScriptEngine.myScriptManager.GetScriptKeys(localID)) 249 foreach (LLUUID itemID in myScriptEngine.myScriptManager.GetScriptKeys(localID))
247 { 250 {
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index b7a4aca..efd5a7f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -169,11 +169,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
169 //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); 169 //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName);
170 170
171 //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, localID); 171 //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, localID);
172 long before; 172
173 before = GC.GetTotalMemory(true); 173 //long before;
174 //before = GC.GetTotalMemory(true);
174 LSL_BaseClass CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName); 175 LSL_BaseClass CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
175 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); 176 //Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
176 before = GC.GetTotalMemory(true); 177 //before = GC.GetTotalMemory(true);
178
179
177 //Script = m_scriptEngine.myAppDomainManager.LoadScript(FileName); 180 //Script = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
178 //Console.WriteLine("Script occupies {0} bytes", GC.GetTotalMemory(true) - before); 181 //Console.WriteLine("Script occupies {0} bytes", GC.GetTotalMemory(true) - before);
179 //before = GC.GetTotalMemory(true); 182 //before = GC.GetTotalMemory(true);