From 5cbd2fbc8409b446f8751792b006693e1d091055 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Fri, 14 Mar 2014 12:56:11 +0100 Subject: LazyVals phase. Creates accessors for lazy vals: 1) lazy local vals are rewritten to dotty.runtime.Lazy*** holders 2) for a non-volatile field lazy val create a non-thread-safe accessor and flag: 2.a) if lazy val type indicates that val is not nullable, uses null value as a flag 2.b) else uses boolean flag for sake of performance, method size, and allowing more jvm optimizations 3) for a volatile field lazy val use double locking scheme, that guaranties no spurious deadlocks, using long bits as bitmaps and creating companion objects to store offsets needed for unsafe methods. Conflicts: test/dotc/tests.scala --- src/dotty/tools/dotc/core/StdNames.scala | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dotty/tools/dotc/core/StdNames.scala') diff --git a/src/dotty/tools/dotc/core/StdNames.scala b/src/dotty/tools/dotc/core/StdNames.scala index e7c04e846..0cbcfa5a7 100644 --- a/src/dotty/tools/dotc/core/StdNames.scala +++ b/src/dotty/tools/dotc/core/StdNames.scala @@ -221,6 +221,7 @@ object StdNames { val FAKE_LOCAL_THIS: N = "this$" val IMPLCLASS_CONSTRUCTOR: N = "$init$" val LAZY_LOCAL: N = "$lzy" + val LAZY_FIELD_OFFSET: N = "OFFSET$" val LAZY_SLOW_SUFFIX: N = "$lzycompute" val LOCAL_SUFFIX: N = " " val UNIVERSE_BUILD_PREFIX: N = "$u.build." -- cgit v1.2.3