You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current Wasm backend is implemented in OCaml and translates from Imp to the AST used in the Webassembly reference implementation.
Doing Imp -> Wasm in OCaml was fine for quickly providing a seemingly working Webassembly backend. However, the gap between Imp and Wasm is quite big. The former was designed to resemble Javascript, the latter is much more low level. In the long run, it might be worth narrowing this gap by adding a more Wasm-like intermediate representation to Q*Cert.
Use integers for variable names instead of string .
listing free variables in blocks would allow to translate Imp blocks to Wasm functions not true because Wasm functions can return only one value.
Replace for(each) with something closer to Wasm's loop construct.
Merge EJsonOperator and EJsonRuntimeOperator into a single WasmOperator. Avoid ADT features, WasmOperator should be an enumeration.
Introduce wasm data model (e.g. type wasm_model = string ejson).
On a later stage:
Replace WasmOperator with (namespace, opname) : (string * string). We import operators from the runtime anyway and this is all information we need. Most operators will have namespace = "runtime" to call into the runtime.wasm, but certain operators might be provided by the environment (e.g. logging) or separate wasm modules.
Use the backward mapping (string * string) -> WasmOperator to test functional equivalence of compiled Wasm contracts linked with operators implemented in Coq/OCaml versus operators implemented in the production runtime.wasm.
Maybe, we can unbox immediate values such as integers and floats after avoiding polymorphic operators.
The text was updated successfully, but these errors were encountered:
The current Wasm backend is implemented in OCaml and translates from Imp to the AST used in the Webassembly reference implementation.
Doing
Imp -> Wasm
in OCaml was fine for quickly providing a seemingly working Webassembly backend. However, the gap between Imp and Wasm is quite big. The former was designed to resemble Javascript, the latter is much more low level. In the long run, it might be worth narrowing this gap by adding a more Wasm-like intermediate representation to Q*Cert.My incomplete wish-list for W-Imp:
listing free variables in blocks would allow to translate Imp blocks to Wasm functionsnot true because Wasm functions can return only one value.EJsonOperator
andEJsonRuntimeOperator
into a singleWasmOperator
. Avoid ADT features,WasmOperator
should be an enumeration.type wasm_model = string ejson
).On a later stage:
WasmOperator
with(namespace, opname) : (string * string)
. We import operators from the runtime anyway and this is all information we need. Most operators will havenamespace = "runtime"
to call into theruntime.wasm
, but certain operators might be provided by the environment (e.g. logging) or separate wasm modules.(string * string) -> WasmOperator
to test functional equivalence of compiled Wasm contracts linked with operators implemented in Coq/OCaml versus operators implemented in the productionruntime.wasm
.The text was updated successfully, but these errors were encountered: