ext/liquid_c/vm.c
VALUE liquid_vm_evaluate(VALUE context, vm_assembler_t *code)
{
    vm_t *vm = vm_from_context(context);
    vm_stack_reserve_for_write(vm, code->max_stack_size);
#ifndef NDEBUG
    size_t old_stack_byte_size = c_buffer_size(&vm->stack);
#endif

    vm_render_until_error_args_t args = {
        .vm = vm,
        .const_ptr = (const size_t *)code->constants.data,
        .ip = code->instructions.data
    };
    vm_render_until_error((VALUE)&args);
    VALUE ret = vm_stack_pop(vm);
    assert(old_stack_byte_size == c_buffer_size(&vm->stack));
    return ret;
}
// Evaluate instructions that avoid using rendering instructions and leave with the result on
// the top of the stack
Evaluate instructions that avoid using rendering instructions and leave with the result on
the top of the stack
Evaluate instructions that avoid using rendering instructions and leave with the result on the top of the stack
VALUE liquid_vm_evaluate(VALUE context, vm_assembler_t *code)
{
    vm_t *vm = vm_from_context(context);
    vm_stack_reserve_for_write(vm, code->max_stack_size);
#ifndef NDEBUG
    size_t old_stack_byte_size = c_buffer_size(&vm->stack);
#endif
    vm_render_until_error_args_t args = {
        .vm = vm,
        .const_ptr = (const size_t *)code->constants.data,
        .ip = code->instructions.data
    };
    vm_render_until_error((VALUE)&args);
    VALUE ret = vm_stack_pop(vm);
    assert(old_stack_byte_size == c_buffer_size(&vm->stack));
    return ret;
}
VALUE liquid_vm_evaluate ( VALUE context , vm_assembler_t * code ) { vm_t * vm = vm_from_context ( context ) ; vm_stack_reserve_for_write ( vm , code -> max_stack_size ) ; #ifndef NDEBUG size_t old_stack_byte_size = c_buffer_size ( & vm -> stack ) ; #endif vm_render_until_error_args_t args = { . vm = vm , . const_ptr = ( const size_t * ) code -> constants . data , . ip = code -> instructions . data } ; vm_render_until_error ( ( VALUE ) & args ) ; VALUE ret = vm_stack_pop ( vm ) ; assert ( old_stack_byte_size == c_buffer_size ( & vm -> stack ) ) ; return ret ; }
Evaluate instructions that avoid using rendering instructions and leave with the result on
the top of the stack
Evaluate instructions that avoid using rendering instructions and leave with the result on the top of the stack