-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Symbols in optimized async programs are often not useful #65978
Comments
It seems like we might want the lowering to emit into debug info (or symbols? not sure if we can use symbols here, i.e., due to duplicates) in such a way that preserves the name of the original function. That seems like something we want, in general. |
I think debuginfo should already include line-by-line information of code that was inlined. But when looking at objdump or a backtrace, it might not show up. We have to pick one function name which is going to be shown for every stack frame (or symbol). In this case, there's one monomorphization per call site. Maybe we can add an attribute to |
If one were to change which symbol is recorded around |
Ah, that's right. (I was confused by the fact that In that case it's less clear to me how to solve this. From the outside, it would look like a caller got inlined into its callee, rather than the other way around. We could make some annotation that says "when a bunch of functions are inlined into a symbol, don't use the symbol name of this function," and the compiler can pick the name of the first inlined function which doesn't contain this annotation, if any. Another way is to gather all the functions inlined into one and pick the "most specific function name," i.e. the function that is a candidate for inlining the least number of times. This might work, but it might also have odd unpredictable effects. I'm not sure how easy these would be to implement. |
I think this is partially fixed by the new symbol mangling scheme ( |
Perhaps someone should compile a program and look at the symbols that come out. It's possible that |
Reopening until we confirm that the backtrace is more helpful now. |
Hi! I've updated the codebase to a post-resume-arguments toolchain, and I can confirm that the symbols got replaced by something equally generic. :-) Now most functions in my program are named Here's a snippet from the
...and so forth. In my ideal world, each of these functions would be named something that links them back to the |
This is caused by the Using an example from the
and when building with
|
#104321 removed the I’m wondering if there is anything more here to do, or this issue can be closed? |
(As observed on
rustc 1.40.0-nightly (4a8c5b20c 2019-10-23)
targetingthumbv7em-none-eabihf
; CC @tmandry)I'm making my first aggressive use of
async fn
in an application. It's a deeply-embedded performance-sensitive application, and I wind up inspecting the disassembly output a lot (usingobjdump
).This is complicated by the fact that basically all of my functions are named
poll_with_tls_context
. (Some of them aren't -- some of them are named after future combinators.)For example, here is my function called
poll_with_tls_context
calling another one, also namedpoll_with_tls_context
:(The observant reader will note
poll_with_tls_context
does not appear in libcore. That's correct -- I've hackedasync
in a#[no_std]
environment. I'm pretty sure the hack is not the problem.)I understand why this is happening:
poll_with_tls_context
is an implementation detail of the current lowering ofasync fn
, and it is being specialized to the future type it's given, hence many such functions. But I also don't think it's ideal.(For what it's worth, I can change the situation by forcing
poll_with_tls_context
to inline, though this produces unacceptable code bloat in my application (and this option isn't available for people who aren't open to using a patched libstd). By default,poll_with_tls_context
doesn't inline, butget_task_context
does, which seems like the right result for size/speed.)I am compiling at
opt-level = 3
with an override fordebug = true
in my release profile.The text was updated successfully, but these errors were encountered: