[runtime] Fix the isinst_with_cache wrapper on 64 bit platforms.
[mono.git] / mono / metadata / null-gc.c
index 86a2528b09f62a876d48a9d513c1c8364975350b..12f69e0df3f8f4f784b4e92a0416abbc5ce690c6 100644 (file)
@@ -11,7 +11,9 @@
 #include <mono/metadata/mono-gc.h>
 #include <mono/metadata/gc-internal.h>
 #include <mono/metadata/runtime.h>
+#include <mono/utils/atomic.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-counters.h>
 
 #ifdef HAVE_NULL_GC
 
@@ -19,12 +21,21 @@ void
 mono_gc_base_init (void)
 {
        MonoThreadInfoCallbacks cb;
+       int dummy;
+
+       mono_counters_init ();
 
        memset (&cb, 0, sizeof (cb));
-       cb.mono_method_is_critical = mono_runtime_is_critical_method;
+       /* TODO: This casts away an incompatible pointer type warning in the same
+                manner that boehm-gc does it. This is probably worth investigating
+                more carefully. */
+       cb.mono_method_is_critical = (gpointer)mono_runtime_is_critical_method;
        cb.mono_gc_pthread_create = (gpointer)mono_gc_pthread_create;
+       cb.thread_exit = mono_gc_pthread_exit;
 
        mono_threads_init (&cb, sizeof (MonoThreadInfo));
+
+       mono_thread_info_attach (&dummy);
 }
 
 void
@@ -183,7 +194,7 @@ mono_gc_wbarrier_set_arrayref (MonoArray *arr, gpointer slot_ptr, MonoObject* va
 void
 mono_gc_wbarrier_arrayref_copy (gpointer dest_ptr, gpointer src_ptr, int count)
 {
-       mono_gc_memmove (dest_ptr, src_ptr, count * sizeof (gpointer));
+       mono_gc_memmove_aligned (dest_ptr, src_ptr, count * sizeof (gpointer));
 }
 
 void
@@ -206,14 +217,14 @@ mono_gc_wbarrier_generic_nostore (gpointer ptr)
 void
 mono_gc_wbarrier_value_copy (gpointer dest, gpointer src, int count, MonoClass *klass)
 {
-       mono_gc_memmove (dest, src, count * mono_class_value_size (klass, NULL));
+       mono_gc_memmove_atomic (dest, src, count * mono_class_value_size (klass, NULL));
 }
 
 void
 mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src)
 {
        /* do not copy the sync state */
-       mono_gc_memmove ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject),
+       mono_gc_memmove_aligned ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject),
                        mono_object_class (obj)->instance_size - sizeof (MonoObject));
 }
 
@@ -223,8 +234,14 @@ mono_gc_is_critical_method (MonoMethod *method)
        return FALSE;
 }
 
+int
+mono_gc_get_aligned_size_for_allocator (int size)
+{
+       return size;
+}
+
 MonoMethod*
-mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box)
+mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box, gboolean known_instance_size)
 {
        return NULL;
 }
@@ -285,6 +302,12 @@ mono_gc_get_suspend_signal (void)
        return -1;
 }
 
+int
+mono_gc_get_restart_signal (void)
+{
+       return -1;
+}
+
 MonoMethod*
 mono_gc_get_write_barrier (void)
 {
@@ -371,7 +394,7 @@ mono_gc_conservatively_scan_area (void *start, void *end)
 }
 
 void *
-mono_gc_scan_object (void *obj)
+mono_gc_scan_object (void *obj, void *gc_data)
 {
        g_assert_not_reached ();
        return NULL;