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/reflection.h>
25 #include <mono/metadata/assembly.h>
26 #include <mono/metadata/tabledefs.h>
27 #include <mono/metadata/exception.h>
28 #include <mono/metadata/file-io.h>
29 #include <mono/metadata/socket-io.h>
30 #include <mono/metadata/mono-endian.h>
31 #include <mono/metadata/tokentype.h>
32 #include <mono/metadata/unicode.h>
33 #include <mono/metadata/appdomain.h>
34 #include <mono/metadata/marshal.h>
35 #include <mono/metadata/gc.h>
36 #include <mono/metadata/rand.h>
37 #include <mono/metadata/sysmath.h>
38 #include <mono/metadata/debug-symfile.h>
39 #include <mono/metadata/string-icalls.h>
40 #include <mono/metadata/process.h>
41 #include <mono/io-layer/io-layer.h>
42 #include <mono/utils/strtod.h>
44 #if defined (PLATFORM_WIN32)
50 mono_double_ToStringImpl (double value)
52 /* FIXME: Handle formats, etc. */
55 retVal = g_strdup_printf ("%.15g", value);
56 s = mono_string_new (mono_domain_get (), retVal);
62 * We expect a pointer to a char, not a string
65 mono_double_ParseImpl (char *ptr)
67 return bsd_strtod (ptr, NULL);
71 mono_float_ToStringImpl (float value)
73 return mono_double_ToStringImpl (value);
77 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
84 ao = (MonoArray *)this;
85 ac = (MonoClass *)ao->obj.vtable->klass;
87 esize = mono_array_element_size (ac);
88 ea = (gpointer*)((char*)ao->vector + (pos * esize));
90 if (ac->element_class->valuetype)
91 return mono_value_box (this->vtable->domain, ac->element_class, ea);
97 ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
103 MONO_CHECK_ARG_NULL (idxs);
105 io = (MonoArray *)idxs;
106 ic = (MonoClass *)io->obj.vtable->klass;
108 ao = (MonoArray *)this;
109 ac = (MonoClass *)ao->obj.vtable->klass;
111 g_assert (ic->rank == 1);
112 if (io->bounds != NULL || io->max_length != ac->rank)
113 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
115 ind = (guint32 *)io->vector;
117 if (ao->bounds == NULL) {
118 if (*ind < 0 || *ind >= ao->max_length)
119 mono_raise_exception (mono_get_exception_index_out_of_range ());
121 return ves_icall_System_Array_GetValueImpl (this, *ind);
124 for (i = 0; i < ac->rank; i++)
125 if ((ind [i] < ao->bounds [i].lower_bound) ||
126 (ind [i] >= ao->bounds [i].length + ao->bounds [i].lower_bound))
127 mono_raise_exception (mono_get_exception_index_out_of_range ());
129 pos = ind [0] - ao->bounds [0].lower_bound;
130 for (i = 1; i < ac->rank; i++)
131 pos = pos*ao->bounds [i].length + ind [i] -
132 ao->bounds [i].lower_bound;
134 return ves_icall_System_Array_GetValueImpl (this, pos);
138 ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
140 MonoClass *ac, *vc, *ec;
149 vc = value->vtable->klass;
153 ac = this->obj.vtable->klass;
154 ec = ac->element_class;
156 esize = mono_array_element_size (ac);
157 ea = (gpointer*)((char*)this->vector + (pos * esize));
158 va = (gpointer*)((char*)value + sizeof (MonoObject));
161 memset (ea, 0, esize);
165 #define NO_WIDENING_CONVERSION G_STMT_START{\
166 mono_raise_exception (mono_get_exception_argument ( \
167 "value", "not a widening conversion")); \
170 #define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
171 if (esize < vsize + (extra)) \
172 mono_raise_exception (mono_get_exception_argument ( \
173 "value", "not a widening conversion")); \
176 #define INVALID_CAST G_STMT_START{\
177 mono_raise_exception (mono_get_exception_invalid_cast ()); \
180 /* Check element (destination) type. */
181 switch (ec->byval_arg.type) {
182 case MONO_TYPE_STRING:
183 switch (vc->byval_arg.type) {
184 case MONO_TYPE_STRING:
190 case MONO_TYPE_BOOLEAN:
191 switch (vc->byval_arg.type) {
192 case MONO_TYPE_BOOLEAN:
205 NO_WIDENING_CONVERSION;
212 if (!ec->valuetype) {
213 *ea = (gpointer)value;
217 if (mono_object_isinst (value, ec)) {
218 memcpy (ea, (char *)value + sizeof (MonoObject), esize);
225 vsize = mono_class_instance_size (vc) - sizeof (MonoObject);
228 g_message (G_STRLOC ": %d (%d) <= %d (%d)",
229 ec->byval_arg.type, esize,
230 vc->byval_arg.type, vsize);
233 #define ASSIGN_UNSIGNED(etype) G_STMT_START{\
234 switch (vc->byval_arg.type) { \
239 case MONO_TYPE_CHAR: \
240 CHECK_WIDENING_CONVERSION(0); \
241 *(etype *) ea = (etype) u64; \
243 /* You can't assign a signed value to an unsigned array. */ \
248 /* You can't assign a floating point number to an integer array. */ \
251 NO_WIDENING_CONVERSION; \
255 #define ASSIGN_SIGNED(etype) G_STMT_START{\
256 switch (vc->byval_arg.type) { \
261 CHECK_WIDENING_CONVERSION(0); \
262 *(etype *) ea = (etype) i64; \
264 /* You can assign an unsigned value to a signed array if the array's */ \
265 /* element size is larger than the value size. */ \
270 case MONO_TYPE_CHAR: \
271 CHECK_WIDENING_CONVERSION(1); \
272 *(etype *) ea = (etype) u64; \
274 /* You can't assign a floating point number to an integer array. */ \
277 NO_WIDENING_CONVERSION; \
281 #define ASSIGN_REAL(etype) G_STMT_START{\
282 switch (vc->byval_arg.type) { \
285 CHECK_WIDENING_CONVERSION(0); \
286 *(etype *) ea = (etype) r64; \
288 /* All integer values fit into a floating point array, so we don't */ \
289 /* need to CHECK_WIDENING_CONVERSION here. */ \
294 *(etype *) ea = (etype) i64; \
300 case MONO_TYPE_CHAR: \
301 *(etype *) ea = (etype) u64; \
306 switch (vc->byval_arg.type) {
308 u64 = *(guint8 *) va;
311 u64 = *(guint16 *) va;
314 u64 = *(guint32 *) va;
317 u64 = *(guint64 *) va;
323 i64 = *(gint16 *) va;
326 i64 = *(gint32 *) va;
329 i64 = *(gint64 *) va;
332 r64 = *(gfloat *) va;
335 r64 = *(gdouble *) va;
338 u64 = *(guint16 *) va;
340 case MONO_TYPE_BOOLEAN:
341 /* Boolean is only compatible with itself. */
342 switch (ec->byval_arg.type) {
354 NO_WIDENING_CONVERSION;
361 /* If we can't do a direct copy, let's try a widening conversion. */
362 switch (ec->byval_arg.type) {
364 ASSIGN_UNSIGNED (guint16);
366 ASSIGN_UNSIGNED (guint8);
368 ASSIGN_UNSIGNED (guint16);
370 ASSIGN_UNSIGNED (guint32);
372 ASSIGN_UNSIGNED (guint64);
374 ASSIGN_SIGNED (gint8);
376 ASSIGN_SIGNED (gint16);
378 ASSIGN_SIGNED (gint32);
380 ASSIGN_SIGNED (gint64);
382 ASSIGN_REAL (gfloat);
384 ASSIGN_REAL (gdouble);
388 /* Not reached, INVALID_CAST does not return. Just to avoid a compiler warning ... */
392 #undef NO_WIDENING_CONVERSION
393 #undef CHECK_WIDENING_CONVERSION
394 #undef ASSIGN_UNSIGNED
400 ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
406 MONO_CHECK_ARG_NULL (idxs);
408 ic = idxs->obj.vtable->klass;
409 ac = this->obj.vtable->klass;
411 g_assert (ic->rank == 1);
412 if (idxs->bounds != NULL || idxs->max_length != ac->rank)
413 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
415 ind = (guint32 *)idxs->vector;
417 if (this->bounds == NULL) {
418 if (*ind < 0 || *ind >= this->max_length)
419 mono_raise_exception (mono_get_exception_index_out_of_range ());
421 ves_icall_System_Array_SetValueImpl (this, value, *ind);
425 for (i = 0; i < ac->rank; i++)
426 if ((ind [i] < this->bounds [i].lower_bound) ||
427 (ind [i] >= this->bounds [i].length + this->bounds [i].lower_bound))
428 mono_raise_exception (mono_get_exception_index_out_of_range ());
430 pos = ind [0] - this->bounds [0].lower_bound;
431 for (i = 1; i < ac->rank; i++)
432 pos = pos * this->bounds [i].length + ind [i] -
433 this->bounds [i].lower_bound;
435 ves_icall_System_Array_SetValueImpl (this, value, pos);
439 ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
445 MONO_CHECK_ARG_NULL (type);
446 MONO_CHECK_ARG_NULL (lengths);
448 MONO_CHECK_ARG (lengths, mono_array_length (lengths) > 0);
450 MONO_CHECK_ARG (bounds, mono_array_length (lengths) == mono_array_length (bounds));
452 for (i = 0; i < mono_array_length (lengths); i++)
453 if (mono_array_get (lengths, gint32, i) < 0)
454 mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
456 aklass = mono_array_class_get (type->type, mono_array_length (lengths));
458 sizes = alloca (aklass->rank * sizeof(guint32) * 2);
459 for (i = 0; i < aklass->rank; ++i) {
460 sizes [i] = mono_array_get (lengths, gint32, i);
462 sizes [i + aklass->rank] = mono_array_get (bounds, gint32, i);
464 sizes [i + aklass->rank] = 0;
467 array = mono_array_new_full (mono_domain_get (), aklass, sizes, sizes + aklass->rank);
473 ves_icall_System_Array_GetRank (MonoObject *this)
475 return this->vtable->klass->rank;
479 ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
481 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
482 if ((dimension < 0) || (dimension >= rank))
483 mono_raise_exception (mono_get_exception_index_out_of_range ());
485 if (this->bounds == NULL)
486 return this->max_length;
488 return this->bounds [dimension].length;
492 ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
494 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
495 if ((dimension < 0) || (dimension >= rank))
496 mono_raise_exception (mono_get_exception_index_out_of_range ());
498 if (this->bounds == NULL)
501 return this->bounds [dimension].lower_bound;
505 ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
507 int element_size = mono_array_element_size (source->obj.vtable->klass);
508 void * dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
509 void * source_addr = mono_array_addr_with_size (source, element_size, source_idx);
511 g_assert (dest_idx + length <= mono_array_length (dest));
512 g_assert (source_idx + length <= mono_array_length (source));
513 memmove (dest_addr, source_addr, element_size * length);
517 ves_icall_InitializeArray (MonoArray *array, MonoClassField *field_handle)
519 MonoClass *klass = array->obj.vtable->klass;
520 guint32 size = mono_array_element_size (klass);
523 if (array->bounds == NULL)
524 size *= array->max_length;
526 for (i = 0; i < klass->rank; ++i)
527 size *= array->bounds [i].length;
529 memcpy (mono_array_addr (array, char, 0), field_handle->data, size);
531 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
535 guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
537 for (i = 0; i < size; i += n/8, data++) { \
538 tmp = read ## n (data); \
543 /* printf ("Initialize array with elements of %s type\n", klass->element_class->name); */
545 switch (klass->element_class->byval_arg.type) {
565 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
567 return mono_object_clone (this);
571 #define MONO_OBJECT_ALIGNMENT_SHIFT 3
573 #define MONO_OBJECT_ALIGNMENT_SHIFT 2
577 * Return hashcode based on object address. This function will need to be
578 * smarter in the presence of a moving garbage collector, which will cache
579 * the address hash before relocating the object.
581 * Wang's address-based hash function:
582 * http://www.concentric.net/~Ttwang/tech/addrhash.htm
585 ves_icall_System_Object_GetHashCode (MonoObject *this)
587 register guint32 key;
588 key = (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
590 return key & 0x7fffffff;
594 * A hash function for value types. I have no idea if this is a good hash
595 * function (its similar to g_str_hash).
598 ves_icall_System_ValueType_GetHashCode (MonoObject *this)
604 MONO_CHECK_ARG_NULL (this);
606 size = this->vtable->klass->instance_size - sizeof (MonoObject);
608 p = (const char *)this + sizeof (MonoObject);
610 for (i = 0; i < size; i++) {
611 h = (h << 5) - h + *p;
619 ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that)
624 MONO_CHECK_ARG_NULL (that);
626 if (this->vtable != that->vtable)
629 size = this->vtable->klass->instance_size - sizeof (MonoObject);
631 p = (const char *)this + sizeof (MonoObject);
632 s = (const char *)that + sizeof (MonoObject);
634 return memcmp (p, s, size)? FALSE: TRUE;
637 static MonoReflectionType *
638 ves_icall_System_Object_GetType (MonoObject *obj)
640 return mono_type_get_object (mono_domain_get (), &obj->vtable->klass->byval_arg);
644 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
646 mtype->type = &obj->vtable->klass->byval_arg;
647 g_assert (mtype->type->type);
651 ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObject *obj)
653 return mono_image_create_token (assb->dynamic_assembly, obj);
657 ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, MonoArray *buf, gint32 offset)
660 MonoDynamicAssembly *ass = assb->dynamic_assembly;
661 char *p = mono_array_addr (buf, char, 0);
663 mono_image_create_pefile (assb);
665 if (offset >= ass->pefile.index)
667 count = mono_array_length (buf);
668 count = MIN (count, ass->pefile.index - offset);
670 memcpy (p, ass->pefile.data + offset, count);
676 get_get_type_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data) {
677 MonoImage **dest = data;
679 /* skip icalls and Type::GetType () */
680 if (!m || m->wrapper_type || (m->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
681 (strcmp (m->name, "GetType") == 0 && m->klass == mono_defaults.monotype_class->parent))
683 *dest = m->klass->image;
687 static MonoReflectionType*
688 ves_icall_type_from_name (MonoString *name)
690 MonoImage *image = NULL;
694 mono_stack_walk (get_get_type_caller, &image);
695 str = mono_string_to_utf8 (name);
696 /*g_print ("requested type %s\n", str);*/
697 type = mono_reflection_type_from_name (str, image);
701 /*g_print ("got it\n");*/
702 return mono_type_get_object (mono_object_domain (name), type);
705 static MonoReflectionType*
706 ves_icall_type_from_handle (MonoType *handle)
708 MonoDomain *domain = mono_domain_get ();
709 MonoClass *klass = mono_class_from_mono_type (handle);
711 mono_class_init (klass);
712 return mono_type_get_object (domain, handle);
716 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
718 if (type->type && c->type)
719 return mono_metadata_type_equal (type->type, c->type);
720 g_print ("type equals\n");
724 /* System.TypeCode */
747 ves_icall_type_GetTypeCode (MonoReflectionType *type)
749 int t = type->type->type;
753 return TYPECODE_OBJECT;
754 case MONO_TYPE_BOOLEAN:
755 return TYPECODE_BOOLEAN;
757 return TYPECODE_BYTE;
759 return TYPECODE_SBYTE;
761 return TYPECODE_UINT16;
763 return TYPECODE_INT16;
765 return TYPECODE_CHAR;
769 return TYPECODE_OBJECT;
771 return TYPECODE_UINT32;
773 return TYPECODE_INT32;
775 return TYPECODE_UINT64;
777 return TYPECODE_INT64;
779 return TYPECODE_SINGLE;
781 return TYPECODE_DOUBLE;
782 case MONO_TYPE_VALUETYPE:
783 if (type->type->data.klass->enumtype) {
784 t = type->type->data.klass->enum_basetype->type;
787 MonoClass *k = type->type->data.klass;
788 if (strcmp (k->name_space, "System") == 0) {
789 if (strcmp (k->name, "Decimal") == 0)
790 return TYPECODE_DECIMAL;
791 else if (strcmp (k->name, "DateTime") == 0)
792 return TYPECODE_DATETIME;
793 else if (strcmp (k->name, "DBNull") == 0)
794 return TYPECODE_DBNULL;
797 /* handle datetime, dbnull.. */
798 return TYPECODE_OBJECT;
799 case MONO_TYPE_STRING:
800 return TYPECODE_STRING;
801 case MONO_TYPE_SZARRAY:
802 case MONO_TYPE_ARRAY:
803 case MONO_TYPE_OBJECT:
804 return TYPECODE_OBJECT;
805 case MONO_TYPE_CLASS:
806 return TYPECODE_OBJECT;
808 g_error ("type 0x%02x not handled in GetTypeCode()", t);
814 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
820 g_assert (type != NULL);
822 domain = ((MonoObject *)type)->vtable->domain;
824 if (!c) /* FIXME: dont know what do do here */
827 klass = mono_class_from_mono_type (type->type);
828 klassc = mono_class_from_mono_type (c->type);
830 /* cut&paste from mono_object_isinst (): keep in sync */
831 if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && !(klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
832 MonoVTable *klass_vt = mono_class_vtable (domain, klass);
833 if ((klassc->interface_id <= klass->max_interface_id) &&
834 klass_vt->interface_offsets [klassc->interface_id])
836 } else if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && (klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
839 for (i = 0; i < klass->interface_count; i ++) {
840 MonoClass *ic = klass->interfaces [i];
846 * klass->baseval is 0 for interfaces
848 if (klass->baseval && ((klass->baseval - klassc->baseval) <= klassc->diffval))
855 ves_icall_get_attributes (MonoReflectionType *type)
857 MonoClass *klass = mono_class_from_mono_type (type->type);
863 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
865 MonoDomain *domain = mono_domain_get ();
867 info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
868 info->ret = mono_type_get_object (domain, method->signature->ret);
869 info->attrs = method->flags;
870 info->implattrs = method->iflags;
874 ves_icall_get_parameter_info (MonoMethod *method)
876 MonoDomain *domain = mono_domain_get ();
878 static MonoClass *System_Reflection_ParameterInfo;
879 MonoReflectionParameter** args;
882 args = mono_param_get_objects (domain, method);
883 if (!System_Reflection_ParameterInfo)
884 System_Reflection_ParameterInfo = mono_class_from_name (
885 mono_defaults.corlib, "System.Reflection", "ParameterInfo");
886 res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count);
887 for (i = 0; i < method->signature->param_count; ++i) {
888 mono_array_set (res, gpointer, i, args [i]);
894 ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
896 MonoDomain *domain = mono_domain_get ();
898 info->parent = mono_type_get_object (domain, &field->klass->byval_arg);
899 info->type = mono_type_get_object (domain, field->field->type);
900 info->name = mono_string_new (domain, field->field->name);
901 info->attrs = field->field->type->attrs;
905 ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *obj)
908 MonoClassField *cf = field->field;
911 MonoDomain *domain = mono_domain_get ();
913 gboolean is_static = FALSE;
914 gboolean is_ref = FALSE;
916 switch (cf->type->type) {
917 case MONO_TYPE_STRING:
918 case MONO_TYPE_OBJECT:
919 case MONO_TYPE_CLASS:
920 case MONO_TYPE_ARRAY:
921 case MONO_TYPE_SZARRAY:
926 case MONO_TYPE_BOOLEAN:
936 case MONO_TYPE_VALUETYPE:
937 is_ref = cf->type->byref;
940 g_error ("type 0x%x not handled in "
941 "ves_icall_Monofield_GetValue", cf->type->type);
945 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
947 vtable = mono_class_vtable (domain, field->klass);
952 mono_field_static_get_value (vtable, cf, &o);
954 mono_field_get_value (obj, cf, &o);
959 /* boxed value type */
960 klass = mono_class_from_mono_type (cf->type);
961 o = mono_object_new (domain, klass);
962 v = ((gchar *) o) + sizeof (MonoObject);
964 mono_field_static_get_value (vtable, cf, v);
966 mono_field_get_value (obj, cf, v);
973 ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *obj, MonoObject *value)
975 MonoClassField *cf = field->field;
979 if (!cf->type->byref) {
980 switch (cf->type->type) {
983 case MONO_TYPE_BOOLEAN:
993 case MONO_TYPE_VALUETYPE:
994 v += sizeof (MonoObject);
996 case MONO_TYPE_STRING:
997 case MONO_TYPE_OBJECT:
998 case MONO_TYPE_CLASS:
999 case MONO_TYPE_ARRAY:
1000 case MONO_TYPE_SZARRAY:
1004 g_error ("type 0x%x not handled in "
1005 "ves_icall_FieldInfo_SetValueInternal", cf->type->type);
1010 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1011 MonoVTable *vtable = mono_class_vtable (mono_domain_get (), field->klass);
1012 mono_field_static_set_value (vtable, cf, v);
1014 mono_field_set_value (obj, cf, v);
1019 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
1021 MonoDomain *domain = mono_domain_get ();
1023 info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
1024 info->name = mono_string_new (domain, property->property->name);
1025 info->attrs = property->property->attrs;
1026 info->get = property->property->get ? mono_method_get_object (domain, property->property->get, NULL): NULL;
1027 info->set = property->property->set ? mono_method_get_object (domain, property->property->set, NULL): NULL;
1029 * There may be other methods defined for properties, though, it seems they are not exposed
1030 * in the reflection API
1035 ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
1037 MonoDomain *domain = mono_domain_get ();
1039 info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
1040 info->name = mono_string_new (domain, event->event->name);
1041 info->attrs = event->event->attrs;
1042 info->add_method = event->event->add ? mono_method_get_object (domain, event->event->add, NULL): NULL;
1043 info->remove_method = event->event->remove ? mono_method_get_object (domain, event->event->remove, NULL): NULL;
1044 info->raise_method = event->event->raise ? mono_method_get_object (domain, event->event->raise, NULL): NULL;
1048 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
1050 MonoDomain *domain = mono_domain_get ();
1053 MonoClass *class = mono_class_from_mono_type (type->type);
1057 for (parent = class; parent; parent = parent->parent) {
1058 ninterf += parent->interface_count;
1060 intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
1062 for (parent = class; parent; parent = parent->parent) {
1063 for (i = 0; i < parent->interface_count; ++i) {
1064 mono_array_set (intf, gpointer, ninterf, mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
1071 static MonoReflectionType*
1072 ves_icall_MonoType_GetElementType (MonoReflectionType *type)
1074 MonoClass *class = mono_class_from_mono_type (type->type);
1075 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1076 return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
1077 else if (class->element_class)
1078 return mono_type_get_object (mono_object_domain (type), &class->element_class->byval_arg);
1084 ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
1086 MonoDomain *domain = mono_domain_get ();
1087 MonoClass *class = mono_class_from_mono_type (type);
1089 info->parent = class->parent ? mono_type_get_object (domain, &class->parent->byval_arg): NULL;
1090 info->nested_in = class->nested_in ? mono_type_get_object (domain, &class->nested_in->byval_arg): NULL;
1091 info->name = mono_string_new (domain, class->name);
1092 info->name_space = mono_string_new (domain, class->name_space);
1093 info->attrs = class->flags;
1094 info->rank = class->rank;
1095 info->assembly = mono_assembly_get_object (domain, class->image->assembly);
1096 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1097 info->etype = mono_type_get_object (domain, class->enum_basetype);
1098 else if (class->element_class)
1099 info->etype = mono_type_get_object (domain, &class->element_class->byval_arg);
1103 info->isbyref = type->byref;
1104 info->ispointer = type->type == MONO_TYPE_PTR;
1105 info->isprimitive = (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8);
1109 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
1111 return mono_runtime_invoke_array (method->method, this, params, NULL);
1115 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
1117 MonoDomain *domain = mono_domain_get ();
1118 MonoMethod *m = method->method;
1119 MonoMethodSignature *sig = m->signature;
1120 MonoArray *out_args;
1122 int i, j, outarg_count = 0;
1124 if (m->klass == mono_defaults.object_class) {
1126 if (!strcmp (m->name, "FieldGetter")) {
1127 MonoClass *k = this->vtable->klass;
1128 MonoString *name = mono_array_get (params, MonoString *, 1);
1131 str = mono_string_to_utf8 (name);
1133 for (i = 0; i < k->field.count; i++) {
1134 if (!strcmp (k->fields [i].name, str)) {
1135 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1136 if (field_klass->valuetype)
1137 result = mono_value_box (domain, field_klass,
1138 (char *)this + k->fields [i].offset);
1140 result = *((gpointer *)((char *)this + k->fields [i].offset));
1143 out_args = mono_array_new (domain, mono_defaults.object_class, 1);
1144 *outArgs = out_args;
1145 mono_array_set (out_args, gpointer, 0, result);
1152 g_assert_not_reached ();
1154 } else if (!strcmp (m->name, "FieldSetter")) {
1155 MonoClass *k = this->vtable->klass;
1156 MonoString *name = mono_array_get (params, MonoString *, 1);
1160 str = mono_string_to_utf8 (name);
1162 for (i = 0; i < k->field.count; i++) {
1163 if (!strcmp (k->fields [i].name, str)) {
1164 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1165 MonoObject *val = mono_array_get (params, gpointer, 2);
1167 if (field_klass->valuetype) {
1168 size = mono_type_size (k->fields [i].type, &align);
1169 memcpy ((char *)this + k->fields [i].offset,
1170 ((char *)val) + sizeof (MonoObject), size);
1172 *((gpointer *)this + k->fields [i].offset) = val;
1181 g_assert_not_reached ();
1186 for (i = 0; i < mono_array_length (params); i++) {
1187 if (sig->params [i]->byref)
1191 out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
1193 for (i = 0, j = 0; i < mono_array_length (params); i++) {
1194 if (sig->params [i]->byref) {
1196 arg = mono_array_get (params, gpointer, i);
1197 mono_array_set (out_args, gpointer, j, arg);
1202 /* fixme: handle constructors? */
1203 if (!strcmp (method->method->name, ".ctor"))
1204 g_assert_not_reached ();
1206 result = mono_runtime_invoke_array (method->method, this, params, NULL);
1208 *outArgs = out_args;
1214 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
1216 MonoDomain *domain = mono_domain_get ();
1217 MonoClass *enumc, *objc;
1221 MONO_CHECK_ARG_NULL (type);
1222 MONO_CHECK_ARG_NULL (obj);
1224 enumc = mono_class_from_mono_type (type->type);
1225 objc = obj->vtable->klass;
1227 MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
1228 MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
1229 objc->byval_arg.type <= MONO_TYPE_U8));
1231 s1 = mono_class_value_size (enumc, NULL);
1232 s2 = mono_class_value_size (objc, NULL);
1234 res = mono_object_new (domain, enumc);
1236 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
1237 memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
1239 memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
1240 (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
1247 ves_icall_System_Enum_get_value (MonoObject *this)
1249 MonoDomain *domain = mono_domain_get ();
1259 g_assert (this->vtable->klass->enumtype);
1261 enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
1262 res = mono_object_new (domain, enumc);
1263 dst = (char *)res + sizeof (MonoObject);
1264 src = (char *)this + sizeof (MonoObject);
1265 size = mono_class_value_size (enumc, NULL);
1267 memcpy (dst, src, size);
1273 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
1275 MonoDomain *domain = mono_domain_get ();
1276 MonoClass *enumc = mono_class_from_mono_type (type->type);
1277 guint i, j, nvalues, crow;
1278 MonoClassField *field;
1280 info->utype = mono_type_get_object (domain, enumc->enum_basetype);
1281 nvalues = enumc->field.count - 1;
1282 info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
1283 info->values = mono_array_new (domain, enumc, nvalues);
1285 for (i = 0, j = 0; i < enumc->field.count; ++i) {
1286 field = &enumc->fields [i];
1287 if (strcmp ("value__", field->name) == 0)
1289 mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
1291 crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1));
1292 crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
1293 /* 1 is the length of the blob */
1294 field->data = 1 + mono_metadata_blob_heap (enumc->image, crow);
1296 switch (enumc->enum_basetype->type) {
1299 mono_array_set (info->values, gchar, j, *field->data);
1301 case MONO_TYPE_CHAR:
1304 mono_array_set (info->values, gint16, j, read16 (field->data));
1308 mono_array_set (info->values, gint32, j, read32 (field->data));
1312 mono_array_set (info->values, gint64, j, read64 (field->data));
1315 g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
1322 search_method (MonoReflectionType *type, const char *name, guint32 flags, MonoArray *args)
1324 MonoClass *klass, *start_class;
1326 MonoReflectionType *paramt;
1329 start_class = klass = mono_class_from_mono_type (type->type);
1331 for (i = 0; i < klass->method.count; ++i) {
1332 m = klass->methods [i];
1333 if (!((m->flags & flags) == flags))
1335 if (strcmp(m->name, name))
1339 if (m->signature->param_count != mono_array_length (args))
1341 for (j = 0; j < m->signature->param_count; ++j) {
1342 paramt = mono_array_get (args, MonoReflectionType*, j);
1343 if (!mono_metadata_type_equal (paramt->type, m->signature->params [j]))
1346 if (j == m->signature->param_count)
1349 klass = klass->parent;
1351 //g_print ("Method %s.%s::%s (%d) not found\n", start_class->name_space, start_class->name, name, mono_array_length (args));
1355 static MonoReflectionMethod*
1356 ves_icall_get_constructor (MonoReflectionType *type, MonoArray *args)
1358 MonoDomain *domain = mono_domain_get ();
1360 MonoClass *refc = mono_class_from_mono_type (type->type);
1362 m = search_method (type, ".ctor", METHOD_ATTRIBUTE_RT_SPECIAL_NAME, args);
1364 return mono_method_get_object (domain, m, refc);
1368 static MonoReflectionMethod*
1369 ves_icall_get_method (MonoReflectionType *type, MonoString *name, MonoArray *args)
1371 MonoDomain *domain = mono_domain_get ();
1373 MonoClass *refc = mono_class_from_mono_type (type->type);
1374 char *n = mono_string_to_utf8 (name);
1376 m = search_method (type, n, 0, args);
1379 return mono_method_get_object (domain, m, refc);
1383 static MonoProperty*
1384 search_property (MonoClass *klass, char* name, MonoArray *args) {
1388 /* FIXME: handle args */
1389 for (i = 0; i < klass->property.count; ++i) {
1390 p = &klass->properties [i];
1391 if (strcmp (p->name, name) == 0)
1397 static MonoReflectionProperty*
1398 ves_icall_get_property (MonoReflectionType *type, MonoString *name, MonoArray *args)
1400 MonoDomain *domain = mono_domain_get ();
1402 MonoClass *class = mono_class_from_mono_type (type->type);
1403 char *n = mono_string_to_utf8 (name);
1405 p = search_property (class, n, args);
1408 return mono_property_get_object (domain, class, p);
1413 BFLAGS_IgnoreCase = 1,
1414 BFLAGS_DeclaredOnly = 2,
1415 BFLAGS_Instance = 4,
1417 BFLAGS_Public = 0x10,
1418 BFLAGS_NonPublic = 0x20,
1419 BFLAGS_InvokeMethod = 0x100,
1420 BFLAGS_CreateInstance = 0x200,
1421 BFLAGS_GetField = 0x400,
1422 BFLAGS_SetField = 0x800,
1423 BFLAGS_GetProperty = 0x1000,
1424 BFLAGS_SetProperty = 0x2000,
1425 BFLAGS_ExactBinding = 0x10000,
1426 BFLAGS_SuppressChangeType = 0x20000,
1427 BFLAGS_OptionalParamBinding = 0x40000
1430 static MonoFieldInfo *
1431 ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
1434 MonoClass *startklass, *klass;
1436 MonoClassField *field;
1438 domain = ((MonoObject *)type)->vtable->domain;
1439 klass = startklass = mono_class_from_mono_type (type->type);
1445 for (i = 0; i < klass->field.count; ++i) {
1447 field = &klass->fields [i];
1448 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1449 if (bflags & BFLAGS_Public)
1452 if (bflags & BFLAGS_NonPublic)
1458 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1459 if (bflags & BFLAGS_Static)
1462 if (bflags & BFLAGS_Instance)
1469 utf8_name = mono_string_to_utf8 (name);
1471 if (strcmp (field->name, utf8_name)) {
1477 return (MonoFieldInfo *)mono_field_get_object (domain, klass, field);
1479 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1486 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
1489 GSList *l = NULL, *tmp;
1490 MonoClass *startklass, *klass;
1494 MonoClassField *field;
1496 domain = ((MonoObject *)type)->vtable->domain;
1497 klass = startklass = mono_class_from_mono_type (type->type);
1500 for (i = 0; i < klass->field.count; ++i) {
1502 field = &klass->fields [i];
1503 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1504 if (bflags & BFLAGS_Public)
1507 if (bflags & BFLAGS_NonPublic)
1513 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1514 if (bflags & BFLAGS_Static)
1517 if (bflags & BFLAGS_Instance)
1523 member = (MonoObject*)mono_field_get_object (domain, klass, field);
1524 l = g_slist_prepend (l, member);
1526 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1528 len = g_slist_length (l);
1529 res = mono_array_new (domain, mono_defaults.field_info_class, len);
1531 tmp = g_slist_reverse (l);
1532 for (; tmp; tmp = tmp->next, ++i)
1533 mono_array_set (res, gpointer, i, tmp->data);
1539 ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
1542 GSList *l = NULL, *tmp;
1543 static MonoClass *System_Reflection_MethodInfo;
1544 MonoClass *startklass, *klass;
1550 domain = ((MonoObject *)type)->vtable->domain;
1551 klass = startklass = mono_class_from_mono_type (type->type);
1554 for (i = 0; i < klass->method.count; ++i) {
1556 method = klass->methods [i];
1557 if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
1559 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1560 if (bflags & BFLAGS_Public)
1563 if (bflags & BFLAGS_NonPublic)
1569 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1570 if (bflags & BFLAGS_Static)
1573 if (bflags & BFLAGS_Instance)
1580 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1582 l = g_slist_prepend (l, member);
1584 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1586 len = g_slist_length (l);
1587 if (!System_Reflection_MethodInfo)
1588 System_Reflection_MethodInfo = mono_class_from_name (
1589 mono_defaults.corlib, "System.Reflection", "MethodInfo");
1590 res = mono_array_new (domain, System_Reflection_MethodInfo, len);
1593 for (; tmp; tmp = tmp->next, ++i)
1594 mono_array_set (res, gpointer, i, tmp->data);
1601 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
1604 GSList *l = NULL, *tmp;
1605 static MonoClass *System_Reflection_ConstructorInfo;
1606 MonoClass *startklass, *klass;
1612 domain = ((MonoObject *)type)->vtable->domain;
1613 klass = startklass = mono_class_from_mono_type (type->type);
1616 for (i = 0; i < klass->method.count; ++i) {
1618 method = klass->methods [i];
1619 if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
1621 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1622 if (bflags & BFLAGS_Public)
1625 if (bflags & BFLAGS_NonPublic)
1631 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1632 if (bflags & BFLAGS_Static)
1635 if (bflags & BFLAGS_Instance)
1641 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1643 l = g_slist_prepend (l, member);
1645 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1647 len = g_slist_length (l);
1648 if (!System_Reflection_ConstructorInfo)
1649 System_Reflection_ConstructorInfo = mono_class_from_name (
1650 mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
1651 res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
1653 tmp = g_slist_reverse (l);
1654 for (; tmp; tmp = tmp->next, ++i)
1655 mono_array_set (res, gpointer, i, tmp->data);
1661 ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
1664 GSList *l = NULL, *tmp;
1665 static MonoClass *System_Reflection_PropertyInfo;
1666 MonoClass *startklass, *klass;
1672 domain = ((MonoObject *)type)->vtable->domain;
1673 klass = startklass = mono_class_from_mono_type (type->type);
1676 for (i = 0; i < klass->property.count; ++i) {
1677 prop = &klass->properties [i];
1682 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1683 if (bflags & BFLAGS_Public)
1686 if (bflags & BFLAGS_NonPublic)
1692 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1693 if (bflags & BFLAGS_Static)
1696 if (bflags & BFLAGS_Instance)
1703 l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
1705 if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
1707 len = g_slist_length (l);
1708 if (!System_Reflection_PropertyInfo)
1709 System_Reflection_PropertyInfo = mono_class_from_name (
1710 mono_defaults.corlib, "System.Reflection", "PropertyInfo");
1711 res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
1714 for (; tmp; tmp = tmp->next, ++i)
1715 mono_array_set (res, gpointer, i, tmp->data);
1721 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
1724 GSList *l = NULL, *tmp;
1725 static MonoClass *System_Reflection_EventInfo;
1726 MonoClass *startklass, *klass;
1732 domain = ((MonoObject *)type)->vtable->domain;
1733 klass = startklass = mono_class_from_mono_type (type->type);
1736 for (i = 0; i < klass->event.count; ++i) {
1737 event = &klass->events [i];
1739 method = event->add;
1741 method = event->remove;
1742 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1743 if (bflags & BFLAGS_Public)
1746 if (bflags & BFLAGS_NonPublic)
1752 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1753 if (bflags & BFLAGS_Static)
1756 if (bflags & BFLAGS_Instance)
1763 l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
1765 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1767 len = g_slist_length (l);
1768 if (!System_Reflection_EventInfo)
1769 System_Reflection_EventInfo = mono_class_from_name (
1770 mono_defaults.corlib, "System.Reflection", "EventInfo");
1771 res = mono_array_new (domain, System_Reflection_EventInfo, len);
1774 for (; tmp; tmp = tmp->next, ++i)
1775 mono_array_set (res, gpointer, i, tmp->data);
1781 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
1784 GSList *l = NULL, *tmp;
1786 MonoClass *startklass, *klass;
1792 domain = ((MonoObject *)type)->vtable->domain;
1793 klass = startklass = mono_class_from_mono_type (type->type);
1795 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
1797 nested = tmpn->data;
1798 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
1799 if (bflags & BFLAGS_Public)
1802 if (bflags & BFLAGS_NonPublic)
1807 member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
1808 l = g_slist_prepend (l, member);
1810 len = g_slist_length (l);
1811 res = mono_array_new (domain, mono_defaults.monotype_class, len);
1813 tmp = g_slist_reverse (l);
1814 for (; tmp; tmp = tmp->next, ++i)
1815 mono_array_set (res, gpointer, i, tmp->data);
1820 static MonoReflectionType*
1821 ves_icall_System_Reflection_Assembly_GetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
1823 MonoDomain *domain = mono_domain_get ();
1826 MonoTypeNameParse info;
1828 str = mono_string_to_utf8 (name);
1829 /*g_print ("requested type %s in %s\n", str, assembly->assembly->aname.name);*/
1830 if (!mono_reflection_parse_type (str, &info)) {
1832 g_list_free (info.modifiers);
1833 g_list_free (info.nested);
1834 if (throwOnError) /* uhm: this is a parse error, though... */
1835 mono_raise_exception (mono_get_exception_type_load ());
1836 /*g_print ("failed parse\n");*/
1840 type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
1842 g_list_free (info.modifiers);
1843 g_list_free (info.nested);
1846 mono_raise_exception (mono_get_exception_type_load ());
1847 /* g_print ("failed find\n"); */
1850 /* g_print ("got it\n"); */
1851 return mono_type_get_object (domain, type);
1856 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
1858 MonoDomain *domain = mono_domain_get ();
1860 char *name = g_strconcat (
1861 "file://", assembly->assembly->image->name, NULL);
1863 res = mono_string_new (domain, name);
1868 static MonoReflectionMethod*
1869 ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly) {
1870 guint32 token = mono_image_get_entry_point (assembly->assembly->image);
1873 return mono_method_get_object (mono_object_domain (assembly), mono_get_method (assembly->assembly->image, token, NULL), NULL);
1877 ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly) {
1878 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
1879 MonoArray *result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
1883 for (i = 0; i < table->rows; ++i) {
1884 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_MANIFEST_NAME));
1885 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), val));
1890 /* move this in some file in mono/util/ */
1892 g_concat_dir_and_file (const char *dir, const char *file)
1894 g_return_val_if_fail (dir != NULL, NULL);
1895 g_return_val_if_fail (file != NULL, NULL);
1898 * If the directory name doesn't have a / on the end, we need
1899 * to add one so we get a proper path to the file
1901 if (dir [strlen(dir) - 1] != G_DIR_SEPARATOR)
1902 return g_strconcat (dir, G_DIR_SEPARATOR_S, file, NULL);
1904 return g_strconcat (dir, file, NULL);
1908 ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name) {
1909 char *n = mono_string_to_utf8 (name);
1910 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
1912 guint32 cols [MONO_MANIFEST_SIZE];
1916 for (i = 0; i < table->rows; ++i) {
1917 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
1918 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
1919 if (strcmp (val, n) == 0)
1923 if (i == table->rows)
1926 if (!cols [MONO_MANIFEST_IMPLEMENTATION]) {
1929 val = mono_image_get_resource (assembly->assembly->image, cols [MONO_MANIFEST_OFFSET], &size);
1932 data = mono_array_new (mono_object_domain (assembly), mono_defaults.byte_class, size);
1933 memcpy (mono_array_addr (data, char, 0), val, size);
1934 return (MonoObject*)data;
1936 switch (cols [MONO_MANIFEST_IMPLEMENTATION] & IMPLEMENTATION_MASK) {
1937 case IMPLEMENTATION_FILE:
1938 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
1939 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
1940 i = mono_metadata_decode_row_col (table, i - 1, MONO_FILE_NAME);
1941 val = mono_metadata_string_heap (assembly->assembly->image, i);
1942 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1943 result = (MonoObject*)mono_string_new (mono_object_domain (assembly), n);
1944 /* check hash if needed */
1947 case IMPLEMENTATION_ASSEMBLYREF:
1948 case IMPLEMENTATION_EXP_TYPE:
1956 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name) {
1957 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
1963 /* check hash if needed */
1965 n = mono_string_to_utf8 (name);
1966 for (i = 0; i < table->rows; ++i) {
1967 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
1968 if (strcmp (val, n) == 0) {
1971 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1972 fn = mono_string_new (mono_object_domain (assembly), n);
1974 return (MonoObject*)fn;
1981 for (i = 0; i < table->rows; ++i) {
1982 result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
1983 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
1984 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1985 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), n));
1988 return (MonoObject*)result;
1991 static MonoReflectionMethod*
1992 ves_icall_GetCurrentMethod (void) {
1993 MonoMethod *m = mono_method_get_last_managed ();
1994 return mono_method_get_object (mono_domain_get (), m, NULL);
1997 static MonoReflectionAssembly*
1998 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (void)
2000 MonoMethod *m = mono_method_get_last_managed ();
2001 return mono_assembly_get_object (mono_domain_get (), m->klass->image->assembly);
2006 get_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data)
2008 MonoMethod **dest = data;
2020 static MonoReflectionAssembly*
2021 ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
2023 MonoDomain* domain = mono_domain_get ();
2024 g_assert (domain->entry_assembly);
2025 return mono_assembly_get_object (domain, domain->entry_assembly);
2029 static MonoReflectionAssembly*
2030 ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
2032 MonoMethod *m = mono_method_get_last_managed ();
2033 MonoMethod *dest = m;
2034 mono_stack_walk (get_caller, &dest);
2037 return mono_assembly_get_object (mono_domain_get (), dest->klass->image->assembly);
2041 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
2043 MonoDomain *domain = mono_domain_get ();
2047 name = mono_type_get_name (object->type);
2048 res = mono_string_new (domain, name);
2055 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
2057 MonoAssemblyName *name = &assembly->assembly->aname;
2059 if (strcmp (name->name, "corlib") == 0)
2060 aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
2062 aname->name = mono_string_new (mono_object_domain (assembly), name->name);
2063 aname->major = name->major;
2067 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
2069 MonoDomain *domain = mono_domain_get ();
2072 MonoTableInfo *tdef = &assembly->assembly->image->tables [MONO_TABLE_TYPEDEF];
2074 guint32 attrs, visibility;
2076 /* we start the count from 1 because we skip the special type <Module> */
2079 for (i = 1; i < tdef->rows; ++i) {
2080 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2081 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2082 if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
2086 count = tdef->rows - 1;
2088 res = mono_array_new (domain, mono_defaults.monotype_class, count);
2090 for (i = 1; i < tdef->rows; ++i) {
2091 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2092 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2093 if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
2094 klass = mono_class_get (assembly->assembly->image, (i + 1) | MONO_TOKEN_TYPE_DEF);
2095 mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
2103 static MonoReflectionType*
2104 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
2107 int isbyref = 0, rank;
2108 char *str = mono_string_to_utf8 (smodifiers);
2111 klass = mono_class_from_mono_type (tb->type.type);
2113 /* logic taken from mono_reflection_parse_type(): keep in sync */
2117 if (isbyref) { /* only one level allowed by the spec */
2124 return mono_type_get_object (mono_domain_get (), &klass->this_arg);
2127 klass = mono_ptr_class_get (&klass->byval_arg);
2128 mono_class_init (klass);
2139 else if (*p != '*') { /* '*' means unknown lower bound */
2150 klass = mono_array_class_get (&klass->byval_arg, rank);
2151 mono_class_init (klass);
2158 return mono_type_get_object (mono_domain_get (), &klass->byval_arg);
2162 ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target,
2163 MonoReflectionMethod *info)
2165 MonoClass *delegate_class = mono_class_from_mono_type (type->type);
2166 MonoObject *delegate;
2169 mono_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
2171 delegate = mono_object_new (target->vtable->domain, delegate_class);
2173 func = mono_compile_method (info->method);
2175 mono_delegate_ctor (delegate, target, func);
2181 * Magic number to convert a time which is relative to
2182 * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
2184 #define EPOCH_ADJUST ((gint64)62135596800L)
2187 ves_icall_System_DateTime_GetNow (void)
2189 #ifdef PLATFORM_WIN32
2194 SystemTimeToFileTime (&st, &ft);
2195 return (gint64)504911232000000000L + ((((gint64)ft.dwHighDateTime)<<32) | ft.dwLowDateTime);
2197 /* FIXME: put this in io-layer and call it GetLocalTime */
2201 if (gettimeofday (&tv, NULL) == 0) {
2202 res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
2205 /* fixme: raise exception */
2211 * This is heavily based on zdump.c from glibc 2.2.
2213 * * data[0]: start of daylight saving time (in DateTime ticks).
2214 * * data[1]: end of daylight saving time (in DateTime ticks).
2215 * * data[2]: utcoffset (in TimeSpan ticks).
2216 * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
2217 * * name[0]: name of this timezone when not daylight saving.
2218 * * name[1]: name of this timezone when daylight saving.
2220 * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
2221 * the class library allows years between 1 and 9999.
2223 * Returns true on success and zero on failure.
2226 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
2228 #ifndef PLATFORM_WIN32
2229 MonoDomain *domain = mono_domain_get ();
2230 struct tm start, tt;
2234 int is_daylight = 0, day;
2236 memset (&start, 0, sizeof (start));
2239 start.tm_year = year-1900;
2241 t = mktime (&start);
2242 #if defined (HAVE_TIMEZONE)
2243 #define gmt_offset(x) (-1 * (((timezone / 60 / 60) - daylight) * 100))
2244 #elif defined (HAVE_TM_GMTOFF)
2245 #define gmt_offset(x) x.tm_gmtoff
2247 #error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
2250 gmtoff = gmt_offset (start);
2252 MONO_CHECK_ARG_NULL (data);
2253 MONO_CHECK_ARG_NULL (names);
2255 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2256 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2258 /* For each day of the year, calculate the tm_gmtoff. */
2259 for (day = 0; day < 365; day++) {
2262 tt = *localtime (&t);
2264 /* Daylight saving starts or ends here. */
2265 if (gmt_offset (tt) != gmtoff) {
2270 /* Try to find the exact hour when daylight saving starts/ends. */
2274 tt1 = *localtime (&t1);
2275 } while (gmt_offset (tt1) != gmtoff);
2277 /* Try to find the exact minute when daylight saving starts/ends. */
2280 tt1 = *localtime (&t1);
2281 } while (gmt_offset (tt1) == gmtoff);
2283 strftime (tzone, 10, "%Z", &tt);
2285 /* Write data, if we're already in daylight saving, we're done. */
2287 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
2288 mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2291 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
2292 mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2296 /* This is only set once when we enter daylight saving. */
2297 mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
2298 mono_array_set ((*data), gint64, 3, (gint64)(gmt_offset (tt) - gmtoff) * 10000000L);
2300 gmtoff = gmt_offset (tt);
2303 gmtoff = gmt_offset (tt);
2307 MonoDomain *domain = mono_domain_get ();
2308 TIME_ZONE_INFORMATION tz_info;
2312 GetTimeZoneInformation (&tz_info);
2314 MONO_CHECK_ARG_NULL (data);
2315 MONO_CHECK_ARG_NULL (names);
2317 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2318 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2320 for (i = 0; i < 32; ++i)
2321 if (!tz_info.DaylightName [i])
2323 mono_array_set ((*names), gpointer, 1, mono_string_new_utf16 (domain, tz_info.DaylightName, i));
2324 for (i = 0; i < 32; ++i)
2325 if (!tz_info.StandardName [i])
2327 mono_array_set ((*names), gpointer, 0, mono_string_new_utf16 (domain, tz_info.StandardName, i));
2329 SystemTimeToFileTime (&tz_info.StandardDate, &ft);
2330 mono_array_set ((*data), gint64, 1, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2331 SystemTimeToFileTime (&tz_info.DaylightDate, &ft);
2332 mono_array_set ((*data), gint64, 0, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2333 mono_array_set ((*data), gint64, 3, tz_info.Bias + tz_info.StandardBias);
2334 mono_array_set ((*data), gint64, 2, tz_info.Bias + tz_info.DaylightBias);
2341 ves_icall_System_Object_obj_address (MonoObject *this) {
2348 ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
2354 klass = array->obj.vtable->klass;
2355 etype = klass->element_class->byval_arg.type;
2356 if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
2359 if (array->bounds == NULL)
2360 length = array->max_length;
2363 for (i = 0; i < klass->rank; ++ i)
2364 length += array->bounds [i].length;
2367 esize = mono_array_element_size (klass);
2368 return length * esize;
2372 ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx) {
2373 return mono_array_get (array, gint8, idx);
2377 ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) {
2378 mono_array_set (array, gint8, idx, value);
2382 ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) {
2383 char *src_buf, *dest_buf;
2385 src_buf = (gint8 *)src->vector + src_offset;
2386 dest_buf = (gint8 *)dest->vector + dest_offset;
2388 memcpy (dest_buf, src_buf, count);
2392 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
2394 MonoDomain *domain = mono_domain_get ();
2396 MonoRealProxy *rp = ((MonoRealProxy *)this);
2400 res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
2402 ((MonoTransparentProxy *)res)->rp = rp;
2403 type = ((MonoReflectionType *)rp->class_to_proxy)->type;
2404 klass = mono_class_from_mono_type (type);
2406 ((MonoTransparentProxy *)res)->klass = klass;
2408 res->vtable = mono_class_proxy_vtable (domain, klass);
2413 /* System.Environment */
2416 ves_icall_System_Environment_get_MachineName (void)
2418 #if defined (PLATFORM_WIN32)
2423 len = MAX_COMPUTERNAME_LENGTH + 1;
2424 buf = g_new (gunichar2, len);
2427 if (GetComputerName (buf, (PDWORD) &len))
2428 result = mono_string_new_utf16 (mono_domain_get (), buf, len);
2438 buf = g_new (gchar, len);
2441 if (gethostname (buf, len) != 0)
2442 result = mono_string_new (mono_domain_get (), buf);
2450 ves_icall_System_Environment_get_Platform (void)
2452 #if defined (PLATFORM_WIN32)
2462 ves_icall_System_Environment_get_NewLine (void)
2464 #if defined (PLATFORM_WIN32)
2465 return mono_string_new (mono_domain_get (), "\r\n");
2467 return mono_string_new (mono_domain_get (), "\n");
2472 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
2480 utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
2481 value = g_getenv (utf8_name);
2487 return mono_string_new (mono_domain_get (), value);
2491 * There is no standard way to get at environ.
2493 extern char **environ;
2496 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
2505 for (e = environ; *e != 0; ++ e)
2508 domain = mono_domain_get ();
2509 names = mono_array_new (domain, mono_defaults.string_class, n);
2512 for (e = environ; *e != 0; ++ e) {
2513 parts = g_strsplit (*e, "=", 2);
2515 str = mono_string_new (domain, *parts);
2516 mono_array_set (names, MonoString *, n, str);
2528 * Returns the number of milliseconds elapsed since the system started.
2531 ves_icall_System_Environment_get_TickCount (void)
2533 #if defined (PLATFORM_WIN32)
2534 return GetTickCount();
2540 res = (gint32) gettimeofday (&tv, &tz);
2543 res = (gint32) ((tv.tv_sec & 0xFFFFF) * 1000 + (tv.tv_usec / 1000));
2550 ves_icall_System_Environment_Exit (int result)
2552 /* we may need to do some cleanup here... */
2557 ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
2558 MonoReflectionMethod *method,
2559 MonoArray *out_args)
2561 MonoDomain *domain = mono_domain_get ();
2563 mono_message_init (domain, this, method, out_args);
2567 ves_icall_IsTransparentProxy (MonoObject *proxy)
2572 if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
2579 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal (MonoReflectionType *type)
2585 domain = mono_object_domain (type);
2586 klass = mono_class_from_mono_type (type->type);
2588 if (klass->rank >= 1) {
2589 g_assert (klass->rank == 1);
2590 obj = (MonoObject *) mono_array_new (domain, klass->element_class, 0);
2592 obj = mono_object_new (domain, klass);
2600 static gconstpointer icall_map [] = {
2604 "System.Array::GetValue", ves_icall_System_Array_GetValue,
2605 "System.Array::SetValue", ves_icall_System_Array_SetValue,
2606 "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
2607 "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
2608 "System.Array::GetRank", ves_icall_System_Array_GetRank,
2609 "System.Array::GetLength", ves_icall_System_Array_GetLength,
2610 "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
2611 "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
2612 "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
2613 "System.Array::Clone", mono_array_clone,
2618 "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
2619 "System.Object::GetType", ves_icall_System_Object_GetType,
2620 "System.Object::GetHashCode", ves_icall_System_Object_GetHashCode,
2621 "System.Object::obj_address", ves_icall_System_Object_obj_address,
2626 "System.ValueType::GetHashCode", ves_icall_System_ValueType_GetHashCode,
2627 "System.ValueType::Equals", ves_icall_System_ValueType_Equals,
2633 "System.String::.ctor(char*)", ves_icall_System_String_ctor_charp,
2634 "System.String::.ctor(char*,int,int)", ves_icall_System_String_ctor_charp_int_int,
2635 "System.String::.ctor(sbyte*)", ves_icall_System_String_ctor_sbytep,
2636 "System.String::.ctor(sbyte*,int,int)", ves_icall_System_String_ctor_sbytep_int_int,
2637 "System.String::.ctor(sbyte*,int,int,System.Text.Encoding)", ves_icall_System_String_ctor_encoding,
2638 "System.String::.ctor(char[])", ves_icall_System_String_ctor_chara,
2639 "System.String::.ctor(char[],int,int)", ves_icall_System_String_ctor_chara_int_int,
2640 "System.String::.ctor(char,int)", ves_icall_System_String_ctor_char_int,
2641 "System.String::InternalEquals", ves_icall_System_String_InternalEquals,
2642 "System.String::InternalJoin", ves_icall_System_String_InternalJoin,
2643 "System.String::InternalInsert", ves_icall_System_String_InternalInsert,
2644 "System.String::InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char,
2645 "System.String::InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str,
2646 "System.String::InternalRemove", ves_icall_System_String_InternalRemove,
2647 "System.String::InternalCopyTo", ves_icall_System_String_InternalCopyTo,
2648 "System.String::InternalSplit", ves_icall_System_String_InternalSplit,
2649 "System.String::InternalTrim", ves_icall_System_String_InternalTrim,
2650 "System.String::InternalIndexOf(char,int,int)", ves_icall_System_String_InternalIndexOf_Char,
2651 "System.String::InternalIndexOf(string,int,int)", ves_icall_System_String_InternalIndexOf_Str,
2652 "System.String::InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny,
2653 "System.String::InternalLastIndexOf(char,int,int)", ves_icall_System_String_InternalLastIndexOf_Char,
2654 "System.String::InternalLastIndexOf(string,int,int)", ves_icall_System_String_InternalLastIndexOf_Str,
2655 "System.String::InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny,
2656 "System.String::InternalPad", ves_icall_System_String_InternalPad,
2657 "System.String::InternalToLower", ves_icall_System_String_InternalToLower,
2658 "System.String::InternalToUpper", ves_icall_System_String_InternalToUpper,
2659 "System.String::InternalAllocateStr", ves_icall_System_String_InternalAllocateStr,
2660 "System.String::InternalStrcpy(string,int,string)", ves_icall_System_String_InternalStrcpy_Str,
2661 "System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
2662 "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
2663 "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
2664 "System.String::InternalCompare(string,int,string,int,int,bool)", ves_icall_System_String_InternalCompareStr_N,
2665 "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
2666 "System.String::get_Chars", ves_icall_System_String_get_Chars,
2671 "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
2672 "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
2673 "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
2674 "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
2675 "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
2676 "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
2677 "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
2678 "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
2679 "System.AppDomain::Unload", ves_icall_System_AppDomain_Unload,
2680 "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
2683 * System.AppDomainSetup
2685 "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
2690 "System.Double::ToStringImpl", mono_double_ToStringImpl,
2691 "System.Double::ParseImpl", mono_double_ParseImpl,
2696 "System.Single::ToStringImpl", mono_float_ToStringImpl,
2701 "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
2702 "System.Decimal::decimal2Int64", mono_decimal2Int64,
2703 "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
2704 "System.Decimal::decimalIncr", mono_decimalIncr,
2705 "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
2706 "System.Decimal::decimal2double", mono_decimal2double,
2707 "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
2708 "System.Decimal::decimalRound", mono_decimalRound,
2709 "System.Decimal::decimalMult", mono_decimalMult,
2710 "System.Decimal::decimalDiv", mono_decimalDiv,
2711 "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
2712 "System.Decimal::decimalCompare", mono_decimalCompare,
2713 "System.Decimal::string2decimal", mono_string2decimal,
2714 "System.Decimal::decimal2string", mono_decimal2string,
2719 "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
2724 "System.Reflection.Emit.AssemblyBuilder::getDataChunk", ves_icall_AssemblyBuilder_getDataChunk,
2725 "System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
2726 "System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
2727 "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
2732 "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
2733 "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
2734 "System.Reflection.MonoFieldInfo::get_field_info", ves_icall_get_field_info,
2735 "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
2736 "System.Reflection.MonoEventInfo::get_event_info", ves_icall_get_event_info,
2737 "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
2738 "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
2739 "System.Reflection.MethodBase::GetCurrentMethod", ves_icall_GetCurrentMethod,
2740 "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
2741 "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
2742 "System.Reflection.MonoField::GetValueInternal", ves_icall_MonoField_GetValueInternal,
2743 "System.Reflection.FieldInfo::SetValueInternal", ves_icall_FieldInfo_SetValueInternal,
2744 "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
2745 "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
2750 "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
2751 "System.Enum::get_value", ves_icall_System_Enum_get_value,
2752 "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
2757 "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
2758 "System.Reflection.Emit.TypeBuilder::create_internal_class", mono_reflection_create_internal_class,
2759 "System.Reflection.Emit.TypeBuilder::create_runtime_class", mono_reflection_create_runtime_class,
2768 "System.Type::internal_from_name", ves_icall_type_from_name,
2769 "System.Type::internal_from_handle", ves_icall_type_from_handle,
2770 "System.Type::get_constructor", ves_icall_get_constructor,
2771 "System.Type::get_property", ves_icall_get_property,
2772 "System.MonoType::get_method", ves_icall_get_method,
2773 "System.MonoType::get_attributes", ves_icall_get_attributes,
2774 "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
2775 "System.Type::Equals", ves_icall_type_Equals,
2776 "System.Type::GetTypeCode", ves_icall_type_GetTypeCode,
2779 * System.Runtime.CompilerServices.RuntimeHelpers
2781 "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_InitializeArray,
2786 "System.Threading.Thread::Abort(object)", ves_icall_System_Threading_Thread_Abort,
2787 "System.Threading.Thread::ResetAbort", ves_icall_System_Threading_Thread_ResetAbort,
2788 "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
2789 "System.Threading.Thread::Thread_free_internal", ves_icall_System_Threading_Thread_Thread_free_internal,
2790 "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
2791 "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
2792 "System.Threading.Thread::CurrentThread_internal", mono_thread_current,
2793 "System.Threading.Thread::CurrentThreadDomain_internal", ves_icall_System_Threading_Thread_CurrentThreadDomain_internal,
2794 "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
2795 "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
2796 "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
2797 "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
2798 "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
2799 "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
2800 "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
2801 "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
2802 "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
2803 "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
2804 "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
2805 "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
2806 "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
2807 "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
2808 "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
2811 * System.Threading.WaitHandle
2813 "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
2814 "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
2815 "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
2818 * System.Runtime.InteropServices.Marshal
2820 "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
2821 "System.Runtime.InteropServices.Marshal::ReadByte", ves_icall_System_Runtime_InteropServices_Marshal_ReadByte,
2822 "System.Runtime.InteropServices.Marshal::ReadInt16", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16,
2823 "System.Runtime.InteropServices.Marshal::ReadInt32", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32,
2824 "System.Runtime.InteropServices.Marshal::ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64,
2825 "System.Runtime.InteropServices.Marshal::WriteIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr,
2826 "System.Runtime.InteropServices.Marshal::WriteByte", ves_icall_System_Runtime_InteropServices_Marshal_WriteByte,
2827 "System.Runtime.InteropServices.Marshal::WriteInt16", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16,
2828 "System.Runtime.InteropServices.Marshal::WriteInt32", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32,
2829 "System.Runtime.InteropServices.Marshal::WriteInt64", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64,
2831 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
2832 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
2833 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
2834 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
2835 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni,
2836 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len,
2837 "System.Runtime.InteropServices.Marshal::PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR,
2839 "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
2840 "System.Runtime.InteropServices.Marshal::AllocHGlobal", mono_marshal_alloc,
2841 "System.Runtime.InteropServices.Marshal::FreeHGlobal", mono_marshal_free,
2842 "System.Runtime.InteropServices.Marshal::ReAllocHGlobal", mono_marshal_realloc,
2843 "System.Runtime.InteropServices.Marshal::copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged,
2844 "System.Runtime.InteropServices.Marshal::copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged,
2845 "System.Runtime.InteropServices.Marshal::SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf,
2846 "System.Runtime.InteropServices.Marshal::StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr,
2847 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure,
2848 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type,
2849 "System.Runtime.InteropServices.Marshal::OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf,
2850 "System.Runtime.InteropServices.Marshal::StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
2851 "System.Runtime.InteropServices.Marshal::StringToHGlobalAuto", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
2852 "System.Runtime.InteropServices.Marshal::StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni,
2853 "System.Runtime.InteropServices.Marshal::DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure,
2856 "System.Reflection.Assembly::LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom,
2857 "System.Reflection.Assembly::GetType", ves_icall_System_Reflection_Assembly_GetType,
2858 "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
2859 "System.Reflection.Assembly::FillName", ves_icall_System_Reflection_Assembly_FillName,
2860 "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
2861 "System.Reflection.Assembly::GetExecutingAssembly", ves_icall_System_Reflection_Assembly_GetExecutingAssembly,
2862 "System.Reflection.Assembly::GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly,
2863 "System.Reflection.Assembly::GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly,
2864 "System.Reflection.Assembly::get_EntryPoint", ves_icall_System_Reflection_Assembly_get_EntryPoint,
2865 "System.Reflection.Assembly::GetManifestResourceNames", ves_icall_System_Reflection_Assembly_GetManifestResourceNames,
2866 "System.Reflection.Assembly::GetManifestResourceInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInternal,
2867 "System.Reflection.Assembly::GetFilesInternal", ves_icall_System_Reflection_Assembly_GetFilesInternal,
2872 "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
2873 "System.MonoType::type_from_obj", mono_type_type_from_obj,
2874 "System.MonoType::GetElementType", ves_icall_MonoType_GetElementType,
2875 "System.MonoType::get_type_info", ves_icall_get_type_info,
2876 "System.MonoType::GetField", ves_icall_Type_GetField,
2877 "System.MonoType::GetFields", ves_icall_Type_GetFields,
2878 "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
2879 "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
2880 "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
2881 "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
2882 "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
2883 "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
2886 * System.Net.Sockets I/O Services
2888 "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
2889 "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
2890 "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
2891 "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
2892 "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
2893 "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
2894 "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
2895 "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
2896 "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
2897 "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
2898 "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
2899 "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
2900 "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
2901 "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
2902 "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
2903 "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
2904 "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
2905 "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
2906 "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
2907 "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
2908 "System.Net.Dns::GetHostByName_internal", ves_icall_System_Net_Dns_GetHostByName_internal,
2909 "System.Net.Dns::GetHostByAddr_internal", ves_icall_System_Net_Dns_GetHostByAddr_internal,
2914 "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
2915 "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
2916 "System.Char::IsControl", ves_icall_System_Char_IsControl,
2917 "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
2918 "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
2919 "System.Char::IsLower", ves_icall_System_Char_IsLower,
2920 "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
2921 "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
2922 "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
2923 "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
2924 "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
2925 "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
2926 "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
2927 "System.Char::ToLower", ves_icall_System_Char_ToLower,
2928 "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
2930 "System.Text.Encoding::IConvNewEncoder", ves_icall_iconv_new_encoder,
2931 "System.Text.Encoding::IConvNewDecoder", ves_icall_iconv_new_decoder,
2932 "System.Text.Encoding::IConvReset", ves_icall_iconv_reset,
2933 "System.Text.Encoding::IConvGetByteCount", ves_icall_iconv_get_byte_count,
2934 "System.Text.Encoding::IConvGetBytes", ves_icall_iconv_get_bytes,
2935 "System.Text.Encoding::IConvGetCharCount", ves_icall_iconv_get_char_count,
2936 "System.Text.Encoding::IConvGetChars", ves_icall_iconv_get_chars,
2938 "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
2939 "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
2944 "System.GC::InternalCollect", ves_icall_System_GC_InternalCollect,
2945 "System.GC::GetTotalMemory", ves_icall_System_GC_GetTotalMemory,
2946 "System.GC::KeepAlive", ves_icall_System_GC_KeepAlive,
2947 "System.GC::ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize,
2948 "System.GC::SuppressFinalize", ves_icall_System_GC_SuppressFinalize,
2949 "System.GC::WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers,
2950 "System.Runtime.InteropServices.GCHandle::GetTarget", ves_icall_System_GCHandle_GetTarget,
2951 "System.Runtime.InteropServices.GCHandle::GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle,
2952 "System.Runtime.InteropServices.GCHandle::FreeHandle", ves_icall_System_GCHandle_FreeHandle,
2953 "System.Runtime.InteropServices.GCHandle::GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject,
2956 * System.Security.Cryptography calls
2959 "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
2960 "System.Security.Cryptography.RNGCryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
2965 "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
2966 "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
2967 "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
2968 "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
2973 "System.IO.MonoIO::GetLastError", ves_icall_System_IO_MonoIO_GetLastError,
2974 "System.IO.MonoIO::CreateDirectory", ves_icall_System_IO_MonoIO_CreateDirectory,
2975 "System.IO.MonoIO::RemoveDirectory", ves_icall_System_IO_MonoIO_RemoveDirectory,
2976 "System.IO.MonoIO::FindFirstFile", ves_icall_System_IO_MonoIO_FindFirstFile,
2977 "System.IO.MonoIO::FindNextFile", ves_icall_System_IO_MonoIO_FindNextFile,
2978 "System.IO.MonoIO::FindClose", ves_icall_System_IO_MonoIO_FindClose,
2979 "System.IO.MonoIO::GetCurrentDirectory", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
2980 "System.IO.MonoIO::SetCurrentDirectory", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
2981 "System.IO.MonoIO::MoveFile", ves_icall_System_IO_MonoIO_MoveFile,
2982 "System.IO.MonoIO::CopyFile", ves_icall_System_IO_MonoIO_CopyFile,
2983 "System.IO.MonoIO::DeleteFile", ves_icall_System_IO_MonoIO_DeleteFile,
2984 "System.IO.MonoIO::GetFileAttributes", ves_icall_System_IO_MonoIO_GetFileAttributes,
2985 "System.IO.MonoIO::SetFileAttributes", ves_icall_System_IO_MonoIO_SetFileAttributes,
2986 "System.IO.MonoIO::GetFileStat", ves_icall_System_IO_MonoIO_GetFileStat,
2987 "System.IO.MonoIO::Open", ves_icall_System_IO_MonoIO_Open,
2988 "System.IO.MonoIO::Close", ves_icall_System_IO_MonoIO_Close,
2989 "System.IO.MonoIO::Read", ves_icall_System_IO_MonoIO_Read,
2990 "System.IO.MonoIO::Write", ves_icall_System_IO_MonoIO_Write,
2991 "System.IO.MonoIO::Seek", ves_icall_System_IO_MonoIO_Seek,
2992 "System.IO.MonoIO::GetLength", ves_icall_System_IO_MonoIO_GetLength,
2993 "System.IO.MonoIO::SetLength", ves_icall_System_IO_MonoIO_SetLength,
2994 "System.IO.MonoIO::SetFileTime", ves_icall_System_IO_MonoIO_SetFileTime,
2995 "System.IO.MonoIO::Flush", ves_icall_System_IO_MonoIO_Flush,
2996 "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
2997 "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
2998 "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
2999 "System.IO.MonoIO::CreatePipe(intptr&,intptr&)", ves_icall_System_IO_MonoIO_CreatePipe,
3000 "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
3001 "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
3002 "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
3003 "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
3004 "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
3009 "System.Math::Sin", ves_icall_System_Math_Sin,
3010 "System.Math::Cos", ves_icall_System_Math_Cos,
3011 "System.Math::Tan", ves_icall_System_Math_Tan,
3012 "System.Math::Sinh", ves_icall_System_Math_Sinh,
3013 "System.Math::Cosh", ves_icall_System_Math_Cosh,
3014 "System.Math::Tanh", ves_icall_System_Math_Tanh,
3015 "System.Math::Acos", ves_icall_System_Math_Acos,
3016 "System.Math::Asin", ves_icall_System_Math_Asin,
3017 "System.Math::Atan", ves_icall_System_Math_Atan,
3018 "System.Math::Atan2", ves_icall_System_Math_Atan2,
3019 "System.Math::Exp", ves_icall_System_Math_Exp,
3020 "System.Math::Log", ves_icall_System_Math_Log,
3021 "System.Math::Log10", ves_icall_System_Math_Log10,
3022 "System.Math::PowImpl", ves_icall_System_Math_Pow,
3023 "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
3026 * System.Environment
3028 "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
3029 "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
3030 "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
3031 "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
3032 "System.Environment::GetCommandLineArgs", mono_runtime_get_main_args,
3033 "System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
3034 "System.Environment::Exit", ves_icall_System_Environment_Exit,
3035 "System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
3038 * System.Runtime.Remoting
3040 "System.Runtime.Remoting.RemotingServices::InternalExecute",
3041 ves_icall_InternalExecute,
3042 "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
3043 ves_icall_IsTransparentProxy,
3046 * System.Runtime.Remoting.Messaging
3048 "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
3049 ves_icall_MonoMethodMessage_InitMessage,
3052 * System.Runtime.Remoting.Proxies
3054 "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy",
3055 ves_icall_Remoting_RealProxy_GetTransparentProxy,
3058 * System.Threading.Interlocked
3060 "System.Threading.Interlocked::Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int,
3061 "System.Threading.Interlocked::Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long,
3062 "System.Threading.Interlocked::Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int,
3063 "System.Threading.Interlocked::Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long,
3064 "System.Threading.Interlocked::CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int,
3065 "System.Threading.Interlocked::CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object,
3066 "System.Threading.Interlocked::CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single,
3067 "System.Threading.Interlocked::Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int,
3068 "System.Threading.Interlocked::Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object,
3069 "System.Threading.Interlocked::Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single,
3072 * System.Diagnostics.Process
3074 "System.Diagnostics.Process::GetCurrentProcess_internal()", ves_icall_System_Diagnostics_Process_GetCurrentProcess_internal,
3075 "System.Diagnostics.Process::GetPid_internal()", ves_icall_System_Diagnostics_Process_GetPid_internal,
3076 "System.Diagnostics.Process::Process_free_internal(intptr)", ves_icall_System_Diagnostics_Process_Process_free_internal,
3077 "System.Diagnostics.Process::GetModules_internal()", ves_icall_System_Diagnostics_Process_GetModules_internal,
3078 "System.Diagnostics.Process::Start_internal(string,string,intptr,intptr,intptr,ProcInfo&)", ves_icall_System_Diagnostics_Process_Start_internal,
3079 "System.Diagnostics.Process::WaitForExit_internal(intptr,int)", ves_icall_System_Diagnostics_Process_WaitForExit_internal,
3080 "System.Diagnostics.Process::ExitTime_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitTime_internal,
3081 "System.Diagnostics.Process::StartTime_internal(intptr)", ves_icall_System_Diagnostics_Process_StartTime_internal,
3082 "System.Diagnostics.Process::ExitCode_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitCode_internal,
3083 "System.Diagnostics.FileVersionInfo::GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal,
3088 "System.Delegate::CreateDelegate_internal", ves_icall_System_Delegate_CreateDelegate_internal,
3091 * System.Runtime.Serialization
3093 "System.Runtime.Serialization.FormatterServices::GetUninitializedObjectInternal",
3094 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal,
3096 * add other internal calls here
3102 mono_init_icall (void)
3107 while ((name = icall_map [i])) {
3108 mono_add_internal_call (name, icall_map [i+1]);