All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jruby.compiler.ir.instructions.UNBOX_Instr Maven / Gradle / Ivy

There is a newer version: 9.4.7.0
Show newest version
package org.jruby.compiler.ir.instructions;

import java.util.Map;

import org.jruby.compiler.ir.Operation;
import org.jruby.compiler.ir.operands.Operand;
import org.jruby.compiler.ir.operands.Variable;
import org.jruby.compiler.ir.representations.InlinerInfo;
import org.jruby.compiler.ir.operands.BoxedValue;
import org.jruby.compiler.ir.operands.UnboxedValue;

public class UNBOX_Instr extends OneOperandInstr
{
    public UNBOX_Instr(Variable dst, Operand v) {
        super(Operation.UNBOX_VALUE, dst, v);
    }

    public String toString() { return super.toString() + "(" + argument + ")"; }

    public Operand simplifyAndGetResult(Map valueMap) {
        simplifyOperands(valueMap);
        return (argument instanceof BoxedValue) ? ((BoxedValue)argument)._value : new UnboxedValue(argument);
    }

    public Instr cloneForInlining(InlinerInfo ii) {
        return new UNBOX_Instr(ii.getRenamedVariable(result), argument.cloneForInlining(ii));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy