Skip to content

Commit b46ffbf

Browse files
[mono] Fix the handling of jit icall wrappers in mono_aot_method_hash (), the name might be different at runtime if DISABLE_JIT is set. (#50497)
Co-authored-by: Zoltan Varga <vargaz@gmail.com>
1 parent a964474 commit b46ffbf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mono/mono/mini/aot-compiler.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10564,7 +10564,11 @@ mono_aot_method_hash (MonoMethod *method)
1056410564
hashes [0] = mono_metadata_str_hash (m_class_get_name (klass));
1056510565
hashes [1] = mono_metadata_str_hash (m_class_get_name_space (klass));
1056610566
}
10567-
hashes [2] = mono_metadata_str_hash (method->name);
10567+
if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE && mono_marshal_get_wrapper_info (method)->subtype == WRAPPER_SUBTYPE_ICALL_WRAPPER)
10568+
/* The name might not be set correctly if DISABLE_JIT is set */
10569+
hashes [2] = mono_marshal_get_wrapper_info (method)->d.icall.jit_icall_id;
10570+
else
10571+
hashes [2] = mono_metadata_str_hash (method->name);
1056810572
hashes [3] = method->wrapper_type;
1056910573
hashes [4] = mono_aot_type_hash (sig->ret);
1057010574
hindex = 5;

0 commit comments

Comments
 (0)