Show HN: LoongArch Userspace Emulator

https://news.ycombinator.com/rss Hits: 6
Summary

64-bit LoongArch emulator library A high-performance LoongArch userspace emulator library designed for embedding and scripting applications. Built on the proven architecture of libriscv, libloong has competitive interpreter performance while maintaining a compact ~18k line codebase. For discussions & help, visit Discord. Features Fast LoongArch interpreter with optional JIT Ultra-low latency call overheads Support for 64-bit LoongArch (LA64) Support for vector LSX and LASX instructions C++ API with Rust and Go bindings Zero dependencies Execution timeout and memory safety First-class pause/resume support Design Game engine scripting is where libloong excels. Traditional games expose modding through shared libraries (full system access), embedded VMs like Lua (~150ns call overhead), or Java run-times. libloong has ~4ns call overhead. See the example Asteroid game. Building CMake configuration options: LA_DEBUG=ON/OFF - Enable debug output (default: OFF) - Enable debug output (default: OFF) LA_BINARY_TRANSLATION=ON/OFF - Enable binary translation (default: OFF) - Enable binary translation (default: OFF) LA_THREADED=ON/OFF - Enable threaded bytecode dispatch (default: ON) - Enable threaded bytecode dispatch (default: ON) LA_MASKED_MEMORY_BITS=N - Set masked memory arena size to 2^N bytes (0 = disabled, default: 0) Example with options: cmake .. -DCMAKE_BUILD_TYPE=Release \ -DLA_MASKED_MEMORY_BITS=32 \ -DLA_BINARY_TRANSLATION=ON make -j6 Quick Start # include < libloong/machine.hpp > int main () { // Load a LoongArch ELF binary std::vector< uint8_t > binary = load_file ( " program.elf " ); // Create a machine with 64MB memory loongarch::Machine machine { binary, { . memory_max = 64 * 1024 * 1024 }}; // Setup program arguments machine. setup_linux ({ " program " }, { " LC_ALL=C " }); // Run the program machine. simulate (); } Performance STREAM memory benchmark: Function Best Rate MB/s Avg time Min time Max time Copy: 33146.7 0.004884 0.004827 0.004962 Scale: 27825.2 0.0...

First seen: 2025-12-28 22:58

Last seen: 2025-12-31 19:08