Skip to content

Commit e8d1612

Browse files
committed
additional documentation for GenBCode
1 parent 94297df commit e8d1612

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
240240

241241
/*
242242
* Populates the InnerClasses JVM attribute with `refedInnerClasses`.
243-
* In additiona to inner classes mentioned somewhere in `jclass` (where `jclass` is a class file being emitted)
243+
* In addition to inner classes mentioned somewhere in `jclass` (where `jclass` is a class file being emitted)
244244
* `refedInnerClasses` should contain those inner classes defined as direct member classes of `jclass`
245245
* but otherwise not mentioned in `jclass`.
246246
*
@@ -1000,6 +1000,9 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters {
10001000

10011001
trait BCClassGen extends BCInnerClassGen {
10021002

1003+
// Used as threshold above which a tableswitch bytecode instruction is preferred over a lookupswitch.
1004+
// There's a space tradeoff between these multi-branch instructions (details in the JVM spec).
1005+
// The particular value in use for `MIN_SWITCH_DENSITY` reflects a heuristic.
10031006
val MIN_SWITCH_DENSITY = 0.7
10041007

10051008
/*

src/compiler/scala/tools/nsc/backend/jvm/GenBCode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class GenBCode extends BCodeSyncAndTry {
4343
class BCodePhase(prev: Phase) extends StdPhase(prev) {
4444

4545
override def name = phaseName
46-
override def description = "Generate bytecode from ASTs"
46+
override def description = "Generate bytecode from ASTs using the ASM library"
4747
override def erasedTypes = true
4848

4949
private var bytecodeWriter : BytecodeWriter = null

src/compiler/scala/tools/nsc/transform/CleanUp.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
406406
if (entryPoints != null) &&
407407
genBCode.isJavaEntryPoint(tree.symbol, currentUnit)
408408
=>
409+
// collecting symbols for entry points here (as opposed to GenBCode where they are used)
410+
// has the advantage of saving an additional pass over all ClassDefs.
409411
entryPoints ::= tree.symbol
410412
super.transform(tree)
411413

0 commit comments

Comments
 (0)