Explorer

core.wasm-runtime-string-to-memory

description
Runtime function 13 of the definy compiler (exported as string_to_memory): string_to_memory(string) -> i32: writes the bytes of the string at 0 of the memory (growing it when needed) and returns the byte length. For the host to read strings. 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,
  2,
  @wasm.value-type-i32,
  @wasm.local-get,
  0,
  @wasm.gc-prefix,
  @wasm.ref-cast,
  @core.wasm-type-string,
  @wasm.gc-prefix,
  @wasm.struct-get,
  @core.wasm-type-string,
  1,
  @wasm.local-tee,
  1,
  @wasm.gc-prefix,
  @wasm.array-len,
  @wasm.local-tee,
  2,
  @wasm.memory-size,
  0,
  @wasm.i32-const,
  16,
  @wasm.i32-shl,
  @wasm.i32-gt-u,
  @wasm.if,
  @wasm.block-type-empty,
  @wasm.local-get,
  2,
  @wasm.i32-const,
  255,
  255,
  3,
  @wasm.i32-add,
  @wasm.i32-const,
  16,
  @wasm.i32-shr-u,
  @wasm.memory-size,
  0,
  @wasm.i32-sub,
  @wasm.memory-grow,
  0,
  @wasm.drop,
  @wasm.end,
  @wasm.i32-const,
  0,
  @wasm.local-set,
  3,
  @wasm.block,
  @wasm.block-type-empty,
  @wasm.loop,
  @wasm.block-type-empty,
  @wasm.local-get,
  3,
  @wasm.local-get,
  2,
  @wasm.i32-ge-u,
  @wasm.br-if,
  1,
  @wasm.local-get,
  3,
  @wasm.local-get,
  1,
  @wasm.local-get,
  3,
  @wasm.gc-prefix,
  @wasm.array-get-u,
  @core.wasm-type-bytes,
  @wasm.i32-store8,
  0,
  0,
  @wasm.local-get,
  3,
  @wasm.i32-const,
  1,
  @wasm.i32-add,
  @wasm.local-set,
  3,
  @wasm.br,
  0,
  @wasm.end,
  @wasm.end,
  @wasm.local-get,
  2,
  @wasm.end
]
visibility
public
core.wasm-runtime-string-to-memory (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: AdIny9TKFOWBcnuPHj2tLhlAPHDt0fpzpZeEqjwd7n8
content hash: AhH2i3e6yLkX3NrtrD2xBkm4v6Tp20P1aU4ToiWjdd4