summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/jvm
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-10-29 16:04:17 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-08 08:25:18 +0100
commita5127a8392fd2a0bce9b3ced302b4ebe1a80bc65 (patch)
tree4d52b8ed7dd8fcfb10d4bef41198ffe6ecc7cfe6 /src/compiler/scala/tools/nsc/backend/jvm
parent3dba9932fcc79ce0ea6f7c9282320c14c95d133f (diff)
downloadscala-a5127a8392fd2a0bce9b3ced302b4ebe1a80bc65.tar.gz
scala-a5127a8392fd2a0bce9b3ced302b4ebe1a80bc65.tar.bz2
scala-a5127a8392fd2a0bce9b3ced302b4ebe1a80bc65.zip
SI-7678 Don't cache member symbols of TypeTags in Definitions.
It we can only safely use vals in Definitions for top-level symbols. Otherwise, when the IDE switches to loading the symbol from source, we can hold on to a stale symbol, which in turn impedes implicit materialization of TypeTags. This commit moves (most) of the accessors for member symbols into RunDefinitions, and changes calling code accordingly. This is a win for presentation compiler correctness, and might even shave of a few cycles. In a few cases, I have had to leave a `def` to a member symbol in Definitions so we can get to it from the SymbolTable cake, which doesn't see RunDefinitions. The macro FastTrack facility now correctly recreates the mapping from Symbol to macro implementation each run, using a new facility in perRunCaches to create a run-indexed cache. The enclosed test recreates the situation reported in the ticket, in which TypeTags.scala is loaded from source.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index 3bacc26a3a..c166b0bb7e 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -623,14 +623,14 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
abort(s"Cannot instantiate $tpt of kind: $generatedType")
}
- case Apply(fun @ _, List(expr)) if definitions.isBox(fun.symbol) =>
+ case Apply(fun @ _, List(expr)) if currentRun.runDefinitions.isBox(fun.symbol) =>
val nativeKind = tpeTK(expr)
genLoad(expr, nativeKind)
val MethodNameAndType(mname, mdesc) = asmBoxTo(nativeKind)
bc.invokestatic(BoxesRunTime.getInternalName, mname, mdesc)
generatedType = boxResultType(fun.symbol) // was toTypeKind(fun.symbol.tpe.resultType)
- case Apply(fun @ _, List(expr)) if definitions.isUnbox(fun.symbol) =>
+ case Apply(fun @ _, List(expr)) if currentRun.runDefinitions.isUnbox(fun.symbol) =>
genLoad(expr)
val boxType = unboxResultType(fun.symbol) // was toTypeKind(fun.symbol.owner.linkedClassOfClass.tpe)
generatedType = boxType
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala
index 39fea9a486..916d118b6e 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala
@@ -90,11 +90,11 @@ abstract class BCodeTypes extends BCodeIdiomatic {
)
boxResultType =
- for(Pair(csym, msym) <- definitions.boxMethod)
+ for(Pair(csym, msym) <- currentRun.runDefinitions.boxMethod)
yield (msym -> classLiteral(primitiveTypeMap(csym)))
unboxResultType =
- for(Pair(csym, msym) <- definitions.unboxMethod)
+ for(Pair(csym, msym) <- currentRun.runDefinitions.unboxMethod)
yield (msym -> primitiveTypeMap(csym))
// boxed classes are looked up in the `exemplars` map by jvmWiseLUB().