@@ -371,9 +371,8 @@ cases are prevented via trap for several reasons:
371371 to link recursive calls and this requires opting in via some
372372 [ TBD] ( Concurrency.md#TODO ) function effect type or canonical ABI option.
373373
374- The ` call_might_be_recursive ` predicate is used by ` canon_lift ` and
375- ` canon_resource_drop ` (defined below) to conservatively detect recursive
376- reentrance and subsequently trap.
374+ The ` call_might_be_recursive ` predicate is used by ` canon_lift ` below to
375+ conservatively detect recursive reentrance and subsequently trap.
377376``` python
378377def call_might_be_recursive (caller : Supertask, callee_inst : ComponentInstance):
379378 if caller.inst is None :
@@ -3653,14 +3652,12 @@ def canon_resource_drop(rt, thread, i):
36533652 if rt.dtor:
36543653 rt.dtor(h.rep)
36553654 else :
3656- if rt.dtor:
3657- caller_opts = CanonicalOptions(async_ = False )
3658- callee_opts = CanonicalOptions(async_ = rt.dtor_async, callback = rt.dtor_callback)
3659- ft = FuncType([U32Type()],[], async_ = False )
3660- callee = partial(canon_lift, callee_opts, rt.impl, ft, rt.dtor)
3661- [] = canon_lower(caller_opts, ft, callee, thread, [h.rep])
3662- else :
3663- trap_if(call_might_be_recursive(thread.task, rt.impl))
3655+ caller_opts = CanonicalOptions(async_ = False )
3656+ callee_opts = CanonicalOptions(async_ = rt.dtor_async, callback = rt.dtor_callback)
3657+ ft = FuncType([U32Type()],[], async_ = False )
3658+ dtor = rt.dtor or (lambda thread , rep : [])
3659+ callee = partial(canon_lift, callee_opts, rt.impl, ft, dtor)
3660+ [] = canon_lower(caller_opts, ft, callee, thread, [h.rep])
36643661 else :
36653662 h.borrow_scope.num_borrows -= 1
36663663 return []
0 commit comments