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

org.jruby.ir.instructions.GetInstr Maven / Gradle / Ivy

package org.jruby.ir.instructions;

import org.jruby.ir.Operation;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRWriterEncoder;

// Represents result = source.ref or result = source where source is not a stack variable
public abstract class GetInstr extends OneOperandResultBaseInstr implements FixedArityInstr {
    private final String  ref;

    public GetInstr(Operation op, Variable result, Operand source, String ref) {
        super(op, result, source);

        assert result != null: getClass().getSimpleName() + " result is null";

        this.ref = ref;
    }

    public String getRef() {
        return ref;
    }

    public Operand getSource() {
        return getOperand1();
    }

    @Override
    public void encode(IRWriterEncoder e) {
        super.encode(e);
        e.encode(getSource());
        e.encode(getRef());
    }

    @Override
    public String[] toStringNonOperandArgs() {
        return new String[] {"name: " + ref};
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy