diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-01-29 20:42:55 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-10-18 17:35:59 +0200 |
commit | a030784ae0dc53a0cdc65d42ca45fa48943eea0d (patch) | |
tree | 224f263607032a12c2c5ad5de3f7fa78f8e07fd9 /src/reflect/scala/reflect/internal/Symbols.scala | |
parent | b2bd146c993a2d92819c741bf8786d843daea5db (diff) | |
download | scala-a030784ae0dc53a0cdc65d42ca45fa48943eea0d.tar.gz scala-a030784ae0dc53a0cdc65d42ca45fa48943eea0d.tar.bz2 scala-a030784ae0dc53a0cdc65d42ca45fa48943eea0d.zip |
cleans up initialization of runtime reflection
At first I just tried to remove syntheticCoreClasses from missingHook
and put them into the initializer of freshly created mirrors in order to
reduce the non-determinism in mutations of the global symbol table.
And then it didn't work, crashing on me claiming that AnyRef is missing.
Apparently we still need AnyRefClass in missingHook, just because it's
impossible to initialize (i.e. unpickle) ScalaPackageClass without it.
And then it still didn't work, whining about multiple overloaded defs
of some synthetic symbols. That was really tricky, but I figured it out
as well by initializing ScalaPackageClass first before forcing any
synthetic symbols (see the details in comments).
And then it worked, but stopped working half a year later when
Jason and I came to revisit this old pull request. The final twist
was pre-initializing ObjectClass, because it's a dependency of AnyRefClass,
which is a critical dependency of ScalaPackageClass (full information
can be found in comments).
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 868913c82f..858d6cf618 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -3341,10 +3341,11 @@ trait Symbols extends api.Symbols { self: SymbolTable => def name = nme.NO_NAME override def name_=(n: Name) = abort("Cannot set NoSymbol's name to " + n) - synchronized { - setInfo(NoType) - privateWithin = this - } + // Syncnote: no need to synchronize this, because NoSymbol's initialization is triggered by JavaUniverse.init + // which is called in universe's constructor - something that's inherently single-threaded + setInfo(NoType) + privateWithin = this + override def info_=(info: Type) = { infos = TypeHistory(1, NoType, null) unlock() |