Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[mono][interp] Remove no longer used hashtable
  • Loading branch information
BrzVlad committed Apr 11, 2024
commit 2b74a8a8e236c6010ae72e7497b98e8fa8921d57
39 changes: 1 addition & 38 deletions src/mono/mono/mini/interp/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ static gboolean debugger_enabled = FALSE;

static MonoException* do_transform_method (InterpMethod *imethod, InterpFrame *method, ThreadContext *context);

static InterpMethod* lookup_method_pointer (gpointer addr);

typedef void (*ICallMethod) (InterpFrame *frame);

static MonoNativeTlsKey thread_context_id;
Expand Down Expand Up @@ -3262,20 +3260,6 @@ interp_compile_interp_method (MonoMethod *method, MonoError *error)
return imethod->jinfo;
}

static InterpMethod*
lookup_method_pointer (gpointer addr)
{
InterpMethod *res = NULL;
MonoJitMemoryManager *jit_mm = get_default_jit_mm ();

jit_mm_lock (jit_mm);
if (jit_mm->interp_method_pointer_hash)
res = (InterpMethod*)g_hash_table_lookup (jit_mm->interp_method_pointer_hash, addr);
jit_mm_unlock (jit_mm);

return res;
}

#ifndef MONO_ARCH_HAVE_INTERP_NATIVE_TO_MANAGED
static void
interp_no_native_to_managed (void)
Expand Down Expand Up @@ -3380,13 +3364,6 @@ interp_create_method_pointer_llvmonly (MonoMethod *method, gboolean unbox, MonoE

addr = mini_llvmonly_create_ftndesc (method, entry_wrapper, entry_ftndesc);

MonoJitMemoryManager *jit_mm = jit_mm_for_method (method);
jit_mm_lock (jit_mm);
if (!jit_mm->interp_method_pointer_hash)
jit_mm->interp_method_pointer_hash = g_hash_table_new (NULL, NULL);
g_hash_table_insert (jit_mm->interp_method_pointer_hash, addr, imethod);
jit_mm_unlock (jit_mm);

mono_memory_barrier ();
if (unbox)
imethod->llvmonly_unbox_entry = addr;
Expand Down Expand Up @@ -3538,13 +3515,6 @@ interp_create_method_pointer (MonoMethod *method, gboolean compile, MonoError *e

addr = mono_create_ftnptr_arg_trampoline (ftndesc, entry_wrapper);

MonoJitMemoryManager *jit_mm = get_default_jit_mm ();
jit_mm_lock (jit_mm);
if (!jit_mm->interp_method_pointer_hash)
jit_mm->interp_method_pointer_hash = g_hash_table_new (NULL, NULL);
g_hash_table_insert (jit_mm->interp_method_pointer_hash, addr, imethod);
jit_mm_unlock (jit_mm);

mono_memory_barrier ();
imethod->jit_entry = addr;

Expand All @@ -3555,23 +3525,16 @@ static void
interp_free_method (MonoMethod *method)
{
MonoJitMemoryManager *jit_mm = jit_mm_for_method (method);
InterpMethod *imethod;
MonoDynamicMethod *dmethod = (MonoDynamicMethod*)method;

jit_mm_lock (jit_mm);
imethod = (InterpMethod*)mono_internal_hash_table_lookup (&jit_mm->interp_code_hash, method);

#if HOST_BROWSER
InterpMethod *imethod = (InterpMethod*)mono_internal_hash_table_lookup (&jit_mm->interp_code_hash, method);
mono_jiterp_free_method_data (method, imethod);
#endif

mono_internal_hash_table_remove (&jit_mm->interp_code_hash, method);
if (imethod && jit_mm->interp_method_pointer_hash) {
if (imethod->jit_entry)
g_hash_table_remove (jit_mm->interp_method_pointer_hash, imethod->jit_entry);
if (imethod->llvmonly_unbox_entry)
g_hash_table_remove (jit_mm->interp_method_pointer_hash, imethod->llvmonly_unbox_entry);
}
jit_mm_unlock (jit_mm);

if (dmethod->mp) {
Expand Down
1 change: 0 additions & 1 deletion src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -4452,7 +4452,6 @@ free_jit_mem_manager (MonoMemoryManager *mem_manager)
g_hash_table_destroy (info->dyn_delegate_info_hash);
g_hash_table_destroy (info->static_rgctx_trampoline_hash);
g_hash_table_destroy (info->mrgctx_hash);
g_hash_table_destroy (info->interp_method_pointer_hash);
mono_conc_hashtable_destroy (info->runtime_invoke_hash);
g_hash_table_destroy (info->seq_points);
g_hash_table_destroy (info->arch_seq_points);
Expand Down
2 changes: 0 additions & 2 deletions src/mono/mono/mini/mini-runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ typedef struct {
MonoInternalHashTable interp_code_hash;
/* Maps MonoMethod -> MonoMethodRuntimeGenericContext */
GHashTable *mrgctx_hash;
/* Maps gpointer -> InterpMethod */
GHashTable *interp_method_pointer_hash;
/* Protected by 'jit_code_hash_lock' */
MonoInternalHashTable jit_code_hash;
mono_mutex_t jit_code_hash_lock;
Expand Down