summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-14 20:03:20 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-14 20:07:07 +0100
commit3b3bcd7b684fc432e48c20aa5317b56e87521c3b (patch)
tree2c10f7d0677812ad9b007c97fcc0c81895960780 /src/reflect
parent05e6322f79009e775ab96e000582321fff43de1c (diff)
downloadscala-3b3bcd7b684fc432e48c20aa5317b56e87521c3b.tar.gz
scala-3b3bcd7b684fc432e48c20aa5317b56e87521c3b.tar.bz2
scala-3b3bcd7b684fc432e48c20aa5317b56e87521c3b.zip
Revert "temporarily disables run/reflection-sync-subtypes"
This reverts commit 04e2dbb29830d0e511cdfa8c132a9fad91d657ed, by avoiding the ill-fated attempt to short-circuit the global reflection lock. I think we can do better performance wise, but lets at least get something correct to start with.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
index 298d0ffebd..1a232c8de1 100644
--- a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
+++ b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala
@@ -32,8 +32,15 @@ private[reflect] trait SynchronizedSymbols extends internal.Symbols { self: Symb
trait SynchronizedSymbol extends Symbol {
def gilSynchronizedIfNotInited[T](body: => T): T = {
- if (isFullyInitialized) body
- else gilSynchronized { body }
+ // TODO JZ desired, but prone to race conditions. We need the runtime reflection based
+ // type completers to establish a memory barrier upon initialization. Maybe a volatile
+ // write? We need to consult with the experts here. Until them, lock pessimistically.
+ //
+ // `run/reflection-sync-subtypes.scala` fails about 1/50 times otherwise.
+ //
+ // if (isFullyInitialized) body
+ // else gilSynchronized { body }
+ gilSynchronized { body }
}
override def validTo = gilSynchronizedIfNotInited { super.validTo }