Commit Graph

2993 Commits

Author SHA1 Message Date
bjorn3
b14c7337db Update to Cranelift 0.87.0 2022-08-22 18:53:10 +00:00
Matthias Krüger
5a9b11648f Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm
Replace most uses of `pointer::offset` with `add` and `sub`

As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts.

This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things.

r? ````@scottmcm````

_split off from #100746_
2022-08-21 16:54:07 +02:00
Waffle Maybe
5f357c2c51 fix cg cranelift
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-08-21 05:27:14 +04:00
Waffle Maybe
63a137605f use shorter ptr_mask impl in cg cranelift
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2022-08-21 05:27:14 +04:00
Maybe Waffle
5b32aa0747 Add pointer masking convenience functions
This commit adds the following functions all of which have a signature
`pointer, usize -> pointer`:
- `<*mut T>::mask`
- `<*const T>::mask`
- `intrinsics::ptr_mask`

These functions are equivalent to `.map_addr(|a| a & mask)` but they
utilize `llvm.ptrmask` llvm intrinsic.

*masks your pointers*
2022-08-21 05:27:14 +04:00
Maybe Waffle
bd1ab72406 Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
bjorn3
7dc8f38956
Merge pull request #1266 from bjorn3/parallel_comp_refactor2
Refactorings for enabling parallel compilation (part 2)
2022-08-19 12:03:43 +02:00
Dylan DPC
ee65a1018f Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkov
make NOP dyn casts not require anything about the vtable

As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
2022-08-19 12:26:41 +05:30
bjorn3
535c6ddc8b Small cleanup 2022-08-18 19:03:28 +00:00
bjorn3
6421427b74 Move Span lowering from debuginfo finalization to codegen
This removes the dependency on TyCtxt from the debuginfo finalization
code.
2022-08-18 18:19:40 +00:00
bjorn3
0534a555cc Make line_program_add_file a DebugContext method 2022-08-18 17:48:22 +00:00
bjorn3
1e57774011 Move set_function_span earlier 2022-08-18 17:23:36 +00:00
bjorn3
01be0ddacf Move FunctionDebugContext creation to codegen_fn 2022-08-18 17:17:33 +00:00
bjorn3
dbf5457308 Introduce FunctionDebugContext
This will make it easier to move TyCtxt requiring operations before clif
ir compilation.
2022-08-18 17:11:41 +00:00
bjorn3
312563f3c4 Use walk_chain for function span too
This is a correctness fix
2022-08-18 15:58:22 +00:00
bjorn3
259b21fd46 Remove TyCtxt from DebugContext
And explicitly thread it through everwhere it is needed.
2022-08-18 15:25:52 +00:00
bjorn3
e5493a5ea2 Remove Instance param of DebugContext::define_function 2022-08-18 15:25:47 +00:00
bjorn3
a49416da6d Remove stub local debuginfo implementation
It isn't actually wired up and temporarily removing it will make changes
to the debuginfo generation code much simpler.
2022-08-18 15:14:04 +00:00
bjorn3
5fc1366dfa Register debuginfo for lazy jit shim 2022-08-18 12:55:44 +00:00
bjorn3
4dac65fcbd
Merge pull request #1265 from afonso360/stack_store
Use `stack_store` instead of `stack_addr`+`store` when building structs
2022-08-17 16:51:02 +02:00
bjorn3
df1b25171c Remove TyCtxt parameter from compile_fn 2022-08-17 13:47:52 +00:00
Afonso Bordado
2079b4bb08 Use stack_store instead of stack_addr+store when building structs 2022-08-17 14:46:05 +01:00
bjorn3
c820b7cd60 Remove TyCtxt field from CodegenCx 2022-08-17 13:43:32 +00:00
bjorn3
b181f2b376 Replace instance param of write_clif_file with symbol_name 2022-08-17 13:07:18 +00:00
bjorn3
701b2747c3 Remove optimize_function
It currently doesn't have any optimizations at all.
2022-08-17 13:03:32 +00:00
bjorn3
1cac888e43 Rustup to rustc 1.65.0-nightly (801821d15 2022-08-14) 2022-08-15 16:21:41 +02:00
bjorn3
fd428c0760 Sync from rust 6ce76091c7 2022-08-15 16:17:32 +02:00
bjorn3
1662702a88 Work around new asm! usage in measureme
This is necessary to fix rustc bootstraps
2022-08-14 16:37:30 +00:00
bjorn3
523f0db7db
Merge pull request #1264 from bjorn3/parallel_comp_refactor
Refactorings for enabling parallel compilation (part 1)
2022-08-13 16:53:28 +02:00
bjorn3
9461fd2cb0 Remove TyCtxt parameter from emit_cgu
TyCtxt isn't available on background threads.
2022-08-13 12:18:41 +00:00
bjorn3
4c0766ce6c Move error reporting out of emit_cgu
Error reporting requires a Session, which isn't available on background
threads.
2022-08-13 09:03:28 +00:00
Afonso Bordado
484041cefe
Rename abi-checker patch (#1262) 2022-08-13 11:02:16 +02:00
bjorn3
8c407e0fb4
Merge pull request #1255 from afonso360/abi-checker
Add abi-checker to y.rs and run it on CI
2022-08-13 08:34:55 +02:00
Afonso Bordado
69c6749aee Disable some abi-checker tests 2022-08-12 23:58:24 +01:00
Afonso Bordado
0706df5f8c Update abi-checker version 2022-08-12 21:47:36 +01:00
bjorn3
c2f0b3a1bf Move copy to incr comp cache to codegen join phase
The copy depends on Session, which is only available on the main thread.
As such the copy can't be done on future codegen threads.
2022-08-12 19:10:16 +00:00
bjorn3
6206c4e927 Stream object file to disk
This reduces memory usage and may improve performance slightly.
2022-08-12 18:57:01 +00:00
bjorn3
ab7c706306 Move build_isa call into make_module 2022-08-12 18:40:48 +00:00
bjorn3
d3512b1d8e Don't attempt to do incr comp for the allocator shim
The allocator shim doesn't get reused and the allocator shim is just
under 2kb, so reusing it is likely more expensive than regenerating it.
2022-08-12 18:29:46 +00:00
bjorn3
db7d8a811d Give fields of ModuleCodegenResult names 2022-08-12 18:29:43 +00:00
bjorn3
57818ce824
Merge pull request #1260 from uweigand/s390x-ignore-aligntest
Ignore ptr_bitops_tagging test on s390x
2022-08-12 14:40:21 +02:00
bjorn3
f76ca22479 Enable inline asm on macOS 2022-08-12 12:38:48 +00:00
bjorn3
e45f6000a0 Remove the partial linking hack for global asm support 2022-08-12 12:27:47 +00:00
Ulrich Weigand
8bcab19018 Ignore ptr_bitops_tagging test on s390x
This test requires dynamic stack re-alignment on s390x, which is
currently unsupported (see issue #1258).
2022-08-12 13:46:31 +02:00
bjorn3
48b312f04a Don't take TyCtxt as argument for compile_global_asm
This allows it to be executed on a background thread.
2022-08-12 11:44:52 +00:00
bjorn3
64c73d0b3c
Merge pull request #1257 from uweigand/memcpy-align
Fix alignment flag for emit_small_memory_copy
2022-08-12 13:14:14 +02:00
Ulrich Weigand
aca05cf603 Fix alignment flag for emit_small_memory_copy
Do not unconditionally pass the "aligned" MemFlag when calling
emit_small_memory_copy.  Instead, allow the back end to rely on
the alignment info passed separately to this routine.
2022-08-12 12:54:41 +02:00
bjorn3
066f844fff Move some sess.fatal calls out of compile_global_asm 2022-08-12 09:28:41 +00:00
bjorn3
7cc97ebcbb Extract global_asm module 2022-08-12 09:11:47 +00:00
bjorn3
c5adc96532 Introduce OngoingCodegen type 2022-08-11 13:49:08 +00:00