5 * Dietmar Maurer (dietmar@ximian.com)
6 * Paolo Molaro (lupus@ximian.com)
7 * Patrik Torstensson (patrik.torstensson@labs2.com)
9 * (C) 2001 Ximian, Inc.
18 #if defined (PLATFORM_WIN32)
22 #include <mono/metadata/object.h>
23 #include <mono/metadata/threads.h>
24 #include <mono/metadata/monitor.h>
25 #include <mono/metadata/reflection.h>
26 #include <mono/metadata/assembly.h>
27 #include <mono/metadata/tabledefs.h>
28 #include <mono/metadata/exception.h>
29 #include <mono/metadata/file-io.h>
30 #include <mono/metadata/socket-io.h>
31 #include <mono/metadata/mono-endian.h>
32 #include <mono/metadata/tokentype.h>
33 #include <mono/metadata/unicode.h>
34 #include <mono/metadata/appdomain.h>
35 #include <mono/metadata/marshal.h>
36 #include <mono/metadata/gc-internal.h>
37 #include <mono/metadata/rand.h>
38 #include <mono/metadata/sysmath.h>
39 #include <mono/metadata/string-icalls.h>
40 #include <mono/metadata/mono-debug-debugger.h>
41 #include <mono/metadata/process.h>
42 #include <mono/metadata/environment.h>
43 #include <mono/metadata/profiler-private.h>
44 #include <mono/metadata/locales.h>
45 #include <mono/io-layer/io-layer.h>
46 #include <mono/utils/strtod.h>
47 #include <mono/utils/monobitset.h>
49 #if defined (PLATFORM_WIN32)
54 static MonoReflectionAssembly* ves_icall_System_Reflection_Assembly_GetCallingAssembly (void);
58 * We expect a pointer to a char, not a string
61 mono_double_ParseImpl (char *ptr)
69 result = bsd_strtod (ptr, &endptr);
71 if (!*ptr || (endptr && *endptr))
72 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib,
80 ves_icall_System_Double_AssertEndianity (double *value)
84 MONO_DOUBLE_ASSERT_ENDIANITY (value);
88 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
97 ao = (MonoArray *)this;
98 ac = (MonoClass *)ao->obj.vtable->klass;
100 esize = mono_array_element_size (ac);
101 ea = (gpointer*)((char*)ao->vector + (pos * esize));
103 if (ac->element_class->valuetype)
104 return mono_value_box (this->vtable->domain, ac->element_class, ea);
110 ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
118 MONO_CHECK_ARG_NULL (idxs);
120 io = (MonoArray *)idxs;
121 ic = (MonoClass *)io->obj.vtable->klass;
123 ao = (MonoArray *)this;
124 ac = (MonoClass *)ao->obj.vtable->klass;
126 g_assert (ic->rank == 1);
127 if (io->bounds != NULL || io->max_length != ac->rank)
128 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
130 ind = (guint32 *)io->vector;
132 if (ao->bounds == NULL) {
133 if (*ind < 0 || *ind >= ao->max_length)
134 mono_raise_exception (mono_get_exception_index_out_of_range ());
136 return ves_icall_System_Array_GetValueImpl (this, *ind);
139 for (i = 0; i < ac->rank; i++)
140 if ((ind [i] < ao->bounds [i].lower_bound) ||
141 (ind [i] >= ao->bounds [i].length + ao->bounds [i].lower_bound))
142 mono_raise_exception (mono_get_exception_index_out_of_range ());
144 pos = ind [0] - ao->bounds [0].lower_bound;
145 for (i = 1; i < ac->rank; i++)
146 pos = pos*ao->bounds [i].length + ind [i] -
147 ao->bounds [i].lower_bound;
149 return ves_icall_System_Array_GetValueImpl (this, pos);
153 ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
155 MonoClass *ac, *vc, *ec;
166 vc = value->vtable->klass;
170 ac = this->obj.vtable->klass;
171 ec = ac->element_class;
173 esize = mono_array_element_size (ac);
174 ea = (gpointer*)((char*)this->vector + (pos * esize));
175 va = (gpointer*)((char*)value + sizeof (MonoObject));
178 memset (ea, 0, esize);
182 #define NO_WIDENING_CONVERSION G_STMT_START{\
183 mono_raise_exception (mono_get_exception_argument ( \
184 "value", "not a widening conversion")); \
187 #define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
188 if (esize < vsize + (extra)) \
189 mono_raise_exception (mono_get_exception_argument ( \
190 "value", "not a widening conversion")); \
193 #define INVALID_CAST G_STMT_START{\
194 mono_raise_exception (mono_get_exception_invalid_cast ()); \
197 /* Check element (destination) type. */
198 switch (ec->byval_arg.type) {
199 case MONO_TYPE_STRING:
200 switch (vc->byval_arg.type) {
201 case MONO_TYPE_STRING:
207 case MONO_TYPE_BOOLEAN:
208 switch (vc->byval_arg.type) {
209 case MONO_TYPE_BOOLEAN:
222 NO_WIDENING_CONVERSION;
229 if (!ec->valuetype) {
230 if (!mono_object_isinst (value, ec))
232 *ea = (gpointer)value;
236 if (mono_object_isinst (value, ec)) {
237 memcpy (ea, (char *)value + sizeof (MonoObject), esize);
244 vsize = mono_class_instance_size (vc) - sizeof (MonoObject);
247 g_message (G_STRLOC ": %d (%d) <= %d (%d)",
248 ec->byval_arg.type, esize,
249 vc->byval_arg.type, vsize);
252 #define ASSIGN_UNSIGNED(etype) G_STMT_START{\
253 switch (vc->byval_arg.type) { \
258 case MONO_TYPE_CHAR: \
259 CHECK_WIDENING_CONVERSION(0); \
260 *(etype *) ea = (etype) u64; \
262 /* You can't assign a signed value to an unsigned array. */ \
267 /* You can't assign a floating point number to an integer array. */ \
270 NO_WIDENING_CONVERSION; \
274 #define ASSIGN_SIGNED(etype) G_STMT_START{\
275 switch (vc->byval_arg.type) { \
280 CHECK_WIDENING_CONVERSION(0); \
281 *(etype *) ea = (etype) i64; \
283 /* You can assign an unsigned value to a signed array if the array's */ \
284 /* element size is larger than the value size. */ \
289 case MONO_TYPE_CHAR: \
290 CHECK_WIDENING_CONVERSION(1); \
291 *(etype *) ea = (etype) u64; \
293 /* You can't assign a floating point number to an integer array. */ \
296 NO_WIDENING_CONVERSION; \
300 #define ASSIGN_REAL(etype) G_STMT_START{\
301 switch (vc->byval_arg.type) { \
304 CHECK_WIDENING_CONVERSION(0); \
305 *(etype *) ea = (etype) r64; \
307 /* All integer values fit into a floating point array, so we don't */ \
308 /* need to CHECK_WIDENING_CONVERSION here. */ \
313 *(etype *) ea = (etype) i64; \
319 case MONO_TYPE_CHAR: \
320 *(etype *) ea = (etype) u64; \
325 switch (vc->byval_arg.type) {
327 u64 = *(guint8 *) va;
330 u64 = *(guint16 *) va;
333 u64 = *(guint32 *) va;
336 u64 = *(guint64 *) va;
342 i64 = *(gint16 *) va;
345 i64 = *(gint32 *) va;
348 i64 = *(gint64 *) va;
351 r64 = *(gfloat *) va;
354 r64 = *(gdouble *) va;
357 u64 = *(guint16 *) va;
359 case MONO_TYPE_BOOLEAN:
360 /* Boolean is only compatible with itself. */
361 switch (ec->byval_arg.type) {
373 NO_WIDENING_CONVERSION;
380 /* If we can't do a direct copy, let's try a widening conversion. */
381 switch (ec->byval_arg.type) {
383 ASSIGN_UNSIGNED (guint16);
385 ASSIGN_UNSIGNED (guint8);
387 ASSIGN_UNSIGNED (guint16);
389 ASSIGN_UNSIGNED (guint32);
391 ASSIGN_UNSIGNED (guint64);
393 ASSIGN_SIGNED (gint8);
395 ASSIGN_SIGNED (gint16);
397 ASSIGN_SIGNED (gint32);
399 ASSIGN_SIGNED (gint64);
401 ASSIGN_REAL (gfloat);
403 ASSIGN_REAL (gdouble);
407 /* Not reached, INVALID_CAST does not return. Just to avoid a compiler warning ... */
411 #undef NO_WIDENING_CONVERSION
412 #undef CHECK_WIDENING_CONVERSION
413 #undef ASSIGN_UNSIGNED
419 ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
427 MONO_CHECK_ARG_NULL (idxs);
429 ic = idxs->obj.vtable->klass;
430 ac = this->obj.vtable->klass;
432 g_assert (ic->rank == 1);
433 if (idxs->bounds != NULL || idxs->max_length != ac->rank)
434 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
436 ind = (guint32 *)idxs->vector;
438 if (this->bounds == NULL) {
439 if (*ind < 0 || *ind >= this->max_length)
440 mono_raise_exception (mono_get_exception_index_out_of_range ());
442 ves_icall_System_Array_SetValueImpl (this, value, *ind);
446 for (i = 0; i < ac->rank; i++)
447 if ((ind [i] < this->bounds [i].lower_bound) ||
448 (ind [i] >= this->bounds [i].length + this->bounds [i].lower_bound))
449 mono_raise_exception (mono_get_exception_index_out_of_range ());
451 pos = ind [0] - this->bounds [0].lower_bound;
452 for (i = 1; i < ac->rank; i++)
453 pos = pos * this->bounds [i].length + ind [i] -
454 this->bounds [i].lower_bound;
456 ves_icall_System_Array_SetValueImpl (this, value, pos);
460 ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
468 MONO_CHECK_ARG_NULL (type);
469 MONO_CHECK_ARG_NULL (lengths);
471 MONO_CHECK_ARG (lengths, mono_array_length (lengths) > 0);
473 MONO_CHECK_ARG (bounds, mono_array_length (lengths) == mono_array_length (bounds));
475 for (i = 0; i < mono_array_length (lengths); i++)
476 if (mono_array_get (lengths, gint32, i) < 0)
477 mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
479 aklass = mono_array_class_get (mono_class_from_mono_type (type->type), mono_array_length (lengths));
481 sizes = alloca (aklass->rank * sizeof(guint32) * 2);
482 for (i = 0; i < aklass->rank; ++i) {
483 sizes [i] = mono_array_get (lengths, gint32, i);
485 sizes [i + aklass->rank] = mono_array_get (bounds, gint32, i);
487 sizes [i + aklass->rank] = 0;
490 array = mono_array_new_full (mono_object_domain (type), aklass, sizes, sizes + aklass->rank);
496 ves_icall_System_Array_GetRank (MonoObject *this)
500 return this->vtable->klass->rank;
504 ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
506 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
510 if ((dimension < 0) || (dimension >= rank))
511 mono_raise_exception (mono_get_exception_index_out_of_range ());
513 if (this->bounds == NULL)
514 return this->max_length;
516 return this->bounds [dimension].length;
520 ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
522 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
526 if ((dimension < 0) || (dimension >= rank))
527 mono_raise_exception (mono_get_exception_index_out_of_range ());
529 if (this->bounds == NULL)
532 return this->bounds [dimension].lower_bound;
536 ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
541 MonoClass *src_class;
542 MonoClass *dest_class;
547 if (source->obj.vtable->klass->rank != dest->obj.vtable->klass->rank)
550 if (source->bounds || dest->bounds)
553 if ((dest_idx + length > mono_array_length (dest)) ||
554 (source_idx + length > mono_array_length (source)))
557 element_size = mono_array_element_size (source->obj.vtable->klass);
558 dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
559 source_addr = mono_array_addr_with_size (source, element_size, source_idx);
561 src_class = source->obj.vtable->klass->element_class;
562 dest_class = dest->obj.vtable->klass->element_class;
565 * Handle common cases.
568 /* Case1: object[] -> valuetype[] (ArrayList::ToArray) */
569 if (src_class == mono_defaults.object_class && dest_class->valuetype) {
570 for (i = source_idx; i < source_idx + length; ++i) {
571 MonoObject *elem = mono_array_get (source, MonoObject*, i);
572 if (elem && !mono_object_isinst (elem, dest_class))
576 element_size = mono_array_element_size (dest->obj.vtable->klass);
577 for (i = 0; i < length; ++i) {
578 MonoObject *elem = mono_array_get (source, MonoObject*, source_idx + i);
579 void *addr = mono_array_addr_with_size (dest, element_size, dest_idx + i);
581 memset (addr, 0, element_size);
583 memcpy (addr, (char *)elem + sizeof (MonoObject), element_size);
588 if (src_class != dest_class) {
589 if (dest_class->valuetype || dest_class->enumtype || src_class->valuetype || src_class->enumtype)
592 if (mono_class_is_subclass_of (src_class, dest_class, FALSE))
594 /* Case2: object[] -> reftype[] (ArrayList::ToArray) */
595 else if (mono_class_is_subclass_of (dest_class, src_class, FALSE))
596 for (i = source_idx; i < source_idx + length; ++i) {
597 MonoObject *elem = mono_array_get (source, MonoObject*, i);
598 if (elem && !mono_object_isinst (elem, dest_class))
605 memmove (dest_addr, source_addr, element_size * length);
611 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoArray *array, MonoClassField *field_handle)
613 MonoClass *klass = array->obj.vtable->klass;
614 guint32 size = mono_array_element_size (klass);
619 if (array->bounds == NULL)
620 size *= array->max_length;
622 for (i = 0; i < klass->rank; ++i)
623 size *= array->bounds [i].length;
625 memcpy (mono_array_addr (array, char, 0), field_handle->data, size);
627 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
631 guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
633 for (i = 0; i < size; i += n/8, data++) { \
634 tmp = read ## n (data); \
639 /* printf ("Initialize array with elements of %s type\n", klass->element_class->name); */
641 switch (klass->element_class->byval_arg.type) {
661 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void)
665 return offsetof (MonoString, chars);
669 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue (MonoObject *obj)
673 if ((obj == NULL) || (! (obj->vtable->klass->valuetype)))
676 return mono_object_clone (obj);
680 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (MonoType *handle)
686 MONO_CHECK_ARG_NULL (handle);
688 klass = mono_class_from_mono_type (handle);
689 MONO_CHECK_ARG (handle, klass);
691 /* This will call the type constructor */
692 if (! (klass->flags & TYPE_ATTRIBUTE_INTERFACE))
693 mono_runtime_class_init (mono_class_vtable (mono_domain_get (), klass));
697 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
701 return mono_object_clone (this);
705 #define MONO_OBJECT_ALIGNMENT_SHIFT 3
707 #define MONO_OBJECT_ALIGNMENT_SHIFT 2
711 * Return hashcode based on object address. This function will need to be
712 * smarter in the presence of a moving garbage collector, which will cache
713 * the address hash before relocating the object.
715 * Wang's address-based hash function:
716 * http://www.concentric.net/~Ttwang/tech/addrhash.htm
719 ves_icall_System_Object_GetHashCode (MonoObject *this)
721 register guint32 key;
725 key = (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
727 return key & 0x7fffffff;
731 ves_icall_System_ValueType_InternalGetHashCode (MonoObject *this, MonoArray **fields)
735 MonoObject **values = NULL;
742 klass = this->vtable->klass;
744 if (klass->field.count == 0)
745 return ves_icall_System_Object_GetHashCode (this);
748 * Compute the starting value of the hashcode for fields of primitive
749 * types, and return the remaining fields in an array to the managed side.
750 * This way, we can avoid costly reflection operations in managed code.
752 for (i = 0; i < klass->field.count; ++i) {
753 MonoClassField *field = &klass->fields [i];
754 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
756 /* FIXME: Add more types */
757 switch (field->type->type) {
759 result ^= *(gint32*)((guint8*)this + field->offset);
761 case MONO_TYPE_STRING: {
763 s = *(MonoString**)((guint8*)this + field->offset);
765 result ^= ves_icall_System_String_GetHashCode (s);
770 values = alloca (klass->field.count * sizeof (MonoObject*));
771 o = mono_field_get_value_object (mono_object_domain (this), field, this);
772 values [count++] = o;
777 *fields = mono_array_new (mono_domain_get (), mono_defaults.object_class, count);
778 memcpy (mono_array_addr (*fields, MonoObject*, 0), values, count * sizeof (MonoObject*));
786 ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that, MonoArray **fields)
790 MonoObject **values = NULL;
796 MONO_CHECK_ARG_NULL (that);
798 if (this->vtable != that->vtable)
801 klass = this->vtable->klass;
804 * Do the comparison for fields of primitive type and return a result if
805 * possible. Otherwise, return the remaining fields in an array to the
806 * managed side. This way, we can avoid costly reflection operations in
810 for (i = 0; i < klass->field.count; ++i) {
811 MonoClassField *field = &klass->fields [i];
812 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
814 /* FIXME: Add more types */
815 switch (field->type->type) {
817 if (*(gint32*)((guint8*)this + field->offset) != *(gint32*)((guint8*)that + field->offset))
820 case MONO_TYPE_STRING: {
822 guint32 s1len, s2len;
823 s1 = *(MonoString**)((guint8*)this + field->offset);
824 s2 = *(MonoString**)((guint8*)that + field->offset);
827 if ((s1 == NULL) || (s2 == NULL))
829 s1len = mono_string_length (s1);
830 s2len = mono_string_length (s2);
834 if (memcmp (mono_string_chars (s1), mono_string_chars (s2), s1len * sizeof (gunichar2)) != 0)
840 values = alloca (klass->field.count * 2 * sizeof (MonoObject*));
841 o = mono_field_get_value_object (mono_object_domain (this), field, this);
842 values [count++] = o;
843 o = mono_field_get_value_object (mono_object_domain (this), field, that);
844 values [count++] = o;
849 *fields = mono_array_new (mono_domain_get (), mono_defaults.object_class, count);
850 memcpy (mono_array_addr (*fields, MonoObject*, 0), values, count * sizeof (MonoObject*));
858 static MonoReflectionType *
859 ves_icall_System_Object_GetType (MonoObject *obj)
863 return mono_type_get_object (mono_object_domain (obj), &obj->vtable->klass->byval_arg);
867 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
871 mtype->type = &obj->vtable->klass->byval_arg;
872 g_assert (mtype->type->type);
876 ves_icall_ModuleBuilder_getToken (MonoReflectionModuleBuilder *mb, MonoObject *obj)
880 return mono_image_create_token (mb->dynamic_image, obj);
884 ves_icall_ModuleBuilder_getDataChunk (MonoReflectionModuleBuilder *mb, MonoArray *buf, gint32 offset)
887 MonoDynamicImage *image = mb->dynamic_image;
888 char *p = mono_array_addr (buf, char, 0);
892 mono_image_create_pefile (mb);
894 if (offset >= image->pefile.index)
896 count = mono_array_length (buf);
897 count = MIN (count, image->pefile.index - offset);
899 memcpy (p, image->pefile.data + offset, count);
905 ves_icall_ModuleBuilder_build_metadata (MonoReflectionModuleBuilder *mb)
909 mono_image_build_metadata (mb);
912 static MonoReflectionType*
913 ves_icall_type_from_name (MonoString *name,
914 MonoBoolean throwOnError,
915 MonoBoolean ignoreCase)
918 MonoType *type = NULL;
919 MonoAssembly *assembly;
920 MonoTypeNameParse info;
924 str = mono_string_to_utf8 (name);
925 if (!mono_reflection_parse_type (str, &info)) {
927 g_list_free (info.modifiers);
928 g_list_free (info.nested);
929 if (throwOnError) /* uhm: this is a parse error, though... */
930 mono_raise_exception (mono_get_exception_type_load (name));
935 if (info.assembly.name) {
936 assembly = mono_assembly_load (&info.assembly, NULL, NULL);
938 MonoReflectionAssembly *refass;
940 refass = ves_icall_System_Reflection_Assembly_GetCallingAssembly ();
941 assembly = refass->assembly;
945 type = mono_reflection_get_type (assembly->image, &info, ignoreCase);
947 if (!info.assembly.name && !type) /* try mscorlib */
948 type = mono_reflection_get_type (NULL, &info, ignoreCase);
951 g_list_free (info.modifiers);
952 g_list_free (info.nested);
955 mono_raise_exception (mono_get_exception_type_load (name));
960 return mono_type_get_object (mono_domain_get (), type);
963 static MonoReflectionType*
964 ves_icall_type_from_handle (MonoType *handle)
966 MonoDomain *domain = mono_domain_get ();
967 MonoClass *klass = mono_class_from_mono_type (handle);
971 mono_class_init (klass);
972 return mono_type_get_object (domain, handle);
976 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
980 if (type->type && c->type)
981 return mono_metadata_type_equal (type->type, c->type);
982 g_print ("type equals\n");
986 /* System.TypeCode */
1005 TYPECODE_STRING = 18
1009 ves_icall_type_GetTypeCode (MonoReflectionType *type)
1011 int t = type->type->type;
1013 MONO_ARCH_SAVE_REGS;
1017 case MONO_TYPE_VOID:
1018 return TYPECODE_OBJECT;
1019 case MONO_TYPE_BOOLEAN:
1020 return TYPECODE_BOOLEAN;
1022 return TYPECODE_BYTE;
1024 return TYPECODE_SBYTE;
1026 return TYPECODE_UINT16;
1028 return TYPECODE_INT16;
1029 case MONO_TYPE_CHAR:
1030 return TYPECODE_CHAR;
1034 return TYPECODE_OBJECT;
1036 return TYPECODE_UINT32;
1038 return TYPECODE_INT32;
1040 return TYPECODE_UINT64;
1042 return TYPECODE_INT64;
1044 return TYPECODE_SINGLE;
1046 return TYPECODE_DOUBLE;
1047 case MONO_TYPE_VALUETYPE:
1048 if (type->type->data.klass->enumtype) {
1049 t = type->type->data.klass->enum_basetype->type;
1052 MonoClass *k = type->type->data.klass;
1053 if (strcmp (k->name_space, "System") == 0) {
1054 if (strcmp (k->name, "Decimal") == 0)
1055 return TYPECODE_DECIMAL;
1056 else if (strcmp (k->name, "DateTime") == 0)
1057 return TYPECODE_DATETIME;
1060 return TYPECODE_OBJECT;
1061 case MONO_TYPE_STRING:
1062 return TYPECODE_STRING;
1063 case MONO_TYPE_SZARRAY:
1064 case MONO_TYPE_ARRAY:
1065 case MONO_TYPE_OBJECT:
1067 case MONO_TYPE_MVAR:
1068 return TYPECODE_OBJECT;
1069 case MONO_TYPE_CLASS:
1071 MonoClass *k = type->type->data.klass;
1072 if (strcmp (k->name_space, "System") == 0) {
1073 if (strcmp (k->name, "DBNull") == 0)
1074 return TYPECODE_DBNULL;
1077 return TYPECODE_OBJECT;
1079 g_error ("type 0x%02x not handled in GetTypeCode()", t);
1085 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
1091 MONO_ARCH_SAVE_REGS;
1093 g_assert (type != NULL);
1095 domain = ((MonoObject *)type)->vtable->domain;
1097 if (!c) /* FIXME: dont know what do do here */
1100 klass = mono_class_from_mono_type (type->type);
1101 klassc = mono_class_from_mono_type (c->type);
1103 return mono_class_is_subclass_of (klass, klassc, check_interfaces);
1107 ves_icall_type_is_assignable_from (MonoReflectionType *type, MonoReflectionType *c)
1113 MONO_ARCH_SAVE_REGS;
1115 g_assert (type != NULL);
1117 domain = ((MonoObject *)type)->vtable->domain;
1119 klass = mono_class_from_mono_type (type->type);
1120 klassc = mono_class_from_mono_type (c->type);
1122 return mono_class_is_assignable_from (klass, klassc);
1126 ves_icall_get_attributes (MonoReflectionType *type)
1128 MonoClass *klass = mono_class_from_mono_type (type->type);
1130 MONO_ARCH_SAVE_REGS;
1132 return klass->flags;
1135 static MonoReflectionField*
1136 ves_icall_System_Reflection_FieldInfo_internal_from_handle (MonoClassField *handle)
1138 MONO_ARCH_SAVE_REGS;
1142 return mono_field_get_object (mono_domain_get (), handle->parent, handle);
1146 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
1148 MonoDomain *domain = mono_domain_get ();
1150 MONO_ARCH_SAVE_REGS;
1152 info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
1153 info->ret = mono_type_get_object (domain, method->signature->ret);
1154 info->attrs = method->flags;
1155 info->implattrs = method->iflags;
1156 if (method->signature->call_convention == MONO_CALL_DEFAULT)
1159 if (method->signature->call_convention == MONO_CALL_VARARG)
1163 info->callconv |= (method->signature->hasthis << 5) | (method->signature->explicit_this << 6);
1167 ves_icall_get_parameter_info (MonoMethod *method)
1169 MonoDomain *domain = mono_domain_get ();
1171 MONO_ARCH_SAVE_REGS;
1173 return mono_param_get_objects (domain, method);
1176 static MonoReflectionType*
1177 ves_icall_MonoField_GetParentType (MonoReflectionField *field, MonoBoolean declaring)
1180 MONO_ARCH_SAVE_REGS;
1182 parent = declaring? field->field->parent: field->klass;
1184 return mono_type_get_object (mono_object_domain (field), &parent->byval_arg);
1188 ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *obj)
1191 MonoClassField *cf = field->field;
1194 MonoDomain *domain = mono_object_domain (field);
1196 gboolean is_static = FALSE;
1197 gboolean is_ref = FALSE;
1199 MONO_ARCH_SAVE_REGS;
1201 mono_class_init (field->klass);
1203 switch (cf->type->type) {
1204 case MONO_TYPE_STRING:
1205 case MONO_TYPE_OBJECT:
1206 case MONO_TYPE_CLASS:
1207 case MONO_TYPE_ARRAY:
1208 case MONO_TYPE_SZARRAY:
1213 case MONO_TYPE_BOOLEAN:
1216 case MONO_TYPE_CHAR:
1225 case MONO_TYPE_VALUETYPE:
1226 is_ref = cf->type->byref;
1229 g_error ("type 0x%x not handled in "
1230 "ves_icall_Monofield_GetValue", cf->type->type);
1235 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1237 vtable = mono_class_vtable (domain, field->klass);
1238 if (!vtable->initialized)
1239 mono_runtime_class_init (vtable);
1244 mono_field_static_get_value (vtable, cf, &o);
1246 mono_field_get_value (obj, cf, &o);
1251 /* boxed value type */
1252 klass = mono_class_from_mono_type (cf->type);
1253 o = mono_object_new (domain, klass);
1254 v = ((gchar *) o) + sizeof (MonoObject);
1256 mono_field_static_get_value (vtable, cf, v);
1258 mono_field_get_value (obj, cf, v);
1265 ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *obj, MonoObject *value)
1267 MonoClassField *cf = field->field;
1270 MONO_ARCH_SAVE_REGS;
1272 v = (gchar *) value;
1273 if (!cf->type->byref) {
1274 switch (cf->type->type) {
1277 case MONO_TYPE_BOOLEAN:
1280 case MONO_TYPE_CHAR:
1289 case MONO_TYPE_VALUETYPE:
1290 v += sizeof (MonoObject);
1292 case MONO_TYPE_STRING:
1293 case MONO_TYPE_OBJECT:
1294 case MONO_TYPE_CLASS:
1295 case MONO_TYPE_ARRAY:
1296 case MONO_TYPE_SZARRAY:
1300 g_error ("type 0x%x not handled in "
1301 "ves_icall_FieldInfo_SetValueInternal", cf->type->type);
1306 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1307 MonoVTable *vtable = mono_class_vtable (mono_object_domain (field), field->klass);
1308 if (!vtable->initialized)
1309 mono_runtime_class_init (vtable);
1310 mono_field_static_set_value (vtable, cf, v);
1312 mono_field_set_value (obj, cf, v);
1317 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
1319 MonoDomain *domain = mono_object_domain (property);
1321 MONO_ARCH_SAVE_REGS;
1323 info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
1324 info->name = mono_string_new (domain, property->property->name);
1325 info->attrs = property->property->attrs;
1326 info->get = property->property->get ? mono_method_get_object (domain, property->property->get, NULL): NULL;
1327 info->set = property->property->set ? mono_method_get_object (domain, property->property->set, NULL): NULL;
1329 * There may be other methods defined for properties, though, it seems they are not exposed
1330 * in the reflection API
1335 ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
1337 MonoDomain *domain = mono_object_domain (event);
1339 MONO_ARCH_SAVE_REGS;
1341 info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
1342 info->name = mono_string_new (domain, event->event->name);
1343 info->attrs = event->event->attrs;
1344 info->add_method = event->event->add ? mono_method_get_object (domain, event->event->add, NULL): NULL;
1345 info->remove_method = event->event->remove ? mono_method_get_object (domain, event->event->remove, NULL): NULL;
1346 info->raise_method = event->event->raise ? mono_method_get_object (domain, event->event->raise, NULL): NULL;
1350 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
1352 MonoDomain *domain = mono_object_domain (type);
1355 MonoClass *class = mono_class_from_mono_type (type->type);
1357 MonoBitSet *slots = mono_bitset_new (class->max_interface_id + 1, 0);
1359 MONO_ARCH_SAVE_REGS;
1362 /* GetInterfaces() returns an empty array in MS.NET (this may be a bug) */
1363 return mono_array_new (domain, mono_defaults.monotype_class, 0);
1367 for (parent = class; parent; parent = parent->parent) {
1368 for (i = 0; i < parent->interface_count; ++i) {
1369 if (mono_bitset_test (slots, parent->interfaces [i]->interface_id))
1372 mono_bitset_set (slots, parent->interfaces [i]->interface_id);
1377 intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
1379 for (parent = class; parent; parent = parent->parent) {
1380 for (i = 0; i < parent->interface_count; ++i) {
1381 if (!mono_bitset_test (slots, parent->interfaces [i]->interface_id))
1384 mono_bitset_clear (slots, parent->interfaces [i]->interface_id);
1385 mono_array_set (intf, gpointer, ninterf,
1386 mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
1391 mono_bitset_free (slots);
1396 ves_icall_Type_GetInterfaceMapData (MonoReflectionType *type, MonoReflectionType *iface, MonoArray **targets, MonoArray **methods)
1398 MonoClass *class = mono_class_from_mono_type (type->type);
1399 MonoClass *iclass = mono_class_from_mono_type (iface->type);
1400 MonoReflectionMethod *member;
1401 int i, len, ioffset;
1404 MONO_ARCH_SAVE_REGS;
1406 /* type doesn't implement iface: the exception is thrown in managed code */
1407 if ((iclass->interface_id > class->max_interface_id) || !class->interface_offsets [iclass->interface_id])
1410 len = iclass->method.count;
1411 ioffset = class->interface_offsets [iclass->interface_id];
1412 domain = mono_object_domain (type);
1413 *targets = mono_array_new (domain, mono_defaults.method_info_class, len);
1414 *methods = mono_array_new (domain, mono_defaults.method_info_class, len);
1415 for (i = 0; i < len; ++i) {
1416 member = mono_method_get_object (domain, iclass->methods [i], iclass);
1417 mono_array_set (*methods, gpointer, i, member);
1418 member = mono_method_get_object (domain, class->vtable [i + ioffset], class);
1419 mono_array_set (*targets, gpointer, i, member);
1423 static MonoReflectionType*
1424 ves_icall_MonoType_GetElementType (MonoReflectionType *type)
1426 MonoClass *class = mono_class_from_mono_type (type->type);
1428 MONO_ARCH_SAVE_REGS;
1430 if (type->type->byref)
1431 return mono_type_get_object (mono_object_domain (type), &class->byval_arg);
1432 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1433 return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
1434 else if (class->element_class)
1435 return mono_type_get_object (mono_object_domain (type), &class->element_class->byval_arg);
1440 static MonoReflectionType*
1441 ves_icall_get_type_parent (MonoReflectionType *type)
1443 MonoClass *class = mono_class_from_mono_type (type->type);
1445 MONO_ARCH_SAVE_REGS;
1447 return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
1451 ves_icall_type_ispointer (MonoReflectionType *type)
1453 MONO_ARCH_SAVE_REGS;
1455 return type->type->type == MONO_TYPE_PTR;
1459 ves_icall_type_isprimitive (MonoReflectionType *type)
1461 MONO_ARCH_SAVE_REGS;
1463 return (!type->type->byref && (type->type->type >= MONO_TYPE_BOOLEAN) && (type->type->type <= MONO_TYPE_R8));
1467 ves_icall_type_isbyref (MonoReflectionType *type)
1469 MONO_ARCH_SAVE_REGS;
1471 return type->type->byref;
1474 static MonoReflectionModule*
1475 ves_icall_MonoType_get_Module (MonoReflectionType *type)
1477 MonoClass *class = mono_class_from_mono_type (type->type);
1479 MONO_ARCH_SAVE_REGS;
1481 return mono_module_get_object (mono_object_domain (type), class->image);
1484 static MonoReflectionAssembly*
1485 ves_icall_MonoType_get_Assembly (MonoReflectionType *type)
1487 MonoDomain *domain = mono_domain_get ();
1488 MonoClass *class = mono_class_from_mono_type (type->type);
1490 MONO_ARCH_SAVE_REGS;
1492 return mono_assembly_get_object (domain, class->image->assembly);
1495 static MonoReflectionType*
1496 ves_icall_MonoType_get_DeclaringType (MonoReflectionType *type)
1498 MonoDomain *domain = mono_domain_get ();
1499 MonoClass *class = mono_class_from_mono_type (type->type);
1501 MONO_ARCH_SAVE_REGS;
1503 return class->nested_in ? mono_type_get_object (domain, &class->nested_in->byval_arg) : NULL;
1506 static MonoReflectionType*
1507 ves_icall_MonoType_get_UnderlyingSystemType (MonoReflectionType *type)
1509 MonoDomain *domain = mono_domain_get ();
1510 MonoClass *class = mono_class_from_mono_type (type->type);
1512 MONO_ARCH_SAVE_REGS;
1514 if (class->enumtype && class->enum_basetype) /* types that are modified typebuilders may not have enum_basetype set */
1515 return mono_type_get_object (domain, class->enum_basetype);
1516 else if (class->element_class)
1517 return mono_type_get_object (domain, &class->element_class->byval_arg);
1523 ves_icall_MonoType_get_Name (MonoReflectionType *type)
1525 MonoDomain *domain = mono_domain_get ();
1526 MonoClass *class = mono_class_from_mono_type (type->type);
1528 MONO_ARCH_SAVE_REGS;
1530 return mono_string_new (domain, class->name);
1534 ves_icall_MonoType_get_Namespace (MonoReflectionType *type)
1536 MonoDomain *domain = mono_domain_get ();
1537 MonoClass *class = mono_class_from_mono_type (type->type);
1539 MONO_ARCH_SAVE_REGS;
1541 while (class->nested_in)
1542 class = class->nested_in;
1544 return mono_string_new (domain, class->name_space);
1548 ves_icall_MonoType_GetArrayRank (MonoReflectionType *type)
1550 MonoClass *class = mono_class_from_mono_type (type->type);
1552 MONO_ARCH_SAVE_REGS;
1558 ves_icall_Type_GetGenericArguments (MonoReflectionType *type)
1561 MonoClass *klass, *pklass;
1563 MONO_ARCH_SAVE_REGS;
1565 klass = mono_class_from_mono_type (type->type);
1567 if (type->type->byref) {
1568 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, 0);
1569 } else if (klass->gen_params) {
1570 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, klass->num_gen_params);
1571 for (i = 0; i < klass->num_gen_params; ++i) {
1572 pklass = mono_class_from_generic_parameter (&klass->gen_params [i], klass->image, FALSE);
1573 mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (type), &pklass->byval_arg));
1575 } else if (klass->generic_inst) {
1576 MonoGenericInst *inst = klass->generic_inst->data.generic_inst;
1577 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, inst->type_argc);
1578 for (i = 0; i < inst->type_argc; ++i) {
1579 mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (type), inst->type_argv [i]));
1582 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, 0);
1588 ves_icall_Type_get_IsGenericTypeDefinition (MonoReflectionType *type)
1591 MONO_ARCH_SAVE_REGS;
1593 if (type->type->byref)
1595 klass = mono_class_from_mono_type (type->type);
1597 return klass->gen_params != NULL;
1600 static MonoReflectionType*
1601 ves_icall_Type_GetGenericTypeDefinition_impl (MonoReflectionType *type)
1604 MONO_ARCH_SAVE_REGS;
1606 if (type->type->byref)
1608 klass = mono_class_from_mono_type (type->type);
1609 if (klass->gen_params) {
1610 return type; /* check this one */
1612 if (klass->generic_inst) {
1613 MonoType *generic_type = klass->generic_inst->data.generic_inst->generic_type;
1614 MonoClass *generic_class = mono_class_from_mono_type (generic_type);
1616 if (generic_class->wastypebuilder && generic_class->reflection_info)
1617 return generic_class->reflection_info;
1619 return mono_type_get_object (mono_object_domain (type), generic_type);
1624 static MonoReflectionGenericInst*
1625 ves_icall_Type_BindGenericParameters (MonoReflectionType *type, MonoArray *types)
1627 MONO_ARCH_SAVE_REGS;
1629 if (type->type->byref)
1632 return mono_reflection_bind_generic_parameters (type, types);
1636 ves_icall_Type_get_IsGenericInstance (MonoReflectionType *type)
1639 MONO_ARCH_SAVE_REGS;
1641 if (type->type->byref)
1643 klass = mono_class_from_mono_type (type->type);
1644 return klass->generic_inst != NULL;
1648 ves_icall_Type_GetGenericParameterPosition (MonoReflectionType *type)
1650 MONO_ARCH_SAVE_REGS;
1652 if (type->type->byref)
1654 if (type->type->type == MONO_TYPE_VAR || type->type->type == MONO_TYPE_MVAR)
1655 return type->type->data.generic_param->num;
1660 ves_icall_MonoType_get_HasGenericArguments (MonoReflectionType *type)
1663 MONO_ARCH_SAVE_REGS;
1665 if (type->type->byref)
1667 klass = mono_class_from_mono_type (type->type);
1668 if (klass->gen_params || klass->generic_inst)
1674 ves_icall_MonoType_get_IsGenericParameter (MonoReflectionType *type)
1676 MONO_ARCH_SAVE_REGS;
1678 if (type->type->byref)
1680 if (type->type->type == MONO_TYPE_VAR || type->type->type == MONO_TYPE_MVAR)
1686 ves_icall_TypeBuilder_get_IsGenericParameter (MonoReflectionTypeBuilder *tb)
1688 MONO_ARCH_SAVE_REGS;
1690 if (tb->type.type->byref)
1692 if (tb->type.type->type == MONO_TYPE_VAR || tb->type.type->type == MONO_TYPE_MVAR)
1697 static MonoReflectionType*
1698 ves_icall_TypeBuilder_define_generic_parameter (MonoReflectionTypeBuilder *tb, MonoReflectionGenericParam *gparam)
1702 MONO_ARCH_SAVE_REGS;
1704 index = mono_array_length (tb->generic_params) - 1;
1705 return mono_reflection_define_generic_parameter (tb, NULL, index, gparam);
1708 static MonoReflectionType*
1709 ves_icall_MethodBuilder_define_generic_parameter (MonoReflectionMethodBuilder *mb, MonoReflectionGenericParam *gparam)
1713 MONO_ARCH_SAVE_REGS;
1715 index = mono_array_length (mb->generic_params) - 1;
1716 return mono_reflection_define_generic_parameter (NULL, mb, index, gparam);
1719 static MonoReflectionMethod *
1720 ves_icall_MonoType_get_DeclaringMethod (MonoReflectionType *type)
1725 MONO_ARCH_SAVE_REGS;
1727 if (type->type->byref)
1730 method = type->type->data.generic_param->method;
1734 klass = mono_class_from_mono_type (type->type);
1735 return mono_method_get_object (mono_object_domain (type), method, klass);
1739 ves_icall_MethodInfo_get_IsGenericMethodDefinition (MonoReflectionMethod *method)
1741 MonoMethodNormal *mn;
1742 MONO_ARCH_SAVE_REGS;
1744 if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
1745 (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
1748 mn = (MonoMethodNormal *) method->method;
1749 return mn->header->gen_params != NULL;
1753 ves_icall_MonoMethod_GetGenericArguments (MonoReflectionMethod *method)
1755 MonoMethodNormal *mn;
1758 MONO_ARCH_SAVE_REGS;
1760 if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
1761 (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
1762 return mono_array_new (mono_object_domain (method), mono_defaults.monotype_class, 0);
1764 mn = (MonoMethodNormal *) method->method;
1765 count = method->method->signature->generic_param_count;
1766 res = mono_array_new (mono_object_domain (method), mono_defaults.monotype_class, count);
1768 for (i = 0; i < count; i++) {
1769 MonoGenericParam *param = &mn->header->gen_params [i];
1770 MonoClass *pklass = mono_class_from_generic_parameter (param, method->method->klass->image, TRUE);
1771 mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (method), &pklass->byval_arg));
1778 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
1781 * Invoke from reflection is supposed to always be a virtual call (the API
1782 * is stupid), mono_runtime_invoke_*() calls the provided method, allowing
1783 * greater flexibility.
1785 MonoMethod *m = method->method;
1788 MONO_ARCH_SAVE_REGS;
1791 if (!mono_object_isinst (this, m->klass))
1792 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
1793 m = mono_object_get_virtual_method (this, m);
1794 } else if (!(m->flags & METHOD_ATTRIBUTE_STATIC) && strcmp (m->name, ".ctor") && !m->wrapper_type)
1795 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
1797 pcount = params? mono_array_length (params): 0;
1798 if (pcount != m->signature->param_count)
1799 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetParameterCountException"));
1801 if (m->klass->rank && !strcmp (m->name, ".ctor")) {
1804 guint32 *lower_bounds;
1805 pcount = mono_array_length (params);
1806 lengths = alloca (sizeof (guint32) * pcount);
1807 for (i = 0; i < pcount; ++i)
1808 lengths [i] = *(gint32*) ((char*)mono_array_get (params, gpointer, i) + sizeof (MonoObject));
1810 if (m->klass->rank == pcount) {
1811 /* Only lengths provided. */
1812 lower_bounds = NULL;
1814 g_assert (pcount == (m->klass->rank * 2));
1815 /* lower bounds are first. */
1816 lower_bounds = lengths;
1817 lengths += m->klass->rank;
1820 return (MonoObject*)mono_array_new_full (mono_object_domain (params), m->klass, lengths, lower_bounds);
1822 return mono_runtime_invoke_array (m, this, params, NULL);
1826 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
1828 MonoDomain *domain = mono_object_domain (method);
1829 MonoMethod *m = method->method;
1830 MonoMethodSignature *sig = m->signature;
1831 MonoArray *out_args;
1833 int i, j, outarg_count = 0;
1835 MONO_ARCH_SAVE_REGS;
1837 if (m->klass == mono_defaults.object_class) {
1839 if (!strcmp (m->name, "FieldGetter")) {
1840 MonoClass *k = this->vtable->klass;
1841 MonoString *name = mono_array_get (params, MonoString *, 1);
1844 str = mono_string_to_utf8 (name);
1846 for (i = 0; i < k->field.count; i++) {
1847 if (!strcmp (k->fields [i].name, str)) {
1848 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1849 if (field_klass->valuetype)
1850 result = mono_value_box (domain, field_klass,
1851 (char *)this + k->fields [i].offset);
1853 result = *((gpointer *)((char *)this + k->fields [i].offset));
1856 out_args = mono_array_new (domain, mono_defaults.object_class, 1);
1857 *outArgs = out_args;
1858 mono_array_set (out_args, gpointer, 0, result);
1865 g_assert_not_reached ();
1867 } else if (!strcmp (m->name, "FieldSetter")) {
1868 MonoClass *k = this->vtable->klass;
1869 MonoString *name = mono_array_get (params, MonoString *, 1);
1873 str = mono_string_to_utf8 (name);
1875 for (i = 0; i < k->field.count; i++) {
1876 if (!strcmp (k->fields [i].name, str)) {
1877 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1878 MonoObject *val = mono_array_get (params, gpointer, 2);
1880 if (field_klass->valuetype) {
1881 size = mono_type_size (k->fields [i].type, &align);
1882 memcpy ((char *)this + k->fields [i].offset,
1883 ((char *)val) + sizeof (MonoObject), size);
1885 *(MonoObject**)((char *)this + k->fields [i].offset) = val;
1887 out_args = mono_array_new (domain, mono_defaults.object_class, 0);
1888 *outArgs = out_args;
1896 g_assert_not_reached ();
1901 for (i = 0; i < mono_array_length (params); i++) {
1902 if (sig->params [i]->byref)
1906 out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
1908 /* fixme: handle constructors? */
1909 if (!strcmp (method->method->name, ".ctor"))
1910 g_assert_not_reached ();
1912 result = mono_runtime_invoke_array (method->method, this, params, NULL);
1914 for (i = 0, j = 0; i < mono_array_length (params); i++) {
1915 if (sig->params [i]->byref) {
1917 arg = mono_array_get (params, gpointer, i);
1918 mono_array_set (out_args, gpointer, j, arg);
1923 *outArgs = out_args;
1929 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
1932 MonoClass *enumc, *objc;
1936 MONO_ARCH_SAVE_REGS;
1938 MONO_CHECK_ARG_NULL (type);
1939 MONO_CHECK_ARG_NULL (obj);
1941 domain = mono_object_domain (type);
1942 enumc = mono_class_from_mono_type (type->type);
1943 objc = obj->vtable->klass;
1945 MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
1946 MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
1947 objc->byval_arg.type <= MONO_TYPE_U8));
1949 s1 = mono_class_value_size (enumc, NULL);
1950 s2 = mono_class_value_size (objc, NULL);
1952 res = mono_object_new (domain, enumc);
1954 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
1955 memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
1957 memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
1958 (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
1965 ves_icall_System_Enum_get_value (MonoObject *this)
1973 MONO_ARCH_SAVE_REGS;
1978 g_assert (this->vtable->klass->enumtype);
1980 enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
1981 res = mono_object_new (mono_object_domain (this), enumc);
1982 dst = (char *)res + sizeof (MonoObject);
1983 src = (char *)this + sizeof (MonoObject);
1984 size = mono_class_value_size (enumc, NULL);
1986 memcpy (dst, src, size);
1992 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
1994 MonoDomain *domain = mono_object_domain (type);
1995 MonoClass *enumc = mono_class_from_mono_type (type->type);
1996 guint i, j, nvalues, crow;
1997 MonoClassField *field;
1999 MONO_ARCH_SAVE_REGS;
2001 info->utype = mono_type_get_object (domain, enumc->enum_basetype);
2002 nvalues = enumc->field.count - 1;
2003 info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
2004 info->values = mono_array_new (domain, enumc, nvalues);
2007 for (i = 0, j = 0; i < enumc->field.count; ++i) {
2008 field = &enumc->fields [i];
2009 if (strcmp ("value__", field->name) == 0)
2011 mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
2013 crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1), crow + 1);
2014 crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
2015 /* 1 is the length of the blob */
2016 field->data = 1 + mono_metadata_blob_heap (enumc->image, crow);
2018 switch (enumc->enum_basetype->type) {
2021 mono_array_set (info->values, gchar, j, *field->data);
2023 case MONO_TYPE_CHAR:
2026 mono_array_set (info->values, gint16, j, read16 (field->data));
2030 mono_array_set (info->values, gint32, j, read32 (field->data));
2034 mono_array_set (info->values, gint64, j, read64 (field->data));
2037 g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
2044 BFLAGS_IgnoreCase = 1,
2045 BFLAGS_DeclaredOnly = 2,
2046 BFLAGS_Instance = 4,
2048 BFLAGS_Public = 0x10,
2049 BFLAGS_NonPublic = 0x20,
2050 BFLAGS_InvokeMethod = 0x100,
2051 BFLAGS_CreateInstance = 0x200,
2052 BFLAGS_GetField = 0x400,
2053 BFLAGS_SetField = 0x800,
2054 BFLAGS_GetProperty = 0x1000,
2055 BFLAGS_SetProperty = 0x2000,
2056 BFLAGS_ExactBinding = 0x10000,
2057 BFLAGS_SuppressChangeType = 0x20000,
2058 BFLAGS_OptionalParamBinding = 0x40000
2061 static MonoReflectionField *
2062 ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
2065 MonoClass *startklass, *klass;
2067 MonoClassField *field;
2069 domain = ((MonoObject *)type)->vtable->domain;
2070 klass = startklass = mono_class_from_mono_type (type->type);
2072 MONO_ARCH_SAVE_REGS;
2075 mono_raise_exception (mono_get_exception_argument_null ("name"));
2078 for (i = 0; i < klass->field.count; ++i) {
2080 field = &klass->fields [i];
2081 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
2082 if (bflags & BFLAGS_Public)
2085 if (bflags & BFLAGS_NonPublic)
2091 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
2092 if (bflags & BFLAGS_Static)
2095 if (bflags & BFLAGS_Instance)
2102 utf8_name = mono_string_to_utf8 (name);
2104 if (strcmp (field->name, utf8_name)) {
2110 return mono_field_get_object (domain, klass, field);
2112 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2119 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
2122 GSList *l = NULL, *tmp;
2123 MonoClass *startklass, *klass;
2127 MonoClassField *field;
2129 MONO_ARCH_SAVE_REGS;
2131 domain = ((MonoObject *)type)->vtable->domain;
2132 klass = startklass = mono_class_from_mono_type (type->type);
2135 for (i = 0; i < klass->field.count; ++i) {
2137 field = &klass->fields [i];
2138 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
2139 if (bflags & BFLAGS_Public)
2142 if (bflags & BFLAGS_NonPublic)
2148 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
2149 if (bflags & BFLAGS_Static)
2152 if (bflags & BFLAGS_Instance)
2158 member = (MonoObject*)mono_field_get_object (domain, klass, field);
2159 l = g_slist_prepend (l, member);
2161 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2163 len = g_slist_length (l);
2164 res = mono_array_new (domain, mono_defaults.field_info_class, len);
2166 tmp = l = g_slist_reverse (l);
2167 for (; tmp; tmp = tmp->next, ++i)
2168 mono_array_set (res, gpointer, i, tmp->data);
2174 ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
2177 GSList *l = NULL, *tmp;
2178 MonoClass *startklass, *klass;
2183 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
2185 MONO_ARCH_SAVE_REGS;
2187 domain = ((MonoObject *)type)->vtable->domain;
2188 klass = startklass = mono_class_from_mono_type (type->type);
2192 for (i = 0; i < klass->method.count; ++i) {
2194 method = klass->methods [i];
2195 if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
2197 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2198 if (bflags & BFLAGS_Public)
2201 if (bflags & BFLAGS_NonPublic)
2207 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2208 if (bflags & BFLAGS_Static)
2211 if (bflags & BFLAGS_Instance)
2218 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
2220 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
2221 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
2223 l = g_slist_prepend (l, member);
2226 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2228 res = mono_array_new (domain, mono_defaults.method_info_class, len);
2231 tmp = l = g_slist_reverse (l);
2233 for (; tmp; tmp = tmp->next, ++i)
2234 mono_array_set (res, gpointer, i, tmp->data);
2236 g_hash_table_destroy (method_slots);
2241 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
2244 GSList *l = NULL, *tmp;
2245 static MonoClass *System_Reflection_ConstructorInfo;
2246 MonoClass *startklass, *klass;
2252 MONO_ARCH_SAVE_REGS;
2254 domain = ((MonoObject *)type)->vtable->domain;
2255 klass = startklass = mono_class_from_mono_type (type->type);
2257 for (i = 0; i < klass->method.count; ++i) {
2259 method = klass->methods [i];
2260 if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
2262 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2263 if (bflags & BFLAGS_Public)
2266 if (bflags & BFLAGS_NonPublic)
2272 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2273 if (bflags & BFLAGS_Static)
2276 if (bflags & BFLAGS_Instance)
2282 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
2284 l = g_slist_prepend (l, member);
2286 len = g_slist_length (l);
2287 if (!System_Reflection_ConstructorInfo)
2288 System_Reflection_ConstructorInfo = mono_class_from_name (
2289 mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
2290 res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
2292 tmp = l = g_slist_reverse (l);
2293 for (; tmp; tmp = tmp->next, ++i)
2294 mono_array_set (res, gpointer, i, tmp->data);
2300 ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
2303 GSList *l = NULL, *tmp;
2304 static MonoClass *System_Reflection_PropertyInfo;
2305 MonoClass *startklass, *klass;
2311 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
2313 MONO_ARCH_SAVE_REGS;
2315 domain = ((MonoObject *)type)->vtable->domain;
2316 klass = startklass = mono_class_from_mono_type (type->type);
2319 for (i = 0; i < klass->property.count; ++i) {
2320 prop = &klass->properties [i];
2325 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2326 if (bflags & BFLAGS_Public)
2329 if (bflags & BFLAGS_NonPublic)
2335 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2336 if (bflags & BFLAGS_Static)
2339 if (bflags & BFLAGS_Instance)
2347 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
2349 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), prop);
2351 l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
2354 if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
2356 if (!System_Reflection_PropertyInfo)
2357 System_Reflection_PropertyInfo = mono_class_from_name (
2358 mono_defaults.corlib, "System.Reflection", "PropertyInfo");
2359 res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
2362 tmp = l = g_slist_reverse (l);
2364 for (; tmp; tmp = tmp->next, ++i)
2365 mono_array_set (res, gpointer, i, tmp->data);
2367 g_hash_table_destroy (method_slots);
2371 static MonoReflectionEvent *
2372 ves_icall_MonoType_GetEvent (MonoReflectionType *type, MonoString *name, guint32 bflags)
2381 MONO_ARCH_SAVE_REGS;
2383 event_name = mono_string_to_utf8 (name);
2384 klass = mono_class_from_mono_type (type->type);
2385 domain = mono_object_domain (type);
2388 for (i = 0; i < klass->event.count; i++) {
2389 event = &klass->events [i];
2390 if (strcmp (event->name, event_name))
2393 method = event->add;
2395 method = event->remove;
2397 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2398 if (!(bflags & BFLAGS_Public))
2401 if (!(bflags & BFLAGS_NonPublic))
2405 g_free (event_name);
2406 return mono_event_get_object (domain, klass, event);
2409 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2412 g_free (event_name);
2417 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
2420 GSList *l = NULL, *tmp;
2421 static MonoClass *System_Reflection_EventInfo;
2422 MonoClass *startklass, *klass;
2428 MONO_ARCH_SAVE_REGS;
2430 domain = ((MonoObject *)type)->vtable->domain;
2431 klass = startklass = mono_class_from_mono_type (type->type);
2434 for (i = 0; i < klass->event.count; ++i) {
2435 event = &klass->events [i];
2437 method = event->add;
2439 method = event->remove;
2440 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2441 if (bflags & BFLAGS_Public)
2444 if (bflags & BFLAGS_NonPublic)
2450 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2451 if (bflags & BFLAGS_Static)
2454 if (bflags & BFLAGS_Instance)
2461 l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
2463 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2465 len = g_slist_length (l);
2466 if (!System_Reflection_EventInfo)
2467 System_Reflection_EventInfo = mono_class_from_name (
2468 mono_defaults.corlib, "System.Reflection", "EventInfo");
2469 res = mono_array_new (domain, System_Reflection_EventInfo, len);
2472 tmp = l = g_slist_reverse (l);
2474 for (; tmp; tmp = tmp->next, ++i)
2475 mono_array_set (res, gpointer, i, tmp->data);
2480 static MonoReflectionType *
2481 ves_icall_Type_GetNestedType (MonoReflectionType *type, MonoString *name, guint32 bflags)
2484 MonoClass *startklass, *klass;
2489 MONO_ARCH_SAVE_REGS;
2491 domain = ((MonoObject *)type)->vtable->domain;
2492 klass = startklass = mono_class_from_mono_type (type->type);
2493 str = mono_string_to_utf8 (name);
2496 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
2498 nested = tmpn->data;
2499 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
2500 if (bflags & BFLAGS_Public)
2503 if (bflags & BFLAGS_NonPublic)
2508 if (strcmp (nested->name, str) == 0){
2510 return mono_type_get_object (domain, &nested->byval_arg);
2513 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2520 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
2523 GSList *l = NULL, *tmp;
2525 MonoClass *startklass, *klass;
2531 MONO_ARCH_SAVE_REGS;
2533 domain = ((MonoObject *)type)->vtable->domain;
2534 klass = startklass = mono_class_from_mono_type (type->type);
2536 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
2538 nested = tmpn->data;
2539 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
2540 if (bflags & BFLAGS_Public)
2543 if (bflags & BFLAGS_NonPublic)
2548 member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
2549 l = g_slist_prepend (l, member);
2551 len = g_slist_length (l);
2552 res = mono_array_new (domain, mono_defaults.monotype_class, len);
2554 tmp = l = g_slist_reverse (l);
2555 for (; tmp; tmp = tmp->next, ++i)
2556 mono_array_set (res, gpointer, i, tmp->data);
2561 static MonoReflectionType*
2562 ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *assembly, MonoReflectionModule *module, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
2565 MonoType *type = NULL;
2566 MonoTypeNameParse info;
2568 MONO_ARCH_SAVE_REGS;
2570 str = mono_string_to_utf8 (name);
2571 /*g_print ("requested type %s in %s\n", str, assembly->assembly->aname.name);*/
2572 if (!mono_reflection_parse_type (str, &info)) {
2574 g_list_free (info.modifiers);
2575 g_list_free (info.nested);
2576 if (throwOnError) /* uhm: this is a parse error, though... */
2577 mono_raise_exception (mono_get_exception_type_load (name));
2578 /*g_print ("failed parse\n");*/
2582 if (module != NULL) {
2584 type = mono_reflection_get_type (module->image, &info, ignoreCase);
2589 if (assembly->assembly->dynamic) {
2590 /* Enumerate all modules */
2591 MonoReflectionAssemblyBuilder *abuilder = (MonoReflectionAssemblyBuilder*)assembly;
2594 if (!abuilder->modules)
2597 for (i = 0; i < mono_array_length (abuilder->modules); ++i) {
2598 MonoReflectionModuleBuilder *mb = mono_array_get (abuilder->modules, MonoReflectionModuleBuilder*, i);
2599 type = mono_reflection_get_type (&mb->dynamic_image->image, &info, ignoreCase);
2606 type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
2608 g_list_free (info.modifiers);
2609 g_list_free (info.nested);
2612 mono_raise_exception (mono_get_exception_type_load (name));
2613 /* g_print ("failed find\n"); */
2616 /* g_print ("got it\n"); */
2617 return mono_type_get_object (mono_object_domain (assembly), type);
2622 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
2624 MonoDomain *domain = mono_object_domain (assembly);
2625 MonoAssembly *mass = assembly->assembly;
2630 MONO_ARCH_SAVE_REGS;
2632 absolute = g_build_filename (mass->basedir, mass->image->module_name, NULL);
2633 uri = g_filename_to_uri (absolute, NULL, NULL);
2634 res = mono_string_new (domain, uri);
2641 ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assembly)
2643 MonoDomain *domain = mono_object_domain (assembly);
2645 char *name = g_build_filename (
2646 assembly->assembly->basedir,
2647 assembly->assembly->image->module_name, NULL);
2649 MONO_ARCH_SAVE_REGS;
2651 res = mono_string_new (domain, name);
2657 ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion (MonoReflectionAssembly *assembly)
2659 MonoDomain *domain = mono_object_domain (assembly);
2661 MONO_ARCH_SAVE_REGS;
2663 return mono_string_new (domain, assembly->assembly->image->version);
2666 static MonoReflectionMethod*
2667 ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly)
2669 guint32 token = mono_image_get_entry_point (assembly->assembly->image);
2671 MONO_ARCH_SAVE_REGS;
2675 return mono_method_get_object (mono_object_domain (assembly), mono_get_method (assembly->assembly->image, token, NULL), NULL);
2679 ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly)
2681 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2682 MonoArray *result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
2686 MONO_ARCH_SAVE_REGS;
2688 for (i = 0; i < table->rows; ++i) {
2689 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_MANIFEST_NAME));
2690 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), val));
2696 ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAssembly *assembly)
2698 static MonoClass *System_Reflection_AssemblyName;
2701 MonoDomain *domain = mono_object_domain (assembly);
2704 MONO_ARCH_SAVE_REGS;
2706 if (!System_Reflection_AssemblyName)
2707 System_Reflection_AssemblyName = mono_class_from_name (
2708 mono_defaults.corlib, "System.Reflection", "AssemblyName");
2710 for (ptr = assembly->assembly->image->references; ptr && *ptr; ptr++)
2713 result = mono_array_new (mono_object_domain (assembly), System_Reflection_AssemblyName, count);
2715 for (i = 0; i < count; i++) {
2716 MonoAssembly *assem = assembly->assembly->image->references [i];
2717 MonoReflectionAssemblyName *aname;
2718 char *codebase, *absolute;
2720 aname = (MonoReflectionAssemblyName *) mono_object_new (
2721 domain, System_Reflection_AssemblyName);
2723 if (strcmp (assem->aname.name, "corlib") == 0)
2724 aname->name = mono_string_new (domain, "mscorlib");
2726 aname->name = mono_string_new (domain, assem->aname.name);
2727 aname->major = assem->aname.major;
2729 absolute = g_build_filename (assem->basedir, assem->image->module_name, NULL);
2730 codebase = g_filename_to_uri (absolute, NULL, NULL);
2731 aname->codebase = mono_string_new (domain, codebase);
2734 mono_array_set (result, gpointer, i, aname);
2745 foreach_namespace (const char* key, gconstpointer val, NameSpaceInfo *info)
2747 MonoString *name = mono_string_new (mono_object_domain (info->res), key);
2749 mono_array_set (info->res, gpointer, info->idx, name);
2754 ves_icall_System_Reflection_Assembly_GetNamespaces (MonoReflectionAssembly *assembly)
2756 MonoImage *img = assembly->assembly->image;
2760 MonoTableInfo *t = &img->tables [MONO_TABLE_EXPORTEDTYPE];
2763 MONO_ARCH_SAVE_REGS;
2765 n = g_hash_table_size (img->name_cache);
2766 res = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, n);
2769 g_hash_table_foreach (img->name_cache, (GHFunc)foreach_namespace, &info);
2771 /* Add namespaces from the EXPORTEDTYPES table as well */
2774 GPtrArray *nspaces = g_ptr_array_new ();
2775 for (i = 0; i < t->rows; ++i) {
2776 const char *nspace = mono_metadata_string_heap (img, mono_metadata_decode_row_col (t, i, MONO_EXP_TYPE_NAMESPACE));
2777 if (!g_hash_table_lookup (img->name_cache, nspace)) {
2778 g_ptr_array_add (nspaces, (char*)nspace);
2781 if (nspaces->len > 0) {
2782 res2 = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, n + nspaces->len);
2783 memcpy (mono_array_addr (res2, MonoString*, 0),
2784 mono_array_addr (res, MonoString*, 0),
2785 n * sizeof (MonoString*));
2786 for (i = 0; i < nspaces->len; ++i)
2787 mono_array_set (res2, MonoString*, n + i,
2788 mono_string_new (mono_object_domain (assembly),
2789 g_ptr_array_index (nspaces, i)));
2792 g_ptr_array_free (nspaces, TRUE);
2798 /* move this in some file in mono/util/ */
2800 g_concat_dir_and_file (const char *dir, const char *file)
2802 g_return_val_if_fail (dir != NULL, NULL);
2803 g_return_val_if_fail (file != NULL, NULL);
2806 * If the directory name doesn't have a / on the end, we need
2807 * to add one so we get a proper path to the file
2809 if (dir [strlen(dir) - 1] != G_DIR_SEPARATOR)
2810 return g_strconcat (dir, G_DIR_SEPARATOR_S, file, NULL);
2812 return g_strconcat (dir, file, NULL);
2816 ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name, gint32 *size)
2818 char *n = mono_string_to_utf8 (name);
2819 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2821 guint32 cols [MONO_MANIFEST_SIZE];
2824 MONO_ARCH_SAVE_REGS;
2826 for (i = 0; i < table->rows; ++i) {
2827 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
2828 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
2829 if (strcmp (val, n) == 0)
2833 if (i == table->rows)
2836 if (cols [MONO_MANIFEST_IMPLEMENTATION]) {
2838 * this code should only be called after obtaining the
2839 * ResourceInfo and handling the other cases.
2841 g_assert_not_reached ();
2845 return (void*)mono_image_get_resource (assembly->assembly->image, cols [MONO_MANIFEST_OFFSET], size);
2849 ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal (MonoReflectionAssembly *assembly, MonoString *name, MonoManifestResourceInfo *info)
2851 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2853 guint32 cols [MONO_MANIFEST_SIZE];
2854 guint32 file_cols [MONO_FILE_SIZE];
2858 MONO_ARCH_SAVE_REGS;
2860 n = mono_string_to_utf8 (name);
2861 for (i = 0; i < table->rows; ++i) {
2862 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
2863 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
2864 if (strcmp (val, n) == 0)
2868 if (i == table->rows)
2871 if (!cols [MONO_MANIFEST_IMPLEMENTATION]) {
2872 info->location = RESOURCE_LOCATION_EMBEDDED | RESOURCE_LOCATION_IN_MANIFEST;
2875 switch (cols [MONO_MANIFEST_IMPLEMENTATION] & IMPLEMENTATION_MASK) {
2876 case IMPLEMENTATION_FILE:
2877 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
2878 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
2879 mono_metadata_decode_row (table, i - 1, file_cols, MONO_FILE_SIZE);
2880 val = mono_metadata_string_heap (assembly->assembly->image, file_cols [MONO_FILE_NAME]);
2881 info->filename = mono_string_new (mono_object_domain (assembly), val);
2882 if (file_cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA)
2885 info->location = RESOURCE_LOCATION_EMBEDDED;
2888 case IMPLEMENTATION_ASSEMBLYREF:
2889 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
2890 info->assembly = mono_assembly_get_object (mono_domain_get (), assembly->assembly->image->references [i - 1]);
2892 // Obtain info recursively
2893 ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal (info->assembly, name, info);
2894 info->location |= RESOURCE_LOCATION_ANOTHER_ASSEMBLY;
2897 case IMPLEMENTATION_EXP_TYPE:
2898 g_assert_not_reached ();
2907 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name)
2909 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
2910 MonoArray *result = NULL;
2915 MONO_ARCH_SAVE_REGS;
2917 /* check hash if needed */
2919 n = mono_string_to_utf8 (name);
2920 for (i = 0; i < table->rows; ++i) {
2921 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
2922 if (strcmp (val, n) == 0) {
2925 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
2926 fn = mono_string_new (mono_object_domain (assembly), n);
2928 return (MonoObject*)fn;
2935 for (i = 0; i < table->rows; ++i) {
2936 result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
2937 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
2938 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
2939 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), n));
2942 return (MonoObject*)result;
2946 ves_icall_System_Reflection_Assembly_GetModulesInternal (MonoReflectionAssembly *assembly)
2948 MonoDomain *domain = mono_domain_get();
2951 int i, module_count = 0, file_count = 0;
2952 MonoImage **modules = assembly->assembly->image->modules;
2953 MonoTableInfo *table;
2956 while (modules[module_count])
2960 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
2961 file_count = table->rows;
2963 g_assert( assembly->assembly->image != NULL);
2966 klass = mono_class_from_name ( mono_defaults.corlib, "System.Reflection", "Module");
2967 res = mono_array_new (domain, klass, module_count + file_count);
2969 mono_array_set (res, gpointer, 0, mono_module_get_object (domain, assembly->assembly->image));
2970 for ( i = 1; i < module_count; ++i )
2971 mono_array_set (res, gpointer, i, mono_module_get_object (domain, modules[i]));
2973 for (i = 0; i < table->rows; ++i)
2974 mono_array_set (res, gpointer, module_count + i, mono_module_file_get_object (domain, assembly->assembly->image, i));
2979 static MonoReflectionMethod*
2980 ves_icall_GetCurrentMethod (void)
2982 MonoMethod *m = mono_method_get_last_managed ();
2984 MONO_ARCH_SAVE_REGS;
2986 return mono_method_get_object (mono_domain_get (), m, NULL);
2989 static MonoReflectionAssembly*
2990 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (void)
2992 MonoMethod *m = mono_method_get_last_managed ();
2994 MONO_ARCH_SAVE_REGS;
2996 return mono_assembly_get_object (mono_domain_get (), m->klass->image->assembly);
3001 get_caller (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data)
3003 MonoMethod **dest = data;
3005 /* skip unmanaged frames */
3020 static MonoReflectionAssembly*
3021 ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
3023 MonoDomain* domain = mono_domain_get ();
3025 MONO_ARCH_SAVE_REGS;
3027 if (!domain->entry_assembly)
3028 domain = mono_root_domain;
3030 return mono_assembly_get_object (domain, domain->entry_assembly);
3034 static MonoReflectionAssembly*
3035 ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
3037 MonoMethod *m = mono_method_get_last_managed ();
3038 MonoMethod *dest = m;
3040 MONO_ARCH_SAVE_REGS;
3042 mono_stack_walk (get_caller, &dest);
3045 return mono_assembly_get_object (mono_domain_get (), dest->klass->image->assembly);
3049 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
3051 MonoDomain *domain = mono_object_domain (object);
3055 MONO_ARCH_SAVE_REGS;
3057 name = mono_type_get_name (object->type);
3058 res = mono_string_new (domain, name);
3065 fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *aname, MonoAssemblyName *name, const char *absolute)
3067 static MonoMethod *create_culture = NULL;
3070 const char *pkey_ptr;
3073 MONO_ARCH_SAVE_REGS;
3075 if (strcmp (name->name, "corlib") == 0)
3076 aname->name = mono_string_new (domain, "mscorlib");
3078 aname->name = mono_string_new (domain, name->name);
3080 aname->major = name->major;
3081 aname->minor = name->minor;
3082 aname->build = name->build;
3083 aname->revision = name->revision;
3084 aname->hashalg = name->hash_alg;
3086 codebase = g_filename_to_uri (absolute, NULL, NULL);
3088 aname->codebase = mono_string_new (domain, codebase);
3092 if (!create_culture) {
3093 MonoMethodDesc *desc = mono_method_desc_new ("System.Globalization.CultureInfo:CreateSpecificCulture(string)", TRUE);
3094 create_culture = mono_method_desc_search_in_image (desc, mono_defaults.corlib);
3095 g_assert (create_culture);
3096 mono_method_desc_free (desc);
3099 args [0] = mono_string_new (domain, name->culture);
3100 aname->cultureInfo =
3101 mono_runtime_invoke (create_culture, NULL, args, NULL);
3103 if (name->public_key) {
3104 pkey_ptr = name->public_key;
3105 pkey_len = mono_metadata_decode_blob_size (pkey_ptr, &pkey_ptr);
3107 aname->publicKey = mono_array_new (domain, mono_defaults.byte_class, pkey_len);
3108 memcpy (mono_array_addr (aname->publicKey, guint8, 0), pkey_ptr, pkey_len);
3113 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
3117 MONO_ARCH_SAVE_REGS;
3119 absolute = g_build_filename (assembly->assembly->basedir, assembly->assembly->image->module_name, NULL);
3121 fill_reflection_assembly_name (mono_object_domain (assembly), aname,
3122 &assembly->assembly->aname, absolute);
3128 ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoString *fname, MonoReflectionAssemblyName *aname)
3131 MonoImageOpenStatus status = MONO_IMAGE_OK;
3134 MonoAssemblyName name;
3136 MONO_ARCH_SAVE_REGS;
3138 filename = mono_string_to_utf8 (fname);
3140 image = mono_image_open (filename, &status);
3146 exc = mono_get_exception_file_not_found (fname);
3147 mono_raise_exception (exc);
3150 res = mono_assembly_fill_assembly_name (image, &name);
3152 mono_image_close (image);
3154 mono_raise_exception (mono_get_exception_argument ("assemblyFile", "The file does not contain a manifest"));
3157 fill_reflection_assembly_name (mono_domain_get (), aname, &name, filename);
3160 mono_image_close (image);
3164 mono_module_get_types (MonoDomain *domain, MonoImage *image,
3165 MonoBoolean exportedOnly)
3169 MonoTableInfo *tdef = &image->tables [MONO_TABLE_TYPEDEF];
3171 guint32 attrs, visibility;
3173 /* we start the count from 1 because we skip the special type <Module> */
3176 for (i = 1; i < tdef->rows; ++i) {
3177 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
3178 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
3179 if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
3183 count = tdef->rows - 1;
3185 res = mono_array_new (domain, mono_defaults.monotype_class, count);
3187 for (i = 1; i < tdef->rows; ++i) {
3188 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
3189 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
3190 if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
3191 klass = mono_class_get (image, (i + 1) | MONO_TOKEN_TYPE_DEF);
3192 mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
3201 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
3204 MonoImage *image = assembly->assembly->image;
3205 MonoTableInfo *table = &image->tables [MONO_TABLE_FILE];
3209 MONO_ARCH_SAVE_REGS;
3211 domain = mono_object_domain (assembly);
3212 res = mono_module_get_types (domain, image, exportedOnly);
3214 /* Append data from all modules in the assembly */
3215 for (i = 0; i < table->rows; ++i) {
3216 if (!(mono_metadata_decode_row_col (table, i, MONO_FILE_FLAGS) & FILE_CONTAINS_NO_METADATA)) {
3217 MonoImage *loaded_image = mono_assembly_load_module (image->assembly, i + 1);
3219 MonoArray *res2 = mono_module_get_types (domain, loaded_image, exportedOnly);
3220 /* Append the new types to the end of the array */
3221 if (mono_array_length (res2) > 0) {
3225 len1 = mono_array_length (res);
3226 len2 = mono_array_length (res2);
3227 res3 = mono_array_new (domain, mono_defaults.monotype_class, len1 + len2);
3228 memcpy (mono_array_addr (res3, MonoReflectionType*, 0),
3229 mono_array_addr (res, MonoReflectionType*, 0),
3230 len1 * sizeof (MonoReflectionType*));
3231 memcpy (mono_array_addr (res3, MonoReflectionType*, len1),
3232 mono_array_addr (res2, MonoReflectionType*, 0),
3233 len2 * sizeof (MonoReflectionType*));
3243 static MonoReflectionType*
3244 ves_icall_System_Reflection_Module_GetGlobalType (MonoReflectionModule *module)
3246 MonoDomain *domain = mono_object_domain (module);
3249 MONO_ARCH_SAVE_REGS;
3251 g_assert (module->image);
3252 klass = mono_class_get (module->image, 1 | MONO_TOKEN_TYPE_DEF);
3253 return mono_type_get_object (domain, &klass->byval_arg);
3257 ves_icall_System_Reflection_Module_GetGuidInternal (MonoReflectionModule *module)
3259 MonoDomain *domain = mono_object_domain (module);
3261 MONO_ARCH_SAVE_REGS;
3263 g_assert (module->image);
3264 return mono_string_new (domain, module->image->guid);
3268 ves_icall_System_Reflection_Module_InternalGetTypes (MonoReflectionModule *module)
3270 MONO_ARCH_SAVE_REGS;
3273 return mono_array_new (mono_object_domain (module), mono_defaults.monotype_class, 0);
3275 return mono_module_get_types (mono_object_domain (module), module->image, FALSE);
3278 static MonoReflectionType*
3279 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
3282 int isbyref = 0, rank;
3283 char *str = mono_string_to_utf8 (smodifiers);
3286 MONO_ARCH_SAVE_REGS;
3288 klass = mono_class_from_mono_type (tb->type.type);
3290 /* logic taken from mono_reflection_parse_type(): keep in sync */
3294 if (isbyref) { /* only one level allowed by the spec */
3301 return mono_type_get_object (mono_object_domain (tb), &klass->this_arg);
3304 klass = mono_ptr_class_get (&klass->byval_arg);
3305 mono_class_init (klass);
3316 else if (*p != '*') { /* '*' means unknown lower bound */
3327 klass = mono_array_class_get (klass, rank);
3328 mono_class_init (klass);
3335 return mono_type_get_object (mono_object_domain (tb), &klass->byval_arg);
3339 ves_icall_Type_IsArrayImpl (MonoReflectionType *t)
3344 MONO_ARCH_SAVE_REGS;
3347 res = !type->byref && (type->type == MONO_TYPE_ARRAY || type->type == MONO_TYPE_SZARRAY);
3352 static MonoReflectionType *
3353 ves_icall_Type_make_array_type (MonoReflectionType *type, int rank)
3355 MonoClass *klass, *aklass;
3357 MONO_ARCH_SAVE_REGS;
3359 klass = mono_class_from_mono_type (type->type);
3360 aklass = mono_array_class_get (klass, rank);
3362 return mono_type_get_object (mono_object_domain (type), &aklass->byval_arg);
3366 ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target,
3367 MonoReflectionMethod *info)
3369 MonoClass *delegate_class = mono_class_from_mono_type (type->type);
3370 MonoObject *delegate;
3373 MONO_ARCH_SAVE_REGS;
3375 mono_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
3377 delegate = mono_object_new (mono_object_domain (type), delegate_class);
3379 func = mono_compile_method (info->method);
3381 mono_delegate_ctor (delegate, target, func);
3387 * Magic number to convert a time which is relative to
3388 * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
3390 #define EPOCH_ADJUST ((guint64)62135596800LL)
3393 * Magic number to convert FILETIME base Jan 1, 1601 to DateTime - base Jan, 1, 0001
3395 #define FILETIME_ADJUST ((guint64)504911232000000000LL)
3398 * This returns Now in UTC
3401 ves_icall_System_DateTime_GetNow (void)
3403 #ifdef PLATFORM_WIN32
3408 SystemTimeToFileTime (&st, &ft);
3409 return (gint64) FILETIME_ADJUST + ((((gint64)ft.dwHighDateTime)<<32) | ft.dwLowDateTime);
3411 /* FIXME: put this in io-layer and call it GetLocalTime */
3415 MONO_ARCH_SAVE_REGS;
3417 if (gettimeofday (&tv, NULL) == 0) {
3418 res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
3421 /* fixme: raise exception */
3426 #ifdef PLATFORM_WIN32
3427 /* convert a SYSTEMTIME which is of the form "last thursday in october" to a real date */
3429 convert_to_absolute_date(SYSTEMTIME *date)
3431 #define IS_LEAP(y) ((y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0))
3432 static int days_in_month[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
3433 static int leap_days_in_month[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
3434 /* from the calendar FAQ */
3435 int a = (14 - date->wMonth) / 12;
3436 int y = date->wYear - a;
3437 int m = date->wMonth + 12 * a - 2;
3438 int d = (1 + y + y/4 - y/100 + y/400 + (31*m)/12) % 7;
3440 /* d is now the day of the week for the first of the month (0 == Sunday) */
3442 int day_of_week = date->wDayOfWeek;
3444 /* set day_in_month to the first day in the month which falls on day_of_week */
3445 int day_in_month = 1 + (day_of_week - d);
3446 if (day_in_month <= 0)
3449 /* wDay is 1 for first weekday in month, 2 for 2nd ... 5 means last - so work that out allowing for days in the month */
3450 date->wDay = day_in_month + (date->wDay - 1) * 7;
3451 if (date->wDay > (IS_LEAP(date->wYear) ? leap_days_in_month[date->wMonth - 1] : days_in_month[date->wMonth - 1]))
3456 #ifndef PLATFORM_WIN32
3458 * Return's the offset from GMT of a local time.
3460 * tm is a local time
3461 * t is the same local time as seconds.
3464 gmt_offset(struct tm *tm, time_t t)
3466 #if defined (HAVE_TM_GMTOFF)
3467 return tm->tm_gmtoff;
3472 g.tm_isdst = tm->tm_isdst;
3474 return (int)difftime(t, t2);
3479 * This is heavily based on zdump.c from glibc 2.2.
3481 * * data[0]: start of daylight saving time (in DateTime ticks).
3482 * * data[1]: end of daylight saving time (in DateTime ticks).
3483 * * data[2]: utcoffset (in TimeSpan ticks).
3484 * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
3485 * * name[0]: name of this timezone when not daylight saving.
3486 * * name[1]: name of this timezone when daylight saving.
3488 * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
3489 * the class library allows years between 1 and 9999.
3491 * Returns true on success and zero on failure.
3494 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
3496 #ifndef PLATFORM_WIN32
3497 MonoDomain *domain = mono_domain_get ();
3498 struct tm start, tt;
3502 int is_daylight = 0, day;
3505 MONO_ARCH_SAVE_REGS;
3507 MONO_CHECK_ARG_NULL (data);
3508 MONO_CHECK_ARG_NULL (names);
3510 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
3511 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
3514 * no info is better than crashing: we'll need our own tz data to make
3515 * this work properly, anyway. The range is reduced to 1970 .. 2037 because
3516 * that is what mktime is guaranteed to support (we get into an infinite loop
3519 if ((year < 1970) || (year > 2037)) {
3521 tt = *localtime (&t);
3522 strftime (tzone, sizeof (tzone), "%Z", &tt);
3523 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
3524 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
3528 memset (&start, 0, sizeof (start));
3531 start.tm_year = year-1900;
3533 t = mktime (&start);
3534 gmtoff = gmt_offset (&start, t);
3536 /* For each day of the year, calculate the tm_gmtoff. */
3537 for (day = 0; day < 365; day++) {
3540 tt = *localtime (&t);
3542 /* Daylight saving starts or ends here. */
3543 if (gmt_offset (&tt, t) != gmtoff) {
3547 /* Try to find the exact hour when daylight saving starts/ends. */
3551 tt1 = *localtime (&t1);
3552 } while (gmt_offset (&tt1, t1) != gmtoff);
3554 /* Try to find the exact minute when daylight saving starts/ends. */
3557 tt1 = *localtime (&t1);
3558 } while (gmt_offset (&tt1, t1) == gmtoff);
3560 strftime (tzone, sizeof (tzone), "%Z", &tt);
3562 /* Write data, if we're already in daylight saving, we're done. */
3564 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
3565 mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
3568 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
3569 mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
3573 /* This is only set once when we enter daylight saving. */
3574 mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
3575 mono_array_set ((*data), gint64, 3, (gint64)(gmt_offset (&tt, t) - gmtoff) * 10000000L);
3577 gmtoff = gmt_offset (&tt, t);
3582 strftime (tzone, sizeof (tzone), "%Z", &tt);
3583 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
3584 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
3585 mono_array_set ((*data), gint64, 0, 0);
3586 mono_array_set ((*data), gint64, 1, 0);
3587 mono_array_set ((*data), gint64, 2, (gint64) gmtoff * 10000000L);
3588 mono_array_set ((*data), gint64, 3, 0);
3593 MonoDomain *domain = mono_domain_get ();
3594 TIME_ZONE_INFORMATION tz_info;
3599 tz_id = GetTimeZoneInformation (&tz_info);
3600 if (tz_id == TIME_ZONE_ID_INVALID)
3603 MONO_CHECK_ARG_NULL (data);
3604 MONO_CHECK_ARG_NULL (names);
3606 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
3607 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
3609 for (i = 0; i < 32; ++i)
3610 if (!tz_info.DaylightName [i])
3612 mono_array_set ((*names), gpointer, 1, mono_string_new_utf16 (domain, tz_info.DaylightName, i));
3613 for (i = 0; i < 32; ++i)
3614 if (!tz_info.StandardName [i])
3616 mono_array_set ((*names), gpointer, 0, mono_string_new_utf16 (domain, tz_info.StandardName, i));
3618 if ((year <= 1601) || (year > 30827)) {
3620 * According to MSDN, the MS time functions can't handle dates outside
3626 /* even if the timezone has no daylight savings it may have Bias (e.g. GMT+13 it seems) */
3627 if (tz_id != TIME_ZONE_ID_UNKNOWN) {
3628 tz_info.StandardDate.wYear = year;
3629 convert_to_absolute_date(&tz_info.StandardDate);
3630 err = SystemTimeToFileTime (&tz_info.StandardDate, &ft);
3632 mono_array_set ((*data), gint64, 1, FILETIME_ADJUST + (((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime));
3633 tz_info.DaylightDate.wYear = year;
3634 convert_to_absolute_date(&tz_info.DaylightDate);
3635 err = SystemTimeToFileTime (&tz_info.DaylightDate, &ft);
3637 mono_array_set ((*data), gint64, 0, FILETIME_ADJUST + (((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime));
3639 mono_array_set ((*data), gint64, 2, (tz_info.Bias + tz_info.StandardBias) * -600000000LL);
3640 mono_array_set ((*data), gint64, 3, (tz_info.DaylightBias - tz_info.StandardBias) * -600000000LL);
3647 ves_icall_System_Object_obj_address (MonoObject *this)
3649 MONO_ARCH_SAVE_REGS;
3657 ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array)
3664 MONO_ARCH_SAVE_REGS;
3666 klass = array->obj.vtable->klass;
3667 etype = klass->element_class->byval_arg.type;
3668 if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
3671 if (array->bounds == NULL)
3672 length = array->max_length;
3675 for (i = 0; i < klass->rank; ++ i)
3676 length *= array->bounds [i].length;
3679 esize = mono_array_element_size (klass);
3680 return length * esize;
3684 ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx)
3686 MONO_ARCH_SAVE_REGS;
3688 return mono_array_get (array, gint8, idx);
3692 ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value)
3694 MONO_ARCH_SAVE_REGS;
3696 mono_array_set (array, gint8, idx, value);
3700 ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count)
3702 char *src_buf, *dest_buf;
3704 MONO_ARCH_SAVE_REGS;
3706 src_buf = (gint8 *)src->vector + src_offset;
3707 dest_buf = (gint8 *)dest->vector + dest_offset;
3709 memcpy (dest_buf, src_buf, count);
3713 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
3715 MonoDomain *domain = mono_object_domain (this);
3717 MonoRealProxy *rp = ((MonoRealProxy *)this);
3721 MONO_ARCH_SAVE_REGS;
3723 res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
3725 ((MonoTransparentProxy *)res)->rp = rp;
3726 type = ((MonoReflectionType *)rp->class_to_proxy)->type;
3727 klass = mono_class_from_mono_type (type);
3729 if (klass->flags & TYPE_ATTRIBUTE_INTERFACE)
3730 ((MonoTransparentProxy *)res)->klass = mono_defaults.marshalbyrefobject_class;
3732 ((MonoTransparentProxy *)res)->klass = klass;
3734 res->vtable = mono_class_proxy_vtable (domain, klass);
3739 /* System.Environment */
3742 ves_icall_System_Environment_get_MachineName (void)
3744 #if defined (PLATFORM_WIN32)
3749 len = MAX_COMPUTERNAME_LENGTH + 1;
3750 buf = g_new (gunichar2, len);
3753 if (GetComputerName (buf, (PDWORD) &len))
3754 result = mono_string_new_utf16 (mono_domain_get (), buf, len);
3763 MONO_ARCH_SAVE_REGS;
3766 buf = g_new (gchar, len);
3769 if (gethostname (buf, len) == 0)
3770 result = mono_string_new (mono_domain_get (), buf);
3778 ves_icall_System_Environment_get_Platform (void)
3780 MONO_ARCH_SAVE_REGS;
3782 #if defined (PLATFORM_WIN32)
3792 ves_icall_System_Environment_get_NewLine (void)
3794 MONO_ARCH_SAVE_REGS;
3796 #if defined (PLATFORM_WIN32)
3797 return mono_string_new (mono_domain_get (), "\r\n");
3799 return mono_string_new (mono_domain_get (), "\n");
3804 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
3809 MONO_ARCH_SAVE_REGS;
3814 utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
3815 value = g_getenv (utf8_name);
3821 return mono_string_new (mono_domain_get (), value);
3825 * There is no standard way to get at environ.
3833 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
3841 MONO_ARCH_SAVE_REGS;
3844 for (e = environ; *e != 0; ++ e)
3847 domain = mono_domain_get ();
3848 names = mono_array_new (domain, mono_defaults.string_class, n);
3851 for (e = environ; *e != 0; ++ e) {
3852 parts = g_strsplit (*e, "=", 2);
3854 str = mono_string_new (domain, *parts);
3855 mono_array_set (names, MonoString *, n, str);
3867 * Returns the number of milliseconds elapsed since the system started.
3870 ves_icall_System_Environment_get_TickCount (void)
3872 #if defined (PLATFORM_WIN32)
3873 return GetTickCount();
3879 MONO_ARCH_SAVE_REGS;
3881 res = (gint32) gettimeofday (&tv, &tz);
3884 res = (gint32) ((tv.tv_sec & 0xFFFFF) * 1000 + (tv.tv_usec / 1000));
3891 ves_icall_System_Environment_Exit (int result)
3893 MONO_ARCH_SAVE_REGS;
3895 mono_runtime_quit ();
3897 /* we may need to do some cleanup here... */
3902 ves_icall_System_Text_Encoding_InternalCodePage (void)
3906 MONO_ARCH_SAVE_REGS;
3908 g_get_charset (&cset);
3909 /* g_print ("charset: %s\n", cset); */
3910 /* handle some common aliases */
3913 if (strcmp (cset, "ANSI_X3.4-1968") == 0)
3917 return mono_string_new (mono_domain_get (), cset);
3921 ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
3922 MonoReflectionMethod *method,
3923 MonoArray *out_args)
3925 MONO_ARCH_SAVE_REGS;
3927 mono_message_init (mono_object_domain (this), this, method, out_args);
3931 ves_icall_IsTransparentProxy (MonoObject *proxy)
3933 MONO_ARCH_SAVE_REGS;
3938 if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
3945 ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (MonoReflectionType *type, MonoBoolean enable)
3950 MONO_ARCH_SAVE_REGS;
3952 klass = mono_class_from_mono_type (type->type);
3953 vtable = mono_class_vtable (mono_domain_get (), klass);
3955 if (enable) vtable->remote = 1;
3956 else vtable->remote = 0;
3960 ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance (MonoReflectionType *type)
3965 MONO_ARCH_SAVE_REGS;
3967 domain = mono_object_domain (type);
3968 klass = mono_class_from_mono_type (type->type);
3970 if (klass->rank >= 1) {
3971 g_assert (klass->rank == 1);
3972 return (MonoObject *) mono_array_new (domain, klass->element_class, 0);
3974 // Bypass remoting object creation check
3975 return mono_object_new_alloc_specific (mono_class_vtable (domain, klass));
3980 ves_icall_System_IO_get_temp_path (void)
3982 MONO_ARCH_SAVE_REGS;
3984 return mono_string_new (mono_domain_get (), g_get_tmp_dir ());
3988 ves_icall_RuntimeMethod_GetFunctionPointer (MonoMethod *method)
3990 MONO_ARCH_SAVE_REGS;
3992 return mono_compile_method (method);
3995 char const * mono_cfg_dir = "";
3998 mono_install_get_config_dir (void)
4000 #ifdef PLATFORM_WIN32
4004 mono_cfg_dir = getenv ("MONO_CFG_DIR");
4006 if (!mono_cfg_dir) {
4007 #ifndef PLATFORM_WIN32
4008 mono_cfg_dir = MONO_CFG_DIR;
4010 mono_cfg_dir = g_strdup (MONO_CFG_DIR);
4011 for (i = strlen (mono_cfg_dir) - 1; i >= 0; i--) {
4012 if (mono_cfg_dir [i] == '/')
4013 ((char*) mono_cfg_dir) [i] = '\\';
4021 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
4026 MONO_ARCH_SAVE_REGS;
4028 path = g_build_path (G_DIR_SEPARATOR_S, mono_cfg_dir, "mono", "machine.config", NULL);
4030 #if defined (PLATFORM_WIN32)
4031 /* Avoid mixing '/' and '\\' */
4034 for (i = strlen (path) - 1; i >= 0; i--)
4035 if (path [i] == '/')
4039 mcpath = mono_string_new (mono_domain_get (), path);
4046 ves_icall_System_Web_Util_ICalls_get_machine_install_dir (void)
4051 MONO_ARCH_SAVE_REGS;
4053 path = g_path_get_dirname (mono_cfg_dir);
4055 #if defined (PLATFORM_WIN32)
4056 /* Avoid mixing '/' and '\\' */
4059 for (i = strlen (path) - 1; i >= 0; i--)
4060 if (path [i] == '/')
4064 ipath = mono_string_new (mono_domain_get (), path);
4071 ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoString *message)
4073 #if defined (PLATFORM_WIN32)
4074 static void (*output_debug) (gchar *);
4075 static gboolean tried_loading = FALSE;
4077 MONO_ARCH_SAVE_REGS;
4079 if (!tried_loading && output_debug == NULL) {
4082 tried_loading = TRUE;
4083 k32 = g_module_open ("kernel32", G_MODULE_BIND_LAZY);
4085 gchar *error = g_strdup (g_module_error ());
4086 g_warning ("Failed to load kernel32.dll: %s\n", error);
4091 g_module_symbol (k32, "OutputDebugStringW", (gpointer *) &output_debug);
4092 if (!output_debug) {
4093 gchar *error = g_strdup (g_module_error ());
4094 g_warning ("Failed to load OutputDebugStringW: %s\n", error);
4100 if (output_debug == NULL)
4103 output_debug (mono_string_chars (message));
4105 g_warning ("WriteWindowsDebugString called and PLATFORM_WIN32 not defined!\n");
4109 /* Only used for value types */
4111 ves_icall_System_Activator_CreateInstanceInternal (MonoReflectionType *type)
4116 MONO_ARCH_SAVE_REGS;
4118 domain = mono_object_domain (type);
4119 klass = mono_class_from_mono_type (type->type);
4121 return mono_object_new (domain, klass);
4124 static MonoReflectionMethod *
4125 ves_icall_MonoMethod_get_base_definition (MonoReflectionMethod *m)
4128 MonoMethod *method = m->method;
4129 MonoMethod *result = NULL;
4131 MONO_ARCH_SAVE_REGS;
4133 if (!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
4134 method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ||
4135 method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
4138 if (method->klass == NULL || (klass = method->klass->parent) == NULL)
4141 while (result == NULL && klass != NULL && (klass->vtable_size > method->slot))
4143 result = klass->vtable [method->slot];
4144 if (result == NULL) {
4145 /* It is an abstract method */
4147 for (i=0; i<klass->method.count; i++) {
4148 if (klass->methods [i]->slot == method->slot) {
4149 result = klass->methods [i];
4154 klass = klass->parent;
4160 return mono_method_get_object (mono_domain_get (), result, NULL);
4164 mono_ArgIterator_Setup (MonoArgIterator *iter, char* argsp, char* start)
4166 MONO_ARCH_SAVE_REGS;
4168 iter->sig = *(MonoMethodSignature**)argsp;
4170 g_assert (iter->sig->sentinelpos <= iter->sig->param_count);
4171 g_assert (iter->sig->call_convention == MONO_CALL_VARARG);
4174 /* FIXME: it's not documented what start is exactly... */
4175 iter->args = start? start: argsp + sizeof (gpointer);
4176 iter->num_args = iter->sig->param_count - iter->sig->sentinelpos;
4178 // g_print ("sig %p, param_count: %d, sent: %d\n", iter->sig, iter->sig->param_count, iter->sig->sentinelpos);
4182 mono_ArgIterator_IntGetNextArg (MonoArgIterator *iter)
4184 gint i, align, arg_size;
4186 MONO_ARCH_SAVE_REGS;
4188 i = iter->sig->sentinelpos + iter->next_arg;
4190 g_assert (i < iter->sig->param_count);
4192 res.type = iter->sig->params [i];
4193 res.klass = mono_class_from_mono_type (res.type);
4194 /* FIXME: endianess issue... */
4195 res.value = iter->args;
4196 arg_size = mono_type_stack_size (res.type, &align);
4197 iter->args = (char*)iter->args + arg_size;
4200 //g_print ("returning arg %d, type 0x%02x of size %d at %p\n", i, res.type->type, arg_size, res.value);
4206 mono_ArgIterator_IntGetNextArgT (MonoArgIterator *iter, MonoType *type)
4208 gint i, align, arg_size;
4210 MONO_ARCH_SAVE_REGS;
4212 i = iter->sig->sentinelpos + iter->next_arg;
4214 g_assert (i < iter->sig->param_count);
4216 while (i < iter->sig->param_count) {
4217 if (!mono_metadata_type_equal (type, iter->sig->params [i]))
4219 res.type = iter->sig->params [i];
4220 res.klass = mono_class_from_mono_type (res.type);
4221 /* FIXME: endianess issue... */
4222 res.value = iter->args;
4223 arg_size = mono_type_stack_size (res.type, &align);
4224 iter->args = (char*)iter->args + arg_size;
4226 //g_print ("returning arg %d, type 0x%02x of size %d at %p\n", i, res.type->type, arg_size, res.value);
4229 //g_print ("arg type 0x%02x not found\n", res.type->type);
4238 mono_ArgIterator_IntGetNextArgType (MonoArgIterator *iter)
4241 MONO_ARCH_SAVE_REGS;
4243 i = iter->sig->sentinelpos + iter->next_arg;
4245 g_assert (i < iter->sig->param_count);
4247 return iter->sig->params [i];
4251 mono_TypedReference_ToObject (MonoTypedRef tref)
4253 MONO_ARCH_SAVE_REGS;
4255 if (MONO_TYPE_IS_REFERENCE (tref.type)) {
4256 MonoObject** objp = tref.value;
4260 return mono_value_box (mono_domain_get (), tref.klass, tref.value);
4264 prelink_method (MonoMethod *method)
4266 if (!(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
4268 mono_lookup_pinvoke_call (method);
4269 /* create the wrapper, too? */
4273 ves_icall_System_Runtime_InteropServices_Marshal_Prelink (MonoReflectionMethod *method)
4275 MONO_ARCH_SAVE_REGS;
4276 prelink_method (method->method);
4280 ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionType *type)
4282 MonoClass *klass = mono_class_from_mono_type (type->type);
4284 MONO_ARCH_SAVE_REGS;
4286 mono_class_init (klass);
4287 for (i = 0; i < klass->method.count; ++i)
4288 prelink_method (klass->methods [i]);
4293 static gconstpointer icall_map [] = {
4297 "System.Array::GetValue", ves_icall_System_Array_GetValue,
4298 "System.Array::SetValue", ves_icall_System_Array_SetValue,
4299 "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
4300 "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
4301 "System.Array::GetRank", ves_icall_System_Array_GetRank,
4302 "System.Array::GetLength", ves_icall_System_Array_GetLength,
4303 "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
4304 "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
4305 "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
4306 "System.Array::Clone", mono_array_clone,
4309 * System.ArgIterator
4311 "System.ArgIterator::Setup", mono_ArgIterator_Setup,
4312 "System.ArgIterator::IntGetNextArg()", mono_ArgIterator_IntGetNextArg,
4313 "System.ArgIterator::IntGetNextArg(intptr)", mono_ArgIterator_IntGetNextArgT,
4314 "System.ArgIterator::IntGetNextArgType", mono_ArgIterator_IntGetNextArgType,
4317 * System.TypedReference
4319 "System.TypedReference::ToObject", mono_TypedReference_ToObject,
4324 "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
4325 "System.Object::GetType", ves_icall_System_Object_GetType,
4326 "System.Object::InternalGetHashCode", ves_icall_System_Object_GetHashCode,
4327 "System.Object::obj_address", ves_icall_System_Object_obj_address,
4332 "System.ValueType::InternalGetHashCode", ves_icall_System_ValueType_InternalGetHashCode,
4333 "System.ValueType::InternalEquals", ves_icall_System_ValueType_Equals,
4339 "System.String::.ctor(char*)", ves_icall_System_String_ctor_charp,
4340 "System.String::.ctor(char*,int,int)", ves_icall_System_String_ctor_charp_int_int,
4341 "System.String::.ctor(sbyte*)", ves_icall_System_String_ctor_sbytep,
4342 "System.String::.ctor(sbyte*,int,int)", ves_icall_System_String_ctor_sbytep_int_int,
4343 "System.String::.ctor(sbyte*,int,int,System.Text.Encoding)", ves_icall_System_String_ctor_encoding,
4344 "System.String::.ctor(char[])", ves_icall_System_String_ctor_chara,
4345 "System.String::.ctor(char[],int,int)", ves_icall_System_String_ctor_chara_int_int,
4346 "System.String::.ctor(char,int)", ves_icall_System_String_ctor_char_int,
4347 "System.String::InternalJoin", ves_icall_System_String_InternalJoin,
4348 "System.String::InternalInsert", ves_icall_System_String_InternalInsert,
4349 "System.String::InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char,
4350 "System.String::InternalRemove", ves_icall_System_String_InternalRemove,
4351 "System.String::InternalCopyTo", ves_icall_System_String_InternalCopyTo,
4352 "System.String::InternalSplit", ves_icall_System_String_InternalSplit,
4353 "System.String::InternalTrim", ves_icall_System_String_InternalTrim,
4354 "System.String::InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny,
4355 "System.String::InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny,
4356 "System.String::InternalPad", ves_icall_System_String_InternalPad,
4357 "System.String::InternalAllocateStr", ves_icall_System_String_InternalAllocateStr,
4358 "System.String::InternalStrcpy(string,int,string)", ves_icall_System_String_InternalStrcpy_Str,
4359 "System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
4360 "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
4361 "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
4362 "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
4363 "System.String::get_Chars", ves_icall_System_String_get_Chars,
4368 "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
4369 "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
4370 "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
4371 "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
4372 "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
4373 "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
4374 "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
4375 "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
4376 "System.AppDomain::LoadAssemblyRaw", ves_icall_System_AppDomain_LoadAssemblyRaw,
4377 "System.AppDomain::InternalIsFinalizingForUnload", ves_icall_System_AppDomain_InternalIsFinalizingForUnload,
4378 "System.AppDomain::InternalUnload", ves_icall_System_AppDomain_InternalUnload,
4379 "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
4380 "System.AppDomain::InternalSetDomain", ves_icall_System_AppDomain_InternalSetDomain,
4381 "System.AppDomain::InternalSetDomainByID", ves_icall_System_AppDomain_InternalSetDomainByID,
4382 "System.AppDomain::InternalPushDomainRef", ves_icall_System_AppDomain_InternalPushDomainRef,
4383 "System.AppDomain::InternalPushDomainRefByID", ves_icall_System_AppDomain_InternalPushDomainRefByID,
4384 "System.AppDomain::InternalPopDomainRef", ves_icall_System_AppDomain_InternalPopDomainRef,
4385 "System.AppDomain::InternalSetContext", ves_icall_System_AppDomain_InternalSetContext,
4386 "System.AppDomain::InternalGetContext", ves_icall_System_AppDomain_InternalGetContext,
4387 "System.AppDomain::InternalGetDefaultContext", ves_icall_System_AppDomain_InternalGetDefaultContext,
4388 "System.AppDomain::InternalGetProcessGuid", ves_icall_System_AppDomain_InternalGetProcessGuid,
4391 * System.AppDomainSetup
4393 "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
4398 "System.Double::ParseImpl", mono_double_ParseImpl,
4399 "System.Double::AssertEndianity", ves_icall_System_Double_AssertEndianity,
4404 "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
4405 "System.Decimal::decimal2Int64", mono_decimal2Int64,
4406 "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
4407 "System.Decimal::decimalIncr", mono_decimalIncr,
4408 "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
4409 "System.Decimal::decimal2double", mono_decimal2double,
4410 "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
4411 "System.Decimal::decimalRound", mono_decimalRound,
4412 "System.Decimal::decimalMult", mono_decimalMult,
4413 "System.Decimal::decimalDiv", mono_decimalDiv,
4414 "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
4415 "System.Decimal::decimalCompare", mono_decimalCompare,
4416 "System.Decimal::string2decimal", mono_string2decimal,
4417 "System.Decimal::decimal2string", mono_decimal2string,
4422 "System.Reflection.Emit.ModuleBuilder::getUSIndex", mono_image_insert_string,
4423 "System.Reflection.Emit.ModuleBuilder::getToken", ves_icall_ModuleBuilder_getToken,
4424 "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
4425 "System.Reflection.Emit.ModuleBuilder::basic_init", mono_image_module_basic_init,
4426 "System.Reflection.Emit.ModuleBuilder::build_metadata", ves_icall_ModuleBuilder_build_metadata,
4427 "System.Reflection.Emit.ModuleBuilder::getDataChunk", ves_icall_ModuleBuilder_getDataChunk,
4432 "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
4437 "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
4438 "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
4439 "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
4440 "System.Reflection.MonoEventInfo::get_event_info", ves_icall_get_event_info,
4441 "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
4442 "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
4443 "System.Reflection.MethodBase::GetCurrentMethod", ves_icall_GetCurrentMethod,
4444 "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
4445 "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
4446 "System.Reflection.MonoField::GetParentType", ves_icall_MonoField_GetParentType,
4447 "System.Reflection.MonoField::GetValueInternal", ves_icall_MonoField_GetValueInternal,
4448 "System.Reflection.MonoField::SetValueInternal", ves_icall_FieldInfo_SetValueInternal,
4449 "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
4450 "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
4452 "System.RuntimeMethodHandle::GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer,
4453 "System.Reflection.MonoMethod::get_base_definition", ves_icall_MonoMethod_get_base_definition,
4457 "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
4458 "System.Enum::get_value", ves_icall_System_Enum_get_value,
4459 "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
4464 "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
4465 "System.Reflection.Emit.TypeBuilder::create_internal_class", mono_reflection_create_internal_class,
4466 "System.Reflection.Emit.TypeBuilder::create_runtime_class", mono_reflection_create_runtime_class,
4467 "System.Reflection.Emit.TypeBuilder::setup_generic_class", mono_reflection_setup_generic_class,
4472 "System.Reflection.Emit.DynamicMethod::create_dynamic_method", mono_reflection_create_dynamic_method,
4475 * TypeBuilder generics icalls.
4477 "System.Reflection.Emit.TypeBuilder::get_IsGenericParameter", ves_icall_TypeBuilder_get_IsGenericParameter,
4478 "System.Reflection.Emit.TypeBuilder::define_generic_parameter", ves_icall_TypeBuilder_define_generic_parameter,
4481 * MethodBuilder generic icalls.
4483 "System.Reflection.Emit.MethodBuilder::define_generic_parameter", ves_icall_MethodBuilder_define_generic_parameter,
4486 * MonoGenericInst generic icalls.
4488 "System.Reflection.MonoGenericInst::inflate_method", mono_reflection_inflate_method_or_ctor,
4489 "System.Reflection.MonoGenericInst::inflate_ctor", mono_reflection_inflate_method_or_ctor,
4490 "System.Reflection.MonoGenericInst::inflate_field", mono_reflection_inflate_field,
4495 "System.Type::internal_from_name", ves_icall_type_from_name,
4496 "System.Type::internal_from_handle", ves_icall_type_from_handle,
4497 "System.MonoType::get_attributes", ves_icall_get_attributes,
4498 "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
4499 "System.Type::type_is_assignable_from", ves_icall_type_is_assignable_from,
4500 "System.Type::Equals", ves_icall_type_Equals,
4501 "System.Type::GetTypeCode", ves_icall_type_GetTypeCode,
4502 "System.Type::GetInterfaceMapData", ves_icall_Type_GetInterfaceMapData,
4503 "System.Type::IsArrayImpl", ves_icall_Type_IsArrayImpl,
4504 "System.Type::make_array_type", ves_icall_Type_make_array_type,
4506 /* Type generics icalls */
4507 "System.Type::GetGenericArguments", ves_icall_Type_GetGenericArguments,
4508 "System.Type::GetGenericParameterPosition", ves_icall_Type_GetGenericParameterPosition,
4509 "System.Type::get_IsGenericTypeDefinition", ves_icall_Type_get_IsGenericTypeDefinition,
4510 "System.Type::GetGenericTypeDefinition_impl", ves_icall_Type_GetGenericTypeDefinition_impl,
4511 "System.Type::BindGenericParameters", ves_icall_Type_BindGenericParameters,
4512 "System.Type::get_IsGenericInstance", ves_icall_Type_get_IsGenericInstance,
4514 "System.MonoType::get_HasGenericArguments", ves_icall_MonoType_get_HasGenericArguments,
4515 "System.MonoType::get_IsGenericParameter", ves_icall_MonoType_get_IsGenericParameter,
4516 "System.MonoType::get_DeclaringMethod", ves_icall_MonoType_get_DeclaringMethod,
4518 /* Method generics icalls */
4519 "System.Reflection.MethodInfo::get_IsGenericMethodDefinition", ves_icall_MethodInfo_get_IsGenericMethodDefinition,
4520 "System.Reflection.MethodInfo::BindGenericParameters", mono_reflection_bind_generic_method_parameters,
4521 "System.Reflection.MonoMethod::GetGenericArguments", ves_icall_MonoMethod_GetGenericArguments,
4525 * System.Reflection.FieldInfo
4527 "System.Reflection.FieldInfo::internal_from_handle", ves_icall_System_Reflection_FieldInfo_internal_from_handle,
4530 * System.Runtime.CompilerServices.RuntimeHelpers
4532 "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray,
4533 "System.Runtime.CompilerServices.RuntimeHelpers::GetOffsetToStringData", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData,
4534 "System.Runtime.CompilerServices.RuntimeHelpers::GetObjectValue", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue,
4535 "System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor,
4540 "System.Threading.Thread::Abort_internal(object)", ves_icall_System_Threading_Thread_Abort,
4541 "System.Threading.Thread::ResetAbort_internal()", ves_icall_System_Threading_Thread_ResetAbort,
4542 "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
4543 "System.Threading.Thread::Thread_free_internal", ves_icall_System_Threading_Thread_Thread_free_internal,
4544 "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
4545 "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
4546 "System.Threading.Thread::CurrentThread_internal", mono_thread_current,
4547 "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
4548 "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
4549 "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
4550 "System.Threading.Thread::GetDomainID", ves_icall_System_Threading_Thread_GetDomainID,
4551 "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
4552 "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
4553 "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
4554 "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
4555 "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
4556 "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
4557 "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
4558 "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
4559 "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
4560 "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
4561 "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
4562 "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
4563 "System.Threading.NativeEventCalls::CloseEvent_internal", ves_icall_System_Threading_Events_CloseEvent_internal,
4564 "System.Threading.ThreadPool::GetAvailableThreads", ves_icall_System_Threading_ThreadPool_GetAvailableThreads,
4565 "System.Threading.ThreadPool::GetMaxThreads", ves_icall_System_Threading_ThreadPool_GetMaxThreads,
4566 "System.Threading.Thread::VolatileRead(byte&)", ves_icall_System_Threading_Thread_VolatileRead1,
4567 "System.Threading.Thread::VolatileRead(double&)", ves_icall_System_Threading_Thread_VolatileRead8,
4568 "System.Threading.Thread::VolatileRead(short&)", ves_icall_System_Threading_Thread_VolatileRead2,
4569 "System.Threading.Thread::VolatileRead(int&)", ves_icall_System_Threading_Thread_VolatileRead4,
4570 "System.Threading.Thread::VolatileRead(long&)", ves_icall_System_Threading_Thread_VolatileRead8,
4571 "System.Threading.Thread::VolatileRead(IntPtr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr,
4572 "System.Threading.Thread::VolatileRead(object&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr,
4573 "System.Threading.Thread::VolatileRead(sbyte&)", ves_icall_System_Threading_Thread_VolatileRead1,
4574 "System.Threading.Thread::VolatileRead(float&)", ves_icall_System_Threading_Thread_VolatileRead4,
4575 "System.Threading.Thread::VolatileRead(ushort&)", ves_icall_System_Threading_Thread_VolatileRead2,
4576 "System.Threading.Thread::VolatileRead(uint&)", ves_icall_System_Threading_Thread_VolatileRead2,
4577 "System.Threading.Thread::VolatileRead(ulong&)", ves_icall_System_Threading_Thread_VolatileRead8,
4578 "System.Threading.Thread::VolatileRead(UIntPtr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr,
4579 "System.Threading.Thread::VolatileWrite(byte&,byte)", ves_icall_System_Threading_Thread_VolatileWrite1,
4580 "System.Threading.Thread::VolatileWrite(double&,double)", ves_icall_System_Threading_Thread_VolatileWrite8,
4581 "System.Threading.Thread::VolatileWrite(short&,short)", ves_icall_System_Threading_Thread_VolatileWrite2,
4582 "System.Threading.Thread::VolatileWrite(int&,int)", ves_icall_System_Threading_Thread_VolatileWrite4,
4583 "System.Threading.Thread::VolatileWrite(long&,long)", ves_icall_System_Threading_Thread_VolatileWrite8,
4584 "System.Threading.Thread::VolatileWrite(IntPtr&,IntPtr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr,
4585 "System.Threading.Thread::VolatileWrite(object&,object)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr,
4586 "System.Threading.Thread::VolatileWrite(sbyte&,sbyte)", ves_icall_System_Threading_Thread_VolatileWrite1,
4587 "System.Threading.Thread::VolatileWrite(float&,float)", ves_icall_System_Threading_Thread_VolatileWrite4,
4588 "System.Threading.Thread::VolatileWrite(ushort&,ushort)", ves_icall_System_Threading_Thread_VolatileWrite2,
4589 "System.Threading.Thread::VolatileWrite(uint&,uint)", ves_icall_System_Threading_Thread_VolatileWrite2,
4590 "System.Threading.Thread::VolatileWrite(ulong&,ulong)", ves_icall_System_Threading_Thread_VolatileWrite8,
4591 "System.Threading.Thread::VolatileWrite(UIntPtr&,UIntPtr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr,
4594 * System.Threading.WaitHandle
4596 "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
4597 "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
4598 "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
4601 * System.Runtime.InteropServices.Marshal
4603 "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
4604 "System.Runtime.InteropServices.Marshal::ReadByte", ves_icall_System_Runtime_InteropServices_Marshal_ReadByte,
4605 "System.Runtime.InteropServices.Marshal::ReadInt16", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16,
4606 "System.Runtime.InteropServices.Marshal::ReadInt32", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32,
4607 "System.Runtime.InteropServices.Marshal::ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64,
4608 "System.Runtime.InteropServices.Marshal::WriteIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr,
4609 "System.Runtime.InteropServices.Marshal::WriteByte", ves_icall_System_Runtime_InteropServices_Marshal_WriteByte,
4610 "System.Runtime.InteropServices.Marshal::WriteInt16", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16,
4611 "System.Runtime.InteropServices.Marshal::WriteInt32", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32,
4612 "System.Runtime.InteropServices.Marshal::WriteInt64", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64,
4614 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
4615 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
4616 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
4617 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
4618 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni,
4619 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len,
4620 "System.Runtime.InteropServices.Marshal::PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR,
4622 "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
4623 "System.Runtime.InteropServices.Marshal::AllocHGlobal", mono_marshal_alloc,
4624 "System.Runtime.InteropServices.Marshal::FreeHGlobal", mono_marshal_free,
4625 "System.Runtime.InteropServices.Marshal::ReAllocHGlobal", mono_marshal_realloc,
4626 "System.Runtime.InteropServices.Marshal::copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged,
4627 "System.Runtime.InteropServices.Marshal::copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged,
4628 "System.Runtime.InteropServices.Marshal::SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf,
4629 "System.Runtime.InteropServices.Marshal::StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr,
4630 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure,
4631 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type,
4632 "System.Runtime.InteropServices.Marshal::OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf,
4633 "System.Runtime.InteropServices.Marshal::StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
4634 "System.Runtime.InteropServices.Marshal::StringToHGlobalAuto", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
4635 "System.Runtime.InteropServices.Marshal::StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni,
4636 "System.Runtime.InteropServices.Marshal::DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure,
4637 "System.Runtime.InteropServices.Marshal::Prelink", ves_icall_System_Runtime_InteropServices_Marshal_Prelink,
4638 "System.Runtime.InteropServices.Marshal::PrelinkAll", ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll,
4641 "System.Reflection.Assembly::LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom,
4642 "System.Reflection.Assembly::InternalGetType", ves_icall_System_Reflection_Assembly_InternalGetType,
4643 "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
4644 "System.Reflection.Assembly::FillName", ves_icall_System_Reflection_Assembly_FillName,
4645 "System.Reflection.Assembly::InternalGetAssemblyName", ves_icall_System_Reflection_Assembly_InternalGetAssemblyName,
4646 "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
4647 "System.Reflection.Assembly::get_location", ves_icall_System_Reflection_Assembly_get_location,
4648 "System.Reflection.Assembly::InternalImageRuntimeVersion", ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion,
4649 "System.Reflection.Assembly::GetExecutingAssembly", ves_icall_System_Reflection_Assembly_GetExecutingAssembly,
4650 "System.Reflection.Assembly::GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly,
4651 "System.Reflection.Assembly::GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly,
4652 "System.Reflection.Assembly::get_EntryPoint", ves_icall_System_Reflection_Assembly_get_EntryPoint,
4653 "System.Reflection.Assembly::GetManifestResourceNames", ves_icall_System_Reflection_Assembly_GetManifestResourceNames,
4654 "System.Reflection.Assembly::GetManifestResourceInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInternal,
4655 "System.Reflection.Assembly::GetManifestResourceInfoInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal,
4656 "System.Reflection.Assembly::GetFilesInternal", ves_icall_System_Reflection_Assembly_GetFilesInternal,
4657 "System.Reflection.Assembly::GetReferencedAssemblies", ves_icall_System_Reflection_Assembly_GetReferencedAssemblies,
4658 "System.Reflection.Assembly::GetNamespaces", ves_icall_System_Reflection_Assembly_GetNamespaces,
4659 "System.Reflection.Assembly::GetModulesInternal", ves_icall_System_Reflection_Assembly_GetModulesInternal,
4662 * System.Reflection.Module
4664 "System.Reflection.Module::GetGlobalType", ves_icall_System_Reflection_Module_GetGlobalType,
4665 "System.Reflection.Module::GetGuidInternal", ves_icall_System_Reflection_Module_GetGuidInternal,
4666 "System.Reflection.Module::InternalGetTypes", ves_icall_System_Reflection_Module_InternalGetTypes,
4671 "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
4672 "System.MonoType::type_from_obj", mono_type_type_from_obj,
4673 "System.MonoType::GetElementType", ves_icall_MonoType_GetElementType,
4674 "System.MonoType::GetArrayRank", ves_icall_MonoType_GetArrayRank,
4675 "System.MonoType::get_BaseType", ves_icall_get_type_parent,
4676 "System.MonoType::get_Module", ves_icall_MonoType_get_Module,
4677 "System.MonoType::get_Assembly", ves_icall_MonoType_get_Assembly,
4678 "System.MonoType::get_DeclaringType", ves_icall_MonoType_get_DeclaringType,
4679 "System.MonoType::get_UnderlyingSystemType", ves_icall_MonoType_get_UnderlyingSystemType,
4680 "System.MonoType::get_Name", ves_icall_MonoType_get_Name,
4681 "System.MonoType::get_Namespace", ves_icall_MonoType_get_Namespace,
4682 "System.MonoType::IsPointerImpl", ves_icall_type_ispointer,
4683 "System.MonoType::IsPrimitiveImpl", ves_icall_type_isprimitive,
4684 "System.MonoType::IsByRefImpl", ves_icall_type_isbyref,
4685 "System.MonoType::GetField", ves_icall_Type_GetField,
4686 "System.MonoType::GetFields", ves_icall_Type_GetFields,
4687 "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
4688 "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
4689 "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
4690 "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
4691 "System.MonoType::InternalGetEvent", ves_icall_MonoType_GetEvent,
4692 "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
4693 "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
4694 "System.MonoType::GetNestedType", ves_icall_Type_GetNestedType,
4697 * System.Net.Sockets I/O Services
4699 "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
4700 "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
4701 "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
4702 "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
4703 "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
4704 "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
4705 "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
4706 "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
4707 "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
4708 "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
4709 "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
4710 "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
4711 "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
4712 "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
4713 "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
4714 "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
4715 "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
4716 "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
4717 "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
4718 "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
4719 "System.Net.Dns::GetHostByName_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByName_internal,
4720 "System.Net.Dns::GetHostByAddr_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByAddr_internal,
4721 "System.Net.Dns::GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal,
4726 "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
4727 "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
4728 "System.Char::IsControl", ves_icall_System_Char_IsControl,
4729 "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
4730 "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
4731 "System.Char::IsLower", ves_icall_System_Char_IsLower,
4732 "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
4733 "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
4734 "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
4735 "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
4736 "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
4737 "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
4738 "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
4739 "System.Char::ToLower", ves_icall_System_Char_ToLower,
4740 "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
4743 * System.Text.Encoding
4745 "System.Text.Encoding::InternalCodePage", ves_icall_System_Text_Encoding_InternalCodePage,
4747 "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
4748 "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
4753 "System.GC::InternalCollect", ves_icall_System_GC_InternalCollect,
4754 "System.GC::GetTotalMemory", ves_icall_System_GC_GetTotalMemory,
4755 "System.GC::KeepAlive", ves_icall_System_GC_KeepAlive,
4756 "System.GC::ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize,
4757 "System.GC::SuppressFinalize", ves_icall_System_GC_SuppressFinalize,
4758 "System.GC::WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers,
4759 "System.Runtime.InteropServices.GCHandle::GetTarget", ves_icall_System_GCHandle_GetTarget,
4760 "System.Runtime.InteropServices.GCHandle::GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle,
4761 "System.Runtime.InteropServices.GCHandle::FreeHandle", ves_icall_System_GCHandle_FreeHandle,
4762 "System.Runtime.InteropServices.GCHandle::GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject,
4765 * System.Security.Cryptography calls
4768 "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes,
4769 "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetNonZeroBytes,
4774 "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
4775 "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
4776 "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
4777 "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
4782 "System.IO.MonoIO::CreateDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CreateDirectory,
4783 "System.IO.MonoIO::RemoveDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_RemoveDirectory,
4784 "System.IO.MonoIO::FindFirstFile(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindFirstFile,
4785 "System.IO.MonoIO::FindNextFile(intptr,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindNextFile,
4786 "System.IO.MonoIO::FindClose(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindClose,
4787 "System.IO.MonoIO::GetCurrentDirectory(System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
4788 "System.IO.MonoIO::SetCurrentDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
4789 "System.IO.MonoIO::MoveFile(string,string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile,
4790 "System.IO.MonoIO::CopyFile(string,string,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CopyFile,
4791 "System.IO.MonoIO::DeleteFile(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_DeleteFile,
4792 "System.IO.MonoIO::GetFileAttributes(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileAttributes,
4793 "System.IO.MonoIO::SetFileAttributes(string,System.IO.FileAttributes,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileAttributes,
4794 "System.IO.MonoIO::GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType,
4795 "System.IO.MonoIO::GetFileStat(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat,
4796 "System.IO.MonoIO::Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open,
4797 "System.IO.MonoIO::Close(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Close,
4798 "System.IO.MonoIO::Read(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Read,
4799 "System.IO.MonoIO::Write(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Write,
4800 "System.IO.MonoIO::Seek(intptr,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek,
4801 "System.IO.MonoIO::GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength,
4802 "System.IO.MonoIO::SetLength(intptr,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetLength,
4803 "System.IO.MonoIO::SetFileTime(intptr,long,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileTime,
4804 "System.IO.MonoIO::Flush(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Flush,
4805 "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
4806 "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
4807 "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
4808 "System.IO.MonoIO::CreatePipe(intptr&,intptr&)", ves_icall_System_IO_MonoIO_CreatePipe,
4809 "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
4810 "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
4811 "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
4812 "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
4813 "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
4814 "System.IO.MonoIO::GetTempPath(string&)", ves_icall_System_IO_MonoIO_GetTempPath,
4819 "System.Math::Floor", ves_icall_System_Math_Floor,
4820 "System.Math::Round", ves_icall_System_Math_Round,
4821 "System.Math::Round2", ves_icall_System_Math_Round2,
4822 "System.Math::Sin", ves_icall_System_Math_Sin,
4823 "System.Math::Cos", ves_icall_System_Math_Cos,
4824 "System.Math::Tan", ves_icall_System_Math_Tan,
4825 "System.Math::Sinh", ves_icall_System_Math_Sinh,
4826 "System.Math::Cosh", ves_icall_System_Math_Cosh,
4827 "System.Math::Tanh", ves_icall_System_Math_Tanh,
4828 "System.Math::Acos", ves_icall_System_Math_Acos,
4829 "System.Math::Asin", ves_icall_System_Math_Asin,
4830 "System.Math::Atan", ves_icall_System_Math_Atan,
4831 "System.Math::Atan2", ves_icall_System_Math_Atan2,
4832 "System.Math::Exp", ves_icall_System_Math_Exp,
4833 "System.Math::Log", ves_icall_System_Math_Log,
4834 "System.Math::Log10", ves_icall_System_Math_Log10,
4835 "System.Math::Pow", ves_icall_System_Math_Pow,
4836 "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
4839 * System.Environment
4841 "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
4842 "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
4843 "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
4844 "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
4845 "System.Environment::GetCommandLineArgs", mono_runtime_get_main_args,
4846 "System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
4847 "System.Environment::Exit", ves_icall_System_Environment_Exit,
4848 "System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
4849 "System.Environment::get_ExitCode", mono_environment_exitcode_get,
4850 "System.Environment::set_ExitCode", mono_environment_exitcode_set,
4851 "System.Environment::GetMachineConfigPath", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
4854 * System.Runtime.Remoting
4856 "System.Runtime.Remoting.RemotingServices::InternalExecute",
4857 ves_icall_InternalExecute,
4858 "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
4859 ves_icall_IsTransparentProxy,
4862 * System.Runtime.Remoting.Activation
4864 "System.Runtime.Remoting.Activation.ActivationServices::AllocateUninitializedClassInstance",
4865 ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance,
4866 "System.Runtime.Remoting.Activation.ActivationServices::EnableProxyActivation",
4867 ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation,
4870 * System.Runtime.Remoting.Messaging
4872 "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
4873 ves_icall_MonoMethodMessage_InitMessage,
4876 * System.Runtime.Remoting.Proxies
4878 "System.Runtime.Remoting.Proxies.RealProxy::InternalGetTransparentProxy",
4879 ves_icall_Remoting_RealProxy_GetTransparentProxy,
4882 * System.Threading.Interlocked
4884 "System.Threading.Interlocked::Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int,
4885 "System.Threading.Interlocked::Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long,
4886 "System.Threading.Interlocked::Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int,
4887 "System.Threading.Interlocked::Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long,
4888 "System.Threading.Interlocked::CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int,
4889 "System.Threading.Interlocked::CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object,
4890 "System.Threading.Interlocked::CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single,
4891 "System.Threading.Interlocked::Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int,
4892 "System.Threading.Interlocked::Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object,
4893 "System.Threading.Interlocked::Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single,
4894 "System.Threading.Thread::current_lcid()", ves_icall_System_Threading_Thread_current_lcid,
4897 * System.Diagnostics.Process
4899 "System.Diagnostics.Process::GetProcess_internal(int)", ves_icall_System_Diagnostics_Process_GetProcess_internal,
4900 "System.Diagnostics.Process::GetProcesses_internal()", ves_icall_System_Diagnostics_Process_GetProcesses_internal,
4901 "System.Diagnostics.Process::GetPid_internal()", ves_icall_System_Diagnostics_Process_GetPid_internal,
4902 "System.Diagnostics.Process::Process_free_internal(intptr)", ves_icall_System_Diagnostics_Process_Process_free_internal,
4903 "System.Diagnostics.Process::GetModules_internal()", ves_icall_System_Diagnostics_Process_GetModules_internal,
4904 "System.Diagnostics.Process::Start_internal(string,string,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo&)", ves_icall_System_Diagnostics_Process_Start_internal,
4905 "System.Diagnostics.Process::WaitForExit_internal(intptr,int)", ves_icall_System_Diagnostics_Process_WaitForExit_internal,
4906 "System.Diagnostics.Process::ExitTime_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitTime_internal,
4907 "System.Diagnostics.Process::StartTime_internal(intptr)", ves_icall_System_Diagnostics_Process_StartTime_internal,
4908 "System.Diagnostics.Process::ExitCode_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitCode_internal,
4909 "System.Diagnostics.Process::ProcessName_internal(intptr)", ves_icall_System_Diagnostics_Process_ProcessName_internal,
4910 "System.Diagnostics.Process::GetWorkingSet_internal(intptr,int&,int&)", ves_icall_System_Diagnostics_Process_GetWorkingSet_internal,
4911 "System.Diagnostics.Process::SetWorkingSet_internal(intptr,int,int,bool)", ves_icall_System_Diagnostics_Process_SetWorkingSet_internal,
4912 "System.Diagnostics.FileVersionInfo::GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal,
4917 "System.Delegate::CreateDelegate_internal", ves_icall_System_Delegate_CreateDelegate_internal,
4922 "System.IO.Path::get_temp_path", ves_icall_System_IO_get_temp_path,
4925 * Private icalls for the Mono Debugger
4927 "System.Reflection.Assembly::MonoDebugger_GetMethod",
4928 ves_icall_MonoDebugger_GetMethod,
4930 "System.Reflection.Assembly::MonoDebugger_GetMethodToken",
4931 ves_icall_MonoDebugger_GetMethodToken,
4933 "System.Reflection.Assembly::MonoDebugger_GetLocalTypeFromSignature",
4934 ves_icall_MonoDebugger_GetLocalTypeFromSignature,
4936 "System.Reflection.Assembly::MonoDebugger_GetType",
4937 ves_icall_MonoDebugger_GetType,
4940 * System.Configuration
4942 "System.Configuration.DefaultConfig::get_machine_config_path",
4943 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
4946 * System.Diagnostics.DefaultTraceListener
4948 "System.Diagnostics.DefaultTraceListener::WriteWindowsDebugString",
4949 ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString,
4953 "System.Activator::CreateInstanceInternal",
4954 ves_icall_System_Activator_CreateInstanceInternal,
4959 "System.Web.Util.ICalls::GetMachineConfigPath",
4960 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
4962 "System.Web.Util.ICalls::GetMachineInstallDirectory",
4963 ves_icall_System_Web_Util_ICalls_get_machine_install_dir,
4966 * System.Globalization
4968 "System.Globalization.CultureInfo::construct_internal_locale(string)", ves_icall_System_Globalization_CultureInfo_construct_internal_locale,
4969 "System.Globalization.CompareInfo::construct_compareinfo(string)", ves_icall_System_Globalization_CompareInfo_construct_compareinfo,
4970 "System.Globalization.CompareInfo::internal_compare(string,string,System.Globalization.CompareOptions)", ves_icall_System_Globalization_CompareInfo_internal_compare,
4971 "System.Globalization.CompareInfo::free_internal_collator()", ves_icall_System_Globalization_CompareInfo_free_internal_collator,
4972 "System.Globalization.CompareInfo::assign_sortkey(object,string,System.Globalization.CompareOptions)", ves_icall_System_Globalization_CompareInfo_assign_sortkey,
4973 "System.Globalization.CompareInfo::internal_index(string,int,int,string,System.Globalization.CompareOptions,bool)", ves_icall_System_Globalization_CompareInfo_internal_index,
4974 "System.String::InternalReplace(string,string,System.Globalization.CompareInfo)", ves_icall_System_String_InternalReplace_Str_Comp,
4975 "System.String::InternalToLower(System.Globalization.CultureInfo)", ves_icall_System_String_InternalToLower_Comp,
4976 "System.String::InternalToUpper(System.Globalization.CultureInfo)", ves_icall_System_String_InternalToUpper_Comp,
4979 * add other internal calls here
4982 /* These will be deleted after the next release */
4983 "System.String::InternalEquals", ves_icall_System_String_InternalEquals,
4984 "System.String::InternalIndexOf(char,int,int)", ves_icall_System_String_InternalIndexOf_Char,
4985 "System.String::InternalIndexOf(string,int,int)", ves_icall_System_String_InternalIndexOf_Str,
4986 "System.String::InternalLastIndexOf(char,int,int)", ves_icall_System_String_InternalLastIndexOf_Char,
4987 "System.String::InternalLastIndexOf(string,int,int)", ves_icall_System_String_InternalLastIndexOf_Str,
4988 "System.String::InternalCompare(string,int,string,int,int,int)", ves_icall_System_String_InternalCompareStr_N,
4989 "System.String::InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str,
4990 "System.String::InternalToLower()", ves_icall_System_String_InternalToLower,
4991 "System.String::InternalToUpper()", ves_icall_System_String_InternalToUpper,
4992 "System.Globalization.CultureInfo::construct_compareinfo(object,string)", ves_icall_System_Globalization_CompareInfo_construct_compareinfo,
4998 mono_init_icall (void)
5003 while ((name = icall_map [i])) {
5004 mono_add_internal_call (name, icall_map [i+1]);