Cache NewLine per AppDomain.
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 11 Mar 2011 17:12:56 +0000 (12:12 -0500)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 11 Mar 2011 17:13:19 +0000 (12:13 -0500)
mcs/class/corlib/System/Environment.cs
mono/metadata/appdomain.c
mono/metadata/icall-def.h

index b507d1536eeb39bd9c82f2815db07607fdd24cc2..c5fa5bfc9f4f0d2878d72608874c20f655ad0233 100644 (file)
@@ -55,7 +55,7 @@ namespace System {
                 * of icalls, do not require an increment.
                 */
 #pragma warning disable 169
-               private const int mono_corlib_version = 95;
+               private const int mono_corlib_version = 96;
 #pragma warning restore 169
 
                [ComVisible (true)]
@@ -197,12 +197,21 @@ namespace System {
                        get;
                }
 
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               extern static string GetNewLine ();
+
+               static string nl;
                /// <summary>
                /// Gets the standard new line value
                /// </summary>
-               public extern static string NewLine {
-                       [MethodImplAttribute (MethodImplOptions.InternalCall)]
-                       get;
+               public static string NewLine {
+                       get {
+                               if (nl != null)
+                                       return nl;
+
+                               nl = GetNewLine ();
+                               return nl;
+                       }
                }
 
                //
index 9797a47b5a6ad56299aece4bebdfeb6f6037a2da..658616a1c1ef879c742e4817d9c2299a80ee8712 100644 (file)
@@ -73,7 +73,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 95
+#define MONO_CORLIB_VERSION 96
 
 typedef struct
 {
index 2db72e8f8ca7a4b9b796c41cbbbf53c33f0804b8..87cbf098b89dd5aecb23d5c539e15e6364846d86 100644 (file)
@@ -240,6 +240,7 @@ ICALL(ENV_2, "GetCommandLineArgs", mono_runtime_get_main_args)
 ICALL(ENV_3, "GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames)
 ICALL(ENV_4, "GetLogicalDrivesInternal", ves_icall_System_Environment_GetLogicalDrives )
 ICALL(ENV_5, "GetMachineConfigPath", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path)
+ICALL(ENV_51, "GetNewLine", ves_icall_System_Environment_get_NewLine)
 ICALL(ENV_6, "GetOSVersionString", ves_icall_System_Environment_GetOSVersionString)
 ICALL(ENV_6a, "GetPageSize", mono_pagesize)
 ICALL(ENV_7, "GetWindowsFolderPath", ves_icall_System_Environment_GetWindowsFolderPath)
@@ -247,7 +248,6 @@ ICALL(ENV_8, "InternalSetEnvironmentVariable", ves_icall_System_Environment_Inte
 ICALL(ENV_9, "get_ExitCode", mono_environment_exitcode_get)
 ICALL(ENV_10, "get_HasShutdownStarted", ves_icall_System_Environment_get_HasShutdownStarted)
 ICALL(ENV_11, "get_MachineName", ves_icall_System_Environment_get_MachineName)
-ICALL(ENV_12, "get_NewLine", ves_icall_System_Environment_get_NewLine)
 ICALL(ENV_13, "get_Platform", ves_icall_System_Environment_get_Platform)
 ICALL(ENV_14, "get_ProcessorCount", mono_cpu_count)
 ICALL(ENV_15, "get_TickCount", mono_msec_ticks)