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/debug-mono-symfile.h>
41 #include <mono/metadata/process.h>
42 #include <mono/metadata/environment.h>
43 #include <mono/io-layer/io-layer.h>
44 #include <mono/utils/strtod.h>
46 #if defined (PLATFORM_WIN32)
51 static MonoReflectionAssembly* ves_icall_System_Reflection_Assembly_GetCallingAssembly (void);
55 mono_double_ToStringImpl (double value)
57 /* FIXME: Handle formats, etc. */
63 retVal = g_strdup_printf ("%.15g", value);
64 s = mono_string_new (mono_domain_get (), retVal);
70 * We expect a pointer to a char, not a string
73 mono_double_ParseImpl (char *ptr)
81 result = bsd_strtod (ptr, &endptr);
83 if (!*ptr || (endptr && *endptr))
84 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib,
92 mono_float_ToStringImpl (float value)
96 return mono_double_ToStringImpl (value);
100 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
109 ao = (MonoArray *)this;
110 ac = (MonoClass *)ao->obj.vtable->klass;
112 esize = mono_array_element_size (ac);
113 ea = (gpointer*)((char*)ao->vector + (pos * esize));
115 if (ac->element_class->valuetype)
116 return mono_value_box (this->vtable->domain, ac->element_class, ea);
122 ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
130 MONO_CHECK_ARG_NULL (idxs);
132 io = (MonoArray *)idxs;
133 ic = (MonoClass *)io->obj.vtable->klass;
135 ao = (MonoArray *)this;
136 ac = (MonoClass *)ao->obj.vtable->klass;
138 g_assert (ic->rank == 1);
139 if (io->bounds != NULL || io->max_length != ac->rank)
140 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
142 ind = (guint32 *)io->vector;
144 if (ao->bounds == NULL) {
145 if (*ind < 0 || *ind >= ao->max_length)
146 mono_raise_exception (mono_get_exception_index_out_of_range ());
148 return ves_icall_System_Array_GetValueImpl (this, *ind);
151 for (i = 0; i < ac->rank; i++)
152 if ((ind [i] < ao->bounds [i].lower_bound) ||
153 (ind [i] >= ao->bounds [i].length + ao->bounds [i].lower_bound))
154 mono_raise_exception (mono_get_exception_index_out_of_range ());
156 pos = ind [0] - ao->bounds [0].lower_bound;
157 for (i = 1; i < ac->rank; i++)
158 pos = pos*ao->bounds [i].length + ind [i] -
159 ao->bounds [i].lower_bound;
161 return ves_icall_System_Array_GetValueImpl (this, pos);
165 ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
167 MonoClass *ac, *vc, *ec;
178 vc = value->vtable->klass;
182 ac = this->obj.vtable->klass;
183 ec = ac->element_class;
185 esize = mono_array_element_size (ac);
186 ea = (gpointer*)((char*)this->vector + (pos * esize));
187 va = (gpointer*)((char*)value + sizeof (MonoObject));
190 memset (ea, 0, esize);
194 #define NO_WIDENING_CONVERSION G_STMT_START{\
195 mono_raise_exception (mono_get_exception_argument ( \
196 "value", "not a widening conversion")); \
199 #define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
200 if (esize < vsize + (extra)) \
201 mono_raise_exception (mono_get_exception_argument ( \
202 "value", "not a widening conversion")); \
205 #define INVALID_CAST G_STMT_START{\
206 mono_raise_exception (mono_get_exception_invalid_cast ()); \
209 /* Check element (destination) type. */
210 switch (ec->byval_arg.type) {
211 case MONO_TYPE_STRING:
212 switch (vc->byval_arg.type) {
213 case MONO_TYPE_STRING:
219 case MONO_TYPE_BOOLEAN:
220 switch (vc->byval_arg.type) {
221 case MONO_TYPE_BOOLEAN:
234 NO_WIDENING_CONVERSION;
241 if (!ec->valuetype) {
242 *ea = (gpointer)value;
246 if (mono_object_isinst (value, ec)) {
247 memcpy (ea, (char *)value + sizeof (MonoObject), esize);
254 vsize = mono_class_instance_size (vc) - sizeof (MonoObject);
257 g_message (G_STRLOC ": %d (%d) <= %d (%d)",
258 ec->byval_arg.type, esize,
259 vc->byval_arg.type, vsize);
262 #define ASSIGN_UNSIGNED(etype) G_STMT_START{\
263 switch (vc->byval_arg.type) { \
268 case MONO_TYPE_CHAR: \
269 CHECK_WIDENING_CONVERSION(0); \
270 *(etype *) ea = (etype) u64; \
272 /* You can't assign a signed value to an unsigned array. */ \
277 /* You can't assign a floating point number to an integer array. */ \
280 NO_WIDENING_CONVERSION; \
284 #define ASSIGN_SIGNED(etype) G_STMT_START{\
285 switch (vc->byval_arg.type) { \
290 CHECK_WIDENING_CONVERSION(0); \
291 *(etype *) ea = (etype) i64; \
293 /* You can assign an unsigned value to a signed array if the array's */ \
294 /* element size is larger than the value size. */ \
299 case MONO_TYPE_CHAR: \
300 CHECK_WIDENING_CONVERSION(1); \
301 *(etype *) ea = (etype) u64; \
303 /* You can't assign a floating point number to an integer array. */ \
306 NO_WIDENING_CONVERSION; \
310 #define ASSIGN_REAL(etype) G_STMT_START{\
311 switch (vc->byval_arg.type) { \
314 CHECK_WIDENING_CONVERSION(0); \
315 *(etype *) ea = (etype) r64; \
317 /* All integer values fit into a floating point array, so we don't */ \
318 /* need to CHECK_WIDENING_CONVERSION here. */ \
323 *(etype *) ea = (etype) i64; \
329 case MONO_TYPE_CHAR: \
330 *(etype *) ea = (etype) u64; \
335 switch (vc->byval_arg.type) {
337 u64 = *(guint8 *) va;
340 u64 = *(guint16 *) va;
343 u64 = *(guint32 *) va;
346 u64 = *(guint64 *) va;
352 i64 = *(gint16 *) va;
355 i64 = *(gint32 *) va;
358 i64 = *(gint64 *) va;
361 r64 = *(gfloat *) va;
364 r64 = *(gdouble *) va;
367 u64 = *(guint16 *) va;
369 case MONO_TYPE_BOOLEAN:
370 /* Boolean is only compatible with itself. */
371 switch (ec->byval_arg.type) {
383 NO_WIDENING_CONVERSION;
390 /* If we can't do a direct copy, let's try a widening conversion. */
391 switch (ec->byval_arg.type) {
393 ASSIGN_UNSIGNED (guint16);
395 ASSIGN_UNSIGNED (guint8);
397 ASSIGN_UNSIGNED (guint16);
399 ASSIGN_UNSIGNED (guint32);
401 ASSIGN_UNSIGNED (guint64);
403 ASSIGN_SIGNED (gint8);
405 ASSIGN_SIGNED (gint16);
407 ASSIGN_SIGNED (gint32);
409 ASSIGN_SIGNED (gint64);
411 ASSIGN_REAL (gfloat);
413 ASSIGN_REAL (gdouble);
417 /* Not reached, INVALID_CAST does not return. Just to avoid a compiler warning ... */
421 #undef NO_WIDENING_CONVERSION
422 #undef CHECK_WIDENING_CONVERSION
423 #undef ASSIGN_UNSIGNED
429 ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
437 MONO_CHECK_ARG_NULL (idxs);
439 ic = idxs->obj.vtable->klass;
440 ac = this->obj.vtable->klass;
442 g_assert (ic->rank == 1);
443 if (idxs->bounds != NULL || idxs->max_length != ac->rank)
444 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
446 ind = (guint32 *)idxs->vector;
448 if (this->bounds == NULL) {
449 if (*ind < 0 || *ind >= this->max_length)
450 mono_raise_exception (mono_get_exception_index_out_of_range ());
452 ves_icall_System_Array_SetValueImpl (this, value, *ind);
456 for (i = 0; i < ac->rank; i++)
457 if ((ind [i] < this->bounds [i].lower_bound) ||
458 (ind [i] >= this->bounds [i].length + this->bounds [i].lower_bound))
459 mono_raise_exception (mono_get_exception_index_out_of_range ());
461 pos = ind [0] - this->bounds [0].lower_bound;
462 for (i = 1; i < ac->rank; i++)
463 pos = pos * this->bounds [i].length + ind [i] -
464 this->bounds [i].lower_bound;
466 ves_icall_System_Array_SetValueImpl (this, value, pos);
470 ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
478 MONO_CHECK_ARG_NULL (type);
479 MONO_CHECK_ARG_NULL (lengths);
481 MONO_CHECK_ARG (lengths, mono_array_length (lengths) > 0);
483 MONO_CHECK_ARG (bounds, mono_array_length (lengths) == mono_array_length (bounds));
485 for (i = 0; i < mono_array_length (lengths); i++)
486 if (mono_array_get (lengths, gint32, i) < 0)
487 mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
489 aklass = mono_array_class_get (type->type, mono_array_length (lengths));
491 sizes = alloca (aklass->rank * sizeof(guint32) * 2);
492 for (i = 0; i < aklass->rank; ++i) {
493 sizes [i] = mono_array_get (lengths, gint32, i);
495 sizes [i + aklass->rank] = mono_array_get (bounds, gint32, i);
497 sizes [i + aklass->rank] = 0;
500 array = mono_array_new_full (mono_object_domain (type), aklass, sizes, sizes + aklass->rank);
506 ves_icall_System_Array_GetRank (MonoObject *this)
510 return this->vtable->klass->rank;
514 ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
516 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
520 if ((dimension < 0) || (dimension >= rank))
521 mono_raise_exception (mono_get_exception_index_out_of_range ());
523 if (this->bounds == NULL)
524 return this->max_length;
526 return this->bounds [dimension].length;
530 ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
532 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
536 if ((dimension < 0) || (dimension >= rank))
537 mono_raise_exception (mono_get_exception_index_out_of_range ());
539 if (this->bounds == NULL)
542 return this->bounds [dimension].lower_bound;
546 ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
548 int element_size = mono_array_element_size (source->obj.vtable->klass);
549 void * dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
550 void * source_addr = mono_array_addr_with_size (source, element_size, source_idx);
554 g_assert (dest_idx + length <= mono_array_length (dest));
555 g_assert (source_idx + length <= mono_array_length (source));
556 memmove (dest_addr, source_addr, element_size * length);
560 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoArray *array, MonoClassField *field_handle)
562 MonoClass *klass = array->obj.vtable->klass;
563 guint32 size = mono_array_element_size (klass);
568 if (array->bounds == NULL)
569 size *= array->max_length;
571 for (i = 0; i < klass->rank; ++i)
572 size *= array->bounds [i].length;
574 memcpy (mono_array_addr (array, char, 0), field_handle->data, size);
576 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
580 guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
582 for (i = 0; i < size; i += n/8, data++) { \
583 tmp = read ## n (data); \
588 /* printf ("Initialize array with elements of %s type\n", klass->element_class->name); */
590 switch (klass->element_class->byval_arg.type) {
610 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void)
614 return offsetof (MonoString, chars);
618 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue (MonoObject *obj)
622 if ((obj == NULL) || (! (obj->vtable->klass->valuetype)))
625 return mono_object_clone (obj);
629 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (MonoType *handle)
635 MONO_CHECK_ARG_NULL (handle);
637 klass = mono_class_from_mono_type (handle);
638 MONO_CHECK_ARG (handle, klass);
640 /* This will call the type constructor */
641 if (! (klass->flags & TYPE_ATTRIBUTE_INTERFACE))
642 mono_class_vtable (mono_domain_get (), klass);
646 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
650 return mono_object_clone (this);
654 #define MONO_OBJECT_ALIGNMENT_SHIFT 3
656 #define MONO_OBJECT_ALIGNMENT_SHIFT 2
660 * Return hashcode based on object address. This function will need to be
661 * smarter in the presence of a moving garbage collector, which will cache
662 * the address hash before relocating the object.
664 * Wang's address-based hash function:
665 * http://www.concentric.net/~Ttwang/tech/addrhash.htm
668 ves_icall_System_Object_GetHashCode (MonoObject *this)
670 register guint32 key;
674 key = (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
676 return key & 0x7fffffff;
680 * A hash function for value types. I have no idea if this is a good hash
681 * function (its similar to g_str_hash).
684 ves_icall_System_ValueType_GetHashCode (MonoObject *this)
692 MONO_CHECK_ARG_NULL (this);
694 size = this->vtable->klass->instance_size - sizeof (MonoObject);
696 p = (const char *)this + sizeof (MonoObject);
698 for (i = 0; i < size; i++) {
699 h = (h << 5) - h + *p;
707 ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that)
714 MONO_CHECK_ARG_NULL (that);
716 if (this->vtable != that->vtable)
719 size = this->vtable->klass->instance_size - sizeof (MonoObject);
721 p = (const char *)this + sizeof (MonoObject);
722 s = (const char *)that + sizeof (MonoObject);
724 return memcmp (p, s, size)? FALSE: TRUE;
727 static MonoReflectionType *
728 ves_icall_System_Object_GetType (MonoObject *obj)
732 return mono_type_get_object (mono_object_domain (obj), &obj->vtable->klass->byval_arg);
736 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
740 mtype->type = &obj->vtable->klass->byval_arg;
741 g_assert (mtype->type->type);
745 ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObject *obj)
749 return mono_image_create_token (assb->dynamic_assembly, obj);
753 ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, MonoArray *buf, gint32 offset)
756 MonoDynamicAssembly *ass = assb->dynamic_assembly;
757 char *p = mono_array_addr (buf, char, 0);
761 mono_image_create_pefile (assb);
763 if (offset >= ass->pefile.index)
765 count = mono_array_length (buf);
766 count = MIN (count, ass->pefile.index - offset);
768 memcpy (p, ass->pefile.data + offset, count);
774 ves_icall_AssemblyBuilder_build_metadata (MonoReflectionAssemblyBuilder *assb)
778 mono_image_build_metadata (assb);
781 static MonoReflectionType*
782 ves_icall_type_from_name (MonoString *name,
783 MonoBoolean throwOnError,
784 MonoBoolean ignoreCase)
787 MonoType *type = NULL;
788 MonoAssembly *assembly;
789 MonoTypeNameParse info;
793 str = mono_string_to_utf8 (name);
794 if (!mono_reflection_parse_type (str, &info)) {
796 g_list_free (info.modifiers);
797 g_list_free (info.nested);
798 if (throwOnError) /* uhm: this is a parse error, though... */
799 mono_raise_exception (mono_get_exception_type_load ());
804 if (info.assembly.name) {
805 assembly = mono_assembly_load (&info.assembly, NULL, NULL);
807 MonoReflectionAssembly *refass;
809 refass = ves_icall_System_Reflection_Assembly_GetCallingAssembly ();
810 assembly = refass->assembly;
814 type = mono_reflection_get_type (assembly->image, &info, ignoreCase);
816 if (!info.assembly.name && !type) /* try mscorlib */
817 type = mono_reflection_get_type (NULL, &info, ignoreCase);
820 MonoReflectionAssembly *assembly;
824 fullName = g_strdup_printf ("%s.%s", info.name_space, info.name);
826 fullName = g_strdup (info.name);
828 mono_domain_try_type_resolve (
830 (MonoObject*)mono_string_new (mono_domain_get (), fullName));
832 type = mono_reflection_get_type (assembly->assembly->image,
838 g_list_free (info.modifiers);
839 g_list_free (info.nested);
842 mono_raise_exception (mono_get_exception_type_load ());
847 return mono_type_get_object (mono_domain_get (), type);
850 static MonoReflectionType*
851 ves_icall_type_from_handle (MonoType *handle)
853 MonoDomain *domain = mono_domain_get ();
854 MonoClass *klass = mono_class_from_mono_type (handle);
858 mono_class_init (klass);
859 return mono_type_get_object (domain, handle);
863 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
867 if (type->type && c->type)
868 return mono_metadata_type_equal (type->type, c->type);
869 g_print ("type equals\n");
873 /* System.TypeCode */
896 ves_icall_type_GetTypeCode (MonoReflectionType *type)
898 int t = type->type->type;
905 return TYPECODE_OBJECT;
906 case MONO_TYPE_BOOLEAN:
907 return TYPECODE_BOOLEAN;
909 return TYPECODE_BYTE;
911 return TYPECODE_SBYTE;
913 return TYPECODE_UINT16;
915 return TYPECODE_INT16;
917 return TYPECODE_CHAR;
921 return TYPECODE_OBJECT;
923 return TYPECODE_UINT32;
925 return TYPECODE_INT32;
927 return TYPECODE_UINT64;
929 return TYPECODE_INT64;
931 return TYPECODE_SINGLE;
933 return TYPECODE_DOUBLE;
934 case MONO_TYPE_VALUETYPE:
935 if (type->type->data.klass->enumtype) {
936 t = type->type->data.klass->enum_basetype->type;
939 MonoClass *k = type->type->data.klass;
940 if (strcmp (k->name_space, "System") == 0) {
941 if (strcmp (k->name, "Decimal") == 0)
942 return TYPECODE_DECIMAL;
943 else if (strcmp (k->name, "DateTime") == 0)
944 return TYPECODE_DATETIME;
945 else if (strcmp (k->name, "DBNull") == 0)
946 return TYPECODE_DBNULL;
949 /* handle datetime, dbnull.. */
950 return TYPECODE_OBJECT;
951 case MONO_TYPE_STRING:
952 return TYPECODE_STRING;
953 case MONO_TYPE_SZARRAY:
954 case MONO_TYPE_ARRAY:
955 case MONO_TYPE_OBJECT:
956 return TYPECODE_OBJECT;
957 case MONO_TYPE_CLASS:
958 return TYPECODE_OBJECT;
960 g_error ("type 0x%02x not handled in GetTypeCode()", t);
966 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
974 g_assert (type != NULL);
976 domain = ((MonoObject *)type)->vtable->domain;
978 if (!c) /* FIXME: dont know what do do here */
981 klass = mono_class_from_mono_type (type->type);
982 klassc = mono_class_from_mono_type (c->type);
984 /* cut&paste from mono_object_isinst (): keep in sync */
985 if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && !(klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
986 MonoVTable *klass_vt = mono_class_vtable (domain, klass);
987 if ((klassc->interface_id <= klass->max_interface_id) &&
988 klass_vt->interface_offsets [klassc->interface_id])
990 } else if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && (klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
993 for (i = 0; i < klass->interface_count; i ++) {
994 MonoClass *ic = klass->interfaces [i];
1000 * klass->baseval is 0 for interfaces
1002 if (klass->baseval && ((klass->baseval - klassc->baseval) <= klassc->diffval))
1009 ves_icall_get_attributes (MonoReflectionType *type)
1011 MonoClass *klass = mono_class_from_mono_type (type->type);
1013 MONO_ARCH_SAVE_REGS;
1015 return klass->flags;
1019 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
1021 MonoDomain *domain = mono_domain_get ();
1023 MONO_ARCH_SAVE_REGS;
1025 info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
1026 info->ret = mono_type_get_object (domain, method->signature->ret);
1027 info->attrs = method->flags;
1028 info->implattrs = method->iflags;
1032 ves_icall_get_parameter_info (MonoMethod *method)
1034 MonoDomain *domain = mono_domain_get ();
1036 static MonoClass *System_Reflection_ParameterInfo;
1037 MonoReflectionParameter** args;
1040 MONO_ARCH_SAVE_REGS;
1042 args = mono_param_get_objects (domain, method);
1043 if (!System_Reflection_ParameterInfo)
1044 System_Reflection_ParameterInfo = mono_class_from_name (
1045 mono_defaults.corlib, "System.Reflection", "ParameterInfo");
1046 res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count);
1047 for (i = 0; i < method->signature->param_count; ++i) {
1048 mono_array_set (res, gpointer, i, args [i]);
1054 ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
1056 MonoDomain *domain = mono_object_domain (field);
1058 MONO_ARCH_SAVE_REGS;
1060 info->parent = mono_type_get_object (domain, &field->klass->byval_arg);
1061 info->type = mono_type_get_object (domain, field->field->type);
1062 info->name = mono_string_new (domain, field->field->name);
1063 info->attrs = field->field->type->attrs;
1067 ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *obj)
1070 MonoClassField *cf = field->field;
1073 MonoDomain *domain = mono_object_domain (field);
1075 gboolean is_static = FALSE;
1076 gboolean is_ref = FALSE;
1078 MONO_ARCH_SAVE_REGS;
1080 mono_class_init (field->klass);
1082 switch (cf->type->type) {
1083 case MONO_TYPE_STRING:
1084 case MONO_TYPE_OBJECT:
1085 case MONO_TYPE_CLASS:
1086 case MONO_TYPE_ARRAY:
1087 case MONO_TYPE_SZARRAY:
1092 case MONO_TYPE_BOOLEAN:
1095 case MONO_TYPE_CHAR:
1104 case MONO_TYPE_VALUETYPE:
1105 is_ref = cf->type->byref;
1108 g_error ("type 0x%x not handled in "
1109 "ves_icall_Monofield_GetValue", cf->type->type);
1113 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1115 vtable = mono_class_vtable (domain, field->klass);
1120 mono_field_static_get_value (vtable, cf, &o);
1122 mono_field_get_value (obj, cf, &o);
1127 /* boxed value type */
1128 klass = mono_class_from_mono_type (cf->type);
1129 o = mono_object_new (domain, klass);
1130 v = ((gchar *) o) + sizeof (MonoObject);
1132 mono_field_static_get_value (vtable, cf, v);
1134 mono_field_get_value (obj, cf, v);
1141 ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *obj, MonoObject *value)
1143 MonoClassField *cf = field->field;
1146 MONO_ARCH_SAVE_REGS;
1148 v = (gchar *) value;
1149 if (!cf->type->byref) {
1150 switch (cf->type->type) {
1153 case MONO_TYPE_BOOLEAN:
1156 case MONO_TYPE_CHAR:
1165 case MONO_TYPE_VALUETYPE:
1166 v += sizeof (MonoObject);
1168 case MONO_TYPE_STRING:
1169 case MONO_TYPE_OBJECT:
1170 case MONO_TYPE_CLASS:
1171 case MONO_TYPE_ARRAY:
1172 case MONO_TYPE_SZARRAY:
1176 g_error ("type 0x%x not handled in "
1177 "ves_icall_FieldInfo_SetValueInternal", cf->type->type);
1182 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1183 MonoVTable *vtable = mono_class_vtable (mono_object_domain (field), field->klass);
1184 mono_field_static_set_value (vtable, cf, v);
1186 mono_field_set_value (obj, cf, v);
1191 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
1193 MonoDomain *domain = mono_object_domain (property);
1195 MONO_ARCH_SAVE_REGS;
1197 info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
1198 info->name = mono_string_new (domain, property->property->name);
1199 info->attrs = property->property->attrs;
1200 info->get = property->property->get ? mono_method_get_object (domain, property->property->get, NULL): NULL;
1201 info->set = property->property->set ? mono_method_get_object (domain, property->property->set, NULL): NULL;
1203 * There may be other methods defined for properties, though, it seems they are not exposed
1204 * in the reflection API
1209 ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
1211 MonoDomain *domain = mono_object_domain (event);
1213 MONO_ARCH_SAVE_REGS;
1215 info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
1216 info->name = mono_string_new (domain, event->event->name);
1217 info->attrs = event->event->attrs;
1218 info->add_method = event->event->add ? mono_method_get_object (domain, event->event->add, NULL): NULL;
1219 info->remove_method = event->event->remove ? mono_method_get_object (domain, event->event->remove, NULL): NULL;
1220 info->raise_method = event->event->raise ? mono_method_get_object (domain, event->event->raise, NULL): NULL;
1224 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
1226 MonoDomain *domain = mono_object_domain (type);
1229 MonoClass *class = mono_class_from_mono_type (type->type);
1232 MONO_ARCH_SAVE_REGS;
1235 for (parent = class; parent; parent = parent->parent) {
1236 ninterf += parent->interface_count;
1238 intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
1240 for (parent = class; parent; parent = parent->parent) {
1241 for (i = 0; i < parent->interface_count; ++i) {
1242 mono_array_set (intf, gpointer, ninterf, mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
1250 ves_icall_Type_GetInterfaceMapData (MonoReflectionType *type, MonoReflectionType *iface, MonoArray **targets, MonoArray **methods)
1252 MonoClass *class = mono_class_from_mono_type (type->type);
1253 MonoClass *iclass = mono_class_from_mono_type (iface->type);
1254 MonoReflectionMethod *member;
1255 int i, len, ioffset;
1258 MONO_ARCH_SAVE_REGS;
1260 /* type doesn't implement iface: the exception is thrown in managed code */
1261 if ((iclass->interface_id > class->max_interface_id) || !class->interface_offsets [iclass->interface_id])
1264 len = iclass->method.count;
1265 ioffset = class->interface_offsets [iclass->interface_id];
1266 domain = mono_object_domain (type);
1267 *targets = mono_array_new (domain, mono_defaults.method_info_class, len);
1268 *methods = mono_array_new (domain, mono_defaults.method_info_class, len);
1269 for (i = 0; i < len; ++i) {
1270 member = mono_method_get_object (domain, iclass->methods [i], iclass);
1271 mono_array_set (*methods, gpointer, i, member);
1272 member = mono_method_get_object (domain, class->vtable [i + ioffset], class);
1273 mono_array_set (*targets, gpointer, i, member);
1277 static MonoReflectionType*
1278 ves_icall_MonoType_GetElementType (MonoReflectionType *type)
1280 MonoClass *class = mono_class_from_mono_type (type->type);
1282 MONO_ARCH_SAVE_REGS;
1284 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1285 return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
1286 else if (class->element_class)
1287 return mono_type_get_object (mono_object_domain (type), &class->element_class->byval_arg);
1292 static MonoReflectionType*
1293 ves_icall_get_type_parent (MonoReflectionType *type)
1295 MonoClass *class = mono_class_from_mono_type (type->type);
1297 MONO_ARCH_SAVE_REGS;
1299 return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
1303 ves_icall_type_ispointer (MonoReflectionType *type)
1305 MONO_ARCH_SAVE_REGS;
1307 return type->type->type == MONO_TYPE_PTR;
1311 ves_icall_type_isbyref (MonoReflectionType *type)
1313 MONO_ARCH_SAVE_REGS;
1315 return type->type->byref;
1318 static MonoReflectionModule*
1319 ves_icall_MonoType_get_Module (MonoReflectionType *type)
1321 MonoClass *class = mono_class_from_mono_type (type->type);
1323 MONO_ARCH_SAVE_REGS;
1325 return mono_module_get_object (mono_object_domain (type), class->image);
1329 ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
1331 MonoDomain *domain = mono_domain_get ();
1332 MonoClass *class = mono_class_from_mono_type (type);
1334 MONO_ARCH_SAVE_REGS;
1336 info->nested_in = class->nested_in ? mono_type_get_object (domain, &class->nested_in->byval_arg): NULL;
1337 info->name = mono_string_new (domain, class->name);
1338 info->name_space = mono_string_new (domain, class->name_space);
1339 info->rank = class->rank;
1340 info->assembly = mono_assembly_get_object (domain, class->image->assembly);
1341 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1342 info->etype = mono_type_get_object (domain, class->enum_basetype);
1343 else if (class->element_class)
1344 info->etype = mono_type_get_object (domain, &class->element_class->byval_arg);
1348 info->isprimitive = (!type->byref && (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8));
1352 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
1355 * Invoke from reflection is supposed to always be a virtual call (the API
1356 * is stupid), mono_runtime_invoke_*() calls the provided method, allowing
1357 * greater flexibility.
1359 MonoMethod *m = method->method;
1362 MONO_ARCH_SAVE_REGS;
1365 if (!mono_object_isinst (this, m->klass))
1366 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
1367 m = mono_object_get_virtual_method (this, m);
1368 } else if (!(m->flags & METHOD_ATTRIBUTE_STATIC) && strcmp (m->name, ".ctor"))
1369 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
1371 pcount = params? mono_array_length (params): 0;
1372 if (pcount != m->signature->param_count)
1373 mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetParameterCountException"));
1375 return mono_runtime_invoke_array (m, this, params, NULL);
1379 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
1381 MonoDomain *domain = mono_object_domain (method);
1382 MonoMethod *m = method->method;
1383 MonoMethodSignature *sig = m->signature;
1384 MonoArray *out_args;
1386 int i, j, outarg_count = 0;
1388 MONO_ARCH_SAVE_REGS;
1390 if (m->klass == mono_defaults.object_class) {
1392 if (!strcmp (m->name, "FieldGetter")) {
1393 MonoClass *k = this->vtable->klass;
1394 MonoString *name = mono_array_get (params, MonoString *, 1);
1397 str = mono_string_to_utf8 (name);
1399 for (i = 0; i < k->field.count; i++) {
1400 if (!strcmp (k->fields [i].name, str)) {
1401 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1402 if (field_klass->valuetype)
1403 result = mono_value_box (domain, field_klass,
1404 (char *)this + k->fields [i].offset);
1406 result = *((gpointer *)((char *)this + k->fields [i].offset));
1409 out_args = mono_array_new (domain, mono_defaults.object_class, 1);
1410 *outArgs = out_args;
1411 mono_array_set (out_args, gpointer, 0, result);
1418 g_assert_not_reached ();
1420 } else if (!strcmp (m->name, "FieldSetter")) {
1421 MonoClass *k = this->vtable->klass;
1422 MonoString *name = mono_array_get (params, MonoString *, 1);
1426 str = mono_string_to_utf8 (name);
1428 for (i = 0; i < k->field.count; i++) {
1429 if (!strcmp (k->fields [i].name, str)) {
1430 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1431 MonoObject *val = mono_array_get (params, gpointer, 2);
1433 if (field_klass->valuetype) {
1434 size = mono_type_size (k->fields [i].type, &align);
1435 memcpy ((char *)this + k->fields [i].offset,
1436 ((char *)val) + sizeof (MonoObject), size);
1438 *((gpointer *)this + k->fields [i].offset) = val;
1440 out_args = mono_array_new (domain, mono_defaults.object_class, 0);
1441 *outArgs = out_args;
1449 g_assert_not_reached ();
1454 for (i = 0; i < mono_array_length (params); i++) {
1455 if (sig->params [i]->byref)
1459 out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
1461 for (i = 0, j = 0; i < mono_array_length (params); i++) {
1462 if (sig->params [i]->byref) {
1464 arg = mono_array_get (params, gpointer, i);
1465 mono_array_set (out_args, gpointer, j, arg);
1470 /* fixme: handle constructors? */
1471 if (!strcmp (method->method->name, ".ctor"))
1472 g_assert_not_reached ();
1474 result = mono_runtime_invoke_array (method->method, this, params, NULL);
1476 *outArgs = out_args;
1482 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
1485 MonoClass *enumc, *objc;
1489 MONO_ARCH_SAVE_REGS;
1491 MONO_CHECK_ARG_NULL (type);
1492 MONO_CHECK_ARG_NULL (obj);
1494 domain = mono_object_domain (type);
1495 enumc = mono_class_from_mono_type (type->type);
1496 objc = obj->vtable->klass;
1498 MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
1499 MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
1500 objc->byval_arg.type <= MONO_TYPE_U8));
1502 s1 = mono_class_value_size (enumc, NULL);
1503 s2 = mono_class_value_size (objc, NULL);
1505 res = mono_object_new (domain, enumc);
1507 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
1508 memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
1510 memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
1511 (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
1518 ves_icall_System_Enum_get_value (MonoObject *this)
1526 MONO_ARCH_SAVE_REGS;
1531 g_assert (this->vtable->klass->enumtype);
1533 enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
1534 res = mono_object_new (mono_object_domain (this), enumc);
1535 dst = (char *)res + sizeof (MonoObject);
1536 src = (char *)this + sizeof (MonoObject);
1537 size = mono_class_value_size (enumc, NULL);
1539 memcpy (dst, src, size);
1545 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
1547 MonoDomain *domain = mono_object_domain (type);
1548 MonoClass *enumc = mono_class_from_mono_type (type->type);
1549 guint i, j, nvalues, crow;
1550 MonoClassField *field;
1552 MONO_ARCH_SAVE_REGS;
1554 info->utype = mono_type_get_object (domain, enumc->enum_basetype);
1555 nvalues = enumc->field.count - 1;
1556 info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
1557 info->values = mono_array_new (domain, enumc, nvalues);
1559 for (i = 0, j = 0; i < enumc->field.count; ++i) {
1560 field = &enumc->fields [i];
1561 if (strcmp ("value__", field->name) == 0)
1563 mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
1565 crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1));
1566 crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
1567 /* 1 is the length of the blob */
1568 field->data = 1 + mono_metadata_blob_heap (enumc->image, crow);
1570 switch (enumc->enum_basetype->type) {
1573 mono_array_set (info->values, gchar, j, *field->data);
1575 case MONO_TYPE_CHAR:
1578 mono_array_set (info->values, gint16, j, read16 (field->data));
1582 mono_array_set (info->values, gint32, j, read32 (field->data));
1586 mono_array_set (info->values, gint64, j, read64 (field->data));
1589 g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
1596 BFLAGS_IgnoreCase = 1,
1597 BFLAGS_DeclaredOnly = 2,
1598 BFLAGS_Instance = 4,
1600 BFLAGS_Public = 0x10,
1601 BFLAGS_NonPublic = 0x20,
1602 BFLAGS_InvokeMethod = 0x100,
1603 BFLAGS_CreateInstance = 0x200,
1604 BFLAGS_GetField = 0x400,
1605 BFLAGS_SetField = 0x800,
1606 BFLAGS_GetProperty = 0x1000,
1607 BFLAGS_SetProperty = 0x2000,
1608 BFLAGS_ExactBinding = 0x10000,
1609 BFLAGS_SuppressChangeType = 0x20000,
1610 BFLAGS_OptionalParamBinding = 0x40000
1613 static MonoFieldInfo *
1614 ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
1617 MonoClass *startklass, *klass;
1619 MonoClassField *field;
1621 domain = ((MonoObject *)type)->vtable->domain;
1622 klass = startklass = mono_class_from_mono_type (type->type);
1624 MONO_ARCH_SAVE_REGS;
1630 for (i = 0; i < klass->field.count; ++i) {
1632 field = &klass->fields [i];
1633 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1634 if (bflags & BFLAGS_Public)
1637 if (bflags & BFLAGS_NonPublic)
1643 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1644 if (bflags & BFLAGS_Static)
1647 if (bflags & BFLAGS_Instance)
1654 utf8_name = mono_string_to_utf8 (name);
1656 if (strcmp (field->name, utf8_name)) {
1662 return (MonoFieldInfo *)mono_field_get_object (domain, klass, field);
1664 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1671 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
1674 GSList *l = NULL, *tmp;
1675 MonoClass *startklass, *klass;
1679 MonoClassField *field;
1681 MONO_ARCH_SAVE_REGS;
1683 domain = ((MonoObject *)type)->vtable->domain;
1684 klass = startklass = mono_class_from_mono_type (type->type);
1687 for (i = 0; i < klass->field.count; ++i) {
1689 field = &klass->fields [i];
1690 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1691 if (bflags & BFLAGS_Public)
1694 if (bflags & BFLAGS_NonPublic)
1700 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1701 if (bflags & BFLAGS_Static)
1704 if (bflags & BFLAGS_Instance)
1710 member = (MonoObject*)mono_field_get_object (domain, klass, field);
1711 l = g_slist_prepend (l, member);
1713 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1715 len = g_slist_length (l);
1716 res = mono_array_new (domain, mono_defaults.field_info_class, len);
1718 tmp = g_slist_reverse (l);
1719 for (; tmp; tmp = tmp->next, ++i)
1720 mono_array_set (res, gpointer, i, tmp->data);
1726 ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
1729 GSList *l = NULL, *tmp;
1730 MonoClass *startklass, *klass;
1735 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
1737 MONO_ARCH_SAVE_REGS;
1739 domain = ((MonoObject *)type)->vtable->domain;
1740 klass = startklass = mono_class_from_mono_type (type->type);
1744 for (i = 0; i < klass->method.count; ++i) {
1746 method = klass->methods [i];
1747 if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
1749 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1750 if (bflags & BFLAGS_Public)
1753 if (bflags & BFLAGS_NonPublic)
1759 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1760 if (bflags & BFLAGS_Static)
1763 if (bflags & BFLAGS_Instance)
1770 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
1772 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
1773 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1775 l = g_slist_prepend (l, member);
1778 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1780 res = mono_array_new (domain, mono_defaults.method_info_class, len);
1783 for (; tmp; tmp = tmp->next, ++i)
1784 mono_array_set (res, gpointer, i, tmp->data);
1786 g_hash_table_destroy (method_slots);
1791 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
1794 GSList *l = NULL, *tmp;
1795 static MonoClass *System_Reflection_ConstructorInfo;
1796 MonoClass *startklass, *klass;
1802 MONO_ARCH_SAVE_REGS;
1804 domain = ((MonoObject *)type)->vtable->domain;
1805 klass = startklass = mono_class_from_mono_type (type->type);
1807 for (i = 0; i < klass->method.count; ++i) {
1809 method = klass->methods [i];
1810 if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
1812 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1813 if (bflags & BFLAGS_Public)
1816 if (bflags & BFLAGS_NonPublic)
1822 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1823 if (bflags & BFLAGS_Static)
1826 if (bflags & BFLAGS_Instance)
1832 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1834 l = g_slist_prepend (l, member);
1836 len = g_slist_length (l);
1837 if (!System_Reflection_ConstructorInfo)
1838 System_Reflection_ConstructorInfo = mono_class_from_name (
1839 mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
1840 res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
1842 tmp = g_slist_reverse (l);
1843 for (; tmp; tmp = tmp->next, ++i)
1844 mono_array_set (res, gpointer, i, tmp->data);
1850 ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
1853 GSList *l = NULL, *tmp;
1854 static MonoClass *System_Reflection_PropertyInfo;
1855 MonoClass *startklass, *klass;
1861 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
1863 MONO_ARCH_SAVE_REGS;
1865 domain = ((MonoObject *)type)->vtable->domain;
1866 klass = startklass = mono_class_from_mono_type (type->type);
1869 for (i = 0; i < klass->property.count; ++i) {
1870 prop = &klass->properties [i];
1875 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1876 if (bflags & BFLAGS_Public)
1879 if (bflags & BFLAGS_NonPublic)
1885 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1886 if (bflags & BFLAGS_Static)
1889 if (bflags & BFLAGS_Instance)
1897 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
1899 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), prop);
1901 l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
1904 if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
1906 if (!System_Reflection_PropertyInfo)
1907 System_Reflection_PropertyInfo = mono_class_from_name (
1908 mono_defaults.corlib, "System.Reflection", "PropertyInfo");
1909 res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
1912 for (; tmp; tmp = tmp->next, ++i)
1913 mono_array_set (res, gpointer, i, tmp->data);
1915 g_hash_table_destroy (method_slots);
1919 static MonoReflectionEvent *
1920 ves_icall_MonoType_GetEvent (MonoReflectionType *type, MonoString *name, guint32 bflags)
1929 MONO_ARCH_SAVE_REGS;
1931 event_name = mono_string_to_utf8 (name);
1932 klass = mono_class_from_mono_type (type->type);
1933 domain = mono_object_domain (type);
1936 for (i = 0; i < klass->event.count; i++) {
1937 event = &klass->events [i];
1938 if (strcmp (event->name, event_name))
1941 method = event->add;
1943 method = event->remove;
1945 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1946 if (!(bflags & BFLAGS_Public))
1949 if (!(bflags & BFLAGS_NonPublic))
1953 g_free (event_name);
1954 return mono_event_get_object (domain, klass, event);
1957 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1960 g_free (event_name);
1965 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
1968 GSList *l = NULL, *tmp;
1969 static MonoClass *System_Reflection_EventInfo;
1970 MonoClass *startklass, *klass;
1976 MONO_ARCH_SAVE_REGS;
1978 domain = ((MonoObject *)type)->vtable->domain;
1979 klass = startklass = mono_class_from_mono_type (type->type);
1982 for (i = 0; i < klass->event.count; ++i) {
1983 event = &klass->events [i];
1985 method = event->add;
1987 method = event->remove;
1988 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1989 if (bflags & BFLAGS_Public)
1992 if (bflags & BFLAGS_NonPublic)
1998 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1999 if (bflags & BFLAGS_Static)
2002 if (bflags & BFLAGS_Instance)
2009 l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
2011 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
2013 len = g_slist_length (l);
2014 if (!System_Reflection_EventInfo)
2015 System_Reflection_EventInfo = mono_class_from_name (
2016 mono_defaults.corlib, "System.Reflection", "EventInfo");
2017 res = mono_array_new (domain, System_Reflection_EventInfo, len);
2020 for (; tmp; tmp = tmp->next, ++i)
2021 mono_array_set (res, gpointer, i, tmp->data);
2027 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
2030 GSList *l = NULL, *tmp;
2032 MonoClass *startklass, *klass;
2038 MONO_ARCH_SAVE_REGS;
2040 domain = ((MonoObject *)type)->vtable->domain;
2041 klass = startklass = mono_class_from_mono_type (type->type);
2043 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
2045 nested = tmpn->data;
2046 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
2047 if (bflags & BFLAGS_Public)
2050 if (bflags & BFLAGS_NonPublic)
2055 member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
2056 l = g_slist_prepend (l, member);
2058 len = g_slist_length (l);
2059 res = mono_array_new (domain, mono_defaults.monotype_class, len);
2061 tmp = g_slist_reverse (l);
2062 for (; tmp; tmp = tmp->next, ++i)
2063 mono_array_set (res, gpointer, i, tmp->data);
2068 static MonoReflectionType*
2069 ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
2073 MonoTypeNameParse info;
2075 MONO_ARCH_SAVE_REGS;
2077 str = mono_string_to_utf8 (name);
2078 /*g_print ("requested type %s in %s\n", str, assembly->assembly->aname.name);*/
2079 if (!mono_reflection_parse_type (str, &info)) {
2081 g_list_free (info.modifiers);
2082 g_list_free (info.nested);
2083 if (throwOnError) /* uhm: this is a parse error, though... */
2084 mono_raise_exception (mono_get_exception_type_load ());
2085 /*g_print ("failed parse\n");*/
2089 type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
2091 g_list_free (info.modifiers);
2092 g_list_free (info.nested);
2095 mono_raise_exception (mono_get_exception_type_load ());
2096 /* g_print ("failed find\n"); */
2099 /* g_print ("got it\n"); */
2100 return mono_type_get_object (mono_object_domain (assembly), type);
2105 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
2107 MonoDomain *domain = mono_object_domain (assembly);
2109 char *name = g_strconcat (
2110 "file://", assembly->assembly->image->name, NULL);
2112 MONO_ARCH_SAVE_REGS;
2114 res = mono_string_new (domain, name);
2120 ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assembly)
2122 MonoDomain *domain = mono_object_domain (assembly);
2124 char *name = g_build_filename (
2125 assembly->assembly->basedir,
2126 assembly->assembly->image->module_name, NULL);
2128 MONO_ARCH_SAVE_REGS;
2130 res = mono_string_new (domain, name);
2135 static MonoReflectionMethod*
2136 ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly)
2138 guint32 token = mono_image_get_entry_point (assembly->assembly->image);
2140 MONO_ARCH_SAVE_REGS;
2144 return mono_method_get_object (mono_object_domain (assembly), mono_get_method (assembly->assembly->image, token, NULL), NULL);
2148 ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly)
2150 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2151 MonoArray *result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
2155 MONO_ARCH_SAVE_REGS;
2157 for (i = 0; i < table->rows; ++i) {
2158 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_MANIFEST_NAME));
2159 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), val));
2165 ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAssembly *assembly)
2167 static MonoClass *System_Reflection_AssemblyName;
2170 MonoDomain *domain = mono_object_domain (assembly);
2173 MONO_ARCH_SAVE_REGS;
2175 if (!System_Reflection_AssemblyName)
2176 System_Reflection_AssemblyName = mono_class_from_name (
2177 mono_defaults.corlib, "System.Reflection", "AssemblyName");
2179 for (ptr = assembly->assembly->image->references; ptr && *ptr; ptr++)
2182 result = mono_array_new (mono_object_domain (assembly), System_Reflection_AssemblyName, count);
2184 for (i = 0; i < count; i++) {
2185 MonoAssembly *assem = assembly->assembly->image->references [i];
2186 MonoReflectionAssemblyName *aname;
2189 aname = (MonoReflectionAssemblyName *) mono_object_new (
2190 domain, System_Reflection_AssemblyName);
2192 if (strcmp (assem->aname.name, "corlib") == 0)
2193 aname->name = mono_string_new (domain, "mscorlib");
2195 aname->name = mono_string_new (domain, assem->aname.name);
2196 aname->major = assem->aname.major;
2198 codebase = g_strconcat ("file://", assembly->assembly->image->references [i]->image->name, NULL);
2199 aname->codebase = mono_string_new (domain, codebase);
2201 mono_array_set (result, gpointer, i, aname);
2206 /* move this in some file in mono/util/ */
2208 g_concat_dir_and_file (const char *dir, const char *file)
2210 g_return_val_if_fail (dir != NULL, NULL);
2211 g_return_val_if_fail (file != NULL, NULL);
2214 * If the directory name doesn't have a / on the end, we need
2215 * to add one so we get a proper path to the file
2217 if (dir [strlen(dir) - 1] != G_DIR_SEPARATOR)
2218 return g_strconcat (dir, G_DIR_SEPARATOR_S, file, NULL);
2220 return g_strconcat (dir, file, NULL);
2224 ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name)
2226 char *n = mono_string_to_utf8 (name);
2227 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
2229 guint32 cols [MONO_MANIFEST_SIZE];
2233 MONO_ARCH_SAVE_REGS;
2235 for (i = 0; i < table->rows; ++i) {
2236 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
2237 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
2238 if (strcmp (val, n) == 0)
2242 if (i == table->rows)
2245 if (!cols [MONO_MANIFEST_IMPLEMENTATION]) {
2248 val = mono_image_get_resource (assembly->assembly->image, cols [MONO_MANIFEST_OFFSET], &size);
2251 data = mono_array_new (mono_object_domain (assembly), mono_defaults.byte_class, size);
2252 memcpy (mono_array_addr (data, char, 0), val, size);
2253 return (MonoObject*)data;
2255 switch (cols [MONO_MANIFEST_IMPLEMENTATION] & IMPLEMENTATION_MASK) {
2256 case IMPLEMENTATION_FILE:
2257 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
2258 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
2259 i = mono_metadata_decode_row_col (table, i - 1, MONO_FILE_NAME);
2260 val = mono_metadata_string_heap (assembly->assembly->image, i);
2261 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
2262 result = (MonoObject*)mono_string_new (mono_object_domain (assembly), n);
2263 /* check hash if needed */
2266 case IMPLEMENTATION_ASSEMBLYREF:
2267 case IMPLEMENTATION_EXP_TYPE:
2275 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name)
2277 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
2283 MONO_ARCH_SAVE_REGS;
2285 /* check hash if needed */
2287 n = mono_string_to_utf8 (name);
2288 for (i = 0; i < table->rows; ++i) {
2289 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
2290 if (strcmp (val, n) == 0) {
2293 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
2294 fn = mono_string_new (mono_object_domain (assembly), n);
2296 return (MonoObject*)fn;
2303 for (i = 0; i < table->rows; ++i) {
2304 result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
2305 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
2306 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
2307 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), n));
2310 return (MonoObject*)result;
2313 static MonoReflectionMethod*
2314 ves_icall_GetCurrentMethod (void)
2316 MonoMethod *m = mono_method_get_last_managed ();
2318 MONO_ARCH_SAVE_REGS;
2320 return mono_method_get_object (mono_domain_get (), m, NULL);
2323 static MonoReflectionAssembly*
2324 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (void)
2326 MonoMethod *m = mono_method_get_last_managed ();
2328 MONO_ARCH_SAVE_REGS;
2330 return mono_assembly_get_object (mono_domain_get (), m->klass->image->assembly);
2335 get_caller (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data)
2337 MonoMethod **dest = data;
2339 /* skip unmanaged frames */
2354 static MonoReflectionAssembly*
2355 ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
2357 MonoDomain* domain = mono_domain_get ();
2359 MONO_ARCH_SAVE_REGS;
2361 if (!domain->entry_assembly)
2362 domain = mono_root_domain;
2364 return mono_assembly_get_object (domain, domain->entry_assembly);
2368 static MonoReflectionAssembly*
2369 ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
2371 MonoMethod *m = mono_method_get_last_managed ();
2372 MonoMethod *dest = m;
2374 MONO_ARCH_SAVE_REGS;
2376 mono_stack_walk (get_caller, &dest);
2379 return mono_assembly_get_object (mono_domain_get (), dest->klass->image->assembly);
2383 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
2385 MonoDomain *domain = mono_object_domain (object);
2389 MONO_ARCH_SAVE_REGS;
2391 name = mono_type_get_name (object->type);
2392 res = mono_string_new (domain, name);
2399 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
2401 MonoAssemblyName *name = &assembly->assembly->aname;
2403 MONO_ARCH_SAVE_REGS;
2405 if (strcmp (name->name, "corlib") == 0)
2406 aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
2408 aname->name = mono_string_new (mono_object_domain (assembly), name->name);
2410 aname->major = name->major;
2411 aname->minor = name->minor;
2412 aname->build = name->build;
2413 aname->revision = name->revision;
2417 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
2419 MonoDomain *domain = mono_object_domain (assembly);
2422 MonoTableInfo *tdef = &assembly->assembly->image->tables [MONO_TABLE_TYPEDEF];
2424 guint32 attrs, visibility;
2426 MONO_ARCH_SAVE_REGS;
2428 /* we start the count from 1 because we skip the special type <Module> */
2431 for (i = 1; i < tdef->rows; ++i) {
2432 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2433 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2434 if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
2438 count = tdef->rows - 1;
2440 res = mono_array_new (domain, mono_defaults.monotype_class, count);
2442 for (i = 1; i < tdef->rows; ++i) {
2443 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2444 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2445 if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
2446 klass = mono_class_get (assembly->assembly->image, (i + 1) | MONO_TOKEN_TYPE_DEF);
2447 mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
2455 static MonoReflectionType*
2456 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
2459 int isbyref = 0, rank;
2460 char *str = mono_string_to_utf8 (smodifiers);
2463 MONO_ARCH_SAVE_REGS;
2465 klass = mono_class_from_mono_type (tb->type.type);
2467 /* logic taken from mono_reflection_parse_type(): keep in sync */
2471 if (isbyref) { /* only one level allowed by the spec */
2478 return mono_type_get_object (mono_object_domain (tb), &klass->this_arg);
2481 klass = mono_ptr_class_get (&klass->byval_arg);
2482 mono_class_init (klass);
2493 else if (*p != '*') { /* '*' means unknown lower bound */
2504 klass = mono_array_class_get (&klass->byval_arg, rank);
2505 mono_class_init (klass);
2512 return mono_type_get_object (mono_object_domain (tb), &klass->byval_arg);
2516 ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target,
2517 MonoReflectionMethod *info)
2519 MonoClass *delegate_class = mono_class_from_mono_type (type->type);
2520 MonoObject *delegate;
2523 MONO_ARCH_SAVE_REGS;
2525 mono_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
2527 delegate = mono_object_new (mono_object_domain (type), delegate_class);
2529 func = mono_compile_method (info->method);
2531 mono_delegate_ctor (delegate, target, func);
2537 * Magic number to convert a time which is relative to
2538 * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
2540 #define EPOCH_ADJUST ((gint64)62135596800L)
2543 ves_icall_System_DateTime_GetNow (void)
2545 #ifdef PLATFORM_WIN32
2550 SystemTimeToFileTime (&st, &ft);
2551 return (gint64)504911232000000000L + ((((gint64)ft.dwHighDateTime)<<32) | ft.dwLowDateTime);
2553 /* FIXME: put this in io-layer and call it GetLocalTime */
2557 MONO_ARCH_SAVE_REGS;
2559 if (gettimeofday (&tv, NULL) == 0) {
2560 res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
2563 /* fixme: raise exception */
2569 * This is heavily based on zdump.c from glibc 2.2.
2571 * * data[0]: start of daylight saving time (in DateTime ticks).
2572 * * data[1]: end of daylight saving time (in DateTime ticks).
2573 * * data[2]: utcoffset (in TimeSpan ticks).
2574 * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
2575 * * name[0]: name of this timezone when not daylight saving.
2576 * * name[1]: name of this timezone when daylight saving.
2578 * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
2579 * the class library allows years between 1 and 9999.
2581 * Returns true on success and zero on failure.
2584 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
2586 #ifndef PLATFORM_WIN32
2587 MonoDomain *domain = mono_domain_get ();
2588 struct tm start, tt;
2592 int is_daylight = 0, day;
2595 MONO_ARCH_SAVE_REGS;
2597 if ((year < 1900) || (year > 2100))
2598 mono_raise_exception (mono_get_exception_not_implemented ());
2600 memset (&start, 0, sizeof (start));
2603 start.tm_year = year-1900;
2605 t = mktime (&start);
2606 #if defined (HAVE_TIMEZONE)
2607 #define gmt_offset(x) (-1 * (((timezone / 60 / 60) - daylight) * 100))
2608 #elif defined (HAVE_TM_GMTOFF)
2609 #define gmt_offset(x) x.tm_gmtoff
2611 #error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
2614 gmtoff = gmt_offset (start);
2616 MONO_CHECK_ARG_NULL (data);
2617 MONO_CHECK_ARG_NULL (names);
2619 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2620 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2622 /* For each day of the year, calculate the tm_gmtoff. */
2623 for (day = 0; day < 365; day++) {
2626 tt = *localtime (&t);
2628 /* Daylight saving starts or ends here. */
2629 if (gmt_offset (tt) != gmtoff) {
2633 /* Try to find the exact hour when daylight saving starts/ends. */
2637 tt1 = *localtime (&t1);
2638 } while (gmt_offset (tt1) != gmtoff);
2640 /* Try to find the exact minute when daylight saving starts/ends. */
2643 tt1 = *localtime (&t1);
2644 } while (gmt_offset (tt1) == gmtoff);
2646 strftime (tzone, 10, "%Z", &tt);
2648 /* Write data, if we're already in daylight saving, we're done. */
2650 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
2651 mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2654 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
2655 mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2659 /* This is only set once when we enter daylight saving. */
2660 mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
2661 mono_array_set ((*data), gint64, 3, (gint64)(gmt_offset (tt) - gmtoff) * 10000000L);
2663 gmtoff = gmt_offset (tt);
2666 gmtoff = gmt_offset (tt);
2670 strftime (tzone, 10, "%Z", &tt);
2671 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
2672 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
2673 mono_array_set ((*data), gint64, 0, 0);
2674 mono_array_set ((*data), gint64, 1, 0);
2675 mono_array_set ((*data), gint64, 2, (gint64) gmtoff * 10000000L);
2676 mono_array_set ((*data), gint64, 3, 0);
2681 MonoDomain *domain = mono_domain_get ();
2682 TIME_ZONE_INFORMATION tz_info;
2686 GetTimeZoneInformation (&tz_info);
2688 MONO_CHECK_ARG_NULL (data);
2689 MONO_CHECK_ARG_NULL (names);
2691 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2692 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2694 for (i = 0; i < 32; ++i)
2695 if (!tz_info.DaylightName [i])
2697 mono_array_set ((*names), gpointer, 1, mono_string_new_utf16 (domain, tz_info.DaylightName, i));
2698 for (i = 0; i < 32; ++i)
2699 if (!tz_info.StandardName [i])
2701 mono_array_set ((*names), gpointer, 0, mono_string_new_utf16 (domain, tz_info.StandardName, i));
2703 SystemTimeToFileTime (&tz_info.StandardDate, &ft);
2704 mono_array_set ((*data), gint64, 1, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2705 SystemTimeToFileTime (&tz_info.DaylightDate, &ft);
2706 mono_array_set ((*data), gint64, 0, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2707 mono_array_set ((*data), gint64, 3, tz_info.Bias + tz_info.StandardBias);
2708 mono_array_set ((*data), gint64, 2, tz_info.Bias + tz_info.DaylightBias);
2715 ves_icall_System_Object_obj_address (MonoObject *this)
2717 MONO_ARCH_SAVE_REGS;
2725 ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array)
2732 MONO_ARCH_SAVE_REGS;
2734 klass = array->obj.vtable->klass;
2735 etype = klass->element_class->byval_arg.type;
2736 if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
2739 if (array->bounds == NULL)
2740 length = array->max_length;
2743 for (i = 0; i < klass->rank; ++ i)
2744 length += array->bounds [i].length;
2747 esize = mono_array_element_size (klass);
2748 return length * esize;
2752 ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx)
2754 MONO_ARCH_SAVE_REGS;
2756 return mono_array_get (array, gint8, idx);
2760 ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value)
2762 MONO_ARCH_SAVE_REGS;
2764 mono_array_set (array, gint8, idx, value);
2768 ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count)
2770 char *src_buf, *dest_buf;
2772 MONO_ARCH_SAVE_REGS;
2774 src_buf = (gint8 *)src->vector + src_offset;
2775 dest_buf = (gint8 *)dest->vector + dest_offset;
2777 memcpy (dest_buf, src_buf, count);
2781 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
2783 MonoDomain *domain = mono_object_domain (this);
2785 MonoRealProxy *rp = ((MonoRealProxy *)this);
2789 MONO_ARCH_SAVE_REGS;
2791 res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
2793 ((MonoTransparentProxy *)res)->rp = rp;
2794 type = ((MonoReflectionType *)rp->class_to_proxy)->type;
2795 klass = mono_class_from_mono_type (type);
2797 ((MonoTransparentProxy *)res)->klass = klass;
2799 res->vtable = mono_class_proxy_vtable (domain, klass);
2804 /* System.Environment */
2807 ves_icall_System_Environment_get_MachineName (void)
2809 #if defined (PLATFORM_WIN32)
2814 len = MAX_COMPUTERNAME_LENGTH + 1;
2815 buf = g_new (gunichar2, len);
2818 if (GetComputerName (buf, (PDWORD) &len))
2819 result = mono_string_new_utf16 (mono_domain_get (), buf, len);
2828 MONO_ARCH_SAVE_REGS;
2831 buf = g_new (gchar, len);
2834 if (gethostname (buf, len) == 0)
2835 result = mono_string_new (mono_domain_get (), buf);
2843 ves_icall_System_Environment_get_Platform (void)
2845 MONO_ARCH_SAVE_REGS;
2847 #if defined (PLATFORM_WIN32)
2857 ves_icall_System_Environment_get_NewLine (void)
2859 MONO_ARCH_SAVE_REGS;
2861 #if defined (PLATFORM_WIN32)
2862 return mono_string_new (mono_domain_get (), "\r\n");
2864 return mono_string_new (mono_domain_get (), "\n");
2869 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
2874 MONO_ARCH_SAVE_REGS;
2879 utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
2880 value = g_getenv (utf8_name);
2886 return mono_string_new (mono_domain_get (), value);
2890 * There is no standard way to get at environ.
2892 extern char **environ;
2895 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
2903 MONO_ARCH_SAVE_REGS;
2906 for (e = environ; *e != 0; ++ e)
2909 domain = mono_domain_get ();
2910 names = mono_array_new (domain, mono_defaults.string_class, n);
2913 for (e = environ; *e != 0; ++ e) {
2914 parts = g_strsplit (*e, "=", 2);
2916 str = mono_string_new (domain, *parts);
2917 mono_array_set (names, MonoString *, n, str);
2929 * Returns the number of milliseconds elapsed since the system started.
2932 ves_icall_System_Environment_get_TickCount (void)
2934 #if defined (PLATFORM_WIN32)
2935 return GetTickCount();
2941 MONO_ARCH_SAVE_REGS;
2943 res = (gint32) gettimeofday (&tv, &tz);
2946 res = (gint32) ((tv.tv_sec & 0xFFFFF) * 1000 + (tv.tv_usec / 1000));
2953 ves_icall_System_Environment_Exit (int result)
2955 MONO_ARCH_SAVE_REGS;
2957 /* we may need to do some cleanup here... */
2962 ves_icall_System_Text_Encoding_InternalCodePage (void)
2966 MONO_ARCH_SAVE_REGS;
2968 g_get_charset (&cset);
2969 /* g_print ("charset: %s\n", cset); */
2970 /* handle some common aliases */
2973 if (strcmp (cset, "ANSI_X3.4-1968") == 0)
2977 return mono_string_new (mono_domain_get (), cset);
2981 ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
2982 MonoReflectionMethod *method,
2983 MonoArray *out_args)
2985 MONO_ARCH_SAVE_REGS;
2987 mono_message_init (mono_object_domain (this), this, method, out_args);
2991 ves_icall_IsTransparentProxy (MonoObject *proxy)
2993 MONO_ARCH_SAVE_REGS;
2998 if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
3005 ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (MonoReflectionType *type, MonoBoolean enable)
3010 MONO_ARCH_SAVE_REGS;
3012 klass = mono_class_from_mono_type (type->type);
3013 vtable = mono_class_vtable (mono_domain_get (), klass);
3015 if (enable) vtable->remote = 1;
3016 else vtable->remote = 0;
3020 ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance (MonoReflectionType *type)
3026 MONO_ARCH_SAVE_REGS;
3028 domain = mono_object_domain (type);
3029 klass = mono_class_from_mono_type (type->type);
3031 // Bypass remoting object creation check
3032 return mono_object_new_alloc_specific (mono_class_vtable (domain, klass));
3036 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal (MonoReflectionType *type)
3042 MONO_ARCH_SAVE_REGS;
3044 domain = mono_object_domain (type);
3045 klass = mono_class_from_mono_type (type->type);
3047 if (klass->rank >= 1) {
3048 g_assert (klass->rank == 1);
3049 obj = (MonoObject *) mono_array_new (domain, klass->element_class, 0);
3051 obj = mono_object_new (domain, klass);
3058 ves_icall_System_IO_get_temp_path (void)
3060 MONO_ARCH_SAVE_REGS;
3062 return mono_string_new (mono_domain_get (), g_get_tmp_dir ());
3066 ves_icall_RuntimeMethod_GetFunctionPointer (MonoMethod *method)
3068 MONO_ARCH_SAVE_REGS;
3070 return mono_compile_method (method);
3073 char const * mono_cfg_dir = "";
3076 mono_install_get_config_dir (void)
3078 mono_cfg_dir = getenv ("MONO_CFG_DIR");
3081 mono_cfg_dir = MONO_CFG_DIR;
3086 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
3088 static MonoString *mcpath;
3091 MONO_ARCH_SAVE_REGS;
3096 path = g_build_path (G_DIR_SEPARATOR_S, mono_cfg_dir, "mono", "machine.config", NULL);
3098 #if defined (PLATFORM_WIN32)
3099 /* Avoid mixing '/' and '\\' */
3102 for (i = strlen (path) - 1; i >= 0; i--)
3103 if (path [i] == '/')
3107 mcpath = mono_string_new (mono_domain_get (), path);
3114 ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoString *message)
3116 #if defined (PLATFORM_WIN32)
3117 static void (*output_debug) (gchar *);
3118 static gboolean tried_loading = FALSE;
3121 MONO_ARCH_SAVE_REGS;
3123 if (!tried_loading && output_debug == NULL) {
3126 tried_loading = TRUE;
3127 k32 = g_module_open ("kernel32", G_MODULE_BIND_LAZY);
3129 gchar *error = g_strdup (g_module_error ());
3130 g_warning ("Failed to load kernel32.dll: %s\n", error);
3135 g_module_symbol (k32, "OutputDebugStringW", (gpointer *) &output_debug);
3136 if (!output_debug) {
3137 gchar *error = g_strdup (g_module_error ());
3138 g_warning ("Failed to load OutputDebugStringW: %s\n", error);
3144 if (output_debug == NULL)
3147 str = mono_string_to_utf8 (message);
3151 g_warning ("WriteWindowsDebugString called and PLATFORM_WIN32 not defined!\n");
3155 /* Only used for value types */
3157 ves_icall_System_Activator_CreateInstanceInternal (MonoReflectionType *type)
3162 MONO_ARCH_SAVE_REGS;
3164 domain = mono_object_domain (type);
3165 klass = mono_class_from_mono_type (type->type);
3167 return mono_object_new (domain, klass);
3170 static MonoReflectionMethod *
3171 ves_icall_MonoMethod_get_base_definition (MonoReflectionMethod *m)
3174 MonoMethod *method = m->method;
3175 MonoMethod *result = NULL;
3177 MONO_ARCH_SAVE_REGS;
3179 if (!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
3180 method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ||
3181 method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
3184 if (method->klass == NULL || (klass = method->klass->parent) == NULL)
3187 if (klass->vtable_size > method->slot)
3188 result = klass->vtable [method->slot];
3193 return mono_method_get_object (mono_domain_get (), result, NULL);
3198 static gconstpointer icall_map [] = {
3202 "System.Array::GetValue", ves_icall_System_Array_GetValue,
3203 "System.Array::SetValue", ves_icall_System_Array_SetValue,
3204 "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
3205 "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
3206 "System.Array::GetRank", ves_icall_System_Array_GetRank,
3207 "System.Array::GetLength", ves_icall_System_Array_GetLength,
3208 "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
3209 "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
3210 "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
3211 "System.Array::Clone", mono_array_clone,
3216 "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
3217 "System.Object::GetType", ves_icall_System_Object_GetType,
3218 "System.Object::GetHashCode", ves_icall_System_Object_GetHashCode,
3219 "System.Object::obj_address", ves_icall_System_Object_obj_address,
3224 "System.ValueType::GetHashCode", ves_icall_System_ValueType_GetHashCode,
3225 "System.ValueType::Equals", ves_icall_System_ValueType_Equals,
3231 "System.String::.ctor(char*)", ves_icall_System_String_ctor_charp,
3232 "System.String::.ctor(char*,int,int)", ves_icall_System_String_ctor_charp_int_int,
3233 "System.String::.ctor(sbyte*)", ves_icall_System_String_ctor_sbytep,
3234 "System.String::.ctor(sbyte*,int,int)", ves_icall_System_String_ctor_sbytep_int_int,
3235 "System.String::.ctor(sbyte*,int,int,System.Text.Encoding)", ves_icall_System_String_ctor_encoding,
3236 "System.String::.ctor(char[])", ves_icall_System_String_ctor_chara,
3237 "System.String::.ctor(char[],int,int)", ves_icall_System_String_ctor_chara_int_int,
3238 "System.String::.ctor(char,int)", ves_icall_System_String_ctor_char_int,
3239 "System.String::InternalEquals", ves_icall_System_String_InternalEquals,
3240 "System.String::InternalJoin", ves_icall_System_String_InternalJoin,
3241 "System.String::InternalInsert", ves_icall_System_String_InternalInsert,
3242 "System.String::InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char,
3243 "System.String::InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str,
3244 "System.String::InternalRemove", ves_icall_System_String_InternalRemove,
3245 "System.String::InternalCopyTo", ves_icall_System_String_InternalCopyTo,
3246 "System.String::InternalSplit", ves_icall_System_String_InternalSplit,
3247 "System.String::InternalTrim", ves_icall_System_String_InternalTrim,
3248 "System.String::InternalIndexOf(char,int,int)", ves_icall_System_String_InternalIndexOf_Char,
3249 "System.String::InternalIndexOf(string,int,int)", ves_icall_System_String_InternalIndexOf_Str,
3250 "System.String::InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny,
3251 "System.String::InternalLastIndexOf(char,int,int)", ves_icall_System_String_InternalLastIndexOf_Char,
3252 "System.String::InternalLastIndexOf(string,int,int)", ves_icall_System_String_InternalLastIndexOf_Str,
3253 "System.String::InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny,
3254 "System.String::InternalPad", ves_icall_System_String_InternalPad,
3255 "System.String::InternalToLower", ves_icall_System_String_InternalToLower,
3256 "System.String::InternalToUpper", ves_icall_System_String_InternalToUpper,
3257 "System.String::InternalAllocateStr", ves_icall_System_String_InternalAllocateStr,
3258 "System.String::InternalStrcpy(string,int,string)", ves_icall_System_String_InternalStrcpy_Str,
3259 "System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
3260 "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
3261 "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
3262 "System.String::InternalCompare(string,int,string,int,int,int)", ves_icall_System_String_InternalCompareStr_N,
3263 "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
3264 "System.String::get_Chars", ves_icall_System_String_get_Chars,
3269 "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
3270 "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
3271 "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
3272 "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
3273 "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
3274 "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
3275 "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
3276 "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
3277 "System.AppDomain::InternalUnload", ves_icall_System_AppDomain_InternalUnload,
3278 "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
3279 "System.AppDomain::InternalSetDomain", ves_icall_System_AppDomain_InternalSetDomain,
3280 "System.AppDomain::InternalSetDomainByID", ves_icall_System_AppDomain_InternalSetDomainByID,
3281 "System.AppDomain::InternalSetContext", ves_icall_System_AppDomain_InternalSetContext,
3282 "System.AppDomain::InternalGetContext", ves_icall_System_AppDomain_InternalGetContext,
3285 * System.AppDomainSetup
3287 "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
3292 "System.Double::ToStringImpl", mono_double_ToStringImpl,
3293 "System.Double::ParseImpl", mono_double_ParseImpl,
3298 "System.Single::ToStringImpl", mono_float_ToStringImpl,
3303 "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
3304 "System.Decimal::decimal2Int64", mono_decimal2Int64,
3305 "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
3306 "System.Decimal::decimalIncr", mono_decimalIncr,
3307 "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
3308 "System.Decimal::decimal2double", mono_decimal2double,
3309 "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
3310 "System.Decimal::decimalRound", mono_decimalRound,
3311 "System.Decimal::decimalMult", mono_decimalMult,
3312 "System.Decimal::decimalDiv", mono_decimalDiv,
3313 "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
3314 "System.Decimal::decimalCompare", mono_decimalCompare,
3315 "System.Decimal::string2decimal", mono_string2decimal,
3316 "System.Decimal::decimal2string", mono_decimal2string,
3321 "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
3322 "System.Reflection.Emit.ModuleBuilder::basic_init", mono_image_module_basic_init,
3327 "System.Reflection.Emit.AssemblyBuilder::getDataChunk", ves_icall_AssemblyBuilder_getDataChunk,
3328 "System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
3329 "System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
3330 "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
3331 "System.Reflection.Emit.AssemblyBuilder::build_metadata", ves_icall_AssemblyBuilder_build_metadata,
3336 "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
3337 "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
3338 "System.Reflection.MonoFieldInfo::get_field_info", ves_icall_get_field_info,
3339 "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
3340 "System.Reflection.MonoEventInfo::get_event_info", ves_icall_get_event_info,
3341 "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
3342 "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
3343 "System.Reflection.MethodBase::GetCurrentMethod", ves_icall_GetCurrentMethod,
3344 "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
3345 "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
3346 "System.Reflection.MonoField::GetValueInternal", ves_icall_MonoField_GetValueInternal,
3347 "System.Reflection.MonoField::SetValueInternal", ves_icall_FieldInfo_SetValueInternal,
3348 "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
3349 "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
3351 "System.RuntimeMethodHandle::GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer,
3352 "System.Reflection.MonoMethod::get_base_definition", ves_icall_MonoMethod_get_base_definition,
3356 "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
3357 "System.Enum::get_value", ves_icall_System_Enum_get_value,
3358 "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
3363 "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
3364 "System.Reflection.Emit.TypeBuilder::create_internal_class", mono_reflection_create_internal_class,
3365 "System.Reflection.Emit.TypeBuilder::create_runtime_class", mono_reflection_create_runtime_class,
3374 "System.Type::internal_from_name", ves_icall_type_from_name,
3375 "System.Type::internal_from_handle", ves_icall_type_from_handle,
3376 "System.MonoType::get_attributes", ves_icall_get_attributes,
3377 "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
3378 "System.Type::Equals", ves_icall_type_Equals,
3379 "System.Type::GetTypeCode", ves_icall_type_GetTypeCode,
3380 "System.Type::GetInterfaceMapData", ves_icall_Type_GetInterfaceMapData,
3383 * System.Runtime.CompilerServices.RuntimeHelpers
3385 "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray,
3386 "System.Runtime.CompilerServices.RuntimeHelpers::GetOffsetToStringData", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData,
3387 "System.Runtime.CompilerServices.RuntimeHelpers::GetObjectValue", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue,
3388 "System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor,
3393 "System.Threading.Thread::Abort(object)", ves_icall_System_Threading_Thread_Abort,
3394 "System.Threading.Thread::ResetAbort", ves_icall_System_Threading_Thread_ResetAbort,
3395 "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
3396 "System.Threading.Thread::Thread_free_internal", ves_icall_System_Threading_Thread_Thread_free_internal,
3397 "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
3398 "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
3399 "System.Threading.Thread::CurrentThread_internal", mono_thread_current,
3400 "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
3401 "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
3402 "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
3403 "System.Threading.Thread::GetDomainID", ves_icall_System_Threading_Thread_GetDomainID,
3404 "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
3405 "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
3406 "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
3407 "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
3408 "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
3409 "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
3410 "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
3411 "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
3412 "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
3413 "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
3414 "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
3415 "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
3418 * System.Threading.WaitHandle
3420 "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
3421 "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
3422 "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
3425 * System.Runtime.InteropServices.Marshal
3427 "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
3428 "System.Runtime.InteropServices.Marshal::ReadByte", ves_icall_System_Runtime_InteropServices_Marshal_ReadByte,
3429 "System.Runtime.InteropServices.Marshal::ReadInt16", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16,
3430 "System.Runtime.InteropServices.Marshal::ReadInt32", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32,
3431 "System.Runtime.InteropServices.Marshal::ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64,
3432 "System.Runtime.InteropServices.Marshal::WriteIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr,
3433 "System.Runtime.InteropServices.Marshal::WriteByte", ves_icall_System_Runtime_InteropServices_Marshal_WriteByte,
3434 "System.Runtime.InteropServices.Marshal::WriteInt16", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16,
3435 "System.Runtime.InteropServices.Marshal::WriteInt32", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32,
3436 "System.Runtime.InteropServices.Marshal::WriteInt64", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64,
3438 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
3439 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
3440 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
3441 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
3442 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni,
3443 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len,
3444 "System.Runtime.InteropServices.Marshal::PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR,
3446 "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
3447 "System.Runtime.InteropServices.Marshal::AllocHGlobal", mono_marshal_alloc,
3448 "System.Runtime.InteropServices.Marshal::FreeHGlobal", mono_marshal_free,
3449 "System.Runtime.InteropServices.Marshal::ReAllocHGlobal", mono_marshal_realloc,
3450 "System.Runtime.InteropServices.Marshal::copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged,
3451 "System.Runtime.InteropServices.Marshal::copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged,
3452 "System.Runtime.InteropServices.Marshal::SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf,
3453 "System.Runtime.InteropServices.Marshal::StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr,
3454 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure,
3455 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type,
3456 "System.Runtime.InteropServices.Marshal::OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf,
3457 "System.Runtime.InteropServices.Marshal::StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
3458 "System.Runtime.InteropServices.Marshal::StringToHGlobalAuto", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
3459 "System.Runtime.InteropServices.Marshal::StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni,
3460 "System.Runtime.InteropServices.Marshal::DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure,
3463 "System.Reflection.Assembly::LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom,
3464 "System.Reflection.Assembly::InternalGetType", ves_icall_System_Reflection_Assembly_InternalGetType,
3465 "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
3466 "System.Reflection.Assembly::FillName", ves_icall_System_Reflection_Assembly_FillName,
3467 "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
3468 "System.Reflection.Assembly::get_location", ves_icall_System_Reflection_Assembly_get_location,
3469 "System.Reflection.Assembly::GetExecutingAssembly", ves_icall_System_Reflection_Assembly_GetExecutingAssembly,
3470 "System.Reflection.Assembly::GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly,
3471 "System.Reflection.Assembly::GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly,
3472 "System.Reflection.Assembly::get_EntryPoint", ves_icall_System_Reflection_Assembly_get_EntryPoint,
3473 "System.Reflection.Assembly::GetManifestResourceNames", ves_icall_System_Reflection_Assembly_GetManifestResourceNames,
3474 "System.Reflection.Assembly::GetManifestResourceInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInternal,
3475 "System.Reflection.Assembly::GetFilesInternal", ves_icall_System_Reflection_Assembly_GetFilesInternal,
3476 "System.Reflection.Assembly::GetReferencedAssemblies", ves_icall_System_Reflection_Assembly_GetReferencedAssemblies,
3481 "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
3482 "System.MonoType::type_from_obj", mono_type_type_from_obj,
3483 "System.MonoType::GetElementType", ves_icall_MonoType_GetElementType,
3484 "System.MonoType::get_type_info", ves_icall_get_type_info,
3485 "System.MonoType::get_BaseType", ves_icall_get_type_parent,
3486 "System.MonoType::get_Module", ves_icall_MonoType_get_Module,
3487 "System.MonoType::IsPointerImpl", ves_icall_type_ispointer,
3488 "System.MonoType::IsByRefImpl", ves_icall_type_isbyref,
3489 "System.MonoType::GetField", ves_icall_Type_GetField,
3490 "System.MonoType::GetFields", ves_icall_Type_GetFields,
3491 "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
3492 "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
3493 "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
3494 "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
3495 "System.MonoType::InternalGetEvent", ves_icall_MonoType_GetEvent,
3496 "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
3497 "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
3500 * System.Net.Sockets I/O Services
3502 "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
3503 "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
3504 "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
3505 "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
3506 "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
3507 "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
3508 "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
3509 "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
3510 "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
3511 "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
3512 "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
3513 "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
3514 "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
3515 "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
3516 "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
3517 "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
3518 "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
3519 "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
3520 "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
3521 "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
3522 "System.Net.Dns::GetHostByName_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByName_internal,
3523 "System.Net.Dns::GetHostByAddr_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByAddr_internal,
3524 "System.Net.Dns::GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal,
3529 "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
3530 "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
3531 "System.Char::IsControl", ves_icall_System_Char_IsControl,
3532 "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
3533 "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
3534 "System.Char::IsLower", ves_icall_System_Char_IsLower,
3535 "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
3536 "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
3537 "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
3538 "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
3539 "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
3540 "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
3541 "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
3542 "System.Char::ToLower", ves_icall_System_Char_ToLower,
3543 "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
3546 * System.Text.Encoding
3548 "System.Text.Encoding::InternalCodePage", ves_icall_System_Text_Encoding_InternalCodePage,
3550 "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
3551 "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
3556 "System.GC::InternalCollect", ves_icall_System_GC_InternalCollect,
3557 "System.GC::GetTotalMemory", ves_icall_System_GC_GetTotalMemory,
3558 "System.GC::KeepAlive", ves_icall_System_GC_KeepAlive,
3559 "System.GC::ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize,
3560 "System.GC::SuppressFinalize", ves_icall_System_GC_SuppressFinalize,
3561 "System.GC::WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers,
3562 "System.Runtime.InteropServices.GCHandle::GetTarget", ves_icall_System_GCHandle_GetTarget,
3563 "System.Runtime.InteropServices.GCHandle::GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle,
3564 "System.Runtime.InteropServices.GCHandle::FreeHandle", ves_icall_System_GCHandle_FreeHandle,
3565 "System.Runtime.InteropServices.GCHandle::GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject,
3568 * System.Security.Cryptography calls
3571 "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes,
3572 "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetNonZeroBytes,
3577 "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
3578 "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
3579 "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
3580 "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
3585 "System.IO.MonoIO::CreateDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CreateDirectory,
3586 "System.IO.MonoIO::RemoveDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_RemoveDirectory,
3587 "System.IO.MonoIO::FindFirstFile(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindFirstFile,
3588 "System.IO.MonoIO::FindNextFile(intptr,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindNextFile,
3589 "System.IO.MonoIO::FindClose(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_FindClose,
3590 "System.IO.MonoIO::GetCurrentDirectory(System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
3591 "System.IO.MonoIO::SetCurrentDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
3592 "System.IO.MonoIO::MoveFile(string,string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile,
3593 "System.IO.MonoIO::CopyFile(string,string,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CopyFile,
3594 "System.IO.MonoIO::DeleteFile(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_DeleteFile,
3595 "System.IO.MonoIO::GetFileAttributes(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileAttributes,
3596 "System.IO.MonoIO::SetFileAttributes(string,System.IO.FileAttributes,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileAttributes,
3597 "System.IO.MonoIO::GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType,
3598 "System.IO.MonoIO::GetFileStat(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat,
3599 "System.IO.MonoIO::Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open,
3600 "System.IO.MonoIO::Close(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Close,
3601 "System.IO.MonoIO::Read(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Read,
3602 "System.IO.MonoIO::Write(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Write,
3603 "System.IO.MonoIO::Seek(intptr,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek,
3604 "System.IO.MonoIO::GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength,
3605 "System.IO.MonoIO::SetLength(intptr,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetLength,
3606 "System.IO.MonoIO::SetFileTime(intptr,long,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileTime,
3607 "System.IO.MonoIO::Flush(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Flush,
3608 "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
3609 "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
3610 "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
3611 "System.IO.MonoIO::CreatePipe(intptr&,intptr&)", ves_icall_System_IO_MonoIO_CreatePipe,
3612 "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
3613 "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
3614 "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
3615 "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
3616 "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
3621 "System.Math::Floor", ves_icall_System_Math_Floor,
3622 "System.Math::Round", ves_icall_System_Math_Round,
3623 "System.Math::Round2", ves_icall_System_Math_Round2,
3624 "System.Math::Sin", ves_icall_System_Math_Sin,
3625 "System.Math::Cos", ves_icall_System_Math_Cos,
3626 "System.Math::Tan", ves_icall_System_Math_Tan,
3627 "System.Math::Sinh", ves_icall_System_Math_Sinh,
3628 "System.Math::Cosh", ves_icall_System_Math_Cosh,
3629 "System.Math::Tanh", ves_icall_System_Math_Tanh,
3630 "System.Math::Acos", ves_icall_System_Math_Acos,
3631 "System.Math::Asin", ves_icall_System_Math_Asin,
3632 "System.Math::Atan", ves_icall_System_Math_Atan,
3633 "System.Math::Atan2", ves_icall_System_Math_Atan2,
3634 "System.Math::Exp", ves_icall_System_Math_Exp,
3635 "System.Math::Log", ves_icall_System_Math_Log,
3636 "System.Math::Log10", ves_icall_System_Math_Log10,
3637 "System.Math::Pow", ves_icall_System_Math_Pow,
3638 "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
3641 * System.Environment
3643 "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
3644 "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
3645 "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
3646 "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
3647 "System.Environment::GetCommandLineArgs", mono_runtime_get_main_args,
3648 "System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
3649 "System.Environment::Exit", ves_icall_System_Environment_Exit,
3650 "System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
3651 "System.Environment::get_ExitCode", mono_environment_exitcode_get,
3652 "System.Environment::set_ExitCode", mono_environment_exitcode_set,
3655 * System.Runtime.Remoting
3657 "System.Runtime.Remoting.RemotingServices::InternalExecute",
3658 ves_icall_InternalExecute,
3659 "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
3660 ves_icall_IsTransparentProxy,
3663 * System.Runtime.Remoting.Activation
3665 "System.Runtime.Remoting.Activation.ActivationServices::AllocateUninitializedClassInstance",
3666 ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance,
3667 "System.Runtime.Remoting.Activation.ActivationServices::EnableProxyActivation",
3668 ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation,
3671 * System.Runtime.Remoting.Messaging
3673 "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
3674 ves_icall_MonoMethodMessage_InitMessage,
3677 * System.Runtime.Remoting.Proxies
3679 "System.Runtime.Remoting.Proxies.RealProxy::InternalGetTransparentProxy",
3680 ves_icall_Remoting_RealProxy_GetTransparentProxy,
3683 * System.Threading.Interlocked
3685 "System.Threading.Interlocked::Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int,
3686 "System.Threading.Interlocked::Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long,
3687 "System.Threading.Interlocked::Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int,
3688 "System.Threading.Interlocked::Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long,
3689 "System.Threading.Interlocked::CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int,
3690 "System.Threading.Interlocked::CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object,
3691 "System.Threading.Interlocked::CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single,
3692 "System.Threading.Interlocked::Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int,
3693 "System.Threading.Interlocked::Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object,
3694 "System.Threading.Interlocked::Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single,
3697 * System.Diagnostics.Process
3699 "System.Diagnostics.Process::GetProcess_internal(int)", ves_icall_System_Diagnostics_Process_GetProcess_internal,
3700 "System.Diagnostics.Process::GetProcesses_internal()", ves_icall_System_Diagnostics_Process_GetProcesses_internal,
3701 "System.Diagnostics.Process::GetPid_internal()", ves_icall_System_Diagnostics_Process_GetPid_internal,
3702 "System.Diagnostics.Process::Process_free_internal(intptr)", ves_icall_System_Diagnostics_Process_Process_free_internal,
3703 "System.Diagnostics.Process::GetModules_internal()", ves_icall_System_Diagnostics_Process_GetModules_internal,
3704 "System.Diagnostics.Process::Start_internal(string,string,intptr,intptr,intptr,ProcInfo&)", ves_icall_System_Diagnostics_Process_Start_internal,
3705 "System.Diagnostics.Process::WaitForExit_internal(intptr,int)", ves_icall_System_Diagnostics_Process_WaitForExit_internal,
3706 "System.Diagnostics.Process::ExitTime_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitTime_internal,
3707 "System.Diagnostics.Process::StartTime_internal(intptr)", ves_icall_System_Diagnostics_Process_StartTime_internal,
3708 "System.Diagnostics.Process::ExitCode_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitCode_internal,
3709 "System.Diagnostics.Process::ProcessName_internal(intptr)", ves_icall_System_Diagnostics_Process_ProcessName_internal,
3710 "System.Diagnostics.Process::GetWorkingSet_internal(intptr,int&,int&)", ves_icall_System_Diagnostics_Process_GetWorkingSet_internal,
3711 "System.Diagnostics.Process::SetWorkingSet_internal(intptr,int,int,bool)", ves_icall_System_Diagnostics_Process_SetWorkingSet_internal,
3712 "System.Diagnostics.FileVersionInfo::GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal,
3717 "System.Delegate::CreateDelegate_internal", ves_icall_System_Delegate_CreateDelegate_internal,
3720 * System.Runtime.Serialization
3722 "System.Runtime.Serialization.FormatterServices::GetUninitializedObjectInternal",
3723 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal,
3728 "System.IO.Path::get_temp_path", ves_icall_System_IO_get_temp_path,
3731 * Private icalls for the Mono Debugger
3733 "System.Reflection.Assembly::MonoDebugger_GetMethod",
3734 ves_icall_MonoDebugger_GetMethod,
3736 "System.Reflection.Assembly::MonoDebugger_GetMethodToken",
3737 ves_icall_MonoDebugger_GetMethodToken,
3739 "System.Reflection.Assembly::MonoDebugger_GetLocalTypeFromSignature",
3740 ves_icall_MonoDebugger_GetLocalTypeFromSignature,
3742 "System.Reflection.Assembly::MonoDebugger_GetType",
3743 ves_icall_MonoDebugger_GetType,
3746 * System.Configuration
3748 "System.Configuration.DefaultConfig::get_machine_config_path",
3749 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
3752 * System.Diagnostics.DefaultTraceListener
3754 "System.Diagnostics.DefaultTraceListener::WriteWindowsDebugString",
3755 ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString,
3759 "System.Activator::CreateInstanceInternal",
3760 ves_icall_System_Activator_CreateInstanceInternal,
3763 * add other internal calls here
3769 mono_init_icall (void)
3774 while ((name = icall_map [i])) {
3775 mono_add_internal_call (name, icall_map [i+1]);