wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

Support importing memory & table

Open YoungWenMing opened this issue 2 years ago • 8 comments

Does this project have any plan to implement supports for importing memories and tables when instantiating a WebAssembly Instance? Besides, any plan to implement the grow method of memories and tables?

YoungWenMing avatar May 12 '22 02:05 YoungWenMing

Currently, We prefer the below strategies for safety:

  • not to use host created memory and table
  • not to grow internal memory and table

lum1n0us avatar May 16 '22 08:05 lum1n0us

@lum1n0us Can you clarify your answer?

I also need to import the table and memory from a different module in an instantiation of a different module. Is there a way to achieve this? Will there ever be one?

Thanks!

remko avatar May 22 '22 21:05 remko

Unfortunately, there is no way to achieve that for now. Every module has to stick with its own table and memory for now in WAMR.

lum1n0us avatar May 24 '22 03:05 lum1n0us

  • not to grow internal memory and table

@lum1n0us What safety concerns are involved with growing Memory and Table?

Zzzode avatar Jun 06 '22 08:06 Zzzode

WAMR actually doesn't want host functions linking "host-made" tables and memories. Worries of growing are related to WAMR memory model. WAMR will help .wasm modules to save their memory consumption and might have a few differences with the linear memory in users' minds.

lum1n0us avatar Jul 28 '22 03:07 lum1n0us

@lum1n0us In my case, my memory and table isn’t host-made. They’re simply imported from another module.

remko avatar Jul 28 '22 05:07 remko

That is the point. As a runtime, it can't tell an imported memory or table(in imports of wasm_instance_new()) comes from wasm_memory_new and wasm_table_new or from another module.

lum1n0us avatar Jul 28 '22 05:07 lum1n0us

Currently, We prefer the below strategies for safety:

* not to use host created memory and table

* not to grow internal memory and table

i'm not sure if i understand the "safety" argument. it's just a lack of functionality.

yamt avatar Aug 10 '22 06:08 yamt