Fix clang build errors

* fix some tiny errors in wasm
* update wasm version to 1.0.24
* run tidy check in actions

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2021-09-09 16:26:15 +09:00 committed by Patrick Kim
commit d369ca50b0
8 changed files with 46 additions and 40 deletions

View file

@ -10,6 +10,20 @@ env:
RUNNER: tools/run-tests.py
jobs:
check_tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '2.7'
- name: Install Packages
run: sudo apt install -y clang-format-6.0
- name: Test
run: tools/check_tidy.py
clang_build:
runs-on: ubuntu-latest
steps:
@ -18,13 +32,22 @@ jobs:
submodules: true
- name: Install Packages
run: sudo apt install -y ninja-build gcc-multilib g++-multilib
- name: Build
env:
BUILD_OPTIONS: -DESCARGOT_HOST=linux -DESCARGOT_MODE=debug -DESCARGOT_OUTPUT=shell_test -GNinja
- name: Patch WABT
working-directory: ./third_party/wasm/wabt
run: |
CC=clang CXX=clang++ cmake -H. -Bout/clang/x86 -DESCARGOT_ARCH=x86 $BUILD_OPTIONS
CC=clang CXX=clang++ cmake -H. -Bout/clang/x64 -DESCARGOT_ARCH=x64 $BUILD_OPTIONS
cp ../../../tools/test/wasm-js/wabt_patch .
patch -p0 < wabt_patch
- name: Build x86
env:
BUILD_OPTIONS: -DESCARGOT_ARCH=x86 -DESCARGOT_HOST=linux -DESCARGOT_MODE=debug -DESCARGOT_WASM=ON -DESCARGOT_OUTPUT=shell_test -GNinja
run: |
CC=clang CXX=clang++ cmake -H. -Bout/clang/x86 $BUILD_OPTIONS
ninja -Cout/clang/x86
- name: Build x64
env:
BUILD_OPTIONS: -DESCARGOT_ARCH=x64 -DESCARGOT_HOST=linux -DESCARGOT_MODE=debug -DESCARGOT_WASM=ON -DESCARGOT_OUTPUT=shell_test -GNinja
run: |
CC=clang CXX=clang++ cmake -H. -Bout/clang/x64 $BUILD_OPTIONS
ninja -Cout/clang/x64
release_x86_test:

4
Jenkinsfile vendored
View file

@ -35,10 +35,6 @@ def isPr() {
}
}
stage('Check tidy') {
sh 'python tools/check_tidy.py'
}
stage('Submodule update') {
sh 'git submodule update --init test third_party/GCutil'
}

View file

@ -603,7 +603,7 @@ static Value builtinAtomicsIsLockFree(ExecutionState& state, Value thisValue, si
return Value(false);
#else
// spec want to do toInteger operation
size;
UNUSED_VARIABLE(size);
return Value(false);
#endif
}

View file

@ -44,6 +44,9 @@ void Heap::finalize()
for (size_t i = 0; i < 5; i++) {
GC_gcollect_and_unmap();
}
// After full gc, remove all registered gc callbacks
GC_remove_all_event_callbacks();
}
void Heap::printGCHeapUsage()

View file

@ -807,7 +807,7 @@ static Value builtinWASMGlobalConstructor(ExecutionState& state, Value thisValue
}
// check and get 'value' property from the first argument
wasm_valkind_t valuetype;
wasm_valkind_t valuetype = WASM_ANYREF;
{
// Let valuetype be ToValueType(descriptor["value"]).
Value valTypeValue = wasmGetValueFromObjectProperty(state, desc, strings->value, strings->toString).second;

2
third_party/GCutil vendored

@ -1 +1 @@
Subproject commit 0cc277fb0cef82d515cc4ff4a439e50568474e16
Subproject commit 012464b63688f0e66daac9cd513284ab2c40f1a9

@ -1 +1 @@
Subproject commit bdd7059ce7c5bf09b2a830f6cd5e15240d438a6e
Subproject commit 21279a861fa3dbac9af9d2bab16c741df17a86af

View file

@ -1,35 +1,19 @@
diff --git src/binary-reader.cc src/binary-reader.cc
index 9b365e87..d770afa4 100644
index e1a7a336..d373770d 100644
--- src/binary-reader.cc
+++ src/binary-reader.cc
@@ -628,7 +628,7 @@ Result BinaryReader::ReadAddress(Address* out_value,
Index memory,
const char* desc) {
ERROR_UNLESS(memory < memories.size(),
- "load/store memory %u out of range %lu", memory,
+ "load/store memory %u out of range %zu", memory,
memories.size());
if (memories[memory].is_64) {
return ReadU64Leb128(out_value, desc);
diff --git src/common.h src/common.h
index dbac0a89..1c0a57e8 100644
--- src/common.h
+++ src/common.h
@@ -66,11 +66,8 @@
char fixed_buf[WABT_DEFAULT_SNPRINTF_ALLOCA_BUFSIZE]; \
char* buffer = fixed_buf; \
size_t len = wabt_vsnprintf(fixed_buf, sizeof(fixed_buf), format, args); \
+ (void)len; \
va_end(args); \
- if (len + 1 > sizeof(fixed_buf)) { \
- buffer = static_cast<char*>(alloca(len + 1)); \
- len = wabt_vsnprintf(buffer, len + 1, format, args_copy); \
- } \
va_end(args_copy)
@@ -2181,8 +2181,7 @@ Result BinaryReader::ReadTypeSection(Offset section_size) {
} else {
uint8_t type;
CHECK_RESULT(ReadU8(&type, "type form"));
- ERROR_UNLESS(type == 0x60, "unexpected type form (got " PRItypecode ")",
- WABT_PRINTF_TYPE_CODE(type));
+ ERROR_UNLESS(type == 0x60, "unexpected type form (got " "%#x" ")", type);
form = Type::Func;
}
#define WABT_ENUM_COUNT(name) \
diff --git src/interp/interp-wasm-c-api.cc src/interp/interp-wasm-c-api.cc
index 75190feb..2a0c861d 100644
index 4df66b89..2edc17d9 100644
--- src/interp/interp-wasm-c-api.cc
+++ src/interp/interp-wasm-c-api.cc
@@ -626,6 +626,11 @@ own wasm_store_t* wasm_store_new(wasm_engine_t* engine) {
@ -52,7 +36,7 @@ index 75190feb..2a0c861d 100644
+ const wasm_func_t* func) {
+ auto&& funcs = instance->As<Instance>()->funcs();
+
+ assert(func.size() < wasm_limits_max_default);
+ assert(funcs.size() < wasm_limits_max_default);
+ for (size_t i = 0; i < funcs.size(); ++i) {
+ if (funcs[i] == func->I.ref()) {
+ return i;