|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpolyglot.frontend.Job
public abstract class Job
A Job
encapsulates work done by the compiler. Job
s
are typically associated either with a nested class (InnerJob
s)
or a source file (SourceJob
s). A Job contains all information
carried between phases of the compiler. A Job consists of a set of scheduled
passes over the associated code.
Field Summary | |
---|---|
protected Node |
ast
The AST constructed from the source file. |
protected JobExt |
ext
Field used for storing extension-specific information. |
protected int |
initialErrorCount
Initial count of errors before running the job. |
protected ExtensionInfo |
lang
The language extension used for this job. |
protected int |
nextPass
Index of the next pass to run. |
protected java.util.ArrayList |
passes
List of passes to be run on this job. |
protected java.util.Map |
passMap
Map from pass id to pass. |
protected boolean |
reportedErrors
True if the the job has reported an error. |
protected Pass |
runningPass
The currently running pass, or null. |
protected boolean |
status
True if all passes run so far have been successful. |
Constructor Summary | |
---|---|
Job(ExtensionInfo lang,
JobExt ext,
Node ast)
|
Method Summary | |
---|---|
Node |
ast()
Get the state's AST. |
void |
ast(Node ast)
Set the state's AST. |
Compiler |
compiler()
|
boolean |
completed()
Return true if all of the passes been completed. |
boolean |
completed(Pass.ID id)
Return true if the pass id has been completed. |
java.util.List |
completedPasses()
Return a list of passes that have been completed so far. |
Context |
context()
By default, a Job does not have a context associated
with it. |
void |
dump(CodeWriter cw)
|
JobExt |
ext()
|
ExtensionInfo |
extensionInfo()
|
void |
finishPass(Pass p,
boolean okay)
Inform this Job that pass p has finished. |
protected abstract java.util.List |
getPasses()
Get the initial list of passes that this Job should go
through. |
Pass |
getPreviousTo(Pass.ID id)
Return the pass immediately before the pass identified by id . |
protected void |
init()
Initialize the passes field and the
passMap field. |
boolean |
isRunning()
|
BarrierPass |
lastBarrier()
Return the last BarrierPass that this job completed;
return null if no BarrierPass es have
yet been completed |
Pass |
nextPass()
Return the next pass to be performed. |
Pass |
passByID(Pass.ID id)
Get the pass identified by id . |
java.util.List |
passes()
Get the list of passes that this Job needs to go through. |
boolean |
pending(Pass.ID id)
Return true if the pass id is still pending. |
java.util.List |
pendingPasses()
Return a list of passes that still have to be performed. |
boolean |
reportedErrors()
True if some pass reported an error. |
Pass |
runningPass()
|
void |
setRunningPass(Pass pass)
|
Source |
source()
Return the Source associated with the
SourceJob returned by sourceJob . |
abstract SourceJob |
sourceJob()
Get the SourceJob associated with this Job . |
Job |
spawn(Context c,
Node ast,
Pass.ID begin,
Pass.ID end)
Spawn a new job. |
boolean |
status()
|
boolean |
userSpecified()
Returns whether the source for this job was explicitly specified by the user, or if it was drawn into the compilation process due to some dependency. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JobExt ext
protected ExtensionInfo lang
protected Node ast
protected java.util.ArrayList passes
protected int nextPass
protected Pass runningPass
protected boolean status
protected java.util.Map passMap
protected int initialErrorCount
protected boolean reportedErrors
Constructor Detail |
---|
public Job(ExtensionInfo lang, JobExt ext, Node ast)
Method Detail |
---|
public JobExt ext()
public BarrierPass lastBarrier()
BarrierPass
that this job completed;
return null
if no BarrierPass
es have
yet been completed
public void setRunningPass(Pass pass)
public boolean isRunning()
public Pass runningPass()
public Node ast()
public void ast(Node ast)
public boolean reportedErrors()
public void dump(CodeWriter cw)
public Context context()
Job
does not have a context associated
with it. Subclasses may override this method.
public abstract SourceJob sourceJob()
SourceJob
associated with this Job
.
If this Job
is a SourceJob
, then this
object should be returned; otherwise the most suitable
SourceJob
should be returned. See subclasses' documentation
for more details of what the most suitable SourceJob
is.
public Source source()
Source
associated with the
SourceJob
returned by sourceJob
.
public boolean userSpecified()
protected abstract java.util.List getPasses()
Job
should go
through.
This method is called only once, from init
.
public final java.util.List passes()
Job
needs to go through.
This list is initialized with the list returned by
getPasses
.
protected void init()
passes
field and the
passMap
field.
public boolean completed()
public java.util.List completedPasses()
completedPasses
concatenated with the
list returned by pendingPasses
should be equivalent to the
list returned by passes
.
public java.util.List pendingPasses()
completedPasses
concatenated with the
list returned by pendingPasses
should be equivalent to the
list returned by passes
.
public boolean completed(Pass.ID id)
id
has been completed.
public boolean pending(Pass.ID id)
id
is still pending.
public Pass passByID(Pass.ID id)
id
.
public Pass getPreviousTo(Pass.ID id)
id
.
Return null
if no such pass exists.
public Pass nextPass()
public boolean status()
public void finishPass(Pass p, boolean okay)
Job
that pass p
has finished.
If okay
is true
, then the pass
was completed successfully; if it is false
the pass was not
completed successfully.
Pass p
may be any pending pass.
public ExtensionInfo extensionInfo()
public Compiler compiler()
public Job spawn(Context c, Node ast, Pass.ID begin, Pass.ID end)
begin
and end
inclusive will be performed immediately on
the AST ast
, and the resulting AST returned.
Spawn a new job. All passes between the pass begin
and end
inclusive will be performed immediately on
the AST ast
.
c
- the context that the AST occurs inast
- the AST the new Job is for.begin
- the first pass to perform for this job.end
- the last pass to perform for this job.
j.status()
and get the ast with j.ast()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |