Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs')
-rw-r--r--src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs
index 51abcf771..a82e434b8 100644
--- a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs
+++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ClassConstructorRunner.cs
@@ -50,7 +50,7 @@ namespace System.Runtime.CompilerServices
return nonGcStaticBase;
}
- private unsafe static object CheckStaticClassConstructionReturnThreadStaticBase(TypeManagerSlot* pModuleData, Int32 typeTlsIndex, StaticClassConstructionContext* context)
+ private unsafe static object CheckStaticClassConstructionReturnThreadStaticBase(TypeManagerSlot* pModuleData, int typeTlsIndex, StaticClassConstructionContext* context)
{
object threadStaticBase = ThreadStatics.GetThreadStaticBaseForType(pModuleData, typeTlsIndex);
EnsureClassConstructorRun(context);
@@ -94,7 +94,7 @@ namespace System.Runtime.CompilerServices
{
NoisyLog("Calling cctor, cctor={0}, thread={1}", pfnCctor, currentManagedThreadId);
- Call<int>(pfnCctor);
+ Call(pfnCctor);
// Insert a memory barrier here to order any writes executed as part of static class
// construction above with respect to the initialized flag update we're about to make
@@ -279,6 +279,19 @@ namespace System.Runtime.CompilerServices
#else
const int Grow = 10;
#endif
+
+ // WASMTODO: Remove this when the Initialize method gets called by the runtime startup
+#if WASM
+ if (s_cctorGlobalLock == null)
+ {
+ Interlocked.CompareExchange(ref s_cctorGlobalLock, new Lock(), null);
+ }
+ if (s_cctorArrays == null)
+ {
+ Interlocked.CompareExchange(ref s_cctorArrays, new Cctor[10][], null);
+ }
+#endif // WASM
+
using (LockHolder.Hold(s_cctorGlobalLock))
{
Cctor[] resultArray = null;
@@ -542,7 +555,7 @@ namespace System.Runtime.CompilerServices
string str;
fixed (char* p = &chars[i])
{
- str = new String(p, 0, numChars - i);
+ str = new string(p, 0, numChars - i);
}
return str;
}