@@ -1777,14 +1777,6 @@ static void jl_init_function(Function *F)
1777
1777
#ifdef JL_DISABLE_FPO
1778
1778
F->addFnAttr (" frame-pointer" , " all" );
1779
1779
#endif
1780
- #if !defined(_COMPILER_ASAN_ENABLED_) && !defined(_OS_WINDOWS_)
1781
- // ASAN won't like us accessing undefined memory causing spurious issues,
1782
- // and Windows has platform-specific handling which causes it to mishandle
1783
- // this annotation. Other platforms should just ignore this if they don't
1784
- // implement it.
1785
- F->addFnAttr (" probe-stack" , " inline-asm" );
1786
- // F->addFnAttr("stack-probe-size", 4096); // can use this to change the default
1787
- #endif
1788
1780
}
1789
1781
1790
1782
static std::pair<bool , bool > uses_specsig (jl_method_instance_t *lam, jl_value_t *rettype, bool prefer_specsig)
@@ -6496,15 +6488,28 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6496
6488
}
6497
6489
}
6498
6490
6499
- // step 6. set up GC frame
6491
+ /*
6492
+ // step 6. (optional) check for stack overflow (the slower way)
6493
+ Value *cur_sp =
6494
+ ctx.builder.CreateCall(Intrinsic::getDeclaration(M,
6495
+ Intrinsic::frameaddress),
6496
+ ConstantInt::get(T_int32, 0));
6497
+ Value *sp_ok =
6498
+ ctx.builder.CreateICmpUGT(cur_sp,
6499
+ ConstantInt::get(T_size,
6500
+ (uptrint_t)jl_stack_lo));
6501
+ error_unless(ctx, sp_ok, "stack overflow");
6502
+ */
6503
+
6504
+ // step 7. set up GC frame
6500
6505
allocate_gc_frame (ctx, b0);
6501
6506
Value *last_age = NULL ;
6502
6507
emit_last_age_field (ctx);
6503
6508
if (toplevel || ctx.is_opaque_closure ) {
6504
6509
last_age = tbaa_decorate (tbaa_gcframe, ctx.builder .CreateAlignedLoad (ctx.world_age_field , Align (sizeof (size_t ))));
6505
6510
}
6506
6511
6507
- // step 7 . allocate local variables slots
6512
+ // step 8 . allocate local variables slots
6508
6513
// must be in the first basic block for the llvm mem2reg pass to work
6509
6514
auto allocate_local = [&](jl_varinfo_t &varinfo, jl_sym_t *s) {
6510
6515
jl_value_t *jt = varinfo.value .typ ;
@@ -6622,7 +6627,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6622
6627
}
6623
6628
}
6624
6629
6625
- // step 8 . move args into local variables
6630
+ // step 9 . move args into local variables
6626
6631
Function::arg_iterator AI = f->arg_begin ();
6627
6632
6628
6633
auto get_specsig_arg = [&](jl_value_t *argType, Type *llvmArgType, bool isboxed) {
@@ -6752,7 +6757,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6752
6757
}
6753
6758
}
6754
6759
6755
- // step 9 . allocate rest argument
6760
+ // step 10 . allocate rest argument
6756
6761
CallInst *restTuple = NULL ;
6757
6762
if (va && ctx.vaSlot != -1 ) {
6758
6763
jl_varinfo_t &vi = ctx.slots [ctx.vaSlot ];
@@ -6794,7 +6799,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6794
6799
}
6795
6800
}
6796
6801
6797
- // step 10 . Compute properties for each statements
6802
+ // step 11 . Compute properties for each statements
6798
6803
// This needs to be computed by iterating in the IR order
6799
6804
// instead of control flow order.
6800
6805
auto in_user_mod = [] (jl_module_t *mod) {
@@ -6916,7 +6921,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
6916
6921
Instruction &prologue_end = ctx.builder .GetInsertBlock ()->back ();
6917
6922
6918
6923
6919
- // step 11 . Do codegen in control flow order
6924
+ // step 12 . Do codegen in control flow order
6920
6925
std::vector<int > workstack;
6921
6926
std::map<int , BasicBlock*> BB;
6922
6927
std::map<size_t , BasicBlock*> come_from_bb;
@@ -7463,7 +7468,7 @@ static std::pair<std::unique_ptr<Module>, jl_llvm_functions_t>
7463
7468
PN->eraseFromParent ();
7464
7469
}
7465
7470
7466
- // step 12 . Perform any delayed instantiations
7471
+ // step 13 . Perform any delayed instantiations
7467
7472
if (ctx.debug_enabled ) {
7468
7473
bool in_prologue = true ;
7469
7474
for (auto &BB : *ctx.f ) {
0 commit comments