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>
43 lines
1,004 B
Rust
43 lines
1,004 B
Rust
// Proxy for the VM boundary cost: a property read done as an extern "C" call into the
|
|
// host (here libc `labs` as a stand-in for a generated C entry point) versus the same
|
|
// value read inline (the "VM intrinsic" path: a load from a repr(C) slot).
|
|
extern "C" {
|
|
fn labs(x: i64) -> i64;
|
|
}
|
|
|
|
#[repr(C)]
|
|
#[derive(Clone, Copy)]
|
|
struct Slot {
|
|
tag: u64,
|
|
value: i64,
|
|
}
|
|
|
|
fn read_inline(slots: &[Slot; 64], i: usize) -> i64 {
|
|
if slots[i].tag == 3 {
|
|
slots[i].value
|
|
} else {
|
|
0
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn call_through() {
|
|
let mut s = 0i64;
|
|
for i in 0..10_000_000i64 {
|
|
s = s.wrapping_add(unsafe { labs(i - 5_000_000) });
|
|
}
|
|
println!("call-through sum {}", s);
|
|
}
|
|
|
|
#[test]
|
|
fn inline_intrinsic() {
|
|
let mut slots = [Slot { tag: 3, value: 0 }; 64];
|
|
for i in 0..64 {
|
|
slots[i].value = i as i64;
|
|
}
|
|
let mut s = 0i64;
|
|
for i in 0..10_000_000usize {
|
|
s = s.wrapping_add(read_inline(&slots, i & 63));
|
|
}
|
|
println!("inline sum {}", s);
|
|
}
|