migrate gc.rs to LinearSet
This commit is contained in:
parent
499f00de1d
commit
7de5e6c487
2 changed files with 5 additions and 11 deletions
|
|
@ -44,7 +44,7 @@ use io;
|
|||
use libc::{size_t, uintptr_t};
|
||||
use option::{None, Option, Some};
|
||||
use ptr;
|
||||
use send_map::linear::LinearMap;
|
||||
use send_map::linear::LinearSet;
|
||||
use stackwalk;
|
||||
use sys;
|
||||
|
||||
|
|
@ -294,12 +294,6 @@ pub fn gc() {
|
|||
}
|
||||
}
|
||||
|
||||
type RootSet = LinearMap<*Word,()>;
|
||||
|
||||
fn RootSet() -> RootSet {
|
||||
LinearMap()
|
||||
}
|
||||
|
||||
#[cfg(gc)]
|
||||
fn expect_sentinel() -> bool { true }
|
||||
|
||||
|
|
@ -337,13 +331,13 @@ pub fn cleanup_stack_for_failure() {
|
|||
ptr::null()
|
||||
};
|
||||
|
||||
let mut roots = ~RootSet();
|
||||
let mut roots = LinearSet::new();
|
||||
for walk_gc_roots(need_cleanup, sentinel) |root, tydesc| {
|
||||
// Track roots to avoid double frees.
|
||||
if roots.find(&*root).is_some() {
|
||||
if roots.contains(&*root) {
|
||||
loop;
|
||||
}
|
||||
roots.insert(*root, ());
|
||||
roots.insert(*root);
|
||||
|
||||
if ptr::is_null(tydesc) {
|
||||
// FIXME #4420: Destroy this box
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ pub mod linear {
|
|||
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
|
||||
}
|
||||
|
||||
impl <T: Hash IterBytes Eq> LinearSet<T> {
|
||||
pub impl <T: Hash IterBytes Eq> LinearSet<T> {
|
||||
/// Create an empty LinearSet
|
||||
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap()} }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue