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/string-icalls.h>
39 #include <mono/metadata/debug-mono-symfile.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_object_domain (type), 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_System_Runtime_CompilerServices_RuntimeHelpers_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_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void)
567 return offsetof (MonoString, chars);
571 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue (MonoObject *obj)
573 if ((obj == NULL) || (! (obj->vtable->klass->valuetype)))
576 return mono_object_clone (obj);
580 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (MonoType *handle)
584 MONO_CHECK_ARG_NULL (handle);
586 klass = mono_class_from_mono_type (handle);
587 MONO_CHECK_ARG (handle, klass);
589 /* This will call the type constructor */
590 mono_class_vtable (mono_domain_get (), klass);
594 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
596 return mono_object_clone (this);
600 #define MONO_OBJECT_ALIGNMENT_SHIFT 3
602 #define MONO_OBJECT_ALIGNMENT_SHIFT 2
606 * Return hashcode based on object address. This function will need to be
607 * smarter in the presence of a moving garbage collector, which will cache
608 * the address hash before relocating the object.
610 * Wang's address-based hash function:
611 * http://www.concentric.net/~Ttwang/tech/addrhash.htm
614 ves_icall_System_Object_GetHashCode (MonoObject *this)
616 register guint32 key;
617 key = (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
619 return key & 0x7fffffff;
623 * A hash function for value types. I have no idea if this is a good hash
624 * function (its similar to g_str_hash).
627 ves_icall_System_ValueType_GetHashCode (MonoObject *this)
633 MONO_CHECK_ARG_NULL (this);
635 size = this->vtable->klass->instance_size - sizeof (MonoObject);
637 p = (const char *)this + sizeof (MonoObject);
639 for (i = 0; i < size; i++) {
640 h = (h << 5) - h + *p;
648 ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that)
653 MONO_CHECK_ARG_NULL (that);
655 if (this->vtable != that->vtable)
658 size = this->vtable->klass->instance_size - sizeof (MonoObject);
660 p = (const char *)this + sizeof (MonoObject);
661 s = (const char *)that + sizeof (MonoObject);
663 return memcmp (p, s, size)? FALSE: TRUE;
666 static MonoReflectionType *
667 ves_icall_System_Object_GetType (MonoObject *obj)
669 return mono_type_get_object (mono_object_domain (obj), &obj->vtable->klass->byval_arg);
673 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
675 mtype->type = &obj->vtable->klass->byval_arg;
676 g_assert (mtype->type->type);
680 ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObject *obj)
682 return mono_image_create_token (assb->dynamic_assembly, obj);
686 ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, MonoArray *buf, gint32 offset)
689 MonoDynamicAssembly *ass = assb->dynamic_assembly;
690 char *p = mono_array_addr (buf, char, 0);
692 mono_image_create_pefile (assb);
694 if (offset >= ass->pefile.index)
696 count = mono_array_length (buf);
697 count = MIN (count, ass->pefile.index - offset);
699 memcpy (p, ass->pefile.data + offset, count);
705 get_get_type_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data) {
706 MonoImage **dest = data;
708 /* skip icalls and Type::GetType () */
709 if (!m || m->wrapper_type || (m->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
710 (strcmp (m->name, "GetType") == 0 && m->klass == mono_defaults.monotype_class->parent))
712 *dest = m->klass->image;
716 static MonoReflectionType*
717 ves_icall_type_from_name (MonoString *name)
719 MonoImage *image = NULL;
723 mono_stack_walk (get_get_type_caller, &image);
724 str = mono_string_to_utf8 (name);
725 /*g_print ("requested type %s\n", str);*/
726 type = mono_reflection_type_from_name (str, image);
730 /*g_print ("got it\n");*/
731 return mono_type_get_object (mono_object_domain (name), type);
734 static MonoReflectionType*
735 ves_icall_type_from_handle (MonoType *handle)
737 MonoDomain *domain = mono_domain_get ();
738 MonoClass *klass = mono_class_from_mono_type (handle);
740 mono_class_init (klass);
741 return mono_type_get_object (domain, handle);
745 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
747 if (type->type && c->type)
748 return mono_metadata_type_equal (type->type, c->type);
749 g_print ("type equals\n");
753 /* System.TypeCode */
776 ves_icall_type_GetTypeCode (MonoReflectionType *type)
778 int t = type->type->type;
782 return TYPECODE_OBJECT;
783 case MONO_TYPE_BOOLEAN:
784 return TYPECODE_BOOLEAN;
786 return TYPECODE_BYTE;
788 return TYPECODE_SBYTE;
790 return TYPECODE_UINT16;
792 return TYPECODE_INT16;
794 return TYPECODE_CHAR;
798 return TYPECODE_OBJECT;
800 return TYPECODE_UINT32;
802 return TYPECODE_INT32;
804 return TYPECODE_UINT64;
806 return TYPECODE_INT64;
808 return TYPECODE_SINGLE;
810 return TYPECODE_DOUBLE;
811 case MONO_TYPE_VALUETYPE:
812 if (type->type->data.klass->enumtype) {
813 t = type->type->data.klass->enum_basetype->type;
816 MonoClass *k = type->type->data.klass;
817 if (strcmp (k->name_space, "System") == 0) {
818 if (strcmp (k->name, "Decimal") == 0)
819 return TYPECODE_DECIMAL;
820 else if (strcmp (k->name, "DateTime") == 0)
821 return TYPECODE_DATETIME;
822 else if (strcmp (k->name, "DBNull") == 0)
823 return TYPECODE_DBNULL;
826 /* handle datetime, dbnull.. */
827 return TYPECODE_OBJECT;
828 case MONO_TYPE_STRING:
829 return TYPECODE_STRING;
830 case MONO_TYPE_SZARRAY:
831 case MONO_TYPE_ARRAY:
832 case MONO_TYPE_OBJECT:
833 return TYPECODE_OBJECT;
834 case MONO_TYPE_CLASS:
835 return TYPECODE_OBJECT;
837 g_error ("type 0x%02x not handled in GetTypeCode()", t);
843 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
849 g_assert (type != NULL);
851 domain = ((MonoObject *)type)->vtable->domain;
853 if (!c) /* FIXME: dont know what do do here */
856 klass = mono_class_from_mono_type (type->type);
857 klassc = mono_class_from_mono_type (c->type);
859 /* cut&paste from mono_object_isinst (): keep in sync */
860 if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && !(klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
861 MonoVTable *klass_vt = mono_class_vtable (domain, klass);
862 if ((klassc->interface_id <= klass->max_interface_id) &&
863 klass_vt->interface_offsets [klassc->interface_id])
865 } else if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && (klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
868 for (i = 0; i < klass->interface_count; i ++) {
869 MonoClass *ic = klass->interfaces [i];
875 * klass->baseval is 0 for interfaces
877 if (klass->baseval && ((klass->baseval - klassc->baseval) <= klassc->diffval))
884 ves_icall_get_attributes (MonoReflectionType *type)
886 MonoClass *klass = mono_class_from_mono_type (type->type);
892 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
894 MonoDomain *domain = mono_domain_get ();
896 info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
897 info->ret = mono_type_get_object (domain, method->signature->ret);
898 info->attrs = method->flags;
899 info->implattrs = method->iflags;
903 ves_icall_get_parameter_info (MonoMethod *method)
905 MonoDomain *domain = mono_domain_get ();
907 static MonoClass *System_Reflection_ParameterInfo;
908 MonoReflectionParameter** args;
911 args = mono_param_get_objects (domain, method);
912 if (!System_Reflection_ParameterInfo)
913 System_Reflection_ParameterInfo = mono_class_from_name (
914 mono_defaults.corlib, "System.Reflection", "ParameterInfo");
915 res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count);
916 for (i = 0; i < method->signature->param_count; ++i) {
917 mono_array_set (res, gpointer, i, args [i]);
923 ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
925 MonoDomain *domain = mono_object_domain (field);
927 info->parent = mono_type_get_object (domain, &field->klass->byval_arg);
928 info->type = mono_type_get_object (domain, field->field->type);
929 info->name = mono_string_new (domain, field->field->name);
930 info->attrs = field->field->type->attrs;
934 ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *obj)
937 MonoClassField *cf = field->field;
940 MonoDomain *domain = mono_object_domain (field);
942 gboolean is_static = FALSE;
943 gboolean is_ref = FALSE;
945 mono_class_init (field->klass);
947 switch (cf->type->type) {
948 case MONO_TYPE_STRING:
949 case MONO_TYPE_OBJECT:
950 case MONO_TYPE_CLASS:
951 case MONO_TYPE_ARRAY:
952 case MONO_TYPE_SZARRAY:
957 case MONO_TYPE_BOOLEAN:
969 case MONO_TYPE_VALUETYPE:
970 is_ref = cf->type->byref;
973 g_error ("type 0x%x not handled in "
974 "ves_icall_Monofield_GetValue", cf->type->type);
978 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
980 vtable = mono_class_vtable (domain, field->klass);
985 mono_field_static_get_value (vtable, cf, &o);
987 mono_field_get_value (obj, cf, &o);
992 /* boxed value type */
993 klass = mono_class_from_mono_type (cf->type);
994 o = mono_object_new (domain, klass);
995 v = ((gchar *) o) + sizeof (MonoObject);
997 mono_field_static_get_value (vtable, cf, v);
999 mono_field_get_value (obj, cf, v);
1006 ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *obj, MonoObject *value)
1008 MonoClassField *cf = field->field;
1011 v = (gchar *) value;
1012 if (!cf->type->byref) {
1013 switch (cf->type->type) {
1016 case MONO_TYPE_BOOLEAN:
1019 case MONO_TYPE_CHAR:
1028 case MONO_TYPE_VALUETYPE:
1029 v += sizeof (MonoObject);
1031 case MONO_TYPE_STRING:
1032 case MONO_TYPE_OBJECT:
1033 case MONO_TYPE_CLASS:
1034 case MONO_TYPE_ARRAY:
1035 case MONO_TYPE_SZARRAY:
1039 g_error ("type 0x%x not handled in "
1040 "ves_icall_FieldInfo_SetValueInternal", cf->type->type);
1045 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1046 MonoVTable *vtable = mono_class_vtable (mono_object_domain (field), field->klass);
1047 mono_field_static_set_value (vtable, cf, v);
1049 mono_field_set_value (obj, cf, v);
1054 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
1056 MonoDomain *domain = mono_object_domain (property);
1058 info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
1059 info->name = mono_string_new (domain, property->property->name);
1060 info->attrs = property->property->attrs;
1061 info->get = property->property->get ? mono_method_get_object (domain, property->property->get, NULL): NULL;
1062 info->set = property->property->set ? mono_method_get_object (domain, property->property->set, NULL): NULL;
1064 * There may be other methods defined for properties, though, it seems they are not exposed
1065 * in the reflection API
1070 ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
1072 MonoDomain *domain = mono_object_domain (event);
1074 info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
1075 info->name = mono_string_new (domain, event->event->name);
1076 info->attrs = event->event->attrs;
1077 info->add_method = event->event->add ? mono_method_get_object (domain, event->event->add, NULL): NULL;
1078 info->remove_method = event->event->remove ? mono_method_get_object (domain, event->event->remove, NULL): NULL;
1079 info->raise_method = event->event->raise ? mono_method_get_object (domain, event->event->raise, NULL): NULL;
1083 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
1085 MonoDomain *domain = mono_object_domain (type);
1088 MonoClass *class = mono_class_from_mono_type (type->type);
1092 for (parent = class; parent; parent = parent->parent) {
1093 ninterf += parent->interface_count;
1095 intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
1097 for (parent = class; parent; parent = parent->parent) {
1098 for (i = 0; i < parent->interface_count; ++i) {
1099 mono_array_set (intf, gpointer, ninterf, mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
1106 static MonoReflectionType*
1107 ves_icall_MonoType_GetElementType (MonoReflectionType *type)
1109 MonoClass *class = mono_class_from_mono_type (type->type);
1110 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1111 return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
1112 else if (class->element_class)
1113 return mono_type_get_object (mono_object_domain (type), &class->element_class->byval_arg);
1118 static MonoReflectionType*
1119 ves_icall_get_type_parent (MonoReflectionType *type)
1121 MonoClass *class = mono_class_from_mono_type (type->type);
1122 return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
1126 ves_icall_type_ispointer (MonoReflectionType *type)
1128 return type->type->type == MONO_TYPE_PTR;
1132 ves_icall_type_isbyref (MonoReflectionType *type)
1134 return type->type->byref;
1137 static MonoReflectionModule*
1138 ves_icall_MonoType_get_Module (MonoReflectionType *type)
1140 MonoClass *class = mono_class_from_mono_type (type->type);
1141 return mono_module_get_object (mono_object_domain (type), class->image);
1145 ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
1147 MonoDomain *domain = mono_domain_get ();
1148 MonoClass *class = mono_class_from_mono_type (type);
1150 info->nested_in = class->nested_in ? mono_type_get_object (domain, &class->nested_in->byval_arg): NULL;
1151 info->name = mono_string_new (domain, class->name);
1152 info->name_space = mono_string_new (domain, class->name_space);
1153 info->rank = class->rank;
1154 info->assembly = mono_assembly_get_object (domain, class->image->assembly);
1155 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1156 info->etype = mono_type_get_object (domain, class->enum_basetype);
1157 else if (class->element_class)
1158 info->etype = mono_type_get_object (domain, &class->element_class->byval_arg);
1162 info->isprimitive = (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8);
1166 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
1168 return mono_runtime_invoke_array (method->method, this, params, NULL);
1172 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
1174 MonoDomain *domain = mono_object_domain (method);
1175 MonoMethod *m = method->method;
1176 MonoMethodSignature *sig = m->signature;
1177 MonoArray *out_args;
1179 int i, j, outarg_count = 0;
1181 if (m->klass == mono_defaults.object_class) {
1183 if (!strcmp (m->name, "FieldGetter")) {
1184 MonoClass *k = this->vtable->klass;
1185 MonoString *name = mono_array_get (params, MonoString *, 1);
1188 str = mono_string_to_utf8 (name);
1190 for (i = 0; i < k->field.count; i++) {
1191 if (!strcmp (k->fields [i].name, str)) {
1192 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1193 if (field_klass->valuetype)
1194 result = mono_value_box (domain, field_klass,
1195 (char *)this + k->fields [i].offset);
1197 result = *((gpointer *)((char *)this + k->fields [i].offset));
1200 out_args = mono_array_new (domain, mono_defaults.object_class, 1);
1201 *outArgs = out_args;
1202 mono_array_set (out_args, gpointer, 0, result);
1209 g_assert_not_reached ();
1211 } else if (!strcmp (m->name, "FieldSetter")) {
1212 MonoClass *k = this->vtable->klass;
1213 MonoString *name = mono_array_get (params, MonoString *, 1);
1217 str = mono_string_to_utf8 (name);
1219 for (i = 0; i < k->field.count; i++) {
1220 if (!strcmp (k->fields [i].name, str)) {
1221 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1222 MonoObject *val = mono_array_get (params, gpointer, 2);
1224 if (field_klass->valuetype) {
1225 size = mono_type_size (k->fields [i].type, &align);
1226 memcpy ((char *)this + k->fields [i].offset,
1227 ((char *)val) + sizeof (MonoObject), size);
1229 *((gpointer *)this + k->fields [i].offset) = val;
1238 g_assert_not_reached ();
1243 for (i = 0; i < mono_array_length (params); i++) {
1244 if (sig->params [i]->byref)
1248 out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
1250 for (i = 0, j = 0; i < mono_array_length (params); i++) {
1251 if (sig->params [i]->byref) {
1253 arg = mono_array_get (params, gpointer, i);
1254 mono_array_set (out_args, gpointer, j, arg);
1259 /* fixme: handle constructors? */
1260 if (!strcmp (method->method->name, ".ctor"))
1261 g_assert_not_reached ();
1263 result = mono_runtime_invoke_array (method->method, this, params, NULL);
1265 *outArgs = out_args;
1271 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
1274 MonoClass *enumc, *objc;
1278 MONO_CHECK_ARG_NULL (type);
1279 MONO_CHECK_ARG_NULL (obj);
1281 domain = mono_object_domain (type);
1282 enumc = mono_class_from_mono_type (type->type);
1283 objc = obj->vtable->klass;
1285 MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
1286 MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
1287 objc->byval_arg.type <= MONO_TYPE_U8));
1289 s1 = mono_class_value_size (enumc, NULL);
1290 s2 = mono_class_value_size (objc, NULL);
1292 res = mono_object_new (domain, enumc);
1294 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
1295 memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
1297 memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
1298 (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
1305 ves_icall_System_Enum_get_value (MonoObject *this)
1316 g_assert (this->vtable->klass->enumtype);
1318 enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
1319 res = mono_object_new (mono_object_domain (this), enumc);
1320 dst = (char *)res + sizeof (MonoObject);
1321 src = (char *)this + sizeof (MonoObject);
1322 size = mono_class_value_size (enumc, NULL);
1324 memcpy (dst, src, size);
1330 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
1332 MonoDomain *domain = mono_object_domain (type);
1333 MonoClass *enumc = mono_class_from_mono_type (type->type);
1334 guint i, j, nvalues, crow;
1335 MonoClassField *field;
1337 info->utype = mono_type_get_object (domain, enumc->enum_basetype);
1338 nvalues = enumc->field.count - 1;
1339 info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
1340 info->values = mono_array_new (domain, enumc, nvalues);
1342 for (i = 0, j = 0; i < enumc->field.count; ++i) {
1343 field = &enumc->fields [i];
1344 if (strcmp ("value__", field->name) == 0)
1346 mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
1348 crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1));
1349 crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
1350 /* 1 is the length of the blob */
1351 field->data = 1 + mono_metadata_blob_heap (enumc->image, crow);
1353 switch (enumc->enum_basetype->type) {
1356 mono_array_set (info->values, gchar, j, *field->data);
1358 case MONO_TYPE_CHAR:
1361 mono_array_set (info->values, gint16, j, read16 (field->data));
1365 mono_array_set (info->values, gint32, j, read32 (field->data));
1369 mono_array_set (info->values, gint64, j, read64 (field->data));
1372 g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
1379 BFLAGS_IgnoreCase = 1,
1380 BFLAGS_DeclaredOnly = 2,
1381 BFLAGS_Instance = 4,
1383 BFLAGS_Public = 0x10,
1384 BFLAGS_NonPublic = 0x20,
1385 BFLAGS_InvokeMethod = 0x100,
1386 BFLAGS_CreateInstance = 0x200,
1387 BFLAGS_GetField = 0x400,
1388 BFLAGS_SetField = 0x800,
1389 BFLAGS_GetProperty = 0x1000,
1390 BFLAGS_SetProperty = 0x2000,
1391 BFLAGS_ExactBinding = 0x10000,
1392 BFLAGS_SuppressChangeType = 0x20000,
1393 BFLAGS_OptionalParamBinding = 0x40000
1396 static MonoFieldInfo *
1397 ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
1400 MonoClass *startklass, *klass;
1402 MonoClassField *field;
1404 domain = ((MonoObject *)type)->vtable->domain;
1405 klass = startklass = mono_class_from_mono_type (type->type);
1411 for (i = 0; i < klass->field.count; ++i) {
1413 field = &klass->fields [i];
1414 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1415 if (bflags & BFLAGS_Public)
1418 if (bflags & BFLAGS_NonPublic)
1424 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1425 if (bflags & BFLAGS_Static)
1428 if (bflags & BFLAGS_Instance)
1435 utf8_name = mono_string_to_utf8 (name);
1437 if (strcmp (field->name, utf8_name)) {
1443 return (MonoFieldInfo *)mono_field_get_object (domain, klass, field);
1445 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1452 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
1455 GSList *l = NULL, *tmp;
1456 MonoClass *startklass, *klass;
1460 MonoClassField *field;
1462 domain = ((MonoObject *)type)->vtable->domain;
1463 klass = startklass = mono_class_from_mono_type (type->type);
1466 for (i = 0; i < klass->field.count; ++i) {
1468 field = &klass->fields [i];
1469 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1470 if (bflags & BFLAGS_Public)
1473 if (bflags & BFLAGS_NonPublic)
1479 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1480 if (bflags & BFLAGS_Static)
1483 if (bflags & BFLAGS_Instance)
1489 member = (MonoObject*)mono_field_get_object (domain, klass, field);
1490 l = g_slist_prepend (l, member);
1492 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1494 len = g_slist_length (l);
1495 res = mono_array_new (domain, mono_defaults.field_info_class, len);
1497 tmp = g_slist_reverse (l);
1498 for (; tmp; tmp = tmp->next, ++i)
1499 mono_array_set (res, gpointer, i, tmp->data);
1505 ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
1508 GSList *l = NULL, *tmp;
1509 static MonoClass *System_Reflection_MethodInfo;
1510 MonoClass *startklass, *klass;
1515 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
1517 domain = ((MonoObject *)type)->vtable->domain;
1518 klass = startklass = mono_class_from_mono_type (type->type);
1522 for (i = 0; i < klass->method.count; ++i) {
1524 method = klass->methods [i];
1525 if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
1527 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1528 if (bflags & BFLAGS_Public)
1531 if (bflags & BFLAGS_NonPublic)
1537 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1538 if (bflags & BFLAGS_Static)
1541 if (bflags & BFLAGS_Instance)
1548 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
1550 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
1551 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1553 l = g_slist_prepend (l, member);
1556 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1558 if (!System_Reflection_MethodInfo)
1559 System_Reflection_MethodInfo = mono_class_from_name (
1560 mono_defaults.corlib, "System.Reflection", "MethodInfo");
1561 res = mono_array_new (domain, System_Reflection_MethodInfo, len);
1564 for (; tmp; tmp = tmp->next, ++i)
1565 mono_array_set (res, gpointer, i, tmp->data);
1567 g_hash_table_destroy (method_slots);
1572 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
1575 GSList *l = NULL, *tmp;
1576 static MonoClass *System_Reflection_ConstructorInfo;
1577 MonoClass *startklass, *klass;
1583 domain = ((MonoObject *)type)->vtable->domain;
1584 klass = startklass = mono_class_from_mono_type (type->type);
1586 for (i = 0; i < klass->method.count; ++i) {
1588 method = klass->methods [i];
1589 if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
1591 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1592 if (bflags & BFLAGS_Public)
1595 if (bflags & BFLAGS_NonPublic)
1601 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1602 if (bflags & BFLAGS_Static)
1605 if (bflags & BFLAGS_Instance)
1611 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1613 l = g_slist_prepend (l, member);
1615 len = g_slist_length (l);
1616 if (!System_Reflection_ConstructorInfo)
1617 System_Reflection_ConstructorInfo = mono_class_from_name (
1618 mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
1619 res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
1621 tmp = g_slist_reverse (l);
1622 for (; tmp; tmp = tmp->next, ++i)
1623 mono_array_set (res, gpointer, i, tmp->data);
1629 ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
1632 GSList *l = NULL, *tmp;
1633 static MonoClass *System_Reflection_PropertyInfo;
1634 MonoClass *startklass, *klass;
1640 GHashTable *method_slots = g_hash_table_new (NULL, NULL);
1642 domain = ((MonoObject *)type)->vtable->domain;
1643 klass = startklass = mono_class_from_mono_type (type->type);
1646 for (i = 0; i < klass->property.count; ++i) {
1647 prop = &klass->properties [i];
1652 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1653 if (bflags & BFLAGS_Public)
1656 if (bflags & BFLAGS_NonPublic)
1662 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1663 if (bflags & BFLAGS_Static)
1666 if (bflags & BFLAGS_Instance)
1674 if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
1676 g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), prop);
1678 l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
1681 if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
1683 if (!System_Reflection_PropertyInfo)
1684 System_Reflection_PropertyInfo = mono_class_from_name (
1685 mono_defaults.corlib, "System.Reflection", "PropertyInfo");
1686 res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
1689 for (; tmp; tmp = tmp->next, ++i)
1690 mono_array_set (res, gpointer, i, tmp->data);
1692 g_hash_table_destroy (method_slots);
1697 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
1700 GSList *l = NULL, *tmp;
1701 static MonoClass *System_Reflection_EventInfo;
1702 MonoClass *startklass, *klass;
1708 domain = ((MonoObject *)type)->vtable->domain;
1709 klass = startklass = mono_class_from_mono_type (type->type);
1712 for (i = 0; i < klass->event.count; ++i) {
1713 event = &klass->events [i];
1715 method = event->add;
1717 method = event->remove;
1718 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1719 if (bflags & BFLAGS_Public)
1722 if (bflags & BFLAGS_NonPublic)
1728 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1729 if (bflags & BFLAGS_Static)
1732 if (bflags & BFLAGS_Instance)
1739 l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
1741 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1743 len = g_slist_length (l);
1744 if (!System_Reflection_EventInfo)
1745 System_Reflection_EventInfo = mono_class_from_name (
1746 mono_defaults.corlib, "System.Reflection", "EventInfo");
1747 res = mono_array_new (domain, System_Reflection_EventInfo, len);
1750 for (; tmp; tmp = tmp->next, ++i)
1751 mono_array_set (res, gpointer, i, tmp->data);
1757 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
1760 GSList *l = NULL, *tmp;
1762 MonoClass *startklass, *klass;
1768 domain = ((MonoObject *)type)->vtable->domain;
1769 klass = startklass = mono_class_from_mono_type (type->type);
1771 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
1773 nested = tmpn->data;
1774 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
1775 if (bflags & BFLAGS_Public)
1778 if (bflags & BFLAGS_NonPublic)
1783 member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
1784 l = g_slist_prepend (l, member);
1786 len = g_slist_length (l);
1787 res = mono_array_new (domain, mono_defaults.monotype_class, len);
1789 tmp = g_slist_reverse (l);
1790 for (; tmp; tmp = tmp->next, ++i)
1791 mono_array_set (res, gpointer, i, tmp->data);
1796 static MonoReflectionType*
1797 ves_icall_System_Reflection_Assembly_GetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
1801 MonoTypeNameParse info;
1803 str = mono_string_to_utf8 (name);
1804 /*g_print ("requested type %s in %s\n", str, assembly->assembly->aname.name);*/
1805 if (!mono_reflection_parse_type (str, &info)) {
1807 g_list_free (info.modifiers);
1808 g_list_free (info.nested);
1809 if (throwOnError) /* uhm: this is a parse error, though... */
1810 mono_raise_exception (mono_get_exception_type_load ());
1811 /*g_print ("failed parse\n");*/
1815 type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
1817 g_list_free (info.modifiers);
1818 g_list_free (info.nested);
1821 mono_raise_exception (mono_get_exception_type_load ());
1822 /* g_print ("failed find\n"); */
1825 /* g_print ("got it\n"); */
1826 return mono_type_get_object (mono_object_domain (assembly), type);
1831 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
1833 MonoDomain *domain = mono_object_domain (assembly);
1835 char *name = g_strconcat (
1836 "file://", assembly->assembly->image->name, NULL);
1838 res = mono_string_new (domain, name);
1844 ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assembly)
1846 MonoDomain *domain = mono_object_domain (assembly);
1848 char *name = g_strconcat (
1849 assembly->assembly->basedir, G_DIR_SEPARATOR_S,
1850 assembly->assembly->image->module_name, NULL);
1852 res = mono_string_new (domain, name);
1857 static MonoReflectionMethod*
1858 ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly) {
1859 guint32 token = mono_image_get_entry_point (assembly->assembly->image);
1862 return mono_method_get_object (mono_object_domain (assembly), mono_get_method (assembly->assembly->image, token, NULL), NULL);
1866 ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly) {
1867 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
1868 MonoArray *result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
1872 for (i = 0; i < table->rows; ++i) {
1873 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_MANIFEST_NAME));
1874 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), val));
1880 ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAssembly *assembly) {
1881 static MonoClass *System_Reflection_AssemblyName;
1886 if (!System_Reflection_AssemblyName)
1887 System_Reflection_AssemblyName = mono_class_from_name (
1888 mono_defaults.corlib, "System.Reflection", "AssemblyName");
1890 for (ptr = assembly->assembly->image->references; ptr && *ptr; ptr++)
1893 result = mono_array_new (mono_object_domain (assembly), System_Reflection_AssemblyName, count);
1895 for (i = 0; i < count; i++) {
1896 MonoAssembly *assem = assembly->assembly->image->references [i];
1897 MonoReflectionAssemblyName *aname;
1899 aname = (MonoReflectionAssemblyName *) mono_object_new (
1900 mono_object_domain (assembly), System_Reflection_AssemblyName);
1902 if (strcmp (assem->aname.name, "corlib") == 0)
1903 aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
1905 aname->name = mono_string_new (mono_object_domain (assembly), assem->aname.name);
1906 aname->major = assem->aname.major;
1908 mono_array_set (result, gpointer, i, aname);
1913 /* move this in some file in mono/util/ */
1915 g_concat_dir_and_file (const char *dir, const char *file)
1917 g_return_val_if_fail (dir != NULL, NULL);
1918 g_return_val_if_fail (file != NULL, NULL);
1921 * If the directory name doesn't have a / on the end, we need
1922 * to add one so we get a proper path to the file
1924 if (dir [strlen(dir) - 1] != G_DIR_SEPARATOR)
1925 return g_strconcat (dir, G_DIR_SEPARATOR_S, file, NULL);
1927 return g_strconcat (dir, file, NULL);
1931 ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name) {
1932 char *n = mono_string_to_utf8 (name);
1933 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
1935 guint32 cols [MONO_MANIFEST_SIZE];
1939 for (i = 0; i < table->rows; ++i) {
1940 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
1941 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
1942 if (strcmp (val, n) == 0)
1946 if (i == table->rows)
1949 if (!cols [MONO_MANIFEST_IMPLEMENTATION]) {
1952 val = mono_image_get_resource (assembly->assembly->image, cols [MONO_MANIFEST_OFFSET], &size);
1955 data = mono_array_new (mono_object_domain (assembly), mono_defaults.byte_class, size);
1956 memcpy (mono_array_addr (data, char, 0), val, size);
1957 return (MonoObject*)data;
1959 switch (cols [MONO_MANIFEST_IMPLEMENTATION] & IMPLEMENTATION_MASK) {
1960 case IMPLEMENTATION_FILE:
1961 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
1962 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
1963 i = mono_metadata_decode_row_col (table, i - 1, MONO_FILE_NAME);
1964 val = mono_metadata_string_heap (assembly->assembly->image, i);
1965 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1966 result = (MonoObject*)mono_string_new (mono_object_domain (assembly), n);
1967 /* check hash if needed */
1970 case IMPLEMENTATION_ASSEMBLYREF:
1971 case IMPLEMENTATION_EXP_TYPE:
1979 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name) {
1980 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
1986 /* check hash if needed */
1988 n = mono_string_to_utf8 (name);
1989 for (i = 0; i < table->rows; ++i) {
1990 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
1991 if (strcmp (val, n) == 0) {
1994 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1995 fn = mono_string_new (mono_object_domain (assembly), n);
1997 return (MonoObject*)fn;
2004 for (i = 0; i < table->rows; ++i) {
2005 result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
2006 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
2007 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
2008 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), n));
2011 return (MonoObject*)result;
2014 static MonoReflectionMethod*
2015 ves_icall_GetCurrentMethod (void) {
2016 MonoMethod *m = mono_method_get_last_managed ();
2017 return mono_method_get_object (mono_domain_get (), m, NULL);
2020 static MonoReflectionAssembly*
2021 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (void)
2023 MonoMethod *m = mono_method_get_last_managed ();
2024 return mono_assembly_get_object (mono_domain_get (), m->klass->image->assembly);
2029 get_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data)
2031 MonoMethod **dest = data;
2043 static MonoReflectionAssembly*
2044 ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
2046 MonoDomain* domain = mono_domain_get ();
2047 g_assert (domain->entry_assembly);
2048 return mono_assembly_get_object (domain, domain->entry_assembly);
2052 static MonoReflectionAssembly*
2053 ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
2055 MonoMethod *m = mono_method_get_last_managed ();
2056 MonoMethod *dest = m;
2057 mono_stack_walk (get_caller, &dest);
2060 return mono_assembly_get_object (mono_domain_get (), dest->klass->image->assembly);
2064 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
2066 MonoDomain *domain = mono_object_domain (object);
2070 name = mono_type_get_name (object->type);
2071 res = mono_string_new (domain, name);
2078 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
2080 MonoAssemblyName *name = &assembly->assembly->aname;
2082 if (strcmp (name->name, "corlib") == 0)
2083 aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
2085 aname->name = mono_string_new (mono_object_domain (assembly), name->name);
2086 aname->major = name->major;
2090 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
2092 MonoDomain *domain = mono_object_domain (assembly);
2095 MonoTableInfo *tdef = &assembly->assembly->image->tables [MONO_TABLE_TYPEDEF];
2097 guint32 attrs, visibility;
2099 /* we start the count from 1 because we skip the special type <Module> */
2102 for (i = 1; i < tdef->rows; ++i) {
2103 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2104 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2105 if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
2109 count = tdef->rows - 1;
2111 res = mono_array_new (domain, mono_defaults.monotype_class, count);
2113 for (i = 1; i < tdef->rows; ++i) {
2114 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2115 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2116 if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
2117 klass = mono_class_get (assembly->assembly->image, (i + 1) | MONO_TOKEN_TYPE_DEF);
2118 mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
2126 static MonoReflectionType*
2127 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
2130 int isbyref = 0, rank;
2131 char *str = mono_string_to_utf8 (smodifiers);
2134 klass = mono_class_from_mono_type (tb->type.type);
2136 /* logic taken from mono_reflection_parse_type(): keep in sync */
2140 if (isbyref) { /* only one level allowed by the spec */
2147 return mono_type_get_object (mono_object_domain (tb), &klass->this_arg);
2150 klass = mono_ptr_class_get (&klass->byval_arg);
2151 mono_class_init (klass);
2162 else if (*p != '*') { /* '*' means unknown lower bound */
2173 klass = mono_array_class_get (&klass->byval_arg, rank);
2174 mono_class_init (klass);
2181 return mono_type_get_object (mono_object_domain (tb), &klass->byval_arg);
2185 ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target,
2186 MonoReflectionMethod *info)
2188 MonoClass *delegate_class = mono_class_from_mono_type (type->type);
2189 MonoObject *delegate;
2192 mono_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
2194 delegate = mono_object_new (mono_object_domain (type), delegate_class);
2196 func = mono_compile_method (info->method);
2198 mono_delegate_ctor (delegate, target, func);
2204 * Magic number to convert a time which is relative to
2205 * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
2207 #define EPOCH_ADJUST ((gint64)62135596800L)
2210 ves_icall_System_DateTime_GetNow (void)
2212 #ifdef PLATFORM_WIN32
2217 SystemTimeToFileTime (&st, &ft);
2218 return (gint64)504911232000000000L + ((((gint64)ft.dwHighDateTime)<<32) | ft.dwLowDateTime);
2220 /* FIXME: put this in io-layer and call it GetLocalTime */
2224 if (gettimeofday (&tv, NULL) == 0) {
2225 res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
2228 /* fixme: raise exception */
2234 * This is heavily based on zdump.c from glibc 2.2.
2236 * * data[0]: start of daylight saving time (in DateTime ticks).
2237 * * data[1]: end of daylight saving time (in DateTime ticks).
2238 * * data[2]: utcoffset (in TimeSpan ticks).
2239 * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
2240 * * name[0]: name of this timezone when not daylight saving.
2241 * * name[1]: name of this timezone when daylight saving.
2243 * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
2244 * the class library allows years between 1 and 9999.
2246 * Returns true on success and zero on failure.
2249 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
2251 #ifndef PLATFORM_WIN32
2252 MonoDomain *domain = mono_domain_get ();
2253 struct tm start, tt;
2257 int is_daylight = 0, day;
2259 memset (&start, 0, sizeof (start));
2262 start.tm_year = year-1900;
2264 t = mktime (&start);
2265 #if defined (HAVE_TIMEZONE)
2266 #define gmt_offset(x) (-1 * (((timezone / 60 / 60) - daylight) * 100))
2267 #elif defined (HAVE_TM_GMTOFF)
2268 #define gmt_offset(x) x.tm_gmtoff
2270 #error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
2273 gmtoff = gmt_offset (start);
2275 MONO_CHECK_ARG_NULL (data);
2276 MONO_CHECK_ARG_NULL (names);
2278 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2279 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2281 /* For each day of the year, calculate the tm_gmtoff. */
2282 for (day = 0; day < 365; day++) {
2285 tt = *localtime (&t);
2287 /* Daylight saving starts or ends here. */
2288 if (gmt_offset (tt) != gmtoff) {
2293 /* Try to find the exact hour when daylight saving starts/ends. */
2297 tt1 = *localtime (&t1);
2298 } while (gmt_offset (tt1) != gmtoff);
2300 /* Try to find the exact minute when daylight saving starts/ends. */
2303 tt1 = *localtime (&t1);
2304 } while (gmt_offset (tt1) == gmtoff);
2306 strftime (tzone, 10, "%Z", &tt);
2308 /* Write data, if we're already in daylight saving, we're done. */
2310 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
2311 mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2314 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
2315 mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2319 /* This is only set once when we enter daylight saving. */
2320 mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
2321 mono_array_set ((*data), gint64, 3, (gint64)(gmt_offset (tt) - gmtoff) * 10000000L);
2323 gmtoff = gmt_offset (tt);
2326 gmtoff = gmt_offset (tt);
2330 MonoDomain *domain = mono_domain_get ();
2331 TIME_ZONE_INFORMATION tz_info;
2335 GetTimeZoneInformation (&tz_info);
2337 MONO_CHECK_ARG_NULL (data);
2338 MONO_CHECK_ARG_NULL (names);
2340 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2341 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2343 for (i = 0; i < 32; ++i)
2344 if (!tz_info.DaylightName [i])
2346 mono_array_set ((*names), gpointer, 1, mono_string_new_utf16 (domain, tz_info.DaylightName, i));
2347 for (i = 0; i < 32; ++i)
2348 if (!tz_info.StandardName [i])
2350 mono_array_set ((*names), gpointer, 0, mono_string_new_utf16 (domain, tz_info.StandardName, i));
2352 SystemTimeToFileTime (&tz_info.StandardDate, &ft);
2353 mono_array_set ((*data), gint64, 1, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2354 SystemTimeToFileTime (&tz_info.DaylightDate, &ft);
2355 mono_array_set ((*data), gint64, 0, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2356 mono_array_set ((*data), gint64, 3, tz_info.Bias + tz_info.StandardBias);
2357 mono_array_set ((*data), gint64, 2, tz_info.Bias + tz_info.DaylightBias);
2364 ves_icall_System_Object_obj_address (MonoObject *this) {
2371 ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
2377 klass = array->obj.vtable->klass;
2378 etype = klass->element_class->byval_arg.type;
2379 if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
2382 if (array->bounds == NULL)
2383 length = array->max_length;
2386 for (i = 0; i < klass->rank; ++ i)
2387 length += array->bounds [i].length;
2390 esize = mono_array_element_size (klass);
2391 return length * esize;
2395 ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx) {
2396 return mono_array_get (array, gint8, idx);
2400 ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) {
2401 mono_array_set (array, gint8, idx, value);
2405 ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) {
2406 char *src_buf, *dest_buf;
2408 src_buf = (gint8 *)src->vector + src_offset;
2409 dest_buf = (gint8 *)dest->vector + dest_offset;
2411 memcpy (dest_buf, src_buf, count);
2415 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
2417 MonoDomain *domain = mono_object_domain (this);
2419 MonoRealProxy *rp = ((MonoRealProxy *)this);
2423 res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
2425 ((MonoTransparentProxy *)res)->rp = rp;
2426 type = ((MonoReflectionType *)rp->class_to_proxy)->type;
2427 klass = mono_class_from_mono_type (type);
2429 ((MonoTransparentProxy *)res)->klass = klass;
2431 res->vtable = mono_class_proxy_vtable (domain, klass);
2436 /* System.Environment */
2439 ves_icall_System_Environment_get_MachineName (void)
2441 #if defined (PLATFORM_WIN32)
2446 len = MAX_COMPUTERNAME_LENGTH + 1;
2447 buf = g_new (gunichar2, len);
2450 if (GetComputerName (buf, (PDWORD) &len))
2451 result = mono_string_new_utf16 (mono_domain_get (), buf, len);
2461 buf = g_new (gchar, len);
2464 if (gethostname (buf, len) != 0)
2465 result = mono_string_new (mono_domain_get (), buf);
2473 ves_icall_System_Environment_get_Platform (void)
2475 #if defined (PLATFORM_WIN32)
2485 ves_icall_System_Environment_get_NewLine (void)
2487 #if defined (PLATFORM_WIN32)
2488 return mono_string_new (mono_domain_get (), "\r\n");
2490 return mono_string_new (mono_domain_get (), "\n");
2495 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
2503 utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
2504 value = g_getenv (utf8_name);
2510 return mono_string_new (mono_domain_get (), value);
2514 * There is no standard way to get at environ.
2516 extern char **environ;
2519 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
2528 for (e = environ; *e != 0; ++ e)
2531 domain = mono_domain_get ();
2532 names = mono_array_new (domain, mono_defaults.string_class, n);
2535 for (e = environ; *e != 0; ++ e) {
2536 parts = g_strsplit (*e, "=", 2);
2538 str = mono_string_new (domain, *parts);
2539 mono_array_set (names, MonoString *, n, str);
2551 * Returns the number of milliseconds elapsed since the system started.
2554 ves_icall_System_Environment_get_TickCount (void)
2556 #if defined (PLATFORM_WIN32)
2557 return GetTickCount();
2563 res = (gint32) gettimeofday (&tv, &tz);
2566 res = (gint32) ((tv.tv_sec & 0xFFFFF) * 1000 + (tv.tv_usec / 1000));
2573 ves_icall_System_Environment_Exit (int result)
2575 /* we may need to do some cleanup here... */
2580 ves_icall_System_Text_Encoding_InternalCodePage (void) {
2582 g_get_charset (&cset);
2583 /* g_print ("charset: %s\n", cset); */
2584 /* handle some common aliases */
2587 if (strcmp (cset, "ANSI_X3.4-1968") == 0)
2591 return mono_string_new (mono_domain_get (), cset);
2595 ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
2596 MonoReflectionMethod *method,
2597 MonoArray *out_args)
2599 mono_message_init (mono_object_domain (this), this, method, out_args);
2603 ves_icall_IsTransparentProxy (MonoObject *proxy)
2608 if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
2615 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal (MonoReflectionType *type)
2621 domain = mono_object_domain (type);
2622 klass = mono_class_from_mono_type (type->type);
2624 if (klass->rank >= 1) {
2625 g_assert (klass->rank == 1);
2626 obj = (MonoObject *) mono_array_new (domain, klass->element_class, 0);
2628 obj = mono_object_new (domain, klass);
2635 ves_icall_System_IO_get_temp_path (void)
2637 return mono_string_new (mono_domain_get (), g_get_tmp_dir ());
2641 ves_icall_RuntimeMethod_GetFunctionPointer (MonoMethod *method)
2643 return mono_compile_method (method);
2647 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
2649 static MonoString *mcpath;
2655 path = g_build_path (G_DIR_SEPARATOR_S, MONO_CFG_DIR, "mono", "machine.config", NULL);
2657 #if defined (PLATFORM_WIN32)
2658 /* Avoid mixing '/' and '\\' */
2661 for (i = strlen (path) - 1; i >= 0; i--)
2662 if (path [i] == '/')
2666 mcpath = mono_string_new (mono_domain_get (), path);
2674 static gconstpointer icall_map [] = {
2678 "System.Array::GetValue", ves_icall_System_Array_GetValue,
2679 "System.Array::SetValue", ves_icall_System_Array_SetValue,
2680 "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
2681 "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
2682 "System.Array::GetRank", ves_icall_System_Array_GetRank,
2683 "System.Array::GetLength", ves_icall_System_Array_GetLength,
2684 "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
2685 "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
2686 "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
2687 "System.Array::Clone", mono_array_clone,
2692 "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
2693 "System.Object::GetType", ves_icall_System_Object_GetType,
2694 "System.Object::GetHashCode", ves_icall_System_Object_GetHashCode,
2695 "System.Object::obj_address", ves_icall_System_Object_obj_address,
2700 "System.ValueType::GetHashCode", ves_icall_System_ValueType_GetHashCode,
2701 "System.ValueType::Equals", ves_icall_System_ValueType_Equals,
2707 "System.String::.ctor(char*)", ves_icall_System_String_ctor_charp,
2708 "System.String::.ctor(char*,int,int)", ves_icall_System_String_ctor_charp_int_int,
2709 "System.String::.ctor(sbyte*)", ves_icall_System_String_ctor_sbytep,
2710 "System.String::.ctor(sbyte*,int,int)", ves_icall_System_String_ctor_sbytep_int_int,
2711 "System.String::.ctor(sbyte*,int,int,System.Text.Encoding)", ves_icall_System_String_ctor_encoding,
2712 "System.String::.ctor(char[])", ves_icall_System_String_ctor_chara,
2713 "System.String::.ctor(char[],int,int)", ves_icall_System_String_ctor_chara_int_int,
2714 "System.String::.ctor(char,int)", ves_icall_System_String_ctor_char_int,
2715 "System.String::InternalEquals", ves_icall_System_String_InternalEquals,
2716 "System.String::InternalJoin", ves_icall_System_String_InternalJoin,
2717 "System.String::InternalInsert", ves_icall_System_String_InternalInsert,
2718 "System.String::InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char,
2719 "System.String::InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str,
2720 "System.String::InternalRemove", ves_icall_System_String_InternalRemove,
2721 "System.String::InternalCopyTo", ves_icall_System_String_InternalCopyTo,
2722 "System.String::InternalSplit", ves_icall_System_String_InternalSplit,
2723 "System.String::InternalTrim", ves_icall_System_String_InternalTrim,
2724 "System.String::InternalIndexOf(char,int,int)", ves_icall_System_String_InternalIndexOf_Char,
2725 "System.String::InternalIndexOf(string,int,int)", ves_icall_System_String_InternalIndexOf_Str,
2726 "System.String::InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny,
2727 "System.String::InternalLastIndexOf(char,int,int)", ves_icall_System_String_InternalLastIndexOf_Char,
2728 "System.String::InternalLastIndexOf(string,int,int)", ves_icall_System_String_InternalLastIndexOf_Str,
2729 "System.String::InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny,
2730 "System.String::InternalPad", ves_icall_System_String_InternalPad,
2731 "System.String::InternalToLower", ves_icall_System_String_InternalToLower,
2732 "System.String::InternalToUpper", ves_icall_System_String_InternalToUpper,
2733 "System.String::InternalAllocateStr", ves_icall_System_String_InternalAllocateStr,
2734 "System.String::InternalStrcpy(string,int,string)", ves_icall_System_String_InternalStrcpy_Str,
2735 "System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
2736 "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
2737 "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
2738 "System.String::InternalCompare(string,int,string,int,int,bool)", ves_icall_System_String_InternalCompareStr_N,
2739 "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
2740 "System.String::get_Chars", ves_icall_System_String_get_Chars,
2745 "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
2746 "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
2747 "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
2748 "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
2749 "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
2750 "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
2751 "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
2752 "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
2753 "System.AppDomain::Unload", ves_icall_System_AppDomain_Unload,
2754 "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
2757 * System.AppDomainSetup
2759 "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
2764 "System.Double::ToStringImpl", mono_double_ToStringImpl,
2765 "System.Double::ParseImpl", mono_double_ParseImpl,
2770 "System.Single::ToStringImpl", mono_float_ToStringImpl,
2775 "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
2776 "System.Decimal::decimal2Int64", mono_decimal2Int64,
2777 "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
2778 "System.Decimal::decimalIncr", mono_decimalIncr,
2779 "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
2780 "System.Decimal::decimal2double", mono_decimal2double,
2781 "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
2782 "System.Decimal::decimalRound", mono_decimalRound,
2783 "System.Decimal::decimalMult", mono_decimalMult,
2784 "System.Decimal::decimalDiv", mono_decimalDiv,
2785 "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
2786 "System.Decimal::decimalCompare", mono_decimalCompare,
2787 "System.Decimal::string2decimal", mono_string2decimal,
2788 "System.Decimal::decimal2string", mono_decimal2string,
2793 "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
2798 "System.Reflection.Emit.AssemblyBuilder::getDataChunk", ves_icall_AssemblyBuilder_getDataChunk,
2799 "System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
2800 "System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
2801 "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
2806 "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
2807 "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
2808 "System.Reflection.MonoFieldInfo::get_field_info", ves_icall_get_field_info,
2809 "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
2810 "System.Reflection.MonoEventInfo::get_event_info", ves_icall_get_event_info,
2811 "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
2812 "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
2813 "System.Reflection.MethodBase::GetCurrentMethod", ves_icall_GetCurrentMethod,
2814 "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
2815 "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
2816 "System.Reflection.MonoField::GetValueInternal", ves_icall_MonoField_GetValueInternal,
2817 "System.Reflection.MonoField::SetValueInternal", ves_icall_FieldInfo_SetValueInternal,
2818 "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
2819 "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
2821 "System.RuntimeMethodHandle::GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer,
2825 "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
2826 "System.Enum::get_value", ves_icall_System_Enum_get_value,
2827 "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
2832 "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
2833 "System.Reflection.Emit.TypeBuilder::create_internal_class", mono_reflection_create_internal_class,
2834 "System.Reflection.Emit.TypeBuilder::create_runtime_class", mono_reflection_create_runtime_class,
2843 "System.Type::internal_from_name", ves_icall_type_from_name,
2844 "System.Type::internal_from_handle", ves_icall_type_from_handle,
2845 "System.MonoType::get_attributes", ves_icall_get_attributes,
2846 "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
2847 "System.Type::Equals", ves_icall_type_Equals,
2848 "System.Type::GetTypeCode", ves_icall_type_GetTypeCode,
2851 * System.Runtime.CompilerServices.RuntimeHelpers
2853 "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray,
2854 "System.Runtime.CompilerServices.RuntimeHelpers::GetOffsetToStringData", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData,
2855 "System.Runtime.CompilerServices.RuntimeHelpers::GetObjectValue", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue,
2856 "System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor,
2861 "System.Threading.Thread::Abort(object)", ves_icall_System_Threading_Thread_Abort,
2862 "System.Threading.Thread::ResetAbort", ves_icall_System_Threading_Thread_ResetAbort,
2863 "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
2864 "System.Threading.Thread::Thread_free_internal", ves_icall_System_Threading_Thread_Thread_free_internal,
2865 "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
2866 "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
2867 "System.Threading.Thread::CurrentThread_internal", mono_thread_current,
2868 "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
2869 "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
2870 "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
2871 "System.Threading.Thread::GetDomainID", ves_icall_System_Threading_Thread_GetDomainID,
2872 "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
2873 "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
2874 "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
2875 "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
2876 "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
2877 "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
2878 "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
2879 "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
2880 "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
2881 "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
2882 "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
2883 "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
2886 * System.Threading.WaitHandle
2888 "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
2889 "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
2890 "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
2893 * System.Runtime.InteropServices.Marshal
2895 "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
2896 "System.Runtime.InteropServices.Marshal::ReadByte", ves_icall_System_Runtime_InteropServices_Marshal_ReadByte,
2897 "System.Runtime.InteropServices.Marshal::ReadInt16", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16,
2898 "System.Runtime.InteropServices.Marshal::ReadInt32", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32,
2899 "System.Runtime.InteropServices.Marshal::ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64,
2900 "System.Runtime.InteropServices.Marshal::WriteIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr,
2901 "System.Runtime.InteropServices.Marshal::WriteByte", ves_icall_System_Runtime_InteropServices_Marshal_WriteByte,
2902 "System.Runtime.InteropServices.Marshal::WriteInt16", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16,
2903 "System.Runtime.InteropServices.Marshal::WriteInt32", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32,
2904 "System.Runtime.InteropServices.Marshal::WriteInt64", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64,
2906 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
2907 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
2908 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
2909 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
2910 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni,
2911 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len,
2912 "System.Runtime.InteropServices.Marshal::PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR,
2914 "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
2915 "System.Runtime.InteropServices.Marshal::AllocHGlobal", mono_marshal_alloc,
2916 "System.Runtime.InteropServices.Marshal::FreeHGlobal", mono_marshal_free,
2917 "System.Runtime.InteropServices.Marshal::ReAllocHGlobal", mono_marshal_realloc,
2918 "System.Runtime.InteropServices.Marshal::copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged,
2919 "System.Runtime.InteropServices.Marshal::copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged,
2920 "System.Runtime.InteropServices.Marshal::SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf,
2921 "System.Runtime.InteropServices.Marshal::StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr,
2922 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure,
2923 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type,
2924 "System.Runtime.InteropServices.Marshal::OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf,
2925 "System.Runtime.InteropServices.Marshal::StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
2926 "System.Runtime.InteropServices.Marshal::StringToHGlobalAuto", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
2927 "System.Runtime.InteropServices.Marshal::StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni,
2928 "System.Runtime.InteropServices.Marshal::DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure,
2931 "System.Reflection.Assembly::LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom,
2932 "System.Reflection.Assembly::GetType", ves_icall_System_Reflection_Assembly_GetType,
2933 "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
2934 "System.Reflection.Assembly::FillName", ves_icall_System_Reflection_Assembly_FillName,
2935 "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
2936 "System.Reflection.Assembly::get_location", ves_icall_System_Reflection_Assembly_get_location,
2937 "System.Reflection.Assembly::GetExecutingAssembly", ves_icall_System_Reflection_Assembly_GetExecutingAssembly,
2938 "System.Reflection.Assembly::GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly,
2939 "System.Reflection.Assembly::GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly,
2940 "System.Reflection.Assembly::get_EntryPoint", ves_icall_System_Reflection_Assembly_get_EntryPoint,
2941 "System.Reflection.Assembly::GetManifestResourceNames", ves_icall_System_Reflection_Assembly_GetManifestResourceNames,
2942 "System.Reflection.Assembly::GetManifestResourceInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInternal,
2943 "System.Reflection.Assembly::GetFilesInternal", ves_icall_System_Reflection_Assembly_GetFilesInternal,
2944 "System.Reflection.Assembly::GetReferencedAssemblies", ves_icall_System_Reflection_Assembly_GetReferencedAssemblies,
2949 "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
2950 "System.MonoType::type_from_obj", mono_type_type_from_obj,
2951 "System.MonoType::GetElementType", ves_icall_MonoType_GetElementType,
2952 "System.MonoType::get_type_info", ves_icall_get_type_info,
2953 "System.MonoType::get_BaseType", ves_icall_get_type_parent,
2954 "System.MonoType::get_Module", ves_icall_MonoType_get_Module,
2955 "System.MonoType::IsPointerImpl", ves_icall_type_ispointer,
2956 "System.MonoType::IsByRefImpl", ves_icall_type_isbyref,
2957 "System.MonoType::GetField", ves_icall_Type_GetField,
2958 "System.MonoType::GetFields", ves_icall_Type_GetFields,
2959 "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
2960 "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
2961 "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
2962 "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
2963 "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
2964 "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
2967 * System.Net.Sockets I/O Services
2969 "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
2970 "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
2971 "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
2972 "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
2973 "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
2974 "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
2975 "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
2976 "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
2977 "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
2978 "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
2979 "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
2980 "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
2981 "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
2982 "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
2983 "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
2984 "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
2985 "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
2986 "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
2987 "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
2988 "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
2989 "System.Net.Dns::GetHostByName_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByName_internal,
2990 "System.Net.Dns::GetHostByAddr_internal(string,string&,string[]&,string[]&)", ves_icall_System_Net_Dns_GetHostByAddr_internal,
2991 "System.Net.Dns::GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal,
2996 "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
2997 "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
2998 "System.Char::IsControl", ves_icall_System_Char_IsControl,
2999 "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
3000 "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
3001 "System.Char::IsLower", ves_icall_System_Char_IsLower,
3002 "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
3003 "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
3004 "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
3005 "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
3006 "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
3007 "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
3008 "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
3009 "System.Char::ToLower", ves_icall_System_Char_ToLower,
3010 "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
3013 * System.Text.Encoding
3015 "System.Text.Encoding::InternalCodePage", ves_icall_System_Text_Encoding_InternalCodePage,
3017 "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
3018 "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
3023 "System.GC::InternalCollect", ves_icall_System_GC_InternalCollect,
3024 "System.GC::GetTotalMemory", ves_icall_System_GC_GetTotalMemory,
3025 "System.GC::KeepAlive", ves_icall_System_GC_KeepAlive,
3026 "System.GC::ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize,
3027 "System.GC::SuppressFinalize", ves_icall_System_GC_SuppressFinalize,
3028 "System.GC::WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers,
3029 "System.Runtime.InteropServices.GCHandle::GetTarget", ves_icall_System_GCHandle_GetTarget,
3030 "System.Runtime.InteropServices.GCHandle::GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle,
3031 "System.Runtime.InteropServices.GCHandle::FreeHandle", ves_icall_System_GCHandle_FreeHandle,
3032 "System.Runtime.InteropServices.GCHandle::GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject,
3035 * System.Security.Cryptography calls
3038 "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
3039 "System.Security.Cryptography.RNGCryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
3044 "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
3045 "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
3046 "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
3047 "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
3052 "System.IO.MonoIO::GetLastError", ves_icall_System_IO_MonoIO_GetLastError,
3053 "System.IO.MonoIO::CreateDirectory", ves_icall_System_IO_MonoIO_CreateDirectory,
3054 "System.IO.MonoIO::RemoveDirectory", ves_icall_System_IO_MonoIO_RemoveDirectory,
3055 "System.IO.MonoIO::FindFirstFile", ves_icall_System_IO_MonoIO_FindFirstFile,
3056 "System.IO.MonoIO::FindNextFile", ves_icall_System_IO_MonoIO_FindNextFile,
3057 "System.IO.MonoIO::FindClose", ves_icall_System_IO_MonoIO_FindClose,
3058 "System.IO.MonoIO::GetCurrentDirectory", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
3059 "System.IO.MonoIO::SetCurrentDirectory", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
3060 "System.IO.MonoIO::MoveFile", ves_icall_System_IO_MonoIO_MoveFile,
3061 "System.IO.MonoIO::CopyFile", ves_icall_System_IO_MonoIO_CopyFile,
3062 "System.IO.MonoIO::DeleteFile", ves_icall_System_IO_MonoIO_DeleteFile,
3063 "System.IO.MonoIO::GetFileAttributes", ves_icall_System_IO_MonoIO_GetFileAttributes,
3064 "System.IO.MonoIO::SetFileAttributes", ves_icall_System_IO_MonoIO_SetFileAttributes,
3065 "System.IO.MonoIO::GetFileType(intptr)", ves_icall_System_IO_MonoIO_GetFileType,
3066 "System.IO.MonoIO::GetFileStat", ves_icall_System_IO_MonoIO_GetFileStat,
3067 "System.IO.MonoIO::Open", ves_icall_System_IO_MonoIO_Open,
3068 "System.IO.MonoIO::Close", ves_icall_System_IO_MonoIO_Close,
3069 "System.IO.MonoIO::Read", ves_icall_System_IO_MonoIO_Read,
3070 "System.IO.MonoIO::Write", ves_icall_System_IO_MonoIO_Write,
3071 "System.IO.MonoIO::Seek", ves_icall_System_IO_MonoIO_Seek,
3072 "System.IO.MonoIO::GetLength", ves_icall_System_IO_MonoIO_GetLength,
3073 "System.IO.MonoIO::SetLength", ves_icall_System_IO_MonoIO_SetLength,
3074 "System.IO.MonoIO::SetFileTime", ves_icall_System_IO_MonoIO_SetFileTime,
3075 "System.IO.MonoIO::Flush", ves_icall_System_IO_MonoIO_Flush,
3076 "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
3077 "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
3078 "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
3079 "System.IO.MonoIO::CreatePipe(intptr&,intptr&)", ves_icall_System_IO_MonoIO_CreatePipe,
3080 "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
3081 "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
3082 "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
3083 "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
3084 "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
3089 "System.Math::Sin", ves_icall_System_Math_Sin,
3090 "System.Math::Cos", ves_icall_System_Math_Cos,
3091 "System.Math::Tan", ves_icall_System_Math_Tan,
3092 "System.Math::Sinh", ves_icall_System_Math_Sinh,
3093 "System.Math::Cosh", ves_icall_System_Math_Cosh,
3094 "System.Math::Tanh", ves_icall_System_Math_Tanh,
3095 "System.Math::Acos", ves_icall_System_Math_Acos,
3096 "System.Math::Asin", ves_icall_System_Math_Asin,
3097 "System.Math::Atan", ves_icall_System_Math_Atan,
3098 "System.Math::Atan2", ves_icall_System_Math_Atan2,
3099 "System.Math::Exp", ves_icall_System_Math_Exp,
3100 "System.Math::Log", ves_icall_System_Math_Log,
3101 "System.Math::Log10", ves_icall_System_Math_Log10,
3102 "System.Math::PowImpl", ves_icall_System_Math_Pow,
3103 "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
3106 * System.Environment
3108 "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
3109 "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
3110 "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
3111 "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
3112 "System.Environment::GetCommandLineArgs", mono_runtime_get_main_args,
3113 "System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
3114 "System.Environment::Exit", ves_icall_System_Environment_Exit,
3115 "System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
3118 * System.Runtime.Remoting
3120 "System.Runtime.Remoting.RemotingServices::InternalExecute",
3121 ves_icall_InternalExecute,
3122 "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
3123 ves_icall_IsTransparentProxy,
3126 * System.Runtime.Remoting.Messaging
3128 "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
3129 ves_icall_MonoMethodMessage_InitMessage,
3132 * System.Runtime.Remoting.Proxies
3134 "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy",
3135 ves_icall_Remoting_RealProxy_GetTransparentProxy,
3138 * System.Threading.Interlocked
3140 "System.Threading.Interlocked::Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int,
3141 "System.Threading.Interlocked::Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long,
3142 "System.Threading.Interlocked::Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int,
3143 "System.Threading.Interlocked::Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long,
3144 "System.Threading.Interlocked::CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int,
3145 "System.Threading.Interlocked::CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object,
3146 "System.Threading.Interlocked::CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single,
3147 "System.Threading.Interlocked::Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int,
3148 "System.Threading.Interlocked::Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object,
3149 "System.Threading.Interlocked::Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single,
3152 * System.Diagnostics.Process
3154 "System.Diagnostics.Process::GetProcess_internal(int)", ves_icall_System_Diagnostics_Process_GetProcess_internal,
3155 "System.Diagnostics.Process::GetProcesses_internal()", ves_icall_System_Diagnostics_Process_GetProcesses_internal,
3156 "System.Diagnostics.Process::GetPid_internal()", ves_icall_System_Diagnostics_Process_GetPid_internal,
3157 "System.Diagnostics.Process::Process_free_internal(intptr)", ves_icall_System_Diagnostics_Process_Process_free_internal,
3158 "System.Diagnostics.Process::GetModules_internal()", ves_icall_System_Diagnostics_Process_GetModules_internal,
3159 "System.Diagnostics.Process::Start_internal(string,string,intptr,intptr,intptr,ProcInfo&)", ves_icall_System_Diagnostics_Process_Start_internal,
3160 "System.Diagnostics.Process::WaitForExit_internal(intptr,int)", ves_icall_System_Diagnostics_Process_WaitForExit_internal,
3161 "System.Diagnostics.Process::ExitTime_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitTime_internal,
3162 "System.Diagnostics.Process::StartTime_internal(intptr)", ves_icall_System_Diagnostics_Process_StartTime_internal,
3163 "System.Diagnostics.Process::ExitCode_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitCode_internal,
3164 "System.Diagnostics.Process::ProcessName_internal(intptr)", ves_icall_System_Diagnostics_Process_ProcessName_internal,
3165 "System.Diagnostics.Process::GetWorkingSet_internal(intptr,int&,int&)", ves_icall_System_Diagnostics_Process_GetWorkingSet_internal,
3166 "System.Diagnostics.Process::SetWorkingSet_internal(intptr,int,int,bool)", ves_icall_System_Diagnostics_Process_SetWorkingSet_internal,
3167 "System.Diagnostics.FileVersionInfo::GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal,
3172 "System.Delegate::CreateDelegate_internal", ves_icall_System_Delegate_CreateDelegate_internal,
3175 * System.Runtime.Serialization
3177 "System.Runtime.Serialization.FormatterServices::GetUninitializedObjectInternal",
3178 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal,
3183 "System.IO.Path::get_temp_path", ves_icall_System_IO_get_temp_path,
3186 * Private icalls for the Mono Debugger
3188 "System.Reflection.Assembly::MonoDebugger_GetMethod",
3189 ves_icall_MonoDebugger_GetMethod,
3191 "System.Reflection.Assembly::MonoDebugger_GetLocalTypeFromSignature",
3192 ves_icall_MonoDebugger_GetLocalTypeFromSignature,
3194 "System.Reflection.Assembly::MonoDebugger_GetType",
3195 ves_icall_MonoDebugger_GetType,
3198 * System.Configuration
3200 "System.Configuration.DefaultConfig::get_machine_config_path",
3201 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
3204 * add other internal calls here
3210 mono_init_icall (void)
3215 while ((name = icall_map [i])) {
3216 mono_add_internal_call (name, icall_map [i+1]);