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 lib_emit.c,1.14,1.15


From: Richard Baumann <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine lib_emit.c,1.14,1.15
Date: Sun, 20 Jul 2003 15:05:01 -0400

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

Modified Files:
        lib_emit.c 
Log Message:
Implement more lib_emit icalls and fix a few things for image writers.


Index: lib_emit.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_emit.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** lib_emit.c  20 Jul 2003 04:59:09 -0000      1.14
--- lib_emit.c  20 Jul 2003 19:04:59 -0000      1.15
***************
*** 1532,1537 ****
                                                         ILInt32 methodToken)
  {
!       /* TODO */
!       return 0;
  }
  
--- 1532,1578 ----
                                                         ILInt32 methodToken)
  {
!       ILType *retval;
!       ILContext *cntxt;
!       ILProgramItem *item;
!       ILImage *image;
!       ILMethod *method;
!       ILType *methodType;
!       ILType *tmp;
!       ILUInt32 callConv;
!       unsigned long params;
!       unsigned long i;
! 
!       if (!context || !module) { return 0; }
! 
!       IL_METADATA_WRLOCK(_thread);
! 
!       cntxt = (ILContext *)context;
!       item = (ILProgramItem *)module;
!       image = ILProgramItem_Image(item);
!       method = ILMethod_FromToken(image, (ILToken)methodToken);
!       methodType = ILMethod_Signature(method);
!       tmp = ILTypeGetReturnWithPrefixes(methodType);
!       callConv = ILType_CallConv(methodType);
!       if (!(retval = ILTypeCreateMethod(cntxt, tmp)))
!       {
!               IL_METADATA_UNLOCK(_thread);
!               ILExecThreadThrowOutOfMemory(_thread);
!               return 0;
!       }
!       ILTypeSetCallConv(retval, callConv);
!       params = ILTypeNumParams(methodType);
!       for (i = 0; i < params; ++i)
!       {
!               tmp = ILTypeGetParamWithPrefixes(methodType, i);
!               if (!(ILTypeAddParam(cntxt, retval, tmp)))
!               {
!                       IL_METADATA_UNLOCK(_thread);
!                       ILExecThreadThrowOutOfMemory(_thread);
!                       return 0;
!               }
!       }
! 
!       IL_METADATA_UNLOCK(_thread);
!       return (ILNativeInt)retval;
  }
  
***************
*** 1569,1574 ****
                                                   ILNativeInt sig)
  {
!       /* TODO */
!       return 0;
  }
  
--- 1610,1658 ----
                                                   ILNativeInt sig)
  {
!       ILProgramItem *item;
!       ILImage *image;
!       ILType *type;
!       ILUInt8 *buf;
!       System_Array *bytes;
!       unsigned long offset;
!       unsigned long length;
!       unsigned char *blob;
! 
!       IL_METADATA_WRLOCK(_thread);
! 
!       item = (ILProgramItem *)module;
!       image = ILProgramItem_Image(item);
!       type = (ILType *)sig;
!       if (ILType_IsMethod(type))
!       {
!               offset = ILTypeToMethodSig(image, type);
!       }
!       else if (ILType_IsField(type))
!       {
!               offset = ILTypeToFieldSig(image, type);
!       }
!       else
!       {
!               offset = ILTypeToOtherSig(image, type);
!       }
!       if (!offset)
!       {
!               IL_METADATA_UNLOCK(_thread);
!               ILExecThreadThrowOutOfMemory(_thread);
!               return 0;
!       }
!       blob = (unsigned char *)ILImageGetBlob(image, offset, &length);
!       bytes = (System_Array *)ILExecThreadNew(_thread, "[B", "(Ti)V", 
(ILVaInt)length);
!       if (!bytes)
!       {
!               IL_METADATA_UNLOCK(_thread);
!               ILExecThreadThrowOutOfMemory(_thread);
!               return 0;
!       }
!       buf = (ILUInt8 *)ArrayToBuffer(bytes);
!       ILMemCpy(buf, blob, length);
! 
!       IL_METADATA_UNLOCK(_thread);
!       return bytes;
  }
  





reply via email to

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