Explorer

core.compile-string-init

description
Instructions of the start function that make the strings of the string table from the passive data segment 0 (array.new_data) and set them to the globals 2, 3, ... (offset is the byte offset of the string index in the segment)
type
Fn(strings: List<String>, index: Number, offset: Number) -> List<Number>
expression
fn(strings$0, index$1, offset$2) =>
  match @core.list-get(list: $0, index: $1) {
    #none(_) =>
      [],
    #some(item$1004) =>
      let length$3 = @core.list-length(value: @core.string-to-bytes(value: $1004));
      @core.list-concat(
        left: @core.list-concat(
          left: [@wasm.i32-const, 2, @wasm.i32-const],
          right: @core.list-concat(
            left: @wasm.signed-leb128(n: $2),
            right: @core.list-concat(left: [@wasm.i32-const], right: @wasm.signed-leb128(n: $3))
          )
        ),
        right: @core.list-concat(
          left: [
            @wasm.gc-prefix,
            @wasm.array-new-data,
            @core.wasm-type-bytes,
            0,
            @wasm.gc-prefix,
            @wasm.struct-new,
            @core.wasm-type-string,
            @wasm.global-set
          ],
          right: @core.list-concat(
            left: @wasm.unsigned-leb128(n: @core.plus(left: $1, right: 2)),
            right: @core.compile-string-init(strings: $0, index: @core.plus(left: $1, right: 1), offset: @core.plus(left: $2, right: $3))
          )
        )
      )
  }
visibility
public
core.compile-string-init (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: QQoKGhNIJN9FFZMJ3t91TNWaGPzV3echE6KCPNxiy78
content hash: KYbkOgTcqD6dS2-XIixGkm-bfU0zgmX0hxbQJhKTAGQ