* test-9.il: New test, test instaniating a class
[mono.git] / mono / metadata / icall.c
index 4609b1afa1c49f49b84ecc69851eeabb314d0179..594b1bbddb366cc5ae0f0e5cfb525a24d7681a79 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <mono/metadata/object.h>
 #include <mono/metadata/threads.h>
+#include <mono/metadata/monitor.h>
 #include <mono/metadata/reflection.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/unicode.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
-#include <mono/metadata/gc.h>
+#include <mono/metadata/gc-internal.h>
 #include <mono/metadata/rand.h>
 #include <mono/metadata/sysmath.h>
 #include <mono/metadata/string-icalls.h>
 #include <mono/metadata/debug-mono-symfile.h>
 #include <mono/metadata/process.h>
+#include <mono/metadata/environment.h>
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/strtod.h>
 
@@ -46,6 +48,9 @@
 #endif
 #include "decimal.h"
 
+static MonoReflectionAssembly* ves_icall_System_Reflection_Assembly_GetCallingAssembly (void);
+
+
 static MonoString *
 mono_double_ToStringImpl (double value)
 {
@@ -67,9 +72,20 @@ mono_double_ToStringImpl (double value)
 static double
 mono_double_ParseImpl (char *ptr)
 {
+       gchar *endptr = NULL;
+       gdouble result;
+
        MONO_ARCH_SAVE_REGS;
 
-       return bsd_strtod (ptr, NULL);
+       if (*ptr)
+               result = bsd_strtod (ptr, &endptr);
+
+       if (!*ptr || (endptr && *endptr))
+               mono_raise_exception (mono_exception_from_name (mono_defaults.corlib,
+                                                               "System",
+                                                               "FormatException"));
+       
+       return result;
 }
 
 static MonoString *
@@ -622,7 +638,8 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor (Mo
        MONO_CHECK_ARG (handle, klass);
 
        /* This will call the type constructor */
-       mono_class_vtable (mono_domain_get (), klass);
+       if (! (klass->flags & TYPE_ATTRIBUTE_INTERFACE))
+               mono_class_vtable (mono_domain_get (), klass);
 }
 
 static MonoObject *
@@ -753,28 +770,12 @@ ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, Mon
        return count;
 }
 
-typedef struct getTypeInfo GetTypeInfo;
-struct getTypeInfo {
-       MonoType *type;
-       MonoTypeNameParse *info;
-       MonoBoolean ignoreCase;
-};
-
 static void
-try_get_type (gpointer key, gpointer value, gpointer user_data)
+ves_icall_AssemblyBuilder_build_metadata (MonoReflectionAssemblyBuilder *assb)
 {
-       GetTypeInfo *gt_info = user_data;
-       MonoAssembly *assembly;
-
-       if (gt_info->type != NULL)
-               return;
+       MONO_ARCH_SAVE_REGS;
 
-       assembly = value;
-       /* Weird, but the domain is locked and the assembly will not be freed */
-       memcpy (&gt_info->info->assembly, &assembly->aname, sizeof (MonoAssemblyName));
-       gt_info->type = mono_reflection_get_type (assembly->image,
-                                                 gt_info->info,
-                                                 gt_info->ignoreCase);
+       mono_image_build_metadata (assb);
 }
 
 static MonoReflectionType*
@@ -783,8 +784,8 @@ ves_icall_type_from_name (MonoString *name,
                          MonoBoolean ignoreCase)
 {
        gchar *str;
-       MonoType *type;
-       MonoAssembly *assembly = NULL;
+       MonoType *type = NULL;
+       MonoAssembly *assembly;
        MonoTypeNameParse info;
 
        MONO_ARCH_SAVE_REGS;
@@ -802,33 +803,18 @@ ves_icall_type_from_name (MonoString *name,
 
        if (info.assembly.name) {
                assembly = mono_assembly_load (&info.assembly, NULL, NULL);
+       } else {
+               MonoReflectionAssembly *refass;
 
-               if (!assembly) {
-                       g_free (str);
-                       g_list_free (info.modifiers);
-                       g_list_free (info.nested);
-                       if (throwOnError)
-                               mono_raise_exception (mono_get_exception_type_load ());
-
-                       return NULL;
-               }
+               refass = ves_icall_System_Reflection_Assembly_GetCallingAssembly  ();
+               assembly = refass->assembly;
        }
-       
-       if (assembly) {
+
+       if (assembly)
                type = mono_reflection_get_type (assembly->image, &info, ignoreCase);
-       } else {
-               MonoDomain *domain = mono_domain_get ();
-               GetTypeInfo gt_info;
-               
-               gt_info.type = NULL;
-               gt_info.info = &info;
-               gt_info.ignoreCase = ignoreCase;
-
-               mono_domain_lock (domain);
-               g_hash_table_foreach (domain->assemblies, try_get_type, &gt_info);
-               mono_domain_unlock (domain);
-               type = gt_info.type;
-       }
+       
+       if (!info.assembly.name && !type) /* try mscorlib */
+               type = mono_reflection_get_type (NULL, &info, ignoreCase);
 
        g_free (str);
        g_list_free (info.modifiers);
@@ -1341,7 +1327,7 @@ ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
        else
                info->etype = NULL;
 
-       info->isprimitive = (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8);
+       info->isprimitive = (!type->byref && (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8));
 }
 
 static MonoObject *
@@ -1353,11 +1339,20 @@ ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoAr
         * greater flexibility.
         */
        MonoMethod *m = method->method;
+       int pcount;
 
        MONO_ARCH_SAVE_REGS;
 
-       if (this)
+       if (this) {
+               if (!mono_object_isinst (this, m->klass))
+                       mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
                m = mono_object_get_virtual_method (this, m);
+       } else if (!(m->flags & METHOD_ATTRIBUTE_STATIC) && strcmp (m->name, ".ctor"))
+               mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetException"));
+
+       pcount = params? mono_array_length (params): 0;
+       if (pcount != m->signature->param_count)
+               mono_raise_exception (mono_exception_from_name (mono_defaults.corlib, "System.Reflection", "TargetParameterCountException"));
 
        return mono_runtime_invoke_array (m, this, params, NULL);
 }
@@ -1424,7 +1419,9 @@ ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoA
                                        } else 
                                                *((gpointer *)this + k->fields [i].offset) = val;
                                
-                                       g_assert (result);
+                                       out_args = mono_array_new (domain, mono_defaults.object_class, 0);
+                                       *outArgs = out_args;
+
                                        g_free (str);
                                        return NULL;
                                }
@@ -2152,6 +2149,7 @@ ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAsse
        static MonoClass *System_Reflection_AssemblyName;
        MonoArray *result;
        MonoAssembly **ptr;
+       MonoDomain *domain = mono_object_domain (assembly);
        int i, count = 0;
 
        MONO_ARCH_SAVE_REGS;
@@ -2168,16 +2166,20 @@ ves_icall_System_Reflection_Assembly_GetReferencedAssemblies (MonoReflectionAsse
        for (i = 0; i < count; i++) {
                MonoAssembly *assem = assembly->assembly->image->references [i];
                MonoReflectionAssemblyName *aname;
+               char *codebase;
 
                aname = (MonoReflectionAssemblyName *) mono_object_new (
-                       mono_object_domain (assembly), System_Reflection_AssemblyName);
+                       domain, System_Reflection_AssemblyName);
 
                if (strcmp (assem->aname.name, "corlib") == 0)
-                       aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
+                       aname->name = mono_string_new (domain, "mscorlib");
                else
-                       aname->name = mono_string_new (mono_object_domain (assembly), assem->aname.name);
+                       aname->name = mono_string_new (domain, assem->aname.name);
                aname->major = assem->aname.major;
 
+               codebase = g_strconcat ("file://", assembly->assembly->image->references [i]->image->name, NULL);
+               aname->codebase = mono_string_new (domain, codebase);
+               g_free (codebase);
                mono_array_set (result, gpointer, i, aname);
        }
        return result;
@@ -2255,7 +2257,7 @@ static MonoObject*
 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssembly *assembly, MonoString *name) 
 {
        MonoTableInfo *table = &assembly->assembly->image->tables [MONO_TABLE_FILE];
-       MonoArray *result;
+       MonoArray *result = NULL;
        int i;
        const char *val;
        char *n;
@@ -2338,7 +2340,9 @@ ves_icall_System_Reflection_Assembly_GetEntryAssembly (void)
 
        MONO_ARCH_SAVE_REGS;
 
-       g_assert (domain->entry_assembly);
+       if (!domain->entry_assembly)
+               domain = mono_root_domain;
+
        return mono_assembly_get_object (domain, domain->entry_assembly);
 }
 
@@ -2384,7 +2388,11 @@ ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly,
                aname->name = mono_string_new (mono_object_domain (assembly), "mscorlib");
        else
                aname->name = mono_string_new (mono_object_domain (assembly), name->name);
+
        aname->major = name->major;
+       aname->minor = name->minor;
+       aname->build = name->build;
+       aname->revision = name->revision;
 }
 
 static MonoArray*
@@ -2564,9 +2572,13 @@ ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data
 
        long int gmtoff;
        int is_daylight = 0, day;
+       char tzone[10];
 
        MONO_ARCH_SAVE_REGS;
 
+       if ((year < 1900) || (year > 2100))
+               mono_raise_exception (mono_get_exception_not_implemented ());
+
        memset (&start, 0, sizeof (start));
 
        start.tm_mday = 1;
@@ -2582,7 +2594,7 @@ ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data
 #endif
        
        gmtoff = gmt_offset (start);
-       
+
        MONO_CHECK_ARG_NULL (data);
        MONO_CHECK_ARG_NULL (names);
 
@@ -2597,7 +2609,6 @@ ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data
 
                /* Daylight saving starts or ends here. */
                if (gmt_offset (tt) != gmtoff) {
-                       char tzone[10];
                        struct tm tt1;
                        time_t t1;
 
@@ -2636,6 +2647,17 @@ ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data
 
                gmtoff = gmt_offset (tt);
        }
+
+       if (!is_daylight) {
+               strftime (tzone, 10, "%Z", &tt);
+               mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tzone));
+               mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tzone));
+               mono_array_set ((*data), gint64, 0, 0);
+               mono_array_set ((*data), gint64, 1, 0);
+               mono_array_set ((*data), gint64, 2, (gint64) gmtoff * 10000000L);
+               mono_array_set ((*data), gint64, 3, 0);
+       }
+
        return 1;
 #else
        MonoDomain *domain = mono_domain_get ();
@@ -2791,7 +2813,7 @@ ves_icall_System_Environment_get_MachineName (void)
        buf = g_new (gchar, len);
 
        result = NULL;
-       if (gethostname (buf, len) != 0)
+       if (gethostname (buf, len) == 0)
                result = mono_string_new (mono_domain_get (), buf);
        
        g_free (buf);
@@ -2961,6 +2983,36 @@ ves_icall_IsTransparentProxy (MonoObject *proxy)
        return 0;
 }
 
+static void
+ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation (MonoReflectionType *type, MonoBoolean enable)
+{
+       MonoClass *klass;
+       MonoVTable* vtable;
+
+       MONO_ARCH_SAVE_REGS;
+
+       klass = mono_class_from_mono_type (type->type);
+       vtable = mono_class_vtable (mono_domain_get (), klass);
+
+       if (enable) vtable->remote = 1;
+       else vtable->remote = 0;
+}
+
+static MonoObject *
+ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance (MonoReflectionType *type)
+{
+       MonoClass *klass;
+       MonoDomain *domain;
+       
+       MONO_ARCH_SAVE_REGS;
+
+       domain = mono_object_domain (type);
+       klass = mono_class_from_mono_type (type->type);
+
+       // Bypass remoting object creation check
+       return mono_object_new_alloc_specific (mono_class_vtable (domain, klass));
+}
+
 static MonoObject *
 ves_icall_System_Runtime_Serialization_FormatterServices_GetUninitializedObject_Internal (MonoReflectionType *type)
 {
@@ -2999,6 +3051,31 @@ ves_icall_RuntimeMethod_GetFunctionPointer (MonoMethod *method)
        return mono_compile_method (method);
 }
 
+char const * mono_cfg_dir = "";
+
+void    
+mono_install_get_config_dir (void)
+{
+#ifdef PLATFORM_WIN32
+  int i;
+#endif
+
+  mono_cfg_dir = getenv ("MONO_CFG_DIR");
+
+  if (!mono_cfg_dir) {
+#ifndef PLATFORM_WIN32
+    mono_cfg_dir = MONO_CFG_DIR;
+#else
+    mono_cfg_dir = g_strdup (MONO_CFG_DIR);
+    for (i = strlen (mono_cfg_dir) - 1; i >= 0; i--) {
+        if (mono_cfg_dir [i] == '/')
+            mono_cfg_dir [i] = '\\';
+    }
+#endif
+  }
+}
+
+
 static MonoString *
 ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
 {
@@ -3010,7 +3087,7 @@ ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
        if (mcpath != NULL)
                return mcpath;
 
-       path = g_build_path (G_DIR_SEPARATOR_S, MONO_CFG_DIR, "mono", "machine.config", NULL);
+       path = g_build_path (G_DIR_SEPARATOR_S, mono_cfg_dir, "mono", "machine.config", NULL);
 
 #if defined (PLATFORM_WIN32)
        /* Avoid mixing '/' and '\\' */
@@ -3027,6 +3104,89 @@ ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
        return mcpath;
 }
 
+static void
+ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoString *message)
+{
+#if defined (PLATFORM_WIN32)
+       static void (*output_debug) (gchar *);
+       static gboolean tried_loading = FALSE;
+       gchar *str;
+
+       MONO_ARCH_SAVE_REGS;
+
+       if (!tried_loading && output_debug == NULL) {
+               GModule *k32;
+
+               tried_loading = TRUE;
+               k32 = g_module_open ("kernel32", G_MODULE_BIND_LAZY);
+               if (!k32) {
+                       gchar *error = g_strdup (g_module_error ());
+                       g_warning ("Failed to load kernel32.dll: %s\n", error);
+                       g_free (error);
+                       return;
+               }
+
+               g_module_symbol (k32, "OutputDebugStringW", (gpointer *) &output_debug);
+               if (!output_debug) {
+                       gchar *error = g_strdup (g_module_error ());
+                       g_warning ("Failed to load OutputDebugStringW: %s\n", error);
+                       g_free (error);
+                       return;
+               }
+       }
+
+       if (output_debug == NULL)
+               return;
+       
+       str = mono_string_to_utf8 (message);
+       output_debug (str);
+       g_free (str);
+#else
+       g_warning ("WriteWindowsDebugString called and PLATFORM_WIN32 not defined!\n");
+#endif
+}
+
+/* Only used for value types */
+static MonoObject *
+ves_icall_System_Activator_CreateInstanceInternal (MonoReflectionType *type)
+{
+       MonoClass *klass;
+       MonoDomain *domain;
+       
+       MONO_ARCH_SAVE_REGS;
+
+       domain = mono_object_domain (type);
+       klass = mono_class_from_mono_type (type->type);
+
+       return mono_object_new (domain, klass);
+}
+
+static MonoReflectionMethod *
+ves_icall_MonoMethod_get_base_definition (MonoReflectionMethod *m)
+{
+       MonoClass *klass;
+       MonoMethod *method = m->method;
+       MonoMethod *result = NULL;
+
+       MONO_ARCH_SAVE_REGS;
+
+       if (!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
+            method->klass->flags & TYPE_ATTRIBUTE_INTERFACE ||
+            method->flags & METHOD_ATTRIBUTE_NEW_SLOT)
+               return m;
+
+       if (method->klass == NULL || (klass = method->klass->parent) == NULL)
+               return m;
+
+       if (klass->vtable_size > method->slot)
+               result = klass->vtable [method->slot];
+
+       if (result == NULL)
+               return m;
+
+       return mono_method_get_object (mono_domain_get (), result, NULL);
+}
+
 /* icall map */
 
 static gconstpointer icall_map [] = {
@@ -3093,7 +3253,7 @@ static gconstpointer icall_map [] = {
        "System.String::InternalStrcpy(string,int,string,int,int)", ves_icall_System_String_InternalStrcpy_StrN,
        "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
        "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
-       "System.String::InternalCompare(string,int,string,int,int,bool)", ves_icall_System_String_InternalCompareStr_N,
+       "System.String::InternalCompare(string,int,string,int,int,int)", ves_icall_System_String_InternalCompareStr_N,
        "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
        "System.String::get_Chars", ves_icall_System_String_get_Chars,
 
@@ -3108,8 +3268,13 @@ static gconstpointer icall_map [] = {
        "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
        "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
        "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
-       "System.AppDomain::Unload", ves_icall_System_AppDomain_Unload,
+       "System.AppDomain::InternalUnload", ves_icall_System_AppDomain_InternalUnload,
        "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
+       "System.AppDomain::InternalSetDomain", ves_icall_System_AppDomain_InternalSetDomain,
+       "System.AppDomain::InternalSetDomainByID", ves_icall_System_AppDomain_InternalSetDomainByID,
+       "System.AppDomain::InternalSetContext", ves_icall_System_AppDomain_InternalSetContext,
+       "System.AppDomain::InternalGetContext", ves_icall_System_AppDomain_InternalGetContext,
+       "System.AppDomain::InternalGetDefaultContext", ves_icall_System_AppDomain_InternalGetDefaultContext,
 
        /*
         * System.AppDomainSetup
@@ -3149,6 +3314,7 @@ static gconstpointer icall_map [] = {
         * ModuleBuilder
         */
        "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
+       "System.Reflection.Emit.ModuleBuilder::basic_init", mono_image_module_basic_init,
        
        /*
         * AssemblyBuilder
@@ -3157,6 +3323,7 @@ static gconstpointer icall_map [] = {
        "System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
        "System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
        "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
+       "System.Reflection.Emit.AssemblyBuilder::build_metadata", ves_icall_AssemblyBuilder_build_metadata,
 
        /*
         * Reflection stuff.
@@ -3177,6 +3344,7 @@ static gconstpointer icall_map [] = {
        "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
 
        "System.RuntimeMethodHandle::GetFunctionPointer", ves_icall_RuntimeMethod_GetFunctionPointer,
+       "System.Reflection.MonoMethod::get_base_definition", ves_icall_MonoMethod_get_base_definition,
        
        /* System.Enum */
 
@@ -3395,8 +3563,8 @@ static gconstpointer icall_map [] = {
         * System.Security.Cryptography calls
         */
 
-        "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
-        "System.Security.Cryptography.RNGCryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
+        "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetBytes,
+        "System.Security.Cryptography.RNGCryptoServiceProvider::InternalGetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_InternalGetNonZeroBytes,
        
        /*
         * System.Buffer
@@ -3445,21 +3613,24 @@ static gconstpointer icall_map [] = {
        /*
         * System.Math
         */
+       "System.Math::Floor", ves_icall_System_Math_Floor,
+       "System.Math::Round", ves_icall_System_Math_Round,
+       "System.Math::Round2", ves_icall_System_Math_Round2,
        "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::PowImpl", ves_icall_System_Math_Pow,
-    "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
+        "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
@@ -3472,6 +3643,8 @@ static gconstpointer icall_map [] = {
        "System.Environment::get_TickCount", ves_icall_System_Environment_get_TickCount,
        "System.Environment::Exit", ves_icall_System_Environment_Exit,
        "System.Environment::get_Platform", ves_icall_System_Environment_get_Platform,
+       "System.Environment::get_ExitCode", mono_environment_exitcode_get,
+       "System.Environment::set_ExitCode", mono_environment_exitcode_set,
 
        /*
         * System.Runtime.Remoting
@@ -3481,6 +3654,14 @@ static gconstpointer icall_map [] = {
        "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
        ves_icall_IsTransparentProxy,
 
+       /*
+        * System.Runtime.Remoting.Activation
+        */     
+       "System.Runtime.Remoting.Activation.ActivationServices::AllocateUninitializedClassInstance",
+       ves_icall_System_Runtime_Activation_ActivationServices_AllocateUninitializedClassInstance,
+       "System.Runtime.Remoting.Activation.ActivationServices::EnableProxyActivation",
+       ves_icall_System_Runtime_Activation_ActivationServices_EnableProxyActivation,
+
        /*
         * System.Runtime.Remoting.Messaging
         */     
@@ -3490,7 +3671,7 @@ static gconstpointer icall_map [] = {
        /*
         * System.Runtime.Remoting.Proxies
         */     
-       "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy", 
+       "System.Runtime.Remoting.Proxies.RealProxy::InternalGetTransparentProxy", 
        ves_icall_Remoting_RealProxy_GetTransparentProxy,
 
        /*
@@ -3547,6 +3728,9 @@ static gconstpointer icall_map [] = {
        "System.Reflection.Assembly::MonoDebugger_GetMethod",
        ves_icall_MonoDebugger_GetMethod,
 
+       "System.Reflection.Assembly::MonoDebugger_GetMethodToken",
+       ves_icall_MonoDebugger_GetMethodToken,
+
        "System.Reflection.Assembly::MonoDebugger_GetLocalTypeFromSignature",
        ves_icall_MonoDebugger_GetLocalTypeFromSignature,
 
@@ -3559,6 +3743,17 @@ static gconstpointer icall_map [] = {
        "System.Configuration.DefaultConfig::get_machine_config_path",
        ves_icall_System_Configuration_DefaultConfig_get_machine_config_path,
 
+       /*
+        * System.Diagnostics.DefaultTraceListener
+        */
+       "System.Diagnostics.DefaultTraceListener::WriteWindowsDebugString",
+       ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString,
+       /*
+        * System.Activator
+        */
+       "System.Activator::CreateInstanceInternal",
+       ves_icall_System_Activator_CreateInstanceInternal,
+
        /*
         * add other internal calls here
         */