[FLINK-40605][table-code-splitter] Allow splitting if blocks containing loops with jump statements - #29141
Open
ChaomingZhangCN wants to merge 1 commit into
Conversation
… jump statements Keep return statements and loop jumps within their original control-flow scope while allowing enclosing blocks with self-contained loops to be extracted. Add compiler and execution regressions for oversized branches, break/continue, labeled jumps, and early returns. Generated-by: Codex CLI 0.153.4
Collaborator
Contributor
Author
|
@JingsongLi Hi, could you please review this PR for FLINK-40605, which fixes a remaining 64 KB code-splitting issue in large if blocks containing loops with break or continue? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fix code splitting for large
ifblocks containing nested loops withbreakorcontinue.Currently,
BlockStatementSplitterskips a statement whenever its subtree contains anyreturn,break, orcontinue. This is overly conservative for an enclosing block containing a self-contained loop: even a small loop with a jump can prevent the surrounding large block from being split, leaving generated methods that fail compilation withCode grows beyond 64 KB.This change allows such enclosing blocks to be split while retaining conservative guards for return statements and loop-body extraction.
Brief change log
break,continue, labeled jumps, and early returns.Verifying this change
Added regression tests that generate an oversized
ifbranch containing a short loop with eitherbreakorcontinue, run the completeJavaCodeSplitterpipeline, compile the output with Janino, and verify execution results.Both oversized-branch test cases fail on the unmodified base commit with
Code grows beyond 64 KBand pass with this change. The tests also verify that skipped branches remain unexecuted and that statements following a jump execute correctly.Additional execution tests verify labeled
break/continueand early-return behavior.The complete code-splitter module test suite was run with its reactor dependencies using JDK 17 and the repository's Maven wrapper:
Result: 54 tests, 0 failures, 0 errors, and 1 pre-existing skipped test.
Spotless and Checkstyle checks also passed. The reactor command skips the repository-wide RAT scan; a module-scoped RAT check was run separately and passed. The full repository test suite was not run.
Does this pull request potentially affect one of the following parts:
Documentation
Was generative AI tooling used to co-author this PR?
Generated-by: Codex CLI 0.153.4