summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2021-08-08AK: Make `InputMemoryStream::read_LEB128_*` templatedDaniel Bertalan
On i686, reading integers larger than `2^32 - 1` would fail as the 32-bit `size_t` parameter would overflow. This caused us to read too few bytes in LibDebug's DWARF parser. Making this method templated solves this issue, as we now can call this API with a `u64` parameter.
2021-08-08AK: Use kmalloc_array() where appropriateAndreas Kling
2021-08-08AK: Add kmalloc_array() to trap multiplication overflowsAndreas Kling
This pattern is no good: kmalloc(elements * sizeof(T)); Since it silently swallows any multiplication overflow. This patch adds a simple kmalloc_array() that stops the program if overflow occurs: kmalloc_array(elements, sizeof(T));
2021-08-08Everywhere: Replace AK::Singleton => SingletonAndreas Kling
2021-08-08AK: Bring Singleton into the global namespace with `using`Andreas Kling
2021-08-07AK: Add RecursionDecisionsin-ack
Similar to IterationDecision, this can be returned from callbacks passed to recursive traversal functions to signal how to proceed.
2021-08-07AK: Use east const in MappedFileTimothy
2021-08-07AK: Add method to create MappedFile from fdTimothy
2021-08-07AK: Introduce IntrusiveListRelaxedConstJean-Baptiste Boric
This container is the same as IntrusiveList, except that it allows modifications to the elements even if the reference to the IntrusiveList itself is const, by returning mutable iterators. This represents a use-case where we want to allow modifications to the elements while keeping the list itself immutable. This behavior is explicitely opt-in by using IntrusiveListRelaxedConst instead of IntrusiveList. It will be useful later on when we model shared/exclusive locks with the help of const and mutable references.
2021-08-06AK: Implement any_of using common implementationLenny Maiorani
Problem: - `any_of` is implemented in 2 different ways, one for the entire container and a different implementation for a partial container using iterators. Solution: - Follow the "don't repeat yourself" (DRY) idiom and implement the entire container version in terms of the partial version.
2021-08-06Kernel: Rename Kernel/VM/ to Kernel/Memory/Andreas Kling
This directory isn't just about virtual memory, it's about all kinds of memory management.
2021-08-06AK: Improve the parsing of data urlsTheFightingCatfish
Improve the parsing of data urls in URLParser to bring it more up-to- spec. At the moment, we cannot parse the components of the MIME type since it is represented as a string, but the spec requires it to be parsed as a "MIME type record".
2021-08-06AK: Make StringBuilder::join() use appendff() instead of append()Ali Mohammad Pur
`append()` is almost never going to select the overload that is desired. e.g. it will append chars when you pass it a Vector<size_t>, which is definitely not the right overload :)
2021-08-04AK+LibJS: Implement String.from{CharCode,CodePoint} using UTF-16 stringsTimothy Flynn
Most of String.prototype and RegExp.prototype is implemented with UTF-16 so this is to prevent extra copying of the string data.
2021-08-04AK: Allow configuring the BumpAllocator chunk sizeTimothy Flynn
2021-08-04AK+LibRegex: Add Utf16View::code_point_at and use it in RegexStringViewTimothy Flynn
The current method of iterating through the string to access a code point hurts performance quite badly for very large strings. The test262 test "RegExp/property-escapes/generated/Any.js" previously took 3 hours to complete; this one change brings it down to under 10 seconds.
2021-08-04AK+Kernel: Print TODO when a TODO() is executedsin-ack
Previously we would just print "ASSERTION FAILED: false", which was kinda cryptic and also didn't make it clear whether this was a TODO or an unreachable condition. Now, we actually print "ASSERTION FAILED: TODO", making it crystal clear.
2021-08-03AK: Mark Time::max() / Time::min() / Time::zero() as constexprBrian Gianforcaro
No reason for these static helper functions to not be constexpr.
2021-08-03Everywhere: Make use of container version of all_ofLenny Maiorani
Problem: - New `all_of` implementation takes the entire container so the user does not need to pass explicit begin/end iterators. This is unused except is in tests. Solution: - Make use of the new and more user-friendly version where possible.
2021-08-02AK: Fix declaration of {String,StringView}::is_one_ofTimothy Flynn
The declarations need to consume the variadic parameters as "Ts&&..." for the parameters to be forwarding references.
2021-08-02AK: Add a simple bump allocatorAli Mohammad Pur
2021-08-02AK: Correct Tuple's constructor signaturesAli Mohammad Pur
Tuple previously required rvalue references, this commit makes it accept forwarding references instead (which was the intention all along).
2021-08-02AK: Add formatters for BigEndian and LittleEndiansin-ack
This allows printing out BigEndian and LittleEndian values without having to perform a static_cast first.
2021-07-31LibWeb: Define proper debug symbols for CSS Parser and TokenizerSam Atkins
You can now turn debug logging for them on using `CSS_PARSER_DEBUG` and `CSS_TOKENIZER_DEBUG`.
2021-07-29AK: Update mmap name for MappedFiles on SerenityOSAndreas Kling
Looking at process memory maps is a lot nicer when you can see the paths of MappedFile mappings.
2021-07-27AK: Add copy_to span method for AK::MACAddressBrian Gianforcaro
2021-07-25AK: Create MACAddress from stringbrapru
Previously there was no way to create a MACAddress by passing a direct address as a string. This will allow programs like the arp utility to create a MACAddress instance by user-passed addresses.
2021-07-24AK: Reimplement all_of in terms of find_ifLenny Maiorani
Problem: - Now that a generic free-function form of `find_if` is implemented the code in `all_of` is redundant. Solution: - Follow the "don't repeat yourself" mantra and make the code DRY by implementing `all_of` in terms of `find_if`. - One tricky part is that since captures are not permitted in `constexpr` lambdas, the lambda created to negate the predicate needs to be created by a function which does not capture and takes the predicate at run-time instead. This allows `all_of` to continue to work in a `constexpr` context.
2021-07-23AK+LibRegex: Partially implement case insensitive UTF-16 comparisonTimothy Flynn
This will work for ASCII code points. Unicode case folding will be needed for non-ASCII.
2021-07-23AK: Add UTF-16 helper methods required for use within LibRegexTimothy Flynn
To be used as a RegexStringView variant, Utf16View must provide a couple more helper methods. It must also not default its assignment operators, because that implicitly deletes move/copy constructors.
2021-07-22CrashDaemon: Remove BACKTRACE_DEBUG debugging codeAndreas Kling
This thing seems to work fine, no need to hang on to old debug code.
2021-07-22AK: Add char SIMD typesHendiadyoin1
These are used in intrinsics, which do not recognize any signed version of the char type
2021-07-22AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith conceptAli Mohammad Pur
This makes it so these algorithms are usable with arbitrary iterators, as opposed to just instances of AK::SimpleIterator. This commit also makes the requirement of ::index() in find_index() explicit, as previously it was accepting any iterator.
2021-07-22AK: Convert AnyOf/AllOf to east-const styleAli Mohammad Pur
2021-07-22AK: Implement {any,all}_of(IterableContainer&&, Predicate)Ali Mohammad Pur
This is a generally nicer-to-use version of the existing {any,all}_of() that doesn't require the user to explicitly provide two iterators. As a bonus, it also allows arbitrary iterators (as opposed to the hard requirement of providing SimpleIterators in the iterator version).
2021-07-22AK: Add a concept for iterable containersAli Mohammad Pur
This concept describes a type with a begin()/end() pair that can function as an iterator, given the following criteria: - The return type of begin() is comparable with the return type of end(), and the comparison (with operator!=) yields a bool - The object returned from begin() can be pre-incremented - The iterator has an operator*() implementation
2021-07-22AK: Add a deduction guide to VectorAli Mohammad Pur
Note that this does not generate a vector with inline capacity.
2021-07-22AK: Add a CommonType<Ts...> type traitAli Mohammad Pur
Also adds a simple-ish test for CommonType.
2021-07-22AK: Make TypeBoundsChecker<UnsignedIntegralT, FloatingPointT> workLinus Groh
By replacing MakeUnsigned<Source> in this specific specialization with a simple negativity check this now works for floating point source types. Previously it would attempt a comparison of the destination type and void.
2021-07-22AK: Add Utf16View for decoding UTF-16 stringsTimothy Flynn
Also includes a way to transcode from and to UTF-8 strings.
2021-07-22AK: Disable clang-format for AK/Time.hGunnar Beutner
clang-format >=12 format this file incorrectly/differently.
2021-07-22AK: Add a getter to JsonValue to get machine-native addressesGunnar Beutner
2021-07-21AK: Sprinkle [[nodiscard]] on AK::ArrayAndreas Kling
2021-07-21AK: Convert Array to east-const styleAndreas Kling
2021-07-21AK: Remove unused private HashTable::lookup_for_reading()Andreas Kling
2021-07-21AK: Sprinkle [[nodiscard]] on HashMap and HashTableAndreas Kling
2021-07-21AK: Sprinkle [[nodiscard]] on AK::BitmapAndreas Kling
2021-07-21AK: Remove unused HashMap::remove_one_randomly()Andreas Kling
2021-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19AK: Introduce Math.hHendiadyoin1
This is to implement constexpr template based implementations for mathematical functions This also changes math.cpp to use these implementations. Also adds a fastpath for floating point trucation for values smaller than the signed 64 bit limit.