diff --git a/Cargo.toml b/Cargo.toml index 731cc02..937b1a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ optional = true [dependencies] bit-set = "0.3.0" -vec_map = "0.4.0" +vec_map = "0.6.0" libc = "0.2.0" [lib] diff --git a/src/spaces/collector/mod.rs b/src/spaces/collector/mod.rs index 6f44ef3..98d70f4 100644 --- a/src/spaces/collector/mod.rs +++ b/src/spaces/collector/mod.rs @@ -240,11 +240,11 @@ impl Collector { } else { unsafe{ (*block).count_holes(); } let (holes, marked_lines) = unsafe{ (*block).count_holes_and_marked_lines() }; - if self.mark_histogram.contains_key(&(holes as usize)) { - if let Some(val) = self.mark_histogram.get_mut(&(holes as usize)) { + if self.mark_histogram.contains_key(holes) { + if let Some(val) = self.mark_histogram.get_mut(holes) { *val += marked_lines; } - } else { self.mark_histogram.insert(holes as usize, marked_lines); } + } else { self.mark_histogram.insert(holes, marked_lines); } debug!("Found {} holes and {} marked lines in block {:p}", holes, marked_lines, block); match holes { @@ -269,18 +269,18 @@ impl Collector { let mut available_histogram : VecMap = VecMap::with_capacity(NUM_LINES_PER_BLOCK); for &block in &self.all_blocks { let (holes, free_lines) = unsafe{ (*block).count_holes_and_available_lines() }; - if available_histogram.contains_key(&(holes as usize)) { - if let Some(val) = available_histogram.get_mut(&(holes as usize)) { + if available_histogram.contains_key(holes) { + if let Some(val) = available_histogram.get_mut(holes) { *val += free_lines; } - } else { available_histogram.insert(holes as usize, free_lines); } + } else { available_histogram.insert(holes, free_lines); } } let mut required_lines = 0; let mut available_lines = evac_headroom * (NUM_LINES_PER_BLOCK - 1); for threshold in 0..NUM_LINES_PER_BLOCK { - required_lines += *self.mark_histogram.get(&threshold).unwrap_or(&0); - available_lines = available_lines.saturating_sub(*available_histogram.get(&threshold).unwrap_or(&0)); + required_lines += *self.mark_histogram.get(threshold).unwrap_or(&0); + available_lines = available_lines.saturating_sub(*available_histogram.get(threshold).unwrap_or(&0)); if available_lines <= required_lines { return threshold; } diff --git a/src/spaces/immix_space/block_info.rs b/src/spaces/immix_space/block_info.rs index 33c656a..e789004 100644 --- a/src/spaces/immix_space/block_info.rs +++ b/src/spaces/immix_space/block_info.rs @@ -256,7 +256,7 @@ impl BlockInfo { self, last_high_index); let mut low_index = NUM_LINES_PER_BLOCK - 1; for index in (last_high_index + 1)..NUM_LINES_PER_BLOCK { - if self.line_counter.get(&index).map_or(true, |c| *c == 0) { + if self.line_counter.get(index).map_or(true, |c| *c == 0) { // +1 to skip the next line in case an object straddles lines low_index = index + 1; break; @@ -264,7 +264,7 @@ impl BlockInfo { } let mut high_index = NUM_LINES_PER_BLOCK; for index in low_index..NUM_LINES_PER_BLOCK { - if self.line_counter.get(&index).map_or(false, |c| *c != 0) { + if self.line_counter.get(index).map_or(false, |c| *c != 0) { high_index = index; break; } @@ -341,10 +341,10 @@ impl BlockInfo{ }; if increment { debug!("Incremented line count for line {} to {}", line, - self.line_counter.get(&line).expect("a line count")); + self.line_counter.get(line).expect("a line count")); } else { debug!("Decremented line count for line {} to {}", line, - self.line_counter.get(&line).expect("a line count")); + self.line_counter.get(line).expect("a line count")); } } }