Top Fields Constructors Methods
org.jruby.ir.instructions

public Class BuildCompoundStringInstr

extends NOperandResultBaseInstr
Class Inheritance
Imports
org.jcodings.Encoding, org.jruby.Appendable, .RubyString, org.jruby.ir.IRManager, .IRVisitor, .Operation, org.jruby.ir.builder.StringStyle, org.jruby.ir.operands.ChilledString, .FrozenString, .ImmutableLiteral, .MutableString, .Operand, .StringLiteral, .Variable, org.jruby.ir.persistence.IRReaderDecoder, .IRWriterEncoder, org.jruby.ir.runtime.IRRuntimeHelpers, org.jruby.ir.transformations.inlining.CloneInfo, org.jruby.parser.StaticScope, org.jruby.runtime.DynamicScope, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.ByteList, java.util.ArrayList, .List

Field Summary

Modifier and TypeField and Description
private final Encoding
private final int
private final String
private final int
private final StringStyle

Constructor Summary

AccessConstructor and Description
public
BuildCompoundStringInstr(Variable result, Operand[] pieces, Encoding encoding, int estimatedSize, StringStyle stringStyle, String file, int line)

Method Summary

Modifier and TypeMethod and Description
private FrozenString
private FrozenString
asOperand(ByteList bytelist)

public Instr
clone(CloneInfo
This object manages renaming of variables and labels, handles args and return values.
ii
)

Implements abstract org.jruby.ir.instructions.Instr.clone.

Clone the instruction for use in an inlining context (either when a scope is inlined into another scope, or when a block has to be cloned because its associated call belongs to an inlined scope).

private FrozenString
combine(ThreadContext context, FrozenString lastString, ImmutableLiteral<T> piece)

private Instr
public static BuildCompoundStringInstr
private static StringStyle
decodeStringStyle(boolean frozen, boolean mutable)

public void
private FrozenString
findNextFrozenString(ThreadContext context, Operand[] piecesArray, List<Operand> pieces, int[] i)

public Encoding
public String
public int
public int
public Operand[]
public Object
public boolean
public boolean
public Instr

Returns:

the simplified instruction or itself when it cannot be simplified.
simplifyInstr
(IRManager
the IR manager
manager
)

Overrides org.jruby.ir.instructions.Instr.simplifyInstr.

This will make an attempt to combine multiple pieces when they are contiguout frozen strings OR immutable literals.

public void
Inherited from org.jruby.ir.instructions.NOperandResultBaseInstr:
getOperandssetOperand

Field Detail

encodingback to summary
private final Encoding encoding
estimatedSizeback to summary
private final int estimatedSize
fileback to summary
private final String file
lineback to summary
private final int line
stringStyleback to summary
private final StringStyle stringStyle

Constructor Detail

BuildCompoundStringInstrback to summary
public BuildCompoundStringInstr(Variable result, Operand[] pieces, Encoding encoding, int estimatedSize, StringStyle stringStyle, String file, int line)

Method Detail

asFrozenStringback to summary
private FrozenString asFrozenString(ThreadContext context, ImmutableLiteral<T> piece)
asOperandback to summary
private FrozenString asOperand(ByteList bytelist)
cloneback to summary
public Instr clone(CloneInfo ii)

Implements abstract org.jruby.ir.instructions.Instr.clone.

Doc from org.jruby.ir.instructions.Instr.clone.

Clone the instruction for use in an inlining context (either when a scope is inlined into another scope, or when a block has to be cloned because its associated call belongs to an inlined scope). This might renaming variables and labels to eliminate naming conflicts. The implementation might vary on the cloning mode.

Parameters
ii:CloneInfo

This object manages renaming of variables and labels, handles args and return values.

Returns:Instr

a new instruction that can be used in the target scope.

Annotations
@Override
combineback to summary
private FrozenString combine(ThreadContext context, FrozenString lastString, ImmutableLiteral<T> piece)
copyback to summary
private Instr copy(FrozenString string)
decodeback to summary
public static BuildCompoundStringInstr decode(IRReaderDecoder d)
decodeStringStyleback to summary
private static StringStyle decodeStringStyle(boolean frozen, boolean mutable)
encodeback to summary
public void encode(IRWriterEncoder e)

Overrides org.jruby.ir.instructions.ResultBaseInstr.encode.

Annotations
@Override
findNextFrozenStringback to summary
private FrozenString findNextFrozenString(ThreadContext context, Operand[] piecesArray, List<Operand> pieces, int[] i)
getEncodingback to summary
public Encoding getEncoding()
getFileback to summary
public String getFile()
getInitialSizeback to summary
public int getInitialSize()
getLineback to summary
public int getLine()
getPiecesback to summary
public Operand[] getPieces()
interpretback to summary
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp)

Overrides org.jruby.ir.instructions.Instr.interpret.

Annotations
@Override
isChilledback to summary
public boolean isChilled()
isFrozenback to summary
public boolean isFrozen()
simplifyInstrback to summary
public Instr simplifyInstr(IRManager manager)

Overrides org.jruby.ir.instructions.Instr.simplifyInstr.

This will make an attempt to combine multiple pieces when they are contiguout frozen strings OR immutable literals. It may fail as not all strings can be concatenated together (e.g. mismatched encodings).

Parameters
manager:IRManager

the IR manager

Returns:Instr

the simplified instruction or itself when it cannot be simplified.

Annotations
@Override
visitback to summary
public void visit(IRVisitor visitor)

Overrides org.jruby.ir.instructions.Instr.visit.

Annotations
@Override