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

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

[Dotgnu-pnet-commits] CVS: pnet/engine cvm_ptr.c,1.38,1.39 engine.h,1.7


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine cvm_ptr.c,1.38,1.39 engine.h,1.75,1.76 heap.c,1.16,1.17 layout.c,1.28,1.29
Date: Fri, 27 Jun 2003 20:45:51 -0400

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv15612/engine

Modified Files:
        cvm_ptr.c engine.h heap.c layout.c 
Log Message:


Use "_ILEngineAllocAtomic" to allocate objects that don't have any
GC'able fields, to prevent the GC from scanning the large static
data areas in C applications, which rarely include managed types.


Index: cvm_ptr.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_ptr.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** cvm_ptr.c   18 Apr 2003 09:15:52 -0000      1.38
--- cvm_ptr.c   28 Jun 2003 00:45:49 -0000      1.39
***************
*** 2549,2555 ****
        }
        COPY_STATE_TO_THREAD();
!       ((ILClassPrivate *)(classInfo->userData))->staticData =
!               _ILEngineAlloc(thread, 0,
!                  ((ILClassPrivate *)(classInfo->userData))->staticSize);
        RESTORE_STATE_FROM_THREAD();
        stacktop[0].ptrValue =
--- 2549,2566 ----
        }
        COPY_STATE_TO_THREAD();
!       if(((ILClassPrivate *)(classInfo->userData))->managedStatic)
!       {
!               ((ILClassPrivate *)(classInfo->userData))->staticData =
!                       _ILEngineAlloc(thread, 0,
!                          ((ILClassPrivate 
*)(classInfo->userData))->staticSize);
!       }
!       else
!       {
!               /* There are no managed fields in the static area,
!                  so use atomic allocation */
!               ((ILClassPrivate *)(classInfo->userData))->staticData =
!                       _ILEngineAllocAtomic(thread, 0,
!                          ((ILClassPrivate 
*)(classInfo->userData))->staticSize);
!       }
        RESTORE_STATE_FROM_THREAD();
        stacktop[0].ptrValue =

Index: engine.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -r1.75 -r1.76
*** engine.h    26 Jun 2003 11:52:51 -0000      1.75
--- engine.h    28 Jun 2003 00:45:49 -0000      1.76
***************
*** 267,272 ****
        ILUInt32                inLayout : 1;           /* Non-zero if in 
layout algorithm */
        ILUInt32                hasFinalizer : 1;       /* Non-zero if 
non-trivial finalizer */
!       ILUInt32                alignment : 7;          /* Preferred instance 
alignment */
!       ILUInt32                nativeAlignment : 7;/* Preferred native 
alignment */
        ILUInt32                vtableSize : 16;        /* Size of the vtable */
        ILMethod      **vtable;                         /* Methods within the 
vtable */
--- 267,274 ----
        ILUInt32                inLayout : 1;           /* Non-zero if in 
layout algorithm */
        ILUInt32                hasFinalizer : 1;       /* Non-zero if 
non-trivial finalizer */
!       ILUInt32                managedInstance : 1;/* Non-zero if managed 
instance field */
!       ILUInt32                managedStatic : 1;      /* Non-zero if managed 
static field */
!       ILUInt32                alignment : 6;          /* Preferred instance 
alignment */
!       ILUInt32                nativeAlignment : 6;/* Preferred native 
alignment */
        ILUInt32                vtableSize : 16;        /* Size of the vtable */
        ILMethod      **vtable;                         /* Methods within the 
vtable */

Index: heap.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/heap.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** heap.c      26 Jun 2003 03:39:25 -0000      1.16
--- heap.c      28 Jun 2003 00:45:49 -0000      1.17
***************
*** 201,206 ****
                return 0;
        }
!       return _ILEngineAlloc(thread, classInfo,
!                                                 ((ILClassPrivate 
*)(classInfo->userData))->size);
  }
  
--- 201,217 ----
                return 0;
        }
!       if(((ILClassPrivate *)(classInfo->userData))->managedInstance)
!       {
!               return _ILEngineAlloc
!                               (thread, classInfo,
!                                ((ILClassPrivate 
*)(classInfo->userData))->size);
!       }
!       else
!       {
!               /* There are no managed fields, so use atomic allocation */
!               return _ILEngineAllocAtomic
!                               (thread, classInfo,
!                                ((ILClassPrivate 
*)(classInfo->userData))->size);
!       }
  }
  

Index: layout.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/layout.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** layout.c    14 Jun 2003 06:34:24 -0000      1.28
--- layout.c    28 Jun 2003 00:45:49 -0000      1.29
***************
*** 44,47 ****
--- 44,49 ----
        ILUInt32        staticSize;
        int                     hasFinalizer;
+       int                     managedInstance;
+       int                     managedStatic;
  
  } LayoutInfo;
***************
*** 61,64 ****
--- 63,67 ----
        {
                /* Lay out a primitive type */
+               layout->managedInstance = 0;
                switch(ILType_ToElement(type))
                {
***************
*** 160,163 ****
--- 163,167 ----
                                layout->alignment = _IL_ALIGN_FOR_TYPE(void_p);
                        #endif
+                               layout->managedInstance = 1;
                        }
                        break;
***************
*** 171,174 ****
--- 175,179 ----
                layout->staticSize = 0;
                layout->hasFinalizer = 0;
+               layout->managedStatic = 0;
                return 1;
        }
***************
*** 204,207 ****
--- 209,214 ----
                layout->staticSize = 0;
                layout->hasFinalizer = 0;
+               layout->managedInstance = 
ILTypeIsReference(ILTypeStripPrefixes(type));
+               layout->managedStatic = 0;
                return 1;
        }
***************
*** 465,468 ****
--- 472,477 ----
                        layout->staticSize = classPrivate->staticSize;
                        layout->hasFinalizer = classPrivate->hasFinalizer;
+                       layout->managedInstance = classPrivate->managedInstance;
+                       layout->managedStatic = classPrivate->managedStatic;
                        return 1;
                }
***************
*** 506,509 ****
--- 515,520 ----
                layout->vtableSize = 0;
                layout->hasFinalizer = 0;
+               layout->managedInstance = 0;
+               layout->managedStatic = 0;
        }
  
***************
*** 634,637 ****
--- 645,654 ----
                                maxNativeAlignment = typeLayout.nativeAlignment;
                        }
+ 
+                       /* Set the "managedInstance" flag if the type is 
managed */
+                       if(typeLayout.managedInstance)
+                       {
+                               layout->managedInstance = 1;
+                       }
                }
        }
***************
*** 730,733 ****
--- 747,756 ----
                                layout->staticSize += typeLayout.size;
                        }
+ 
+                       /* Set the "managedStatic" flag if the type is managed 
*/
+                       if(typeLayout.managedInstance)
+                       {
+                               layout->managedStatic = 1;
+                       }
                }
        }
***************
*** 846,849 ****
--- 869,874 ----
        classPrivate->vtable = vtable;
        classPrivate->hasFinalizer = layout->hasFinalizer;
+       classPrivate->managedInstance = layout->managedInstance;
+       classPrivate->managedStatic = layout->managedStatic;
        layout->vtable = vtable;
  





reply via email to

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