Conversation
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.
Fixes #602.
Change
When lowering a local array declaration,
Unblockcurrently emits a separate assignment AST node for every element not explicitly listed in the initializer. Consequently, the AST and compiler memory usage grow with the declared array bound even when the initializer has a fixed source size, such as{ 0 }.This PR retains the existing individual assignments for explicitly initialized elements and represents the remaining implicit tail with a counted
Sforloop. The generated loop uses a unique compiler-createdsize_tindex.For each omitted element, the loop body performs the same type-specific initialization as the current lowering. This includes recursive initialization of nested arrays and structures, as well as typed initialization of pointers, floating-point values, and volatile subobjects.
As a result, the generated AST no longer grows with the number of omitted array elements. The change constructs only existing assignment and
SforAST nodes and does not modify any verified compiler pass or proof.Scope
The change applies to automatic declaration initializers handled by
process_decl. Global and static initializers are unchanged.Local compound literals retain the existing expression-based lowering because supporting statement-level loops there requires separate handling of expression sequence points.
I can also propose some regression tests into
CompCert-small-testsonce the lowering approach is reviewed.Validation
Tested from CompCert 3.18 commit
66a9fd06:ccomp, and the runtime library,make test SIMU=qemu-x86_64,Unblockoutput for a 100,000-element array.