Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ JL_DLLEXPORT jl_value_t *jl_alloc_string(size_t len)
int pool_id = jl_gc_szclass_align8(allocsz);
jl_gc_pool_t *p = &ptls->heap.norm_pools[pool_id];
int osize = jl_gc_sizeclasses[pool_id];
s = jl_gc_pool_alloc_inner(ptls, (char*)p - (char*)ptls, osize);
s = jl_gc_pool_alloc_wrapper(ptls, (char*)p - (char*)ptls, osize);
}
else {
if (allocsz < sz) // overflow in adding offs, size was "negative"
Expand Down
29 changes: 17 additions & 12 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,19 +1196,9 @@ static NOINLINE jl_taggedvalue_t *add_page(jl_gc_pool_t *p) JL_NOTSAFEPOINT
return fl;
}

// instrumented version of jl_gc_pool_alloc_inner called into by LLVM-generated code
JL_DLLEXPORT jl_value_t *jl_gc_pool_alloc(jl_ptls_t ptls, int pool_offset,
int osize)
{
jl_value_t *val = jl_gc_pool_alloc_inner(ptls, pool_offset, osize);

maybe_record_alloc_to_profile(val, osize, jl_gc_unknown_type_tag);
return val;
}

// Size includes the tag and the tag is not cleared!!
jl_value_t *jl_gc_pool_alloc_inner(jl_ptls_t ptls, int pool_offset,
int osize)
static inline jl_value_t *jl_gc_pool_alloc_inner(jl_ptls_t ptls, int pool_offset,
int osize)
{
// Use the pool offset instead of the pool address as the argument
// to workaround a llvm bug.
Expand Down Expand Up @@ -1263,6 +1253,21 @@ jl_value_t *jl_gc_pool_alloc_inner(jl_ptls_t ptls, int pool_offset,
return jl_valueof(v);
}

// instrumented version of jl_gc_pool_alloc_inner called into by LLVM-generated code
JL_DLLEXPORT jl_value_t *jl_gc_pool_alloc(jl_ptls_t ptls, int pool_offset,
int osize)
{
jl_value_t *val = jl_gc_pool_alloc_inner(ptls, pool_offset, osize);

maybe_record_alloc_to_profile(val, osize, jl_gc_unknown_type_tag);
return val;
}

jl_value_t *jl_gc_pool_alloc_wrapper(jl_ptls_t ptls, int pool_offset,
int osize) {
return jl_gc_pool_alloc_inner(ptls, pool_offset, osize);
}

int jl_gc_classify_pools(size_t sz, int *osize)
{
if (sz > GC_MAX_SZCLASS)
Expand Down
4 changes: 2 additions & 2 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ extern jl_array_t *jl_all_methods JL_GLOBALLY_ROOTED;
JL_DLLEXPORT extern int jl_lineno;
JL_DLLEXPORT extern const char *jl_filename;

jl_value_t *jl_gc_pool_alloc_inner(jl_ptls_t ptls, int pool_offset,
jl_value_t *jl_gc_pool_alloc_wrapper(jl_ptls_t ptls, int pool_offset,
int osize);
JL_DLLEXPORT jl_value_t *jl_gc_big_alloc(jl_ptls_t ptls, size_t allocsz);
JL_DLLEXPORT int jl_gc_classify_pools(size_t sz, int *osize);
Expand Down Expand Up @@ -357,7 +357,7 @@ STATIC_INLINE jl_value_t *jl_gc_alloc_(jl_ptls_t ptls, size_t sz, void *ty)
int pool_id = jl_gc_szclass(allocsz);
jl_gc_pool_t *p = &ptls->heap.norm_pools[pool_id];
int osize = jl_gc_sizeclasses[pool_id];
v = jl_gc_pool_alloc_inner(ptls, (char*)p - (char*)ptls, osize);
v = jl_gc_pool_alloc_wrapper(ptls, (char*)p - (char*)ptls, osize);
}
else {
if (allocsz < sz) // overflow in adding offs, size was "negative"
Expand Down