Skip to content

Implement JSR-45 for Scala 3 #8

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

Closed
anatoliykmetyuk opened this issue Nov 8, 2022 · 2 comments
Closed

Implement JSR-45 for Scala 3 #8

anatoliykmetyuk opened this issue Nov 8, 2022 · 2 comments

Comments

@anatoliykmetyuk
Copy link

anatoliykmetyuk commented Nov 8, 2022

Debugging inlined calls in Scala 3 is tricky since they may come from a different file, and the information stored in the class files is insufficient to locate that other file. JSR-45 is a class file extension format used by other JVM-based languages to solve this problem. This project aims to add information necessary to debug inlined calls in Scala using JSR-45.

Some work was already done around project: #15684.

The work is incomplete though: in most cases, it works, but it breaks certain assumptions inside the compiler which makes it fail in corner cases. Those cases need to be investigated, and the solution proposed in that PR needs to be modified to take them into account.

As part of this project, you will:

  • Familiarise yourself with the JSR-45 specification and format.
  • Familiarise yourself with the prior work done on the project.
  • Investigate existing test failures at the linked PR.
  • Investigate and implement possible solutions to the test failures.
  • Write feature tests to make sure the feature works.

The project will be interesting to anyone looking to get familiar with the Scala 3 compiler.

@anatoliykmetyuk
Copy link
Author

anatoliykmetyuk commented Feb 16, 2023

https://github.com/lampepfl/dotty/pull/15684/files#diff-dedc82431ec1fb02535bbab3742b2313abf87721d05295a14e29a93950853be1R251 – this is where an assumption gets broken.

Trees store information about their positions and source file location. JSR-45 changes this information as early as in the Inliner phase. It turns out, some downstream phases rely on this information – e.g. the Constructors phase. If the source file is changed, certain asserts may no longer work, since they may check for consistency in source file locations.

@julienrf
Copy link

julienrf commented Jun 30, 2023

This project has been implemented by Théo Abel (@Tetchki). You can find the corresponding PR at scala/scala3#17055. Théo managed to fix all the regressions introduced by the previous work and to clean up the implementation. Before we can merge his contribution we still need to:

  • check that debuggers don't crash with virtual debug line numbers
  • update debuggers (scala-debug-adapter and IntelliJ's debugger) to leverage the new information attached to the classfiles to fix the behavior of “step into” when calling an inlined method

We may post another student project description for those remaining tasks.

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