Commit graph

30071 commits

Author SHA1 Message Date
Andreas Kling
03ddda7979 LibWasm: Fix broken build after merging un-rebased Validator changes 2021-11-11 09:27:00 +01:00
Ben Wiederhake
fb003d71c2 LibC: Avoid unnecessary mprotect during program finalization
In particular, we track separately whether each AtExitEntry has already
been called, through a separate Bitmap. This has several side-effects:

- We now call malloc() during __cxa_finalize(). I believe this is fine,
  and at that point during program execution memory pressure should be
  low anyway.
- An attacker could prevent arbitrary entries from executing by writing
  to atexit_called_entries. However, this already was possible (by
  setting atexit_entry_count to zero), and this path is even more
  troublesome (the attacker needs to overwrite atexit_called_entries,
  and a region serving as *atexit_called_entries.m_data, and magically
  know exactly how many entries already exist.)
- This reduces the size of AtExitEntry from 16 to 12 (on i686). As such,
  we can reduce the initial memory allocation from two to one page,
  reducing the initial capacity from 512 to 341 entries (or 256 to 170,
  on x86_64). It seems that most programs only use 36-47 entries anyway.

For 'true', this shaves off about 69 syscalls, as measured by strace.
2021-11-11 09:20:35 +01:00
Ben Wiederhake
26b647f303 LibC: Track capacity in terms of AtExitEntry's, not bytes 2021-11-11 09:20:35 +01:00
Ben Wiederhake
2158e1a6b9 LibC: Avoid unnecessary mprotect during program initialization
For 'true', this shaves off about 69 syscalls, as measured by strace.
2021-11-11 09:20:35 +01:00
Ali Mohammad Pur
2801323236 LibWeb: Implement WebAssembly::validate()
...and make sure to validate the module in WebAssembly::compile()
2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
3680aa253d LibWasm: Remove traps caught by validation 2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
7d1142e2c8 LibWasm: Implement module validation 2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
30736c39b9 LibWasm: Make opcode definitions enumerable through a macro 2021-11-11 09:20:04 +01:00
Ali Mohammad Pur
d0ad7efd9b Meta: Update WebAssembly testsuite branch name
The 'master' branch is no longer updated, they've switched to 'main'.
2021-11-11 09:20:04 +01:00
kleines Filmröllchen
c2340a1b1f LibDSP: Optimize note processing
Previously, a collection of notes (Vector or Array) would be created and
promptly deleted for every sample (at least 44 thousand times per
second!). This was measured to be one of the most significant
performance drawbacks as well as the most obvious performance
improvement I could currently find here. Although it will not cause
Piano to lag currently (at least on virtualized systems), I see an
incoming issue once we get the capability to use more processors.

Now, we use a HashMap correlating pitches to notes, and Track reuses the
data structure in order to avoid reallocations. That is the reason for
introducing the fast clear_with_capacity to HashMap.
2021-11-11 09:19:17 +01:00
kleines Filmröllchen
557be4649d LibDSP: Move to constexpr wherever possible 2021-11-11 09:19:17 +01:00
kleines Filmröllchen
3a4ec49131 LibDSP: Clean up ProcessorParameter header 2021-11-11 09:19:17 +01:00
Hendiadyoin1
f76241914c AK: Allow to clear HashTables/Maps with capacity 2021-11-11 09:19:17 +01:00
Camron
5137f96bd6 Solitaire: Fix 3 card draw from reversing after an undo
Solitaire: Fix 3 card draw from reversing after an undo
Co-Authored-By: Tim Flynn <trflynn89@pm.me>
2021-11-10 20:15:09 -08:00
Andreas Kling
68b5e6c565 LibCrypto: Pass AK::Bytes by value 2021-11-11 01:27:46 +01:00
Andreas Kling
80d4e830a0 Everywhere: Pass AK::ReadonlyBytes by value 2021-11-11 01:27:46 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Andreas Kling
ad5d217e76 Kernel/Ext2FS: Propagate HashMap errors instead of panicking 2021-11-11 01:27:46 +01:00
Andreas Kling
9d1f238450 AK: Make HashTable and HashMap try_* functions return ErrorOr<T>
This allows us to use TRY() and MUST() with them.
2021-11-11 01:27:46 +01:00
Linus Groh
4eaa95769d LibJS: Add missing (void) to handle [[nodiscard]] TRY() result 2021-11-11 00:03:07 +00:00
Linus Groh
fdffdc43fa LibJS: Implement the rest of to_temporal_month_day()
Always throws at the moment, because parse_temporal_month_day_string()
is basically a stub, and parse_iso_date_time() isn't functional either.

The spec issue has been resolved though, so I figured we might as well
get one small step further :^)
2021-11-10 22:28:27 +00:00
Linus Groh
6ef1a2793f LibJS: Rename ZonedDateTime's MatchBehavior enum members to match spec 2021-11-10 21:27:25 +00:00
Andreas Kling
f86ee71f65 Kernel/Ext2FS: Propagate errors from block list computation functions 2021-11-10 21:58:58 +01:00
Andreas Kling
4661ca5f15 Kernel: Propagate Vector append errors in two places in Ext2FS
There are a bunch more of these, just taking care of some simple ones.
2021-11-10 21:58:58 +01:00
Andreas Kling
5ce753b74d Kernel: Make Inode::traverse_as_directory() callback return ErrorOr
This allows us to propagate errors from inside the callback with TRY().
2021-11-10 21:58:58 +01:00
Andreas Kling
a15ed8743d AK: Make ByteBuffer::try_* functions return ErrorOr<void>
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-10 21:58:58 +01:00
Andreas Kling
88b6428c25 AK: Make Vector::try_* functions return ErrorOr<void>
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-11-10 21:58:58 +01:00
Andreas Kling
cd49f30bea AK+LibJS: Simplify MUST() and move it from LibJS to AK/Try.h
This is generally useful so let's move it to AK. Also it seems that we
don't need the temporary variable hack anymore, so let's lose that.
2021-11-10 21:58:58 +01:00
Andreas Kling
5f7d008791 AK+Everywhere: Stop including Vector.h from StringView.h
Preparation for using Error.h from Vector.h. This required moving some
things out of line.
2021-11-10 21:58:58 +01:00
Sam Atkins
e52f987020 LibWeb: Make property_initial_value() return a NonnullRefPtr
The finale! Users can now be sure that the value is valid, which makes
things simpler.
2021-11-10 21:58:14 +01:00
Sam Atkins
4d42915485 LibWeb: Ensure that CSS initial values are always valid :^)
First off, this verifies that an initial value is always provided in
Properties.json for each property.

Second, it verifies that parsing that initial value succeeds.

This means that a call to `property_initial_value()` will always return
a valid StyleValue. :^)
2021-11-10 21:58:14 +01:00
Sam Atkins
63aa399873 LibWeb: Allow none value for transform property
This is the initial value for `transform`. We already handle the value
later, we just were not parsing it.
2021-11-10 21:58:14 +01:00
Sam Atkins
11f0ece58f LibWeb: Add initial values for all CSS properties
It's a little verbose to repeat these in cases like the borders, but if
everything has an initial value, we can guarantee that
`property_initial_value()` will return something! :^)
2021-11-10 21:58:14 +01:00
Sam Atkins
ca3b86c922 LibWeb: Add initial values and longhands to background definition
There is no specified initial value, but `transparent` is equivalent to
setting all the background properties to their defaults.
2021-11-10 21:58:14 +01:00
Sam Atkins
1fa985b0a6 LibWeb: Correct initial values in Properties.json
- `align-items`: `normal` is the initial value in the CSS-ALIGN spec,
but `stretch` is in CSS-FLEXBOX. The FLEXBOX spec is the one we've
actually implemented elsewhere, and ALIGN adds new values with special
syntax, so it's not trivial to add it here.
- `border-spacing`: `0` is equivalent to `0px 0px` and we don't yet
parse the double-value syntax.
- `text-decoration-thickness`: Had the wrong value.
2021-11-10 21:58:14 +01:00
Idan Horowitz
a445deb205 LibJS: Remove left-over debug assertion from the Await AO 2021-11-10 18:11:26 +00:00
Idan Horowitz
d5f637fa21 LibJS: Do not parse async methods with a new line after the "async"
This was already checked in normal function expressions, but was
missing for Object Expressions.
2021-11-10 18:11:26 +00:00
Ben Wiederhake
ad5061bb7a Kernel: Make (f)statvfs report filesystem ID correctly 2021-11-10 16:13:10 +01:00
Ben Wiederhake
631447da57 Kernel: Fix TOCTOU in fstatvfs
In particular, fstatvfs used to assume that a file that was earlier
opened using some path will forever be at that path. This is wrong, and
in the meantime new mounts and new filesystems could take up the
filename or directories, leading to a completely inaccurate result.
This commit improves the situation:
- All filesystem information is now always accurate.
- The mount flags *might* be erroneously zero, if the custody for the
  open file is not available. I don't know when that might happen, but
  it is definitely not the typical case.
2021-11-10 16:13:10 +01:00
Tim Schumacher
26a48f3516 Ports: Use GNU patch instead of the OpenBSD version
The OpenBSD version is having some weird issues, so:

Reject OpenBSD, return to GNU.
2021-11-10 14:48:39 +01:00
Tim Schumacher
bd6c48f6ea Utilities: tar: Always create parent directory when extracting 2021-11-10 14:48:20 +01:00
Jan de Visser
3425730294 LibSQL: Implement table joins
This patch introduces table joins. It uses a pretty dumb algorithm-
starting with a singleton '__unity__' row consisting of a single boolean
value, a cartesian product of all tables in the 'FROM' clause is built.
This cartesian product is then filtered through the 'WHERE' clause,
again without any smarts just using brute force.

This patch required a bunch of busy work to allow for example the
ColumnNameExpression having to deal with multiple tables potentially
having columns with the same name.
2021-11-10 14:47:49 +01:00
Jan de Visser
87f4c1677b LibSQL: Relax assignment rules for Null Values
It should be possible to assign a Value of any type to a Value which
currently is Null.
2021-11-10 14:47:49 +01:00
Jan de Visser
1c50e9aadc LibSQL: Add current statement to the ExecutionContext
Because SQL is the craptastic language that it is, sometimes expressions
need to know details about the calling statement. For example the tables
in the 'FROM' clause may be needed to determine which columns are
referenced in 'WHERE' expressions. So the current statement is added
to the ExecutionContext and a new 'execute' overload on Statement is
created which takes the Database and the Statement and builds an
ExecutionContaxt from those.
2021-11-10 14:47:49 +01:00
Jan de Visser
7ea54db430 LibSQL: Add 'schema' and 'table' to TupleElementDescriptor
These are needed to distinguish columns from different tables with the
same column name in one and the same (joined) Tuple. Not quite happy
yet with this API; I think some sort of hierarchical structure would be
better but we'll burn that bridge when we get there :^)
2021-11-10 14:47:49 +01:00
Jan de Visser
c2c47fb9bb LibSQL: Add the 'extend' operation to the Tuple class
Tuple::extend is similar to the Vector method of the same name; it
concatenates a second Tuple to the current one.
2021-11-10 14:47:49 +01:00
Jan de Visser
f3a9d61891 LibSQL: Add SQL files to assist in troubleshooting
These files contain the same SQL statements as the similarly named tests
in Tests/LibSQL/TestSqlStatementExecution.cpp test suite. They can be
fed to the sql utility to assist in troubleshooting failing tests.
2021-11-10 14:47:49 +01:00
Ben Wiederhake
4512e89159 strace: Interpret errno codes for pointer-like return codes 2021-11-10 14:47:31 +01:00
Ben Wiederhake
81b6be4bf4 strace: Switch to new flag handler, support more flags
In particular, strace now supports all O_*, MSG_*, MAP_*, and PROT_*
flags, as well as a more context-dependent default value (e.g.
"PROT_NONE").
2021-11-10 14:47:31 +01:00
Ben Wiederhake
491ed375fc strace: Better support for bitflags, show unrecognized flags 2021-11-10 14:47:31 +01:00