Trim buildEffective() bytecode 74/87774/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 14 Feb 2020 22:55:40 +0000 (23:55 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 16 Feb 2020 09:44:06 +0000 (10:44 +0100)
This method is hot as hell, let's make sure it's also as small as
possible to aid inlining.

Change-Id: I0540a7efac1037cabb49190eb55da9ad022bc9d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java

index 0ee59976f49327045315c6bf8ee7cf4285cfaed7..621bc423905f3e63bc703f63a6cfaa4871ddd582 100644 (file)
@@ -516,8 +516,12 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
 
     @Override
     public E buildEffective() {
-        final E existing = effectiveInstance;
-        return existing != null ? existing : (effectiveInstance = definition.getFactory().createEffective(this));
+        final E existing;
+        return (existing = effectiveInstance) != null ? existing : loadEffective();
+    }
+
+    private E loadEffective() {
+        return effectiveInstance = definition.getFactory().createEffective(this);
     }
 
     /**