Explorer

core.wasm-runtime-string-slice

description
Runtime function 10 of the definy compiler: string_slice(string, start, end) -> value: the bytes from start to end. start and end are clamped to 0..=length, and the result is empty when end < start. Local variable declarations and instructions, without the byte length (wasm.code-entry adds it)
type
List<Number>
expression
[
  4,
  1,
  @wasm.value-type-ref-null,
  @core.wasm-type-bytes,
  3,
  @wasm.value-type-i32,
  1,
  @wasm.value-type-i64,
  1,
  @wasm.value-type-ref-null,
  @core.wasm-type-bytes,
  @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,
  3,
  @wasm.gc-prefix,
  @wasm.array-len,
  @wasm.local-set,
  4,
  @wasm.local-get,
  1,
  @wasm.call,
  15,
  @wasm.local-set,
  7,
  @wasm.local-get,
  7,
  @wasm.i64-const,
  0,
  @wasm.i64-lt-s,
  @wasm.if,
  @wasm.value-type-i32,
  @wasm.i32-const,
  0,
  @wasm.else,
  @wasm.local-get,
  7,
  @wasm.local-get,
  4,
  @wasm.i64-extend-i32-u,
  @wasm.i64-gt-s,
  @wasm.if,
  @wasm.value-type-i32,
  @wasm.local-get,
  4,
  @wasm.else,
  @wasm.local-get,
  7,
  @wasm.i32-wrap-i64,
  @wasm.end,
  @wasm.end,
  @wasm.local-set,
  5,
  @wasm.local-get,
  2,
  @wasm.call,
  15,
  @wasm.local-set,
  7,
  @wasm.local-get,
  7,
  @wasm.i64-const,
  0,
  @wasm.i64-lt-s,
  @wasm.if,
  @wasm.value-type-i32,
  @wasm.i32-const,
  0,
  @wasm.else,
  @wasm.local-get,
  7,
  @wasm.local-get,
  4,
  @wasm.i64-extend-i32-u,
  @wasm.i64-gt-s,
  @wasm.if,
  @wasm.value-type-i32,
  @wasm.local-get,
  4,
  @wasm.else,
  @wasm.local-get,
  7,
  @wasm.i32-wrap-i64,
  @wasm.end,
  @wasm.end,
  @wasm.local-set,
  6,
  @wasm.local-get,
  6,
  @wasm.local-get,
  5,
  @wasm.i32-lt-u,
  @wasm.if,
  @wasm.block-type-empty,
  @wasm.local-get,
  5,
  @wasm.local-set,
  6,
  @wasm.end,
  @wasm.local-get,
  6,
  @wasm.local-get,
  5,
  @wasm.i32-sub,
  @wasm.gc-prefix,
  @wasm.array-new-default,
  @core.wasm-type-bytes,
  @wasm.local-set,
  8,
  @wasm.local-get,
  8,
  @wasm.i32-const,
  0,
  @wasm.local-get,
  3,
  @wasm.local-get,
  5,
  @wasm.local-get,
  6,
  @wasm.local-get,
  5,
  @wasm.i32-sub,
  @wasm.gc-prefix,
  @wasm.array-copy,
  @core.wasm-type-bytes,
  @core.wasm-type-bytes,
  @wasm.i32-const,
  2,
  @wasm.local-get,
  8,
  @wasm.gc-prefix,
  @wasm.struct-new,
  @core.wasm-type-string,
  @wasm.end
]
visibility
public
core.wasm-runtime-string-slice (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: 3SV_pw-kRUXyX9Pcx-EOyXK3B4tucbmyrC3Rd74Ds2A
content hash: 5-9d7Oc_ZGyFc4R0Us1KFe9jqUZ8ug8J14qGRhwnXTI