summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWasm
AgeCommit message (Collapse)Author
2022-11-11AK+Everywhere: Replace DistinctNumeric bool parameters with named onesSam Atkins
This means that rather than this: ``` AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, true, true, false, false, false, true, FunctionAddress); ``` We now have this: ``` AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, FunctionAddress, Arithmetic, Comparison, Increment); ``` Which is a lot more readable. :^) Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2022-11-01Everywhere: Mark dependencies of most targets as PRIVATETim Schumacher
Otherwise, we end up propagating those dependencies into targets that link against that library, which creates unnecessary link-time dependencies. Also included are changes to readd now missing dependencies to tools that actually need them.
2022-11-01Everywhere: Explicitly link all binaries against the LibC targetTim Schumacher
Even though the toolchain implicitly links against -lc, it does not know where it should get LibC from except for the sysroot. In the case of Clang this causes it to pick up the LibC stub instead, which might be slightly outdated and feature missing symbols. This is currently not an issue that manifests because we pass through the dependency on LibC and other libraries by accident, which causes CMake to link against the LibC target (instead of just the library), and thus points the linker at the build output directory. Since we are looking to fix that in the upcoming commits, let's make sure that everything will still be able to find the proper LibC first.
2022-10-28LibWasm: Specify which instruction opcode failed validation in errorLuke Wilde
2022-10-28LibWasm: Add missing validation for memory.copyLuke Wilde
This has the exact same validation as memory.fill
2022-10-24LibWasm: Allow vectors of up to 500M entriesAli Mohammad Pur
This usually shows up in custom sections, containing plain bytes.
2022-10-24LibWasm: Calculate the max data segment size correctlyAli Mohammad Pur
This is given in pages, we need to first convert to bytes before comparing with bytes.
2022-10-03LibWasm: Use String::join in Printer where apropriateHendiadyoin1
2022-10-03LibWasm: Use TRY in Module::parseHendiadyoin1
2022-07-22Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_'Linus Groh
2022-07-22Everywhere: Prefix 'TYPEDEF_DISTINCT_NUMERIC_GENERAL' with 'AK_'Linus Groh
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Everywhere: Split Error::from_string_literal and Error::from_string_viewsin-ack
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
2022-04-22LibWasm: Simplify the return instruction execution code a bitAli Mohammad Pur
2022-04-22LibWasm: Push call results back in reverse order to preserve stack orderAli Mohammad Pur
2022-04-22LibWasm: Make memory_grow validation push back the old memory sizeAli Mohammad Pur
2022-04-22LibWasm: Make local_tee validation keep the value on the stackAli Mohammad Pur
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-20LibWasm: Increase the arbitrary local value count per type limitAli Mohammad Pur
It was arbitrary, it's still arbitrary, but now it's funny too :^)
2022-03-20LibWasm: Use some template magic to greatly simplify stack validationAli Mohammad Pur
This also auto-fixes a few bugs that were present before as we were manually checking the stack.
2022-03-20LibWasm: Allow Limits max value to be equal to 2^k-1Ali Mohammad Pur
That value fits in k bits, so we should allow it.
2022-02-16LibWasm: Fix validation of if-else blocksAli Mohammad Pur
We were doing a number of things wrong: - Switching to the parent context in the else meant that we couldn't break out of the else section anymore - We were not validating the resulting values, and so the stack was in a relatively unknown state after 'else' This commit fixes these issues :^)
2022-02-16LibWasm: Make MemoryInstance allocation fail if initial growth failsAli Mohammad Pur
...instead of silently ignoring the failure in the constructor.
2022-01-07Everywhere: Fix many spelling errorsmjz19910
2022-01-04Userland: Resolve tautological-constant-out-of-range-compare warningsAndrew Kaster
Stop comparing platform-specific sized integer types to max() values of other interger types. Enable the warning everywhere.
2021-12-21AK+Everywhere: Replace __builtin bit functionsNick Johnson
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount}, this commit removes all calls to these functions and replaces them with the equivalent functions in AK/BuiltinWrappers.h.
2021-12-21LibWasm: Tolerate modules with invalid sections and mark them as invalidAli Mohammad Pur
We should not crash, but rather just fail to verify them.
2021-12-21LibWasm: Make shown instruction names match the names in the specAli Mohammad Pur
2021-12-21LibWasm: Add a instruction_from_name getterAli Mohammad Pur
2021-12-21LibWasm: Print the block type for structured argumentsAli Mohammad Pur
2021-12-21LibWasm: Fix silly typo in f32 reinterpret validationAli Mohammad Pur
2021-12-21LibWasm: Make blocks that take arguments actually workAli Mohammad Pur
Previously we were ignoring the actual parameters and setting the arity to an incorrect value, which could cause crashes (or unexpected traps).
2021-12-21LibWasm: Implement memory.init and passive mode dataAli Mohammad Pur
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-11LibWasm: Fix broken build after merging un-rebased Validator changesAndreas Kling
2021-11-11LibWasm: Remove traps caught by validationAli Mohammad Pur
2021-11-11LibWasm: Implement module validationAli Mohammad Pur
2021-11-11LibWasm: Make opcode definitions enumerable through a macroAli Mohammad Pur
2021-11-10AK: Make ByteBuffer::try_* functions return ErrorOr<void>Andreas Kling
Same as Vector, ByteBuffer now also signals allocation failure by returning an ENOMEM Error instead of a bool, allowing us to use the TRY() and MUST() patterns.
2021-11-10AK: Make Vector::try_* functions return ErrorOr<void>Andreas Kling
Instead of signalling allocation failure with a bool return value (false), we now use ErrorOr<void> and return ENOMEM as appropriate. This allows us to use TRY() and MUST() with Vector. :^)
2021-10-06LibWasm: Add missing forward declaration to Printer/Printer.hBen Wiederhake
2021-09-21Libraries: Use AK::Variant default initialization where appropriateBen Wiederhake
2021-09-11LibWasm: Avoid making StringView of temporary ByteBufferBen Wiederhake
2021-09-07Everywhere: Behaviour => BehaviorAndreas Kling
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-09-06Everywhere: Use OOM-safe ByteBuffer APIs where possibleAli Mohammad Pur
If we can easily communicate failure, let's avoid asserting and report failure instead.
2021-09-05LibWeb+LibWasm: Implement the WebAssembly.Table objectAli Mohammad Pur
2021-09-05LibWasm: Move the vector size limit to Constants.h and increase it a bitAli Mohammad Pur
2021-08-31LibWasm: Limit the number of function localsAli Mohammad Pur
It's possible for the module to request too many locals, we now reject such modules instead of trying to allocate space for them. The value itself is chosen arbitrarily, so future tweaks _might_ be necessary. Found by OSS-Fuzz: https://oss-fuzz.com/testcase?key=4755809098661888