@@ -315,7 +315,6 @@ extern RTDyldMemoryManager* createRTDyldMemoryManagerOSX();
315
315
// important functions
316
316
static Function *jlnew_func;
317
317
static Function *jlthrow_func;
318
- static Function *jlthrow_line_func;
319
318
static Function *jlerror_func;
320
319
static Function *jltypeerror_func;
321
320
static Function *jlundefvarerror_func;
@@ -539,7 +538,6 @@ typedef struct {
539
538
bool vaStack; // varargs stack-allocated
540
539
bool sret;
541
540
int nReqArgs;
542
- int lineno;
543
541
std::vector<bool > boundsCheck;
544
542
545
543
jl_gcinfo_t gc;
@@ -1437,7 +1435,7 @@ extern "C" void jl_write_malloc_log(void)
1437
1435
static void show_source_loc (JL_STREAM *out, jl_codectx_t *ctx)
1438
1436
{
1439
1437
if (ctx == NULL ) return ;
1440
- jl_printf (out, " in %s at %s:%d " , ctx->linfo ->name ->name , ctx->linfo ->file ->name , ctx-> lineno );
1438
+ jl_printf (out, " in %s at %s" , ctx->linfo ->name ->name , ctx->linfo ->file ->name );
1441
1439
}
1442
1440
1443
1441
extern " C" void jl_binding_deprecation_warning (jl_binding_t *b);
@@ -4417,7 +4415,6 @@ static Function *emit_function(jl_lambda_info_t *lam)
4417
4415
}
4418
4416
}
4419
4417
}
4420
- ctx.lineno = lno;
4421
4418
int toplineno = lno;
4422
4419
4423
4420
DIBuilder dbuilder (*m);
@@ -4429,6 +4426,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4429
4426
DIFile topfile;
4430
4427
DISubprogram SP;
4431
4428
#endif
4429
+ DebugLoc inlineLoc;
4432
4430
4433
4431
BasicBlock *b0 = BasicBlock::Create (jl_LLVMContext, " top" , f);
4434
4432
builder.SetInsertPoint (b0);
@@ -4503,7 +4501,8 @@ static Function *emit_function(jl_lambda_info_t *lam)
4503
4501
true , // isOptimized
4504
4502
f); // Fn
4505
4503
// set initial line number
4506
- builder.SetCurrentDebugLocation (DebugLoc::get (lno, 0 , (MDNode*)SP, NULL ));
4504
+ inlineLoc = DebugLoc::get (lno, 0 , (MDNode*)SP, NULL );
4505
+ builder.SetCurrentDebugLocation (inlineLoc);
4507
4506
#ifndef LLVM37
4508
4507
assert (SP.Verify () && SP.describes (f) && SP.getFunction () == f);
4509
4508
#endif
@@ -4520,7 +4519,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4520
4519
argname->name , // Variable name
4521
4520
ctx.sret + i + 1 , // Argument number (1-based)
4522
4521
topfile, // File
4523
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line
4522
+ toplineno == -1 ? 0 : toplineno , // Line
4524
4523
// Variable type
4525
4524
julia_type_to_di (varinfo.value .typ ,ctx.dbuilder ,specsig));
4526
4525
#else
@@ -4529,7 +4528,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4529
4528
SP, // Scope (current function will be fill in later)
4530
4529
argname->name , // Variable name
4531
4530
topfile, // File
4532
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4531
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4533
4532
julia_type_to_di (varinfo.value .typ , ctx.dbuilder , specsig), // Variable type
4534
4533
false , // May be optimized out
4535
4534
0 , // Flags (TODO: Do we need any)
@@ -4543,15 +4542,15 @@ static Function *emit_function(jl_lambda_info_t *lam)
4543
4542
ctx.vaName ->name , // Variable name
4544
4543
ctx.sret + nreq + 1 , // Argument number (1-based)
4545
4544
topfile, // File
4546
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4545
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4547
4546
julia_type_to_di (ctx.vars [ctx.vaName ].value .typ , ctx.dbuilder , false ));
4548
4547
#else
4549
4548
ctx.vars [ctx.vaName ].dinfo = ctx.dbuilder ->createLocalVariable (
4550
4549
llvm::dwarf::DW_TAG_arg_variable, // Tag
4551
4550
SP, // Scope (current function will be fill in later)
4552
4551
ctx.vaName ->name , // Variable name
4553
4552
topfile, // File
4554
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4553
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4555
4554
julia_type_to_di (ctx.vars [ctx.vaName ].value .typ , ctx.dbuilder , false ), // Variable type
4556
4555
false , // May be optimized out
4557
4556
0 , // Flags (TODO: Do we need any)
@@ -4572,7 +4571,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4572
4571
SP, // Scope (current function will be fill in later)
4573
4572
s->name , // Variable name
4574
4573
topfile, // File
4575
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4574
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4576
4575
julia_type_to_di (varinfo.value .typ , ctx.dbuilder , specsig), // Variable type
4577
4576
false , // May be optimized out
4578
4577
0 // Flags (TODO: Do we need any)
@@ -4596,7 +4595,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4596
4595
SP, // Scope (current function will be filled in later)
4597
4596
vname->name , // Variable name
4598
4597
topfile, // File
4599
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4598
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4600
4599
julia_type_to_di (varinfo.value .typ , ctx.dbuilder , specsig), // Variable type
4601
4600
false , // May be optimized out
4602
4601
0 // Flags (TODO: Do we need any)
@@ -4996,35 +4995,31 @@ static Function *emit_function(jl_lambda_info_t *lam)
4996
4995
}
4997
4996
DebugLoc loc;
4998
4997
if (ctx.debug_enabled ) {
4999
- MDNode *funcscope = (MDNode*)dbuilder.createLexicalBlockFile (SP, topfile);
5000
4998
MDNode *scope;
5001
4999
if ((dfil == topfile || dfil == NULL ) &&
5002
5000
lno >= toplineno)
5003
5001
{
5004
5002
// for sequentially-defined code,
5005
5003
// set location to line in top file.
5006
5004
// TODO: improve handling of nested inlines
5007
- loc = DebugLoc::get (lno, 1 , SP, NULL );
5005
+ loc = inlineLoc = DebugLoc::get (lno, 1 , SP, NULL );
5008
5006
} else {
5009
5007
// otherwise, we are compiling inlined code,
5010
5008
// so set the DebugLoc "inlinedAt" parameter
5011
5009
// to the current line, then use source loc.
5012
5010
#ifdef LLVM37
5013
5011
scope = (MDNode*)dbuilder.createLexicalBlockFile (SP,dfil);
5014
- MDNode *inlineLocMd = DebugLoc::get (toplineno, 1 , funcscope, NULL ).
5015
- getAsMDNode ();
5012
+ MDNode *inlineLocMd = inlineLoc.getAsMDNode ();
5016
5013
#else
5017
5014
scope = (MDNode*)dbuilder.createLexicalBlockFile (SP,DIFile (dfil));
5018
- MDNode *inlineLocMd = DebugLoc::get (toplineno, 1 , funcscope, NULL ).
5019
- getAsMDNode (jl_LLVMContext);
5015
+ MDNode *inlineLocMd = inlineLoc.getAsMDNode (jl_LLVMContext);
5020
5016
#endif
5021
5017
loc = DebugLoc::get (lno, 1 , scope, inlineLocMd);
5022
5018
}
5023
5019
builder.SetCurrentDebugLocation (loc);
5024
5020
}
5025
5021
if (do_coverage)
5026
5022
coverageVisitLine (filename, lno);
5027
- ctx.lineno = lno; // NOO TOUCHIE; NO TOUCH! See #922
5028
5023
}
5029
5024
if (jl_is_labelnode (stmt)) {
5030
5025
if (prevlabel) continue ;
@@ -5478,15 +5473,6 @@ static void init_julia_llvm_env(Module *m)
5478
5473
jluboundserror_func->setDoesNotReturn ();
5479
5474
add_named_global (jluboundserror_func, (void *)&jl_bounds_error_unboxed_int);
5480
5475
5481
- std::vector<Type*> args2_throw (0 );
5482
- args2_throw.push_back (T_pjlvalue);
5483
- args2_throw.push_back (T_int32);
5484
- jlthrow_line_func =
5485
- (Function*)m->getOrInsertFunction (" jl_throw_with_superfluous_argument" ,
5486
- FunctionType::get (T_void, args2_throw, false ));
5487
- jlthrow_line_func->setDoesNotReturn ();
5488
- add_named_global (jlthrow_line_func, (void *)&jl_throw_with_superfluous_argument);
5489
-
5490
5476
jlnew_func =
5491
5477
Function::Create (jl_func_sig, Function::ExternalLinkage,
5492
5478
" jl_new_structv" , m);
@@ -5517,13 +5503,12 @@ static void init_julia_llvm_env(Module *m)
5517
5503
te_args.push_back (T_pint8);
5518
5504
te_args.push_back (T_pjlvalue);
5519
5505
te_args.push_back (T_pjlvalue);
5520
- te_args.push_back (T_int32);
5521
5506
jltypeerror_func =
5522
5507
Function::Create (FunctionType::get (T_void, te_args, false ),
5523
5508
Function::ExternalLinkage,
5524
- " jl_type_error_rt_line " , m);
5509
+ " jl_type_error_rt " , m);
5525
5510
jltypeerror_func->setDoesNotReturn ();
5526
- add_named_global (jltypeerror_func, (void *)&jl_type_error_rt_line );
5511
+ add_named_global (jltypeerror_func, (void *)&jl_type_error_rt );
5527
5512
5528
5513
std::vector<Type *> args_2ptrs (0 );
5529
5514
args_2ptrs.push_back (T_pjlvalue);
@@ -5923,13 +5908,16 @@ static void init_julia_llvm_env(Module *m)
5923
5908
5924
5909
extern " C" void jl_init_codegen (void )
5925
5910
{
5911
+ const char *const argv_tailmerge[] = {" " , " -enable-tail-merge=0" }; // NOO TOUCHIE; NO TOUCH! See #922
5912
+ cl::ParseCommandLineOptions (sizeof (argv_tailmerge)/sizeof (argv_tailmerge[0 ]), argv_tailmerge, " disable-tail-merge\n " );
5926
5913
#if defined(_OS_WINDOWS_) && defined(_CPU_X86_64_)
5927
- const char *const argv [] = {" " , " -disable-copyprop" }; // llvm bug 21743
5928
- cl::ParseCommandLineOptions (sizeof (argv )/sizeof (argv [0 ]), argv , " disable-copyprop\n " );
5914
+ const char *const argv_copyprop [] = {" " , " -disable-copyprop" }; // llvm bug 21743
5915
+ cl::ParseCommandLineOptions (sizeof (argv_copyprop )/sizeof (argv_copyprop [0 ]), argv_copyprop , " disable-copyprop\n " );
5929
5916
#endif
5930
5917
#ifdef JL_DEBUG_BUILD
5931
5918
cl::ParseEnvironmentOptions (" Julia" , " JULIA_LLVM_ARGS" );
5932
5919
#endif
5920
+
5933
5921
#if defined(_CPU_PPC_) || defined(_CPU_PPC64_)
5934
5922
imaging_mode = true ; // LLVM seems to JIT bad TOC tables for the optimizations we attempt in non-imaging_mode
5935
5923
#else
0 commit comments