Skip to content

Commit

Permalink
Fix test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyuzhao committed Mar 13, 2024
1 parent a9e2541 commit d7a7401
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions mallockit/src/malloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<P: Plan> MallocAPI<P> {
pub unsafe fn malloc_size(&self, ptr: Address) -> usize {
let ptr = Address::from(ptr);
#[cfg(target_os = "macos")]
if Self::is_in_mallockit_heap(ptr.into()) {
if !Self::is_in_mallockit_heap(ptr.into()) {
return crate::util::macos_malloc_zone::external_memory_size(ptr);
}
P::get_layout(ptr).size()
Expand Down Expand Up @@ -85,7 +85,7 @@ impl<P: Plan> MallocAPI<P> {
return;
}
#[cfg(target_os = "macos")]
if Self::is_in_mallockit_heap(ptr.into()) {
if !Self::is_in_mallockit_heap(ptr.into()) {
return;
}
self.mutator().dealloc(ptr.into());
Expand All @@ -108,7 +108,7 @@ impl<P: Plan> MallocAPI<P> {
let new_size = Self::align_up(new_size, Self::MIN_ALIGNMENT);

#[cfg(target_os = "macos")]
if Self::is_in_mallockit_heap(ptr.into()) {
if !Self::is_in_mallockit_heap(ptr.into()) {
let ptr = Address::from(ptr);
let old_size = crate::util::macos_malloc_zone::external_memory_size(ptr);
let new_layout =
Expand Down
7 changes: 4 additions & 3 deletions mallockit/src/mutator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ pub trait TLS: Sized {
}
}

impl TLS for u8 {

Check failure on line 94 in mallockit/src/mutator.rs

View workflow job for this annotation

GitHub Actions / checks

not all trait items implemented, missing: `current`

Check failure on line 94 in mallockit/src/mutator.rs

View workflow job for this annotation

GitHub Actions / checks

not all trait items implemented, missing: `current`
const NEW: Self = 0;
}

#[cfg(target_os = "macos")]
mod macos_tls {
use spin::{mutex::Mutex, Yield};
Expand All @@ -111,9 +115,6 @@ mod macos_tls {
#[cfg(test)]
#[no_mangle]
extern "C" fn mallockit_initialize_macos_tls() -> *mut u8 {
impl TLS for u8 {
const NEW: Self = 0;
}
get_tls::<u8>()
}

Expand Down

0 comments on commit d7a7401

Please sign in to comment.