package wax-lib

  1. Overview
  2. Docs
Libraries for Wax, a Rust-like syntax for WebAssembly

Install

dune-project
 Dependency

Authors

Maintainers

Sources

wax-v0.2.0.tbz
sha256=4361e1324b7754a4c08ab5b505df32061f3ce0cea60443fd0d3699e0fa796b32
sha512=fcc756d2f160ba90a9aa1131f2ab22ed7f45466ccd658c21cf9df6868a6aab0cee7f404719d698a379958802f9820398f2fe0685ecc4dda018ca4f653294e39b

doc/wax-lib.wasm/Wax_wasm/Ast/Text/index.html

Module Ast.TextSource

Sourcetype name = (string, location) annotated
Sourcetype idx_desc =
  1. | Num of Uint32.t
  2. | Id of string
Sourcemodule X : sig ... end
Sourcemodule Types : sig ... end
include sig ... end
Sourcetype 'a annotated_array = 'a X.annotated_array
Sourcetype 'a opt_annotated_array = 'a X.opt_annotated_array
Sourcetype heaptype = Make_types(X).heaptype =
  1. | Func
  2. | NoFunc
  3. | Exn
  4. | NoExn
  5. | Cont
  6. | NoCont
  7. | Extern
  8. | NoExtern
  9. | Any
  10. | Eq
  11. | I31
  12. | Struct
  13. | Array
  14. | None_
  15. | Type of idx
  16. | Exact of idx
Sourcetype reftype = Make_types(X).reftype = {
  1. nullable : bool;
  2. typ : heaptype;
}
Sourcetype valtype = Make_types(X).valtype =
  1. | I32
  2. | I64
  3. | F32
  4. | F64
  5. | V128
  6. | Ref of reftype
Sourcetype functype = Make_types(X).functype = {
  1. params : valtype opt_annotated_array;
  2. results : valtype array;
}
Sourcetype nonrec packedtype = packedtype =
  1. | I8
  2. | I16
Sourcetype storagetype = Make_types(X).storagetype =
  1. | Value of valtype
  2. | Packed of packedtype
Sourcetype nonrec !'typ muttype = 'typ muttype = {
  1. mut : bool;
  2. typ : 'typ;
}
Sourcetype fieldtype = storagetype muttype
Sourcetype comptype = Make_types(X).comptype =
  1. | Func of functype
  2. | Struct of fieldtype annotated_array
  3. | Array of fieldtype
  4. | Cont of idx
Sourcetype subtype = Make_types(X).subtype = {
  1. typ : comptype;
  2. supertype : idx option;
  3. final : bool;
  4. descriptor : idx option;
  5. describes : idx option;
}
Sourcetype nonrec limits = limits = {
  1. mi : Uint64.t;
  2. ma : Uint64.t option;
  3. address_type : [ `I32 | `I64 ];
  4. page_size_log2 : int option;
  5. shared : bool;
}
Sourcetype globaltype = valtype muttype
Sourceval heaptype_keyword : heaptype -> string option

The keyword naming a heap type (e.g. Some "func"); None for the Type case, whose index each printer renders in its own way.

Sourcetype typeuse = idx option * functype option
Sourcetype tabletype = {
  1. limits : (limits, location) annotated;
  2. reftype : reftype;
}
include sig ... end
Sourcetype nonrec (!'i32, !'i64, !'f32, !'f64) op = ('i32, 'i64, 'f32, 'f64) op =
  1. | I32 of 'i32
  2. | I64 of 'i64
  3. | F32 of 'f32
  4. | F64 of 'f64
Sourcetype nonrec signage = signage =
  1. | Signed
  2. | Unsigned
Sourcetype nonrec int_un_op = int_un_op =
  1. | Clz
  2. | Ctz
  3. | Popcnt
  4. | Eqz
  5. | Trunc of [ `F32 | `F64 ] * signage
  6. | TruncSat of [ `F32 | `F64 ] * signage
  7. | Reinterpret
  8. | ExtendS of [ `_16 | `_32 | `_8 ]
Sourcetype nonrec int_bin_op = int_bin_op =
  1. | Add
  2. | Sub
  3. | Mul
  4. | Div of signage
  5. | Rem of signage
  6. | And
  7. | Or
  8. | Xor
  9. | Shl
  10. | Shr of signage
  11. | Rotl
  12. | Rotr
  13. | Eq
  14. | Ne
  15. | Lt of signage
  16. | Gt of signage
  17. | Le of signage
  18. | Ge of signage
Sourcetype nonrec float_un_op = float_un_op =
  1. | Neg
  2. | Abs
  3. | Ceil
  4. | Floor
  5. | Trunc
  6. | Nearest
  7. | Sqrt
  8. | Convert of [ `I32 | `I64 ] * signage
  9. | Reinterpret
Sourcetype nonrec float_bin_op = float_bin_op =
  1. | Add
  2. | Sub
  3. | Mul
  4. | Div
  5. | Min
  6. | Max
  7. | CopySign
  8. | Eq
  9. | Ne
  10. | Lt
  11. | Gt
  12. | Le
  13. | Ge
Sourcetype nonrec num_type = num_type =
  1. | NumI32
  2. | NumI64
  3. | NumF32
  4. | NumF64
Sourcetype nonrec vec_shape = vec_shape =
  1. | I8x16
  2. | I16x8
  3. | I32x4
  4. | I64x2
  5. | F32x4
  6. | F64x2
Sourcetype nonrec vec_un_op = vec_un_op =
  1. | VecNeg of vec_shape
  2. | VecAbs of vec_shape
  3. | VecSqrt of [ `F32 | `F64 ]
  4. | VecNot
  5. | VecTruncSat of [ `F32 | `F64 ] * signage
  6. | VecConvert of [ `F32 | `F64 ] * signage
  7. | VecExtend of [ `High | `Low ] * [ `_16 | `_32 | `_8 ] * signage
  8. | VecPromote
  9. | VecDemote
  10. | VecCeil of [ `F32 | `F64 ]
  11. | VecFloor of [ `F32 | `F64 ]
  12. | VecTrunc of [ `F32 | `F64 ]
  13. | VecNearest of [ `F32 | `F64 ]
  14. | VecPopcnt
  15. | VecExtAddPairwise of signage * [ `I16 | `I8 ]
  16. | VecRelaxedTrunc of signage
  17. | VecRelaxedTruncZero of signage
Sourcetype nonrec vec_bin_op = vec_bin_op =
  1. | VecAdd of vec_shape
  2. | VecSub of vec_shape
  3. | VecMul of vec_shape
  4. | VecDiv of [ `F32 | `F64 ]
  5. | VecMin of signage option * vec_shape
  6. | VecMax of signage option * vec_shape
  7. | VecPMin of [ `F32 | `F64 ]
  8. | VecPMax of [ `F32 | `F64 ]
  9. | VecAvgr of [ `I16 | `I8 ]
  10. | VecQ15MulrSat
  11. | VecAddSat of signage * [ `I16 | `I8 ]
  12. | VecSubSat of signage * [ `I16 | `I8 ]
  13. | VecDot
  14. | VecEq of vec_shape
  15. | VecNe of vec_shape
  16. | VecLt of signage option * vec_shape
  17. | VecGt of signage option * vec_shape
  18. | VecLe of signage option * vec_shape
  19. | VecGe of signage option * vec_shape
  20. | VecAnd
  21. | VecOr
  22. | VecXor
  23. | VecAndNot
  24. | VecNarrow of signage * [ `I16 | `I8 ]
  25. | VecSwizzle
  26. | VecExtMulLow of signage * [ `_16 | `_32 | `_8 ]
  27. | VecExtMulHigh of signage * [ `_16 | `_32 | `_8 ]
  28. | VecRelaxedSwizzle
  29. | VecRelaxedMin of vec_shape
  30. | VecRelaxedMax of vec_shape
  31. | VecRelaxedQ15Mulr
  32. | VecRelaxedDot
Sourcetype nonrec vec_test_op = vec_test_op =
  1. | AnyTrue
  2. | AllTrue of vec_shape
Sourcetype nonrec vec_shift_op = vec_shift_op =
  1. | Shl of vec_shape
  2. | Shr of signage * vec_shape
Sourcetype nonrec vec_bitmask_op = vec_bitmask_op =
  1. | Bitmask of vec_shape
Sourcetype nonrec vec_tern_op = vec_tern_op =
  1. | VecRelaxedMAdd of [ `F32 | `F64 ]
  2. | VecRelaxedNMAdd of [ `F32 | `F64 ]
  3. | VecRelaxedLaneSelect of vec_shape
  4. | VecRelaxedDotAdd
Sourcetype nonrec vec_load_op = vec_load_op =
  1. | Load128
  2. | Load8x8S
  3. | Load8x8U
  4. | Load16x4S
  5. | Load16x4U
  6. | Load32x2S
  7. | Load32x2U
  8. | Load32Zero
  9. | Load64Zero
Sourcetype blocktype =
  1. | Typeuse of typeuse
  2. | Valtype of Make_types(X).valtype
Sourcetype nonrec memarg = memarg = {
  1. offset : Uint64.t;
  2. align : Uint64.t;
}
Sourcetype catch =
  1. | Catch of idx * idx
  2. | CatchRef of idx * idx
  3. | CatchAll of idx
  4. | CatchAllRef of idx
Sourcetype on_clause =
  1. | OnLabel of idx * idx
  2. | OnSwitch of idx
Sourcetype !'info instr_desc =
  1. | Block of {
    1. label : name option;
    2. typ : blocktype option;
    3. block : ('info instr list, location) annotated;
    }
  2. | Loop of {
    1. label : name option;
    2. typ : blocktype option;
    3. block : ('info instr list, location) annotated;
    }
  3. | If of {
    1. label : name option;
    2. typ : blocktype option;
    3. if_block : ('info instr list, location) annotated;
    4. else_block : ('info instr list, location) annotated;
    }
  4. | TryTable of {
    1. label : name option;
    2. typ : blocktype option;
    3. catches : catch list;
    4. block : ('info instr list, location) annotated;
    }
  5. | Try of {
    1. label : name option;
    2. typ : blocktype option;
    3. block : ('info instr list, location) annotated;
    4. catches : (idx * ('info instr list, location) annotated) list;
    5. catch_all : ('info instr list, location) annotated option;
    }
  6. | Unreachable
  7. | Nop
  8. | Throw of idx
  9. | ThrowRef
  10. | ContNew of idx
  11. | ContBind of idx * idx
  12. | Suspend of idx
  13. | Resume of idx * on_clause list
  14. | ResumeThrow of idx * idx * on_clause list
  15. | ResumeThrowRef of idx * on_clause list
  16. | Switch of idx * idx
  17. | Br of idx
  18. | Br_if of idx
  19. | Br_table of idx list * idx
  20. | Br_on_null of idx
  21. | Br_on_non_null of idx
  22. | Br_on_cast of idx * Make_types(X).reftype * Make_types(X).reftype
  23. | Br_on_cast_fail of idx * Make_types(X).reftype * Make_types(X).reftype
  24. | Br_on_cast_desc_eq of idx * Make_types(X).reftype * Make_types(X).reftype
  25. | Br_on_cast_desc_eq_fail of idx * Make_types(X).reftype * Make_types(X).reftype
  26. | Return
  27. | Call of idx
  28. | CallRef of idx
  29. | CallIndirect of idx * typeuse
  30. | ReturnCall of idx
  31. | ReturnCallRef of idx
  32. | ReturnCallIndirect of idx * typeuse
  33. | Drop
  34. | Select of Make_types(X).valtype list option
  35. | LocalGet of idx
  36. | LocalSet of idx
  37. | LocalTee of idx
  38. | GlobalGet of idx
  39. | GlobalSet of idx
  40. | Load of idx * memarg * num_type
  41. | LoadS of idx * memarg * [ `I32 | `I64 ] * [ `I16 | `I32 | `I8 ] * signage
  42. | Store of idx * memarg * num_type
  43. | StoreS of idx * memarg * [ `I32 | `I64 ] * [ `I16 | `I32 | `I8 ]
  44. | Atomic of idx * atomicop * memarg
  45. | AtomicFence
  46. | MemorySize of idx
  47. | MemoryGrow of idx
  48. | MemoryFill of idx
  49. | MemoryCopy of idx * idx
  50. | MemoryInit of idx * idx
  51. | DataDrop of idx
  52. | TableGet of idx
  53. | TableSet of idx
  54. | TableSize of idx
  55. | TableGrow of idx
  56. | TableFill of idx
  57. | TableCopy of idx * idx
  58. | TableInit of idx * idx
  59. | ElemDrop of idx
  60. | RefNull of Make_types(X).heaptype
  61. | RefFunc of idx
  62. | RefIsNull
  63. | RefAsNonNull
  64. | RefEq
  65. | RefTest of Make_types(X).reftype
  66. | RefCast of Make_types(X).reftype
  67. | RefCastDescEq of Make_types(X).reftype
  68. | RefGetDesc of idx
  69. | StructNew of idx
  70. | StructNewDefault of idx
  71. | StructNewDesc of idx
  72. | StructNewDefaultDesc of idx
  73. | StructGet of signage option * idx * idx
  74. | StructSet of idx * idx
  75. | ArrayNew of idx
  76. | ArrayNewDefault of idx
  77. | ArrayNewFixed of idx * Uint32.t
  78. | ArrayNewData of idx * idx
  79. | ArrayNewElem of idx * idx
  80. | ArrayGet of signage option * idx
  81. | ArraySet of idx
  82. | ArrayLen
  83. | ArrayFill of idx
  84. | ArrayCopy of idx * idx
  85. | ArrayInitData of idx * idx
  86. | ArrayInitElem of idx * idx
  87. | RefI31
  88. | I31Get of signage
  89. | Const of (string, string, string, string) op
  90. | BinOp of (int_bin_op, int_bin_op, float_bin_op, float_bin_op) op
  91. | UnOp of (int_un_op, int_un_op, float_un_op, float_un_op) op
  92. | Add128
  93. | Sub128
  94. | MulWide of signage
  95. | VecConst of Wax_utils.V128.t
  96. | VecUnOp of vec_un_op
  97. | VecBinOp of vec_bin_op
  98. | VecTest of vec_test_op
  99. | VecShift of vec_shift_op
  100. | VecBitmask of vec_bitmask_op
  101. | VecTernOp of vec_tern_op
  102. | VecBitselect
  103. | VecLoad of idx * vec_load_op * memarg
  104. | VecStore of idx * memarg
  105. | VecLoadLane of idx * [ `I16 | `I32 | `I64 | `I8 ] * memarg * int
  106. | VecStoreLane of idx * [ `I16 | `I32 | `I64 | `I8 ] * memarg * int
  107. | VecLoadSplat of idx * [ `I16 | `I32 | `I64 | `I8 ] * memarg
  108. | VecExtract of vec_shape * signage option * int
  109. | VecReplace of vec_shape * int
  110. | VecSplat of vec_shape
  111. | VecShuffle of string
  112. | I32WrapI64
  113. | I64ExtendI32 of signage
  114. | F32DemoteF64
  115. | F64PromoteF32
  116. | ExternConvertAny
  117. | AnyConvertExtern
  118. | Folded of 'info instr * 'info instr list
  119. | String of idx option * (string, location) annotated list
  120. | Char of Uchar.t
  121. | If_annotation of {
    1. cond : cond;
    2. then_body : ('info instr list, location) annotated;
    3. else_body : ('info instr list, location) annotated option;
    }
Sourceand !'info instr = {
  1. desc : 'info instr_desc;
  2. info : 'info;
  3. hints : idx Hints.t;
    (*

    The advisory metadata.code.* metadata of this instruction (branch-hinting and compilation-hints proposals). A field rather than a wrapper node, so that the matches on desc — which is nearly every match on an instruction — neither see it nor have to see through it.

    *)
}

A synthesized instruction: no source location, no hints. The instruction counterpart of Ast.no_loc, which builds an annotated and so cannot serve a record that carries hints as well.

Sourcetype !'info expr = 'info instr list

A sequence of instructions.

Sourcetype datastring = (string, location) annotated list
Sourcetype datavalelem =
  1. | Str of string
  2. | Numlist of storagetype * string list
  3. | V128list of Wax_utils.V128.t list
Sourcetype dataval = (datavalelem, location) annotated list
Sourcetype importdesc =
  1. | Func of {
    1. exact : bool;
    2. typ : typeuse;
    }
  2. | Memory of (limits, location) annotated
  3. | Table of tabletype
  4. | Global of globaltype
  5. | Tag of typeuse
Sourcetype nonrec exportable = exportable =
  1. | Func
  2. | Memory
  3. | Table
  4. | Tag
  5. | Global
Sourcetype 'info datamode =
  1. | Passive
  2. | Active of idx * 'info expr
Sourcetype 'info elemmode =
  1. | Passive
  2. | Active of idx * 'info expr
  3. | Declare
Sourcetype 'info tableinit =
  1. | Init_default
  2. | Init_expr of 'info expr
  3. | Init_segment of 'info expr list
Sourcetype 'info modulefield =
  1. | Types of rectype
  2. | Import of {
    1. module_ : name;
    2. name : name;
    3. id : name option;
    4. desc : importdesc;
    5. exports : name list;
    }
  3. | Import_group1 of {
    1. module_ : name;
    2. items : (name * name option * importdesc) list;
    }
  4. | Import_group2 of {
    1. module_ : name;
    2. desc : importdesc;
    3. items : name list;
    }
  5. | Func of {
    1. id : name option;
    2. typ : typeuse;
    3. locals : (name option * valtype, location) annotated list;
    4. instrs : 'info instr list;
    5. exports : name list;
    6. priority : Hints.priority option;
      (*

      compilation-hints: the function's metadata.code.compilation_priority entry, the one hint of that family that is per-function rather than per-instruction.

      *)
    }
  6. | Memory of {
    1. id : name option;
    2. limits : (limits, location) annotated;
    3. init : dataval option;
    4. exports : name list;
    }
  7. | Table of {
    1. id : name option;
    2. typ : tabletype;
    3. init : 'info tableinit;
    4. exports : name list;
    }
  8. | Tag of {
    1. id : name option;
    2. typ : typeuse;
    3. exports : name list;
    }
  9. | Global of {
    1. id : name option;
    2. typ : globaltype;
    3. init : 'info expr;
    4. exports : name list;
    }
  10. | Export of {
    1. name : name;
    2. kind : exportable;
    3. index : idx;
    }
  11. | Start of idx
  12. | Elem of {
    1. id : name option;
    2. typ : reftype;
    3. init : 'info expr list;
    4. mode : 'info elemmode;
    }
  13. | Data of {
    1. id : name option;
    2. init : dataval;
    3. mode : 'info datamode;
    }
  14. | String_global of {
    1. id : name;
    2. typ : idx option;
    3. init : datastring;
    }
  15. | Feature_annotation of name
  16. | Module_if_annotation of {
    1. cond : cond;
    2. then_fields : (('info modulefield, location) annotated list, location) annotated;
    3. else_fields : (('info modulefield, location) annotated list, location) annotated option;
    }
Sourcetype 'info module_ = name option * ('info modulefield, location) annotated list

A Wasm module in text format.