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) protected
FrozenString
(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 FrozenString
void
boolean
int
getFile()
int
getLine()
int
hashCode()
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
isCached()
Has this object already been cached?boolean
Returns true if this is an immediate value that will always be considered truthy (true, numbers, etc)toString()
void
Methods inherited from class org.jruby.ir.operands.ImmutableLiteral
addUsedVariables, cachedObject, canCopyPropagate, retrieve
Methods 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:
getOperandType
in classOperand
-
hasKnownValue
public boolean hasKnownValue()Description copied from class:Operand
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).- Overrides:
hasKnownValue
in classImmutableLiteral<RubyString>
- Returns:
- true if a known compile-time value.
-
hashCode
public int hashCode() -
equals
-
toString
-
cloneForInlining
- Overrides:
cloneForInlining
in classImmutableLiteral<RubyString>
-
createCacheObject
Description copied from class:ImmutableLiteral
Implementing class is responsible for constructing the cached value.- Specified by:
createCacheObject
in classImmutableLiteral<RubyString>
-
isCached
public boolean isCached()Description copied from class:ImmutableLiteral
Has this object already been cached?- Overrides:
isCached
in classImmutableLiteral<RubyString>
-
visit
-
getByteList
- Specified by:
getByteList
in interfaceStringLiteral
-
getString
- Specified by:
getString
in interfaceStringable
-
getFile
-
getLine
public int getLine() -
encode
-
decode
-
getCodeRange
public int getCodeRange()- Specified by:
getCodeRange
in interfaceStringLiteral
-
isTruthyImmediate
public boolean isTruthyImmediate()Description copied from class:Operand
Returns true if this is an immediate value that will always be considered truthy (true, numbers, etc)- Overrides:
isTruthyImmediate
in classOperand
- Returns:
-