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

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

There is a newer version: 9.4.9.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.operands.BoxedValue;
import org.jruby.compiler.ir.operands.UnboxedValue;
import org.jruby.compiler.ir.representations.InlinerInfo;

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

    public Operand[] getOperands() { return new Operand[] {argument}; }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy