Skip to content

Commit

Permalink
Auto merge of #122662 - Mark-Simulacrum:optional-drop, r=bjorn3
Browse files Browse the repository at this point in the history
Omit non-needs_drop drop_in_place in vtables

This replaces the drop_in_place reference with null in vtables. On librustc_driver.so, this drops about ~17k (11%) dynamic relocations from the output, since many vtables can now be placed in read-only memory, rather than having a relocated pointer included.

This makes a tradeoff by adding a null check at vtable call sites. I'm not sure that's readily avoidable without changing the vtable format (e.g., so that we can use a pc-relative relocation instead of an absolute address, and avoid the dynamic relocation that way). But it seems likely that the check is cheap at runtime.

Accepted MCP: rust-lang/compiler-team#730
  • Loading branch information
bors committed May 28, 2024
2 parents 5763074 + 6744092 commit 59bbd30
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 59bbd30

Please sign in to comment.