New AIR rejects: island_use_after_send (E2001), island_lend_task (E4002), island_destroy_while_borrowed (E2101), arc_content_mutex (E2111), frozen_borrow_mut (E1001). Every Phase 4 invariant now has an AIR and an .aji test. Full suite 392/392, also under --stress 1000 and --collect-every-step; test-extended, hosted smoke, source coverage 61/61.
35 lines
832 B
LLVM
35 lines
832 B
LLVM
; An island is not Share (its owner may mutate it): lending it to a task is E4002.
|
|
; expect: reject E4002
|
|
; phase: 4
|
|
; spec: docs/spec/04-concurrency-and-atomics.md
|
|
module test.island_lend_task
|
|
air 0
|
|
lang 0.1
|
|
features [capabilities, effects, heap, islands, ownership, resources, tasks]
|
|
|
|
fn @read(%g: ref<island<u64>>) -> u64
|
|
effects []
|
|
entry:
|
|
%r = island.root %g
|
|
%p = island.borrow %g, %r
|
|
%v = load %p
|
|
borrow.end %p
|
|
ret %v
|
|
|
|
fn @main(%heap: cap<mem.alloc>) -> u64
|
|
effects [mem.alloc, task.spawn]
|
|
entry:
|
|
%v = const.u64 1
|
|
island.create %v, %heap, ok -> @made, err -> @oom
|
|
made(%i: island<u64>):
|
|
%g = borrow.ref %i
|
|
%sc = task.scope.begin
|
|
%t = task.spawn %sc, @read(%g)
|
|
%r = task.join %t
|
|
task.scope.end %sc
|
|
borrow.end %g
|
|
island.destroy %i
|
|
ret %r
|
|
oom(%e: alloc_error):
|
|
trap
|