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 call.c,1.29,1.30 cvm_call.c,1.65


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine call.c,1.29,1.30 cvm_call.c,1.65,1.66 engine.h,1.72,1.73 heap.c,1.14,1.15 layout.c,1.25,1.26 lib_defs.h,1.20,1.21 lib_object.c,1.11,1.12 lib_reflect.c,1.36,1.37
Date: Mon, 02 Jun 2003 02:55:19 -0400

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

Modified Files:
        call.c cvm_call.c engine.h heap.c layout.c lib_defs.h 
        lib_object.c lib_reflect.c 
Log Message:


Make objects point to the ILClassPrivate structure instead of ILClass,
to remove a pointer indirection step in virtual and interface method calls.


Index: call.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/call.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** call.c      31 Mar 2003 05:49:34 -0000      1.29
--- call.c      2 Jun 2003 06:55:16 -0000       1.30
***************
*** 723,737 ****
  }
  
! ILMethod *_ILLookupInterfaceMethod(ILClass *objectClass,
                                                                   ILClass 
*interfaceClass,
                                                                   ILUInt32 
index)
  {
        ILImplPrivate *implements;
!       ILClass *searchClass = objectClass;
  
        /* Locate the interface table within the class hierarchy for the object 
*/
        while(searchClass != 0)
        {
!               implements = ((ILClassPrivate 
*)(searchClass->userData))->implements;
                while(implements != 0)
                {
--- 723,737 ----
  }
  
! ILMethod *_ILLookupInterfaceMethod(ILClassPrivate *objectClassPrivate,
                                                                   ILClass 
*interfaceClass,
                                                                   ILUInt32 
index)
  {
        ILImplPrivate *implements;
!       ILClassPrivate *searchClass = objectClassPrivate;
  
        /* Locate the interface table within the class hierarchy for the object 
*/
        while(searchClass != 0)
        {
!               implements = searchClass->implements;
                while(implements != 0)
                {
***************
*** 744,749 ****
                                if(index != (ILUInt32)(ILUInt16)0xFFFF)
                                {
!                                       return ((ILClassPrivate 
*)(objectClass->userData))
!                                                                       
->vtable[index];
                                }
                                else
--- 744,748 ----
                                if(index != (ILUInt32)(ILUInt16)0xFFFF)
                                {
!                                       return 
objectClassPrivate->vtable[index];
                                }
                                else
***************
*** 756,760 ****
                        implements = implements->next;
                }
!               searchClass = ILClassGetParent(searchClass);
        }
  
--- 755,760 ----
                        implements = implements->next;
                }
!               searchClass = (ILClassPrivate *)
!                       (ILClassGetParent(searchClass->classInfo)->userData);
        }
  
***************
*** 804,809 ****
                if(ILClassImplements(objectClass, classInfo))
                {
!                       method = _ILLookupInterfaceMethod(objectClass, 
classInfo,
!                                                                               
          method->index);
                        if(method)
                        {
--- 804,810 ----
                if(ILClassImplements(objectClass, classInfo))
                {
!                       method = _ILLookupInterfaceMethod
!                               (((ILClassPrivate *)(objectClass->userData)),
!                                classInfo, method->index);
                        if(method)
                        {
***************
*** 870,875 ****
                if(ILClassImplements(objectClass, classInfo))
                {
!                       method = _ILLookupInterfaceMethod(objectClass, 
classInfo,
!                                                                               
          method->index);
                        if(method)
                        {
--- 871,877 ----
                if(ILClassImplements(objectClass, classInfo))
                {
!                       method = _ILLookupInterfaceMethod
!                                       (((ILClassPrivate 
*)(objectClass->userData)),
!                                        classInfo, method->index);
                        if(method)
                        {

Index: cvm_call.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_call.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -r1.65 -r1.66
*** cvm_call.c  14 Apr 2003 00:17:05 -0000      1.65
--- cvm_call.c  2 Jun 2003 06:55:16 -0000       1.66
***************
*** 733,737 ****
        {
                /* Locate the method to be called */
!               methodToCall = ((ILClassPrivate 
*)(GetObjectClass(tempptr)->userData))
                                                        
->vtable[CVM_ARG_DWIDE2_SMALL];
  
--- 733,737 ----
        {
                /* Locate the method to be called */
!               methodToCall = (GetObjectClassPrivate(tempptr))
                                                        
->vtable[CVM_ARG_DWIDE2_SMALL];
  
***************
*** 830,834 ****
                /* Locate the method to be called */
                methodToCall = _ILLookupInterfaceMethod
!                       (GetObjectClass(tempptr), 
CVM_ARG_DWIDE_PTR_SMALL(ILClass *),
                         CVM_ARG_DWIDE2_SMALL);
                if(!methodToCall)
--- 830,834 ----
                /* Locate the method to be called */
                methodToCall = _ILLookupInterfaceMethod
!                       (GetObjectClassPrivate(tempptr), 
CVM_ARG_DWIDE_PTR_SMALL(ILClass *),
                         CVM_ARG_DWIDE2_SMALL);
                if(!methodToCall)
***************
*** 1311,1315 ****
        {
                /* Locate the method to be called */
!               methodToCall = ((ILClassPrivate 
*)(GetObjectClass(tempptr)->userData))
                                                        
->vtable[CVM_ARG_DWIDE2_LARGE];
  
--- 1311,1315 ----
        {
                /* Locate the method to be called */
!               methodToCall = (GetObjectClassPrivate(tempptr))
                                                        
->vtable[CVM_ARG_DWIDE2_LARGE];
  
***************
*** 1355,1359 ****
                /* Locate the method to be called */
                methodToCall = _ILLookupInterfaceMethod
!                       (GetObjectClass(tempptr), 
CVM_ARG_DWIDE_PTR_LARGE(ILClass *),
                         CVM_ARG_DWIDE2_LARGE);
                if(!methodToCall)
--- 1355,1359 ----
                /* Locate the method to be called */
                methodToCall = _ILLookupInterfaceMethod
!                       (GetObjectClassPrivate(tempptr), 
CVM_ARG_DWIDE_PTR_LARGE(ILClass *),
                         CVM_ARG_DWIDE2_LARGE);
                if(!methodToCall)
***************
*** 1519,1524 ****
        {
                stacktop[-1].ptrValue =
!                       ((ILClassPrivate *)(GetObjectClass(tempptr)->userData))
!                                       ->vtable[CVMP_ARG_WORD];
                MODIFY_PC_AND_STACK(CVMP_LEN_WORD, 0);
        }
--- 1519,1523 ----
        {
                stacktop[-1].ptrValue =
!                       (GetObjectClassPrivate(tempptr))->vtable[CVMP_ARG_WORD];
                MODIFY_PC_AND_STACK(CVMP_LEN_WORD, 0);
        }
***************
*** 1560,1564 ****
        {
                stacktop[-1].ptrValue =
!                       _ILLookupInterfaceMethod(GetObjectClass(tempptr),
                                                                         
CVMP_ARG_WORD_PTR(ILClass *),
                                                                         
CVMP_ARG_WORD);
--- 1559,1563 ----
        {
                stacktop[-1].ptrValue =
!                       _ILLookupInterfaceMethod(GetObjectClassPrivate(tempptr),
                                                                         
CVMP_ARG_WORD_PTR(ILClass *),
                                                                         
CVMP_ARG_WORD);

Index: engine.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -r1.72 -r1.73
*** engine.h    15 May 2003 05:06:34 -0000      1.72
--- engine.h    2 Jun 2003 06:55:16 -0000       1.73
***************
*** 241,244 ****
--- 241,245 ----
  struct _tagILClassPrivate
  {
+       ILClass            *classInfo;                  /* Back-pointer to the 
class */
        ILUInt32                size;                           /* Full 
instance size */
        ILUInt32                nativeSize;                     /* Full native 
instance size */
***************
*** 426,430 ****
   * Look up an interface method.  Returns NULL if not found.
   */
! ILMethod *_ILLookupInterfaceMethod(ILClass *objectClass,
                                                                   ILClass 
*interfaceClass,
                                                                   ILUInt32 
index);
--- 427,431 ----
   * Look up an interface method.  Returns NULL if not found.
   */
! ILMethod *_ILLookupInterfaceMethod(ILClassPrivate *objectClassPrivate,
                                                                   ILClass 
*interfaceClass,
                                                                   ILUInt32 
index);

Index: heap.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/heap.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** heap.c      14 Apr 2003 07:42:21 -0000      1.14
--- heap.c      2 Jun 2003 06:55:16 -0000       1.15
***************
*** 72,76 ****
  
        /* Get the object's class and locate the "Finalize" method */
!       classInfo = *((ILClass **)block);
        while(classInfo != 0)
        {
--- 72,76 ----
  
        /* Get the object's class and locate the "Finalize" method */
!       classInfo = (*((ILClassPrivate **)block))->classInfo;
        while(classInfo != 0)
        {
***************
*** 119,123 ****
  
        /* Set the class into the block */
!       *((ILClass **)ptr) = classInfo;
  
        /* Attach a finalizer to the object if the class has
--- 119,130 ----
  
        /* Set the class into the block */
!       if(classInfo)
!       {
!               *((ILClassPrivate **)ptr) = (ILClassPrivate 
*)(classInfo->userData);
!       }
!       else
!       {
!               *((ILClassPrivate **)ptr) = 0;
!       }
  
        /* Attach a finalizer to the object if the class has
***************
*** 154,158 ****
  
        /* Set the class into the block */
!       *((ILClass **)ptr) = classInfo;
  
        /* Return a pointer to the data just after the class information */
--- 161,172 ----
  
        /* Set the class into the block */
!       if(classInfo)
!       {
!               *((ILClassPrivate **)ptr) = (ILClassPrivate 
*)(classInfo->userData);
!       }
!       else
!       {
!               *((ILClassPrivate **)ptr) = 0;
!       }
  
        /* Return a pointer to the data just after the class information */

Index: layout.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/layout.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** layout.c    18 Apr 2003 09:15:52 -0000      1.25
--- layout.c    2 Jun 2003 06:55:16 -0000       1.26
***************
*** 471,474 ****
--- 471,475 ----
                        return 0;
                }
+               classPrivate->classInfo = info;
                info->userData = (void *)classPrivate;
                classPrivate->inLayout = 1;

Index: lib_defs.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_defs.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** lib_defs.h  23 Feb 2003 04:24:11 -0000      1.20
--- lib_defs.h  2 Jun 2003 06:55:16 -0000       1.21
***************
*** 29,36 ****
  
  /*
   * Get the class that is associated with a non-null object.
   */
! #define       GetObjectClass(obj)     \
!                       (*((ILClass **)(((unsigned char *)(obj)) - 
IL_BEST_ALIGNMENT)))
  
  /*
--- 29,42 ----
  
  /*
+  * Get the ILClassPrivate information that is associated with
+  * a non-null object.
+  */
+ #define       GetObjectClassPrivate(obj)      \
+       (*((ILClassPrivate **)(((unsigned char *)(obj)) - IL_BEST_ALIGNMENT)))
+ 
+ /*
   * Get the class that is associated with a non-null object.
   */
! #define       GetObjectClass(obj)     
((GetObjectClassPrivate((obj)))->classInfo)
  
  /*

Index: lib_object.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_object.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** lib_object.c        24 Apr 2003 06:00:43 -0000      1.11
--- lib_object.c        2 Jun 2003 06:55:16 -0000       1.12
***************
*** 26,35 ****
  #endif
  
- /*
-  * Get the private data attached to a class.
-  */
- #define       IL_CLASS_PRIVATE(classInfo)     \
-                               ((ILClassPrivate *)((classInfo)->userData))
- 
  ILObject *_IL_Object_GetType(ILExecThread *thread, ILObject *_this)
  {
--- 26,29 ----
***************
*** 37,43 ****
  
        /* Does the class already have a "ClrType" instance? */
!       if(IL_CLASS_PRIVATE(GetObjectClass(_this))->clrType)
        {
!               return IL_CLASS_PRIVATE(GetObjectClass(_this))->clrType;
        }
  
--- 31,37 ----
  
        /* Does the class already have a "ClrType" instance? */
!       if(GetObjectClassPrivate(_this)->clrType)
        {
!               return GetObjectClassPrivate(_this)->clrType;
        }
  
***************
*** 116,122 ****
  
        /* Copy the contents of "this" into the new object */
!       if(IL_CLASS_PRIVATE(GetObjectClass(_this))->size != 0)
        {
!               ILMemCpy(obj, _this, 
IL_CLASS_PRIVATE(GetObjectClass(_this))->size);
        }
  
--- 110,116 ----
  
        /* Copy the contents of "this" into the new object */
!       if(GetObjectClassPrivate(_this)->size != 0)
        {
!               ILMemCpy(obj, _this, GetObjectClassPrivate(_this)->size);
        }
  

Index: lib_reflect.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** lib_reflect.c       5 May 2003 06:28:12 -0000       1.36
--- lib_reflect.c       2 Jun 2003 06:55:17 -0000       1.37
***************
*** 2145,2150 ****
                                return 0;
                        }
!                       method = _ILLookupInterfaceMethod(targetClass, 
classInfo,
!                                                                               
          method->index);
                }
                else
--- 2145,2151 ----
                                return 0;
                        }
!                       method = _ILLookupInterfaceMethod
!                                       (((ILClassPrivate 
*)(targetClass->userData)),
!                                        classInfo, method->index);
                }
                else





reply via email to

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