Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dyn*'s value backend type a pointer #107772

Merged
merged 5 commits into from
Feb 19, 2023

Conversation

compiler-errors
Copy link
Member

One tweak on top of Ralf's commit should fix using usize as a dyn*-coercible type, and should fix when we're using various other pointer types when LLVM opaque pointers is disabled.

r? @eholk but feel free to reassign
cc #107728 (comment) @RalfJung

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 7, 2023
@compiler-errors compiler-errors force-pushed the dyn-star-backend-is-ptr branch 2 times, most recently from 1fbad25 to f4a0097 Compare February 7, 2023 19:53
@eholk
Copy link
Contributor

eholk commented Feb 8, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Feb 8, 2023

📌 Commit f4a0097f3119667b0f3d9ceceec9a49a4d1ec564 has been approved by eholk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 8, 2023
@erikdesjardins
Copy link
Contributor

It would be good to add a case to tests/codegen/function-arguments.rs showing the ABI of dyn*; something like

// CHECK: { {{i8\*|ptr}}, {{i8\*|ptr}} } @dyn_star({{i8\*|ptr}} noundef align 1 %x.0, {{i8\*|ptr}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %x.1)
#[no_mangle]
pub fn dyn_star(x: dyn* Drop) -> dyn* Drop {
  x
}

Comment on lines +279 to +282
// FIXME(dyn-star): We probably have to do a bitcast first, then inttoptr.
kind => bug!("unexpected TypeKind for left-hand side of `dyn*` cast: {kind:?}"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be hit by using a type such as

#[repr(C)]
struct S(usize);

and then doing S(0) as dyn* Send or something like that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's broken for another reason (#104694), which I plan on rebasing/reworking once your Miri support for dyn* PR lands.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's not surprising -- I assume so far this has only been tested with types that have Scalar layout.

(i32, i32) would also be an interesting testcase, that will have ScalarPair layout. Also better left for a future PR, probably.

@matthiaskrgr
Copy link
Member

@bors rollup=never
bumping this up in the queue

@compiler-errors
Copy link
Member Author

@bors r- i'll address ralf's comments today

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 10, 2023
@compiler-errors compiler-errors force-pushed the dyn-star-backend-is-ptr branch 2 times, most recently from 2078fff to adc351c Compare February 10, 2023 18:34
@compiler-errors
Copy link
Member Author

@bors r=eholk

@bors
Copy link
Contributor

bors commented Feb 10, 2023

📌 Commit adc351cadf47722f149d30b40b0136a3cfcbfdef has been approved by eholk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 10, 2023
@compiler-errors
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 11, 2023
@compiler-errors compiler-errors force-pushed the dyn-star-backend-is-ptr branch 5 times, most recently from dca87df to 8c4eb8d Compare February 11, 2023 04:01
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 18, 2023
@bors
Copy link
Contributor

bors commented Feb 18, 2023

⌛ Testing commit 7f798c2 with merge 23d857844c85097003539b8f2e2b9a4707cf266a...

@bors
Copy link
Contributor

bors commented Feb 18, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 18, 2023
@compiler-errors
Copy link
Member Author

It didn't even start testing?

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 19, 2023
@bors
Copy link
Contributor

bors commented Feb 19, 2023

⌛ Testing commit 7f798c2 with merge 6910affab408ca9a6fcf649ae16a3b58d1d7c1a7...

@bors
Copy link
Contributor

bors commented Feb 19, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 19, 2023
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-mingw-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[2579/3025] Linking CXX static library lib\libLLVMInstrumentation.a
[2580/3025] Building CXX object tools/llvm-ar/CMakeFiles/llvm-ar.dir/llvm-ar.cpp.obj
[2581/3025] Linking CXX executable bin\not.exe
[2582/3025] Linking CXX static library lib\libLLVMInstCombine.a
FAILED: lib/libLLVMInstCombine.a 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E rm -f lib\libLLVMInstCombine.a && D:\a\rust\rust\mingw64\bin\ar.exe qc lib\libLLVMInstCombine.a  lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstructionCombining.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineAddSub.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineAtomicRMW.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineAndOrXor.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineCalls.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineCasts.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineCompares.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineLoadStoreAlloca.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineMulDivRem.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineNegator.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombinePHI.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineSelect.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineShifts.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineSimplifyDemanded.cpp.obj lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombineVectorOps.cpp.obj && D:\a\rust\rust\mingw64\bin\ranlib.exe lib\libLLVMInstCombine.a && cd ."
D:\a\rust\rust\mingw64\bin\ranlib.exe: could not create temporary file whilst writing archive: no more archived files
[2583/3025] Linking CXX static library lib\libLLVMObjCARCOpts.a
[2584/3025] Linking CXX static library lib\libLLVMLinker.a
[2585/3025] Linking CXX executable bin\yaml-bench.exe
[2586/3025] Building CXX object tools/llvm-lto/CMakeFiles/llvm-lto.dir/llvm-lto.cpp.obj
[2586/3025] Building CXX object tools/llvm-lto/CMakeFiles/llvm-lto.dir/llvm-lto.cpp.obj
[2587/3025] Linking CXX executable bin\UnicodeNameMappingGenerator.exe
[2588/3025] Linking CXX executable bin\llvm-config.exe
[2589/3025] Linking CXX static library lib\libLLVMVectorize.a
ninja: build stopped: subcommand failed.
command did not execute successfully, got: exit code: 1


build script failed, must exit now', C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.48\src\lib.rs:975:5
 finished in 286.471 seconds
Build completed unsuccessfully in 0:06:31
Build completed unsuccessfully in 0:06:31
make: *** [Makefile:80: ci-mingw-subset-2] Error 1

@erikdesjardins
Copy link
Contributor

CI error is spurious, opened #108227 to track it

@compiler-errors
Copy link
Member Author

Thanks, in that case

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 19, 2023
@bors
Copy link
Contributor

bors commented Feb 19, 2023

⌛ Testing commit 7f798c2 with merge 73f4019...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-mingw-1 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[2529/3025] Building CXX object lib/XRay/CMakeFiles/LLVMXRay.dir/Trace.cpp.obj
[2530/3025] Building CXX object lib/XRay/CMakeFiles/LLVMXRay.dir/RecordPrinter.cpp.obj
[2531/3025] Linking CXX static library lib\libLLVMDlltoolDriver.a
FAILED: lib/libLLVMDlltoolDriver.a 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E rm -f lib\libLLVMDlltoolDriver.a && D:\a\rust\rust\mingw64\bin\ar.exe qc lib\libLLVMDlltoolDriver.a  lib/ToolDrivers/llvm-dlltool/CMakeFiles/LLVMDlltoolDriver.dir/DlltoolDriver.cpp.obj && D:\a\rust\rust\mingw64\bin\ranlib.exe lib\libLLVMDlltoolDriver.a && cd ."
D:\a\rust\rust\mingw64\bin\ranlib.exe: could not create temporary file whilst writing archive: no more archived files
[2532/3025] Linking CXX static library lib\libLLVMDebugInfoDWARF.a
[2533/3025] Linking CXX static library lib\libLLVMObjCopy.a
[2534/3025] Linking CXX static library lib\libLLVMJITLink.a
[2535/3025] Building CXX object lib/XRay/CMakeFiles/LLVMXRay.dir/InstrumentationMap.cpp.obj
[2535/3025] Building CXX object lib/XRay/CMakeFiles/LLVMXRay.dir/InstrumentationMap.cpp.obj
[2536/3025] Linking CXX static library lib\libLLVMRuntimeDyld.a
[2537/3025] Linking CXX static library lib\libLLVMDebugInfoPDB.a
[2538/3025] Linking CXX static library lib\libLLVMObjectYAML.a
ninja: build stopped: subcommand failed.
command did not execute successfully, got: exit code: 1


build script failed, must exit now', C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.48\src\lib.rs:975:5
 finished in 240.900 seconds
Build completed unsuccessfully in 0:06:30
Build completed unsuccessfully in 0:06:30
make: *** [Makefile:78: ci-mingw-subset-1] Error 1

@bors
Copy link
Contributor

bors commented Feb 19, 2023

☀️ Test successful - checks-actions
Approved by: eholk
Pushing 73f4019 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 19, 2023
@bors bors merged commit 73f4019 into rust-lang:master Feb 19, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 19, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (73f4019): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.1%, -0.1%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) - - 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants