summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Garcia <miguelalfredo.garcia@epfl.ch>2013-06-26 16:24:27 +0200
committerMiguel Garcia <miguelalfredo.garcia@epfl.ch>2013-06-26 21:59:01 +0200
commite8d1612de49418034cc319508b5f6bcb5a7367e6 (patch)
tree209bc9c1cb2a0ce8e0c2af16c771756a8357b3bc /src
parent94297df0a8b63b2fa7d1d5bb8fa72d9dce5432e8 (diff)
downloadscala-e8d1612de49418034cc319508b5f6bcb5a7367e6.tar.gz
scala-e8d1612de49418034cc319508b5f6bcb5a7367e6.tar.bz2
scala-e8d1612de49418034cc319508b5f6bcb5a7367e6.zip
additional documentation for GenBCode
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala5
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
index f4c230671f..62270b7c0a 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
@@ -240,7 +240,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
/*
* Populates the InnerClasses JVM attribute with `refedInnerClasses`.
- * In additiona to inner classes mentioned somewhere in `jclass` (where `jclass` is a class file being emitted)
+ * In addition to inner classes mentioned somewhere in `jclass` (where `jclass` is a class file being emitted)
* `refedInnerClasses` should contain those inner classes defined as direct member classes of `jclass`
* but otherwise not mentioned in `jclass`.
*
@@ -1000,6 +1000,9 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
trait BCClassGen extends BCInnerClassGen {
+ // Used as threshold above which a tableswitch bytecode instruction is preferred over a lookupswitch.
+ // There's a space tradeoff between these multi-branch instructions (details in the JVM spec).
+ // The particular value in use for `MIN_SWITCH_DENSITY` reflects a heuristic.
val MIN_SWITCH_DENSITY = 0.7
/*
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
index ccef9934e8..e55a3baed0 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala
@@ -43,7 +43,7 @@ abstract class GenBCode extends BCodeSyncAndTry {
class BCodePhase(prev: Phase) extends StdPhase(prev) {
override def name = phaseName
- override def description = "Generate bytecode from ASTs"
+ override def description = "Generate bytecode from ASTs using the ASM library"
override def erasedTypes = true
private var bytecodeWriter : BytecodeWriter = null
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index 70ccbca8b4..b16ba91916 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -406,6 +406,8 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
if (entryPoints != null) &&
genBCode.isJavaEntryPoint(tree.symbol, currentUnit)
=>
+ // collecting symbols for entry points here (as opposed to GenBCode where they are used)
+ // has the advantage of saving an additional pass over all ClassDefs.
entryPoints ::= tree.symbol
super.transform(tree)