summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2020-10-29AK: Make String::matches() capable of reporting match positions tooAnotherTest
Also, rewrite StringUtils::match(), because the old implementation was fairly broken, e.g. "acdcxb" would *not* match "a*?b".
2020-10-29AK: Add a `is_one_of()' to StringViewAnotherTest
This copies the similar API from String.
2020-10-29CMake: Use CONFIGURE_DEPENDS in existing globs.asynts
2020-10-29AK: Add GenericLexer::retreat()Linus Groh
This allows going back one character at a time, and then re-consume previously consumed chars. The code I need this for looks something like this: ASSERT(lexer.consume_specific('\\')); if (lexer.next_is("foo")) ... lexer.retreat(); lexer.consume_escaped_character(); // This expects lexer.peek() == '\\'
2020-10-25AK: Deprecate warn().asynts
2020-10-25AK: Eradicate calls to warn().asynts
2020-10-25AK: Remove a really slow unit test.asynts
2020-10-24AK: Add [[deprecated]] to out().asynts
2020-10-24AK: Introduce SourceGenerator::fork().asynts
Previously, I abused the copy constructor, this is a lot better.
2020-10-22AK: Add `GenericLexer::consume_escaped_character()'AnotherTest
...and use it in `consume_and_unescape_string()'.
2020-10-22AK: Enhance String::contains to allow case-insensitive searchesTom
2020-10-22AK: Make Utf8View and Utf32View more consistentTom
This enables use of these classes in templated code.
2020-10-21TestArray: constexpr_sum using spanLenny Maiorani
Problem: - `constexpr_sum` is implemented using `Array` which means the function needs to be a function template so that the size can be deduced. Solution: - Change the `Array` function argument to a `Span` since `Span` now is `constexpr`.
2020-10-21HashFunctions: constexpr capabilityLenny Maiorani
Problem: - Hash functions can be `constexpr`, but are not. Solution: - Change `inline` keyword to `constexpr`. - Add `static_assert` tests to ensure the hash functions work in a `constexpr` context.
2020-10-21TestHashFunctions: Tests to bind hash functionalityLenny Maiorani
Problem: - The hash functions have no associated tests, so there is nothing binding their behavior. Solution: - Bind the hash function behavior by adding tests. - Use the existing behavior as "correct".
2020-10-20Everywhere: Redundant inline specifier on constexpr functions (#3807)Lenny Maiorani
Problem: - `constexpr` functions are decorated with the `inline` specifier keyword. This is redundant because `constexpr` functions are implicitly `inline`. - [dcl.constexpr], §7.1.5/2 in the C++11 standard): "constexpr functions and constexpr constructors are implicitly inline (7.1.2)". Solution: - Remove the redundant `inline` keyword.
2020-10-20Checked: constexpr supportLenny Maiorani
Problem: - `Checked` is not `constexpr`-aware. Solution: - Decorate member functions with `constexpr` keyword. - Add tests to ensure the functionality where possible.
2020-10-20Checked: Use default compiler-generated functionsLenny Maiorani
Problem: - Compiler-generated functions are being defined which results in extra code to maintain. Solution: - Switch to compiler-generated default functions for default construction, copy assignment, move assignment, copy construction and move construction.
2020-10-20Build: Modify various parts to allow the build to succeed on FreeBSDLaurent Cimon
2020-10-18AK: Reduce memory writes in HashTable destructorDano Perniš
2020-10-18AK: Implement HashTable assignment in terms of swapDano Perniš
2020-10-18AK: Provide swap() for HashTableDano Perniš
2020-10-17CircularQueue: Ensure constructor does not construct any valuesLenny Maiorani
Problem: - There is no test which guarantees the CircularQueue does not construct any objects of the value type. The goal is to have uninitialized memory which can be used. Solution: - Add a test requiring that the constructor of the value type is never called.
2020-10-17AK: Add formatters for NonnullOwnPtr and WeakPtr.asynts
2020-10-17AK+Format: Add outln(FILE*, ...) overload.asynts
This commit also removes a few functions like raw_out and vwarn. If we want to write raw output, we can do this as follows: out("{}", "Hello, World!"); The vout stuff isn't really public API anyways, so no need for another vwarn.
2020-10-17BinarySearch: constexpr supportLenny Maiorani
Problem: - It is not possible to perform a binary search at compile-time because `binary_search` is not `constexpr`-aware. Solution: - Add `constexpr` support.
2020-10-17ntpquery: Don't leak local time, and check origin time in replyNico Weber
This implements the transmit time suggestion in (abandoned?) draft-ietf-ntp-data-minimization. (The other suggestions were already implemented as far as I can tell.)
2020-10-16Span: constexpr supportLenny Maiorani
Problem: - `Span` is not `constexpr` aware. Solution: - Add `constexpr` support for all parts that do not require `reinterpret_cast`. - Modify tests which use the `constexpr` functions.
2020-10-16AK: Tune HashTable load factorAndreas Kling
Double the capacity when used+deleted buckets crosses 60% of capacity. This appears to be a sweet spot for performance based on some ad-hoc testing with test-js. :^)
2020-10-16AK: Add some more checks to the HashMap testAndreas Kling
2020-10-15AK: Redesign HashTable to use closed hashingAndreas Kling
Instead of each hash bucket being a SinglyLinkedList, switch to using closed hashing (open addressing). Buckets are chained together via double hashing (hashing the hash until we find an unused bucket.) This greatly reduces malloc traffic, since each added element no longer allocates a new linked list node. Appears performance neutral on test-js. Can definitely be tuned and could use proper management of load factor, etc.
2020-10-15AK: Improve HashMap tests a little bitAndreas Kling
2020-10-14AK: Don't forward declare abort.asynts
There is no portable way to forward declare abort because the libc implementations disagree on the signature. Originally, I added a __portable_abort function with a "portable" signature which just called abort. But I really don't like it and just including <stdlib.h> is simpler. Note that the headers we include in <AK/TestSuite.h> are no longer commutative now, we have to include <stdlib.h> before anything else.
2020-10-13Base64: Pre-allocate size of input and outputLenny Maiorani
Problem: - Output of decode and encode grow as the decode and encode happen. This is inefficient because a large size will require many reallocations. - `const` qualifiers are missing on variables which are not intended to change. Solution: - Since the size of the decoded or encoded message is known prior to starting, calculate the size and set the output to that size immediately. All appends will not incur the reallocation overhead. - Add `const` qualifiers to show intent.
2020-10-13Use new format functions in remaining DevTools. (#3755)Paul Scharnofske
* AK: Add formatter for JsonValue. * Inspector: Use new format functions. * Profiler: Use new format functions. * UserspaceEmulator: Use new format functions.
2020-10-13Base64: constexpr initialization of alphabet and lookup tableLenny Maiorani
Problem: - The Base64 alphabet and lookup table are initialized at run-time. This results in an initial start-up cost as well as a boolean evaluation and branch every time the function is called. Solution: - Provide `constexpr` functions which initialize the alphabet and lookup table at compile-time. These can be called and assigned to a `constexpr` variable so that there is no run-time cost associated with the initialization or lookup.
2020-10-12AK: Add SourceGenerator class.asynts
2020-10-09AK: Add formatter for LexcialPath.asynts
2020-10-09AK+Format: Remove new_dbg(dbg) and raw_dbg.asynts
We are adding the process name as prefix and a newline as suffix to any message written to debug. Thus, the following doesn't make any sense: for (u8 byte : bytes) dbg("{:02x} ", byte); dbgln(); Which function call would put the prefix? This doesn't make any sense, thus these functions must go. The example above could be converted to: StringBuilder builder; for (u8 byte : bytes) builder.appendff("{:02x} ", byte); dbgln("{}", builder.build());
2020-10-08Endian: constexpr constructors and conversion operatorsLenny Maiorani
Problem: - Constructors and conversion operators are not `constexpr`, but they can be. - `constexpr` is needed here so that other classes can add `constexpr` evaluation. Solution: - Add the `constexpr` keyword to the constructors and conversion operators. - Add `static_assert` tests which ensure the capability works.
2020-10-08AK: Make StringView hashableMatthew Olsson
2020-10-08AK: Use new format functions.asynts
2020-10-08AK: Add formatter for StringImpl.asynts
2020-10-08AK+Format: Make it possible to format characters as integers.asynts
2020-10-08AK+Format: Add SFINAE wrapper 'FormatIfSupported'.asynts
2020-10-08AK+Format: Add overloads with const char* for outln, warnln and dbgln.asynts
This makes it possible to forward declare 'warnln' in TestSuite.h.
2020-10-08AK+Format: Add overloads without arguments to outln, warnln and dbgln.asynts
2020-10-08AK+Format: Use pointer mode for pointers by default.asynts
2020-10-08VariadicFormatParams: Use initialized data to create parent classLenny Maiorani
Problem: - m_data is being passed to the constructor of the parent class before it is initialized. This is not really a problem because the compiler knows the location and it is only a span being constructed, but it triggers a warning in clang for use-before-init. Solution: - Initialize using a default constructed array and then overwrite it inside the constructor after the member is initialized.
2020-10-08Formatter: Remove extraneous char definitionLenny Maiorani
Formatter is specialized in the header file. The definition in the implementation file is extraneous and has no effect. Simply removing it so that there is no confusion.