This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Adjustable stack size for EVM #2483
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -22,9 +22,19 @@ use crossbeam::sync::chase_lev; | |
use service::{HandlerId, IoChannel, IoContext}; | ||
use IoHandler; | ||
use panics::*; | ||
use std::cell::Cell; | ||
|
||
use std::sync::{Condvar as SCondvar, Mutex as SMutex}; | ||
|
||
const STACK_SIZE: usize = 16*1024*1024; | ||
|
||
thread_local! { | ||
/// Stack size | ||
/// Should be modified if it is changed in Rust since it is no way | ||
/// to know or get it | ||
pub static LOCAL_STACK_SIZE: Cell<usize> = Cell::new(::std::env::var("RUST_MIN_STACK").ok().and_then(|s| s.parse().ok()).unwrap_or(2 * 1024 * 1024)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minimum should be 512k, that's the default on OS X There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 512k must be default for the main thread only this expression exactly the same value which rust uses for spawned threads: |
||
} | ||
|
||
pub enum WorkType<Message> { | ||
Readable, | ||
Writable, | ||
|
@@ -66,8 +76,9 @@ impl Worker { | |
deleting: deleting.clone(), | ||
wait_mutex: wait_mutex.clone(), | ||
}; | ||
worker.thread = Some(thread::Builder::new().name(format!("IO Worker #{}", index)).spawn( | ||
worker.thread = Some(thread::Builder::new().stack_size(STACK_SIZE).name(format!("IO Worker #{}", index)).spawn( | ||
move || { | ||
LOCAL_STACK_SIZE.with(|val| val.set(STACK_SIZE)); | ||
panic_handler.catch_panic(move || { | ||
Worker::work_loop(stealer, channel.clone(), wait, wait_mutex.clone(), deleting) | ||
}).unwrap() | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like with 8kb frame the stack of 8mb should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be so, but previously we used 32kb
see above