Skip to content

Commit 499d648

Browse files
authored
Assert alloc size alignment (mmtk#68)
1 parent 56915e9 commit 499d648

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

mmtk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2018"
1010
[package.metadata.julia]
1111
# 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.
1212
julia_repo = "https://github.com/mmtk/julia.git"
13-
julia_version = "98a66ba3c0925ea21bfe051a191210eeae7df0f2"
13+
julia_version = "0d8bbd943af2642f04dc6d8c2a74543c4ec8e84f"
1414

1515
[lib]
1616
crate-type = ["staticlib", "rlib", "dylib"]

mmtk/src/api.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ pub extern "C" fn mmtk_alloc(
166166
offset: usize,
167167
semantics: AllocationSemantics,
168168
) -> Address {
169+
debug_assert!(
170+
mmtk::util::conversions::raw_is_aligned(
171+
size,
172+
<JuliaVM as mmtk::vm::VMBinding>::MIN_ALIGNMENT
173+
),
174+
"Alloc size {} is not aligned to min alignment",
175+
size
176+
);
169177
memory_manager::alloc::<JuliaVM>(unsafe { &mut *mutator }, size, align, offset, semantics)
170178
}
171179

@@ -192,14 +200,7 @@ pub extern "C" fn mmtk_post_alloc(
192200
bytes: usize,
193201
semantics: AllocationSemantics,
194202
) {
195-
match semantics {
196-
AllocationSemantics::Los => {
197-
memory_manager::post_alloc::<JuliaVM>(unsafe { &mut *mutator }, refer, bytes, semantics)
198-
}
199-
_ => {
200-
memory_manager::post_alloc::<JuliaVM>(unsafe { &mut *mutator }, refer, bytes, semantics)
201-
}
202-
}
203+
memory_manager::post_alloc::<JuliaVM>(unsafe { &mut *mutator }, refer, bytes, semantics)
203204
}
204205

205206
#[no_mangle]

0 commit comments

Comments
 (0)