Top Fields Constructors Methods
org.jruby.ir

public Class IRManager

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.util.EnumSet, .HashSet, .Iterator, .List, .Set, org.jcodings.specific.UTF8Encoding, org.jruby.ParseResult, .Ruby, .RubyInstanceConfig, .RubyModule, .RubySymbol, org.jruby.ast.DefNode, .IScopingNode, .ModuleNode, .Node, .RootNode, org.jruby.ext.coverage.CoverageData, org.jruby.ir.builder.IRBuilderFactory, .LazyMethodDefinitionAST, org.jruby.ir.instructions.LineNumberInstr, .ReceiveSelfInstr, .ToggleBacktraceInstr, org.jruby.ir.interpreter.FullInterpreterContext, org.jruby.ir.listeners.IRScopeListener, .InstructionsListener, org.jruby.ir.operands.*, .Boolean, org.jruby.ir.passes.BasicCompilerPassListener, .CompilerPass, .CompilerPassListener, .CompilerPassScheduler, .DeadCodeElimination, .OptimizeDelegationPass, .OptimizeDynScopesPass, org.jruby.ir.util.IGVInstrListener, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.ByteList, .FileResource, .JRubyFile, org.jruby.util.cli.Options

Field Summary

Modifier and TypeField and Description
private final BuiltinClass
private IRBuilderFactory
private static final int
private final String[]
private final List<CompilerPass>
private final RubyInstanceConfig
private final CompilerPass
public static final String
public static final String
public static final String
private final CompilerPassListener
private int
private final Boolean
private static final int
private final Fixnum[]
private final BuiltinClass
private final List<CompilerPass>
private InstructionsListener
public static final boolean
public static final int
public static final boolean
private IRScopeListener
private final List<CompilerPass>
private LineNumberInstr[]
public final ToggleBacktraceInstr
public final ToggleBacktraceInstr
private final Nil
private static final ByteList
private final IRModuleBody
private final BuiltinClass
private final CompilerPass
private final CompilerPass
private final Set<CompilerPassListener>
private final ReceiveSelfInstr
public final Ruby
public static final String
private final List<CompilerPass>
private final StandardError
private final BuiltinClass
private TemporaryLocalVariable[]
private final Boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public BuiltinClass
public IRBuilderFactory
public String
getClosurePrefix(int closureId)

public List<CompilerPass>
public Boolean
public BuiltinClass
public List<CompilerPass>
public RubyInstanceConfig
public InstructionsListener
public IRScopeListener
public List<CompilerPass>
public Set<CompilerPassListener>
public RubySymbol
public Nil
public IRModuleBody
public BuiltinClass
public ReceiveSelfInstr
public Ruby
public List<CompilerPass>
public StandardError
public BuiltinClass
public Boolean
protected LineNumberInstr[]
protected TemporaryLocalVariable[]
public IRMethod
public ToggleBacktraceInstr
needsBacktrace(boolean needsIt)

public Fixnum
newFixnum(long value)

public LineNumberInstr
newLineNumber(int line)

public TemporaryLocalVariable
newTemporaryIntVariable(int index)

Temporarily provided for loading/storing a normal local as int on JVM; interpreter will still box as Integer.

public TemporaryLocalVariable
newTemporaryLocalVariable(int index)

Temporary local variables are immutable and always start from a low index value and increment up to a higher index value per scope.

protected void
optimizeIfSimpleScope(FullInterpreterContext fic)

For scopes that don't require a dynamic scope we can run DCE and some other passes which cannot be stymied by escaped bindings.

private ParseResult
parse(ThreadContext context, FileResource file, String fileName)

public void
public void
public void
public CompilerPassScheduler
public static CompilerPassScheduler
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayClassback to summary
private final BuiltinClass arrayClass
builderFactoryback to summary
private IRBuilderFactory builderFactory
CLOSURE_PREFIX_CACHE_SIZEback to summary
private static final int CLOSURE_PREFIX_CACHE_SIZE
closurePrefixCacheback to summary
private final String[] closurePrefixCache
compilerPassesback to summary
private final List<CompilerPass> compilerPasses
configback to summary
private final RubyInstanceConfig config
deadCodeEliminationPassback to summary
private final CompilerPass deadCodeEliminationPass
DEFAULT_BUILD_PASSESback to summary
public static final String DEFAULT_BUILD_PASSES
DEFAULT_INLINING_COMPILER_PASSESback to summary
public static final String DEFAULT_INLINING_COMPILER_PASSES
DEFAULT_JIT_PASSESback to summary
public static final String DEFAULT_JIT_PASSES
defaultListenerback to summary
private final CompilerPassListener defaultListener
dummyMetaClassCountback to summary
private int dummyMetaClassCount
falsback to summary
private final Boolean fals
FIXNUM_CACHE_HALF_SIZEback to summary
private static final int FIXNUM_CACHE_HALF_SIZE
fixnumsback to summary
private final Fixnum[] fixnums
hashClassback to summary
private final BuiltinClass hashClass
inliningCompilerPassesback to summary
private final List<CompilerPass> inliningCompilerPasses
instrsListenerback to summary
private InstructionsListener instrsListener
IR_INLINERback to summary
public static final boolean IR_INLINER
IR_INLINER_THRESHOLDback to summary
public static final int IR_INLINER_THRESHOLD
IR_INLINER_VERBOSEback to summary
public static final boolean IR_INLINER_VERBOSE
irScopeListenerback to summary
private IRScopeListener irScopeListener
jitPassesback to summary
private final List<CompilerPass> jitPasses
lineNumbersback to summary
private LineNumberInstr[] lineNumbers
needsBacktraceback to summary
public final ToggleBacktraceInstr needsBacktrace
needsNoBacktraceback to summary
public final ToggleBacktraceInstr needsNoBacktrace
nilback to summary
private final Nil nil
OBJECTback to summary
private static final ByteList OBJECT
objectback to summary
private final IRModuleBody object
objectClassback to summary
private final BuiltinClass objectClass
optimizeDelegationPassback to summary
private final CompilerPass optimizeDelegationPass
optimizeDynScopesPassback to summary
private final CompilerPass optimizeDynScopesPass
passListenersback to summary
private final Set<CompilerPassListener> passListeners
receiveSelfInstrback to summary
private final ReceiveSelfInstr receiveSelfInstr
runtimeback to summary
public final Ruby runtime
SAFE_COMPILER_PASSESback to summary
public static final String SAFE_COMPILER_PASSES
safePassesback to summary
private final List<CompilerPass> safePasses
standardErrorback to summary
private final StandardError standardError
symbolClassback to summary
private final BuiltinClass symbolClass
temporaryLocalVariablesback to summary
private TemporaryLocalVariable[] temporaryLocalVariables
truback to summary
private final Boolean tru

Constructor Detail

IRManagerback to summary
public IRManager(Ruby runtime, RubyInstanceConfig config)

Method Detail

addListenerback to summary
public void addListener(CompilerPassListener listener)
addListenerback to summary
public void addListener(InstructionsListener listener)
addListenerback to summary
public void addListener(IRScopeListener listener)
getArrayClassback to summary
public BuiltinClass getArrayClass()
getBuilderFactoryback to summary
public IRBuilderFactory getBuilderFactory()
getClosurePrefixback to summary
public String getClosurePrefix(int closureId)
getCompilerPassesback to summary
public List<CompilerPass> getCompilerPasses(IRScope scope)
getFalseback to summary
public Boolean getFalse()
getHashClassback to summary
public BuiltinClass getHashClass()
getInliningCompilerPassesback to summary
public List<CompilerPass> getInliningCompilerPasses(IRScope scope)
getInstanceConfigback to summary
public RubyInstanceConfig getInstanceConfig()
getInstructionsListenerback to summary
public InstructionsListener getInstructionsListener()
getIRScopeListenerback to summary
public IRScopeListener getIRScopeListener()
getJITPassesback to summary
public List<CompilerPass> getJITPasses(IRScope scope)
getListenersback to summary
public Set<CompilerPassListener> getListeners()
getMetaClassNameback to summary
public RubySymbol getMetaClassName()
getNilback to summary
public Nil getNil()
getObjectback to summary
public IRModuleBody getObject()
getObjectClassback to summary
public BuiltinClass getObjectClass()
getReceiveSelfInstrback to summary
public ReceiveSelfInstr getReceiveSelfInstr()
getRuntimeback to summary
public Ruby getRuntime()
getSafePassesback to summary
public List<CompilerPass> getSafePasses(IRScope scope)
getStandardErrorback to summary
public StandardError getStandardError()
getSymbolClassback to summary
public BuiltinClass getSymbolClass()
getTrueback to summary
public Boolean getTrue()
growLineNumbersPoolback to summary
protected LineNumberInstr[] growLineNumbersPool(int index)
growTemporaryVariablePoolback to summary
protected TemporaryLocalVariable[] growTemporaryVariablePool(int index)
loadInternalMethodback to summary
public IRMethod loadInternalMethod(ThreadContext context, IRubyObject self, String method)
needsBacktraceback to summary
public ToggleBacktraceInstr needsBacktrace(boolean needsIt)
newFixnumback to summary
public Fixnum newFixnum(long value)
newLineNumberback to summary
public LineNumberInstr newLineNumber(int line)
newTemporaryIntVariableback to summary
public TemporaryLocalVariable newTemporaryIntVariable(int index)

Temporarily provided for loading/storing a normal local as int on JVM; interpreter will still box as Integer.

newTemporaryLocalVariableback to summary
public TemporaryLocalVariable newTemporaryLocalVariable(int index)

Temporary local variables are immutable and always start from a low index value and increment up to a higher index value per scope. So we can share these and store the ones in a simple list. If hard pinning is ever an issue we can periodically evict the list and start over at the cost of more live objects but this list cache reduces a simple empty Rails app console from over 140K instances to about 1200 instances.

optimizeIfSimpleScopeback to summary
protected void optimizeIfSimpleScope(FullInterpreterContext fic)

For scopes that don't require a dynamic scope we can run DCE and some other passes which cannot be stymied by escaped bindings.

parseback to summary
private ParseResult parse(ThreadContext context, FileResource file, String fileName) throws IOException
removeListenerback to summary
public void removeListener(CompilerPassListener listener)
removeListenerback to summary
public void removeListener(InstructionsListener listener)
removeListenerback to summary
public void removeListener(IRScopeListener listener)
schedulePassesback to summary
public CompilerPassScheduler schedulePasses()
schedulePassesback to summary
public static CompilerPassScheduler schedulePasses(final List<CompilerPass> passes)
setBuilderFactoryback to summary
public void setBuilderFactory(IRBuilderFactory builderFactory)