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_setup.c


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc_setup.c
Date: Sun, 28 May 2006 10:50:16 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnet
Branch:         
Changes by:     Aleksey Demakov <address@hidden>        06/05/28 10:50:16

Modified files:
        .              : ChangeLog 
        engine         : jitc_setup.c 

Log message:
        make sure that static ctor once check is executed before setjmp setup 
block

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/ChangeLog.diff?tr1=1.3318&tr2=1.3319&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_setup.c.diff?tr1=1.15&tr2=1.16&r1=text&r2=text

Patches:
Index: pnet/ChangeLog
diff -u pnet/ChangeLog:1.3318 pnet/ChangeLog:1.3319
--- pnet/ChangeLog:1.3318       Sat May 27 12:10:50 2006
+++ pnet/ChangeLog      Sun May 28 10:50:16 2006
@@ -1,3 +1,10 @@
+2006-05-28  Aleksey Demakov  <address@hidden>
+
+       * engine/jitc_setup.c (JITCoder_Setup): move static ctor once check
+       block to the function start so it will be exceuted before any other
+       blocks that also could be moved to the start. This prevents the
+       corruption of setjmp stack in static constructors with try/catch.
+
 2006-05-27  Klaus Treichel  <address@hidden>
 
        * engine/jitc.c: Mobe the inclusion of jitc_alloc.c just before
Index: pnet/engine/jitc_setup.c
diff -u pnet/engine/jitc_setup.c:1.15 pnet/engine/jitc_setup.c:1.16
--- pnet/engine/jitc_setup.c:1.15       Thu May 18 19:34:31 2006
+++ pnet/engine/jitc_setup.c    Sun May 28 10:50:16 2006
@@ -86,28 +86,40 @@
        if(ILMethod_IsStaticConstructor(method))
        {
                /* We have to take care that the method is executed only once. 
*/
-               ILClass *info = ILMethod_Owner(method);
-               ILJitValue classInfo = 
-                       jit_value_create_nint_constant(coder->jitFunction,
+               ILClass *info;
+               ILJitValue classInfo;
+               ILJitValue cctorOnce;
+               ILJitValue attributes;
+               ILJitValue temp;
+               jit_label_t startLabel = jit_label_undefined;
+               jit_label_t endLabel = jit_label_undefined;
+               jit_label_t label1 = jit_label_undefined;
+
+               jit_insn_label(coder->jitFunction, &startLabel);
+
+               info = ILMethod_Owner(method);
+               classInfo = jit_value_create_nint_constant(coder->jitFunction,
                                                                                
   _IL_JIT_TYPE_VPTR,
                                                                                
   (jit_nint)info);
-               ILJitValue cctorOnce = 
-                       jit_value_create_nint_constant(coder->jitFunction,
+               cctorOnce = jit_value_create_nint_constant(coder->jitFunction,
                                                                                
   _IL_JIT_TYPE_UINT32,
                                                                                
   (jit_nint)IL_META_TYPEDEF_CCTOR_ONCE);
-               ILJitValue attributes = 
jit_insn_load_relative(coder->jitFunction,
+               attributes = jit_insn_load_relative(coder->jitFunction,
                                                                                
                           classInfo,
                                                                                
                           offsetof(ILClass, attributes),
                                                                                
                           _IL_JIT_TYPE_UINT32);
-               ILJitValue temp = jit_insn_and(coder->jitFunction, attributes, 
cctorOnce);
-               jit_label_t label1 = jit_label_undefined;
-
+               temp = jit_insn_and(coder->jitFunction, attributes, cctorOnce);
                jit_insn_branch_if_not(coder->jitFunction, temp, &label1);
                jit_insn_return(coder->jitFunction, 0);
                jit_insn_label(coder->jitFunction, &label1);
                temp = jit_insn_or(coder->jitFunction, attributes, cctorOnce);
                jit_insn_store_relative(coder->jitFunction, classInfo,
                                                                
offsetof(ILClass, attributes), temp);
+
+               jit_insn_label(coder->jitFunction, &endLabel);
+               /* Make sure that this check will remain very first even if any
+                  other blocks are later moved to the function start. */
+               jit_insn_move_blocks_to_start(coder->jitFunction, startLabel, 
endLabel);
        }
 
        return 1;




reply via email to

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