2 * metadata.c: Routines for accessing the metadata
5 * Miguel de Icaza (miguel@ximian.com)
7 * (C) 2001 Ximian, Inc.
13 #include "methodheader.h"
17 * Encoding of the "description" argument:
19 * identifier [CODE ARG]
21 * If CODE is ':', then a lookup on table ARG is performed
22 * If CODE is '=', then a lookup in the aliased-table ARG is performed
23 * If CODE is '#', then this encodes a flag, ARG is the flag name.
25 * Aliased table for example is `CustomAttributeType' which depending on the
26 * information might refer to different tables.
29 static MonoMetaTable AssemblySchema [] = {
30 { MONO_MT_UINT32, "HashId" },
31 { MONO_MT_UINT16, "Major" },
32 { MONO_MT_UINT16, "Minor" },
33 { MONO_MT_UINT16, "BuildNumber" },
34 { MONO_MT_UINT16, "RevisionNumber" },
35 { MONO_MT_UINT32, "Flags" },
36 { MONO_MT_BLOB_IDX, "PublicKey" },
37 { MONO_MT_STRING_IDX, "Name" },
38 { MONO_MT_STRING_IDX, "Culture" },
42 static MonoMetaTable AssemblyOSSchema [] = {
43 { MONO_MT_UINT32, "OSPlatformID" },
44 { MONO_MT_UINT32, "OSMajor" },
45 { MONO_MT_UINT32, "OSMinor" },
49 static MonoMetaTable AssemblyProcessorSchema [] = {
50 { MONO_MT_UINT32, "Processor" },
54 static MonoMetaTable AssemblyRefSchema [] = {
55 { MONO_MT_UINT16, "Major" },
56 { MONO_MT_UINT16, "Minor" },
57 { MONO_MT_UINT16, "Build" },
58 { MONO_MT_UINT16, "Revision" },
59 { MONO_MT_UINT32, "Flags" },
60 { MONO_MT_BLOB_IDX, "PublicKeyOrToken" },
61 { MONO_MT_STRING_IDX, "Name" },
62 { MONO_MT_STRING_IDX, "Culture" },
63 { MONO_MT_BLOB_IDX, "HashValue" },
67 static MonoMetaTable AssemblyRefOSSchema [] = {
68 { MONO_MT_UINT32, "OSPlatformID" },
69 { MONO_MT_UINT32, "OSMajorVersion" },
70 { MONO_MT_UINT32, "OSMinorVersion" },
71 { MONO_MT_TABLE_IDX, "AssemblyRef:AssemblyRef" },
75 static MonoMetaTable AssemblyRefProcessorSchema [] = {
76 { MONO_MT_UINT32, "Processor" },
77 { MONO_MT_TABLE_IDX, "AssemblyRef:AssemblyRef" },
81 static MonoMetaTable ClassLayoutSchema [] = {
82 { MONO_MT_UINT16, "PackingSize" },
83 { MONO_MT_UINT32, "ClassSize" },
84 { MONO_MT_TABLE_IDX, "Parent:TypeDef" },
88 static MonoMetaTable ConstantSchema [] = {
89 { MONO_MT_UINT8, "Type" },
90 { MONO_MT_UINT8, "PaddingZero" },
91 { MONO_MT_CONST_IDX, "Parent" },
92 { MONO_MT_BLOB_IDX, "Value" },
96 static MonoMetaTable CustomAttributeSchema [] = {
97 { MONO_MT_HASCAT_IDX, "Parent" },
98 { MONO_MT_CAT_IDX, "Type" },
99 { MONO_MT_BLOB_IDX, "Value" },
100 { MONO_MT_END, NULL }
103 static MonoMetaTable DeclSecuritySchema [] = {
104 { MONO_MT_UINT16, "Action" },
105 { MONO_MT_HASDEC_IDX, "Parent" },
106 { MONO_MT_BLOB_IDX, "PermissionSet" },
107 { MONO_MT_END, NULL }
110 static MonoMetaTable EventMapSchema [] = {
111 { MONO_MT_TABLE_IDX, "Parent:TypeDef" },
112 { MONO_MT_TABLE_IDX, "EventList:Event" },
113 { MONO_MT_END, NULL }
116 static MonoMetaTable EventSchema [] = {
117 { MONO_MT_UINT16, "EventFlags#EventAttribute" },
118 { MONO_MT_STRING_IDX, "Name" },
119 { MONO_MT_TABLE_IDX, "EventType" }, /* TypeDef or TypeRef */
120 { MONO_MT_END, NULL }
123 static MonoMetaTable ExportedTypeSchema [] = {
124 { MONO_MT_UINT32, "Flags" },
125 { MONO_MT_TABLE_IDX, "TypeDefId" },
126 { MONO_MT_STRING_IDX, "TypeName" },
127 { MONO_MT_STRING_IDX, "TypeNameSpace" },
128 { MONO_MT_IMPL_IDX, "Implementation" },
129 { MONO_MT_END, NULL }
132 static MonoMetaTable FieldSchema [] = {
133 { MONO_MT_UINT16, "Flags" },
134 { MONO_MT_STRING_IDX, "Name" },
135 { MONO_MT_BLOB_IDX, "Signature" },
136 { MONO_MT_END, NULL }
138 static MonoMetaTable FieldLayoutSchema [] = {
139 { MONO_MT_UINT32, "Offset" },
140 { MONO_MT_TABLE_IDX, "Field:Field" },
141 { MONO_MT_END, NULL }
144 static MonoMetaTable FieldMarshalSchema [] = {
145 { MONO_MT_HFM_IDX, "Parent" },
146 { MONO_MT_BLOB_IDX, "NativeType" },
147 { MONO_MT_END, NULL }
149 static MonoMetaTable FieldRVASchema [] = {
150 { MONO_MT_UINT32, "RVA" },
151 { MONO_MT_TABLE_IDX, "Field:Field" },
152 { MONO_MT_END, NULL }
155 static MonoMetaTable FileSchema [] = {
156 { MONO_MT_UINT32, "Flags" },
157 { MONO_MT_STRING_IDX, "Name" },
158 { MONO_MT_BLOB_IDX, "Value" },
159 { MONO_MT_END, NULL }
162 static MonoMetaTable ImplMapSchema [] = {
163 { MONO_MT_UINT16, "MappingFlag" },
164 { MONO_MT_MF_IDX, "MemberForwarded" },
165 { MONO_MT_STRING_IDX, "ImportName" },
166 { MONO_MT_TABLE_IDX, "ImportScope:ModuleRef" },
167 { MONO_MT_END, NULL }
170 static MonoMetaTable InterfaceImplSchema [] = {
171 { MONO_MT_TABLE_IDX, "Class:TypeDef" },
172 { MONO_MT_TDOR_IDX, "Interface=TypeDefOrRef" },
173 { MONO_MT_END, NULL }
176 static MonoMetaTable ManifestResourceSchema [] = {
177 { MONO_MT_UINT32, "Offset" },
178 { MONO_MT_UINT32, "Flags" },
179 { MONO_MT_STRING_IDX, "Name" },
180 { MONO_MT_IMPL_IDX, "Implementation" },
181 { MONO_MT_END, NULL }
184 static MonoMetaTable MemberRefSchema [] = {
185 { MONO_MT_MRP_IDX, "Class" },
186 { MONO_MT_STRING_IDX, "Name" },
187 { MONO_MT_BLOB_IDX, "Signature" },
188 { MONO_MT_END, NULL }
191 static MonoMetaTable MethodSchema [] = {
192 { MONO_MT_UINT32, "RVA" },
193 { MONO_MT_UINT16, "ImplFlags#MethodImplAttributes" },
194 { MONO_MT_UINT16, "Flags#MethodAttribute" },
195 { MONO_MT_STRING_IDX, "Name" },
196 { MONO_MT_BLOB_IDX, "Signature" },
197 { MONO_MT_TABLE_IDX, "ParamList:Param" },
198 { MONO_MT_END, NULL }
201 static MonoMetaTable MethodImplSchema [] = {
202 { MONO_MT_TABLE_IDX, "Class:TypeDef" },
203 { MONO_MT_MDOR_IDX, "MethodBody" },
204 { MONO_MT_MDOR_IDX, "MethodDeclaration" },
205 { MONO_MT_END, NULL }
208 static MonoMetaTable MethodSemanticsSchema [] = {
209 { MONO_MT_UINT16, "MethodSemantic" },
210 { MONO_MT_TABLE_IDX, "Method:Method" },
211 { MONO_MT_HS_IDX, "Association" },
212 { MONO_MT_END, NULL }
215 static MonoMetaTable ModuleSchema [] = {
216 { MONO_MT_UINT16, "Generation" },
217 { MONO_MT_STRING_IDX, "Name" },
218 { MONO_MT_GUID_IDX, "MVID" },
219 { MONO_MT_GUID_IDX, "EncID" },
220 { MONO_MT_GUID_IDX, "EncBaseID" },
221 { MONO_MT_END, NULL }
224 static MonoMetaTable ModuleRefSchema [] = {
225 { MONO_MT_STRING_IDX, "Name" },
226 { MONO_MT_END, NULL }
229 static MonoMetaTable NestedClassSchema [] = {
230 { MONO_MT_TABLE_IDX, "NestedClass:TypeDef" },
231 { MONO_MT_TABLE_IDX, "EnclosingClass:TypeDef" },
232 { MONO_MT_END, NULL }
235 static MonoMetaTable ParamSchema [] = {
236 { MONO_MT_UINT16, "Flags" },
237 { MONO_MT_UINT16, "Sequence" },
238 { MONO_MT_STRING_IDX, "Name" },
239 { MONO_MT_END, NULL }
242 static MonoMetaTable PropertySchema [] = {
243 { MONO_MT_UINT16, "Flags" },
244 { MONO_MT_STRING_IDX, "Name" },
245 { MONO_MT_BLOB_IDX, "Type" },
246 { MONO_MT_END, NULL }
249 static MonoMetaTable PropertyMapSchema [] = {
250 { MONO_MT_TABLE_IDX, "Parent:TypeDef" },
251 { MONO_MT_TABLE_IDX, "PropertyList:Property" },
252 { MONO_MT_END, NULL }
255 static MonoMetaTable StandaloneSigSchema [] = {
256 { MONO_MT_BLOB_IDX, "Signature" },
257 { MONO_MT_END, NULL }
260 static MonoMetaTable TypeDefSchema [] = {
261 { MONO_MT_UINT32, "Flags" },
262 { MONO_MT_STRING_IDX, "Name" },
263 { MONO_MT_STRING_IDX, "Namespace" },
264 { MONO_MT_TDOR_IDX, "Extends" },
265 { MONO_MT_TABLE_IDX, "FieldList:Field" },
266 { MONO_MT_TABLE_IDX, "MethodList:Method" },
267 { MONO_MT_END, NULL }
270 static MonoMetaTable TypeRefSchema [] = {
271 { MONO_MT_RS_IDX, "ResolutionScope=ResolutionScope" },
272 { MONO_MT_STRING_IDX, "Name" },
273 { MONO_MT_STRING_IDX, "Namespace" },
274 { MONO_MT_END, NULL }
277 static MonoMetaTable TypeSpecSchema [] = {
278 { MONO_MT_BLOB_IDX, "Signature" },
279 { MONO_MT_END, NULL }
283 MonoMetaTable *table;
286 /* 0 */ { ModuleSchema, "Module" },
287 /* 1 */ { TypeRefSchema, "TypeRef" },
288 /* 2 */ { TypeDefSchema, "TypeDef" },
289 /* 3 */ { NULL, NULL },
290 /* 4 */ { FieldSchema, "Field" },
291 /* 5 */ { NULL, NULL },
292 /* 6 */ { MethodSchema, "Method" },
293 /* 7 */ { NULL, NULL },
294 /* 8 */ { ParamSchema, "Param" },
295 /* 9 */ { InterfaceImplSchema, "InterfaceImpl" },
296 /* A */ { MemberRefSchema, "MemberRef" },
297 /* B */ { ConstantSchema, "Constant" },
298 /* C */ { CustomAttributeSchema, "CustomAttribute" },
299 /* D */ { FieldMarshalSchema, "FieldMarshal" },
300 /* E */ { DeclSecuritySchema, "DeclSecurity" },
301 /* F */ { ClassLayoutSchema, "ClassLayout" },
302 /* 10 */ { FieldLayoutSchema, "FieldLayout" },
303 /* 11 */ { StandaloneSigSchema, "StandaloneSig" },
304 /* 12 */ { EventMapSchema, "EventMap" },
305 /* 13 */ { NULL, NULL },
306 /* 14 */ { EventSchema, "Event" },
307 /* 15 */ { PropertyMapSchema, "PropertyMap" },
308 /* 16 */ { NULL, NULL },
309 /* 17 */ { PropertySchema, "PropertyTable" },
310 /* 18 */ { MethodSemanticsSchema, "MethodSemantics" },
311 /* 19 */ { MethodImplSchema, "MethodImpl" },
312 /* 1A */ { ModuleRefSchema, "ModuleRef" },
313 /* 1B */ { TypeSpecSchema, "TypeSpec" },
314 /* 1C */ { ImplMapSchema, "ImplMap" },
315 /* 1D */ { FieldRVASchema, "FieldRVA" },
316 /* 1E */ { NULL, NULL },
317 /* 1F */ { NULL, NULL },
318 /* 20 */ { AssemblySchema, "Assembly" },
319 /* 21 */ { AssemblyProcessorSchema, "AssemblyProcessor" },
320 /* 22 */ { AssemblyOSSchema, "AssemblyOS" },
321 /* 23 */ { AssemblyRefSchema, "AssemblyRef" },
322 /* 24 */ { AssemblyRefProcessorSchema, "AssemblyRefProcessor" },
323 /* 25 */ { AssemblyRefOSSchema, "AssemblyRefOS" },
324 /* 26 */ { FileSchema, "File" },
325 /* 27 */ { ExportedTypeSchema, "ExportedType" },
326 /* 28 */ { ManifestResourceSchema, "ManifestResource" },
327 /* 29 */ { NestedClassSchema, "NestedClass" },
328 /* 2A */ { NULL, NULL },
329 /* 2B */ { NULL, NULL },
333 * mono_meta_table_name:
334 * @table: table index
336 * Returns the name for the @table index
339 mono_meta_table_name (int table)
341 if ((table < 0) || (table > 0x29))
344 return tables [table].name;
347 #define rtsize(s,b) (((s) > (1 << (b)) ? 4 : 2))
350 compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount, guint32 *result_bitfield)
352 guint32 bitfield = 0;
353 int tsize = rowcount > 65536 ? 4 : 2;
354 int size = 0, field_size;
358 for (i = 0; (code = table [i].code) != MONO_MT_END; i++){
361 field_size = 4; break;
364 field_size = 2; break;
367 field_size = 1; break;
369 case MONO_MT_BLOB_IDX:
370 field_size = meta->idx_blob_wide ? 4 : 2; break;
372 case MONO_MT_STRING_IDX:
373 field_size = meta->idx_string_wide ? 4 : 2; break;
375 case MONO_MT_GUID_IDX:
376 field_size = meta->idx_string_wide ? 4 : 2; break;
378 case MONO_MT_TABLE_IDX:
379 field_size = tsize; break;
382 * HasConstant: ParamDef, FieldDef, Property
384 case MONO_MT_CONST_IDX:
385 n = MAX (meta->tables [META_TABLE_PARAM].rows,
386 meta->tables [META_TABLE_FIELD].rows);
387 n = MAX (n, meta->tables [META_TABLE_PROPERTY].rows);
389 /* 2 bits to encode tag */
390 field_size = rtsize (n, 16-2);
394 * HasCustomAttribute: points to any table but
397 case MONO_MT_HASCAT_IDX:
399 * We believe that since the signature and
400 * permission are indexing the Blob heap,
401 * we should consider the blob size first
403 if (meta->idx_blob_wide){
408 n = MAX (meta->tables [META_TABLE_METHOD].rows,
409 meta->tables [META_TABLE_FIELD].rows);
410 n = MAX (n, meta->tables [META_TABLE_TYPEREF].rows);
411 n = MAX (n, meta->tables [META_TABLE_TYPEDEF].rows);
412 n = MAX (n, meta->tables [META_TABLE_PARAM].rows);
413 n = MAX (n, meta->tables [META_TABLE_INTERFACEIMPL].rows);
414 n = MAX (n, meta->tables [META_TABLE_MEMBERREF].rows);
415 n = MAX (n, meta->tables [META_TABLE_MODULE].rows);
416 /* Permission seems to be a blob heap pointer */
417 n = MAX (n, meta->tables [META_TABLE_PROPERTY].rows);
418 n = MAX (n, meta->tables [META_TABLE_EVENT].rows);
419 /* Signature seems to be a blob heap pointer */
420 n = MAX (n, meta->tables [META_TABLE_MODULEREF].rows);
421 n = MAX (n, meta->tables [META_TABLE_TYPESPEC].rows);
422 n = MAX (n, meta->tables [META_TABLE_ASSEMBLY].rows);
423 n = MAX (n, meta->tables [META_TABLE_ASSEMBLYREF].rows);
424 n = MAX (n, meta->tables [META_TABLE_FILE].rows);
425 n = MAX (n, meta->tables [META_TABLE_EXPORTEDTYPE].rows);
426 n = MAX (n, meta->tables [META_TABLE_MANIFESTRESOURCE].rows);
428 /* 5 bits to encode */
429 field_size = rtsize (n, 16-5);
433 * CustomAttributeType: TypeDef, TypeRef, MethodDef,
434 * MemberRef and String.
436 case MONO_MT_CAT_IDX:
437 /* String is a heap, if it is wide, we know the size */
438 if (meta->idx_string_wide){
443 n = MAX (meta->tables [META_TABLE_TYPEREF].rows,
444 meta->tables [META_TABLE_TYPEDEF].rows);
445 n = MAX (n, meta->tables [META_TABLE_METHOD].rows);
446 n = MAX (n, meta->tables [META_TABLE_MEMBERREF].rows);
448 /* 3 bits to encode */
449 field_size = rtsize (n, 16-3);
453 * HasDeclSecurity: Typedef, MethodDef, Assembly
455 case MONO_MT_HASDEC_IDX:
456 n = MAX (meta->tables [META_TABLE_TYPEDEF].rows,
457 meta->tables [META_TABLE_METHOD].rows);
458 n = MAX (n, meta->tables [META_TABLE_ASSEMBLY].rows);
460 /* 2 bits to encode */
461 field_size = rtsize (n, 16-2);
465 * Implementation: File, AssemblyRef, ExportedType
467 case MONO_MT_IMPL_IDX:
468 n = MAX (meta->tables [META_TABLE_FILE].rows,
469 meta->tables [META_TABLE_ASSEMBLYREF].rows);
470 n = MAX (n, meta->tables [META_TABLE_EXPORTEDTYPE].rows);
472 /* 2 bits to encode tag */
473 field_size = rtsize (n, 16-2);
477 * HasFieldMarshall: FieldDef, ParamDef
479 case MONO_MT_HFM_IDX:
480 n = MAX (meta->tables [META_TABLE_FIELD].rows,
481 meta->tables [META_TABLE_PARAM].rows);
483 /* 1 bit used to encode tag */
484 field_size = rtsize (n, 16-1);
488 * MemberForwarded: FieldDef, MethodDef
491 n = MAX (meta->tables [META_TABLE_FIELD].rows,
492 meta->tables [META_TABLE_METHOD].rows);
494 /* 1 bit used to encode tag */
495 field_size = rtsize (n, 16-1);
499 * TypeDefOrRef: TypeDef, ParamDef, TypeSpec
501 case MONO_MT_TDOR_IDX:
502 n = MAX (meta->tables [META_TABLE_TYPEDEF].rows,
503 meta->tables [META_TABLE_PARAM].rows);
504 n = MAX (n, meta->tables [META_TABLE_TYPESPEC].rows);
506 /* 2 bits to encode */
507 field_size = rtsize (n, 16-2);
511 * MemberRefParent: TypeDef, TypeRef, ModuleDef, ModuleRef, TypeSpec
513 case MONO_MT_MRP_IDX:
514 n = MAX (meta->tables [META_TABLE_TYPEDEF].rows,
515 meta->tables [META_TABLE_TYPEREF].rows);
516 n = MAX (n, meta->tables [META_TABLE_MODULE].rows);
517 n = MAX (n, meta->tables [META_TABLE_MODULEREF].rows);
518 n = MAX (n, meta->tables [META_TABLE_TYPESPEC].rows);
520 /* 3 bits to encode */
521 field_size = rtsize (n, 16 - 3);
524 case MONO_MT_MDOR_IDX:
527 * MethodDefOrRef: MethodDef, MemberRef
530 n = MAX (meta->tables [META_TABLE_METHOD].rows,
531 meta->tables [META_TABLE_MEMBERREF].rows);
533 /* 1 bit used to encode tag */
534 field_size = rtsize (n, 16-1);
538 * ResolutionScope: Module, ModuleRef, AssemblyRef, TypeRef
541 n = MAX (meta->tables [META_TABLE_MODULE].rows,
542 meta->tables [META_TABLE_MODULEREF].rows);
543 n = MAX (n, meta->tables [META_TABLE_ASSEMBLYREF].rows);
544 n = MAX (n, meta->tables [META_TABLE_TYPEREF].rows);
546 /* 3 bits used to encode tag */
547 field_size = rtsize (n, 16 - 3);
552 * encode field size as follows (we just need to
559 bitfield |= (field_size-1) << shift;
564 *result_bitfield = (i << 24) | bitfield;
569 * mono_metadata_compute_table_bases:
570 * @meta: metadata context to compute table values
572 * Computes the table bases for the metadata structure.
573 * This is an internal function used by the image loader code.
576 mono_metadata_compute_table_bases (metadata_t *meta)
579 char *base = meta->tables_base;
581 for (i = 0; i < 64; i++){
582 if (meta->tables [i].rows == 0)
585 meta->tables [i].row_size = compute_size (
586 meta, tables [i].table, meta->tables [i].rows,
587 &meta->tables [i].size_bitfield);
588 meta->tables [i].base = base;
589 base += meta->tables [i].rows * meta->tables [i].row_size;
594 * mono_metadata_locate:
595 * @meta: metadata context
596 * @table: table code.
597 * @idx: index of element to retrieve from @table.
599 * Returns a pointer to the @idx element in the metadata table
600 * whose code is @table.
603 mono_metadata_locate (metadata_t *meta, int table, int idx)
605 /* idx == 0 refers always to NULL */
607 return meta->tables [table].base + (meta->tables [table].row_size * (idx - 1));
611 mono_metadata_locate_token (metadata_t *meta, guint32 token)
613 return mono_metadata_locate (meta, token >> 24, token & 0xffffff);
617 * mono_metadata_get_table:
618 * @table: table to retrieve
620 * Returns the MonoMetaTable structure for table @table
623 mono_metadata_get_table (MetaTableEnum table)
627 g_return_val_if_fail ((x > 0) && (x <= META_TABLE_LAST), NULL);
629 return tables [table].table;
633 * mono_metadata_string_heap:
634 * @meta: metadata context
635 * @index: index into the string heap.
637 * Returns: an in-memory pointer to the @index in the string heap.
640 mono_metadata_string_heap (metadata_t *meta, guint32 index)
642 return meta->raw_metadata + meta->heap_strings.sh_offset + index;
646 * mono_metadata_blob_heap:
647 * @meta: metadata context
648 * @index: index into the blob.
650 * Returns: an in-memory pointer to the @index in the Blob heap.
653 mono_metadata_blob_heap (metadata_t *meta, guint32 index)
655 return meta->raw_metadata + meta->heap_blob.sh_offset + index;
659 dword_align (const char *ptr)
661 return (const char *) (((guint32) (ptr + 3)) & ~3);
664 MonoMetaMethodHeader *
665 mono_metadata_parse_mh (const char *ptr)
667 MonoMetaMethodHeader *mh;
668 unsigned char flags = *(unsigned char *) ptr;
669 unsigned char format = flags & METHOD_HEADER_FORMAT_MASK;
671 unsigned char sect_data_flags;
672 int hsize, sect_data_len;
674 g_return_val_if_fail (ptr != NULL, NULL);
675 g_return_val_if_fail (mh != NULL, NULL);
677 mh = g_new0 (MonoMetaMethodHeader, 1);
679 case METHOD_HEADER_TINY_FORMAT:
682 mh->local_var_sig_tok = 0;
683 mh->code_size = flags >> 2;
687 case METHOD_HEADER_TINY_FORMAT1:
690 mh->local_var_sig_tok = 0;
691 mh->code_size = flags >> 3;
695 case METHOD_HEADER_FAT_FORMAT:
696 fat_flags = read16 (ptr);
698 hsize = (fat_flags >> 12) & 0xf;
699 mh->max_stack = *(guint16 *) ptr;
701 mh->code_size = *(guint32 *) ptr;
703 mh->local_var_sig_tok = *(guint32 *) ptr;
706 if (fat_flags & METHOD_HEADER_INIT_LOCALS)
713 if (!(fat_flags & METHOD_HEADER_MORE_SECTS))
717 * There are more sections
719 ptr = mh->code + mh->code_size;
721 /* align on 32-bit boundary */
722 /* FIXME: not 64-bit clean code */
723 ptr = dword_align (ptr);
725 sect_data_flags = *ptr;
728 if (sect_data_flags & METHOD_HEADER_SECTION_MORE_SECTS){
729 g_error ("Can not deal with more sections");
732 if (sect_data_flags & METHOD_HEADER_SECTION_FAT_FORMAT){
733 sect_data_len = (ptr [0] << 16) | (ptr [1] << 8) | ptr [2];
736 sect_data_len = ptr [0];
740 if (!(sect_data_flags & METHOD_HEADER_SECTION_EHTABLE))
743 ptr = dword_align (ptr);
755 mono_metadata_free_mh (MonoMetaMethodHeader *mh)