@@ -298,7 +298,6 @@ extern RTDyldMemoryManager* createRTDyldMemoryManagerOSX();
298
298
// important functions
299
299
static Function *jlnew_func;
300
300
static Function *jlthrow_func;
301
- static Function *jlthrow_line_func;
302
301
static Function *jlerror_func;
303
302
static Function *jltypeerror_func;
304
303
static Function *jlundefvarerror_func;
@@ -468,7 +467,6 @@ typedef struct {
468
467
bool vaStack; // varargs stack-allocated
469
468
bool sret;
470
469
int nReqArgs;
471
- int lineno;
472
470
std::vector<bool > boundsCheck;
473
471
474
472
jl_gcinfo_t gc;
@@ -1272,7 +1270,7 @@ extern "C" void jl_write_malloc_log(void)
1272
1270
static void show_source_loc (JL_STREAM *out, jl_codectx_t *ctx)
1273
1271
{
1274
1272
if (ctx == NULL ) return ;
1275
- jl_printf (out, " in %s at %s:%d " , ctx->linfo ->name ->name , ctx->linfo ->file ->name , ctx-> lineno );
1273
+ jl_printf (out, " in %s at %s" , ctx->linfo ->name ->name , ctx->linfo ->file ->name );
1276
1274
}
1277
1275
1278
1276
extern " C" void jl_binding_deprecation_warning (jl_binding_t *b);
@@ -4185,7 +4183,6 @@ static Function *emit_function(jl_lambda_info_t *lam)
4185
4183
}
4186
4184
}
4187
4185
}
4188
- ctx.lineno = lno;
4189
4186
int toplineno = lno;
4190
4187
4191
4188
DIBuilder dbuilder (*m);
@@ -4197,6 +4194,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4197
4194
DIFile topfile;
4198
4195
DISubprogram SP;
4199
4196
#endif
4197
+ DebugLoc inlineLoc;
4200
4198
4201
4199
BasicBlock *b0 = BasicBlock::Create (jl_LLVMContext, " top" , f);
4202
4200
builder.SetInsertPoint (b0);
@@ -4273,7 +4271,8 @@ static Function *emit_function(jl_lambda_info_t *lam)
4273
4271
true , // isOptimized
4274
4272
f); // Fn
4275
4273
// set initial line number
4276
- builder.SetCurrentDebugLocation (DebugLoc::get (lno, 0 , (MDNode*)SP, NULL ));
4274
+ inlineLoc = DebugLoc::get (lno, 0 , (MDNode*)SP, NULL );
4275
+ builder.SetCurrentDebugLocation (inlineLoc);
4277
4276
#ifndef LLVM37
4278
4277
assert (SP.Verify () && SP.describes (f) && SP.getFunction () == f);
4279
4278
#endif
@@ -4290,7 +4289,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4290
4289
argname->name , // Variable name
4291
4290
ctx.sret + i + 1 , // Argument number (1-based)
4292
4291
topfile, // File
4293
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line
4292
+ toplineno == -1 ? 0 : toplineno , // Line
4294
4293
// Variable type
4295
4294
julia_type_to_di (varinfo.declType ,ctx.dbuilder ,specsig));
4296
4295
#else
@@ -4299,7 +4298,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4299
4298
SP, // Scope (current function will be fill in later)
4300
4299
argname->name , // Variable name
4301
4300
topfile, // File
4302
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4301
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4303
4302
julia_type_to_di (varinfo.declType ,ctx.dbuilder ,specsig), // Variable type
4304
4303
false , // May be optimized out
4305
4304
0 , // Flags (TODO: Do we need any)
@@ -4313,15 +4312,15 @@ static Function *emit_function(jl_lambda_info_t *lam)
4313
4312
ctx.vaName ->name , // Variable name
4314
4313
ctx.sret + nreq + 1 , // Argument number (1-based)
4315
4314
topfile, // File
4316
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4315
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4317
4316
julia_type_to_di (ctx.vars [ctx.vaName ].declType ,ctx.dbuilder ,false ));
4318
4317
#else
4319
4318
ctx.vars [ctx.vaName ].dinfo = ctx.dbuilder ->createLocalVariable (
4320
4319
llvm::dwarf::DW_TAG_arg_variable, // Tag
4321
4320
SP, // Scope (current function will be fill in later)
4322
4321
ctx.vaName ->name , // Variable name
4323
4322
topfile, // File
4324
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4323
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4325
4324
julia_type_to_di (ctx.vars [ctx.vaName ].declType ,ctx.dbuilder ,false ), // Variable type
4326
4325
false , // May be optimized out
4327
4326
0 , // Flags (TODO: Do we need any)
@@ -4342,7 +4341,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4342
4341
SP, // Scope (current function will be fill in later)
4343
4342
s->name , // Variable name
4344
4343
topfile, // File
4345
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4344
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4346
4345
julia_type_to_di (varinfo.declType ,ctx.dbuilder ,specsig), // Variable type
4347
4346
false , // May be optimized out
4348
4347
0 // Flags (TODO: Do we need any)
@@ -4366,7 +4365,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
4366
4365
SP, // Scope (current function will be filled in later)
4367
4366
vname->name , // Variable name
4368
4367
topfile, // File
4369
- ctx. lineno == -1 ? 0 : ctx. lineno , // Line (for now, use lineno of the function)
4368
+ toplineno == -1 ? 0 : toplineno , // Line (for now, use lineno of the function)
4370
4369
julia_type_to_di (varinfo.declType ,ctx.dbuilder ,specsig), // Variable type
4371
4370
false , // May be optimized out
4372
4371
0 // Flags (TODO: Do we need any)
@@ -4732,35 +4731,31 @@ static Function *emit_function(jl_lambda_info_t *lam)
4732
4731
}
4733
4732
DebugLoc loc;
4734
4733
if (ctx.debug_enabled ) {
4735
- MDNode *funcscope = (MDNode*)dbuilder.createLexicalBlockFile (SP, topfile);
4736
4734
MDNode *scope;
4737
4735
if ((dfil == topfile || dfil == NULL ) &&
4738
4736
lno >= toplineno)
4739
4737
{
4740
4738
// for sequentially-defined code,
4741
4739
// set location to line in top file.
4742
4740
// TODO: improve handling of nested inlines
4743
- loc = DebugLoc::get (lno, 1 , SP, NULL );
4741
+ loc = inlineLoc = DebugLoc::get (lno, 1 , SP, NULL );
4744
4742
} else {
4745
4743
// otherwise, we are compiling inlined code,
4746
4744
// so set the DebugLoc "inlinedAt" parameter
4747
4745
// to the current line, then use source loc.
4748
4746
#ifdef LLVM37
4749
4747
scope = (MDNode*)dbuilder.createLexicalBlockFile (SP,dfil);
4750
- MDNode *inlineLocMd = DebugLoc::get (toplineno, 1 , funcscope, NULL ).
4751
- getAsMDNode ();
4748
+ MDNode *inlineLocMd = inlineLoc.getAsMDNode ();
4752
4749
#else
4753
4750
scope = (MDNode*)dbuilder.createLexicalBlockFile (SP,DIFile (dfil));
4754
- MDNode *inlineLocMd = DebugLoc::get (toplineno, 1 , funcscope, NULL ).
4755
- getAsMDNode (jl_LLVMContext);
4751
+ MDNode *inlineLocMd = inlineLoc.getAsMDNode (jl_LLVMContext);
4756
4752
#endif
4757
4753
loc = DebugLoc::get (lno, 1 , scope, inlineLocMd);
4758
4754
}
4759
4755
builder.SetCurrentDebugLocation (loc);
4760
4756
}
4761
4757
if (do_coverage)
4762
4758
coverageVisitLine (filename, lno);
4763
- ctx.lineno = lno; // NOO TOUCHIE; NO TOUCH! See #922
4764
4759
}
4765
4760
if (jl_is_labelnode (stmt)) {
4766
4761
if (prevlabel) continue ;
@@ -5199,15 +5194,6 @@ static void init_julia_llvm_env(Module *m)
5199
5194
jluboundserror_func->setDoesNotReturn ();
5200
5195
add_named_global (jluboundserror_func, (void *)&jl_bounds_error_unboxed_int);
5201
5196
5202
- std::vector<Type*> args2_throw (0 );
5203
- args2_throw.push_back (jl_pvalue_llvmt);
5204
- args2_throw.push_back (T_int32);
5205
- jlthrow_line_func =
5206
- (Function*)m->getOrInsertFunction (" jl_throw_with_superfluous_argument" ,
5207
- FunctionType::get (T_void, args2_throw, false ));
5208
- jlthrow_line_func->setDoesNotReturn ();
5209
- add_named_global (jlthrow_line_func, (void *)&jl_throw_with_superfluous_argument);
5210
-
5211
5197
jlnew_func =
5212
5198
Function::Create (jl_func_sig, Function::ExternalLinkage,
5213
5199
" jl_new_structv" , m);
@@ -5238,13 +5224,12 @@ static void init_julia_llvm_env(Module *m)
5238
5224
te_args.push_back (T_pint8);
5239
5225
te_args.push_back (jl_pvalue_llvmt);
5240
5226
te_args.push_back (jl_pvalue_llvmt);
5241
- te_args.push_back (T_int32);
5242
5227
jltypeerror_func =
5243
5228
Function::Create (FunctionType::get (T_void, te_args, false ),
5244
5229
Function::ExternalLinkage,
5245
- " jl_type_error_rt_line " , m);
5230
+ " jl_type_error_rt " , m);
5246
5231
jltypeerror_func->setDoesNotReturn ();
5247
- add_named_global (jltypeerror_func, (void *)&jl_type_error_rt_line );
5232
+ add_named_global (jltypeerror_func, (void *)&jl_type_error_rt );
5248
5233
5249
5234
std::vector<Type *> args_2ptrs (0 );
5250
5235
args_2ptrs.push_back (jl_pvalue_llvmt);
@@ -5686,13 +5671,16 @@ static inline SmallVector<std::string,10> getTargetFeatures() {
5686
5671
5687
5672
extern " C" void jl_init_codegen (void )
5688
5673
{
5674
+ const char *const argv_tailmerge[] = {" " , " -enable-tail-merge=0" }; // NOO TOUCHIE; NO TOUCH! See #922
5675
+ cl::ParseCommandLineOptions (sizeof (argv_tailmerge)/sizeof (argv_tailmerge[0 ]), argv_tailmerge, " disable-tail-merge\n " );
5689
5676
#if defined(_OS_WINDOWS_) && defined(_CPU_X86_64_)
5690
- const char *const argv [] = {" " , " -disable-copyprop" }; // llvm bug 21743
5691
- cl::ParseCommandLineOptions (sizeof (argv )/sizeof (argv [0 ]), argv , " disable-copyprop\n " );
5677
+ const char *const argv_copyprop [] = {" " , " -disable-copyprop" }; // llvm bug 21743
5678
+ cl::ParseCommandLineOptions (sizeof (argv_copyprop )/sizeof (argv_copyprop [0 ]), argv_copyprop , " disable-copyprop\n " );
5692
5679
#endif
5693
5680
#ifdef JL_DEBUG_BUILD
5694
5681
cl::ParseEnvironmentOptions (" Julia" , " JULIA_LLVM_ARGS" );
5695
5682
#endif
5683
+
5696
5684
#if defined(_CPU_PPC_) || defined(_CPU_PPC64_)
5697
5685
imaging_mode = true ; // LLVM seems to JIT bad TOC tables for the optimizations we attempt in non-imaging_mode
5698
5686
#else
0 commit comments