Skip to content

Commit

Permalink
Merge branch 'v1.9.2+RAI' into fix/RAI-sticky
Browse files Browse the repository at this point in the history
  • Loading branch information
udesou committed Jan 24, 2024
2 parents 5fae64f + c01026c commit b3ce6db
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ inline void maybe_collect(jl_ptls_t ptls)

// weak references

static void clear_weak_refs(void)
void clear_weak_refs(void)
{
assert(gc_n_threads);
for (int i = 0; i < gc_n_threads; i++) {
Expand All @@ -601,7 +601,7 @@ static void clear_weak_refs(void)
}
}

static void sweep_weak_refs(void)
void sweep_weak_refs(void)
{
assert(gc_n_threads);
for (int i = 0; i < gc_n_threads; i++) {
Expand Down Expand Up @@ -2978,6 +2978,11 @@ void jl_init_thread_heap(jl_ptls_t ptls)
jl_atomic_store_relaxed(&ptls->gc_num.allocd, -(int64_t)gc_num.interval);
}

void jl_deinit_thread_heap(jl_ptls_t ptls)
{
// do nothing
}

// System-wide initializations
void jl_gc_init(void)
{
Expand Down
1 change: 1 addition & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ void jl_init_serializer(void);
void jl_gc_init(void);
void jl_init_uv(void);
void jl_init_thread_heap(jl_ptls_t ptls);
void jl_deinit_thread_heap(jl_ptls_t ptls);
void jl_init_int32_int64_cache(void);
JL_DLLEXPORT void jl_init_options(void);

Expand Down
2 changes: 2 additions & 0 deletions src/llvm-final-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ Value *FinalLowerGC::lowerGCAllocBytes(CallInst *target, Function &F)
auto pool_allocd_total = builder.CreateAdd(pool_allocd, pool_osize);
builder.CreateStore(pool_allocd_total, pool_alloc_tls);

// FIXME: add ptls->gc_num.poolalloc++;

auto v_raw = builder.CreateNSWAdd(result, ConstantInt::get(Type::getInt64Ty(target->getContext()), sizeof(jl_taggedvalue_t)));
auto v_as_ptr = builder.CreateIntToPtr(v_raw, poolAllocFunc->getReturnType());
builder.CreateBr(top_cont);
Expand Down
6 changes: 3 additions & 3 deletions src/mmtk-gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,10 @@ void jl_gc_init(void)
double min_size = strtod(min_size_gb, &p);
min_heap_size = (long) 1024 * 1024 * 1024 * min_size;
} else {
min_heap_size = default_collect_interval;
min_heap_size = (long) 1024 * 1024 * 1024 * 1;
}

// default max heap currently set as 70% the free memory in the system
// default max heap currently set as 30 Gb
if (max_size_def != NULL) {
char *p;
double max_size = strtod(max_size_def, &p);
Expand All @@ -393,7 +393,7 @@ void jl_gc_init(void)
double max_size = strtod(max_size_gb, &p);
max_heap_size = (long) 1024 * 1024 * 1024 * max_size;
} else {
max_heap_size = uv_get_free_memory() * 70 / 100;
max_heap_size = (long) uv_get_free_memory() * 60 / 100;
}

// Assert that the number of stock GC threads is 0; MMTK uses the number of threads in jl_options.ngcthreads
Expand Down
3 changes: 3 additions & 0 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ static void jl_delete_thread(void *value)
#else
pthread_mutex_unlock(&in_signal_lock);
#endif

jl_deinit_thread_heap(ptls);

(void)jl_gc_safe_enter(ptls);
}

Expand Down

0 comments on commit b3ce6db

Please sign in to comment.