RFR: 8322992: Javac fails with StackOverflowError when compiling deeply nested synchronized blocks [v3]

Vicente Romero vromero at openjdk.org
Mon Apr 22 15:20:56 UTC 2024


> This is a fix to a memory issue but I'm not totally sure we should apply it. Basically the issue here is that javac is failing because of lack of resources for a very deeply nested sequence of blocks. I was tracing the root cause and I found the fix for: [JDK-8291769](https://bugs.openjdk.org/browse/JDK-8291769) to be the one starting from which the stack overflow issue started to happen. Basically method Gen::visitBlock as refactored by fix for [JDK-8291769](https://bugs.openjdk.org/browse/JDK-8291769) occupies more memory than before, at execution time space for local variables is reserved regardless and after the mentioned fix the method has more local variables.
> 
> This refactoring proposed here fixes the stack overflow for the reproductor provided in the bug entry but it could be that if we add more nested blocks then we can make the compiler fail at some point. So the merit of this fix is arguable. Still the bug could be valid for the reporter so let's discuss if this fix should be pushed or not.
> 
> TIA

Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:

  adding a comment to Gen::visitBlock

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/18832/files
  - new: https://git.openjdk.org/jdk/pull/18832/files/24c7e37c..59f77da7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18832&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18832&range=01-02

  Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/18832.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18832/head:pull/18832

PR: https://git.openjdk.org/jdk/pull/18832


More information about the compiler-dev mailing list