Skip to content

Commit

Permalink
update vec to 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoyen committed Mar 9, 2016
1 parent c78c9b0 commit 22a42e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
16 changes: 8 additions & 8 deletions src/spaces/collector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -269,18 +269,18 @@ impl Collector {
let mut available_histogram : VecMap<usize> = 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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/spaces/immix_space/block_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,15 @@ 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;
}
}
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;
}
Expand Down Expand Up @@ -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"));
}
}
}
Expand Down

0 comments on commit 22a42e5

Please sign in to comment.