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

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

[Dotgnu-pnet-commits] pnet/engine cvm_conv.c, 1.29, 1.30 engine.h, 1.85,


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnet/engine cvm_conv.c, 1.29, 1.30 engine.h, 1.85, 1.86 lib_delegate.c, 1.5, 1.6 lib_marshal.c, 1.5, 1.6 pinvoke.c, 1.23, 1.24
Date: Wed, 08 Oct 2003 09:42:44 +0000

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

Modified Files:
        cvm_conv.c engine.h lib_delegate.c lib_marshal.c pinvoke.c 
Log Message:


Add delegate objects to the GC handle table when they are converted
into closures so that the object won't disappear out from underneath the
closure.


Index: lib_delegate.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_delegate.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** lib_delegate.c      30 Sep 2003 00:36:33 -0000      1.5
--- lib_delegate.c      8 Oct 2003 09:42:42 -0000       1.6
***************
*** 26,32 ****
  #endif
  
! void *_ILDelegateGetClosure(ILObject *delegate)
  {
! #if defined(HAVE_LIBFFI)
        ILMethod *methodInfo;
  
--- 26,32 ----
  #endif
  
! void *_ILDelegateGetClosure(ILExecThread *thread, ILObject *delegate)
  {
! #if defined(HAVE_LIBFFI) && defined(IL_CONFIG_RUNTIME_INFRA)
        ILMethod *methodInfo;
  
***************
*** 47,50 ****
--- 47,53 ----
                return 0;
        }
+ 
+       /* Nail down the delegate object, to protect it from garbage collection 
*/
+       _IL_GCHandle_GCAlloc(thread, delegate, 2 /* Normal */);
  
        /* Make a native closure and cache it for next time */

Index: lib_marshal.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_marshal.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** lib_marshal.c       7 Oct 2003 09:38:16 -0000       1.5
--- lib_marshal.c       8 Oct 2003 09:42:42 -0000       1.6
***************
*** 651,655 ****
                if(marshalType == IL_META_MARSHAL_FNPTR)
                {
!                       *((void **)ptr) = _ILDelegateGetClosure(*((ILObject 
**)ptr));
                }
        }
--- 651,656 ----
                if(marshalType == IL_META_MARSHAL_FNPTR)
                {
!                       *((void **)ptr) = _ILDelegateGetClosure
!                               (thread, *((ILObject **)ptr));
                }
        }

Index: engine.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -C2 -d -r1.85 -r1.86
*** engine.h    29 Aug 2003 22:47:39 -0000      1.85
--- engine.h    8 Oct 2003 09:42:42 -0000       1.86
***************
*** 617,621 ****
   * if the closure could not be created for some reason.
   */
! void *_ILDelegateGetClosure(ILObject *delegate);
  
  /*
--- 617,621 ----
   * if the closure could not be created for some reason.
   */
! void *_ILDelegateGetClosure(ILExecThread *thread, ILObject *delegate);
  
  /*

Index: cvm_conv.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_conv.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** cvm_conv.c  7 Oct 2003 09:38:15 -0000       1.29
--- cvm_conv.c  8 Oct 2003 09:42:42 -0000       1.30
***************
*** 2030,2034 ****
        /* Convert a delegate into a function pointer */
        stacktop[-1].ptrValue = _ILDelegateGetClosure
!               ((ILObject *)(stacktop[-1].ptrValue));
        MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
  }
--- 2030,2034 ----
        /* Convert a delegate into a function pointer */
        stacktop[-1].ptrValue = _ILDelegateGetClosure
!               (thread, (ILObject *)(stacktop[-1].ptrValue));
        MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
  }

Index: pinvoke.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/pinvoke.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** pinvoke.c   7 Oct 2003 09:38:16 -0000       1.23
--- pinvoke.c   8 Oct 2003 09:42:42 -0000       1.24
***************
*** 776,780 ****
                                /* Convert a delegate into a function closure 
pointer */
                                *((void **)result) = _ILDelegateGetClosure
!                                       ((ILObject 
*)(thread->stackTop[-1].ptrValue));
                                --(thread->stackTop);
                        }
--- 776,780 ----
                                /* Convert a delegate into a function closure 
pointer */
                                *((void **)result) = _ILDelegateGetClosure
!                                       (thread, (ILObject 
*)(thread->stackTop[-1].ptrValue));
                                --(thread->stackTop);
                        }





reply via email to

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