verifier: preserve resource obligations across CFG handoff
This commit is contained in:
1 parent
0e98638bc6
commit
09fbf8a5bc
34 files changed
+1267
-67
No files matched your search
@@ -0,0 +1,33 @@
|
||||
; A guard may be passed through a block argument; borrowing through it, unlocking and only then ending the mutex borrow is valid.
|
||||
; expect: run
|
||||
; schedules: 20
|
||||
; result: 7
|
||||
; phase: 3
|
||||
; spec: docs/spec/04-concurrency-and-atomics.md §40
|
||||
module test.cfg_provenance_guard_handoff
|
||||
air 0
|
||||
lang 0.1
|
||||
features [cancellation, effects, ownership, sync, tasks]
|
||||
|
||||
fn @main() -> u64
|
||||
effects [task.wait]
|
||||
entry:
|
||||
%z = const.u64 0
|
||||
%m = mutex.make %z
|
||||
%mr = borrow.ref %m
|
||||
mutex.lock %mr, ok -> @locked, cancelled -> @out
|
||||
locked(%g: guard<u64>):
|
||||
br @next(%g)
|
||||
next(%g2: guard<u64>):
|
||||
%p = mutex.borrow %g2
|
||||
%seven = const.u64 7
|
||||
store %p, %seven
|
||||
borrow.end %p
|
||||
mutex.unlock %g2
|
||||
borrow.end %mr
|
||||
%v = mutex.take %m
|
||||
ret %v
|
||||
out:
|
||||
borrow.end %mr
|
||||
%w = mutex.take %m
|
||||
ret %w
|
||||
Reference in new issue
Block a user