[sgen] Binary protocol for every write barrier, not just the generic store one.
[mono.git] / mono / metadata / appdomain.c
index 9797a47b5a6ad56299aece4bebdfeb6f6037a2da..f9cb246a676807b76f62da4f0d147a42a6f1c98e 100644 (file)
 #include <config.h>
 #include <glib.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #ifdef HAVE_UTIME_H
 #include <utime.h>
 #else
@@ -73,7 +73,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 95
+#define MONO_CORLIB_VERSION 96
 
 typedef struct
 {
@@ -1099,7 +1099,7 @@ set_domain_search_path (MonoDomain *domain)
        if (setup->private_bin_path) {
                search_path = mono_string_to_utf8_checked (setup->private_bin_path, &error);
                if (!mono_error_ok (&error)) { /*FIXME maybe we should bubble up the error.*/
-                       g_warning ("Could not decode AppDomain search path since it contains invalid caracters");
+                       g_warning ("Could not decode AppDomain search path since it contains invalid characters");
                        mono_error_cleanup (&error);
                        mono_domain_assemblies_unlock (domain);
                        return;
@@ -1481,10 +1481,22 @@ static gboolean
 private_file_needs_copying (const char *src, struct stat *sbuf_src, char *dest)
 {
        struct stat sbuf_dest;
+       gchar *real_src = mono_portability_find_file (src, TRUE);
+
+       if (!real_src)
+               real_src = (gchar*)src;
        
-       if (stat (src, sbuf_src) == -1 || stat (dest, &sbuf_dest) == -1)
+       if (stat (real_src, sbuf_src) == -1) {
+               time_t tnow = time (NULL);
+               memset (sbuf_src, 0, sizeof (*sbuf_src));
+               sbuf_src->st_mtime = tnow;
+               sbuf_src->st_atime = tnow;
                return TRUE;
+       }
 
+       if (stat (dest, &sbuf_dest) == -1)
+               return TRUE;
+       
        if (sbuf_src->st_size == sbuf_dest.st_size &&
            sbuf_src->st_mtime == sbuf_dest.st_mtime)
                return FALSE;
@@ -2157,21 +2169,23 @@ clear_cached_vtable (MonoVTable *vtable)
        MonoClass *klass = vtable->klass;
        MonoDomain *domain = vtable->domain;
        MonoClassRuntimeInfo *runtime_info;
+       void *data;
 
        runtime_info = klass->runtime_info;
        if (runtime_info && runtime_info->max_domain >= domain->domain_id)
                runtime_info->domain_vtables [domain->domain_id] = NULL;
-       if (vtable->data && klass->has_static_refs)
-               mono_gc_free_fixed (vtable->data);
+       if (klass->has_static_refs && (data = mono_vtable_get_static_field_data (vtable)))
+               mono_gc_free_fixed (data);
 }
 
 static G_GNUC_UNUSED void
 zero_static_data (MonoVTable *vtable)
 {
        MonoClass *klass = vtable->klass;
+       void *data;
 
-       if (vtable->data && klass->has_static_refs)
-               memset (vtable->data, 0, mono_class_data_size (klass));
+       if (klass->has_static_refs && (data = mono_vtable_get_static_field_data (vtable)))
+               mono_gc_bzero (data, mono_class_data_size (klass));
 }
 
 typedef struct unload_data {