Package org.jruby.ir.operands
Class ScopeModule
java.lang.Object
org.jruby.ir.operands.Operand
org.jruby.ir.operands.ScopeModule
Wrap a scope for the purpose of finding live module which happens to be associated with it.
-
Field Summary
FieldsFields inherited from class org.jruby.ir.operands.Operand
EMPTY_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Append the list of variables used in this operand to the input list -- force every operand to implement this because a missing implementation can cause bad failures.boolean
Can we replace every use of a variable 'v' that contains the value of this operand with the operand itself? This takes importance when there are at least two uses of 'v' within this scope.static ScopeModule
void
boolean
int
int
hashCode()
static ScopeModule
ModuleFor
(int depth) retrieve
(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) toString()
void
Methods inherited from class org.jruby.ir.operands.Operand
getSimplifiedOperand, getValue, hasKnownValue, isFalseyImmediate, isTruthyImmediate
-
Field Details
-
SCOPE_MODULE
-
-
Constructor Details
-
ScopeModule
public ScopeModule(int scopeModuleDepth)
-
-
Method Details
-
ModuleFor
-
getOperandType
- Specified by:
getOperandType
in classOperand
-
addUsedVariables
Description copied from class:Operand
Append the list of variables used in this operand to the input list -- force every operand to implement this because a missing implementation can cause bad failures.- Specified by:
addUsedVariables
in classOperand
-
cloneForInlining
- Specified by:
cloneForInlining
in classOperand
-
hashCode
public int hashCode() -
getScopeModuleDepth
public int getScopeModuleDepth() -
equals
-
canCopyPropagate
public boolean canCopyPropagate()Description copied from class:Operand
Can we replace every use of a variable 'v' that contains the value of this operand with the operand itself? This takes importance when there are at least two uses of 'v' within this scope. Ex: v = [1,2,3]; x = v; y = v In this case, we cannot replace the occurrences of 'v' because we would then get x = [1,2,3]; y = [1,2,3] which would then result in two different array objects being constructed instead of a single one.- Overrides:
canCopyPropagate
in classOperand
- Returns:
- true if it is safe to copy-propagate the operand.
-
toString
-
retrieve
public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) -
encode
-
decode
-
visit
-