aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Trees.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-07-01 15:59:33 +0200
committerMartin Odersky <odersky@gmail.com>2015-07-06 17:46:45 +0200
commit84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c (patch)
tree309525b19d9f063a384d4e2561f0b29a34986c43 /src/dotty/tools/dotc/ast/Trees.scala
parent64f65182f6e4f80b03d45923e02441dafe0755b4 (diff)
downloaddotty-84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c.tar.gz
dotty-84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c.tar.bz2
dotty-84ad34ad7a50a7f9d39d6958a7b8840e16c37a3c.zip
Add @sharable annotation
Add @sharable annotation for classes and vals that are presumed to be safely sharable between threads. Also: Document CtxLazy.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Trees.scala')
-rw-r--r--src/dotty/tools/dotc/ast/Trees.scala19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala
index 97facaa5d..f63d32b14 100644
--- a/src/dotty/tools/dotc/ast/Trees.scala
+++ b/src/dotty/tools/dotc/ast/Trees.scala
@@ -1,4 +1,5 @@
-package dotty.tools.dotc
+package dotty.tools
+package dotc
package ast
import core._
@@ -26,7 +27,7 @@ object Trees {
type Untyped = Null
/** The total number of created tree nodes, maintained if Stats.enabled */
- var ntrees = 0
+ @sharable var ntrees = 0
/** Modifiers and annotations for definitions
* @param flags The set flags
@@ -68,7 +69,7 @@ object Trees {
def tokenPos: Seq[(Token, Position)] = ???
}
- private var nextId = 0 // for debugging
+ @sharable private var nextId = 0 // for debugging
type LazyTree = AnyRef /* really: Tree | Lazy[Tree] */
type LazyTreeList = AnyRef /* really: List[Tree] | Lazy[List[Tree]] */
@@ -723,9 +724,9 @@ object Trees {
setMods(Modifiers[T](PrivateLocal))
}
- val theEmptyTree: Thicket[Type] = Thicket(Nil)
- val theEmptyValDef = new EmptyValDef[Type]
- val theEmptyModifiers = new Modifiers()
+ @sharable val theEmptyTree: Thicket[Type] = Thicket(Nil)
+ @sharable val theEmptyValDef = new EmptyValDef[Type]
+ @sharable val theEmptyModifiers = new Modifiers()
def genericEmptyValDef[T >: Untyped]: ValDef[T] = theEmptyValDef.asInstanceOf[ValDef[T]]
def genericEmptyTree[T >: Untyped]: Thicket[T] = theEmptyTree.asInstanceOf[Thicket[T]]
@@ -845,9 +846,9 @@ object Trees {
type Annotated = Trees.Annotated[T]
type Thicket = Trees.Thicket[T]
- val EmptyTree: Thicket = genericEmptyTree
- val EmptyValDef: ValDef = genericEmptyValDef
- val EmptyModifiers: Modifiers = genericEmptyModifiers
+ @sharable val EmptyTree: Thicket = genericEmptyTree
+ @sharable val EmptyValDef: ValDef = genericEmptyValDef
+ @sharable val EmptyModifiers: Modifiers = genericEmptyModifiers
// ----- Auxiliary creation methods ------------------