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] Migrate more ghashtables to simdhash #102476

Merged
merged 2 commits into from
Jun 8, 2024
Merged

[mono] Migrate more ghashtables to simdhash #102476

merged 2 commits into from
Jun 8, 2024

Conversation

kg
Copy link
Contributor

@kg kg commented May 21, 2024

Migrates various GHashTables in the mono runtime over to dn_simdhash, and optimizes a couple specific spots in the process.

There are more hash tables in mono that might be profitable to migrate based on profiling, but they're more complex scenarios, i.e. internal hash tables or concurrent hash tables, so I opted not to do them in this PR. In one case when I tried migrating one of them, things actually got slower.

Copy link
Member

@lambdageek lambdageek left a comment

Choose a reason for hiding this comment

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

lgtm, but I think we should get rid of the debugger engine hash table that's keyed by domain

src/mono/mono/component/debugger-engine.c Outdated Show resolved Hide resolved
kg added 2 commits June 5, 2024 15:35
(this message is wrong due to rebasing)
Use dn_simdhash_string_ptr for namespace lookup cache
Use simdhash for interp patch_sites_table
Migrate method and methodref cache to simdhash
Add missing include, fix typo
Migrate data_hash and patchsite_hash to simdhash
Pre-reserve capacity for some simdhash instances that grow during startup
Reduce initial size of these simdhashes because we have one instance per assembly
Fix bundled_resources by adding ANOTHER hash table
Migrate MonoJitMemoryManager::seq_points to simdhash
Add equivalent operation for g_hash_table_insert_replace
Rename simdhash replace operation to make it clear that it only replaces the value
Adjust modified code to have the same overwrite behavior as the old g_hash_table
Probably meaningless semantic tweak for replace handler
Migrate jit_code_hash and interp_code_hash to simdhash_ptr_ptr
Copy link
Member

@lambdageek lambdageek left a comment

Choose a reason for hiding this comment

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

looks good, but if you want to delete more MonoDomains from the debugger, please do it


for (guint i = 0; i < methods->len; ++i) {
m = (MonoMethod *)g_ptr_array_index (methods, i);
domain = (MonoDomain *)g_ptr_array_index (method_domains, i);
domain = user_data.domain;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need user_data.domain? can we just say domain = mono_get_root_domain(); or maybe change set_bp_in_method to call mono_get_root_domain() directly, if necessary (and I'm hoping it's not even necessary. We only really need to mention domains at the debugger protocol boundary, probably).

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the code, I think we should just delete domain from BreakpointInstance and then chase down all the places that touch that field.

@kg kg merged commit 2da65a9 into dotnet:main Jun 8, 2024
138 of 142 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2024
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.

2 participants