Package org.jruby.ir.passes
Class CompilerPass
java.lang.Object
org.jruby.ir.passes.CompilerPass
- Direct Known Subclasses:
AddCallProtocolInstructions
,AddLocalVarLoadStoreInstructions
,AddMissingInitsPass
,DeadCodeElimination
,DominatorTreeBuilder
,EnsureTempsAssigned
,LiveVariableAnalysis
,LocalOptimizationPass
,OptimizeDelegationPass
,OptimizeDynScopesPass
,UnboxingPass
A mechanism for executing code against an IRScope or transforming the
IRScopes dependent data. A Compiler pass may or may not affect the state
of an IRScope (possibly including any child IRScopes) and it may
or may not depend on other compiler passes to execute first.
For dependencies between compiler passes, getDependencies will return
a list of all dependent passes. Those passes in turn will end up having
their own dependencies. The order of execution is depth-first, but if the
pass recognizes that the data it depends on already exists, then it does
not run the pass. It will just return the existing data. If you want to
guarantee (re)execution, then you should call invalidate().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CompilerPass
createPassInstance
(Class<? extends CompilerPass> passClass) static CompilerPass
createPassInstance
(String passClassName) boolean
abstract Object
execute
(FullInterpreterContext fic, Object... dependencyData) Meat of an individual pass.List
<Class<? extends CompilerPass>> abstract String
getLabel()
What is the user-friendly name of this compiler passstatic List
<CompilerPass> getPassesFromString
(String passList, String defaultPassList) Shorter labelint
hashCode()
boolean
The data that this pass is responsible for will get invalidated so that if this pass is then executed it will generate new pass data.If this pass has been previous run, then return the data from that last run.run
(FullInterpreterContext fic, boolean force) protected Object
run
(FullInterpreterContext fic, boolean force, boolean childScope)
-
Constructor Details
-
CompilerPass
public CompilerPass()
-
-
Method Details
-
getLabel
What is the user-friendly name of this compiler pass -
getShortLabel
Shorter label -
hashCode
public int hashCode() -
equals
-
execute
Meat of an individual pass. run will call this after dependency resolution.- Parameters:
fic
- is the FullInterpreterContext to run this pass ondependencyData
- is the data supplied to this pass to use to execute the pass
-
getDependencies
-
previouslyRun
If this pass has been previous run, then return the data from that last run. Specific scopes can override this behavior.- Returns:
- data or null if it needs to be run
-
invalidate
The data that this pass is responsible for will get invalidated so that if this pass is then executed it will generate new pass data. Note that some data will destructively manipulate dependent compiler pass data. In that case, the pass may wipe more than just it's data. In that case, an execute() should still rebuild everything fine because all compiler passes list their dependencies.- Parameters:
fic
- is where the pass stores its data.- Returns:
- true if invalidation succeeded, false otherwise.
-
run
-
run
-
run
-
createPassInstance
-
createPassInstance
-
getPassesFromString
-