Commit Graph

21759 Commits

Author SHA1 Message Date
Apoorv Mishra
5d57384bc4 Meta: Check installed QEMU version
`ninja install` fails with a clueless error message if the installed
QEMU version is less than 5.0.
2021-06-09 18:53:32 +02:00
Jelle Raaijmakers
340f6cde2d Ports: Use shared icon logic for ScummVM 2021-06-09 18:53:21 +02:00
Sam Atkins
6f92d1e639 LibGUI: Set TextEditor to unmodified after saving size=0 files
This fixes #7946

Previously, TextEditor::write_to_file() would not mark its document
as unmodified if the file size was 0. This caused a desync in the
Text Editor app between the window's is_modified state and the
TextEditor's. It's already noted in the comments of the app's
save action code that propagating the modified state automatically
would be good, and it would solve issues like this, but I'm not yet
familiar enough with the code to try a change like that.
2021-06-09 18:53:13 +02:00
Andreas Kling
5b47e9b39a Meta: Remove references to the abandoned IRC channel 2021-06-09 18:38:25 +02:00
Idan Horowitz
ad0e3c0e54 LibJS: Mark heap cell values stored in Set instances
This makes sure they dont get garbage collected while stored in a Set.
2021-06-09 17:05:53 +01:00
Gunnar Beutner
6a0d1fa259 LibJS: Store strings in a string table
Instead of using Strings in the bytecode ops this adds a global string
table to the Executable struct which individual operations can refer
to using indices. This brings bytecode ops one step closer to being
pointer free.
2021-06-09 17:42:52 +02:00
Max Wipfli
4efccbd030 LookupServer: Watch /etc/hosts for changes during runtime
This adds a FileWatcher to the LookupServer which watches '/etc/hosts'
for changes during runtime and reloads its contents. If the file is
deleted, m_etc_hosts will be cleared.

Since we now need to access '/etc/hosts' later during runtime, it needs
to be unveiled with read permissions.
2021-06-09 17:43:32 +04:30
Max Wipfli
7b39db3bf4 LookupServer: Check for hostname after /etc/hosts
If the hostname is not in /etc/hosts, looking it up should return
127.0.0.1.
2021-06-09 17:43:32 +04:30
Max Wipfli
12feb79cef LookupServer: Make DNSName::operator== ignore case 2021-06-09 17:43:32 +04:30
Max Wipfli
95d4d36b5c LookupServer: Modernize load_etc_hosts()
This reworks the LookupServer::load_etc_hosts() method to use the
IPv4Address APIs instead of trying to parse an IPv4 address itself.

It also adds a few error checks for invalid entries in /etc/hosts,
trims away leading and trailing whitespace from lines and tries to use
StringView over String.
2021-06-09 17:43:32 +04:30
Max Wipfli
d1dae5f4d1 AK: Implement IPv4Address::to_string_reversed() 2021-06-09 17:43:32 +04:30
Gunnar Beutner
a4d5745e2f Ports: Remove checksum for the stpuzzles port
The Git repository is hosted on GitHub and is owned by the SerenityOS
GitHub organization which means our root of trust is GitHub anyway
(where did you get _this_ repository from?) So let's remove the
checksum.
2021-06-09 17:39:00 +04:30
Gunnar Beutner
a5e6a373cc Ports: Embed icons for the stpuzzles port 2021-06-09 17:39:00 +04:30
Max Trussell
b889bfe0f6 Ports: .port_include.sh add install_icon function 2021-06-09 17:37:56 +04:30
Nick Miller
23d5b99fbf LibAudio: Make Loader::seek() treat its input as a sample index
This fixes a bug where if you try to play a Wave file a second
time (or loop with `aplay -l`), the second time will be pure
noise.

The function `Audio::Loader::seek` is meant to seek to a specific
audio sample, e.g. seek(0) should go to the first audio sample.
However, WavLoader was interpreting seek(0) as the beginning
of the file or stream, which contains non-audio header data.

This fixes the bug by capturing the byte offset of the start of the
audio data, and offseting the raw file/stream seek by that amount.
2021-06-09 17:30:08 +04:30
Idan Horowitz
2a3090d292 LibJS: Add the SetIterator built-in and Set.prototype.{values, entries}
While this implementation should be complete it is based on HashTable's
iterator, which currently follows bucket-order instead of the required
insertion order. This can be simply fixed by replacing the underlying
HashTable member in Set with an enhanced one that maintains a linked
list in insertion order.
2021-06-09 11:48:04 +01:00
Idan Horowitz
0b0f1eda05 LibJS: Add most of the Set.prototype methods
Specifically all aside from "values" and "entries" which require an
implementation of the SetIterator object.
2021-06-09 11:48:04 +01:00
Idan Horowitz
670be04c81 LibJS: Add the Set built-in object 2021-06-09 11:48:04 +01:00
Idan Horowitz
b17a282b4b LibCrypto: Add hash methods to {Signed, Unsigned}BigInteger
These just use hash the underlying bytes that make up the integer words
2021-06-09 11:48:04 +01:00
Idan Horowitz
71c54198fa AK: Allow changing the HashTable behaviour for sets on existing entries
Specifically, replacing the existing entry or just keeping it and
canceling the set.
2021-06-09 11:48:04 +01:00
Andreas Kling
59eedd6de0 LibJS: Implement bytecode generation for UpdateExpression :^)
Added Increment and Decrement bytecode ops to support this. Postfix
updates use a temporary register to preserve the original value.

Note that this patch only implements Identifier updates. Member
expression updates are a TODO.
2021-06-09 11:40:38 +02:00
Andreas Kling
5c98f979c6 LibJS: Simplify the way we stringify bytecode instructions
For instructions that only have a single operand, omit the operand
name since it's implied anyway.
2021-06-09 11:06:11 +02:00
Brian Gianforcaro
aa63fe20a5 Kernel: Mark VirtIOConsole constructor as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
7e88ac63b9 Kernel: Mark VirtIORNG constructor as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
d27cecd729 Kernel: Mark VirtIO detection/creation functions as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
80a3cc47e5 Kernel: Mark MMIOAccess detection function as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
40ea464fb0 Kernel: Mark PCI Access enumeration functions as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
9e6f0fd925 Kernel: Mark SyncTask::spawn() as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
83841e47e5 Kernel: Mark FinalizerTask::spawn() as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
c8b6bd4b97 Kernel: Mark WorkQueue initailzation functions as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
b5d388a9b3 Kernel: Mark NE2000NetworkAdapter::ram_test() UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
e9add0bb80 Kernel: Mark E1000NetworkAdapter is_valid_device_id(..) UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Brian Gianforcaro
f124affc8e Kernel: Mark PCISerialDevice::detect() as UNMAP_AFTER_INIT 2021-06-09 10:57:51 +02:00
Erik Biederstadt
61bd1890d2 LibGL: Implement very basic version of glGetFloatv
This is a very basic implementation of glGetfloatv. It will only give a
result when used with GL_MODELVIEW_MATRIX. In the future
 we can update and extend it's functionality.
2021-06-09 10:49:38 +02:00
Andreas Kling
99ffcc28c2 LibJS: Print the name of AST nodes that are missing generate_bytecode()
This way you know which one it is right away. :^)
2021-06-09 09:32:09 +02:00
Gunnar Beutner
764a41e284 LibCore: Fix building LibCore on FreeBSD 2021-06-09 09:24:58 +02:00
Andreas Kling
a8ccc9580d LibJS: Move Instruction::length() to the Op.h header
Make sure this gets inlined as well, as it's used by the bytecode
stream iterator and thus extremely hot.
2021-06-09 09:24:32 +02:00
Andreas Kling
48a8022cf6 LibJS: Move Bytecode::Instruction::execute() to the Op.h header
..and make sure it always gets inlined in the interpreter loop.
2021-06-09 09:24:32 +02:00
Andreas Kling
b61f198d22 LibJS: Rename Bytecode::ExecutionUnit => Bytecode::Executable 2021-06-09 09:24:32 +02:00
Luke
597e0d95fe LibJS: Only set element in array literal to an empty value if it's null
This avoids an unnecessary empty load that immediately gets overridden.

For example, `[1,,]` would appear as:
[   0] EnterScope
[  10] LoadImmediate value:<empty>
[  28] LoadImmediate value:1
[  40] Store dst:$1
[  48] LoadImmediate value:<empty>
[  60] Store dst:$2
[  68] NewArray, elements:[$1,$2]

But now appears as:
[   0] EnterScope
[  10] LoadImmediate value:1
[  28] Store dst:$1
[  30] LoadImmediate value:<empty>
[  48] Store dst:$2
[  50] NewArray, elements:[$1,$2]
2021-06-09 09:14:40 +02:00
Ali Mohammad Pur
01e8f0889a LibJS: Generate bytecode in basic blocks instead of one big block
This limits the size of each block (currently set to 1K), and gets us
closer to a canonical, more easily analysable bytecode format.
As a result of this, "Labels" are now simply entries to basic blocks.
Since there is no more 'conditional' jump (as all jumps are always
taken), JumpIf{True,False} are unified to JumpConditional, and
JumpIfNullish is renamed to JumpNullish.
Also fixes #7914 as a result of reimplementing the loop logic.
2021-06-09 09:07:29 +02:00
brapru
d7a25cdb82 Utilities: Do not allow creating users with existing usernames
Previously useradd would not check if a username already existed on the
system, and would instead add the user anyway and just increment the
uid. useradd should instead return an error when the user attempts to
create already existing users.
2021-06-09 09:00:31 +02:00
Matthew Olsson
f286cf1792 LibJS: Fix not executing the expression of a return statement 2021-06-09 01:33:38 +02:00
Gunnar Beutner
a1e5711a27 LibJS: Generate bytecode for array expressions 2021-06-09 01:27:18 +02:00
Andreas Kling
b8a5ea1f8d Revert "LibJS: Add bytecode instruction handles"
This reverts commit a01bd35c67.

This broke simple programs like:

function sum(a, b) { return a + b; }
console.log(sum(1, 2));
2021-06-09 00:50:42 +02:00
Matthew Olsson
a01bd35c67 LibJS: Add bytecode instruction handles
This change removes the mmap inside of Block in favor of a growing
vector of bytes. This is favorable for two reasons:
  - We don't take more space than we need
  - There is no limit to the growth of the vector (previously, if
    the Block overstepped its 64kb boundary, it would just crash)

However, if that vector happens to resize, any pointer pointing into
that vector would become invalid. To avoid this, this commit adds an
InstructionHandle<Op> class which just stores a block and an offset
into that block.
2021-06-09 00:37:17 +02:00
Linus Groh
83be39c91a LibJS: Handle Proxy with Array target in IsArray() abstract operation
This was missing from Value::is_array(), which is equivalent to the
spec's IsArray() abstract operation - it treats a Proxy value with an
Array target object as being an Array.
It can throw, so needs both the global object and an exception check
now.
2021-06-08 23:53:13 +02:00
Linus Groh
9b35231453 LibJS: Implement Proxy.revocable() 2021-06-08 23:53:13 +02:00
Linus Groh
e39dd65cf0 LibJS: Remove Proxy() argument count check
Let's just treat missing arguments as undefined and throw with
'target/handler must be object' - this is more JavaScript-y.
2021-06-08 23:53:13 +02:00
Gunnar Beutner
5ff85abe8c LibJS: Make sure loop results are initialized
This ensures that "while", do...while, "for" expressions have a
properly initialized result value even if the user terminated
the loop body via break or the loop body wasn't executed at all.
2021-06-08 21:49:52 +01:00