diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-01-15 20:23:18 +0300 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-01-20 10:30:57 +0300 |
commit | b88198ee2343ad7209d1b33ef3914da0d6be118c (patch) | |
tree | 6d155c20e98946114dbbe1cf3952775485130dd3 /src/reflect | |
parent | f2afbb46bb6d915212bbce7e958bfc6a1d8b2d0a (diff) | |
download | scala-b88198ee2343ad7209d1b33ef3914da0d6be118c.tar.gz scala-b88198ee2343ad7209d1b33ef3914da0d6be118c.tar.bz2 scala-b88198ee2343ad7209d1b33ef3914da0d6be118c.zip |
Revert "synchronizes pendingVolatiles"
This reverts commit 000c18a8fac60065747652368dadcd7850532f3f,
because Symbol.isStable is independent from Type.isVolatile
since fada1ef6b315326ac0329d9e78951cfc95ad0eb0.
Diffstat (limited to 'src/reflect')
5 files changed, 7 insertions, 18 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 28d980bcfd..b00380f962 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -796,7 +796,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => * * Stability and volatility are checked separately to allow volatile paths in patterns that amount to equality checks. SI-6815 */ - def isStable = isTerm && !isMutable && !(hasFlag(BYNAMEPARAM)) && (!isMethod || hasStableFlag) + final def isStable = isTerm && !isMutable && !(hasFlag(BYNAMEPARAM)) && (!isMethod || hasStableFlag) final def hasVolatileType = tpe.isVolatile && !hasAnnotation(uncheckedStableClass) /** Does this symbol denote the primary constructor of its enclosing class? */ diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index e9230aceee..7fc7af1b71 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -1976,12 +1976,12 @@ trait Types def apply(value: Constant) = unique(new UniqueConstantType(value)) } - private var _volatileRecursions: Int = 0 - def volatileRecursions = _volatileRecursions - def volatileRecursions_=(value: Int) = _volatileRecursions = value - - private val _pendingVolatiles = new mutable.HashSet[Symbol] - def pendingVolatiles = _pendingVolatiles + /* Syncnote: The `volatile` var and `pendingVolatiles` mutable set need not be protected + * with synchronized, because they are accessed only from isVolatile, which is called only from + * Typer. + */ + private var volatileRecursions: Int = 0 + private val pendingVolatiles = new mutable.HashSet[Symbol] class ArgsTypeRef(pre0: Type, sym0: Symbol, args0: List[Type]) extends TypeRef(pre0, sym0, args0) { require(args0.nonEmpty, this) diff --git a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala index b3b20a888e..3a41edd28b 100644 --- a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala +++ b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala @@ -32,8 +32,6 @@ trait JavaUniverseForce { self: runtime.JavaUniverse => // inaccessible: this._skolemizationLevel // inaccessible: this._undoLog // inaccessible: this._intersectionWitness - // inaccessible: this._volatileRecursions - // inaccessible: this._pendingVolatiles // inaccessible: this._subsametypeRecursions // inaccessible: this._pendingSubTypes // inaccessible: this._basetypeRecursions diff --git a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala index 1a232c8de1..d7e3d3c84b 100644 --- a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala +++ b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala @@ -71,8 +71,6 @@ private[reflect] trait SynchronizedSymbols extends internal.Symbols { self: Symb } } - override def isStable: Boolean = gilSynchronized { super.isStable } - // ------ creators ------------------------------------------------------------------- override protected def createAbstractTypeSymbol(name: TypeName, pos: Position, newFlags: Long): AbstractTypeSymbol = diff --git a/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala b/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala index de78e527a7..eb164777b4 100644 --- a/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala +++ b/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala @@ -50,13 +50,6 @@ private[reflect] trait SynchronizedTypes extends internal.Types { self: SymbolTa private lazy val _intersectionWitness = mkThreadLocalStorage(perRunCaches.newWeakMap[List[Type], sWeakRef[Type]]()) override def intersectionWitness = _intersectionWitness.get - private lazy val _volatileRecursions = mkThreadLocalStorage(0) - override def volatileRecursions = _volatileRecursions.get - override def volatileRecursions_=(value: Int) = _volatileRecursions.set(value) - - private lazy val _pendingVolatiles = mkThreadLocalStorage(new mutable.HashSet[Symbol]) - override def pendingVolatiles = _pendingVolatiles.get - private lazy val _subsametypeRecursions = mkThreadLocalStorage(0) override def subsametypeRecursions = _subsametypeRecursions.get override def subsametypeRecursions_=(value: Int) = _subsametypeRecursions.set(value) |