Intern statements along copy axis 78/97378/7
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Sep 2021 17:39:54 +0000 (19:39 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 4 Dec 2021 08:16:07 +0000 (09:16 +0100)
commitee34bdd83e7386b27e0422a89688d3d13916cfd9
tree2f95ee17cc572523fe67ea96aff8310ff726103a
parent01925b2a78cead093d2872d3f5cd9712a72bdd1b
Intern statements along copy axis

When we are inferring statements through grouping/uses, we end up adding
a few bits to record the copy history and effective status/config. This
process does not feed back anything back to the original declaration
site.

This leads to a situation when we can have a number of inferred
statements which are exactly equal, yet each is its own java object --
hence unnecessarily using heap for duplicate objects.

We can improve this by having a deduplication map at the site of
original declaration and updating/consulting it when we find we have an
otherwise-unmodified statement.

This patch adds the prerequisite constructs to yang-parser-spi and
the smarts to perform this deduplication to yang-parser-reactor.

JIRA: YANGTOOLS-1214
Change-Id: I957c6d69d16717759f22a78163c705390e602e22
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/EffectiveInstances.java [new file with mode: 0644]
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/InferredStatementContext.java
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/ReactorStmtCtx.java
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/EffectiveStatementState.java [new file with mode: 0644]
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementFactory.java
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementSupport.java