Explorer

core.wasm-runtime-list-find-last-by-field

description
Runtime function 32 of the definy compiler: list_find_last_by_field(list, field, value) -> value: an option, some(the last record in the list whose field equals the value), none if there is none. Searches from the end and reads the field with record_get (runtime function 6). When the value is a string it compares with string_eq (4), otherwise with values_equal (5). Local variable declarations and instructions, without the byte length (wasm.code-entry adds it)
type
List<Number>
expression
[
  5,
  1,
  @wasm.value-type-i32,
  1,
  @wasm.value-type-ref-null,
  @core.wasm-type-values,
  1,
  @wasm.value-type-ref-null,
  @core.wasm-type-value,
  1,
  @wasm.value-type-i32,
  1,
  @wasm.value-type-ref-null,
  @core.wasm-type-value,
  @wasm.local-get,
  2,
  @wasm.gc-prefix,
  @wasm.struct-get,
  @core.wasm-type-value,
  0,
  @wasm.i32-const,
  2,
  @wasm.i32-eq,
  @wasm.local-set,
  6,
  @wasm.local-get,
  0,
  @wasm.call,
  19,
  @wasm.local-tee,
  4,
  @wasm.ref-is-null,
  @wasm.if,
  @wasm.block-type-empty,
  @wasm.i32-const,
  6,
  @wasm.global-get,
  4,
  @wasm.ref-null,
  @core.wasm-type-value,
  @wasm.gc-prefix,
  @wasm.struct-new,
  @core.wasm-type-variant,
  @wasm.return,
  @wasm.end,
  @wasm.local-get,
  4,
  @wasm.gc-prefix,
  @wasm.array-len,
  @wasm.local-set,
  3,
  @wasm.block,
  @wasm.block-type-empty,
  @wasm.loop,
  @wasm.block-type-empty,
  @wasm.local-get,
  3,
  @wasm.i32-eqz,
  @wasm.br-if,
  1,
  @wasm.local-get,
  3,
  @wasm.i32-const,
  1,
  @wasm.i32-sub,
  @wasm.local-set,
  3,
  @wasm.local-get,
  4,
  @wasm.local-get,
  3,
  @wasm.gc-prefix,
  @wasm.array-get,
  @core.wasm-type-values,
  @wasm.local-tee,
  5,
  @wasm.local-get,
  1,
  @wasm.call,
  6,
  @wasm.local-set,
  7,
  @wasm.local-get,
  6,
  @wasm.if,
  @wasm.value-type-i32,
  @wasm.local-get,
  7,
  @wasm.local-get,
  2,
  @wasm.call,
  4,
  @wasm.else,
  @wasm.local-get,
  7,
  @wasm.local-get,
  2,
  @wasm.call,
  5,
  @wasm.end,
  @wasm.if,
  @wasm.block-type-empty,
  @wasm.i32-const,
  6,
  @wasm.global-get,
  5,
  @wasm.local-get,
  5,
  @wasm.gc-prefix,
  @wasm.struct-new,
  @core.wasm-type-variant,
  @wasm.return,
  @wasm.end,
  @wasm.br,
  0,
  @wasm.end,
  @wasm.end,
  @wasm.i32-const,
  6,
  @wasm.global-get,
  4,
  @wasm.ref-null,
  @core.wasm-type-value,
  @wasm.gc-prefix,
  @wasm.struct-new,
  @core.wasm-type-variant,
  @wasm.end
]
visibility
public
core.wasm-runtime-list-find-last-by-field (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: 36aYigEK9vaud9cPpH1nJxAvbnvTSpvtYaCkKxWeV4E
content hash: jUuuxappin6UhrwhWIL98PXtroGn_Vr1XX7lFbYiXAY