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 engine.h,1.60,1.61 internal.c,1.3


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine engine.h,1.60,1.61 internal.c,1.34,1.35 process.c,1.37,1.38 convert.c,1.15,1.16
Date: Sat, 16 Nov 2002 14:00:42 -0500

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

Modified Files:
        engine.h internal.c process.c convert.c 
Log Message:
enable addition of runtime internal calls


Index: engine.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -r1.60 -r1.61
*** engine.h    1 Jul 2002 00:54:15 -0000       1.60
--- engine.h    16 Nov 2002 19:00:39 -0000      1.61
***************
*** 138,141 ****
--- 138,145 ----
        ILImage            *entryImage;
  
+       /* The custom internal call table which is runtime settable */
+       ILEngineInternalClassInfo* internalClassTable;
+       int                     internalClassCount;
+ 
  #ifdef IL_CONFIG_DEBUG_LINES
  
***************
*** 237,277 ****
  
  /*
-  * Structure of an "internalcall" method table entry.
-  */
- typedef struct
- {
-       const char         *methodName;
-       const char         *signature;
-       void           *func;
- #if !defined(HAVE_LIBFFI)
-       void           *marshal;
- #endif
- 
- } ILMethodTableEntry;
- 
- /*
-  * Helper macros for defining "internalcall" method tables.
-  */
- #define       IL_METHOD_BEGIN(name)   \
-                       static ILMethodTableEntry const name[] = {
- #if defined(HAVE_LIBFFI)
- #define       IL_METHOD(name,sig,func,marshal)        \
-                       {(name), (sig), (void *)(func)},
- #define       IL_CONSTRUCTOR(name,sig,func,marshal,allocFunc,allocMarshal)    
\
-                       {(name), (sig), (void *)(func)}, \
-                       {(name), 0, (void *)(allocFunc)},
- #define       IL_METHOD_END                   \
-                       {0, 0, 0}};
- #else
- #define       IL_METHOD(name,sig,func,marshal)        \
-                       {(name), (sig), (void *)(func), (void *)(marshal)},
- #define       IL_CONSTRUCTOR(name,sig,func,marshal,allocFunc,allocMarshal)    
\
-                       {(name), (sig), (void *)(func), (void *)(marshal)}, \
-                       {(name), 0, (void *)(allocFunc), (void 
*)(allocMarshal)},
- #define       IL_METHOD_END                   \
-                       {0, 0, 0, 0}};
- #endif
- 
- /*
   * Class information for the CVM coder.
   */
--- 241,244 ----
***************
*** 427,431 ****
   * Returns zero if there is no function information.
   */
! int _ILFindInternalCall(ILMethod *method, int ctorAlloc, ILInternalInfo 
*info);
  
  /*
--- 394,399 ----
   * Returns zero if there is no function information.
   */
! int _ILFindInternalCall(ILExecProcess* process, ILMethod *method, 
!                                               int ctorAlloc, ILInternalInfo 
*info);
  
  /*
***************
*** 437,442 ****
   * Find internalcall information for a delegate method.
   */
! int _ILGetInternalDelegate(ILMethod *method, int *isCtor,
!                                                  ILInternalInfo *info);
  
  /*
--- 405,409 ----
   * Find internalcall information for a delegate method.
   */
! int _ILGetInternalDelegate(ILMethod *method, int *isCtor,  ILInternalInfo 
*info);
  
  /*

Index: internal.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/internal.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** internal.c  3 Nov 2002 19:33:26 -0000       1.34
--- internal.c  16 Nov 2002 19:00:39 -0000      1.35
***************
*** 85,89 ****
  #include "int_table.c"
  
! int _ILFindInternalCall(ILMethod *method, int ctorAlloc, ILInternalInfo *info)
  {
        ILImage *image;
--- 85,90 ----
  #include "int_table.c"
  
! int _ILFindInternalCall(ILExecProcess *process,ILMethod *method, 
!                                               int ctorAlloc, ILInternalInfo 
*info)
  {
        ILImage *image;
***************
*** 171,174 ****
--- 172,234 ----
                }
        }
+       
+       /* Search for the local internalcall table */
+       left = 0;
+       right = process->internalClassCount - 1;
+       while(left <= right)
+       {
+               middle = (left + right) / 2;
+               cmp = strcmp(name, process->internalClassTable[middle].name);
+               if(!cmp)
+               {
+                       if(!strcmp(namespace, 
+                                                       
process->internalClassTable[middle].namespace))
+                       {
+                               /* Search for the method within the class's 
table */
+                               entry = 
process->internalClassTable[middle].entry;
+                               name = ILMethod_Name(method);
+                               signature = ILMethod_Signature(method);
+                               while(entry->methodName != 0)
+                               {
+                                       if(!strcmp(entry->methodName, name) &&
+                                          entry->signature != 0 &&
+                                          _ILLookupTypeMatch(signature, 
entry->signature))
+                                       {
+                                               if(ctorAlloc && 
entry[1].methodName &&
+                                                  !(entry[1].signature))
+                                               {
+                                                       info->func = 
entry[1].func;
+                                               #if defined(HAVE_LIBFFI)
+                                                       info->marshal = 0;
+                                               #else
+                                                       info->marshal = 
entry[1].marshal;
+                                               #endif
+                                               }
+                                               else
+                                               {
+                                                       info->func = 
entry->func;
+                                               #if defined(HAVE_LIBFFI)
+                                                       info->marshal = 0;
+                                               #else
+                                                       info->marshal = 
entry->marshal;
+                                               #endif
+                                               }
+                                               return 1;
+                                       }
+                                       ++entry;
+                               }
+                       }
+                       return 0;
+               }
+               else if(cmp < 0)
+               {
+                       right = middle - 1;
+               }
+               else
+               {
+                       left = middle + 1;
+               }
+       }
+ 
  
        /* Perhaps this is a "runtime" method for an array or delegate? */

Index: process.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/process.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** process.c   12 Aug 2002 09:50:11 -0000      1.37
--- process.c   16 Nov 2002 19:00:39 -0000      1.38
***************
*** 68,71 ****
--- 68,73 ----
        process->gcHandles = 0;
        process->entryImage = 0;
+       process->internalClassTable = 0;
+       process->internalClassCount = 0;
  #ifdef IL_CONFIG_DEBUG_LINES
        process->debugHookFunc = 0;
***************
*** 464,467 ****
--- 466,479 ----
        /* Return the "Main" arguments to the caller */
        return mainArgs;
+ }
+ 
+ int ILExecProcessSetInternalCallTable(ILExecProcess* process, 
+                                       ILEngineInternalClassInfo* 
internalClassTable,
+                                       int internalClassCount)
+ {
+       if(internalClassCount<=0)return 0;
+       process->internalClassTable=internalClassTable;
+       process->internalClassCount=internalClassCount;
+       return 1;
  }
  

Index: convert.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/convert.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** convert.c   17 Sep 2002 00:03:29 -0000      1.15
--- convert.c   16 Nov 2002 19:00:39 -0000      1.16
***************
*** 256,264 ****
  
                                /* Look up the internalcall function details */
!                               if(!_ILFindInternalCall(method, 0, &fnInfo))
                                {
                                        if(isConstructor)
                                        {
!                                               if(!_ILFindInternalCall(method, 
1, &ctorfnInfo))
                                                {
                                                        METADATA_UNLOCK(thread);
--- 256,266 ----
  
                                /* Look up the internalcall function details */
!                               
if(!_ILFindInternalCall(ILExecThreadGetProcess(thread),
!                                                                               
method, 0, &fnInfo))
                                {
                                        if(isConstructor)
                                        {
!                                               
if(!_ILFindInternalCall(ILExecThreadGetProcess(thread),
!                                                                               
                method, 1, &ctorfnInfo))
                                                {
                                                        METADATA_UNLOCK(thread);
***************
*** 276,280 ****
                                else if(isConstructor)
                                {
!                                       _ILFindInternalCall(method, 1, 
&ctorfnInfo);
                                }
                        }
--- 278,283 ----
                                else if(isConstructor)
                                {
!                                       
_ILFindInternalCall(ILExecThreadGetProcess(thread),
!                                                                               
method, 1, &ctorfnInfo);
                                }
                        }





reply via email to

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