diff options
author | Melanie Thielker | 2009-03-26 14:49:39 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-03-26 14:49:39 +0000 |
commit | eb6c1ae0c1e8ec4af14900ecd38eb79333bc5607 (patch) | |
tree | af2e564b048322d024e201c677ca153d7576b024 /OpenSim/Region/ScriptEngine/Shared/CodeTools | |
parent | Avoid writing script state to the filesystem if the state has not changed. (diff) | |
download | opensim-SC_OLD-eb6c1ae0c1e8ec4af14900ecd38eb79333bc5607.zip opensim-SC_OLD-eb6c1ae0c1e8ec4af14900ecd38eb79333bc5607.tar.gz opensim-SC_OLD-eb6c1ae0c1e8ec4af14900ecd38eb79333bc5607.tar.bz2 opensim-SC_OLD-eb6c1ae0c1e8ec4af14900ecd38eb79333bc5607.tar.xz |
Avoid preprocessing scripts on region restart just to generate the line
number map. Instead, write the map to a file for later use. That is not
yet used, so currently runtime errors after a sim restart will have wrong
line numbers
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 42ec324..5215b90 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -300,14 +300,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
300 | if (Script == String.Empty) | 300 | if (Script == String.Empty) |
301 | { | 301 | { |
302 | if (File.Exists(OutFile)) | 302 | if (File.Exists(OutFile)) |
303 | { | ||
304 | // m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset); | ||
305 | return OutFile; | 303 | return OutFile; |
306 | } | ||
307 | 304 | ||
308 | throw new Exception("Cannot find script assembly and no script text present"); | 305 | throw new Exception("Cannot find script assembly and no script text present"); |
309 | } | 306 | } |
310 | 307 | ||
308 | // Don't recompile if we already have it | ||
309 | // | ||
310 | if (File.Exists(OutFile) && File.Exists(OutFile+".text") && File.Exists(OutFile+".map")) | ||
311 | { | ||
312 | // TODO: Read .map file here | ||
313 | return OutFile; | ||
314 | } | ||
315 | |||
311 | enumCompileType l = DefaultCompileLanguage; | 316 | enumCompileType l = DefaultCompileLanguage; |
312 | 317 | ||
313 | if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) | 318 | if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) |
@@ -353,14 +358,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
353 | m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap; | 358 | m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap; |
354 | } | 359 | } |
355 | 360 | ||
356 | // Check this late so the map is generated on sim start | ||
357 | // | ||
358 | if (File.Exists(OutFile) && File.Exists(OutFile+".text")) | ||
359 | { | ||
360 | // m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset); | ||
361 | return OutFile; | ||
362 | } | ||
363 | |||
364 | if (l == enumCompileType.yp) | 361 | if (l == enumCompileType.yp) |
365 | { | 362 | { |
366 | // Its YP, convert it to C# | 363 | // Its YP, convert it to C# |
@@ -646,6 +643,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
646 | sfs.Write(buf, 0, buf.Length); | 643 | sfs.Write(buf, 0, buf.Length); |
647 | sfs.Close(); | 644 | sfs.Close(); |
648 | 645 | ||
646 | string posmap = String.Empty; | ||
647 | foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> kvp in m_positionMap) | ||
648 | { | ||
649 | KeyValuePair<int, int> k = kvp.Key; | ||
650 | KeyValuePair<int, int> v = kvp.Value; | ||
651 | posmap += String.Format("{0},{1},{2},{3}\n", | ||
652 | k.Key, k.Value, v.Key, v.Value); | ||
653 | } | ||
654 | |||
655 | buf = enc.GetBytes(posmap); | ||
656 | |||
657 | FileStream mfs = File.Create(OutFile+".map"); | ||
658 | mfs.Write(buf, 0, buf.Length); | ||
659 | mfs.Close(); | ||
660 | |||
649 | return OutFile; | 661 | return OutFile; |
650 | } | 662 | } |
651 | 663 | ||