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. ffd0bc555ec5a1f20267c27e0a8d0f20274596cd
Date: Sun, 16 Jan 2011 14:19:50 +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  ffd0bc555ec5a1f20267c27e0a8d0f20274596cd (commit)
      from  fa723edc0cb4c1cd6ce7579c70829ba3f850cd09 (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=ffd0bc555ec5a1f20267c27e0a8d0f20274596cd

commit ffd0bc555ec5a1f20267c27e0a8d0f20274596cd
Author: Klaus Treichel <address@hidden>
Date:   Sun Jan 16 15:19:33 2011 +0100

    More optimizations for exception handling (mostly cvm) and fix of
    thread abort handling with jit coder.

diff --git a/ChangeLog b/ChangeLog
index f99d847..e953c4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2011-01-16  Klaus Treichel  <address@hidden>
+
+       * include/il_coder.h: Add ILCoderExceptions and hasRethrow arguments
+       to the coder setup function. This function has to setup the exception
+       handling now too.
+       Remove the setupExceptions function.
+
+       * engine/cvmc.c: Remove the unused needTry member fron the cvm coder.
+       Introduce the IL_CVMC_DECLARATIONS and IL_CVMC_FUNCTIONS defines to
+       allow inclusion of parts of coder sources at defined places.
+       Remove CVMCoder_SetupExceptions from the cvm coder instance.
+
+       * engine/cvmc_except.c (CVMCoder_SetupExceptions): Rename function to
+       CVMEntrySetupExceptions and add only the locals needed to the
+       CVMEntryContext.
+
+       * engine/cvmc_setup.c (CVMCoder_Setup): Call CVMEntrySetupExceptions
+       after allocating the locals so that the space for locals and excepion
+       slots will be allocated with one operation.
+       Create the cache region now in this function too if there are any
+       exception blocks.
+
+       * engine/jitc.c: Remove JITCoder_SetupExceptions from the jit coder
+       instance.
+
+       * engine/jitc_except.c (JITCoder_SetupExceptions): Rename to
+       SetupExceptions.
+       Move block with initialization of the values needed for exception
+       handling to the start of the function.
+       (JITCoder_LeaveCatch): Reset the flag for handling of a thread abort
+       now before rethrowing the thread abort exception.
+       (JITCoder_OutputExceptionTable): Fix the handling of a thread abort.
+
+       * engine/jitc_setup.c (JITCoder_Setup): Add call to SetupExceptions.
+
+       * engine/null_coder.c (Coder_Setup): Add new arguments.
+       (Coder_SetupExceptions): Remove.
+       Remove Coder_SetupExceptions from the null coder instance.
+
+       * engine/verify.c (_ILVerify): Move calls to ILCoderSetup and
+       ILCoderProfileStart just before the start code verification after
+       coder exception setup and label verification is done.
+       Remove the call to ILCoderSetupExceptions.
+
 2011-01-09  Klaus Treichel  <address@hidden>
 
        * engine/engine.h: Add macros for accessing the current thrown
diff --git a/engine/cvmc.c b/engine/cvmc.c
index 50997c0..3707c4e 100644
--- a/engine/cvmc.c
+++ b/engine/cvmc.c
@@ -69,7 +69,6 @@ struct _tagILCVMCoder
        ILCachePosn             codePosn;
        unsigned char  *start;
        unsigned char  *stackCheck;
-       int                             needTry;
        unsigned char  *tryHandler;
        long                    height;
        long                    minHeight;
@@ -102,6 +101,10 @@ struct _tagILCVMCoder
 #endif
 };
 
+#define        IL_CVMC_DECLARATIONS
+#include "cvmc_setup.c"
+#undef IL_CVMC_DECLARATIONS
+
 /*
  * Convert a pointer to an ILCoder to a pointer to the ILCVMVoder instance
  */
@@ -152,6 +155,11 @@ static ILUInt32 GetStackTypeSize(ILExecProcess *process, 
ILType *type)
        return (size + sizeof(CVMWord) - 1) / sizeof(CVMWord);
 }
 
+#define IL_CVMC_FUNCTIONS
+#include "cvmc_setup.c"
+#include "cvmc_except.c"
+#undef IL_CVMC_FUNCTIONS
+
 /*
  * Create a new CVM coder instance.
  */
@@ -177,7 +185,6 @@ static ILCoder *CVMCoder_Create(ILExecProcess *process, 
ILUInt32 size,
        }
        coder->start = 0;
        coder->stackCheck = 0;
-       coder->needTry = 0;
        coder->tryHandler = 0;
        coder->height = 0;
        coder->minHeight = 0;
@@ -587,7 +594,6 @@ ILCoderClass const _ILCVMCoderClass =
        CVMCoder_LoadFuncAddr,
        CVMCoder_LoadVirtualAddr,
        CVMCoder_LoadInterfaceAddr,
-       CVMCoder_SetupExceptions,
        CVMCoder_Throw,
        CVMCoder_SetStackTrace,
        CVMCoder_Rethrow,
diff --git a/engine/cvmc_except.c b/engine/cvmc_except.c
index 3db0635..f3bb7fa 100644
--- a/engine/cvmc_except.c
+++ b/engine/cvmc_except.c
@@ -19,23 +19,21 @@
  */
 #include "cvm_format.h"
 
-#ifdef IL_CVMC_CODE
+#ifdef IL_CVMC_FUNCTIONS
 
 /*
- * Set up exception handling for the current method.
+ * Allocate extra local variables needed for exception handling.
  */
-static void CVMCoder_SetupExceptions(ILCoder *_coder, ILCoderExceptions 
*exceptions,
-                                                                        int 
hasRethrow)
+static void CVMEntrySetupExceptions(CVMEntryContext *ctx, ILCVMCoder *coder,
+                                                                       
ILCoderExceptions *exceptions)
 {
-       ILCVMCoder *coder = (ILCVMCoder *)_coder;
-       ILCoderExceptionBlock *exception;
-       ILUInt32 index;
-       ILUInt32 extraLocals;
-
-
-       extraLocals = 0;
        if(exceptions->numBlocks > 0)
        {
+               ILCoderExceptionBlock *exception;
+               ILUInt32 index;
+               ILUInt32 offset;
+
+               offset = ctx->numLocalWords + ctx->numArgWords;
                index = 0;
                while(index < exceptions->numBlocks)
                {
@@ -45,46 +43,20 @@ static void CVMCoder_SetupExceptions(ILCoder *_coder, 
ILCoderExceptions *excepti
                        {
                                
if(exception->un.handlerBlock.tryBlock->userData == IL_MAX_UINT32)
                                {
-                                       
exception->un.handlerBlock.tryBlock->userData = extraLocals + coder->minHeight;
-                                       ++extraLocals;
+                                       
exception->un.handlerBlock.tryBlock->userData = offset;
+                                       ++offset;
                                }
                                exception->userData = 
exception->un.handlerBlock.tryBlock->userData;
                        }
-                       else
-                       {
-                               /*
-                                * TODO: Look for the first parent catch block 
and use it's exception slot
-                                */
-                       }
                        ++index;
                }
-               if(extraLocals == 1)
-               {
-                       CVM_OUT_NONE(COP_MK_LOCAL_1);
-               }
-               else if(extraLocals == 2)
-               {
-                       CVM_OUT_NONE(COP_MK_LOCAL_2);
-               }
-               else if(extraLocals == 3)
-               {
-                       CVM_OUT_NONE(COP_MK_LOCAL_3);
-               }
-               else if(extraLocals != 0)
-               {
-                       CVM_OUT_WIDE(COP_MK_LOCAL_N, extraLocals);
-               }
-               coder->height += extraLocals;
-               coder->minHeight += extraLocals;
-               coder->maxHeight += extraLocals;
+               ctx->numLocalWords = offset - ctx->numArgWords;
        }
+}
 
-       /* Start the method's primary exception region here */
-       ILCacheNewRegion(&(coder->codePosn), (void *)0);
+#endif
 
-       /* Set up the method's frame to perform exception handling */
-       coder->needTry = 1;
-}
+#ifdef IL_CVMC_CODE
 
 /*
  * Output a throw instruction.
diff --git a/engine/cvmc_setup.c b/engine/cvmc_setup.c
index 9047db0..affd5bf 100644
--- a/engine/cvmc_setup.c
+++ b/engine/cvmc_setup.c
@@ -18,7 +18,30 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef IL_CVMC_CODE
+
+#ifdef IL_CVMC_DECLARATIONS
+
+/*
+ * Context structure for outputting entry point code.
+ */
+typedef struct _tagCVMEntryContext
+{
+       ILUInt32        thisAdjust;                     /* Value to adjust for 
"this" words */
+       ILUInt32        numArgWords;            /* Number of argument words */
+       ILUInt32        numLocals;                      /* Number of declared 
local variables */
+       ILUInt32        numLocalWords;          /* Number of declared local 
words */
+       ILUInt32        extraLocals;            /* Extra locals for special 
purposes */
+       ILUInt32        extraOffset;            /* Allocation offset for extra 
locals */
+       int                     firstExtraIsTop;        /* First extra is 
top-most on stack */
+       int                     nativeArg;                      /* Current 
native argument */
+       ILUInt32        nativeArgWords;         /* Number of native arguments 
on stack */
+       ILUInt32        returnOffset;           /* Offset of native return 
value */
+
+} CVMEntryContext;
+
+#endif
+
+#ifdef IL_CVMC_FUNCTIONS
 /*#define DONT_UNROLL_SYSTEM */
 
 /*
@@ -62,24 +85,6 @@
                        } while (0)
 
 /*
- * Context structure for outputting entry point code.
- */
-typedef struct _tagCVMEntryContext
-{
-       ILUInt32        thisAdjust;                     /* Value to adjust for 
"this" words */
-       ILUInt32        numArgWords;            /* Number of argument words */
-       ILUInt32        numLocals;                      /* Number of declared 
local variables */
-       ILUInt32        numLocalWords;          /* Number of declared local 
words */
-       ILUInt32        extraLocals;            /* Extra locals for special 
purposes */
-       ILUInt32        extraOffset;            /* Allocation offset for extra 
locals */
-       int                     firstExtraIsTop;        /* First extra is 
top-most on stack */
-       int                     nativeArg;                      /* Current 
native argument */
-       ILUInt32        nativeArgWords;         /* Number of native arguments 
on stack */
-       ILUInt32        returnOffset;           /* Offset of native return 
value */
-
-} CVMEntryContext;
-
-/*
  * Initialize an entry context.
  */
 static void CVMEntryInit(CVMEntryContext *ctx)
@@ -1238,11 +1243,16 @@ static void CVMEntryCallNative(CVMEntryContext *ctx, 
ILCVMCoder *coder,
        }
 }
 
+#endif /* IL_CVMC_FUNCTIONS */
+
+#ifdef IL_CVMC_CODE
+
 /*
  * Set up a CVM coder instance to process a specific method.
  */
 static int CVMCoder_Setup(ILCoder *_coder, unsigned char **start,
-                                                 ILMethod *method, 
ILMethodCode *code)
+                                                 ILMethod *method, 
ILMethodCode *code,
+                                                 ILCoderExceptions 
*exceptions, int hasRethrow)
 {
        ILCVMCoder *coder = ((ILCVMCoder *)_coder);
        ILType *signature = ILMethod_Signature(method);
@@ -1266,6 +1276,9 @@ static int CVMCoder_Setup(ILCoder *_coder, unsigned char 
**start,
                return 0;
        }
 
+       /* Allocate locals needed for exception handling */
+       CVMEntrySetupExceptions(&ctx, coder, exceptions);
+
 #ifdef IL_DEBUGGER
        /* Check if this method can be debugged */
        debugger = ILDebuggerFromProcess(coder->process);
@@ -1276,8 +1289,17 @@ static int CVMCoder_Setup(ILCoder *_coder, unsigned char 
**start,
        ILCCtorMgr_SetCurrentMethod(&(coder->cctorMgr), method);
 
        /* Generate the entry point code */
-       return CVMEntryGen(&ctx, coder, method, signature,
-                                          ILMethod_IsConstructor(method), 1, 
start, 1);
+       if(CVMEntryGen(&ctx, coder, method, signature,
+                                  ILMethod_IsConstructor(method), 1, start, 1))
+       {
+               if(exceptions->numBlocks > 0)
+               {
+                       /* Start the method's primary exception region here */
+                       ILCacheNewRegion(&(coder->codePosn), (void *)0);
+               }
+               return 1;
+       }
+       return 0;
 }
 
 /*
diff --git a/engine/jitc.c b/engine/jitc.c
index 7236300..c523c89 100755
--- a/engine/jitc.c
+++ b/engine/jitc.c
@@ -5150,7 +5150,6 @@ ILCoderClass const _ILJITCoderClass =
        JITCoder_LoadFuncAddr,
        JITCoder_LoadVirtualAddr,
        JITCoder_LoadInterfaceAddr,
-       JITCoder_SetupExceptions,
        JITCoder_Throw,
        JITCoder_SetStackTrace,
        JITCoder_Rethrow,
diff --git a/engine/jitc_except.c b/engine/jitc_except.c
index af4f7cf..280fc60 100644
--- a/engine/jitc_except.c
+++ b/engine/jitc_except.c
@@ -285,22 +285,19 @@ static jit_label_t 
*GetNextTryBlockStartLabel(ILCoderExceptions *coderExceptions
        return GetNextParentHandlerLabel(coderExceptions, coderException);
 }
 
-#endif /* IL_JITC_FUNCTIONS */
-
-#ifdef IL_JITC_CODE
-
 /*
  * Set up exception handling for the current method.
  */
-static void JITCoder_SetupExceptions(ILCoder *_coder,
-                                                                        
ILCoderExceptions *exceptions,
-                                                                        int 
hasRethrow)
+static void SetupExceptions(ILJITCoder *jitCoder,
+                                                       ILCoderExceptions 
*exceptions,
+                                                       int hasRethrow)
 {
-       ILJITCoder *jitCoder = _ILCoderToILJITCoder(_coder);
        ILJitValue nullPointer;
        ILJitValue nullInt32;
        int currentException;
        int currentCatchBlock;
+       jit_label_t startLabel;
+       jit_label_t endLabel;
 
        if(exceptions->numBlocks == 0)
        {
@@ -319,14 +316,16 @@ static void JITCoder_SetupExceptions(ILCoder *_coder,
        }
 #endif
 
-       /* Setup the jit function to handle exceptions. */
-       jit_insn_uses_catcher(jitCoder->jitFunction);
-       jitCoder->nextBlock = jit_label_undefined;
-       jitCoder->rethrowBlock = jit_label_undefined;
-
        /*
         * Initialize the values needed for exception handling.
         */
+       startLabel = jit_label_undefined;
+       endLabel = jit_label_undefined;
+       if(!jit_insn_label(jitCoder->jitFunction, &startLabel))
+       {
+               return;
+       }
+
        nullPointer = jit_value_create_nint_constant(jitCoder->jitFunction,
                                                                                
                 _IL_JIT_TYPE_VPTR,
                                                                                
                 (jit_nint)0);
@@ -338,7 +337,32 @@ static void JITCoder_SetupExceptions(ILCoder *_coder,
        jitCoder->abortBlock = jit_value_create(jitCoder->jitFunction, 
_IL_JIT_TYPE_INT32);
        jit_insn_store(jitCoder->jitFunction, jitCoder->abortBlock, nullInt32);
        jitCoder->aborting = jit_value_create(jitCoder->jitFunction, 
_IL_JIT_TYPE_INT32);
-       jit_insn_store(jitCoder->jitFunction, jitCoder->abortBlock, nullInt32);
+       jit_insn_store(jitCoder->jitFunction, jitCoder->aborting, nullInt32);
+
+       /*
+        * Create a new block for the end label. This should be done
+        * by jit_insn_label anyways but it doesn't hurt.
+        */
+       if(!jit_insn_new_block(jitCoder->jitFunction))
+       {
+               return;
+       }
+
+       if(!jit_insn_label(jitCoder->jitFunction, &endLabel))
+       {
+               return;
+       }
+
+       if(!jit_insn_move_blocks_to_start(jitCoder->jitFunction, startLabel,
+                                                                         
endLabel))
+       {
+               return;
+       }
+
+       /* Setup the jit function to handle exceptions. */
+       jit_insn_uses_catcher(jitCoder->jitFunction);
+       jitCoder->nextBlock = jit_label_undefined;
+       jitCoder->rethrowBlock = jit_label_undefined;
 
        /*
         * Setup the labels for the entries of the exception blocks.
@@ -454,6 +478,10 @@ static void JITCoder_SetupExceptions(ILCoder *_coder,
        }
 }
 
+#endif /* IL_JITC_FUNCTIONS */
+
+#ifdef IL_JITC_CODE
+
 /*
  * Output a throw instruction.
  */
@@ -626,7 +654,12 @@ static void JITCoder_LeaveCatch(ILCoder *coder,
                                                                  
jit_type_sys_int);
        label1 = jit_label_undefined;
        jit_insn_branch_if_not(jitCoder->jitFunction, temp, &label1);
-       /* If it still aborting then rethrow the thread abort exception. */
+       /* If it still aborting then reset the aborting flag */
+       temp = jit_value_create_nint_constant(jitCoder->jitFunction,
+                                                                               
  _IL_JIT_TYPE_INT32,
+                                                                               
 0);
+       jit_insn_store(jitCoder->jitFunction, jitCoder->aborting, temp);
+       /* and rethrow the thread abort exception. */
        jit_insn_call_native(jitCoder->jitFunction,
                                                 "ILRuntimeExceptionRethrow",
                                                 ILRuntimeExceptionRethrow,
@@ -679,46 +712,39 @@ static void JITCoder_OutputExceptionTable(ILCoder *coder,
                                                        offsetof(ILExecThread, 
thrownException),
                                                        nullException);
 
-
        temp = jit_value_create_nint_constant(jitCoder->jitFunction,
                                                                                
  _IL_JIT_TYPE_INT32, 0);
        newAbortException = jit_value_create(jitCoder->jitFunction,
                                                                                
 _IL_JIT_TYPE_INT32);
        jit_insn_store(jitCoder->jitFunction, newAbortException, temp);
 
-       /* Check if we have to handle a new thread abort. */
+       /* Check if we have to handle a thread abort. */
        label = jit_label_undefined;
        /*
-        * First check if we are not alteady handling a thread abort.
+        * First check if we are not allready handling a thread abort.
+        */
+       jit_insn_branch_if(jitCoder->jitFunction, jitCoder->aborting, &label);
+       /*
+        * If we dont handle a thread abort check if the thread is aborting.
         */
-       jit_insn_branch_if_not(jitCoder->jitFunction,
-                                                  jitCoder->aborting,
-                                                  &label);
        temp = jit_insn_load_relative(jitCoder->jitFunction, thread,
                                                                  
offsetof(ILExecThread, aborting),
                                                                  
jit_type_sys_int);
-       /*
-        * Then check if the thread is aborting.
-        */
        jit_insn_branch_if_not(jitCoder->jitFunction,
                                                   temp, &label);
        /*
-        * Check if the exception is a threadAbortException.
+        * If the thread is aborting check if the exception is a 
threadAbortException.
         */
        threadAbortExceptionClass = 
jit_value_create_nint_constant(jitCoder->jitFunction,
                                                                                
                                           _IL_JIT_TYPE_VPTR,
                                                                                
                                           
(jit_nint)jitCoder->process->threadAbortClass);
-
-       /* Get the class of the current exception */
        exceptionClass = _ILJitGetObjectClass(jitCoder->jitFunction, 
exceptionObject);
-
-       /* Is the class not the ThreadAbortException class ? */
-       temp = jit_insn_ne(jitCoder->jitFunction,
+       temp = jit_insn_eq(jitCoder->jitFunction,
                                           exceptionClass,
                                           threadAbortExceptionClass);
 
        /* If it's not then this exception is thrown while handling an abort. */
-       jit_insn_branch_if(jitCoder->jitFunction, temp, &label);
+       jit_insn_branch_if_not(jitCoder->jitFunction, temp, &label);
 
        /* Otherwise store the current exception object for later use */
        jit_insn_store(jitCoder->jitFunction, jitCoder->threadAbortException, 
exceptionObject);
@@ -804,7 +830,8 @@ static void JITCoder_OutputExceptionTable(ILCoder *coder,
                        currentExceptionBlock = 
jit_value_create_nint_constant(jitCoder->jitFunction,
                                                                                
                                                   _IL_JIT_TYPE_INT32,
                                                                                
                                                   
currentCoderException->userData);
-                       jit_insn_store(jitCoder->jitFunction, 
jitCoder->abortBlock, currentExceptionBlock);
+                       jit_insn_store(jitCoder->jitFunction, 
jitCoder->abortBlock,
+                                                  currentExceptionBlock);
                        jit_insn_label(jitCoder->jitFunction, &label);
                        coderException = 
currentCoderException->un.tryBlock.handlerBlock;
                        while(coderException)
@@ -863,7 +890,8 @@ static void JITCoder_OutputExceptionTable(ILCoder *coder,
                                                                                
                                   ILRuntimeCanCastClass,
                                                                                
                                   _ILJitSignature_ILRuntimeCanCastClass,
                                                                                
                                   args, 3, JIT_CALL_NOTHROW);
-                                               
jit_insn_branch_if_not(jitCoder->jitFunction, returnValue, notHandledLabel);
+                                               
jit_insn_branch_if_not(jitCoder->jitFunction,
+                                                                               
           returnValue, notHandledLabel);
                                                /*
                                                 * Save the current exception 
for a possible rethrow.
                                                 */
@@ -906,7 +934,8 @@ static void JITCoder_OutputExceptionTable(ILCoder *coder,
                        currentExceptionBlock = 
jit_value_create_nint_constant(jitCoder->jitFunction,
                                                                                
                                                   _IL_JIT_TYPE_INT32,
                                                                                
                                                   
currentCoderException->userData);
-                       temp = jit_insn_eq(jitCoder->jitFunction, 
jitCoder->abortBlock, currentExceptionBlock);
+                       temp = jit_insn_eq(jitCoder->jitFunction, 
jitCoder->abortBlock,
+                                                          
currentExceptionBlock);
                        jit_insn_branch_if_not(jitCoder->jitFunction, temp, 
&label);
                        /*
                         * The thread abort was last handled here.
@@ -926,7 +955,8 @@ static void JITCoder_OutputExceptionTable(ILCoder *coder,
                        /*
                         * And set the new thread abort again.
                         */
-                       temp = 
jit_value_create_nint_constant(jitCoder->jitFunction, _IL_JIT_TYPE_INT32, 1);
+                       temp = 
jit_value_create_nint_constant(jitCoder->jitFunction,
+                                                                               
                  _IL_JIT_TYPE_INT32, 1);
                        jit_insn_store(jitCoder->jitFunction, 
newAbortException, temp);
                        jit_insn_branch(jitCoder->jitFunction, &label);
                        jit_insn_label(jitCoder->jitFunction, &label1);
@@ -979,9 +1009,21 @@ static void JITCoder_OutputExceptionTable(ILCoder *coder,
        /*
         * Restore the thrown exception and throw it to the caller.
         */
+       label = jit_label_undefined;
+       label1 = jit_label_undefined;
+       /*
+        * If the thread is aborting then rethrow the thread_abort_exception.
+        */
+       jit_insn_branch_if_not(jitCoder->jitFunction, jitCoder->aborting, 
&label);
+       jit_insn_store_relative(jitCoder->jitFunction, thread,
+                                                       offsetof(ILExecThread, 
thrownException),
+                                                       
jitCoder->threadAbortException);
+       jit_insn_branch(jitCoder->jitFunction, &label1);
+       jit_insn_label(jitCoder->jitFunction, &label);
        jit_insn_store_relative(jitCoder->jitFunction, thread,
                                                        offsetof(ILExecThread, 
thrownException),
                                                        exceptionObject);
+       jit_insn_label(jitCoder->jitFunction, &label1);
        jit_insn_rethrow_unhandled(jitCoder->jitFunction);
 }
 
diff --git a/engine/jitc_setup.c b/engine/jitc_setup.c
index 97dcbe0..761715f 100644
--- a/engine/jitc_setup.c
+++ b/engine/jitc_setup.c
@@ -24,7 +24,9 @@
  * Set up a JIT coder instance to process a specific method.
  */
 static int JITCoder_Setup(ILCoder *_coder, unsigned char **start,
-                                                 ILMethod *method, 
ILMethodCode *code)
+                                                 ILMethod *method, 
ILMethodCode *code,
+                                                 ILCoderExceptions 
*coderExceptions,
+                                                 int hasRethrow)
 {
        ILJITCoder *coder = ((ILJITCoder *)_coder);
 #ifdef IL_DEBUGGER
@@ -116,6 +118,9 @@ static int JITCoder_Setup(ILCoder *_coder, unsigned char 
**start,
        /* Reset the isInCatcher flag. */
        coder->isInCatcher = 0;
 
+       /* Setup exception handling */
+       SetupExceptions(coder, coderExceptions, hasRethrow);
+
        return 1;
 }
 
diff --git a/engine/null_coder.c b/engine/null_coder.c
index da85594..b2996ca 100644
--- a/engine/null_coder.c
+++ b/engine/null_coder.c
@@ -45,7 +45,9 @@ static unsigned long Coder_GetCacheSize(ILCoder *coder)
        return 0;
 }
 static int Coder_Setup(ILCoder *coder, unsigned char **start,
-                                          ILMethod *method, ILMethodCode *code)
+                                          ILMethod *method, ILMethodCode *code,
+                                          ILCoderExceptions *coderExceptions,
+                                          int hasRethrow)
 {
        return 1;
 }
@@ -336,11 +338,6 @@ static void Coder_LoadVirtualAddr(ILCoder *coder, ILMethod 
*methodInfo)
 static void Coder_LoadInterfaceAddr(ILCoder *coder, ILMethod *methodInfo)
 {
 }
-static void Coder_SetupExceptions(ILCoder *coder,
-                                                                 
ILCoderExceptions *exceptions,
-                                                                 int 
hasRethrow)
-{
-}
 static void Coder_Throw(ILCoder *coder, int inCurrentMethod)
 {
 }
@@ -541,7 +538,6 @@ ILCoderClass const _ILNullCoderClass = {
        Coder_LoadFuncAddr,
        Coder_LoadVirtualAddr,
        Coder_LoadInterfaceAddr,
-       Coder_SetupExceptions,
        Coder_Throw,
        Coder_SetStackTrace,
        Coder_Rethrow,
diff --git a/engine/verify.c b/engine/verify.c
index ee9e8f3..b7a8572 100644
--- a/engine/verify.c
+++ b/engine/verify.c
@@ -1160,7 +1160,7 @@ int _ILVerify(ILCoder *coder, unsigned char **start, 
ILMethod *method,
                }
                if(isSynchronized)
                {
-                       /* We'll need an extra try and flnally block for 
synchronization */
+                       /* We'll need an extra try and fault block for 
synchronization */
                        ++numHandlers;
                }
                /*
@@ -1271,17 +1271,6 @@ restart:
        /* Reset the prefix information */
        ILMemZero(&prefixInfo, sizeof(ILCoderPrefixInfo));
 
-       /* Set up the coder to process the method */
-       if(!ILCoderSetup(coder, start, method, code))
-       {
-               VERIFY_MEMORY_ERROR();
-       }
-
-       if((coderFlags & IL_CODER_FLAG_METHOD_PROFILE) != 0)
-       {
-               ILCoderProfileStart(coder);
-       }
-
        /* Allocate the jump target mask */
        jumpMask = (unsigned long *)TempAllocate
                                        (&allocator, 
BYTES_FOR_MASK(code->codeLen + extraCodeLen));
@@ -1562,10 +1551,15 @@ restart:
                numLocals = 0;
        }
 
-       /* Set up for exception handling if necessary */
-       if(exceptions || isSynchronized)
+       /* Set up the coder to process the method */
+       if(!ILCoderSetup(coder, start, method, code, &coderExceptions, 
hasRethrow))
        {
-               ILCoderSetupExceptions(coder, &coderExceptions, hasRethrow);
+               VERIFY_MEMORY_ERROR();
+       }
+
+       if((coderFlags & IL_CODER_FLAG_METHOD_PROFILE) != 0)
+       {
+               ILCoderProfileStart(coder);
        }
 
        /* Verify the code */
diff --git a/include/il_coder.h b/include/il_coder.h
index da5eebd..706bad2 100644
--- a/include/il_coder.h
+++ b/include/il_coder.h
@@ -293,7 +293,9 @@ struct _tagILCoderClass
         * returned in "*start".
         */
        int (*setup)(ILCoder *coder, unsigned char **start,
-                                ILMethod *method, ILMethodCode *code);
+                                ILMethod *method, ILMethodCode *code,
+                                ILCoderExceptions *coderExceptions,
+                                int hasRethrow);
 
        /*
         * Set up a coder instance for processing a specific external method.
@@ -760,12 +762,6 @@ struct _tagILCoderClass
        void (*loadInterfaceAddr)(ILCoder *coder, ILMethod *methodInfo);
 
        /*
-        * Set up exception handling for the current method.
-        */
-       void (*setupExceptions)(ILCoder *coder, ILCoderExceptions 
*coderExceptions,
-                                                       int hasRethrow);
-
-       /*
         * Throw an exception.  If "inCurrentMethod" is non-zero,
         * then there is a catch block in the current method that
         * surrounds the current code position.  If "inCurrentMethod"
@@ -981,8 +977,10 @@ struct _tagILCoderClass
                        ((*((coder)->classInfo->alloc))((coder), (size)))
 #define        ILCoderGetCacheSize(coder)      \
                        ((*((coder)->classInfo->getCacheSize))((coder)))
-#define        ILCoderSetup(coder,start,method,code) \
-                       ((*((coder)->classInfo->setup))((coder), (start), 
(method), (code)))
+#define        ILCoderSetup(coder,start,method,code,exceptions,hasRethrow) \
+                       ((*((coder)->classInfo->setup))((coder), (start), 
(method), \
+                                                                               
        (code), (exceptions), \
+                                                                               
        (hasRethrow)))
 #define        ILCoderSetupExtern(coder,start,method,fn,cif,isInternal) \
                        ((*((coder)->classInfo->setupExtern))((coder), (start), 
(method), \
                                                                                
                  (fn), (cif), (isInternal)))
@@ -1190,9 +1188,6 @@ struct _tagILCoderClass
                        ((*((coder)->classInfo->loadVirtualAddr))((coder), 
(methodInfo)))
 #define        ILCoderLoadInterfaceAddr(coder,methodInfo) \
                        ((*((coder)->classInfo->loadInterfaceAddr))((coder), 
(methodInfo)))
-#define        ILCoderSetupExceptions(coder,exceptions,hasRethrow) \
-                       ((*((coder)->classInfo->setupExceptions))((coder), 
(exceptions), \
-                                                                               
                          (hasRethrow)))
 #define        ILCoderThrow(coder,inCurrent) \
                        ((*((coder)->classInfo->throwException))((coder), 
(inCurrent)))
 #define        ILCoderSetStackTrace(coder) \

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

Summary of changes:
 ChangeLog            |   44 +++++++++++++++++++
 engine/cvmc.c        |   12 ++++-
 engine/cvmc_except.c |   58 +++++++-------------------
 engine/cvmc_setup.c  |   66 +++++++++++++++++++----------
 engine/jitc.c        |    1 -
 engine/jitc_except.c |  112 ++++++++++++++++++++++++++++++++++----------------
 engine/jitc_setup.c  |    7 +++-
 engine/null_coder.c  |   10 +---
 engine/verify.c      |   24 ++++-------
 include/il_coder.h   |   19 +++-----
 10 files changed, 214 insertions(+), 139 deletions(-)


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



reply via email to

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