diff options
author | paltherr <paltherr@epfl.ch> | 2003-08-18 15:58:45 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-08-18 15:58:45 +0000 |
commit | 87210b8f1092065be1b7cfaf13a3852fe861abe4 (patch) | |
tree | 0e2ee43a75d151a74cec60e0025876082f2d7bc5 /sources/scalac/backend/jvm | |
parent | c4e1967d6c99021400b8fa906f51f0bcba984fd4 (diff) | |
download | scala-87210b8f1092065be1b7cfaf13a3852fe861abe4.tar.gz scala-87210b8f1092065be1b7cfaf13a3852fe861abe4.tar.bz2 scala-87210b8f1092065be1b7cfaf13a3852fe861abe4.zip |
- rewrote the phase creation process
- replace PhaseRepository by CompilerPhases
Diffstat (limited to 'sources/scalac/backend/jvm')
-rw-r--r-- | sources/scalac/backend/jvm/GenJVMBCELPhase.java | 45 | ||||
-rw-r--r-- | sources/scalac/backend/jvm/GenJVMPhase.java | 38 |
2 files changed, 49 insertions, 34 deletions
diff --git a/sources/scalac/backend/jvm/GenJVMBCELPhase.java b/sources/scalac/backend/jvm/GenJVMBCELPhase.java index 4ef402fd86..3d1b50a77e 100644 --- a/sources/scalac/backend/jvm/GenJVMBCELPhase.java +++ b/sources/scalac/backend/jvm/GenJVMBCELPhase.java @@ -9,31 +9,42 @@ package scalac.backend.jvm; import scalac.Global; -import scalac.Unit; +import scalac.Phase; import scalac.PhaseDescriptor; -import scalac.ApplicationError; +import scalac.Unit; -public class GenJVMBCELPhase extends PhaseDescriptor { +/** + * Phase to generate Java bytecodes using the BCEL library. + * + * @author Michel Schinz + * @version 1.0 + */ - public String name () { - return "genjvm-bcel"; - } +public class GenJVMBCELPhase extends Phase { - public String description () { - return "generate JVM bytecodes"; - } + //######################################################################## + // Private Fields - public String taskDescription() { - return "generated JVM code"; - } + /** The tree to code translator */ + private final GenJVMBCEL translator; + + //######################################################################## + // Public Constructors - public void apply(Global global) { - for (int i = 0; i < global.units.length; i++) - apply(global.units[i]); + /** Initializes this instance. */ + public GenJVMBCELPhase(Global global, PhaseDescriptor descriptor) { + super(global, descriptor); + this.translator = new GenJVMBCEL(global); } - public void apply(Unit unit) { - new GenJVMBCEL(unit.global).translate(unit); + //######################################################################## + // Public Methods + + /** Applies this phase to the given compilation units. */ + public void apply(Unit[] units) { + for (int i = 0; i < units.length; i++) translator.translate(units[i]); } + + //######################################################################## } diff --git a/sources/scalac/backend/jvm/GenJVMPhase.java b/sources/scalac/backend/jvm/GenJVMPhase.java index 6087cfb2e1..9fb1c72e89 100644 --- a/sources/scalac/backend/jvm/GenJVMPhase.java +++ b/sources/scalac/backend/jvm/GenJVMPhase.java @@ -9,9 +9,9 @@ package scalac.backend.jvm; import scalac.Global; -import scalac.Unit; +import scalac.Phase; import scalac.PhaseDescriptor; -import scalac.ApplicationError; +import scalac.Unit; /** * Phase to generate Java bytecodes using the FJBG library. @@ -20,26 +20,30 @@ import scalac.ApplicationError; * @version 1.0 */ -public class GenJVMPhase extends PhaseDescriptor { +public class GenJVMPhase extends Phase { - public String name () { - return "genjvm"; - } + //######################################################################## + // Private Fields - public String description () { - return "generate JVM bytecodes"; - } + /** The tree to code translator */ + private final GenJVM translator; - public String taskDescription() { - return "generated JVM code"; - } + //######################################################################## + // Public Constructors - public void apply(Global global) { - for (int i = 0; i < global.units.length; i++) - apply(global.units[i]); + /** Initializes this instance. */ + public GenJVMPhase(Global global, PhaseDescriptor descriptor) { + super(global, descriptor); + this.translator = new GenJVM(global); } - public void apply(Unit unit) { - new GenJVM(unit.global).translate(unit); + //######################################################################## + // Public Methods + + /** Applies this phase to the given compilation units. */ + public void apply(Unit[] units) { + for (int i = 0; i < units.length; i++) translator.translate(units[i]); } + + //######################################################################## } |