Conversation
Codecov Report
@@ Coverage Diff @@
## master #739 +/- ##
==========================================
- Coverage 99.27% 99.27% -0.01%
==========================================
Files 88 88
Lines 13296 13158 -138
==========================================
- Hits 13200 13062 -138
Misses 96 96
Flags with carried forward coverage won't be shown. Click here to find out more.
|
test/utils/wasm3_engine.cpp
Outdated
| if (result == m3Err_none) | ||
| return {false, ret_valid ? ret_value : std::optional<uint64_t>{}}; | ||
|
|
||
| std::vector<const void*> argPtrs; |
There was a problem hiding this comment.
If you want ultimate speed you can use stack-allocated fixed-size array. Just bail out if too much arguments provided.
There was a problem hiding this comment.
fizzy/test/utils/wasm3_engine.cpp:147:24: error: variable length arrays are a C99 feature [-Werror,-Wvla-extension]
const void* argPtrs[args.size()];
Or not sure what you've meant?
There was a problem hiding this comment.
Ah you meant like allocating an array with like 32 items, and fail if args.size() is larger.
There was a problem hiding this comment.
Not sure if this makes a lot of speed difference, but pushed a version.
|
My plan is we release 0.8.0, then merge this and release 0.8.1. Then it is simple to show benchmarks for both, if needed. |
| namespace | ||
| { | ||
| const void* env_adler32(IM3Runtime /*runtime*/, uint64_t* stack, void* mem) | ||
| const void* env_adler32( |
There was a problem hiding this comment.
Based on https://github.com/wasm3/wasm3/blob/main/source/wasm3.h#L327-L340 this would be the correct way:
m3ApiRawFunction(env_adler32)
{
(void)runtime;
(void)_ctx;
m3ApiReturnType (uint32_t)
m3ApiGetArgMem (const uint8_t*, offset)
m3ApiGetArg (uint32_t, length)
// This would be the correct way, but it traps. Although the numbers seem to be correct.
// mem + offset + length <= mem + m3_getMemorySize
m3ApiCheckMem(offset, length);
m3ApiReturn(fizzy::test::adler32({offset, length}));
}See also an example wasi function: https://github.com/wasm3/wasm3/blob/main/source/m3_api_meta_wasi.c#L146
| const uint32_t length = static_cast<uint32_t>(stack[1]); | ||
| const uint32_t offset = static_cast<uint32_t>(stack[1]); | ||
| const uint32_t length = static_cast<uint32_t>(stack[2]); | ||
| stack[0] = fizzy::test::adler32({reinterpret_cast<uint8_t*>(mem) + offset, length}); |
There was a problem hiding this comment.
The stack order has changed. Now the return value is on the bottom.
65e1677 to
4d0934d
Compare
8761680 to
f449879
Compare
|
Merging this is still blocked on benchmarks running out of stack space or something: We did find some reason, increased something/update compiler to work it around, but it is back again. |
|
Apparently we run into a wasm3 bug: wasm3/wasm3#425 |
We still need a patch for the start function, see wasm3/wasm3#202. And also a memory leak issue: wasm3/wasm3#203.
At least we could get rid of wasm3/wasm3#130, wasm3/wasm3#129, and wasm3/wasm3#145.