You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CPPIA JIT: typed-array helper exceptions bypass script catches and terminate the host #404
CPPIA's JIT terminates the host when these typed-array operations throw, even when the script wraps the operation in try/catch:
cpp.NativeArray.blit(dest, -1, source, 0, 1) with two-element Int arrays.
cpp.NativeArray.setSize(values, -1) with a two-element Int array.
values.resize(0x40000000) with an Int array. The runtime rejects the element count before allocating the buffer.
The same script catches all three exceptions and continues under the interpreter and native C++. A mixed Array<Dynamic> blit with an invalid source range also recovers under both CPPIA engines in this test.
Expected: the script catches the exception and continues with the original array intact.
Observed on Windows x64: the JIT child exits with -529697949 (0xE06D7363, an unhandled C++ exception). Neither the script catch nor the host catch around Host.runFile runs.
src/hx/cppia/ArrayBuiltin.cpp calls runBlit, runSetSizeExact and runResize directly from generated code. These helpers do not use TRY_NATIVE / CATCH_NATIVE, and their call sites do not check the pending exception. Helpers such as runSort and runToString already use that exception bridge.
Added the conventional local regression fixture test/regression/CppiaBlitException/{Script.hx,Main.hx,build.hxml,stdout.txt} before reporting. It runs each engine and operation in a separate child, checks array contents after the catch, and includes a valid blit and the dynamic-array control. No runtime fix is included. The fixture is local and has not been committed.
Validation on 4cdca96, Haxe 4.3.7, MSVC 19.44, Windows x64 release:
Case
Native C++
Interpreter
JIT
Typed blit range error
Pass
Pass
Process exits
Dynamic blit range error
Pass
Pass
Pass
Negative exact size
Pass
Pass
Process exits
Resize size limit
Pass
Pass
Process exits
The fix belongs in libhxcpp's JIT/native exception bridge and does not require a compiler or stdlib change. This is separate from #66, which concerned script exceptions returning to native callers.
Activity
Fix four dynamic and typed array builtins in cppia
Fix four dynamic and typed array builtins in cppia