-
-
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
lineno fixes #13491
Merged
Merged
lineno fixes #13491
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -315,7 +315,6 @@ extern RTDyldMemoryManager* createRTDyldMemoryManagerOSX(); | |
// important functions | ||
static Function *jlnew_func; | ||
static Function *jlthrow_func; | ||
static Function *jlthrow_line_func; | ||
static Function *jlerror_func; | ||
static Function *jltypeerror_func; | ||
static Function *jlundefvarerror_func; | ||
|
@@ -539,7 +538,6 @@ typedef struct { | |
bool vaStack; // varargs stack-allocated | ||
bool sret; | ||
int nReqArgs; | ||
int lineno; | ||
std::vector<bool> boundsCheck; | ||
|
||
jl_gcinfo_t gc; | ||
|
@@ -1437,7 +1435,7 @@ extern "C" void jl_write_malloc_log(void) | |
static void show_source_loc(JL_STREAM *out, jl_codectx_t *ctx) | ||
{ | ||
if (ctx == NULL) return; | ||
jl_printf(out, "in %s at %s:%d", ctx->linfo->name->name, ctx->linfo->file->name, ctx->lineno); | ||
jl_printf(out, "in %s at %s", ctx->linfo->name->name, ctx->linfo->file->name); | ||
} | ||
|
||
extern "C" void jl_binding_deprecation_warning(jl_binding_t *b); | ||
|
@@ -4417,7 +4415,6 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
} | ||
} | ||
} | ||
ctx.lineno = lno; | ||
int toplineno = lno; | ||
|
||
DIBuilder dbuilder(*m); | ||
|
@@ -4429,6 +4426,7 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
DIFile topfile; | ||
DISubprogram SP; | ||
#endif | ||
DebugLoc inlineLoc; | ||
|
||
BasicBlock *b0 = BasicBlock::Create(jl_LLVMContext, "top", f); | ||
builder.SetInsertPoint(b0); | ||
|
@@ -4503,7 +4501,8 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
true, // isOptimized | ||
f); // Fn | ||
// set initial line number | ||
builder.SetCurrentDebugLocation(DebugLoc::get(lno, 0, (MDNode*)SP, NULL)); | ||
inlineLoc = DebugLoc::get(lno, 0, (MDNode*)SP, NULL); | ||
builder.SetCurrentDebugLocation(inlineLoc); | ||
#ifndef LLVM37 | ||
assert(SP.Verify() && SP.describes(f) && SP.getFunction() == f); | ||
#endif | ||
|
@@ -4520,7 +4519,7 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
argname->name, // Variable name | ||
ctx.sret + i + 1, // Argument number (1-based) | ||
topfile, // File | ||
ctx.lineno == -1 ? 0 : ctx.lineno, // Line | ||
toplineno == -1 ? 0 : toplineno, // Line | ||
// Variable type | ||
julia_type_to_di(varinfo.value.typ,ctx.dbuilder,specsig)); | ||
#else | ||
|
@@ -4529,7 +4528,7 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
SP, // Scope (current function will be fill in later) | ||
argname->name, // Variable name | ||
topfile, // File | ||
ctx.lineno == -1 ? 0 : ctx.lineno, // Line (for now, use lineno of the function) | ||
toplineno == -1 ? 0 : toplineno, // Line (for now, use lineno of the function) | ||
julia_type_to_di(varinfo.value.typ, ctx.dbuilder, specsig), // Variable type | ||
false, // May be optimized out | ||
0, // Flags (TODO: Do we need any) | ||
|
@@ -4543,15 +4542,15 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
ctx.vaName->name, // Variable name | ||
ctx.sret + nreq + 1, // Argument number (1-based) | ||
topfile, // File | ||
ctx.lineno == -1 ? 0 : ctx.lineno, // Line (for now, use lineno of the function) | ||
toplineno == -1 ? 0 : toplineno, // Line (for now, use lineno of the function) | ||
julia_type_to_di(ctx.vars[ctx.vaName].value.typ, ctx.dbuilder, false)); | ||
#else | ||
ctx.vars[ctx.vaName].dinfo = ctx.dbuilder->createLocalVariable( | ||
llvm::dwarf::DW_TAG_arg_variable, // Tag | ||
SP, // Scope (current function will be fill in later) | ||
ctx.vaName->name, // Variable name | ||
topfile, // File | ||
ctx.lineno == -1 ? 0 : ctx.lineno, // Line (for now, use lineno of the function) | ||
toplineno == -1 ? 0 : toplineno, // Line (for now, use lineno of the function) | ||
julia_type_to_di(ctx.vars[ctx.vaName].value.typ, ctx.dbuilder, false), // Variable type | ||
false, // May be optimized out | ||
0, // Flags (TODO: Do we need any) | ||
|
@@ -4572,7 +4571,7 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
SP, // Scope (current function will be fill in later) | ||
s->name, // Variable name | ||
topfile, // File | ||
ctx.lineno == -1 ? 0 : ctx.lineno, // Line (for now, use lineno of the function) | ||
toplineno == -1 ? 0 : toplineno, // Line (for now, use lineno of the function) | ||
julia_type_to_di(varinfo.value.typ, ctx.dbuilder, specsig), // Variable type | ||
false, // May be optimized out | ||
0 // Flags (TODO: Do we need any) | ||
|
@@ -4596,7 +4595,7 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
SP, // Scope (current function will be filled in later) | ||
vname->name, // Variable name | ||
topfile, // File | ||
ctx.lineno == -1 ? 0 : ctx.lineno, // Line (for now, use lineno of the function) | ||
toplineno == -1 ? 0 : toplineno, // Line (for now, use lineno of the function) | ||
julia_type_to_di(varinfo.value.typ, ctx.dbuilder, specsig), // Variable type | ||
false, // May be optimized out | ||
0 // Flags (TODO: Do we need any) | ||
|
@@ -4996,35 +4995,31 @@ static Function *emit_function(jl_lambda_info_t *lam) | |
} | ||
DebugLoc loc; | ||
if (ctx.debug_enabled) { | ||
MDNode *funcscope = (MDNode*)dbuilder.createLexicalBlockFile(SP, topfile); | ||
MDNode *scope; | ||
if ((dfil == topfile || dfil == NULL) && | ||
lno >= toplineno) | ||
{ | ||
// for sequentially-defined code, | ||
// set location to line in top file. | ||
// TODO: improve handling of nested inlines | ||
loc = DebugLoc::get(lno, 1, SP, NULL); | ||
loc = inlineLoc = DebugLoc::get(lno, 1, SP, NULL); | ||
} else { | ||
// otherwise, we are compiling inlined code, | ||
// so set the DebugLoc "inlinedAt" parameter | ||
// to the current line, then use source loc. | ||
#ifdef LLVM37 | ||
scope = (MDNode*)dbuilder.createLexicalBlockFile(SP,dfil); | ||
MDNode *inlineLocMd = DebugLoc::get(toplineno, 1, funcscope, NULL). | ||
getAsMDNode(); | ||
MDNode *inlineLocMd = inlineLoc.getAsMDNode(); | ||
#else | ||
scope = (MDNode*)dbuilder.createLexicalBlockFile(SP,DIFile(dfil)); | ||
MDNode *inlineLocMd = DebugLoc::get(toplineno, 1, funcscope, NULL). | ||
getAsMDNode(jl_LLVMContext); | ||
MDNode *inlineLocMd = inlineLoc.getAsMDNode(jl_LLVMContext); | ||
#endif | ||
loc = DebugLoc::get(lno, 1, scope, inlineLocMd); | ||
} | ||
builder.SetCurrentDebugLocation(loc); | ||
} | ||
if (do_coverage) | ||
coverageVisitLine(filename, lno); | ||
ctx.lineno = lno; // NOO TOUCHIE; NO TOUCH! See #922 | ||
} | ||
if (jl_is_labelnode(stmt)) { | ||
if (prevlabel) continue; | ||
|
@@ -5478,15 +5473,6 @@ static void init_julia_llvm_env(Module *m) | |
jluboundserror_func->setDoesNotReturn(); | ||
add_named_global(jluboundserror_func, (void*)&jl_bounds_error_unboxed_int); | ||
|
||
std::vector<Type*> args2_throw(0); | ||
args2_throw.push_back(T_pjlvalue); | ||
args2_throw.push_back(T_int32); | ||
jlthrow_line_func = | ||
(Function*)m->getOrInsertFunction("jl_throw_with_superfluous_argument", | ||
FunctionType::get(T_void, args2_throw, false)); | ||
jlthrow_line_func->setDoesNotReturn(); | ||
add_named_global(jlthrow_line_func, (void*)&jl_throw_with_superfluous_argument); | ||
|
||
jlnew_func = | ||
Function::Create(jl_func_sig, Function::ExternalLinkage, | ||
"jl_new_structv", m); | ||
|
@@ -5517,13 +5503,12 @@ static void init_julia_llvm_env(Module *m) | |
te_args.push_back(T_pint8); | ||
te_args.push_back(T_pjlvalue); | ||
te_args.push_back(T_pjlvalue); | ||
te_args.push_back(T_int32); | ||
jltypeerror_func = | ||
Function::Create(FunctionType::get(T_void, te_args, false), | ||
Function::ExternalLinkage, | ||
"jl_type_error_rt_line", m); | ||
"jl_type_error_rt", m); | ||
jltypeerror_func->setDoesNotReturn(); | ||
add_named_global(jltypeerror_func, (void*)&jl_type_error_rt_line); | ||
add_named_global(jltypeerror_func, (void*)&jl_type_error_rt); | ||
|
||
std::vector<Type *> args_2ptrs(0); | ||
args_2ptrs.push_back(T_pjlvalue); | ||
|
@@ -5923,13 +5908,16 @@ static void init_julia_llvm_env(Module *m) | |
|
||
extern "C" void jl_init_codegen(void) | ||
{ | ||
const char *const argv_tailmerge[] = {"", "-enable-tail-merge=0"}; // NOO TOUCHIE; NO TOUCH! See #922 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very funny 😄 |
||
cl::ParseCommandLineOptions(sizeof(argv_tailmerge)/sizeof(argv_tailmerge[0]), argv_tailmerge, "disable-tail-merge\n"); | ||
#if defined(_OS_WINDOWS_) && defined(_CPU_X86_64_) | ||
const char *const argv[] = {"", "-disable-copyprop"}; // llvm bug 21743 | ||
cl::ParseCommandLineOptions(sizeof(argv)/sizeof(argv[0]), argv, "disable-copyprop\n"); | ||
const char *const argv_copyprop[] = {"", "-disable-copyprop"}; // llvm bug 21743 | ||
cl::ParseCommandLineOptions(sizeof(argv_copyprop)/sizeof(argv_copyprop[0]), argv_copyprop, "disable-copyprop\n"); | ||
#endif | ||
#ifdef JL_DEBUG_BUILD | ||
cl::ParseEnvironmentOptions("Julia", "JULIA_LLVM_ARGS"); | ||
#endif | ||
|
||
#if defined(_CPU_PPC_) || defined(_CPU_PPC64_) | ||
imaging_mode = true; // LLVM seems to JIT bad TOC tables for the optimizations we attempt in non-imaging_mode | ||
#else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should the cost threshold be adjusted? The top-level expression count is going to increase significantly without the filter.
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.
possibly, it somewhat affects the expected average number of symbols per line (
julia/base/inference.jl
Line 2624 in d3af973
:line
Expr is pretty small. I think I'll wait to see if it is a concern.