dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and to


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. d9026ac65e3eecb6acfc6490cd691a4fae92bfb5
Date: Sun, 08 Nov 2009 17:53:18 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET engine, compilers and tools (pnet)".

The branch, master has been updated
       via  d9026ac65e3eecb6acfc6490cd691a4fae92bfb5 (commit)
      from  4357197102136ed953e50afe8de51dd88556a581 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnet.git/commit/?id=d9026ac65e3eecb6acfc6490cd691a4fae92bfb5

commit d9026ac65e3eecb6acfc6490cd691a4fae92bfb5
Author: Klaus Treichel <address@hidden>
Date:   Sun Nov 8 18:52:49 2009 +0100

    Unify declaration and usage of METADATA_WRLOCK and METADATA_UNLOCK.

diff --git a/ChangeLog b/ChangeLog
index 6c597dc..c256ead 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2009-11-08  Klaus Treichel  <address@hidden>
+
+       * engine/engine.h: Centralize the declarations of METADATA_WRLOCK and
+       METADATA_UNLOCK here.
+
+       * engine/cctormgr.c: Remove local declarations of METADATA_WRLOCK and
+       METADATA_UNLOCK;
+
+       * engine/jitc.c: likewise
+
+       * engine/heap.c (InitializeClass): Replace local implementation with
+       usage of the macros METADATA_WRLOCK and METADATA_UNLOCK.
+
+       * engine/convert.c: Remove local declarations of METADATA_WRLOCK and
+       METADATA_UNLOCK and adjust the usages so that the process is passed
+       instead of the thread.
+
 2009-11-07  Klaus Treichel  <address@hidden>
 
        * include/il_coder.h: Declare the ILCoderPrefixInfo struct and add a
diff --git a/engine/cctormgr.c b/engine/cctormgr.c
index b5f2648..a128672 100755
--- a/engine/cctormgr.c
+++ b/engine/cctormgr.c
@@ -26,22 +26,6 @@ extern       "C" {
 #endif
 
 /*
- * Acquire and release the metadata lock, while suppressing finalizers
- * Must be kept in sync with convert.c
- */
-#define        METADATA_WRLOCK(process)        \
-                       do { \
-                               IL_METADATA_WRLOCK(process); \
-                               ILGCDisableFinalizers(0); \
-                       } while (0)
-#define        METADATA_UNLOCK(process)        \
-                       do { \
-                               ILGCEnableFinalizers(); \
-                               IL_METADATA_UNLOCK(process); \
-                               ILGCInvokeFinalizers(0); \
-                       } while (0)
-
-/*
  * Forward declaration.
  */
 static int _ILCCtorMgr_RunCCtors(ILCCtorMgr *cctorMgr,
diff --git a/engine/convert.c b/engine/convert.c
index 2938b1f..cd10989 100644
--- a/engine/convert.c
+++ b/engine/convert.c
@@ -36,22 +36,6 @@ extern       "C" {
 #define        IL_CONVERT_TYPE_INIT            5
 #define        IL_CONVERT_DLL_NOT_FOUND        6
 
-/*
- * Acquire and release the metadata lock, while suppressing finalizers
- * during the execution of "ConvertMethod".
- */
-#define        METADATA_WRLOCK(thread) \
-                       do { \
-                               
IL_METADATA_WRLOCK(_ILExecThreadProcess(thread)); \
-                               ILGCDisableFinalizers(0); \
-                       } while (0)
-#define        METADATA_UNLOCK(thread) \
-                       do { \
-                               ILGCEnableFinalizers(); \
-                               
IL_METADATA_UNLOCK(_ILExecThreadProcess(thread)); \
-                               ILGCInvokeFinalizers(0); \
-                       } while (0)
-
 #ifdef IL_USE_JIT
 
 /*
@@ -72,7 +56,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
        if((ILMethod_CallConv(method) & IL_META_CALLCONV_MASK) ==
                        IL_META_CALLCONV_VARARG)
        {
-               METADATA_UNLOCK(thread);
+               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                *errorCode = IL_CONVERT_NOT_IMPLEMENTED;
                return 0;
        }
@@ -92,7 +76,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                if(!_ILVerify(coder, &start, method, &code,
                                          
ILImageIsSecure(ILProgramItem_Image(method)), thread))
                {
-                       METADATA_UNLOCK(thread);
+                       METADATA_UNLOCK(_ILExecThreadProcess(thread));
                        *errorCode = IL_CONVERT_VERIFY_FAILED;
                        return 0;
                }
@@ -101,7 +85,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
        {
                /* All other cases should be handled in the jit coder. */
 
-               METADATA_UNLOCK(thread);
+               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                return 0;
        }
@@ -187,12 +171,12 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
        ILInternalInfo ctorfnInfo;
 
        /* We need the metadata write lock */
-       METADATA_WRLOCK(thread);
+       METADATA_WRLOCK(_ILExecThreadProcess(thread));
 
        /* Handle locked methods while cctors are executed. */
        if((start = (unsigned char *)ILCoderHandleLockedMethod(coder, method)))
        {
-               METADATA_UNLOCK(thread);
+               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                *errorCode = IL_CONVERT_OK;
                return start;
        }
@@ -200,7 +184,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
        /* Is the method already converted? */
        if((start = (unsigned char *)(method->userData)) != 0)
        {
-               METADATA_UNLOCK(thread);
+               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                *errorCode = IL_CONVERT_OK;
                return start;
        }
@@ -210,7 +194,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
        if((ILMethod_CallConv(method) & IL_META_CALLCONV_MASK) ==
                        IL_META_CALLCONV_VARARG)
        {
-               METADATA_UNLOCK(thread);
+               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                *errorCode = IL_CONVERT_NOT_IMPLEMENTED;
                return 0;
        }
@@ -219,7 +203,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
        /* Make sure that we can lay out the method's class */
        if(!_ILLayoutClass(_ILExecThreadProcess(thread), 
ILMethod_Owner(method)))
        {
-               METADATA_UNLOCK(thread);
+               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                *errorCode = IL_CONVERT_TYPE_INIT;
                return 0;
        }
@@ -238,7 +222,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                if(!_ILVerify(coder, &start, method, &code,
                                          
ILImageIsSecure(ILProgramItem_Image(method)), thread))
                {
-                       METADATA_UNLOCK(thread);
+                       METADATA_UNLOCK(_ILExecThreadProcess(thread));
                        *errorCode = IL_CONVERT_VERIFY_FAILED;
                        return 0;
                }
@@ -264,7 +248,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                   know what to map this method call to */
                                if(!pinv)
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_ENTRY_POINT;
                                        return 0;
                                }
@@ -274,14 +258,14 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                module = ILPInvoke_Module(pinv);
                                if(!module)
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_ENTRY_POINT;
                                        return 0;
                                }
                                name = ILModule_Name(module);
                                if(!name || *name == '\0')
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_ENTRY_POINT;
                                        return 0;
                                }
@@ -289,7 +273,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                                                        
(thread->process, name, pinv);
                                if(!moduleHandle)
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_DLL_NOT_FOUND;
                                        *errorInfo = name;
                                        return 0;
@@ -337,7 +321,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                fnInfo.func = 
ILDynLibraryGetSymbol(moduleHandle, name);
                        #endif  /* !IL_WIN32_PLATFORM */
                        #else /* !IL_CONFIG_PINVOKE */
-                               METADATA_UNLOCK(thread);
+                               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                *errorCode = IL_CONVERT_NOT_IMPLEMENTED;
                                return 0;
                        #endif /* IL_CONFIG_PINVOKE */
@@ -351,7 +335,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                   have PInvoke records associated with them */
                                if(pinv)
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_VERIFY_FAILED;
                                        return 0;
                                }
@@ -365,14 +349,14 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                                
if(!_ILFindInternalCall(ILExecThreadGetProcess(thread),
                                                                                
                method, 1, &ctorfnInfo))
                                                {
-                                                       METADATA_UNLOCK(thread);
+                                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                                        *errorCode = 
IL_CONVERT_NOT_IMPLEMENTED;
                                                        return 0;
                                                }
                                        }
                                        else
                                        {
-                                               METADATA_UNLOCK(thread);
+                                               
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                                *errorCode = 
IL_CONVERT_NOT_IMPLEMENTED;
                                                return 0;
                                        }
@@ -388,7 +372,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                        default:
                        {
                                /* No idea how to invoke this method */
-                               METADATA_UNLOCK(thread);
+                               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                *errorCode = IL_CONVERT_VERIFY_FAILED;
                                return 0;
                        }
@@ -398,7 +382,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                /* Bail out if we did not find the underlying native method */
                if(!(fnInfo.func) && !(ctorfnInfo.func))
                {
-                       METADATA_UNLOCK(thread);
+                       METADATA_UNLOCK(_ILExecThreadProcess(thread));
                        if(pinv)
                                *errorCode = IL_CONVERT_ENTRY_POINT;
                        else
@@ -415,7 +399,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                                                                
method, (pinv == 0));
                        if(!cif)
                        {
-                               METADATA_UNLOCK(thread);
+                               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                return 0;
                        }
@@ -431,7 +415,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                                                                
                method, (pinv == 0));
                        if(!ctorcif)
                        {
-                               METADATA_UNLOCK(thread);
+                               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                return 0;
                        }
@@ -453,7 +437,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                        if(!ILCoderSetupExtern(coder, &start, method,
                                                                   fnInfo.func, 
cif, (pinv == 0)))
                        {
-                               METADATA_UNLOCK(thread);
+                               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                return 0;
                        }
@@ -462,14 +446,14 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                /* Do we need a coder restart due to cache 
overflow? */
                                if(result != IL_CODER_END_RESTART)
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                        return 0;
                                }
                                if(!ILCoderSetupExtern(coder, &start, method,
                                                                           
fnInfo.func, cif, (pinv == 0)))
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                        return 0;
                                }
@@ -483,7 +467,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                                                           
ctorfnInfo.func, ctorcif,
                                                                           
(pinv == 0)))
                        {
-                               METADATA_UNLOCK(thread);
+                               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                return 0;
                        }
@@ -492,7 +476,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                /* Do we need a coder restart due to cache 
overflow? */
                                if(result != IL_CODER_END_RESTART)
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                        return 0;
                                }
@@ -501,7 +485,7 @@ static unsigned char *ConvertMethod(ILExecThread *thread, 
ILMethod *method,
                                                                                
   ctorfnInfo.func, ctorcif,
                                                                                
   (pinv == 0)))
                                {
-                                       METADATA_UNLOCK(thread);
+                                       
METADATA_UNLOCK(_ILExecThreadProcess(thread));
                                        *errorCode = IL_CONVERT_OUT_OF_MEMORY;
                                        return 0;
                                }
@@ -594,9 +578,9 @@ int _ILUnrollMethod(ILExecThread *thread, ILCoder *coder,
                                        unsigned char *pc, ILMethod *method)
 {
        int result;
-       METADATA_WRLOCK(thread);
+       METADATA_WRLOCK(_ILExecThreadProcess(thread));
        result = _ILCVMUnrollMethod(coder, pc, method);
-       METADATA_UNLOCK(thread);
+       METADATA_UNLOCK(_ILExecThreadProcess(thread));
        return result;
 }
 
diff --git a/engine/engine.h b/engine/engine.h
index 069dec4..088bae8 100644
--- a/engine/engine.h
+++ b/engine/engine.h
@@ -377,6 +377,22 @@ typedef struct _tagILLocalWatch
 #define _ILExecProcessGetFriendlyName(process) ((process)->friendlyName)
 
 /*
+ * Acquire and release the metadata lock, while suppressing finalizers
+ * during the execution of "ConvertMethod".
+ */
+#define        METADATA_WRLOCK(process)        \
+                       do { \
+                               IL_METADATA_WRLOCK((process)); \
+                               ILGCDisableFinalizers(0); \
+                       } while (0)
+#define        METADATA_UNLOCK(process)        \
+                       do { \
+                               ILGCEnableFinalizers(); \
+                               IL_METADATA_UNLOCK((process)); \
+                               ILGCInvokeFinalizers(0); \
+                       } while (0)
+
+/*
  * Information that is stored in a stack call frame.
  * Offsets are used to refer to the stack instead of
  * pointers.  This allows the stack to be realloc'ed,
diff --git a/engine/heap.c b/engine/heap.c
index b839330..94fc661 100644
--- a/engine/heap.c
+++ b/engine/heap.c
@@ -38,26 +38,21 @@ static int InitializeClass(ILExecThread *thread, ILClass 
*classInfo)
        }
 
        /* Acquire the metadata write lock and disable finalizers */
-       IL_METADATA_WRLOCK(_ILExecThreadProcess(thread));
-       ILGCDisableFinalizers(0);
+       METADATA_WRLOCK(_ILExecThreadProcess(thread));
 
        /* Lay out the class's fields.  This will check for layout
           again, to avoid race condition situations */
        if(!_ILLayoutClass(_ILExecThreadProcess(thread), classInfo))
        {
                /* Throw a "TypeInitializationException" */
-               ILGCEnableFinalizers();
-               IL_METADATA_UNLOCK(_ILExecThreadProcess(thread));
-               ILGCInvokeFinalizers(0);
+               METADATA_UNLOCK(_ILExecThreadProcess(thread));
                thread->thrownException = _ILSystemException
                        (thread, "System.TypeInitializationException");
                return 0;
        }
 
        /* Re-enable finalizers and unlock the metadata write lock */
-       ILGCEnableFinalizers();
-       IL_METADATA_UNLOCK(_ILExecThreadProcess(thread));
-       ILGCInvokeFinalizers(0);
+       METADATA_UNLOCK(_ILExecThreadProcess(thread));
        return 1;
 }
 
diff --git a/engine/jitc.c b/engine/jitc.c
index 57a6ed4..2919fad 100755
--- a/engine/jitc.c
+++ b/engine/jitc.c
@@ -77,22 +77,6 @@ extern       "C" {
  */
 /* #define _IL_JIT_ENABLE_INLINE 1 */
 
-/*
- * Acquire and release the metadata lock, while suppressing finalizers
- * Must be kept in sync with convert.c
- */
-#define        METADATA_WRLOCK(process)        \
-                       do { \
-                               IL_METADATA_WRLOCK(process); \
-                               ILGCDisableFinalizers(0); \
-                       } while (0)
-#define        METADATA_UNLOCK(process)        \
-                       do { \
-                               ILGCEnableFinalizers(); \
-                               IL_METADATA_UNLOCK(process); \
-                               ILGCInvokeFinalizers(0); \
-                       } while (0)
-
 #ifdef _IL_JIT_DUMP_FUNCTION
 #ifndef _IL_JIT_ENABLE_DEBUG
 #define _IL_JIT_ENABLE_DEBUG 1

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   17 ++++++++++++
 engine/cctormgr.c |   16 -----------
 engine/convert.c  |   74 ++++++++++++++++++++--------------------------------
 engine/engine.h   |   16 +++++++++++
 engine/heap.c     |   11 ++-----
 engine/jitc.c     |   16 -----------
 6 files changed, 65 insertions(+), 85 deletions(-)


hooks/post-receive
-- 
DotGNU Portable.NET engine, compilers and tools (pnet)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]