@@ -261,9 +261,7 @@ static GlobalVariable *jlemptytuple_var;
261261#if JL_NEED_FLOATTEMP_VAR
262262static GlobalVariable *jlfloattemp_var;
263263#endif
264- #ifdef JL_GC_MARKSWEEP
265264static GlobalVariable *jlpgcstack_var;
266- #endif
267265static GlobalVariable *jlexc_var;
268266static GlobalVariable *jldiverr_var;
269267static GlobalVariable *jlundeferr_var;
@@ -334,10 +332,8 @@ static Function *box8_func;
334332static Function *box16_func;
335333static Function *box32_func;
336334static Function *box64_func;
337- #ifdef JL_GC_MARKSWEEP
338335static Function *wbfunc;
339336static Function *queuerootfun;
340- #endif
341337static Function *expect_func;
342338static Function *jldlsym_func;
343339static Function *jlnewbits_func;
@@ -540,11 +536,9 @@ struct jl_gcinfo_t {
540536 int argDepth;
541537 int maxDepth;
542538 int argSpaceOffs;
543- #ifdef JL_GC_MARKSWEEP
544539 Instruction *gcframe;
545540 Instruction *argSpaceInits;
546541 StoreInst *storeFrameSize;
547- #endif
548542 BasicBlock::iterator first_gcframe_inst;
549543 BasicBlock::iterator last_gcframe_inst;
550544 std::vector<Instruction*> gc_frame_pops;
@@ -2696,10 +2690,8 @@ static Value *emit_call(jl_value_t **args, size_t arglen, jl_codectx_t *ctx, jl_
26962690 }
26972691 if (theFptr == NULL ) {
26982692 Value *theFunc = emit_expr (args[0 ], ctx);
2699- #ifdef JL_GC_MARKSWEEP
27002693 if (!headIsGlobal && (jl_is_expr (a0) || jl_is_lambda_info (a0)))
27012694 make_gcroot (boxed (theFunc,ctx), ctx);
2702- #endif
27032695 // extract pieces of the function object
27042696 // TODO: try extractvalue instead
27052697 theFptr = emit_nthptr_recast (theFunc, (ssize_t )(offsetof (jl_function_t ,fptr)/sizeof (void *)), tbaa_func, jl_pfptr_llvmt);
@@ -3579,7 +3571,6 @@ static void allocate_gc_frame(size_t n_roots, BasicBlock *b0, jl_codectx_t *ctx)
35793571 gc->argDepth = 0 ;
35803572 gc->maxDepth = 0 ;
35813573
3582- #ifdef JL_GC_MARKSWEEP
35833574 // allocate gc frame
35843575 // gc->gcframe is assumed to be the first instruction creating the gc frame
35853576 // in finalize_gc_frame.
@@ -3595,14 +3586,6 @@ static void allocate_gc_frame(size_t n_roots, BasicBlock *b0, jl_codectx_t *ctx)
35953586 builder.CreateBitCast (builder.CreateConstGEP1_32 (gc->gcframe , 1 ), PointerType::get (jl_ppvalue_llvmt,0 )));
35963587 Instruction *linst = builder.CreateStore (gc->gcframe , prepare_global (jlpgcstack_var), false );
35973588 gc->argSpaceInits = &b0->back ();
3598- #else
3599- // gc->gcframe is assumed to be the first instruction creating the gc frame
3600- // in finalize_gc_frame
3601- gc->argTemp = builder.CreateAlloca (jl_pvalue_llvmt,
3602- ConstantInt::get (T_int32, n_roots));
3603- gc->first_gcframe_inst = BasicBlock::iterator (gc->argTemp );
3604- Instruction *linst = gc->argTemp ;
3605- #endif
36063589 // initialize local variable stack roots to null
36073590 for (size_t i=0 ; i < (size_t )gc->argSpaceOffs ; i++) {
36083591 Value *varSlot = emit_local_slot (i, ctx);
@@ -3656,7 +3639,6 @@ static void clear_gc_frame(jl_gcinfo_t *gc)
36563639static void finalize_gc_frame (jl_codectx_t *ctx)
36573640{
36583641 jl_gcinfo_t *gc = &ctx->gc ;
3659- #ifdef JL_GC_MARKSWEEP
36603642 if (gc->argSpaceOffs + gc->maxDepth == 0 ) {
36613643 // 0 roots; remove gc frame entirely
36623644 clear_gc_frame (gc);
@@ -3691,33 +3673,18 @@ static void finalize_gc_frame(jl_codectx_t *ctx)
36913673 instList.insertAfter (argTempi, after);
36923674 }
36933675 }
3694- #else
3695- if (gc->maxDepth != 0 ) {
3696- BasicBlock::iterator bbi (gc->argTemp );
3697- AllocaInst *newgcframe =
3698- new AllocaInst (jl_pvalue_llvmt,
3699- ConstantInt::get (T_int32, (gc->argSpaceOffs +
3700- gc->maxDepth )));
3701- ReplaceInstWithInst (gc->argTemp ->getParent ()->getInstList (), bbi,
3702- newgcframe);
3703- }
3704- #endif
37053676}
37063677
37073678static void
37083679emit_gcpop (jl_codectx_t *ctx)
37093680{
3710- #ifdef JL_GC_MARKSWEEP
37113681 // finalize_gc_frame assumes each frame pop takes 4 instructions.
37123682 Instruction *gcpop =
37133683 (Instruction*)builder.CreateConstGEP1_32 (ctx->gc .gcframe , 1 );
37143684 ctx->gc .gc_frame_pops .push_back (gcpop);
37153685 builder.CreateStore (builder.CreateBitCast (builder.CreateLoad (gcpop, false ),
37163686 jl_ppvalue_llvmt),
37173687 prepare_global (jlpgcstack_var));
3718- #else
3719- (void )ctx;
3720- #endif
37213688}
37223689
37233690static Function *gen_cfun_wrapper (jl_function_t *ff, jl_value_t *jlrettype, jl_tupletype_t *argt, int64_t isref)
@@ -5129,13 +5096,11 @@ static void init_julia_llvm_env(Module *m)
51295096 " jl_array_t" );
51305097 jl_parray_llvmt = PointerType::get (jl_array_llvmt,0 );
51315098
5132- #ifdef JL_GC_MARKSWEEP
51335099 jlpgcstack_var =
51345100 new GlobalVariable (*m, jl_ppvalue_llvmt,
51355101 false , GlobalVariable::ExternalLinkage,
51365102 NULL , " jl_pgcstack" );
51375103 add_named_global (jlpgcstack_var, (void *)&jl_pgcstack);
5138- #endif
51395104
51405105 global_to_llvm (" __stack_chk_guard" , (void *)&__stack_chk_guard, m);
51415106 Function *jl__stack_chk_fail =
@@ -5356,7 +5321,6 @@ static void init_julia_llvm_env(Module *m)
53565321 jlgetfield_func = builtin_func_map[jl_f_get_field];
53575322 jlapplygeneric_func = jlcall_func_to_llvm (" jl_apply_generic" , (void *)&jl_apply_generic, m);
53585323
5359- #ifdef JL_GC_MARKSWEEP
53605324 queuerootfun = Function::Create (FunctionType::get (T_void, args_1ptr, false ),
53615325 Function::ExternalLinkage,
53625326 " jl_gc_queue_root" , m);
@@ -5369,7 +5333,6 @@ static void init_julia_llvm_env(Module *m)
53695333 Function::ExternalLinkage,
53705334 " jl_gc_wb_slow" , m);
53715335 add_named_global (wbfunc, (void *)&jl_gc_wb_slow);
5372- #endif
53735336
53745337 std::vector<Type *> exp_args (0 );
53755338 exp_args.push_back (T_int1);
0 commit comments