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

Find a way of dealing with errors from findSharedData() in the JIT #12264

Open
Leonardo2718 opened this issue Mar 22, 2021 · 0 comments
Open

Comments

@Leonardo2718
Copy link
Contributor

In #9416, it was discovered that when a call to findSharedData() fails (i.e. returns error), it can put the JIT in an inconsistent state. In that particular issue, the defining class of a field (also looked up through findSharedData()) is found to be NULL (see #9416 (comment) and #9416 (comment)).

Although that particular issue can be resolved by changing the assert into a failCompilation() call, there is a more fundamental issue that needs to be investigated and resolved. When compiling a method, it seems reasonable to assume that if a field was successfully looked up then looking up its defining class should also be successful, since looking up the latter is required when looking up the first. The assert mentioned in #9416 was introduced precisely because of this assumption. As such, it is possible that other parts of the code operate under similar assumptions. It's also possible that future code will make such assumptions. As #9416 demonstrated, failures resulting from violations of such assumptions can be highly intermittent and difficult to debug, and even more so if the code does not use asserts. Therefore, having findSharedData() violate those assumptions is quite dangerous.

I think the basic solution should be to make it so that any APIs used in the JIT like fieldAttributes() and definingClassFromCPFieldRef() never return inconsistent answers. Consistency could be achieved in several ways, including:

  • Caching results from API calls
  • Improving handling of errors when findSharedData() is called so that inconsistent states cannot be reached (e.g. by aborting compilation immediately)
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