Package org.jruby.ir.runtime
Class IRRuntimeHelpers
java.lang.Object
org.jruby.ir.runtime.IRRuntimeHelpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
aliasGlobalVariable
(Ruby runtime, Object newName, Object oldName) static boolean
anyTrue
(boolean[] booleans) static int
arrayLength
(RubyArray array) static RubyString
asString
(ThreadContext context, IRubyObject caller, IRubyObject target, CallSite site) asString using a given call sitestatic IRubyObject
blockGivenOrCall
(ThreadContext context, IRubyObject self, FunctionalCachingCallSite blockGivenSite, Object blk) static boolean[]
buildSplatMap
(Operand[] args) static IRubyObject
callOptimizedAref
(ThreadContext context, IRubyObject caller, IRubyObject target, RubyString keyStr, CallSite site) static void
callTrace
(ThreadContext context, Block selfBlock, RubyEvent event, String name, String filename, int line) static void
callTrace
(ThreadContext context, IRubyObject selfClass, RubyEvent event, String name, String filename, int line) static void
callTraceHooks
(ThreadContext context, Block selfBlock, RubyEvent event, String name, String filename, int line) static void
checkArity
(ThreadContext context, StaticScope scope, Object[] args, Object keywords, int required, int opt, boolean rest, int restKey, Block block) static void
checkAritySpecificArgs
(ThreadContext context, StaticScope scope, Object[] args, int required, int opt, boolean rest, int restKey, Block block) static void
checkForExtraUnwantedKeywordArgs
(ThreadContext context, StaticScope scope, RubyHash keywordArgs) static void
checkForLJE
(ThreadContext context, DynamicScope currentScope, boolean definedWithinMethod, Block block) static RubyString
chillLiteralString
(RubyString string) static IRubyObject
classSuper
(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) static IRubyObject
classSuperIter
(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) static IRubyObject
classSuperIterSplatArgs
(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) static IRubyObject
classSuperSplatArgs
(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) static RubyHash
constructHashFromArray
(ThreadContext context, IRubyObject[] pairs) static IRubyObject[]
convertValueIntoArgArray
(ThreadContext context, RubyArray array, Signature signature) static IRubyObject[]
convertValueIntoArgArray
(ThreadContext context, IRubyObject value, Signature signature) static IRScope
decodeScopeFromBytes
(Ruby runtime, byte[] scopeBytes, String filename) static boolean[]
decodeSplatmap
(String splatmapString) static void
defCompiledClassMethod
(ThreadContext context, MethodHandle variable, MethodHandle specific, int specificArity, String id, int line, StaticScope scope, String encodedArgumentDescriptors, IRubyObject obj, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) static void
defCompiledClassMethod
(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, String encodedArgumentDescriptors, IRubyObject obj, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) static void
defCompiledInstanceMethod
(ThreadContext context, MethodHandle variable, MethodHandle specific, int specificArity, String id, int line, StaticScope scope, String encodedArgumentDescriptors, DynamicScope currDynScope, IRubyObject self, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) static void
defCompiledInstanceMethod
(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, String encodedArgumentDescriptors, DynamicScope currDynScope, IRubyObject self, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) static void
defineAlias
(ThreadContext context, IRubyObject self, DynamicScope currDynScope, IRubyObject newName, IRubyObject oldName) static void
defInterpretedClassMethod
(ThreadContext context, IRScope method, IRubyObject obj) static void
defInterpretedInstanceMethod
(ThreadContext context, IRScope method, DynamicScope currDynScope, IRubyObject self) static IRubyObject
dupIfKeywordRestAtCallsite
(ThreadContext context, IRubyObject arg) Methods like Kernel#send if it receives a key-splatted value at a send site (send :foo, **h) it will dup h.static RubyHash
dupKwargsHashAndPopulateFromArray
(ThreadContext context, RubyHash dupHash, IRubyObject[] pairs) static String
encodeSplatmap
(boolean[] splatmap) static IRubyObject
extractOptionalArgument
(RubyArray rubyArray, int minArgsLength, int index) static boolean
feq
(double v1, double v2) static boolean
fgt
(double v1, double v2) static RubyModule
findInstanceMethodContainer
(ThreadContext context, DynamicScope currDynScope, IRubyObject self) static boolean
flt
(double v1, double v2) static RubyString
freezeLiteralString
(RubyString string) static RubyFixnum
getArgScopeDepth
(ThreadContext context, StaticScope currScope) static RubyClass
getArray
(ThreadContext context) static Block
getBlockFromObject
(ThreadContext context, Object value) static IRubyObject
getClassVariable
(ThreadContext context, RubyModule module, String id) static RubyModule
getCurrentClassBase
(ThreadContext context, IRubyObject self) Find the base class or "cbase" used for various class-level operations.static RubyString
getFileNameStringFromScope
(ThreadContext context, StaticScope currScope) static Block
getFrameBlockFromBlock
(Block block) static String
getFrameNameFromBlock
(Block block) static RubyClass
getHash
(ThreadContext context) static RubyModule
getModuleFromScope
(ThreadContext context, StaticScope scope, IRubyObject arg) static RubyClass
getObject
(ThreadContext context) static IRubyObject
getPreArgSafe
(ThreadContext context, IRubyObject[] args, int argIndex) static Block
getRefinedBlockFromObject
(ThreadContext context, StaticScope scope, Object value) static RubyClass
getStandardError
(ThreadContext context) static RubyClass
getSymbol
(ThreadContext context) static VariableAccessor
getVariableAccessorForRead
(IRubyObject object, String name) static VariableAccessor
getVariableAccessorForWrite
(IRubyObject object, String name) static IRubyObject
handleBreakAndReturnsInLambdas
(ThreadContext context, DynamicScope dynScope, Object exc, Block block) static IRubyObject
handleNonlocalReturn
(DynamicScope currentScope, Object rjExc) static IRubyObject
handlePropagatedBreak
(ThreadContext context, DynamicScope dynScope, Object bjExc) static IRubyObject
hashCheck
(ThreadContext context, IRubyObject hash) static boolean
ieq
(long v1, long v2) static boolean
igt
(long v1, long v2) static boolean
ilt
(long v1, long v2) static IRubyObject
inheritedSearchConst
(ThreadContext context, IRubyObject cmVal, String constName, boolean noPrivateConsts) static IRubyObject
initiateBreak
(ThreadContext context, DynamicScope dynScope, IRubyObject breakValue, Block block) static IRubyObject
initiateNonLocalReturn
(DynamicScope currentScope, Block block, IRubyObject returnValue) static boolean
inLambda
(Block.Type blockType) static boolean
inMethod
(Block.Type blockType) static boolean
inNonMethodBodyLambda
(StaticScope scope, Block.Type blockType) static boolean
inProc
(Block.Type blockType) static boolean
static IRubyObject
instanceSuper
(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) static IRubyObject
instanceSuperIter
(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) static IRubyObject
instanceSuperIterSplatArgs
(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) static IRubyObject
instanceSuperSplatArgs
(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) static IRubyObject
invokeModuleBody
(ThreadContext context, DynamicMethod method) static IRubyObject
irNot
(ThreadContext context, IRubyObject obj) static IRubyObject
irReqdArgMultipleAsgn
(ThreadContext context, RubyArray rubyArray, int preArgsCount, int index, int postArgsCount) static int
irReqdArgMultipleAsgnIndex
(int n, int preArgsCount, int index, int postArgsCount) static RubyArray
irSplat
(ThreadContext context, IRubyObject ary) static IRubyObject
irToAry
(ThreadContext context, IRubyObject value) static RubyBoolean
isBlockGiven
(ThreadContext context, Object blk) static boolean
isDebug()
static IRubyObject
isDefinedBackref
(ThreadContext context, IRubyObject definedMessage) static IRubyObject
isDefinedCall
(ThreadContext context, IRubyObject self, IRubyObject receiver, String name, IRubyObject definedMessage) static IRubyObject
isDefinedClassVar
(ThreadContext context, RubyModule receiver, String name, IRubyObject definedMessage) static IRubyObject
isDefinedConstantOrMethod
(ThreadContext context, IRubyObject receiver, RubyString name, IRubyObject definedConstantMessage, IRubyObject definedMethodMessage) static IRubyObject
isDefinedGlobal
(ThreadContext context, String name, IRubyObject definedMessage) static IRubyObject
isDefinedMethod
(ThreadContext context, IRubyObject receiver, String name, boolean checkIfPublic, IRubyObject definedMessage) static IRubyObject
isDefinedNthRef
(ThreadContext context, int matchNumber, IRubyObject definedMessage) static IRubyObject
isDefinedSuper
(ThreadContext context, IRubyObject receiver, String frameName, RubyModule frameClass, IRubyObject definedMessage) static IRubyObject
isDefinedSuper
(ThreadContext context, IRubyObject receiver, IRubyObject definedMessage) static IRubyObject
isEQQ
(ThreadContext context, IRubyObject receiver, IRubyObject value, CallSite callSite, boolean splattedValue) static IRubyObject
isExceptionHandled
(ThreadContext context, IRubyObject excType, Object excObj) static IRubyObject
isHashEmpty
(ThreadContext context, IRubyObject hash) static IRubyObject
keywordRestOnHash
(ThreadContext context, IRubyObject rest) static IRubyObject
lexicalSearchConst
(ThreadContext context, StaticScope staticScope, String constName) static IRubyObject
match3
(ThreadContext context, RubyRegexp regexp, IRubyObject argValue) static IRubyObject
mergeKeywordArguments
(ThreadContext context, IRubyObject restKwarg, IRubyObject explicitKwarg, boolean checkForDuplicates) static boolean
needsSplatting
(boolean[] splatmap) static RubyArray
newArray
(ThreadContext context) static RubyArray
newArray
(ThreadContext context, IRubyObject obj) static RubyArray
newArray
(ThreadContext context, IRubyObject obj0, IRubyObject obj1) static final ByteList
newByteListFromRaw
(Ruby runtime, String str, String encoding) static DynamicMethod
newCompiledClassBody
(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, Object container, Object superClass, boolean maybeRefined) static DynamicMethod
newCompiledMetaClass
(ThreadContext context, MethodHandle handle, StaticScope scope, IRubyObject obj, int line, boolean refinements, boolean dynscopeEliminated) Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object.static DynamicMethod
newCompiledModuleBody
(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, Object rubyContainer, boolean maybeRefined) static RubyComplex
newComplexRaw
(ThreadContext context, IRubyObject i) static RubySymbol
newDSymbol
(ThreadContext context, IRubyObject symbol) static RubyRegexp
newDynamicRegexp
(ThreadContext context, IRubyObject[] pieces, int embeddedOptions) static RubyRegexp
newDynamicRegexp
(ThreadContext context, IRubyObject arg0, int embeddedOptions) static RubyRegexp
newDynamicRegexp
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, int embeddedOptions) static RubyRegexp
newDynamicRegexp
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, int embeddedOptions) static RubyRegexp
newDynamicRegexp
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, int embeddedOptions) static RubyRegexp
newDynamicRegexp
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, int embeddedOptions) static Binding
newFrameScopeBinding
(ThreadContext context, IRubyObject self, DynamicScope scope) static RubyString
newFrozenString
(ThreadContext context, ByteList bytelist, int coderange) static RubyString
newFrozenString
(ThreadContext context, ByteList bytelist, int coderange, String file, int line) static RubyString
newFrozenStringFromRaw
(ThreadContext context, String str, String encoding, int cr) static RubyString
newFrozenStringFromRaw
(ThreadContext context, String str, String encoding, int cr, String file, int line) static FunctionalCachingCallSite
static DynamicMethod
newInterpretedMetaClass
(ThreadContext context, IRScope metaClassBody, IRubyObject obj) Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object.static RubyProc
newLambdaProc
(ThreadContext context, Block block) static RubyRegexp
newLiteralRegexp
(ThreadContext context, ByteList source, int embeddedOptions) static RubyRegexp
newLiteralRegexp
(ThreadContext context, ByteList source, RegexpOptions options) static MonomorphicCallSite
newMonomorphicCallSite
(String name) static IRubyObject
static IRubyObject
newProc
(ThreadContext context, Block block) static ProfilingCachingCallSite
newProfilingCachingCallSite
(CallType callType, String name, IRScope scope, long callSiteId) static RubyRational
newRationalCanonicalize
(ThreadContext context, IRubyObject num, IRubyObject den) static RefinedCachingCallSite
newRefinedCachingCallSite
(String name, StaticScope scope, String callType) static RaiseException
newRequiredKeywordArgumentError
(ThreadContext context, String id) static RubyModule
newRubyClassFromIR
(ThreadContext context, String id, StaticScope scope, Object superClass, Object container, boolean maybeRefined) static RubyModule
newRubyModuleFromIR
(ThreadContext context, String id, StaticScope scope, Object rubyContainer, boolean maybeRefined) static RubyProc
newSymbolProc
(ThreadContext context, RubySymbol symbol) Create a new Symbol.to_proc for the given symbol name and encoding.static RubyProc
newSymbolProc
(ThreadContext context, ByteList value) Create a new Symbol.to_proc for the given symbol name and encoding.static VariableCachingCallSite
static IRubyObject
nthMatch
(ThreadContext context, int matchNumber) static Block
prepareBlock
(ThreadContext context, IRubyObject self, DynamicScope scope, BlockBody body) static IRubyObject[]
prepareBlockArgs
(ThreadContext context, Block block, IRubyObject[] args, boolean usesKwArgs, boolean ruby2Keywords) static IRubyObject[]
prepareFixedBlockArgs
(ThreadContext context, Block block, IRubyObject[] args) static IRubyObject[]
prepareNoBlockArgs
(ThreadContext context, Block block, IRubyObject[] args) Check whether incoming args are zero length for a lambda, and no-op for non-lambda.static DynamicScope
prepareScriptScope
(ThreadContext context, StaticScope scope) static IRubyObject[]
prepareSingleBlockArgs
(ThreadContext context, Block block, IRubyObject[] args) static DynamicScope
pushBlockDynamicScopeIfNeeded
(ThreadContext context, Block block, boolean pushNewDynScope, boolean reuseParentDynScope) static DynamicScope
pushBlockDynamicScopeNew
(ThreadContext context, Block block) static DynamicScope
pushBlockDynamicScopeReuse
(ThreadContext context, Block block) static void
pushExitBlock
(ThreadContext context, Object blk) static void
pushExitBlock
(ThreadContext context, Block blk) static void
putClassVariable
(ThreadContext context, IRubyObject self, RubyModule module, String id, IRubyObject value) static void
putConst
(ThreadContext context, IRubyObject self, IRubyObject module, String id, IRubyObject value) static void
putConst
(ThreadContext context, IRubyObject self, IRubyObject module, String id, IRubyObject value, StaticScope scope, int line) static IRubyObject
receiveKeywordArg
(IRubyObject keywords, RubySymbol key) static IRubyObject
receiveKeywordArg
(ThreadContext context, IRubyObject keywords, String id) static IRubyObject
receiveKeywordRestArg
(ThreadContext context, IRubyObject keywords) static IRubyObject
receiveKeywords
(ThreadContext context, IRubyObject[] args, boolean hasRestArgs, boolean acceptsKeywords, boolean ruby2_keywords_method) Handle incoming keyword arguments given the receiver's rest arg, keyword acceptance, and need for ruby2_keywords.static IRubyObject
receiveNormalKeywordsNoRestNoKeywords
(ThreadContext context, IRubyObject[] args) Simplified receiveKeywords when: receiver is not a ruby2_keywords method.static IRubyObject
receiveOptArg
(IRubyObject[] args, IRubyObject keywords, int requiredArgs, int preArgs, int argIndex) static IRubyObject
receivePostReqdArg
(ThreadContext context, IRubyObject[] args, IRubyObject keywords, int pre, int opt, boolean rest, int post, int argIndex) static IRubyObject
receiveRestArg
(ThreadContext context, IRubyObject[] args, IRubyObject keywords, int required, int argIndex) static IRubyObject
receiveSpecificArityKeywords
(ThreadContext context, IRubyObject last, boolean ruby2Keywords) static RubyEncoding
retrieveEncoding
(ThreadContext context, String name) static org.jcodings.Encoding
retrieveJCodingsEncoding
(ThreadContext context, String name) static IRubyObject
returnOrRethrowSavedException
(ThreadContext context, IRubyObject value) static IRubyObject
searchConst
(ThreadContext context, StaticScope staticScope, String constName, boolean noPrivateConsts) static void
setCallInfo
(ThreadContext context, int flags) static IRubyObject
setCapturedVar
(ThreadContext context, IRubyObject matchRes, String id) static IRubyObject
setInstanceVariable
(IRubyObject self, IRubyObject value, String name) static boolean
shouldPrintIR
(Ruby runtime) If the ir.print property is enabled and we are not booting, or the ir.print.all property is enabled and we are booting, return true to indicate IR should be printed.static boolean
shouldPrintScope
(IRScope scope) Check if the scope matches the configured ir.print.pattern, or if no pattern is set.static IRubyObject[]
singleBlockArgToArray
(IRubyObject value) static IRubyObject[]
splatArguments
(IRubyObject[] args, boolean[] splatMap) static RubyArray
splatArray
(ThreadContext context, IRubyObject ary) Call to_ary to get Array or die typing.static RubyArray
splatArray
(ThreadContext context, IRubyObject ary, boolean dupArray) Call to_ary to get Array or die typing.static RubyArray
splatArrayDup
(ThreadContext context, IRubyObject ary) Call to_ary to get Array or die typing.static IRubyObject
svalue
(ThreadContext context, Object val) static IRubyObject[]
toAry
(ThreadContext context, IRubyObject[] args) static void
traceRaise
(ThreadContext context) static void
traceRescue
(ThreadContext context, String file, int line) static final org.objectweb.asm.Type[]
typesFromSignature
(com.headius.invokebinder.Signature signature) static long
unboxFixnum
(IRubyObject val) static double
unboxFloat
(IRubyObject val) static IRubyObject
static IRubyObject
undefMethod
(ThreadContext context, Object nameArg, DynamicScope currDynScope, IRubyObject self) static IRubyObject
unresolvedSuper
(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) static IRubyObject
unresolvedSuperIter
(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) static IRubyObject
unresolvedSuperIterSplatArgs
(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block, boolean[] splatMap) static IRubyObject
unresolvedSuperSplatArgs
(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block, boolean[] splatMap) static Object
unwrapRubyException
(Object excObj) static IRubyObject
updateBlockState
(Block block, IRubyObject self) static void
updateCoverage
(ThreadContext context, String filename, int line) Update coverage data for the given file and zero-based line number.static IRubyObject
useBindingSelf
(Binding binding) static void
warnSetConstInRefinement
(ThreadContext context, IRubyObject self) static IRubyObject
yield
(ThreadContext context, Block b, IRubyObject yieldVal, boolean unwrapArray) static IRubyObject
yieldSpecific
(ThreadContext context, Block b) static IRubyObject
yieldValues
(ThreadContext context, Block blk, IRubyObject[] args) static IRubyObject
zSuper
(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) static IRubyObject
zSuperSplatArgs
(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block, boolean[] splatMap)
-
Constructor Details
-
IRRuntimeHelpers
public IRRuntimeHelpers()
-
-
Method Details
-
inProfileMode
public static boolean inProfileMode() -
isDebug
public static boolean isDebug() -
inNonMethodBodyLambda
-
inMethod
-
inLambda
-
inProc
-
checkForLJE
public static void checkForLJE(ThreadContext context, DynamicScope currentScope, boolean definedWithinMethod, Block block) -
initiateNonLocalReturn
public static IRubyObject initiateNonLocalReturn(DynamicScope currentScope, Block block, IRubyObject returnValue) -
handleNonlocalReturn
public static IRubyObject handleNonlocalReturn(DynamicScope currentScope, Object rjExc) throws RuntimeException - Throws:
RuntimeException
-
initiateBreak
public static IRubyObject initiateBreak(ThreadContext context, DynamicScope dynScope, IRubyObject breakValue, Block block) throws RuntimeException - Throws:
RuntimeException
-
handleBreakAndReturnsInLambdas
public static IRubyObject handleBreakAndReturnsInLambdas(ThreadContext context, DynamicScope dynScope, Object exc, Block block) throws RuntimeException - Throws:
RuntimeException
-
returnOrRethrowSavedException
-
handlePropagatedBreak
public static IRubyObject handlePropagatedBreak(ThreadContext context, DynamicScope dynScope, Object bjExc) -
undefMethod
public static IRubyObject undefMethod(ThreadContext context, Object nameArg, DynamicScope currDynScope, IRubyObject self) -
unboxFloat
-
unboxFixnum
-
flt
public static boolean flt(double v1, double v2) -
fgt
public static boolean fgt(double v1, double v2) -
feq
public static boolean feq(double v1, double v2) -
ilt
public static boolean ilt(long v1, long v2) -
igt
public static boolean igt(long v1, long v2) -
ieq
public static boolean ieq(long v1, long v2) -
unwrapRubyException
-
isExceptionHandled
public static IRubyObject isExceptionHandled(ThreadContext context, IRubyObject excType, Object excObj) -
isEQQ
public static IRubyObject isEQQ(ThreadContext context, IRubyObject receiver, IRubyObject value, CallSite callSite, boolean splattedValue) -
newProc
-
newProc
-
newLambdaProc
-
yield
public static IRubyObject yield(ThreadContext context, Block b, IRubyObject yieldVal, boolean unwrapArray) -
yieldSpecific
-
yieldValues
-
convertValueIntoArgArray
public static IRubyObject[] convertValueIntoArgArray(ThreadContext context, IRubyObject value, Signature signature) -
convertValueIntoArgArray
public static IRubyObject[] convertValueIntoArgArray(ThreadContext context, RubyArray array, Signature signature) -
getBlockFromObject
-
getRefinedBlockFromObject
public static Block getRefinedBlockFromObject(ThreadContext context, StaticScope scope, Object value) -
checkAritySpecificArgs
public static void checkAritySpecificArgs(ThreadContext context, StaticScope scope, Object[] args, int required, int opt, boolean rest, int restKey, Block block) -
checkArity
public static void checkArity(ThreadContext context, StaticScope scope, Object[] args, Object keywords, int required, int opt, boolean rest, int restKey, Block block) -
shouldPrintIR
If the ir.print property is enabled and we are not booting, or the ir.print.all property is enabled and we are booting, return true to indicate IR should be printed.- Parameters:
runtime
- the current runtime- Returns:
- whether to print IR
-
shouldPrintScope
Check if the scope matches the configured ir.print.pattern, or if no pattern is set.- Parameters:
scope
- the scope to match- Returns:
- whether to print the scope
-
updateCoverage
Update coverage data for the given file and zero-based line number.- Parameters:
context
-filename
-line
-
-
hashCheck
-
isHashEmpty
-
undefined
-
receiveSpecificArityKeywords
public static IRubyObject receiveSpecificArityKeywords(ThreadContext context, IRubyObject last, boolean ruby2Keywords) -
receiveNormalKeywordsNoRestNoKeywords
public static IRubyObject receiveNormalKeywordsNoRestNoKeywords(ThreadContext context, IRubyObject[] args) Simplified receiveKeywords when: receiver is not a ruby2_keywords method. receiver does not accept keywords. there's no rest argument.- Parameters:
context
-args
-- Returns:
- the prepared kwargs hash, or UNDEFINED as a sigil for no kwargs
-
receiveKeywords
public static IRubyObject receiveKeywords(ThreadContext context, IRubyObject[] args, boolean hasRestArgs, boolean acceptsKeywords, boolean ruby2_keywords_method) Handle incoming keyword arguments given the receiver's rest arg, keyword acceptance, and need for ruby2_keywords. We return as undefined and not null when no kwarg since null gets auto-converted to nil because temp vars do this to work around no explicit initialization of temp values (e.g. they might start as null).- Parameters:
context
-args
-hasRestArgs
-acceptsKeywords
-ruby2_keywords_method
-- Returns:
-
dupIfKeywordRestAtCallsite
Methods like Kernel#send if it receives a key-splatted value at a send site (send :foo, **h) it will dup h. -
setCallInfo
-
checkForExtraUnwantedKeywordArgs
public static void checkForExtraUnwantedKeywordArgs(ThreadContext context, StaticScope scope, RubyHash keywordArgs) -
prepareScriptScope
-
blockGivenOrCall
public static IRubyObject blockGivenOrCall(ThreadContext context, IRubyObject self, FunctionalCachingCallSite blockGivenSite, Object blk) -
match3
-
extractOptionalArgument
public static IRubyObject extractOptionalArgument(RubyArray rubyArray, int minArgsLength, int index) -
isDefinedBackref
-
isDefinedGlobal
public static IRubyObject isDefinedGlobal(ThreadContext context, String name, IRubyObject definedMessage) -
isDefinedNthRef
public static IRubyObject isDefinedNthRef(ThreadContext context, int matchNumber, IRubyObject definedMessage) -
isDefinedClassVar
public static IRubyObject isDefinedClassVar(ThreadContext context, RubyModule receiver, String name, IRubyObject definedMessage) -
isDefinedCall
public static IRubyObject isDefinedCall(ThreadContext context, IRubyObject self, IRubyObject receiver, String name, IRubyObject definedMessage) -
isDefinedConstantOrMethod
public static IRubyObject isDefinedConstantOrMethod(ThreadContext context, IRubyObject receiver, RubyString name, IRubyObject definedConstantMessage, IRubyObject definedMethodMessage) -
isDefinedMethod
public static IRubyObject isDefinedMethod(ThreadContext context, IRubyObject receiver, String name, boolean checkIfPublic, IRubyObject definedMessage) -
isDefinedSuper
public static IRubyObject isDefinedSuper(ThreadContext context, IRubyObject receiver, IRubyObject definedMessage) -
isDefinedSuper
public static IRubyObject isDefinedSuper(ThreadContext context, IRubyObject receiver, String frameName, RubyModule frameClass, IRubyObject definedMessage) -
nthMatch
-
defineAlias
public static void defineAlias(ThreadContext context, IRubyObject self, DynamicScope currDynScope, IRubyObject newName, IRubyObject oldName) -
getCurrentClassBase
Find the base class or "cbase" used for various class-level operations. This should be equivalent to "cbase" in CRuby, as retrieved by vm_get_cbase. SeeGetClassVarContainerModuleInstr
andRubyKernel.autoload(ThreadContext, IRubyObject, IRubyObject, IRubyObject)
for example usage.- Parameters:
context
- the current contextself
- the current self object- Returns:
- the instance method definition target, or the "cbase" for other purposes
-
getModuleFromScope
public static RubyModule getModuleFromScope(ThreadContext context, StaticScope scope, IRubyObject arg) -
mergeKeywordArguments
public static IRubyObject mergeKeywordArguments(ThreadContext context, IRubyObject restKwarg, IRubyObject explicitKwarg, boolean checkForDuplicates) -
findInstanceMethodContainer
public static RubyModule findInstanceMethodContainer(ThreadContext context, DynamicScope currDynScope, IRubyObject self) -
isBlockGiven
-
receiveRestArg
public static IRubyObject receiveRestArg(ThreadContext context, IRubyObject[] args, IRubyObject keywords, int required, int argIndex) -
receivePostReqdArg
public static IRubyObject receivePostReqdArg(ThreadContext context, IRubyObject[] args, IRubyObject keywords, int pre, int opt, boolean rest, int post, int argIndex) -
receiveOptArg
public static IRubyObject receiveOptArg(IRubyObject[] args, IRubyObject keywords, int requiredArgs, int preArgs, int argIndex) -
getPreArgSafe
-
receiveKeywordArg
-
receiveKeywordArg
-
keywordRestOnHash
-
receiveKeywordRestArg
-
setCapturedVar
-
instanceSuperSplatArgs
public static IRubyObject instanceSuperSplatArgs(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) -
instanceSuperIterSplatArgs
public static IRubyObject instanceSuperIterSplatArgs(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) -
instanceSuper
public static IRubyObject instanceSuper(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) -
instanceSuperIter
public static IRubyObject instanceSuperIter(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) -
classSuperSplatArgs
public static IRubyObject classSuperSplatArgs(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) -
classSuperIterSplatArgs
public static IRubyObject classSuperIterSplatArgs(ThreadContext context, IRubyObject self, String methodName, RubyModule definingModule, IRubyObject[] args, Block block, boolean[] splatMap) -
classSuper
public static IRubyObject classSuper(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) -
classSuperIter
public static IRubyObject classSuperIter(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) -
unresolvedSuperSplatArgs
public static IRubyObject unresolvedSuperSplatArgs(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block, boolean[] splatMap) -
unresolvedSuperIterSplatArgs
public static IRubyObject unresolvedSuperIterSplatArgs(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block, boolean[] splatMap) -
unresolvedSuper
public static IRubyObject unresolvedSuper(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) -
unresolvedSuperIter
public static IRubyObject unresolvedSuperIter(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) -
zSuperSplatArgs
public static IRubyObject zSuperSplatArgs(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block, boolean[] splatMap) -
zSuper
public static IRubyObject zSuper(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) -
splatArguments
-
encodeSplatmap
-
decodeSplatmap
-
buildSplatMap
-
anyTrue
public static boolean anyTrue(boolean[] booleans) -
needsSplatting
public static boolean needsSplatting(boolean[] splatmap) -
typesFromSignature
public static final org.objectweb.asm.Type[] typesFromSignature(com.headius.invokebinder.Signature signature) -
newFrozenStringFromRaw
public static RubyString newFrozenStringFromRaw(ThreadContext context, String str, String encoding, int cr, String file, int line) -
newFrozenStringFromRaw
public static RubyString newFrozenStringFromRaw(ThreadContext context, String str, String encoding, int cr) -
newByteListFromRaw
-
retrieveEncoding
-
retrieveJCodingsEncoding
-
constructHashFromArray
-
dupKwargsHashAndPopulateFromArray
public static RubyHash dupKwargsHashAndPopulateFromArray(ThreadContext context, RubyHash dupHash, IRubyObject[] pairs) -
searchConst
public static IRubyObject searchConst(ThreadContext context, StaticScope staticScope, String constName, boolean noPrivateConsts) -
inheritedSearchConst
public static IRubyObject inheritedSearchConst(ThreadContext context, IRubyObject cmVal, String constName, boolean noPrivateConsts) -
lexicalSearchConst
public static IRubyObject lexicalSearchConst(ThreadContext context, StaticScope staticScope, String constName) -
setInstanceVariable
-
newInterpretedMetaClass
public static DynamicMethod newInterpretedMetaClass(ThreadContext context, IRScope metaClassBody, IRubyObject obj) Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object. Used by interpreter. -
newCompiledMetaClass
public static DynamicMethod newCompiledMetaClass(ThreadContext context, MethodHandle handle, StaticScope scope, IRubyObject obj, int line, boolean refinements, boolean dynscopeEliminated) Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object. Used by JIT. -
newCompiledModuleBody
public static DynamicMethod newCompiledModuleBody(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, Object rubyContainer, boolean maybeRefined) -
newRubyModuleFromIR
public static RubyModule newRubyModuleFromIR(ThreadContext context, String id, StaticScope scope, Object rubyContainer, boolean maybeRefined) -
newCompiledClassBody
public static DynamicMethod newCompiledClassBody(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, Object container, Object superClass, boolean maybeRefined) -
newRubyClassFromIR
public static RubyModule newRubyClassFromIR(ThreadContext context, String id, StaticScope scope, Object superClass, Object container, boolean maybeRefined) -
defInterpretedClassMethod
public static void defInterpretedClassMethod(ThreadContext context, IRScope method, IRubyObject obj) -
defCompiledClassMethod
public static void defCompiledClassMethod(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, String encodedArgumentDescriptors, IRubyObject obj, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) -
defCompiledClassMethod
public static void defCompiledClassMethod(ThreadContext context, MethodHandle variable, MethodHandle specific, int specificArity, String id, int line, StaticScope scope, String encodedArgumentDescriptors, IRubyObject obj, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) -
defInterpretedInstanceMethod
public static void defInterpretedInstanceMethod(ThreadContext context, IRScope method, DynamicScope currDynScope, IRubyObject self) -
defCompiledInstanceMethod
public static void defCompiledInstanceMethod(ThreadContext context, MethodHandle handle, String id, int line, StaticScope scope, String encodedArgumentDescriptors, DynamicScope currDynScope, IRubyObject self, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) -
defCompiledInstanceMethod
public static void defCompiledInstanceMethod(ThreadContext context, MethodHandle variable, MethodHandle specific, int specificArity, String id, int line, StaticScope scope, String encodedArgumentDescriptors, DynamicScope currDynScope, IRubyObject self, boolean maybeRefined, boolean receivesKeywordArgs, boolean needsToFindImplementer) -
invokeModuleBody
-
newDynamicRegexp
public static RubyRegexp newDynamicRegexp(ThreadContext context, IRubyObject[] pieces, int embeddedOptions) -
newDynamicRegexp
public static RubyRegexp newDynamicRegexp(ThreadContext context, IRubyObject arg0, int embeddedOptions) -
newDynamicRegexp
public static RubyRegexp newDynamicRegexp(ThreadContext context, IRubyObject arg0, IRubyObject arg1, int embeddedOptions) -
newDynamicRegexp
public static RubyRegexp newDynamicRegexp(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, int embeddedOptions) -
newDynamicRegexp
public static RubyRegexp newDynamicRegexp(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, int embeddedOptions) -
newDynamicRegexp
public static RubyRegexp newDynamicRegexp(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, int embeddedOptions) -
newLiteralRegexp
public static RubyRegexp newLiteralRegexp(ThreadContext context, ByteList source, RegexpOptions options) -
newLiteralRegexp
public static RubyRegexp newLiteralRegexp(ThreadContext context, ByteList source, int embeddedOptions) -
irSplat
-
splatArray
Call to_ary to get Array or die typing. The optionally dup it if specified. Some conditional cases in compiler we know we are safe in not-duping. This method is the same impl as MRIs splatarray instr in the YARV instruction set. -
splatArray
Call to_ary to get Array or die typing. The optionally dup it if specified. Some conditional cases in compiler we know we are safe in not-duping. This method is the same impl as MRIs splatarray instr in the YARV instruction set. -
splatArrayDup
Call to_ary to get Array or die typing. The optionally dup it if specified. Some conditional cases in compiler we know we are safe in not-duping. This method is the same impl as MRIs splatarray instr in the YARV instruction set. -
irToAry
-
irReqdArgMultipleAsgnIndex
public static int irReqdArgMultipleAsgnIndex(int n, int preArgsCount, int index, int postArgsCount) -
irReqdArgMultipleAsgn
public static IRubyObject irReqdArgMultipleAsgn(ThreadContext context, RubyArray rubyArray, int preArgsCount, int index, int postArgsCount) -
irNot
-
newRequiredKeywordArgumentError
-
pushExitBlock
-
pushExitBlock
-
newFunctionalCachingCallSite
-
newProfilingCachingCallSite
public static ProfilingCachingCallSite newProfilingCachingCallSite(CallType callType, String name, IRScope scope, long callSiteId) -
newMonomorphicCallSite
-
newVariableCachingCallSite
-
newRefinedCachingCallSite
public static RefinedCachingCallSite newRefinedCachingCallSite(String name, StaticScope scope, String callType) -
decodeScopeFromBytes
-
getVariableAccessorForRead
-
getVariableAccessorForWrite
-
getArgScopeDepth
-
toAry
-
prepareNoBlockArgs
public static IRubyObject[] prepareNoBlockArgs(ThreadContext context, Block block, IRubyObject[] args) Check whether incoming args are zero length for a lambda, and no-op for non-lambda. This could probably be simplified to just an arity check with no return value, but returns the incoming args currently for consistency with the other prepares.- Parameters:
context
-block
-args
-- Returns:
-
prepareSingleBlockArgs
public static IRubyObject[] prepareSingleBlockArgs(ThreadContext context, Block block, IRubyObject[] args) -
prepareFixedBlockArgs
public static IRubyObject[] prepareFixedBlockArgs(ThreadContext context, Block block, IRubyObject[] args) -
prepareBlockArgs
public static IRubyObject[] prepareBlockArgs(ThreadContext context, Block block, IRubyObject[] args, boolean usesKwArgs, boolean ruby2Keywords) -
pushBlockDynamicScopeIfNeeded
public static DynamicScope pushBlockDynamicScopeIfNeeded(ThreadContext context, Block block, boolean pushNewDynScope, boolean reuseParentDynScope) -
pushBlockDynamicScopeNew
-
pushBlockDynamicScopeReuse
-
updateBlockState
-
useBindingSelf
-
newSymbolProc
Create a new Symbol.to_proc for the given symbol name and encoding.- Parameters:
context
-value
-- Returns:
-
newSymbolProc
Create a new Symbol.to_proc for the given symbol name and encoding.- Parameters:
context
-symbol
-- Returns:
-
singleBlockArgToArray
-
prepareBlock
public static Block prepareBlock(ThreadContext context, IRubyObject self, DynamicScope scope, BlockBody body) -
newFrameScopeBinding
public static Binding newFrameScopeBinding(ThreadContext context, IRubyObject self, DynamicScope scope) -
newFrozenString
public static RubyString newFrozenString(ThreadContext context, ByteList bytelist, int coderange, String file, int line) -
newFrozenString
-
freezeLiteralString
-
chillLiteralString
-
callOptimizedAref
public static IRubyObject callOptimizedAref(ThreadContext context, IRubyObject caller, IRubyObject target, RubyString keyStr, CallSite site) -
asString
public static RubyString asString(ThreadContext context, IRubyObject caller, IRubyObject target, CallSite site) asString using a given call site -
newArray
-
newArray
-
newArray
-
getFileNameStringFromScope
-
callTrace
public static void callTrace(ThreadContext context, IRubyObject selfClass, RubyEvent event, String name, String filename, int line) -
traceRaise
-
traceRescue
-
callTrace
public static void callTrace(ThreadContext context, Block selfBlock, RubyEvent event, String name, String filename, int line) -
callTraceHooks
public static void callTraceHooks(ThreadContext context, Block selfBlock, RubyEvent event, String name, String filename, int line) -
warnSetConstInRefinement
-
putConst
public static void putConst(ThreadContext context, IRubyObject self, IRubyObject module, String id, IRubyObject value) -
putConst
public static void putConst(ThreadContext context, IRubyObject self, IRubyObject module, String id, IRubyObject value, StaticScope scope, int line) -
getClassVariable
-
putClassVariable
public static void putClassVariable(ThreadContext context, IRubyObject self, RubyModule module, String id, IRubyObject value) -
newRationalCanonicalize
public static RubyRational newRationalCanonicalize(ThreadContext context, IRubyObject num, IRubyObject den) -
newComplexRaw
-
newDSymbol
-
getStandardError
-
getArray
-
getHash
-
getObject
-
getSymbol
-
svalue
-
aliasGlobalVariable
-
arrayLength
-
getFrameNameFromBlock
-
getFrameBlockFromBlock
-