Skip to content

addMemory in rt cannot handle more 65536 wasm page memory. #2653

Closed
@HerrCai0907

Description

@HerrCai0907

Bug description

Meet runtime addMemory error.

RuntimeError: unreachable
at ~lib/rt/tlsf/addMemory (wasm://wasm/b69e6f5a:wasm-function[11]:0x47b)
at ~lib/rt/tlsf/growMemory (wasm://wasm/b69e6f5a:wasm-function[16]:0x853)
at ~lib/rt/tlsf/allocateBlock (wasm://wasm/b69e6f5a:wasm-function[18]:0x918)
at ~lib/rt/tlsf/__alloc (wasm://wasm/b69e6f5a:wasm-function[19]:0x965)
at ~lib/memory/heap.alloc (wasm://wasm/b69e6f5a:wasm-function[20]:0x970)
at start:assembly/index (wasm://wasm/b69e6f5a:wasm-function[23]:0x9fe)
at ~start (wasm://wasm/b69e6f5a:wasm-function[21]:0x976)
at file:///Users/q540239/as/tests/index.js:4:31

Steps to reproduce

// align memory page to 2**n
while (memory.size() != 128) {
  heap.alloc(16);
}
// alloc memory to more than 65536/2 wasm page
for (let i = 0; i < 32763; i++) {
  heap.alloc(64 * 1024);
}

AssemblyScript version

0.27.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions