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

Use mono_runtime_invoke to invoke finalizers. #1316

Merged
merged 2 commits into from
Jul 13, 2020

Conversation

TautvydasZilys
Copy link

On macOS ARM64, you're supposed to mark JIT memory executable before you invoke it. Currently, when invoking finalizers, we invoke JITed code directly from "gc.c", which means we don't have a chance to switch to executable mode.

To fix this, I changed gc.c to go through mono_runtime_invoke. That way all the setup can be done there. It fixes the issue completely.

…e can do whatever is necessary to transition to executing managed code, like marking JIT memory executable on macOS ARM64.
@TautvydasZilys
Copy link
Author

I'm going to test this in ABV before merging.

…lvirt Finalize() on the object and if it didn't have a finalizer, it would call Object::Finalize(). However, since now we use mono_method_invoke with a concrete method, we crash if it's null. So we just
@TautvydasZilys
Copy link
Author

Everything looks great on Unity's side.

@TautvydasZilys TautvydasZilys merged commit a1b76c5 into unity-master Jul 13, 2020
@TautvydasZilys TautvydasZilys deleted the macos-arm64-finalizer-fix-2 branch July 13, 2020 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants