Defer statement initialization in InferredStatementContext (YANGTOOLS-784)

[YANGTOOLS-1184] Release InferredStatementContext's effective statements after build Created: 25/Nov/20  Updated: 24/Jul/21  Resolved: 03/Dec/20

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: 7.0.0

Type: Sub-task Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split to YANGTOOLS-1197 Release GroupingNamespace when module... Resolved
split to YANGTOOLS-1194 Reduce StatementSourceReference proli... Resolved
split to YANGTOOLS-1198 Release TypeNamespace when module/sub... Resolved
split from YANGTOOLS-1161 Reformulate StatementContextFactory.c... Resolved
Relates
relates to YANGTOOLS-1308 Reactor failure with OpenROADM models Resolved
relates to YANGTOOLS-1192 ModifierImpl leaks post buildEffective() Resolved
relates to YANGTOOLS-1190 Refactor AbstractAugmentStatementSupport Confirmed

 Description   

Performing lazy copy operations means we can end up copying a statement after it has been built and hence should no longer need its effective statements.

Add an explicit ModelProcessingPhase.EFFECTIVE_VIEW, which will run after EFFECTIVE_MODEL has been completed and the effective statement has been built.

It's execution is a straightforward children-first walk from root, just as any other processing phase.

All copy operations need to hook a prerequisite for EFFECTIVE_VIEW on their source context – which prevents it from completing – for each copied statement. That hook needs to resolve when the copy acquires the substatements.



 Comments   
Comment by Robert Varga [ 27/Nov/20 ]

Another processing phase does not solve the problem, as we need to be centered around references to parents and integrate with buildEffective() which runs separately.

The alternative approach is to use a StatementContextBase refcount, so that we hold off cleaning substatements if there is an outstanding reference to source statement or any of its parents.

Generated at Wed Feb 07 20:55:25 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.