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][aot] Enable direct call transformation for MONO_PATCH_INFO_METHOD #82711

Closed
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
6 changes: 1 addition & 5 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -6588,12 +6588,9 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
direct_call_target = symbol;
patch_info->type = MONO_PATCH_INFO_NONE;
} else if ((m_class_get_image (patch_info->data.method->klass) == acfg->image) && !got_only && is_direct_callable (acfg, method, patch_info)) {
#if 0
// FIXME: Currently not used. It fails as some callees require initialization.
MonoCompile *callee_cfg = (MonoCompile *)g_hash_table_lookup (acfg->method_to_cfg, cmethod);

// Don't compile inflated methods if we're doing dedup
if (acfg->aot_opts.dedup && !mono_aot_can_dedup (cmethod)) {
if (!m_class_has_cctor (method->klass) && mono_aot_can_specialize (callee_cfg->method)) {
char *name = mono_aot_get_mangled_method_name (cmethod);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked into why this was not enabled before, and i don't think this is going to work. The callee method might use GOT slots etc. which are not initialized if the method is directly called. So before this can be enabled, the AOTed code needs to be changed to init itself, the same way the llvm compiled code does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Let's first try to enable method initialization during the invocation before proceeding with this and other direct call transformations.

mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "DIRECT CALL: %s by %s", name, method ? mono_method_full_name (method, TRUE) : "");
g_free (name);
Expand All @@ -6603,7 +6600,6 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
patch_info->type = MONO_PATCH_INFO_NONE;
acfg->stats.direct_calls ++;
}
#endif
}

acfg->stats.all_calls ++;
Expand Down