Merge pull request #1909 from esdrubal/reflection
[mono.git] / mono / metadata / icall.c
index ef680e12a1e2807038b42d93f1deb39c785ed06a..6ab999ba126cb69b9da05f76c2ad1ba78591dc3a 100644 (file)
@@ -37,7 +37,6 @@
 #include <mono/metadata/object.h>
 #include <mono/metadata/threads.h>
 #include <mono/metadata/threads-types.h>
-#include <mono/metadata/threadpool.h>
 #include <mono/metadata/threadpool-ms.h>
 #include <mono/metadata/threadpool-ms-io.h>
 #include <mono/metadata/monitor.h>
@@ -66,7 +65,6 @@
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/locales.h>
 #include <mono/metadata/filewatcher.h>
-#include <mono/metadata/char-conversions.h>
 #include <mono/metadata/security.h>
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/cil-coff.h>
@@ -1163,6 +1161,18 @@ ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilder *mb, MonoObje
        mono_image_register_token (mb->dynamic_image, token, obj);
 }
 
+ICALL_EXPORT MonoObject*
+ves_icall_ModuleBuilder_GetRegisteredToken (MonoReflectionModuleBuilder *mb, guint32 token)
+{
+       gpointer obj;
+
+       mono_loader_lock ();
+       obj = mono_g_hash_table_lookup (mb->dynamic_image->tokens, GUINT_TO_POINTER (token));
+       mono_loader_unlock ();
+
+       return obj;
+}
+
 static gboolean
 get_caller (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data)
 {
@@ -2026,6 +2036,14 @@ fill_iface_array (gpointer key, gpointer value, gpointer user_data)
                mono_metadata_free_type (inflated);
 }
 
+static guint
+get_interfaces_hash (gconstpointer v1)
+{
+       MonoClass *k = (MonoClass*)v1;
+
+       return k->type_token;
+}
+
 ICALL_EXPORT MonoArray*
 ves_icall_Type_GetInterfaces (MonoReflectionType* type)
 {
@@ -2035,7 +2053,7 @@ ves_icall_Type_GetInterfaces (MonoReflectionType* type)
        FillIfaceArrayData data = { 0 };
        int len;
 
-       GHashTable *iface_hash = g_hash_table_new (NULL, NULL);
+       GHashTable *iface_hash = g_hash_table_new (get_interfaces_hash, NULL);
 
        if (class->generic_class && class->generic_class->context.class_inst->is_open) {
                data.context = mono_class_get_context (class);
@@ -6817,20 +6835,6 @@ ves_icall_System_NumberFormatter_GetFormatterTables (guint64 const **mantissas,
        *decHexDigits = Formatter_DecHexDigits;
 }
 
-/* These parameters are "readonly" in corlib/System/Globalization/TextInfo.cs */
-ICALL_EXPORT void
-ves_icall_System_Globalization_TextInfo_GetDataTablePointersLite (
-                                           guint16 const **to_lower_data_low,
-                                           guint16 const **to_lower_data_high,
-                                           guint16 const **to_upper_data_low,
-                                           guint16 const **to_upper_data_high)
-{
-       *to_lower_data_low = ToLowerDataLow;
-       *to_lower_data_high = ToLowerDataHigh;
-       *to_upper_data_low = ToUpperDataLow;
-       *to_upper_data_high = ToUpperDataHigh;
-}
-
 /*
  * We return NULL for no modifiers so the corlib code can return Type.EmptyTypes
  * and avoid useless allocations.