-
Notifications
You must be signed in to change notification settings - Fork 5k
[RuntimeAsync] Double check OSR in async2 struct instance methods #115259
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
Comments
These sort of complications make me think that perhaps we should still leave it up to the IL code generators to create these copies themselves. I think we are going to run into similar problems around EnC and also diagnostics with the implicitly created locals that are hidden from the user. Leaving it up to IL creators to create these copies would probably also simplify the spec; it is already saying that byrefs are not captured across suspension points, so the "this" argument in struct methods already fall under this rule, hence IL code generators are forced to create the copy if they need access to the instance after suspension points. Thoughts @333fred @agocke @davidwrighton @VSadov? |
We would still need some policy from the JIT on what happens when refs are alive across suspension points. Ideally that should not end in behavior that is dependent on whether suspension happened or not or on whether JIT is optimizing. |
Rewriting If there are no bugs, there should be no IL byrefs that try to be alive across awaits. I think we can guarantee this on Roslyn side. I just wonder what will happen if there is a bug, in Roslyn, or in some IL rewriting/instrumentation tool. Will JIT just throw I think I might prefer not accepting IL that carries byrefs across awaits. It feels a bit more deterministic, even if it may depend on whether the code was actually JIT-ed and perhaps on quality of flow analysis (and thus on JIT version or optimization mode). |
I agree, but I think this is orthogonal to this particular question -- we need some policy regardless.
It does seem hard to come up with good IL validity rules without having something like |
this may no longer be relevant. |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
OSR might not be saving the struct instance copy made implicitly by the JIT. Double check and fix this if necessary.
The text was updated successfully, but these errors were encountered: