Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono] Register static rgctx trampolines in the JIT info tables. #89142

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/mono/mono/mini/jit-icalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ mono_ldftn (MonoMethod *method)
} else {
addr = mono_create_jump_trampoline (method, FALSE, error);
if (mono_method_needs_static_rgctx_invoke (method, FALSE))
addr = mono_create_static_rgctx_trampoline (method, addr);
addr = mono_create_static_rgctx_trampoline (method, addr);
}
if (!is_ok (error)) {
mono_error_set_pending_exception (error);
Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/mini/mini-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -4029,6 +4029,7 @@ mini_init_delegate (MonoDelegateHandle delegate, MonoObjectHandle target, gpoint
MonoDelegateTrampInfo *info = NULL;

if (mono_use_interpreter) {
g_assert (method || del->interp_method);
mini_get_interp_callbacks ()->init_delegate (del, &info, error);
return_if_nok (error);
}
Expand Down
10 changes: 10 additions & 0 deletions src/mono/mono/mini/mini-trampolines.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ mono_create_static_rgctx_trampoline (MonoMethod *m, gpointer addr)
else
res = mono_arch_get_static_rgctx_trampoline (jit_mm->mem_manager, ctx, addr);

/* This address might be passed to mini_init_delegate () which needs to look up the method */
MonoJitInfo *ji;

ji = mini_alloc_jinfo (jit_mm, MONO_SIZEOF_JIT_INFO);
ji->code_start = MINI_FTNPTR_TO_ADDR (res);
/* Doesn't matter, just need to be able to look up the exact address */
ji->code_size = 4;
ji->d.method = m;
mono_jit_info_table_add (ji);

jit_mm_lock (jit_mm);
/* Duplicates inserted while we didn't hold the lock are OK */
info = (RgctxTrampInfo *)m_method_alloc (m, sizeof (RgctxTrampInfo));
Expand Down
Loading