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][interp] Update mono struct lowering to use MonoMemoryManager #102486

Merged
merged 3 commits into from
May 23, 2024

Conversation

kotlarmilos
Copy link
Member

Description

This PR updates mono_metadata_signature_dup_new_params to use MonoMemoryManager instead of MonoMemPool. The mempool can be detroyed after method is compiled.

Fixes #102478

Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@matouskozak matouskozak left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the quick fix. The failing test was caused by my PR #102143 and the fact that at the moment when the CI ran on my PR the SwiftErrorHandling tests were disabled so it didn't get caught before merging.

@@ -7585,7 +7585,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}

// Create a new dummy signature with the lowered arguments
fsig = mono_metadata_signature_dup_new_params (cfg->mempool, fsig, new_param_count, (MonoType**)new_params->data);
fsig = mono_metadata_signature_dup_new_params (cfg->mem_manager, fsig, new_param_count, (MonoType**)new_params->data);
Copy link
Member

Choose a reason for hiding this comment

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

Is this really needed though ? While interpreter requires the signature to be alive after the code is compiled, I don't think jit code has this constraint. This change prevents the signature from being freed as it was done before.

Copy link
Member

@matouskozak matouskozak May 22, 2024

Choose a reason for hiding this comment

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

We could use a similar approach as with mono_metadata_signature_dup_internal

mono_metadata_signature_dup_internal (MonoImage *image, MonoMemPool *mp, MonoMemoryManager *mem_manager,
and use mempool for JIT and mem_manager for interpreter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, updated.

…r a MonoMethodSignature based on the provided parameters
@@ -2559,13 +2576,13 @@ mono_metadata_signature_dup_delegate_invoke_to_target (MonoMethodSignature *sig)
* @return the new \c MonoMethodSignature structure.
*/
MonoMethodSignature*
mono_metadata_signature_dup_new_params (MonoMemPool *mp, MonoMethodSignature *sig, uint32_t num_params, MonoType **new_params)
mono_metadata_signature_dup_new_params (MonoImage *image, MonoMemPool *mp, MonoMemoryManager *mem_manager, MonoMethodSignature *sig, uint32_t num_params, MonoType **new_params)
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we can drop the image arg here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I added it for future extensibility, but not needed at this point.

@kotlarmilos kotlarmilos merged commit aabefea into dotnet:main May 23, 2024
79 checks passed
steveharter pushed a commit to steveharter/runtime that referenced this pull request May 28, 2024
…otnet#102486)

* Update mono_metadata_signature_dup_new_params to use MonoMemoryManager

* Refactor mono_metadata_signature_dup_new_params to allocate memory for a MonoMethodSignature based on the provided parameters

* Remove unused param from the mono_metadata_signature_dup_new_params
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
…otnet#102486)

* Update mono_metadata_signature_dup_new_params to use MonoMemoryManager

* Refactor mono_metadata_signature_dup_new_params to allocate memory for a MonoMethodSignature based on the provided parameters

* Remove unused param from the mono_metadata_signature_dup_new_params
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 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.

Abort on mono in SwiftErrorHandling
3 participants