Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2741554
Add Arch Linux installation instructions
cmichi Jan 14, 2019
e95140a
Enable tracing heap size
gavofyork Jan 11, 2019
d2a7935
Extract heap
cmichi Jan 12, 2019
aff276a
Replace linear allocator with buddy allocator
cmichi Jan 14, 2019
292c177
Fix test
cmichi Jan 16, 2019
1d71e15
Get rid of memcpy in to_vec()
cmichi Jan 16, 2019
b65f0e4
fixup: Style and comments
cmichi Jan 17, 2019
02a3d1e
fixup: Split Linux instructions by distribution
cmichi Jan 17, 2019
dfa62a8
fixup: Remove unnecessary types and code
cmichi Jan 17, 2019
41e4ab7
fixup: Make Pointers start from 1, remove some panics, code improvements
cmichi Jan 17, 2019
53bf828
fixup: Return 0 on errors
cmichi Jan 17, 2019
b189736
fixup: Move loop to separate function
cmichi Jan 17, 2019
18a1efc
fixup: Use FnvHashMap instead of HashMap
cmichi Jan 17, 2019
137b5bd
fixup: Fix error handling
cmichi Jan 17, 2019
741e972
fixup: Use current_size() instead of used_size()
cmichi Jan 17, 2019
93dc2e9
fixup: Fix and document allocation offset
cmichi Jan 17, 2019
d4676b0
fixup: Remove unnecessary multiplication
cmichi Jan 17, 2019
6a99426
fixup: Fix comments
cmichi Jan 17, 2019
6725a49
fixup: Remove Arch installation instructions
cmichi Jan 17, 2019
6438db3
Revert "Fix test"
cmichi Jan 17, 2019
ecd9731
fixup: Remove unused code, improve import
cmichi Jan 17, 2019
ca065b1
fixup: Proper alignment
cmichi Jan 17, 2019
58ee588
fixup: Do not use internal constant in public description
cmichi Jan 17, 2019
247d37b
fixup: Add comment regarding invariants
cmichi Jan 18, 2019
8e4deda
fixup: Move assertion to compile-time check
cmichi Jan 18, 2019
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
Prev Previous commit
Next Next commit
fixup: Use FnvHashMap instead of HashMap
  • Loading branch information
cmichi committed Jan 17, 2019
commit 18a1efce82bacdfd0c0256208a21db7c14ffb5d5
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ byteorder = "1.1"
lazy_static = "1.0"
parking_lot = "0.7.1"
log = "0.4"
fnv = "1.0.6"

[dev-dependencies]
assert_matches = "1.1"
Expand Down
8 changes: 5 additions & 3 deletions core/executor/src/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
//! It uses a binary tree and follows the concepts outlined in
//! https://en.wikipedia.org/wiki/Buddy_memory_allocation.

extern crate fnv;

use std::vec;
use std::collections::HashMap;
use self::fnv::FnvHashMap;

// The pointers need to be aligned. By choosing a block size
// which is a multiple of the memory alignment requirement
Expand All @@ -41,7 +43,7 @@ enum Node {
/// A buddy allocation heap, which tracks allocations and deallocations
/// using a binary tree.
pub struct Heap {
allocated_bytes: HashMap<u32, u32>,
allocated_bytes: FnvHashMap<u32, u32>,
levels: u32,
tree: vec::Vec<Node>,
total_size: u32,
Expand All @@ -56,7 +58,7 @@ impl Heap {
let node_count: usize = (1 << levels + 1) - 1;

Heap {
allocated_bytes: HashMap::new(),
allocated_bytes: FnvHashMap::default(),
levels,
tree: vec![Node::Free; node_count],
total_size: 0,
Expand Down