summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala3
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala6
-rw-r--r--src/library/scala/runtime/ShortRef.java1
-rwxr-xr-xsrc/library/scala/runtime/VolatileBooleanRef.java20
-rwxr-xr-xsrc/library/scala/runtime/VolatileByteRef.java20
-rwxr-xr-xsrc/library/scala/runtime/VolatileCharRef.java20
-rwxr-xr-xsrc/library/scala/runtime/VolatileDoubleRef.java19
-rwxr-xr-xsrc/library/scala/runtime/VolatileFloatRef.java20
-rwxr-xr-xsrc/library/scala/runtime/VolatileIntRef.java19
-rwxr-xr-xsrc/library/scala/runtime/VolatileLongRef.java20
-rwxr-xr-xsrc/library/scala/runtime/VolatileObjectRef.java20
-rwxr-xr-xsrc/library/scala/runtime/VolatileShortRef.java20
12 files changed, 187 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
+ )
}
}
}
diff --git a/src/library/scala/runtime/ShortRef.java b/src/library/scala/runtime/ShortRef.java
index eadacaca19..76db3de29a 100644
--- a/src/library/scala/runtime/ShortRef.java
+++ b/src/library/scala/runtime/ShortRef.java
@@ -16,4 +16,5 @@ public class ShortRef implements java.io.Serializable {
public short elem;
public ShortRef(short elem) { this.elem = elem; }
+ public String toString() { return java.lang.Short.toString(elem); }
}
diff --git a/src/library/scala/runtime/VolatileBooleanRef.java b/src/library/scala/runtime/VolatileBooleanRef.java
new file mode 100755
index 0000000000..5cb308b0fd
--- /dev/null
+++ b/src/library/scala/runtime/VolatileBooleanRef.java
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+
+public class VolatileBooleanRef implements java.io.Serializable {
+ private static final long serialVersionUID = -5730524563015615974L;
+
+ volatile public boolean elem;
+ public VolatileBooleanRef(boolean elem) { this.elem = elem; }
+ public String toString() { return "" + elem; }
+}
diff --git a/src/library/scala/runtime/VolatileByteRef.java b/src/library/scala/runtime/VolatileByteRef.java
new file mode 100755
index 0000000000..4cddb3ecca
--- /dev/null
+++ b/src/library/scala/runtime/VolatileByteRef.java
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+
+public class VolatileByteRef implements java.io.Serializable {
+ private static final long serialVersionUID = -100666928446877072L;
+
+ volatile public byte elem;
+ public VolatileByteRef(byte elem) { this.elem = elem; }
+ public String toString() { return java.lang.Byte.toString(elem); }
+}
diff --git a/src/library/scala/runtime/VolatileCharRef.java b/src/library/scala/runtime/VolatileCharRef.java
new file mode 100755
index 0000000000..76cc1267fd
--- /dev/null
+++ b/src/library/scala/runtime/VolatileCharRef.java
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+
+public class VolatileCharRef implements java.io.Serializable {
+ private static final long serialVersionUID = 6537214938268005702L;
+
+ volatile public char elem;
+ public VolatileCharRef(char elem) { this.elem = elem; }
+ public String toString() { return java.lang.Character.toString(elem); }
+}
diff --git a/src/library/scala/runtime/VolatileDoubleRef.java b/src/library/scala/runtime/VolatileDoubleRef.java
new file mode 100755
index 0000000000..4720638399
--- /dev/null
+++ b/src/library/scala/runtime/VolatileDoubleRef.java
@@ -0,0 +1,19 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+public class VolatileDoubleRef implements java.io.Serializable {
+ private static final long serialVersionUID = 8304402127373655534L;
+
+ volatile public double elem;
+ public VolatileDoubleRef(double elem) { this.elem = elem; }
+ public String toString() { return java.lang.Double.toString(elem); }
+}
diff --git a/src/library/scala/runtime/VolatileFloatRef.java b/src/library/scala/runtime/VolatileFloatRef.java
new file mode 100755
index 0000000000..e69dd3a2c9
--- /dev/null
+++ b/src/library/scala/runtime/VolatileFloatRef.java
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+
+public class VolatileFloatRef implements java.io.Serializable {
+ private static final long serialVersionUID = -5793980990371366933L;
+
+ volatile public float elem;
+ public VolatileFloatRef(float elem) { this.elem = elem; }
+ public String toString() { return java.lang.Float.toString(elem); }
+}
diff --git a/src/library/scala/runtime/VolatileIntRef.java b/src/library/scala/runtime/VolatileIntRef.java
new file mode 100755
index 0000000000..bf306a2c4c
--- /dev/null
+++ b/src/library/scala/runtime/VolatileIntRef.java
@@ -0,0 +1,19 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+public class VolatileIntRef implements java.io.Serializable {
+ private static final long serialVersionUID = 1488197132022872888L;
+
+ volatile public int elem;
+ public VolatileIntRef(int elem) { this.elem = elem; }
+ public String toString() { return java.lang.Integer.toString(elem); }
+}
diff --git a/src/library/scala/runtime/VolatileLongRef.java b/src/library/scala/runtime/VolatileLongRef.java
new file mode 100755
index 0000000000..d7e094e296
--- /dev/null
+++ b/src/library/scala/runtime/VolatileLongRef.java
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+
+public class VolatileLongRef implements java.io.Serializable {
+ private static final long serialVersionUID = -3567869820105829499L;
+
+ volatile public long elem;
+ public VolatileLongRef(long elem) { this.elem = elem; }
+ public String toString() { return java.lang.Long.toString(elem); }
+}
diff --git a/src/library/scala/runtime/VolatileObjectRef.java b/src/library/scala/runtime/VolatileObjectRef.java
new file mode 100755
index 0000000000..2549b58713
--- /dev/null
+++ b/src/library/scala/runtime/VolatileObjectRef.java
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+
+public class VolatileObjectRef implements java.io.Serializable {
+ private static final long serialVersionUID = -9055728157600312291L;
+
+ volatile public Object elem;
+ public VolatileObjectRef(Object elem) { this.elem = elem; }
+ public String toString() { return "" + elem; }
+}
diff --git a/src/library/scala/runtime/VolatileShortRef.java b/src/library/scala/runtime/VolatileShortRef.java
new file mode 100755
index 0000000000..ccb160fae9
--- /dev/null
+++ b/src/library/scala/runtime/VolatileShortRef.java
@@ -0,0 +1,20 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+
+
+package scala.runtime;
+
+
+public class VolatileShortRef implements java.io.Serializable {
+ private static final long serialVersionUID = 4218441291229072313L;
+
+ volatile public short elem;
+ public VolatileShortRef(short elem) { this.elem = elem; }
+ public String toString() { return java.lang.Short.toString(elem); }
+}