Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improper handling of inlined blocks in inline-blocks transform #86

Merged
merged 1 commit into from
Jan 1, 2024

Conversation

bitwalker
Copy link
Contributor

This patches the inline-blocks pass to ensure that inlined blocks are not visited multiple times by the inliner - once inlined, these blocks are treated as not inlineable from that point forward, allowing us to visit successor blocks with the inliner normally without considering the inlined block itself.

Additionally, the following issues are addressed:

  • We did not raise an error if attempting to remove a node from its OrderedArenaMap if it had already been removed. These nodes remain accessible via the map so that outstanding references are still usable, but are treated in all other respects as if they are not contained in the map - this was not being handled properly by remove
  • The link field of BlockData was superfluous and has been for some time, but was missed because it is a public field of a public struct, and there are places where we were incorrectly referencing this field as if it was in use. In fact, the link field we care about is the one associated with the LayoutNode used by OrderedArenaMap, and the BlockData one was never linked into anything, resulting in some places incorrectly treating blocks as detached when they were in fact attached.

Closes #85

I'll merge #83 after this is merged

This patches the inline-blocks pass to ensure that inlined blocks are
not visited multiple times by the inliner - once inlined, these blocks
are treated as not inlineable from that point forward, allowing us to
visit successor blocks with the inliner normally without considering the
inlined block itself.

Additionally, the following issues are addressed:

* We did not raise an error if attempting to remove a node from its
  OrderedArenaMap if it had already been removed. These nodes remain
  accessible via the map so that outstanding references are still
  usable, but are treated in all other respects as if they are not
  contained in the map - this was not being handled properly by `remove`
* The `link` field of `BlockData` was superfluous and has been for some
  time, but was missed because it is a public field of a public struct,
  and there are places where we were incorrectly referencing this field
  as if it was in use. In fact, the `link` field we care about is the
  one associated with the `LayoutNode` used by `OrderedArenaMap`, and
  the `BlockData` one was never linked into anything, resulting in some
  places incorrectly treating blocks as detached when they were in fact
  attached.

Closes #85
@bitwalker bitwalker added bug Something isn't working blocker This issue is one of our top priorities labels Dec 30, 2023
@bitwalker bitwalker requested a review from greenhat December 30, 2023 04:07
@bitwalker bitwalker self-assigned this Dec 30, 2023
Copy link
Contributor

@greenhat greenhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

Copy link
Contributor

@greenhat greenhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@bitwalker bitwalker merged commit 3ecede9 into main Jan 1, 2024
1 check passed
@bitwalker bitwalker deleted the bitwalker/fix-85 branch January 1, 2024 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker This issue is one of our top priorities bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InlineBlocks pass crashes with (signal: 11, SIGSEGV: invalid memory reference)
2 participants