Skip to content
Closed
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
7 changes: 5 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn main() {

let dst = autotools::Config::new(LIB_GC_DIR)
.cflag(format!(
"-I{} -L/lib/x86_64-linux-gnu -lpthread -fPIC",
"-I{} -L/lib/x86_64-linux-gnu -lpthread -fPIC -D POINTER_MASK=0x7",
dst.join("include").display()
))
.build();
Expand Down Expand Up @@ -59,7 +59,10 @@ fn main() {
let dst = Config::new(LIB_GC_DIR)
.profile("Release")
.define("BUILD_SHARED_LIBS", "FALSE")
.cflag(format!("-I{}", libatomic_include_path))
.cflag(format!(
"-I{} -DPOINTER_MASK=0x7",
libatomic_include_path, foo
))
.build();

println!(
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extern "C" {
fn GC_get_stack_base(stack_base: *mut GcStackBase) -> c_int;
fn GC_init();
fn GC_malloc(size: size_t) -> *mut c_void;
fn GC_memalign(align: size_t, size: size_t) -> *mut c_void;
fn GC_realloc(ptr: *mut c_void, size: size_t) -> *mut c_void;
fn GC_register_my_thread(stack_base: *const GcStackBase) -> c_int;
fn GC_set_stackbottom(thread: *const c_void, stack_bottom: *const GcStackBase);
Expand Down Expand Up @@ -126,7 +127,7 @@ impl Allocator {

unsafe impl GlobalAlloc for Allocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
GC_malloc(layout.size()) as *mut u8
GC_memalign(layout.align(), layout.size()) as *mut u8
}

unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
Expand Down