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/process.h>
40 #include <mono/io-layer/io-layer.h>
41 #include <mono/utils/strtod.h>
43 #if defined (PLATFORM_WIN32)
49 mono_double_ToStringImpl (double value)
51 /* FIXME: Handle formats, etc. */
54 retVal = g_strdup_printf ("%.15g", value);
55 s = mono_string_new (mono_domain_get (), retVal);
61 * We expect a pointer to a char, not a string
64 mono_double_ParseImpl (char *ptr)
66 return bsd_strtod (ptr, NULL);
70 mono_float_ToStringImpl (float value)
72 return mono_double_ToStringImpl (value);
76 ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
83 ao = (MonoArray *)this;
84 ac = (MonoClass *)ao->obj.vtable->klass;
86 esize = mono_array_element_size (ac);
87 ea = (gpointer*)((char*)ao->vector + (pos * esize));
89 if (ac->element_class->valuetype)
90 return mono_value_box (this->vtable->domain, ac->element_class, ea);
96 ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
102 MONO_CHECK_ARG_NULL (idxs);
104 io = (MonoArray *)idxs;
105 ic = (MonoClass *)io->obj.vtable->klass;
107 ao = (MonoArray *)this;
108 ac = (MonoClass *)ao->obj.vtable->klass;
110 g_assert (ic->rank == 1);
111 if (io->bounds != NULL || io->max_length != ac->rank)
112 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
114 ind = (guint32 *)io->vector;
116 if (ao->bounds == NULL) {
117 if (*ind < 0 || *ind >= ao->max_length)
118 mono_raise_exception (mono_get_exception_index_out_of_range ());
120 return ves_icall_System_Array_GetValueImpl (this, *ind);
123 for (i = 0; i < ac->rank; i++)
124 if ((ind [i] < ao->bounds [i].lower_bound) ||
125 (ind [i] >= ao->bounds [i].length + ao->bounds [i].lower_bound))
126 mono_raise_exception (mono_get_exception_index_out_of_range ());
128 pos = ind [0] - ao->bounds [0].lower_bound;
129 for (i = 1; i < ac->rank; i++)
130 pos = pos*ao->bounds [i].length + ind [i] -
131 ao->bounds [i].lower_bound;
133 return ves_icall_System_Array_GetValueImpl (this, pos);
137 ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
139 MonoClass *ac, *vc, *ec;
148 vc = value->vtable->klass;
152 ac = this->obj.vtable->klass;
153 ec = ac->element_class;
155 esize = mono_array_element_size (ac);
156 ea = (gpointer*)((char*)this->vector + (pos * esize));
157 va = (gpointer*)((char*)value + sizeof (MonoObject));
160 memset (ea, 0, esize);
164 #define NO_WIDENING_CONVERSION G_STMT_START{\
165 mono_raise_exception (mono_get_exception_argument ( \
166 "value", "not a widening conversion")); \
169 #define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
170 if (esize < vsize + (extra)) \
171 mono_raise_exception (mono_get_exception_argument ( \
172 "value", "not a widening conversion")); \
175 #define INVALID_CAST G_STMT_START{\
176 mono_raise_exception (mono_get_exception_invalid_cast ()); \
179 /* Check element (destination) type. */
180 switch (ec->byval_arg.type) {
181 case MONO_TYPE_STRING:
182 switch (vc->byval_arg.type) {
183 case MONO_TYPE_STRING:
189 case MONO_TYPE_BOOLEAN:
190 switch (vc->byval_arg.type) {
191 case MONO_TYPE_BOOLEAN:
204 NO_WIDENING_CONVERSION;
211 if (!ec->valuetype) {
212 *ea = (gpointer)value;
216 if (mono_object_isinst (value, ec)) {
217 memcpy (ea, (char *)value + sizeof (MonoObject), esize);
224 vsize = mono_class_instance_size (vc) - sizeof (MonoObject);
227 g_message (G_STRLOC ": %d (%d) <= %d (%d)",
228 ec->byval_arg.type, esize,
229 vc->byval_arg.type, vsize);
232 #define ASSIGN_UNSIGNED(etype) G_STMT_START{\
233 switch (vc->byval_arg.type) { \
238 case MONO_TYPE_CHAR: \
239 CHECK_WIDENING_CONVERSION(0); \
240 *(etype *) ea = (etype) u64; \
242 /* You can't assign a signed value to an unsigned array. */ \
247 /* You can't assign a floating point number to an integer array. */ \
250 NO_WIDENING_CONVERSION; \
254 #define ASSIGN_SIGNED(etype) G_STMT_START{\
255 switch (vc->byval_arg.type) { \
260 CHECK_WIDENING_CONVERSION(0); \
261 *(etype *) ea = (etype) i64; \
263 /* You can assign an unsigned value to a signed array if the array's */ \
264 /* element size is larger than the value size. */ \
269 case MONO_TYPE_CHAR: \
270 CHECK_WIDENING_CONVERSION(1); \
271 *(etype *) ea = (etype) u64; \
273 /* You can't assign a floating point number to an integer array. */ \
276 NO_WIDENING_CONVERSION; \
280 #define ASSIGN_REAL(etype) G_STMT_START{\
281 switch (vc->byval_arg.type) { \
284 CHECK_WIDENING_CONVERSION(0); \
285 *(etype *) ea = (etype) r64; \
287 /* All integer values fit into a floating point array, so we don't */ \
288 /* need to CHECK_WIDENING_CONVERSION here. */ \
293 *(etype *) ea = (etype) i64; \
299 case MONO_TYPE_CHAR: \
300 *(etype *) ea = (etype) u64; \
305 switch (vc->byval_arg.type) {
307 u64 = *(guint8 *) va;
310 u64 = *(guint16 *) va;
313 u64 = *(guint32 *) va;
316 u64 = *(guint64 *) va;
322 i64 = *(gint16 *) va;
325 i64 = *(gint32 *) va;
328 i64 = *(gint64 *) va;
331 r64 = *(gfloat *) va;
334 r64 = *(gdouble *) va;
337 u64 = *(guint16 *) va;
339 case MONO_TYPE_BOOLEAN:
340 /* Boolean is only compatible with itself. */
341 switch (ec->byval_arg.type) {
353 NO_WIDENING_CONVERSION;
360 /* If we can't do a direct copy, let's try a widening conversion. */
361 switch (ec->byval_arg.type) {
363 ASSIGN_UNSIGNED (guint16);
365 ASSIGN_UNSIGNED (guint8);
367 ASSIGN_UNSIGNED (guint16);
369 ASSIGN_UNSIGNED (guint32);
371 ASSIGN_UNSIGNED (guint64);
373 ASSIGN_SIGNED (gint8);
375 ASSIGN_SIGNED (gint16);
377 ASSIGN_SIGNED (gint32);
379 ASSIGN_SIGNED (gint64);
381 ASSIGN_REAL (gfloat);
383 ASSIGN_REAL (gdouble);
387 /* Not reached, INVALID_CAST does not return. Just to avoid a compiler warning ... */
391 #undef NO_WIDENING_CONVERSION
392 #undef CHECK_WIDENING_CONVERSION
393 #undef ASSIGN_UNSIGNED
399 ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
405 MONO_CHECK_ARG_NULL (idxs);
407 ic = idxs->obj.vtable->klass;
408 ac = this->obj.vtable->klass;
410 g_assert (ic->rank == 1);
411 if (idxs->bounds != NULL || idxs->max_length != ac->rank)
412 mono_raise_exception (mono_get_exception_argument (NULL, NULL));
414 ind = (guint32 *)idxs->vector;
416 if (this->bounds == NULL) {
417 if (*ind < 0 || *ind >= this->max_length)
418 mono_raise_exception (mono_get_exception_index_out_of_range ());
420 ves_icall_System_Array_SetValueImpl (this, value, *ind);
424 for (i = 0; i < ac->rank; i++)
425 if ((ind [i] < this->bounds [i].lower_bound) ||
426 (ind [i] >= this->bounds [i].length + this->bounds [i].lower_bound))
427 mono_raise_exception (mono_get_exception_index_out_of_range ());
429 pos = ind [0] - this->bounds [0].lower_bound;
430 for (i = 1; i < ac->rank; i++)
431 pos = pos * this->bounds [i].length + ind [i] -
432 this->bounds [i].lower_bound;
434 ves_icall_System_Array_SetValueImpl (this, value, pos);
438 ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
444 MONO_CHECK_ARG_NULL (type);
445 MONO_CHECK_ARG_NULL (lengths);
447 MONO_CHECK_ARG (lengths, mono_array_length (lengths) > 0);
449 MONO_CHECK_ARG (bounds, mono_array_length (lengths) == mono_array_length (bounds));
451 for (i = 0; i < mono_array_length (lengths); i++)
452 if (mono_array_get (lengths, gint32, i) < 0)
453 mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
455 aklass = mono_array_class_get (type->type, mono_array_length (lengths));
457 sizes = alloca (aklass->rank * sizeof(guint32) * 2);
458 for (i = 0; i < aklass->rank; ++i) {
459 sizes [i] = mono_array_get (lengths, gint32, i);
461 sizes [i + aklass->rank] = mono_array_get (bounds, gint32, i);
463 sizes [i + aklass->rank] = 0;
466 array = mono_array_new_full (mono_domain_get (), aklass, sizes, sizes + aklass->rank);
472 ves_icall_System_Array_GetRank (MonoObject *this)
474 return this->vtable->klass->rank;
478 ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
480 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
481 if ((dimension < 0) || (dimension >= rank))
482 mono_raise_exception (mono_get_exception_index_out_of_range ());
484 if (this->bounds == NULL)
485 return this->max_length;
487 return this->bounds [dimension].length;
491 ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
493 gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
494 if ((dimension < 0) || (dimension >= rank))
495 mono_raise_exception (mono_get_exception_index_out_of_range ());
497 if (this->bounds == NULL)
500 return this->bounds [dimension].lower_bound;
504 ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
506 int element_size = mono_array_element_size (source->obj.vtable->klass);
507 void * dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
508 void * source_addr = mono_array_addr_with_size (source, element_size, source_idx);
510 g_assert (dest_idx + length <= mono_array_length (dest));
511 g_assert (source_idx + length <= mono_array_length (source));
512 memmove (dest_addr, source_addr, element_size * length);
516 ves_icall_InitializeArray (MonoArray *array, MonoClassField *field_handle)
518 MonoClass *klass = array->obj.vtable->klass;
519 guint32 size = mono_array_element_size (klass);
522 if (array->bounds == NULL)
523 size *= array->max_length;
525 for (i = 0; i < klass->rank; ++i)
526 size *= array->bounds [i].length;
528 memcpy (mono_array_addr (array, char, 0), field_handle->data, size);
530 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
534 guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
536 for (i = 0; i < size; i += n/8, data++) { \
537 tmp = read ## n (data); \
542 /* printf ("Initialize array with elements of %s type\n", klass->element_class->name); */
544 switch (klass->element_class->byval_arg.type) {
564 ves_icall_System_Object_MemberwiseClone (MonoObject *this)
566 return mono_object_clone (this);
570 #define MONO_OBJECT_ALIGNMENT_SHIFT 3
572 #define MONO_OBJECT_ALIGNMENT_SHIFT 2
576 * Return hashcode based on object address. This function will need to be
577 * smarter in the presence of a moving garbage collector, which will cache
578 * the address hash before relocating the object.
580 * Wang's address-based hash function:
581 * http://www.concentric.net/~Ttwang/tech/addrhash.htm
584 ves_icall_System_Object_GetHashCode (MonoObject *this)
586 register guint32 key;
587 key = (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
589 return key & 0x7fffffff;
593 * A hash function for value types. I have no idea if this is a good hash
594 * function (its similar to g_str_hash).
597 ves_icall_System_ValueType_GetHashCode (MonoObject *this)
603 MONO_CHECK_ARG_NULL (this);
605 size = this->vtable->klass->instance_size - sizeof (MonoObject);
607 p = (const char *)this + sizeof (MonoObject);
609 for (i = 0; i < size; i++) {
610 h = (h << 5) - h + *p;
618 ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that)
623 MONO_CHECK_ARG_NULL (that);
625 if (this->vtable != that->vtable)
628 size = this->vtable->klass->instance_size - sizeof (MonoObject);
630 p = (const char *)this + sizeof (MonoObject);
631 s = (const char *)that + sizeof (MonoObject);
633 return memcmp (p, s, size)? FALSE: TRUE;
636 static MonoReflectionType *
637 ves_icall_System_Object_GetType (MonoObject *obj)
639 return mono_type_get_object (mono_domain_get (), &obj->vtable->klass->byval_arg);
643 mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
645 mtype->type = &obj->vtable->klass->byval_arg;
646 g_assert (mtype->type->type);
650 ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObject *obj)
652 return mono_image_create_token (assb->dynamic_assembly, obj);
656 ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, MonoArray *buf, gint32 offset)
659 MonoDynamicAssembly *ass = assb->dynamic_assembly;
660 char *p = mono_array_addr (buf, char, 0);
662 mono_image_create_pefile (assb);
664 if (offset >= ass->pefile.index)
666 count = mono_array_length (buf);
667 count = MIN (count, ass->pefile.index - offset);
669 memcpy (p, ass->pefile.data + offset, count);
675 get_get_type_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data) {
676 MonoImage **dest = data;
678 /* skip icalls and Type::GetType () */
679 if (!m || m->wrapper_type || (m->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
680 (strcmp (m->name, "GetType") == 0 && m->klass == mono_defaults.monotype_class->parent))
682 *dest = m->klass->image;
686 static MonoReflectionType*
687 ves_icall_type_from_name (MonoString *name)
689 MonoImage *image = NULL;
693 mono_stack_walk (get_get_type_caller, &image);
694 str = mono_string_to_utf8 (name);
695 /*g_print ("requested type %s\n", str);*/
696 type = mono_reflection_type_from_name (str, image);
700 /*g_print ("got it\n");*/
701 return mono_type_get_object (mono_object_domain (name), type);
704 static MonoReflectionType*
705 ves_icall_type_from_handle (MonoType *handle)
707 MonoDomain *domain = mono_domain_get ();
708 MonoClass *klass = mono_class_from_mono_type (handle);
710 mono_class_init (klass);
711 return mono_type_get_object (domain, handle);
715 ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
717 if (type->type && c->type)
718 return mono_metadata_type_equal (type->type, c->type);
719 g_print ("type equals\n");
723 /* System.TypeCode */
746 ves_icall_type_GetTypeCode (MonoReflectionType *type)
748 int t = type->type->type;
752 return TYPECODE_OBJECT;
753 case MONO_TYPE_BOOLEAN:
754 return TYPECODE_BOOLEAN;
756 return TYPECODE_BYTE;
758 return TYPECODE_SBYTE;
760 return TYPECODE_UINT16;
762 return TYPECODE_INT16;
764 return TYPECODE_CHAR;
768 return TYPECODE_OBJECT;
770 return TYPECODE_UINT32;
772 return TYPECODE_INT32;
774 return TYPECODE_UINT64;
776 return TYPECODE_INT64;
778 return TYPECODE_SINGLE;
780 return TYPECODE_DOUBLE;
781 case MONO_TYPE_VALUETYPE:
782 if (type->type->data.klass->enumtype) {
783 t = type->type->data.klass->enum_basetype->type;
786 MonoClass *k = type->type->data.klass;
787 if (strcmp (k->name_space, "System") == 0) {
788 if (strcmp (k->name, "Decimal") == 0)
789 return TYPECODE_DECIMAL;
790 else if (strcmp (k->name, "DateTime") == 0)
791 return TYPECODE_DATETIME;
792 else if (strcmp (k->name, "DBNull") == 0)
793 return TYPECODE_DBNULL;
796 /* handle datetime, dbnull.. */
797 return TYPECODE_OBJECT;
798 case MONO_TYPE_STRING:
799 return TYPECODE_STRING;
800 case MONO_TYPE_SZARRAY:
801 case MONO_TYPE_ARRAY:
802 case MONO_TYPE_OBJECT:
803 return TYPECODE_OBJECT;
804 case MONO_TYPE_CLASS:
805 return TYPECODE_OBJECT;
807 g_error ("type 0x%02x not handled in GetTypeCode()", t);
813 ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
819 g_assert (type != NULL);
821 domain = ((MonoObject *)type)->vtable->domain;
823 if (!c) /* FIXME: dont know what do do here */
826 klass = mono_class_from_mono_type (type->type);
827 klassc = mono_class_from_mono_type (c->type);
829 /* cut&paste from mono_object_isinst (): keep in sync */
830 if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && !(klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
831 MonoVTable *klass_vt = mono_class_vtable (domain, klass);
832 if ((klassc->interface_id <= klass->max_interface_id) &&
833 klass_vt->interface_offsets [klassc->interface_id])
835 } else if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && (klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
838 for (i = 0; i < klass->interface_count; i ++) {
839 MonoClass *ic = klass->interfaces [i];
845 * klass->baseval is 0 for interfaces
847 if (klass->baseval && ((klass->baseval - klassc->baseval) <= klassc->diffval))
854 ves_icall_get_attributes (MonoReflectionType *type)
856 MonoClass *klass = mono_class_from_mono_type (type->type);
862 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
864 MonoDomain *domain = mono_domain_get ();
866 info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
867 info->ret = mono_type_get_object (domain, method->signature->ret);
868 info->attrs = method->flags;
869 info->implattrs = method->iflags;
873 ves_icall_get_parameter_info (MonoMethod *method)
875 MonoDomain *domain = mono_domain_get ();
877 static MonoClass *System_Reflection_ParameterInfo;
878 MonoReflectionParameter** args;
881 args = mono_param_get_objects (domain, method);
882 if (!System_Reflection_ParameterInfo)
883 System_Reflection_ParameterInfo = mono_class_from_name (
884 mono_defaults.corlib, "System.Reflection", "ParameterInfo");
885 res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count);
886 for (i = 0; i < method->signature->param_count; ++i) {
887 mono_array_set (res, gpointer, i, args [i]);
893 ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
895 MonoDomain *domain = mono_domain_get ();
897 info->parent = mono_type_get_object (domain, &field->klass->byval_arg);
898 info->type = mono_type_get_object (domain, field->field->type);
899 info->name = mono_string_new (domain, field->field->name);
900 info->attrs = field->field->type->attrs;
904 ves_icall_MonoField_GetValueInternal (MonoReflectionField *field, MonoObject *obj)
907 MonoClassField *cf = field->field;
910 MonoDomain *domain = mono_domain_get ();
912 gboolean is_static = FALSE;
913 gboolean is_ref = FALSE;
915 mono_class_init (field->klass);
917 switch (cf->type->type) {
918 case MONO_TYPE_STRING:
919 case MONO_TYPE_OBJECT:
920 case MONO_TYPE_CLASS:
921 case MONO_TYPE_ARRAY:
922 case MONO_TYPE_SZARRAY:
927 case MONO_TYPE_BOOLEAN:
939 case MONO_TYPE_VALUETYPE:
940 is_ref = cf->type->byref;
943 g_error ("type 0x%x not handled in "
944 "ves_icall_Monofield_GetValue", cf->type->type);
948 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
950 vtable = mono_class_vtable (domain, field->klass);
955 mono_field_static_get_value (vtable, cf, &o);
957 mono_field_get_value (obj, cf, &o);
962 /* boxed value type */
963 klass = mono_class_from_mono_type (cf->type);
964 o = mono_object_new (domain, klass);
965 v = ((gchar *) o) + sizeof (MonoObject);
967 mono_field_static_get_value (vtable, cf, v);
969 mono_field_get_value (obj, cf, v);
976 ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *obj, MonoObject *value)
978 MonoClassField *cf = field->field;
982 if (!cf->type->byref) {
983 switch (cf->type->type) {
986 case MONO_TYPE_BOOLEAN:
998 case MONO_TYPE_VALUETYPE:
999 v += sizeof (MonoObject);
1001 case MONO_TYPE_STRING:
1002 case MONO_TYPE_OBJECT:
1003 case MONO_TYPE_CLASS:
1004 case MONO_TYPE_ARRAY:
1005 case MONO_TYPE_SZARRAY:
1009 g_error ("type 0x%x not handled in "
1010 "ves_icall_FieldInfo_SetValueInternal", cf->type->type);
1015 if (cf->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1016 MonoVTable *vtable = mono_class_vtable (mono_domain_get (), field->klass);
1017 mono_field_static_set_value (vtable, cf, v);
1019 mono_field_set_value (obj, cf, v);
1024 ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
1026 MonoDomain *domain = mono_domain_get ();
1028 info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
1029 info->name = mono_string_new (domain, property->property->name);
1030 info->attrs = property->property->attrs;
1031 info->get = property->property->get ? mono_method_get_object (domain, property->property->get, NULL): NULL;
1032 info->set = property->property->set ? mono_method_get_object (domain, property->property->set, NULL): NULL;
1034 * There may be other methods defined for properties, though, it seems they are not exposed
1035 * in the reflection API
1040 ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
1042 MonoDomain *domain = mono_domain_get ();
1044 info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
1045 info->name = mono_string_new (domain, event->event->name);
1046 info->attrs = event->event->attrs;
1047 info->add_method = event->event->add ? mono_method_get_object (domain, event->event->add, NULL): NULL;
1048 info->remove_method = event->event->remove ? mono_method_get_object (domain, event->event->remove, NULL): NULL;
1049 info->raise_method = event->event->raise ? mono_method_get_object (domain, event->event->raise, NULL): NULL;
1053 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
1055 MonoDomain *domain = mono_domain_get ();
1058 MonoClass *class = mono_class_from_mono_type (type->type);
1062 for (parent = class; parent; parent = parent->parent) {
1063 ninterf += parent->interface_count;
1065 intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
1067 for (parent = class; parent; parent = parent->parent) {
1068 for (i = 0; i < parent->interface_count; ++i) {
1069 mono_array_set (intf, gpointer, ninterf, mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
1076 static MonoReflectionType*
1077 ves_icall_MonoType_GetElementType (MonoReflectionType *type)
1079 MonoClass *class = mono_class_from_mono_type (type->type);
1080 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1081 return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
1082 else if (class->element_class)
1083 return mono_type_get_object (mono_object_domain (type), &class->element_class->byval_arg);
1088 static MonoReflectionType*
1089 ves_icall_get_type_parent (MonoReflectionType *type)
1091 MonoClass *class = mono_class_from_mono_type (type->type);
1092 return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
1096 ves_icall_type_ispointer (MonoReflectionType *type)
1098 return type->type->type == MONO_TYPE_PTR;
1102 ves_icall_type_isbyref (MonoReflectionType *type)
1104 return type->type->byref;
1108 ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
1110 MonoDomain *domain = mono_domain_get ();
1111 MonoClass *class = mono_class_from_mono_type (type);
1113 info->nested_in = class->nested_in ? mono_type_get_object (domain, &class->nested_in->byval_arg): NULL;
1114 info->name = mono_string_new (domain, class->name);
1115 info->name_space = mono_string_new (domain, class->name_space);
1116 info->rank = class->rank;
1117 info->assembly = mono_assembly_get_object (domain, class->image->assembly);
1118 if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
1119 info->etype = mono_type_get_object (domain, class->enum_basetype);
1120 else if (class->element_class)
1121 info->etype = mono_type_get_object (domain, &class->element_class->byval_arg);
1125 info->isprimitive = (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8);
1129 ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
1131 return mono_runtime_invoke_array (method->method, this, params, NULL);
1135 ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
1137 MonoDomain *domain = mono_domain_get ();
1138 MonoMethod *m = method->method;
1139 MonoMethodSignature *sig = m->signature;
1140 MonoArray *out_args;
1142 int i, j, outarg_count = 0;
1144 if (m->klass == mono_defaults.object_class) {
1146 if (!strcmp (m->name, "FieldGetter")) {
1147 MonoClass *k = this->vtable->klass;
1148 MonoString *name = mono_array_get (params, MonoString *, 1);
1151 str = mono_string_to_utf8 (name);
1153 for (i = 0; i < k->field.count; i++) {
1154 if (!strcmp (k->fields [i].name, str)) {
1155 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1156 if (field_klass->valuetype)
1157 result = mono_value_box (domain, field_klass,
1158 (char *)this + k->fields [i].offset);
1160 result = *((gpointer *)((char *)this + k->fields [i].offset));
1163 out_args = mono_array_new (domain, mono_defaults.object_class, 1);
1164 *outArgs = out_args;
1165 mono_array_set (out_args, gpointer, 0, result);
1172 g_assert_not_reached ();
1174 } else if (!strcmp (m->name, "FieldSetter")) {
1175 MonoClass *k = this->vtable->klass;
1176 MonoString *name = mono_array_get (params, MonoString *, 1);
1180 str = mono_string_to_utf8 (name);
1182 for (i = 0; i < k->field.count; i++) {
1183 if (!strcmp (k->fields [i].name, str)) {
1184 MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
1185 MonoObject *val = mono_array_get (params, gpointer, 2);
1187 if (field_klass->valuetype) {
1188 size = mono_type_size (k->fields [i].type, &align);
1189 memcpy ((char *)this + k->fields [i].offset,
1190 ((char *)val) + sizeof (MonoObject), size);
1192 *((gpointer *)this + k->fields [i].offset) = val;
1201 g_assert_not_reached ();
1206 for (i = 0; i < mono_array_length (params); i++) {
1207 if (sig->params [i]->byref)
1211 out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
1213 for (i = 0, j = 0; i < mono_array_length (params); i++) {
1214 if (sig->params [i]->byref) {
1216 arg = mono_array_get (params, gpointer, i);
1217 mono_array_set (out_args, gpointer, j, arg);
1222 /* fixme: handle constructors? */
1223 if (!strcmp (method->method->name, ".ctor"))
1224 g_assert_not_reached ();
1226 result = mono_runtime_invoke_array (method->method, this, params, NULL);
1228 *outArgs = out_args;
1234 ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
1236 MonoDomain *domain = mono_domain_get ();
1237 MonoClass *enumc, *objc;
1241 MONO_CHECK_ARG_NULL (type);
1242 MONO_CHECK_ARG_NULL (obj);
1244 enumc = mono_class_from_mono_type (type->type);
1245 objc = obj->vtable->klass;
1247 MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
1248 MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
1249 objc->byval_arg.type <= MONO_TYPE_U8));
1251 s1 = mono_class_value_size (enumc, NULL);
1252 s2 = mono_class_value_size (objc, NULL);
1254 res = mono_object_new (domain, enumc);
1256 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
1257 memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
1259 memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
1260 (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
1267 ves_icall_System_Enum_get_value (MonoObject *this)
1269 MonoDomain *domain = mono_domain_get ();
1279 g_assert (this->vtable->klass->enumtype);
1281 enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
1282 res = mono_object_new (domain, enumc);
1283 dst = (char *)res + sizeof (MonoObject);
1284 src = (char *)this + sizeof (MonoObject);
1285 size = mono_class_value_size (enumc, NULL);
1287 memcpy (dst, src, size);
1293 ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
1295 MonoDomain *domain = mono_domain_get ();
1296 MonoClass *enumc = mono_class_from_mono_type (type->type);
1297 guint i, j, nvalues, crow;
1298 MonoClassField *field;
1300 info->utype = mono_type_get_object (domain, enumc->enum_basetype);
1301 nvalues = enumc->field.count - 1;
1302 info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
1303 info->values = mono_array_new (domain, enumc, nvalues);
1305 for (i = 0, j = 0; i < enumc->field.count; ++i) {
1306 field = &enumc->fields [i];
1307 if (strcmp ("value__", field->name) == 0)
1309 mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
1311 crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1));
1312 crow = mono_metadata_decode_row_col (&enumc->image->tables [MONO_TABLE_CONSTANT], crow-1, MONO_CONSTANT_VALUE);
1313 /* 1 is the length of the blob */
1314 field->data = 1 + mono_metadata_blob_heap (enumc->image, crow);
1316 switch (enumc->enum_basetype->type) {
1319 mono_array_set (info->values, gchar, j, *field->data);
1321 case MONO_TYPE_CHAR:
1324 mono_array_set (info->values, gint16, j, read16 (field->data));
1328 mono_array_set (info->values, gint32, j, read32 (field->data));
1332 mono_array_set (info->values, gint64, j, read64 (field->data));
1335 g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
1341 static MonoProperty*
1342 search_property (MonoClass *klass, char* name, MonoArray *args) {
1346 /* FIXME: handle args */
1347 for (i = 0; i < klass->property.count; ++i) {
1348 p = &klass->properties [i];
1349 if (strcmp (p->name, name) == 0)
1355 static MonoReflectionProperty*
1356 ves_icall_get_property (MonoReflectionType *type, MonoString *name, MonoArray *args)
1358 MonoDomain *domain = mono_domain_get ();
1360 MonoClass *class = mono_class_from_mono_type (type->type);
1361 char *n = mono_string_to_utf8 (name);
1363 p = search_property (class, n, args);
1366 return mono_property_get_object (domain, class, p);
1371 BFLAGS_IgnoreCase = 1,
1372 BFLAGS_DeclaredOnly = 2,
1373 BFLAGS_Instance = 4,
1375 BFLAGS_Public = 0x10,
1376 BFLAGS_NonPublic = 0x20,
1377 BFLAGS_InvokeMethod = 0x100,
1378 BFLAGS_CreateInstance = 0x200,
1379 BFLAGS_GetField = 0x400,
1380 BFLAGS_SetField = 0x800,
1381 BFLAGS_GetProperty = 0x1000,
1382 BFLAGS_SetProperty = 0x2000,
1383 BFLAGS_ExactBinding = 0x10000,
1384 BFLAGS_SuppressChangeType = 0x20000,
1385 BFLAGS_OptionalParamBinding = 0x40000
1388 static MonoFieldInfo *
1389 ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
1392 MonoClass *startklass, *klass;
1394 MonoClassField *field;
1396 domain = ((MonoObject *)type)->vtable->domain;
1397 klass = startklass = mono_class_from_mono_type (type->type);
1403 for (i = 0; i < klass->field.count; ++i) {
1405 field = &klass->fields [i];
1406 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1407 if (bflags & BFLAGS_Public)
1410 if (bflags & BFLAGS_NonPublic)
1416 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1417 if (bflags & BFLAGS_Static)
1420 if (bflags & BFLAGS_Instance)
1427 utf8_name = mono_string_to_utf8 (name);
1429 if (strcmp (field->name, utf8_name)) {
1435 return (MonoFieldInfo *)mono_field_get_object (domain, klass, field);
1437 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1444 ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
1447 GSList *l = NULL, *tmp;
1448 MonoClass *startklass, *klass;
1452 MonoClassField *field;
1454 domain = ((MonoObject *)type)->vtable->domain;
1455 klass = startklass = mono_class_from_mono_type (type->type);
1458 for (i = 0; i < klass->field.count; ++i) {
1460 field = &klass->fields [i];
1461 if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
1462 if (bflags & BFLAGS_Public)
1465 if (bflags & BFLAGS_NonPublic)
1471 if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
1472 if (bflags & BFLAGS_Static)
1475 if (bflags & BFLAGS_Instance)
1481 member = (MonoObject*)mono_field_get_object (domain, klass, field);
1482 l = g_slist_prepend (l, member);
1484 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1486 len = g_slist_length (l);
1487 res = mono_array_new (domain, mono_defaults.field_info_class, len);
1489 tmp = g_slist_reverse (l);
1490 for (; tmp; tmp = tmp->next, ++i)
1491 mono_array_set (res, gpointer, i, tmp->data);
1497 ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
1500 GSList *l = NULL, *tmp;
1501 static MonoClass *System_Reflection_MethodInfo;
1502 MonoClass *startklass, *klass;
1508 domain = ((MonoObject *)type)->vtable->domain;
1509 klass = startklass = mono_class_from_mono_type (type->type);
1512 for (i = 0; i < klass->method.count; ++i) {
1514 method = klass->methods [i];
1515 if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
1517 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1518 if (bflags & BFLAGS_Public)
1521 if (bflags & BFLAGS_NonPublic)
1527 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1528 if (bflags & BFLAGS_Static)
1531 if (bflags & BFLAGS_Instance)
1538 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1540 l = g_slist_prepend (l, member);
1542 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1544 len = g_slist_length (l);
1545 if (!System_Reflection_MethodInfo)
1546 System_Reflection_MethodInfo = mono_class_from_name (
1547 mono_defaults.corlib, "System.Reflection", "MethodInfo");
1548 res = mono_array_new (domain, System_Reflection_MethodInfo, len);
1551 for (; tmp; tmp = tmp->next, ++i)
1552 mono_array_set (res, gpointer, i, tmp->data);
1559 ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
1562 GSList *l = NULL, *tmp;
1563 static MonoClass *System_Reflection_ConstructorInfo;
1564 MonoClass *startklass, *klass;
1570 domain = ((MonoObject *)type)->vtable->domain;
1571 klass = startklass = mono_class_from_mono_type (type->type);
1574 for (i = 0; i < klass->method.count; ++i) {
1576 method = klass->methods [i];
1577 if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
1579 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1580 if (bflags & BFLAGS_Public)
1583 if (bflags & BFLAGS_NonPublic)
1589 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1590 if (bflags & BFLAGS_Static)
1593 if (bflags & BFLAGS_Instance)
1599 member = (MonoObject*)mono_method_get_object (domain, method, startklass);
1601 l = g_slist_prepend (l, member);
1603 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1605 len = g_slist_length (l);
1606 if (!System_Reflection_ConstructorInfo)
1607 System_Reflection_ConstructorInfo = mono_class_from_name (
1608 mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
1609 res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
1611 tmp = g_slist_reverse (l);
1612 for (; tmp; tmp = tmp->next, ++i)
1613 mono_array_set (res, gpointer, i, tmp->data);
1619 ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
1622 GSList *l = NULL, *tmp;
1623 static MonoClass *System_Reflection_PropertyInfo;
1624 MonoClass *startklass, *klass;
1630 domain = ((MonoObject *)type)->vtable->domain;
1631 klass = startklass = mono_class_from_mono_type (type->type);
1634 for (i = 0; i < klass->property.count; ++i) {
1635 prop = &klass->properties [i];
1640 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1641 if (bflags & BFLAGS_Public)
1644 if (bflags & BFLAGS_NonPublic)
1650 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1651 if (bflags & BFLAGS_Static)
1654 if (bflags & BFLAGS_Instance)
1661 l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
1663 if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
1665 len = g_slist_length (l);
1666 if (!System_Reflection_PropertyInfo)
1667 System_Reflection_PropertyInfo = mono_class_from_name (
1668 mono_defaults.corlib, "System.Reflection", "PropertyInfo");
1669 res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
1672 for (; tmp; tmp = tmp->next, ++i)
1673 mono_array_set (res, gpointer, i, tmp->data);
1679 ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
1682 GSList *l = NULL, *tmp;
1683 static MonoClass *System_Reflection_EventInfo;
1684 MonoClass *startklass, *klass;
1690 domain = ((MonoObject *)type)->vtable->domain;
1691 klass = startklass = mono_class_from_mono_type (type->type);
1694 for (i = 0; i < klass->event.count; ++i) {
1695 event = &klass->events [i];
1697 method = event->add;
1699 method = event->remove;
1700 if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
1701 if (bflags & BFLAGS_Public)
1704 if (bflags & BFLAGS_NonPublic)
1710 if (method->flags & METHOD_ATTRIBUTE_STATIC) {
1711 if (bflags & BFLAGS_Static)
1714 if (bflags & BFLAGS_Instance)
1721 l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
1723 if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
1725 len = g_slist_length (l);
1726 if (!System_Reflection_EventInfo)
1727 System_Reflection_EventInfo = mono_class_from_name (
1728 mono_defaults.corlib, "System.Reflection", "EventInfo");
1729 res = mono_array_new (domain, System_Reflection_EventInfo, len);
1732 for (; tmp; tmp = tmp->next, ++i)
1733 mono_array_set (res, gpointer, i, tmp->data);
1739 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
1742 GSList *l = NULL, *tmp;
1744 MonoClass *startklass, *klass;
1750 domain = ((MonoObject *)type)->vtable->domain;
1751 klass = startklass = mono_class_from_mono_type (type->type);
1753 for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
1755 nested = tmpn->data;
1756 if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
1757 if (bflags & BFLAGS_Public)
1760 if (bflags & BFLAGS_NonPublic)
1765 member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
1766 l = g_slist_prepend (l, member);
1768 len = g_slist_length (l);
1769 res = mono_array_new (domain, mono_defaults.monotype_class, len);
1771 tmp = g_slist_reverse (l);
1772 for (; tmp; tmp = tmp->next, ++i)
1773 mono_array_set (res, gpointer, i, tmp->data);
1778 static MonoReflectionType*
1779 ves_icall_System_Reflection_Assembly_GetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
1781 MonoDomain *domain = mono_domain_get ();
1784 MonoTypeNameParse info;
1786 str = mono_string_to_utf8 (name);
1787 /*g_print ("requested type %s in %s\n", str, assembly->assembly->aname.name);*/
1788 if (!mono_reflection_parse_type (str, &info)) {
1790 g_list_free (info.modifiers);
1791 g_list_free (info.nested);
1792 if (throwOnError) /* uhm: this is a parse error, though... */
1793 mono_raise_exception (mono_get_exception_type_load ());
1794 /*g_print ("failed parse\n");*/
1798 type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
1800 g_list_free (info.modifiers);
1801 g_list_free (info.nested);
1804 mono_raise_exception (mono_get_exception_type_load ());
1805 /* g_print ("failed find\n"); */
1808 /* g_print ("got it\n"); */
1809 return mono_type_get_object (domain, type);
1814 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
1816 MonoDomain *domain = mono_domain_get ();
1818 char *name = g_strconcat (
1819 "file://", assembly->assembly->image->name, NULL);
1821 res = mono_string_new (domain, name);
1827 ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssembly *assembly)
1829 MonoDomain *domain = mono_domain_get ();
1831 char *name = g_strconcat (
1832 assembly->assembly->basedir, G_DIR_SEPARATOR_S,
1833 assembly->assembly->image->module_name, NULL);
1835 res = mono_string_new (domain, name);
1840 static MonoReflectionMethod*
1841 ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssembly *assembly) {
1842 guint32 token = mono_image_get_entry_point (assembly->assembly->image);
1845 return mono_method_get_object (mono_object_domain (assembly), mono_get_method (assembly->assembly->image, token, NULL), NULL);
1849 ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssembly *assembly) {
1850 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
1851 MonoArray *result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
1855 for (i = 0; i < table->rows; ++i) {
1856 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_MANIFEST_NAME));
1857 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), val));
1862 /* move this in some file in mono/util/ */
1864 g_concat_dir_and_file (const char *dir, const char *file)
1866 g_return_val_if_fail (dir != NULL, NULL);
1867 g_return_val_if_fail (file != NULL, NULL);
1870 * If the directory name doesn't have a / on the end, we need
1871 * to add one so we get a proper path to the file
1873 if (dir [strlen(dir) - 1] != G_DIR_SEPARATOR)
1874 return g_strconcat (dir, G_DIR_SEPARATOR_S, file, NULL);
1876 return g_strconcat (dir, file, NULL);
1880 ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssembly *assembly, MonoString *name) {
1881 char *n = mono_string_to_utf8 (name);
1882 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
1884 guint32 cols [MONO_MANIFEST_SIZE];
1888 for (i = 0; i < table->rows; ++i) {
1889 mono_metadata_decode_row (table, i, cols, MONO_MANIFEST_SIZE);
1890 val = mono_metadata_string_heap (assembly->assembly->image, cols [MONO_MANIFEST_NAME]);
1891 if (strcmp (val, n) == 0)
1895 if (i == table->rows)
1898 if (!cols [MONO_MANIFEST_IMPLEMENTATION]) {
1901 val = mono_image_get_resource (assembly->assembly->image, cols [MONO_MANIFEST_OFFSET], &size);
1904 data = mono_array_new (mono_object_domain (assembly), mono_defaults.byte_class, size);
1905 memcpy (mono_array_addr (data, char, 0), val, size);
1906 return (MonoObject*)data;
1908 switch (cols [MONO_MANIFEST_IMPLEMENTATION] & IMPLEMENTATION_MASK) {
1909 case IMPLEMENTATION_FILE:
1910 i = cols [MONO_MANIFEST_IMPLEMENTATION] >> IMPLEMENTATION_BITS;
1911 table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
1912 i = mono_metadata_decode_row_col (table, i - 1, MONO_FILE_NAME);
1913 val = mono_metadata_string_heap (assembly->assembly->image, i);
1914 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1915 result = (MonoObject*)mono_string_new (mono_object_domain (assembly), n);
1916 /* check hash if needed */
1919 case IMPLEMENTATION_ASSEMBLYREF:
1920 case IMPLEMENTATION_EXP_TYPE:
1928 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name) {
1929 MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
1935 /* check hash if needed */
1937 n = mono_string_to_utf8 (name);
1938 for (i = 0; i < table->rows; ++i) {
1939 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
1940 if (strcmp (val, n) == 0) {
1943 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1944 fn = mono_string_new (mono_object_domain (assembly), n);
1946 return (MonoObject*)fn;
1953 for (i = 0; i < table->rows; ++i) {
1954 result = mono_array_new (mono_object_domain (assembly), mono_defaults.string_class, table->rows);
1955 val = mono_metadata_string_heap (assembly->assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
1956 n = g_concat_dir_and_file (assembly->assembly->basedir, val);
1957 mono_array_set (result, gpointer, i, mono_string_new (mono_object_domain (assembly), n));
1960 return (MonoObject*)result;
1963 static MonoReflectionMethod*
1964 ves_icall_GetCurrentMethod (void) {
1965 MonoMethod *m = mono_method_get_last_managed ();
1966 return mono_method_get_object (mono_domain_get (), m, NULL);
1969 static MonoReflectionAssembly*
1970 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (void)
1972 MonoMethod *m = mono_method_get_last_managed ();
1973 return mono_assembly_get_object (mono_domain_get (), m->klass->image->assembly);
1978 get_caller (MonoMethod *m, gint32 no, gint32 ilo, gpointer data)
1980 MonoMethod **dest = data;
1992 static MonoReflectionAssembly*
1993 ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
1995 MonoDomain* domain = mono_domain_get ();
1996 g_assert (domain->entry_assembly);
1997 return mono_assembly_get_object (domain, domain->entry_assembly);
2001 static MonoReflectionAssembly*
2002 ves_icall_System_Reflection_Assembly_GetCallingAssembly (void)
2004 MonoMethod *m = mono_method_get_last_managed ();
2005 MonoMethod *dest = m;
2006 mono_stack_walk (get_caller, &dest);
2009 return mono_assembly_get_object (mono_domain_get (), dest->klass->image->assembly);
2013 ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
2015 MonoDomain *domain = mono_domain_get ();
2019 name = mono_type_get_name (object->type);
2020 res = mono_string_new (domain, name);
2027 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
2029 MonoAssemblyName *name = &assembly->assembly->aname;
2031 if (strcmp (name->name, "corlib") == 0)
2032 aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
2034 aname->name = mono_string_new (mono_object_domain (assembly), name->name);
2035 aname->major = name->major;
2039 ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
2041 MonoDomain *domain = mono_domain_get ();
2044 MonoTableInfo *tdef = &assembly->assembly->image->tables [MONO_TABLE_TYPEDEF];
2046 guint32 attrs, visibility;
2048 /* we start the count from 1 because we skip the special type <Module> */
2051 for (i = 1; i < tdef->rows; ++i) {
2052 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2053 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2054 if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
2058 count = tdef->rows - 1;
2060 res = mono_array_new (domain, mono_defaults.monotype_class, count);
2062 for (i = 1; i < tdef->rows; ++i) {
2063 attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
2064 visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
2065 if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
2066 klass = mono_class_get (assembly->assembly->image, (i + 1) | MONO_TOKEN_TYPE_DEF);
2067 mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
2075 static MonoReflectionType*
2076 ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
2079 int isbyref = 0, rank;
2080 char *str = mono_string_to_utf8 (smodifiers);
2083 klass = mono_class_from_mono_type (tb->type.type);
2085 /* logic taken from mono_reflection_parse_type(): keep in sync */
2089 if (isbyref) { /* only one level allowed by the spec */
2096 return mono_type_get_object (mono_domain_get (), &klass->this_arg);
2099 klass = mono_ptr_class_get (&klass->byval_arg);
2100 mono_class_init (klass);
2111 else if (*p != '*') { /* '*' means unknown lower bound */
2122 klass = mono_array_class_get (&klass->byval_arg, rank);
2123 mono_class_init (klass);
2130 return mono_type_get_object (mono_domain_get (), &klass->byval_arg);
2134 ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target,
2135 MonoReflectionMethod *info)
2137 MonoClass *delegate_class = mono_class_from_mono_type (type->type);
2138 MonoObject *delegate;
2141 mono_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
2143 delegate = mono_object_new (mono_object_domain (type), delegate_class);
2145 func = mono_compile_method (info->method);
2147 mono_delegate_ctor (delegate, target, func);
2153 * Magic number to convert a time which is relative to
2154 * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
2156 #define EPOCH_ADJUST ((gint64)62135596800L)
2159 ves_icall_System_DateTime_GetNow (void)
2161 #ifdef PLATFORM_WIN32
2166 SystemTimeToFileTime (&st, &ft);
2167 return (gint64)504911232000000000L + ((((gint64)ft.dwHighDateTime)<<32) | ft.dwLowDateTime);
2169 /* FIXME: put this in io-layer and call it GetLocalTime */
2173 if (gettimeofday (&tv, NULL) == 0) {
2174 res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
2177 /* fixme: raise exception */
2183 * This is heavily based on zdump.c from glibc 2.2.
2185 * * data[0]: start of daylight saving time (in DateTime ticks).
2186 * * data[1]: end of daylight saving time (in DateTime ticks).
2187 * * data[2]: utcoffset (in TimeSpan ticks).
2188 * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
2189 * * name[0]: name of this timezone when not daylight saving.
2190 * * name[1]: name of this timezone when daylight saving.
2192 * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
2193 * the class library allows years between 1 and 9999.
2195 * Returns true on success and zero on failure.
2198 ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
2200 #ifndef PLATFORM_WIN32
2201 MonoDomain *domain = mono_domain_get ();
2202 struct tm start, tt;
2206 int is_daylight = 0, day;
2208 memset (&start, 0, sizeof (start));
2211 start.tm_year = year-1900;
2213 t = mktime (&start);
2214 #if defined (HAVE_TIMEZONE)
2215 #define gmt_offset(x) (-1 * (((timezone / 60 / 60) - daylight) * 100))
2216 #elif defined (HAVE_TM_GMTOFF)
2217 #define gmt_offset(x) x.tm_gmtoff
2219 #error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc.
2222 gmtoff = gmt_offset (start);
2224 MONO_CHECK_ARG_NULL (data);
2225 MONO_CHECK_ARG_NULL (names);
2227 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2228 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2230 /* For each day of the year, calculate the tm_gmtoff. */
2231 for (day = 0; day < 365; day++) {
2234 tt = *localtime (&t);
2236 /* Daylight saving starts or ends here. */
2237 if (gmt_offset (tt) != gmtoff) {
2242 /* Try to find the exact hour when daylight saving starts/ends. */
2246 tt1 = *localtime (&t1);
2247 } while (gmt_offset (tt1) != gmtoff);
2249 /* Try to find the exact minute when daylight saving starts/ends. */
2252 tt1 = *localtime (&t1);
2253 } while (gmt_offset (tt1) == gmtoff);
2255 strftime (tzone, 10, "%Z", &tt);
2257 /* Write data, if we're already in daylight saving, we're done. */
2259 mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
2260 mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2263 mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
2264 mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
2268 /* This is only set once when we enter daylight saving. */
2269 mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
2270 mono_array_set ((*data), gint64, 3, (gint64)(gmt_offset (tt) - gmtoff) * 10000000L);
2272 gmtoff = gmt_offset (tt);
2275 gmtoff = gmt_offset (tt);
2279 MonoDomain *domain = mono_domain_get ();
2280 TIME_ZONE_INFORMATION tz_info;
2284 GetTimeZoneInformation (&tz_info);
2286 MONO_CHECK_ARG_NULL (data);
2287 MONO_CHECK_ARG_NULL (names);
2289 (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
2290 (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
2292 for (i = 0; i < 32; ++i)
2293 if (!tz_info.DaylightName [i])
2295 mono_array_set ((*names), gpointer, 1, mono_string_new_utf16 (domain, tz_info.DaylightName, i));
2296 for (i = 0; i < 32; ++i)
2297 if (!tz_info.StandardName [i])
2299 mono_array_set ((*names), gpointer, 0, mono_string_new_utf16 (domain, tz_info.StandardName, i));
2301 SystemTimeToFileTime (&tz_info.StandardDate, &ft);
2302 mono_array_set ((*data), gint64, 1, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2303 SystemTimeToFileTime (&tz_info.DaylightDate, &ft);
2304 mono_array_set ((*data), gint64, 0, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
2305 mono_array_set ((*data), gint64, 3, tz_info.Bias + tz_info.StandardBias);
2306 mono_array_set ((*data), gint64, 2, tz_info.Bias + tz_info.DaylightBias);
2313 ves_icall_System_Object_obj_address (MonoObject *this) {
2320 ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
2326 klass = array->obj.vtable->klass;
2327 etype = klass->element_class->byval_arg.type;
2328 if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
2331 if (array->bounds == NULL)
2332 length = array->max_length;
2335 for (i = 0; i < klass->rank; ++ i)
2336 length += array->bounds [i].length;
2339 esize = mono_array_element_size (klass);
2340 return length * esize;
2344 ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx) {
2345 return mono_array_get (array, gint8, idx);
2349 ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) {
2350 mono_array_set (array, gint8, idx, value);
2354 ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) {
2355 char *src_buf, *dest_buf;
2357 src_buf = (gint8 *)src->vector + src_offset;
2358 dest_buf = (gint8 *)dest->vector + dest_offset;
2360 memcpy (dest_buf, src_buf, count);
2364 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
2366 MonoDomain *domain = mono_domain_get ();
2368 MonoRealProxy *rp = ((MonoRealProxy *)this);
2372 res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
2374 ((MonoTransparentProxy *)res)->rp = rp;
2375 type = ((MonoReflectionType *)rp->class_to_proxy)->type;
2376 klass = mono_class_from_mono_type (type);
2378 ((MonoTransparentProxy *)res)->klass = klass;
2380 res->vtable = mono_class_proxy_vtable (domain, klass);
2385 /* System.Environment */
2388 ves_icall_System_Environment_get_MachineName (void)
2390 #if defined (PLATFORM_WIN32)
2395 len = MAX_COMPUTERNAME_LENGTH + 1;
2396 buf = g_new (gunichar2, len);
2399 if (GetComputerName (buf, (PDWORD) &len))
2400 result = mono_string_new_utf16 (mono_domain_get (), buf, len);
2410 buf = g_new (gchar, len);
2413 if (gethostname (buf, len) != 0)
2414 result = mono_string_new (mono_domain_get (), buf);
2422 ves_icall_System_Environment_get_Platform (void)
2424 #if defined (PLATFORM_WIN32)
2434 ves_icall_System_Environment_get_NewLine (void)
2436 #if defined (PLATFORM_WIN32)
2437 return mono_string_new (mono_domain_get (), "\r\n");
2439 return mono_string_new (mono_domain_get (), "\n");
2444 ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
2452 utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
2453 value = g_getenv (utf8_name);
2459 return mono_string_new (mono_domain_get (), value);
2463 * There is no standard way to get at environ.
2465 extern char **environ;
2468 ves_icall_System_Environment_GetEnvironmentVariableNames (void)
2477 for (e = environ; *e != 0; ++ e)
2480 domain = mono_domain_get ();
2481 names = mono_array_new (domain, mono_defaults.string_class, n);
2484 for (e = environ; *e != 0; ++ e) {
2485 parts = g_strsplit (*e, "=", 2);
2487 str = mono_string_new (domain, *parts);
2488 mono_array_set (names, MonoString *, n, str);
2500 * Returns the number of milliseconds elapsed since the system started.
2503 ves_icall_System_Environment_get_TickCount (void)
2505 #if defined (PLATFORM_WIN32)
2506 return GetTickCount();
2512 res = (gint32) gettimeofday (&tv, &tz);
2515 res = (gint32) ((tv.tv_sec & 0xFFFFF) * 1000 + (tv.tv_usec / 1000));
2522 ves_icall_System_Environment_Exit (int result)
2524 /* we may need to do some cleanup here... */
2529 ves_icall_System_Text_Encoding_InternalCodePage (void) {
2531 g_get_charset (&cset);
2532 /* g_print ("charset: %s\n", cset); */
2533 /* handle some common aliases */
2536 if (strcmp (cset, "ANSI_X3.4-1968") == 0)
2540 return mono_string_new (mono_domain_get (), cset);
2544 ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
2545 MonoReflectionMethod *method,
2546 MonoArray *out_args)
2548 MonoDomain *domain = mono_domain_get ();
2550 mono_message_init (domain, this, method, out_args);
2554 ves_icall_IsTransparentProxy (MonoObject *proxy)
2559 if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
2566 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal (MonoReflectionType *type)
2572 domain = mono_object_domain (type);
2573 klass = mono_class_from_mono_type (type->type);
2575 if (klass->rank >= 1) {
2576 g_assert (klass->rank == 1);
2577 obj = (MonoObject *) mono_array_new (domain, klass->element_class, 0);
2579 obj = mono_object_new (domain, klass);
2586 ves_icall_System_IO_get_temp_path (void)
2588 return mono_string_new (mono_domain_get (), g_get_tmp_dir ());
2592 ves_icall_RuntimeMethod_GetFunctionPointer (MonoMethod *method)
2594 return mono_compile_method (method);
2599 static gconstpointer icall_map [] = {
2603 "System.Array::GetValue", ves_icall_System_Array_GetValue,
2604 "System.Array::SetValue", ves_icall_System_Array_SetValue,
2605 "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
2606 "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
2607 "System.Array::GetRank", ves_icall_System_Array_GetRank,
2608 "System.Array::GetLength", ves_icall_System_Array_GetLength,
2609 "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
2610 "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
2611 "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
2612 "System.Array::Clone", mono_array_clone,
2617 "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
2618 "System.Object::GetType", ves_icall_System_Object_GetType,
2619 "System.Object::GetHashCode", ves_icall_System_Object_GetHashCode,
2620 "System.Object::obj_address", ves_icall_System_Object_obj_address,
2625 "System.ValueType::GetHashCode", ves_icall_System_ValueType_GetHashCode,
2626 "System.ValueType::Equals", ves_icall_System_ValueType_Equals,
2632 "System.String::.ctor(char*)", ves_icall_System_String_ctor_charp,
2633 "System.String::.ctor(char*,int,int)", ves_icall_System_String_ctor_charp_int_int,
2634 "System.String::.ctor(sbyte*)", ves_icall_System_String_ctor_sbytep,
2635 "System.String::.ctor(sbyte*,int,int)", ves_icall_System_String_ctor_sbytep_int_int,
2636 "System.String::.ctor(sbyte*,int,int,System.Text.Encoding)", ves_icall_System_String_ctor_encoding,
2637 "System.String::.ctor(char[])", ves_icall_System_String_ctor_chara,
2638 "System.String::.ctor(char[],int,int)", ves_icall_System_String_ctor_chara_int_int,
2639 "System.String::.ctor(char,int)", ves_icall_System_String_ctor_char_int,
2640 "System.String::InternalEquals", ves_icall_System_String_InternalEquals,
2641 "System.String::InternalJoin", ves_icall_System_String_InternalJoin,
2642 "System.String::InternalInsert", ves_icall_System_String_InternalInsert,
2643 "System.String::InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char,
2644 "System.String::InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str,
2645 "System.String::InternalRemove", ves_icall_System_String_InternalRemove,
2646 "System.String::InternalCopyTo", ves_icall_System_String_InternalCopyTo,
2647 "System.String::InternalSplit", ves_icall_System_String_InternalSplit,
2648 "System.String::InternalTrim", ves_icall_System_String_InternalTrim,
2649 "System.String::InternalIndexOf(char,int,int)", ves_icall_System_String_InternalIndexOf_Char,
2650 "System.String::InternalIndexOf(string,int,int)", ves_icall_System_String_InternalIndexOf_Str,
2651 "System.String::InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny,
2652 "System.String::InternalLastIndexOf(char,int,int)", ves_icall_System_String_InternalLastIndexOf_Char,
2653 "System.String::InternalLastIndexOf(string,int,int)", ves_icall_System_String_InternalLastIndexOf_Str,
2654 "System.String::InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny,
2655 "System.String::InternalPad", ves_icall_System_String_InternalPad,
2656 "System.String::InternalToLower", ves_icall_System_String_InternalToLower,
2657 "System.String::InternalToUpper", ves_icall_System_String_InternalToUpper,
2658 "System.String::InternalAllocateStr", ves_icall_System_String_InternalAllocateStr,
2659 "System.String::InternalStrcpy(string,int,string)", ves_icall_System_String_InternalStrcpy_Str,
2660 "System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
2661 "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
2662 "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
2663 "System.String::InternalCompare(string,int,string,int,int,bool)", ves_icall_System_String_InternalCompareStr_N,
2664 "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
2665 "System.String::get_Chars", ves_icall_System_String_get_Chars,
2670 "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
2671 "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
2672 "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
2673 "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
2674 "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
2675 "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
2676 "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
2677 "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
2678 "System.AppDomain::Unload", ves_icall_System_AppDomain_Unload,
2679 "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
2682 * System.AppDomainSetup
2684 "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
2689 "System.Double::ToStringImpl", mono_double_ToStringImpl,
2690 "System.Double::ParseImpl", mono_double_ParseImpl,
2695 "System.Single::ToStringImpl", mono_float_ToStringImpl,
2700 "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
2701 "System.Decimal::decimal2Int64", mono_decimal2Int64,
2702 "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
2703 "System.Decimal::decimalIncr", mono_decimalIncr,
2704 "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
2705 "System.Decimal::decimal2double", mono_decimal2double,
2706 "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
2707 "System.Decimal::decimalRound", mono_decimalRound,
2708 "System.Decimal::decimalMult", mono_decimalMult,
2709 "System.Decimal::decimalDiv", mono_decimalDiv,
2710 "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
2711 "System.Decimal::decimalCompare", mono_decimalCompare,
2712 "System.Decimal::string2decimal", mono_string2decimal,
2713 "System.Decimal::decimal2string", mono_decimal2string,
2718 "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
2723 "System.Reflection.Emit.AssemblyBuilder::getDataChunk", ves_icall_AssemblyBuilder_getDataChunk,
2724 "System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
2725 "System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
2726 "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
2731 "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
2732 "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
2733 "System.Reflection.MonoFieldInfo::get_field_info", ves_icall_get_field_info,
2734 "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
2735 "System.Reflection.MonoEventInfo::get_event_info", ves_icall_get_event_info,
2736 "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
2737 "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
2738 "System.Reflection.MethodBase::GetCurrentMethod", ves_icall_GetCurrentMethod,
2739 "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
2740 "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
2741 "System.Reflection.MonoField::GetValueInternal", ves_icall_MonoField_GetValueInternal,
2742 "System.Reflection.FieldInfo::SetValueInternal", ves_icall_FieldInfo_SetValueInternal,
2743 "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
2744 "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
2746 "System.RuntimeMethodHandle::GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer,
2750 "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
2751 "System.Enum::get_value", ves_icall_System_Enum_get_value,
2752 "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
2757 "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
2758 "System.Reflection.Emit.TypeBuilder::create_internal_class", mono_reflection_create_internal_class,
2759 "System.Reflection.Emit.TypeBuilder::create_runtime_class", mono_reflection_create_runtime_class,
2768 "System.Type::internal_from_name", ves_icall_type_from_name,
2769 "System.Type::internal_from_handle", ves_icall_type_from_handle,
2770 "System.Type::get_property", ves_icall_get_property,
2771 "System.MonoType::get_attributes", ves_icall_get_attributes,
2772 "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
2773 "System.Type::Equals", ves_icall_type_Equals,
2774 "System.Type::GetTypeCode", ves_icall_type_GetTypeCode,
2777 * System.Runtime.CompilerServices.RuntimeHelpers
2779 "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_InitializeArray,
2784 "System.Threading.Thread::Abort(object)", ves_icall_System_Threading_Thread_Abort,
2785 "System.Threading.Thread::ResetAbort", ves_icall_System_Threading_Thread_ResetAbort,
2786 "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
2787 "System.Threading.Thread::Thread_free_internal", ves_icall_System_Threading_Thread_Thread_free_internal,
2788 "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
2789 "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
2790 "System.Threading.Thread::CurrentThread_internal", mono_thread_current,
2791 "System.Threading.Thread::CurrentThreadDomain_internal", ves_icall_System_Threading_Thread_CurrentThreadDomain_internal,
2792 "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
2793 "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
2794 "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
2795 "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
2796 "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
2797 "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
2798 "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
2799 "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
2800 "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
2801 "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
2802 "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
2803 "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
2804 "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
2805 "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
2806 "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
2809 * System.Threading.WaitHandle
2811 "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
2812 "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
2813 "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
2816 * System.Runtime.InteropServices.Marshal
2818 "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
2819 "System.Runtime.InteropServices.Marshal::ReadByte", ves_icall_System_Runtime_InteropServices_Marshal_ReadByte,
2820 "System.Runtime.InteropServices.Marshal::ReadInt16", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt16,
2821 "System.Runtime.InteropServices.Marshal::ReadInt32", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt32,
2822 "System.Runtime.InteropServices.Marshal::ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64,
2823 "System.Runtime.InteropServices.Marshal::WriteIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_WriteIntPtr,
2824 "System.Runtime.InteropServices.Marshal::WriteByte", ves_icall_System_Runtime_InteropServices_Marshal_WriteByte,
2825 "System.Runtime.InteropServices.Marshal::WriteInt16", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt16,
2826 "System.Runtime.InteropServices.Marshal::WriteInt32", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt32,
2827 "System.Runtime.InteropServices.Marshal::WriteInt64", ves_icall_System_Runtime_InteropServices_Marshal_WriteInt64,
2829 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
2830 "System.Runtime.InteropServices.Marshal::PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
2831 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi,
2832 "System.Runtime.InteropServices.Marshal::PtrToStringAuto(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len,
2833 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni,
2834 "System.Runtime.InteropServices.Marshal::PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len,
2835 "System.Runtime.InteropServices.Marshal::PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR,
2837 "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
2838 "System.Runtime.InteropServices.Marshal::AllocHGlobal", mono_marshal_alloc,
2839 "System.Runtime.InteropServices.Marshal::FreeHGlobal", mono_marshal_free,
2840 "System.Runtime.InteropServices.Marshal::ReAllocHGlobal", mono_marshal_realloc,
2841 "System.Runtime.InteropServices.Marshal::copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged,
2842 "System.Runtime.InteropServices.Marshal::copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged,
2843 "System.Runtime.InteropServices.Marshal::SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf,
2844 "System.Runtime.InteropServices.Marshal::StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr,
2845 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure,
2846 "System.Runtime.InteropServices.Marshal::PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type,
2847 "System.Runtime.InteropServices.Marshal::OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf,
2848 "System.Runtime.InteropServices.Marshal::StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
2849 "System.Runtime.InteropServices.Marshal::StringToHGlobalAuto", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi,
2850 "System.Runtime.InteropServices.Marshal::StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni,
2851 "System.Runtime.InteropServices.Marshal::DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure,
2854 "System.Reflection.Assembly::LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom,
2855 "System.Reflection.Assembly::GetType", ves_icall_System_Reflection_Assembly_GetType,
2856 "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
2857 "System.Reflection.Assembly::FillName", ves_icall_System_Reflection_Assembly_FillName,
2858 "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
2859 "System.Reflection.Assembly::get_location", ves_icall_System_Reflection_Assembly_get_location,
2860 "System.Reflection.Assembly::GetExecutingAssembly", ves_icall_System_Reflection_Assembly_GetExecutingAssembly,
2861 "System.Reflection.Assembly::GetEntryAssembly", ves_icall_System_Reflection_Assembly_GetEntryAssembly,
2862 "System.Reflection.Assembly::GetCallingAssembly", ves_icall_System_Reflection_Assembly_GetCallingAssembly,
2863 "System.Reflection.Assembly::get_EntryPoint", ves_icall_System_Reflection_Assembly_get_EntryPoint,
2864 "System.Reflection.Assembly::GetManifestResourceNames", ves_icall_System_Reflection_Assembly_GetManifestResourceNames,
2865 "System.Reflection.Assembly::GetManifestResourceInternal", ves_icall_System_Reflection_Assembly_GetManifestResourceInternal,
2866 "System.Reflection.Assembly::GetFilesInternal", ves_icall_System_Reflection_Assembly_GetFilesInternal,
2871 "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
2872 "System.MonoType::type_from_obj", mono_type_type_from_obj,
2873 "System.MonoType::GetElementType", ves_icall_MonoType_GetElementType,
2874 "System.MonoType::get_type_info", ves_icall_get_type_info,
2875 "System.MonoType::get_BaseType", ves_icall_get_type_parent,
2876 "System.MonoType::IsPointerImpl", ves_icall_type_ispointer,
2877 "System.MonoType::IsByRefImpl", ves_icall_type_isbyref,
2878 "System.MonoType::GetField", ves_icall_Type_GetField,
2879 "System.MonoType::GetFields", ves_icall_Type_GetFields,
2880 "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
2881 "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
2882 "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
2883 "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
2884 "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
2885 "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
2888 * System.Net.Sockets I/O Services
2890 "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
2891 "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
2892 "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
2893 "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
2894 "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
2895 "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
2896 "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
2897 "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
2898 "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
2899 "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
2900 "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
2901 "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
2902 "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
2903 "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
2904 "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
2905 "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
2906 "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
2907 "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
2908 "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
2909 "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
2910 "System.Net.Dns::GetHostByName_internal", ves_icall_System_Net_Dns_GetHostByName_internal,
2911 "System.Net.Dns::GetHostByAddr_internal", ves_icall_System_Net_Dns_GetHostByAddr_internal,
2916 "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
2917 "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
2918 "System.Char::IsControl", ves_icall_System_Char_IsControl,
2919 "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
2920 "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
2921 "System.Char::IsLower", ves_icall_System_Char_IsLower,
2922 "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
2923 "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
2924 "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
2925 "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
2926 "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
2927 "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
2928 "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
2929 "System.Char::ToLower", ves_icall_System_Char_ToLower,
2930 "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
2933 * System.Text.Encoding
2935 "System.Text.Encoding::InternalCodePage", ves_icall_System_Text_Encoding_InternalCodePage,
2937 "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
2938 "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
2943 "System.GC::InternalCollect", ves_icall_System_GC_InternalCollect,
2944 "System.GC::GetTotalMemory", ves_icall_System_GC_GetTotalMemory,
2945 "System.GC::KeepAlive", ves_icall_System_GC_KeepAlive,
2946 "System.GC::ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize,
2947 "System.GC::SuppressFinalize", ves_icall_System_GC_SuppressFinalize,
2948 "System.GC::WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers,
2949 "System.Runtime.InteropServices.GCHandle::GetTarget", ves_icall_System_GCHandle_GetTarget,
2950 "System.Runtime.InteropServices.GCHandle::GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle,
2951 "System.Runtime.InteropServices.GCHandle::FreeHandle", ves_icall_System_GCHandle_FreeHandle,
2952 "System.Runtime.InteropServices.GCHandle::GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject,
2955 * System.Security.Cryptography calls
2958 "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
2959 "System.Security.Cryptography.RNGCryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
2964 "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
2965 "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
2966 "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
2967 "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
2972 "System.IO.MonoIO::GetLastError", ves_icall_System_IO_MonoIO_GetLastError,
2973 "System.IO.MonoIO::CreateDirectory", ves_icall_System_IO_MonoIO_CreateDirectory,
2974 "System.IO.MonoIO::RemoveDirectory", ves_icall_System_IO_MonoIO_RemoveDirectory,
2975 "System.IO.MonoIO::FindFirstFile", ves_icall_System_IO_MonoIO_FindFirstFile,
2976 "System.IO.MonoIO::FindNextFile", ves_icall_System_IO_MonoIO_FindNextFile,
2977 "System.IO.MonoIO::FindClose", ves_icall_System_IO_MonoIO_FindClose,
2978 "System.IO.MonoIO::GetCurrentDirectory", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
2979 "System.IO.MonoIO::SetCurrentDirectory", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
2980 "System.IO.MonoIO::MoveFile", ves_icall_System_IO_MonoIO_MoveFile,
2981 "System.IO.MonoIO::CopyFile", ves_icall_System_IO_MonoIO_CopyFile,
2982 "System.IO.MonoIO::DeleteFile", ves_icall_System_IO_MonoIO_DeleteFile,
2983 "System.IO.MonoIO::GetFileAttributes", ves_icall_System_IO_MonoIO_GetFileAttributes,
2984 "System.IO.MonoIO::SetFileAttributes", ves_icall_System_IO_MonoIO_SetFileAttributes,
2985 "System.IO.MonoIO::GetFileStat", ves_icall_System_IO_MonoIO_GetFileStat,
2986 "System.IO.MonoIO::Open", ves_icall_System_IO_MonoIO_Open,
2987 "System.IO.MonoIO::Close", ves_icall_System_IO_MonoIO_Close,
2988 "System.IO.MonoIO::Read", ves_icall_System_IO_MonoIO_Read,
2989 "System.IO.MonoIO::Write", ves_icall_System_IO_MonoIO_Write,
2990 "System.IO.MonoIO::Seek", ves_icall_System_IO_MonoIO_Seek,
2991 "System.IO.MonoIO::GetLength", ves_icall_System_IO_MonoIO_GetLength,
2992 "System.IO.MonoIO::SetLength", ves_icall_System_IO_MonoIO_SetLength,
2993 "System.IO.MonoIO::SetFileTime", ves_icall_System_IO_MonoIO_SetFileTime,
2994 "System.IO.MonoIO::Flush", ves_icall_System_IO_MonoIO_Flush,
2995 "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
2996 "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
2997 "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
2998 "System.IO.MonoIO::CreatePipe(intptr&,intptr&)", ves_icall_System_IO_MonoIO_CreatePipe,
2999 "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
3000 "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
3001 "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
3002 "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
3003 "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
3008 "System.Math::Sin", ves_icall_System_Math_Sin,
3009 "System.Math::Cos", ves_icall_System_Math_Cos,
3010 "System.Math::Tan", ves_icall_System_Math_Tan,
3011 "System.Math::Sinh", ves_icall_System_Math_Sinh,
3012 "System.Math::Cosh", ves_icall_System_Math_Cosh,
3013 "System.Math::Tanh", ves_icall_System_Math_Tanh,
3014 "System.Math::Acos", ves_icall_System_Math_Acos,
3015 "System.Math::Asin", ves_icall_System_Math_Asin,
3016 "System.Math::Atan", ves_icall_System_Math_Atan,
3017 "System.Math::Atan2", ves_icall_System_Math_Atan2,
3018 "System.Math::Exp", ves_icall_System_Math_Exp,
3019 "System.Math::Log", ves_icall_System_Math_Log,
3020 "System.Math::Log10", ves_icall_System_Math_Log10,
3021 "System.Math::PowImpl", ves_icall_System_Math_Pow,
3022 "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
3025 * System.Environment
3027 "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
3028 "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
3029 "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
3030 "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
3031 "System.Environment::GetCommandLineArgs", mono_runtime_get_main_args,
3032 "System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
3033 "System.Environment::Exit", ves_icall_System_Environment_Exit,
3034 "System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
3037 * System.Runtime.Remoting
3039 "System.Runtime.Remoting.RemotingServices::InternalExecute",
3040 ves_icall_InternalExecute,
3041 "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
3042 ves_icall_IsTransparentProxy,
3045 * System.Runtime.Remoting.Messaging
3047 "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
3048 ves_icall_MonoMethodMessage_InitMessage,
3051 * System.Runtime.Remoting.Proxies
3053 "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy",
3054 ves_icall_Remoting_RealProxy_GetTransparentProxy,
3057 * System.Threading.Interlocked
3059 "System.Threading.Interlocked::Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int,
3060 "System.Threading.Interlocked::Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long,
3061 "System.Threading.Interlocked::Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int,
3062 "System.Threading.Interlocked::Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long,
3063 "System.Threading.Interlocked::CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int,
3064 "System.Threading.Interlocked::CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object,
3065 "System.Threading.Interlocked::CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single,
3066 "System.Threading.Interlocked::Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int,
3067 "System.Threading.Interlocked::Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object,
3068 "System.Threading.Interlocked::Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single,
3071 * System.Diagnostics.Process
3073 "System.Diagnostics.Process::GetCurrentProcess_internal()", ves_icall_System_Diagnostics_Process_GetCurrentProcess_internal,
3074 "System.Diagnostics.Process::GetPid_internal()", ves_icall_System_Diagnostics_Process_GetPid_internal,
3075 "System.Diagnostics.Process::Process_free_internal(intptr)", ves_icall_System_Diagnostics_Process_Process_free_internal,
3076 "System.Diagnostics.Process::GetModules_internal()", ves_icall_System_Diagnostics_Process_GetModules_internal,
3077 "System.Diagnostics.Process::Start_internal(string,string,intptr,intptr,intptr,ProcInfo&)", ves_icall_System_Diagnostics_Process_Start_internal,
3078 "System.Diagnostics.Process::WaitForExit_internal(intptr,int)", ves_icall_System_Diagnostics_Process_WaitForExit_internal,
3079 "System.Diagnostics.Process::ExitTime_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitTime_internal,
3080 "System.Diagnostics.Process::StartTime_internal(intptr)", ves_icall_System_Diagnostics_Process_StartTime_internal,
3081 "System.Diagnostics.Process::ExitCode_internal(intptr)", ves_icall_System_Diagnostics_Process_ExitCode_internal,
3082 "System.Diagnostics.FileVersionInfo::GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal,
3087 "System.Delegate::CreateDelegate_internal", ves_icall_System_Delegate_CreateDelegate_internal,
3090 * System.Runtime.Serialization
3092 "System.Runtime.Serialization.FormatterServices::GetUninitializedObjectInternal",
3093 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal,
3098 "System.IO.Path::get_temp_path", ves_icall_System_IO_get_temp_path,
3101 * add other internal calls here
3107 mono_init_icall (void)
3112 while ((name = icall_map [i])) {
3113 mono_add_internal_call (name, icall_map [i+1]);