0

I have some assemblyScript code:

export function run(): void {
  store<string>(0, 'hello, my name is marty');
}

That stores a string at pointer 0 in memory.

However, the produced .wat file stores the string at location 1056 instead of 0:

(module
 (type $none_=>_none (func))
 (memory $0 1)
 (data (i32.const 1036) "L")
 (data (i32.const 1048) "\01\00\00\00.\00\00\00h\00e\00l\00l\00o\00,\00 \00m\00y\00 \00n\00a\00m\00e\00 \00i\00s\00 \00m\00a\00r\00t\00y")
 (export "run" (func $assembly/index/run))
 (export "memory" (memory $0))
 (func $assembly/index/run
  i32.const 0
  i32.const 1056
  i32.store
 )
)
murty
  • 145
  • 1
  • 6

1 Answers1

0

It stores pointer of string with value 1056 into zero (0) index in linear memory. So everything correct.

MaxGraey
  • 351
  • 2
  • 6