summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2023-05-21AK: Add `SPICE_AGENT_DEBUG` flagCaoimhe
2023-05-19AK: Add FIXMEs to HashMap copy-construct and copy-assignBen Wiederhake
This underlines that we still copy-construct and copy-assign HashMaps. Primarily, this makes it easier to develop towards OOM-safe(r) internal data structures, by providing a reminder (the FIXME) and an easy error- checking switch (just change it to "delete" to see some of the errors).
2023-05-19AK: Make all HashMap copy-constructs explicitBen Wiederhake
2023-05-19AK: Rewrite HashMap::clone signature with template-args and constBen Wiederhake
2023-05-18AK: Include Array.h in Base64.hMuhammad Zahalqa
Array.h should be included in Base64.h and removed from Base64.cpp
2023-05-18AK: Account for bit position 8 in bit stream alignmentkleines Filmröllchen
See identical code in LittleEndianBitStream; even in the bytewise reading BigEndianBitStream an offset of 8 is not inconsistent state and handled just fine by read_bits.
2023-05-18AK: Discard bits from LittleEndianInputBitStream as they are readTimothy Flynn
Rather than tracking our position in the bit buffer, we can simply shift away the bits that we read. This is mostly for simplicity, but also does help performance a bit. Using the "enwik8" file as a test (100MB uncompressed, commonly used in benchmarks: https://www.mattmahoney.net/dc/enwik8.zip), compression time decreases from: 3.96s to 3.79s on Serenity (cold) 1.08s to 1.04s on Serenity (warm) 0.83s to 0.82s on Linux
2023-05-18AK: Add dbg()Nico Weber
We have outln() and out(), warnln() and warn(), now we have dbgln() and dbg(). This is useful for printing arrays element-by-element while still only printing one line per array.
2023-05-17LibCompress: Add a lot of debug logging to LZMATim Schumacher
2023-05-17AK: Add `CircularBuffer::find_copy_in_seekback()`Tim Schumacher
This is useful for compressors, which quite frequently need to find a matching span of data within the seekback.
2023-05-17AK: Add `count_required_bits`Tim Schumacher
2023-05-15AK: Silence false positive -Warray-bounds warningDaniel Bertalan
This regression has been reported to GCC's Bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109727 The formatting change looks like a clang-format 15 bug :(
2023-05-14Meta: Remove unused debug flags, add missing GENERATE_DEBUGBen Wiederhake
Commands that were helpful while investigating this: ``` grep -P '^set' Meta/CMake/all_the_debug_macros.cmake \ | sed -Ee 's,set\((.+) ON\)$,\1,' > macros.lst for i in $(cat macros.lst); do echo -n "$i "; git grep -Pn '\b'"$i"'\b' | wc -l done | tee matches.lst sort -k2 -n matches.lst ```
2023-05-13AK: Fix typo in instructions for adopt_nonnull_REF_or_enomemBen Wiederhake
2023-05-09AK: Add `FixedArray::unchecked_at`Lucas CHOLLET
2023-05-09AK: Add `OutputBufferedStream`Lucas CHOLLET
This class, in a similar fashion to what has been done with `InputBufferedStream`, postpones write to the stream until an internal buffer is full. This patch also adds the `OutputBufferedFile` alias.
2023-05-09AK: Add the `Input` word to input-only buffered streamsLucas CHOLLET
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-09AK: Add `CircularBuffer::flush_to_stream`Lucas CHOLLET
In a similar fashion to what have been done with `fill_from_stream`, this new method allows to write CircularBuffer's data to a Stream without additional copies.
2023-05-09AK: Remove `must_set()` from `JsonArray`Kemal Zebari
Due to 582c55a, both `must_set()` and `set()` should be providing the same behavior. Not only is that a reason to remove `must_set()`, but it also performs erroneous behavior since it inserts an element at a specified index instead of modifying an element at that index.
2023-05-08AK: Use consteval String factories on macOSTimothy Flynn
Xcode 14.3 ships with clang 15, which supports our usage of consteval to validate short strings at compile time.
2023-05-07Everywhere: Change spelling of 'behaviour' to 'behavior'Ben Wiederhake
"The official project language is American English […]." https://github.com/SerenityOS/serenity/blob/5d2e9156239cd707a22ecea6c87d48e5fc1cbe84/CONTRIBUTING.md?plain=1#L30 Here's a short statistic of the occurrences of the word "behavio(u)r": $ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n 2 BEHAVIOR 24 Behaviour 32 behaviour 407 Behavior 992 behavior Therefore, it is clear that "behaviour" (56 occurrences) should be regarded a typo, and "behavior" (1401 occurrences) should be preferred. Note that The occurrences in LibJS are intentionally NOT changed, because there are taken verbatim from the specification. Hence: $ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n 2 BEHAVIOR 10 behaviour 24 Behaviour 407 Behavior 1014 behavior
2023-05-07Everywhere: Run spellcheck on all documentationBen Wiederhake
2023-05-04AK: Prevent bit counter underflows in the new BitStreamTim Schumacher
Our current `peek_bits` function allows retrieving more bits than we can actually provide, so whenever someone discards the requested bit count afterwards we were underflowing the value instead.
2023-05-03AK: Have `JsonArray::set()` change values instead of inserting valuesKemal Zebari
Resolves #18618. 8134dcc changed `JsonArray::set()` to insert elements at an index instead of changing existing elements in-place. Since no behavior such as `Vector::try_at()` exists yet, it returns nothing.
2023-05-02AK: Accomodate always-32-bit data member pointers in IntrusiveListAli Mohammad Pur
This only exists on windows, but we've made an effort to keep jakt working on windows, so let's support this silliness.
2023-05-02Everywhere: Make Lagom build with GCC 13Daniel Bertalan
GCC 13 was released on 2023-04-26. This commit fixes Lagom build errors when using an updated host toolchain: - Adds a workaround for a bug in constraint handling, which made LibJS fail to compile: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109683 - Silences the new `-Wdangling-reference` diagnostic globally. It produces multiple false positives with no clear way to silence them without `#pragmas`. - Silences `-Wself-move` in `RefPtr` tests as GCC 13 adds this previously Clang-exclusive warning.
2023-04-30AK: Replace linear exponentiation by binary in MinimalBigIntDan Klishch
This further optimizes floating point parsing (specifically with a large amount of digits). The commit shaves additional 20% of the run time for 750-digit numbers. No performance degradation is noticeable for small numbers.
2023-04-30AK: Use helpers from BigIntBase.h in MinimalBigIntDan Klishch
Although it might seem like we've switched to more generic functions, which must run slower, it is not the case. The time required to parse "1", for example, decreased by 1%. For numbers with more digits, the effect is more noticeable: 8-digit numbers are parsed ~5% faster; for gigantic 750-digit numbers, parsing is 2 times faster. The later result is achieved by using UFixedBigInt<64>::wide_multiply instead of u128::operator*(u128).
2023-04-30AK: Move taint_for_optimizer to StdLibExtras.hDan Klishch
Additionally, split it into two versions (for IsIntegral<T> -- asking to place value into register and for !IsIntegral<T> -- asking to place value into memory with memory clobber), so that Clang is no more completely confused about `taint_for_optimizer(AK::StringView&)`.
2023-04-30AK: Add count() helper to Stringthankyouverycool
2023-04-29AK: Add `Span::align_to`Daniel Bertalan
This method returns a sub-span whose data pointer and size is aligned to a specified alignment.
2023-04-28AK: Add values() method in HashTableAliaksandr Kalenik
Add HashTable::values() method that returns all values.
2023-04-28AK: Make the Optional formatter always available and tweak its formatAli Mohammad Pur
There's no real reason to make this a debug-only formatter, on top of that, jakt has a optional formatter that prints None/foo instead of OptionalNone/Optional(foo), which is more concise anyway, so switch to that.
2023-04-28AK+LibTimeZone: Add debug only formatter for OptionalMacDue
I found this handy for debugging, and so might others. This now also adds a formatter for TimeZone::TimeZone. This is needed for FormatIfSupported<Optional<TimeZone::TimeZone>> to compile. As FormatIfSupported sees a formatter for Optional exists, but not that there's not one for TimeZone::TimeZone.
2023-04-28AK: Don't refer to AK::swap() as ::swap()Ali Mohammad Pur
While swap() is available in the global namespace in normal conditions, !USING_AK_GLOBALLY will make this name unavailable in the global namespace, making these calls fail to compile.
2023-04-28AK+Everywhere: Disallow Error::from_string_view(FooString)Ali Mohammad Pur
That pattern seems to show up a lot in code written by people that aren't intimately familiar with the lifetime model of Error and Strings. This commit makes the compiler detect it and present a more helpful diagnostic than "garbage string at runtime".
2023-04-26LibWasm: Start implementing WASIAli Mohammad Pur
This commit starts adding support for WASI, along with the framework to implement all the functions (though only a couple are currently implemented).
2023-04-25AK: Rename `Stream::format()` to `Stream::write_formatted()`Tim Schumacher
This brings the function name in line with how we usually name those functions, which is with a `read_` or `write_` prefix depending on what they do. While at it, make the internal `_impl` function private and not-virtual, since there is no good reason to ever override that function.
2023-04-24AK: Use `JsonArray::append` when parsing arrayCameron Youell
2023-04-24AK: Add new failable `JsonArray::{append/set}` functionsCameron Youell
Move all old usages to the more explicit `JsonArray:must_{append/set}`
2023-04-23LibThreading: Create WorkerThread class run a single task concurrentlyZaggy1024
This class can be used to run a task in another thread, and allows the caller to wait for the task to complete to retrieve any error that may have occurred. Currently, it doesn't support functions returning a value on success, but with some template magic that should be possible. :^)
2023-04-23AK: Implement Stream::format(fmtstr, args...)Peter Brottveit Bock
Based on `out()` and `vout()` from AK/Format.h. As opposed to those, this propagates errors. As `Core::File` extends `AK::Stream`, this allows formatted printing directly on `Core::File`s.
2023-04-21AK: Add Array::contains_slow() and ::first_index_of(), with tests :^)Sam Atkins
2023-04-21AK: Fix crash during teardown of self-owning objectsAndreas Kling
We now null out smart pointers *before* calling unref on the pointee. This ensures that the same smart pointer can't be used to acquire a new reference to the pointee after its destruction has begun. I ran into this when destroying a non-empty IntrusiveList of RefPtrs, but the problem was more general so this fixes it for all of RefPtr, NonnullRefPtr, OwnPtr and NonnullOwnPtr.
2023-04-15AK+Everywhere: Replace URL::paths() with path_segment_at_index()MacDue
This allows accessing and looping over the path segments in a URL without necessarily allocating a new vector if you want them percent decoded too (which path_segment_at_index() has an option for).
2023-04-15AK+Everywhere: Change URL::path() to serialize_path()MacDue
This now defaults to serializing the path with percent decoded segments (which is what all callers expect), but has an option not to. This fixes `file://` URLs with spaces in their paths. The name has been changed to serialize_path() path to make it more clear that this method will generate a new string each call (except for the cannot_be_a_base_url() case). A few callers have then been updated to avoid repeatedly calling this function.
2023-04-15AK+Everywhere: Add ApplyPercentDecoding option to URL gettersMacDue
The defaults selected for this are based on the behaviour of URL when it applied percent decoding during parsing. This does mean now in some cases the getters will allocate, but percent_decode() checks if there's anything to decode first, so in many cases still won't.
2023-04-15AK: Remove unnecessary parameter names in URL.hMacDue
2023-04-14AK: Remove workaround for old macOS SDKNico Weber
https://github.com/SerenityOS/serenity/pull/9716#issuecomment-1508606204 has details.
2023-04-14AK: Remove unused AK_ARCH_ definesNico Weber
ARCH() uses the AK_IS_ARCH_ macros internally since 349e54d5375a4a, and all user code uses the ARCH() macro instead of AK_ARCH_. (Why it's called ARCH() and not AK_ARCH(), I don't know.) If any ports not in the main repo use AK_ARCH_, they should switch to using ARCH() instead.