Commit graph

36376 commits

Author SHA1 Message Date
Luke Wilde 7cc53b7ef1 LibJS/Bytecode: Implement the delete unary expression
`delete` has to operate directly on Reference Records, so this
introduces a new set of operations called DeleteByValue, DeleteVariable
and DeleteById. They operate similarly to their Get counterparts,
except they end in creating a (temporary) Reference and calling delete_
on it.
2022-03-28 14:05:33 +02:00
Luke Wilde 589c3771e9 LibJS: Only store MemberExpression object when loading a computed prop
When calling emit_load_from_reference with a MemberExpression, it is
only necessary to store the result of evaluating MemberExpression's
object when performing computed property lookup.

This allows us to skip unnecessary stores for identifier lookup.
For example, this would generate 3 unnecessary stores:
```
> Temporal.PlainDateTime.prototype.add
JS::Bytecode::Executable (REPL)
1:
[   0] GetVariable 0 (Temporal)
[  28] Store $2
[  30] GetById 1 (PlainDateTime)
[  40] Store $3
[  48] GetById 2 (prototype)
[  58] Store $4
[  60] GetById 3 (add)
```

With this, it generates:
```
> Temporal.PlainDateTime.prototype.add
JS::Bytecode::Executable (REPL)
1:
[   0] GetVariable 0 (Temporal)
[  28] GetById 1 (PlainDateTime)
[  38] GetById 2 (prototype)
[  48] GetById 3 (add)
```
2022-03-28 14:05:33 +02:00
Luke Wilde 88901182b8 LibJS: Generate update Jump in for/in/of only if block is not terminated
The body of for/in/of can contain an unconditional block terminator
(e.g. return, throw), so we have to check for that before generating
the Jump to the loop update block.
2022-03-28 14:05:33 +02:00
Luke Wilde 741745baab LibJS/Bytecode: Update NewArray stringifier to print a register range
NewArray now only contains two elements maximum in `m_elements` to
indicate the range of registers to create the array from.

However, `m_element_count` still contains how many registers are in the
range and the stringifier was not updated to account for this. Thus, if
the range contained more than 2 registers, it would do a read OOB on
`m_elements`.

This makes it now just print the first and second entries in
`m_elements` in the format of `[<reg>-<reg>]`.
2022-03-28 14:05:33 +02:00
Lorenz Steinert 78f8821152 Kernel: Propagate HIDManagement initialisation error to init
Initialisation errors for HIDManagement are now returned to the init. In
the init we assert by MUST if we get an error.
2022-03-28 11:36:17 +02:00
Lorenz Steinert d3ce97e8b2 Kernel/Devices/HID: Propagate errors of HIDDevices properly
Some error indication was done by returning bool. This was changed to
propagate the error by ErrorOr from the underlying functions. The
returntype of the underlying functions was also changed to propagate the
error.
2022-03-28 11:36:17 +02:00
Brian Gianforcaro 83e96569ed LibAudio: Make sure we initialize ResampleHelper member variables
Found by Static Analysis: Sonar Cloud
2022-03-27 16:43:05 -07:00
Brian Gianforcaro ecc0459f76 LibC: Fix potential double free in ttyname_r_for_directory
If we break out of the loop before we attempt to allocate again,
then we double free the memory pointed to by `name_path`.

Found by Static Analysis: Sonar Cloud
2022-03-27 16:43:05 -07:00
Brian Gianforcaro 4674577d80 Everywhere: Rename CommandResult stdout, stderr members to output, error
The names stdout / stderr are bound to conflict with existing
declarations when compiling against other LibC's. The build on OpenBSD
is broken for this reason at the moment.

Lets rename the members to more generic names to resolve the situation.
2022-03-27 16:41:39 -07:00
Ali Chraghi f3f3b32a00 Base: Add SQL filetype icon 2022-03-27 23:16:38 +01:00
Ali Chraghi cee460ab0b Base: Add Database filetype icon 2022-03-27 23:16:38 +01:00
Andreas Kling 3ac9ea369d LibWeb: Don't choke on ICB with inline children
Let's relax our assumption about what kind of children the ICB has.
This is preparation for loading XHTML documents.
2022-03-27 23:38:27 +02:00
Andreas Kling 4575ab558b LibWeb: Make whitespace collapsing stateless
Previously, the whitespace collapsing code had a parameter telling it
whether the previous text node ended in whitespace. This was not
actually necessary, so let's get rid of it.
2022-03-27 21:56:21 +02:00
Daniel Bertalan 66582a875f Meta: Specify -z when decompressing tar.gz archives
While GNU tar automatically detects the used compression algorithm,
POSIX requires that we specify -z if the tarball is compressed with
gzip.

Fixes a build error on OpenBSD.
2022-03-27 12:17:59 -07:00
Linus Groh 192f4b0258 LibWeb: Ensure lazy WindowObject creation when activating event handler 2022-03-27 20:14:25 +01:00
Andreas Kling f9e8f02451 LibWeb: Don't crash in IFC if very first chunk is collapsible whitespace 2022-03-27 21:06:02 +02:00
Ali Mohammad Pur b732edf61c LibLine: Avoid pointless size_t <-> ssize_t cast
Just a small cleanup.
2022-03-27 21:05:44 +02:00
Ali Mohammad Pur f6afb70b07 LibLine: Handle read events serially
Previously LibLine accepted read callbacks while it was in the process
of reading input, this wasn't an issue as no async code was being
executed up until the Shell autocompletion came along.
Simply defer input processing while processing input to avoid causing
problems.
Fixes #13280.
2022-03-27 21:05:44 +02:00
Ali Mohammad Pur 5e541aaebd Shell: Keep the stdio and rpath pledges for execute_process()
If the command fails, we'd like to still be capable of printing out
diagnostics, so restore stdio and rpath.
Fixes #13281.
2022-03-27 21:05:44 +02:00
Linus Groh 46ad69cd1e LookupServer: Fix confusing copy/paste error in debug message 2022-03-27 18:39:47 +01:00
Linus Groh 1e82c2708d Kernel: Support all AMD-defined CPUID feature flags for EAX=80000001h
We're now able to detect all the AMD-defined CPUID feature flags from
ECX/EDX for EAX=80000001h :^)
2022-03-27 18:54:56 +02:00
Linus Groh 96e6420d8d Kernel: Support all Intel-defined extended CPUID feature flags for EAX=7
We're now able to detect all the extended CPUID feature flags from
EBX/ECX/EDX for EAX=7 :^)
2022-03-27 18:54:56 +02:00
Linus Groh 6ca03b915e Kernel: Support all Intel-defined CPUID feature flags for EAX=1
We're now able to detect all the regular CPUID feature flags from
ECX/EDX for EAX=1 :^)

None of the new ones are being used for anything yet, but they will show
up in /proc/cpuinfo and subsequently lscpu and SystemMonitor.

Note that I replaced the periods from the SSE 4.1 and 4.2 instructions
with underscores, which matches the internal enum names, Linux's
/proc/cpuinfo and the general pattern of replacing special characters
with underscores to limit feature names to [a-z0-9_].

The enum member stringification has been moved to a new function for
better re-usability and to avoid cluttering up Processor.cpp.
2022-03-27 18:54:56 +02:00
Linus Groh bc7ec02a82 Kernel: Implement CPUFeature as an ArbitrarySizedEnum
This will make it possible to add many, many more CPU features - more
than the current limit 32 and later limit of 64 if we stick with an enum
class to be specific :^)
2022-03-27 18:54:56 +02:00
Linus Groh e284ee7dcf Kernel: Fix whack formatting of the CPUID constructor 2022-03-27 18:54:56 +02:00
Linus Groh c895780829 Kernel: Reorder code in Processor::cpu_detect() for readability
Checks of ECX go before EDX, and the bit indices are now ordered
properly. Additionally, handling of the EDX[11] bit has been moved into
a lambda function to keep the series of if statements neatly together.
All of this makes it *a lot* easier to follow along and compare the
implementation to the tables in the Intel manual, e.g. to find missing
checks.
2022-03-27 18:54:56 +02:00
Tom c2f6152db8 Kernel: Change the BSP Processor instance to not have a constructor
This solves a problem where any non-trivial member in the global BSP
Processor instance would get re-initialized (improperly), losing data
that was already initialized earlier.
2022-03-27 18:54:56 +02:00
Linus Groh 22308e52cf AK: Add an ArbitrarySizedEnum template
This is an enum-like type that works with arbitrary sized storage > u64,
which is the limit for a regular enum class - which limits it to 64
members when needing bit field behavior.

Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2022-03-27 18:54:56 +02:00
Linus Groh 8b2361e362 AK: Add non-const DistinctNumeric::value() getter 2022-03-27 18:54:56 +02:00
Linus Groh 76e85ebbfc AK: Remove unused String.h include from UFixedBigInt.h
This makes it usable in the Kernel. :^)
2022-03-27 18:54:56 +02:00
Linus Groh 4727b5bd4d Meta: Fix path to GCC's addr2line in serenity.sh
I'm not sure when this changed, but the path is wildly different now.
2022-03-27 18:54:56 +02:00
Michael Manganiello f421addc50 Ports: Add Free Heroes of Might and Magic II (fheroes2) port
`fheroes2` is a recreation of HoMM2 game engine. This port is set with
`GET_HOMM2_DEMO=ON` for a free demo version to be automatically
downloaded and used, without requiring the user to provide game
resources from the original game.

Besides the provided patches, we set `CXXFLAGS="'-D_GNU_SOURCE'"` to
build the port, for SerenityOS' `LibC/endian.h` to provide required
endianness functions and constants.

**Considerations**:
* In-game custom cursor is not working, game logs show:
  `Cursors are not currently supported` [0].
* Game is still unplayable, as it commonly raises a Kernel panic when
  trying to start a new game (reported at SerenityOS/serenity#9401).

[0] ae3bc94772/src/events/SDL_mouse.c (L952)
2022-03-27 18:31:10 +02:00
Jelle Raaijmakers 8a3242cb83 LibGL+LibSoftGPU+LibGfx: Reimplement normal transformation
We now support generating top-left submatrices from a `Gfx::Matrix`
and we move the normal transformation calculation into
`SoftGPU::Device`. No functional changes.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers 74de8e4224 LibGL: Always normalize vertex attribute data
We were normalizing data read from vertex attribute pointers based on
their usage, but there is nothing written about this behavior in the
spec or in man pages.

When we implement `glVertexAttribPointer` however, the user can
optionally enable normalization per vertex attribute pointer. This
refactors the `VertexAttribPointer` to have a `normalize` field so we
can support that future implementation.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers bc5e5afc7b LibSoftGPU+LibGfx: Transform and normalize normals before lighting
We were transforming the vertices' normals twice (bug 1) and
normalizing them after lighting (bug 2). In the lighting code, we were
then diverting from the spec to deal with the normal situation, which
is now no longer needed.

This fixes the lighting of Tux in Tux Racer.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers 23476dac64 LibSoftGPU: Clean up Material initial value style 2022-03-27 09:19:43 -07:00
Jelle Raaijmakers 284a629ab4 LibGL+LibSoftGPU: Implement more of GL_LIGHT_MODEL_COLOR_CONTROL
This gets rid of a place where OpenGL was leaking into LibSoftGPU.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers 4b6b9f272f LibGL: Use correct GLbyte range in glColor4b
We were only setting half the color intensity that we should have set.
2022-03-27 09:19:43 -07:00
Jelle Raaijmakers ae88c642c6 LibSoftGPU: Test for 1.f equality in determining the scale factor
We are still not doing the right thing here, but using `<=` instead of
`<` at least gets rid of artifacts in Grim Fandango.
2022-03-27 09:19:43 -07:00
Andreas Kling 27c68624b6 LibWeb: Resolve top/bottom inset properties for position:relative
This patch reimplements inset property resolution based on the new
CSS Positioned Layout specification. Nothing should change for
left/right insets, but we gain support for top/bottom. :^)
2022-03-27 18:16:09 +02:00
Andreas Kling fa71401bec LibWeb: Rename ComputedValues::offset() => inset() 2022-03-27 18:16:08 +02:00
Andreas Kling d77dfc6b48 LibWeb: Rename FormattingContext::compute_position() => compute_inset()
This function computes the used inset properties, not the position of a
box per se, so let's call it something more accurate.
2022-03-27 18:16:08 +02:00
Andreas Kling c49c036c84 LibWeb: Stop allowing position:relative to affect layout
Relatively positioned boxes should not affect the *layout* of their
siblings. So instead of applying relative inset as a layout-time
translation on the box, we now perform the adjustment at the paintable
level instead.

This makes position:relative actually work as expected, and exposes some
new bugs we need to take care of for Acid2. :^)
2022-03-27 18:16:08 +02:00
djwisdom 153370e7f4 Base: Update Basic Latin 0020 char to font SatoriMonoRegular 2022-03-27 09:16:03 -07:00
djwisdom a6e91caf5b Base: Update Basic Latin 0020 char to font SatoriBold 2022-03-27 09:16:03 -07:00
djwisdom 6f58aecd8b Base: Update Basic Latin 0020 char to font SatoriRegular 2022-03-27 09:16:03 -07:00
djwisdom cc3eb3d7d8 Base: Update Basic Latin 004F char to font SatoriMonoBold 2022-03-27 09:16:03 -07:00
djwisdom 050bc99d56 Base: Add Latin-1 Supplement chars to font Ataraxia
00A1-00FF
https://www.unicode.org/charts/PDF/U0080.pdf
2022-03-27 09:16:03 -07:00
Karol Kosek 813b9c400d Base: Add Multilingual layout to Colemak
This commit will add additional key combinations from the Colemak
Multilingual page, except of the dead keys.

https://colemak.com/Multilingual
2022-03-27 09:12:50 -07:00
Pankaj Raghav e40d4b2677 Kernel: Remove hardcoded values for block size in IDEChannel 2022-03-27 08:54:32 -07:00