Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfi

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-06-05 12:00:11

Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. For further details, read Cosmopolitan Third Edition, the Cosmo README, and the Cosmopolitan Toolchain README.

This release makes dlmalloc scalable and zlib crc32 faster. Enterprise server applications that employ many threads on many cores can now look upon Cosmopolitan as a serious and viable option for their needs.

This release brings a more modern standard library for C++. It compiles slower, but in certain cases that can be worked around since it defines "breakout" headers for individual functions, e.g. std::move(). Since it goes so slow, we're experimenting with creating our own STL replacement

Our --ftrace function call logger now demangles C++ symbols. This is thanks to revisions we've made to our FreeBSD demangler that makes it lockless and reentrant so it's safe to call from signal handlers. It's not as good as the libcxxabi demangler, but that doesn't make it unimpressive. For example, calling kprintf("%t", sym) successfully demangles 90% of the symbols in the llamafile codebase. Usually when it doesn't work, it's because a symbol is very very long. Since it's run when nops are hooked in function prologues, it has to be part of the privileged cosmo runtime, which is highly constrained and can only use fixed size stack buffers.

Leave a Comment