Skip to content

Commit dcfcbea

Browse files
committed
Merge branch 'master' of github.com:JuliaLang/julia
2 parents 1267b52 + a1378b4 commit dcfcbea

File tree

12 files changed

+3
-152
lines changed

12 files changed

+3
-152
lines changed

src/alloc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,6 @@ void jl_init_box_caches(void)
805805
}
806806
}
807807

808-
#ifdef JL_GC_MARKSWEEP
809808
void jl_mark_box_caches(void)
810809
{
811810
int64_t i;
@@ -824,7 +823,6 @@ void jl_mark_box_caches(void)
824823
jl_gc_setmark(boxed_gensym_cache[i]);
825824
}
826825
}
827-
#endif
828826

829827
jl_value_t *jl_box_bool(int8_t x)
830828
{

src/ast.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ static jl_value_t *full_list_of_lists(value_t e, int expronly)
197197

198198
static jl_value_t *scm_to_julia(value_t e, int expronly)
199199
{
200-
#ifdef JL_GC_MARKSWEEP
201200
int en = jl_gc_enable(0);
202-
#endif
203201
jl_value_t *v;
204202
JL_TRY {
205203
v = scm_to_julia_(e, expronly);
@@ -210,9 +208,7 @@ static jl_value_t *scm_to_julia(value_t e, int expronly)
210208
jl_cellset(ex->args, 0, jl_cstr_to_string("invalid AST"));
211209
v = (jl_value_t*)ex;
212210
}
213-
#ifdef JL_GC_MARKSWEEP
214211
jl_gc_enable(en);
215-
#endif
216212
return v;
217213
}
218214

src/builtins.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,7 @@ void jl_enter_handler(jl_handler_t *eh)
188188
{
189189
JL_SIGATOMIC_BEGIN();
190190
eh->prev = jl_current_task->eh;
191-
#ifdef JL_GC_MARKSWEEP
192191
eh->gcstack = jl_pgcstack;
193-
#endif
194192
jl_current_task->eh = eh;
195193
// TODO: this should really go after setjmp(). see comment in
196194
// ctx_switch in task.c.

src/ccall.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,10 @@ static Value *emit_llvmcall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
715715
}
716716
}
717717

718-
#ifdef JL_GC_MARKSWEEP
719718
// make sure args are rooted
720719
if (t == jl_pvalue_llvmt && (needroot || might_need_root(argi))) {
721720
make_gcroot(arg, ctx);
722721
}
723-
#endif
724722
Value *v = julia_to_native(t, tti, arg, expr_type(argi, ctx), false, false, false, false, false, i, ctx, NULL);
725723
bool issigned = jl_signed_type && jl_subtype(tti, (jl_value_t*)jl_signed_type, 0);
726724
argvals[i] = llvm_type_rewrite(v, t, t, false, false, issigned, ctx);
@@ -1298,12 +1296,10 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
12981296
}
12991297
}
13001298

1301-
#ifdef JL_GC_MARKSWEEP
13021299
// make sure args are rooted
13031300
if (largty == jl_pvalue_llvmt && (needroot || might_need_root(argi))) {
13041301
make_gcroot(arg, ctx);
13051302
}
1306-
#endif
13071303

13081304
bool nSR=false;
13091305
bool issigned = jl_signed_type && jl_subtype(jargty, (jl_value_t*)jl_signed_type, 0);

src/cgutils.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,6 @@ static Value* emit_allocobj(size_t static_size)
18741874
// if ptr is NULL this emits a write barrier _back_
18751875
static void emit_write_barrier(jl_codectx_t* ctx, Value *parent, Value *ptr)
18761876
{
1877-
#ifdef JL_GC_MARKSWEEP
18781877
Value* parenttag = builder.CreateBitCast(emit_typeptr_addr(parent), T_psize);
18791878
Value* parent_type = builder.CreateLoad(parenttag);
18801879
Value* parent_mark_bits = builder.CreateAnd(parent_type, 1);
@@ -1897,12 +1896,10 @@ static void emit_write_barrier(jl_codectx_t* ctx, Value *parent, Value *ptr)
18971896
builder.CreateBr(cont);
18981897
ctx->f->getBasicBlockList().push_back(cont);
18991898
builder.SetInsertPoint(cont);
1900-
#endif
19011899
}
19021900

19031901
static void emit_checked_write_barrier(jl_codectx_t *ctx, Value *parent, Value *ptr)
19041902
{
1905-
#ifdef JL_GC_MARKSWEEP
19061903
BasicBlock *cont;
19071904
Value *not_null = builder.CreateICmpNE(ptr, V_null);
19081905
BasicBlock *if_not_null = BasicBlock::Create(getGlobalContext(), "wb_not_null", ctx->f);
@@ -1913,7 +1910,6 @@ static void emit_checked_write_barrier(jl_codectx_t *ctx, Value *parent, Value *
19131910
builder.CreateBr(cont);
19141911
ctx->f->getBasicBlockList().push_back(cont);
19151912
builder.SetInsertPoint(cont);
1916-
#endif
19171913
}
19181914

19191915
static Value *emit_setfield(jl_datatype_t *sty, Value *strct, size_t idx0,

src/codegen.cpp

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,7 @@ static GlobalVariable *jlemptytuple_var;
261261
#if JL_NEED_FLOATTEMP_VAR
262262
static GlobalVariable *jlfloattemp_var;
263263
#endif
264-
#ifdef JL_GC_MARKSWEEP
265264
static GlobalVariable *jlpgcstack_var;
266-
#endif
267265
static GlobalVariable *jlexc_var;
268266
static GlobalVariable *jldiverr_var;
269267
static GlobalVariable *jlundeferr_var;
@@ -334,10 +332,8 @@ static Function *box8_func;
334332
static Function *box16_func;
335333
static Function *box32_func;
336334
static Function *box64_func;
337-
#ifdef JL_GC_MARKSWEEP
338335
static Function *wbfunc;
339336
static Function *queuerootfun;
340-
#endif
341337
static Function *expect_func;
342338
static Function *jldlsym_func;
343339
static 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)
36563639
static 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

37073678
static void
37083679
emit_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

37233690
static 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);

src/dump.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,9 +1526,7 @@ DLLEXPORT void jl_preload_sysimg_so(const char *fname)
15261526

15271527
void jl_restore_system_image_from_stream(ios_t *f)
15281528
{
1529-
#ifdef JL_GC_MARKSWEEP
15301529
int en = jl_gc_enable(0);
1531-
#endif
15321530
DUMP_MODES last_mode = mode;
15331531
mode = MODE_SYSTEM_IMAGE;
15341532
arraylist_new(&backref_list, 250000);
@@ -1594,9 +1592,7 @@ void jl_restore_system_image_from_stream(ios_t *f)
15941592
//jl_printf(JL_STDERR, "backref_list.len = %d\n", backref_list.len);
15951593
arraylist_free(&backref_list);
15961594

1597-
#ifdef JL_GC_MARKSWEEP
15981595
jl_gc_enable(en);
1599-
#endif
16001596
mode = last_mode;
16011597
jl_update_all_fptrs();
16021598
}

src/gc.c

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ void jl_finalize(jl_value_t *o)
188188
(void)finalize_object(o);
189189
}
190190

191-
#ifdef JL_GC_MARKSWEEP
192-
193191
typedef struct _buff_t {
194192
union {
195193
uintptr_t header;
@@ -2680,33 +2678,6 @@ static void big_obj_stats(void)
26802678
}
26812679
#endif //MEMPROFILE
26822680

2683-
#else //JL_GC_MARKSWEEP
2684-
DLLEXPORT jl_value_t *jl_gc_allocobj(size_t sz)
2685-
{
2686-
size_t allocsz = sz + sizeof_jl_taggedvalue_t;
2687-
if (allocsz < sz) // overflow in adding offs, size was "negative"
2688-
jl_throw(jl_memory_exception);
2689-
allocd_bytes += allocsz;
2690-
gc_num.alloc++;
2691-
return jl_valueof(malloc(allocsz));
2692-
}
2693-
int64_t jl_gc_diff_total_bytes(void)
2694-
{
2695-
return 0;
2696-
}
2697-
DLLEXPORT jl_weakref_t *jl_gc_new_weakref(jl_value_t *value)
2698-
{
2699-
jl_weakref_t *wr = (jl_weakref_t*)jl_gc_alloc_1w();
2700-
jl_set_typeof(wr, jl_weakref_type);
2701-
wr->value = value;
2702-
return wr;
2703-
}
2704-
static inline int maybe_collect(void)
2705-
{
2706-
return 0;
2707-
}
2708-
#endif //JL_GC_MARKSWEEP
2709-
27102681
DLLEXPORT void *jl_gc_counted_malloc(size_t sz)
27112682
{
27122683
maybe_collect();
@@ -2762,14 +2733,11 @@ DLLEXPORT void *jl_gc_managed_realloc(void *d, size_t sz, size_t oldsz, int isal
27622733
if (allocsz < sz) // overflow in adding offs, size was "negative"
27632734
jl_throw(jl_memory_exception);
27642735

2765-
#ifdef JL_GC_MARKSWEEP
27662736
if (gc_bits(jl_astaggedvalue(owner)) == GC_MARKED) {
27672737
perm_scanned_bytes += allocsz - oldsz;
27682738
live_bytes += allocsz - oldsz;
27692739
}
2770-
else
2771-
#endif
2772-
if (allocsz < oldsz)
2740+
else if (allocsz < oldsz)
27732741
freed_bytes += (oldsz - allocsz);
27742742
else
27752743
allocd_bytes += (allocsz - oldsz);

src/init.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static struct uv_shutdown_queue_item *next_shutdown_queue_item(struct uv_shutdow
544544

545545
DLLEXPORT void jl_atexit_hook()
546546
{
547-
#if defined(JL_GC_MARKSWEEP) && defined(GC_FINAL_STATS)
547+
#if defined(GC_FINAL_STATS)
548548
jl_print_gc_stats(JL_STDERR);
549549
#endif
550550
if (jl_options.code_coverage)
@@ -1067,10 +1067,8 @@ void _julia_init(JL_IMAGE_SEARCH rel)
10671067
}
10681068
#endif
10691069

1070-
#ifdef JL_GC_MARKSWEEP
10711070
jl_gc_init();
10721071
jl_gc_enable(0);
1073-
#endif
10741072
jl_init_frontend();
10751073
jl_init_types();
10761074
jl_init_tasks();
@@ -1140,9 +1138,7 @@ void _julia_init(JL_IMAGE_SEARCH rel)
11401138
if (jl_options.handle_signals == JL_OPTIONS_HANDLE_SIGNALS_ON)
11411139
jl_install_default_signal_handlers();
11421140

1143-
#ifdef JL_GC_MARKSWEEP
11441141
jl_gc_enable(1);
1145-
#endif
11461142

11471143
if (jl_options.image_file)
11481144
jl_init_restored_modules();

0 commit comments

Comments
 (0)