Tue Nov 27 16:31:52 CET 2001 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / loader.c
1 /*
2  * loader.c: Image Loader 
3  *
4  * Authors:
5  *   Paolo Molaro (lupus@ximian.com)
6  *   Miguel de Icaza (miguel@ximian.com)
7  *
8  * (C) 2001 Ximian, Inc.
9  *
10  * This file is used by the interpreter and the JIT engine to locate
11  * assemblies.  Used to load AssemblyRef and later to resolve various
12  * kinds of `Refs'.
13  *
14  * TODO:
15  *   This should keep track of the assembly versions that we are loading.
16  *
17  */
18 #include <config.h>
19 #include <glib.h>
20 #include <gmodule.h>
21 #include <stdio.h>
22 #include <string.h>
23 #include <mono/metadata/metadata.h>
24 #include <mono/metadata/image.h>
25 #include <mono/metadata/assembly.h>
26 #include <mono/metadata/tokentype.h>
27 #include <mono/metadata/cil-coff.h>
28 #include <mono/metadata/tabledefs.h>
29 #include <mono/metadata/loader.h>
30 #include <mono/metadata/class.h>
31
32 static gboolean dummy_icall = TRUE;
33
34 MonoDefaults mono_defaults;
35
36 #ifdef __CYGWIN__
37 #define mono_map_dll(name) (name)
38 #else
39 static char *dll_map[] = {
40         "libc", "libc.so.6",
41         "libm", "libm.so.6",
42         "cygwin1.dll", "libc.so.6", 
43         NULL, NULL
44 };
45
46 static const char *
47 mono_map_dll (const char *name)
48 {
49         int i = 0;
50
51         while (dll_map [i]) {
52                 if (!strcmp (dll_map [i], name))
53                         return  dll_map [i + 1];
54                 i += 2;
55         }
56
57         return name;
58 }
59 #endif
60
61 void
62 mono_init (void)
63 {
64         static gboolean initialized = FALSE;
65         MonoAssembly *ass;
66         enum MonoImageOpenStatus status = MONO_IMAGE_OK;
67
68         if (initialized)
69                 return;
70
71         /* find the corlib */
72         ass = mono_assembly_open (CORLIB_NAME, NULL, &status);
73         g_assert (status == MONO_IMAGE_OK);
74         g_assert (ass != NULL);
75         mono_defaults.corlib = ass->image;
76
77         mono_defaults.object_class = mono_class_from_name (
78                 mono_defaults.corlib, "System", "Object");
79         g_assert (mono_defaults.object_class != 0);
80
81         mono_defaults.void_class = mono_class_from_name (
82                 mono_defaults.corlib, "System", "Void");
83         g_assert (mono_defaults.void_class != 0);
84
85         mono_defaults.boolean_class = mono_class_from_name (
86                 mono_defaults.corlib, "System", "Boolean");
87         g_assert (mono_defaults.boolean_class != 0);
88
89         mono_defaults.byte_class = mono_class_from_name (
90                 mono_defaults.corlib, "System", "Byte");
91         g_assert (mono_defaults.byte_class != 0);
92
93         mono_defaults.sbyte_class = mono_class_from_name (
94                 mono_defaults.corlib, "System", "SByte");
95         g_assert (mono_defaults.sbyte_class != 0);
96
97         mono_defaults.int16_class = mono_class_from_name (
98                 mono_defaults.corlib, "System", "Int16");
99         g_assert (mono_defaults.int16_class != 0);
100
101         mono_defaults.uint16_class = mono_class_from_name (
102                 mono_defaults.corlib, "System", "UInt16");
103         g_assert (mono_defaults.uint16_class != 0);
104
105         mono_defaults.int32_class = mono_class_from_name (
106                 mono_defaults.corlib, "System", "Int32");
107         g_assert (mono_defaults.int32_class != 0);
108
109         mono_defaults.uint32_class = mono_class_from_name (
110                 mono_defaults.corlib, "System", "UInt32");
111         g_assert (mono_defaults.uint32_class != 0);
112
113         mono_defaults.uint_class = mono_class_from_name (
114                 mono_defaults.corlib, "System", "UIntPtr");
115         g_assert (mono_defaults.uint_class != 0);
116
117         mono_defaults.int_class = mono_class_from_name (
118                 mono_defaults.corlib, "System", "IntPtr");
119         g_assert (mono_defaults.int_class != 0);
120
121         mono_defaults.int64_class = mono_class_from_name (
122                 mono_defaults.corlib, "System", "Int64");
123         g_assert (mono_defaults.int64_class != 0);
124
125         mono_defaults.uint64_class = mono_class_from_name (
126                 mono_defaults.corlib, "System", "UInt64");
127         g_assert (mono_defaults.uint64_class != 0);
128
129         mono_defaults.single_class = mono_class_from_name (
130                 mono_defaults.corlib, "System", "Single");
131         g_assert (mono_defaults.single_class != 0);
132
133         mono_defaults.double_class = mono_class_from_name (
134                 mono_defaults.corlib, "System", "Double");
135         g_assert (mono_defaults.double_class != 0);
136
137         mono_defaults.char_class = mono_class_from_name (
138                 mono_defaults.corlib, "System", "Char");
139         g_assert (mono_defaults.char_class != 0);
140
141         mono_defaults.string_class = mono_class_from_name (
142                 mono_defaults.corlib, "System", "String");
143         g_assert (mono_defaults.string_class != 0);
144
145         mono_defaults.enum_class = mono_class_from_name (
146                 mono_defaults.corlib, "System", "Enum");
147         g_assert (mono_defaults.enum_class != 0);
148
149         mono_defaults.array_class = mono_class_from_name (
150                 mono_defaults.corlib, "System", "Array");
151         g_assert (mono_defaults.array_class != 0);
152
153         mono_defaults.delegate_class = mono_class_from_name (
154                 mono_defaults.corlib, "System", "Delegate");
155         g_assert (mono_defaults.delegate_class != 0);
156
157         mono_defaults.typehandle_class = mono_class_from_name (
158                 mono_defaults.corlib, "System", "RuntimeTypeHandle");
159         g_assert (mono_defaults.typehandle_class != 0);
160
161         mono_defaults.methodhandle_class = mono_class_from_name (
162                 mono_defaults.corlib, "System", "RuntimeMethodHandle");
163         g_assert (mono_defaults.methodhandle_class != 0);
164
165         mono_defaults.fieldhandle_class = mono_class_from_name (
166                 mono_defaults.corlib, "System", "RuntimeFieldHandle");
167         g_assert (mono_defaults.fieldhandle_class != 0);
168
169         mono_defaults.monotype_class = mono_class_from_name (
170                 mono_defaults.corlib, "System", "MonoType");
171         g_assert (mono_defaults.monotype_class != 0);
172 }
173
174 static GHashTable *icall_hash = NULL;
175
176 void
177 mono_add_internal_call (const char *name, gpointer method)
178 {
179         if (!icall_hash) {
180                 dummy_icall = FALSE;
181                 icall_hash = g_hash_table_new (g_str_hash , g_str_equal);
182         }
183
184         g_hash_table_insert (icall_hash, g_strdup (name), method);
185 }
186
187 static void
188 ves_icall_dummy ()
189 {
190         g_warning ("the mono runtime is not initialized");
191         g_assert_not_reached ();
192 }
193
194 gpointer
195 mono_lookup_internal_call (const char *name)
196 {
197         gpointer res;
198
199         if (dummy_icall)
200                 return ves_icall_dummy;
201
202         if (!icall_hash) {
203                 g_warning ("icall_hash not initialized");
204                 g_assert_not_reached ();
205         }
206
207         if (!(res = g_hash_table_lookup (icall_hash, name))) {
208                 g_warning ("cant resolve internal call to \"%s\"", name);
209                 return NULL;
210         }
211
212         return res;
213 }
214
215 MonoClassField*
216 mono_field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass)
217 {
218         MonoImage *mimage;
219         MonoClass *klass;
220         MonoTableInfo *tables = image->tables;
221         guint32 cols[6];
222         guint32 nindex, class, i;
223         const char *fname, *name, *nspace;
224         const char *ptr;
225         guint32 index = mono_metadata_token_index (token);
226
227         mono_metadata_decode_row (&tables [MONO_TABLE_MEMBERREF], index-1, cols, MONO_MEMBERREF_SIZE);
228         nindex = cols [MONO_MEMBERREF_CLASS] >> MEMBERREF_PARENT_BITS;
229         class = cols [MONO_MEMBERREF_CLASS] & MEMBERREF_PARENT_MASK;
230
231         fname = mono_metadata_string_heap (image, cols [MONO_MEMBERREF_NAME]);
232         
233         ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
234         mono_metadata_decode_blob_size (ptr, &ptr);
235         /* we may want to check the signature here... */
236
237         switch (class) {
238         case MEMBERREF_PARENT_TYPEREF: {
239                 guint32 scopeindex, scopetable;
240
241                 mono_metadata_decode_row (&tables [MONO_TABLE_TYPEREF], nindex-1, cols, MONO_TYPEREF_SIZE);
242                 scopeindex = cols [MONO_TYPEREF_SCOPE] >> RESOLTION_SCOPE_BITS;
243                 scopetable = cols [MONO_TYPEREF_SCOPE] & RESOLTION_SCOPE_MASK;
244                 /*g_print ("typeref: 0x%x 0x%x %s.%s\n", scopetable, scopeindex,
245                         mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAMESPACE]),
246                         mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAME]));*/
247                 switch (scopetable) {
248                 case RESOLTION_SCOPE_ASSEMBLYREF:
249                         /*
250                          * To find the field we have the following info:
251                          * *) name and namespace of the class from the TYPEREF table
252                          * *) name and signature of the field from the MEMBERREF table
253                          */
254                         nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);
255                         name = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);
256
257                         /* this will triggered by references to mscorlib */
258                         if (image->references [scopeindex-1] == NULL)
259                                 g_error ("Reference to mscorlib? Probably need to implement %s.%s::%s in corlib", nspace, name, fname);
260
261                         mimage = image->references [scopeindex-1]->image;
262
263                         klass = mono_class_from_name (mimage, nspace, name);
264                         mono_class_metadata_init (klass);
265
266                         /* mostly dumb search for now */
267                         for (i = 0; i < klass->field.count; ++i) {
268                                 MonoClassField *f = &klass->fields [i];
269                                 if (!strcmp (fname, f->name)) {
270                                         if (retklass)
271                                                 *retklass = klass;
272                                         return f;
273                                 }
274                         }
275                         g_warning ("Missing field %s.%s::%s", nspace, name, fname);
276                         return NULL;
277                 default:
278                         return NULL;
279                 }
280                 break;
281         }
282         default:
283                 return NULL;
284         }
285 }
286
287 static MonoMethod *
288 method_from_memberref (MonoImage *image, guint32 index)
289 {
290         MonoImage *mimage;
291         MonoClass *klass;
292         MonoTableInfo *tables = image->tables;
293         guint32 cols[6];
294         guint32 nindex, class, i;
295         const char *mname, *name, *nspace;
296         MonoMethodSignature *sig;
297         const char *ptr;
298
299         mono_metadata_decode_row (&tables [MONO_TABLE_MEMBERREF], index-1, cols, 3);
300         nindex = cols [MONO_MEMBERREF_CLASS] >> MEMBERREF_PARENT_BITS;
301         class = cols [MONO_MEMBERREF_CLASS] & MEMBERREF_PARENT_MASK;
302         /*g_print ("methodref: 0x%x 0x%x %s\n", class, nindex,
303                 mono_metadata_string_heap (m, cols [MONO_MEMBERREF_NAME]));*/
304
305         mname = mono_metadata_string_heap (image, cols [MONO_MEMBERREF_NAME]);
306         
307         ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
308         mono_metadata_decode_blob_size (ptr, &ptr);
309         sig = mono_metadata_parse_method_signature (image, 0, ptr, NULL);
310
311         switch (class) {
312         case MEMBERREF_PARENT_TYPEREF: {
313                 guint32 scopeindex, scopetable;
314
315                 mono_metadata_decode_row (&tables [MONO_TABLE_TYPEREF], nindex-1, cols, MONO_TYPEREF_SIZE);
316                 scopeindex = cols [MONO_TYPEREF_SCOPE] >> RESOLTION_SCOPE_BITS;
317                 scopetable = cols [MONO_TYPEREF_SCOPE] & RESOLTION_SCOPE_MASK;
318                 /*g_print ("typeref: 0x%x 0x%x %s.%s\n", scopetable, scopeindex,
319                         mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAMESPACE]),
320                         mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAME]));*/
321                 switch (scopetable) {
322                 case RESOLTION_SCOPE_ASSEMBLYREF:
323                         /*
324                          * To find the method we have the following info:
325                          * *) name and namespace of the class from the TYPEREF table
326                          * *) name and signature of the method from the MEMBERREF table
327                          */
328                         nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);
329                         name = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);
330
331                         /* this will triggered by references to mscorlib */
332                         if (image->references [scopeindex-1] == NULL)
333                                 g_error ("Reference to mscorlib? Probably need to implement %s.%s::%s in corlib", nspace, name, mname);
334
335                         mimage = image->references [scopeindex-1]->image;
336
337                         klass = mono_class_from_name (mimage, nspace, name);
338                         mono_class_metadata_init (klass);
339
340                         /* 
341                          * FIXME: this is a workaround for the different signatures
342                          * in delegates constructors you get in user code (native int)
343                          * and in mscorlib (native unsigned int)
344                          */
345                         if (klass->parent && klass->parent->parent == mono_defaults.delegate_class) {
346                                 for (i = 0; i < klass->method.count; ++i) {
347                                         MonoMethod *m = klass->methods [i];
348                                         if (!strcmp (mname, m->name)) {
349                                                 if (!strcmp (mname, ".ctor")) {
350                                                         /* we assume signature is correct */
351                                                         mono_metadata_free_method_signature (sig);
352                                                         return m;
353                                                 }
354                                                 if (mono_metadata_signature_equal (sig, m->signature)) {
355                                                         mono_metadata_free_method_signature (sig);
356                                                         return m;
357                                                 }
358                                         }
359                                 }
360                         }
361                         /* mostly dumb search for now */
362                         for (i = 0; i < klass->method.count; ++i) {
363                                 MonoMethod *m = klass->methods [i];
364                                 if (!strcmp (mname, m->name)) {
365                                         if (mono_metadata_signature_equal (sig, m->signature)) {
366                                                 mono_metadata_free_method_signature (sig);
367                                                 return m;
368                                         }
369                                 }
370                         }
371                         g_warning ("Missing method %s.%s::%s", nspace, name, mname);
372                         mono_metadata_free_method_signature (sig);
373                         return NULL;
374                 default:
375                         mono_metadata_free_method_signature (sig);
376                         return NULL;
377                 }
378                 break;
379         }
380         case MEMBERREF_PARENT_TYPESPEC: {
381                 guint32 bcols [MONO_TYPESPEC_SIZE];
382                 guint32 len;
383                 MonoType *type;
384                 MonoMethod *result;
385
386                 mono_metadata_decode_row (&tables [MONO_TABLE_TYPESPEC], nindex - 1, 
387                                           bcols, MONO_TYPESPEC_SIZE);
388                 ptr = mono_metadata_blob_heap (image, bcols [MONO_TYPESPEC_SIGNATURE]);
389                 len = mono_metadata_decode_value (ptr, &ptr);   
390                 type = mono_metadata_parse_type (image, MONO_PARSE_TYPE, 0, ptr, &ptr);
391
392                 if (type->type != MONO_TYPE_ARRAY)
393                         g_assert_not_reached ();                
394
395                 result = (MonoMethod *)g_new0 (MonoMethodPInvoke, 1);
396                 result->klass = mono_class_get (image, MONO_TOKEN_TYPE_SPEC | nindex);
397                 result->iflags = METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL;
398                 result->signature = sig;
399                 result->name = mname;
400
401                 if (!strcmp (mname, ".ctor")) {
402                         /* we special-case this in the runtime. */
403                         result->addr = NULL;
404                         return result;
405                 }
406                 
407                 if (!strcmp (mname, "Set")) {
408                         g_assert (sig->hasthis);
409                         g_assert (type->data.array->rank + 1 == sig->param_count);
410
411                         result->addr = mono_lookup_internal_call ("__array_Set");
412                         return result;
413                 }
414
415                 if (!strcmp (mname, "Get")) {
416                         g_assert (sig->hasthis);
417                         g_assert (type->data.array->rank == sig->param_count);
418
419                         result->addr = mono_lookup_internal_call ("__array_Get");
420                         return result;
421                 }
422
423                 g_assert_not_reached ();
424                 break;
425         }
426         default:
427                 g_assert_not_reached ();
428         }
429
430         return NULL;
431 }
432
433 static void
434 fill_pinvoke_info (MonoImage *image, MonoMethodPInvoke *piinfo, int index)
435 {
436         MonoMethod *mh = &piinfo->method;
437         MonoTableInfo *tables = image->tables;
438         MonoTableInfo *im = &tables [MONO_TABLE_IMPLMAP];
439         MonoTableInfo *mr = &tables [MONO_TABLE_MODULEREF];
440         guint32 im_cols [4];
441         guint32 mr_cols [1];
442         const char *import = NULL;
443         const char *scope = NULL;
444         char *full_name;
445         GModule *gmodule;
446         int i;
447
448         for (i = 0; i < im->rows; i++) {
449                         
450                 mono_metadata_decode_row (im, i, im_cols, 4);
451
452                 if ((im_cols[1] >> 1) == index + 1) {
453
454                         import = mono_metadata_string_heap (image, im_cols [2]);
455
456                         mono_metadata_decode_row (mr, im_cols [3] - 1, mr_cols,
457                                                   1);
458                         
459                         scope = mono_metadata_string_heap (image, mr_cols [0]);
460                 }
461         }
462
463         piinfo->piflags = im_cols [0];
464
465         g_assert (import && scope);
466
467         scope = mono_map_dll (scope);
468         full_name = g_module_build_path (NULL, scope);
469         gmodule = g_module_open (full_name, G_MODULE_BIND_LAZY);
470
471         mh->addr = NULL;
472         if (!gmodule) {
473                 if (!(gmodule=g_module_open (scope, G_MODULE_BIND_LAZY))) {
474                         g_warning ("Failed to load library %s (%s)", full_name, scope);
475                         g_free (full_name);
476                         return;
477                 }
478         }
479         g_free (full_name);
480
481         g_module_symbol (gmodule, import, &mh->addr); 
482
483         if (!mh->addr) {
484                 g_warning ("Failed to load function %s from %s", import, scope);
485                 return;
486         }
487
488         mh->flags |= METHOD_ATTRIBUTE_PINVOKE_IMPL;
489 }
490
491 MonoMethod *
492 mono_get_method (MonoImage *image, guint32 token, MonoClass *klass)
493 {
494         MonoMethod *result;
495         int table = mono_metadata_token_table (token);
496         int index = mono_metadata_token_index (token);
497         MonoTableInfo *tables = image->tables;
498         const char *loc, *sig = NULL;
499         char *name;
500         int size;
501         guint32 cols [MONO_TYPEDEF_SIZE];
502
503         if ((result = g_hash_table_lookup (image->method_cache, GINT_TO_POINTER (token))))
504                         return result;
505
506         if (table != MONO_TABLE_METHOD) {
507                 g_assert (table == MONO_TABLE_MEMBERREF);
508                 result = method_from_memberref (image, index);
509                 g_hash_table_insert (image->method_cache, GINT_TO_POINTER (token), result);
510                 return result;
511         }
512
513         mono_metadata_decode_row (&tables [table], index - 1, cols, 6);
514
515         if ((cols [2] & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
516             (cols [1] & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
517                 result = (MonoMethod *)g_new0 (MonoMethodPInvoke, 1);
518         else 
519                 result = (MonoMethod *)g_new0 (MonoMethodNormal, 1);
520         
521         result->slot = -1;
522         result->klass = klass;
523         result->flags = cols [2];
524         result->iflags = cols [1];
525         result->name = mono_metadata_string_heap (image, cols [3]);
526
527         if (!sig) /* already taken from the methodref */
528                 sig = mono_metadata_blob_heap (image, cols [4]);
529         size = mono_metadata_decode_blob_size (sig, &sig);
530         result->signature = mono_metadata_parse_method_signature (image, 0, sig, NULL);
531
532         if (!result->klass) {
533                 guint32 type = mono_metadata_typedef_from_method (image, token);
534                 result->klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | type);
535         }
536
537         if (cols [1] & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
538                 name = g_strconcat (result->klass->name_space, ".", result->klass->name, "::", 
539                                     mono_metadata_string_heap (image, cols [MONO_METHOD_NAME]), NULL);
540                 result->addr = mono_lookup_internal_call (name);
541                 g_free (name);
542                 result->flags |= METHOD_ATTRIBUTE_PINVOKE_IMPL;
543         } else if (cols [2] & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
544                 fill_pinvoke_info (image, (MonoMethodPInvoke *)result, index - 1);
545         } else {
546                 /* if this is a methodref from another module/assembly, this fails */
547                 loc = mono_cli_rva_map ((MonoCLIImageInfo *)image->image_info, cols [0]);
548
549                 if (!result->klass->dummy && !(result->flags & METHOD_ATTRIBUTE_ABSTRACT) &&
550                                         !(result->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
551                         g_assert (loc);
552                         ((MonoMethodNormal *)result)->header = mono_metadata_parse_mh (image, loc);
553                 }
554         }
555
556         g_hash_table_insert (image->method_cache, GINT_TO_POINTER (token), result);
557
558         return result;
559 }
560
561 void
562 mono_free_method  (MonoMethod *method)
563 {
564         mono_metadata_free_method_signature (method->signature);
565         if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
566                 MonoMethodPInvoke *piinfo = (MonoMethodPInvoke *)method;
567                 g_free (piinfo->code);
568         } else if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
569                 mono_metadata_free_mh (((MonoMethodNormal *)method)->header);
570         }
571
572         g_free (method);
573 }
574
575 void
576 mono_method_get_param_names (MonoMethod *method, const char **names)
577 {
578         int i, lastp;
579         MonoClass *klass = method->klass;
580         MonoTableInfo *methodt = &klass->image->tables [MONO_TABLE_METHOD];
581         MonoTableInfo *paramt = &klass->image->tables [MONO_TABLE_PARAM];
582
583         if (!method->signature->param_count)
584                 return;
585         for (i = 0; i < method->signature->param_count; ++i)
586                 names [i] = "";
587
588         mono_class_metadata_init (klass);
589         if (!klass->methods)
590                 return;
591
592         for (i = 0; i < klass->method.count; ++i) {
593                 if (method == klass->methods [i]) {
594                         guint32 index = klass->method.first + i;
595                         guint32 cols [MONO_PARAM_SIZE];
596                         guint param_index = mono_metadata_decode_row_col (methodt, index, MONO_METHOD_PARAMLIST);
597
598                         if (index < methodt->rows)
599                                 lastp = mono_metadata_decode_row_col (methodt, index + 1, MONO_METHOD_PARAMLIST);
600                         else
601                                 lastp = paramt->rows;
602                         for (i = param_index; i < lastp; ++i) {
603                                 mono_metadata_decode_row (paramt, i -1, cols, MONO_PARAM_SIZE);
604                                 if (cols [MONO_PARAM_SEQUENCE]) /* skip return param spec */
605                                         names [cols [MONO_PARAM_SEQUENCE] - 1] = mono_metadata_string_heap (klass->image, cols [MONO_PARAM_NAME]);
606                         }
607                         return;
608                 }
609         }
610 }
611