@@ -1719,6 +1719,10 @@ static void jl_init_function(Function *F)
1719
1719
F->addFnAttr (" no-frame-pointer-elim" , " true" );
1720
1720
#endif
1721
1721
#endif
1722
+ #if JL_LLVM_VERSION >= 110000 && !defined(JL_ASAN_ENABLED)
1723
+ F->addFnAttr (" probe-stack" , " inline-asm" );
1724
+ // F->addFnAttr("stack-probe-size", 4096); // can use this to change the default
1725
+ #endif
1722
1726
}
1723
1727
1724
1728
static std::pair<bool , bool > uses_specsig (jl_method_instance_t *lam, jl_value_t *rettype, bool prefer_specsig)
@@ -6297,28 +6301,15 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6297
6301
}
6298
6302
}
6299
6303
6300
- /*
6301
- // step 6. (optional) check for stack overflow (the slower way)
6302
- Value *cur_sp =
6303
- ctx.builder.CreateCall(Intrinsic::getDeclaration(M,
6304
- Intrinsic::frameaddress),
6305
- ConstantInt::get(T_int32, 0));
6306
- Value *sp_ok =
6307
- ctx.builder.CreateICmpUGT(cur_sp,
6308
- ConstantInt::get(T_size,
6309
- (uptrint_t)jl_stack_lo));
6310
- error_unless(ctx, sp_ok, "stack overflow");
6311
- */
6312
-
6313
- // step 7. set up GC frame
6304
+ // step 6. set up GC frame
6314
6305
allocate_gc_frame (ctx, b0);
6315
6306
Value *last_age = NULL ;
6316
6307
emit_last_age_field (ctx);
6317
6308
if (toplevel || ctx.is_opaque_closure ) {
6318
6309
last_age = tbaa_decorate (tbaa_gcframe, ctx.builder .CreateAlignedLoad (ctx.world_age_field , Align (sizeof (size_t ))));
6319
6310
}
6320
6311
6321
- // step 8 . allocate local variables slots
6312
+ // step 7 . allocate local variables slots
6322
6313
// must be in the first basic block for the llvm mem2reg pass to work
6323
6314
auto allocate_local = [&](jl_varinfo_t &varinfo, jl_sym_t *s) {
6324
6315
jl_value_t *jt = varinfo.value .typ ;
@@ -6436,7 +6427,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6436
6427
}
6437
6428
}
6438
6429
6439
- // step 9 . move args into local variables
6430
+ // step 8 . move args into local variables
6440
6431
Function::arg_iterator AI = f->arg_begin ();
6441
6432
6442
6433
auto get_specsig_arg = [&](jl_value_t *argType, Type *llvmArgType, bool isboxed) {
@@ -6566,7 +6557,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6566
6557
}
6567
6558
}
6568
6559
6569
- // step 10 . allocate rest argument
6560
+ // step 9 . allocate rest argument
6570
6561
CallInst *restTuple = NULL ;
6571
6562
if (va && ctx.vaSlot != -1 ) {
6572
6563
jl_varinfo_t &vi = ctx.slots [ctx.vaSlot ];
@@ -6608,7 +6599,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6608
6599
}
6609
6600
}
6610
6601
6611
- // step 11 . Compute properties for each statements
6602
+ // step 10 . Compute properties for each statements
6612
6603
// This needs to be computed by iterating in the IR order
6613
6604
// instead of control flow order.
6614
6605
auto in_user_mod = [] (jl_module_t *mod) {
@@ -6730,7 +6721,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6730
6721
Instruction &prologue_end = ctx.builder .GetInsertBlock ()->back ();
6731
6722
6732
6723
6733
- // step 12 . Do codegen in control flow order
6724
+ // step 11 . Do codegen in control flow order
6734
6725
std::vector<int > workstack;
6735
6726
std::map<int , BasicBlock*> BB;
6736
6727
std::map<size_t , BasicBlock*> come_from_bb;
@@ -7288,7 +7279,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
7288
7279
PN->eraseFromParent ();
7289
7280
}
7290
7281
7291
- // step 13 . Perform any delayed instantiations
7282
+ // step 12 . Perform any delayed instantiations
7292
7283
if (ctx.debug_enabled ) {
7293
7284
bool in_prologue = true ;
7294
7285
for (auto &BB : *ctx.f ) {
0 commit comments