mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00

Currently we only generate a single static function, but it is probably loaded and run with jit. This is the base to start generating proper code.
44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
extern crate bumpalo;
|
|
|
|
#[macro_use]
|
|
pub mod eval;
|
|
|
|
/// Used in the with_larger_debug_stack() function, for tests that otherwise
|
|
/// run out of stack space in debug builds (but don't in --release builds)
|
|
#[allow(dead_code)]
|
|
const EXPANDED_STACK_SIZE: usize = 8 * 1024 * 1024;
|
|
|
|
/// Without this, some tests pass in `cargo test --release` but fail without
|
|
/// the --release flag because they run out of stack space. This increases
|
|
/// stack size for debug builds only, while leaving the stack space at the default
|
|
/// amount for release builds.
|
|
#[allow(dead_code)]
|
|
#[cfg(debug_assertions)]
|
|
pub fn with_larger_debug_stack<F>(run_test: F)
|
|
where
|
|
F: FnOnce() -> (),
|
|
F: Send,
|
|
F: 'static,
|
|
{
|
|
std::thread::Builder::new()
|
|
.stack_size(EXPANDED_STACK_SIZE)
|
|
.spawn(run_test)
|
|
.expect("Error while spawning expanded dev stack size thread")
|
|
.join()
|
|
.expect("Error while joining expanded dev stack size thread")
|
|
}
|
|
|
|
/// In --release builds, don't increase the stack size. Run the test normally.
|
|
/// This way, we find out if any of our tests are blowing the stack even after
|
|
/// optimizations in release builds.
|
|
#[allow(dead_code)]
|
|
#[cfg(not(debug_assertions))]
|
|
#[inline(always)]
|
|
pub fn with_larger_debug_stack<F>(run_test: F)
|
|
where
|
|
F: FnOnce() -> (),
|
|
F: Send,
|
|
F: 'static,
|
|
{
|
|
run_test()
|
|
}
|