@@ -57,6 +57,14 @@ local function wrap_traceback(f)
5757 end
5858end
5959
60+ local function jit_off (f )
61+ if type (f ) ~= ' function' then
62+ return function (...) return f (... ) end
63+ end
64+ jit .off (f )
65+ return f
66+ end
67+
6068local props = { }
6169
6270local function props_key (ptr )
@@ -341,9 +349,9 @@ local upipe_methods = {
341349 assert (pipe ~= nil , " upipe_flow_alloc_sub failed" )
342350 return ffi .gc (pipe , C .upipe_release )
343351 end ,
344- release = function (pipe )
352+ release = jit_off ( function (pipe )
345353 C .upipe_release (ffi .gc (pipe , nil ))
346- end ,
354+ end ) ,
347355 iterate_sub = function (pipe , p )
348356 local f = C .upipe_iterate_sub
349357 return p and f (pipe , p ) or iterator (pipe , f , " struct upipe *" )
@@ -372,14 +380,18 @@ ffi.metatype("struct upipe", {
372380 if props and props ._control and props ._control [key ] then
373381 f = props ._control [key ]
374382 else
375- f = C [" upipe_" .. key ]
383+ f = jit_off ( C [" upipe_" .. key ])
376384 end
377385 return getter (upipe_getters , f , key )
378386 end ,
379- __newindex = function (pipe , key , val )
387+ __newindex = jit_off ( function (pipe , key , val )
380388 local sym = " upipe_set_" .. key
381- assert (C .ubase_check (C [sym ](pipe , val )), sym )
382- end ,
389+ local ret = C [sym ](pipe , val )
390+ if not C .ubase_check (ret ) then
391+ local msg = C .ubase_err_str (ret )
392+ error (fmt (" %s: %s" , sym , msg ~= nil and ffi .string (msg ) or ret ))
393+ end
394+ end ),
383395 __concat = function (pipe , next_pipe )
384396 local last = pipe
385397 local output = ffi .new (" struct upipe *[1]" )
0 commit comments