Mon Mar 25 13:04:56 CET 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / icall.c
index 60f1f7a585de198441c742a0349d6ffc2e175c9b..60c6e6fd169335a47535871b06d34985b9dc6734 100644 (file)
@@ -28,6 +28,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 +357,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;
        
@@ -453,7 +449,7 @@ ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* d
 {
        int element_size = mono_array_element_size (source->obj.vtable->klass);
        void * dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
-       void * source_addr = mono_array_addr_with_size (source, element_size, dest_idx);
+       void * source_addr = mono_array_addr_with_size (source, element_size, source_idx);
 
        memcpy (dest_addr, source_addr, element_size * length);
 }
@@ -509,6 +505,37 @@ ves_icall_System_Object_MemberwiseClone (MonoObject *this)
        return mono_object_clone (this);
 }
 
+static gint32
+ves_icall_System_Object_GetHashCode (MonoObject *this)
+{
+       return *((gint32 *)this - 1);
+}
+
+/*
+ * A hash function for value types. I have no idea if this is a good hash 
+ * function (its similar to g_str_hash).
+ */
+static gint32
+ves_icall_System_ValueType_GetHashCode (MonoObject *this)
+{
+       gint32 i, size;
+       const char *p;
+       guint h;
+
+       MONO_CHECK_ARG_NULL (this);
+
+       size = this->vtable->klass->instance_size - sizeof (MonoObject);
+
+       p = (char *)this + sizeof (MonoObject);
+
+       for (i = 0; i < size; i++) {
+               h = (h << 5) - h + *p;
+               p++;
+       }
+
+       return h;
+}
+
 static MonoReflectionType *
 ves_icall_System_Object_GetType (MonoObject *obj)
 {
@@ -529,24 +556,34 @@ ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObj
 }
 
 static gint32
-ves_icall_get_data_chunk (MonoReflectionAssemblyBuilder *assb, gint32 type, MonoArray *buf)
+ves_icall_get_data_chunk (MonoReflectionAssemblyBuilder *assb, gint32 offset, MonoArray *buf)
 {
        int count;
 
-       if (type == 0) { /* get the header */
+       if (offset == 0) { /* get the header */
                count = mono_image_get_header (assb, (char*)buf->vector, buf->bounds->length);
                if (count != -1)
                        return count;
        } else {
                MonoDynamicAssembly *ass = assb->dynamic_assembly;
                char *p = mono_array_addr (buf, char, 0);
+               int chunklen;
+               offset--;
                count = ass->code.index + ass->meta_size;
-               if (count > buf->bounds->length) {
-                       g_print ("assembly data exceed supplied buffer\n");
-                       return 0;
-               }
-               memcpy (p, ass->code.data, ass->code.index);
-               memcpy (p + ass->code.index, ass->assembly.image->raw_metadata, ass->meta_size);
+               if (count - offset > buf->bounds->length) {
+                       count =  buf->bounds->length;
+               } else
+                       count = count - offset;
+               if (offset < ass->code.index) {
+                       chunklen = ass->code.index - offset;
+                       memcpy (p, ass->code.data + offset, chunklen);
+                       offset += chunklen;
+                       p += chunklen;
+                       chunklen = count - chunklen;
+               } else
+                       chunklen = count;
+               offset -= ass->code.index;
+               memcpy (p, ass->assembly.image->raw_metadata + offset, chunklen);
                return count;
        }
        
@@ -557,7 +594,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;
@@ -566,6 +603,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;
        }
 
@@ -574,46 +612,28 @@ 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);
-       
-       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*
 ves_icall_type_from_handle (MonoType *handle)
 {
        MonoDomain *domain = mono_domain_get (); 
+       MonoClass *klass = mono_class_from_mono_type (handle);
 
-       mono_class_init (handle->data.klass);
+       mono_class_init (klass);
        return mono_type_get_object (domain, handle);
 }
 
@@ -803,7 +823,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);
@@ -816,14 +836,50 @@ ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
 }
 
 static MonoObject*
-ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) {
-       //MonoMethodSignature *sig = method->method->signature;
+ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params) 
+{
+       MonoMethodSignature *sig = method->method->signature;
+       gpointer *pa;
+       int i;
 
-       /*
-        * Do we need to copy the values so that the called method can't change them?
-        */
+       pa = alloca (sizeof (gpointer) * params->bounds->length);
 
-       return NULL;
+       for (i = 0; i < params->bounds->length; i++) {
+               if (sig->params [i]->byref) {
+                       /* fixme: don't know how to handle this */
+                       g_assert_not_reached ();
+               }
+
+               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 *
@@ -1089,7 +1145,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);
@@ -1262,7 +1318,7 @@ handle_parent:
                match = 0;
                l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
        }
-       if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
+       if (!l && (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
                goto handle_parent;
        len = g_slist_length (l);
        if (!System_Reflection_PropertyInfo)
@@ -1277,6 +1333,66 @@ handle_parent:
        return res;
 }
 
+static MonoArray*
+ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
+{
+       MonoDomain *domain; 
+       GSList *l = NULL, *tmp;
+       static MonoClass *System_Reflection_EventInfo;
+       MonoClass *startklass, *klass;
+       MonoArray *res;
+       MonoMethod *method;
+       MonoEvent *event;
+       int i, len, match;
+
+       domain = ((MonoObject *)type)->vtable->domain;
+       klass = startklass = mono_class_from_mono_type (type->type);
+
+handle_parent: 
+       for (i = 0; i < klass->event.count; ++i) {
+               event = &klass->events [i];
+               match = 0;
+               method = event->add;
+               if (!method)
+                       method = event->remove;
+               if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
+                       if (bflags & BFLAGS_Public)
+                               match++;
+               } else {
+                       if (bflags & BFLAGS_NonPublic)
+                               match++;
+               }
+               if (!match)
+                       continue;
+               match = 0;
+               if (method->flags & METHOD_ATTRIBUTE_STATIC) {
+                       if (bflags & BFLAGS_Static)
+                               match++;
+               } else {
+                       if (bflags & BFLAGS_Instance)
+                               match++;
+               }
+
+               if (!match)
+                       continue;
+               match = 0;
+               l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
+       }
+       if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
+               goto handle_parent;
+       len = g_slist_length (l);
+       if (!System_Reflection_EventInfo)
+               System_Reflection_EventInfo = mono_class_from_name (
+                       mono_defaults.corlib, "System.Reflection", "EventInfo");
+       res = mono_array_new (domain, System_Reflection_EventInfo, len);
+       i = 0;
+       tmp = l;
+       for (; tmp; tmp = tmp->next, ++i)
+               mono_array_set (res, gpointer, i, tmp->data);
+       g_slist_free (l);
+       return res;
+}
+
 static gpointer
 ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr)
 {
@@ -1297,66 +1413,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;
-       guint rank;
-       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;
-               }
-       }
-
-       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;
        }
 
-       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);
-               /*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 *
@@ -1422,16 +1506,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);
+       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);
 }
 
 static MonoString *
@@ -1553,17 +1675,59 @@ ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data
 
                gmtoff = tt.tm_gmtoff;
        }
-
-       return 0;
 #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);
+}
+
+/* icall map */
+
 static gpointer icall_map [] = {
        /*
         * System.Array
@@ -1584,8 +1748,14 @@ 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
+        */
+       "System.ValueType::GetHashCode", ves_icall_System_ValueType_GetHashCode,
+
        /*
         * System.String
         */
@@ -1650,9 +1820,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 */
 
@@ -1664,6 +1838,7 @@ static gpointer icall_map [] = {
         * TypeBuilder
         */
        "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
+
        
        /*
         * MethodBuilder
@@ -1733,6 +1908,7 @@ static gpointer icall_map [] = {
        "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
        "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
        "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
+       "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
        "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
 
        "System.PAL.OpSys::GetCurrentDirectory", ves_icall_System_PAL_GetCurrentDirectory,
@@ -1741,12 +1917,6 @@ static gpointer icall_map [] = {
         * 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,
@@ -1814,6 +1984,54 @@ 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.FileStream
+        */
+       "System.IO.FileStream::FileOpen", ves_icall_System_IO_FileStream_FileOpen,
+       "System.IO.FileStream::FileClose", ves_icall_System_IO_FileStream_FileClose,
+       "System.IO.FileStream::FileRead", ves_icall_System_IO_FileStream_FileRead,
+       "System.IO.FileStream::FileWrite", ves_icall_System_IO_FileStream_FileWrite,
+       "System.IO.FileStream::FileSeek", ves_icall_System_IO_FileStream_FileSeek,
+       "System.IO.FileStream::FileGetLength", ves_icall_System_IO_FileStream_FileGetLength,
+       "System.IO.FileStream::FileSetLength", ves_icall_System_IO_FileStream_FileSetLength,
+       "System.IO.FileStream::FileFlush", ves_icall_System_IO_FileStream_FileFlush,
+
+       /*
+        * 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,
+
+       /*
+        * 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,
+
+
 
        /*
         * add other internal calls here