| 1 | module scheme |
| 2 | |
| 3 | fn test_native_private_wind_existing_continuation_exit_keeps_real_extent() { |
| 4 | mut vm := new_with_options(Options{max_steps: 0, max_frames: 0})! |
| 5 | vm.eval('(define out #f) (call/cc (lambda (k) (set! out k) 42))')! |
| 6 | vm.eval('(define (work k v) (dynamic-wind |
| 7 | (lambda () (vector-set! v 0 (+ (vector-ref v 0) 1))) |
| 8 | (lambda () (k 99)) |
| 9 | (lambda () (vector-set! v 0 (+ (vector-ref v 0) 10)))))')! |
| 10 | v := vm.eval('(vector 0)')! |
| 11 | gc_collect() |
| 12 | vm.with_native_execution(fn [v] (mut vm VM) !Value { |
| 13 | assert vm.call(vm.lookup('work')!, [vm.lookup('out')!, v])!.whole() == 99 |
| 14 | assert write(v)! == '#(11)' |
| 15 | // Flattened native wind extents cannot admit continuation exits. |
| 16 | // Future native escape support must retain this decline, or explicitly |
| 17 | // model wind exits before changing this admission expectation. |
| 18 | scope := unsafe { &NativeScope(vm.native_execution_scope) } |
| 19 | root := vm.lookup('work')!.procedure_pointer().function |
| 20 | assert !scope.plans.any(voidptr(it.root) == voidptr(root) && !it.disabled) |
| 21 | return unspecified() |
| 22 | })! |
| 23 | } |
| 24 | |