2004-04-07 Martin Baulig <martin@ximian.com>
[mono.git] / mono / metadata / icall.c
index 2d325c846d43335facee149e8b5c6f993137774c..b350488800af2bbcd2316e72565aa10f3446bd29 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <mono/metadata/object.h>
 #include <mono/metadata/threads.h>
+#include <mono/metadata/threadpool.h>
 #include <mono/metadata/monitor.h>
 #include <mono/metadata/reflection.h>
 #include <mono/metadata/assembly.h>
@@ -43,6 +44,8 @@
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/locales.h>
 #include <mono/metadata/filewatcher.h>
+#include <mono/metadata/char-conversions.h>
+#include <mono/metadata/security.h>
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/strtod.h>
 #include <mono/utils/monobitset.h>
@@ -872,7 +875,10 @@ ves_icall_System_Object_GetType (MonoObject *obj)
 {
        MONO_ARCH_SAVE_REGS;
 
-       return mono_type_get_object (mono_object_domain (obj), &obj->vtable->klass->byval_arg);
+       if (obj->vtable->klass != mono_defaults.transparent_proxy_class)
+               return mono_type_get_object (mono_object_domain (obj), &obj->vtable->klass->byval_arg);
+       else
+               return mono_type_get_object (mono_object_domain (obj), &((MonoTransparentProxy*)obj)->remote_class->proxy_class->byval_arg);
 }
 
 static void
@@ -1087,6 +1093,8 @@ handle_enum:
                        }
                }
                return TYPECODE_OBJECT;
+       case MONO_TYPE_GENERICINST:
+               return TYPECODE_OBJECT;
        default:
                g_error ("type 0x%02x not handled in GetTypeCode()", t);
        }
@@ -1349,8 +1357,10 @@ ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo
 
        MONO_ARCH_SAVE_REGS;
 
-       if ((req_info & PInfo_ReflectedType) != 0 || (req_info & PInfo_DeclaringType) != 0)
+       if ((req_info & PInfo_ReflectedType) != 0)
                info->parent = mono_type_get_object (domain, &property->klass->byval_arg);
+       else if ((req_info & PInfo_DeclaringType) != 0)
+               info->parent = mono_type_get_object (domain, &property->property->parent->byval_arg);
 
        if ((req_info & PInfo_Name) != 0)
                info->name = mono_string_new (domain, property->property->name);
@@ -1378,7 +1388,9 @@ ves_icall_get_event_info (MonoReflectionEvent *event, MonoEventInfo *info)
 
        MONO_ARCH_SAVE_REGS;
 
-       info->parent = mono_type_get_object (domain, &event->klass->byval_arg);
+       info->declaring_type = mono_type_get_object (domain, &event->klass->byval_arg);
+       info->reflected_type = mono_type_get_object (domain, &event->event->parent->byval_arg);
+
        info->name = mono_string_new (domain, event->event->name);
        info->attrs = event->event->attrs;
        info->add_method = event->event->add ? mono_method_get_object (domain, event->event->add, NULL): NULL;
@@ -1596,7 +1608,7 @@ ves_icall_MonoType_GetArrayRank (MonoReflectionType *type)
 }
 
 static MonoArray*
-ves_icall_Type_GetGenericArguments (MonoReflectionType *type)
+ves_icall_MonoType_GetGenericArguments (MonoReflectionType *type)
 {
        MonoArray *res;
        MonoClass *klass, *pklass;
@@ -1663,16 +1675,25 @@ ves_icall_Type_GetGenericTypeDefinition_impl (MonoReflectionType *type)
 }
 
 static MonoReflectionType*
-ves_icall_Type_BindGenericParameters (MonoReflectionType *type, MonoArray *types)
+ves_icall_Type_BindGenericParameters (MonoReflectionType *type, MonoArray *type_array)
 {
-       MonoType *geninst;
+       MonoType *geninst, **types;
+       int i, count;
 
        MONO_ARCH_SAVE_REGS;
 
        if (type->type->byref)
                return NULL;
 
-       geninst = mono_reflection_bind_generic_parameters (type->type, types);
+       count = mono_array_length (type_array);
+       types = g_new0 (MonoType *, count);
+
+       for (i = 0; i < count; i++) {
+               MonoReflectionType *t = mono_array_get (type_array, gpointer, i);
+               types [i] = t->type;
+       }
+
+       geninst = mono_reflection_bind_generic_parameters (type, count, types);
 
        return mono_type_get_object (mono_object_domain (type), geninst);
 }
@@ -1739,22 +1760,6 @@ ves_icall_TypeBuilder_get_IsGenericParameter (MonoReflectionTypeBuilder *tb)
        return FALSE;
 }
 
-static MonoReflectionGenericParam*
-ves_icall_TypeBuilder_define_generic_parameter (MonoReflectionTypeBuilder *tb, MonoString *name, int index)
-{
-       MONO_ARCH_SAVE_REGS;
-
-       return mono_reflection_define_generic_parameter (tb, NULL, name, index);
-}
-
-static MonoReflectionGenericParam*
-ves_icall_MethodBuilder_define_generic_parameter (MonoReflectionMethodBuilder *mb, MonoString *name, int index)
-{
-       MONO_ARCH_SAVE_REGS;
-
-       return mono_reflection_define_generic_parameter (NULL, mb, name, index);
-}
-
 static MonoReflectionType*
 ves_icall_MonoGenericInst_GetParentType (MonoReflectionGenericInst *type)
 {
@@ -1800,9 +1805,9 @@ ves_icall_MonoGenericInst_GetInterfaces (MonoReflectionGenericInst *type)
 
        klass = mono_class_from_mono_type (ginst->generic_type);
 
-       res = mono_array_new (domain, System_Reflection_MonoGenericInst, klass->interface_count);
+       res = mono_array_new (domain, System_Reflection_MonoGenericInst, ginst->count_ifaces);
 
-       for (i = 0; i < klass->interface_count; i++) {
+       for (i = 0; i < ginst->count_ifaces; i++) {
                MonoReflectionType *iface = mono_type_get_object (domain, ginst->ifaces [i]);
 
                mono_array_set (res, gpointer, i, iface);
@@ -1933,11 +1938,37 @@ ves_icall_MonoGenericInst_GetProperties (MonoReflectionGenericInst *type,
        return res;
 }
 
-static void
-ves_icall_MonoGenericParam_initialize (MonoReflectionGenericParam *gparam)
+static MonoArray*
+ves_icall_MonoGenericInst_GetEvents (MonoReflectionGenericInst *type,
+                                    MonoReflectionType *reflected_type)
 {
+       static MonoClass *System_Reflection_EventInfo;
+       MonoGenericInst *ginst;
+       MonoDynamicGenericInst *dginst;
+       MonoDomain *domain;
+       MonoClass *refclass;
+       MonoArray *res;
+       int i;
+
        MONO_ARCH_SAVE_REGS;
-       mono_reflection_initialize_generic_parameter (gparam);
+
+       if (!System_Reflection_EventInfo)
+               System_Reflection_EventInfo = mono_class_from_name (
+                       mono_defaults.corlib, "System.Reflection", "EventInfo");
+
+       ginst = type->type.type->data.generic_inst;
+       g_assert ((dginst = ginst->dynamic_info) != NULL);
+
+       refclass = mono_class_from_mono_type (reflected_type->type);
+
+       domain = mono_object_domain (type);
+       res = mono_array_new (domain, System_Reflection_EventInfo, dginst->count_events);
+
+       for (i = 0; i < dginst->count_events; i++)
+               mono_array_set (res, gpointer, i,
+                               mono_event_get_object (domain, refclass, &dginst->events [i]));
+
+       return res;
 }
 
 static MonoReflectionMethod *
@@ -1959,40 +1990,107 @@ ves_icall_MonoType_get_DeclaringMethod (MonoReflectionType *type)
        return mono_method_get_object (mono_object_domain (type), method, klass);
 }
 
+static MonoReflectionMethod *
+ves_icall_MonoMethod_GetGenericMethodDefinition (MonoReflectionMethod *method)
+{
+       MonoMethodInflated *imethod;
+
+       MONO_ARCH_SAVE_REGS;
+
+       if (!method->method->signature->is_inflated) {
+               if (method->method->signature->generic_param_count)
+                       return method;
+
+               return NULL;
+       }
+
+       imethod = (MonoMethodInflated *) method->method;
+       if (imethod->context->gmethod && imethod->context->gmethod->reflection_info)
+               return imethod->context->gmethod->reflection_info;
+       else
+               return mono_method_get_object (
+                       mono_object_domain (method), imethod->declaring, NULL);
+}
+
 static gboolean
-ves_icall_MethodInfo_get_IsGenericMethodDefinition (MonoReflectionMethod *method)
+ves_icall_MonoMethod_get_HasGenericParameters (MonoReflectionMethod *method)
 {
-       MonoMethodNormal *mn;
        MONO_ARCH_SAVE_REGS;
 
        if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
            (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
                return FALSE;
 
-       mn = (MonoMethodNormal *) method->method;
-       return mn->header->gen_params != NULL;
+       return method->method->signature->generic_param_count != 0;
+}
+
+static gboolean
+ves_icall_MonoMethod_get_Mono_IsInflatedMethod (MonoReflectionMethod *method)
+{
+       MONO_ARCH_SAVE_REGS;
+
+       if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+           (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
+               return FALSE;
+
+       return method->method->signature->is_inflated;
+}
+
+static gboolean
+ves_icall_MonoMethod_get_IsGenericMethodDefinition (MonoReflectionMethod *method)
+{
+       MONO_ARCH_SAVE_REGS;
+
+       if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+           (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
+               return FALSE;
+
+       return method->method->signature->generic_param_count != 0;
 }
 
 static MonoArray*
 ves_icall_MonoMethod_GetGenericArguments (MonoReflectionMethod *method)
 {
-       MonoMethodNormal *mn;
        MonoArray *res;
+       MonoDomain *domain;
+       MonoMethodNormal *mn;
        int count, i;
        MONO_ARCH_SAVE_REGS;
 
+       domain = mono_object_domain (method);
+
        if ((method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
            (method->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
-               return mono_array_new (mono_object_domain (method), mono_defaults.monotype_class, 0);
+               return mono_array_new (domain, mono_defaults.monotype_class, 0);
+
+       if (method->method->signature->is_inflated) {
+               MonoMethodInflated *imethod = (MonoMethodInflated *) method->method;
+               MonoGenericMethod *gmethod = imethod->context->gmethod;
+
+               if (gmethod) {
+                       count = gmethod->mtype_argc;
+                       res = mono_array_new (domain, mono_defaults.monotype_class, count);
+
+                       for (i = 0; i < count; i++) {
+                               MonoType *t = gmethod->mtype_argv [i];
+                               mono_array_set (
+                                       res, gpointer, i, mono_type_get_object (domain, t));
+                       }
+
+                       return res;
+               }
+       }
 
        mn = (MonoMethodNormal *) method->method;
        count = method->method->signature->generic_param_count;
-       res = mono_array_new (mono_object_domain (method), mono_defaults.monotype_class, count);
+       res = mono_array_new (domain, mono_defaults.monotype_class, count);
 
        for (i = 0; i < count; i++) {
                MonoGenericParam *param = &mn->header->gen_params [i];
-               MonoClass *pklass = mono_class_from_generic_parameter (param, method->method->klass->image, TRUE);
-               mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (method), &pklass->byval_arg));
+               MonoClass *pklass = mono_class_from_generic_parameter (
+                       param, method->method->klass->image, TRUE);
+               mono_array_set (res, gpointer, i,
+                               mono_type_get_object (domain, &pklass->byval_arg));
        }
 
        return res;
@@ -2344,7 +2442,7 @@ handle_parent:
                }
                g_free (utf8_name);
                
-               return mono_field_get_object (domain, klass, field);
+               return mono_field_get_object (domain, startklass, field);
        }
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
@@ -2357,8 +2455,7 @@ ves_icall_Type_GetFields_internal (MonoReflectionType *type, guint32 bflags, Mon
 {
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
-       MonoClass *startklass, *klass;
-       /* MonoClass *refklass; bug 54518 */
+       MonoClass *startklass, *klass, *refklass;
        MonoArray *res;
        MonoObject *member;
        int i, len, match;
@@ -2368,9 +2465,7 @@ ves_icall_Type_GetFields_internal (MonoReflectionType *type, guint32 bflags, Mon
 
        domain = ((MonoObject *)type)->vtable->domain;
        klass = startklass = mono_class_from_mono_type (type->type);
-       /*bug 54518
        refklass = mono_class_from_mono_type (reftype->type);
-        */
 
 handle_parent: 
        for (i = 0; i < klass->field.count; ++i) {
@@ -2399,7 +2494,7 @@ handle_parent:
 
                if (!match)
                        continue;
-               member = (MonoObject*)mono_field_get_object (domain, klass, field);
+               member = (MonoObject*)mono_field_get_object (domain, refklass, field);
                l = g_slist_prepend (l, member);
        }
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
@@ -2419,10 +2514,7 @@ ves_icall_Type_GetMethodsByName (MonoReflectionType *type, MonoString *name, gui
 {
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
-       MonoClass *startklass, *klass;
-       /* bug 54518
-       MonoClass *refklass;
-       */
+       MonoClass *startklass, *klass, *refklass;
        MonoArray *res;
        MonoMethod *method;
        MonoObject *member;
@@ -2435,9 +2527,7 @@ ves_icall_Type_GetMethodsByName (MonoReflectionType *type, MonoString *name, gui
 
        domain = ((MonoObject *)type)->vtable->domain;
        klass = startklass = mono_class_from_mono_type (type->type);
-       /* bug 54518
        refklass = mono_class_from_mono_type (reftype->type);
-       */
        len = 0;
        if (name != NULL) {
                mname = mono_string_to_utf8 (name);
@@ -2478,10 +2568,13 @@ handle_parent:
                }
                
                match = 0;
-               if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
-                       continue;
-               g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
-               member = (MonoObject*)mono_method_get_object (domain, method, startklass);
+               if (method->slot != -1) {
+                       if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
+                               continue;
+                       g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), method);
+               }
+               
+               member = (MonoObject*)mono_method_get_object (domain, method, refklass);
                
                l = g_slist_prepend (l, member);
                len++;
@@ -2508,8 +2601,7 @@ ves_icall_Type_GetConstructors_internal (MonoReflectionType *type, guint32 bflag
        MonoDomain *domain; 
        GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_ConstructorInfo;
-       MonoClass *startklass, *klass;
-       /* MonoClass *refklass; bug 54518 */
+       MonoClass *startklass, *klass, *refklass;
        MonoArray *res;
        MonoMethod *method;
        MonoObject *member;
@@ -2519,9 +2611,7 @@ ves_icall_Type_GetConstructors_internal (MonoReflectionType *type, guint32 bflag
 
        domain = ((MonoObject *)type)->vtable->domain;
        klass = startklass = mono_class_from_mono_type (type->type);
-       /* bug 54581
        refklass = mono_class_from_mono_type (reftype->type);
-       */
 
        for (i = 0; i < klass->method.count; ++i) {
                match = 0;
@@ -2549,7 +2639,7 @@ ves_icall_Type_GetConstructors_internal (MonoReflectionType *type, guint32 bflag
 
                if (!match)
                        continue;
-               member = (MonoObject*)mono_method_get_object (domain, method, startklass);
+               member = (MonoObject*)mono_method_get_object (domain, method, refklass);
                        
                l = g_slist_prepend (l, member);
        }
@@ -2573,7 +2663,6 @@ ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString *name,
        GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_PropertyInfo;
        MonoClass *startklass, *klass;
-       /* MonoClass *refklass; bug 54518 */
        MonoArray *res;
        MonoMethod *method;
        MonoProperty *prop;
@@ -2587,9 +2676,6 @@ ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString *name,
 
        domain = ((MonoObject *)type)->vtable->domain;
        klass = startklass = mono_class_from_mono_type (type->type);
-       /*
-       refklass = mono_class_from_mono_type (reftype->type);
-       */
        if (name != NULL) {
                propname = mono_string_to_utf8 (name);
                compare_func = (ignore_case) ? g_strcasecmp : strcmp;
@@ -2630,11 +2716,13 @@ handle_parent:
                                continue;
                }
                
-               if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
-                       continue;
-               g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), prop);
+               if (method->slot != -1) {
+                       if (g_hash_table_lookup (method_slots, GUINT_TO_POINTER (method->slot)))
+                               continue;
+                       g_hash_table_insert (method_slots, GUINT_TO_POINTER (method->slot), prop);
+               }
 
-               l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
+               l = g_slist_prepend (l, mono_property_get_object (domain, startklass, prop));
                len++;
        }
        if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
@@ -2660,7 +2748,7 @@ static MonoReflectionEvent *
 ves_icall_MonoType_GetEvent (MonoReflectionType *type, MonoString *name, guint32 bflags)
 {
        MonoDomain *domain;
-       MonoClass *klass;
+       MonoClass *klass, *startklass;
        gint i;
        MonoEvent *event;
        MonoMethod *method;
@@ -2669,7 +2757,7 @@ ves_icall_MonoType_GetEvent (MonoReflectionType *type, MonoString *name, guint32
        MONO_ARCH_SAVE_REGS;
 
        event_name = mono_string_to_utf8 (name);
-       klass = mono_class_from_mono_type (type->type);
+       klass = startklass = mono_class_from_mono_type (type->type);
        domain = mono_object_domain (type);
 
 handle_parent: 
@@ -2691,7 +2779,7 @@ handle_parent:
                }
 
                g_free (event_name);
-               return mono_event_get_object (domain, klass, event);
+               return mono_event_get_object (domain, startklass, event);
        }
 
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
@@ -2708,7 +2796,6 @@ ves_icall_Type_GetEvents_internal (MonoReflectionType *type, guint32 bflags, Mon
        GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_EventInfo;
        MonoClass *startklass, *klass;
-       /* MonoClass *refklass; bug 54518 */
        MonoArray *res;
        MonoMethod *method;
        MonoEvent *event;
@@ -2718,9 +2805,6 @@ ves_icall_Type_GetEvents_internal (MonoReflectionType *type, guint32 bflags, Mon
 
        domain = ((MonoObject *)type)->vtable->domain;
        klass = startklass = mono_class_from_mono_type (type->type);
-       /*
-       refklass = mono_class_from_mono_type (reftype->type);
-       */
 
 handle_parent: 
        for (i = 0; i < klass->event.count; ++i) {
@@ -4041,7 +4125,7 @@ ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, Mo
 }
 
 static MonoObject *
-ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
+ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this, MonoString *class_name)
 {
        MonoDomain *domain = mono_object_domain (this); 
        MonoObject *res;
@@ -4059,18 +4143,19 @@ ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
        type = ((MonoReflectionType *)rp->class_to_proxy)->type;
        klass = mono_class_from_mono_type (type);
 
-       if (klass->flags & TYPE_ATTRIBUTE_INTERFACE)
-               tp->klass = mono_defaults.marshalbyrefobject_class;
-       else
-               tp->klass = klass;
-       
        tp->custom_type_info = (mono_object_isinst (this, mono_defaults.iremotingtypeinfo_class) != NULL);
-
-       res->vtable = mono_class_proxy_vtable (domain, klass);
+       tp->remote_class = mono_remote_class (domain, class_name, klass);
+       res->vtable = tp->remote_class->vtable;
 
        return res;
 }
 
+static MonoReflectionType *
+ves_icall_Remoting_RealProxy_InternalGetProxyType (MonoTransparentProxy *tp)
+{
+       return mono_type_get_object (mono_object_domain (tp), &tp->remote_class->proxy_class->byval_arg);
+}
+
 /* System.Environment */
 
 static MonoString *
@@ -4484,13 +4569,16 @@ ves_icall_MonoMethod_get_base_definition (MonoReflectionMethod *m)
        MONO_ARCH_SAVE_REGS;
 
        if (!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
-            method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ||
-            method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
+           MONO_CLASS_IS_INTERFACE (method->klass) ||
+           method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
                return m;
 
        if (method->klass == NULL || (klass = method->klass->parent) == NULL)
                return m;
 
+       if (klass->generic_inst)
+               klass = mono_class_from_mono_type (klass->generic_inst->generic_type);
+
        while (result == NULL && klass != NULL && (klass->vtable_size > method->slot))
        {
                result = klass->vtable [method->slot];
@@ -4646,6 +4734,21 @@ ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionType
                prelink_method (klass->methods [i]);
 }
 
+static void
+ves_icall_System_Char_GetDataTablePointers (guint8 **category_data, guint8 **numeric_data,
+               gdouble **numeric_data_values, guint16 **to_lower_data_low,
+               guint16 **to_lower_data_high, guint16 **to_upper_data_low,
+               guint16 **to_upper_data_high)
+{
+       *category_data = CategoryData;
+       *numeric_data = NumericData;
+       *numeric_data_values = NumericDataValues;
+       *to_lower_data_low = ToLowerDataLow;
+       *to_lower_data_high = ToLowerDataHigh;
+       *to_upper_data_low = ToUpperDataLow;
+       *to_upper_data_high = ToUpperDataHigh;
+}
+
 /* icall map */
 typedef struct {
        const char *method;
@@ -4717,18 +4820,7 @@ static const IcallEntry buffer_icalls [] = {
 };
 
 static const IcallEntry char_icalls [] = {
-       {"GetNumericValue", ves_icall_System_Char_GetNumericValue},
-       {"GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory},
-       {"IsControl", ves_icall_System_Char_IsControl},
-       {"IsLetter", ves_icall_System_Char_IsLetter},
-       {"IsLower", ves_icall_System_Char_IsLower},
-       {"IsNumber", ves_icall_System_Char_IsNumber},
-       {"IsPunctuation", ves_icall_System_Char_IsPunctuation},
-       {"IsSurrogate", ves_icall_System_Char_IsSurrogate},
-       {"IsSymbol", ves_icall_System_Char_IsSymbol},
-       {"IsUpper", ves_icall_System_Char_IsUpper},
-       {"ToLower", ves_icall_System_Char_ToLower},
-       {"ToUpper", ves_icall_System_Char_ToUpper}
+       {"GetDataTablePointers", ves_icall_System_Char_GetDataTablePointers},
 };
 
 static const IcallEntry defaultconf_icalls [] = {
@@ -4780,6 +4872,7 @@ static const IcallEntry process_icalls [] = {
        {"GetProcess_internal(int)", ves_icall_System_Diagnostics_Process_GetProcess_internal},
        {"GetProcesses_internal()", ves_icall_System_Diagnostics_Process_GetProcesses_internal},
        {"GetWorkingSet_internal(intptr,int&,int&)", ves_icall_System_Diagnostics_Process_GetWorkingSet_internal},
+       {"Kill_internal", ves_icall_System_Diagnostics_Process_Kill_internal},
        {"ProcessName_internal(intptr)", ves_icall_System_Diagnostics_Process_ProcessName_internal},
        {"Process_free_internal(intptr)", ves_icall_System_Diagnostics_Process_Process_free_internal},
        {"SetWorkingSet_internal(intptr,int,int,bool)", ves_icall_System_Diagnostics_Process_SetWorkingSet_internal},
@@ -4810,13 +4903,22 @@ static const IcallEntry environment_icalls [] = {
        {"get_NewLine", ves_icall_System_Environment_get_NewLine},
        {"get_Platform", ves_icall_System_Environment_get_Platform},
        {"get_TickCount", ves_icall_System_Environment_get_TickCount},
+       {"get_UserName", ves_icall_System_Environment_get_UserName},
        {"internalGetGacPath", ves_icall_System_Environment_GetGacPath},
        {"set_ExitCode", mono_environment_exitcode_set}
 };
 
 static const IcallEntry cultureinfo_icalls [] = {
        {"construct_compareinfo(object,string)", ves_icall_System_Globalization_CompareInfo_construct_compareinfo},
-       {"construct_internal_locale(string)", ves_icall_System_Globalization_CultureInfo_construct_internal_locale}
+       {"construct_datetime_format", ves_icall_System_Globalization_CultureInfo_construct_datetime_format},
+       {"construct_internal_locale(string)", ves_icall_System_Globalization_CultureInfo_construct_internal_locale},
+       {"construct_internal_locale_from_current_locale", ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_current_locale},
+       {"construct_internal_locale_from_lcid", ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_lcid},
+       {"construct_internal_locale_from_name", ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name},
+       {"construct_internal_locale_from_specific_name", ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_specific_name},
+       {"construct_number_format", ves_icall_System_Globalization_CultureInfo_construct_number_format},
+       {"internal_get_cultures", ves_icall_System_Globalization_CultureInfo_internal_get_cultures},
+       {"internal_is_lcid_neutral", ves_icall_System_Globalization_CultureInfo_internal_is_lcid_neutral}
 };
 
 static const IcallEntry compareinfo_icalls [] = {
@@ -4853,6 +4955,8 @@ static const IcallEntry path_icalls [] = {
 };
 
 static const IcallEntry monoio_icalls [] = {
+       {"BeginRead", ves_icall_System_IO_MonoIO_BeginRead },
+       {"BeginWrite", ves_icall_System_IO_MonoIO_BeginWrite },
        {"Close(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Close},
        {"CopyFile(string,string,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CopyFile},
        {"CreateDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CreateDirectory},
@@ -4867,9 +4971,10 @@ static const IcallEntry monoio_icalls [] = {
        {"GetFileStat(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat},
        {"GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType},
        {"GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength},
+       {"GetSupportsAsync", ves_icall_System_IO_MonoIO_GetSupportsAsync},
        {"GetTempPath(string&)", ves_icall_System_IO_MonoIO_GetTempPath},
        {"MoveFile(string,string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile},
-       {"Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open},
+       {"Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open},
        {"Read(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Read},
        {"RemoveDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_RemoveDirectory},
        {"Seek(intptr,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek},
@@ -4929,6 +5034,7 @@ static const IcallEntry monotype_icalls [] = {
        {"GetEvents_internal", ves_icall_Type_GetEvents_internal},
        {"GetField", ves_icall_Type_GetField},
        {"GetFields_internal", ves_icall_Type_GetFields_internal},
+       {"GetGenericArguments", ves_icall_MonoType_GetGenericArguments},
        {"GetInterfaces", ves_icall_Type_GetInterfaces},
        {"GetMethodsByName", ves_icall_Type_GetMethodsByName},
        {"GetNestedType", ves_icall_Type_GetNestedType},
@@ -4987,11 +5093,6 @@ static const IcallEntry methodbase_icalls [] = {
        {"GetCurrentMethod", ves_icall_GetCurrentMethod}
 };
 
-static const IcallEntry methodinfo_icalls [] = {
-       {"BindGenericParameters", mono_reflection_bind_generic_method_parameters},
-       {"get_IsGenericMethodDefinition", ves_icall_MethodInfo_get_IsGenericMethodDefinition}
-};
-
 static const IcallEntry module_icalls [] = {
        {"Close", ves_icall_System_Reflection_Module_Close},
        {"GetGlobalType", ves_icall_System_Reflection_Module_GetGlobalType},
@@ -5000,7 +5101,9 @@ static const IcallEntry module_icalls [] = {
 };
 
 static const IcallEntry monocmethod_icalls [] = {
-       {"InternalInvoke", ves_icall_InternalInvoke}
+       {"GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition},
+       {"InternalInvoke", ves_icall_InternalInvoke},
+       {"get_Mono_IsInflatedMethod", ves_icall_MonoMethod_get_Mono_IsInflatedMethod}
 };
 
 static const IcallEntry monoeventinfo_icalls [] = {
@@ -5015,6 +5118,7 @@ static const IcallEntry monofield_icalls [] = {
 
 static const IcallEntry monogenericinst_icalls [] = {
        {"GetConstructors_internal", ves_icall_MonoGenericInst_GetConstructors},
+       {"GetEvents_internal", ves_icall_MonoGenericInst_GetEvents},
        {"GetFields_internal", ves_icall_MonoGenericInst_GetFields},
        {"GetInterfaces_internal", ves_icall_MonoGenericInst_GetInterfaces},
        {"GetMethods_internal", ves_icall_MonoGenericInst_GetMethods},
@@ -5023,13 +5127,18 @@ static const IcallEntry monogenericinst_icalls [] = {
        {"initialize", mono_reflection_generic_inst_initialize}
 };
 
-static const IcallEntry monogenericparam_icalls [] = {
-       {"initialize", ves_icall_MonoGenericParam_initialize}
+static const IcallEntry generictypeparambuilder_icalls [] = {
+       {"initialize", mono_reflection_initialize_generic_parameter}
 };
 
 static const IcallEntry monomethod_icalls [] = {
+       {"BindGenericParameters", mono_reflection_bind_generic_method_parameters},
        {"GetGenericArguments", ves_icall_MonoMethod_GetGenericArguments},
+       {"GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition},
        {"InternalInvoke", ves_icall_InternalInvoke},
+       {"get_HasGenericParameters", ves_icall_MonoMethod_get_HasGenericParameters},
+       {"get_IsGenericMethodDefinition", ves_icall_MonoMethod_get_IsGenericMethodDefinition},
+       {"get_Mono_IsInflatedMethod", ves_icall_MonoMethod_get_Mono_IsInflatedMethod},
        {"get_base_definition", ves_icall_MonoMethod_get_base_definition}
 };
 
@@ -5096,7 +5205,7 @@ static const IcallEntry dynamicmethod_icalls [] = {
 };
 
 static const IcallEntry methodbuilder_icalls [] = {
-       {"define_generic_parameter", ves_icall_MethodBuilder_define_generic_parameter}
+       {"BindGenericParameters", mono_reflection_bind_generic_method_parameters}
 };
 
 static const IcallEntry modulebuilder_icalls [] = {
@@ -5116,8 +5225,8 @@ static const IcallEntry signaturehelper_icalls [] = {
 static const IcallEntry typebuilder_icalls [] = {
        {"create_internal_class", mono_reflection_create_internal_class},
        {"create_runtime_class", mono_reflection_create_runtime_class},
-       {"define_generic_parameter", ves_icall_TypeBuilder_define_generic_parameter},
        {"get_IsGenericParameter", ves_icall_TypeBuilder_get_IsGenericParameter},
+       {"get_event_info", mono_reflection_event_builder_get_event_info},
        {"setup_generic_class", mono_reflection_setup_generic_class},
        {"setup_internal_class", mono_reflection_setup_internal_class}
 };
@@ -5185,6 +5294,7 @@ static const IcallEntry monomethodmessage_icalls [] = {
 };
        
 static const IcallEntry realproxy_icalls [] = {
+       {"InternalGetProxyType", ves_icall_Remoting_RealProxy_InternalGetProxyType},
        {"InternalGetTransparentProxy", ves_icall_Remoting_RealProxy_GetTransparentProxy}
 };
 
@@ -5212,30 +5322,21 @@ static const IcallEntry string_icalls [] = {
        {".ctor(sbyte*,int,int,System.Text.Encoding)", ves_icall_System_String_ctor_encoding},
        {"GetHashCode", ves_icall_System_String_GetHashCode},
        {"InternalAllocateStr", ves_icall_System_String_InternalAllocateStr},
-       {"InternalCompare(string,int,string,int,int,int)", ves_icall_System_String_InternalCompareStr_N},
        {"InternalCopyTo", ves_icall_System_String_InternalCopyTo},
-       {"InternalEquals", ves_icall_System_String_InternalEquals},
-       {"InternalIndexOf(char,int,int)", ves_icall_System_String_InternalIndexOf_Char},
-       {"InternalIndexOf(string,int,int)", ves_icall_System_String_InternalIndexOf_Str},
        {"InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny},
        {"InternalInsert", ves_icall_System_String_InternalInsert},
        {"InternalIntern", ves_icall_System_String_InternalIntern},
        {"InternalIsInterned", ves_icall_System_String_InternalIsInterned},
        {"InternalJoin", ves_icall_System_String_InternalJoin},
-       {"InternalLastIndexOf(char,int,int)", ves_icall_System_String_InternalLastIndexOf_Char},
-       {"InternalLastIndexOf(string,int,int)", ves_icall_System_String_InternalLastIndexOf_Str},
        {"InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny},
        {"InternalPad", ves_icall_System_String_InternalPad},
        {"InternalRemove", ves_icall_System_String_InternalRemove},
        {"InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char},
-       {"InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str},
        {"InternalReplace(string,string,System.Globalization.CompareInfo)", ves_icall_System_String_InternalReplace_Str_Comp},
        {"InternalSplit", ves_icall_System_String_InternalSplit},
        {"InternalStrcpy(string,int,string)", ves_icall_System_String_InternalStrcpy_Str},
        {"InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN},
-       {"InternalToLower", ves_icall_System_String_InternalToLower},
        {"InternalToLower(System.Globalization.CultureInfo)", ves_icall_System_String_InternalToLower_Comp},
-       {"InternalToUpper", ves_icall_System_String_InternalToUpper},
        {"InternalToUpper(System.Globalization.CultureInfo)", ves_icall_System_String_InternalToUpper_Comp},
        {"InternalTrim", ves_icall_System_String_InternalTrim},
        {"get_Chars", ves_icall_System_String_get_Chars}
@@ -5324,6 +5425,7 @@ static const IcallEntry thread_icalls [] = {
 };
 
 static const IcallEntry threadpool_icalls [] = {
+       {"BindHandleInternal", ves_icall_System_Threading_ThreadPool_BindHandle},
        {"GetAvailableThreads", ves_icall_System_Threading_ThreadPool_GetAvailableThreads},
        {"GetMaxThreads", ves_icall_System_Threading_ThreadPool_GetMaxThreads}
 };
@@ -5337,7 +5439,6 @@ static const IcallEntry waithandle_icalls [] = {
 static const IcallEntry type_icalls [] = {
        {"BindGenericParameters", ves_icall_Type_BindGenericParameters},
        {"Equals", ves_icall_type_Equals},
-       {"GetGenericArguments", ves_icall_Type_GetGenericArguments},
        {"GetGenericParameterPosition", ves_icall_Type_GetGenericParameterPosition},
        {"GetGenericTypeDefinition_impl", ves_icall_Type_GetGenericTypeDefinition_impl},
        {"GetInterfaceMapData", ves_icall_Type_GetInterfaceMapData},
@@ -5376,7 +5477,7 @@ static const IcallEntry array_icalls [] = {
 
 /* keep the entries all sorted */
 static const IcallMap icall_entries [] = {
-       {"System.Activation", activator_icalls, G_N_ELEMENTS (activator_icalls)},
+       {"System.Activator", activator_icalls, G_N_ELEMENTS (activator_icalls)},
        {"System.AppDomain", appdomain_icalls, G_N_ELEMENTS (appdomain_icalls)},
        {"System.AppDomainSetup", appdomainsetup_icalls, G_N_ELEMENTS (appdomainsetup_icalls)},
        {"System.ArgIterator", argiterator_icalls, G_N_ELEMENTS (argiterator_icalls)},
@@ -5413,19 +5514,18 @@ static const IcallMap icall_entries [] = {
        {"System.Reflection.Emit.AssemblyBuilder", assemblybuilder_icalls, G_N_ELEMENTS (assemblybuilder_icalls)},
        {"System.Reflection.Emit.CustomAttributeBuilder", customattrbuilder_icalls, G_N_ELEMENTS (customattrbuilder_icalls)},
        {"System.Reflection.Emit.DynamicMethod", dynamicmethod_icalls, G_N_ELEMENTS (dynamicmethod_icalls)},
+       {"System.Reflection.Emit.GenericTypeParameterBuilder", generictypeparambuilder_icalls, G_N_ELEMENTS (generictypeparambuilder_icalls)},
        {"System.Reflection.Emit.MethodBuilder", methodbuilder_icalls, G_N_ELEMENTS (methodbuilder_icalls)},
        {"System.Reflection.Emit.ModuleBuilder", modulebuilder_icalls, G_N_ELEMENTS (modulebuilder_icalls)},
        {"System.Reflection.Emit.SignatureHelper", signaturehelper_icalls, G_N_ELEMENTS (signaturehelper_icalls)},
        {"System.Reflection.Emit.TypeBuilder", typebuilder_icalls, G_N_ELEMENTS (typebuilder_icalls)},
        {"System.Reflection.FieldInfo", fieldinfo_icalls, G_N_ELEMENTS (fieldinfo_icalls)},
        {"System.Reflection.MethodBase", methodbase_icalls, G_N_ELEMENTS (methodbase_icalls)},
-       {"System.Reflection.MethodInfo", methodinfo_icalls, G_N_ELEMENTS (methodinfo_icalls)},
        {"System.Reflection.Module", module_icalls, G_N_ELEMENTS (module_icalls)},
        {"System.Reflection.MonoCMethod", monocmethod_icalls, G_N_ELEMENTS (monocmethod_icalls)},
        {"System.Reflection.MonoEventInfo", monoeventinfo_icalls, G_N_ELEMENTS (monoeventinfo_icalls)},
        {"System.Reflection.MonoField", monofield_icalls, G_N_ELEMENTS (monofield_icalls)},
        {"System.Reflection.MonoGenericInst", monogenericinst_icalls, G_N_ELEMENTS (monogenericinst_icalls)},
-       {"System.Reflection.MonoGenericParam", monogenericparam_icalls, G_N_ELEMENTS (monogenericparam_icalls)},
        {"System.Reflection.MonoMethod", monomethod_icalls, G_N_ELEMENTS (monomethod_icalls)},
        {"System.Reflection.MonoMethodInfo", monomethodinfo_icalls, G_N_ELEMENTS (monomethodinfo_icalls)},
        {"System.Reflection.MonoPropertyInfo", monopropertyinfo_icalls, G_N_ELEMENTS (monopropertyinfo_icalls)},