-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: improve inlined line numbers, take 2 #16335
Conversation
@@ -759,6 +769,10 @@ extern "C" void jl_register_fptrs(uint64_t sysimage_base, void **fptrs, jl_lambd | |||
sysimg_fvars_n = n; | |||
} | |||
|
|||
#ifdef _OS_LINUX_ | |||
#include <link.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top of file, around L53-54?
91a3866
to
748b043
Compare
I'm not sure how to handle locations from macro expansions. My guess is that there is not good support for the filename magically switching in the middle of a function, so for now I handled it the same way as an inlined function (since that seems to work well), with the inlined function name being |
748b043
to
013d32f
Compare
Will there be a way for Julia code examining the AST to figure or which file that lines from a macro expansion came from? |
I think ultimately the only way to handle generated code sanely will be to keep generated ASTs and be able to step through them. The |
Yes, there are |
Big fan of this effort.
Awesome! Doesn't yet seem documented in this PR, though. Might need a small section in devdocs or something. |
@@ -4286,7 +4277,7 @@ static std::unique_ptr<Module> emit_function(jl_lambda_info_t *lam, jl_llvm_func | |||
#ifndef LLVM34 | |||
SP = dbuilder.createFunction((DIDescriptor)dbuilder.getCU(), | |||
#else | |||
SP = dbuilder.createFunction(CU, | |||
SP = dbuilder.createFunction(topfile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this works. If the function isn't associated to a compile unit, it might not end up being represented in the binary.
85fb83c
to
b4e7b6f
Compare
Dev docs added and comments addressed. Should be ready to merge. |
have_backtrace = true | ||
break | ||
end | ||
end | ||
|
||
@test have_backtrace | ||
|
||
# Test location information for inlined code (ref issues #1334 #12544) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the results of these all changed, can we change them to test the affirmative of what they should be now, instead of deleting them altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, will do.
fd24b5e
to
3156e4c
Compare
This breaks building against LLVM 3.3, if we're still concerned with trying to keep that working for testing/perf comparison. |
Thanks a lot. I got sidetracked with the memory issues and was starting to lose faith ;). Glad to see a lot of it was salvageable. Allocating our own jit sections was an easy win if we don't care too much about W^X but I'm not sure that'll be the consensus. |
Yeah the allocation part is definitely important to work on, but should just be done separately. I suspect it's probably ok to use RWX pages by default, with a switch to disable them. |
It would make me happy to remove all the LLVM version ifdefs. If we have ifdefs for some LLVM version, but it's not tested in CI and even most developers never run it, is it really supported? The readability and maintainability gains would be significant. However currently I'm having trouble building with LLVM 3.3. I get errors about |
I agree that it would help clean things up, but 3.7 is still a pretty bad compiler perf regression relative to 3.3 isn't it? Though I see a failure at the end of bootstrap that was introduced by one of the codegen rewrites in March (#15556), so maybe it's already broken and not salvagable. |
You need |
Thanks.
Yes it is. But we already decided to make that tradeoff. |
On master, as a default build configuration. We don't have every-commit CI for lots of nominally supported configurations, ARM, FreeBSD, etc. We haven't deleted all of the LLVM 3.3 code yet, so the decision of whether or not to keep that a possible option for testing hasn't totally been finalized. |
I believe @vtjnash is testing it on Mac, which doesn't require much special configuration due to clang being permissive about c++11 features and |
3156e4c
to
0ca6cb6
Compare
OK, LLVM 3.3 build restored to at least as working as it was before. |
- add location info to empty blocks; fixes #15280 - remove file names from non-initial `line` nodes - emit `(meta push_loc filename)` and `(meta pop_loc)` around nested blocks from different files, to handle macros - fix line number of `catch` blocks
0ca6cb6
to
06d4b2a
Compare
Is this the cause of the new failure in genstdlib?
|
This is a rebased and edited version of #14949. To reduce the scope a bit, I changed it to store file names and function names instead of references to LambdaInfos. The goal is to get something mergeable as soon as possible, as this change has several important fixes from @carnaval :
I want to get these changes in even if the backtraces are not perfect yet. We can improve it later, either by adding back the LambdaInfo (or Method) references or by keeping a mapping from filename and line number to Methods.
I will merge #15583 into this branch, so we can take advantage of some of this for macro code locations as well.