+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4541949
Ported type family removal pass from MIL
DCupello1 Sep 30, 2025
8def55f
Generated projection functions for each type family instance.
DCupello1 Oct 1, 2025
0022a6b
Created chains that lead from the real type to the expected type. Imp…
DCupello1 Oct 3, 2025
8f073e8
Refactor: simplified exp transformation by making it only do conversi…
DCupello1 Oct 3, 2025
3454ac5
Made family constructors actually expose the binded variables as case…
DCupello1 Oct 3, 2025
d834aae
Some more cleanup. Made it so generation of conversion functions is d…
DCupello1 Oct 3, 2025
ddcf475
Fixed potential issue with families with one instance being applied o…
DCupello1 Oct 5, 2025
b502003
Added a simplification operation to the conversion chain.
DCupello1 Oct 5, 2025
b3baeb4
Fixed simplification to now work both ways. Move generation of projec…
DCupello1 Oct 5, 2025
0c213c3
Some extra fixes on iteration typing to make rocq code compile.
DCupello1 Oct 6, 2025
27adcb7
Cleanup and added description to pass.
DCupello1 Oct 7, 2025
dd677fa
Added small totalize fix to make wasm 2.0 validate.
DCupello1 Oct 7, 2025
0aa54d4
Improved naming of constructor and projection functions to use the ca…
DCupello1 Oct 7, 2025
502a325
Renaming some functions and types.
DCupello1 Oct 7, 2025
730503d
Small tweak on BinE and UnE real types.
DCupello1 Oct 8, 2025
26d354c
Modifying Pnn and Inn to be aliases of packtype and addrtype, respect…
DCupello1 Oct 8, 2025
2192553
fix test.md
DCupello1 Oct 8, 2025
3f8737f
Update check_type
f52985 Oct 13, 2025
e948b47
fix TEST.md for other tests
DCupello1 Oct 13, 2025
7b93476
Merge branch 'main' into typefamily-removal-pass
DCupello1 Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion specification/wasm-2.0/1-syntax.spectec
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ syntax resulttype hint(desc "result type") =
syntax packtype hint(desc "packed type") = I8 | I16
syntax lanetype hint(desc "lane type") = numtype | packtype

syntax Pnn hint(show I#n) = I8 | I16
syntax Pnn hint(show I#n) = packtype
syntax Jnn hint(show I#n) = Inn | Pnn
syntax Lnn hint(show I#n) = Inn | Fnn | Pnn

Expand Down
2 changes: 1 addition & 1 deletion specification/wasm-3.0/1.2-syntax.types.spectec
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ syntax valtype/sem =
| ... | BOT


syntax Inn hint(show I#N) hint(macro "nt%") = I32 | I64
syntax Inn hint(show I#N) hint(macro "nt%") = addrtype
syntax Fnn hint(show F#N) hint(macro "nt%") = F32 | F64
syntax Vnn hint(show V#N) hint(macro "nt%") = V128
syntax Cnn hint(show t) = Inn | Fnn | Vnn
Expand Down
2 changes: 1 addition & 1 deletion spectec/src/backend-interpreter/interpreter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ and check_type ty v expr =
boolV (ty = "val")
(* numtype *)
| CaseV (nt, []) when List.mem nt inn_types ->
boolV (ty = "Inn" || ty = "Jnn" || ty = "numtype" || ty = "valtype" || ty = "consttype")
boolV (ty = "Inn" || ty = "Jnn" || ty = "numtype" || ty = "valtype" || ty = "consttype" || ty = "addrtype")
| CaseV (nt, []) when List.mem nt fnn_types ->
boolV (ty = "Fnn" || ty = "numtype" || ty = "valtype" || ty = "consttype")
| CaseV (vt, []) when List.mem vt vnn_types ->
Expand Down
6 changes: 5 additions & 1 deletion spectec/src/exe-spectec/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type pass =
| Totalize
| Unthe
| Sideconditions
| TypeFamilyRemoval

(* This list declares the intended order of passes.

Expand All @@ -27,7 +28,7 @@ passers (--all-passes, some targets), we do _not_ want to use the order of
flags on the command line.
*)
let _skip_passes = [ Sub; Unthe ] (* Not clear how to extend them to indexed types *)
let all_passes = [ Totalize; Sideconditions ]
let all_passes = [ TypeFamilyRemoval; Totalize; Sideconditions; ]

type file_kind =
| Spec
Expand Down Expand Up @@ -73,18 +74,21 @@ let pass_flag = function
| Totalize -> "totalize"
| Unthe -> "the-elimination"
| Sideconditions -> "sideconditions"
| TypeFamilyRemoval -> "typefamily-removal"

let pass_desc = function
| Sub -> "Synthesize explicit subtype coercions"
| Totalize -> "Run function totalization"
| Unthe -> "Eliminate the ! operator in relations"
| Sideconditions -> "Infer side conditions"
| TypeFamilyRemoval -> "Transform Type families into sum types"

let run_pass : pass -> Il.Ast.script -> Il.Ast.script = function
| Sub -> Middlend.Sub.transform
| Totalize -> Middlend.Totalize.transform
| Unthe -> Middlend.Unthe.transform
| Sideconditions -> Middlend.Sideconditions.transform
| TypeFamilyRemoval -> Middlend.Typefamilyremoval.transform


(* Argument parsing *)
Expand Down
1 change: 1 addition & 0 deletions spectec/src/middlend/dune
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
totalize
unthe
sideconditions
typefamilyremoval
)
)
2 changes: 1 addition & 1 deletion spectec/src/middlend/totalize.ml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ let rec t_def' env = function
| ExpP (_, typI) ->
let x = ("x" ^ string_of_int i) $ no_region in
[ExpB (x, typI) $ x.at], ExpA (VarE x $$ no_region % typI) $ no_region
| TypP id -> [], TypA (VarT (id, []) $ no_region) $ no_region
| TypP id -> [TypB id $ no_region], TypA (VarT (id, []) $ no_region) $ no_region
| DefP (id, _, _) -> [], DefA id $ no_region
| GramP (id, _) -> [], GramA (VarG (id, []) $ no_region) $ no_region
) params' |> List.split in
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载