Commit Graph
1656 Commits
Author SHA1 Message Date
Frank Denis 045040a973 Fix build.zig file for Zig 0.10 (#410)
addIncludeDir() was renamed to addIncludePath()
2022-11-24 22:57:59 +02:00
Jason Beetham 011597ecea Added Nim Bindings to readme (#388) 2022-11-12 12:09:22 +00:00
coderzh a0f4ec9e63 fix consts limit bug (#391) 2022-11-12 12:08:46 +00:00
Cheng Shao 6ad2d3fea1 Bump up some default limits to align with mainstream wasm implementations (#403)
This commit bumps up some default limit values to align with some
mainstream wasm implementations, and allows wasm3 to execute some
larger wasm32 modules that it would previously report errors like "too
many functions" and such. There are specialized m3_core.h for more
restricted platforms, and this commit doesn't touch those, so it
shouldn't increase the overhead on those platforms.

Wasm spec discussion: https://github.com/WebAssembly/spec/issues/607
V8 limits: https://chromium.googlesource.com/v8/v8/+/master/src/wasm/wasm-limits.h
SpiderMonkey limits: https://hg.mozilla.org/mozilla-central/file/tip/js/src/wasm/WasmConstants.h
JavaScriptCore limits: https://github.com/WebKit/WebKit/blob/main/Source/JavaScriptCore/wasm/WasmLimits.h
2022-11-12 12:06:56 +00:00
Bill d3a763c84c Remove alignment attributes defined as vectorcall. The compiler interprets this as an alignment requirement on the pointer itself, not what it points to, which is probably not what was intended. (#393) 2022-11-12 10:01:46 +00:00
omahs 2749577dc3 Fix: typos (#397)
Fix: typos
2022-11-12 10:00:47 +00:00
I-mikan-I bd152c79aa Fix operations preventing tail-call-elimination: (#402)
If the compiler cannot analyze memcpy, it must expect that pointer arguments may be stored as static data and must live for recursive calls.
In such cases, op_Store and op_Load operations will not get tail-call optimized.
By enclosing the local variables in a block before the recursive call, the storage duration does not extend far enough, allowing for TCO.
2022-11-12 10:00:06 +00:00
Volodymyr Shymanskyy fa18e9ece4 Update README.md 2022-09-14 15:30:32 +03:00
Volodymyr Shymanskyy 1a6ca56ee1 Update README.md 2022-09-12 13:28:46 +03:00
Balint Molnar aba42b533e feat: add support for multi return value for raw functions (#385) 2022-09-12 13:26:12 +03:00
Volodymyr Shymanskyy 9a2894387d Detect musttail attribute 2022-08-31 23:24:23 +03:00
Stuff is on GitLabandVolodymyr Shymanskyy b88b269dab C++ platform: zero-size array & compiler warnings (#305)
* fix: zero-size array, unused args, inconsistent types

* chg: var name style

* docs: fix func. signature

Co-authored-by: Volodymyr Shymanskyy <vshymanskyi@gmail.com>
2022-08-31 23:19:01 +03:00
Victor Polevoy 727bcfb6c0 Allow C++ enum classes to be marshalled as integers when possible. (#336)
With C++ enum classes, the size of an enum object can vary depending
on the compiler generation mechanism (choosing the most optimal storage size
to contain all the variants) or a user-defined storage type. In wasm we
can only send int32_t and int64_t. That means, the enums using this
integer width for storage must also work properly. At runtime this works
flawlessly, the functions in wasm can return these values safely and
they are even converted back on the C++ side to their enum
representations, thanks to the code in wasm3 which does a cast an
integer cast. But when it comes to generating the code for function
arguments, the defined data structure is not enough to generalize the
code to allow enum classes even if they are of a proper (allowed) width.

This commit changes the defined data structure to create a data
structure literal for wasm so that it allows enum classes as well as
already defined data types.
2022-08-31 23:17:26 +03:00
skrphv 7dd43c11d8 m3_Call*-functions fix (#364)
* fix for [issues#363](https://github.com/wasm3/wasm3/issues/363)

* minor
2022-08-31 23:16:22 +03:00
Volodymyr Shymanskyy 8e2db951d6 Fix strict aliasing warnings 2022-08-31 22:31:25 +03:00
Volodymyr Shymanskyy e43e93046a Fix CI 2022-08-31 22:01:35 +03:00
Volodymyr Shymanskyy 89964f456b Fix build 2022-08-31 21:54:59 +03:00
Volodymyr Shymanskyy 03a4652520 Use musttail attribute for Clang 13+ 2022-08-31 20:15:33 +03:00
Volodymyr Shymanskyy 22fa923eef Fix strict aliasing warnings 2022-08-31 19:33:51 +03:00
Volodymyr Shymanskyy d97045a804 Increase d_m3MaxFunctionStackHeight on some platforms 2022-08-31 17:35:37 +03:00
Volodymyr Shymanskyy 3a144c0d39 Drop DEBUG requirement for d_m3EnableStrace >= 2 2022-08-30 14:42:51 +03:00
Yuta Saito 99cbf5144d m3_env.c: prefer export name in searching function (#328)
Since https://reviews.llvm.org/D81689, wasm-ld has started wrapping
all exported functions including "_start" with surrounding ctor/dtor
calls. The wrapper function "_start.command_export" is exposed as
"_start".
wasm3 searched the entry function by looking up names indiscriminately.
However, it sometimes found the internal "_start" function, so ctor/dtor
were not called. To pick up the wrapper "_start", this patch changes to
search export names at first.
2022-08-30 14:03:41 +03:00
Volodymyr Shymanskyy fbbacefeaf Set linear memory limit to 65536 pages. Fix #353 2022-08-30 13:22:11 +03:00
Volodymyr Shymanskyy ea85e9c584 Update logos 2022-08-30 12:57:02 +03:00
Volodymyr Shymanskyy 7a8eec8fae Try fix CI 2022-08-30 12:48:53 +03:00
Volodymyr Shymanskyy 17fc9b4728 Try fix CI 2022-08-30 12:41:42 +03:00
Volodymyr Shymanskyy 3ceeefa137 Use JDK 11 2022-08-30 12:35:14 +03:00
Volodymyr Shymanskyy a34879daf9 Use available ndk version for build 2022-08-30 12:30:22 +03:00
Volodymyr Shymanskyy 6dcdc5c9db Update gradle 2022-08-30 11:53:56 +03:00
Volodymyr Shymanskyy 1a68d516b5 Fix warnings 2022-08-30 11:12:19 +03:00
Volodymyr Shymanskyy e7b7f6a500 Faster tests 2022-08-30 10:43:12 +03:00
Volodymyr Shymanskyy efe5aa738d Add --rebuild flag 2022-08-30 00:42:57 +03:00
Volodymyr Shymanskyy d2c235198b Add WASI toolchains 2022-08-30 00:33:12 +03:00
Volodymyr Shymanskyy f6b7ad6c7a Fix env 2022-08-29 23:18:04 +03:00
Volodymyr Shymanskyy 15ee9e0c27 Fix env 2022-08-29 23:10:51 +03:00
Volodymyr Shymanskyy a4288495e6 Detect WASI_SDK_PREFIX 2022-08-29 23:05:18 +03:00
Volodymyr Shymanskyy 67357a08d8 Fix env 2022-08-29 23:02:18 +03:00
Volodymyr Shymanskyy b915c69595 Fix env 2022-08-29 22:41:09 +03:00
Volodymyr Shymanskyy d47ed71c97 Revert blacklist 2022-08-29 22:12:42 +03:00
Volodymyr Shymanskyy 39506abac1 Drop wasienv, use wasi-sdk directly 2022-08-29 22:11:23 +03:00
Volodymyr Shymanskyy 3443437f46 Fix build 2022-08-29 20:01:17 +03:00
Volodymyr Shymanskyy 2d5ce699f5 Fix CI 2022-08-29 18:56:22 +03:00
Volodymyr Shymanskyy 321ba58316 Merge branch 'main' of https://github.com/wasm3/wasm3 into main 2022-08-29 16:57:22 +03:00
Volodymyr Shymanskyy 7db4a5c3b4 Add install rules. Fix #255 2022-08-29 16:55:59 +03:00
Volodymyr Shymanskyy 43cea2cfd9 Move d_m3EnableWasiTracing to m3_config.h 2022-08-29 16:55:30 +03:00
Volodymyr Shymanskyy 2d2c2c7489 Fix warnings 2022-08-29 16:51:54 +03:00
Guus Waals 37ae5a8ebd Support standalone clang with GCC frontend (#310) 2022-08-29 15:28:25 +03:00
Alex Rebert 8f3986a66c Fix memory safety issues found by OSS-Fuzz (#301)
* Add integer overflow checks in NewCodePage

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33457

* TouchSlot should track slots outside of functions

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33554.

The OSS-Fuzz inputs led to a crash on a Const64 instruction that
overflows the stack. The overflow was not detected during compilation as
TouchSlot did not track maxStackSlots if o->function is NULL. This
commit changes TouchSlot to track slots outside of functions.

* Fix out-of-bounds write in MarkSlotsAllocatedByType

While pushing the params back onto the stack in CompileBlock,
GetSlotForStackIndex may return c_slotUnused. If that is the case,
passing the slot to MarkSlotsAllocatedByType leads to a crash.

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33555
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36551

* Fix memory leak in CompileElseBlock

In the case of an exception in CompileElseBlock, the original page was not
properly restored and was leaked. This commit moves the release/restore
in the _catch: block which always executes.

* Fix stackIndex underflow in param deallocation

When the stack is polymorphic, the stack should never underflow. This
commits fixes an unreported stack underflow while led to an integer
underflow in stackIndex. Now, if the stack is polymorphic, we only
decrement stackIndex up until blockStackIndex.
2022-08-29 15:22:17 +03:00
Ryan Tremblay 58488085f2 Replace C array with std::array to handle zero length (#371)
Co-authored-by: Ryan Tremblay <ryan.tremblay@outlook.com>
Fix #368
2022-08-29 15:15:29 +03:00
Felipe Gasper 4fb6d9e426 Fix parsing of i32 constant globals on big-endian systems. (#322)
FIx #321. This replaces `intValue` in the global value union with
separate `i32Value` and `i64Value`. A CI test is added against s390x.
2022-08-29 15:10:23 +03:00