Revert until Martin is online to debug
[mono.git] / mono / metadata / icall.c
index 0f6e86167962d55c3879bee6a040246fd8d529be..ad2580f55928b83d43635f35d23a995c553dabe6 100644 (file)
@@ -92,6 +92,29 @@ mono_double_ParseImpl (char *ptr, double *result)
        return TRUE;
 }
 
+static MonoClass *
+mono_class_get_throw (MonoImage *image, guint32 type_token)
+{
+       MonoClass *class = mono_class_get (image, type_token);
+       MonoLoaderError *error;
+       MonoException *ex;
+       
+       if (class != NULL){
+               if (class->exception_type) {
+                       MonoException *exc = mono_class_get_exception_for_failure (class);
+                       g_assert (exc);
+                       mono_raise_exception (exc);
+               }
+               return class;
+       }
+       error = mono_loader_get_last_error ();
+       g_assert (error != NULL);
+       
+       ex = mono_loader_error_prepare_exception (error);
+       mono_raise_exception (ex);
+       return NULL;
+}
+
 static void
 ves_icall_System_Double_AssertEndianity (double *value)
 {
@@ -757,24 +780,6 @@ ves_icall_System_Object_MemberwiseClone (MonoObject *this)
        return mono_object_clone (this);
 }
 
-#define MONO_OBJECT_ALIGNMENT_SHIFT    3
-
-/*
- * Return hashcode based on object address. This function will need to be
- * smarter in the presence of a moving garbage collector, which will cache
- * the address hash before relocating the object.
- *
- * Wang's address-based hash function:
- *   http://www.concentric.net/~Ttwang/tech/addrhash.htm
- */
-static gint32
-ves_icall_System_Object_GetHashCode (MonoObject *this)
-{
-       MONO_ARCH_SAVE_REGS;
-
-       return (GPOINTER_TO_UINT (this) >> MONO_OBJECT_ALIGNMENT_SHIFT) * 2654435761u;
-}
-
 static gint32
 ves_icall_System_ValueType_InternalGetHashCode (MonoObject *this, MonoArray **fields)
 {
@@ -2868,9 +2873,10 @@ ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
        enumc = mono_class_from_mono_type (type->type);
        objc = obj->vtable->klass;
 
-       MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
-       MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
-                                                 objc->byval_arg.type <= MONO_TYPE_U8));
+       if (!enumc->enumtype)
+               mono_raise_exception (mono_get_exception_argument ("enumType", "Type provided must be an Enum."));
+       if (!((objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 && objc->byval_arg.type <= MONO_TYPE_U8)))
+               mono_raise_exception (mono_get_exception_argument ("value", "The value passed in must be an enum base or an underlying type for an enum, such as an Int32."));
 
        res = mono_object_new (domain, enumc);
        val = read_enum_value ((char *)obj + sizeof (MonoObject), objc->enumtype? objc->enum_basetype->type: objc->byval_arg.type);
@@ -3057,7 +3063,6 @@ static MonoArray*
 ves_icall_Type_GetFields_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
 {
        MonoDomain *domain; 
-       GSList *l = NULL, *tmp;
        MonoClass *startklass, *klass, *refklass;
        MonoArray *res;
        MonoObject *member;
@@ -3069,10 +3074,13 @@ ves_icall_Type_GetFields_internal (MonoReflectionType *type, guint32 bflags, Mon
 
        domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref)
-               return mono_array_new (domain, mono_defaults.method_info_class, 0);
+               return mono_array_new (domain, mono_defaults.field_info_class, 0);
        klass = startklass = mono_class_from_mono_type (type->type);
        refklass = mono_class_from_mono_type (reftype->type);
 
+       i = 0;
+       len = 2;
+       res = mono_array_new (domain, mono_defaults.field_info_class, len);
 handle_parent: 
        iter = NULL;
        while ((field = mono_class_get_fields (klass, &iter))) {
@@ -3101,17 +3109,26 @@ handle_parent:
                if (!match)
                        continue;
                member = (MonoObject*)mono_field_get_object (domain, refklass, field);
-               l = g_slist_prepend (l, member);
+               if (i >= len) {
+                       MonoArray *new_res = mono_array_new (domain, mono_defaults.field_info_class, len * 2);
+                       mono_array_memcpy_refs (new_res, 0, res, 0, len);
+                       len *= 2;
+                       res = new_res;
+               }
+               mono_array_setref (res, i, member);
+               ++i;
        }
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
-       len = g_slist_length (l);
-       res = mono_array_new (domain, mono_defaults.field_info_class, len);
-       i = 0;
-       tmp = l = g_slist_reverse (l);
-       for (; tmp; tmp = tmp->next, ++i)
-               mono_array_setref (res, i, tmp->data);
-       g_slist_free (l);
+       if (i != len) {
+               MonoArray *new_res = mono_array_new (domain, mono_defaults.field_info_class, i);
+               mono_array_memcpy_refs (new_res, 0, res, 0, i);
+               res = new_res;
+               /*
+                * Better solution for the new GC.
+                * res->max_length = i;
+                */
+       }
        return res;
 }
 
@@ -3119,7 +3136,6 @@ static MonoArray*
 ves_icall_Type_GetMethodsByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
 {
        MonoDomain *domain; 
-       GSList *l = NULL, *tmp;
        MonoClass *startklass, *klass, *refklass;
        MonoArray *res;
        MonoMethod *method;
@@ -3153,6 +3169,9 @@ ves_icall_Type_GetMethodsByName (MonoReflectionType *type, MonoString *name, gui
                method_slots = method_slots_default;
                memset (method_slots, 0, sizeof (method_slots_default));
        }
+       i = 0;
+       len = 1;
+       res = mono_array_new (domain, mono_defaults.method_info_class, len);
 handle_parent:
        mono_class_setup_vtable (klass);
        iter = NULL;
@@ -3197,23 +3216,30 @@ handle_parent:
                
                member = (MonoObject*)mono_method_get_object (domain, method, refklass);
                
-               l = g_slist_prepend (l, member);
-               len++;
+               if (i >= len) {
+                       MonoArray *new_res = mono_array_new (domain, mono_defaults.method_info_class, len * 2);
+                       mono_array_memcpy_refs (new_res, 0, res, 0, len);
+                       len *= 2;
+                       res = new_res;
+               }
+               mono_array_setref (res, i, member);
+               ++i;
        }
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
 
        g_free (mname);
-       res = mono_array_new (domain, mono_defaults.method_info_class, len);
-       i = 0;
-
-       tmp = l = g_slist_reverse (l);
-
-       for (; tmp; tmp = tmp->next, ++i)
-               mono_array_setref (res, i, tmp->data);
-       g_slist_free (l);
        if (method_slots != method_slots_default)
                g_free (method_slots);
+       if (i != len) {
+               MonoArray *new_res = mono_array_new (domain, mono_defaults.method_info_class, i);
+               mono_array_memcpy_refs (new_res, 0, res, 0, i);
+               res = new_res;
+               /*
+                * Better solution for the new GC.
+                * res->max_length = i;
+                */
+       }
        return res;
 }
 
@@ -3221,7 +3247,6 @@ static MonoArray*
 ves_icall_Type_GetConstructors_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
 {
        MonoDomain *domain; 
-       GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_ConstructorInfo;
        MonoClass *startklass, *klass, *refklass;
        MonoArray *res;
@@ -3238,6 +3263,13 @@ ves_icall_Type_GetConstructors_internal (MonoReflectionType *type, guint32 bflag
        klass = startklass = mono_class_from_mono_type (type->type);
        refklass = mono_class_from_mono_type (reftype->type);
 
+       if (!System_Reflection_ConstructorInfo)
+               System_Reflection_ConstructorInfo = mono_class_from_name (
+                       mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
+
+       i = 0;
+       len = 2;
+       res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
        iter = NULL;
        while ((method = mono_class_get_methods (klass, &iter))) {
                match = 0;
@@ -3265,19 +3297,25 @@ ves_icall_Type_GetConstructors_internal (MonoReflectionType *type, guint32 bflag
                if (!match)
                        continue;
                member = (MonoObject*)mono_method_get_object (domain, method, refklass);
-                       
-               l = g_slist_prepend (l, member);
+
+               if (i >= len) {
+                       MonoArray *new_res = mono_array_new (domain, System_Reflection_ConstructorInfo, len * 2);
+                       mono_array_memcpy_refs (new_res, 0, res, 0, len);
+                       len *= 2;
+                       res = new_res;
+               }
+               mono_array_setref (res, i, member);
+               ++i;
+       }
+       if (i != len) {
+               MonoArray *new_res = mono_array_new (domain, System_Reflection_ConstructorInfo, i);
+               mono_array_memcpy_refs (new_res, 0, res, 0, i);
+               res = new_res;
+               /*
+                * Better solution for the new GC.
+                * res->max_length = i;
+                */
        }
-       len = g_slist_length (l);
-       if (!System_Reflection_ConstructorInfo)
-               System_Reflection_ConstructorInfo = mono_class_from_name (
-                       mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
-       res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
-       i = 0;
-       tmp = l = g_slist_reverse (l);
-       for (; tmp; tmp = tmp->next, ++i)
-               mono_array_setref (res, i, tmp->data);
-       g_slist_free (l);
        return res;
 }
 
@@ -3285,7 +3323,6 @@ static MonoArray*
 ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
 {
        MonoDomain *domain; 
-       GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_PropertyInfo;
        MonoClass *startklass, *klass;
        MonoArray *res;
@@ -3324,6 +3361,9 @@ ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString *name,
                method_slots = method_slots_default;
                memset (method_slots, 0, sizeof (method_slots_default));
        }
+       i = 0;
+       len = 2;
+       res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
 handle_parent:
        mono_class_setup_vtable (klass);
        iter = NULL;
@@ -3376,23 +3416,30 @@ handle_parent:
                        method_slots [prop->set->slot >> 5] |= 1 << (prop->set->slot & 0x1f);
                }
 
-               l = g_slist_prepend (l, mono_property_get_object (domain, startklass, prop));
-               len++;
+               if (i >= len) {
+                       MonoArray *new_res = mono_array_new (domain, System_Reflection_PropertyInfo, len * 2);
+                       mono_array_memcpy_refs (new_res, 0, res, 0, len);
+                       len *= 2;
+                       res = new_res;
+               }
+               mono_array_setref (res, i, mono_property_get_object (domain, startklass, prop));
+               ++i;
        }
        if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
                goto handle_parent;
 
        g_free (propname);
-       res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
-       i = 0;
-
-       tmp = l = g_slist_reverse (l);
-
-       for (; tmp; tmp = tmp->next, ++i)
-               mono_array_setref (res, i, tmp->data);
-       g_slist_free (l);
        if (method_slots != method_slots_default)
                g_free (method_slots);
+       if (i != len) {
+               MonoArray *new_res = mono_array_new (domain, System_Reflection_PropertyInfo, i);
+               mono_array_memcpy_refs (new_res, 0, res, 0, i);
+               res = new_res;
+               /*
+                * Better solution for the new GC.
+                * res->max_length = i;
+                */
+       }
        return res;
 }
 
@@ -3453,7 +3500,6 @@ static MonoArray*
 ves_icall_Type_GetEvents_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
 {
        MonoDomain *domain; 
-       GSList *l = NULL, *tmp;
        static MonoClass *System_Reflection_EventInfo;
        MonoClass *startklass, *klass;
        MonoArray *res;
@@ -3473,6 +3519,9 @@ ves_icall_Type_GetEvents_internal (MonoReflectionType *type, guint32 bflags, Mon
                return mono_array_new (domain, System_Reflection_EventInfo, 0);
        klass = startklass = mono_class_from_mono_type (type->type);
 
+       i = 0;
+       len = 2;
+       res = mono_array_new (domain, System_Reflection_EventInfo, len);
 handle_parent: 
        iter = NULL;
        while ((event = mono_class_get_events (klass, &iter))) {
@@ -3513,19 +3562,26 @@ handle_parent:
                if (!match)
                        continue;
                match = 0;
-               l = g_slist_prepend (l, mono_event_get_object (domain, startklass, event));
+               if (i >= len) {
+                       MonoArray *new_res = mono_array_new (domain, System_Reflection_EventInfo, len * 2);
+                       mono_array_memcpy_refs (new_res, 0, res, 0, len);
+                       len *= 2;
+                       res = new_res;
+               }
+               mono_array_setref (res, i, mono_event_get_object (domain, startklass, event));
+               ++i;
        }
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
-       len = g_slist_length (l);
-       res = mono_array_new (domain, System_Reflection_EventInfo, len);
-       i = 0;
-
-       tmp = l = g_slist_reverse (l);
-
-       for (; tmp; tmp = tmp->next, ++i)
-               mono_array_setref (res, i, tmp->data);
-       g_slist_free (l);
+       if (i != len) {
+               MonoArray *new_res = mono_array_new (domain, System_Reflection_EventInfo, i);
+               mono_array_memcpy_refs (new_res, 0, res, 0, i);
+               res = new_res;
+               /*
+                * Better solution for the new GC.
+                * res->max_length = i;
+                */
+       }
        return res;
 }
 
@@ -3574,7 +3630,6 @@ static MonoArray*
 ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
 {
        MonoDomain *domain; 
-       GSList *l = NULL, *tmp;
        GList *tmpn;
        MonoClass *startklass, *klass;
        MonoArray *res;
@@ -3589,6 +3644,9 @@ ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
                return mono_array_new (domain, mono_defaults.monotype_class, 0);
        klass = startklass = mono_class_from_mono_type (type->type);
 
+       i = 0;
+       len = 1;
+       res = mono_array_new (domain, mono_defaults.monotype_class, len);
        for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
                match = 0;
                nested = tmpn->data;
@@ -3602,15 +3660,24 @@ ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
                if (!match)
                        continue;
                member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
-               l = g_slist_prepend (l, member);
+               if (i >= len) {
+                       MonoArray *new_res = mono_array_new (domain, mono_defaults.monotype_class, len * 2);
+                       mono_array_memcpy_refs (new_res, 0, res, 0, len);
+                       len *= 2;
+                       res = new_res;
+               }
+               mono_array_setref (res, i, member);
+               ++i;
+       }
+       if (i != len) {
+               MonoArray *new_res = mono_array_new (domain, mono_defaults.monotype_class, i);
+               mono_array_memcpy_refs (new_res, 0, res, 0, i);
+               res = new_res;
+               /*
+                * Better solution for the new GC.
+                * res->max_length = i;
+                */
        }
-       len = g_slist_length (l);
-       res = mono_array_new (domain, mono_defaults.monotype_class, len);
-       i = 0;
-       tmp = l = g_slist_reverse (l);
-       for (; tmp; tmp = tmp->next, ++i)
-               mono_array_setref (res, i, tmp->data);
-       g_slist_free (l);
        return res;
 }
 
@@ -4395,8 +4462,6 @@ ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoString *fname,
                mono_raise_exception (exc);
        }
 
-       /* So we can call mono_image_close () later */
-       mono_image_addref (image);
        res = mono_assembly_fill_assembly_name (image, &name);
        if (!res) {
                mono_image_close (image);
@@ -4440,8 +4505,7 @@ ves_icall_System_Reflection_Assembly_LoadPermissions (MonoReflectionAssembly *as
 }
 
 static MonoArray*
-mono_module_get_types (MonoDomain *domain, MonoImage *image, 
-                                          MonoBoolean exportedOnly)
+mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoBoolean exportedOnly)
 {
        MonoArray *res;
        MonoClass *klass;
@@ -4467,7 +4531,9 @@ mono_module_get_types (MonoDomain *domain, MonoImage *image,
                attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
                visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
                if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
-                       klass = mono_class_get (image, (i + 1) | MONO_TOKEN_TYPE_DEF);
+                       klass = mono_class_get_throw (image, (i + 1) | MONO_TOKEN_TYPE_DEF);
+                       if (mono_loader_get_last_error ())
+                               mono_loader_clear_error ();
                        mono_array_setref (res, count, mono_type_get_object (domain, &klass->byval_arg));
                        count++;
                }
@@ -4483,7 +4549,8 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
        MonoImage *image = NULL;
        MonoTableInfo *table = NULL;
        MonoDomain *domain;
-       int i;
+       GList *list = NULL;
+       int i, len;
 
        MONO_ARCH_SAVE_REGS;
 
@@ -4568,42 +4635,41 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly,
                }
        }
 
-       if (mono_is_security_manager_active ()) {
-               /* the ReflectionTypeLoadException must have all the types (Types property), 
-                * NULL replacing types which throws an exception. The LoaderException must
-                * contains all exceptions for NULL items.
-                */
+       /* the ReflectionTypeLoadException must have all the types (Types property), 
+        * NULL replacing types which throws an exception. The LoaderException must
+        * contain all exceptions for NULL items.
+        */
 
-               guint32 len = mono_array_length (res);
-               GList *list = NULL;
-
-               for (i = 0; i < len; i++) {
-                       MonoReflectionType *t = mono_array_get (res, gpointer, i);
-                       MonoClass *klass = mono_type_get_class (t->type);
-                       if ((klass != NULL) && klass->exception_type) {
-                               /* keep the class in the list */
-                               list = g_list_append (list, klass);
-                               /* and replace Type with NULL */
-                               mono_array_setref (res, i, NULL);
-                       }
+       len = mono_array_length (res);
+
+       for (i = 0; i < len; i++) {
+               MonoReflectionType *t = mono_array_get (res, gpointer, i);
+               MonoClass *klass = mono_type_get_class (t->type);
+               if ((klass != NULL) && klass->exception_type) {
+                       /* keep the class in the list */
+                       list = g_list_append (list, klass);
+                       /* and replace Type with NULL */
+                       mono_array_setref (res, i, NULL);
                }
+       }
 
-               if (list) {
-                       GList *tmp = NULL;
-                       MonoException *exc = NULL;
-                       int length = g_list_length (list);
+       if (list) {
+               GList *tmp = NULL;
+               MonoException *exc = NULL;
+               int length = g_list_length (list);
 
-                       MonoArray *exl = mono_array_new (domain, mono_defaults.exception_class, length);
-                       for (i = 0, tmp = list; i < length; i++, tmp = tmp->next) {
-                               MonoException *exc = mono_class_get_exception_for_failure (tmp->data);
-                               mono_array_setref (exl, i, exc);
-                       }
-                       g_list_free (list);
-                       list = NULL;
+               mono_loader_clear_error ();
 
-                       exc = mono_get_exception_reflection_type_load (res, exl);
-                       mono_raise_exception (exc);
+               MonoArray *exl = mono_array_new (domain, mono_defaults.exception_class, length);
+               for (i = 0, tmp = list; i < length; i++, tmp = tmp->next) {
+                       MonoException *exc = mono_class_get_exception_for_failure (tmp->data);
+                       mono_array_setref (exl, i, exc);
                }
+               g_list_free (list);
+               list = NULL;
+
+               exc = mono_get_exception_reflection_type_load (res, exl);
+               mono_raise_exception (exc);
        }
                
        return res;
@@ -6589,7 +6655,7 @@ static const IcallEntry monoio_icalls [] = {
        {"GetTempPath(string&)", ves_icall_System_IO_MonoIO_GetTempPath},
        {"Lock(intptr,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Lock},
        {"MoveFile(string,string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile},
-       {"Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open},
+       {"Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.FileOptions,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},
@@ -6912,8 +6978,10 @@ static const IcallEntry marshal_icalls [] = {
        {"AllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem},
        {"AllocHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal},
        {"DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure},
+       {"FreeBSTR", ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR},
        {"FreeCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem},
        {"FreeHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal},
+       {"GetComSlotForMethodInfoInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal},
        {"GetDelegateForFunctionPointerInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal},
        {"GetFunctionPointerForDelegateInternal", mono_delegate_to_ftnptr},
        {"GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error},
@@ -6936,6 +7004,7 @@ static const IcallEntry marshal_icalls [] = {
        {"ReadInt64", ves_icall_System_Runtime_InteropServices_Marshal_ReadInt64},
        {"ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr},
        {"SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf},
+       {"StringToBSTR", ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR},
        {"StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi},
        {"StringToHGlobalAuto", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi},
        {"StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni},