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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcore: Add VaList and variadic arg handling intrinsics #49878

Merged
merged 2 commits into from Nov 29, 2018

Conversation

@dlrobertson
Contributor

dlrobertson commented Apr 11, 2018

Summary

  • Add intrinsics for va_start, va_end, va_copy, and va_arg.
  • Add core::va_list::VaList to libcore.

Part 1 of (at least) 3 for #44930

Comments and critiques are very much welcomed 馃槃

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Apr 11, 2018

r? @petrochenkov

(rust_highfive has picked a reviewer for you, use r? to override)

@TimNN

This comment has been minimized.

Contributor

TimNN commented Apr 11, 2018

Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (613823/613823), completed with 4888 local objects.
---
[00:00:44] configure: rust.quiet-tests     := True
---
[00:04:36] tidy error: /checkout/src/librustc_trans/type_.rs:330: TODO is deprecated; use FIXME
[00:04:37] some tidy checks failed
[00:04:37]
[00:04:37]
[00:04:37] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:37] expected success, got: exit code: 1
[00:04:37]
[00:04:37]
[00:04:37] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:37] Build completed unsuccessfully in 0:01:45
[00:04:37] Makefile:79: recipe for target 'tidy' failed
[00:04:37] make: *** [tidy] Error 1
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
ls: cannot access /home/travis/Library/Logs/DiagnosticReports/: No such file or directory
travis_time:end:0e2c5175:start=1523454640590169950,finish=1523454640597313231,duration=7143281
travis_fold:end:after_failure.2
travis_fold:start:after_failure.3
travis_time:start:095160e0
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:095160e0:start=1523454640603734434,finish=1523454640611305195,duration=7570761
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:08c0cb7c
$ dmesg | grep -i kill
[   10.307371] init: failsafe main process (1093) killed by TERM signal

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@petrochenkov

This comment has been minimized.

Contributor

petrochenkov commented Apr 12, 2018

I'm not familiar with codegen.
r? @eddyb
or ping @nagisa @arielb1 if eddyb is busy

@rust-highfive rust-highfive assigned eddyb and unassigned petrochenkov Apr 12, 2018

@nagisa

The changes look good, but I would probably prefer to see the full implementation before landing, rather than doing it in parts.

AArch64Abi,
PowerPcAbi,
X86_64Abi,
None

This comment has been minimized.

@nagisa

nagisa Apr 12, 2018

Contributor

Is this variant just a placeholder for targets which haven鈥檛 specified their VaList ABI? Removing this variant and picking some default would would end up removing the bug branch from trans.

This comment has been minimized.

@dlrobertson

dlrobertson Apr 13, 2018

Contributor

The void or char pointer could be a sensible default.

This comment has been minimized.

@dlrobertson

dlrobertson Apr 13, 2018

Contributor

Is this variant just a placeholder for targets which haven鈥檛 specified their VaList ABI?

I don't believe we support one that doesn't specify a VaList ABI, and I can't think of one off the top of my head that hasn't specified their VaList ABI, so unless someone else can think of a reason to keep the none variant, I'll remove it and use void-ptr or char-ptr as the default.

},
_ => {
// TODO: Is this the right thing to do?
bug!("va_list: not supported for this target type");

This comment has been minimized.

@nagisa

nagisa Apr 12, 2018

Contributor

Yes, bug-ing out here is the right thing to do as the valid variants are filtered out earlier. Message could be made to point out the issue better, though:

unexpected va_list kind reached trans

for example.

This comment has been minimized.

@dlrobertson

dlrobertson Apr 13, 2018

Contributor

馃憤 much better. I'll do a bit more research, but I think defaulting to either a void pointer or char pointer would be reasonable.

@dlrobertson

This comment has been minimized.

Contributor

dlrobertson commented Apr 13, 2018

I would probably prefer to see the full implementation before landing

I'll be in airports all weekend, but I can try to get the commit with VaList implemented in libcore up early next week.

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from 361cdee to b595ab0 Apr 17, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Apr 17, 2018

Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (617013/617013), completed with 4915 local objects.
---
[00:00:44] configure: rust.quiet-tests     := True
---
[00:40:40] warning: [va_arg] cannot be resolved, ignoring it...
---
[00:42:59] .................................................................................i..................
[00:43:05] ........................i...........................................................................
---
[00:43:48] .....................i...........................................................................i..
[00:43:54] ....................................................................................................
[00:44:00] ...........ii.......................................................................................
[00:44:09] ............................................................................................i.......
---
[00:44:45] .............................................i......................................................
---
[00:48:37] ..............................i.....................................................................
[00:48:51] ...............................................................i....................................
[00:49:06] .................................................i..................................................
[00:49:26] ....................................................................................................
[00:49:47] ....................................................................................................
[00:50:07] ....................................................................................................
[00:50:32] .......i............................................................................................
[00:51:01] ...i......................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:51:06] ..........
[00:51:38] ....................................................................................................
[00:52:08] .....................................................................ii.............................
[00:53:00] ................................i....................................................i.ii........test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:53:01] ...
[00:53:41] .............................................................................................iiiiiii
---
[00:55:53] ...................i............................................................ii.iii..............
[00:56:00] ....................................................................................................
[00:56:08] ........i..............................i............................................................
[00:56:15] ....................................................................................................
[00:56:22] ..........i.........................................................................................
[00:56:30] ....................................................................................................
[00:56:39] ....................................................................................................
[00:56:49] ....................................................................................................
[00:57:00] ....................................................................................................
[00:57:12] ....................................................................................................
[00:57:19] ...i................................................................................................
[00:57:28] .......i..ii........................................................................................
[00:57:39] ....................................................................................................
[00:57:48] ....................................................................................................
[00:57:57] .........................................................................i..........................
[00:58:07] ...................i................................................................................
---
[00:58:40] ...........................i........................................................................
[00:58:42] ....................................................................i...............................
[00:58:43] ................i.......................................................
---
[00:58:58] .............i........................
---
[00:59:28] i...i..ii....i.............ii.........iii......i..i...i...ii..i..i..ii.....
---
[00:59:31] i.......i......................i.......
---
[01:00:09] iiii.......i..i........i..i.i.............i..........iiii...........i...i..........ii.i.i.......ii..
[01:00:10] ....ii...
---
[01:07:17] ..................i.................................................................................
[01:08:51] ........i...........................................................................................
---
[01:10:52] .....................................i..............................................................
[01:11:12] ....................................................................................................
[01:11:32] ..........................................i.........................................................
---
[01:13:02] .........................................................ii.........................................
---
[01:14:24] .....................i..............................................................................
---
[01:19:50] ii..................................................................................................
[01:20:10] ....................................................................................................
[01:20:27] .......................iii......i......i...i......i.................................................
[01:20:36] ....................................................................................................
[01:20:51] .............................................iiii........ii.........................................
[01:21:02] ....................................................................................................
[01:21:19] ............................................................................................i.......
[01:21:42] ....................................................................................................
[01:21:54] ....................................................................................................
[01:22:04] ..iiii...............................................
---
[01:28:22] std/intrinsics/fn.va_end.html:59: broken link - std/intrinsics/fn.va_start
[01:28:22] std/intrinsics/fn.va_end.html:60: broken link - std/intrinsics/fn.va_copy
[01:28:22] std/intrinsics/index.html:1916: broken link - std/intrinsics/fn.va_start
[01:28:22] std/intrinsics/index.html:1917: broken link - std/intrinsics/fn.va_copy
[01:28:31] core/intrinsics/fn.va_end.html:59: broken link - core/intrinsics/fn.va_start
[01:28:31] core/intrinsics/fn.va_end.html:60: broken link - core/intrinsics/fn.va_copy
[01:28:31] core/intrinsics/index.html:1909: broken link - core/intrinsics/fn.va_start
[01:28:31] core/intrinsics/index.html:1910: broken link - core/intrinsics/fn.va_copy
[01:28:37] thread 'main' panicked at 'found some broken links', tools/linkchecker/main.rs:49:9
---
[01:28:37] make: *** [check] Error 1
[01:28:37] Makefile:58: recipe for target 'check' failed
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
ls: cannot access /home/travis/Library/Logs/DiagnosticReports/: No such file or directory
travis_time:end:0203b0b8:start=1523970196743178500,finish=1523970196755294281,duration=12115781
travis_fold:end:after_failure.2
travis_fold:start:after_failure.3
travis_time:start:18f77766
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:18f77766:start=1523970196766937437,finish=1523970196778607460,duration=11670023
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:09d272ac
$ dmesg | grep -i kill
[   10.991686] init: failsafe main process (1096) killed by TERM signal

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from b595ab0 to 61bf322 Apr 17, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Apr 17, 2018

Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (616537/616537), completed with 4918 local objects.
---
[00:00:54] configure: rust.quiet-tests     := True
---
[00:42:09] .................................................................................i..................
[00:42:15] ........................i...........................................................................
---
[00:42:56] .....................i...........................................................................i..
[00:43:02] ....................................................................................................
[00:43:09] ...........ii.......................................................................................
[00:43:17] ............................................................................................i.......
---
[00:43:53] .............................................i......................................................
---
[00:47:38] ..............................i.....................................................................
[00:47:52] ...............................................................i....................................
[00:48:06] .................................................i..................................................
[00:48:25] ....................................................................................................
[00:48:45] ....................................................................................................
[00:49:06] ....................................................................................................
[00:49:29] .......i............................................................................................
[00:49:59] ...i.........................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:50:02] .......
[00:50:33] ....................................................................................................
[00:51:03] .....................................................................ii.............................
[00:51:54] ................................i....................................................i.ii...........
[00:51:55] test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:52:33] .............................................................................................iiiiiii
---
[00:54:43] ...................i............................................................ii.iii..............
[00:54:50] ....................................................................................................
[00:54:58] ........i..............................i............................................................
[00:55:05] ....................................................................................................
[00:55:12] ..........i.........................................................................................
[00:55:20] ....................................................................................................
[00:55:30] ....................................................................................................
[00:55:40] ....................................................................................................
[00:55:50] ....................................................................................................
[00:56:02] ....................................................................................................
[00:56:09] ...i................................................................................................
[00:56:18] .......i..ii........................................................................................
[00:56:28] ....................................................................................................
[00:56:37] ....................................................................................................
[00:56:46] .........................................................................i..........................
[00:56:57] ...................i................................................................................
---
[00:57:30] ...........................i........................................................................
[00:57:31] ....................................................................i...............................
[00:57:32] ................i.......................................................
---
[00:57:48] .............i........................
---
[00:58:17] i...i..ii....i.............ii.........iii......i..i...i...ii..i..i..ii.....
---
[00:58:20] i.......i......................i.......
---
[00:58:58] iiii.......i..i........i..i.i.............i..........iiii...........i...i..........ii.i.i.......ii..
[00:58:59] ....ii...
---
[01:05:55] ..................i.................................................................................
[01:07:29] ........i...........................................................................................
---
[01:09:21] .....................................i..............................................................
[01:09:40] ....................................................................................................
[01:09:59] ..........................................i.........................................................
---
[01:11:26] .........................................................ii.........................................
---
[01:12:45] .....................i..............................................................................
---
[01:17:55] ii..................................................................................................
[01:18:15] ....................................................................................................
[01:18:31] .......................iii......i......i...i......i.................................................
[01:18:40] ....................................................................................................
[01:18:55] .............................................iiii........ii.........................................
[01:19:06] ....................................................................................................
[01:19:23] ............................................................................................i.......
[01:19:46] ....................................................................................................
[01:19:57] ....................................................................................................
[01:20:07] ..iiii...............................................
---
[01:26:03] std/intrinsics/fn.va_end.html:59: broken link - std/intrinsics/fn.va_start
[01:26:03] std/intrinsics/fn.va_end.html:60: broken link - std/intrinsics/fn.va_copy
[01:26:03] std/intrinsics/fn.va_start.html:59: broken link - std/intrinsics/fn.va_arg
[01:26:03] std/intrinsics/index.html:1916: broken link - std/intrinsics/fn.va_start
[01:26:03] std/intrinsics/index.html:1917: broken link - std/intrinsics/fn.va_copy
[01:26:03] std/intrinsics/index.html:1925: broken link - std/intrinsics/fn.va_arg
[01:26:11] core/intrinsics/fn.va_end.html:59: broken link - core/intrinsics/fn.va_start
[01:26:11] core/intrinsics/fn.va_end.html:60: broken link - core/intrinsics/fn.va_copy
[01:26:11] core/intrinsics/fn.va_start.html:59: broken link - core/intrinsics/fn.va_arg
[01:26:11] core/intrinsics/index.html:1909: broken link - core/intrinsics/fn.va_start
[01:26:11] core/intrinsics/index.html:1910: broken link - core/intrinsics/fn.va_copy
[01:26:11] core/intrinsics/index.html:1918: broken link - core/intrinsics/fn.va_arg
---
122308 ./obj/build/bootstrap/debug/incremental/bootstrap-351vorei3hhuv/s-f07b1ew9gk-1e3u9p4-1k86flishkqwv
---
101196 ./obj/build/bootstrap/debug/incremental/bootstrap-zki88qpb4pjm/s-f07c488ery-2uy5dz-14mc0iqu0r5mn
91728 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps
90108 ./obj/build/x86_64-unknown-linux-gnu/stage1
90084 ./obj/build/x86_64-unknown-linux-gnu/stage1/lib
89688 ./src/llvm/test/CodeGen
88712 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz
88708 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz/s-f07c1vne0e-m7bhan-3qf3mk1askxcf
---
53212 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/incremental/syntax-33oa6nnkk1g08/s-f07c3hkns3-40g0n9-3dxcw1ob0971a

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from 61bf322 to f0e2318 Apr 17, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Apr 17, 2018

Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Resolving deltas: 100% (616705/616705), completed with 4918 local objects.
---
[00:00:57] configure: rust.quiet-tests     := True
---
[00:46:56] .................................................................................i..................
[00:47:02] ........................i...........................................................................
---
[00:47:46] .....................i...........................................................................i..
[00:47:52] ....................................................................................................
[00:47:59] ...........ii.......................................................................................
[00:48:07] ............................................................................................i.......
---
[00:48:47] .............................................i......................................................
---
[00:52:55] ..............................i.....................................................................
[00:53:09] ...............................................................i....................................
[00:53:25] .................................................i..................................................
[00:53:46] ....................................................................................................
[00:54:08] ....................................................................................................
[00:54:30] ....................................................................................................
[00:54:56] .......i............................................................................................
[00:55:23] ...i.............................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:55:33] ...................
[00:56:06] ....................................................................................................
[00:56:39] .....................................................................ii.............................
[00:57:29] ................................i..............................................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:57:37] ......i.ii...........
[00:58:21] .............................................................................................iiiiiii
---
[01:00:42] ....................i............................................................ii.iii.............
[01:00:50] ....................................................................................................
[01:00:58] .........i..............................i...........................................................
[01:01:05] ....................................................................................................
[01:01:12] ...........i........................................................................................
[01:01:21] ....................................................................................................
[01:01:30] ....................................................................................................
[01:01:41] ....................................................................................................
[01:01:52] ....................................................................................................
[01:02:06] ....................................................................................................
[01:02:14] ....i...............................................................................................
[01:02:23] ........i..ii.......................................................................................
[01:02:34] ....................................................................................................
[01:02:43] ....................................................................................................
[01:02:53] ..........................................................................i.........................
[01:03:03] ....................i...............................................................................
---
[01:03:38] ...........................i........................................................................
[01:03:39] ....................................................................i...............................
[01:03:40] ...............i.......................................................
---
[01:03:57] .............i........................
---
[01:04:28] i...i..ii....i.............ii.........iii......i..i...i...ii..i..i..ii.....
---
[01:04:31] i.......i......................i.......
---
[01:05:10] iiii.......i..i........i..i.i.............i..........iiii...........i...i..........ii.i.i.......ii..
[01:05:12] ....ii...
---
[01:13:29] ..................i.................................................................................
[01:15:14] ........i...........................................................................................
---
[01:17:21] .....................................i..............................................................
[01:17:43] ....................................................................................................
[01:18:06] ..........................................i.........................................................
---
[01:19:39] .........................................................ii.........................................
---
[01:21:06] .....................i..............................................................................
---
[01:26:42] ii..................................................................................................
[01:27:03] ....................................................................................................
[01:27:20] .......................iii......i......i...i......i.................................................
[01:27:30] ....................................................................................................
[01:27:46] .............................................iiii........ii.........................................
[01:27:58] ....................................................................................................
[01:28:15] ............................................................................................i.......
[01:28:41] ....................................................................................................
[01:28:53] ....................................................................................................
[01:29:04] ..iiii...............................................
---
[01:35:16] std/intrinsics/fn.va_end.html:2: broken link - std/intrinsics/fn.va_start
[01:35:16] std/intrinsics/fn.va_end.html:3: broken link - std/intrinsics/fn.va_copy
[01:35:16] std/intrinsics/fn.va_start.html:2: broken link - std/intrinsics/fn.va_arg
[01:35:16] std/intrinsics/index.html:1859: broken link - std/intrinsics/fn.va_start
[01:35:16] std/intrinsics/index.html:1860: broken link - std/intrinsics/fn.va_copy
[01:35:16] std/intrinsics/index.html:1868: broken link - std/intrinsics/fn.va_arg
[01:35:25] core/intrinsics/fn.va_end.html:2: broken link - core/intrinsics/fn.va_start
[01:35:25] core/intrinsics/fn.va_end.html:3: broken link - core/intrinsics/fn.va_copy
[01:35:25] core/intrinsics/fn.va_start.html:2: broken link - core/intrinsics/fn.va_arg
[01:35:25] core/intrinsics/index.html:1852: broken link - core/intrinsics/fn.va_start
[01:35:25] core/intrinsics/index.html:1853: broken link - core/intrinsics/fn.va_copy
[01:35:25] core/intrinsics/index.html:1861: broken link - core/intrinsics/fn.va_arg
[01:35:31] thread 'main' panicked at 'found some broken links', tools/linkchecker/main.rs:49:9
---
[01:35:31] make: *** [check] Error 1
[01:35:31] Makefile:58: recipe for target 'check' failed
---
$ ls -lat $HOME/Library/Logs/DiagnosticReports/
ls: cannot access /home/travis/Library/Logs/DiagnosticReports/: No such file or directory
travis_time:end:16f54d06:start=1523998992908371833,finish=1523998992923970785,duration=15598952
travis_fold:end:after_failure.2
travis_fold:start:after_failure.3
travis_time:start:0600ccca
$ find $HOME/Library/Logs/DiagnosticReports -type f -name '*.crash' -not -name '*.stage2-*.crash' -not -name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash' -exec printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" {} \; -exec head -750 {} \; -exec echo travis_fold":"end:crashlog \; || true
find: `/home/travis/Library/Logs/DiagnosticReports': No such file or directory
travis_time:end:0600ccca:start=1523998992930712028,finish=1523998992937289954,duration=6577926
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:020702ae
$ dmesg | grep -i kill
[   10.678826] init: failsafe main process (1096) killed by TERM signal

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

This comment has been minimized.

Contributor

bors commented Apr 21, 2018

鈽旓笍 The latest upstream changes (presumably #50093) made this pull request unmergeable. Please resolve the merge conflicts.

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from f0e2318 to 5198f5a Apr 22, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Apr 22, 2018

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:56:04] ....i......................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:56:09] .........
[00:56:41] ....................................................................................................
[00:57:10] ......................................................................ii............................
[00:58:02] .................................i....................................................i.ii.....test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:58:47] ..............................................................................................iiiiii
[00:59:14] i...................................................................................................
[00:59:44] ....................................................................................................
[01:00:10] ....................................................................................................
---
[01:33:32] travis_fold:end:stage0-linkchecker

[01:33:32] travis_time:end:stage0-linkchecker:start=1524363993598161550,finish=1524363996559484103,duration=2961322553

[01:33:35] std/intrinsics/fn.va_end.html:2: broken link fragment `#fn.va_start` pointing to `std/intrinsics/fn.va_end.html`
[01:33:35] std/intrinsics/fn.va_end.html:3: broken link fragment `#fn.va_copy` pointing to `std/intrinsics/fn.va_end.html`
[01:33:35] std/intrinsics/fn.va_start.html:2: broken link fragment `#fn.va_arg` pointing to `std/intrinsics/fn.va_start.html`
[01:33:35] std/intrinsics/index.html:1859: broken link fragment `#fn.va_start` pointing to `std/intrinsics/index.html`
[01:33:35] std/intrinsics/index.html:1860: broken link fragment `#fn.va_copy` pointing to `std/intrinsics/index.html`
[01:33:35] std/intrinsics/index.html:1868: broken link fragment `#fn.va_arg` pointing to `std/intrinsics/index.html`
[01:33:43] core/intrinsics/fn.va_end.html:2: broken link fragment `#fn.va_start` pointing to `core/intrinsics/fn.va_end.html`
[01:33:43] core/intrinsics/fn.va_end.html:3: broken link fragment `#fn.va_copy` pointing to `core/intrinsics/fn.va_end.html`
[01:33:43] core/intrinsics/fn.va_start.html:2: broken link fragment `#fn.va_arg` pointing to `core/intrinsics/fn.va_start.html`
[01:33:43] core/intrinsics/index.html:1852: broken link fragment `#fn.va_start` pointing to `core/intrinsics/index.html`
[01:33:43] core/intrinsics/index.html:1853: broken link fragment `#fn.va_copy` pointing to `core/intrinsics/index.html`
[01:33:43] core/intrinsics/index.html:1861: broken link fragment `#fn.va_arg` pointing to `core/intrinsics/index.html`

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:039409e6
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from 5198f5a to 638ff83 Apr 22, 2018

@bors

This comment has been minimized.

Contributor

bors commented Apr 26, 2018

鈽旓笍 The latest upstream changes (presumably #50228) made this pull request unmergeable. Please resolve the merge conflicts.

@pietroalbini

This comment has been minimized.

Member

pietroalbini commented Apr 30, 2018

Ping from triage @eddyb! This PR needs your review.
Also @dlrobertson, there are a bunch of conflicts that needs to be fixed.

@dlrobertson

This comment has been minimized.

Contributor

dlrobertson commented Apr 30, 2018

@pietroalbini I can push up a rebased branch shortly.

@nagisa @eddyb I'm still working on the actual VaList implementation in libcore. I have a WIP commit that includes it that doesn't currently generate the correct code yet. Would you prefer me to push that code to this branch as well?

@nagisa

This comment has been minimized.

Contributor

nagisa commented Apr 30, 2018

Feel free to push whenever you have any changes. It is easier to stay up-to-date with the state of the PR that way and it might avoid the pings from triage.

VoidPtr,
AArch64Abi,
PowerPcAbi,
X86_64Abi,

This comment has been minimized.

@eddyb

eddyb Apr 30, 2018

Member

I wonder why this enum was added, instead of determining this information from the architecture, in the call ABI (formerly src/librustc_trans/{abi,cabi_*}.rs, now in src/librustc_target/abi/call/*.rs) infrastructure.

This comment has been minimized.

@eddyb

eddyb Apr 30, 2018

Member

Is there value in custom target specifications overriding it? Currently we don't support overriding most of the behavior of the C call ABI for a target.

This comment has been minimized.

@dlrobertson

dlrobertson Apr 30, 2018

Contributor

My main motivation for using this approach was because it more closely mirrored clang's implementation. Other than that, it makes windows a bit easier. Windows may be x86_64, but the va_list implementation is the CharPtr variant. That being said, I think we could use is_windows_like and the architecture.

This comment has been minimized.

@eddyb

eddyb Apr 30, 2018

Member

Yeah, we already special-case windows in call ABI code. Also, I'm curious what it affects, in terms of the final implementation - is it just required to be something that only LLVM operates on, or would rustc_trans also have to generate code looking at its fields etc.?

This comment has been minimized.

@dlrobertson

dlrobertson Apr 30, 2018

Contributor

I'm honestly not entirely sure yet. I'm still a rustc noobie, and I'm still reading through much of the trans code. I was hoping that rustc_trans::Type::va_list could be the only function that needed this enum, but the VaList argument would get eliminated as an argument due to the core implementation being a ZST.

I was also hoping that we could generate better debug info for architectures like x86_64 and Aarch64, but I haven't gotten that far yet.

@eddyb

This comment has been minimized.

Member

eddyb commented Apr 30, 2018

Sorry about the delay, I wish I had read through this sooner - had I said anything about #49878 (comment) sooner, conflicts with #50228 would've been avoided.
Aside from that, the patch looks good, and I'm excited to see the VaList implementation!

@dlrobertson

This comment has been minimized.

Contributor

dlrobertson commented Apr 30, 2018

Sorry about the delay

Np. Nothing a little vimdiff can't fix

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from 638ff83 to a6876b0 Apr 30, 2018

@dlrobertson

@eddyb @nagisa Added the WIP commit adding VaList to core.

reason = "dlrobertson is still working on this",
issue = "27745")]
#[derive(Debug)]
pub struct VaList;

This comment has been minimized.

@dlrobertson

dlrobertson Apr 30, 2018

Contributor

The original RFC indicates that this should be implemented as core::intrinsics::VaList, but since everything in intrinsics is a "rust-intrinsic" I implemented it as core::va_list::VaList. Was there a reason this was going to be implemented under intrinsics?

@@ -2694,6 +2695,34 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.object_lifetime_defaults_map(id.owner)
.and_then(|map| map.get(&id.local_id).cloned())
}
pub fn va_list_types(&self) -> Vec<Ty<'tcx>> {

This comment has been minimized.

@dlrobertson

dlrobertson Apr 30, 2018

Contributor

Used to get the Tys of the VaList fields. I'm still working on figuring out what to do here for the pointer variants. I'm not sure if the current implementation works for them. My first attempt only used Type::va_list, but the VaList function argument would get optimized out as a ZST, so I added extra logic here so that the LayoutDetails indicate that the VaList is not a ZST. Comments and critiques on this would be super helpful.

let variants = tcx.va_list_types().iter()
.map(|x| self.layout_of(x).unwrap())
.collect::<Vec<_>>();
univariant_uninterned(&variants[..], &def.repr, kind)?

This comment has been minimized.

@dlrobertson

dlrobertson Apr 30, 2018

Contributor

I don't think this is entirely correct. I think this will not be correct for the CharPtr and VoidPtr variants.

@@ -1614,6 +1624,13 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
this.ty.simd_type(tcx)
}
ty::TyAdt(def, ..) if Some(def.did) == tcx.lang_items().va_list() => {

This comment has been minimized.

@dlrobertson

dlrobertson Apr 30, 2018

Contributor

The VaList implementation in core is just a stub. When compiling for X86_64, any access to field will result in an out of bounds index.

@@ -297,4 +298,34 @@ impl Type {
pub fn x86_mmx(cx: &CodegenCx) -> Type {
ty!(llvm::LLVMX86MMXTypeInContext(cx.llcx))
}
pub fn va_list(cx: &CodegenCx, name: &str) -> Type {

This comment has been minimized.

@dlrobertson

dlrobertson Apr 30, 2018

Contributor

Function used to generate the correct type.

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from a6876b0 to da46325 Apr 30, 2018

@eddyb

This comment has been minimized.

Member

eddyb commented Apr 30, 2018

@dlrobertson Looking again at the RFC, it seems to me that the logic for picking the fields of VaList should be done with #[cfg]'s in libcore, instead of magically within the compiler.
At least we can do that today and we know it would work, whereas doing it in the compiler would be harder. Ideally VaList would be an extern type always behind a &mut, but can it be?

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from 465816a to addf60f Nov 26, 2018

}
"va_copy" => {
let va_list = match tcx.lang_items().va_list() {
Some(did) if result.layout.ty == tcx.type_of(did) => args[0].immediate(),

This comment has been minimized.

@eddyb

eddyb Nov 26, 2018

Member

I think you should match on result.layout.ty.sty for ty::Adt(def, _) and compare def.did with did instead of calling type_of.

This comment has been minimized.

@dlrobertson

dlrobertson Nov 26, 2018

Contributor

Updated.

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from addf60f to 861d84a Nov 26, 2018

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 26, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:2b685ce8:start=1543270798200971514,finish=1543270800681784872,duration=2480813358
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---

[00:03:21] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:03:21] tidy error: /checkout/src/librustc_codegen_llvm/intrinsic.rs:153: line longer than 100 chars
[00:03:21] tidy error: /checkout/src/librustc_codegen_llvm/intrinsic.rs:162: line longer than 100 chars
[00:03:23] some tidy checks failed
[00:03:23] 
[00:03:23] 
[00:03:23] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:03:23] 
[00:03:23] 
[00:03:23] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:03:23] Build completed unsuccessfully in 0:00:58
[00:03:23] Build completed unsuccessfully in 0:00:58
[00:03:23] Makefile:79: recipe for target 'tidy' failed
[00:03:23] make: *** [tidy] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:02b506d2
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Nov 26 22:23:32 UTC 2018
---
travis_time:end:0003e54a:start=1543271013201234980,finish=1543271013206629907,duration=5394927
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0f7088b4
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1038891c
travis_time:start:1038891c
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0996240c
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

dlrobertson added some commits Oct 23, 2018

libcore: Add va_list lang item and intrinsics
 - Add the llvm intrinsics used to manipulate a va_list.
 - Add the va_list lang item in order to allow implementing
   VaList in libcore.

@dlrobertson dlrobertson force-pushed the dlrobertson:va_list_pt0 branch from 861d84a to e9e084f Nov 26, 2018

@eddyb

eddyb approved these changes Nov 26, 2018

@dlrobertson

This comment has been minimized.

Contributor

dlrobertson commented Nov 27, 2018

I've tested on x86_64-pc-windows-gnu and x86_64-unknown-linux-gnu. Any other targets you'd like me to test before it is handed over to bors?

@eddyb

This comment has been minimized.

Member

eddyb commented Nov 27, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 27, 2018

馃搶 Commit e9e084f has been approved by eddyb

@bors

This comment has been minimized.

Contributor

bors commented Nov 29, 2018

鈱涳笍 Testing commit e9e084f with merge 3e90a12...

bors added a commit that referenced this pull request Nov 29, 2018

Auto merge of #49878 - dlrobertson:va_list_pt0, r=eddyb
libcore: Add VaList and variadic arg handling intrinsics

## Summary

 - Add intrinsics for `va_start`, `va_end`, `va_copy`, and `va_arg`.
 - Add `core::va_list::VaList` to `libcore`.

Part 1 of (at least) 3 for #44930

Comments and critiques are very much welcomed 馃槃
@bors

This comment has been minimized.

Contributor

bors commented Nov 29, 2018

鈽锔 Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing 3e90a12 to master...

@bors bors merged commit e9e084f into rust-lang:master Nov 29, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@dlrobertson

This comment has been minimized.

Contributor

dlrobertson commented Nov 29, 2018

\o/ Thanks @eddyb @joshtriplett @rkruppe and everyone else who helped me work through this!

@dlrobertson dlrobertson deleted the dlrobertson:va_list_pt0 branch Nov 29, 2018

alexreg added a commit to alexreg/rust that referenced this pull request Nov 30, 2018

Auto merge of rust-lang#49878 - dlrobertson:va_list_pt0, r=eddyb
libcore: Add VaList and variadic arg handling intrinsics

## Summary

 - Add intrinsics for `va_start`, `va_end`, `va_copy`, and `va_arg`.
 - Add `core::va_list::VaList` to `libcore`.

Part 1 of (at least) 3 for rust-lang#44930

Comments and critiques are very much welcomed 馃槃
@RalfJung

This comment has been minimized.

Member

RalfJung commented Nov 30, 2018

Is it possible that this creates unaligned slices, thus causing #55011 (comment) ?

@dlrobertson

This comment has been minimized.

Contributor

dlrobertson commented Nov 30, 2018

Is it possible that this creates unaligned slices, thus causing #55011 (comment) ?

After a very brief review, it looks like an issue with the test.

@glguy

This comment has been minimized.

glguy commented Dec 4, 2018

This PR merges the platform specific aspects of va_copy with a particular access pattern via higher-order function that enforces a particular use pattern of va_end afterward.

I ran into an example of a non-standard use-case here: https://github.com/GNOME/libxml2/blob/35e83488505d501864826125cfe6a7950d6cba78/xmlwriter.c#L4483-L4497

My proposal would be to move the architecture-specific logic out into its own method that was used to implement the copy method. https://github.com/rust-lang/rust/blob/master/src/libcore/ffi.rs#L193-L202

I'd be curious to hear your opinions!

@dlrobertson

This comment has been minimized.

Contributor

dlrobertson commented Dec 5, 2018

@glguy I don't see how you could implement a similar function with the current interface. This is indeed a non-standard use case, so I don't see it having an impact on the methods implemented for VaList. If we did want to support such a use case I think our best option is to implement Default for VaList and expose the raw intrinsics. You might create an issue about this or comment on the RFC rust-lang/rfcs#2137.

@eddyb

This comment has been minimized.

Member

eddyb commented Dec 6, 2018

@glguy That code is only awkward because it (mis-)uses a while loop.
In Rust, you'd just use loop. This is how you can re-write the C loop:

    while(1) {
        VA_COPY(locarg, argptr);
        count = vsnprintf((char *) buf, size, format, locarg);
        va_end(locarg);
        if (!((count < 0) || (count == size - 1) || (count == size) || (count > size))) {
            break;
        }
        xmlFree(buf);
        size += BUFSIZ;
        buf = (xmlChar *) xmlMalloc(size);
        if (buf == NULL) {
            xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY,
                            "xmlTextWriterVSprintf : out of memory!\n");
            return NULL;
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment