Skip to content

Commit de803b2

Browse files
Small refactor on WASMModuleInstance and fix Go/Python language bindings (#3227)
- Merge unused field `used_to_be_wasi_ctx` in `AOTModuleInstance` into `reserved` area - Add field `memory_lock` in `WASMMemoryInstance` for future refactor - Go binding: fix type error #3220 - Python binding: type annotation uses the union operator "|", which requires Python version >=3.10
1 parent c3e33a9 commit de803b2

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

core/iwasm/aot/aot_runtime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ bh_static_assert(offsetof(AOTModuleInstance, func_type_indexes)
4848
bh_static_assert(offsetof(AOTModuleInstance, cur_exception)
4949
== 13 * sizeof(uint64));
5050
bh_static_assert(offsetof(AOTModuleInstance, c_api_func_imports)
51-
== 13 * sizeof(uint64) + 128 + 8 * sizeof(uint64));
51+
== 13 * sizeof(uint64) + 128 + 7 * sizeof(uint64));
5252
bh_static_assert(offsetof(AOTModuleInstance, global_table_data)
5353
== 13 * sizeof(uint64) + 128 + 14 * sizeof(uint64));
5454

55-
bh_static_assert(sizeof(AOTMemoryInstance) == 112);
55+
bh_static_assert(sizeof(AOTMemoryInstance) == 120);
5656
bh_static_assert(offsetof(AOTTableInstance, elems) == 24);
5757

5858
bh_static_assert(offsetof(AOTModuleInstanceExtra, stack_sizes) == 0);

core/iwasm/interpreter/wasm_runtime.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ struct WASMMemoryInstance {
138138
DefPointer(uint8 *, heap_data_end);
139139
/* The heap created */
140140
DefPointer(void *, heap_handle);
141+
/* TODO: use it to replace the g_shared_memory_lock */
142+
DefPointer(korp_mutex *, memory_lock);
141143

142144
#if WASM_ENABLE_FAST_JIT != 0 || WASM_ENABLE_JIT != 0 \
143145
|| WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_AOT != 0
@@ -405,8 +407,6 @@ struct WASMModuleInstance {
405407
it denotes `AOTModule *` */
406408
DefPointer(WASMModule *, module);
407409

408-
DefPointer(void *, used_to_be_wasi_ctx); /* unused */
409-
410410
DefPointer(WASMExecEnv *, exec_env_singleton);
411411
/* Array of function pointers to import functions,
412412
not available in AOTModuleInstance */
@@ -434,7 +434,7 @@ struct WASMModuleInstance {
434434

435435
/* Default WASM operand stack size */
436436
uint32 default_wasm_stack_size;
437-
uint32 reserved[5];
437+
uint32 reserved[7];
438438

439439
/*
440440
* +------------------------------+ <-- memories

language-bindings/go/wamr/module.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ func (self *Module) SetWasiArgsEx(dirList [][]byte, mapDirList [][]byte,
117117
C.wasm_runtime_set_wasi_args_ex(self.module, dirPtr, dirCount,
118118
mapDirPtr, mapDirCount,
119119
envPtr, envCount, argvPtr, argc,
120-
C.int(stdinfd), C.int(stdoutfd),
121-
C.int(stderrfd))
120+
C.long(stdinfd), C.long(stdoutfd),
121+
C.long(stderrfd))
122122
}
123123

124124
/* Set module's wasi network address pool */

language-bindings/python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The WAMR Python package contains a set of high-level bindings for WAMR API and W
44

55
## Installation
66

7-
* **Notice**: This python package need python >= `3.9`.
7+
* **Notice**: This python package need python >= `3.10`.
88

99
To Install from local source tree in _development mode_ run the following command,
1010

language-bindings/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ def run(self):
6262
'install': PreInstallCommand,
6363
'egg_info': PreEggInfoCommand,
6464
},
65-
python_requires='>=3.9'
65+
python_requires='>=3.10'
6666
)

language-bindings/python/wamr-api/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# WARM API
22

3-
* **Notice**: The python package `wamr.wamrapi.wamr` need python >= `3.9`.
3+
* **Notice**: The python package `wamr.wamrapi.wamr` need python >= `3.10`.
44

55
## Setup
66

77
### Pre-requisites
88

99
Install requirements,
1010

11-
```
11+
```shell
1212
pip install -r requirements.txt
1313
```
1414

@@ -17,6 +17,7 @@ pip install -r requirements.txt
1717
The following command builds the iwasm library and generates the Python bindings,
1818

1919
```sh
20+
# In WAMR root directory
2021
bash language-bindings/python/utils/create_lib.sh
2122
```
2223

0 commit comments

Comments
 (0)