Commit graph

21 commits

Author SHA1 Message Date
Shannon Booth
e2e7c4d574 Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as
to_number will handle something such as:

```
Optional<I> opt;
if constexpr (IsSigned<I>)
    opt = view.to_int<I>();
else
    opt = view.to_uint<I>();
```

For us.

The main goal here however is to have a single generic number conversion
API between all of the String classes.
2023-12-23 20:41:07 +01:00
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Ali Mohammad Pur
22d411345d LibWasm: Implement the multi-memory proposal 2023-10-26 11:15:11 +02:00
Ali Mohammad Pur
2462064fcd LibWasm+LibWeb: Parse and validate all Wasm SIMD instructions 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
b005691497 LibWasm: Disallow out-of-range br_table labels 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur
8668851cb1 LibWasm: Do not allow self-referencial globals
This is written in a somewhat roundabout way in the spec, so the
initial implementation did not implement it correctly.
2023-08-21 13:39:32 +03:30
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Luke Wilde
8fdf4b43cd LibWasm: Specify which instruction opcode failed validation in error 2022-10-28 10:27:02 +03:30
Luke Wilde
805e6593b9 LibWasm: Add missing validation for memory.copy
This has the exact same validation as memory.fill
2022-10-28 10:27:02 +03:30
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
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-12 23:11:35 +02:00
Ali Mohammad Pur
6760ea33a0 LibWasm: Make memory_grow validation push back the old memory size 2022-04-22 21:12:47 +04:30
Ali Mohammad Pur
6e07e74261 LibWasm: Make local_tee validation keep the value on the stack 2022-04-22 21:12:47 +04:30
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Ali Mohammad Pur
a6c4b6848b LibWasm: Use some template magic to greatly simplify stack validation
This also auto-fixes a few bugs that were present before as we were
manually checking the stack.
2022-03-20 10:44:32 +03:30
Ali Mohammad Pur
18c5b0f1cc LibWasm: Allow Limits max value to be equal to 2^k-1
That value fits in k bits, so we should allow it.
2022-03-20 10:44:32 +03:30
Ali Mohammad Pur
eccdf4eb4b LibWasm: Fix validation of if-else blocks
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-16 22:48:32 +03:30
Ali Mohammad Pur
76ed7f2b20 LibWasm: Fix silly typo in f32 reinterpret validation 2021-12-21 05:03:44 +03:30
Ali Mohammad Pur
fecbf0e03a LibWasm: Make blocks that take arguments actually work
Previously we were ignoring the actual parameters and setting the arity
to an incorrect value, which could cause crashes (or unexpected traps).
2021-12-21 05:03:44 +03:30
Ali Mohammad Pur
b5ca290605 LibWasm: Implement memory.init and passive mode data 2021-12-21 05:03:44 +03:30
Andreas Kling
03ddda7979 LibWasm: Fix broken build after merging un-rebased Validator changes 2021-11-11 09:27:00 +01:00
Ali Mohammad Pur
7d1142e2c8 LibWasm: Implement module validation 2021-11-11 09:20:04 +01:00