Skip to content

Releases: igravious/cosmoruby

CosmoRuby v1.3.0 - Fat binaries, 6-platform CI, Mexican Toaster lifecycle

07 Mar 11:20

Choose a tag to compare

CosmoRuby v1.3.0 — Fat binaries, 6-platform CI, Mexican Toaster lifecycle

Ruby

  • Ruby 4.0.0 x86_64-cosmo
  • 5440 stdlib files embedded in /zip/
  • IRB 1.16.0

Binaries

Binary Size
ruby.com 29MB
irb.com 29MB

Platforms tested (CI)

  • Linux x86_64 + aarch64
  • macOS x86_64 + Apple Silicon
  • Windows x86_64 + arm64

Changes since v1.2.3

  • bb4ce7f Trigger ruby-platforms.yml CI run
  • d5ccbb7 Trigger cosmo-hello-world.yml CI run
  • 4b19755 Trigger cosmo-hello-world.yml CI run
  • fbf0909 Trigger cosmo-hello-world.yml CI run
  • b886c10 Update CI triggers for bake/releases paths, add redbean Ruby test
  • 87dc487 Fix Makefile include ordering, local-includes.mk, bake output path
  • 6d17e3f Refactor Ruby packaging into assemble_stdlib.sh + embed_stdlib.sh
  • 68e89fb Add Mexican Toaster caboose lifecycle (thaw/persist/freeze/discard)
  • cd53bb6 Add tomlc99 TOML parser library
  • c086fd4 Guard YJIT init to Linux only, add ruby CI trigger script
  • 5856ea0 Make encoding_utf8 CI check a soft warning
  • 615a146 Rework ruby CI to download pre-built binary from release

CosmoRuby v1.2.2 - Windows YJIT Fix

28 Jan 23:53

Choose a tag to compare

Bug Fixes

  • Disable YJIT on Windows (Rust TLS incompatible with Cosmopolitan)
  • Ruby now executes code correctly on Windows

Technical Details

YJIT's Rust code uses std::thread::local which crashes on Windows under Cosmopolitan. The fix skips YJIT initialization when IsWindows() returns true.

Ruby works correctly without YJIT - it's a performance optimisation, not a correctness requirement.

🤖 Generated with Claude Code

CosmoRuby v1.2.1 - Windows Memory Warning Fix

28 Jan 21:30

Choose a tag to compare

Bug Fixes

  • Fix mimalloc "unable to free OS memory" warning on Windows
  • Windows VirtualFree can't do partial frees, now properly detected

Previous in v1.2.0

  • Fix APE binary generation (MZ header at offset 0)

Usage

curl -LO https://github.com/igravious/cosmoruby/releases/download/v1.2.1/ruby.com
./ruby.com --version

CosmoRuby v1.2.0 - Allocator Info & Benchmarks

28 Jan 16:36

Choose a tag to compare

New Features

  • --cosmo-info flag - Shows detailed Cosmopolitan build information
  • Version string - Shows +MIMALLOC or +DLMALLOC in --version output
  • RUBY_COSMO_ALLOCATOR constant - Runtime allocator detection from Ruby code

Benchmark Suite

New performance regression tests in performance_regressions/:

  • memory_allocator_benchmark.rb - RSS growth testing (1M Class.new)
  • class_new_benchmark.rb - Allocation speed testing
  • yjit_benchmark.rb - JIT performance testing

Performance Results (1M Class.new allocations)

Allocator RSS Growth Time Status
System Ruby (glibc) 1.21x 14.3s Best overall
mimalloc 1.59x 26.8s ✓ Recommended
dlmalloc (no rseq) 1.60x 33.2s ✓ Stable
dlmalloc (default) 8.80x 49.8s ✗ Memory retention

Key Findings

  1. Pure computation matches system Ruby - 0.48s vs 0.47s for 10M iterations
  2. Allocation overhead - The ~2x slowdown is entirely in malloc/GC path, not Ruby interpreter
  3. mimalloc recommended - Stable memory, fastest CosmoRuby option
  4. dlmalloc RSEQ issue - Disable with COSMOPOLITAN_M_RSEQ_MAX=0 if using dlmalloc

Usage

```bash

Check allocator in version

ruby.com --version

ruby 4.0.0 (2025-12-31) +PRISM +MIMALLOC [x86_64-cosmo]

Detailed build info

ruby.com --cosmo-info

Runtime check

ruby.com -e 'puts RUBY_COSMO_ALLOCATOR'

mimalloc

```

CosmoRuby 4.0.0 v1.0.0

26 Jan 17:26
f1e83d5

Choose a tag to compare

CosmoRuby 4.0.0 v1.0.0

The first stable release of Ruby 4.0.0 for Cosmopolitan Libc.

Downloads

File Description
ruby.com Ruby interpreter with embedded stdlib (~15MB)
irb.com Interactive Ruby shell with embedded stdlib

Features

  • Actually Portable Executable: Single binary runs on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD
  • Embedded stdlib: No external dependencies, no RUBYLIB needed
  • Full Ruby 4.0.0: Prism parser, YJIT JIT compiler, all core features
  • Bundled tools: gem, bundle, rake, irb, rdoc, ri, erb, racc, typeprof, test-unit

Usage

# Download and make executable
chmod +x ruby.com

# Run Ruby code
./ruby.com -e 'puts "Hello from Ruby #{RUBY_VERSION}!"'

# Run scripts
./ruby.com script.rb

# Interactive shell
./irb.com

# Run bundled tools
./ruby.com -S gem --version
./ruby.com -S rake --version

Extensions

Built-in extensions (statically linked):

  • date, digest, etc, fcntl, io/console, io/nonblock, io/wait
  • json, openssl (via mbedtls), psych (YAML), stringio, strscan, zlib
  • socket, ripper, coverage, objspace

What's New in This Release

  • Fixed undefined behaviour issues when running with ubsan
  • Improved debugging with mimalloc backtrace support
  • Fixed ruby -S to use embedded scripts instead of system PATH
  • Fixed RbConfig.ruby to return actual executable path
  • Added racc, typeprof, test-unit to bundled executables

Known Limitations

  • No C extension compilation (extensions must be statically linked)
  • Windows console input may have quirks in IRB
  • YJIT requires x86_64 architecture

Building from Source

git clone https://github.com/user/cosmopolitan
cd cosmopolitan
git checkout feature/ruby-4.0.0-port
make -j8 o//third_party/ruby/ruby
cd third_party/ruby && ./package_ruby.sh
# Output: o/third_party/ruby/ruby.com

Changelog

Full commit: decd350383 - Ruby 4.0.0: Polish for v1 release

Ubsan/undefined behaviour fixes

  • Disable UNALIGNED_WORD_ACCESS when ubsan enabled
  • Fix signed left shift UB in prism_compile.h
  • Add #ifndef guards in st.h to prevent macro redefinition

Packaged mode improvements

  • Fix ruby -S to search /zip/bin only, preventing rbenv/system ruby conflicts
  • Add RUBY_COSMO_EXECUTABLE constant with actual executable path
  • Fix RbConfig.ruby to return real path instead of /zip/bin/ruby.com
  • Add racc, typeprof, test-unit executables to packaged bin/

mimalloc debugging enhancements

  • Add symbolic backtrace on invalid pointer errors
  • Add backtrace on assertion failures in debug builds
  • Register ShowBacktrace from Ruby for richer debug output

Build system

  • Add THIRD_PARTY_MIMALLOC dependency for ruby, irb, miniruby
  • Simplify YJIT Cargo build rules

Ruby cross-platform test

04 Mar 08:01
f1e83d5

Choose a tag to compare

Pre-built ruby.com for CI testing

Mexican Toaster test

07 Mar 12:01
f1e83d5

Choose a tag to compare

Fat APE binaries (mtsh.com, lsdir.com, caboose.com) for cross-platform CI testing

Phase 0 hello test

04 Mar 05:08
f1e83d5

Choose a tag to compare

APE fat binary for cross-platform testing

Fat APE smoke test

20 Mar 08:01
f1e83d5

Choose a tag to compare

APE fat binary for cross-platform testing

Caboose cross-platform test

08 Mar 00:57
f1e83d5

Choose a tag to compare

Fat APE caboose.com binary with embedded ZIP filesystem for cross-platform CI testing