Package org.jruby.ir.operands
Class FrozenString
- All Implemented Interfaces:
Stringable,StringLiteral
Represents a frozen string value.
-
Field Summary
FieldsFields inherited from class org.jruby.ir.operands.Operand
EMPTY_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionIRBuild.buildGetDefinition returns a frozen string and this is for all intern'd Java strings.FrozenString(RubySymbol symbol) protectedFrozenString(ByteList byteList) FrozenString(ByteList bytelist, int coderange, String file, int line) Used by persistence and by .freeze optimization -
Method Summary
Modifier and TypeMethodDescriptioncreateCacheObject(ThreadContext context) Implementing class is responsible for constructing the cached value.static FrozenStringvoidbooleanintgetFile()intgetLine()inthashCode()booleanDo 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).booleanisCached()Has this object already been cached?booleanReturns 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, retrieveMethods inherited from class org.jruby.ir.operands.Operand
getSimplifiedOperand, getValue, isFalseyImmediate
-
Field Details
-
bytelist
-
coderange
public final int coderange -
file
-
line
public final int line -
string
-
-
Constructor Details
-
FrozenString
Used by persistence and by .freeze optimization -
FrozenString
-
FrozenString
IRBuild.buildGetDefinition returns a frozen string and this is for all intern'd Java strings. -
FrozenString
-
-
Method Details
-
getOperandType
- Specified by:
getOperandTypein classOperand
-
hasKnownValue
public boolean hasKnownValue()Description copied from class:OperandDo 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).- Overrides:
hasKnownValuein classImmutableLiteral<RubyString>- Returns:
- true if a known compile-time value.
-
hashCode
public int hashCode() -
equals
-
toString
-
cloneForInlining
- Overrides:
cloneForInliningin classImmutableLiteral<RubyString>
-
createCacheObject
Description copied from class:ImmutableLiteralImplementing class is responsible for constructing the cached value.- Specified by:
createCacheObjectin classImmutableLiteral<RubyString>
-
isCached
public boolean isCached()Description copied from class:ImmutableLiteralHas this object already been cached?- Overrides:
isCachedin classImmutableLiteral<RubyString>
-
visit
-
getByteList
- Specified by:
getByteListin interfaceStringLiteral
-
getString
- Specified by:
getStringin interfaceStringable
-
getFile
-
getLine
public int getLine() -
encode
-
decode
-
getCodeRange
public int getCodeRange()- Specified by:
getCodeRangein interfaceStringLiteral
-
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:
-