CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      06/10/18 11:06:09

Modified files:
        .              : ChangeLog 
        engine         : jitc_array.c 

Log message:
        2006-10-18  Klaus Treichel  <[EMAIL PROTECTED]>
        
                * engine/jitc_array.c: Change the allocation scheme for the 
arrays. Use
                atomic allocation for arrays which elements are either 
primitive types but
                no TypedRef, no reference types and value types which do not 
contain any
                reference types.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3377&r2=1.3378
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_array.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3377
retrieving revision 1.3378
diff -u -b -r1.3377 -r1.3378
--- ChangeLog   18 Oct 2006 05:14:14 -0000      1.3377
+++ ChangeLog   18 Oct 2006 11:06:08 -0000      1.3378
@@ -1,4 +1,11 @@
-2006-09-17  Radek Polak <[EMAIL PROTECTED]>
+2006-10-18  Klaus Treichel  <[EMAIL PROTECTED]>
+
+       * engine/jitc_array.c: Change the allocation scheme for the arrays. Use
+       atomic allocation for arrays which elements are either primitive types 
but
+       no TypedRef, no reference types and value types which do not contain any
+       reference types.
+
+2006-10-17  Radek Polak <[EMAIL PROTECTED]>
 
        * engine/debugger.c: show_locals can handle all primitive types,
        strings and chars are dumped in utf8.

Index: engine/jitc_array.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc_array.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- engine/jitc_array.c 17 Oct 2006 12:24:18 -0000      1.3
+++ engine/jitc_array.c 18 Oct 2006 11:06:09 -0000      1.4
@@ -26,6 +26,20 @@
 #define _IL_JIT_SARRAY_HEADERSIZE      sizeof(System_Array)
 
 /*
+ * Check if the elementtype e needs to be scanned by the GC.
+ *
+ * Use the following conservative check if you encounter any problems with
+ * objects prematurely collected.
+ *
+ *             ((ILType_IsPrimitive(e) &&
+ *                (e) != ILType_TypedRef))
+ */
+#define _IL_JIT_ARRAY_TYPE_NEEDS_GC(e, c) \
+       (!(ILType_IsPrimitive((e)) && ((e) != ILType_TypedRef)) || \
+        (ILTypeIsReference(e)) || \
+        (ILType_IsValueType((e)) && (c)->managedInstance))
+
+/*
  * Validate the array index.
  */
 #define JITC_START_CHECK_ARRAY_INDEX(jitCoder, length, index) \
@@ -213,9 +227,7 @@
                                                                                
         (jit_nint)arrayClass);
        args[1] = arraySize;
 
-       /* if(!(classPrivate->managedInstance)) */
-       if(ILType_IsPrimitive(elementType) &&
-          elementType != ILType_TypedRef)
+       if(!_IL_JIT_ARRAY_TYPE_NEEDS_GC(elementType, classPrivate))
        {
                newArray = jit_insn_call_native(jitFunction,
                                                                                
"_ILJitAllocAtomic",
@@ -348,9 +360,7 @@
                                                                                
                 (jit_nint)arrayClass);
                args[1] = jit_insn_add(jitCoder->jitFunction, arraySize, 
headerSize);
 
-               /* if(!(classPrivate->managedInstance)) */
-               if(ILType_IsPrimitive(elementType) &&
-                  elementType != ILType_TypedRef)
+               if(!_IL_JIT_ARRAY_TYPE_NEEDS_GC(elementType, classPrivate))
                {
                        newArray = jit_insn_call_native(jitCoder->jitFunction,
                                                                                
        "_ILJitAllocAtomic",
@@ -384,9 +394,7 @@
                                                                                
                 _IL_JIT_TYPE_UINT32,
                                                                                
                 elementSize);
 
-               /* if(!(classPrivate->managedInstance)) */
-               if(ILType_IsPrimitive(elementType) &&
-                  elementType != ILType_TypedRef)
+               if(!_IL_JIT_ARRAY_TYPE_NEEDS_GC(elementType, classPrivate))
                {
                        newArray = jit_insn_call_native(jitCoder->jitFunction,
                                                                                
        "_ILJitSArrayAllocAtomic",


_______________________________________________
dotgnu-pnet-commits mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/dotgnu-pnet-commits

Reply via email to