Integrated: 8322992: Javac fails with StackOverflowError when compiling deeply nested synchronized blocks

Vicente Romero vromero at openjdk.org
Mon Apr 22 16:34:34 UTC 2024


On Thu, 18 Apr 2024 01:24:01 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: 0b9350e8
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/0b9350e8b619bc556f36652cde6f73211be5b85b
Stats:     1229 lines in 2 files changed: 1211 ins; 15 del; 3 mod

8322992: Javac fails with StackOverflowError when compiling deeply nested synchronized blocks

Reviewed-by: jlahoda

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

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


More information about the compiler-dev mailing list