summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-04-22 12:37:25 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-04-22 12:37:25 +1000
commit8a9efcc93a47fe647926065ab88962cb392a9f71 (patch)
tree7e156b8aa829f5a683262a7ee03c8db2a496f548 /src
parentd12d59a178c4056fb8ea3cdf4eab5ef453c9a113 (diff)
downloadscala-8a9efcc93a47fe647926065ab88962cb392a9f71.tar.gz
scala-8a9efcc93a47fe647926065ab88962cb392a9f71.tar.bz2
scala-8a9efcc93a47fe647926065ab88962cb392a9f71.zip
Update internal documentation in Delambdafy phase
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Delambdafy.scala17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
index 548f34d9b9..79bcf5c655 100644
--- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
+++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
@@ -9,12 +9,17 @@ import scala.reflect.internal.Symbols
import scala.collection.mutable.LinkedHashMap
/**
- * This transformer is responsible for turning lambdas into anonymous classes.
+ * This transformer is responsible for preparing lambdas for runtime, by either translating to anonymous classes
+ * or to a tree that will be convereted to invokedynamic by the JVM 1.8+ backend.
+ *
* The main assumption it makes is that a lambda {args => body} has been turned into
* {args => liftedBody()} where lifted body is a top level method that implements the body of the lambda.
* Currently Uncurry is responsible for that transformation.
*
- * From a lambda, Delambdafy will create
+ * From a lambda, Delambdafy will create:
+ *
+ * Under -target:jvm-1.7 and below:
+ *
* 1) a new top level class that
a) has fields and a constructor taking the captured environment (including possibly the "this"
* reference)
@@ -22,9 +27,11 @@ import scala.collection.mutable.LinkedHashMap
* c) if needed a bridge method for the apply method
* 2) an instantiation of the newly created class which replaces the lambda
*
- * TODO the main work left to be done is to plug into specialization. Primarily that means choosing a
- * specialized FunctionN trait instead of the generic FunctionN trait as a parent and creating the
- * appropriately named applysp method
+ * Under -target:jvm-1.8 with GenBCode:
+ *
+ * 1) An application of the captured arguments to a fictional symbol representing the lambda factory.
+ * This will be translated by the backed into an invokedynamic using a bootstrap method in JDK8's `LambdaMetaFactory`.
+ * The captured arguments include `this` if `liftedBody` is unable to be made STATIC.
*/
abstract class Delambdafy extends Transform with TypingTransformers with ast.TreeDSL with TypeAdaptingTransformer {
import global._