8d5624fce4685526e4375bc4237fc487b5c3db7f — Marek Marecki 4 months ago bae6d71
Use get_value() for all kinds of general purpose registers

All instructions should use the get_value() wrapper instead of accessing
registers directly. This will make it possible to use local, argument,
and parameter registers in all operands.
1 files changed, 14 insertions(+), 1 deletions(-)

M new/src/vm/ins.cpp
M new/src/vm/ins.cpp => new/src/vm/ins.cpp +14 -1
@@ 535,7 535,20 @@ auto get_value(Stack& stack,
               viua::arch::Register_access const a,
               ip_type const ip) -> viua::vm::types::Cell_view
    return get_value(stack.frames.back().registers, a, ip);
    static viua::vm::Value void_placeholder;
    switch (a.set) {
        using enum viua::arch::REGISTER_SET;
        case VOID:
            return void_placeholder.value.view();
        case LOCAL:
            return get_value(stack.frames.back().registers, a, ip);
        case PARAMETER:
            return get_value(stack.frames.back().parameters, a, ip);
        case ARGUMENT:
            return get_value(stack.args, a, ip);
            throw abort_execution{ip, "illegal read access to register " + a.to_string()};
}  // namespace