Skip to content
Closed
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
Prev Previous commit
Next Next commit
Use m_class_has_cctor method to check if class requires no initializa…
…tion
  • Loading branch information
kotlarmilos committed Feb 28, 2023
commit 882353ea456b8dcbb738dce9cfa16afc1600526c
2 changes: 1 addition & 1 deletion src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -6591,7 +6591,7 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
MonoCompile *callee_cfg = (MonoCompile *)g_hash_table_lookup (acfg->method_to_cfg, cmethod);

// Enable direct call transformation where caller's class requires no initialization and callee can specialize
if (!m_class_has_static_refs (method->klass) && mono_aot_can_specialize (cmethod)) {
if (!m_class_has_cctor (method->klass) && mono_aot_can_specialize (cmethod)) {
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 Down