You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "yamt (via GitHub)" <gi...@apache.org> on 2023/04/03 05:18:21 UTC
[GitHub] [nuttx-apps] yamt commented on a diff in pull request #1638: wasm: increase WASM_INITIAL_MEMORY if stack size is great than initial memory
yamt commented on code in PR #1638:
URL: https://github.com/apache/nuttx-apps/pull/1638#discussion_r1155487009
##########
interpreters/Wasm.mk:
##########
@@ -21,9 +21,14 @@
ifeq ($(WASM_BUILD),y)
ifneq ($(CONFIG_INTERPRETERS_WAMR)$(CONFIG_INTERPRETERS_WAMR3),)
-WASM_INITIAL_MEMORY ?= 65536
-STACKSIZE ?= $(CONFIG_DEFAULT_TASK_STACKSIZE)
-PRIORITY ?= SCHED_PRIORITY_DEFAULT
+STACKSIZE ?= $(CONFIG_DEFAULT_TASK_STACKSIZE)
+PRIORITY ?= SCHED_PRIORITY_DEFAULT
+
+ifneq ($(INITMEMORY),)
+ ifeq ($(shell test $(INITMEMORY) -lt $(STACKSIZE); echo $$?),0)
+ INITMEMORY := $(shell expr $(STACKSIZE) + $(INITMEMORY))
Review Comment:
> Some stack size configurations may be written like this:
>
> ```
> config EXAMPLES_HELLO_STACKSIZE
> int "Hello stack size"
> default 16384 if ARCH_SIM
> default DEFAULT_TASK_STACKSIZE
> ```
>
> It is common to have different stack size on different platforms
yes.
it seems wrong to use platform DEFAULT_TASK_STACKSIZE for wasm in the first place.
##########
interpreters/Wasm.mk:
##########
@@ -21,9 +21,14 @@
ifeq ($(WASM_BUILD),y)
ifneq ($(CONFIG_INTERPRETERS_WAMR)$(CONFIG_INTERPRETERS_WAMR3),)
-WASM_INITIAL_MEMORY ?= 65536
-STACKSIZE ?= $(CONFIG_DEFAULT_TASK_STACKSIZE)
-PRIORITY ?= SCHED_PRIORITY_DEFAULT
+STACKSIZE ?= $(CONFIG_DEFAULT_TASK_STACKSIZE)
+PRIORITY ?= SCHED_PRIORITY_DEFAULT
+
+ifneq ($(INITMEMORY),)
+ ifeq ($(shell test $(INITMEMORY) -lt $(STACKSIZE); echo $$?),0)
+ INITMEMORY := $(shell expr $(STACKSIZE) + $(INITMEMORY))
Review Comment:
also, i suspect there is no reasonable way to fix the situation (INITMEMORY < STACKSIZE) automatically.
your solution (INITMEMORY = INITMEMORY + STACKSIZE) seems wrong because INITMEMORY means to include STACKSIZE.
only the user who specified INITMEMORY can know how to fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org