[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-114953":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":13,"stars7d":15,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":16,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":19,"topics":21,"createdAt":9,"pushedAt":22,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},114953,"crate","oneamendez\u002Fcrate","oneamendez","Compact Runtime for Arm64 Translation and Emulation: an embeddable arm64 virtual machine engine",null,"Rust",73,9,1,0,10,3,51,"Mozilla Public License 2.0",false,"main",[],"2026-11-14 05:29:13","2026-11-22 22:54:26","\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Ficon.png\" alt=\"crate's icon: a wooden crate holding a terminal and two other windows\" width=\"128\" height=\"128\">\n\u003C\u002Fp>\n\n# crate\n\n**Compact Runtime for Arm64 Translation and Emulation.**\n\nAn embeddable engine that runs arm64 virtual machines on arm64 hosts that offer\nno hypervisor to apps, such as iPhones and iPads. Guest code runs through an\narm64-to-arm64 translator: most instructions are copied into host code as they\nare, and only what touches the machine (memory, branches, system registers,\nexceptions) is rewritten. On a Mac the same machines can also run on Apple's\nHypervisor framework.\n\ncrate is a library, not an app. An app links it, describes a machine through\nits API, and gets the console, the screen and input back as callbacks; the\nengine never assumes what the app looks like.\n\nStatus: early. The `virt` machine boots Debian to a shell on a Mac through\nApple's Hypervisor framework and through the translator, on one to four CPUs,\nseveral times faster than QEMU's TCG. A virtio-gpu with virgl (virglrenderer\nover ANGLE), a keyboard and a tablet run Linux desktops and Chrome with\nhardware compositing, on a Mac and on an iPhone, where the app gets executable\nmemory from an attached debugger. **The C API is a draft**: until 1.0 it\nchanges incompatibly as needed (see\n[milestone 7](docs\u002FPLAN.md#milestone-7-firming-up-the-api)). See\n[docs\u002FPLAN.md](docs\u002FPLAN.md) for what is done and what is left, and\n[docs\u002FDESIGN.md](docs\u002FDESIGN.md) for how the pieces fit.\n\n## Goals\n\n- **Linux first.** A `virt` machine that boots stock arm64 Linux kernels with a\n  device tree, virtio devices and a GPU for desktops.\n- **A real library.** A versioned C API (`include\u002Fcrate.h`) for apps in any\n  language, a Rust API for Rust code, and a Swift package for Apple platforms.\n- **Extensible.** Machines, devices, CPU backends and host backends are separate\n  pieces with interfaces between them, so a project can add its own device or\n  board without forking the engine.\n- **Not tied to one guest.** Nothing in the engine assumes Linux or macOS;\n  what a guest needs lives in its machine.\n- **Fast.** Close to native for ordinary code, with the remaining overhead\n  (memory translation, the kernel's own work) attacked directly.\n\n## Layout\n\n    include\u002Fcrate.h     the C API\n    crates\u002F\n      crate-core        machine model: guest memory, CPUs, buses, interrupts, traits\n      crate-jit         the translator (CPU backend for hosts without a hypervisor)\n      crate-hvf         CPU backend on Apple's Hypervisor framework (macOS)\n      crate-devices     GICv3, UART, RTC, virtio (block, network, console)\n      crate-virt        the virt machine: memory map, device tree, Linux boot\n      crate-host        executable memory, guest RAM, disks, network, GPU\n      crate-vnc         an optional VNC server for a display\n      crate-ffi         the C API's implementation (libcrate)\n    tools\u002Fcrate-run     command-line runner for development\n    tools\u002Fvnc.py        screenshots and input through a VNC server\n    docs\u002F               plan, design, provenance\n\n## Building\n\nNeeds Rust 1.85 or later, and libslirp for user-mode networking\n(`brew install libslirp`; another location can be given in `SLIRP_LIB_DIR`).\n\n    cargo build\n    cargo test\n\n## The C API and iOS\n\n`include\u002Fcrate.h` is the API, a draft until 1.0: its minor version changes with\nevery incompatible change, so pin a release. `tools\u002Fxcframework.sh` builds it\n(release) as\n`target\u002Fxcframework\u002FCrate.xcframework`, a static library for iPhones, Simulators\non Apple silicon and Macs on arm64, with the header and a module map for Swift\n(`import CrateEngine`); it needs the `aarch64-apple-ios` and\n`aarch64-apple-ios-sim` Rust targets. Pushing a tag `vX.Y.Z`, the workspace\nversion, publishes it as a release (`.github\u002Fworkflows\u002Frelease.yml`): the zip and\nits SHA-256, which an app pins, and for every release after v0.1.0 GitHub's\nattestation of the commit and workflow that built it. The app links libslirp\nitself. On iOS the app passes in executable memory that a debugger it attached\nhas prepared (see `crate_config_set_jit_region`); crate cannot get its own\nthere.\n\n`tools\u002Fcrate-boot\u002Fbuild.sh` builds a C program that boots a guest through the\nAPI, as an app does:\n\n    target\u002Frelease\u002Fcrate-boot --backend jit --cpus 4 --memory 2048 \\\n        --kernel vmlinuz --initrd initrd.img --disk rootfs.img \\\n        --cmdline \"console=ttyAMA0 root=\u002Fdev\u002Fvda rw\" --forward 2230:22\n\n## Running a guest on a Mac\n\n`crate-run` needs Apple's `com.apple.security.hypervisor` entitlement, so build\nit with the script that signs it (ad hoc), which prints the binary's path:\n\n    tools\u002Fcrate-run\u002Fbuild.sh\n\nThen, for example, a Debian image with four CPUs, its disk, the network and\nSSH forwarded from port 2230:\n\n    target\u002Fdebug\u002Fcrate-run --kernel vmlinuz --initrd initrd.img \\\n        --cmdline \"console=ttyAMA0 root=\u002Fdev\u002Fvda rw\" \\\n        --disk rootfs.img --cpus 4 --memory 2048 --forward 2230:22\n\nThe terminal is the guest's serial console; Ctrl-A x stops the machine.\n`crate-run --help` lists the rest.\n\nA screen, keyboard and tablet come with `--display 2d` or `--display virgl`,\nseen through a VNC server (`--vnc vnc.sock`, `--vnc-tcp 127.0.0.1:5905`).\nvirgl needs virglrenderer and ANGLE, which crate loads when the machine starts,\nfound through dyld's paths. Set them in a script that runs crate-run itself:\nmacOS drops `DYLD_*` variables on the way through system binaries such as\n`nohup` or `perl`.\n\n    export DYLD_FRAMEWORK_PATH=$GPU\u002Fangle          # ANGLE's EGL.framework\n    export DYLD_LIBRARY_PATH=$GPU\u002Flib:\u002Fopt\u002Fhomebrew\u002Fopt\u002Fmolten-vk\u002Flib\n    target\u002Frelease\u002Fcrate-run ... --display virgl --vnc vnc.sock\n    tools\u002Fvnc.py vnc.sock shot screen.png\n\n## Benchmarks\n\nA Debian 13 guest runs a fixed set of workloads once it has booted, and prints\neach one's time and a hash of what it printed; every engine must print the same\nhashes as native. Seconds, medians of 3, on an M3 MacBook Air with 4 CPUs and\n4 GB for the guest. crate is its `jit` backend (2026-11-11). Native is QEMU on\nApple's Hypervisor framework (`-accel hvf -cpu host`), and QEMU's TCG is QEMU\n10.0.2's translator (`-accel tcg,tb-size=512,split-wx=on -cpu max,sve=off`),\nboth measured 2026-11-07 on the same machine and guest.\n\n| one at a time | crate `jit` | QEMU's TCG | native |\n|---|---|---|---|\n| boot to the benchmark | 2.97 | 13.80 | 1.82 |\n| gcc -O2, one large file | 6.93 | 35.30 | 1.59 |\n| gcc again | 6.67 | 34.17 | 1.48 |\n| `node -e 0` | 0.41 | 1.44 | 0.13 |\n| node, integer loop | 0.51 | 1.98 | 0.16 |\n| node, floating-point loop | 0.91 | 5.61 | 0.32 |\n| python loop | 1.36 | 12.97 | 0.26 |\n| awk, sqrt loop | 0.58 | 7.94 | 0.27 |\n| xz -6, 4 MB | 1.39 | 4.93 | 0.65 |\n| sha256, 50 MB | 0.06 | 0.30 | 0.04 |\n| 1000 process spawns | 0.52 | 4.42 | 0.13 |\n| find \u002Fusr | 0.50 | 2.50 | 0.45 |\n| **the whole pass** | **24.5** | **130.5** | **9.1** |\n\n| all four CPUs at once | crate `jit` | QEMU's TCG | native |\n|---|---|---|---|\n| 4 x gcc -O2 | 9.20 | 56-77 | 1.83 |\n| xz -T4, 50 MB | 11.40 | 43-61 | 6.09 |\n| 4 x 250 process spawns | 0.13 | 2.31-2.52 | 0.03 |\n\nQEMU's TCG had two runs of these, so its column gives both. An idle shell costs\ncrate about 0.65% of a host core, and QEMU's TCG 1.0%. On a fanless laptop wall\ntimes move 5-20% between identical runs, so smaller changes in crate are judged\nby the process's retired cycles instead.\n\n**On an iPhone.** An iPhone Duo (A20, iOS 27.1), `jit` with 3 CPUs and 1950 MiB,\nexecutable memory from StikDebug's `legacy.js`, measured 2026-11-11 (before the\nlast round of speed work above). Every output matched the Mac's.\n\n| | crate `jit` |\n|---|---|\n| root prompt, from the app's launch | 5.3 s |\n| desktop drawn, from the app's launch | 6.3 s |\n| sha256, 100 MB | 84 ms |\n| perl loop of 3 million | 312 ms |\n| sort, 300,000 lines | 72 ms |\n| gzip and gunzip, 50 MB | 363 ms |\n| three sha256 of 50 MB at once | 81 ms |\n| `claude --version` (Claude Code) | 165 ms |\n| headless Chrome: start, then a V8 loop of 10 million | 2.4 s |\n\nThe benchmark's guest image (3 GB) is not part of this repository.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md): crate is written from public\nspecifications only, and contributions are too. Security issues go privately,\nas [SECURITY.md](SECURITY.md) says.\n\n## License\n\n[MPL-2.0](LICENSE). Changes to crate's own files stay open; apps of any\nlicense, open or closed, can use it. MPL-2.0 also allows combining crate with\nGPL-2.0-or-later code.\n","crate 是一个轻量级的 Arm64 虚拟机运行时引擎，专为无原生虚拟化支持的 Arm64 设备（如 iPhone\u002FiPad）设计，提供 arm64-to-arm64 指令翻译与仿真能力。核心功能包括嵌入式友好的 C\u002FRust\u002FSwift API、模块化架构（支持自定义设备与 CPU 后端）、基于 JIT 的高效指令翻译（非全系统模拟），以及对 Linux guest 的完整 virt 机器支持（含 virtio 设备、GPU 加速桌面）。适用于在受限 iOS\u002FmacOS 环境中运行 Linux 容器、轻量虚拟机或沙箱化工作负载，尤其适合需要硬件加速图形和低开销执行的移动端虚拟化场景。",2,"2026-11-24 04:49:51","CREATED_QUERY"]