Commit d1c0550
committed
auto merge of #9130 : alexcrichton/rust/inline-globals, r=thestinger
In #8185 cross-crate condition handlers were fixed by ensuring that globals
didn't start appearing in different crates with different addressed. An
unfortunate side effect of that pull request is that constants weren't inlined
across crates (uint::bits is unknown to everything but libstd).
This commit fixes this inlining by using the `available_eternally` linkage
provided by LLVM. It partially reverts #8185, and then adds support for this
linkage type. The main caveat is that not all statics could be inlined into
other crates. Before this patch, all statics were considered "inlineable items",
but an unfortunate side effect of how we deal with `&static` and `&[static]`
means that these two cases cannot be inlined across crates. The translation of
constants was modified to propogate this condition of whether a constant
should be considered inlineable into other crates.
Closes #9036File tree
9 files changed
+157
-59
lines changed- src
- librustc
- metadata
- middle/trans
- test
- auxiliary
- run-pass
9 files changed
+157
-59
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
907 | 909 | | |
908 | 910 | | |
909 | 911 | | |
910 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
911 | 915 | | |
912 | 916 | | |
913 | 917 | | |
| |||
1728 | 1732 | | |
1729 | 1733 | | |
1730 | 1734 | | |
| 1735 | + | |
1731 | 1736 | | |
1732 | 1737 | | |
1733 | 1738 | | |
| |||
1739 | 1744 | | |
1740 | 1745 | | |
1741 | 1746 | | |
| 1747 | + | |
1742 | 1748 | | |
1743 | 1749 | | |
1744 | 1750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2541 | 2541 | | |
2542 | 2542 | | |
2543 | 2543 | | |
2544 | | - | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
2545 | 2558 | | |
2546 | 2559 | | |
2547 | | - | |
| 2560 | + | |
2548 | 2561 | | |
2549 | | - | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
2550 | 2567 | | |
2551 | 2568 | | |
2552 | 2569 | | |
| |||
2997 | 3014 | | |
2998 | 3015 | | |
2999 | 3016 | | |
| 3017 | + | |
3000 | 3018 | | |
3001 | 3019 | | |
3002 | 3020 | | |
| |||
0 commit comments