Commit graph

20714 commits

Author SHA1 Message Date
Idan Horowitz bcfde43849 Toolchain: Replace the -march=native flag with -mtune=native
This ensures inter-machine compatibility by not emitting any processor
specific instructions. This fixes the issue raised by the non AVX-512
supporting GitHub actions runners.
2021-05-21 15:23:07 +02:00
Brian Gianforcaro bd1bdbe91b Meta: Add GDB pretty printer for AK::SinglyLinkedList 2021-05-21 15:23:01 +02:00
Brian Gianforcaro 0fbc5893bf Meta: Add GDB pretty printer for AK::InlineLinkedList
This allows a developer to easily dump a InlineLinkedList in the
debugger without having to manually running the list.
I needed this for a recent bug investigation in the Kernel.
2021-05-21 15:23:01 +02:00
Andreas Kling 6b25842b10 Base: Remove accidentally added file :^) 2021-05-21 15:11:16 +02:00
Brian Gianforcaro 3d7cc471d6 Revert "Kernel: Avoid allocating under spinlock in ProcessGroup::find_or_create"
This reverts commit e95eb7a51d.

This is causing some sort of list corruption, as evident by #7313
I haven't been able to figure it out yet, so lets revert this change
until I can figure out what's going on.
2021-05-21 12:36:20 +02:00
Brian Gianforcaro 124a523199 Revert "Kernel: Fix regression, removing a ProcessGroup that not in the list"
This reverts commit bbe315d8c0.

This is un-needed when reverting the parent commit.
2021-05-21 12:36:20 +02:00
Linus Groh d60ebbbba6 Revert "Userland: static vs non-static constexpr variables"
This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
2021-05-21 10:30:52 +01:00
Lenny Maiorani 68f76b9e37 Userland: Change typedef to using directive
Problem:
- `typedef`s are read backwards making it confusing.
- `using` statements can be used in template aliases.
- `using` provides similarity to most other C++ syntax.

- C++ core guidelines say to prefer `using` over `typedef`:
  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-using

Solution:
- Switch these where appropriate.
2021-05-21 10:07:22 +01:00
Lenny Maiorani 800ea8ea96 Userland: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-21 10:07:06 +01:00
Brian Gianforcaro 17ff895e1c Toolchain: Enable native host optimizations when building toolchain
-march=native specializes the binaries for the CPU features available on
the CPU the binary is being compiled on. This matches the needs of the
Toolchain, as it's always built and used on that machine only.

This should be safe for the github actions VMs as well, as they all run
on a standard VM SKU in "the cloud".

I saw small but notable improvements in end-2-end build times in my
local testing. Each compilation unit is on average around a second
faster on my Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz.
2021-05-21 10:04:49 +01:00
Andrew Kaster 413d98fb45 Shell: Use /tmp for all file operations valid.sh test
Not doing so sometimes intermittently caused the '*' glob expansion test
to fail and lock up the shell.
2021-05-21 13:30:45 +04:30
Andrew Kaster a5889b9aad Shell: Hide job times behind SHELL_JOB_DEBUG flag 2021-05-21 12:05:34 +04:30
Andrew Kaster 0d0f52337c Base/CI: Run tests from /usr/Tests in GitHub Actions
Uncomment the tests that were disabled due to frequent freezes when
running without KVM. This also adds a new github actions group for
every single test, which makes it easier to browse test boundaries
during test runs.

Move catting the serial output log back to its own step, so that it
has higher visibility. The previous solution was also shown to not
actually cat the log in the case of a failed boot and timeout :^(.
2021-05-21 12:05:34 +04:30
Andrew Kaster 7e905ea201 Tests: Install non-LibTest based Kernel tests into Kernel/Legacy subdir
This makes it easier to run tests we know will work in CI, and ignore
ones that need some help to be repeatable.
2021-05-21 12:05:34 +04:30
Ali Mohammad Pur 1822d6b8ac LibWeb: Fix invalid behaviour of HTMLTokenizer::skip() and restore_to()
skip() is supposed to end up keeping the previous iterator only one
index behind the current one, and restore_to() should actually do the
restore instead of just removing the now-useless source positions.
Fixes #7331.
2021-05-21 09:22:35 +02:00
Liav A 09d09b79b6 Kernel: Fix type, dectivate_writes => deactivate_writes 2021-05-21 08:08:33 +02:00
Liav A db268efa69 Kernel/Graphics: Choose VMObject considering enabled state when mmaping
When mmaping a Framebuffer from userspace, we need to check whether the
framebuffer device is actually enabled (e.g. graphical mode is being
used) or a textual VirtualConsole is active.

Considering the above state, we mmap the right VMObject to ensure we
don't have graphical artifacts if we change the resolution from
DisplaySettings, changed to textual mode and after the resolution change
was reverted, we will see the Desktop reappearing even though we are
still in textual mode.
2021-05-21 08:08:33 +02:00
Liav A 87f8f892d8 Kernel: Fix framebuffer resolution modesetting after boot
If we tried to change the resolution before of this patch, we triggered
a kernel crash due to mmaping the framebuffer device again.
Therefore, on mmaping of the framebuffer device, we create an entire new
set of VMObjects and Regions for the new settings.

Then, when we change the resolution, the framebuffersconsole needs to be
updated with the new resolution and also to be refreshed with the new
settings. To ensure we handle both shrinking of the resolution and
growth of it, we only copy the right amount of available data from the
cells Region.
2021-05-21 08:08:33 +02:00
Liav A 5f718c6b05 Kernel/TTY: Don't flush dirty lines if VirtualConsole is not active 2021-05-21 08:08:33 +02:00
Liav A 38ccdb02ce Kernel: Process request to change virtual console from the IO Work queue
Instead of processing the input after receiving an IRQ, we shift the
responsibility to the io work queue to handle this for us, so if a page
fault occurs when trying to switch the VirtualConsole, the kernel can
handle that.
2021-05-21 08:08:33 +02:00
Linus Groh 9dd3203cc6 LibGfx: Add missing TextAlignment::BottomLeft 2021-05-21 08:04:31 +02:00
Ali Mohammad Pur 8cbdcffd05 LibWasm: Print instruction arguments too 2021-05-21 00:15:23 +01:00
Ali Mohammad Pur 207379165f LibWasm: Fix nested structured instruction parsing
Previously, the ip would not be propagated correctly, and we would
produce invalid jumps when more than one level of nesting was involved.
This makes loops work :P
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur 29b193d25d LibWasm: Resolve labels starting from the top of the stack
Otherwise "label index 0" would be the first ever created label, not the
last one (as the spec wants) :^(
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur 35b3ae26ed LibWasm: Implement a very basic linker
This will simply "link" any given module instances and produce a list of
external values that can be used to instantiate a module.
Note that this is extremely basic and cannot resolve circular
dependencies, and depends on the instance order.
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur 3283c8a495 LibWasm: Make the instantiation process produce an OwnPtr
Managing the instantiated modules becomes a pain if they're on the
stack, since an instantiated module will eventually reference itself.
To make using this simpler, just avoid copying the instance.
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur efb106069b LibWasm: Decouple ModuleInstance from the AbstractMachine
This fixes a FIXME and will allow linking only select modules together,
instead of linking every instantiated module into a big mess of exported
entities :P
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur 24b2a6c93a LibWasm+Meta: Implement instantiation/execution primitives in test-wasm
This also optionally generates a test suite from the WebAssembly
testsuite, which can be enabled via passing `INCLUDE_WASM_SPEC_TESTS`
to cmake, which will generate test-wasm-compatible tests and the
required fixtures.
The generated directories are excluded from git since there's no point
in committing them.
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur 541091500c LibWasm: Trap instead of VERIFY()'ing
...unless something really is an assertion.
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur b3c13c3e8a LibWasm+Meta: Add test-wasm and optionally test the conformance tests
This only tests "can it be parsed", but the goal of this commit is to
provide a test framework that can be built upon :)
The conformance tests are downloaded, compiled* and installed only if
the INCLUDE_WASM_SPEC_TESTS cmake option is enabled.
(*) Since we do not yet have a wast parser, the compilation is delegated
to an external tool from binaryen, `wasm-as`, which is required for the
test suite download/install to succeed.
This *does* run the tests in CI, but it currently does not include the
spec conformance tests.
2021-05-21 00:15:23 +01:00
Ali Mohammad Pur ba2fce14d3 Meta: Add a Wasm parser fuzzer 2021-05-21 00:15:23 +01:00
Linus Groh 90e5f607bd CI: Bump update-alternatives priority to 100
This didn't seem to have worked in the past, the new value matches the
recomendation on the GitHub Actions clang-11 default announcement:

https://github.com/actions/virtual-environments/issues/3235
2021-05-21 00:15:14 +01:00
Linus Groh 13288d956b CI: Also apt-get purge clang-11 in build_and_test_lagom step
We don't need it. A recent change to the ubuntu-20.04 image has made it
the default, causing builds to fail - we're installing and want to use
clang-12 anyway, so let's just get rid of the other installed versions.
2021-05-21 00:15:14 +01:00
r-paiva 943f4eb287 LibCore: Let IODevice::can_read_line() buffer until \n or EOF
If a line was larger than 1024 bytes or the file ended without a
newline character, can_read_line would return false.

IODevice::can_read_line() now reads until a newline is found or
EOF is reached.

fixes #5907
2021-05-20 23:53:06 +02:00
r-paiva edcfbdf4bd AK: Added contains_in_range to Vector
Vector::contains_in_range() allows the search of an element in a given
range on a vector object.
Also added testcases for the new Vector method.
2021-05-20 23:53:06 +02:00
r-paiva 68de9008e7 Utilities: Fix grep match when reading from stdin
When reading from stdin, grep discards the last character,
even if that character is not \n.

This commit changes grep to no longer discard the last character from
a line.
2021-05-20 23:53:06 +02:00
Stephan Unverwerth eed0bcaf42 LibGL: Implement glHint() 2021-05-20 23:29:56 +02:00
Gunnar Beutner 2a16c8bdb8 3DFileViewer: Clean up file handling
This unifies how 3DFileViewer handles the initial file when starting
the application and when opening files later on via the menu.

Errors are shown both for the initial load as well as when loading
files later on. An error during file load no longer clears the
existing model.

It also adds support for specifying the filename as a command-line
argument.

The opened file's name is shown in the titlebar.
2021-05-20 22:22:56 +02:00
Gunnar Beutner 728e6dad73 3DFileViewer: Move the example model into the home directory 2021-05-20 22:22:56 +02:00
Andreas Kling 1e0d855fdf TextEditor: Don't launch a WebContent process until it's needed
The HTML and Markdown preview modes both use an OutOfProcessWebView to
render the preview pane, and we were instantiating this view from GML.
This caused us to always spawn a WebContent process alongside every
TextEditor instance.

Fix this by deferring the OOPWV construction until we actually need it.
This makes launching TextEditor on a text file quite a bit faster. :^)
2021-05-20 22:12:42 +02:00
Andreas Kling e95e64972c Clipboard+LibGUI: Remove unnecessary client/server greeting message 2021-05-20 22:12:42 +02:00
Andreas Kling ec8363aec3 WindowServer+LibGUI: Make client/server greeting faster
Instead of doing a full IPC round-trip for the client and server to
greet each other upon connecting, the server now automatically sends
a "fast_greet" message when a client connects.

The client simply waits for that message to arrive before proceeding.
(Waiting is necessary since LibGUI relies on the palette information
included in the greeting.)
2021-05-20 22:12:42 +02:00
Andreas Kling 1150e9fe79 LibGfx: Remove unused current_system_theme() function 2021-05-20 22:12:42 +02:00
Max Wipfli 4cd8ca07e3 FontEditor: Make statusbar text generation more robust
This makes a few modifications to the statusbar text generation:
* Use the canonical U+XXXX representation of unicode characters.
* For control characters, display their alias instead of whitespace.
* Substitute RTL codepoints with U+FFFD so the text paints correctly.
* Only show the glyph's dimensions if it actually exists in the font.

This fixes #7286.
2021-05-20 22:10:45 +02:00
Max Wipfli 3c2565da94 AK: Add UnicodeUtils with Unicode-related helper functions
This introduces the UnicodeUtils file, which contains helper functions
related to Unicode. This is in contrast to StringUtils, whose functions
are not directly related to Unicode and are, in theory,
encoding-agnostic.
2021-05-20 22:10:45 +02:00
Max Wipfli 621a4008e6 FontEditor: Add tooltip to "Move Glyph" button
This adds a simple tooltip to the "Move Glyph" button to indicate its
functionality.
2021-05-20 22:10:45 +02:00
Tom 9dcc7a67e5 Kernel: Close a Thread tid lookup race
There is a window between dropping a thread's last reference and it
being removed from the list.

Found in #5541
2021-05-20 22:08:36 +02:00
Tobias Christiansen adfdfd6aba LibWeb: Deal with Boxes that have a background, border and -radius
This hack allows for Boxes that have a background to be painted and a
border to accurately paint their border-radii if needed.
For that the box in with the background is drawn is extended to the
bordered_rect. The border is later drawn over this regardless.
Previously when drawing a Box that had all three, background, border
and a border-radius, there could be some white between the filling and
the border.
2021-05-20 22:08:02 +02:00
Tobias Christiansen a49812cb07 LibWeb: Take border-radius into account when painting borders
This applies to thicker borders. When drawing them we now don't
chamfer the corner if there is a border-radius present.
2021-05-20 22:08:02 +02:00
Tobias Christiansen 7a566e54e5 LibWeb: Introduce struct to hold border radii and normalize once
The struct BorderRadiusData contains the four radii of the box.
In case the specified borders are too large for the dimensions of the
box, they get scaled down.
2021-05-20 22:08:02 +02:00