Skip to content

Releases: google/emboss

v2024.1221.181843

21 Dec 18:18
1827594
Compare
Choose a tag to compare
Handle very large `.emb` files. (#215)

This change switches parse tree handling to use iteration (with an
explicit stack) instead of recursion, which:

*   Allows large (>~1000 entity) `.emb` files to be formatted.
*   Allows very large (>~16k entity) `.emb` files to be compiled.

The difference in sizes in the previous code was due to `module_ir.py`
hackily increasing the recursion limit: while this more or less worked,
it was a little dangerous (it ran the risk of blowing out the C stack,
depending on platform) and only increased the limit.  This change
removes the limit entirely (at least, up to the available memory on the
system).

v2024.1219.234851

19 Dec 23:48
615a955
Compare
Choose a tag to compare
Add `alignas` specifier to buffer in explicit alignment test. (#216)

Also update workflow to emit test logs on failure.

v2024.1218.230943

18 Dec 23:09
bb45c18
Compare
Choose a tag to compare
Add docs for would-be contributors. (#213)

v2024.1218.215136

18 Dec 21:51
75bdc4c
Compare
Choose a tag to compare
Add error message for obscure case with parameters. (#214)

Prior to this change, if a user omitted the length of an integer
parameter *and* used that parameter as an argument to an operator or
function, the compiler with throw an `AttributeError` instead of
providing a useful message.

This is because the check that integer runtime parameters have an
explicit size happened later than the function in `expression_bounds.py`
that tried to use the size.

This change moves the check earlier (incidentally spliting
`check_constraints` into `check_constraints` and
`check_early_constraints`), and also gives it a better error message.

v2024.1205.195338

05 Dec 19:53
35220b7
Compare
Choose a tag to compare
Fix tests under `bazel test -c opt`. (#212)

With certain versions of GCC, `bazel test -c opt ...` failed, apparently
due to a compiler bug.

This change:

1.  Adds a workaround for the GCC bug.
2.  Enables the workaround on versions of GCC known to have the bug.
3.  Documents the bug (in comments).
4.  Enables testing with `-c opt` as part of the commit hook.

Note that the versions covered by #2 are a little wider than may be
technically necessary.  As of the time of writing, this affects all
released versions of GCC from 12.1 through 14.1, but the GCC fix has
been backported to the 12.X and 13.X branches.  It may be possible
to reduce the workaround's scope once those are released.

v2024.1120.233102

20 Nov 23:31
d7c0ba3
Compare
Choose a tag to compare
Add test profiles that disable all `EMBOSS_CHECK`s. (#211)

This catches cases where C++ code inadvertently includes side effects
inside of an `EMBOSS_CHECK`; the default `EMBOSS_CHECK` uses `assert`,
which will be omitted when `NDEBUG` is defined.

v2024.1017.203246

17 Oct 20:32
73cbd98
Compare
Choose a tag to compare
Convert Location to a namedtuple, and associated cleanup (#205)

This change makes the `Location` dataclass, which does not change
frequently, into a new `SourceLocation` namedtuple, and changes the
`SourceLocation` serialization.  As a result, with this change:

*   `embossc` runs about 25% faster on a large (7kLOC) input; `python3
    -OO emboss` runs about 19% faster on the same input.
*   Serialized IR is about 45% smaller.

Details:

*   Replace the `ir_data.Location` dataclass with a new
    `parser_types.SourceLocation` namedtuple.  The rename helps clarify
    the difference between a location within source code
    (`SourceLocation`) and a location within a structure
    (`FieldLocation`).
*   Similarly, replace `ir_data.Position` with
    `parser_types.SourcePosition`.
*   Update any place that edits a `SourceLocation` with an appropriate
    assignment; e.g., `x.source_location.end = y` becomes
    `x.source_location = x.source_location._replace(end=y)`.  In most
    cases, several fields were updated consecutively; those updates are
    been merged.
*   Update the JSON serialization to use the compact format.
*   Replace `format_location()` and `format_position()` with
    `__str__()` methods on `SourceLocation` and `SourcePosition`,
    respectively.
*   Replace `parse_location()` and `parse_position()` with `from_str()`
    class methods on `SourceLocation` and `SourcePosition`,
    respectively.
*   Move the `make_location()` functionality into
    `SourceLocation.__new__()`.
*   Update `_to_dict` and `_from_dict` in `IrDataSerializer` to
    stringify and destringify `SourceLocation`.  It is tempting to
    try to do this during the JSON serialization step (with a `default=`
    parameter to `json.dumps` and an `object_hook=` parameter to
    `json.loads`), but it is tricky to get the `object_hook` to know
    when to convert.

v2024.1011.225822

11 Oct 22:58
46423da
Compare
Choose a tag to compare
Emit a warning when the cached parser is not used. (#204)

This change checks to see if the cached parser was discarded due to a
mismatch between the cached parser and the grammar specified in
module_ir.py, and, if so, emits a warning that the cached parser was not
used, along with informational messages on the nature of the mismatch.

Adjusted the "warning" color from magenta to yellow.  (This is the first
warning in Emboss, so no magenta messages would have ever been emitted.)

Adjusted the "note" color from "bright black" (dark grey) to "white"
(light grey), becaused at least some terminals display "bright black"
as just black.

v2024.1011.195933

11 Oct 19:59
bd276c4
Compare
Choose a tag to compare
Replace `WhichOneof("x")` with `which_x`.  (#197)

This change refactors `OneOfField` so that all fields in a given `oneof`
construct share the same backing attributes on their container class --
`which_{oneof name}`, which holds the (string) name of the
currently-active member of the oneof named `{oneof name}` (or `None` if
no member is active), and `_value_{oneof name}`, which holds the value
of the currently-active member (or `None`).

This avoids looping through field specs in order to do an update or to
figure out which member of a `oneof` is currently active.

Since the `WhichOneof()` method is now a trivial read of a
similarly-named attribute, it can be inlined for a small decrease in
overall code size and without sacrificing readability.

As a result of these changes, the compiler now runs 4.5% faster on my
large test `.emb`.

v2024.1010.220729

10 Oct 22:07
96675c9
Compare
Choose a tag to compare
Fix test name. (#203)