[runtime]Add the marshal lock to the lock tracer.
authorRodrigo Kumpera <kumpera@gmail.com>
Wed, 4 Dec 2013 19:38:26 +0000 (14:38 -0500)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 5 Dec 2013 19:11:58 +0000 (14:11 -0500)
data/lock-decoder/LockTracerDecoder.cs
mono/metadata/lock-tracer.h
mono/metadata/marshal.c

index f786e6b81dc20dc9c399733e794ffcd0555dea4b..abd4e5f89fc944a1c1f70181db836569fe446ee1 100644 (file)
@@ -122,6 +122,8 @@ public enum Lock {
        DomainAssembliesLock,
        DomainJitCodeHashLock,
        IcallLock,
+       AssemblyBindingLock,
+       MarshalLock,
 }
 
 public class SimLock
index b303f0fe81f19f1c1ba4543b99bf1790c57ba106..215b683ba4beb910514d98422f2c3fc8b039e78e 100644 (file)
@@ -17,6 +17,7 @@ typedef enum {
        DomainJitCodeHashLock,
        IcallLock,
        AssemblyBindingLock,
+       MarshalLock
 } RuntimeLocks;
 
 #ifdef LOCK_TRACER
index dddd049d4b0d5f0261c16640ec778843635aa3e9..fa50598f7d72c68a36f2b4396988c2f24a6b61ba 100644 (file)
@@ -72,11 +72,12 @@ typedef struct _MonoRemotingMethods MonoRemotingMethods;
 /* 
  * This mutex protects the various marshalling related caches in MonoImage
  * and a few other data structures static to this file.
- * Note that when this lock is held it is not possible to take other runtime
- * locks like the loader lock.
+ *
+ * The marshal lock is a non-recursive complex lock that sits below the domain lock in the
+ * runtime locking latice. Which means it can take simple locks suck as the image lock.
  */
-#define mono_marshal_lock() EnterCriticalSection (&marshal_mutex)
-#define mono_marshal_unlock() LeaveCriticalSection (&marshal_mutex)
+#define mono_marshal_lock() mono_locks_acquire (&marshal_mutex, MarshalLock)
+#define mono_marshal_unlock() mono_locks_release (&marshal_mutex, MarshalLock)
 static CRITICAL_SECTION marshal_mutex;
 static gboolean marshal_mutex_initialized;