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] Precompute the CallInfo structure used by the mono_arch_..nati… #88369

Merged
merged 3 commits into from
Jul 10, 2023

Conversation

vargaz
Copy link
Contributor

@vargaz vargaz commented Jul 4, 2023

…ve_call_context_.. functions.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 4, 2023
@ghost ghost assigned vargaz Jul 4, 2023
@vargaz
Copy link
Contributor Author

vargaz commented Jul 4, 2023

This speeds up ves_pinvoke_method () in the interpreter, including the icalls which use QCallTypeHandle.

if (!call_info) {
call_info = mono_arch_get_interp_native_call_info (get_default_mem_manager (), sig);
mono_memory_barrier ();
*cache = call_info;
Copy link
Member

Choose a reason for hiding this comment

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

We should use a CAS here to avoid leaks from races

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The memory is allocated from the mem manager, so its going to be leaked anyway.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Also a mono_memory_write_barrier here is enough.

@vargaz
Copy link
Contributor Author

vargaz commented Jul 4, 2023

This speeds up this testcase by about 50% when running with the interpreter:

        for (int i = 0; i < 10000000; ++i) {
            var t = typeof (int).DeclaringType;
        }

@danmoseley danmoseley added area-VM-meta-mono and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jul 4, 2023
@vargaz vargaz merged commit 09f4951 into dotnet:main Jul 10, 2023
@vargaz vargaz deleted the native-call-context branch July 10, 2023 23:41
@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 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.

4 participants