Writing a WASM module represented as Clojure data structures to a BinF view. In other words, compilation.
Unless one wants to design a custom module compilation environment, ultimately, one should use the compile
function
from the helins.wasm
namespace which does all the job for compiling a whole WASM module.
For writing sections, things must be prepared with the helins.wasm.count
namespace.
See README for namespace organization and naming scheme.
Writing a WASM module represented as Clojure data structures to a BinF view. In other words, compilation. Unless one wants to design a custom module compilation environment, ultimately, one should use the `compile` function from the `helins.wasm` namespace which does all the job for compiling a whole WASM module. For writing sections, things must be prepared with the [[helins.wasm.count]] namespace. See README for namespace organization and naming scheme.
(exportsec'
view
{:wasm/keys [exportsec]
{:as ctx-write n-byte- :wasm.count/exportsec n-export :wasm.export/n}
:wasm/write})
(expr' view flatidx opvec+)
For a vector of instr'
.
For a vector of [[instr']].
(func view flatidx-type {:wasm/keys [typeidx]})
For functions found in the funcsec and in imports.
WASM specification does not have a special name for it since binary-wise it is simply a type index.
For functions found in the funcsec and in imports. WASM specification does not have a special name for it since binary-wise it is simply a type index.
(importsec' view
{:wasm/keys [importsec]
{flatidx-type :wasm.flatidx/type
n-byte- :wasm.count/importsec
n-import :wasm.import/n}
:wasm/write})
(instr'+ view flatidx opvec+)
Behaves same as expr'
.
Behaves same as [[expr']].
(op-constval f-value)
(op-constval f-value view _flatidx opvec)
Used for numerical operations declaring a constant value.
Used for numerical operations declaring a constant value.
Map of opcode -> reading function for opcodes which:
Map of **opcode** -> **reading function** for opcodes which: - Have any kind of immediate(s) - Is not 0xFC (the "misc" opcode that leads to a second-level opcode
(op-memarg view _flatidx opvec)
Used for memory instructions that have a memarg'
.
Used for memory instructions that have a [[memarg']].
(op-memory view flatidx opvec)
Used for memory instructions that have a memidx'
as only immediate.
Used for memory instructions that have a [[memidx']] as only immediate.
Map of immediate to "misc" opcode (0xFC) -> reading function.
Map of **immediate to "misc" opcode (0xFC)** -> **reading function**.
(op-table view flatidx opvec)
Table instruction involving a table index immediate.
Table instruction involving a table index immediate.
(op-table-misc view flatidx opvec)
Table instruction involving a table index immediate (prefixed with the 0xFC "misc" opcode).
Table instruction involving a table index immediate (prefixed with the 0xFC "misc" opcode).
(op-var-global view flatidx opvec)
Used for global variable instructions.
Used for global variable instructions.
(op-var-local view _flatidx opvec)
Used for local variable instructions.
Used for local variable instructions.
(section'+ view ctx)
Writes all existing sections.
Used by module'
.
Writes all existing sections. Used by [[module']].
(section-externval view ctx k-section bin-section-id k-count compile-item)
Helper for writing sections about WASM externval (eg. funcsec, memsec, tablesec...)
Helper for writing sections about WASM **externval** (eg. funcsec, memsec, tablesec...)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close