Skip to content

Fix assertion in OptimizeInstructions for exact refs - #7354

Merged
tlively merged 3 commits into
mainfrom
optimize-insts-exact
Mar 11, 2025
Merged

Fix assertion in OptimizeInstructions for exact refs#7354
tlively merged 3 commits into
mainfrom
optimize-insts-exact

Conversation

@tlively

@tlively tlively commented Mar 8, 2025

Copy link
Copy Markdown
Member

When optimizing a cast to an exact reference to a bottom type,
OptimizeInstructions previously triggered an assertion that expected the
cast type to be inexact. Fix the assertion and surrounding code to be
more robust to the presence of exact reference types and add a test.

tlively added 2 commits March 7, 2025 17:26
Update the finalization of all instructions whose types (or sent types)
depend on their operand reference types to handle exact references
correctly. Specifically, update `ref.as_non_null`, `br_on_null`,
`br_on_non_null`, `br_on_cast`, and `br_on_cast_fail`. Also add TODOs on
all instructions that allocate new heap objects to remind us to make
their types exact in the future.
When optimizing a cast to an exact reference to a bottom type,
OptimizeInstructions previously triggered an assertion that expected the
cast type to be inexact. Fix the assertion and surrounding code to be
more robust to the presence of exact reference types and add a test.
@tlively
tlively requested a review from kripken March 8, 2025 03:33
Base automatically changed from exact-finalization to main March 11, 2025 00:32
@tlively
tlively merged commit 894c770 into main Mar 11, 2025
@tlively
tlively deleted the optimize-insts-exact branch March 11, 2025 04:39
tlively added a commit that referenced this pull request Mar 26, 2025
We decided that Custom Descriptors should introduce exact heap types
rather than exact reference types. Although these new features are very
similar, the APIs we need to change for them are completely different.

One option would have been to keep the existing exact reference type
implementation while additionally implementing exact heap types, but
there are not enough free bits in the type implementation to have both
at once without increasing the alignment of HeapTypeInfo allocations.
Portably increasing the alignment is annoying enough that it's easier to
just eagerly remove exact reference types to free up the bit for use
with exact heap types.

Fully or partially revert the following PRs:

 - #7371
 - #7365
 - #7360
 - #7357
 - #7356
 - #7355
 - #7354
 - #7353
 - #7347
 - #7342
 - #7328

Keep the new `.with(...)` Type APIs and the relevant parts of the type
relations gtest that were introduced as part of the reverted work.
tlively added a commit that referenced this pull request Mar 26, 2025
We decided that Custom Descriptors should introduce exact heap types
rather than exact reference types. Although these new features are very
similar, the APIs we need to change for them are completely different.

One option would have been to keep the existing exact reference type
implementation while additionally implementing exact heap types, but
there are not enough free bits in the type implementation to have both
at once without increasing the alignment of HeapTypeInfo allocations.
Portably increasing the alignment is annoying enough that it's easier to
just eagerly remove exact reference types to free up the bit for use
with exact heap types.

Fully or partially revert the following PRs:

 - #7371
 - #7365
 - #7360
 - #7357
 - #7356
 - #7355
 - #7354
 - #7353
 - #7347
 - #7342
 - #7328

Keep the new `.with(...)` Type APIs and the relevant parts of the type
relations gtest that were introduced as part of the reverted work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants