Trim buildEffective() bytecode 58/87758/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:42:29 +0000 (10:42 +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 deb21a4e249ff3821c3381d823fdf98981bfb45b..f70283c0f7baeec8f0779784a4c6b4911854a610 100644 (file)
@@ -548,8 +548,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);
     }
 
     /**