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

Change callvirt into calli for virtual delegates #83461

Merged
merged 27 commits into from Apr 26, 2023

Conversation

LeVladIonescu
Copy link
Contributor

@LeVladIonescu LeVladIonescu commented Mar 15, 2023

Related to #83329.

@LeVladIonescu LeVladIonescu marked this pull request as ready for review March 16, 2023 13:21
@SamMonoRT SamMonoRT requested a review from trylek March 16, 2023 19:14
@@ -6287,7 +6283,7 @@ mono_marshal_free_dynamic_wrappers (MonoMethod *method)
if (image->wrapper_caches.runtime_invoke_method_cache)
clear_runtime_invoke_method_cache (image->wrapper_caches.runtime_invoke_method_cache, method);
if (image->wrapper_caches.delegate_abstract_invoke_cache)
g_hash_table_foreach_remove (image->wrapper_caches.delegate_abstract_invoke_cache, signature_pointer_pair_matches_pointer, method);
g_hash_table_remove (image->wrapper_caches.delegate_abstract_invoke_cache, mono_method_signature_internal (method));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not be needed anymore since the wrappers are no longer associated with the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And how is that cache going to be freed if we remove it from here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Its freed already in marshal.c, we just don't need to handle it here, since these wrappers will no longer depend on dynamic methods.

Vlad - Alexandru Ionescu and others added 2 commits April 3, 2023 19:56
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-4.local>
@LeVladIonescu
Copy link
Contributor Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Vlad - Alexandru Ionescu added 2 commits April 13, 2023 02:43
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-4.local>
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-4.local>
@kg
Copy link
Contributor

kg commented Apr 13, 2023

I can reproduce the browser System.Runtime.Tests failure in console with XUNIT_RANDOM_ORDER_SEED=875207244. It occurs in AOT but not in interp mode, and occurs even if jiterpreter is disabled. It seems to be some sort of problem with the AOT<->interp transitions that are happening when most of the test suite is AOT'd.

@kg
Copy link
Contributor

kg commented Apr 13, 2023

Error info from a modified debug build:

* Assertion at /home/kate/Projects/dotnet-runtime-wasm/src/mono/mono/mini/interp/interp.c:1874, condition `ftndesc->method' not met
at mono_wasm_stringify_as_error_with_stack (/home/kate/Projects/dotnet-runtime-wasm/artifacts/bin/System.Runtime.Tests/Debug/net8.0-browser/browser-wasm/AppBundle/dotnet.js:810:22)
at mono_wasm_trace_logger (/home/kate/Projects/dotnet-runtime-wasm/artifacts/bin/System.Runtime.Tests/Debug/net8.0-browser/browser-wasm/AppBundle/dotnet.js:829:31)
at wasm_trace_logger (wasm_trace_logger (wasm://wasm/1fdbaf7e:wasm-function[109418]:0x672e272))
at eglib_log_adapter (eglib_log_adapter (wasm://wasm/1fdbaf7e:wasm-function[93132]:0x61719b4))
at monoeg_g_logstr (monoeg_g_logstr (wasm://wasm/1fdbaf7e:wasm-function[92989]:0x616175b))
at monoeg_g_logv_nofree (monoeg_g_logv_nofree (wasm://wasm/1fdbaf7e:wasm-function[92987]:0x61615c4))
at monoeg_assertion_message (monoeg_assertion_message (wasm://wasm/1fdbaf7e:wasm-function[92991]:0x616183c))
at mono_assertion_message (mono_assertion_message (wasm://wasm/1fdbaf7e:wasm-function[92992]:0x61618ea))
at mono_interp_exec_method (mono_interp_exec_method (wasm://wasm/1fdbaf7e:wasm-function[92646]:0x612c6a5))
at interp_entry (interp_entry (wasm://wasm/1fdbaf7e:wasm-function[92719]:0x6131807))
at interp_entry_instance_ret_1 (interp_entry_instance_ret_1 (wasm://wasm/1fdbaf7e:wasm-function[92733]:0x6131eb5))
at aot_instances_aot_wrapper_gsharedvt_in_sig_obj_this_bii (aot_instances_aot_wrapper_gsharedvt_in_sig_obj_this_bii (wasm://wasm/1fdbaf7e:wasm-function[68462]:0x45f40a3))
at System_Runtime_Tests_System_Tests_CreateDelegateTests_CreateDelegate10_Nullable_Method (System_Runtime_Tests_System_Tests_CreateDelegateTests_CreateDelegate10_Nullable_Method (wasm://wasm/1fdbaf7e:wasm-function[40702]:0x2094aad))

@kg
Copy link
Contributor

kg commented Apr 13, 2023

That assertion is in ftnptr_to_imethod, which means it's either in the implementation of CALLI or interp_delegate_ctor.

Vlad - Alexandru Ionescu and others added 4 commits April 19, 2023 16:33
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-4.local>
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-5.local>
@LeVladIonescu
Copy link
Contributor Author

This version is ready to be merged
cc @vargaz @lambdageek @SamMonoRT

@SamMonoRT
Copy link
Member

Let's merge this after Preview4 snap.

@LeVladIonescu LeVladIonescu merged commit 2677eb2 into dotnet:main Apr 26, 2023
152 checks passed
@LeVladIonescu LeVladIonescu deleted the delegates_issue branch April 26, 2023 06:27
@ghost ghost locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants