Package org.jruby.ir.operands
Class Bignum
java.lang.Object
org.jruby.ir.operands.Operand
org.jruby.ir.operands.ImmutableLiteral
org.jruby.ir.operands.Bignum
Represents a literal Bignum.
We cache the value so that when the same Bignum Operand is copy-propagated
across multiple instructions, the same RubyBignum object is created. In a
ddition, the same constant across loops should be the same object.
So, in this example, the output should be false, true, true
n = 0
olda = nil
while (n < 3)
a = 81402749386839761113321
p a.equal?(olda)
olda = a
n += 1
end
-
Field Summary
FieldsFields inherited from class org.jruby.ir.operands.Operand
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCacheObject(ThreadContext context) Implementing class is responsible for constructing the cached value.static BignumvoidbooleanReturns true if this is an immediate value that will always be considered truthy (true, numbers, etc)toString()voidMethods inherited from class org.jruby.ir.operands.ImmutableLiteral
addUsedVariables, cachedObject, canCopyPropagate, cloneForInlining, hasKnownValue, isCached, retrieveMethods inherited from class org.jruby.ir.operands.Operand
getSimplifiedOperand, getValue, isFalseyImmediate
-
Field Details
-
value
-
-
Constructor Details
-
Bignum
-
-
Method Details
-
getOperandType
- Specified by:
getOperandTypein classOperand
-
createCacheObject
Description copied from class:ImmutableLiteralImplementing class is responsible for constructing the cached value.- Specified by:
createCacheObjectin classImmutableLiteral
-
visit
-
encode
-
decode
-
toString
-
isTruthyImmediate
public boolean isTruthyImmediate()Description copied from class:OperandReturns true if this is an immediate value that will always be considered truthy (true, numbers, etc)- Overrides:
isTruthyImmediatein classOperand- Returns:
-