Agree. Interrupts disable should be implement in the interpreter and JIT simultaneously.
On the other hand, I want to ask you the implementation of error handling either in JIT. Take a simple example:
-------------------- Compiling tree --------------------
while (i <= 10000)
i++;
endwhile
-------------------- optimized llvm ir --------------------
define void @foobar(%octave_base_value**) {
prelude:
%1 = getelementptr inbounds %octave_base_value** %0, i64 1
%2 = load %octave_base_value** %0, align 8
%3 = load %octave_base_value** %1, align 8
%4 = call double @octave_jit_cast_scalar_any(%octave_base_value* %3)
br label %while_cond_check
while_cond_check: ; preds = %while_body, %prelude
%5 = phi double [ %4, %prelude ], [ %8, %while_body ]
%6 = phi %octave_base_value* [ %2, %prelude ], [ %11, %while_body ]
%7 = fcmp ule double %5, 1.000000e+04
br i1 %7, label %while_body, label %final
while_body: ; preds = %while_cond_check
%8 = fadd double 1.000000e+00, %5
call void @octave_jit_release_any(%octave_base_value* %6)
%9 = load volatile i32* @octave_interrupt_state, align 4
%10 = icmp sgt i32 %9, 0
%11 = call %octave_base_value* @octave_jit_cast_any_scalar(double %5)
br i1 %10, label %final, label %while_cond_check
final: ; preds = %while_body, %while_cond_check
%12 = phi double [ %5, %while_cond_check ], [ %8, %while_body ]
%13 = phi %octave_base_value* [ %6, %while_cond_check ], [ %11, %while_body ]
store %octave_base_value* %13, %octave_base_value** %0, align 8
%14 = call %octave_base_value* @octave_jit_cast_any_scalar(double %12)
store %octave_base_value* %14, %octave_base_value** %1, align 8
ret void
}
I guess you use "%9 = load volatile i32* @octave_interrupt_state, align 4" to load global variable octave_interrupt_state. This value is used to do interrupt handling. But which instruction is used to do error handling?
Thanks a lot