@@ -4,7 +4,7 @@ title: "Backend Internals"
4
4
---
5
5
6
6
The code for the backend is split up by functionality and assembled in the
7
- objet ` GenBCode ` .
7
+ object ` GenBCode ` .
8
8
9
9
``` none
10
10
object GenBCode --- [defines] --> PlainClassBuilder GenBCode also defines class BCodePhase, the compiler phase
@@ -61,29 +61,29 @@ ready for serialization to disk.
61
61
62
62
Currently the queue subsystem is all sequential, but as can be seen in
63
63
http://magarciaepfl.github.io/scala/ the above design enables overlapping (a.1)
64
- building of ClassNodes, (a.2) intra-method optimizations, and (a.3)
64
+ building of ` ClassNodes ` , (a.2) intra-method optimizations, and (a.3)
65
65
serialization to disk.
66
66
67
- This subsystem is described in detail in GenBCode.scala
67
+ This subsystem is described in detail in ` GenBCode.scala `
68
68
69
69
#### (b) Bytecode-level types, BType ####
70
70
The previous bytecode emitter goes to great lengths to reason about
71
71
bytecode-level types in terms of Symbols.
72
72
73
- GenBCode uses BType as a more direct representation. A BType is immutable, and
73
+ ` GenBCode ` uses ` BType ` as a more direct representation. A ` BType ` is immutable, and
74
74
a value class (once the rest of GenBCode is merged from
75
75
http://magarciaepfl.github.io/scala/ ).
76
76
77
77
Whether value class or not, its API is the same. That API doesn't reach into
78
- the type checker. Instead, each method on a BType answers a question that can
79
- be answered based on the BType itself. Sounds too simple to be good? It's a
78
+ the type checker. Instead, each method on a ` BType ` answers a question that can
79
+ be answered based on the ` BType ` itself. Sounds too simple to be good? It's a
80
80
good building block, that's what it is.
81
81
82
- The internal representation of a BType is based on what the JVM uses: internal
83
- names (eg Ljava/lang/String; ) and method descriptors; as defined in the JVM
84
- spec (that's why they aren't documented in GenBCode, just read the spec).
82
+ The internal representation of a ` BType ` is based on what the JVM uses: internal
83
+ names (e.g. ` Ljava/lang/String; ` ) and method descriptors; as defined in the JVM
84
+ spec (that's why they aren't documented in ` GenBCode ` , just read the [ JVM 8 spec] ( https://docs.oracle.com/javase/specs/jvms/se8/html/ ) ).
85
85
86
- All things BType can be found in BCodeGlue.scala
86
+ All things ` BType ` can be found in ` BCodeGlue.scala `
87
87
88
88
#### (c) Utilities offering a more "high-level" API to bytecode emission ####
89
89
Bytecode can be emitted one opcode at a time, but there are recurring patterns
@@ -93,7 +93,7 @@ For example, when emitting a load-constant, a dedicated instruction exists for
93
93
emitting load-zero. Similarly, emitting a switch can be done according to one
94
94
of two strategies.
95
95
96
- All these utilities are encapsulated in file BCodeIdiomatic.scala. They know
96
+ All these utilities are encapsulated in file ` BCodeIdiomatic.scala ` . They know
97
97
nothing about the type checker (because, just between us, they don't need to).
98
98
99
99
#### (d) Mapping between type-checker types and BTypes ####
@@ -109,10 +109,10 @@ To understand how it's built, see:
109
109
final def exemplar (csym0 : Symbol ): Tracked = { ... }
110
110
```
111
111
112
- Details in BCodeTypes.scala
112
+ Details in ` BCodeTypes.scala `
113
113
114
114
#### (e) More "high-level" utilities for bytecode emission ####
115
- In the spirit of BCodeIdiomatic, utilities are added in BCodeHelpers for
115
+ In the spirit of ` BCodeIdiomatic ` , utilities are added in ` BCodeHelpers ` for
116
116
emitting:
117
117
118
118
- bean info class
@@ -122,4 +122,4 @@ emitting:
122
122
123
123
124
124
#### (f) Building an ASM ClassNode given an AST TypeDef ####
125
- It's done by PlainClassBuilder
125
+ It's done by ` PlainClassBuilder ` (see ` GenBCode.scala ` ).
0 commit comments