The IPCCompiler was using GENERATE_DEBUG_CODE, which was missing from
AK/Debug.h.in, and plain old DEBUG. Let's just use the one that
was already in the debug header, but unused.
This enables the Lock class to block a thread even while the thread is
working on a BlockCondition. A thread can still only be either blocked
by a Lock or a BlockCondition.
This also establishes a linked list of threads that are blocked by a
Lock and unblocking directly unlocks threads and wakes them directly.
It's possible that a timer may have been queued to be executed by
the timer irq handler, but if we're in a critical section on the
same processor and are trying to cancel that timer, we would spin
forever waiting for it to be executed.
This re-arranges the order of how things are initialized so that we
try to initialize process and thread management earlier. This is
neccessary because a lot of the code uses the Lock class, which really
needs to have a running scheduler in place so that we can properly
preempt.
This also enables us to potentially initialize some things in parallel.
Instead of each PhysicalPage knowing whether it comes from the
supervisor pages or from the user pages, we can just check in both
sets when freeing a page.
It's just a handful of pointer range checks, nothing expensive.
There appears to be no reason why the process registration needs
to happen under the space spin lock. As the first thread is not started
yet it should be completely uncontested, but it's still bad practice.
If no other thread is ready to be run we don't need to switch to the
idle thread and wait for the next timer interrupt. We can just give
the thread another timeslice and keep it running.
Context menu entries like evaluate expression and
move execution to line action should only be enabled
when a debug session is running. Otherwise they should
be disabled.
This commit disables the run button while we
are in debug mode. Otherwise the stop button
gets disabled when we run the program while
we are in debug mode. This would prevent us
from exiting the debug mode.
Calling is_valid_escape_sequence() with no arguments hides what it
is operating on, so I have removed that, so that you must explicitly
tell it what you are testing.
The call from consume_a_token() was using the wrong tokens, so it
returned false incorrectly. This was resulting in corrupted output
when faced with this code from Acid2. (Abbreviated)
```css
.parser { error: \}; }
.parser { }
```
Had to adjust some places that were using Token.to_string() for
non-debug-logging purposes. Changed its name to to_debug_string()
to make the usage clearer.
Whitespace marks the end of a compound-selector, no matter where
it occurs. `check_for_eof_or_whitespace()` reconsumes the whitespace
token for convenience.
The entry points for CSS parsing in the spec are defined as accepting
any of a stream of Tokens, or a stream of ComponentValues, or a String.
TokenStream is an attempt to reduce the duplication of code for that.
The end goal here is to make the two classes mostly interchangeable, as
the CSS spec requires that the various parser algorithms can take a
stream of either class, and we want to have that functionality without
needing to duplicate all of the code.
Rather than passing a ComponentType, and then manually modifying the
data fields, we now create them initialized.
The constructor that takes a Token is intentionally left implicit,
so that we can automatically convert when using the TokenStream later.
AtStyleRule being a subclass of QualifiedStyleRule was causing
problems when trying to distinguish between them. Combining them
and then distinguishing between them with a Type enum makes that
check simpler, and is in line with how similar checks are done
elsewhere in the parser.
The new one is the same as the old one, just in the new Parser's
source files. This isn't the most elegant solution but it seemed
like the best option. And it's all temporary, after all.
Previous implementation was returning everything in a single Vector,
when what we really want is a Vector of Vectors, one for each comma-
separated part of the list.
Optional seems like a good idea, but in many places we were not
checking if it had a value, which was causing crashes when the
Tokenizer was given malformed input. Using an EOF value along with
is_eof() makes things a lot simpler.
This is very much stubbed out for now. Most notably is
Parser::convert_rule() where most of the conversion will happen
from the parser's internal rule classes to CSSRule and its children.