Fri Mar 29 16:09:54 CET 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / icall.c
index c1f28b8a93bec61c5d6318eee2a59d9c2810fa60..1488817681967e12803924967faf154128d9fc58 100644 (file)
@@ -14,6 +14,9 @@
 #include <string.h>
 #include <sys/time.h>
 #include <unistd.h>
+#if defined (PLATFORM_WIN32)
+#include <stdlib.h>
+#endif
 
 #include <mono/metadata/object.h>
 #include <mono/metadata/threads.h>
@@ -28,6 +31,8 @@
 #include <mono/metadata/unicode.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/rand.h>
+#include <mono/metadata/sysmath.h>
+#include <mono/metadata/debug-symfile.h>
 #include <mono/io-layer/io-layer.h>
 #include "decimal.h"
 
@@ -355,17 +360,11 @@ ves_icall_System_Array_SetValue (MonoObject *this, MonoObject *value,
                                 MonoObject *idxs)
 {
        MonoArray *ao, *io, *vo;
-       MonoClass *ac, *ic, *vc;
+       MonoClass *ac, *ic;
        gint32 i, pos, *ind;
 
        MONO_CHECK_ARG_NULL (idxs);
 
-       vo = (MonoArray *)value;
-       if (vo)
-               vc = (MonoClass *)vo->obj.vtable->klass;
-       else
-               vc = NULL;
-
        io = (MonoArray *)idxs;
        ic = (MonoClass *)io->obj.vtable->klass;
        
@@ -598,7 +597,7 @@ static MonoReflectionType*
 ves_icall_type_from_name (MonoString *name)
 {
        MonoDomain *domain = mono_domain_get (); 
-       MonoClass *klass;
+       MonoType *type;
        MonoImage *image;
        MonoTypeNameParse info;
        gchar *str;
@@ -607,6 +606,7 @@ ves_icall_type_from_name (MonoString *name)
        /*g_print ("requested type %s\n", str);*/
        if (!mono_reflection_parse_type (str, &info)) {
                g_free (str);
+               g_list_free (info.modifiers);
                return NULL;
        }
 
@@ -615,40 +615,19 @@ ves_icall_type_from_name (MonoString *name)
                /* do we need to load if it's not already loaded? */
                if (!image) {
                        g_free (str);
+                       g_list_free (info.modifiers);
                        return NULL;
                }
        } else
                image = mono_defaults.corlib;
-       if (info.nest_name) {
-               klass = mono_class_from_name (image, info.nest_name_space, info.nest_name);
-               if (klass) {
-                       GList *nested;
-                       mono_class_init (klass);
-                       nested = klass->nested_classes;
-                       while (nested) {
-                               klass = nested->data;
-                               if (strcmp (klass->name, info.nest_name) == 0 &&
-                                               strcmp (klass->name_space, info.nest_name_space) == 0)
-                                       break;
-                               klass = NULL;
-                       }
-               }
-       } else {
-               klass = mono_class_from_name (image, info.name_space, info.name);
-       }
+
+       type = mono_reflection_get_type (image, &info, FALSE);
        g_free (str);
-       if (!klass)
+       g_list_free (info.modifiers);
+       if (!type)
                return NULL;
-       mono_class_init (klass);
-       if (info.rank) {
-               klass = mono_array_class_get (&klass->byval_arg, info.rank);
-               mono_class_init (klass);
-       }
-       
-       if (info.isbyref || info.ispointer) /* hack */
-               return mono_type_get_object (domain, &klass->this_arg);
-       else
-               return mono_type_get_object (domain, &klass->byval_arg);
+       /*g_print ("got it\n");*/
+       return mono_type_get_object (domain, type);
 }
 
 static MonoReflectionType*
@@ -847,7 +826,7 @@ ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
        info->attrs = class->flags;
        info->rank = class->rank;
        info->assembly = NULL; /* FIXME */
-       if (class->enumtype)
+       if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
                info->etype = mono_type_get_object (domain, class->enum_basetype);
        else if (class->element_class)
                info->etype = mono_type_get_object (domain, &class->element_class->byval_arg);
@@ -859,15 +838,86 @@ ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
        info->isprimitive = (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8);
 }
 
-static MonoObject*
-ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) {
-       //MonoMethodSignature *sig = method->method->signature;
+static MonoObject *
+ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) 
+{
+       MonoMethodSignature *sig = method->method->signature;
+       gpointer *pa;
+       int i;
+
+       pa = alloca (sizeof (gpointer) * params->bounds->length);
 
-       /*
-        * Do we need to copy the values so that the called method can't change them?
-        */
+       for (i = 0; i < params->bounds->length; i++) {
+               if (sig->params [i]->byref) {
+                       /* nothing to do */
+               }
 
-       return NULL;
+               switch (sig->params [i]->type) {
+               case MONO_TYPE_U1:
+               case MONO_TYPE_I1:
+               case MONO_TYPE_BOOLEAN:
+               case MONO_TYPE_U2:
+               case MONO_TYPE_I2:
+               case MONO_TYPE_CHAR:
+               case MONO_TYPE_U:
+               case MONO_TYPE_I:
+               case MONO_TYPE_U4:
+               case MONO_TYPE_I4:
+               case MONO_TYPE_U8:
+               case MONO_TYPE_I8:
+               case MONO_TYPE_VALUETYPE:
+                       pa [i] = (char *)(((gpointer *)params->vector)[i]) + sizeof (MonoObject);
+                       break;
+               case MONO_TYPE_STRING:
+                       pa [i] = (char *)(((gpointer *)params->vector)[i]);
+                       break;
+               default:
+                       g_error ("type 0x%x not handled in invoke", sig->params [i]->type);
+               }
+       }
+
+       if (!strcmp (method->method->name, ".ctor")) {
+               this = mono_object_new (mono_domain_get (), method->method->klass);
+               mono_runtime_invoke (method->method, this, pa);
+               return this;
+       } else
+               return mono_runtime_invoke (method->method, this, pa);
+}
+
+static MonoObject *
+ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs) 
+{
+       MonoDomain *domain = mono_domain_get (); 
+       MonoMethodSignature *sig = method->method->signature;
+       MonoArray *out_args;
+       MonoObject *result;
+       int i, j, outarg_count = 0;
+
+       for (i = 0; i < params->bounds->length; i++) {
+               if (sig->params [i]->byref) 
+                       outarg_count++;
+       }
+
+       out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
+       
+       for (i = 0, j = 0; i < params->bounds->length; i++) {
+               if (sig->params [i]->byref) {
+                       gpointer arg;
+                       arg = mono_array_get (params, gpointer, i);
+                       mono_array_set (out_args, gpointer, j, arg);
+                       j++;
+               }
+       }
+
+       /* fixme: handle constructors? */
+       if (!strcmp (method->method->name, ".ctor"))
+               g_assert_not_reached ();
+
+       result = ves_icall_InternalInvoke (method, this, params);
+
+       *outArgs = out_args;
+
+       return result;
 }
 
 static MonoObject *
@@ -1133,7 +1183,7 @@ handle_parent:
                        mono_defaults.corlib, "System.Reflection", "FieldInfo");
        res = mono_array_new (domain, System_Reflection_FieldInfo, len);
        i = 0;
-       tmp = l;
+       tmp = g_slist_reverse (l);
        for (; tmp; tmp = tmp->next, ++i)
                mono_array_set (res, gpointer, i, tmp->data);
        g_slist_free (l);
@@ -1401,78 +1451,34 @@ static guint32 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Erro
 }
 
 static MonoReflectionType*
-ves_icall_System_Reflection_Assembly_GetType (MonoReflectionAssembly *assembly, MonoString *type, MonoBoolean throwOnError, MonoBoolean ignoreCase)
+ves_icall_System_Reflection_Assembly_GetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
 {
        MonoDomain *domain = mono_domain_get (); 
-       /* FIXME : use ignoreCase */
-       gchar *name, *namespace, *str;
-       char *byref, *isarray, *ispointer, *isa2;
-       guint rank, recarray = 0;
-       MonoClass *klass;
+       gchar *str;
+       MonoType *type;
+       MonoTypeNameParse info;
 
-       str = namespace = mono_string_to_utf8 (type);
+       str = mono_string_to_utf8 (name);
        /*g_print ("requested type %s in %s\n", str, assembly->assembly->name);*/
-
-       name = strrchr (str, '.');
-       byref = strrchr (str, '&');
-       ispointer = strrchr (str, '*');
-       if (byref)
-               *byref = 0;
-       if (ispointer)
-               *ispointer = 0;
-       isarray = strrchr (str, '[');
-       if (isarray) {
-               rank = 1;
-               *isarray = 0;
-               while (*isarray) {
-                       if (*isarray == ',')
-                               rank++;
-                       if (*isarray == ']')
-                               break;
-                       ++isarray;
-               }
-       }
-
-       isa2 = strrchr (str, '[');
-       if (isa2 && *isa2 == '[') {
-               /* g_print ("recarray for: type name search: %s.%s\n", namespace, name); */
-               recarray = 1;
-               *isa2 = 0;
-       }
-
-       if (name) {
-               *name = 0;
-               ++name;
-       } else {
-               namespace = "";
-               name = str;
+       if (!mono_reflection_parse_type (str, &info)) {
+               g_free (str);
+               g_list_free (info.modifiers);
+               if (throwOnError) /* uhm: this is a parse error, though... */
+                       mono_raise_exception (mono_get_exception_type_load ());
+               return NULL;
        }
 
-       /*g_print ("type name search: %s.%s\n", namespace, name);*/
-       klass = mono_class_from_name (assembly->assembly->image, namespace, name);
+       type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
        g_free (str);
-       if (!klass) {
+       g_list_free (info.modifiers);
+       if (!type) {
                if (throwOnError)
                        mono_raise_exception (mono_get_exception_type_load ());
                return NULL;
        }
-       if (!klass->inited)
-               mono_class_init (klass);
-
-       if (isarray) {
-               klass = mono_array_class_get (&klass->byval_arg, rank);
-               mono_class_init (klass);
-               if (recarray) {
-                       klass = mono_array_class_get (&klass->byval_arg, rank);
-                       mono_class_init (klass);
-               }
-               /*g_print ("got array class %s [%d] (0x%x)\n", klass->element_class->name, klass->rank, klass->this_arg.type);*/
-       }
+       /*g_print ("got it\n");*/
+       return mono_type_get_object (domain, type);
 
-       if (byref || ispointer)
-               return mono_type_get_object (domain, &klass->this_arg);
-       else
-               return mono_type_get_object (domain, &klass->byval_arg);
 }
 
 static MonoString *
@@ -1538,27 +1544,54 @@ ves_icall_System_MonoType_assQualifiedName (MonoReflectionType *object)
 }
 
 static MonoReflectionType*
-ves_icall_ModuleBuilder_create_modified_type (MonoReflectionType *tb, gint32 arrayrank, MonoBoolean isbyref)
+ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
 {
        MonoClass *klass;
-
-       if (arrayrank)
-               klass = mono_array_class_get (tb->type, arrayrank);
-       else
-               klass = mono_class_from_mono_type (tb->type);
-
-       return mono_type_get_object (mono_domain_get (), isbyref? &klass->this_arg: &klass->byval_arg);
-}
-
-static MonoString *
-ves_icall_System_PAL_GetCurrentDirectory (MonoObject *object)
-{
-       MonoDomain *domain = mono_domain_get (); 
-       MonoString *res;
-       gchar *path = g_get_current_dir ();
-       res = mono_string_new (domain, path);
-       g_free (path);
-       return res;
+       int isbyref = 0, rank;
+       char *str = mono_string_to_utf8 (smodifiers);
+       char *p;
+
+       klass = mono_class_from_mono_type (tb->type.type);
+       p = str;
+       /* logic taken from mono_reflection_parse_type(): keep in sync */
+       while (*p) {
+               switch (*p) {
+               case '&':
+                       if (isbyref) /* only one level allowed by the spec */
+                               return NULL;
+                       isbyref = 1;
+                       p++;
+                       return mono_type_get_object (mono_domain_get (), &klass->this_arg);
+                       break;
+               case '*':
+                       klass = mono_ptr_class_get (&klass->byval_arg);
+                       mono_class_init (klass);
+                       p++;
+                       break;
+               case '[':
+                       rank = 1;
+                       p++;
+                       while (*p) {
+                               if (*p == ']')
+                                       break;
+                               if (*p == ',')
+                                       rank++;
+                               else if (*p != '*') /* '*' means unknown lower bound */
+                                       return NULL;
+                               ++p;
+                       }
+                       if (*p != ']')
+                               return NULL;
+                       p++;
+                       klass = mono_array_class_get (&klass->byval_arg, rank);
+                       mono_class_init (klass);
+                       break;
+               default:
+                       break;
+               }
+       }
+       g_free (str);
+       return mono_type_get_object (mono_domain_get (), &klass->byval_arg);
 }
 
 /*
@@ -1669,11 +1702,230 @@ ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data
 
                gmtoff = tt.tm_gmtoff;
        }
-
+#endif
        return 0;
+}
+
+static gpointer
+ves_icall_System_Object_obj_address (MonoObject *this) {
+       return this;
+}
+
+/* System.Buffer */
+
+static gint32 
+ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
+       MonoClass *klass;
+       MonoTypeEnum etype;
+       int length, esize;
+       int i;
+
+       klass = array->obj.vtable->klass;
+       etype = klass->element_class->byval_arg.type;
+       if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
+               return -1;
+
+       length = 0;
+       for (i = 0; i < klass->rank; ++ i)
+               length += array->bounds [i].length;
+
+       esize = mono_array_element_size (klass);
+       return length * esize;
+}
+
+static gint8 
+ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 index) {
+       return mono_array_get (array, gint8, index);
+}
+
+static void 
+ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 index, gint8 value) {
+       mono_array_set (array, gint8, index, value);
+}
+
+static void 
+ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) {
+       char *src_buf, *dest_buf;
+
+       src_buf = (gint8 *)src->vector + src_offset;
+       dest_buf = (gint8 *)dest->vector + dest_offset;
+
+       memcpy (dest_buf, src_buf, count);
+}
+
+static MonoObject *
+ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
+{
+       MonoDomain *domain = mono_domain_get (); 
+       MonoObject *res;
+       MonoRealProxy *rp = ((MonoRealProxy *)this);
+       MonoType *type;
+       MonoClass *klass;
+
+       res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
+       
+       ((MonoTransparentProxy *)res)->rp = this;
+       type = ((MonoReflectionType *)rp->class_to_proxy)->type;
+       klass = mono_class_from_mono_type (type);
+
+       res->vtable = mono_class_proxy_vtable (domain, klass);
+
+       return res;
+}
+
+/* System.Environment */
+
+static MonoString *
+ves_icall_System_Environment_get_MachineName ()
+{
+#if defined (PLATFORM_WIN32)
+       gunichar2 *buf;
+       guint32 len;
+       MonoString *result;
+
+       len = MAX_COMPUTERNAME_LENGTH + 1;
+       buf = g_new (gunichar2, len);
+
+       result = NULL;
+       if (GetComputerName (buf, &len))
+               result = mono_string_new_utf16 (mono_domain_get (), buf, len);
+
+       g_free (buf);
+       return result;
+#else
+       gchar *buf;
+       int len;
+       MonoString *result;
+
+       len = 256;
+       buf = g_new (gchar, len);
+
+       result = NULL;
+       if (gethostname (buf, len) != 0)
+               result = mono_string_new (mono_domain_get (), buf);
+       
+       g_free (buf);
+       return result;
 #endif
 }
 
+static MonoString *
+ves_icall_System_Environment_get_NewLine ()
+{
+#if defined (PLATFORM_WIN32)
+       return mono_string_new (mono_domain_get (), "\r\n");
+#else
+       return mono_string_new (mono_domain_get (), "\n");
+#endif
+}
+
+static MonoString *
+ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
+{
+       const gchar *value;
+       gchar *utf8_name;
+
+       if (name == NULL)
+               return NULL;
+
+       utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
+       value = g_getenv (utf8_name);
+       g_free (utf8_name);
+
+       if (value == 0)
+               return NULL;
+       
+       return mono_string_new (mono_domain_get (), value);
+}
+
+static MonoArray *
+ves_icall_System_Environment_GetEnvironmentVariableNames ()
+{
+       MonoArray *names;
+       MonoDomain *domain;
+       MonoString *str;
+       gchar **e, **parts;
+       int n;
+
+       n = 0;
+       for (e = environ; *e != 0; ++ e)
+               ++ n;
+
+       domain = mono_domain_get ();
+       names = mono_array_new (domain, mono_defaults.string_class, n);
+
+       n = 0;
+       for (e = environ; *e != 0; ++ e) {
+               parts = g_strsplit (*e, "=", 2);
+               if (*parts != 0) {
+                       str = mono_string_new (domain, *parts);
+                       mono_array_set (names, MonoString *, n, str);
+               }
+
+               g_strfreev (parts);
+
+               ++ n;
+       }
+
+       return names;
+}
+
+static MonoString *
+ves_icall_System_Environment_GetCommandLine ()
+{
+       return NULL;    /* FIXME */
+}
+
+
+void
+ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this, 
+                                        MonoReflectionMethod *method,
+                                        MonoArray *out_args)
+{
+       MonoDomain *domain = mono_domain_get ();
+       MonoMethodSignature *sig = method->method->signature;
+       MonoString *name;
+       int i, j;
+       char **names;
+       guint8 arg_type;
+
+       this->method = method;
+
+       this->args = mono_array_new (domain, mono_defaults.object_class, sig->param_count);
+       this->arg_types = mono_array_new (domain, mono_defaults.byte_class, sig->param_count);
+
+       names = g_new (char *, sig->param_count);
+       mono_method_get_param_names (method->method, (const char **) names);
+       this->names = mono_array_new (domain, mono_defaults.string_class, sig->param_count);
+       
+       for (i = 0; i < sig->param_count; i++) {
+                name = mono_string_new (domain, names [i]);
+                mono_array_set (this->names, gpointer, i, name);       
+       }
+
+       g_free (names);
+       
+       for (i = 0, j = 0; i < sig->param_count; i++) {
+
+               if (sig->params [i]->byref) {
+                       if (out_args) {
+                               gpointer arg = mono_array_get (out_args, gpointer, j);
+                               mono_array_set (this->args, gpointer, i, arg);
+                               j++;
+                       }
+                       arg_type = 2;
+                       if (sig->params [i]->attrs & PARAM_ATTRIBUTE_IN)
+                               arg_type = 1;
+               } else {
+                       arg_type = 1;
+               }
+
+               mono_array_set (this->arg_types, guint8, i, arg_type);
+       }
+}
+
+/* icall map */
+
 static gpointer icall_map [] = {
        /*
         * System.Array
@@ -1695,6 +1947,7 @@ static gpointer icall_map [] = {
        "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
        "System.Object::GetType", ves_icall_System_Object_GetType,
        "System.Object::GetHashCode", ves_icall_System_Object_GetHashCode,
+       "System.Object::obj_address", ves_icall_System_Object_obj_address,
 
        /*
         * System.ValueType
@@ -1765,9 +2018,13 @@ static gpointer icall_map [] = {
        "System.Reflection.MonoFieldInfo::get_field_info", ves_icall_get_field_info,
        "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
        "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
+       "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
        "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
        "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
        "System.Reflection.MonoField::GetValue", ves_icall_MonoField_GetValue,
+       "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
+       "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
+
        
        /* System.Enum */
 
@@ -1779,6 +2036,7 @@ static gpointer icall_map [] = {
         * TypeBuilder
         */
        "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
+
        
        /*
         * MethodBuilder
@@ -1851,23 +2109,6 @@ static gpointer icall_map [] = {
        "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
        "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
 
-       "System.PAL.OpSys::GetCurrentDirectory", ves_icall_System_PAL_GetCurrentDirectory,
-
-       /*
-        * System.PAL.OpSys I/O Services
-        */
-       "System.PAL.OpSys::GetStdHandle", ves_icall_System_PAL_OpSys_GetStdHandle,
-       "System.PAL.OpSys::ReadFile", ves_icall_System_PAL_OpSys_ReadFile,
-       "System.PAL.OpSys::WriteFile", ves_icall_System_PAL_OpSys_WriteFile,
-       "System.PAL.OpSys::SetLengthFile", ves_icall_System_PAL_OpSys_SetLengthFile,
-       "System.PAL.OpSys::OpenFile", ves_icall_System_PAL_OpSys_OpenFile,
-       "System.PAL.OpSys::CloseFile", ves_icall_System_PAL_OpSys_CloseFile,
-       "System.PAL.OpSys::SeekFile", ves_icall_System_PAL_OpSys_SeekFile,
-       "System.PAL.OpSys::DeleteFile", ves_icall_System_PAL_OpSys_DeleteFile,
-       "System.PAL.OpSys::ExistsFile", ves_icall_System_PAL_OpSys_ExistsFile,
-       "System.PAL.OpSys::GetFileTime", ves_icall_System_PAL_OpSys_GetFileTime,
-       "System.PAL.OpSys::SetFileTime", ves_icall_System_PAL_OpSys_SetFileTime,
-
        /*
         * System.Net.Sockets I/O Services
         */
@@ -1930,6 +2171,106 @@ static gpointer icall_map [] = {
 
         "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
         "System.Security.Cryptography.RNG_CryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
+       
+       /*
+        * System.Buffer
+        */
+       "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
+       "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
+       "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
+       "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
+
+       /*
+        * System.IO.MonoIO
+        */
+       "System.IO.MonoIO::GetLastError", ves_icall_System_IO_MonoIO_GetLastError,
+       "System.IO.MonoIO::CreateDirectory", ves_icall_System_IO_MonoIO_CreateDirectory,
+       "System.IO.MonoIO::RemoveDirectory", ves_icall_System_IO_MonoIO_RemoveDirectory,
+       "System.IO.MonoIO::FindFirstFile", ves_icall_System_IO_MonoIO_FindFirstFile,
+       "System.IO.MonoIO::FindNextFile", ves_icall_System_IO_MonoIO_FindNextFile,
+       "System.IO.MonoIO::FindClose", ves_icall_System_IO_MonoIO_FindClose,
+       "System.IO.MonoIO::GetCurrentDirectory", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
+       "System.IO.MonoIO::SetCurrentDirectory", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
+       "System.IO.MonoIO::MoveFile", ves_icall_System_IO_MonoIO_MoveFile,
+       "System.IO.MonoIO::CopyFile", ves_icall_System_IO_MonoIO_CopyFile,
+       "System.IO.MonoIO::DeleteFile", ves_icall_System_IO_MonoIO_DeleteFile,
+       "System.IO.MonoIO::GetFileAttributes", ves_icall_System_IO_MonoIO_GetFileAttributes,
+       "System.IO.MonoIO::SetFileAttributes", ves_icall_System_IO_MonoIO_SetFileAttributes,
+       "System.IO.MonoIO::GetFileStat", ves_icall_System_IO_MonoIO_GetFileStat,
+       "System.IO.MonoIO::Open", ves_icall_System_IO_MonoIO_Open,
+       "System.IO.MonoIO::Close", ves_icall_System_IO_MonoIO_Close,
+       "System.IO.MonoIO::Read", ves_icall_System_IO_MonoIO_Read,
+       "System.IO.MonoIO::Write", ves_icall_System_IO_MonoIO_Write,
+       "System.IO.MonoIO::Seek", ves_icall_System_IO_MonoIO_Seek,
+       "System.IO.MonoIO::GetLength", ves_icall_System_IO_MonoIO_GetLength,
+       "System.IO.MonoIO::SetLength", ves_icall_System_IO_MonoIO_SetLength,
+       "System.IO.MonoIO::SetFileTime", ves_icall_System_IO_MonoIO_SetFileTime,
+       "System.IO.MonoIO::Flush", ves_icall_System_IO_MonoIO_Flush,
+       "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
+       "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
+       "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
+       "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
+       "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
+       "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
+       "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
+       "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
+
+       /*
+        * System.Math
+        */
+       "System.Math::Sin", ves_icall_System_Math_Sin,
+        "System.Math::Cos", ves_icall_System_Math_Cos,
+        "System.Math::Tan", ves_icall_System_Math_Tan,
+        "System.Math::Sinh", ves_icall_System_Math_Sinh,
+        "System.Math::Cosh", ves_icall_System_Math_Cosh,
+        "System.Math::Tanh", ves_icall_System_Math_Tanh,
+        "System.Math::Acos", ves_icall_System_Math_Acos,
+        "System.Math::Asin", ves_icall_System_Math_Asin,
+        "System.Math::Atan", ves_icall_System_Math_Atan,
+        "System.Math::Atan2", ves_icall_System_Math_Atan2,
+        "System.Math::Exp", ves_icall_System_Math_Exp,
+        "System.Math::Log", ves_icall_System_Math_Log,
+        "System.Math::Log10", ves_icall_System_Math_Log10,
+        "System.Math::Pow", ves_icall_System_Math_Pow,
+        "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
+
+       /*
+        * System.Environment
+        */
+       "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
+       "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
+       "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
+       "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
+       "System.Environment::GetCommandLine", ves_icall_System_Environment_GetCommandLine,
+
+       /*
+        * Mono.CSharp.Debugger
+        */
+       "Mono.CSharp.Debugger.MonoSymbolWriter::get_local_type_from_sig", 
+       ves_icall_Debugger_MonoSymbolWriter_get_local_type_from_sig,
+       "Mono.CSharp.Debugger.MonoSymbolWriter::get_method", 
+       ves_icall_Debugger_MonoSymbolWriter_method_from_token,
+       "Mono.CSharp.Debugger.DwarfFileWriter::get_type_token", 
+       ves_icall_Debugger_DwarfFileWriter_get_type_token,
+
+
+       /*
+        * System.Runtime.Remoting
+        */     
+       "System.Runtime.Remoting.RemotingServices::InternalExecute",
+       ves_icall_InternalExecute,
+
+       /*
+        * System.Runtime.Remoting.Messaging
+        */     
+       "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
+       ves_icall_MonoMethodMessage_InitMessage,
+       
+       /*
+        * System.Runtime.Remoting.Proxies
+        */     
+       "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy", 
+       ves_icall_Remoting_RealProxy_GetTransparentProxy,
 
        /*
         * add other internal calls here