-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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][jit] Devirtualize ldarg(s)+callvirt where possible. #75748
Conversation
… vtable is unavailable. dotnet#33015
…so fails when klass is abstract.
… is devirtualized in callvirt handler now.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
…Fixed code style issues.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
the wasm build test failure was #76621 and should be fixed now |
Looks ok. |
try_prepare_objaddr_callvirt_optimization (MonoCompile *cfg, guchar *next_ip, guchar* end, MonoMethod *method, MonoGenericContext* generic_context, MonoClass *klass) | ||
{ | ||
// TODO: relax the _is_def requirement? | ||
if (cfg->compile_aot || cfg->compile_llvm || !klass || !mono_class_is_def (klass)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these can be relaxed later.
|
||
if (m_class_get_vtable (klass) == NULL) | ||
return FALSE; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can happen if the vtable is not created yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a vtable setup, as in the regular mono_class_get_virtual_method
.
…l_method_assumptions.
This addresses Mono:devirtualize sealed calls. If
ldarg(a)
is succeeded by acallvirt
, we devirtualize that call if we can resolve to a final method at that time. Additional conditions apply, mainly no AOT and no generics. The method also must have no arguments exceptthis
.The example from the said issue is now devirtualized and inlined. The codegen for
Test(B b)
is as follows on arm64:Given: