From 7d6e12917f7c73b20d8d959c19d5b26a47cce363 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 20 Dec 2022 01:07:50 +0900 Subject: [PATCH] interpreter/toywasm: Update toywasm version The situation of toywasm_config.c is similar to toywasm_config.h. It's cmake-generated in the upstream. The original template is covered by a different license. I'm the author of the file and hereby re-license this copy. Tested on sim/macOS. --- interpreters/toywasm/Kconfig | 5 +++ interpreters/toywasm/Makefile | 13 ++++++- interpreters/toywasm/include/toywasm_config.h | 2 + interpreters/toywasm/src/toywasm_config.c | 39 +++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 interpreters/toywasm/src/toywasm_config.c diff --git a/interpreters/toywasm/Kconfig b/interpreters/toywasm/Kconfig index aa71eb526..d849f7ac2 100644 --- a/interpreters/toywasm/Kconfig +++ b/interpreters/toywasm/Kconfig @@ -7,6 +7,11 @@ config INTERPRETERS_TOYWASM tristate "Toywasm Webassembly Runtime" default n + # TOYWASM_ENABLE_WASM_THREADS and TOYWASM_ENABLE_WASI_THREADS + # depends on pthread + # REVISIT: make these Kconfig + depends on !DISABLE_PTHREAD + if INTERPRETERS_TOYWASM config INTERPRETERS_TOYWASM_PRIORITY diff --git a/interpreters/toywasm/Makefile b/interpreters/toywasm/Makefile index c975386c7..1818e5578 100644 --- a/interpreters/toywasm/Makefile +++ b/interpreters/toywasm/Makefile @@ -28,6 +28,7 @@ MODULE = $(CONFIG_INTERPRETERS_TOYWASM) # cli MAINSRC = main.c CSRCS += repl.c +CSRCS += toywasm_config.c # lib CSRCS += bitmap.c @@ -39,6 +40,7 @@ CSRCS += exec.c CSRCS += expr.c CSRCS += fileio.c CSRCS += host_instance.c +CSRCS += idalloc.c CSRCS += import_object.c CSRCS += insn.c CSRCS += instance.c @@ -46,6 +48,7 @@ CSRCS += leb128.c CSRCS += module.c CSRCS += module_writer.c CSRCS += report.c +CSRCS += timeutil.c CSRCS += type.c CSRCS += util.c CSRCS += validation.c @@ -53,10 +56,17 @@ CSRCS += vec.c CSRCS += wasi.c CSRCS += xlog.c +# TOYWASM_ENABLE_WASM_THREADS +CSRCS += lock.c +CSRCS += waitlist.c + +# TOYWASM_ENABLE_WASI_THREADS +CSRCS += wasi_threads.c + CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)/interpreters/toywasm/include} CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)/interpreters/toywasm/toywasm/lib} -TOYWASM_VERSION = ab861c89be54144d2bdff432e21d431c8a1c1e74 +TOYWASM_VERSION = 7c55fe4478e01ae651967f7c5d3fd3fa98a851ba TOYWASM_UNPACK = toywasm TOYWASM_TARBALL = $(TOYWASM_VERSION).zip TOYWASM_URL_BASE = https://github.com/yamt/toywasm/archive/ @@ -64,6 +74,7 @@ TOYWASM_URL = $(TOYWASM_URL_BASE)/$(TOYWASM_TARBALL) VPATH += $(TOYWASM_UNPACK)/cli VPATH += $(TOYWASM_UNPACK)/lib +VPATH += src $(TOYWASM_TARBALL): $(Q) echo "Downloading $(TOYWASM_TARBALL)" diff --git a/interpreters/toywasm/include/toywasm_config.h b/interpreters/toywasm/include/toywasm_config.h index fd018d13f..70f61517c 100644 --- a/interpreters/toywasm/include/toywasm_config.h +++ b/interpreters/toywasm/include/toywasm_config.h @@ -33,5 +33,7 @@ #define TOYWASM_USE_RESULTTYPE_CELLIDX #define TOYWASM_USE_LOCALTYPE_CELLIDX #define TOYWASM_ENABLE_WRITER +#define TOYWASM_ENABLE_WASM_THREADS +#define TOYWASM_ENABLE_WASI_THREADS #endif /* !defined(_TOYWASM_CONFIG_H) */ diff --git a/interpreters/toywasm/src/toywasm_config.c b/interpreters/toywasm/src/toywasm_config.c new file mode 100644 index 000000000..56c7f85d1 --- /dev/null +++ b/interpreters/toywasm/src/toywasm_config.c @@ -0,0 +1,39 @@ +/**************************************************************************** + * apps/interpreters/toywasm/src/toywasm_config.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +const char *toywasm_config_string = +"\tTOYWASM_USE_SEPARATE_EXECUTE = ON\n" +"\tTOYWASM_USE_TAILCALL = ON\n" +"\tTOYWASM_ENABLE_TRACING = OFF\n" +"\tTOYWASM_USE_JUMP_BINARY_SEARCH = ON\n" +"\tTOYWASM_USE_JUMP_CACHE = OFF\n" +"\tTOYWASM_JUMP_CACHE2_SIZE = 4\n" +"\tTOYWASM_USE_LOCALS_CACHE = ON\n" +"\tTOYWASM_USE_SEPARATE_LOCALS = ON\n" +"\tTOYWASM_USE_SMALL_CELLS = ON\n" +"\tTOYWASM_USE_RESULTTYPE_CELLIDX = ON\n" +"\tTOYWASM_USE_LOCALTYPE_CELLIDX = ON\n" +"\tTOYWASM_ENABLE_WRITER = ON\n" +"\tTOYWASM_ENABLE_WASM_THREADS = ON\n" +"\tTOYWASM_ENABLE_WASI_THREADS = ON\n";