Commit graph

15444 commits

Author SHA1 Message Date
Tom
54c66b8f7b Meta: Bump default RAM size to 512MB
Now that we commit memory, we need a lot more physical memory. Physical
memory requirements can be reduced again once we have memory swapping,
which allows the swap area/file to be counted against memory that can
be committed.
2021-01-01 23:43:44 +01:00
Tom
476f17b3f1 Kernel: Merge PurgeableVMObject into AnonymousVMObject
This implements memory commitments and lazy-allocation of committed
memory.
2021-01-01 23:43:44 +01:00
Tom
b2a52f6208 Kernel: Implement lazy committed page allocation
By designating a committed page pool we can guarantee to have physical
pages available for lazy allocation in mappings. However, when forking
we will overcommit. The assumption is that worst-case it's better for
the fork to die due to insufficient physical memory on COW access than
the parent that created the region. If a fork wants to ensure that all
memory is available (trigger a commit) then it can use madvise.

This also means that fork now can gracefully fail if we don't have
enough physical pages available.
2021-01-01 23:43:44 +01:00
Tom
e21cc4cff6 Kernel: Remove MAP_PURGEABLE from mmap
This brings mmap more in line with other operating systems. Prior to
this, it was impossible to request memory that was definitely committed,
instead MAP_PURGEABLE would provide a region that was not actually
purgeable, but also not fully committed, which meant that using such memory
still could cause crashes when the underlying pages could no longer be
allocated.

This fixes some random crashes in low-memory situations where non-volatile
memory is mapped (e.g. malloc, tls, Gfx::Bitmap, etc) but when a page in
these regions is first accessed, there is insufficient physical memory
available to commit a new page.
2021-01-01 23:43:44 +01:00
Tom
c3451899bc Kernel: Add MAP_NORESERVE support to mmap
Rather than lazily committing regions by default, we now commit
the entire region unless MAP_NORESERVE is specified.

This solves random crashes in low-memory situations where e.g. the
malloc heap allocated memory, but using pages that haven't been
used before triggers a crash when no more physical memory is available.

Use this flag to create large regions without actually committing
the backing memory. madvise() can be used to commit arbitrary areas
of such regions after creating them.
2021-01-01 23:43:44 +01:00
Tom
bc5d6992a4 Kernel: Memory purging improvements
This adds the ability for a Region to define volatile/nonvolatile
areas within mapped memory using madvise(). This also means that
memory purging takes into account all views of the PurgeableVMObject
and only purges memory that is not needed by all of them. When calling
madvise() to change an area to nonvolatile memory, return whether
memory from that area was purged. At that time also try to remap
all memory that is requested to be nonvolatile, and if insufficient
pages are available notify the caller of that fact.
2021-01-01 23:43:44 +01:00
Linus Groh
cf2c215def Conway: Distribute leftover space equally on all sides
This draws the universe centered rather than just putting all leftover
space on the right and bottom sides until the window is large enough to
be completely filled with cells again.
2021-01-01 23:34:25 +01:00
Andreas Kling
849e2ded24 LibGfx: Tweak color of checkmark in disabled+checked GUI::CheckBox 2021-01-01 23:08:59 +01:00
Andreas Kling
93e82e8459 HackStudio: Use is<T> instead of strcmp on a widget class_name() :^) 2021-01-01 23:02:31 +01:00
Andrew Kaster
744322c247 HackStudio: Call Thread::join instead of pthread_join
It's really awkward that HackStudioWidget was calling the pthread API on
its LibThread::Thread. Change to calling the new Thread::join call,
which returns the information it wants to log.
2021-01-01 23:01:48 +01:00
Andrew Kaster
8d0b4657e7 LibThread: Improve semantics of Thread::join, and remove Thread::quit.
Thread::quit was created before the pthread_create_helper in pthread.cpp
that automagically calls pthread_exit from all pthreads after the user's
thread function exits. It is unused, and unecessary now.

Cleanup some logging, and make join return a Result<T, ThreadError>.
This also adds a new type, LibThread::ThreadError as an
AK::DistinctNumeric. Hopefully, this will make it possible to have a
Result<int, ThreadError> and have it compile? It also makes it clear
that the int there is an error at the call site.

By default, the T on join is void, meaning the caller doesn't care about
the return value from the thread.

As Result is a [[nodiscard]] type, also change the current caller of
join to explicitly ignore it.

Move the logging out of join as well, as it's the user's
responsibility whether to log or not.
2021-01-01 23:01:48 +01:00
Andrew Kaster
986544600a AK: Add Result<void, ErrorType> specialization, cleanup
Add a specialization for a void ValueType. This is useful if a generic
function wants to return a Result<T, E> where the user might not
actually care abut the T, and default it to void. In this case it
basically becomes Unexpected<E> instead of Result, but hey, it works :)
2021-01-01 23:01:48 +01:00
Andrew Kaster
7b94ca21b3 LibPthread: Implement destruction of pthread_keys
Add a function to destroy any keys that were set on the current thread
using the algorithm from Dr. POSIX's pthread_key_create. Add some
defines to pthread.h for pthread key use, and implement
pthread_key_delete. It has a prototype in pthread.h, but any program
trying to actually use it would be in for a link-time surprise.

Currently, keys are destroyed either via global destructors, with the
s_key_destroyer object, or in exit_thread. exit_thread is invoked by
pthread_exit, and transitively by pthread_create, via the
pthread_create_helper that ensures all threads created with the pthread
API properly clean up for themselves when they exit gracefully.

A future patch might make s_key_destroyer a C++11 thread_local instead,
assuming we get thread_local and thread_local destructors working.
2021-01-01 23:01:48 +01:00
Liav A
9dc8bea3e7 Kernel: Allow to boot from a partition with partition UUID
Instead of specifying the boot argument to be root=/dev/hdXY, now
one can write root=PARTUUID= with the right UUID, and if the partition
is found, the kernel will boot from it.

This feature is mainly used with GUID partitions, and is considered to
be the most reliable way for the kernel to identify partitions.
2021-01-01 22:59:48 +01:00
Liav A
d22d29a29a AK: Add the UUID container
This container represents a universally unique identifier. This will be
used later in the kernel for GUID partitions.
2021-01-01 22:59:48 +01:00
Brendan Coles
d1d729370e Games: Add Conway 2021-01-01 22:51:37 +01:00
Simon Danner
138c3c7d58 ClipboardHistory: Fix crash when deleting without selection
* Fix by only activating the deletion action if we have a selection
2021-01-01 22:50:56 +01:00
Andreas Kling
3eca77bd86 Lagom: Build test-compress 2021-01-01 22:42:13 +01:00
Andreas Kling
19ffa676f2 LibWeb: Use is<T> in XMLHttpRequestPrototype 2021-01-01 22:41:50 +01:00
asynts
8ff61698da Meta: Add test-compress to Github workflow. 2021-01-01 22:23:13 +01:00
asynts
e77031ce67 AK: Deal with unsigned integers in binary search. 2021-01-01 22:23:13 +01:00
Andreas Kling
febc8a5ac7 UserspaceEmulator: Remove hand-rolled is_foo() helpers in favor of RTTI 2021-01-01 19:37:36 +01:00
Andreas Kling
db790dda62 LibJS: Remove hand-rolled type information in JS AST in favor of RTTI 2021-01-01 19:34:07 +01:00
Andreas Kling
07dd73c351 LibWeb: Remove hand-rolled is_foo() helpers in Layout::Node classes 2021-01-01 18:56:49 +01:00
Andreas Kling
3bb0cb2202 LibWeb: Remove more hand-rolled type information :^)
Hoo boy, we've really accumulated a lot of this stuff.
2021-01-01 18:14:00 +01:00
Andreas Kling
d2613403e0 LibJS+LibWeb: Stop generating is_foo_wrapper() for JS DOM wrappers 2021-01-01 18:06:38 +01:00
Andreas Kling
f48751a739 LibJS: Remove hand-rolled Object is_foo() helpers in favor of RTTI 2021-01-01 17:46:39 +01:00
Andreas Kling
8333055c3d LibJS: Use RTTI for inheritance checks
This replaces the hand-rolled string-based inheritance check tech.
2021-01-01 17:00:20 +01:00
Andreas Kling
fc86717f43 LibWeb: Demangle the names returned by Layout::Node::class_name()
Note that these are only used in debugging/test output so it's not
performance sensitive.
2021-01-01 16:42:44 +01:00
Andreas Kling
730af2c524 LibWeb: Simplify Layout::Node::class_name() with RTTI 2021-01-01 16:08:49 +01:00
Andreas Kling
7841528cd4 LibCore: Remove Core::Object::is_widget() in favor of RTTI 2021-01-01 16:08:49 +01:00
Andreas Kling
42179715c3 LibCore: Remove some hand-rolled type information from Core::Object
Both is_action() and is_window() can be answered by RTTI.
2021-01-01 16:08:49 +01:00
Andreas Kling
32fd59b471 LibGUI: Remove some hand-rolled type information from Widget 2021-01-01 16:08:49 +01:00
Andreas Kling
167906d02b PixelPaint: Remove hand-rolled type information in favor of RTTI 2021-01-01 16:08:49 +01:00
Jesse Buhagiar
ef5e9af6d3 DisplaySettings: Remove root_widget() from DisplaySettings
This fixes a weird dependency graph in DisplaySettings. The widget itself
(which is described in `gml` now), no longer contains `root_widget()`.

The widget itself has been moved into a tabbed pane, to get it ready
to add some more features and bring it more up to date with the current
UI code.
2021-01-01 15:55:08 +01:00
Andreas Kling
865f524d5b AK+LibGUI+LibWeb: Remove AK::TypeTraits in favor of RTTI-based helpers
Now that we have RTTI in userspace, we can do away with all this manual
hackery and use dynamic_cast.

We keep the is<T> and downcast<T> helpers since they still provide good
readability improvements. Note that unlike dynamic_cast<T>, downcast<T>
does not fail in a recoverable way, but will assert if the object being
casted is not a T.
2021-01-01 15:33:30 +01:00
Andreas Kling
7c3b6b10e4 Kernel: Remove the limited use of AK::TypeTraits we had in the kernel
This was only used for VMObject and we can do without it there. This is
preparation for migrating to dynamic_cast-based helpers in userspace.
2021-01-01 15:32:44 +01:00
Linus Groh
aa92adeedf LibJS: Fix email in TypedArray{Constructor,Prototype} copyright headers 2021-01-01 15:02:58 +01:00
Andrew Kaster
347bf6459d Applications+LibGUI: Convert all GML consumers to use the LibCore finder
Remove Widget::find_child_by_name and Widget::find_descendant_by_name,
and convert all users to using the type-safer version in Core::Object.
2021-01-01 14:45:09 +01:00
Andrew Kaster
5b03a0867f LibCore: Add typed find_child and find_descendant helpers to Object
These look a lot like the parallel functionality in GUI::Widget :).
These use dynamic_cast now, to make use of that RTTI we just added.
2021-01-01 14:45:09 +01:00
Andrew Kaster
350d4d3543 Meta: Enable RTTI for Userspace programs
RTTI is still disabled for the Kernel, and for the Dynamic Loader. This
allows for much less awkward navigation of class heirarchies in LibCore,
LibGUI, LibWeb, and LibJS (eventually). Measured RootFS size increase
was < 1%, and libgui.so binary size was ~3.3%. The small binary size
increase here seems worth it :^)
2021-01-01 14:45:09 +01:00
Brian Gianforcaro
43908db594 CMake: Add public cmake option to document BUILD_LAGOM
- Making this an option makes this option visible to users and tooling.
2021-01-01 14:37:04 +01:00
Brian Gianforcaro
40f671ac67 CMake: Add public cmake option to document ENABLE_ALL_THE_DEBUG_MACROS
- Making this an option makes this option visible to users and tooling.
- Rename `ALL_THE_DEBUG_MACROS` -> `ENABLE_ALL_THE_DEBUG_MACROS`.
2021-01-01 14:37:04 +01:00
Brian Gianforcaro
ab6ee9f7b2 CMake: Remove some trailing whitespace from a few CMakeLists.txt files 2021-01-01 14:37:04 +01:00
Brian Gianforcaro
6d67c4cafc CMake: Consolidate all options to the root of the project 2021-01-01 14:37:04 +01:00
Brendan Coles
74a65cffbd LibELF: validate_program_headers: Validate p_memsz and p_align 2021-01-01 14:34:25 +01:00
AnotherTest
887a62582d ProtocolServer: Use an empty Optional<IPC::File> to pass along "no fd"
Passing `-1` wouldn't work, as these are passed to `sendfd()'.
Fixes #4706.
2021-01-01 14:26:43 +01:00
Brendan Coles
f2973875e3 Base: Add Coffee theme 2021-01-01 13:10:54 +01:00
Andreas Kling
fc75421d50 Terminal: Tweak "Find" menu item -> "Find..."
The ellipsis (...) in a menu item traditionally means that the action
will require more input before executing. In this case, you need to
provide a search string. :^)
2021-01-01 02:19:45 +01:00
Andreas Kling
39efb3df18 LibGUI: Hide unnecessary scrollbars in MultiView
This removes pointless scrollbars in FilePicker which looks nice.
2021-01-01 02:12:39 +01:00