Explorer

core.wasm-runtime-string-from-memory

description
Runtime function 1 of the definy compiler (exported as string_from_memory): string_from_memory(length: i32) -> value: a new string of the bytes 0..length of the memory. The memory is only a buffer for the host to pass strings (the values live in the GC heap). Local variable declarations and instructions, without the byte length (wasm.code-entry adds it)
type
List<Number>
expression
[
  2,
  1,
  @wasm.value-type-ref-null,
  @core.wasm-type-bytes,
  1,
  @wasm.value-type-i32,
  @wasm.local-get,
  0,
  @wasm.gc-prefix,
  @wasm.array-new-default,
  @core.wasm-type-bytes,
  @wasm.local-set,
  1,
  @wasm.i32-const,
  0,
  @wasm.local-set,
  2,
  @wasm.block,
  @wasm.block-type-empty,
  @wasm.loop,
  @wasm.block-type-empty,
  @wasm.local-get,
  2,
  @wasm.local-get,
  0,
  @wasm.i32-ge-u,
  @wasm.br-if,
  1,
  @wasm.local-get,
  1,
  @wasm.local-get,
  2,
  @wasm.local-get,
  2,
  @wasm.i32-load8-u,
  0,
  0,
  @wasm.gc-prefix,
  @wasm.array-set,
  @core.wasm-type-bytes,
  @wasm.local-get,
  2,
  @wasm.i32-const,
  1,
  @wasm.i32-add,
  @wasm.local-set,
  2,
  @wasm.br,
  0,
  @wasm.end,
  @wasm.end,
  @wasm.i32-const,
  2,
  @wasm.local-get,
  1,
  @wasm.gc-prefix,
  @wasm.struct-new,
  @core.wasm-type-string,
  @wasm.end
]
visibility
public
core.wasm-runtime-string-from-memory (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: GhQ7adO3e6jEOkMmjEpWg4vxLH-kt5YTrs4CjS423O8
content hash: upOJT1Qp3HJAXqzEznoxvEyBkT79G2h82DV_PE0Wh2E