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

MarkInterfacesNeededByBodyStack keeps more interfaces than necessary #1428

Open
MichalStrehovsky opened this issue Aug 11, 2020 · 0 comments

Comments

@MichalStrehovsky
Copy link
Member

I found this by accident when I failed one of the tests for this and was left scratching my head why the test expects a useless interface to be kept.

The MarkInterfacesNeededByBodyStack logic was introduced in #463. The argument for adding this was that this is necessary to produce correct IL. The IL is correct even without this step. This step is necessary to produce verifiable IL (both "correct" and "verifiable" IL are terms defined in the ECMA-335 spec).

E.g. the implementation of Unsafe.As does exactly this and is unverifiable, but correct.

E.g. here's correctness and verifiabilily of stfld as defined in the ECMA spec:

image

The logic in question is trying to ensure the "verifier-assignable-to" relationship, which is necessary for verifiable IL. Correct IL only requires that the type of the location matches the IL stack type (e.g. we're not trying to store a reference type into a float field).

Do we need linker to produce verifiable IL by default? I think it would be fine to put the MethodBodyScanner heuristic under a switch that is off by default and squeeze out a couple extra kB in savings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants