spec: accept RFC 0005 and integrate Phase 1 memory model (P1-1, P1-2)
- RFC 0005 Accepted (revision 2) - spec 07 §8.8 types and syntax; spec 07a contracts for features ownership and arrays; spec 08 §11-§14 borrows, facts, initialization, stage order; spec 03 frame storage, second-class borrows, static region generations - grammar: from-returns, multi-result, new types and opcodes - feature registry: ownership and arrays published; heap added and regions moved to Phase 2; borrow_joins reserved and unscheduled - codes E2105-E2108, T0008 - Q-009, Q-010 resolved; Phase 1 and Phase 2 plans updated; Own test moved to phase 2
This commit is contained in:
15 files changed
+269
-55
No files matched your search
@@ -30,14 +30,16 @@ Declaring `features [capabilities, effects, ownership]` grants no authority. It
|
||||
|
||||
| Feature | Status | Phase | Depends on | Semantic block |
|
||||
|---|---|---|---|---|
|
||||
| `arrays` | reserved | 1 | — | fixed-size arrays `[T; N]`, checked indexing |
|
||||
| `arrays` | published | 1 | `ownership` | `[T; N]`, `slice<T>`, `slice_mut<T>`, `array.splat`, `borrow.index[.proven]`, `slice.*`, `guard`, bounds facts (spec 07a, spec 08 §12) |
|
||||
| `atomics` | reserved | 5 | `ownership` | atomic types, the five orderings, fences, `atomic.*` instructions |
|
||||
| `capabilities` | reserved | 2 | `effects`, `ownership` | `cap<…>` values, narrowing, delegation, capability-gated intrinsics |
|
||||
| `borrow_joins` | reserved | — | `ownership` | borrow-typed block parameters (spec 08 §11.6); unscheduled |
|
||||
| `channels` | reserved | 3 | `ownership` | bounded and rendezvous channels with ownership transfer |
|
||||
| `effects` | reserved | 2 | — | effect checking of `effects [...]` lists (E3101) |
|
||||
| `islands` | reserved | 4 | `ownership`, `regions` | `Island<T>`, `iref<T>`, transfer, freeze, `Frozen<T>` |
|
||||
| `ownership` | reserved | 1 | — | `Own<T>`, `move`, `ref<T>`/`mut<T>` borrows, slices, initialization, linearity |
|
||||
| `regions` | reserved | 1 | `ownership` | `Region`, generations, region allocation, reset and destroy |
|
||||
| `heap` | reserved | 2 | `capabilities`, `effects`, `ownership` | `Own<T>`, `own.alloc`, `own.free`, move-only values |
|
||||
| `islands` | reserved | 4 | `capabilities`, `effects`, `ownership`, `regions` | `Island<T>`, `iref<T>`, transfer, freeze, `Frozen<T>` |
|
||||
| `ownership` | published | 1 | — | frame storage `local<T>`, second-class borrows `ref<T>`/`mut<T>`, `from` returns, initialization (spec 07 §8.8, spec 07a, spec 08 §11, §13) |
|
||||
| `regions` | reserved | 2 | `capabilities`, `effects`, `ownership` | `Region`, static generations, region allocation, reset and destroy |
|
||||
| `sync` | reserved | 3 | `ownership` | `Mutex<T>`, `RwLock<T>`, linear guards |
|
||||
| `tasks` | reserved | 3 | `ownership` | structured task scopes, spawn/join/cancel, `Send`/`Share` |
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ field = ident ":" type ;
|
||||
enum_type = "enum" "{" variant { "," variant } [ "," ] "}" ;
|
||||
variant = ident [ "(" [ type { "," type } ] ")" ] ;
|
||||
|
||||
function = "fn" global "(" [ param_list ] ")" "->" type NL
|
||||
function = "fn" global "(" [ param_list ] ")" "->" type [ "from" local ] NL (* from: feature ownership *)
|
||||
"effects" "[" [ path_list ] "]" NL
|
||||
block { block } ;
|
||||
param_list = param { "," param } ;
|
||||
@@ -44,7 +44,8 @@ param = local ":" type ;
|
||||
block = ident [ "(" [ param_list ] ")" ] ":" NL { instruction NL } ;
|
||||
(* The first block is the entry block and takes no parameters. *)
|
||||
|
||||
instruction = [ local "=" ] operation ;
|
||||
instruction = [ local { "," local } "=" ] operation ;
|
||||
(* More than one result only for instructions specified with several results (slice.split). *)
|
||||
|
||||
operation = "const." int_type int_lit
|
||||
| "const.bool" ( "true" | "false" )
|
||||
@@ -56,8 +57,32 @@ operation = "const." int_type int_lit
|
||||
| "struct.get" global "." ident "," local
|
||||
| "enum.make" global "." ident "(" [ local_list ] ")"
|
||||
| "call" global "(" [ local_list ] ")"
|
||||
| ownership_op
|
||||
| arrays_op
|
||||
| terminator ;
|
||||
|
||||
(* Feature ownership (spec 07a). *)
|
||||
ownership_op = "local.alloc" type
|
||||
| "local.store" local "," local
|
||||
| "local.zero" local
|
||||
| "local.load" local
|
||||
| "borrow.ref" local
|
||||
| "borrow.mut" local
|
||||
| "borrow.field" global "." ident "," local
|
||||
| "borrow.end" local
|
||||
| "load" local
|
||||
| "store" local "," local ;
|
||||
|
||||
(* Feature arrays (spec 07a). *)
|
||||
arrays_op = "array.splat" type local
|
||||
| ( "borrow.index" | "borrow.index.proven" ) local "," local
|
||||
| "slice.make" local
|
||||
| "slice.len" local
|
||||
| "slice.sub" local "," local "," local
|
||||
| "slice.split" local "," local
|
||||
| "slice.copy" local "," local
|
||||
| "guard" local ;
|
||||
|
||||
arith_op = ( "add" | "sub" | "mul" ) "." ( "checked" | "wrap" ) "." int_type
|
||||
| ( "div" | "rem" ) ".checked." int_type
|
||||
| ( "and" | "or" | "xor" ) "." ( int_type | "bool" )
|
||||
@@ -76,7 +101,10 @@ terminator = "br" target
|
||||
enum_arm = ident "->" global ; (* target block receives the variant payload as parameters *)
|
||||
target = global "(" [ local_list ] ")" ;
|
||||
|
||||
type = int_type | "bool" | "void" | "never" | global ;
|
||||
type = int_type | "bool" | "void" | "never" | global
|
||||
| ( "local" | "ref" | "mut" ) "<" type ">" (* feature ownership *)
|
||||
| "[" type ";" int_lit "]" (* feature arrays *)
|
||||
| ( "slice" | "slice_mut" ) "<" type ">" ; (* feature arrays *)
|
||||
int_type = "u8" | "u16" | "u32" | "u64" | "u128" | "usize"
|
||||
| "i8" | "i16" | "i32" | "i64" | "i128" | "isize" ;
|
||||
(* "f32" and "f64" are reserved; see spec 07 §8.4. "byte" is not an AIR type: frontends lower it to u8. *)
|
||||
|
||||
@@ -33,6 +33,10 @@ Draft registry. Codes are stable once released in a tagged compiler version.
|
||||
| E2103 | memory.out_of_bounds | Access not proven in bounds |
|
||||
| E2104 | memory.region_generation | Reference belongs to invalidated region generation |
|
||||
| E2110 | island.escape | Island-internal reference escapes island |
|
||||
| E2105 | borrow.not_ended | Owned borrow live at `ret`, or borrow state differs between edges into a block |
|
||||
| E2106 | borrow.use_after_end | Borrow used or ended after it was ended |
|
||||
| E2107 | borrow.not_owned | Lent (parameter) borrow ended by the callee |
|
||||
| E2108 | borrow.escapes_frame | Borrow derived from frame storage returned from its function |
|
||||
| E2111 | island.foreign_mutable_edge | Island graph points to forbidden foreign mutable storage |
|
||||
|
||||
## E3xxx — Resources/capabilities/effects
|
||||
@@ -85,3 +89,4 @@ Reported in trap records (spec 01 §6), not by the verifier.
|
||||
| T0005 | trap.shift_out_of_range | Shift amount negative or not less than bit width |
|
||||
| T0006 | trap.cast_out_of_range | Checked cast value not representable in target type |
|
||||
| T0007 | trap.call_depth | Call depth limit (1 024 frames) exceeded |
|
||||
| T0008 | trap.out_of_bounds | Runtime bounds check failed |
|
||||
Reference in new issue
Block a user