+2007-06-04 Mark Probst <mark.probst@gmail.com>
+
+ * interp.c, interp.h (RuntimeMethod): Due to the jit_code_hash
+ change in MonoDomain this had to be changed slightly, too.
+
2006-05-09 Miguel de Icaza <miguel@novell.com>
* interp.c (ves_exec_method_with_context): Pass a temporary to the
RuntimeMethod *rtm;
EnterCriticalSection (&runtime_method_lookup_section);
- if ((rtm = g_hash_table_lookup (domain->jit_code_hash, method))) {
+ if ((rtm = mono_internal_hash_table_lookup (&domain->jit_code_hash, method))) {
LeaveCriticalSection (&runtime_method_lookup_section);
return rtm;
}
rtm->param_count = mono_method_signature (method)->param_count;
rtm->hasthis = mono_method_signature (method)->hasthis;
rtm->valuetype = method->klass->valuetype;
- g_hash_table_insert (domain->jit_code_hash, method, rtm);
+ mono_internal_hash_table_insert (&domain->jit_code_hash, method, rtm);
LeaveCriticalSection (&runtime_method_lookup_section);
return rtm;
* Structure representing a method transformed for the interpreter
* This is domain specific
*/
-typedef struct
+typedef struct _RuntimeMethod
{
+ /* NOTE: These first two elements (method and
+ next_jit_code_hash) must be in the same order and at the
+ same offset as in MonoJitInfo, because of the jit_code_hash
+ internal hash table in MonoDomain. */
+ MonoMethod *method;
+ struct _RuntimeMethod *next_jit_code_hash;
guint32 locals_size;
guint32 args_size;
guint32 stack_size;
guint32 alloca_size;
unsigned short *code;
unsigned short *new_body_start; /* after all STINARG instrs */
- MonoMethod *method;
MonoPIFunc func;
int num_clauses;
MonoExceptionClause *clauses;
+2007-06-04 Mark Probst <mark.probst@gmail.com>
+
+ * domain.c, domain-internals.h (MonoDomain): jit_code_hash is a
+ MonoInternalHashTable now.
+
2007-05-31 Zoltan Varga <vargaz@gmail.com>
* domain-internals.h (MonoDomain): Add two new hash tables to store delegate
#include <mono/utils/mono-codeman.h>
#include <mono/utils/mono-hash.h>
#include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-internal-hash.h>
#include <mono/io-layer/io-layer.h>
extern CRITICAL_SECTION mono_delegate_section;
} MonoJitExceptionInfo;
struct _MonoJitInfo {
+ /* NOTE: These first two elements (method and
+ next_jit_code_hash) must be in the same order and at the
+ same offset as in RuntimeMethod, because of the jit_code_hash
+ internal hash table in MonoDomain. */
MonoMethod *method;
+ struct _MonoJitInfo *next_jit_code_hash;
gpointer code_start;
guint32 used_regs;
int code_size;
MONO_APPDOMAIN_UNLOADED
} MonoAppDomainState;
+typedef struct _MonoJitCodeHash MonoJitCodeHash;
+
struct _MonoDomain {
CRITICAL_SECTION lock;
MonoMemPool *mp;
GHashTable *class_vtable_hash;
/* maps remote class key -> MonoRemoteClass */
GHashTable *proxy_vtable_hash;
- GHashTable *jit_code_hash;
+ MonoInternalHashTable jit_code_hash;
/* maps MonoMethod -> MonoJitDynamicMethodInfo */
GHashTable *dynamic_code_hash;
MonoJitInfoTable *jit_info_table;
typedef MonoJitInfo *(*MonoJitInfoFindInAot) (MonoDomain *domain, MonoImage *image, gpointer addr);
void mono_install_jit_info_find_in_aot (MonoJitInfoFindInAot func) MONO_INTERNAL;
+void
+mono_jit_code_hash_init (MonoInternalHashTable *jit_code_hash) MONO_INTERNAL;
+
MonoAppDomain *
ves_icall_System_AppDomain_getCurDomain (void) MONO_INTERNAL;
return ji->method;
}
+static gpointer
+jit_info_key_extract (gpointer value)
+{
+ MonoJitInfo *info = (MonoJitInfo*)value;
+
+ return info->method;
+}
+
+static gpointer*
+jit_info_next_value (gpointer value)
+{
+ MonoJitInfo *info = (MonoJitInfo*)value;
+
+ return (gpointer*)&info->next_jit_code_hash;
+}
+
+void
+mono_jit_code_hash_init (MonoInternalHashTable *jit_code_hash)
+{
+ mono_internal_hash_table_init (jit_code_hash,
+ mono_aligned_addr_hash,
+ jit_info_key_extract,
+ jit_info_next_value);
+}
+
/**
* mono_string_equal:
* @s1: First string to compare
domain->class_vtable_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
domain->proxy_vtable_hash = g_hash_table_new ((GHashFunc)mono_ptrarray_hash, (GCompareFunc)mono_ptrarray_equal);
domain->static_data_array = NULL;
- domain->jit_code_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
+ mono_jit_code_hash_init (&domain->jit_code_hash);
domain->ldstr_table = mono_g_hash_table_new ((GHashFunc)mono_string_hash, (GCompareFunc)mono_string_equal);
domain->jit_info_table = mono_jit_info_table_new ();
domain->class_init_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
mono_gc_free_fixed (domain->static_data_array);
domain->static_data_array = NULL;
}
- g_hash_table_destroy (domain->jit_code_hash);
- domain->jit_code_hash = NULL;
+ mono_internal_hash_table_destroy (&domain->jit_code_hash);
if (domain->dynamic_code_hash) {
g_hash_table_foreach (domain->dynamic_code_hash, dynamic_method_info_free, NULL);
g_hash_table_destroy (domain->dynamic_code_hash);
+2007-06-04 Mark Probst <mark.probst@gmail.com>
+
+ * mini.c, driver.c: Changed MonoDomain.jit_code_hash to a
+ MonoInternalHashTable.
Mon Jun 4 11:29:43 CEST 2007 Paolo Molaro <lupus@ximian.com>
/* fixme: ugly hack - delete all previously compiled methods */
g_hash_table_destroy (mono_domain_get ()->jit_trampoline_hash);
mono_domain_get ()->jit_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
- g_hash_table_destroy (mono_domain_get ()->jit_code_hash);
- mono_domain_get ()->jit_code_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
+ mono_internal_hash_table_destroy (&(mono_domain_get ()->jit_code_hash));
+ mono_jit_code_hash_init (&(mono_domain_get ()->jit_code_hash));
g_timer_start (timer);
if (mini_stats_fd)
mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt)
{
MonoCompile *cfg;
- GHashTable *jit_code_hash;
gpointer code = NULL;
MonoJitInfo *info;
- jit_code_hash = target_domain->jit_code_hash;
-
method = mono_get_inflated_method (method);
#ifdef MONO_USE_AOT_COMPILER
/* Check if some other thread already did the job. In this case, we can
discard the code this thread generated. */
- if ((info = g_hash_table_lookup (target_domain->jit_code_hash, method))) {
+ if ((info = mono_internal_hash_table_lookup (&target_domain->jit_code_hash, method))) {
/* We can't use a domain specific method in another domain */
if ((target_domain == mono_domain_get ()) || info->domain_neutral) {
code = info->code_start;
}
if (code == NULL) {
- g_hash_table_insert (jit_code_hash, method, cfg->jit_info);
+ mono_internal_hash_table_insert (&target_domain->jit_code_hash, method, cfg->jit_info);
code = cfg->native_code;
}
mono_domain_lock (target_domain);
- if ((info = g_hash_table_lookup (target_domain->jit_code_hash, method))) {
+ if ((info = mono_internal_hash_table_lookup (&target_domain->jit_code_hash, method))) {
/* We can't use a domain specific method in another domain */
if (! ((domain != target_domain) && !info->domain_neutral)) {
mono_domain_unlock (target_domain);
return;
mono_domain_lock (domain);
g_hash_table_remove (domain->dynamic_code_hash, method);
- g_hash_table_remove (domain->jit_code_hash, method);
+ mono_internal_hash_table_remove (&domain->jit_code_hash, method);
g_hash_table_remove (domain->jump_trampoline_hash, method);
mono_domain_unlock (domain);
mono_domain_lock (target_domain);
- if ((info = g_hash_table_lookup (target_domain->jit_code_hash, method))) {
+ if ((info = mono_internal_hash_table_lookup (&target_domain->jit_code_hash, method))) {
/* We can't use a domain specific method in another domain */
if (! ((domain != target_domain) && !info->domain_neutral)) {
mono_domain_unlock (target_domain);