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

No longer use pool size in MMTk allocation #66

Draft
wants to merge 1 commit 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
julia/*.o
julia/*.dbg.obj
.vscode
34 changes: 11 additions & 23 deletions julia/mmtk_julia.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ JL_DLLEXPORT void (jl_mmtk_harness_end)(void)
mmtk_harness_end();
}

JL_DLLEXPORT jl_value_t *jl_mmtk_gc_alloc_default(jl_ptls_t ptls, int pool_offset,
int osize, void *ty)
JL_DLLEXPORT jl_value_t *jl_mmtk_gc_alloc_default(jl_ptls_t ptls, size_t osize, void *ty)
{
// safepoint
jl_gc_safepoint();
Expand Down Expand Up @@ -278,8 +277,7 @@ size_t get_so_size(void* obj_raw)
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(tsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = tsz + sizeof(jl_taggedvalue_t);
return osize;
} else if (a->flags.how == 1) {
int ndimwords = jl_array_ndimwords(jl_array_ndims(a));
Expand All @@ -288,8 +286,7 @@ size_t get_so_size(void* obj_raw)
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(tsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = tsz + sizeof(jl_taggedvalue_t);

return osize;
} else if (a->flags.how == 2) {
Expand All @@ -299,8 +296,7 @@ size_t get_so_size(void* obj_raw)
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(tsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = tsz + sizeof(jl_taggedvalue_t);

return osize;
} else if (a->flags.how == 3) {
Expand All @@ -310,8 +306,7 @@ size_t get_so_size(void* obj_raw)
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(tsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = tsz + sizeof(jl_taggedvalue_t);
return osize;
}
} else if (vt == jl_simplevector_type) {
Expand All @@ -320,54 +315,47 @@ size_t get_so_size(void* obj_raw)
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(l * sizeof(void*) + sizeof(jl_svec_t) + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = l * sizeof(void*) + sizeof(jl_svec_t) + sizeof(jl_taggedvalue_t);
return osize;
} else if (vt == jl_module_type) {
size_t dtsz = sizeof(jl_module_t);
if (dtsz + sizeof(jl_taggedvalue_t) > 2032) {
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(dtsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = dtsz + sizeof(jl_taggedvalue_t);
return osize;
} else if (vt == jl_task_type) {
size_t dtsz = sizeof(jl_task_t);
if (dtsz + sizeof(jl_taggedvalue_t) > 2032) {
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(dtsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = dtsz + sizeof(jl_taggedvalue_t);
return osize;
} else if (vt == jl_string_type) {
size_t dtsz = jl_string_len(obj) + sizeof(size_t) + 1;
if (dtsz + sizeof(jl_taggedvalue_t) > 2032) {
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass_align8(dtsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = dtsz + sizeof(jl_taggedvalue_t);
return osize;
} else if (vt == jl_method_type) {
size_t dtsz = sizeof(jl_method_t);
if (dtsz + sizeof(jl_taggedvalue_t) > 2032) {
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(dtsz + sizeof(jl_taggedvalue_t));

int osize = jl_gc_sizeclasses[pool_id];
int osize = dtsz + sizeof(jl_taggedvalue_t);
return osize;
} else {
size_t dtsz = jl_datatype_size(vt);
if (dtsz + sizeof(jl_taggedvalue_t) > 2032) {
printf("size greater than minimum!\n");
mmtk_runtime_panic();
}
int pool_id = jl_gc_szclass(dtsz + sizeof(jl_taggedvalue_t));
int osize = jl_gc_sizeclasses[pool_id];
int osize = dtsz + sizeof(jl_taggedvalue_t);
return osize;
}
return 0;
Expand Down
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 = "98a66ba3c0925ea21bfe051a191210eeae7df0f2"
julia_repo = "https://github.com/qinsoon/julia.git"
julia_version = "a008070765a660fff8953c1e8538b6521ea858c8"

[lib]
crate-type = ["staticlib", "rlib", "dylib"]
Expand Down
8 changes: 7 additions & 1 deletion mmtk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,13 @@ pub extern "C" fn mmtk_alloc(
offset: usize,
semantics: AllocationSemantics,
) -> Address {
memory_manager::alloc::<JuliaVM>(unsafe { &mut *mutator }, size, align, offset, semantics)
debug_assert!(mmtk::util::conversions::raw_is_aligned(size, <JuliaVM as mmtk::vm::VMBinding>::MIN_ALIGNMENT), "Trying to allocate {} bytes which is not aligned to MIN_ALIGNMENT", size);
let ret = memory_manager::alloc::<JuliaVM>(unsafe { &mut *mutator }, size, align, offset, semantics);

debug_assert!((ret + offset).is_aligned_to(align));
// info!("Alloc size {} align {} offset {} semantics {:?} = {}", size, align, offset, semantics, ret);

ret
}

#[no_mangle]
Expand Down