Skip to content

Commit

Permalink
[interp] check existence of InterpMethod before removing it from inte…
Browse files Browse the repository at this point in the history
…rp code hastable

when creating dynamic methods, we put those in a queue so they can be
collected later via `mono_jit_free_method ()`. the interpreter part was
assuming, as soon as we allocate a dynamic method, it will be executed
eventually and therefore an InterpMethod must exist in
`info.interp_code_hash`, but this isn't necessarily the case.
  • Loading branch information
lewurm authored and marek-safar committed Jun 18, 2018
1 parent f3235f3 commit 4e1474e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mono/mini/mini-runtime.c
Expand Up @@ -2240,7 +2240,8 @@ mono_jit_free_method (MonoDomain *domain, MonoMethod *method)
if (mono_use_interpreter) {
mono_domain_jit_code_hash_lock (domain);
/* InterpMethod is allocated in the domain mempool */
mono_internal_hash_table_remove (&info->interp_code_hash, method);
if (mono_internal_hash_table_lookup (&info->interp_code_hash, method))
mono_internal_hash_table_remove (&info->interp_code_hash, method);
mono_domain_jit_code_hash_unlock (domain);
}

Expand Down

0 comments on commit 4e1474e

Please sign in to comment.