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. fa723edc0cb4c1cd6ce7579c70829ba3f850cd09
Date: Sun, 09 Jan 2011 16:00:44 +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  fa723edc0cb4c1cd6ce7579c70829ba3f850cd09 (commit)
      from  a918a85ac6f0a32c6485752b13150ed6170fd1c0 (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=fa723edc0cb4c1cd6ce7579c70829ba3f850cd09

commit fa723edc0cb4c1cd6ce7579c70829ba3f850cd09
Author: Klaus Treichel <address@hidden>
Date:   Sun Jan 9 16:59:15 2011 +0100

    Unify accesses to the current exception in the ILExecThread structure
    in the engine.

diff --git a/ChangeLog b/ChangeLog
index ce9221c..f99d847 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2011-01-09  Klaus Treichel  <address@hidden>
+
+       * engine/engine.h: Add macros for accessing the current thrown
+       exception in the ILExecThread structure.
+
+       * engine/throv.c (ILExecThreadHasException): Replace implementation
+       by the new internal macro.
+       (ILExecThreadGetException): Likewise.
+       (ILExecThreadClearException): Likewise.
+       (ILExecThreadSetException): Likewise.
+       Replace all calls to one of these functions with a call of the
+       corresponding macro.
+
+       * engine/call.c, engine/cctormgr.c, engine/convert.c: Replace all calls
+       to functions that access the ILExecThread's thrownException and direct
+       accesses to the ILExecThread's thrownException member with calls to the
+       corresponding new macro.
+
+       * engine/custom.c, engine/cvm.c, engine/cvm_call.c: Likewise.
+
+       * engine/cvm_conv.c, engine/cvm_except.c, engine/heap.c: Likewise.
+
+       * engine/ilrun.c, engine/jitc.c, engine/lib_crypt.c: Likewise.
+
+       * engine/lib_delegate.c, engine/lib_object.c: Likewise.
+
+       * engine/lib_thread.c, engine/lib_type.c, engine/pinvoke.c: Likewise.
+
+       * engine/process.c, engine/system.c, engine/thread.c: Likewise.
+
 2011-01-07  Klaus Treichel  <address@hidden>
 
        * engine/cvm.c, engine/cvm_interrupts.c: Do some reformatting.
diff --git a/engine/call.c b/engine/call.c
index 7dcd8b9..ade0706 100644
--- a/engine/call.c
+++ b/engine/call.c
@@ -1,7 +1,7 @@
 /*
  * call.c - External interface for calling methods using the engine.
  *
- * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -71,8 +71,8 @@ extern        "C" {
                        do { \
                                if((stacktop + (nwords)) > stacklimit) \
                                { \
-                                       thread->thrownException = 
_ILSystemException \
-                                               (thread, 
"System.StackOverflowException"); \
+                                       _ILExecThreadSetException(thread, 
_ILSystemException \
+                                               (thread, 
"System.StackOverflowException")); \
                                        return 1; \
                                } \
                        } while (0)
@@ -1170,7 +1170,7 @@ int _ILCallMethod(ILExecThread *thread, ILMethod *method,
        }
 
        /* Clear the pending exception on entry to the method */
-       thread->thrownException = 0;
+       _ILExecThreadClearException(thread);
 
        /* Convert the method into CVM bytecode */
        pcstart = _ILConvertMethod(thread, method);
@@ -1185,8 +1185,8 @@ int _ILCallMethod(ILExecThread *thread, ILMethod *method,
        {
            if((frame = _ILAllocCallFrame(thread)) == 0)
                {
-                       thread->thrownException = _ILSystemException
-                               (thread, "System.StackOverflowException");
+                       _ILExecThreadSetException(thread, _ILSystemException
+                               (thread, "System.StackOverflowException"));
                        return 1;
            }
        }
diff --git a/engine/cctormgr.c b/engine/cctormgr.c
index a128672..a213dc5 100644
--- a/engine/cctormgr.c
+++ b/engine/cctormgr.c
@@ -1,7 +1,7 @@
 /*
  * cctormgr.c - Queue and execute class initializers (static constructors).
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -511,19 +511,20 @@ static int _ILCCtorMgr_QueueClass(ILCCtorMgr *cctorMgr,
  */
 static void _ILCCtorMgr_ThrowTypeInitializationException(ILExecThread *thread)
 {
-       ILObject *exception = ILExecThreadGetException(thread);
+       ILObject *exception;
 
+       exception = _ILExecThreadGetException(thread);
        if(exception)
        {
                ILObject *typeInitializationException = 0;
 
-               ILExecThreadClearException(thread);
+               _ILExecThreadClearException(thread);
 
                ILExecThreadThrowSystem(thread,
                                                                
"System.TypeInitializationException",
                                                                 0);
 
-               typeInitializationException = ILExecThreadGetException(thread);
+               typeInitializationException = _ILExecThreadGetException(thread);
                if(typeInitializationException)
                {
                        /* Set the inner exception thrown by the class 
initializer. */
diff --git a/engine/convert.c b/engine/convert.c
index cd10989..3b09bc9 100644
--- a/engine/convert.c
+++ b/engine/convert.c
@@ -1,7 +1,7 @@
 /*
  * convert.c - Convert methods using a coder.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -517,7 +517,7 @@ unsigned char *_ILConvertMethod(ILExecThread *thread, 
ILMethod *method)
                {
                        case IL_CONVERT_VERIFY_FAILED:
                        {
-                               ILExecThreadSetException
+                               _ILExecThreadSetException
                                        (thread, _ILSystemException(thread, 
                                                
"System.Security.VerificationException"));
                        }
@@ -525,7 +525,7 @@ unsigned char *_ILConvertMethod(ILExecThread *thread, 
ILMethod *method)
 
                        case IL_CONVERT_ENTRY_POINT:
                        {
-                               ILExecThreadSetException
+                               _ILExecThreadSetException
                                        (thread, _ILSystemException(thread, 
                                                
"System.EntryPointNotFoundException"));
                        }
@@ -533,7 +533,7 @@ unsigned char *_ILConvertMethod(ILExecThread *thread, 
ILMethod *method)
 
                        case IL_CONVERT_NOT_IMPLEMENTED:
                        {
-                               ILExecThreadSetException
+                               _ILExecThreadSetException
                                        (thread, _ILSystemException(thread, 
                                                
"System.NotImplementedException"));
                        }
@@ -547,7 +547,7 @@ unsigned char *_ILConvertMethod(ILExecThread *thread, 
ILMethod *method)
 
                        case IL_CONVERT_TYPE_INIT:
                        {
-                               ILExecThreadSetException
+                               _ILExecThreadSetException
                                        (thread, _ILSystemException(thread, 
                                                
"System.TypeInitializationException"));
                        }
@@ -564,7 +564,7 @@ unsigned char *_ILConvertMethod(ILExecThread *thread, 
ILMethod *method)
                                                (ILObject 
*)ILStringCreate(thread, errorInfo));
                                }
 
-                               ILExecThreadSetException(thread, obj);
+                               _ILExecThreadSetException(thread, obj);
                        }
                        break;
                }
diff --git a/engine/custom.c b/engine/custom.c
index 23899ce..c5257bb 100644
--- a/engine/custom.c
+++ b/engine/custom.c
@@ -1,7 +1,7 @@
 /*
  * custom.c - Handle custom marshaling operations.
  *
- * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2003, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -130,7 +130,7 @@ static ILObject *GetMarshallingInstance(ILExecThread 
*thread,
  */
 static void ThrowCustomError(ILExecThread *thread)
 {
-       if(!ILExecThreadHasException(thread))
+       if(!_ILExecThreadHasException(thread))
        {
                ILExecThreadThrowSystem(thread, 
"System.InvalidOperationException", 0);
        }
diff --git a/engine/cvm.c b/engine/cvm.c
index ef3684f..2ad1c6a 100644
--- a/engine/cvm.c
+++ b/engine/cvm.c
@@ -1,7 +1,7 @@
 /*
  * cvm.c - Implementation of the "Converted Virtual Machine".
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1052,8 +1052,8 @@ static int unwind(ILExecThread *thread,
        frame = thread->frame;
        stacktop = thread->stackTop;
        method = thread->method;
-       exception = thread->thrownException;
-       thread->thrownException = 0;
+       exception = _ILExecThreadGetException(thread);
+       _ILExecThreadClearException(thread);
 
        threadIsAborting = 0;
        /*
@@ -1334,7 +1334,7 @@ static int unwind(ILExecThread *thread,
                /* Should we return to an external method? */
                if(callFrame->pc == IL_INVALID_PC)
                {
-                       thread->thrownException = exception;
+                       _ILExecThreadSetException(thread, exception);
                        COPY_STATE_TO_THREAD();
                        return _CVM_EXIT_EXCEPT;
                }
diff --git a/engine/cvm_call.c b/engine/cvm_call.c
index d4d828f..918bb14 100644
--- a/engine/cvm_call.c
+++ b/engine/cvm_call.c
@@ -1,7 +1,7 @@
 /*
  * cvm_call.c - Opcodes for performing calls to other methods.
  *
- * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@ ILCallFrame *_ILAllocCallFrame(ILExecThread *thread)
        if((newframe = (ILCallFrame *)ILGCAllocPersistent
                                (sizeof(ILCallFrame) * newsize)) == 0)
        {
-           thread->thrownException = thread->process->outOfMemoryObject;
+           _ILExecThreadSetOutOfMemoryException(thread);
                return 0;
        }
        ILMemCpy(newframe, thread->frameStack,
@@ -90,7 +90,7 @@ ILCallFrame *_ILAllocCallFrame(ILExecThread *thread)
        return &(thread->frameStack[(thread->numFrames)++]);
 #else
        /* We are not allowed to grow the frame stack */
-    thread->thrownException = thread->process->outOfMemoryObject;
+    _ILExecThreadSetOutOfMemoryException(thread);
        return 0;
 #endif
 }
@@ -183,7 +183,7 @@ ILCallFrame *_ILAllocCallFrame(ILExecThread *thread)
                                stacktop = thread->stackTop; \
                                frame = thread->frame; \
                                stackmax = thread->stackLimit; \
-                               if(IL_EXPECT(thread->thrownException != 0, 0)) \
+                               if(IL_EXPECT(_ILExecThreadGetException(thread) 
!= 0, 0)) \
                                { \
                                        /* An exception occurred, which we now 
must handle */ \
                                        goto throwCurrentException; \
@@ -192,7 +192,7 @@ ILCallFrame *_ILAllocCallFrame(ILExecThread *thread)
 #else
 #define        RESTORE_STATE_FROM_THREAD()     \
                        do { \
-                               if(IL_EXPECT(thread->thrownException != 0, 0)) \
+                               if(IL_EXPECT(_ILExecThreadGetException(thread) 
!= 0, 0)) \
                                { \
                                        /* An exception occurred, which we now 
must handle */ \
                                        goto throwCurrentException; \
diff --git a/engine/cvm_conv.c b/engine/cvm_conv.c
index d455400..d33ab18 100644
--- a/engine/cvm_conv.c
+++ b/engine/cvm_conv.c
@@ -1,7 +1,7 @@
 /*
  * cvm_conv.c - Opcodes for converting between data types.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -241,7 +241,7 @@ static void *RefArrayToC(ILExecThread *thread, void *ref,
        {
                *newArray = (void *)((*conv)
                        (thread, ((ILString **)(ArrayToBuffer(array)))[index]));
-               if(ILExecThreadHasException(thread))
+               if(_ILExecThreadHasException(thread))
                {
                        return 0;
                }
diff --git a/engine/cvm_except.c b/engine/cvm_except.c
index b294a04..7a9ea7f 100644
--- a/engine/cvm_except.c
+++ b/engine/cvm_except.c
@@ -1,7 +1,7 @@
 /*
  * cvm_except.c - Opcodes for handling exceptions.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -182,7 +182,7 @@ VMCASE(COP_PREFIX_THROW):
         */
 throwException:
        /* Store the exception to the thread. */
-       thread->thrownException = tempptr;
+       _ILExecThreadSetException(thread, tempptr);
        /*
         * Label that we jump to when the exception thrown is allready
         * stored in the thread's thrownException slot.
@@ -202,12 +202,10 @@ throwCurrentException:
         * managed barrier.
         */
 throwThreadAbortException:
+       COPY_STATE_TO_THREAD();
        ILInterlockedAndU4(&(thread->managedSafePointFlags),
                                           ~_IL_MANAGED_SAFEPOINT_THREAD_ABORT);
-       tempptr = thread->thrownException;
-       thread->thrownException = 0;
-       COPY_STATE_TO_THREAD();
-       goto throwException;
+       goto throwCurrentException;
 
        /*
         * Jump target to throw a NullReferenceException
diff --git a/engine/engine.h b/engine/engine.h
index a42a5b4..f4b1399 100644
--- a/engine/engine.h
+++ b/engine/engine.h
@@ -1,7 +1,7 @@
 /*
  * engine.h - Core definitions for the runtime engine.
  *
- * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -586,6 +586,22 @@ struct _tagObjectHeader
 #endif
 };
 
+/*
+ * Some internal shortcuts for public functions.
+ * No checks for the validity of arguments are done here so use them with care.
+ */
+
+/*
+ * Define the exception related macros.
+ */
+#define _ILExecThreadHasException(thread)      ((thread)->thrownException != 0)
+#define _ILExecThreadClearException(thread)    ((thread)->thrownException = 0)
+#define _ILExecThreadGetException(thread)      ((thread)->thrownException)
+#define _ILExecThreadSetException(thread,except)       \
+                       ((thread)->thrownException = (except))
+#define _ILExecThreadSetOutOfMemoryException(thread)   \
+                       ((thread)->thrownException = 
(thread)->process->outOfMemoryObject)
+
 /* global accessor function to get the global engine object */
 ILExecEngine *ILExecEngineInstance(void);
 
diff --git a/engine/heap.c b/engine/heap.c
index 5a0cf6e..6d5389f 100644
--- a/engine/heap.c
+++ b/engine/heap.c
@@ -1,7 +1,7 @@
 /*
  * heap.c - Heap routines for the runtime engine.
  *
- * Copyright (C) 2001, 2008, 2009  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008, 2009, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,8 +46,8 @@ static int InitializeClass(ILExecThread *thread, ILClass 
*classInfo)
        {
                /* Throw a "TypeInitializationException" */
                METADATA_UNLOCK(_ILExecThreadProcess(thread));
-               thread->thrownException = _ILSystemException
-                       (thread, "System.TypeInitializationException");
+               _ILExecThreadSetException(thread, _ILSystemException
+                       (thread, "System.TypeInitializationException"));
                return 0;
        }
 
@@ -165,7 +165,7 @@ void _ILFinalizeObject(void *block, void *data)
                if(ILExecThreadCall(ILExecThreadCurrent(),
                                                        method, (void *)0, 
object))
                {
-                       ILExecThreadClearException(ILExecThreadCurrent());
+                       _ILExecThreadClearException(ILExecThreadCurrent());
                }
        }
        
@@ -210,7 +210,7 @@ ILObject *_ILEngineAlloc(ILExecThread *thread, ILClass 
*classInfo,
                if(!ptr)
                {
                        /* Throw an "OutOfMemoryException" */
-                       thread->thrownException = 
thread->process->outOfMemoryObject;
+                       _ILExecThreadSetOutOfMemoryException(thread);
                        return 0;
                }
 
@@ -273,7 +273,7 @@ ILObject *_ILEngineAllocAtomic(ILExecThread *thread, 
ILClass *classInfo,
                if(!ptr)
                {
                        /* Throw an "OutOfMemoryException" */
-                       thread->thrownException = 
thread->process->outOfMemoryObject;
+                       _ILExecThreadSetOutOfMemoryException(thread);
                        return 0;
                }
                
@@ -330,7 +330,7 @@ ILObject *_ILEngineAllocTyped(ILExecThread *thread, ILClass 
*classInfo)
        if(!ptr)
        {
                /* Throw an "OutOfMemoryException" */
-               thread->thrownException = thread->process->outOfMemoryObject;
+               _ILExecThreadSetOutOfMemoryException(thread);
                return 0;
        }
                
diff --git a/engine/ilrun.c b/engine/ilrun.c
index 4d9a91d..6809a88 100644
--- a/engine/ilrun.c
+++ b/engine/ilrun.c
@@ -1,7 +1,7 @@
 /*
  * ilrun.c - Command-line version of the runtime engine.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -562,7 +562,7 @@ int main(int argc, char *argv[])
        if(error == IL_EXECUTE_ERR_EXCEPTION)
        {
                /* Print the top-level exception that occurred */
-               if(!ILExecThreadIsThreadAbortException(thread, 
ILExecThreadGetException(thread)))
+               if(!ILExecThreadIsThreadAbortException(thread, 
_ILExecThreadGetException(thread)))
                {               
                        ILExecThreadPrintException(thread);
                }
diff --git a/engine/jitc.c b/engine/jitc.c
index c0a8037..7236300 100755
--- a/engine/jitc.c
+++ b/engine/jitc.c
@@ -1,7 +1,7 @@
 /*
  * jitc.c - Coder implementation for JIT output.
  *
- * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1547,7 +1547,7 @@ void ILRuntimeExceptionRethrow(ILObject *object)
 
                if(thread)
                {
-                       thread->thrownException = object;
+                       _ILExecThreadSetException(thread, object);
                        jit_exception_throw(object);
                }
        }
@@ -1566,7 +1566,7 @@ void ILRuntimeExceptionThrow(ILObject *object)
 
                if(thread)
                {
-                       thread->thrownException = (ILObject *)exception;
+                       _ILExecThreadSetException(thread, (ILObject 
*)exception);
                        exception->stackTrace = 
_ILJitGetExceptionStackTrace(thread);
                        jit_exception_throw(exception);
                }
@@ -1588,7 +1588,7 @@ void ILRuntimeExceptionThrowClass(ILClass *classInfo)
        /* thrown an OutOfMenory exception then. */
        if(thread)
        {
-               thread->thrownException = (ILObject *)exception;
+               _ILExecThreadSetException(thread, (ILObject *)exception);
                exception->stackTrace = _ILJitGetExceptionStackTrace(thread);
                jit_exception_throw(exception);
        }
@@ -1603,8 +1603,8 @@ void ILRuntimeExceptionThrowOutOfMemory()
 
        if(thread)
        {
-               thread->thrownException = thread->process->outOfMemoryObject;
-               jit_exception_throw(thread->thrownException);
+               _ILExecThreadSetOutOfMemoryException(thread);
+               jit_exception_throw(_ILExecThreadGetException(thread));
                return;
        }
        jit_exception_builtin(JIT_RESULT_OUT_OF_MEMORY);
@@ -1619,7 +1619,7 @@ void ILRuntimeHandleManagedSafePointFlags(ILExecThread 
*thread)
        {
                if(_ILExecThreadSelfAborting(thread) == 0)
                {
-                       jit_exception_throw(thread->thrownException);
+                       jit_exception_throw(_ILExecThreadGetException(thread));
                }
        }
        else if(thread->managedSafePointFlags & 
_IL_MANAGED_SAFEPOINT_THREAD_SUSPEND)
@@ -2071,7 +2071,7 @@ void *_ILJitExceptionHandler(int exception_type)
                }
                break;
        }
-       thread->thrownException = object;
+       _ILExecThreadSetException(thread, object);
        return object;
 }
 
diff --git a/engine/lib_crypt.c b/engine/lib_crypt.c
index 620a20a..99625d8 100644
--- a/engine/lib_crypt.c
+++ b/engine/lib_crypt.c
@@ -1,7 +1,7 @@
 /*
  * lib_crypt.c - Internalcall methods for the CryptoMethods class.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -318,7 +318,7 @@ ILNativeInt _IL_CryptoMethods_HashNew(ILExecThread 
*_thread, ILInt32 algorithm)
                }
                /* Not reached */
        }
-       ILExecThreadSetException(_thread,
+       _ILExecThreadSetException(_thread,
                        _ILSystemException(_thread, 
"System.NotImplementedException"));
        return 0;
 }
@@ -623,7 +623,7 @@ ILNativeInt _IL_CryptoMethods_EncryptCreate(ILExecThread 
*_thread,
                }
                /* Not reached */
        }
-       ILExecThreadSetException(_thread,
+       _ILExecThreadSetException(_thread,
                        _ILSystemException(_thread, 
"System.NotImplementedException"));
        return 0;
 }
diff --git a/engine/lib_delegate.c b/engine/lib_delegate.c
index ad2ed49..7060586 100644
--- a/engine/lib_delegate.c
+++ b/engine/lib_delegate.c
@@ -1,7 +1,7 @@
 /*
  * lib_delegate.c - Delegate handling for the runtime engine.
  *
- * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2002, 2011  Southern Storm Software, Pty Ltd.
  *
  * Contributions:  Thong Nguyen (address@hidden)
  *
@@ -221,8 +221,8 @@ static int PackDelegateInvokeParams(ILExecThread *thread, 
ILMethod *method,
        {
                if(stacktop >= thread->stackLimit)
                {
-                       thread->thrownException = _ILSystemException
-                               (thread, "System.StackOverflowException");
+                       _ILExecThreadSetException(thread, _ILSystemException
+                               (thread, "System.StackOverflowException"));
                        return 1;
                }
                stacktop->ptrValue = _this;
@@ -232,8 +232,8 @@ static int PackDelegateInvokeParams(ILExecThread *thread, 
ILMethod *method,
        /* Push the parameter words */
        if((stacktop + params->numWords) >= thread->stackLimit)
        {
-               thread->thrownException = _ILSystemException
-                       (thread, "System.StackOverflowException");
+               _ILExecThreadSetException(thread, _ILSystemException
+                       (thread, "System.StackOverflowException"));
                return 1;
        }
        /* Expand "float" and "double" parameters, because the frame variables
@@ -288,7 +288,7 @@ static void Delegate_Invoke(ILExecThread *thread,
        if(((System_Delegate *)_this)->prev)
        {
                Delegate_Invoke(thread, result, ((System_Delegate 
*)_this)->prev);
-               if(ILExecThreadHasException(thread))
+               if(_ILExecThreadHasException(thread))
                {
                        return;
                }
diff --git a/engine/lib_object.c b/engine/lib_object.c
index 704a9df..977e92e 100644
--- a/engine/lib_object.c
+++ b/engine/lib_object.c
@@ -1,7 +1,7 @@
 /*
  * lib_object.c - Internalcall methods for "System.Object".
  *
- * Copyright (C) 2001, 2009  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2009, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -121,8 +121,8 @@ ILObject *_ILGetClrType(ILExecThread *thread, ILClass 
*classInfo)
 
        if(!classInfo)
        {
-               thread->thrownException = _ILSystemException
-                       (thread, "System.TypeInitializationException");
+               _ILExecThreadSetException(thread, _ILSystemException
+                       (thread, "System.TypeInitializationException"));
                return 0;
        }
 
@@ -137,8 +137,8 @@ ILObject *_ILGetClrType(ILExecThread *thread, ILClass 
*classInfo)
                if(!_ILLayoutClass(_ILExecThreadProcess(thread), classInfo))
                {
                        IL_METADATA_UNLOCK(_ILExecThreadProcess(thread));
-                       thread->thrownException = _ILSystemException
-                               (thread, "System.TypeInitializationException");
+                       _ILExecThreadSetException(thread, _ILSystemException
+                               (thread, "System.TypeInitializationException"));
                        return 0;
                }
                IL_METADATA_UNLOCK(_ILExecThreadProcess(thread));
@@ -151,8 +151,8 @@ ILObject *_ILGetClrType(ILExecThread *thread, ILClass 
*classInfo)
                        /* Create a new "ClrType" instance */
                        if(!(thread->process->clrTypeClass))
                        {
-                               thread->thrownException = _ILSystemException
-                                       (thread, 
"System.TypeInitializationException");
+                               _ILExecThreadSetException(thread, 
_ILSystemException
+                                       (thread, 
"System.TypeInitializationException"));
                                return 0;
                        }
                        obj = _ILEngineAllocObject(thread, 
thread->process->clrTypeClass);
diff --git a/engine/lib_thread.c b/engine/lib_thread.c
index 04d111a..921fb35 100644
--- a/engine/lib_thread.c
+++ b/engine/lib_thread.c
@@ -1,7 +1,7 @@
 /*
  * lib_thread.c - Internalcall methods for "System.Threading.*".
  *
- * Copyright (C) 2001, 2002, 2003  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2003, 2011  Southern Storm Software, Pty Ltd.
  *
  * Contributions from Thong Nguyen <address@hidden>
  *
@@ -193,8 +193,8 @@ static void __PrivateThreadStart(void *objectArg)
                );
 
        /* Print out any uncaught exceptions */
-       if (ILExecThreadHasException(thread)
-               && !ILExecThreadIsThreadAbortException(thread, 
ILExecThreadGetException(thread)))
+       if (_ILExecThreadHasException(thread)
+               && !ILExecThreadIsThreadAbortException(thread, 
_ILExecThreadGetException(thread)))
        {                               
                ILExecThreadPrintException(thread);
        }
diff --git a/engine/lib_type.c b/engine/lib_type.c
index 3ff52ef..6d8bb57 100644
--- a/engine/lib_type.c
+++ b/engine/lib_type.c
@@ -1,7 +1,7 @@
 /*
  * lib_type.c - Internalcall methods for "Type" and related classes.
  *
- * Copyright (C) 2001, 2002, 2008  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2002, 2008, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -646,7 +646,7 @@ ILObject *_ILGetTypeFromImage(ILExecThread *thread,
 void _ILClrNotImplemented(ILExecThread *thread)
 {
        /* Avoid re-entering the C# class library to create the exception */
-       ILExecThreadSetException
+       _ILExecThreadSetException
                (thread, _ILSystemException(thread, 
"System.NotImplementedException"));
 }
 
diff --git a/engine/pinvoke.c b/engine/pinvoke.c
index 5d182ea..9108ea8 100644
--- a/engine/pinvoke.c
+++ b/engine/pinvoke.c
@@ -1,7 +1,7 @@
 /*
  * pinvoke.c - Handle PInvoke and "internalcall" methods within the engine.
  *
- * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -453,8 +453,8 @@ void *_ILMakeCifForConstructor(ILExecProcess *process, 
ILMethod *method, int isI
                        do { \
                                if((stacktop + (nwords)) > stacklimit) \
                                { \
-                                       thread->thrownException = 
_ILSystemException \
-                                               (thread, 
"System.StackOverflowException"); \
+                                       _ILExecThreadSetException(thread, 
_ILSystemException \
+                                               (thread, 
"System.StackOverflowException")); \
                                        return 1; \
                                } \
                        } while (0)
@@ -614,7 +614,7 @@ static int PackDelegateParams(ILExecThread *thread, 
ILMethod *method,
                                                (thread, *((void **)(*args)),
                                                 customName, customNameLen,
                                                 customCookie, customCookieLen);
-                                       if(ILExecThreadHasException(thread))
+                                       if(_ILExecThreadHasException(thread))
                                        {
                                                return 1;
                                        }
@@ -972,7 +972,7 @@ static void _DelegateInvoke(ILDelegateInvokeParams *params)
                prevParams.delegate = (System_Delegate 
*)(params->delegate->prev);
 ;
                _DelegateInvoke(&prevParams);
-               if(ILExecThreadHasException(params->thread))
+               if(_ILExecThreadHasException(params->thread))
                {
                        return;
                }
diff --git a/engine/process.c b/engine/process.c
index 70a23a3..f2eb9c3 100644
--- a/engine/process.c
+++ b/engine/process.c
@@ -1,7 +1,7 @@
 /*
  * process.c - Manage processes within the runtime engine.
  *
- * Copyright (C) 2001, 2008  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2008, 2011  Southern Storm Software, Pty Ltd.
  *
  * Contributions by Thong Nguyen (address@hidden)
  *
@@ -1075,7 +1075,7 @@ int ILExecProcessExecuteFileInternal(ILExecThread *thread,
        args = ILExecProcessSetCommandLine(process, filename, argv);
 
        /* Call the entry point */
-       if(args != 0 && !ILExecThreadHasException(thread))
+       if(args != 0 && !_ILExecThreadHasException(thread))
        {
                execValue.ptrValue = args;
                ILMemZero(&retValue, sizeof(retValue));
@@ -1269,13 +1269,13 @@ ILObject *ILExecProcessSetCommandLine(ILExecProcess 
*process,
        thread = ILExecProcessGetMain(process);
        mainArgs = ILExecThreadNew(thread, "[oSystem.String;",
                                                       "(Ti)V", (ILVaInt)argc);
-       if(!mainArgs || ILExecThreadHasException(thread))
+       if(!mainArgs || _ILExecThreadHasException(thread))
        {
                return 0;
        }
        allArgs = ILExecThreadNew(thread, "[oSystem.String;",
                                                      "(Ti)V", (ILVaInt)(argc + 
1));
-       if(!allArgs || ILExecThreadHasException(thread))
+       if(!allArgs || _ILExecThreadHasException(thread))
        {
                return 0;
        }
@@ -1289,7 +1289,7 @@ ILObject *ILExecProcessSetCommandLine(ILExecProcess 
*process,
        }
        argString = ILStringCreate(thread, expanded);
        ILFree(expanded);
-       if(!argString || ILExecThreadHasException(thread))
+       if(!argString || _ILExecThreadHasException(thread))
        {
                return 0;
        }
@@ -1297,7 +1297,7 @@ ILObject *ILExecProcessSetCommandLine(ILExecProcess 
*process,
        for(opt = 0; opt < argc; ++opt)
        {
                argString = ILStringCreate(thread, args[opt]);
-               if(!argString || ILExecThreadHasException(thread))
+               if(!argString || _ILExecThreadHasException(thread))
                {
                        return 0;
                }
diff --git a/engine/system.c b/engine/system.c
index bdd945e..59e1cb4 100644
--- a/engine/system.c
+++ b/engine/system.c
@@ -1,7 +1,7 @@
 /*
  * system.c - functions and objects used by the runtime.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -112,7 +112,7 @@ void _ILSetExceptionStackTrace(ILExecThread *thread, 
ILObject *object)
        {
                /* We ran out of memory while allocating the stack trace,
                   but it isn't serious: we can just throw without the trace */
-               thread->thrownException = 0;
+               _ILExecThreadClearException(thread);
        }
 }
 
@@ -129,7 +129,7 @@ void _ILSetExceptionStackTrace(ILExecThread *thread, 
ILObject *object)
 #endif /* !(IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES) */
 
 void *_ILSystemExceptionWithClass(ILExecThread *thread, ILClass *classInfo)
-{
+{
        ILObject *object;
        
        object = _ILEngineAllocObject(thread, classInfo);
@@ -139,18 +139,18 @@ void *_ILSystemExceptionWithClass(ILExecThread *thread, 
ILClass *classInfo)
                if(!FindAndSetStackTrace(thread, object))
                {
                        /* We ran out of memory: pick up the 
"OutOfMemoryException" */
-                       object = thread->thrownException;
-                       thread->thrownException = 0;
+                       object = _ILExecThreadGetException(thread);
+                       _ILExecThreadClearException(thread);
                }
 #endif /* IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES */
        }
        else
        {
                /* The system ran out of memory, so copy the 
"OutOfMemoryException" */
-               object = thread->thrownException;
-               thread->thrownException = 0;
+               object = _ILExecThreadGetException(thread);
+               _ILExecThreadClearException(thread);
        }
-       return object;
+       return object;
 }
 
 void *_ILSystemException(ILExecThread *thread, const char *className)
diff --git a/engine/thread.c b/engine/thread.c
index e424c80..446b7c4 100644
--- a/engine/thread.c
+++ b/engine/thread.c
@@ -1,7 +1,7 @@
 /*
  * thread.c - Manage threads within the runtime engine.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * Contributions from Thong Nguyen <address@hidden>
  *
@@ -316,7 +316,7 @@ int _ILExecThreadSelfAborting(ILExecThread *thread)
                        ILInterlockedAndU4(&(thread->managedSafePointFlags),
                                                           
~_IL_MANAGED_SAFEPOINT_THREAD_ABORT);
                        thread->aborting = 1;
-                       ILExecThreadSetException(thread, exception);
+                       _ILExecThreadSetException(thread, exception);
 
                        return 0;
                }
@@ -887,7 +887,7 @@ ILLocalWatch *_ILAllocLocalWatch(ILExecThread *thread)
        if((watches = (ILLocalWatch *)ILGCAllocPersistent
                                (sizeof(ILLocalWatch) * newsize)) == 0)
        {
-               thread->thrownException = thread->process->outOfMemoryObject;
+               _ILExecThreadSetOutOfMemoryException(thread);
                return 0;
        }
 
diff --git a/engine/throw.c b/engine/throw.c
index 1a7beb7..9d5c725 100644
--- a/engine/throw.c
+++ b/engine/throw.c
@@ -1,7 +1,7 @@
 /*
  * throw.c - External API's for throwing and managing exceptions.
  *
- * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ * Copyright (C) 2001, 2011  Southern Storm Software, Pty Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,31 +28,31 @@ extern      "C" {
 
 int ILExecThreadHasException(ILExecThread *thread)
 {
-       return (thread->thrownException != 0);
+       return _ILExecThreadHasException(thread);
 }
 
 ILObject *ILExecThreadGetException(ILExecThread *thread)
 {
-       return thread->thrownException;
+       return _ILExecThreadGetException(thread);
 }
 
 void ILExecThreadClearException(ILExecThread *thread)
 {
-       thread->thrownException = 0;
+       _ILExecThreadClearException(thread);
 }
 
 void ILExecThreadSetException(ILExecThread *thread, ILObject *obj)
 {
-       thread->thrownException = obj;
+       _ILExecThreadSetException(thread, obj);
 }
 
 void _ILSetExceptionStackTrace(ILExecThread *thread, ILObject *object);
 
 void ILExecThreadThrow(ILExecThread *thread, ILObject *object)
 {
-       if(!ILExecThreadHasException(thread))
+       if(!_ILExecThreadHasException(thread))
        {
-               ILExecThreadSetException(thread, object);
+               _ILExecThreadSetException(thread, object);
        }
 }
 
@@ -64,7 +64,7 @@ void ILExecThreadThrowSystem(ILExecThread *thread, const char 
*typeName,
        ILObject *object;
 
        /* Bail out if there already is a pending exception or if the thread is 
aborting */
-       if(ILExecThreadHasException(thread))
+       if(_ILExecThreadHasException(thread))
        {
                return;
        }
@@ -82,7 +82,7 @@ void ILExecThreadThrowSystem(ILExecThread *thread, const char 
*typeName,
                        {
                                ILExecThreadCall(thread, method, 
&resourceString,
                                                                 
resourceString);
-                               if(ILExecThreadHasException(thread))
+                               if(_ILExecThreadHasException(thread))
                                {
                                        /* The string lookup threw an exception 
*/
                                        return;
@@ -102,9 +102,9 @@ void ILExecThreadThrowSystem(ILExecThread *thread, const 
char *typeName,
                object = ILExecThreadNew(thread, typeName, "(T)V");
        }
        _ILSetExceptionStackTrace(thread, object);
-       if(!ILExecThreadHasException(thread))
+       if(!_ILExecThreadHasException(thread))
        {
-               ILExecThreadSetException(thread, object);
+               _ILExecThreadSetException(thread, object);
        }
 }
 
@@ -117,7 +117,7 @@ void ILExecThreadThrowArgRange(ILExecThread *thread, const 
char *paramName,
        ILObject *object;
 
        /* Bail out if there already is a pending exception or if the thread is 
aborting */
-       if(ILExecThreadHasException(thread))
+       if(_ILExecThreadHasException(thread))
        {
                return;
        }
@@ -136,7 +136,7 @@ void ILExecThreadThrowArgRange(ILExecThread *thread, const 
char *paramName,
                                ILExecThreadCall(thread, method, 
&resourceString,
                                                                 
resourceString);
                        }
-                       if(ILExecThreadHasException(thread))
+                       if(_ILExecThreadHasException(thread))
                        {
                                /* The string create or lookup threw an 
exception */
                                return;
@@ -146,7 +146,7 @@ void ILExecThreadThrowArgRange(ILExecThread *thread, const 
char *paramName,
 
        /* Convert the parameter name into a string */
        paramString = ILStringCreate(thread, paramName);
-       if(ILExecThreadHasException(thread))
+       if(_ILExecThreadHasException(thread))
        {
                /* The string create threw an exception */
                return;
@@ -166,9 +166,9 @@ void ILExecThreadThrowArgRange(ILExecThread *thread, const 
char *paramName,
                                                                 paramString);
        }
        _ILSetExceptionStackTrace(thread, object);
-       if(!ILExecThreadHasException(thread))
+       if(!_ILExecThreadHasException(thread))
        {
-               ILExecThreadSetException(thread, object);
+               _ILExecThreadSetException(thread, object);
        }
 }
 
@@ -178,14 +178,14 @@ void ILExecThreadThrowArgNull(ILExecThread *thread, const 
char *paramName)
        ILObject *object;
 
        /* Bail out if there already is a pending exception or if the thread is 
aborting */
-       if(ILExecThreadHasException(thread))
+       if(_ILExecThreadHasException(thread))
        {
                return;
        }
 
        /* Convert the parameter name into a string */
        paramString = ILStringCreate(thread, paramName);
-       if(ILExecThreadHasException(thread))
+       if(_ILExecThreadHasException(thread))
        {
                /* The string create threw an exception */
                return;
@@ -195,19 +195,20 @@ void ILExecThreadThrowArgNull(ILExecThread *thread, const 
char *paramName)
        object = ILExecThreadNew(thread, "System.ArgumentNullException",
                                                         "(ToSystem.String;)V", 
paramString);
        _ILSetExceptionStackTrace(thread, object);
-       if(!ILExecThreadHasException(thread))
+       if(!_ILExecThreadHasException(thread))
        {
-               ILExecThreadSetException(thread, object);
+               _ILExecThreadSetException(thread, object);
        }
 }
+
 void ILExecThreadThrowOutOfMemory(ILExecThread *thread)
 {
        /* Note: Eventhough the exception maybe of OutOfMemory, this may
         * be an accidental error */
        _ILSetExceptionStackTrace(thread, thread->process->outOfMemoryObject);
-       if(!ILExecThreadHasException(thread))
+       if(!_ILExecThreadHasException(thread))
        {
-               ILExecThreadSetException(thread, 
thread->process->outOfMemoryObject);
+               _ILExecThreadSetException(thread, 
thread->process->outOfMemoryObject);
        }
 }
 
@@ -251,8 +252,8 @@ void ILExecThreadPrintException(ILExecThread *thread)
 
        /* Get the exception object from the thread.  If there is no object,
           then assume that memory is exhausted */
-       exception = ILExecThreadGetException(thread);
-       ILExecThreadClearException(thread);
+       exception = _ILExecThreadGetException(thread);
+       _ILExecThreadClearException(thread);
        if(!exception)
        {
                exception = thread->process->outOfMemoryObject;
@@ -260,7 +261,7 @@ void ILExecThreadPrintException(ILExecThread *thread)
 
        /* Attempt to use "ToString" to format the exception, but not
           if we know that the exception is reporting out of memory */
-       if(exception != thread->process->outOfMemoryObject)             
+       if(exception != thread->process->outOfMemoryObject)
        {
                str = ILObjectToString(thread, exception);
                if(str != 0 && (ansistr = ILStringToAnsi(thread, str)) != 0)

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

Summary of changes:
 ChangeLog             |   30 ++++++++++++++++++++++++++++
 engine/call.c         |   12 +++++-----
 engine/cctormgr.c     |    9 ++++---
 engine/convert.c      |   12 +++++-----
 engine/custom.c       |    4 +-
 engine/cvm.c          |    8 +++---
 engine/cvm_call.c     |   10 ++++----
 engine/cvm_conv.c     |    4 +-
 engine/cvm_except.c   |   10 +++-----
 engine/engine.h       |   18 ++++++++++++++++-
 engine/heap.c         |   14 ++++++------
 engine/ilrun.c        |    4 +-
 engine/jitc.c         |   16 +++++++-------
 engine/lib_crypt.c    |    6 ++--
 engine/lib_delegate.c |   12 +++++-----
 engine/lib_object.c   |   14 ++++++------
 engine/lib_thread.c   |    6 ++--
 engine/lib_type.c     |    4 +-
 engine/pinvoke.c      |   10 ++++----
 engine/process.c      |   12 +++++-----
 engine/system.c       |   16 +++++++-------
 engine/thread.c       |    6 ++--
 engine/throw.c        |   51 +++++++++++++++++++++++++------------------------
 23 files changed, 167 insertions(+), 121 deletions(-)


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



reply via email to

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