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 int_proto.h, 1.70, 1.71 int_table


From: Richard Baumann <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine int_proto.h, 1.70, 1.71 int_table.c, 1.73, 1.74 lib_emit.c, 1.22, 1.23
Date: Fri, 25 Jul 2003 04:33:46 -0400

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

Modified Files:
        int_proto.h int_table.c lib_emit.c 
Log Message:
Get method body output working in lib_emit.


Index: int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -r1.70 -r1.71
*** int_proto.h 23 Jul 2003 15:35:45 -0000      1.70
--- int_proto.h 25 Jul 2003 08:33:44 -0000      1.71
***************
*** 376,380 ****
  extern ILNativeInt _IL_AssemblyBuilder_ClrAssemblyCreate(ILExecThread * 
_thread, ILString * _p1, ILInt32 _p2, ILInt32 _p3, ILInt32 _p4, ILInt32 _p5, 
ILInt32 _p6, ILNativeInt * writer);
  extern ILBool _IL_AssemblyBuilder_ClrSave(ILExecThread * _thread, ILNativeInt 
_p1, ILNativeInt _p2, ILString * _p3, ILNativeInt _p4, ILInt32 _p5);
! extern ILInt32 _IL_AssemblyBuilder_ClrWriteMethod(ILExecThread * _thread, 
ILNativeInt _p1, ILNativeInt _p2, System_Array * _p3);
  extern ILInt32 _IL_AssemblyBuilder_ClrGetItemToken(ILExecThread * _thread, 
ILNativeInt _p1);
  extern ILNativeInt _IL_AssemblyBuilder_ClrGetItemFromToken(ILExecThread * 
_thread, ILNativeInt _p1, ILInt32 _p2);
--- 376,380 ----
  extern ILNativeInt _IL_AssemblyBuilder_ClrAssemblyCreate(ILExecThread * 
_thread, ILString * _p1, ILInt32 _p2, ILInt32 _p3, ILInt32 _p4, ILInt32 _p5, 
ILInt32 _p6, ILNativeInt * writer);
  extern ILBool _IL_AssemblyBuilder_ClrSave(ILExecThread * _thread, ILNativeInt 
_p1, ILNativeInt _p2, ILString * _p3, ILNativeInt _p4, ILInt32 _p5);
! extern ILInt32 _IL_AssemblyBuilder_ClrWriteMethod(ILExecThread * _thread, 
ILNativeInt _p1, ILNativeInt _p2, System_Array * _p3, System_Array * _p4, 
System_Array * _p5, System_Array * _p6, System_Array * _p7, System_Array * _p8, 
System_Array * _p9);
  extern ILInt32 _IL_AssemblyBuilder_ClrGetItemToken(ILExecThread * _thread, 
ILNativeInt _p1);
  extern ILNativeInt _IL_AssemblyBuilder_ClrGetItemFromToken(ILExecThread * 
_thread, ILNativeInt _p1, ILInt32 _p2);
***************
*** 413,416 ****
--- 413,417 ----
  extern ILNativeInt _IL_SignatureHelper_ClrSigCreateMethodCopy(ILExecThread * 
_thread, ILNativeInt _p1, ILNativeInt _p2, ILInt32 _p3);
  extern ILBool _IL_SignatureHelper_ClrSigAddSentinel(ILExecThread * _thread, 
ILNativeInt _p1, ILNativeInt _p2);
+ extern ILInt32 _IL_SignatureHelper_ClrStandAloneToken(ILExecThread * _thread, 
ILNativeInt _p1, ILNativeInt _p2);
  extern ILNativeInt _IL_SignatureHelper_ClrSigCreateProperty(ILExecThread * 
_thread, ILNativeInt _p1, ILNativeInt _p2);
  extern ILNativeInt _IL_SignatureHelper_ClrSigModuleToContext(ILExecThread * 
_thread, ILNativeInt _p1);

Index: int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -C2 -r1.73 -r1.74
*** int_table.c 23 Jul 2003 15:35:45 -0000      1.73
--- int_table.c 25 Jul 2003 08:33:44 -0000      1.74
***************
*** 1873,1879 ****
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_ipjjp(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILNativeUInt, 
ILNativeUInt, void *))fn)(*((void * *)(avalue[0])), *((ILNativeUInt 
*)(avalue[1])), *((ILNativeUInt *)(avalue[2])), *((void * *)(avalue[3])));
  }
  
--- 1873,1879 ----
  #if !defined(HAVE_LIBFFI)
  
! static void marshal_ipjjppppppp(void (*fn)(), void *rvalue, void **avalue)
  {
!       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILNativeUInt, 
ILNativeUInt, void *, void *, void *, void *, void *, void *, void 
*))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), 
*((ILNativeUInt *)(avalue[2])), *((void * *)(avalue[3])), *((void * 
*)(avalue[4])), *((void * *)(avalue[5])), *((void * *)(avalue[6])), *((void * 
*)(avalue[7])), *((void * *)(avalue[8])), *((void * *)(avalue[9])));
  }
  
***************
*** 1885,1889 ****
        IL_METHOD("ClrAssemblyCreate", 
"(oSystem.String;iiiivSystem.Reflection.Emit.AssemblyBuilderAccess;&j)j", 
_IL_AssemblyBuilder_ClrAssemblyCreate, marshal_jppiiiiip)
        IL_METHOD("ClrSave", 
"(jjoSystem.String;jvSystem.Reflection.Emit.PEFileKinds;)Z", 
_IL_AssemblyBuilder_ClrSave, marshal_bpjjpji)
!       IL_METHOD("ClrWriteMethod", "(jj[B)i", 
_IL_AssemblyBuilder_ClrWriteMethod, marshal_ipjjp)
        IL_METHOD("ClrGetItemToken", "(j)i", 
_IL_AssemblyBuilder_ClrGetItemToken, marshal_ipj)
        IL_METHOD("ClrGetItemFromToken", "(ji)j", 
_IL_AssemblyBuilder_ClrGetItemFromToken, marshal_jpji)
--- 1885,1889 ----
        IL_METHOD("ClrAssemblyCreate", 
"(oSystem.String;iiiivSystem.Reflection.Emit.AssemblyBuilderAccess;&j)j", 
_IL_AssemblyBuilder_ClrAssemblyCreate, marshal_jppiiiiip)
        IL_METHOD("ClrSave", 
"(jjoSystem.String;jvSystem.Reflection.Emit.PEFileKinds;)Z", 
_IL_AssemblyBuilder_ClrSave, marshal_bpjjpji)
!       IL_METHOD("ClrWriteMethod", "(jj[B[B[j[i[[B[j[i)i", 
_IL_AssemblyBuilder_ClrWriteMethod, marshal_ipjjppppppp)
        IL_METHOD("ClrGetItemToken", "(j)i", 
_IL_AssemblyBuilder_ClrGetItemToken, marshal_ipj)
        IL_METHOD("ClrGetItemFromToken", "(ji)j", 
_IL_AssemblyBuilder_ClrGetItemFromToken, marshal_jpji)
***************
*** 2084,2087 ****
--- 2084,2096 ----
  #if !defined(HAVE_LIBFFI)
  
+ static void marshal_ipjj(void (*fn)(), void *rvalue, void **avalue)
+ {
+       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILNativeUInt, 
ILNativeUInt))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), 
*((ILNativeUInt *)(avalue[2])));
+ }
+ 
+ #endif
+ 
+ #if !defined(HAVE_LIBFFI)
+ 
  static void marshal_lpjjb(void (*fn)(), void *rvalue, void **avalue)
  {
***************
*** 2099,2102 ****
--- 2108,2112 ----
        IL_METHOD("ClrSigCreateMethodCopy", "(jji)j", 
_IL_SignatureHelper_ClrSigCreateMethodCopy, marshal_jpjji)
        IL_METHOD("ClrSigAddSentinel", "(jj)Z", 
_IL_SignatureHelper_ClrSigAddSentinel, marshal_bpjj)
+       IL_METHOD("ClrStandAloneToken", "(jj)i", 
_IL_SignatureHelper_ClrStandAloneToken, marshal_ipjj)
        IL_METHOD("ClrSigCreateProperty", "(jj)j", 
_IL_SignatureHelper_ClrSigCreateProperty, marshal_jpjj)
        IL_METHOD("ClrSigModuleToContext", "(j)j", 
_IL_SignatureHelper_ClrSigModuleToContext, marshal_jpj)
***************
*** 2112,2124 ****
        IL_METHOD("ClrSigGetBytes", "(jl)[B", 
_IL_SignatureHelper_ClrSigGetBytes, marshal_ppjl)
  IL_METHOD_END
- 
- #endif
- 
- #if !defined(HAVE_LIBFFI)
- 
- static void marshal_ipjj(void (*fn)(), void *rvalue, void **avalue)
- {
-       *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILNativeUInt, 
ILNativeUInt))fn)(*((void * *)(avalue[0])), *((ILNativeUInt *)(avalue[1])), 
*((ILNativeUInt *)(avalue[2])));
- }
  
  #endif
--- 2122,2125 ----

Index: lib_emit.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_emit.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** lib_emit.c  23 Jul 2003 15:35:45 -0000      1.22
--- lib_emit.c  25 Jul 2003 08:33:44 -0000      1.23
***************
*** 225,247 ****
  }
  /*
!  * private static int ClrWriteMethod(IntPtr assembly, IntPtr writer, byte[] 
code);
   */
  ILInt32 _IL_AssemblyBuilder_ClrWriteMethod(ILExecThread *_thread,
                                             ILNativeInt _assembly,
                                             ILNativeInt _writer,
!                                            System_Array *_code)
  {
        ILInt32 retval;
        ILWriter *writer;
        unsigned char *buf;
!       unsigned long len;
  
        IL_METADATA_WRLOCK(_thread);
  
        writer = (ILWriter *)_writer;
!       buf = (unsigned char *)ArrayToBuffer(_code);
!       len = (unsigned long)_code->length;
        retval = (ILInt32)ILWriterGetTextRVA(writer);
!       ILWriterTextWrite(writer, buf, len);
  
        IL_METADATA_UNLOCK(_thread);
--- 225,324 ----
  }
  /*
!  * private static int ClrWriteMethod(IntPtr assembly,
!  *                                   IntPtr writer,
!  *                                   byte[] header,
!  *                                   byte[] code,
!  *                                   IntPtr[] codeFixupPtrs,
!  *                                   int[] codeFixupOffsets,
!  *                                   byte[][] exceptionBlocks,
!  *                                   IntPtr[] exceptionBlockFixupPtrs,
!  *                                   int[] exceptionBlockFixupOffsets);
   */
  ILInt32 _IL_AssemblyBuilder_ClrWriteMethod(ILExecThread *_thread,
                                             ILNativeInt _assembly,
                                             ILNativeInt _writer,
!                                            System_Array *_header,
!                                            System_Array *_code,
!                                            System_Array *_codeFixupPtrs,
!                                            System_Array *_codeFixupOffsets,
!                                            System_Array *_exceptionBlocks,
!                                            System_Array 
*_exceptionBlockFixupPtrs,
!                                            System_Array 
*_exceptionBlockFixupOffsets)
  {
        ILInt32 retval;
        ILWriter *writer;
+       ILInt32 rva;
+       ILNativeInt *ptrs;
+       ILInt32 *offsets;
+       System_Array **eBlocks;
        unsigned char *buf;
!       unsigned long i, len, length;
  
        IL_METADATA_WRLOCK(_thread);
  
+       /* align to the next 4-byte boundary and get the starting rva */
        writer = (ILWriter *)_writer;
!       ILWriterTextAlign(writer);
        retval = (ILInt32)ILWriterGetTextRVA(writer);
! 
!       /* write out the header */
!       buf = (unsigned char *)ArrayToBuffer(_header);
!       length = (unsigned long)_header->length;
!       ILWriterTextWrite(writer, buf, length);
! 
!       /* get the rva of the code section */
!       rva = (ILInt32)ILWriterGetTextRVA(writer);
! 
!       /* write out the code section */
!       buf = (unsigned char *)ArrayToBuffer(_code);
!       length = (unsigned long)_code->length;
!       ILWriterTextWrite(writer, buf, length);
! 
!       /* register token fixups for the code section */
!       if (_codeFixupPtrs && _codeFixupOffsets)
!       {
!               ptrs = (ILNativeInt *)ArrayToBuffer(_codeFixupPtrs);
!               offsets = (ILInt32 *)ArrayToBuffer(_codeFixupOffsets);
!               length = (unsigned long)_codeFixupPtrs->length;
!               for (i = 0; i < length; ++i)
!               {
!                       ILWriterSetFixup(writer, rva+offsets[i], (ILProgramItem 
*)ptrs[i]);
!               }
!       }
! 
!       /* if there are no exception blocks, we're done */
!       if (!_exceptionBlocks)
!       {
!               IL_METADATA_UNLOCK(_thread);
!               return retval;
!       }
! 
!       /* align to the next 4-byte boundary */
!       ILWriterTextAlign(writer);
! 
!       /* get the rva of the exception block section */
!       rva = (ILInt32)ILWriterGetTextRVA(writer);
! 
!       /* write out the exception block section */
!       eBlocks = (System_Array **)ArrayToBuffer(_exceptionBlocks);
!       len = (unsigned long)_exceptionBlocks->length;
!       for (i = 0; i < len; ++i)
!       {
!               buf = (unsigned char *)ArrayToBuffer(eBlocks[i]);
!               length = (unsigned long)eBlocks[i]->length;
!               ILWriterTextWrite(writer, buf, length);
!       }
! 
!       /* register token fixups for the exception block section */
!       if (_exceptionBlockFixupPtrs && _exceptionBlockFixupOffsets)
!       {
!               ptrs = (ILNativeInt *)ArrayToBuffer(_exceptionBlockFixupPtrs);
!               offsets = (ILInt32 *)ArrayToBuffer(_exceptionBlockFixupOffsets);
!               length = (unsigned long)_exceptionBlockFixupPtrs->length;
!               for (i = 0; i < length; ++i)
!               {
!                       ILWriterSetFixup(writer, rva+offsets[i], (ILProgramItem 
*)ptrs[i]);
!               }
!       }
  
        IL_METADATA_UNLOCK(_thread);
***************
*** 1806,1809 ****
--- 1883,1915 ----
        IL_METADATA_UNLOCK(_thread);
        return bytes;
+ }
+ /*
+  * private static int ClrStandAloneToken(IntPtr module, IntPtr sig);
+  */
+ ILInt32 _IL_SignatureHelper_ClrStandAloneToken(ILExecThread *_thread,
+                                                ILNativeInt _module,
+                                                ILNativeInt _sig)
+ {
+       ILInt32 retval;
+       ILProgramItem *module;
+       ILImage *image;
+       ILType *sig;
+       ILStandAloneSig *saSig;
+ 
+       IL_METADATA_WRLOCK(_thread);
+ 
+       module = (ILProgramItem *)_module;
+       image = ILProgramItem_Image(module);
+       sig = (ILType *)_sig;
+       if (!(saSig = ILStandAloneSigCreate(image, 0, sig)))
+       {
+               IL_METADATA_UNLOCK(_thread);
+               ILExecThreadThrowOutOfMemory(_thread);
+               return 0;
+       }
+       retval = (ILInt32)ILProgramItem_Token(saSig);
+ 
+       IL_METADATA_UNLOCK(_thread);
+       return retval;
  }
  





reply via email to

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