/[dotgnu-pnet]/pnet/engine/lib_emit.c
ViewVC logotype

Diff of /pnet/engine/lib_emit.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28 by t3rmin4t0r, Sat Sep 25 15:20:33 2004 UTC revision 1.29 by ktreichel, Tue Aug 23 10:45:52 2005 UTC
# Line 60  ILNativeInt _IL_AssemblyBuilder_ClrAssem Line 60  ILNativeInt _IL_AssemblyBuilder_ClrAssem
60          }          }
61    
62          /* Lock the metadata system while we do this */          /* Lock the metadata system while we do this */
63          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
64    
65          /* Determine which context to use: internal or external */          /* Determine which context to use: internal or external */
66          if((access & 1) != 0)          if((access & 1) != 0)
# Line 75  ILNativeInt _IL_AssemblyBuilder_ClrAssem Line 75  ILNativeInt _IL_AssemblyBuilder_ClrAssem
75                  context = ILContextCreate();                  context = ILContextCreate();
76                  if(!context)                  if(!context)
77                  {                  {
78                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
79                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
80                          return 0;                          return 0;
81                  }                  }
# Line 90  ILNativeInt _IL_AssemblyBuilder_ClrAssem Line 90  ILNativeInt _IL_AssemblyBuilder_ClrAssem
90                  {                  {
91                          ILContextDestroy(context);                          ILContextDestroy(context);
92                  }                  }
93                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
94                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
95                  return 0;                  return 0;
96          }          }
# Line 105  ILNativeInt _IL_AssemblyBuilder_ClrAssem Line 105  ILNativeInt _IL_AssemblyBuilder_ClrAssem
105                  {                  {
106                          ILContextDestroy(context);                          ILContextDestroy(context);
107                  }                  }
108                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
109                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
110                  return 0;                  return 0;
111          }          }
# Line 119  ILNativeInt _IL_AssemblyBuilder_ClrAssem Line 119  ILNativeInt _IL_AssemblyBuilder_ClrAssem
119                  {                  {
120                          ILContextDestroy(context);                          ILContextDestroy(context);
121                  }                  }
122                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
123                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
124                  return 0;                  return 0;
125          }          }
# Line 127  ILNativeInt _IL_AssemblyBuilder_ClrAssem Line 127  ILNativeInt _IL_AssemblyBuilder_ClrAssem
127          ILAssemblySetVersionSplit(retval, v1, v2, v3, v4);          ILAssemblySetVersionSplit(retval, v1, v2, v3, v4);
128    
129          /* Unlock and return the information to the caller */          /* Unlock and return the information to the caller */
130          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
131          *writerReturn = (ILNativeInt)writer;          *writerReturn = (ILNativeInt)writer;
132          return (ILNativeInt)retval;          return (ILNativeInt)retval;
133  }  }
# Line 150  ILBool _IL_AssemblyBuilder_ClrSave(ILExe Line 150  ILBool _IL_AssemblyBuilder_ClrSave(ILExe
150          int tmp;          int tmp;
151          int needChmod;          int needChmod;
152    
153          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
154    
155          item = (ILProgramItem *)_assembly;          item = (ILProgramItem *)_assembly;
156          image = ILProgramItem_Image(item);          image = ILProgramItem_Image(item);
# Line 158  ILBool _IL_AssemblyBuilder_ClrSave(ILExe Line 158  ILBool _IL_AssemblyBuilder_ClrSave(ILExe
158          entryMethod = (ILMethod *)_entryMethod;          entryMethod = (ILMethod *)_entryMethod;
159          if (!(path = (const char *)ILStringToPathname(_thread, _path)))          if (!(path = (const char *)ILStringToPathname(_thread, _path)))
160          {          {
161                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
162                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
163                  return 0;                  return 0;
164          }          }
# Line 166  ILBool _IL_AssemblyBuilder_ClrSave(ILExe Line 166  ILBool _IL_AssemblyBuilder_ClrSave(ILExe
166          {          {
167                  if (!(stream = fopen(path, "w")))                  if (!(stream = fopen(path, "w")))
168                  {                  {
169                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
170                          return 0;                          return 0;
171                  }                  }
172          }          }
# Line 210  ILBool _IL_AssemblyBuilder_ClrSave(ILExe Line 210  ILBool _IL_AssemblyBuilder_ClrSave(ILExe
210          {          {
211                  if ((fclose(stream)))                  if ((fclose(stream)))
212                  {                  {
213                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
214                          return 0;                          return 0;
215                  }                  }
216                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
217                  return 0;                  return 0;
218          }          }
219          else if (tmp == -1)          else if (tmp == -1)
220          {          {
221                  if ((fclose(stream)))                  if ((fclose(stream)))
222                  {                  {
223                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
224                          return 0;                          return 0;
225                  }                  }
226                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
227                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
228                  return 0;                  return 0;
229          }          }
230          if ((fclose(stream)))          if ((fclose(stream)))
231          {          {
232                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
233                  return 0;                  return 0;
234          }          }
235  #if !(defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__))  #if !(defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__))
# Line 241  ILBool _IL_AssemblyBuilder_ClrSave(ILExe Line 241  ILBool _IL_AssemblyBuilder_ClrSave(ILExe
241          }          }
242  #endif  #endif
243    
244          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
245          return (ILBool)1;          return (ILBool)1;
246  }  }
247  /*  /*
# Line 275  ILInt32 _IL_AssemblyBuilder_ClrWriteMeth Line 275  ILInt32 _IL_AssemblyBuilder_ClrWriteMeth
275          unsigned char *buf;          unsigned char *buf;
276          unsigned long i, len, length;          unsigned long i, len, length;
277    
278          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
279    
280          /* align to the next 4-byte boundary and get the starting rva */          /* align to the next 4-byte boundary and get the starting rva */
281          writer = (ILWriter *)_writer;          writer = (ILWriter *)_writer;
# Line 310  ILInt32 _IL_AssemblyBuilder_ClrWriteMeth Line 310  ILInt32 _IL_AssemblyBuilder_ClrWriteMeth
310          /* if there are no exception blocks, we're done */          /* if there are no exception blocks, we're done */
311          if (!_exceptionBlocks)          if (!_exceptionBlocks)
312          {          {
313                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
314                  return retval;                  return retval;
315          }          }
316    
# Line 342  ILInt32 _IL_AssemblyBuilder_ClrWriteMeth Line 342  ILInt32 _IL_AssemblyBuilder_ClrWriteMeth
342                  }                  }
343          }          }
344    
345          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
346          return retval;          return retval;
347  }  }
348    
# Line 440  ILNativeInt _IL_EventBuilder_ClrEventCre Line 440  ILNativeInt _IL_EventBuilder_ClrEventCre
440          ILClass *typeInfo;          ILClass *typeInfo;
441          const char *str;          const char *str;
442    
443          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
444    
445          info = (ILClass *)classInfo;          info = (ILClass *)classInfo;
446          typeInfo = (ILClass *)type;          typeInfo = (ILClass *)type;
447          if (!(str = (const char *)ILStringToAnsi(_thread, name)))          if (!(str = (const char *)ILStringToAnsi(_thread, name)))
448          {          {
449                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
450                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
451                  return 0;                  return 0;
452          }          }
453          if (!(retval = ILEventCreate(info, 0, str, (ILUInt32)attrs, typeInfo)))          if (!(retval = ILEventCreate(info, 0, str, (ILUInt32)attrs, typeInfo)))
454          {          {
455                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
456                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
457                  return 0;                  return 0;
458          }          }
459    
460          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
461          return (ILNativeInt)retval;          return (ILNativeInt)retval;
462  }  }
463    
# Line 475  void _IL_EventBuilder_ClrEventAddSemanti Line 475  void _IL_EventBuilder_ClrEventAddSemanti
475          ILToken tok;          ILToken tok;
476          ILMethod *method;          ILMethod *method;
477    
478          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
479    
480          item = (ILProgramItem *)eventInfo;          item = (ILProgramItem *)eventInfo;
481          image = ILProgramItem_Image(item);          image = ILProgramItem_Image(item);
482          tok = *((ILToken *)token);          tok = *((ILToken *)token);
483          if (!(method = ILMethod_FromToken(image,tok)))          if (!(method = ILMethod_FromToken(image,tok)))
484          {          {
485                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
486                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
487                  return;                  return;
488          }          }
489          if (!(ILMethodSemCreate(item, 0, (ILUInt32)attr, method)))          if (!(ILMethodSemCreate(item, 0, (ILUInt32)attr, method)))
490          {          {
491                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
492                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
493                  return;                  return;
494          }          }
495    
496          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
497  }  }
498    
499  /*  /*
# Line 510  ILNativeInt _IL_FieldBuilder_ClrFieldCre Line 510  ILNativeInt _IL_FieldBuilder_ClrFieldCre
510          ILType *sig;          ILType *sig;
511          const char *str;          const char *str;
512    
513          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
514    
515          info = (ILClass *)classInfo;          info = (ILClass *)classInfo;
516          sig = (ILType *)type;          sig = (ILType *)type;
517          if (!(str = (const char *)ILStringToAnsi(_thread, name)))          if (!(str = (const char *)ILStringToAnsi(_thread, name)))
518          {          {
519                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
520                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
521                  return 0;                  return 0;
522          }          }
523          if (!(retval = ILFieldCreate(info, 0, str, (ILUInt32)attrs)))          if (!(retval = ILFieldCreate(info, 0, str, (ILUInt32)attrs)))
524          {          {
525                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
526                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
527                  return 0;                  return 0;
528          }          }
529          ILMemberSetSignature((ILMember *)retval, sig);          ILMemberSetSignature((ILMember *)retval, sig);
530    
531          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
532          return (ILNativeInt)retval;          return (ILNativeInt)retval;
533  }  }
534    
# Line 549  void _IL_FieldBuilder_ClrFieldSetConstan Line 549  void _IL_FieldBuilder_ClrFieldSetConstan
549          ILExecValue blob;          ILExecValue blob;
550          unsigned long len;          unsigned long len;
551    
552          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
553    
554          owner = (ILProgramItem *)item;          owner = (ILProgramItem *)item;
555          image = ILProgramItem_Image(owner);          image = ILProgramItem_Image(owner);
# Line 569  void _IL_FieldBuilder_ClrFieldSetConstan Line 569  void _IL_FieldBuilder_ClrFieldSetConstan
569          {          {
570                  if (!(constant = ILConstantCreate(image, 0, owner, IL_META_ELEMTYPE_CLASS)))                  if (!(constant = ILConstantCreate(image, 0, owner, IL_META_ELEMTYPE_CLASS)))
571                  {                  {
572                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
573                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
574                          return;                          return;
575                  }                  }
576                  blob.int32Value = (ILInt32)0;                  blob.int32Value = (ILInt32)0;
577                  if (!(ILConstantSetValue(constant, &blob, 4)))                  if (!(ILConstantSetValue(constant, &blob, 4)))
578                  {                  {
579                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
580                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
581                          return;                          return;
582                  }                  }
583                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
584                  return;                  return;
585          }          }
586    
# Line 615  void _IL_FieldBuilder_ClrFieldSetConstan Line 615  void _IL_FieldBuilder_ClrFieldSetConstan
615                          len = (((System_String *)value)->length);                          len = (((System_String *)value)->length);
616                          if (!(blob.ptrValue = (ILUInt16 *)ILMalloc(len*2)))                          if (!(blob.ptrValue = (ILUInt16 *)ILMalloc(len*2)))
617                          {                          {
618                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
619                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
620                                  return;                                  return;
621                          }                          }
# Line 628  void _IL_FieldBuilder_ClrFieldSetConstan Line 628  void _IL_FieldBuilder_ClrFieldSetConstan
628                          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))                          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))
629                          {                          {
630                                  ILFree(blob.ptrValue);                                  ILFree(blob.ptrValue);
631                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
632                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
633                                  return;                                  return;
634                          }                          }
635                          if (!(ILConstantSetValue(constant, blob.ptrValue, len*2)))                          if (!(ILConstantSetValue(constant, blob.ptrValue, len*2)))
636                          {                          {
637                                  ILFree(blob.ptrValue);                                  ILFree(blob.ptrValue);
638                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
639                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
640                                  return;                                  return;
641                          }                          }
642                          ILFree(blob.ptrValue);                          ILFree(blob.ptrValue);
643                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
644                  }                  }
645                  return;                  return;
646    
647                  default:                  default:
648                  {                  {
649                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
650                  }                  }
651                  return;                  return;
652          }          }
653          if (!(ILExecThreadUnbox(_thread, type, value, &blob)))          if (!(ILExecThreadUnbox(_thread, type, value, &blob)))
654          {          {
655                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
656                  return;                  return;
657          }          }
658          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))
659          {          {
660                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
661                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
662                  return;                  return;
663          }          }
664          if (!(ILConstantSetValue(constant, &blob, len)))          if (!(ILConstantSetValue(constant, &blob, len)))
665          {          {
666                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
667                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
668                  return;                  return;
669          }          }
670    
671          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
672  }  }
673    
674  /*  /*
# Line 684  void _IL_FieldBuilder_ClrFieldSetMarshal Line 684  void _IL_FieldBuilder_ClrFieldSetMarshal
684          ILUInt8 *blob;          ILUInt8 *blob;
685          unsigned long length;          unsigned long length;
686    
687          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
688    
689          owner = (ILProgramItem *)item;          owner = (ILProgramItem *)item;
690          image = ILProgramItem_Image(owner);          image = ILProgramItem_Image(owner);
# Line 692  void _IL_FieldBuilder_ClrFieldSetMarshal Line 692  void _IL_FieldBuilder_ClrFieldSetMarshal
692          length = (unsigned long)data->length;          length = (unsigned long)data->length;
693          if (!(marshal = ILFieldMarshalCreate(image, 0, owner)))          if (!(marshal = ILFieldMarshalCreate(image, 0, owner)))
694          {          {
695                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
696                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
697                  return;                  return;
698          }          }
699          if (!(ILFieldMarshalSetType(marshal, blob, length)))          if (!(ILFieldMarshalSetType(marshal, blob, length)))
700          {          {
701                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
702                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
703                  return;                  return;
704          }          }
705    
706          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
707  }  }
708    
709  /*  /*
# Line 713  void _IL_FieldBuilder_ClrFieldSetOffset( Line 713  void _IL_FieldBuilder_ClrFieldSetOffset(
713                                          ILNativeInt item, ILInt32 offset)                                          ILNativeInt item, ILInt32 offset)
714  {  {
715          ILFieldLayout *layout;          ILFieldLayout *layout;
716          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
717          if(item)          if(item)
718          {          {
719                  layout = ILFieldLayoutGetFromOwner((ILField *)item);                  layout = ILFieldLayoutGetFromOwner((ILField *)item);
# Line 726  void _IL_FieldBuilder_ClrFieldSetOffset( Line 726  void _IL_FieldBuilder_ClrFieldSetOffset(
726                          if(!ILFieldLayoutCreate(ILProgramItem_Image(item), 0,                          if(!ILFieldLayoutCreate(ILProgramItem_Image(item), 0,
727                                                                          (ILField *)item, (ILUInt32)offset))                                                                          (ILField *)item, (ILUInt32)offset))
728                          {                          {
729                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
730                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
731                          }                          }
732                  }                  }
733          }          }
734          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
735  }  }
736    
737  /*  /*
# Line 741  void _IL_FieldBuilder_ClrFieldSetRVA(ILE Line 741  void _IL_FieldBuilder_ClrFieldSetRVA(ILE
741                                       ILNativeInt item, ILInt32 rva)                                       ILNativeInt item, ILInt32 rva)
742  {  {
743          ILFieldRVA *rvainfo;          ILFieldRVA *rvainfo;
744          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
745          if(item)          if(item)
746          {          {
747                  rvainfo = ILFieldRVAGetFromOwner((ILField *)item);                  rvainfo = ILFieldRVAGetFromOwner((ILField *)item);
# Line 754  void _IL_FieldBuilder_ClrFieldSetRVA(ILE Line 754  void _IL_FieldBuilder_ClrFieldSetRVA(ILE
754                          if(!ILFieldRVACreate(ILProgramItem_Image(item), 0,                          if(!ILFieldRVACreate(ILProgramItem_Image(item), 0,
755                                                                   (ILField *)item, (ILUInt32)rva))                                                                   (ILField *)item, (ILUInt32)rva))
756                          {                          {
757                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
758                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
759                          }                          }
760                  }                  }
761          }          }
762          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
763  }  }
764    
765  /*  /*
# Line 773  ILNativeInt _IL_ModuleBuilder_ClrModuleC Line 773  ILNativeInt _IL_ModuleBuilder_ClrModuleC
773          ILImage *image;          ILImage *image;
774          const char *str;          const char *str;
775    
776          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
777    
778          image = ILProgramItem_Image(assembly);          image = ILProgramItem_Image(assembly);
779          if (!(str = (const char *)ILStringToAnsi(_thread, name)))          if (!(str = (const char *)ILStringToAnsi(_thread, name)))
780          {          {
781                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
782                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
783                  return 0;                  return 0;
784          }          }
785          if (!(retval = ILModuleCreate(image, 0, str, NULL)))          if (!(retval = ILModuleCreate(image, 0, str, NULL)))
786          {          {
787                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
788                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
789                  return 0;                  return 0;
790          }          }
791    
792          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
793          return (ILNativeInt)retval;          return (ILNativeInt)retval;
794  }  }
795    
# Line 806  ILInt32 _IL_ModuleBuilder_ClrModuleCreat Line 806  ILInt32 _IL_ModuleBuilder_ClrModuleCreat
806          const char *string;          const char *string;
807          int length;          int length;
808    
809          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
810    
811          item = (ILProgramItem *)module;          item = (ILProgramItem *)module;
812          image = ILProgramItem_Image(item);          image = ILProgramItem_Image(item);
# Line 814  ILInt32 _IL_ModuleBuilder_ClrModuleCreat Line 814  ILInt32 _IL_ModuleBuilder_ClrModuleCreat
814          string = (const char *)ILStringToAnsi(_thread, str);          string = (const char *)ILStringToAnsi(_thread, str);
815          if (!(retval = ILImageAddUserString(image, string, length)))          if (!(retval = ILImageAddUserString(image, string, length)))
816          {          {
817                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
818                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
819                  return 0;                  return 0;
820          }          }
821    
822          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
823          return (ILInt32)(retval | IL_META_TOKEN_STRING);          return (ILInt32)(retval | IL_META_TOKEN_STRING);
824  }  }
825    
# Line 860  ILNativeInt _IL_PropertyBuilder_ClrPrope Line 860  ILNativeInt _IL_PropertyBuilder_ClrPrope
860          ILType *sig;          ILType *sig;
861          const char *str;          const char *str;
862    
863          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
864    
865          info = (ILClass *)classInfo;          info = (ILClass *)classInfo;
866          sig = (ILType *)signature;          sig = (ILType *)signature;
867          if (!(str = (const char *)ILStringToAnsi(_thread, name)))          if (!(str = (const char *)ILStringToAnsi(_thread, name)))
868          {          {
869                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
870                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
871                  return 0;                  return 0;
872          }          }
873          if (!(retval = ILPropertyCreate(info, 0, str, (ILUInt32)attrs, sig)))          if (!(retval = ILPropertyCreate(info, 0, str, (ILUInt32)attrs, sig)))
874          {          {
875                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
876                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
877                  return 0;                  return 0;
878          }          }
879    
880          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
881          return (ILNativeInt)retval;          return (ILNativeInt)retval;
882  }  }
883    
# Line 896  void _IL_PropertyBuilder_ClrPropertyAddS Line 896  void _IL_PropertyBuilder_ClrPropertyAddS
896          ILToken tok;          ILToken tok;
897          ILMethod *method;          ILMethod *method;
898    
899          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
900    
901          itemInfo = (ILProgramItem *)item;          itemInfo = (ILProgramItem *)item;
902          image = ILProgramItem_Image(itemInfo);          image = ILProgramItem_Image(itemInfo);
903          tok = *((ILToken *)token);          tok = *((ILToken *)token);
904          if (!(method = ILMethod_FromToken(image,tok)))          if (!(method = ILMethod_FromToken(image,tok)))
905          {          {
906                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
907                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
908                  return;                  return;
909          }          }
910          if (!(ILMethodSemCreate(itemInfo, 0, (ILUInt32)attr, method)))          if (!(ILMethodSemCreate(itemInfo, 0, (ILUInt32)attr, method)))
911          {          {
912                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
913                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
914                  return;                  return;
915          }          }
916    
917          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
918  }  }
919    
920  /*  /*
# Line 934  void _IL_PropertyBuilder_ClrPropertySetC Line 934  void _IL_PropertyBuilder_ClrPropertySetC
934          ILExecValue blob;          ILExecValue blob;
935          unsigned long len;          unsigned long len;
936    
937          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
938    
939          owner = (ILProgramItem *)item;          owner = (ILProgramItem *)item;
940          image = ILProgramItem_Image(owner);          image = ILProgramItem_Image(owner);
# Line 954  void _IL_PropertyBuilder_ClrPropertySetC Line 954  void _IL_PropertyBuilder_ClrPropertySetC
954          {          {
955                  if (!(constant = ILConstantCreate(image, 0, owner, IL_META_ELEMTYPE_CLASS)))                  if (!(constant = ILConstantCreate(image, 0, owner, IL_META_ELEMTYPE_CLASS)))
956                  {                  {
957                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
958                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
959                          return;                          return;
960                  }                  }
961                  blob.int32Value = (ILInt32)0;                  blob.int32Value = (ILInt32)0;
962                  if (!(ILConstantSetValue(constant, &blob, 4)))                  if (!(ILConstantSetValue(constant, &blob, 4)))
963                  {                  {
964                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
965                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
966                          return;                          return;
967                  }                  }
968                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
969                  return;                  return;
970          }          }
971    
# Line 1000  void _IL_PropertyBuilder_ClrPropertySetC Line 1000  void _IL_PropertyBuilder_ClrPropertySetC
1000                          len = (((System_String *)value)->length);                          len = (((System_String *)value)->length);
1001                          if (!(blob.ptrValue = (ILUInt16 *)ILMalloc(len*2)))                          if (!(blob.ptrValue = (ILUInt16 *)ILMalloc(len*2)))
1002                          {                          {
1003                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1004                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
1005                                  return;                                  return;
1006                          }                          }
# Line 1013  void _IL_PropertyBuilder_ClrPropertySetC Line 1013  void _IL_PropertyBuilder_ClrPropertySetC
1013                          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))                          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))
1014                          {                          {
1015                                  ILFree(blob.ptrValue);                                  ILFree(blob.ptrValue);
1016                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1017                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
1018                                  return;                                  return;
1019                          }                          }
1020                          if (!(ILConstantSetValue(constant, blob.ptrValue, len*2)))                          if (!(ILConstantSetValue(constant, blob.ptrValue, len*2)))
1021                          {                          {
1022                                  ILFree(blob.ptrValue);                                  ILFree(blob.ptrValue);
1023                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1024                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
1025                                  return;                                  return;
1026                          }                          }
1027                          ILFree(blob.ptrValue);                          ILFree(blob.ptrValue);
1028                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1029                  }                  }
1030                  return;                  return;
1031    
1032                  default:                  default:
1033                  {                  {
1034                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1035                  }                  }
1036                  return;                  return;
1037          }          }
1038          if (!(ILExecThreadUnbox(_thread, type, value, &blob)))          if (!(ILExecThreadUnbox(_thread, type, value, &blob)))
1039          {          {
1040                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1041                  return;                  return;
1042          }          }
1043          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))          if (!(constant = ILConstantCreate(image, 0, owner, elemType)))
1044          {          {
1045                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1046                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1047                  return;                  return;
1048          }          }
1049          if (!(ILConstantSetValue(constant, &blob, len)))          if (!(ILConstantSetValue(constant, &blob, len)))
1050          {          {
1051                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1052                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1053                  return;                  return;
1054          }          }
1055    
1056          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1057  }  }
1058    
1059  /*  /*
# Line 1077  ILNativeInt _IL_TypeBuilder_ClrTypeCreat Line 1077  ILNativeInt _IL_TypeBuilder_ClrTypeCreat
1077          ILClass *baseClass;          ILClass *baseClass;
1078          ILClass *retval;          ILClass *retval;
1079    
1080          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1081    
1082          image = ((ILProgramItem *)module)->image;          image = ((ILProgramItem *)module)->image;
1083          token = *((ILToken *)parent);          token = *((ILToken *)parent);
1084          if (!(scope = (ILProgramItem *)nestedParent) &&          if (!(scope = (ILProgramItem *)nestedParent) &&
1085              !(scope = ILClassGlobalScope(image)))              !(scope = ILClassGlobalScope(image)))
1086          {          {
1087                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1088                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1089                  return 0;                  return 0;
1090          }          }
1091          if (!(typeName = (const char *)ILStringToAnsi(_thread, name)))          if (!(typeName = (const char *)ILStringToAnsi(_thread, name)))
1092          {          {
1093                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1094                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1095                  return 0;                  return 0;
1096          }          }
# Line 1098  ILNativeInt _IL_TypeBuilder_ClrTypeCreat Line 1098  ILNativeInt _IL_TypeBuilder_ClrTypeCreat
1098          {          {
1099                  if (!(nameSpace = (const char *)ILStringToAnsi(_thread, nspace)))                  if (!(nameSpace = (const char *)ILStringToAnsi(_thread, nspace)))
1100                  {                  {
1101                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1102                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1103                          return 0;                          return 0;
1104                  }                  }
# Line 1117  ILNativeInt _IL_TypeBuilder_ClrTypeCreat Line 1117  ILNativeInt _IL_TypeBuilder_ClrTypeCreat
1117          }          }
1118          else if (!(baseClass = ILClass_FromToken(image, token)))          else if (!(baseClass = ILClass_FromToken(image, token)))
1119          {          {
1120                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1121                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1122                  return 0;                  return 0;
1123          }          }
# Line 1127  ILNativeInt _IL_TypeBuilder_ClrTypeCreat Line 1127  ILNativeInt _IL_TypeBuilder_ClrTypeCreat
1127                  ILClassSetAttrs(retval, (ILUInt32)-1, (ILUInt32)attr);                  ILClassSetAttrs(retval, (ILUInt32)-1, (ILUInt32)attr);
1128          }          }
1129    
1130          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1131          return (ILNativeInt)retval;          return (ILNativeInt)retval;
1132  }  }
1133    
# Line 1139  void _IL_TypeBuilder_ClrTypeSetPackingSi Line 1139  void _IL_TypeBuilder_ClrTypeSetPackingSi
1139                                             ILInt32 packingSize)                                             ILInt32 packingSize)
1140  {  {
1141          ILClassLayout *layout;          ILClassLayout *layout;
1142          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1143          if(classInfo)          if(classInfo)
1144          {          {
1145                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);
# Line 1153  void _IL_TypeBuilder_ClrTypeSetPackingSi Line 1153  void _IL_TypeBuilder_ClrTypeSetPackingSi
1153                                                                          (ILClass *)classInfo,                                                                          (ILClass *)classInfo,
1154                                                                          (ILUInt32)packingSize, 0))                                                                          (ILUInt32)packingSize, 0))
1155                          {                          {
1156                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1157                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
1158                          }                          }
1159                  }                  }
1160          }          }
1161          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1162  }  }
1163    
1164  /*  /*
# Line 1169  void _IL_TypeBuilder_ClrTypeSetClassSize Line 1169  void _IL_TypeBuilder_ClrTypeSetClassSize
1169                                           ILInt32 classSize)                                           ILInt32 classSize)
1170  {  {
1171          ILClassLayout *layout;          ILClassLayout *layout;
1172          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1173          if(classInfo)          if(classInfo)
1174          {          {
1175                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);
# Line 1183  void _IL_TypeBuilder_ClrTypeSetClassSize Line 1183  void _IL_TypeBuilder_ClrTypeSetClassSize
1183                                                                          (ILClass *)classInfo,                                                                          (ILClass *)classInfo,
1184                                                                          0, (ILUInt32)classSize))                                                                          0, (ILUInt32)classSize))
1185                          {                          {
1186                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1187                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
1188                          }                          }
1189                  }                  }
1190          }          }
1191          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1192  }  }
1193    
1194  /*  /*
# Line 1203  void _IL_TypeBuilder_ClrTypeAddInterface Line 1203  void _IL_TypeBuilder_ClrTypeAddInterface
1203          ILImage *image;          ILImage *image;
1204          ILClass *interface;          ILClass *interface;
1205    
1206          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1207    
1208          class = (ILClass *)classInfo;          class = (ILClass *)classInfo;
1209          token = *((ILToken *)iface);          token = *((ILToken *)iface);
1210          image = ILClassToImage(class);          image = ILClassToImage(class);
1211          if (!(interface = ILClass_FromToken(image, token)))          if (!(interface = ILClass_FromToken(image, token)))
1212          {          {
1213                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1214                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1215                  return;                  return;
1216          }          }
1217          if (!(ILClassAddImplements(class, interface, token)))          if (!(ILClassAddImplements(class, interface, token)))
1218          {          {
1219                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1220                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1221                  return;                  return;
1222          }          }
1223    
1224          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1225  }  }
1226    
1227  /*  /*
# Line 1232  ILInt32 _IL_TypeBuilder_ClrTypeGetPackin Line 1232  ILInt32 _IL_TypeBuilder_ClrTypeGetPackin
1232  {  {
1233          ILInt32 size = 0;          ILInt32 size = 0;
1234          ILClassLayout *layout;          ILClassLayout *layout;
1235          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1236          if(classInfo)          if(classInfo)
1237          {          {
1238                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);
# Line 1241  ILInt32 _IL_TypeBuilder_ClrTypeGetPackin Line 1241  ILInt32 _IL_TypeBuilder_ClrTypeGetPackin
1241                          size = (ILInt32)(ILClassLayoutGetPackingSize(layout));                          size = (ILInt32)(ILClassLayoutGetPackingSize(layout));
1242                  }                  }
1243          }          }
1244          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1245          return size;          return size;
1246  }  }
1247    
# Line 1253  ILInt32 _IL_TypeBuilder_ClrTypeGetClassS Line 1253  ILInt32 _IL_TypeBuilder_ClrTypeGetClassS
1253  {  {
1254          ILInt32 size = 0;          ILInt32 size = 0;
1255          ILClassLayout *layout;          ILClassLayout *layout;
1256          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1257          if(classInfo)          if(classInfo)
1258          {          {
1259                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);                  layout = ILClassLayoutGetFromOwner((ILClass *)classInfo);
# Line 1262  ILInt32 _IL_TypeBuilder_ClrTypeGetClassS Line 1262  ILInt32 _IL_TypeBuilder_ClrTypeGetClassS
1262                          size = (ILInt32)(ILClassLayoutGetClassSize(layout));                          size = (ILInt32)(ILClassLayoutGetClassSize(layout));
1263                  }                  }
1264          }          }
1265          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1266          return size;          return size;
1267  }  }
1268    
# Line 1278  void _IL_TypeBuilder_ClrTypeSetParent(IL Line 1278  void _IL_TypeBuilder_ClrTypeSetParent(IL
1278          ILImage *image;          ILImage *image;
1279          ILClass *parentClass;          ILClass *parentClass;
1280    
1281          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1282    
1283          class = (ILClass *)classInfo;          class = (ILClass *)classInfo;
1284          token = *((ILToken *)parent);          token = *((ILToken *)parent);
1285          image = ILClassToImage(class);          image = ILClassToImage(class);
1286          if (!(parentClass = ILClass_FromToken(image, token)))          if (!(parentClass = ILClass_FromToken(image, token)))
1287          {          {
1288                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1289                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1290                  return;                  return;
1291          }          }
1292          ILClassSetParent(class, parentClass);          ILClassSetParent(class, parentClass);
1293    
1294          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1295  }  }
1296    
1297  /*  /*
# Line 1305  ILInt32 _IL_TypeBuilder_ClrTypeImport(IL Line 1305  ILInt32 _IL_TypeBuilder_ClrTypeImport(IL
1305          ILClass *import;          ILClass *import;
1306          ILToken token;          ILToken token;
1307    
1308          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1309    
1310          image = ((ILProgramItem *)module)->image;          image = ((ILProgramItem *)module)->image;
1311          import = ILClassImport(image, (ILClass *)classInfo);          import = ILClassImport(image, (ILClass *)classInfo);
# Line 1315  ILInt32 _IL_TypeBuilder_ClrTypeImport(IL Line 1315  ILInt32 _IL_TypeBuilder_ClrTypeImport(IL
1315                  token = ILClass_Token(import);                  token = ILClass_Token(import);
1316          }          }
1317    
1318          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1319          return (ILInt32)token;          return (ILInt32)token;
1320  }  }
1321    
# Line 1330  ILInt32 _IL_TypeBuilder_ClrTypeImportMem Line 1330  ILInt32 _IL_TypeBuilder_ClrTypeImportMem
1330          ILMember *import;          ILMember *import;
1331          ILToken token;          ILToken token;
1332    
1333          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1334    
1335          image = ((ILProgramItem *)module)->image;          image = ((ILProgramItem *)module)->image;
1336          import = ILMemberImport(image, (ILMember *)memberInfo);          import = ILMemberImport(image, (ILMember *)memberInfo);
1337          if (!import)          if (!import)
1338          {          {
1339                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1340                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1341                  return 0;                  return 0;
1342          }          }
1343          token = ILMember_Token(import);          token = ILMember_Token(import);
1344    
1345          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1346          return (ILInt32)token;          return (ILInt32)token;
1347  }  }
1348    
# Line 1360  void _IL_TypeBuilder_ClrTypeAddOverride( Line 1360  void _IL_TypeBuilder_ClrTypeAddOverride(
1360          ILMethod *decl;          ILMethod *decl;
1361          ILClass *class;          ILClass *class;
1362    
1363          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1364    
1365          image = ((ILProgramItem *)module)->image;          image = ((ILProgramItem *)module)->image;
1366          if (!(body = ILMethod_FromToken(image, (ILToken)bodyToken)))          if (!(body = ILMethod_FromToken(image, (ILToken)bodyToken)))
1367          {          {
1368                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1369                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1370                  return;                  return;
1371          }          }
1372          if (!(decl = ILMethod_FromToken(image, (ILToken)declToken)))          if (!(decl = ILMethod_FromToken(image, (ILToken)declToken)))
1373          {          {
1374                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1375                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1376                  return;                  return;
1377          }          }
1378          class = ILMethod_Owner(decl);          class = ILMethod_Owner(decl);
1379          if (!(ILOverrideCreate(class, 0, decl, body)))          if (!(ILOverrideCreate(class, 0, decl, body)))
1380          {          {
1381                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1382                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1383                  return;                  return;
1384          }          }
1385    
1386          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1387  }  }
1388    
1389  /*  /*
# Line 1401  ILNativeInt _IL_MethodBuilder_ClrMethodC Line 1401  ILNativeInt _IL_MethodBuilder_ClrMethodC
1401          const char *str;          const char *str;
1402          ILMethod *method;          ILMethod *method;
1403    
1404          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1405    
1406          class = (ILClass *)classInfo;          class = (ILClass *)classInfo;
1407          if (!(str = (const char *)ILStringToAnsi(_thread, name)))          if (!(str = (const char *)ILStringToAnsi(_thread, name)))
1408          {          {
1409                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1410                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1411                  return 0;                  return 0;
1412          }          }
1413          if (!(method = ILMethodCreate(class, 0, str, (ILUInt32)attributes)))          if (!(method = ILMethodCreate(class, 0, str, (ILUInt32)attributes)))
1414          {          {
1415                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1416                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1417                  return 0;                  return 0;
1418          }          }
1419          ILMemberSetSignature((ILMember *)method, (ILType *)signature);          ILMemberSetSignature((ILMember *)method, (ILType *)signature);
1420    
1421          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1422          return (ILNativeInt)method;          return (ILNativeInt)method;
1423  }  }
1424    
# Line 1479  void _IL_MethodBuilder_ClrMethodAddPInvo Line 1479  void _IL_MethodBuilder_ClrMethodAddPInvo
1479          const char *dll;          const char *dll;
1480          const char *entry;          const char *entry;
1481    
1482          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1483    
1484          methodInfo = (ILMethod *)method;          methodInfo = (ILMethod *)method;
1485          image = ((ILProgramItem *)methodInfo)->image;          image = ((ILProgramItem *)methodInfo)->image;
1486          if (!(dll = (const char *)ILStringToAnsi(_thread, dllName)))          if (!(dll = (const char *)ILStringToAnsi(_thread, dllName)))
1487          {          {
1488                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1489                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1490                  return;                  return;
1491          }          }
1492          if (!(entry = (const char *)ILStringToAnsi(_thread, entryName)))          if (!(entry = (const char *)ILStringToAnsi(_thread, entryName)))
1493          {          {
1494                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1495                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1496                  return;                  return;
1497          }          }
1498          if (!(module = ILModuleCreate(image, 0, dll, 0)))          if (!(module = ILModuleCreate(image, 0, dll, 0)))
1499          {          {
1500                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1501                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1502                  return;                  return;
1503          }          }
1504          if (!(ILPInvokeCreate(methodInfo, 0, (ILUInt32)pinvAttrs, module, entry)))          if (!(ILPInvokeCreate(methodInfo, 0, (ILUInt32)pinvAttrs, module, entry)))
1505          {          {
1506                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1507                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1508                  return;                  return;
1509          }          }
1510    
1511          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1512  }  }
1513    
1514  /*  /*
# Line 1521  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1521  ILNativeInt _IL_SignatureHelper_ClrSigCr
1521                                                     ILNativeInt returnType)                                                     ILNativeInt returnType)
1522  {  {
1523          ILType *type = 0;          ILType *type = 0;
1524          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1525          if(context)          if(context)
1526          {          {
1527                  type = ILTypeCreateMethod((ILContext *)context, (ILType *)returnType);                  type = ILTypeCreateMethod((ILContext *)context, (ILType *)returnType);
1528                  if(!type)                  if(!type)
1529                  {                  {
1530                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1531                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1532                          return 0;                          return 0;
1533                  }                  }
1534                  ILTypeSetCallConv(type, (ILUInt32)callConv);                  ILTypeSetCallConv(type, (ILUInt32)callConv);
1535          }          }
1536          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1537          return (ILNativeInt)type;          return (ILNativeInt)type;
1538  }  }
1539    
# Line 1546  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1546  ILNativeInt _IL_SignatureHelper_ClrSigCr
1546                                                       ILNativeInt returnType)                                                       ILNativeInt returnType)
1547  {  {
1548          ILType *type = 0;          ILType *type = 0;
1549          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1550          if(context)          if(context)
1551          {          {
1552                  type = ILTypeCreateProperty((ILContext *)context, (ILType *)returnType);                  type = ILTypeCreateProperty((ILContext *)context, (ILType *)returnType);
1553                  if(!type)                  if(!type)
1554                  {                  {
1555                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1556                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1557                          return 0;                          return 0;
1558                  }                  }
1559          }          }
1560          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1561          return (ILNativeInt)type;          return (ILNativeInt)type;
1562  }  }
1563    
# Line 1606  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1606  ILNativeInt _IL_SignatureHelper_ClrSigCr
1606                                                    ILNativeInt elemType)                                                    ILNativeInt elemType)
1607  {  {
1608          ILType *type = 0;          ILType *type = 0;
1609          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1610          if(context)          if(context)
1611          {          {
1612                  type = ILTypeCreateArray                  type = ILTypeCreateArray
# Line 1614  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1614  ILNativeInt _IL_SignatureHelper_ClrSigCr
1614                           (ILType *)elemType);                           (ILType *)elemType);
1615                  if(!type)                  if(!type)
1616                  {                  {
1617                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1618                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1619                          return 0;                          return 0;
1620                  }                  }
1621          }          }
1622          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1623          return (ILNativeInt)type;          return (ILNativeInt)type;
1624  }  }
1625    
# Line 1631  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1631  ILNativeInt _IL_SignatureHelper_ClrSigCr
1631                                                      ILNativeInt elemType)                                                      ILNativeInt elemType)
1632  {  {
1633          ILType *type = 0;          ILType *type = 0;
1634          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1635          if(context)          if(context)
1636          {          {
1637                  type = ILTypeCreateRef                  type = ILTypeCreateRef
1638                          ((ILContext *)context, IL_TYPE_COMPLEX_PTR, (ILType *)elemType);                          ((ILContext *)context, IL_TYPE_COMPLEX_PTR, (ILType *)elemType);
1639                  if(!type)                  if(!type)
1640                  {                  {
1641                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1642                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1643                          return 0;                          return 0;
1644                  }                  }
1645          }          }
1646          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1647          return (ILNativeInt)type;          return (ILNativeInt)type;
1648  }  }
1649    
# Line 1655  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1655  ILNativeInt _IL_SignatureHelper_ClrSigCr
1655                                                    ILNativeInt elemType)                                                    ILNativeInt elemType)
1656  {  {
1657          ILType *type = 0;          ILType *type = 0;
1658          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1659          if(context)          if(context)
1660          {          {
1661                  type = ILTypeCreateRef                  type = ILTypeCreateRef
1662                          ((ILContext *)context, IL_TYPE_COMPLEX_BYREF, (ILType *)elemType);                          ((ILContext *)context, IL_TYPE_COMPLEX_BYREF, (ILType *)elemType);
1663                  if(!type)                  if(!type)
1664                  {                  {
1665                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1666                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1667                          return 0;                          return 0;
1668                  }                  }
1669          }          }
1670          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1671          return (ILNativeInt)type;          return (ILNativeInt)type;
1672  }  }
1673    
# Line 1716  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1716  ILNativeInt _IL_SignatureHelper_ClrSigCr
1716                                                    ILNativeInt context)                                                    ILNativeInt context)
1717  {  {
1718          ILType *type = 0;          ILType *type = 0;
1719          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1720          if(context)          if(context)
1721          {          {
1722                  type = ILTypeCreateLocalList((ILContext *)context);                  type = ILTypeCreateLocalList((ILContext *)context);
1723                  if(!type)                  if(!type)
1724                  {                  {
1725                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1726                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1727                          return 0;                          return 0;
1728                  }                  }
1729          }          }
1730          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1731          return (ILNativeInt)type;          return (ILNativeInt)type;
1732  }  }
1733    
# Line 1741  ILBool _IL_SignatureHelper_ClrSigAddArgu Line 1741  ILBool _IL_SignatureHelper_ClrSigAddArgu
1741                                               ILNativeInt arg)                                               ILNativeInt arg)
1742  {  {
1743          int result = 0;          int result = 0;
1744          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1745          if(context && sig)          if(context && sig)
1746          {          {
1747                  if(ILType_IsComplex((ILType *)sig) &&                  if(ILType_IsComplex((ILType *)sig) &&
# Line 1750  ILBool _IL_SignatureHelper_ClrSigAddArgu Line 1750  ILBool _IL_SignatureHelper_ClrSigAddArgu
1750                          if(!ILTypeAddLocal((ILContext *)context,                          if(!ILTypeAddLocal((ILContext *)context,
1751                                                             (ILType *)sig, (ILType *)arg))                                                             (ILType *)sig, (ILType *)arg))
1752                          {                          {
1753                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1754                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
1755                                  return 0;                                  return 0;
1756                          }                          }
# Line 1761  ILBool _IL_SignatureHelper_ClrSigAddArgu Line 1761  ILBool _IL_SignatureHelper_ClrSigAddArgu
1761                          if(!ILTypeAddParam((ILContext *)context,                          if(!ILTypeAddParam((ILContext *)context,
1762                                                             (ILType *)sig, (ILType *)arg))                                                             (ILType *)sig, (ILType *)arg))
1763                          {                          {
1764                                  IL_METADATA_UNLOCK(_thread);                                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1765                                  ILExecThreadThrowOutOfMemory(_thread);                                  ILExecThreadThrowOutOfMemory(_thread);
1766                                  return 0;                                  return 0;
1767                          }                          }
1768                          result = 1;                          result = 1;
1769                  }                  }
1770          }          }
1771          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1772          return (ILBool)result;          return (ILBool)result;
1773  }  }
1774    
# Line 1780  ILBool _IL_SignatureHelper_ClrSigAddSent Line 1780  ILBool _IL_SignatureHelper_ClrSigAddSent
1780                                               ILNativeInt sig)                                               ILNativeInt sig)
1781  {  {
1782          int result = 0;          int result = 0;
1783          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1784          if(context && sig)          if(context && sig)
1785          {          {
1786                  if(!ILTypeAddSentinel((ILContext *)context, (ILType *)sig))                  if(!ILTypeAddSentinel((ILContext *)context, (ILType *)sig))
1787                  {                  {
1788                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1789                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1790                          return 0;                          return 0;
1791                  }                  }
1792                  result = 1;                  result = 1;
1793          }          }
1794          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1795          return (ILBool)result;          return (ILBool)result;
1796  }  }
1797    
# Line 1817  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1817  ILNativeInt _IL_SignatureHelper_ClrSigCr
1817    
1818          if (!context || !module) { return 0; }          if (!context || !module) { return 0; }
1819    
1820          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1821    
1822          cntxt = (ILContext *)context;          cntxt = (ILContext *)context;
1823          item = (ILProgramItem *)module;          item = (ILProgramItem *)module;
# Line 1828  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1828  ILNativeInt _IL_SignatureHelper_ClrSigCr
1828          callConv = ILType_CallConv(methodType);          callConv = ILType_CallConv(methodType);
1829          if (!(retval = ILTypeCreateMethod(cntxt, tmp)))          if (!(retval = ILTypeCreateMethod(cntxt, tmp)))
1830          {          {
1831                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1832                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1833                  return 0;                  return 0;
1834          }          }
# Line 1839  ILNativeInt _IL_SignatureHelper_ClrSigCr Line 1839  ILNativeInt _IL_SignatureHelper_ClrSigCr
1839                  tmp = ILTypeGetParamWithPrefixes(methodType, i);                  tmp = ILTypeGetParamWithPrefixes(methodType, i);
1840                  if (!(ILTypeAddParam(cntxt, retval, tmp)))                  if (!(ILTypeAddParam(cntxt, retval, tmp)))
1841                  {                  {
1842                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1843                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
1844                          return 0;                          return 0;
1845                  }                  }
1846          }          }
1847    
1848          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1849          return (ILNativeInt)retval;          return (ILNativeInt)retval;
1850  }  }
1851    
# Line 1888  ILInt64 _IL_SignatureHelper_ClrSigFinali Line 1888  ILInt64 _IL_SignatureHelper_ClrSigFinali
1888          ILType *type;          ILType *type;
1889          unsigned long offset;          unsigned long offset;
1890    
1891          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1892    
1893          item = (ILProgramItem *)module;          item = (ILProgramItem *)module;
1894          image = ILProgramItem_Image(item);          image = ILProgramItem_Image(item);
# Line 1907  ILInt64 _IL_SignatureHelper_ClrSigFinali Line 1907  ILInt64 _IL_SignatureHelper_ClrSigFinali
1907          }          }
1908          if (!offset)          if (!offset)
1909          {          {
1910                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1911                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1912                  return (ILInt64)-1;                  return (ILInt64)-1;
1913          }          }
1914    
1915          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1916          return (ILInt64)offset;          return (ILInt64)offset;
1917  }  }
1918    
# Line 1931  System_Array *_IL_SignatureHelper_ClrSig Line 1931  System_Array *_IL_SignatureHelper_ClrSig
1931          unsigned long length;          unsigned long length;
1932          unsigned char *blob;          unsigned char *blob;
1933    
1934          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1935    
1936          item = (ILProgramItem *)module;          item = (ILProgramItem *)module;
1937          image = ILProgramItem_Image(item);          image = ILProgramItem_Image(item);
# Line 1940  System_Array *_IL_SignatureHelper_ClrSig Line 1940  System_Array *_IL_SignatureHelper_ClrSig
1940          bytes = (System_Array *)ILExecThreadNew(_thread, "[B", "(Ti)V", (ILVaInt)length);          bytes = (System_Array *)ILExecThreadNew(_thread, "[B", "(Ti)V", (ILVaInt)length);
1941          if (!bytes)          if (!bytes)
1942          {          {
1943                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1944                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1945                  return 0;                  return 0;
1946          }          }
1947          buf = (ILUInt8 *)ArrayToBuffer(bytes);          buf = (ILUInt8 *)ArrayToBuffer(bytes);
1948          ILMemCpy(buf, blob, length);          ILMemCpy(buf, blob, length);
1949    
1950          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1951          return bytes;          return bytes;
1952  }  }
1953  /*  /*
# Line 1963  ILInt32 _IL_SignatureHelper_ClrStandAlon Line 1963  ILInt32 _IL_SignatureHelper_ClrStandAlon
1963          ILType *sig;          ILType *sig;
1964          ILStandAloneSig *saSig;          ILStandAloneSig *saSig;
1965    
1966          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1967    
1968          module = (ILProgramItem *)_module;          module = (ILProgramItem *)_module;
1969          image = ILProgramItem_Image(module);          image = ILProgramItem_Image(module);
1970          sig = (ILType *)_sig;          sig = (ILType *)_sig;
1971          if (!(saSig = ILStandAloneSigCreate(image, 0, sig)))          if (!(saSig = ILStandAloneSigCreate(image, 0, sig)))
1972          {          {
1973                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1974                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
1975                  return 0;                  return 0;
1976          }          }
1977          retval = (ILInt32)ILProgramItem_Token(saSig);          retval = (ILInt32)ILProgramItem_Token(saSig);
1978    
1979          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
1980          return retval;          return retval;
1981  }  }
1982    
# Line 1995  ILNativeInt _IL_ParameterBuilder_ClrPara Line 1995  ILNativeInt _IL_ParameterBuilder_ClrPara
1995          ILMethod *methodInfo;          ILMethod *methodInfo;
1996          const char *str;          const char *str;
1997    
1998          IL_METADATA_WRLOCK(_thread);          IL_METADATA_WRLOCK(_ILExecThreadProcess(_thread));
1999    
2000          methodInfo = (ILMethod *)method;          methodInfo = (ILMethod *)method;
2001          if(name != NULL)          if(name != NULL)
2002          {          {
2003                  if (!(str = (const char *)ILStringToAnsi(_thread, name)))                  if (!(str = (const char *)ILStringToAnsi(_thread, name)))
2004                  {                  {
2005                          IL_METADATA_UNLOCK(_thread);                          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
2006                          ILExecThreadThrowOutOfMemory(_thread);                          ILExecThreadThrowOutOfMemory(_thread);
2007                          return 0;                          return 0;
2008                  }                  }
# Line 2014  ILNativeInt _IL_ParameterBuilder_ClrPara Line 2014  ILNativeInt _IL_ParameterBuilder_ClrPara
2014          }          }
2015          if (!(retval = ILParameterCreate(methodInfo, 0, str, (ILUInt32)attributes, (ILUInt32)position)))          if (!(retval = ILParameterCreate(methodInfo, 0, str, (ILUInt32)attributes, (ILUInt32)position)))
2016          {          {
2017                  IL_METADATA_UNLOCK(_thread);                  IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
2018                  ILExecThreadThrowOutOfMemory(_thread);                  ILExecThreadThrowOutOfMemory(_thread);
2019                  return 0;                  return 0;
2020          }          }
2021    
2022          IL_METADATA_UNLOCK(_thread);          IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
2023          return (ILNativeInt)retval;          return (ILNativeInt)retval;
2024  }  }
2025    

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26