module scheme // This is a backend admission probe. The semantic cases are separate and must // pass on the unchanged baseline; this assertion is expected to fail there. fn test_native_private_wind_admission_runs_complete_private_loop() { mut vm := new_with_options(Options{max_steps: 0, max_frames: 0})! vm.eval('(define (work n) (let ((sum 0)) (let loop ((i 0)) (if (= i n) sum (begin (dynamic-wind (lambda () (set! sum (+ sum 1))) (lambda () (set! sum (+ sum 2))) (lambda () (set! sum (+ sum 4)))) (loop (+ i 1)))))))')! vm.with_native_execution(fn (mut vm VM) !Value { assert vm.call(vm.lookup('work')!, [integer(17)])!.whole() == 119 scope := unsafe { &NativeScope(vm.native_execution_scope) } root := vm.lookup('work')!.procedure_pointer().function assert scope.plans.any(voidptr(it.root) == voidptr(root) && !it.disabled) assert scope.hits == 1 && scope.deopts == 0 return unspecified() })! } fn test_native_private_wind_admission_keeps_callback_internal_loop() { mut vm := new_with_options(Options{max_steps: 0, max_frames: 0})! vm.eval('(define (work n) (let ((state 0)) (let ((answer (dynamic-wind (lambda () (set! state 1)) (lambda () (let loop ((i n) (total 0)) (if (= i 0) total (loop (- i 1) (+ total i))))) (lambda () (set! state 4))))) (+ (* answer 10) state))))')! vm.with_native_execution(fn (mut vm VM) !Value { assert vm.call(vm.lookup('work')!, [integer(10)])!.whole() == 554 scope := unsafe { &NativeScope(vm.native_execution_scope) } root := vm.lookup('work')!.procedure_pointer().function assert scope.plans.any(voidptr(it.root) == voidptr(root) && !it.disabled) assert scope.hits == 1 && scope.deopts == 0 return unspecified() })! }