Commit graph

9850 commits

Author SHA1 Message Date
Sergey Bugaev
0dd68a2949 Kernel: Look for a user region first
We're far more likely to be looking for a user region than otherwise, so
optimize for that case.
2020-05-20 14:11:13 +02:00
Sergey Bugaev
d2b500fbcb AK+Kernel: Help the compiler inline a bunch of trivial methods
If these methods get inlined, the compiler is able to statically eliminate most
of the assertions. Alas, it doesn't realize this, and believes inlining them to
be too expensive. So give it a strong hint that it's not the case.

This *decreases* the kernel binary size.
2020-05-20 14:11:13 +02:00
Sergey Bugaev
36dcbce161 LibC: Claim some copyright for stdio
I've written a large part of the new stdio, so I'm (partly) to blame for it now.
2020-05-20 14:11:13 +02:00
Sergey Bugaev
776275a747 LibC: Handle fgets(size = 0)
I accidentally broke this in the recent rewrite. This reinstantiates the
behavior implemented in 6571468525.
2020-05-20 14:11:13 +02:00
Hüseyin ASLITÜRK
da23514431 Base: Add MessageBox question icon 2020-05-20 13:54:10 +02:00
Hüseyin ASLITÜRK
63539d655c Demos: WidgetGallery, Add MessageBox question icon option 2020-05-20 13:54:10 +02:00
Hüseyin ASLITÜRK
25227ee284 LibGUI: Add MessageBox question icon 2020-05-20 13:54:10 +02:00
AnotherTest
7fba21aefc LibLine: Unify completion hooks and adapt its users
LibLine should ultimately not care about what a "token" means in the
context of its user, so force the user to split the buffer itself.
This also allows the users to pick up contextual clues as well, since
they have to lex the line themselves.

This commit pacthes Shell and the JS repl to better handle completions,
so certain wrong behaviours are now corrected as well:
- JS repl can now complete "Object . getOw<tab>"
- Shell can now complete "echo | ca<tab>" and paths inside strings
2020-05-20 13:41:37 +02:00
Hüseyin ASLITÜRK
d18f6e82eb LibGUI: Replace up and down arrows with emoji 2020-05-20 13:40:24 +02:00
Hüseyin ASLITÜRK
80699a0824 LibGUI: Update copyright character in about dialog 2020-05-20 13:40:24 +02:00
Hüseyin ASLITÜRK
426cdaf65b Base: Add new characters to Katica and Csilla 2020-05-20 13:40:24 +02:00
Andrew Kaster
83137f76de Meta: Restore instructions to create build directory for CMake
We eliminated the need to pre-build LibC for libstdc++ by eliminating
libstdc++ itself, so users need to create their own build directories
again.
2020-05-20 08:37:50 +02:00
Andrew Kaster
4e051c6c15 Toolchain: Don't pre-build LibC and LibM, nor pre-install their headers
We can do away with that shenanigans now that libstdc++ is gone.
Also, simplify the toolchain dependency hash calculation to only depend
on the toolchain build script(s) and the Patches files we use to modify
the toolchain itself.
2020-05-20 08:37:50 +02:00
Andrew Kaster
c1eb744ff0 Build: Include headers from LibC, LibM, and LibPthread with -isystem
Make sure that userspace is always referencing "system" headers in a way
that would build on target :). This means removing the explicit
include_directories of Libraries/LibC in favor of having it export its
headers as SYSTEM. Also remove a redundant include_directories of
Libraries in the 'serenity build' part of the build script. It's already
set at the top.

This causes issues for the Kernel, and for crt0.o. These special cases
are handled individually.
2020-05-20 08:37:50 +02:00
Andrew Kaster
cdbbe14062 LibC: Implement Itanium C++ ABI for static variable guards
This is __cxa_guard_acquire, __cxa_guard_release, and __cxa_guard_abort.

We put these symbols in a 'fake' libstdc++ to trick gcc into thinking it
has libstdc++. These symbols are necessary for C++ programs and not C
programs, so, seems file. There's no way to tell gcc that, for example,
the standard lib it should use is libc++ or libc. So, this is what we
have for now.

When threaded code enters a block that is trying to call the constructor
for a block-scope static, the compiler will emit calls to these methods
to handle the "call_once" nature of block-scope statics.

The compiler creates a 64-bit guard variable, which it checks the first
byte of to determine if the variable should be intialized or not.

If the compiler-generated code reads that byte as a 0, it will call
__cxa_guard_acquire to try and be the thread to call the constructor for
the static variable. If the first byte is 1, it will assume that the
variable's constructor was called, and go on to access it.

__cxa_guard_acquire uses one of the 7 implementation defined bytes of
the guard variable as an atomic 8 bit variable. To control a state
machine that lets each entering thread know if they gained
'initialization rights', someone is working on the varaible, someone is
working on the varaible and there's at least one thread waiting for it
to be intialized, or if the variable was initialized and it's time to
access it. We only store a 1 to the byte the compiler looks at in
__cxa_guard_release, and use a futex to handle waiting.
2020-05-20 08:37:50 +02:00
Andrew Kaster
4361a50225 AK: Don't demangle in serenity :(
In order to remove libstdc++ completely, we need to give up on their
implementation of abi::__cxa_demangle. The demangler logic will actually
have to be quite complex, and included in both the kernel and userspace.

A definite fixme for the future, to parse the mangled names into real
deal names.
2020-05-20 08:37:50 +02:00
Andrew Kaster
aff594f1e7 AK: Add AtomicRef, for atomically accesing a reference to a varaible
This is distintly different from Atomic<T*>, because we want to
atomically access a variable that the atomic object itself does not own.
2020-05-20 08:37:50 +02:00
Andrew Kaster
bde7bc3472 Kernel: Don't link against libstdc++
It has nothing we need anymore :^)
2020-05-20 08:37:50 +02:00
Andrew Kaster
6d0d848720 Kernel: Add implementation of operator new and delete to kmalloc.cpp
This was missing before, we were getting it for free from libstdc++
2020-05-20 08:37:50 +02:00
Andrew Kaster
2c82347393 AK+LibC: Move non-placement new/delete into LibC
This allows operator new and operator delete to be available to anyone
that links -lc (everyone) rather than just people that include
kmalloc.h (almost no one).
2020-05-20 08:37:50 +02:00
Andrew Kaster
0a2cab0928 AK: Add InitializerList, an implementation of std::initializer_list
Use the AK version of std::initializer_list in AK::Vector, but only
when in serenity. When building AK for a non-serenity target, the header
<initializer_list> should be always available.
2020-05-20 08:37:50 +02:00
Andrew Kaster
3de808e860 df: Don't include c++ standard <cstring>
Use string.h instead, since that's part of serenity :)
2020-05-20 08:37:50 +02:00
Andreas Kling
191073000e WindowServer: Remove WindowManager::invalidate(Window) API's
Instead, we now tell Windows to invalidate themselves. Window will then
pass on the requests to Compositor.

My basic idea here is that WindowManager should do window management,
dealing with incoming events, moving, resizing, etc. Compositor should
deal with painting the window stack in the right order with the least
amount of effort. :^)
2020-05-20 08:31:46 +02:00
Andreas Kling
10699b347f WindowServer: Move occlusion things from WindowManager to Compositor 2020-05-20 08:31:46 +02:00
Sergey Bugaev
db30a2549e LibC: Rewrite stdio
The new version uses buffering much more prominently, and hopefully performs
better. It also uses something resembling C++ rather than plain C.
2020-05-20 08:31:31 +02:00
Sergey Bugaev
000a9cad34 AK: Fix Checked::multiplication_would_overflow() signature
The two-argument version doesn't need an extra template parameter.
2020-05-20 08:31:31 +02:00
Sergey Bugaev
7541122206 Kernel+LibC: Switch isatty() to use a fcntl()
We would want it to work with only stdio pledged.
2020-05-20 08:31:31 +02:00
AnotherTest
f9cffda0e0 LibTLS: Flush some packets as soon as more packets are written
This seems like a better compromise between throughput and latency, and
it doesn't _really_ affect the performance, so let's just compromise.
2020-05-20 08:30:51 +02:00
Linus Groh
b69abb3626 LibWeb: Make window.location.reload() enumerable only 2020-05-20 08:30:22 +02:00
Linus Groh
eb0810bf1a LibWeb: Make window.location properties non-configurable
Technically the property descriptors for these should not have
"writable: true" but "get" and "set" instead - but we don't support that
yet.
2020-05-20 08:30:22 +02:00
Linus Groh
6caacfec85 LibWeb: Add leading "?" to window.location.search if not empty 2020-05-20 08:30:22 +02:00
Linus Groh
8a913f336a LibWeb: Add leading "#" to window.location.hash if not empty 2020-05-20 08:30:22 +02:00
AnotherTest
c38c2668da LibLine: Default to resolving Spans as byte offsets
This allows all the unicode processing to be internal to the line
editor.
2020-05-19 20:02:28 +02:00
AnotherTest
379cb061d7 LibTLS: Only try to flush data when needed
This patchset drops the write notifier, and schedules writes only when
necessary.
As a result, the CPU utilisation no longer spikes to the skies :^)
2020-05-19 20:00:43 +02:00
Linus Groh
41da1a4336 LibWeb: Fix duplicated public access modifier in StyleDeclaration 2020-05-19 19:25:41 +02:00
Linus Groh
0edfd45451 FileManager: Remove empty public access modifier from DesktopWidget 2020-05-19 19:25:41 +02:00
Andreas Kling
ecea904ce9 WindowServer: Always send mouse events to the full-screen window
Full-screen mode is pleasantly exclusive, so we only need to send the
incoming mouse events to the active full-screen window.

This fixes an issue where clicking on the area normally covered by
the menubar while in full-screen mode would not send mouse events to
the full-screen window.
2020-05-19 18:14:19 +02:00
Andreas Kling
c1827d9766 WindowServer: Ignore overlap when compositing full-screen windows
Normally we walk the window stack to see if a given dirty rect is
covered by an opaque window. When the active window is full-screened,
we can skip this check and just unconditionally paint the window.

This fixes an issue where windows with higher inherent z-order (like
the taskbar and menu windows) would get cursor ghosting in them while
a normal window was full-screened.

Fixes #2289.
2020-05-19 17:59:13 +02:00
Andreas Kling
6d078a9ec3 LibGUI: Use dbg() instead of dbgprintf() in GUI::Dialog 2020-05-19 17:46:28 +02:00
Andreas Kling
ff8d250cbc LibGUI: Remove some ancient unused debug logging in AbstractButton 2020-05-19 17:46:28 +02:00
Andreas Kling
d2ae37f88f LibProtocol: Make Protocol::Client constructor private
Core::Object derived objects should always have private constructors
and use construct() for construction. This prevents accidentally
keeping them in non-reference-counting containers.
2020-05-19 17:46:28 +02:00
Andreas Kling
bc7bf727dd SystemMenu: Don't exit if the shutdown dialog is opened but cancelled
Previously opening the shutdown dialog and cancelling out of it would
cause SystemMenu to exit due to the exit-when-there-are-no-more-windows
mechanism in GUI::Application. Fix this by opting out of it.
2020-05-19 17:46:28 +02:00
Andreas Kling
efb3a34e43 SystemMenu: Rename PowerDialog => ShutdownDialog 2020-05-19 17:46:28 +02:00
Linus Groh
e5ea243842 Browser: Hide tab bar if there's only one tab 2020-05-19 17:42:48 +02:00
Linus Groh
f4a941a5d7 Browser: Support fullscreen view 2020-05-19 17:42:48 +02:00
Linus Groh
4ab4de7810 LibGUI: Add ability to hide GUI::TabWidget's tab bar 2020-05-19 17:42:48 +02:00
AnotherTest
082cd7048e LibLine: Handle <return>s in incomplete data correctly
Previously, we would concatenate all the commands together:
```
> sleep 5
echo well
echo hello
echo friends

> echo wellecho helloecho friends
```

Also renames some variables to be more descriptive.
2020-05-19 11:59:28 +02:00
Sergey Bugaev
88e23113ae Kernel: Tweak FileBackedFS API to avoid intermediary copies
read_block() and write_block() now accept the count (how many bytes to read
or write) and offset (where in the block to start; defaults to 0). Using these
new APIs, we can avoid doing copies between intermediary buffers in a lot more
cases. Hopefully this improves performance or something.
2020-05-19 11:07:35 +02:00
Sergey Bugaev
de4b7d9c21 Kernel: Make FS::block_size a size_t 2020-05-19 11:07:35 +02:00
Sergey Bugaev
9cbdd5f01e Kernel: Inline Inode::fsid() 2020-05-19 11:07:35 +02:00