-
Notifications
You must be signed in to change notification settings - Fork 0
New alloca #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Km1zZzoU
wants to merge
21
commits into
master
Choose a base branch
from
new-alloca
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New alloca #43
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
76f243b
.
Km1zZzoU fb44358
threads 0
Km1zZzoU df86370
gc 0.0
Km1zZzoU 9c5adac
add markqueue
Km1zZzoU bf2714b
rewrite mark colors
Km1zZzoU d1ff919
add flag in queue in Arena3
Km1zZzoU b9b5b08
refactoring lib.rs
Km1zZzoU d1be98c
progress in gc/mod.rs
Km1zZzoU aa7c9d0
start -> span_start
Km1zZzoU 75f3f48
progress in the gc module
Km1zZzoU 8935849
misstake
Km1zZzoU 0fd4144
fix misstakes
Km1zZzoU 9c42cf0
sweep complete
Km1zZzoU 230c05e
;
Km1zZzoU 6b9b569
rewrite alloca
Km1zZzoU 2ba2994
the worst commit ever, dont check please, rust issue
Km1zZzoU 99dd8e5
this fcking bitch compiled
Km1zZzoU ca5ed15
fix tests
Km1zZzoU 6db5291
fix bugs, complete test and stress-test (alloca3)
Km1zZzoU 32acf95
fix mutexs, bug in alloca and etc
Km1zZzoU 6df8596
review
Km1zZzoU File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,5 +5,4 @@ edition = "2024" | |
|
|
||
| [dependencies] | ||
| libc = "1.0.0-alpha.1" | ||
| mmap-rs = "0.6.1" | ||
| memmap2 = "0.9.7" | ||
| dashmap = "7.0.0-rc2" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,21 @@ | ||
| use crate::alloca::{ptr, Object}; | ||
| use crate::alloca::arena::Arena3; | ||
| use crate::alloca::{Cfg, ptr}; | ||
| use crate::utils::Object; | ||
|
|
||
| pub trait ArenaAllocator3<T: Object, U: Arena3> { | ||
| const LOG_CAPACITY_SIZE: usize; | ||
|
|
||
| const LOG_BLOCK_SIZE: usize; | ||
|
|
||
| const LOG_START_ARENA_SIZE: usize; | ||
|
|
||
| const LOG_MAX_ARENA_SIZE: usize; | ||
|
|
||
| fn new(max_size: usize) -> Self; | ||
|
|
||
| fn alloc(&mut self, o: &T) -> ptr; | ||
|
|
||
| fn mark_white(&mut self); | ||
|
|
||
| fn arena_by_ptr(&mut self, ptr: usize) -> &mut U; | ||
|
|
||
| fn mark_gray(&mut self, ptr: ptr); | ||
|
|
||
| fn mark_black(&mut self, ptr: ptr); | ||
| } | ||
| pub trait ArenaAllocator3<U: Arena3> { | ||
| fn new(config: &Cfg) -> Self; | ||
|
|
||
| fn alloc(&mut self, o: &Object) -> (ptr, bool); | ||
|
|
||
| fn mark_white(&mut self); | ||
|
|
||
| fn arena_by_ptr(&self, ptr: usize) -> Option<&U>; | ||
|
|
||
| fn mut_arena_by_ptr(&mut self, ptr: usize) -> Option<&mut U>; | ||
|
|
||
| fn mark_gray(&mut self, ptr: ptr) -> Option<&mut U>; | ||
|
|
||
| fn mark_black(&mut self, ptr: ptr) -> Option<&mut U>; | ||
|
|
||
| fn sweep(&mut self); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,39 @@ | ||
| use crate::alloca::ptr; | ||
|
|
||
| pub trait Arena3 { | ||
| fn new(start: ptr, size: usize) -> Self; | ||
|
|
||
| fn start(&self) -> ptr; | ||
|
|
||
| fn cur(&self) -> ptr; | ||
|
|
||
| fn add(&mut self, size: usize); | ||
|
|
||
| fn size(&self) -> usize; | ||
|
|
||
| fn how_much(&self) -> usize; | ||
|
|
||
| fn gray_map(&self) ->(ptr, usize); | ||
|
|
||
| fn black_map(&self) ->(ptr, usize); | ||
|
|
||
| fn clear_mark(&mut self); | ||
|
|
||
| fn live(&self) -> bool; | ||
|
|
||
| fn on(&mut self); | ||
|
|
||
| fn off(&mut self); | ||
|
|
||
| fn mark_gray(&mut self, ptr: ptr); | ||
|
|
||
| fn mark_black(&mut self, ptr: ptr); | ||
| } | ||
| fn new(start: ptr, size: usize) -> Self; | ||
|
|
||
| fn span_start(&self) -> ptr; | ||
|
|
||
| fn cur(&self) -> ptr; | ||
|
|
||
| fn add(&mut self, size: usize); | ||
|
|
||
| fn size(&self) -> usize; | ||
|
|
||
| fn how_much(&self) -> usize; | ||
|
|
||
| fn gray_map(&self) -> (ptr, usize); | ||
|
|
||
| fn black_map(&self) -> (ptr, usize); | ||
|
|
||
| fn clear_mark(&mut self); | ||
|
|
||
| fn live(&self) -> bool; | ||
|
|
||
| fn alive(&mut self); | ||
|
|
||
| fn kill(&mut self); | ||
|
|
||
| fn make_live(&mut self); | ||
|
|
||
| fn temp_kill(&mut self); | ||
|
|
||
| fn mark_gray(&mut self, ptr: ptr); | ||
|
|
||
| fn mark_black(&mut self, ptr: ptr); | ||
|
|
||
| fn fetch_and_add_in_queue(&mut self) -> bool; | ||
|
|
||
| fn fetch_and_take_from_queue(&mut self) -> bool; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| pub struct Cfg { | ||
| pub log_capacity_size: usize, | ||
| pub log_block_size: usize, | ||
| pub log_start_arena_size: usize, | ||
| pub step_arena_size: usize, | ||
| pub log_max_arena_size: usize, | ||
| pub count_of_tiers: usize, | ||
| pub max_size: usize, | ||
| pub max_object_size_by_size: fn(usize) -> usize, | ||
|
|
||
| pub count_gc_workers: usize, | ||
| } | ||
|
|
||
| impl Cfg { | ||
| pub fn new( | ||
| log_capacity_size: usize, | ||
| log_block_size: usize, | ||
| log_start_arena_size: usize, | ||
| log_max_arena_size: usize, | ||
| step_arena_size: usize, | ||
| max_size: usize, | ||
| max_object_size_by_size: fn(usize) -> usize, | ||
| count_gc_workers: usize, | ||
| ) -> Self { | ||
| assert!(log_capacity_size > log_block_size); | ||
| assert!(log_block_size > log_max_arena_size); | ||
| assert!(log_max_arena_size > log_start_arena_size); | ||
| assert!(step_arena_size < log_max_arena_size - log_start_arena_size); | ||
| assert!(count_gc_workers > 0); | ||
|
|
||
| Self { | ||
| log_capacity_size, | ||
| log_block_size, | ||
| log_start_arena_size, | ||
| step_arena_size, | ||
| log_max_arena_size, | ||
| count_of_tiers: ((log_max_arena_size - log_start_arena_size) / step_arena_size) + 1, | ||
| max_size, | ||
| max_object_size_by_size, | ||
| count_gc_workers, | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.