Commit graph

3 commits

Author SHA1 Message Date
Matthew Maurer b53a0f2c9e CFI: Add test for call_once addr taken
One of the proposed ways to reduce the non-passed argument erasure would
cause this test to fail. Adding this now ensures that any attempt to
reduce non-passed argument erasure won't make the same mistake.
2024-04-04 22:06:58 +00:00
Matthew Maurer 473a70de84 CFI: Support function pointers for trait methods
Adds support for both CFI and KCFI for attaching concrete and abstract
types to functions. KCFI does this through generation of `ReifyShim` on
any function pointer that could go in a vtable, and checking the
`ReifyReason` when emitting the instance. CFI does this by attaching
both the concrete and abstract type to every instance.

TypeID codegen tests are switched to be anchored on the left rather than
the right in order to allow emission of additional type attachments.

Fixes #115953
2024-04-02 19:11:16 +00:00
Matthew Maurer 8cc9a912d7 CFI: Rewrite closure and coroutine instances to their trait method
Similar to methods on a trait object, the most common way to indirectly
call a closure or coroutine is through the vtable on the appropriate
trait. This uses the same approach as we use for trait methods, after
backing out the trait arguments from the type.
2024-03-30 16:40:38 +00:00