Skip to content

Commit

Permalink
Fix exported names from gc.c to have jl_gc_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottPJones committed Jun 19, 2015
1 parent c147ecf commit 7f0deec
Show file tree
Hide file tree
Showing 18 changed files with 208 additions and 212 deletions.
30 changes: 15 additions & 15 deletions src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void jl_set_nth_field(jl_value_t *v, size_t i, jl_value_t *rhs)
size_t offs = jl_field_offset(st,i);
if (jl_field_isptr(st,i)) {
*(jl_value_t**)((char*)v + offs) = rhs;
if (rhs != NULL) gc_wb(v, rhs);
if (rhs != NULL) jl_gc_wb(v, rhs);
}
else {
jl_assign_bits((char*)v + offs, rhs);
Expand Down Expand Up @@ -315,7 +315,7 @@ DLLEXPORT jl_value_t *jl_new_struct_uninit(jl_datatype_t *type)
DLLEXPORT jl_function_t *jl_new_closure(jl_fptr_t fptr, jl_value_t *env,
jl_lambda_info_t *linfo)
{
jl_function_t *f = (jl_function_t*)alloc_3w(); assert(NWORDS(sizeof(jl_function_t))==3);
jl_function_t *f = (jl_function_t*)jl_gc_alloc_3w(); assert(NWORDS(sizeof(jl_function_t))==3);
jl_set_typeof(f, jl_function_type);
f->fptr = (fptr!=NULL ? fptr : linfo->fptr);
f->env = env;
Expand Down Expand Up @@ -445,7 +445,7 @@ jl_sym_t *jl_symbol(const char *str)
if (*pnode == NULL) {
*pnode = mk_symbol(str);
if (parent != NULL)
gc_wb(parent, *pnode);
jl_gc_wb(parent, *pnode);
}
return *pnode;
}
Expand Down Expand Up @@ -594,11 +594,11 @@ jl_datatype_t *jl_new_datatype(jl_sym_t *name, jl_datatype_t *super,
tn = t->name;
// init before possibly calling jl_new_typename
t->super = super;
if (super != NULL) gc_wb(t, t->super);
if (super != NULL) jl_gc_wb(t, t->super);
t->parameters = parameters;
gc_wb(t, t->parameters);
jl_gc_wb(t, t->parameters);
t->types = ftypes;
if (ftypes != NULL) gc_wb(t, t->types);
if (ftypes != NULL) jl_gc_wb(t, t->types);
t->abstract = abstract;
t->mutabl = mutabl;
t->pointerfree = 0;
Expand All @@ -616,14 +616,14 @@ jl_datatype_t *jl_new_datatype(jl_sym_t *name, jl_datatype_t *super,
else
tn = jl_new_typename((jl_sym_t*)name);
t->name = tn;
gc_wb(t, t->name);
jl_gc_wb(t, t->name);
}
t->name->names = fnames;
gc_wb(t->name, t->name->names);
jl_gc_wb(t->name, t->name->names);

if (t->name->primary == NULL) {
t->name->primary = (jl_value_t*)t;
gc_wb(t->name, t);
jl_gc_wb(t->name, t);
}

if (abstract || jl_svec_len(parameters) > 0) {
Expand Down Expand Up @@ -668,7 +668,7 @@ jl_value_t *jl_box##nb(jl_datatype_t *t, int##nb##_t x) \
{ \
assert(jl_isbits(t)); \
assert(jl_datatype_size(t) == sizeof(x)); \
jl_value_t *v = (jl_value_t*)alloc_##nw##w(); \
jl_value_t *v = (jl_value_t*)jl_gc_alloc_##nw##w(); \
jl_set_typeof(v, t); \
*(int##nb##_t*)jl_data_ptr(v) = x; \
return v; \
Expand Down Expand Up @@ -706,7 +706,7 @@ UNBOX_FUNC(gensym, ssize_t)
#define BOX_FUNC(typ,c_type,pfx,nw) \
jl_value_t *pfx##_##typ(c_type x) \
{ \
jl_value_t *v = (jl_value_t*)alloc_##nw##w(); \
jl_value_t *v = (jl_value_t*)jl_gc_alloc_##nw##w(); \
jl_set_typeof(v, jl_##typ##_type); \
*(c_type*)jl_data_ptr(v) = x; \
return v; \
Expand All @@ -728,7 +728,7 @@ jl_value_t *jl_box_##typ(c_type x) \
c_type idx = x+NBOX_C/2; \
if ((u##c_type)idx < (u##c_type)NBOX_C) \
return boxed_##typ##_cache[idx]; \
jl_value_t *v = (jl_value_t*)alloc_##nw##w(); \
jl_value_t *v = (jl_value_t*)jl_gc_alloc_##nw##w(); \
jl_set_typeof(v, jl_##typ##_type); \
*(c_type*)jl_data_ptr(v) = x; \
return v; \
Expand All @@ -739,7 +739,7 @@ jl_value_t *jl_box_##typ(c_type x) \
{ \
if (x < NBOX_C) \
return boxed_##typ##_cache[x]; \
jl_value_t *v = (jl_value_t*)alloc_##nw##w(); \
jl_value_t *v = (jl_value_t*)jl_gc_alloc_##nw##w(); \
jl_set_typeof(v, jl_##typ##_type); \
*(c_type*)jl_data_ptr(v) = x; \
return v; \
Expand Down Expand Up @@ -833,7 +833,7 @@ jl_expr_t *jl_exprn(jl_sym_t *head, size_t n)
{
jl_array_t *ar = n==0 ? (jl_array_t*)jl_an_empty_cell : jl_alloc_cell_1d(n);
JL_GC_PUSH1(&ar);
jl_expr_t *ex = (jl_expr_t*)alloc_3w(); assert(NWORDS(sizeof(jl_expr_t))==3);
jl_expr_t *ex = (jl_expr_t*)jl_gc_alloc_3w(); assert(NWORDS(sizeof(jl_expr_t))==3);
jl_set_typeof(ex, jl_expr_type);
ex->head = head;
ex->args = ar;
Expand All @@ -850,7 +850,7 @@ JL_CALLABLE(jl_f_new_expr)
JL_GC_PUSH1(&ar);
for(size_t i=0; i < nargs-1; i++)
jl_cellset(ar, i, args[i+1]);
jl_expr_t *ex = (jl_expr_t*)alloc_3w(); assert(NWORDS(sizeof(jl_expr_t))==3);
jl_expr_t *ex = (jl_expr_t*)jl_gc_alloc_3w(); assert(NWORDS(sizeof(jl_expr_t))==3);
jl_set_typeof(ex, jl_expr_type);
ex->head = (jl_sym_t*)args[0];
ex->args = ar;
Expand Down
16 changes: 8 additions & 8 deletions src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static jl_array_t *_new_array_(jl_value_t *atype, uint32_t ndims, size_t *dims,
size_t doffs = tsz;
tsz += tot;
tsz = JL_ARRAY_ALIGN(tsz, 16); // align whole object 16
a = (jl_array_t*)allocobj(tsz);
a = (jl_array_t*)jl_gc_allocobj(tsz);
jl_set_typeof(a, atype);
a->how = 0;
data = (char*)a + doffs;
Expand All @@ -91,7 +91,7 @@ static jl_array_t *_new_array_(jl_value_t *atype, uint32_t ndims, size_t *dims,
}
else {
tsz = JL_ARRAY_ALIGN(tsz, 16); // align whole object 16
a = (jl_array_t*)allocobj(tsz);
a = (jl_array_t*)jl_gc_allocobj(tsz);
JL_GC_PUSH1(&a);
jl_set_typeof(a, atype);
// temporarily initialize to make gc-safe
Expand Down Expand Up @@ -153,7 +153,7 @@ jl_array_t *jl_reshape_array(jl_value_t *atype, jl_array_t *data, jl_value_t *di

int ndimwords = jl_array_ndimwords(ndims);
int tsz = JL_ARRAY_ALIGN(sizeof(jl_array_t) + ndimwords*sizeof(size_t) + sizeof(void*), 16);
a = (jl_array_t*)allocobj(tsz);
a = (jl_array_t*)jl_gc_allocobj(tsz);
jl_set_typeof(a, atype);
a->pooled = tsz <= GC_MAX_SZCLASS;
a->ndims = ndims;
Expand Down Expand Up @@ -229,7 +229,7 @@ jl_array_t *jl_ptr_to_array_1d(jl_value_t *atype, void *data, size_t nel,

int ndimwords = jl_array_ndimwords(1);
int tsz = JL_ARRAY_ALIGN(sizeof(jl_array_t) + ndimwords*sizeof(size_t), 16);
a = (jl_array_t*)allocobj(tsz);
a = (jl_array_t*)jl_gc_allocobj(tsz);
jl_set_typeof(a, atype);
a->pooled = tsz <= GC_MAX_SZCLASS;
a->data = data;
Expand Down Expand Up @@ -280,7 +280,7 @@ jl_array_t *jl_ptr_to_array(jl_value_t *atype, void *data, jl_value_t *dims,

int ndimwords = jl_array_ndimwords(ndims);
int tsz = JL_ARRAY_ALIGN(sizeof(jl_array_t) + ndimwords*sizeof(size_t), 16);
a = (jl_array_t*)allocobj(tsz);
a = (jl_array_t*)jl_gc_allocobj(tsz);
jl_set_typeof(a, atype);
a->pooled = tsz <= GC_MAX_SZCLASS;
a->data = data;
Expand Down Expand Up @@ -354,7 +354,7 @@ jl_value_t *jl_array_to_string(jl_array_t *a)
// TODO: check type of array?
jl_datatype_t *string_type = u8_isvalid((char*)a->data, jl_array_len(a)) == 1 ? // ASCII
jl_ascii_string_type : jl_utf8_string_type;
jl_value_t *s = (jl_value_t*)alloc_1w();
jl_value_t *s = (jl_value_t*)jl_gc_alloc_1w();
jl_set_typeof(s, string_type);
jl_set_nth_field(s, 0, (jl_value_t*)a);
return s;
Expand Down Expand Up @@ -524,7 +524,7 @@ void jl_arrayset(jl_array_t *a, jl_value_t *rhs, size_t i)
if (a->how == 3) {
owner = jl_array_data_owner(a);
}
gc_wb(owner, rhs);
jl_gc_wb(owner, rhs);
}
}

Expand Down Expand Up @@ -598,7 +598,7 @@ static void array_resize_buffer(jl_array_t *a, size_t newlen, size_t oldlen, siz
if (a->ptrarray || es==1)
memset(newdata+offsnb+oldnbytes, 0, nbytes-oldnbytes-offsnb);
if (a->how == 1)
gc_wb_buf(a, newdata);
jl_gc_wb_buf(a, newdata);
a->maxsize = newlen;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ static jl_value_t *copy_ast(jl_value_t *expr, jl_svec_t *sp, int do_sp)
// of a top-level thunk that gets type inferred.
li->def = li;
li->ast = jl_prepare_ast(li, li->sparams);
gc_wb(li, li->ast);
jl_gc_wb(li, li->ast);
JL_GC_POP();
return (jl_value_t*)li;
}
Expand Down Expand Up @@ -821,7 +821,7 @@ DLLEXPORT jl_value_t *jl_copy_ast(jl_value_t *expr)
ne = jl_exprn(e->head, l);
if (l == 0) {
ne->args = jl_alloc_cell_1d(0);
gc_wb(ne, ne->args);
jl_gc_wb(ne, ne->args);
}
else {
for(i=0; i < l; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ void jl_trampoline_compile_function(jl_function_t *f, int always_infer, jl_tuple
if (!jl_in_inference) {
if (!jl_is_expr(f->linfo->ast)) {
f->linfo->ast = jl_uncompress_ast(f->linfo, f->linfo->ast);
gc_wb(f->linfo, f->linfo->ast);
jl_gc_wb(f->linfo, f->linfo->ast);
}
if (always_infer || jl_eval_with_compiler_p(jl_lam_body((jl_expr_t*)f->linfo->ast),1,f->linfo->module)) {
jl_type_infer(f->linfo, sig, f->linfo);
Expand All @@ -952,7 +952,7 @@ void jl_trampoline_compile_function(jl_function_t *f, int always_infer, jl_tuple
jl_generate_fptr(f);
if (jl_boot_file_loaded && jl_is_expr(f->linfo->ast)) {
f->linfo->ast = jl_compress_ast(f->linfo, f->linfo->ast);
gc_wb(f->linfo, f->linfo->ast);
jl_gc_wb(f->linfo, f->linfo->ast);
}
}

Expand Down
42 changes: 21 additions & 21 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ static std::vector<Type *> three_pvalue_llvmt;

static std::map<jl_fptr_t, Function*> builtin_func_map;

extern "C" DLLEXPORT void gc_wb_slow(jl_value_t* parent, jl_value_t* ptr)
extern "C" DLLEXPORT void jl_gc_wb_slow(jl_value_t* parent, jl_value_t* ptr)
{
gc_wb(parent, ptr);
jl_gc_wb(parent, ptr);
}

// --- code generation ---
Expand Down Expand Up @@ -1229,7 +1229,7 @@ static logdata_t mallocData;
static void mallocVisitLine(std::string filename, int line)
{
if (filename == "" || filename == "none" || filename == "no file") {
sync_gc_total_bytes();
jl_gc_sync_total_bytes();
return;
}
logdata_t::iterator it = mallocData.find(filename);
Expand Down Expand Up @@ -1273,7 +1273,7 @@ extern "C" DLLEXPORT void jl_clear_malloc_data(void)
}
}
}
sync_gc_total_bytes();
jl_gc_sync_total_bytes();
}

extern "C" void jl_write_malloc_log(void)
Expand Down Expand Up @@ -1749,7 +1749,7 @@ static void jl_add_linfo_root(jl_lambda_info_t *li, jl_value_t *val)
li = li->def;
if (li->roots == NULL) {
li->roots = jl_alloc_cell_1d(1);
gc_wb(li, li->roots);
jl_gc_wb(li, li->roots);
jl_cellset(li->roots, 0, val);
}
else {
Expand Down Expand Up @@ -4966,9 +4966,9 @@ extern "C" void jl_fptr_to_llvm(void *fptr, jl_lambda_info_t *lam, int specsig)

extern "C" DLLEXPORT jl_value_t *jl_new_box(jl_value_t *v)
{
jl_value_t *box = (jl_value_t*)alloc_1w();
jl_value_t *box = (jl_value_t*)jl_gc_alloc_1w();
jl_set_typeof(box, jl_box_any_type);
// if (v) gc_wb(box, v); // write block not needed: box was just allocated
// if (v) jl_gc_wb(box, v); // write block not needed: box was just allocated
box->fieldptr[0] = v;
return box;
}
Expand Down Expand Up @@ -5341,16 +5341,16 @@ static void init_julia_llvm_env(Module *m)
#ifdef JL_GC_MARKSWEEP
queuerootfun = Function::Create(FunctionType::get(T_void, args_1ptr, false),
Function::ExternalLinkage,
"gc_queue_root", m);
add_named_global(queuerootfun, (void*)&gc_queue_root);
"jl_gc_queue_root", m);
add_named_global(queuerootfun, (void*)&jl_gc_queue_root);

std::vector<Type *> wbargs(0);
wbargs.push_back(jl_pvalue_llvmt);
wbargs.push_back(jl_pvalue_llvmt);
wbfunc = Function::Create(FunctionType::get(T_void, wbargs, false),
Function::ExternalLinkage,
"gc_wb_slow", m);
add_named_global(wbfunc, (void*)&gc_wb_slow);
"jl_gc_wb_slow", m);
add_named_global(wbfunc, (void*)&jl_gc_wb_slow);
#endif

std::vector<Type *> exp_args(0);
Expand Down Expand Up @@ -5489,27 +5489,27 @@ static void init_julia_llvm_env(Module *m)
jlallocobj_func =
Function::Create(FunctionType::get(jl_pvalue_llvmt, aoargs, false),
Function::ExternalLinkage,
"allocobj", m);
add_named_global(jlallocobj_func, (void*)&allocobj);
"jl_gc_allocobj", m);
add_named_global(jlallocobj_func, (void*)&jl_gc_allocobj);

std::vector<Type*> empty_args(0);
jlalloc1w_func =
Function::Create(FunctionType::get(jl_pvalue_llvmt, empty_args, false),
Function::ExternalLinkage,
"alloc_1w", m);
add_named_global(jlalloc1w_func, (void*)&alloc_1w);
"jl_gc_alloc_1w", m);
add_named_global(jlalloc1w_func, (void*)&jl_gc_alloc_1w);

jlalloc2w_func =
Function::Create(FunctionType::get(jl_pvalue_llvmt, empty_args, false),
Function::ExternalLinkage,
"alloc_2w", m);
add_named_global(jlalloc2w_func, (void*)&alloc_2w);
"jl_gc_alloc_2w", m);
add_named_global(jlalloc2w_func, (void*)&jl_gc_alloc_2w);

jlalloc3w_func =
Function::Create(FunctionType::get(jl_pvalue_llvmt, empty_args, false),
Function::ExternalLinkage,
"alloc_3w", m);
add_named_global(jlalloc3w_func, (void*)&alloc_3w);
"jl_gc_alloc_3w", m);
add_named_global(jlalloc3w_func, (void*)&jl_gc_alloc_3w);

std::vector<Type*> atargs(0);
atargs.push_back(T_size);
Expand Down Expand Up @@ -5550,8 +5550,8 @@ static void init_julia_llvm_env(Module *m)
diff_gc_total_bytes_func =
Function::Create(FunctionType::get(T_int64, false),
Function::ExternalLinkage,
"diff_gc_total_bytes", m);
add_named_global(diff_gc_total_bytes_func, (void*)*diff_gc_total_bytes);
"jl_gc_diff_total_bytes", m);
add_named_global(diff_gc_total_bytes_func, (void*)*jl_gc_diff_total_bytes);

std::vector<Type *> execpoint_args(0);
execpoint_args.push_back(T_pint8);
Expand Down
Loading

0 comments on commit 7f0deec

Please sign in to comment.