The JIT that runs makepad apps from source: lexer, front end, type checker, lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and warm/cold caches keyed by compiler stamp, provided crates bound late, startup images, live patching. User-facing name is `makepad run` (binary `makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal library name. `makepad check` reports rustc-style diagnostics with rustc error codes and checks a whole workspace (`--workspace`). Runs on macOS, Linux, Windows and Android. makepad-remote: one tool schema for apps and the WM (app/1): grabs, captures, traces, frame profiles and tweaks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
18 lines
1.1 KiB
Rust
18 lines
1.1 KiB
Rust
// Fuel (hotreload.md §12.3): with MAKEPAD_RUN_MODULE_FUEL=1000000, a module call that runs more loop
|
|
// iterations than that ends with an error (no deadline needed); a shorter one completes, and
|
|
// the budget is per call (refilled at each entry).
|
|
#[test]
|
|
fn fuel() {
|
|
use std::relax::Module;
|
|
let m = Module::load_source("spin", "spin.rs", "pub fn spin(n: u64) -> u64 {\n let mut x = 1u64;\n let mut i = 0;\n while i < n {\n x = x.wrapping_mul(6364136223846793005).wrapping_add(i);\n i += 1;\n }\n x\n}\n", &[]).unwrap();
|
|
let f: fn(u64) -> u64 = m.get("spin").unwrap();
|
|
// Fuel must still trap after O3 optimises a hot twin.
|
|
for _ in 0..10000 { std::hint::black_box(f(10)); }
|
|
std::thread::sleep(std::time::Duration::from_millis(800));
|
|
let short = std::relax::guard(0, || f(10_000));
|
|
let long = std::relax::guard(0, || f(100_000_000));
|
|
let again = std::relax::guard(0, || f(10_000));
|
|
println!("out short ok: {}", short.is_ok());
|
|
println!("out long stopped: {}", long.is_err());
|
|
println!("out refilled: {}", again.is_ok() && again.ok() == short.ok());
|
|
}
|