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/metadata/filewatcher.h>
46 #include <mono/io-layer/io-layer.h>
47 #include <mono/utils/strtod.h>
48 #include <mono/utils/monobitset.h>
50 #if defined (PLATFORM_WIN32)
55 static MonoReflectionAssembly* ves_icall_System_Reflection_Assembly_GetCallingAssembly (void);
59 * We expect a pointer to a char, not a string
62 mono_double_ParseImpl (char *ptr)
70 result = bsd_strtod (ptr, &endptr);
72 if (!*ptr || (endptr && *endptr))
73 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib,
81 ves_icall_System_Double_AssertEndianity (double *value)
85 MONO_DOUBLE_ASSERT_ENDIANITY (value);
89 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
98 ao = (MonoArray *)this;
99 ac = (MonoClass *)ao->obj.vtable->klass;
101 esize = mono_array_element_size (ac);
102 ea = (gpointer*)((char*)ao->vector + (pos * esize));
104 if (ac->element_class->valuetype)
105 return mono_value_box (this->vtable->domain, ac->element_class, ea);
111 ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
119 MONO_CHECK_ARG_NULL (idxs);
121 io = (MonoArray *)idxs;
122 ic = (MonoClass *)io->obj.vtable->klass;
124 ao = (MonoArray *)this;
125 ac = (MonoClass *)ao->obj.vtable->klass;
127 g_assert (ic->rank == 1);
128 if (io->bounds != NULL || io->max_length != ac->rank)
129 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
131 ind = (guint32 *)io->vector;
133 if (ao->bounds == NULL) {
134 if (*ind < 0 || *ind >= ao->max_length)
135 mono_raise_exception (mono_get_exception_index_out_of_range ());
137 return ves_icall_System_Array_GetValueImpl (this, *ind);
140 for (i = 0; i < ac->rank; i++)
141 if ((ind [i] < ao->bounds [i].lower_bound) ||
142 (ind [i] >= ao->bounds [i].length + ao->bounds [i].lower_bound))
143 mono_raise_exception (mono_get_exception_index_out_of_range ());
145 pos = ind [0] - ao->bounds [0].lower_bound;
146 for (i = 1; i < ac->rank; i++)
147 pos = pos*ao->bounds [i].length + ind [i] -
148 ao->bounds [i].lower_bound;
150 return ves_icall_System_Array_GetValueImpl (this, pos);
154 ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
156 MonoClass *ac, *vc, *ec;
167 vc = value->vtable->klass;
171 ac = this->obj.vtable->klass;
172 ec = ac->element_class;
174 esize = mono_array_element_size (ac);
175 ea = (gpointer*)((char*)this->vector + (pos * esize));
176 va = (gpointer*)((char*)value + sizeof (MonoObject));
179 memset (ea, 0, esize);
183 #define NO_WIDENING_CONVERSION G_STMT_START{\
184 mono_raise_exception (mono_get_exception_argument ( \
185 "value", "not a widening conversion")); \
188 #define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
189 if (esize < vsize + (extra)) \
190 mono_raise_exception (mono_get_exception_argument ( \
191 "value", "not a widening conversion")); \
194 #define INVALID_CAST G_STMT_START{\
195 mono_raise_exception (mono_get_exception_invalid_cast ()); \
198 /* Check element (destination) type. */
199 switch (ec->byval_arg.type) {
200 case MONO_TYPE_STRING:
201 switch (vc->byval_arg.type) {
202 case MONO_TYPE_STRING:
208 case MONO_TYPE_BOOLEAN:
209 switch (vc->byval_arg.type) {
210 case MONO_TYPE_BOOLEAN:
223 NO_WIDENING_CONVERSION;
230 if (!ec->valuetype) {
231 if (!mono_object_isinst (value, ec))
233 *ea = (gpointer)value;
237 if (mono_object_isinst (value, ec)) {
238 memcpy (ea, (char *)value + sizeof (MonoObject), esize);
245 vsize = mono_class_instance_size (vc) - sizeof (MonoObject);
248 g_message (G_STRLOC ": %d (%d) <= %d (%d)",
249 ec->byval_arg.type, esize,
250 vc->byval_arg.type, vsize);
253 #define ASSIGN_UNSIGNED(etype) G_STMT_START{\
254 switch (vc->byval_arg.type) { \
259 case MONO_TYPE_CHAR: \
260 CHECK_WIDENING_CONVERSION(0); \
261 *(etype *) ea = (etype) u64; \
263 /* You can't assign a signed value to an unsigned array. */ \
268 /* You can't assign a floating point number to an integer array. */ \
271 NO_WIDENING_CONVERSION; \
275 #define ASSIGN_SIGNED(etype) G_STMT_START{\
276 switch (vc->byval_arg.type) { \
281 CHECK_WIDENING_CONVERSION(0); \
282 *(etype *) ea = (etype) i64; \
284 /* You can assign an unsigned value to a signed array if the array's */ \
285 /* element size is larger than the value size. */ \
290 case MONO_TYPE_CHAR: \
291 CHECK_WIDENING_CONVERSION(1); \
292 *(etype *) ea = (etype) u64; \
294 /* You can't assign a floating point number to an integer array. */ \
297 NO_WIDENING_CONVERSION; \
301 #define ASSIGN_REAL(etype) G_STMT_START{\
302 switch (vc->byval_arg.type) { \
305 CHECK_WIDENING_CONVERSION(0); \
306 *(etype *) ea = (etype) r64; \
308 /* All integer values fit into a floating point array, so we don't */ \
309 /* need to CHECK_WIDENING_CONVERSION here. */ \
314 *(etype *) ea = (etype) i64; \
320 case MONO_TYPE_CHAR: \
321 *(etype *) ea = (etype) u64; \
326 switch (vc->byval_arg.type) {
328 u64 = *(guint8 *) va;
331 u64 = *(guint16 *) va;
334 u64 = *(guint32 *) va;
337 u64 = *(guint64 *) va;
343 i64 = *(gint16 *) va;
346 i64 = *(gint32 *) va;
349 i64 = *(gint64 *) va;
352 r64 = *(gfloat *) va;
355 r64 = *(gdouble *) va;
358 u64 = *(guint16 *) va;
360 case MONO_TYPE_BOOLEAN:
361 /* Boolean is only compatible with itself. */
362 switch (ec->byval_arg.type) {
374 NO_WIDENING_CONVERSION;
381 /* If we can't do a direct copy, let's try a widening conversion. */
382 switch (ec->byval_arg.type) {
384 ASSIGN_UNSIGNED (guint16);
386 ASSIGN_UNSIGNED (guint8);
388 ASSIGN_UNSIGNED (guint16);
390 ASSIGN_UNSIGNED (guint32);
392 ASSIGN_UNSIGNED (guint64);
394 ASSIGN_SIGNED (gint8);
396 ASSIGN_SIGNED (gint16);
398 ASSIGN_SIGNED (gint32);
400 ASSIGN_SIGNED (gint64);
402 ASSIGN_REAL (gfloat);
404 ASSIGN_REAL (gdouble);
408 /* Not reached, INVALID_CAST does not return. Just to avoid a compiler warning ... */
412 #undef NO_WIDENING_CONVERSION
413 #undef CHECK_WIDENING_CONVERSION
414 #undef ASSIGN_UNSIGNED
420 ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
428 MONO_CHECK_ARG_NULL (idxs);
430 ic = idxs->obj.vtable->klass;
431 ac = this->obj.vtable->klass;
433 g_assert (ic->rank == 1);
434 if (idxs->bounds != NULL || idxs->max_length != ac->rank)
435 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
437 ind = (guint32 *)idxs->vector;
439 if (this->bounds == NULL) {
440 if (*ind < 0 || *ind >= this->max_length)
441 mono_raise_exception (mono_get_exception_index_out_of_range ());
443 ves_icall_System_Array_SetValueImpl (this, value, *ind);
447 for (i = 0; i < ac->rank; i++)
448 if ((ind [i] < this->bounds [i].lower_bound) ||
449 (ind [i] >= this->bounds [i].length + this->bounds [i].lower_bound))
450 mono_raise_exception (mono_get_exception_index_out_of_range ());
452 pos = ind [0] - this->bounds [0].lower_bound;
453 for (i = 1; i < ac->rank; i++)
454 pos = pos * this->bounds [i].length + ind [i] -
455 this->bounds [i].lower_bound;
457 ves_icall_System_Array_SetValueImpl (this, value, pos);
461 ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
466 gboolean bounded = FALSE;
470 MONO_CHECK_ARG_NULL (type);
471 MONO_CHECK_ARG_NULL (lengths);
473 MONO_CHECK_ARG (lengths, mono_array_length (lengths) > 0);
475 MONO_CHECK_ARG (bounds, mono_array_length (lengths) == mono_array_length (bounds));
477 for (i = 0; i < mono_array_length (lengths); i++)
478 if (mono_array_get (lengths, gint32, i) < 0)
479 mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
481 if (bounds && (mono_array_length (bounds) == 1) && (mono_array_get (bounds, gint32, 0) != 0))
482 /* vectors are not the same as one dimensional arrays with no-zero bounds */
487 aklass = mono_bounded_array_class_get (mono_class_from_mono_type (type->type), mono_array_length (lengths), bounded);
489 sizes = alloca (aklass->rank * sizeof(guint32) * 2);
490 for (i = 0; i < aklass->rank; ++i) {
491 sizes [i] = mono_array_get (lengths, gint32, i);
493 sizes [i + aklass->rank] = mono_array_get (bounds, gint32, i);
495 sizes [i + aklass->rank] = 0;
498 array = mono_array_new_full (mono_object_domain (type), aklass, sizes, sizes + aklass->rank);
504 ves_icall_System_Array_GetRank (MonoObject *this)
508 return this->vtable->klass->rank;
512 ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
514 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
518 if ((dimension < 0) || (dimension >= rank))
519 mono_raise_exception (mono_get_exception_index_out_of_range ());
521 if (this->bounds == NULL)
522 return this->max_length;
524 return this->bounds [dimension].length;
528 ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
530 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
534 if ((dimension < 0) || (dimension >= rank))
535 mono_raise_exception (mono_get_exception_index_out_of_range ());
537 if (this->bounds == NULL)
540 return this->bounds [dimension].lower_bound;
544 ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
549 MonoClass *src_class;
550 MonoClass *dest_class;
555 if (source->obj.vtable->klass->rank != dest->obj.vtable->klass->rank)
558 if (source->bounds || dest->bounds)
561 if ((dest_idx + length > mono_array_length (dest)) ||
562 (source_idx + length > mono_array_length (source)))
565 element_size = mono_array_element_size (source->obj.vtable->klass);
566 dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
567 source_addr = mono_array_addr_with_size (source, element_size, source_idx);
569 src_class = source->obj.vtable->klass->element_class;
570 dest_class = dest->obj.vtable->klass->element_class;
573 * Handle common cases.
576 /* Case1: object[] -> valuetype[] (ArrayList::ToArray) */
577 if (src_class == mono_defaults.object_class && dest_class->valuetype) {
578 for (i = source_idx; i < source_idx + length; ++i) {
579 MonoObject *elem = mono_array_get (source, MonoObject*, i);
580 if (elem && !mono_object_isinst (elem, dest_class))
584 element_size = mono_array_element_size (dest->obj.vtable->klass);
585 for (i = 0; i < length; ++i) {
586 MonoObject *elem = mono_array_get (source, MonoObject*, source_idx + i);
587 void *addr = mono_array_addr_with_size (dest, element_size, dest_idx + i);
589 memset (addr, 0, element_size);
591 memcpy (addr, (char *)elem + sizeof (MonoObject), element_size);
596 if (src_class != dest_class) {
597 if (dest_class->valuetype || dest_class->enumtype || src_class->valuetype || src_class->enumtype)
600 if (mono_class_is_subclass_of (src_class, dest_class, FALSE))
602 /* Case2: object[] -> reftype[] (ArrayList::ToArray) */
603 else if (mono_class_is_subclass_of (dest_class, src_class, FALSE))
604 for (i = source_idx; i < source_idx + length; ++i) {
605 MonoObject *elem = mono_array_get (source, MonoObject*, i);
606 if (elem && !mono_object_isinst (elem, dest_class))
613 memmove (dest_addr, source_addr, element_size * length);
619 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoArray *array, MonoClassField *field_handle)
621 MonoClass *klass = array->obj.vtable->klass;
622 guint32 size = mono_array_element_size (klass);
627 if (array->bounds == NULL)
628 size *= array->max_length;
630 for (i = 0; i < klass->rank; ++i)
631 size *= array->bounds [i].length;
633 memcpy (mono_array_addr (array, char, 0), field_handle->data, size);
635 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
639 guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
641 for (i = 0; i < size; i += n/8, data++) { \
642 tmp = read ## n (data); \
647 /* printf ("Initialize array with elements of %s type\n", klass->element_class->name); */
649 switch (klass->element_class->byval_arg.type) {
669 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void)
673 return offsetof (MonoString, chars);
677 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue (MonoObject *obj)
681 if ((obj == NULL) || (! (obj->vtable->klass->valuetype)))
684 return mono_object_clone (obj);
688 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (MonoType *handle)
694 MONO_CHECK_ARG_NULL (handle);
696 klass = mono_class_from_mono_type (handle);
697 MONO_CHECK_ARG (handle, klass);
699 /* This will call the type constructor */
700 if (! (klass->flags & TYPE_ATTRIBUTE_INTERFACE))
701 mono_runtime_class_init (mono_class_vtable (mono_domain_get (), klass));
705 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
709 return mono_object_clone (this);
713 #define MONO_OBJECT_ALIGNMENT_SHIFT 3
715 #define MONO_OBJECT_ALIGNMENT_SHIFT 2
719 * Return hashcode based on object address. This function will need to be
720 * smarter in the presence of a moving garbage collector, which will cache
721 * the address hash before relocating the object.
723 * Wang's address-based hash function:
724 * http://www.concentric.net/~Ttwang/tech/addrhash.htm
727 ves_icall_System_Object_GetHashCode (MonoObject *this)
729 register guint32 key;
733 key = (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
735 return key & 0x7fffffff;
739 ves_icall_System_ValueType_InternalGetHashCode (MonoObject *this, MonoArray **fields)
743 MonoObject **values = NULL;
750 klass = this->vtable->klass;
752 if (klass->field.count == 0)
753 return ves_icall_System_Object_GetHashCode (this);
756 * Compute the starting value of the hashcode for fields of primitive
757 * types, and return the remaining fields in an array to the managed side.
758 * This way, we can avoid costly reflection operations in managed code.
760 for (i = 0; i < klass->field.count; ++i) {
761 MonoClassField *field = &klass->fields [i];
762 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
764 if (mono_field_is_deleted (field))
766 /* FIXME: Add more types */
767 switch (field->type->type) {
769 result ^= *(gint32*)((guint8*)this + field->offset);
771 case MONO_TYPE_STRING: {
773 s = *(MonoString**)((guint8*)this + field->offset);
775 result ^= ves_icall_System_String_GetHashCode (s);
780 values = alloca (klass->field.count * sizeof (MonoObject*));
781 o = mono_field_get_value_object (mono_object_domain (this), field, this);
782 values [count++] = o;
787 *fields = mono_array_new (mono_domain_get (), mono_defaults.object_class, count);
788 memcpy (mono_array_addr (*fields, MonoObject*, 0), values, count * sizeof (MonoObject*));
796 ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that, MonoArray **fields)
800 MonoObject **values = NULL;
806 MONO_CHECK_ARG_NULL (that);
808 if (this->vtable != that->vtable)
811 klass = this->vtable->klass;
814 * Do the comparison for fields of primitive type and return a result if
815 * possible. Otherwise, return the remaining fields in an array to the
816 * managed side. This way, we can avoid costly reflection operations in
820 for (i = 0; i < klass->field.count; ++i) {
821 MonoClassField *field = &klass->fields [i];
822 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC)
824 if (mono_field_is_deleted (field))
826 /* FIXME: Add more types */
827 switch (field->type->type) {
829 if (*(gint32*)((guint8*)this + field->offset) != *(gint32*)((guint8*)that + field->offset))
832 case MONO_TYPE_STRING: {
834 guint32 s1len, s2len;
835 s1 = *(MonoString**)((guint8*)this + field->offset);
836 s2 = *(MonoString**)((guint8*)that + field->offset);
839 if ((s1 == NULL) || (s2 == NULL))
841 s1len = mono_string_length (s1);
842 s2len = mono_string_length (s2);
846 if (memcmp (mono_string_chars (s1), mono_string_chars (s2), s1len * sizeof (gunichar2)) != 0)
852 values = alloca (klass->field.count * 2 * sizeof (MonoObject*));
853 o = mono_field_get_value_object (mono_object_domain (this), field, this);
854 values [count++] = o;
855 o = mono_field_get_value_object (mono_object_domain (this), field, that);
856 values [count++] = o;
861 *fields = mono_array_new (mono_domain_get (), mono_defaults.object_class, count);
862 memcpy (mono_array_addr (*fields, MonoObject*, 0), values, count * sizeof (MonoObject*));
870 static MonoReflectionType *
871 ves_icall_System_Object_GetType (MonoObject *obj)
875 return mono_type_get_object (mono_object_domain (obj), &obj->vtable->klass->byval_arg);
879 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
883 mtype->type = &obj->vtable->klass->byval_arg;
884 g_assert (mtype->type->type);
888 ves_icall_ModuleBuilder_getToken (MonoReflectionModuleBuilder *mb, MonoObject *obj)
892 return mono_image_create_token (mb->dynamic_image, obj);
896 ves_icall_ModuleBuilder_getDataChunk (MonoReflectionModuleBuilder *mb, MonoArray *buf, gint32 offset)
899 MonoDynamicImage *image = mb->dynamic_image;
900 char *p = mono_array_addr (buf, char, 0);
904 mono_image_create_pefile (mb);
906 if (offset >= image->pefile.index)
908 count = mono_array_length (buf);
909 count = MIN (count, image->pefile.index - offset);
911 memcpy (p, image->pefile.data + offset, count);
917 ves_icall_ModuleBuilder_build_metadata (MonoReflectionModuleBuilder *mb)
921 mono_image_build_metadata (mb);
924 static MonoReflectionType*
925 ves_icall_type_from_name (MonoString *name,
926 MonoBoolean throwOnError,
927 MonoBoolean ignoreCase)
930 MonoType *type = NULL;
931 MonoAssembly *assembly;
932 MonoTypeNameParse info;
936 str = mono_string_to_utf8 (name);
937 if (!mono_reflection_parse_type (str, &info)) {
939 g_list_free (info.modifiers);
940 g_list_free (info.nested);
941 if (throwOnError) /* uhm: this is a parse error, though... */
942 mono_raise_exception (mono_get_exception_type_load (name));
947 if (info.assembly.name) {
948 assembly = mono_assembly_load (&info.assembly, NULL, NULL);
950 MonoReflectionAssembly *refass;
952 refass = ves_icall_System_Reflection_Assembly_GetCallingAssembly ();
953 assembly = refass->assembly;
957 type = mono_reflection_get_type (assembly->image, &info, ignoreCase);
959 if (!info.assembly.name && !type) /* try mscorlib */
960 type = mono_reflection_get_type (NULL, &info, ignoreCase);
963 g_list_free (info.modifiers);
964 g_list_free (info.nested);
967 mono_raise_exception (mono_get_exception_type_load (name));
972 return mono_type_get_object (mono_domain_get (), type);
975 static MonoReflectionType*
976 ves_icall_type_from_handle (MonoType *handle)
978 MonoDomain *domain = mono_domain_get ();
979 MonoClass *klass = mono_class_from_mono_type (handle);
983 mono_class_init (klass);
984 return mono_type_get_object (domain, handle);
988 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
992 if (type->type && c->type)
993 return mono_metadata_type_equal (type->type, c->type);
994 g_print ("type equals\n");
998 /* System.TypeCode */
1017 TYPECODE_STRING = 18
1021 ves_icall_type_GetTypeCode (MonoReflectionType *type)
1023 int t = type->type->type;
1025 MONO_ARCH_SAVE_REGS;
1029 case MONO_TYPE_VOID:
1030 return TYPECODE_OBJECT;
1031 case MONO_TYPE_BOOLEAN:
1032 return TYPECODE_BOOLEAN;
1034 return TYPECODE_BYTE;
1036 return TYPECODE_SBYTE;
1038 return TYPECODE_UINT16;
1040 return TYPECODE_INT16;
1041 case MONO_TYPE_CHAR:
1042 return TYPECODE_CHAR;
1046 return TYPECODE_OBJECT;
1048 return TYPECODE_UINT32;
1050 return TYPECODE_INT32;
1052 return TYPECODE_UINT64;
1054 return TYPECODE_INT64;
1056 return TYPECODE_SINGLE;
1058 return TYPECODE_DOUBLE;
1059 case MONO_TYPE_VALUETYPE:
1060 if (type->type->data.klass->enumtype) {
1061 t = type->type->data.klass->enum_basetype->type;
1064 MonoClass *k = type->type->data.klass;
1065 if (strcmp (k->name_space, "System") == 0) {
1066 if (strcmp (k->name, "Decimal") == 0)
1067 return TYPECODE_DECIMAL;
1068 else if (strcmp (k->name, "DateTime") == 0)
1069 return TYPECODE_DATETIME;
1072 return TYPECODE_OBJECT;
1073 case MONO_TYPE_STRING:
1074 return TYPECODE_STRING;
1075 case MONO_TYPE_SZARRAY:
1076 case MONO_TYPE_ARRAY:
1077 case MONO_TYPE_OBJECT:
1079 case MONO_TYPE_MVAR:
1080 return TYPECODE_OBJECT;
1081 case MONO_TYPE_CLASS:
1083 MonoClass *k = type->type->data.klass;
1084 if (strcmp (k->name_space, "System") == 0) {
1085 if (strcmp (k->name, "DBNull") == 0)
1086 return TYPECODE_DBNULL;
1089 return TYPECODE_OBJECT;
1091 g_error ("type 0x%02x not handled in GetTypeCode()", t);
1097 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
1103 MONO_ARCH_SAVE_REGS;
1105 g_assert (type != NULL);
1107 domain = ((MonoObject *)type)->vtable->domain;
1109 if (!c) /* FIXME: dont know what do do here */
1112 klass = mono_class_from_mono_type (type->type);
1113 klassc = mono_class_from_mono_type (c->type);
1115 return mono_class_is_subclass_of (klass, klassc, check_interfaces);
1119 ves_icall_type_is_assignable_from (MonoReflectionType *type, MonoReflectionType *c)
1125 MONO_ARCH_SAVE_REGS;
1127 g_assert (type != NULL);
1129 domain = ((MonoObject *)type)->vtable->domain;
1131 klass = mono_class_from_mono_type (type->type);
1132 klassc = mono_class_from_mono_type (c->type);
1134 return mono_class_is_assignable_from (klass, klassc);
1138 ves_icall_type_IsInstanceOfType (MonoReflectionType *type, MonoObject *obj)
1140 MonoClass *klass = mono_class_from_mono_type (type->type);
1141 return mono_object_isinst (obj, klass) != NULL;
1145 ves_icall_get_attributes (MonoReflectionType *type)
1147 MonoClass *klass = mono_class_from_mono_type (type->type);
1149 MONO_ARCH_SAVE_REGS;
1151 return klass->flags;
1154 static MonoReflectionField*
1155 ves_icall_System_Reflection_FieldInfo_internal_from_handle (MonoClassField *handle)
1157 MONO_ARCH_SAVE_REGS;
1161 return mono_field_get_object (mono_domain_get (), handle->parent, handle);
1165 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
1167 MonoDomain *domain = mono_domain_get ();
1169 MONO_ARCH_SAVE_REGS;
1171 info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
1172 info->ret = mono_type_get_object (domain, method->signature->ret);
1173 info->attrs = method->flags;
1174 info->implattrs = method->iflags;
1175 if (method->signature->call_convention == MONO_CALL_DEFAULT)
1178 if (method->signature->call_convention == MONO_CALL_VARARG)
1182 info->callconv |= (method->signature->hasthis << 5) | (method->signature->explicit_this << 6);
1186 ves_icall_get_parameter_info (MonoMethod *method)
1188 MonoDomain *domain = mono_domain_get ();
1190 MONO_ARCH_SAVE_REGS;
1192 return mono_param_get_objects (domain, method);
1195 static MonoReflectionType*
1196 ves_icall_MonoField_GetParentType (MonoReflectionField *field, MonoBoolean declaring)
1199 MONO_ARCH_SAVE_REGS;
1201 parent = declaring? field->field->parent: field->klass;
1203 return mono_type_get_object (mono_object_domain (field), &parent->byval_arg);
1207 ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *obj)
1210 MonoClassField *cf = field->field;
1213 MonoDomain *domain = mono_object_domain (field);
1215 gboolean is_static = FALSE;
1216 gboolean is_ref = FALSE;
1218 MONO_ARCH_SAVE_REGS;
1220 mono_class_init (field->klass);
1222 switch (cf->type->type) {
1223 case MONO_TYPE_STRING:
1224 case MONO_TYPE_OBJECT:
1225 case MONO_TYPE_CLASS:
1226 case MONO_TYPE_ARRAY:
1227 case MONO_TYPE_SZARRAY:
1232 case MONO_TYPE_BOOLEAN:
1235 case MONO_TYPE_CHAR:
1244 case MONO_TYPE_VALUETYPE:
1245 is_ref = cf->type->byref;
1248 g_error ("type 0x%x not handled in "
1249 "ves_icall_Monofield_GetValue", cf->type->type);
1254 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1256 vtable = mono_class_vtable (domain, field->klass);
1257 if (!vtable->initialized && !(cf->type->attrs & FIELD_ATTRIBUTE_LITERAL))
1258 mono_runtime_class_init (vtable);
1263 mono_field_static_get_value (vtable, cf, &o);
1265 mono_field_get_value (obj, cf, &o);
1270 /* boxed value type */
1271 klass = mono_class_from_mono_type (cf->type);
1272 o = mono_object_new (domain, klass);
1273 v = ((gchar *) o) + sizeof (MonoObject);
1275 mono_field_static_get_value (vtable, cf, v);
1277 mono_field_get_value (obj, cf, v);
1284 ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *obj, MonoObject *value)
1286 MonoClassField *cf = field->field;
1289 MONO_ARCH_SAVE_REGS;
1291 v = (gchar *) value;
1292 if (!cf->type->byref) {
1293 switch (cf->type->type) {
1296 case MONO_TYPE_BOOLEAN:
1299 case MONO_TYPE_CHAR:
1308 case MONO_TYPE_VALUETYPE:
1309 v += sizeof (MonoObject);
1311 case MONO_TYPE_STRING:
1312 case MONO_TYPE_OBJECT:
1313 case MONO_TYPE_CLASS:
1314 case MONO_TYPE_ARRAY:
1315 case MONO_TYPE_SZARRAY:
1319 g_error ("type 0x%x not handled in "
1320 "ves_icall_FieldInfo_SetValueInternal", cf->type->type);
1325 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1326 MonoVTable *vtable = mono_class_vtable (mono_object_domain (field), field->klass);
1327 if (!vtable->initialized)
1328 mono_runtime_class_init (vtable);
1329 mono_field_static_set_value (vtable, cf, v);
1331 mono_field_set_value (obj, cf, v);
1335 /* From MonoProperty.cs */
1337 PInfo_Attributes = 1,
1338 PInfo_GetMethod = 1 << 1,
1339 PInfo_SetMethod = 1 << 2,
1340 PInfo_ReflectedType = 1 << 3,
1341 PInfo_DeclaringType = 1 << 4,
1346 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info, PInfo req_info)
1348 MonoDomain *domain = mono_object_domain (property);
1350 MONO_ARCH_SAVE_REGS;
1352 if ((req_info & PInfo_ReflectedType) != 0 || (req_info & PInfo_DeclaringType) != 0)
1353 info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
1355 if ((req_info & PInfo_Name) != 0)
1356 info->name = mono_string_new (domain, property->property->name);
1358 if ((req_info & PInfo_Attributes) != 0)
1359 info->attrs = property->property->attrs;
1361 if ((req_info & PInfo_GetMethod) != 0)
1362 info->get = property->property->get ?
1363 mono_method_get_object (domain, property->property->get, NULL): NULL;
1365 if ((req_info & PInfo_SetMethod) != 0)
1366 info->set = property->property->set ?
1367 mono_method_get_object (domain, property->property->set, NULL): NULL;
1369 * There may be other methods defined for properties, though, it seems they are not exposed
1370 * in the reflection API
1375 ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
1377 MonoDomain *domain = mono_object_domain (event);
1379 MONO_ARCH_SAVE_REGS;
1381 info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
1382 info->name = mono_string_new (domain, event->event->name);
1383 info->attrs = event->event->attrs;
1384 info->add_method = event->event->add ? mono_method_get_object (domain, event->event->add, NULL): NULL;
1385 info->remove_method = event->event->remove ? mono_method_get_object (domain, event->event->remove, NULL): NULL;
1386 info->raise_method = event->event->raise ? mono_method_get_object (domain, event->event->raise, NULL): NULL;
1390 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
1392 MonoDomain *domain = mono_object_domain (type);
1395 MonoClass *class = mono_class_from_mono_type (type->type);
1397 MonoBitSet *slots = mono_bitset_new (class->max_interface_id + 1, 0);
1399 MONO_ARCH_SAVE_REGS;
1402 /* GetInterfaces() returns an empty array in MS.NET (this may be a bug) */
1403 mono_bitset_free (slots);
1404 return mono_array_new (domain, mono_defaults.monotype_class, 0);
1408 for (parent = class; parent; parent = parent->parent) {
1409 for (i = 0; i < parent->interface_count; ++i) {
1410 if (mono_bitset_test (slots, parent->interfaces [i]->interface_id))
1413 mono_bitset_set (slots, parent->interfaces [i]->interface_id);
1418 intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
1420 for (parent = class; parent; parent = parent->parent) {
1421 for (i = 0; i < parent->interface_count; ++i) {
1422 if (!mono_bitset_test (slots, parent->interfaces [i]->interface_id))
1425 mono_bitset_clear (slots, parent->interfaces [i]->interface_id);
1426 mono_array_set (intf, gpointer, ninterf,
1427 mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
1432 mono_bitset_free (slots);
1437 ves_icall_Type_GetInterfaceMapData (MonoReflectionType *type, MonoReflectionType *iface, MonoArray **targets, MonoArray **methods)
1439 MonoClass *class = mono_class_from_mono_type (type->type);
1440 MonoClass *iclass = mono_class_from_mono_type (iface->type);
1441 MonoReflectionMethod *member;
1442 int i, len, ioffset;
1445 MONO_ARCH_SAVE_REGS;
1447 /* type doesn't implement iface: the exception is thrown in managed code */
1448 if ((iclass->interface_id > class->max_interface_id) || !class->interface_offsets [iclass->interface_id])
1451 len = iclass->method.count;
1452 ioffset = class->interface_offsets [iclass->interface_id];
1453 domain = mono_object_domain (type);
1454 *targets = mono_array_new (domain, mono_defaults.method_info_class, len);
1455 *methods = mono_array_new (domain, mono_defaults.method_info_class, len);
1456 for (i = 0; i < len; ++i) {
1457 member = mono_method_get_object (domain, iclass->methods [i], iclass);
1458 mono_array_set (*methods, gpointer, i, member);
1459 member = mono_method_get_object (domain, class->vtable [i + ioffset], class);
1460 mono_array_set (*targets, gpointer, i, member);
1464 static MonoReflectionType*
1465 ves_icall_MonoType_GetElementType (MonoReflectionType *type)
1467 MonoClass *class = mono_class_from_mono_type (type->type);
1469 MONO_ARCH_SAVE_REGS;
1471 if (type->type->byref)
1472 return mono_type_get_object (mono_object_domain (type), &class->byval_arg);
1473 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1474 return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
1475 else if (class->element_class)
1476 return mono_type_get_object (mono_object_domain (type), &class->element_class->byval_arg);
1481 static MonoReflectionType*
1482 ves_icall_get_type_parent (MonoReflectionType *type)
1484 MonoClass *class = mono_class_from_mono_type (type->type);
1486 MONO_ARCH_SAVE_REGS;
1488 return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
1492 ves_icall_type_ispointer (MonoReflectionType *type)
1494 MONO_ARCH_SAVE_REGS;
1496 return type->type->type == MONO_TYPE_PTR;
1500 ves_icall_type_isprimitive (MonoReflectionType *type)
1502 MONO_ARCH_SAVE_REGS;
1504 return (!type->type->byref && (type->type->type >= MONO_TYPE_BOOLEAN) && (type->type->type <= MONO_TYPE_R8));
1508 ves_icall_type_isbyref (MonoReflectionType *type)
1510 MONO_ARCH_SAVE_REGS;
1512 return type->type->byref;
1515 static MonoReflectionModule*
1516 ves_icall_MonoType_get_Module (MonoReflectionType *type)
1518 MonoClass *class = mono_class_from_mono_type (type->type);
1520 MONO_ARCH_SAVE_REGS;
1522 return mono_module_get_object (mono_object_domain (type), class->image);
1525 static MonoReflectionAssembly*
1526 ves_icall_MonoType_get_Assembly (MonoReflectionType *type)
1528 MonoDomain *domain = mono_domain_get ();
1529 MonoClass *class = mono_class_from_mono_type (type->type);
1531 MONO_ARCH_SAVE_REGS;
1533 return mono_assembly_get_object (domain, class->image->assembly);
1536 static MonoReflectionType*
1537 ves_icall_MonoType_get_DeclaringType (MonoReflectionType *type)
1539 MonoDomain *domain = mono_domain_get ();
1540 MonoClass *class = mono_class_from_mono_type (type->type);
1542 MONO_ARCH_SAVE_REGS;
1544 return class->nested_in ? mono_type_get_object (domain, &class->nested_in->byval_arg) : NULL;
1547 static MonoReflectionType*
1548 ves_icall_MonoType_get_UnderlyingSystemType (MonoReflectionType *type)
1550 MonoDomain *domain = mono_domain_get ();
1551 MonoClass *class = mono_class_from_mono_type (type->type);
1553 MONO_ARCH_SAVE_REGS;
1555 if (class->enumtype && class->enum_basetype) /* types that are modified typebuilders may not have enum_basetype set */
1556 return mono_type_get_object (domain, class->enum_basetype);
1557 else if (class->element_class)
1558 return mono_type_get_object (domain, &class->element_class->byval_arg);
1564 ves_icall_MonoType_get_Name (MonoReflectionType *type)
1566 MonoDomain *domain = mono_domain_get ();
1567 MonoClass *class = mono_class_from_mono_type (type->type);
1569 MONO_ARCH_SAVE_REGS;
1571 return mono_string_new (domain, class->name);
1575 ves_icall_MonoType_get_Namespace (MonoReflectionType *type)
1577 MonoDomain *domain = mono_domain_get ();
1578 MonoClass *class = mono_class_from_mono_type (type->type);
1580 MONO_ARCH_SAVE_REGS;
1582 while (class->nested_in)
1583 class = class->nested_in;
1585 return mono_string_new (domain, class->name_space);
1589 ves_icall_MonoType_GetArrayRank (MonoReflectionType *type)
1591 MonoClass *class = mono_class_from_mono_type (type->type);
1593 MONO_ARCH_SAVE_REGS;
1599 ves_icall_Type_GetGenericArguments (MonoReflectionType *type)
1602 MonoClass *klass, *pklass;
1604 MONO_ARCH_SAVE_REGS;
1606 klass = mono_class_from_mono_type (type->type);
1608 if (type->type->byref) {
1609 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, 0);
1610 } else if (klass->gen_params) {
1611 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, klass->num_gen_params);
1612 for (i = 0; i < klass->num_gen_params; ++i) {
1613 pklass = mono_class_from_generic_parameter (&klass->gen_params [i], klass->image, FALSE);
1614 mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (type), &pklass->byval_arg));
1616 } else if (klass->generic_inst) {
1617 MonoGenericInst *inst = klass->generic_inst->data.generic_inst;
1618 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, inst->type_argc);
1619 for (i = 0; i < inst->type_argc; ++i) {
1620 mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (type), inst->type_argv [i]));
1623 res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, 0);
1629 ves_icall_Type_get_IsGenericTypeDefinition (MonoReflectionType *type)
1632 MONO_ARCH_SAVE_REGS;
1634 if (type->type->byref)
1636 klass = mono_class_from_mono_type (type->type);
1638 return klass->gen_params != NULL;
1641 static MonoReflectionType*
1642 ves_icall_Type_GetGenericTypeDefinition_impl (MonoReflectionType *type)
1645 MONO_ARCH_SAVE_REGS;
1647 if (type->type->byref)
1649 klass = mono_class_from_mono_type (type->type);
1650 if (klass->gen_params) {
1651 return type; /* check this one */
1653 if (klass->generic_inst) {
1654 MonoType *generic_type = klass->generic_inst->data.generic_inst->generic_type;
1655 MonoClass *generic_class = mono_class_from_mono_type (generic_type);
1657 if (generic_class->wastypebuilder && generic_class->reflection_info)
1658 return generic_class->reflection_info;
1660 return mono_type_get_object (mono_object_domain (type), generic_type);
1665 static MonoReflectionGenericInst*
1666 ves_icall_Type_BindGenericParameters (MonoReflectionType *type, MonoArray *types)
1668 MONO_ARCH_SAVE_REGS;
1670 if (type->type->byref)
1673 return mono_reflection_bind_generic_parameters (type, types);
1677 ves_icall_Type_get_IsGenericInstance (MonoReflectionType *type)
1680 MONO_ARCH_SAVE_REGS;
1682 if (type->type->byref)
1684 klass = mono_class_from_mono_type (type->type);
1685 return klass->generic_inst != NULL;
1689 ves_icall_Type_GetGenericParameterPosition (MonoReflectionType *type)
1691 MONO_ARCH_SAVE_REGS;
1693 if (type->type->byref)
1695 if (type->type->type == MONO_TYPE_VAR || type->type->type == MONO_TYPE_MVAR)
1696 return type->type->data.generic_param->num;
1701 ves_icall_MonoType_get_HasGenericArguments (MonoReflectionType *type)
1704 MONO_ARCH_SAVE_REGS;
1706 if (type->type->byref)
1708 klass = mono_class_from_mono_type (type->type);
1709 if (klass->gen_params || klass->generic_inst)
1715 ves_icall_MonoType_get_IsGenericParameter (MonoReflectionType *type)
1717 MONO_ARCH_SAVE_REGS;
1719 if (type->type->byref)
1721 if (type->type->type == MONO_TYPE_VAR || type->type->type == MONO_TYPE_MVAR)
1727 ves_icall_TypeBuilder_get_IsGenericParameter (MonoReflectionTypeBuilder *tb)
1729 MONO_ARCH_SAVE_REGS;
1731 if (tb->type.type->byref)
1733 if (tb->type.type->type == MONO_TYPE_VAR || tb->type.type->type == MONO_TYPE_MVAR)
1738 static MonoReflectionGenericParam*
1739 ves_icall_TypeBuilder_define_generic_parameter (MonoReflectionTypeBuilder *tb, MonoString *name, int index)
1741 MONO_ARCH_SAVE_REGS;
1743 return mono_reflection_define_generic_parameter (tb, NULL, name, index);
1746 static MonoReflectionGenericParam*
1747 ves_icall_MethodBuilder_define_generic_parameter (MonoReflectionMethodBuilder *mb, MonoString *name, int index)
1749 MONO_ARCH_SAVE_REGS;
1751 return mono_reflection_define_generic_parameter (NULL, mb, name, index);
1755 ves_icall_MonoGenericParam_initialize (MonoReflectionGenericParam *gparam)
1757 MONO_ARCH_SAVE_REGS;
1758 mono_reflection_initialize_generic_parameter (gparam);
1761 static MonoReflectionMethod *
1762 ves_icall_MonoType_get_DeclaringMethod (MonoReflectionType *type)
1767 MONO_ARCH_SAVE_REGS;
1769 if (type->type->byref)
1772 method = type->type->data.generic_param->method;
1776 klass = mono_class_from_mono_type (type->type);
1777 return mono_method_get_object (mono_object_domain (type), method, klass);
1781 ves_icall_MethodInfo_get_IsGenericMethodDefinition (MonoReflectionMethod *method)
1783 MonoMethodNormal *mn;
1784 MONO_ARCH_SAVE_REGS;
1786 if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
1787 (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
1790 mn = (MonoMethodNormal *) method->method;
1791 return mn->header->gen_params != NULL;
1795 ves_icall_MonoMethod_GetGenericArguments (MonoReflectionMethod *method)
1797 MonoMethodNormal *mn;
1800 MONO_ARCH_SAVE_REGS;
1802 if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
1803 (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
1804 return mono_array_new (mono_object_domain (method), mono_defaults.monotype_class, 0);
1806 mn = (MonoMethodNormal *) method->method;
1807 count = method->method->signature->generic_param_count;
1808 res = mono_array_new (mono_object_domain (method), mono_defaults.monotype_class, count);
1810 for (i = 0; i < count; i++) {
1811 MonoGenericParam *param = &mn->header->gen_params [i];
1812 MonoClass *pklass = mono_class_from_generic_parameter (param, method->method->klass->image, TRUE);
1813 mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (method), &pklass->byval_arg));
1820 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
1823 * Invoke from reflection is supposed to always be a virtual call (the API
1824 * is stupid), mono_runtime_invoke_*() calls the provided method, allowing
1825 * greater flexibility.
1827 MonoMethod *m = method->method;
1830 MONO_ARCH_SAVE_REGS;
1833 if (!mono_object_isinst (this, m->klass))
1834 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
1835 m = mono_object_get_virtual_method (this, m);
1836 } else if (!(m->flags & METHOD_ATTRIBUTE_STATIC) && strcmp (m->name, ".ctor") && !m->wrapper_type)
1837 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
1839 pcount = params? mono_array_length (params): 0;
1840 if (pcount != m->signature->param_count)
1841 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetParameterCountException"));
1843 if (m->klass->rank && !strcmp (m->name, ".ctor")) {
1846 guint32 *lower_bounds;
1847 pcount = mono_array_length (params);
1848 lengths = alloca (sizeof (guint32) * pcount);
1849 for (i = 0; i < pcount; ++i)
1850 lengths [i] = *(gint32*) ((char*)mono_array_get (params, gpointer, i) + sizeof (MonoObject));
1852 if (m->klass->rank == pcount) {
1853 /* Only lengths provided. */
1854 lower_bounds = NULL;
1856 g_assert (pcount == (m->klass->rank * 2));
1857 /* lower bounds are first. */
1858 lower_bounds = lengths;
1859 lengths += m->klass->rank;
1862 return (MonoObject*)mono_array_new_full (mono_object_domain (params), m->klass, lengths, lower_bounds);
1864 return mono_runtime_invoke_array (m, this, params, NULL);
1868 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
1870 MonoDomain *domain = mono_object_domain (method);
1871 MonoMethod *m = method->method;
1872 MonoMethodSignature *sig = m->signature;
1873 MonoArray *out_args;
1875 int i, j, outarg_count = 0;
1877 MONO_ARCH_SAVE_REGS;
1879 if (m->klass == mono_defaults.object_class) {
1881 if (!strcmp (m->name, "FieldGetter")) {
1882 MonoClass *k = this->vtable->klass;
1883 MonoString *name = mono_array_get (params, MonoString *, 1);
1886 str = mono_string_to_utf8 (name);
1888 for (i = 0; i < k->field.count; i++) {
1889 if (!strcmp (k->fields [i].name, str)) {
1890 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1891 if (field_klass->valuetype)
1892 result = mono_value_box (domain, field_klass,
1893 (char *)this + k->fields [i].offset);
1895 result = *((gpointer *)((char *)this + k->fields [i].offset));
1898 out_args = mono_array_new (domain, mono_defaults.object_class, 1);
1899 *outArgs = out_args;
1900 mono_array_set (out_args, gpointer, 0, result);
1907 g_assert_not_reached ();
1909 } else if (!strcmp (m->name, "FieldSetter")) {
1910 MonoClass *k = this->vtable->klass;
1911 MonoString *name = mono_array_get (params, MonoString *, 1);
1915 str = mono_string_to_utf8 (name);
1917 for (i = 0; i < k->field.count; i++) {
1918 if (!strcmp (k->fields [i].name, str)) {
1919 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1920 MonoObject *val = mono_array_get (params, gpointer, 2);
1922 if (field_klass->valuetype) {
1923 size = mono_type_size (k->fields [i].type, &align);
1924 memcpy ((char *)this + k->fields [i].offset,
1925 ((char *)val) + sizeof (MonoObject), size);
1927 *(MonoObject**)((char *)this + k->fields [i].offset) = val;
1929 out_args = mono_array_new (domain, mono_defaults.object_class, 0);
1930 *outArgs = out_args;
1938 g_assert_not_reached ();
1943 for (i = 0; i < mono_array_length (params); i++) {
1944 if (sig->params [i]->byref)
1948 out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
1950 /* fixme: handle constructors? */
1951 if (!strcmp (method->method->name, ".ctor"))
1952 g_assert_not_reached ();
1954 result = mono_runtime_invoke_array (method->method, this, params, NULL);
1956 for (i = 0, j = 0; i < mono_array_length (params); i++) {
1957 if (sig->params [i]->byref) {
1959 arg = mono_array_get (params, gpointer, i);
1960 mono_array_set (out_args, gpointer, j, arg);
1965 *outArgs = out_args;
1971 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
1974 MonoClass *enumc, *objc;
1978 MONO_ARCH_SAVE_REGS;
1980 MONO_CHECK_ARG_NULL (type);
1981 MONO_CHECK_ARG_NULL (obj);
1983 domain = mono_object_domain (type);
1984 enumc = mono_class_from_mono_type (type->type);
1985 objc = obj->vtable->klass;
1987 MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
1988 MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
1989 objc->byval_arg.type <= MONO_TYPE_U8));
1991 s1 = mono_class_value_size (enumc, NULL);
1992 s2 = mono_class_value_size (objc, NULL);
1994 res = mono_object_new (domain, enumc);
1996 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
1997 memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
1999 memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
2000 (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
2007 ves_icall_System_Enum_get_value (MonoObject *this)
2015 MONO_ARCH_SAVE_REGS;
2020 g_assert (this->vtable->klass->enumtype);
2022 enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
2023 res = mono_object_new (mono_object_domain (this), enumc);
2024 dst = (char *)res + sizeof (MonoObject);
2025 src = (char *)this + sizeof (MonoObject);
2026 size = mono_class_value_size (enumc, NULL);
2028 memcpy (dst, src, size);
2034 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
2036 MonoDomain *domain = mono_object_domain (type);
2037 MonoClass *enumc = mono_class_from_mono_type (type->type);
2038 guint i, j, nvalues, crow;
2039 MonoClassField *field;
2041 MONO_ARCH_SAVE_REGS;
2043 info->utype = mono_type_get_object (domain, enumc->enum_basetype);
2044 nvalues = enumc->field.count - 1;
2045 info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
2046 info->values = mono_array_new (domain, enumc, nvalues);
2049 for (i = 0, j = 0; i < enumc->field.count; ++i) {
2053 field = &enumc->fields [i];
2054 if (strcmp ("value__", field->name) == 0)
2056 if (mono_field_is_deleted (field))
2058 mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
2059 if (!field->def_value) {
2060 field->def_value = g_new0 (MonoConstant, 1);
2061 crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1), crow + 1);
2062 field->def_value->type = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_TYPE);
2063 crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
2064 field->def_value->value = (gpointer)mono_metadata_blob_heap (enumc->image, crow);
2067 p = field->def_value->value;
2068 len = mono_metadata_decode_blob_size (p, &p);
2069 switch (enumc->enum_basetype->type) {
2072 mono_array_set (info->values, gchar, j, *p);
2074 case MONO_TYPE_CHAR:
2077 mono_array_set (info->values, gint16, j, read16 (p));
2081 mono_array_set (info->values, gint32, j, read32 (p));
2085 mono_array_set (info->values, gint64, j, read64 (p));
2088 g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
2095 BFLAGS_IgnoreCase = 1,
2096 BFLAGS_DeclaredOnly = 2,
2097 BFLAGS_Instance = 4,
2099 BFLAGS_Public = 0x10,
2100 BFLAGS_NonPublic = 0x20,
2101 BFLAGS_FlattenHierarchy = 0x40,
2102 BFLAGS_InvokeMethod = 0x100,
2103 BFLAGS_CreateInstance = 0x200,
2104 BFLAGS_GetField = 0x400,
2105 BFLAGS_SetField = 0x800,
2106 BFLAGS_GetProperty = 0x1000,
2107 BFLAGS_SetProperty = 0x2000,
2108 BFLAGS_ExactBinding = 0x10000,
2109 BFLAGS_SuppressChangeType = 0x20000,
2110 BFLAGS_OptionalParamBinding = 0x40000
2113 static MonoReflectionField *
2114 ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
2117 MonoClass *startklass, *klass;
2119 MonoClassField *field;
2121 domain = ((MonoObject *)type)->vtable->domain;
2122 klass = startklass = mono_class_from_mono_type (type->type);
2124 MONO_ARCH_SAVE_REGS;
2127 mono_raise_exception (mono_get_exception_argument_null ("name"));
2130 for (i = 0; i < klass->field.count; ++i) {
2132 field = &klass->fields [i];
2133 if (mono_field_is_deleted (field))
2135 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
2136 if (bflags & BFLAGS_Public)
2139 if (bflags & BFLAGS_NonPublic)
2145 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
2146 if (bflags & BFLAGS_Static)
2147 if ((bflags & BFLAGS_FlattenHierarchy) || (klass == startklass))
2150 if (bflags & BFLAGS_Instance)
2157 utf8_name = mono_string_to_utf8 (name);
2159 if (strcmp (field->name, utf8_name)) {
2165 return mono_field_get_object (domain, klass, field);
2167 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2174 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
2177 GSList *l = NULL, *tmp;
2178 MonoClass *startklass, *klass;
2182 MonoClassField *field;
2184 MONO_ARCH_SAVE_REGS;
2186 domain = ((MonoObject *)type)->vtable->domain;
2187 klass = startklass = mono_class_from_mono_type (type->type);
2190 for (i = 0; i < klass->field.count; ++i) {
2192 field = &klass->fields [i];
2193 if (mono_field_is_deleted (field))
2195 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
2196 if (bflags & BFLAGS_Public)
2199 if (bflags & BFLAGS_NonPublic)
2205 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
2206 if (bflags & BFLAGS_Static)
2207 if ((bflags & BFLAGS_FlattenHierarchy) || (klass == startklass))
2210 if (bflags & BFLAGS_Instance)
2216 member = (MonoObject*)mono_field_get_object (domain, klass, field);
2217 l = g_slist_prepend (l, member);
2219 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2221 len = g_slist_length (l);
2222 res = mono_array_new (domain, mono_defaults.field_info_class, len);
2224 tmp = l = g_slist_reverse (l);
2225 for (; tmp; tmp = tmp->next, ++i)
2226 mono_array_set (res, gpointer, i, tmp->data);
2232 ves_icall_Type_GetMethodsByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
2235 GSList *l = NULL, *tmp;
2236 MonoClass *startklass, *klass;
2241 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
2242 gchar *mname = NULL;
2243 int (*compare_func) (const char *s1, const char *s2) = NULL;
2245 MONO_ARCH_SAVE_REGS;
2247 domain = ((MonoObject *)type)->vtable->domain;
2248 klass = startklass = mono_class_from_mono_type (type->type);
2251 mname = mono_string_to_utf8 (name);
2252 compare_func = (ignore_case) ? g_strcasecmp : strcmp;
2256 for (i = 0; i < klass->method.count; ++i) {
2258 method = klass->methods [i];
2259 if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
2261 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2262 if (bflags & BFLAGS_Public)
2265 if (bflags & BFLAGS_NonPublic)
2271 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2272 if (bflags & BFLAGS_Static)
2273 if ((bflags & BFLAGS_FlattenHierarchy) || (klass == startklass))
2276 if (bflags & BFLAGS_Instance)
2284 if (compare_func (mname, method->name))
2289 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
2291 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
2292 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
2294 l = g_slist_prepend (l, member);
2297 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2301 res = mono_array_new (domain, mono_defaults.method_info_class, len);
2304 tmp = l = g_slist_reverse (l);
2306 for (; tmp; tmp = tmp->next, ++i)
2307 mono_array_set (res, gpointer, i, tmp->data);
2309 g_hash_table_destroy (method_slots);
2314 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
2317 GSList *l = NULL, *tmp;
2318 static MonoClass *System_Reflection_ConstructorInfo;
2319 MonoClass *startklass, *klass;
2325 MONO_ARCH_SAVE_REGS;
2327 domain = ((MonoObject *)type)->vtable->domain;
2328 klass = startklass = mono_class_from_mono_type (type->type);
2330 for (i = 0; i < klass->method.count; ++i) {
2332 method = klass->methods [i];
2333 if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
2335 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2336 if (bflags & BFLAGS_Public)
2339 if (bflags & BFLAGS_NonPublic)
2345 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2346 if (bflags & BFLAGS_Static)
2347 if ((bflags & BFLAGS_FlattenHierarchy) || (klass == startklass))
2350 if (bflags & BFLAGS_Instance)
2356 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
2358 l = g_slist_prepend (l, member);
2360 len = g_slist_length (l);
2361 if (!System_Reflection_ConstructorInfo)
2362 System_Reflection_ConstructorInfo = mono_class_from_name (
2363 mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
2364 res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
2366 tmp = l = g_slist_reverse (l);
2367 for (; tmp; tmp = tmp->next, ++i)
2368 mono_array_set (res, gpointer, i, tmp->data);
2374 ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
2377 GSList *l = NULL, *tmp;
2378 static MonoClass *System_Reflection_PropertyInfo;
2379 MonoClass *startklass, *klass;
2385 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
2386 gchar *propname = NULL;
2387 int (*compare_func) (const char *s1, const char *s2) = NULL;
2389 MONO_ARCH_SAVE_REGS;
2391 domain = ((MonoObject *)type)->vtable->domain;
2392 klass = startklass = mono_class_from_mono_type (type->type);
2394 propname = mono_string_to_utf8 (name);
2395 compare_func = (ignore_case) ? g_strcasecmp : strcmp;
2399 for (i = 0; i < klass->property.count; ++i) {
2400 prop = &klass->properties [i];
2405 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2406 if (bflags & BFLAGS_Public)
2409 if (bflags & BFLAGS_NonPublic)
2415 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2416 if (bflags & BFLAGS_Static)
2417 if ((bflags & BFLAGS_FlattenHierarchy) || (klass == startklass))
2420 if (bflags & BFLAGS_Instance)
2429 if (compare_func (propname, prop->name))
2433 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
2435 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), prop);
2437 l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
2440 if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
2444 if (!System_Reflection_PropertyInfo)
2445 System_Reflection_PropertyInfo = mono_class_from_name (
2446 mono_defaults.corlib, "System.Reflection", "PropertyInfo");
2447 res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
2450 tmp = l = g_slist_reverse (l);
2452 for (; tmp; tmp = tmp->next, ++i)
2453 mono_array_set (res, gpointer, i, tmp->data);
2455 g_hash_table_destroy (method_slots);
2459 static MonoReflectionEvent *
2460 ves_icall_MonoType_GetEvent (MonoReflectionType *type, MonoString *name, guint32 bflags)
2469 MONO_ARCH_SAVE_REGS;
2471 event_name = mono_string_to_utf8 (name);
2472 klass = mono_class_from_mono_type (type->type);
2473 domain = mono_object_domain (type);
2476 for (i = 0; i < klass->event.count; i++) {
2477 event = &klass->events [i];
2478 if (strcmp (event->name, event_name))
2481 method = event->add;
2483 method = event->remove;
2485 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2486 if (!(bflags & BFLAGS_Public))
2489 if (!(bflags & BFLAGS_NonPublic))
2493 g_free (event_name);
2494 return mono_event_get_object (domain, klass, event);
2497 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2500 g_free (event_name);
2505 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
2508 GSList *l = NULL, *tmp;
2509 static MonoClass *System_Reflection_EventInfo;
2510 MonoClass *startklass, *klass;
2516 MONO_ARCH_SAVE_REGS;
2518 domain = ((MonoObject *)type)->vtable->domain;
2519 klass = startklass = mono_class_from_mono_type (type->type);
2522 for (i = 0; i < klass->event.count; ++i) {
2523 event = &klass->events [i];
2525 method = event->add;
2527 method = event->remove;
2528 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
2529 if (bflags & BFLAGS_Public)
2532 if (bflags & BFLAGS_NonPublic)
2538 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
2539 if (bflags & BFLAGS_Static)
2540 if ((bflags & BFLAGS_FlattenHierarchy) || (klass == startklass))
2543 if (bflags & BFLAGS_Instance)
2550 l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
2552 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2554 len = g_slist_length (l);
2555 if (!System_Reflection_EventInfo)
2556 System_Reflection_EventInfo = mono_class_from_name (
2557 mono_defaults.corlib, "System.Reflection", "EventInfo");
2558 res = mono_array_new (domain, System_Reflection_EventInfo, len);
2561 tmp = l = g_slist_reverse (l);
2563 for (; tmp; tmp = tmp->next, ++i)
2564 mono_array_set (res, gpointer, i, tmp->data);
2569 static MonoReflectionType *
2570 ves_icall_Type_GetNestedType (MonoReflectionType *type, MonoString *name, guint32 bflags)
2573 MonoClass *startklass, *klass;
2578 MONO_ARCH_SAVE_REGS;
2580 domain = ((MonoObject *)type)->vtable->domain;
2581 klass = startklass = mono_class_from_mono_type (type->type);
2582 str = mono_string_to_utf8 (name);
2585 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
2587 nested = tmpn->data;
2588 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
2589 if (bflags & BFLAGS_Public)
2592 if (bflags & BFLAGS_NonPublic)
2597 if (strcmp (nested->name, str) == 0){
2599 return mono_type_get_object (domain, &nested->byval_arg);
2602 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2609 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
2612 GSList *l = NULL, *tmp;
2614 MonoClass *startklass, *klass;
2620 MONO_ARCH_SAVE_REGS;
2622 domain = ((MonoObject *)type)->vtable->domain;
2623 klass = startklass = mono_class_from_mono_type (type->type);
2625 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
2627 nested = tmpn->data;
2628 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
2629 if (bflags & BFLAGS_Public)
2632 if (bflags & BFLAGS_NonPublic)
2637 member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
2638 l = g_slist_prepend (l, member);
2640 len = g_slist_length (l);
2641 res = mono_array_new (domain, mono_defaults.monotype_class, len);
2643 tmp = l = g_slist_reverse (l);
2644 for (; tmp; tmp = tmp->next, ++i)
2645 mono_array_set (res, gpointer, i, tmp->data);
2650 static MonoReflectionType*
2651 ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *assembly, MonoReflectionModule *module, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
2654 MonoType *type = NULL;
2655 MonoTypeNameParse info;
2657 MONO_ARCH_SAVE_REGS;
2659 str = mono_string_to_utf8 (name);
2660 /*g_print ("requested type %s in %s\n", str, assembly->assembly->aname.name);*/
2661 if (!mono_reflection_parse_type (str, &info)) {
2663 g_list_free (info.modifiers);
2664 g_list_free (info.nested);
2665 if (throwOnError) /* uhm: this is a parse error, though... */
2666 mono_raise_exception (mono_get_exception_type_load (name));
2667 /*g_print ("failed parse\n");*/
2671 if (module != NULL) {
2673 type = mono_reflection_get_type (module->image, &info, ignoreCase);
2678 if (assembly->assembly->dynamic) {
2679 /* Enumerate all modules */
2680 MonoReflectionAssemblyBuilder *abuilder = (MonoReflectionAssemblyBuilder*)assembly;
2684 if (abuilder->modules) {
2685 for (i = 0; i < mono_array_length (abuilder->modules); ++i) {
2686 MonoReflectionModuleBuilder *mb = mono_array_get (abuilder->modules, MonoReflectionModuleBuilder*, i);
2687 type = mono_reflection_get_type (&mb->dynamic_image->image, &info, ignoreCase);
2693 if (!type && abuilder->loaded_modules) {
2694 for (i = 0; i < mono_array_length (abuilder->loaded_modules); ++i) {
2695 MonoReflectionModule *mod = mono_array_get (abuilder->loaded_modules, MonoReflectionModule*, i);
2696 type = mono_reflection_get_type (mod->image, &info, ignoreCase);
2703 type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
2705 g_list_free (info.modifiers);
2706 g_list_free (info.nested);
2709 mono_raise_exception (mono_get_exception_type_load (name));
2710 /* g_print ("failed find\n"); */
2713 /* g_print ("got it\n"); */
2714 return mono_type_get_object (mono_object_domain (assembly), type);
2719 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
2721 MonoDomain *domain = mono_object_domain (assembly);
2722 MonoAssembly *mass = assembly->assembly;
2727 MONO_ARCH_SAVE_REGS;
2729 absolute = g_build_filename (mass->basedir, mass->image->module_name, NULL);
2730 uri = g_filename_to_uri (absolute, NULL, NULL);
2731 res = mono_string_new (domain, uri);
2738 ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assembly)
2740 MonoDomain *domain = mono_object_domain (assembly);
2742 char *name = g_build_filename (
2743 assembly->assembly->basedir,
2744 assembly->assembly->image->module_name, NULL);
2746 MONO_ARCH_SAVE_REGS;
2748 res = mono_string_new (domain, name);
2754 ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion (MonoReflectionAssembly *assembly)
2756 MonoDomain *domain = mono_object_domain (assembly);
2758 MONO_ARCH_SAVE_REGS;
2760 return mono_string_new (domain, assembly->assembly->image->version);
2763 static MonoReflectionMethod*
2764 ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly)
2766 guint32 token = mono_image_get_entry_point (assembly->assembly->image);
2768 MONO_ARCH_SAVE_REGS;
2772 return mono_method_get_object (mono_object_domain (assembly), mono_get_method (assembly->assembly->image, token, NULL), NULL);
2776 ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly)
2778 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2779 MonoArray *result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
2783 MONO_ARCH_SAVE_REGS;
2785 for (i = 0; i < table->rows; ++i) {
2786 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_MANIFEST_NAME));
2787 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), val));
2793 ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAssembly *assembly)
2795 static MonoClass *System_Reflection_AssemblyName;
2798 MonoDomain *domain = mono_object_domain (assembly);
2801 MONO_ARCH_SAVE_REGS;
2803 if (!System_Reflection_AssemblyName)
2804 System_Reflection_AssemblyName = mono_class_from_name (
2805 mono_defaults.corlib, "System.Reflection", "AssemblyName");
2807 for (ptr = assembly->assembly->image->references; ptr && *ptr; ptr++)
2810 result = mono_array_new (mono_object_domain (assembly), System_Reflection_AssemblyName, count);
2812 for (i = 0; i < count; i++) {
2813 MonoAssembly *assem = assembly->assembly->image->references [i];
2814 MonoReflectionAssemblyName *aname;
2815 char *codebase, *absolute;
2817 aname = (MonoReflectionAssemblyName *) mono_object_new (
2818 domain, System_Reflection_AssemblyName);
2820 if (strcmp (assem->aname.name, "corlib") == 0)
2821 aname->name = mono_string_new (domain, "mscorlib");
2823 aname->name = mono_string_new (domain, assem->aname.name);
2824 aname->major = assem->aname.major;
2826 absolute = g_build_filename (assem->basedir, assem->image->module_name, NULL);
2827 codebase = g_filename_to_uri (absolute, NULL, NULL);
2828 aname->codebase = mono_string_new (domain, codebase);
2831 mono_array_set (result, gpointer, i, aname);
2842 foreach_namespace (const char* key, gconstpointer val, NameSpaceInfo *info)
2844 MonoString *name = mono_string_new (mono_object_domain (info->res), key);
2846 mono_array_set (info->res, gpointer, info->idx, name);
2851 ves_icall_System_Reflection_Assembly_GetNamespaces (MonoReflectionAssembly *assembly)
2853 MonoImage *img = assembly->assembly->image;
2857 MonoTableInfo *t = &img->tables [MONO_TABLE_EXPORTEDTYPE];
2860 MONO_ARCH_SAVE_REGS;
2862 n = g_hash_table_size (img->name_cache);
2863 res = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, n);
2866 g_hash_table_foreach (img->name_cache, (GHFunc)foreach_namespace, &info);
2868 /* Add namespaces from the EXPORTEDTYPES table as well */
2871 GPtrArray *nspaces = g_ptr_array_new ();
2872 for (i = 0; i < t->rows; ++i) {
2873 const char *nspace = mono_metadata_string_heap (img, mono_metadata_decode_row_col (t, i, MONO_EXP_TYPE_NAMESPACE));
2874 if (!g_hash_table_lookup (img->name_cache, nspace)) {
2875 g_ptr_array_add (nspaces, (char*)nspace);
2878 if (nspaces->len > 0) {
2879 res2 = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, n + nspaces->len);
2880 memcpy (mono_array_addr (res2, MonoString*, 0),
2881 mono_array_addr (res, MonoString*, 0),
2882 n * sizeof (MonoString*));
2883 for (i = 0; i < nspaces->len; ++i)
2884 mono_array_set (res2, MonoString*, n + i,
2885 mono_string_new (mono_object_domain (assembly),
2886 g_ptr_array_index (nspaces, i)));
2889 g_ptr_array_free (nspaces, TRUE);
2895 /* move this in some file in mono/util/ */
2897 g_concat_dir_and_file (const char *dir, const char *file)
2899 g_return_val_if_fail (dir != NULL, NULL);
2900 g_return_val_if_fail (file != NULL, NULL);
2903 * If the directory name doesn't have a / on the end, we need
2904 * to add one so we get a proper path to the file
2906 if (dir [strlen(dir) - 1] != G_DIR_SEPARATOR)
2907 return g_strconcat (dir, G_DIR_SEPARATOR_S, file, NULL);
2909 return g_strconcat (dir, file, NULL);
2913 ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name, gint32 *size, MonoReflectionModule **ref_module)
2915 char *n = mono_string_to_utf8 (name);
2916 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2918 guint32 cols [MONO_MANIFEST_SIZE];
2919 guint32 impl, file_idx;
2923 MONO_ARCH_SAVE_REGS;
2925 for (i = 0; i < table->rows; ++i) {
2926 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
2927 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
2928 if (strcmp (val, n) == 0)
2932 if (i == table->rows)
2935 impl = cols [MONO_MANIFEST_IMPLEMENTATION];
2938 * this code should only be called after obtaining the
2939 * ResourceInfo and handling the other cases.
2941 g_assert ((impl & IMPLEMENTATION_MASK) == IMPLEMENTATION_FILE);
2942 file_idx = impl >> IMPLEMENTATION_BITS;
2944 module = mono_image_load_file_for_image (assembly->assembly->image, file_idx);
2949 module = assembly->assembly->image;
2951 *ref_module = mono_module_get_object (mono_domain_get (), module);
2953 return (void*)mono_image_get_resource (module, cols [MONO_MANIFEST_OFFSET], size);
2957 ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal (MonoReflectionAssembly *assembly, MonoString *name, MonoManifestResourceInfo *info)
2959 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2961 guint32 cols [MONO_MANIFEST_SIZE];
2962 guint32 file_cols [MONO_FILE_SIZE];
2966 MONO_ARCH_SAVE_REGS;
2968 n = mono_string_to_utf8 (name);
2969 for (i = 0; i < table->rows; ++i) {
2970 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
2971 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
2972 if (strcmp (val, n) == 0)
2976 if (i == table->rows)
2979 if (!cols [MONO_MANIFEST_IMPLEMENTATION]) {
2980 info->location = RESOURCE_LOCATION_EMBEDDED | RESOURCE_LOCATION_IN_MANIFEST;
2983 switch (cols [MONO_MANIFEST_IMPLEMENTATION] & IMPLEMENTATION_MASK) {
2984 case IMPLEMENTATION_FILE:
2985 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
2986 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
2987 mono_metadata_decode_row (table, i - 1, file_cols, MONO_FILE_SIZE);
2988 val = mono_metadata_string_heap (assembly->assembly->image, file_cols [MONO_FILE_NAME]);
2989 info->filename = mono_string_new (mono_object_domain (assembly), val);
2990 if (file_cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA)
2993 info->location = RESOURCE_LOCATION_EMBEDDED;
2996 case IMPLEMENTATION_ASSEMBLYREF:
2997 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
2998 info->assembly = mono_assembly_get_object (mono_domain_get (), assembly->assembly->image->references [i - 1]);
3000 // Obtain info recursively
3001 ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal (info->assembly, name, info);
3002 info->location |= RESOURCE_LOCATION_ANOTHER_ASSEMBLY;
3005 case IMPLEMENTATION_EXP_TYPE:
3006 g_assert_not_reached ();
3015 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name)
3017 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
3018 MonoArray *result = NULL;
3023 MONO_ARCH_SAVE_REGS;
3025 /* check hash if needed */
3027 n = mono_string_to_utf8 (name);
3028 for (i = 0; i < table->rows; ++i) {
3029 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
3030 if (strcmp (val, n) == 0) {
3033 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
3034 fn = mono_string_new (mono_object_domain (assembly), n);
3036 return (MonoObject*)fn;
3043 for (i = 0; i < table->rows; ++i) {
3044 result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
3045 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
3046 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
3047 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), n));
3050 return (MonoObject*)result;
3054 ves_icall_System_Reflection_Assembly_GetModulesInternal (MonoReflectionAssembly *assembly)
3056 MonoDomain *domain = mono_domain_get();
3059 int i, module_count = 0, file_count = 0;
3060 MonoImage **modules = assembly->assembly->image->modules;
3061 MonoTableInfo *table;
3064 while (modules[module_count])
3068 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
3069 file_count = table->rows;
3071 g_assert( assembly->assembly->image != NULL);
3074 klass = mono_class_from_name ( mono_defaults.corlib, "System.Reflection", "Module");
3075 res = mono_array_new (domain, klass, module_count + file_count);
3077 mono_array_set (res, gpointer, 0, mono_module_get_object (domain, assembly->assembly->image));
3078 for ( i = 1; i < module_count; ++i )
3079 mono_array_set (res, gpointer, i, mono_module_get_object (domain, modules[i]));
3081 for (i = 0; i < table->rows; ++i)
3082 mono_array_set (res, gpointer, module_count + i, mono_module_file_get_object (domain, assembly->assembly->image, i));
3087 static MonoReflectionMethod*
3088 ves_icall_GetCurrentMethod (void)
3090 MonoMethod *m = mono_method_get_last_managed ();
3092 MONO_ARCH_SAVE_REGS;
3094 return mono_method_get_object (mono_domain_get (), m, NULL);
3097 static MonoReflectionAssembly*
3098 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (void)
3100 MonoMethod *m = mono_method_get_last_managed ();
3102 MONO_ARCH_SAVE_REGS;
3104 return mono_assembly_get_object (mono_domain_get (), m->klass->image->assembly);
3109 get_caller (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data)
3111 MonoMethod **dest = data;
3113 /* skip unmanaged frames */
3128 static MonoReflectionAssembly*
3129 ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
3131 MonoDomain* domain = mono_domain_get ();
3133 MONO_ARCH_SAVE_REGS;
3135 if (!domain->entry_assembly)
3136 domain = mono_root_domain;
3138 return mono_assembly_get_object (domain, domain->entry_assembly);
3142 static MonoReflectionAssembly*
3143 ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
3145 MonoMethod *m = mono_method_get_last_managed ();
3146 MonoMethod *dest = m;
3148 MONO_ARCH_SAVE_REGS;
3150 mono_stack_walk (get_caller, &dest);
3153 return mono_assembly_get_object (mono_domain_get (), dest->klass->image->assembly);
3157 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
3159 MonoDomain *domain = mono_object_domain (object);
3163 MONO_ARCH_SAVE_REGS;
3165 name = mono_type_get_name (object->type);
3166 res = mono_string_new (domain, name);
3173 fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *aname, MonoAssemblyName *name, const char *absolute)
3175 static MonoMethod *create_culture = NULL;
3178 const char *pkey_ptr;
3181 MONO_ARCH_SAVE_REGS;
3183 if (strcmp (name->name, "corlib") == 0)
3184 aname->name = mono_string_new (domain, "mscorlib");
3186 aname->name = mono_string_new (domain, name->name);
3188 aname->major = name->major;
3189 aname->minor = name->minor;
3190 aname->build = name->build;
3191 aname->revision = name->revision;
3192 aname->hashalg = name->hash_alg;
3194 codebase = g_filename_to_uri (absolute, NULL, NULL);
3196 aname->codebase = mono_string_new (domain, codebase);
3200 if (!create_culture) {
3201 MonoMethodDesc *desc = mono_method_desc_new ("System.Globalization.CultureInfo:CreateSpecificCulture(string)", TRUE);
3202 create_culture = mono_method_desc_search_in_image (desc, mono_defaults.corlib);
3203 g_assert (create_culture);
3204 mono_method_desc_free (desc);
3207 args [0] = mono_string_new (domain, name->culture);
3208 aname->cultureInfo =
3209 mono_runtime_invoke (create_culture, NULL, args, NULL);
3211 if (name->public_key) {
3212 pkey_ptr = name->public_key;
3213 pkey_len = mono_metadata_decode_blob_size (pkey_ptr, &pkey_ptr);
3215 aname->publicKey = mono_array_new (domain, mono_defaults.byte_class, pkey_len);
3216 memcpy (mono_array_addr (aname->publicKey, guint8, 0), pkey_ptr, pkey_len);
3221 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
3225 MONO_ARCH_SAVE_REGS;
3227 absolute = g_build_filename (assembly->assembly->basedir, assembly->assembly->image->module_name, NULL);
3229 fill_reflection_assembly_name (mono_object_domain (assembly), aname,
3230 &assembly->assembly->aname, absolute);
3236 ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoString *fname, MonoReflectionAssemblyName *aname)
3239 MonoImageOpenStatus status = MONO_IMAGE_OK;
3242 MonoAssemblyName name;
3244 MONO_ARCH_SAVE_REGS;
3246 filename = mono_string_to_utf8 (fname);
3248 image = mono_image_open (filename, &status);
3254 exc = mono_get_exception_file_not_found (fname);
3255 mono_raise_exception (exc);
3258 res = mono_assembly_fill_assembly_name (image, &name);
3260 mono_image_close (image);
3262 mono_raise_exception (mono_get_exception_argument ("assemblyFile", "The file does not contain a manifest"));
3265 fill_reflection_assembly_name (mono_domain_get (), aname, &name, filename);
3268 mono_image_close (image);
3272 mono_module_get_types (MonoDomain *domain, MonoImage *image,
3273 MonoBoolean exportedOnly)
3277 MonoTableInfo *tdef = &image->tables [MONO_TABLE_TYPEDEF];
3279 guint32 attrs, visibility;
3281 /* we start the count from 1 because we skip the special type <Module> */
3284 for (i = 1; i < tdef->rows; ++i) {
3285 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
3286 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
3287 if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
3291 count = tdef->rows - 1;
3293 res = mono_array_new (domain, mono_defaults.monotype_class, count);
3295 for (i = 1; i < tdef->rows; ++i) {
3296 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
3297 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
3298 if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
3299 klass = mono_class_get (image, (i + 1) | MONO_TOKEN_TYPE_DEF);
3300 mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
3309 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
3312 MonoImage *image = assembly->assembly->image;
3313 MonoTableInfo *table = &image->tables [MONO_TABLE_FILE];
3317 MONO_ARCH_SAVE_REGS;
3319 domain = mono_object_domain (assembly);
3320 res = mono_module_get_types (domain, image, exportedOnly);
3322 /* Append data from all modules in the assembly */
3323 for (i = 0; i < table->rows; ++i) {
3324 if (!(mono_metadata_decode_row_col (table, i, MONO_FILE_FLAGS) & FILE_CONTAINS_NO_METADATA)) {
3325 MonoImage *loaded_image = mono_assembly_load_module (image->assembly, i + 1);
3327 MonoArray *res2 = mono_module_get_types (domain, loaded_image, exportedOnly);
3328 /* Append the new types to the end of the array */
3329 if (mono_array_length (res2) > 0) {
3333 len1 = mono_array_length (res);
3334 len2 = mono_array_length (res2);
3335 res3 = mono_array_new (domain, mono_defaults.monotype_class, len1 + len2);
3336 memcpy (mono_array_addr (res3, MonoReflectionType*, 0),
3337 mono_array_addr (res, MonoReflectionType*, 0),
3338 len1 * sizeof (MonoReflectionType*));
3339 memcpy (mono_array_addr (res3, MonoReflectionType*, len1),
3340 mono_array_addr (res2, MonoReflectionType*, 0),
3341 len2 * sizeof (MonoReflectionType*));
3351 static MonoReflectionType*
3352 ves_icall_System_Reflection_Module_GetGlobalType (MonoReflectionModule *module)
3354 MonoDomain *domain = mono_object_domain (module);
3357 MONO_ARCH_SAVE_REGS;
3359 g_assert (module->image);
3360 klass = mono_class_get (module->image, 1 | MONO_TOKEN_TYPE_DEF);
3361 return mono_type_get_object (domain, &klass->byval_arg);
3365 ves_icall_System_Reflection_Module_Close (MonoReflectionModule *module)
3368 mono_image_close (module->image);
3372 ves_icall_System_Reflection_Module_GetGuidInternal (MonoReflectionModule *module)
3374 MonoDomain *domain = mono_object_domain (module);
3376 MONO_ARCH_SAVE_REGS;
3378 g_assert (module->image);
3379 return mono_string_new (domain, module->image->guid);
3383 ves_icall_System_Reflection_Module_InternalGetTypes (MonoReflectionModule *module)
3385 MONO_ARCH_SAVE_REGS;
3388 return mono_array_new (mono_object_domain (module), mono_defaults.monotype_class, 0);
3390 return mono_module_get_types (mono_object_domain (module), module->image, FALSE);
3393 static MonoReflectionType*
3394 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
3397 int isbyref = 0, rank;
3398 char *str = mono_string_to_utf8 (smodifiers);
3401 MONO_ARCH_SAVE_REGS;
3403 klass = mono_class_from_mono_type (tb->type.type);
3405 /* logic taken from mono_reflection_parse_type(): keep in sync */
3409 if (isbyref) { /* only one level allowed by the spec */
3416 return mono_type_get_object (mono_object_domain (tb), &klass->this_arg);
3419 klass = mono_ptr_class_get (&klass->byval_arg);
3420 mono_class_init (klass);
3431 else if (*p != '*') { /* '*' means unknown lower bound */
3442 klass = mono_array_class_get (klass, rank);
3443 mono_class_init (klass);
3450 return mono_type_get_object (mono_object_domain (tb), &klass->byval_arg);
3454 ves_icall_Type_IsArrayImpl (MonoReflectionType *t)
3459 MONO_ARCH_SAVE_REGS;
3462 res = !type->byref && (type->type == MONO_TYPE_ARRAY || type->type == MONO_TYPE_SZARRAY);
3467 static MonoReflectionType *
3468 ves_icall_Type_make_array_type (MonoReflectionType *type, int rank)
3470 MonoClass *klass, *aklass;
3472 MONO_ARCH_SAVE_REGS;
3474 klass = mono_class_from_mono_type (type->type);
3475 aklass = mono_array_class_get (klass, rank);
3477 return mono_type_get_object (mono_object_domain (type), &aklass->byval_arg);
3480 static MonoReflectionType *
3481 ves_icall_Type_make_byref_type (MonoReflectionType *type)
3485 MONO_ARCH_SAVE_REGS;
3487 klass = mono_class_from_mono_type (type->type);
3489 return mono_type_get_object (mono_object_domain (type), &klass->this_arg);
3493 ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target,
3494 MonoReflectionMethod *info)
3496 MonoClass *delegate_class = mono_class_from_mono_type (type->type);
3497 MonoObject *delegate;
3500 MONO_ARCH_SAVE_REGS;
3502 mono_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
3504 delegate = mono_object_new (mono_object_domain (type), delegate_class);
3506 func = mono_compile_method (info->method);
3508 mono_delegate_ctor (delegate, target, func);
3514 * Magic number to convert a time which is relative to
3515 * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
3517 #define EPOCH_ADJUST ((guint64)62135596800LL)
3520 * Magic number to convert FILETIME base Jan 1, 1601 to DateTime - base Jan, 1, 0001
3522 #define FILETIME_ADJUST ((guint64)504911232000000000LL)
3525 * This returns Now in UTC
3528 ves_icall_System_DateTime_GetNow (void)
3530 #ifdef PLATFORM_WIN32
3535 SystemTimeToFileTime (&st, &ft);
3536 return (gint64) FILETIME_ADJUST + ((((gint64)ft.dwHighDateTime)<<32) | ft.dwLowDateTime);
3538 /* FIXME: put this in io-layer and call it GetLocalTime */
3542 MONO_ARCH_SAVE_REGS;
3544 if (gettimeofday (&tv, NULL) == 0) {
3545 res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
3548 /* fixme: raise exception */
3553 #ifdef PLATFORM_WIN32
3554 /* convert a SYSTEMTIME which is of the form "last thursday in october" to a real date */
3556 convert_to_absolute_date(SYSTEMTIME *date)
3558 #define IS_LEAP(y) ((y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0))
3559 static int days_in_month[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
3560 static int leap_days_in_month[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
3561 /* from the calendar FAQ */
3562 int a = (14 - date->wMonth) / 12;
3563 int y = date->wYear - a;
3564 int m = date->wMonth + 12 * a - 2;
3565 int d = (1 + y + y/4 - y/100 + y/400 + (31*m)/12) % 7;
3567 /* d is now the day of the week for the first of the month (0 == Sunday) */
3569 int day_of_week = date->wDayOfWeek;
3571 /* set day_in_month to the first day in the month which falls on day_of_week */
3572 int day_in_month = 1 + (day_of_week - d);
3573 if (day_in_month <= 0)
3576 /* wDay is 1 for first weekday in month, 2 for 2nd ... 5 means last - so work that out allowing for days in the month */
3577 date->wDay = day_in_month + (date->wDay - 1) * 7;
3578 if (date->wDay > (IS_LEAP(date->wYear) ? leap_days_in_month[date->wMonth - 1] : days_in_month[date->wMonth - 1]))
3583 #ifndef PLATFORM_WIN32
3585 * Return's the offset from GMT of a local time.
3587 * tm is a local time
3588 * t is the same local time as seconds.
3591 gmt_offset(struct tm *tm, time_t t)
3593 #if defined (HAVE_TM_GMTOFF)
3594 return tm->tm_gmtoff;
3599 g.tm_isdst = tm->tm_isdst;
3601 return (int)difftime(t, t2);
3606 * This is heavily based on zdump.c from glibc 2.2.
3608 * * data[0]: start of daylight saving time (in DateTime ticks).
3609 * * data[1]: end of daylight saving time (in DateTime ticks).
3610 * * data[2]: utcoffset (in TimeSpan ticks).
3611 * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
3612 * * name[0]: name of this timezone when not daylight saving.
3613 * * name[1]: name of this timezone when daylight saving.
3615 * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
3616 * the class library allows years between 1 and 9999.
3618 * Returns true on success and zero on failure.
3621 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
3623 #ifndef PLATFORM_WIN32
3624 MonoDomain *domain = mono_domain_get ();
3625 struct tm start, tt;
3629 int is_daylight = 0, day;
3632 MONO_ARCH_SAVE_REGS;
3634 MONO_CHECK_ARG_NULL (data);
3635 MONO_CHECK_ARG_NULL (names);
3637 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
3638 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
3641 * no info is better than crashing: we'll need our own tz data to make
3642 * this work properly, anyway. The range is reduced to 1970 .. 2037 because
3643 * that is what mktime is guaranteed to support (we get into an infinite loop
3646 if ((year < 1970) || (year > 2037)) {
3648 tt = *localtime (&t);
3649 strftime (tzone, sizeof (tzone), "%Z", &tt);
3650 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
3651 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
3655 memset (&start, 0, sizeof (start));
3658 start.tm_year = year-1900;
3660 t = mktime (&start);
3661 gmtoff = gmt_offset (&start, t);
3663 /* For each day of the year, calculate the tm_gmtoff. */
3664 for (day = 0; day < 365; day++) {
3667 tt = *localtime (&t);
3669 /* Daylight saving starts or ends here. */
3670 if (gmt_offset (&tt, t) != gmtoff) {
3674 /* Try to find the exact hour when daylight saving starts/ends. */
3678 tt1 = *localtime (&t1);
3679 } while (gmt_offset (&tt1, t1) != gmtoff);
3681 /* Try to find the exact minute when daylight saving starts/ends. */
3684 tt1 = *localtime (&t1);
3685 } while (gmt_offset (&tt1, t1) == gmtoff);
3687 strftime (tzone, sizeof (tzone), "%Z", &tt);
3689 /* Write data, if we're already in daylight saving, we're done. */
3691 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
3692 mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
3695 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
3696 mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
3700 /* This is only set once when we enter daylight saving. */
3701 mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
3702 mono_array_set ((*data), gint64, 3, (gint64)(gmt_offset (&tt, t) - gmtoff) * 10000000L);
3704 gmtoff = gmt_offset (&tt, t);
3709 strftime (tzone, sizeof (tzone), "%Z", &tt);
3710 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
3711 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
3712 mono_array_set ((*data), gint64, 0, 0);
3713 mono_array_set ((*data), gint64, 1, 0);
3714 mono_array_set ((*data), gint64, 2, (gint64) gmtoff * 10000000L);
3715 mono_array_set ((*data), gint64, 3, 0);
3720 MonoDomain *domain = mono_domain_get ();
3721 TIME_ZONE_INFORMATION tz_info;
3726 tz_id = GetTimeZoneInformation (&tz_info);
3727 if (tz_id == TIME_ZONE_ID_INVALID)
3730 MONO_CHECK_ARG_NULL (data);
3731 MONO_CHECK_ARG_NULL (names);
3733 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
3734 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
3736 for (i = 0; i < 32; ++i)
3737 if (!tz_info.DaylightName [i])
3739 mono_array_set ((*names), gpointer, 1, mono_string_new_utf16 (domain, tz_info.DaylightName, i));
3740 for (i = 0; i < 32; ++i)
3741 if (!tz_info.StandardName [i])
3743 mono_array_set ((*names), gpointer, 0, mono_string_new_utf16 (domain, tz_info.StandardName, i));
3745 if ((year <= 1601) || (year > 30827)) {
3747 * According to MSDN, the MS time functions can't handle dates outside
3753 /* even if the timezone has no daylight savings it may have Bias (e.g. GMT+13 it seems) */
3754 if (tz_id != TIME_ZONE_ID_UNKNOWN) {
3755 tz_info.StandardDate.wYear = year;
3756 convert_to_absolute_date(&tz_info.StandardDate);
3757 err = SystemTimeToFileTime (&tz_info.StandardDate, &ft);
3759 mono_array_set ((*data), gint64, 1, FILETIME_ADJUST + (((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime));
3760 tz_info.DaylightDate.wYear = year;
3761 convert_to_absolute_date(&tz_info.DaylightDate);
3762 err = SystemTimeToFileTime (&tz_info.DaylightDate, &ft);
3764 mono_array_set ((*data), gint64, 0, FILETIME_ADJUST + (((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime));
3766 mono_array_set ((*data), gint64, 2, (tz_info.Bias + tz_info.StandardBias) * -600000000LL);
3767 mono_array_set ((*data), gint64, 3, (tz_info.DaylightBias - tz_info.StandardBias) * -600000000LL);
3774 ves_icall_System_Object_obj_address (MonoObject *this)
3776 MONO_ARCH_SAVE_REGS;
3784 ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array)
3791 MONO_ARCH_SAVE_REGS;
3793 klass = array->obj.vtable->klass;
3794 etype = klass->element_class->byval_arg.type;
3795 if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
3798 if (array->bounds == NULL)
3799 length = array->max_length;
3802 for (i = 0; i < klass->rank; ++ i)
3803 length *= array->bounds [i].length;
3806 esize = mono_array_element_size (klass);
3807 return length * esize;
3811 ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx)
3813 MONO_ARCH_SAVE_REGS;
3815 return mono_array_get (array, gint8, idx);
3819 ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value)
3821 MONO_ARCH_SAVE_REGS;
3823 mono_array_set (array, gint8, idx, value);
3827 ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count)
3829 char *src_buf, *dest_buf;
3831 MONO_ARCH_SAVE_REGS;
3833 src_buf = (gint8 *)src->vector + src_offset;
3834 dest_buf = (gint8 *)dest->vector + dest_offset;
3836 memcpy (dest_buf, src_buf, count);
3840 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
3842 MonoDomain *domain = mono_object_domain (this);
3844 MonoRealProxy *rp = ((MonoRealProxy *)this);
3845 MonoTransparentProxy *tp;
3849 MONO_ARCH_SAVE_REGS;
3851 res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
3852 tp = (MonoTransparentProxy*) res;
3855 type = ((MonoReflectionType *)rp->class_to_proxy)->type;
3856 klass = mono_class_from_mono_type (type);
3858 if (klass->flags & TYPE_ATTRIBUTE_INTERFACE)
3859 tp->klass = mono_defaults.marshalbyrefobject_class;
3863 tp->custom_type_info = (mono_object_isinst (this, mono_defaults.iremotingtypeinfo_class) != NULL);
3865 res->vtable = mono_class_proxy_vtable (domain, klass);
3870 /* System.Environment */
3873 ves_icall_System_Environment_get_MachineName (void)
3875 #if defined (PLATFORM_WIN32)
3880 len = MAX_COMPUTERNAME_LENGTH + 1;
3881 buf = g_new (gunichar2, len);
3884 if (GetComputerName (buf, (PDWORD) &len))
3885 result = mono_string_new_utf16 (mono_domain_get (), buf, len);
3894 MONO_ARCH_SAVE_REGS;
3897 buf = g_new (gchar, len);
3900 if (gethostname (buf, len) == 0)
3901 result = mono_string_new (mono_domain_get (), buf);
3909 ves_icall_System_Environment_get_Platform (void)
3911 MONO_ARCH_SAVE_REGS;
3913 #if defined (PLATFORM_WIN32)
3923 ves_icall_System_Environment_get_NewLine (void)
3925 MONO_ARCH_SAVE_REGS;
3927 #if defined (PLATFORM_WIN32)
3928 return mono_string_new (mono_domain_get (), "\r\n");
3930 return mono_string_new (mono_domain_get (), "\n");
3935 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
3940 MONO_ARCH_SAVE_REGS;
3945 utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
3946 value = g_getenv (utf8_name);
3952 return mono_string_new (mono_domain_get (), value);
3956 * There is no standard way to get at environ.
3964 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
3972 MONO_ARCH_SAVE_REGS;
3975 for (e = environ; *e != 0; ++ e)
3978 domain = mono_domain_get ();
3979 names = mono_array_new (domain, mono_defaults.string_class, n);
3982 for (e = environ; *e != 0; ++ e) {
3983 parts = g_strsplit (*e, "=", 2);
3985 str = mono_string_new (domain, *parts);
3986 mono_array_set (names, MonoString *, n, str);
3998 * Returns the number of milliseconds elapsed since the system started.
4001 ves_icall_System_Environment_get_TickCount (void)
4003 #if defined (PLATFORM_WIN32)
4004 return GetTickCount();
4010 MONO_ARCH_SAVE_REGS;
4012 res = (gint32) gettimeofday (&tv, &tz);
4015 res = (gint32) ((tv.tv_sec & 0xFFFFF) * 1000 + (tv.tv_usec / 1000));
4022 ves_icall_System_Environment_Exit (int result)
4024 MONO_ARCH_SAVE_REGS;
4026 mono_runtime_quit ();
4028 /* we may need to do some cleanup here... */
4033 ves_icall_System_Environment_GetGacPath (void)
4035 return mono_string_new (mono_domain_get (), MONO_ASSEMBLIES);
4039 ves_icall_System_Text_Encoding_InternalCodePage (void)
4043 MONO_ARCH_SAVE_REGS;
4045 g_get_charset (&cset);
4046 /* g_print ("charset: %s\n", cset); */
4047 /* handle some common aliases */
4050 if (strcmp (cset, "ANSI_X3.4-1968") == 0)
4054 return mono_string_new (mono_domain_get (), cset);
4058 ves_icall_System_Environment_get_HasShutdownStarted (void)
4060 if (mono_runtime_is_shutting_down ())
4063 if (mono_domain_is_unloading (mono_domain_get ()))
4070 ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
4071 MonoReflectionMethod *method,
4072 MonoArray *out_args)
4074 MONO_ARCH_SAVE_REGS;
4076 mono_message_init (mono_object_domain (this), this, method, out_args);
4080 ves_icall_IsTransparentProxy (MonoObject *proxy)
4082 MONO_ARCH_SAVE_REGS;
4087 if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
4094 ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (MonoReflectionType *type, MonoBoolean enable)
4099 MONO_ARCH_SAVE_REGS;
4101 klass = mono_class_from_mono_type (type->type);
4102 vtable = mono_class_vtable (mono_domain_get (), klass);
4104 if (enable) vtable->remote = 1;
4105 else vtable->remote = 0;
4109 ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance (MonoReflectionType *type)
4114 MONO_ARCH_SAVE_REGS;
4116 domain = mono_object_domain (type);
4117 klass = mono_class_from_mono_type (type->type);
4119 if (klass->rank >= 1) {
4120 g_assert (klass->rank == 1);
4121 return (MonoObject *) mono_array_new (domain, klass->element_class, 0);
4123 // Bypass remoting object creation check
4124 return mono_object_new_alloc_specific (mono_class_vtable (domain, klass));
4129 ves_icall_System_IO_get_temp_path (void)
4131 MONO_ARCH_SAVE_REGS;
4133 return mono_string_new (mono_domain_get (), g_get_tmp_dir ());
4137 ves_icall_RuntimeMethod_GetFunctionPointer (MonoMethod *method)
4139 MONO_ARCH_SAVE_REGS;
4141 return mono_compile_method (method);
4144 char const * mono_cfg_dir = "";
4147 mono_install_get_config_dir (void)
4149 #ifdef PLATFORM_WIN32
4153 mono_cfg_dir = getenv ("MONO_CFG_DIR");
4155 if (!mono_cfg_dir) {
4156 #ifndef PLATFORM_WIN32
4157 mono_cfg_dir = MONO_CFG_DIR;
4159 mono_cfg_dir = g_strdup (MONO_CFG_DIR);
4160 for (i = strlen (mono_cfg_dir) - 1; i >= 0; i--) {
4161 if (mono_cfg_dir [i] == '/')
4162 ((char*) mono_cfg_dir) [i] = '\\';
4170 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
4175 MONO_ARCH_SAVE_REGS;
4177 path = g_build_path (G_DIR_SEPARATOR_S, mono_cfg_dir, "mono", "machine.config", NULL);
4179 #if defined (PLATFORM_WIN32)
4180 /* Avoid mixing '/' and '\\' */
4183 for (i = strlen (path) - 1; i >= 0; i--)
4184 if (path [i] == '/')
4188 mcpath = mono_string_new (mono_domain_get (), path);
4195 ves_icall_System_Web_Util_ICalls_get_machine_install_dir (void)
4200 MONO_ARCH_SAVE_REGS;
4202 path = g_path_get_dirname (mono_cfg_dir);
4204 #if defined (PLATFORM_WIN32)
4205 /* Avoid mixing '/' and '\\' */
4208 for (i = strlen (path) - 1; i >= 0; i--)
4209 if (path [i] == '/')
4213 ipath = mono_string_new (mono_domain_get (), path);
4220 ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoString *message)
4222 #if defined (PLATFORM_WIN32)
4223 static void (*output_debug) (gchar *);
4224 static gboolean tried_loading = FALSE;
4226 MONO_ARCH_SAVE_REGS;
4228 if (!tried_loading && output_debug == NULL) {
4231 tried_loading = TRUE;
4232 k32 = g_module_open ("kernel32", G_MODULE_BIND_LAZY);
4234 gchar *error = g_strdup (g_module_error ());
4235 g_warning ("Failed to load kernel32.dll: %s\n", error);
4240 g_module_symbol (k32, "OutputDebugStringW", (gpointer *) &output_debug);
4241 if (!output_debug) {
4242 gchar *error = g_strdup (g_module_error ());
4243 g_warning ("Failed to load OutputDebugStringW: %s\n", error);
4249 if (output_debug == NULL)
4252 output_debug (mono_string_chars (message));
4254 g_warning ("WriteWindowsDebugString called and PLATFORM_WIN32 not defined!\n");
4258 /* Only used for value types */
4260 ves_icall_System_Activator_CreateInstanceInternal (MonoReflectionType *type)
4265 MONO_ARCH_SAVE_REGS;
4267 domain = mono_object_domain (type);
4268 klass = mono_class_from_mono_type (type->type);
4270 return mono_object_new (domain, klass);
4273 static MonoReflectionMethod *
4274 ves_icall_MonoMethod_get_base_definition (MonoReflectionMethod *m)
4277 MonoMethod *method = m->method;
4278 MonoMethod *result = NULL;
4280 MONO_ARCH_SAVE_REGS;
4282 if (!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
4283 method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ||
4284 method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
4287 if (method->klass == NULL || (klass = method->klass->parent) == NULL)
4290 while (result == NULL && klass != NULL && (klass->vtable_size > method->slot))
4292 result = klass->vtable [method->slot];
4293 if (result == NULL) {
4294 /* It is an abstract method */
4296 for (i=0; i<klass->method.count; i++) {
4297 if (klass->methods [i]->slot == method->slot) {
4298 result = klass->methods [i];
4303 klass = klass->parent;
4309 return mono_method_get_object (mono_domain_get (), result, NULL);
4313 mono_ArgIterator_Setup (MonoArgIterator *iter, char* argsp, char* start)
4315 MONO_ARCH_SAVE_REGS;
4317 iter->sig = *(MonoMethodSignature**)argsp;
4319 g_assert (iter->sig->sentinelpos <= iter->sig->param_count);
4320 g_assert (iter->sig->call_convention == MONO_CALL_VARARG);
4323 /* FIXME: it's not documented what start is exactly... */
4324 iter->args = start? start: argsp + sizeof (gpointer);
4325 iter->num_args = iter->sig->param_count - iter->sig->sentinelpos;
4327 // g_print ("sig %p, param_count: %d, sent: %d\n", iter->sig, iter->sig->param_count, iter->sig->sentinelpos);
4331 mono_ArgIterator_IntGetNextArg (MonoArgIterator *iter)
4333 gint i, align, arg_size;
4335 MONO_ARCH_SAVE_REGS;
4337 i = iter->sig->sentinelpos + iter->next_arg;
4339 g_assert (i < iter->sig->param_count);
4341 res.type = iter->sig->params [i];
4342 res.klass = mono_class_from_mono_type (res.type);
4343 /* FIXME: endianess issue... */
4344 res.value = iter->args;
4345 arg_size = mono_type_stack_size (res.type, &align);
4346 iter->args = (char*)iter->args + arg_size;
4349 //g_print ("returning arg %d, type 0x%02x of size %d at %p\n", i, res.type->type, arg_size, res.value);
4355 mono_ArgIterator_IntGetNextArgT (MonoArgIterator *iter, MonoType *type)
4357 gint i, align, arg_size;
4359 MONO_ARCH_SAVE_REGS;
4361 i = iter->sig->sentinelpos + iter->next_arg;
4363 g_assert (i < iter->sig->param_count);
4365 while (i < iter->sig->param_count) {
4366 if (!mono_metadata_type_equal (type, iter->sig->params [i]))
4368 res.type = iter->sig->params [i];
4369 res.klass = mono_class_from_mono_type (res.type);
4370 /* FIXME: endianess issue... */
4371 res.value = iter->args;
4372 arg_size = mono_type_stack_size (res.type, &align);
4373 iter->args = (char*)iter->args + arg_size;
4375 //g_print ("returning arg %d, type 0x%02x of size %d at %p\n", i, res.type->type, arg_size, res.value);
4378 //g_print ("arg type 0x%02x not found\n", res.type->type);
4387 mono_ArgIterator_IntGetNextArgType (MonoArgIterator *iter)
4390 MONO_ARCH_SAVE_REGS;
4392 i = iter->sig->sentinelpos + iter->next_arg;
4394 g_assert (i < iter->sig->param_count);
4396 return iter->sig->params [i];
4400 mono_TypedReference_ToObject (MonoTypedRef tref)
4402 MONO_ARCH_SAVE_REGS;
4404 if (MONO_TYPE_IS_REFERENCE (tref.type)) {
4405 MonoObject** objp = tref.value;
4409 return mono_value_box (mono_domain_get (), tref.klass, tref.value);
4413 prelink_method (MonoMethod *method)
4415 const char *exc_class, *exc_arg;
4416 if (!(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
4418 mono_lookup_pinvoke_call (method, &exc_class, &exc_arg);
4420 mono_raise_exception(
4421 mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg ) );
4423 /* create the wrapper, too? */
4427 ves_icall_System_Runtime_InteropServices_Marshal_Prelink (MonoReflectionMethod *method)
4429 MONO_ARCH_SAVE_REGS;
4430 prelink_method (method->method);
4434 ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionType *type)
4436 MonoClass *klass = mono_class_from_mono_type (type->type);
4438 MONO_ARCH_SAVE_REGS;
4440 mono_class_init (klass);
4441 for (i = 0; i < klass->method.count; ++i)
4442 prelink_method (klass->methods [i]);
4447 static gconstpointer icall_map [] = {
4451 "System.Array::GetValue", ves_icall_System_Array_GetValue,
4452 "System.Array::SetValue", ves_icall_System_Array_SetValue,
4453 "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
4454 "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
4455 "System.Array::GetRank", ves_icall_System_Array_GetRank,
4456 "System.Array::GetLength", ves_icall_System_Array_GetLength,
4457 "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
4458 "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
4459 "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
4460 "System.Array::Clone", mono_array_clone,
4463 * System.ArgIterator
4465 "System.ArgIterator::Setup", mono_ArgIterator_Setup,
4466 "System.ArgIterator::IntGetNextArg()", mono_ArgIterator_IntGetNextArg,
4467 "System.ArgIterator::IntGetNextArg(intptr)", mono_ArgIterator_IntGetNextArgT,
4468 "System.ArgIterator::IntGetNextArgType", mono_ArgIterator_IntGetNextArgType,
4471 * System.TypedReference
4473 "System.TypedReference::ToObject", mono_TypedReference_ToObject,
4478 "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
4479 "System.Object::GetType", ves_icall_System_Object_GetType,
4480 "System.Object::InternalGetHashCode", ves_icall_System_Object_GetHashCode,
4481 "System.Object::obj_address", ves_icall_System_Object_obj_address,
4486 "System.ValueType::InternalGetHashCode", ves_icall_System_ValueType_InternalGetHashCode,
4487 "System.ValueType::InternalEquals", ves_icall_System_ValueType_Equals,
4493 "System.String::.ctor(char*)", ves_icall_System_String_ctor_charp,
4494 "System.String::.ctor(char*,int,int)", ves_icall_System_String_ctor_charp_int_int,
4495 "System.String::.ctor(sbyte*)", ves_icall_System_String_ctor_sbytep,
4496 "System.String::.ctor(sbyte*,int,int)", ves_icall_System_String_ctor_sbytep_int_int,
4497 "System.String::.ctor(sbyte*,int,int,System.Text.Encoding)", ves_icall_System_String_ctor_encoding,
4498 "System.String::.ctor(char[])", ves_icall_System_String_ctor_chara,
4499 "System.String::.ctor(char[],int,int)", ves_icall_System_String_ctor_chara_int_int,
4500 "System.String::.ctor(char,int)", ves_icall_System_String_ctor_char_int,
4501 "System.String::InternalJoin", ves_icall_System_String_InternalJoin,
4502 "System.String::InternalInsert", ves_icall_System_String_InternalInsert,
4503 "System.String::InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char,
4504 "System.String::InternalRemove", ves_icall_System_String_InternalRemove,
4505 "System.String::InternalCopyTo", ves_icall_System_String_InternalCopyTo,
4506 "System.String::InternalSplit", ves_icall_System_String_InternalSplit,
4507 "System.String::InternalTrim", ves_icall_System_String_InternalTrim,
4508 "System.String::InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny,
4509 "System.String::InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny,
4510 "System.String::InternalPad", ves_icall_System_String_InternalPad,
4511 "System.String::InternalAllocateStr", ves_icall_System_String_InternalAllocateStr,
4512 "System.String::InternalStrcpy(string,int,string)", ves_icall_System_String_InternalStrcpy_Str,
4513 "System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
4514 "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
4515 "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
4516 "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
4517 "System.String::get_Chars", ves_icall_System_String_get_Chars,
4522 "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
4523 "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
4524 "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
4525 "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
4526 "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
4527 "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
4528 "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
4529 "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
4530 "System.AppDomain::LoadAssemblyRaw", ves_icall_System_AppDomain_LoadAssemblyRaw,
4531 "System.AppDomain::InternalIsFinalizingForUnload", ves_icall_System_AppDomain_InternalIsFinalizingForUnload,
4532 "System.AppDomain::InternalUnload", ves_icall_System_AppDomain_InternalUnload,
4533 "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
4534 "System.AppDomain::InternalSetDomain", ves_icall_System_AppDomain_InternalSetDomain,
4535 "System.AppDomain::InternalSetDomainByID", ves_icall_System_AppDomain_InternalSetDomainByID,
4536 "System.AppDomain::InternalPushDomainRef", ves_icall_System_AppDomain_InternalPushDomainRef,
4537 "System.AppDomain::InternalPushDomainRefByID", ves_icall_System_AppDomain_InternalPushDomainRefByID,
4538 "System.AppDomain::InternalPopDomainRef", ves_icall_System_AppDomain_InternalPopDomainRef,
4539 "System.AppDomain::InternalSetContext", ves_icall_System_AppDomain_InternalSetContext,
4540 "System.AppDomain::InternalGetContext", ves_icall_System_AppDomain_InternalGetContext,
4541 "System.AppDomain::InternalGetDefaultContext", ves_icall_System_AppDomain_InternalGetDefaultContext,
4542 "System.AppDomain::InternalGetProcessGuid", ves_icall_System_AppDomain_InternalGetProcessGuid,
4545 * System.AppDomainSetup
4547 "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
4552 "System.Double::ParseImpl", mono_double_ParseImpl,
4553 "System.Double::AssertEndianity", ves_icall_System_Double_AssertEndianity,
4558 "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
4559 "System.Decimal::decimal2Int64", mono_decimal2Int64,
4560 "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
4561 "System.Decimal::decimalIncr", mono_decimalIncr,
4562 "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
4563 "System.Decimal::decimal2double", mono_decimal2double,
4564 "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
4565 "System.Decimal::decimalRound", mono_decimalRound,
4566 "System.Decimal::decimalMult", mono_decimalMult,
4567 "System.Decimal::decimalDiv", mono_decimalDiv,
4568 "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
4569 "System.Decimal::decimalCompare", mono_decimalCompare,
4570 "System.Decimal::string2decimal", mono_string2decimal,
4571 "System.Decimal::decimal2string", mono_decimal2string,
4576 "System.Reflection.Emit.ModuleBuilder::getUSIndex", mono_image_insert_string,
4577 "System.Reflection.Emit.ModuleBuilder::getToken", ves_icall_ModuleBuilder_getToken,
4578 "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
4579 "System.Reflection.Emit.ModuleBuilder::basic_init", mono_image_module_basic_init,
4580 "System.Reflection.Emit.ModuleBuilder::build_metadata", ves_icall_ModuleBuilder_build_metadata,
4581 "System.Reflection.Emit.ModuleBuilder::getDataChunk", ves_icall_ModuleBuilder_getDataChunk,
4586 "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
4587 "System.Reflection.Emit.AssemblyBuilder::InternalAddModule", mono_image_load_module,
4592 "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
4593 "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
4594 "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
4595 "System.Reflection.MonoEventInfo::get_event_info", ves_icall_get_event_info,
4596 "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
4597 "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
4598 "System.Reflection.MethodBase::GetCurrentMethod", ves_icall_GetCurrentMethod,
4599 "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
4600 "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
4601 "System.Reflection.MonoField::GetParentType", ves_icall_MonoField_GetParentType,
4602 "System.Reflection.MonoField::GetValueInternal", ves_icall_MonoField_GetValueInternal,
4603 "System.Reflection.MonoField::SetValueInternal", ves_icall_FieldInfo_SetValueInternal,
4604 "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
4605 "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
4607 "System.RuntimeMethodHandle::GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer,
4608 "System.Reflection.MonoMethod::get_base_definition", ves_icall_MonoMethod_get_base_definition,
4612 "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
4613 "System.Enum::get_value", ves_icall_System_Enum_get_value,
4614 "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
4619 "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
4620 "System.Reflection.Emit.TypeBuilder::create_internal_class", mono_reflection_create_internal_class,
4621 "System.Reflection.Emit.TypeBuilder::create_runtime_class", mono_reflection_create_runtime_class,
4622 "System.Reflection.Emit.TypeBuilder::setup_generic_class", mono_reflection_setup_generic_class,
4627 "System.Reflection.Emit.DynamicMethod::create_dynamic_method", mono_reflection_create_dynamic_method,
4630 * TypeBuilder generics icalls.
4632 "System.Reflection.Emit.TypeBuilder::get_IsGenericParameter", ves_icall_TypeBuilder_get_IsGenericParameter,
4633 "System.Reflection.Emit.TypeBuilder::define_generic_parameter", ves_icall_TypeBuilder_define_generic_parameter,
4636 * MethodBuilder generic icalls.
4638 "System.Reflection.Emit.MethodBuilder::define_generic_parameter", ves_icall_MethodBuilder_define_generic_parameter,
4641 * MonoGenericInst generic icalls.
4643 "System.Reflection.MonoGenericInst::inflate_method", mono_reflection_inflate_method_or_ctor,
4644 "System.Reflection.MonoGenericInst::inflate_ctor", mono_reflection_inflate_method_or_ctor,
4645 "System.Reflection.MonoGenericInst::inflate_field", mono_reflection_inflate_field,
4646 "System.Reflection.MonoGenericParam::initialize", ves_icall_MonoGenericParam_initialize,
4651 "System.Type::internal_from_name", ves_icall_type_from_name,
4652 "System.Type::internal_from_handle", ves_icall_type_from_handle,
4653 "System.MonoType::get_attributes", ves_icall_get_attributes,
4654 "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
4655 "System.Type::type_is_assignable_from", ves_icall_type_is_assignable_from,
4656 "System.Type::IsInstanceOfType", ves_icall_type_IsInstanceOfType,
4657 "System.Type::Equals", ves_icall_type_Equals,
4658 "System.Type::GetTypeCode", ves_icall_type_GetTypeCode,
4659 "System.Type::GetInterfaceMapData", ves_icall_Type_GetInterfaceMapData,
4660 "System.Type::IsArrayImpl", ves_icall_Type_IsArrayImpl,
4661 "System.Type::make_array_type", ves_icall_Type_make_array_type,
4662 "System.Type::make_byref_type", ves_icall_Type_make_byref_type,
4664 /* Type generics icalls */
4665 "System.Type::GetGenericArguments", ves_icall_Type_GetGenericArguments,
4666 "System.Type::GetGenericParameterPosition", ves_icall_Type_GetGenericParameterPosition,
4667 "System.Type::get_IsGenericTypeDefinition", ves_icall_Type_get_IsGenericTypeDefinition,
4668 "System.Type::GetGenericTypeDefinition_impl", ves_icall_Type_GetGenericTypeDefinition_impl,
4669 "System.Type::BindGenericParameters", ves_icall_Type_BindGenericParameters,
4670 "System.Type::get_IsGenericInstance", ves_icall_Type_get_IsGenericInstance,
4672 "System.MonoType::get_HasGenericArguments", ves_icall_MonoType_get_HasGenericArguments,
4673 "System.MonoType::get_IsGenericParameter", ves_icall_MonoType_get_IsGenericParameter,
4674 "System.MonoType::get_DeclaringMethod", ves_icall_MonoType_get_DeclaringMethod,
4676 /* Method generics icalls */
4677 "System.Reflection.MethodInfo::get_IsGenericMethodDefinition", ves_icall_MethodInfo_get_IsGenericMethodDefinition,
4678 "System.Reflection.MethodInfo::BindGenericParameters", mono_reflection_bind_generic_method_parameters,
4679 "System.Reflection.MonoMethod::GetGenericArguments", ves_icall_MonoMethod_GetGenericArguments,
4683 * System.Reflection.FieldInfo
4685 "System.Reflection.FieldInfo::internal_from_handle", ves_icall_System_Reflection_FieldInfo_internal_from_handle,
4688 * System.Runtime.CompilerServices.RuntimeHelpers
4690 "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray,
4691 "System.Runtime.CompilerServices.RuntimeHelpers::GetOffsetToStringData", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData,
4692 "System.Runtime.CompilerServices.RuntimeHelpers::GetObjectValue", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue,
4693 "System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor,
4698 "System.Threading.Thread::Abort_internal(object)", ves_icall_System_Threading_Thread_Abort,
4699 "System.Threading.Thread::ResetAbort_internal()", ves_icall_System_Threading_Thread_ResetAbort,
4700 "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
4701 "System.Threading.Thread::Thread_free_internal", ves_icall_System_Threading_Thread_Thread_free_internal,
4702 "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
4703 "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
4704 "System.Threading.Thread::CurrentThread_internal", mono_thread_current,
4705 "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
4706 "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
4707 "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
4708 "System.Threading.Thread::GetDomainID", ves_icall_System_Threading_Thread_GetDomainID,
4709 "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
4710 "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
4711 "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
4712 "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
4713 "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
4714 "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
4715 "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
4716 "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
4717 "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
4718 "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
4719 "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
4720 "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
4721 "System.Threading.NativeEventCalls::CloseEvent_internal", ves_icall_System_Threading_Events_CloseEvent_internal,
4722 "System.Threading.ThreadPool::GetAvailableThreads", ves_icall_System_Threading_ThreadPool_GetAvailableThreads,
4723 "System.Threading.ThreadPool::GetMaxThreads", ves_icall_System_Threading_ThreadPool_GetMaxThreads,
4724 "System.Threading.Thread::VolatileRead(byte&)", ves_icall_System_Threading_Thread_VolatileRead1,
4725 "System.Threading.Thread::VolatileRead(double&)", ves_icall_System_Threading_Thread_VolatileRead8,
4726 "System.Threading.Thread::VolatileRead(short&)", ves_icall_System_Threading_Thread_VolatileRead2,
4727 "System.Threading.Thread::VolatileRead(int&)", ves_icall_System_Threading_Thread_VolatileRead4,
4728 "System.Threading.Thread::VolatileRead(long&)", ves_icall_System_Threading_Thread_VolatileRead8,
4729 "System.Threading.Thread::VolatileRead(IntPtr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr,
4730 "System.Threading.Thread::VolatileRead(object&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr,
4731 "System.Threading.Thread::VolatileRead(sbyte&)", ves_icall_System_Threading_Thread_VolatileRead1,
4732 "System.Threading.Thread::VolatileRead(float&)", ves_icall_System_Threading_Thread_VolatileRead4,
4733 "System.Threading.Thread::VolatileRead(ushort&)", ves_icall_System_Threading_Thread_VolatileRead2,
4734 "System.Threading.Thread::VolatileRead(uint&)", ves_icall_System_Threading_Thread_VolatileRead2,
4735 "System.Threading.Thread::VolatileRead(ulong&)", ves_icall_System_Threading_Thread_VolatileRead8,
4736 "System.Threading.Thread::VolatileRead(UIntPtr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr,
4737 "System.Threading.Thread::VolatileWrite(byte&,byte)", ves_icall_System_Threading_Thread_VolatileWrite1,
4738 "System.Threading.Thread::VolatileWrite(double&,double)", ves_icall_System_Threading_Thread_VolatileWrite8,
4739 "System.Threading.Thread::VolatileWrite(short&,short)", ves_icall_System_Threading_Thread_VolatileWrite2,
4740 "System.Threading.Thread::VolatileWrite(int&,int)", ves_icall_System_Threading_Thread_VolatileWrite4,
4741 "System.Threading.Thread::VolatileWrite(long&,long)", ves_icall_System_Threading_Thread_VolatileWrite8,
4742 "System.Threading.Thread::VolatileWrite(IntPtr&,IntPtr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr,
4743 "System.Threading.Thread::VolatileWrite(object&,object)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr,
4744 "System.Threading.Thread::VolatileWrite(sbyte&,sbyte)", ves_icall_System_Threading_Thread_VolatileWrite1,
4745 "System.Threading.Thread::VolatileWrite(float&,float)", ves_icall_System_Threading_Thread_VolatileWrite4,
4746 "System.Threading.Thread::VolatileWrite(ushort&,ushort)", ves_icall_System_Threading_Thread_VolatileWrite2,
4747 "System.Threading.Thread::VolatileWrite(uint&,uint)", ves_icall_System_Threading_Thread_VolatileWrite2,
4748 "System.Threading.Thread::VolatileWrite(ulong&,ulong)", ves_icall_System_Threading_Thread_VolatileWrite8,
4749 "System.Threading.Thread::VolatileWrite(UIntPtr&,UIntPtr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr,
4752 * System.Threading.WaitHandle
4754 "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
4755 "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
4756 "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
4759 * System.Runtime.InteropServices.Marshal
4761 "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
4762 "System.Runtime.InteropServices.Marshal::ReadByte", ves_icall_System_Runtime_InteropServices_Marshal_ReadByte,
4763 "System.Runtime.InteropServices.Marshal::ReadInt16", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16,
4764 "System.Runtime.InteropServices.Marshal::ReadInt32", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32,
4765 "System.Runtime.InteropServices.Marshal::ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64,
4766 "System.Runtime.InteropServices.Marshal::WriteIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr,
4767 "System.Runtime.InteropServices.Marshal::WriteByte", ves_icall_System_Runtime_InteropServices_Marshal_WriteByte,
4768 "System.Runtime.InteropServices.Marshal::WriteInt16", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16,
4769 "System.Runtime.InteropServices.Marshal::WriteInt32", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32,
4770 "System.Runtime.InteropServices.Marshal::WriteInt64", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64,
4772 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
4773 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
4774 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
4775 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
4776 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni,
4777 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len,
4778 "System.Runtime.InteropServices.Marshal::PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR,
4780 "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
4781 "System.Runtime.InteropServices.Marshal::AllocHGlobal", mono_marshal_alloc,
4782 "System.Runtime.InteropServices.Marshal::FreeHGlobal", mono_marshal_free,
4783 "System.Runtime.InteropServices.Marshal::ReAllocHGlobal", mono_marshal_realloc,
4784 "System.Runtime.InteropServices.Marshal::AllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem,
4785 "System.Runtime.InteropServices.Marshal::FreeCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem,
4786 "System.Runtime.InteropServices.Marshal::copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged,
4787 "System.Runtime.InteropServices.Marshal::copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged,
4788 "System.Runtime.InteropServices.Marshal::SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf,
4789 "System.Runtime.InteropServices.Marshal::StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr,
4790 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure,
4791 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type,
4792 "System.Runtime.InteropServices.Marshal::OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf,
4793 "System.Runtime.InteropServices.Marshal::StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
4794 "System.Runtime.InteropServices.Marshal::StringToHGlobalAuto", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
4795 "System.Runtime.InteropServices.Marshal::StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni,
4796 "System.Runtime.InteropServices.Marshal::DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure,
4797 "System.Runtime.InteropServices.Marshal::Prelink", ves_icall_System_Runtime_InteropServices_Marshal_Prelink,
4798 "System.Runtime.InteropServices.Marshal::PrelinkAll", ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll,
4801 "System.Reflection.Assembly::LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom,
4802 "System.Reflection.Assembly::InternalGetType", ves_icall_System_Reflection_Assembly_InternalGetType,
4803 "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
4804 "System.Reflection.Assembly::FillName", ves_icall_System_Reflection_Assembly_FillName,
4805 "System.Reflection.Assembly::InternalGetAssemblyName", ves_icall_System_Reflection_Assembly_InternalGetAssemblyName,
4806 "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
4807 "System.Reflection.Assembly::get_location", ves_icall_System_Reflection_Assembly_get_location,
4808 "System.Reflection.Assembly::InternalImageRuntimeVersion", ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion,
4809 "System.Reflection.Assembly::GetExecutingAssembly", ves_icall_System_Reflection_Assembly_GetExecutingAssembly,
4810 "System.Reflection.Assembly::GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly,
4811 "System.Reflection.Assembly::GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly,
4812 "System.Reflection.Assembly::get_EntryPoint", ves_icall_System_Reflection_Assembly_get_EntryPoint,
4813 "System.Reflection.Assembly::GetManifestResourceNames", ves_icall_System_Reflection_Assembly_GetManifestResourceNames,
4814 "System.Reflection.Assembly::GetManifestResourceInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInternal,
4815 "System.Reflection.Assembly::GetManifestResourceInfoInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal,
4816 "System.Reflection.Assembly::GetFilesInternal", ves_icall_System_Reflection_Assembly_GetFilesInternal,
4817 "System.Reflection.Assembly::GetReferencedAssemblies", ves_icall_System_Reflection_Assembly_GetReferencedAssemblies,
4818 "System.Reflection.Assembly::GetNamespaces", ves_icall_System_Reflection_Assembly_GetNamespaces,
4819 "System.Reflection.Assembly::GetModulesInternal", ves_icall_System_Reflection_Assembly_GetModulesInternal,
4822 * System.Reflection.Module
4824 "System.Reflection.Module::GetGlobalType", ves_icall_System_Reflection_Module_GetGlobalType,
4825 "System.Reflection.Module::Close", ves_icall_System_Reflection_Module_Close,
4826 "System.Reflection.Module::GetGuidInternal", ves_icall_System_Reflection_Module_GetGuidInternal,
4827 "System.Reflection.Module::InternalGetTypes", ves_icall_System_Reflection_Module_InternalGetTypes,
4832 "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
4833 "System.MonoType::type_from_obj", mono_type_type_from_obj,
4834 "System.MonoType::GetElementType", ves_icall_MonoType_GetElementType,
4835 "System.MonoType::GetArrayRank", ves_icall_MonoType_GetArrayRank,
4836 "System.MonoType::get_BaseType", ves_icall_get_type_parent,
4837 "System.MonoType::get_Module", ves_icall_MonoType_get_Module,
4838 "System.MonoType::get_Assembly", ves_icall_MonoType_get_Assembly,
4839 "System.MonoType::get_DeclaringType", ves_icall_MonoType_get_DeclaringType,
4840 "System.MonoType::get_UnderlyingSystemType", ves_icall_MonoType_get_UnderlyingSystemType,
4841 "System.MonoType::get_Name", ves_icall_MonoType_get_Name,
4842 "System.MonoType::get_Namespace", ves_icall_MonoType_get_Namespace,
4843 "System.MonoType::IsPointerImpl", ves_icall_type_ispointer,
4844 "System.MonoType::IsPrimitiveImpl", ves_icall_type_isprimitive,
4845 "System.MonoType::IsByRefImpl", ves_icall_type_isbyref,
4846 "System.MonoType::GetField", ves_icall_Type_GetField,
4847 "System.MonoType::GetFields", ves_icall_Type_GetFields,
4848 "System.MonoType::GetMethodsByName", ves_icall_Type_GetMethodsByName,
4849 "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
4850 "System.MonoType::GetPropertiesByName", ves_icall_Type_GetPropertiesByName,
4851 "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
4852 "System.MonoType::InternalGetEvent", ves_icall_MonoType_GetEvent,
4853 "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
4854 "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
4855 "System.MonoType::GetNestedType", ves_icall_Type_GetNestedType,
4858 * System.Net.Sockets I/O Services
4860 "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
4861 "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
4862 "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
4863 "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
4864 "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
4865 "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
4866 "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
4867 "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
4868 "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
4869 "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
4870 "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
4871 "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
4872 "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
4873 "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
4874 "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
4875 "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
4876 "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
4877 "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
4878 "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
4879 "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
4880 "System.Net.Dns::GetHostByName_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByName_internal,
4881 "System.Net.Dns::GetHostByAddr_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByAddr_internal,
4882 "System.Net.Dns::GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal,
4887 "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
4888 "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
4889 "System.Char::IsControl", ves_icall_System_Char_IsControl,
4890 "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
4891 "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
4892 "System.Char::IsLower", ves_icall_System_Char_IsLower,
4893 "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
4894 "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
4895 "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
4896 "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
4897 "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
4898 "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
4899 "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
4900 "System.Char::ToLower", ves_icall_System_Char_ToLower,
4901 "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
4904 * System.Text.Encoding
4906 "System.Text.Encoding::InternalCodePage", ves_icall_System_Text_Encoding_InternalCodePage,
4908 "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
4909 "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
4914 "System.GC::InternalCollect", ves_icall_System_GC_InternalCollect,
4915 "System.GC::GetTotalMemory", ves_icall_System_GC_GetTotalMemory,
4916 "System.GC::KeepAlive", ves_icall_System_GC_KeepAlive,
4917 "System.GC::ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize,
4918 "System.GC::SuppressFinalize", ves_icall_System_GC_SuppressFinalize,
4919 "System.GC::WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers,
4920 "System.Runtime.InteropServices.GCHandle::GetTarget", ves_icall_System_GCHandle_GetTarget,
4921 "System.Runtime.InteropServices.GCHandle::GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle,
4922 "System.Runtime.InteropServices.GCHandle::FreeHandle", ves_icall_System_GCHandle_FreeHandle,
4923 "System.Runtime.InteropServices.GCHandle::GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject,
4926 * System.Security.Cryptography calls
4929 "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes,
4934 "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
4935 "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
4936 "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
4937 "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
4942 "System.IO.MonoIO::CreateDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CreateDirectory,
4943 "System.IO.MonoIO::RemoveDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_RemoveDirectory,
4944 "System.IO.MonoIO::FindFirstFile(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindFirstFile,
4945 "System.IO.MonoIO::FindNextFile(intptr,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindNextFile,
4946 "System.IO.MonoIO::FindClose(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindClose,
4947 "System.IO.MonoIO::GetCurrentDirectory(System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
4948 "System.IO.MonoIO::SetCurrentDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
4949 "System.IO.MonoIO::MoveFile(string,string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile,
4950 "System.IO.MonoIO::CopyFile(string,string,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CopyFile,
4951 "System.IO.MonoIO::DeleteFile(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_DeleteFile,
4952 "System.IO.MonoIO::GetFileAttributes(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileAttributes,
4953 "System.IO.MonoIO::SetFileAttributes(string,System.IO.FileAttributes,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileAttributes,
4954 "System.IO.MonoIO::GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType,
4955 "System.IO.MonoIO::GetFileStat(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat,
4956 "System.IO.MonoIO::Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open,
4957 "System.IO.MonoIO::Close(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Close,
4958 "System.IO.MonoIO::Read(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Read,
4959 "System.IO.MonoIO::Write(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Write,
4960 "System.IO.MonoIO::Seek(intptr,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek,
4961 "System.IO.MonoIO::GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength,
4962 "System.IO.MonoIO::SetLength(intptr,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetLength,
4963 "System.IO.MonoIO::SetFileTime(intptr,long,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileTime,
4964 "System.IO.MonoIO::Flush(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Flush,
4965 "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
4966 "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
4967 "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
4968 "System.IO.MonoIO::CreatePipe(intptr&,intptr&)", ves_icall_System_IO_MonoIO_CreatePipe,
4969 "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
4970 "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
4971 "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
4972 "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
4973 "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
4974 "System.IO.MonoIO::GetTempPath(string&)", ves_icall_System_IO_MonoIO_GetTempPath,
4979 "System.Math::Floor", ves_icall_System_Math_Floor,
4980 "System.Math::Round", ves_icall_System_Math_Round,
4981 "System.Math::Round2", ves_icall_System_Math_Round2,
4982 "System.Math::Sin", ves_icall_System_Math_Sin,
4983 "System.Math::Cos", ves_icall_System_Math_Cos,
4984 "System.Math::Tan", ves_icall_System_Math_Tan,
4985 "System.Math::Sinh", ves_icall_System_Math_Sinh,
4986 "System.Math::Cosh", ves_icall_System_Math_Cosh,
4987 "System.Math::Tanh", ves_icall_System_Math_Tanh,
4988 "System.Math::Acos", ves_icall_System_Math_Acos,
4989 "System.Math::Asin", ves_icall_System_Math_Asin,
4990 "System.Math::Atan", ves_icall_System_Math_Atan,
4991 "System.Math::Atan2", ves_icall_System_Math_Atan2,
4992 "System.Math::Exp", ves_icall_System_Math_Exp,
4993 "System.Math::Log", ves_icall_System_Math_Log,
4994 "System.Math::Log10", ves_icall_System_Math_Log10,
4995 "System.Math::Pow", ves_icall_System_Math_Pow,
4996 "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
4999 * System.Environment
5001 "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
5002 "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
5003 "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
5004 "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
5005 "System.Environment::GetCommandLineArgs", mono_runtime_get_main_args,
5006 "System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
5007 "System.Environment::Exit", ves_icall_System_Environment_Exit,
5008 "System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
5009 "System.Environment::get_HasShutdownStarted", ves_icall_System_Environment_get_HasShutdownStarted,
5010 "System.Environment::get_ExitCode", mono_environment_exitcode_get,
5011 "System.Environment::set_ExitCode", mono_environment_exitcode_set,
5012 "System.Environment::GetMachineConfigPath", ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
5013 "System.Environment::internalGetGacPath", ves_icall_System_Environment_GetGacPath,
5016 * System.Runtime.Remoting
5018 "System.Runtime.Remoting.RemotingServices::InternalExecute",
5019 ves_icall_InternalExecute,
5020 "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
5021 ves_icall_IsTransparentProxy,
5024 * System.Runtime.Remoting.Activation
5026 "System.Runtime.Remoting.Activation.ActivationServices::AllocateUninitializedClassInstance",
5027 ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance,
5028 "System.Runtime.Remoting.Activation.ActivationServices::EnableProxyActivation",
5029 ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation,
5032 * System.Runtime.Remoting.Messaging
5034 "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
5035 ves_icall_MonoMethodMessage_InitMessage,
5038 * System.Runtime.Remoting.Proxies
5040 "System.Runtime.Remoting.Proxies.RealProxy::InternalGetTransparentProxy",
5041 ves_icall_Remoting_RealProxy_GetTransparentProxy,
5044 * System.Threading.Interlocked
5046 "System.Threading.Interlocked::Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int,
5047 "System.Threading.Interlocked::Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long,
5048 "System.Threading.Interlocked::Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int,
5049 "System.Threading.Interlocked::Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long,
5050 "System.Threading.Interlocked::CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int,
5051 "System.Threading.Interlocked::CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object,
5052 "System.Threading.Interlocked::CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single,
5053 "System.Threading.Interlocked::Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int,
5054 "System.Threading.Interlocked::Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object,
5055 "System.Threading.Interlocked::Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single,
5056 "System.Threading.Thread::current_lcid()", ves_icall_System_Threading_Thread_current_lcid,
5059 * System.Diagnostics.Process
5061 "System.Diagnostics.Process::GetProcess_internal(int)", ves_icall_System_Diagnostics_Process_GetProcess_internal,
5062 "System.Diagnostics.Process::GetProcesses_internal()", ves_icall_System_Diagnostics_Process_GetProcesses_internal,
5063 "System.Diagnostics.Process::GetPid_internal()", ves_icall_System_Diagnostics_Process_GetPid_internal,
5064 "System.Diagnostics.Process::Process_free_internal(intptr)", ves_icall_System_Diagnostics_Process_Process_free_internal,
5065 "System.Diagnostics.Process::GetModules_internal()", ves_icall_System_Diagnostics_Process_GetModules_internal,
5066 "System.Diagnostics.Process::Start_internal(string,string,intptr,intptr,intptr,System.Diagnostics.Process/ProcInfo&)", ves_icall_System_Diagnostics_Process_Start_internal,
5067 "System.Diagnostics.Process::WaitForExit_internal(intptr,int)", ves_icall_System_Diagnostics_Process_WaitForExit_internal,
5068 "System.Diagnostics.Process::ExitTime_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitTime_internal,
5069 "System.Diagnostics.Process::StartTime_internal(intptr)", ves_icall_System_Diagnostics_Process_StartTime_internal,
5070 "System.Diagnostics.Process::ExitCode_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitCode_internal,
5071 "System.Diagnostics.Process::ProcessName_internal(intptr)", ves_icall_System_Diagnostics_Process_ProcessName_internal,
5072 "System.Diagnostics.Process::GetWorkingSet_internal(intptr,int&,int&)", ves_icall_System_Diagnostics_Process_GetWorkingSet_internal,
5073 "System.Diagnostics.Process::SetWorkingSet_internal(intptr,int,int,bool)", ves_icall_System_Diagnostics_Process_SetWorkingSet_internal,
5074 "System.Diagnostics.FileVersionInfo::GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal,
5079 "System.Delegate::CreateDelegate_internal", ves_icall_System_Delegate_CreateDelegate_internal,
5084 "System.IO.Path::get_temp_path", ves_icall_System_IO_get_temp_path,
5087 * Private icalls for the Mono Debugger
5089 "System.Reflection.Assembly::MonoDebugger_GetMethod",
5090 ves_icall_MonoDebugger_GetMethod,
5092 "System.Reflection.Assembly::MonoDebugger_GetMethodToken",
5093 ves_icall_MonoDebugger_GetMethodToken,
5095 "System.Reflection.Assembly::MonoDebugger_GetLocalTypeFromSignature",
5096 ves_icall_MonoDebugger_GetLocalTypeFromSignature,
5098 "System.Reflection.Assembly::MonoDebugger_GetType",
5099 ves_icall_MonoDebugger_GetType,
5102 * System.Configuration
5104 "System.Configuration.DefaultConfig::get_machine_config_path",
5105 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
5108 * System.Diagnostics.DefaultTraceListener
5110 "System.Diagnostics.DefaultTraceListener::WriteWindowsDebugString",
5111 ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString,
5115 "System.Activator::CreateInstanceInternal",
5116 ves_icall_System_Activator_CreateInstanceInternal,
5121 "System.Web.Util.ICalls::GetMachineConfigPath",
5122 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
5124 "System.Web.Util.ICalls::GetMachineInstallDirectory",
5125 ves_icall_System_Web_Util_ICalls_get_machine_install_dir,
5128 * System.Globalization
5130 "System.Globalization.CultureInfo::construct_internal_locale(string)", ves_icall_System_Globalization_CultureInfo_construct_internal_locale,
5131 "System.Globalization.CompareInfo::construct_compareinfo(string)", ves_icall_System_Globalization_CompareInfo_construct_compareinfo,
5132 "System.Globalization.CompareInfo::internal_compare(string,int,int,string,int,int,System.Globalization.CompareOptions)", ves_icall_System_Globalization_CompareInfo_internal_compare,
5133 "System.Globalization.CompareInfo::free_internal_collator()", ves_icall_System_Globalization_CompareInfo_free_internal_collator,
5134 "System.Globalization.CompareInfo::assign_sortkey(object,string,System.Globalization.CompareOptions)", ves_icall_System_Globalization_CompareInfo_assign_sortkey,
5135 "System.Globalization.CompareInfo::internal_index(string,int,int,string,System.Globalization.CompareOptions,bool)", ves_icall_System_Globalization_CompareInfo_internal_index,
5136 "System.Globalization.CompareInfo::internal_index(string,int,int,char,System.Globalization.CompareOptions,bool)", ves_icall_System_Globalization_CompareInfo_internal_index_char,
5137 "System.String::InternalReplace(string,string,System.Globalization.CompareInfo)", ves_icall_System_String_InternalReplace_Str_Comp,
5138 "System.String::InternalToLower(System.Globalization.CultureInfo)", ves_icall_System_String_InternalToLower_Comp,
5139 "System.String::InternalToUpper(System.Globalization.CultureInfo)", ves_icall_System_String_InternalToUpper_Comp,
5142 * System.IO.FileSystemWatcher
5144 "System.IO.FileSystemWatcher::InternalSupportsFSW", ves_icall_System_IO_FSW_SupportsFSW,
5145 "System.IO.FileSystemWatcher::InternalOpenDirectory", ves_icall_System_IO_FSW_OpenDirectory,
5146 "System.IO.FileSystemWatcher::InternalCloseDirectory", ves_icall_System_IO_FSW_CloseDirectory,
5147 "System.IO.FileSystemWatcher::InternalReadDirectoryChanges", ves_icall_System_IO_FSW_ReadDirectoryChanges,
5149 * System.IO.FAMWatcher
5151 "System.IO.FAMWatcher::InternalFAMNextEvent", ves_icall_System_IO_FAMW_InternalFAMNextEvent,
5154 * add other internal calls here
5157 /* These will be deleted after the next release */
5158 "System.String::InternalEquals", ves_icall_System_String_InternalEquals,
5159 "System.String::InternalIndexOf(char,int,int)", ves_icall_System_String_InternalIndexOf_Char,
5160 "System.String::InternalIndexOf(string,int,int)", ves_icall_System_String_InternalIndexOf_Str,
5161 "System.String::InternalLastIndexOf(char,int,int)", ves_icall_System_String_InternalLastIndexOf_Char,
5162 "System.String::InternalLastIndexOf(string,int,int)", ves_icall_System_String_InternalLastIndexOf_Str,
5163 "System.String::InternalCompare(string,int,string,int,int,int)", ves_icall_System_String_InternalCompareStr_N,
5164 "System.String::InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str,
5165 "System.String::InternalToLower()", ves_icall_System_String_InternalToLower,
5166 "System.String::InternalToUpper()", ves_icall_System_String_InternalToUpper,
5167 "System.Globalization.CultureInfo::construct_compareinfo(object,string)", ves_icall_System_Globalization_CompareInfo_construct_compareinfo,
5173 mono_init_icall (void)
5178 while ((name = icall_map [i])) {
5179 mono_add_internal_call (name, icall_map [i+1]);