Age | Commit message (Collapse) | Author |
|
|
|
Also use strlen() instead of manually walking the string. This allows
GCC to optimize away the strlen() entirely for string literals. :^)
|
|
This avoids constructing a temporary JsonValue just to append an int.
|
|
|
|
This implementation uses the new helper method of Bitmap called
find_longest_range_of_unset_bits. This method looks for the biggest
range of contiguous bits unset in the bitmap and returns the start of
the range back to the caller.
|
|
Add sized variants of the global operator delete functions so we don't
have to use these GCC options anymore.
|
|
This is only used by the somewhat dubious templated String::copy().
An empty Vector should generate an empty String when copied, never
a null String.
|
|
Trying to make_weak_ptr() on something that has begun destruction is
very unlikely to be what you want. Let's assert if that scenario comes
up so we can catch it immediately.
|
|
This changes copyright holder to myself for the source code files that I've
created or have (almost) completely rewritten. Not included are the files
that were significantly changed by others even though it was me who originally
created them (think HtmlView), or the many other files I've contributed code to.
|
|
Also provide a specialized swap(OwnPtr, OwnPtr) that allows swapping
an OwnPtr with itself.
|
|
It always bothered me that we're using the overloaded "dereference"
term for this. Let's call it "unreference" instead. :^)
|
|
FileSystemPath(".") should not have a title(). This was caught by the
unit test for FileSystemPath, yay! :^)
|
|
Just like String[View]::split_view() has already.
|
|
When using dbg() in the kernel, the output is automatically prefixed
with [Process(PID:TID)]. This makes it a lot easier to understand which
thread is generating the output.
This patch also cleans up some common logging messages and removes the
now-unnecessary "dbg() << *current << ..." pattern.
|
|
|
|
We should move towards using uintptr_t instead of u32 for pointers
everywhere, to prepare for an eventual 64-bit port.
|
|
This function can be used to more cleanly write the common operation of
clamping a value between two values.
|
|
|
|
Previously, when deallocating a range of VM, we would sort and merge
the range list. This was quite slow for large processes.
This patch optimizes VM deallocation in the following ways:
- Use binary search instead of linear scan to find the place to insert
the deallocated range.
- Insert at the right place immediately, removing the need to sort.
- Merge the inserted range with any adjacent range(s) in-line instead
of doing a separate merge pass into a list copy.
- Add Traits<Range> to inform Vector that Range objects are trivial
and can be moved using memmove().
I've also added an assertion that deallocated ranges are actually part
of the RangeAllocator's initial address range.
I've benchmarked this using g++ to compile Kernel/Process.cpp.
With these changes, compilation goes from ~41 sec to ~35 sec.
|
|
|
|
|
|
The generic swap() is not able to swap a NonnullRefPtr with itself,
due to its use of a temporary and NonnullRefPtr asserting when trying
to move() from an already move()'d instance.
|
|
|
|
Given the following situation:
struct Object : public RefCounted<Object> {
RefPtr<Object> parent;
}
NonnullRefPtr<Object> object = get_some_object();
object = *object->parent;
We would previously crash if 'object' was the only strongly referencing
pointer to 'parent'. This happened because NonnullRefPtr would unref
the outgoing pointee before reffing the incoming pointee.
This patch fixes that by implementing NonnullRefPtr assignments using
pointer swaps, just like RefPtr already did.
|
|
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.
For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.
Going forward, all new source files should include a license header.
|
|
It was possible to craft a custom ELF executable that when symbolicated
would cause the kernel to read from user-controlled addresses anywhere
in memory. You could then fetch this memory via /proc/PID/stack
We fix this by making ELFImage hand out StringView rather than raw
const char* for symbol names. In case a symbol offset is outside the
ELF image, you get a null StringView. :^)
Test: Kernel/elf-symbolication-kernel-read-exploit.cpp
|
|
This removes an item at an index without preserving the sort order of
the Vector.
This enables constant-time removal from unsorted Vectors, as it avoids
shifting all of the entries following the removed one.
|
|
If the last character was the separator and keep_empty is true, the
previous if statement would have already appended the last empty part,
so no need to do this again.
This was even more problematic, because the result of split_view() is
expected to consist of true substrings that are usable with the
StringView::substring_view_starting_*_substring() methods, not of
equal strings located elsewhere.
Fixes https://github.com/SerenityOS/serenity/issues/970
See https://github.com/SerenityOS/serenity/pull/938
|
|
We expect the result to be usable with the
StringView::substring_view_starting_*_substring() methods.
See https://github.com/SerenityOS/serenity/pull/938
|
|
|
|
Also use <AK/Types.h> instead of <stddef.h>
|
|
Let's catch ourselves if we ever index out of bounds into one of these.
|
|
|
|
These warnings are pretty harmless, but warnings nonetheless.
|
|
|
|
This was tripping up CObject which interprets timer ID 0 as "no timer".
Once we got ID 0 assigned, it was impossible to turn it off and it
would fire on every event loop iteration, causing CPU churn.
|
|
|
|
This allows u64s to be used in HashMaps.
|
|
|
|
Allow HOST_CXX to be passed to make which will be the actual host
C++ compiler used, such as 'make HOST_CXX=clang++'.
|
|
|
|
This always felt out-of-place in LibC.
|
|
For some reason, the default CXXFLAGS and such don't get us the
__cxa_demangle symbol in userland.
|
|
|
|
This variant of get() returns a const JsonValue* instead of a JsonValue
and can be used when you want to peek into a JsonObject's member fields
without making copies.
|
|
The mechanism that caches the most recently seen string for each first
character was indexing into the cache using a 'char' subscript. Oops!
|
|
|
|
|
|
Lock each directory before entering it so when using -j, the same
dependency isn't built more than once at a time.
This doesn't get full -j parallelism though, since one make child
will be sitting idle waiting for flock to receive its lock and
continue making (which should then do nothing since it will have
been built already). Unfortunately there's not much that can be
done to fix that since it can't proceed until its dependency is
built by another make process.
|
|
|