2009-05-06 Zoltan Varga <vargaz@gmail.com>
+ * aot-compiler.c aot-runtime.c: Use our own hash function instead of
+ g_str_hash () which can change.
+
* driver.c (mini_regression): Disable optimizations not supported by
the cpu. Fixes #500019.
#endif /* #if !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */
+/*
+ * mono_aot_str_hash:
+ *
+ * Hash function for strings which we use to hash strings for things which are
+ * saved in the AOT image, since g_str_hash () can change.
+ */
+guint
+mono_aot_str_hash (gconstpointer v1)
+{
+ /* Same as g_str_hash () in glib */
+ char *p = (char *) v1;
+ guint hash = *p;
+
+ while (*p++) {
+ if (*p)
+ hash = (hash << 5) - hash + *p;
+ }
+
+ return hash;
+}
+
/*
* mono_aot_method_hash:
*
guint32 hash;
if (method->wrapper_type) {
- hash = g_str_hash (method->name);
+ hash = mono_aot_str_hash (method->name);
} else {
char *full_name = mono_method_full_name (method, TRUE);
// FIXME: Improve this (changing this requires bumping MONO_AOT_FILE_VERSION)
- hash = g_str_hash (full_name);
+ hash = mono_aot_str_hash (full_name);
g_free (full_name);
}
token = MONO_TOKEN_TYPE_DEF | (i + 1);
klass = mono_class_get (acfg->image, token);
full_name = mono_type_get_name_full (mono_class_get_type (klass), MONO_TYPE_NAME_FORMAT_FULL_NAME);
- hash = g_str_hash (full_name) % table_size;
+ hash = mono_aot_str_hash (full_name) % table_size;
g_free (full_name);
/* FIXME: Allocate from the mempool */
full_name = g_strdup_printf ("%s.%s", name_space, name);
}
}
- hash = g_str_hash (full_name) % table_size;
+ hash = mono_aot_str_hash (full_name) % table_size;
if (full_name != full_name_buf)
g_free (full_name);