INNER CODE UNIT · JavaScript

mkWasmSupport

FStarLang/karamel · krmllib/js/loader.js:146

let mkWasmSupport = (mem) => ({
  WasmSupport_trap: (s) => {
    dump(mem, 2*1024);
    my_print(stringAtAddr(mem, s));
    my_print("Run-time trap, e.g. zero-sized array or abort. See error message above.");
    throw new Error();
  },
  WasmSupport_malloc: (sz) => {
    // We now provide experimental support for heap allocations. This only
    // caters to a very specific scenario, wherein the entirety of heap
    // allocations performed within a function call are reachable via this
    // function's return value. (In effect, this captures all of the
    // `create_in` functions from HACL.). The caller, upon dealing with such a
    // return value, copies the entire object graph using a combination of:
    // - a JSON description of the layout generated by krml, and
    // - the header tag of heap allocations, which contains their length.
    //
    // The allocator is bare-bones: the final word in memory contains the amount

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…