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

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

[dotgnu-pnet-commits] pnet ChangeLog engine/jitc.c engine/jitc_except...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog engine/jitc.c engine/jitc_except...
Date: Sat, 16 Sep 2006 20:24:05 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      06/09/16 20:24:05

Modified files:
        .              : ChangeLog 
        engine         : jitc.c jitc_except.c lib_gc.c 

Log message:
        2006-09-16  Klaus Treichel  <address@hidden>
        
                * engine/jitc.c, engine/jitc_except.c: Move the thrownException 
in the
                thread to the currentException if an exception is thrown. The
                currentException is used only to prevent a collection of the 
exception
                object by the gc.
        
                * engine/lib_gc.c: Readd the ILGCFreePersistent of the 
handletable.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3359&r2=1.3360
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc.c?cvsroot=dotgnu-pnet&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_except.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_gc.c?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3359
retrieving revision 1.3360
diff -u -b -r1.3359 -r1.3360
--- ChangeLog   4 Sep 2006 18:07:30 -0000       1.3359
+++ ChangeLog   16 Sep 2006 20:24:04 -0000      1.3360
@@ -1,3 +1,12 @@
+2006-09-16  Klaus Treichel  <address@hidden>
+
+       * engine/jitc.c, engine/jitc_except.c: Move the thrownException in the
+       thread to the currentException if an exception is thrown. The
+       currentException is used only to prevent a collection of the exception
+       object by the gc.
+
+       * engine/lib_gc.c: Readd the ILGCFreePersistent of the handletable.
+
 2006-09-04  Klaus treichel  <address@hidden>
 
        * support/pt_defs.c: Add a default mutex attribute to make sure that 
fast

Index: engine/jitc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- engine/jitc.c       4 Sep 2006 10:11:30 -0000       1.47
+++ engine/jitc.c       16 Sep 2006 20:24:05 -0000      1.48
@@ -268,7 +268,6 @@
  */
 static ILJitType _ILJitSignature_ILJitDelegateGetClosure = 0;
 
-
 /*
  * Define offsetof macro if not present.
  */
@@ -1350,16 +1349,16 @@
  */
 void ILRuntimeExceptionRethrow(ILObject *object)
 {
+       if(object)
+       {
        ILExecThread *thread = ILExecThreadCurrent();
 
        if(thread)
        {
-               thread->thrownException = object;
-       }
-       if(object)
-       {
+                       thread->currentException = object;
                jit_exception_throw(object);
        }
+       }
 }
 
 /*
@@ -1367,21 +1366,19 @@
  */
 void ILRuntimeExceptionThrow(ILObject *object)
 {
-       ILExecThread *thread = ILExecThreadCurrent();
        System_Exception *exception = (System_Exception *)object;
 
-       if(thread)
-       {
-               thread->thrownException = object;
                if(exception)
                {
-                       exception->stackTrace = 
_ILJitGetExceptionStackTrace(thread);
-               }
-       }
-       if(exception)
+               ILExecThread *thread = ILExecThreadCurrent();
+
+               if(thread)
        {
+                       thread->currentException = (ILObject *)exception;
+                       exception->stackTrace = 
_ILJitGetExceptionStackTrace(thread);
                jit_exception_throw(exception);
        }
+       }
 }
 
 /*
@@ -1399,10 +1396,10 @@
        /* thrown an OutOfMenory exception then. */
        if(thread)
        {
-               thread->thrownException = (ILObject *)exception;
+               thread->currentException = (ILObject *)exception;
                exception->stackTrace = _ILJitGetExceptionStackTrace(thread);
-       }
        jit_exception_throw(exception);
+       }
 }
 
 /*
@@ -1411,12 +1408,11 @@
 void ILRuntimeExceptionThrowOutOfMemory()
 {
        ILExecThread *thread = ILExecThreadCurrent();
-       void *exception = 0;
 
        if(thread)
        {
-               thread->thrownException = thread->process->outOfMemoryObject;
-               jit_exception_throw(exception);
+               thread->currentException = thread->process->outOfMemoryObject;
+               jit_exception_throw(thread->currentException);
                return;
        }
        jit_exception_builtin(JIT_RESULT_OUT_OF_MEMORY);
@@ -1431,7 +1427,9 @@
        {
                if(_ILExecThreadSelfAborting(thread) == 0)
                {
-                       jit_exception_throw(thread->thrownException);
+                       thread->currentException = thread->thrownException;
+                       thread->thrownException = 0;
+                       jit_exception_throw(thread->currentException);
                }
        }
        else if(thread->managedSafePointFlags & 
_IL_MANAGED_SAFEPOINT_THREAD_SUSPEND)
@@ -1455,13 +1453,18 @@
        ILJitValue thrownException = jit_insn_load_relative(func, thread,
                                                                        
offsetof(ILExecThread, thrownException),
                                                                        
_IL_JIT_TYPE_VPTR);
+       ILJitValue nullException = jit_value_create_nint_constant(func,
+                                                                               
                                          _IL_JIT_TYPE_VPTR,
+                                                                               
                                      (jit_nint)0);
        jit_label_t label = jit_label_undefined;
 
        jit_insn_branch_if_not(func, thrownException, &label);
-       jit_insn_call_native(func, "jit_exception_clear_last",
-                                                               
jit_exception_clear_last,
-                                                               
_ILJitSignature_JitExceptionClearLast,
-                                                               0, 0, 
JIT_CALL_NOTHROW);
+       jit_insn_store_relative(func, thread, 
+                                                       offsetof(ILExecThread, 
currentException),
+                                                       thrownException);
+       jit_insn_store_relative(func, thread, 
+                                                       offsetof(ILExecThread, 
thrownException),
+                                                       nullException);
        jit_insn_throw(func, thrownException);
        jit_insn_label(func, &label);
 }
@@ -1936,7 +1939,7 @@
                }
                break;
        }
-       thread->thrownException = object;
+       thread->currentException = object;
        return object;
 }
 
@@ -1949,7 +1952,17 @@
        ILJitValue thrownException = jit_insn_load_relative(coder->jitFunction,
                                                                        thread,
                                                                        
offsetof(ILExecThread, thrownException), 
-                                                                       
jit_type_void_ptr);
+                                                                       
_IL_JIT_TYPE_VPTR);
+       ILJitValue nullException = 
jit_value_create_nint_constant(coder->jitFunction,
+                                                                               
                                          _IL_JIT_TYPE_VPTR,
+                                                                               
                                      (jit_nint)0);
+
+       jit_insn_store_relative(coder->jitFunction, thread, 
+                                                       offsetof(ILExecThread, 
currentException),
+                                                       thrownException);
+       jit_insn_store_relative(coder->jitFunction, thread, 
+                                                       offsetof(ILExecThread, 
thrownException),
+                                                       nullException);
        jit_insn_throw(coder->jitFunction, thrownException);
 }
 

Index: engine/jitc_except.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_except.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- engine/jitc_except.c        28 Jul 2006 17:41:54 -0000      1.9
+++ engine/jitc_except.c        16 Sep 2006 20:24:05 -0000      1.10
@@ -496,6 +496,7 @@
 {
        ILJITCoder *jitCoder = _ILCoderToILJITCoder(_coder);
        ILJitValue thread = _ILJitCoderGetThread(jitCoder);
+       ILJitValue currentException = (ILJitValue)(exception->ptrUserData);
        ILJitValue classTo = 
jit_value_create_nint_constant(jitCoder->jitFunction,
                                                                                
                                _IL_JIT_TYPE_VPTR,
                                                                                
                                (jit_nint)classInfo);
@@ -505,6 +506,7 @@
        ILJitValue nullException = 
jit_value_create_nint_constant(jitCoder->jitFunction,
                                                                                
                                          _IL_JIT_TYPE_VPTR,
                                                                                
                                      (jit_nint)0);
+
        ILJitValue exceptionObject;
        ILJitValue args[3];
        ILJitValue returnValue;
@@ -524,14 +526,18 @@
        }
 #endif
 
-       /* Get the current exception object. */
-       exceptionObject = jit_insn_load_relative(jitCoder->jitFunction, thread,
-                                                                               
         offsetof(ILExecThread, thrownException),
+       /* Get the thrown exception object. */
+       exceptionObject = jit_insn_load_relative(jitCoder->jitFunction,
+                                                                               
         thread,
+                                                                               
         offsetof(ILExecThread, currentException),
                                                                                
         _IL_JIT_TYPE_VPTR);
 
+       /* Save the thrown exception to the current exception block. */
+       jit_insn_store(jitCoder->jitFunction, currentException, 
exceptionObject);
+
        /* Look if the object can be casted to the cought exception type. */
        args[0] = method;
-       args[1] = exceptionObject;
+       args[1] = currentException;
        args[2] = classTo;
        returnValue = jit_insn_call_native(jitCoder->jitFunction,
                                                                           
"ILRuntimeCanCastClass",
@@ -541,21 +547,21 @@
        jit_insn_branch_if_not(jitCoder->jitFunction, returnValue, &label);
 
        /* Save the exception in the threadAbortException if it is one. */
-       _ILJitSetThreadAbortException(jitCoder, thread, exceptionObject);
+       _ILJitSetThreadAbortException(jitCoder, thread, currentException);
 
        /* Push the exception object on the stack. */
-       jitCoder->jitStack[0] = exceptionObject;
+       jitCoder->jitStack[0] = currentException;
        jitCoder->stackTop = 1;
        catchBlock = _ILJitLabelGet(jitCoder, exception->handlerOffset,
                                                                                
  _IL_JIT_LABEL_STARTCATCH);
 
-       jit_insn_store_relative(jitCoder->jitFunction, thread, 
-                                                       offsetof(ILExecThread, 
thrownException),
-                                                       nullException);
        jit_insn_call_native(jitCoder->jitFunction, "jit_exception_clear_last",
                                                                                
                jit_exception_clear_last,
                                                                                
                _ILJitSignature_JitExceptionClearLast,
                                                                                
                0, 0, JIT_CALL_NOTHROW);
+       jit_insn_store_relative(jitCoder->jitFunction, thread, 
+                                                       offsetof(ILExecThread, 
currentException),
+                                                       nullException);
        jit_insn_branch(jitCoder->jitFunction, &(catchBlock->label));
        jit_insn_label(jitCoder->jitFunction, &label);
 }

Index: engine/lib_gc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_gc.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- engine/lib_gc.c     4 Sep 2006 18:07:30 -0000       1.11
+++ engine/lib_gc.c     16 Sep 2006 20:24:05 -0000      1.12
@@ -565,6 +565,7 @@
                /* Destroy the object lock */
                ILMutexDestroy(table->lock);
        }
+       ILGCFreePersistent(table);
 }
 
 #endif /* IL_CONFIG_RUNTIME_INFRA */




reply via email to

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