Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@
fn attach(&mut self, root: &mut T, index: T) {
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
}

fn detach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 201 in doublets/src/mem/split/generic/external_sources_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal detach
self.detach(root, index)

Check failure on line 203 in doublets/src/mem/split/generic/external_sources_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

multiple applicable items in scope
}

fn attach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 206 in doublets/src/mem/split/generic/external_sources_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal attach
self.attach(root, index)

Check failure on line 208 in doublets/src/mem/split/generic/external_sources_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

multiple applicable items in scope
}
}

impl<T: LinkType> SplitUpdateMem<T> for ExternalSourcesRecursionlessTree<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@
fn attach(&mut self, root: &mut T, index: T) {
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
}

fn detach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 199 in doublets/src/mem/split/generic/external_targets_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal detach
self.detach(root, index)
}

fn attach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 204 in doublets/src/mem/split/generic/external_targets_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal attach
self.attach(root, index)
}
}

impl<T: LinkType> SplitUpdateMem<T> for ExternalTargetsRecursionlessTree<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@
fn attach(&mut self, root: &mut T, index: T) {
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
}

fn detach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 133 in doublets/src/mem/split/generic/internal_sources_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal detach
self.detach(root, index)
}

fn attach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 138 in doublets/src/mem/split/generic/internal_sources_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal attach
self.attach(root, index)
}
}

impl<T: LinkType> SplitUpdateMem<T> for InternalSourcesRecursionlessTree<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@
fn attach(&mut self, root: &mut T, index: T) {
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
}

fn detach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 140 in doublets/src/mem/split/generic/internal_targets_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal detach
self.detach(root, index)
}

fn attach_with_mem(&mut self, _mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {

Check failure on line 145 in doublets/src/mem/split/generic/internal_targets_recursion_less_tree.rs

View workflow job for this annotation

GitHub Actions / Benchmark

cannot find type `LinkPart` in this scope
// Split trees don't use unit memory, so just delegate to normal attach
self.attach(root, index)
}
}

impl<T: LinkType> SplitUpdateMem<T> for InternalTargetsRecursionlessTree<T> {
Expand Down
5 changes: 5 additions & 0 deletions doublets/src/mem/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ pub trait LinksTree<T: LinkType> {
fn detach(&mut self, root: &mut T, index: T);

fn attach(&mut self, root: &mut T, index: T);

// New methods that accept memory explicitly to avoid stacked borrows issues
fn detach_with_mem(&mut self, mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T);

fn attach_with_mem(&mut self, mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T);
}

pub trait UnitUpdateMem<T: LinkType> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ impl<T: LinkType> LinksTree<T> for LinksSourcesRecursionlessSizeBalancedTree<T>
fn attach(&mut self, root: &mut T, index: T) {
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
}

fn detach_with_mem(&mut self, mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {
// Temporarily update memory reference to avoid stacked borrows
let old_mem = self.base.mem;
self.base.mem = mem;
unsafe { NoRecurSzbTree::detach(self, root as *mut _, index) }
self.base.mem = old_mem;
}

fn attach_with_mem(&mut self, mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {
// Temporarily update memory reference to avoid stacked borrows
let old_mem = self.base.mem;
self.base.mem = mem;
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
self.base.mem = old_mem;
}
}

impl<T: LinkType> UnitUpdateMem<T> for LinksSourcesRecursionlessSizeBalancedTree<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ impl<T: LinkType> LinksTree<T> for LinksTargetsRecursionlessSizeBalancedTree<T>
fn attach(&mut self, root: &mut T, index: T) {
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
}

fn detach_with_mem(&mut self, mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {
// Temporarily update memory reference to avoid stacked borrows
let old_mem = self.base.mem;
self.base.mem = mem;
unsafe { NoRecurSzbTree::detach(self, root as *mut _, index) }
self.base.mem = old_mem;
}

fn attach_with_mem(&mut self, mem: NonNull<[LinkPart<T>]>, root: &mut T, index: T) {
// Temporarily update memory reference to avoid stacked borrows
let old_mem = self.base.mem;
self.base.mem = mem;
unsafe { NoRecurSzbTree::attach(self, root as *mut _, index) }
self.base.mem = old_mem;
}
}

impl<T: LinkType> UnitUpdateMem<T> for LinksTargetsRecursionlessSizeBalancedTree<T> {
Expand Down
16 changes: 12 additions & 4 deletions doublets/src/mem/unit/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use leak_slice::LeakSliceExt;
use mem::{RawMem, DEFAULT_PAGE_SIZE};

use std::{cmp, cmp::Ordering, error::Error, mem::transmute, ptr::NonNull};

Check warning on line 17 in doublets/src/mem/unit/store.rs

View workflow job for this annotation

GitHub Actions / Benchmark

unused import: `error::Error`

pub struct Store<
T: LinkType,
Expand Down Expand Up @@ -151,19 +151,27 @@
}

unsafe fn detach_source_unchecked(&mut self, root: *mut T, index: T) {
self.sources.detach(&mut *root, index);
// Get memory pointer first to avoid overlapping borrows
let mem_ptr = self.mem_ptr;
self.sources.detach_with_mem(mem_ptr, &mut *root, index);
}

unsafe fn detach_target_unchecked(&mut self, root: *mut T, index: T) {
self.targets.detach(&mut *root, index);
// Get memory pointer first to avoid overlapping borrows
let mem_ptr = self.mem_ptr;
self.targets.detach_with_mem(mem_ptr, &mut *root, index);
}

unsafe fn attach_source_unchecked(&mut self, root: *mut T, index: T) {
self.sources.attach(&mut *root, index);
// Get memory pointer first to avoid overlapping borrows
let mem_ptr = self.mem_ptr;
self.sources.attach_with_mem(mem_ptr, &mut *root, index);
}

unsafe fn attach_target_unchecked(&mut self, root: *mut T, index: T) {
self.targets.attach(&mut *root, index);
// Get memory pointer first to avoid overlapping borrows
let mem_ptr = self.mem_ptr;
self.targets.attach_with_mem(mem_ptr, &mut *root, index);
}

unsafe fn detach_source(&mut self, index: T) {
Expand Down
Loading