Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for allocating in a non-moving space #101

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 28 additions & 0 deletions julia/mmtk_julia.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,34 @@ JL_DLLEXPORT jl_value_t *jl_mmtk_gc_alloc_big(jl_ptls_t ptls, size_t sz)
return result;
}

// allocating in a non-moving space
JL_DLLEXPORT jl_value_t *jl_mmtk_gc_alloc_non_moving(jl_ptls_t ptls,
int osize, void *ty)
{
// safepoint
jl_gc_safepoint_(ptls);

jl_value_t *v;
if ((uintptr_t)ty != jl_buff_tag) {
// v needs to be 16 byte aligned, therefore v_tagged needs to be offset accordingly to consider the size of header
jl_taggedvalue_t *v_tagged = (jl_taggedvalue_t *)mmtk_alloc(&ptls->mmtk_mutator, LLT_ALIGN(osize, 16), 16, sizeof(jl_taggedvalue_t), 6);
v = jl_valueof(v_tagged);
mmtk_non_moving_post_alloc_fast(&ptls->mmtk_mutator, v, osize);
} else {
// allocating an extra word to store the size of buffer objects
jl_taggedvalue_t *v_tagged = (jl_taggedvalue_t *)mmtk_alloc(&ptls->mmtk_mutator, LLT_ALIGN(osize+sizeof(jl_taggedvalue_t), 16), 16, 0, 6);
jl_value_t* v_tagged_aligned = ((jl_value_t*)((char*)(v_tagged) + sizeof(jl_taggedvalue_t)));
v = jl_valueof(v_tagged_aligned);
mmtk_store_obj_size_c(v, osize + sizeof(jl_taggedvalue_t));
mmtk_non_moving_post_alloc_fast(&ptls->mmtk_mutator, v, osize + sizeof(jl_taggedvalue_t));
}

ptls->gc_num.allocd += osize;
ptls->gc_num.poolalloc++;

return v;
}

static void mmtk_sweep_malloced_arrays(void) JL_NOTSAFEPOINT
{
void* iter = new_mutator_iterator();
Expand Down
4 changes: 2 additions & 2 deletions mmtk/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mmtk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ edition = "2018"
# Metadata for the Julia repository
[package.metadata.julia]
# Our CI matches the following line and extract mmtk/julia. If this line is updated, please check ci yaml files and make sure it works.
julia_repo = "https://github.com/mmtk/julia.git"
julia_version = "83796a7d38878faa9afdb94ce84b6da00035b336"
julia_repo = "https://github.com/udesou/julia.git"
julia_version = "0e0adf1cb1f5193c6f6a8b0fd0dc0561c8e04f44"

[lib]
crate-type = ["cdylib"]
Expand Down