Package org.jruby.ir.operands
Class Operand
java.lang.Object
org.jruby.ir.operands.Operand
- Direct Known Subclasses:
Array
,BuiltinClass
,CurrentScope
,DynamicSymbol
,Filename
,Hash
,ImmutableLiteral
,IRException
,Label
,MutableString
,Reference
,Scope
,ScopeModule
,Splat
,StandardError
,SValue
,UndefinedValue
,Variable
,WrappedIRClosure
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
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.abstract Operand
void
abstract OperandType
getSimplifiedOperand
(Map<Operand, Operand> valueMap, boolean force) boolean
Do we know the value of this operand at compile-time? If we do then it may be possible to constant propagate (one case: We also know it is also an ImmutableLiteral).boolean
boolean
Returns true if this is an immediate value that will always be considered truthy (true, numbers, etc)retrieve
(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) void
-
Field Details
-
EMPTY_ARRAY
-
-
Constructor Details
-
Operand
public Operand()
-
-
Method Details
-
getOperandType
-
hasKnownValue
public boolean hasKnownValue()Do we know the value of this operand at compile-time? If we do then it may be possible to constant propagate (one case: We also know it is also an ImmutableLiteral).- Returns:
- true if a known compile-time value.
-
canCopyPropagate
public boolean canCopyPropagate()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.- Returns:
- true if it is safe to copy-propagate the operand.
-
getSimplifiedOperand
-
getValue
-
isTruthyImmediate
public boolean isTruthyImmediate()Returns true if this is an immediate value that will always be considered truthy (true, numbers, etc)- Returns:
-
isFalseyImmediate
public boolean isFalseyImmediate() -
addUsedVariables
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. -
cloneForInlining
-
encode
-
retrieve
public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) -
visit
-