summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-06-08 07:27:08 +0000
committerMartin Odersky <odersky@gmail.com>2010-06-08 07:27:08 +0000
commitd112ec1f8878b02094b68ebe849dbc8831a9c0d9 (patch)
tree5c88195fb5596c97963c51f93c94a0899ccb0d68 /src/compiler
parenta1e29d20aa7b49caf07e7992287eb0ba8208558a (diff)
downloadscala-d112ec1f8878b02094b68ebe849dbc8831a9c0d9.tar.gz
scala-d112ec1f8878b02094b68ebe849dbc8831a9c0d9.tar.bz2
scala-d112ec1f8878b02094b68ebe849dbc8831a9c0d9.zip
Fixed #2424. Review by dragos
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala3
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala6
2 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 0d881e0068..c19a868d8e 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -419,6 +419,7 @@ trait Definitions extends reflect.generic.StandardDefinitions {
// boxed classes
lazy val ObjectRefClass = getClass("scala.runtime.ObjectRef")
+ lazy val VolatileObjectRefClass = getClass("scala.runtime.VolatileObjectRef")
lazy val BoxesRunTimeClass = getModule("scala.runtime.BoxesRunTime")
lazy val BoxedNumberClass = getClass(sn.BoxedNumber)
lazy val BoxedCharacterClass = getClass(sn.BoxedCharacter)
@@ -583,6 +584,7 @@ trait Definitions extends reflect.generic.StandardDefinitions {
def isBox(m: Symbol) = boxMethod.valuesIterator contains m
val refClass = new HashMap[Symbol, Symbol]
+ val volatileRefClass = new HashMap[Symbol, Symbol]
val abbrvTag = new HashMap[Symbol, Char]
private val numericWeight = new HashMap[Symbol, Int]
@@ -614,6 +616,7 @@ trait Definitions extends reflect.generic.StandardDefinitions {
boxedClass(clazz) = getClass(boxedName)
boxedModule(clazz) = getModule(boxedName)
refClass(clazz) = getClass("scala.runtime." + name + "Ref")
+ volatileRefClass(clazz) = getClass("scala.runtime.Volatile" + name + "Ref")
abbrvTag(clazz) = tag
if (weight > 0) numericWeight(clazz) = weight
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 33fa14033e..72914934cb 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -161,7 +161,11 @@ abstract class LambdaLift extends InfoTransform {
val symClass = sym.tpe.typeSymbol;
atPhase(phase.next) {
sym updateInfo (
- if (isValueClass(symClass)) refClass(symClass).tpe else ObjectRefClass.tpe)
+ if (sym.hasAnnotation(VolatileAttr))
+ if (isValueClass(symClass)) volatileRefClass(symClass).tpe else VolatileObjectRefClass.tpe
+ else
+ if (isValueClass(symClass)) refClass(symClass).tpe else ObjectRefClass.tpe
+ )
}
}
}