Skip to content

[pull] master from ruby:master#870

Merged
pull[bot] merged 21 commits intoturkdevops:masterfrom
ruby:master
Mar 21, 2026
Merged

[pull] master from ruby:master#870
pull[bot] merged 21 commits intoturkdevops:masterfrom
ruby:master

Conversation

@pull
Copy link

@pull pull bot commented Mar 21, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

tenderlove and others added 21 commits March 20, 2026 19:51
* eliminate redundant jumps

* update merge tests

* add some test coverage

* push insns as usual

* wipwipwip

* fix reg imm imm

* update tests

* oops

* collapse some branches

* refactor x86 split pass

* remove unused assert

* do not hardcode reg numbers

* fix rust errors
* Use sparse sorted Vec for IseqProfile instead of dense pre-allocated Vecs

Replace the two dense Vec fields (opnd_types and num_profiles) that were
pre-allocated to iseq_size for every ISEQ with a single sorted
Vec<(u32, ProfileEntry)> that only allocates entries for instructions
that actually get profiled. Lookups use binary search.

On Lobsters benchmark: zjit_alloc_bytes drops from 38.9 MB to 20.7 MB
(46.8% reduction) with no performance regression.

Use sparse storage for profiles and use u16 for counts instead of usize. Keep profiles in a sparse vec sorted by bytecode instruction index.

```
┌─────────────────────┬─────────────────┬───────────────────┬────────┐
│ Metric              │ upstream/master │ mb-sparse-profile │ Change │
├─────────────────────┼─────────────────┼───────────────────┼────────┤
│ zjit_alloc_bytes    │ 31.47 MB        │ 14.99 MB          │ −52.4% │
├─────────────────────┼─────────────────┼───────────────────┼────────┤
│ total_mem_bytes     │ 57.52 MB        │ 41.05 MB          │ −28.6% │
├─────────────────────┼─────────────────┼───────────────────┼────────┤
│ compile_time        │ 1,170ms         │ 1,206ms           │ +3.1%  │
├─────────────────────┼─────────────────┼───────────────────┼────────┤
│ profile_time        │ 9ms             │ 10ms              │ ~same  │
└─────────────────────┴─────────────────┴───────────────────┴────────┘
```
The make-snapshot process needs dump_ast (a C program) to generate
.rbinc files via mk_builtin_loader.rb. Since CC=false in prereq.status
prevents make from compiling C code, build dump_ast directly using the
system compiler before running make prepare-package.

The generated prism C sources and headers are created from ERB templates
using BASERUBY before compilation, as they are not checked into git.
When building from a snapshot/tarball without BASERUBY, the .rbinc files
are pre-generated and should not be rebuilt. However, DUMP_AST_TARGET
was set to $(DUMP_AST) unconditionally, causing a freshly compiled
dump_ast to trigger .rbinc regeneration which requires BASERUBY.

Clear DUMP_AST_TARGET when HAVE_BASERUBY=no so the pre-generated .rbinc
files are used as-is.
* JAVA_STRING_TYPE and related change to IDENTIFIER
* TruffleRuby still uses java.lang.String

Fixes ruby/prism#4009

ruby/prism@cbe91a3f36
* Allocate array of byte[] as byte[length][].
* Default JAVA_BACKEND to "default" with "truffleruby" the custom
  option.

ruby/prism@6ad180a00d
Take a method, unbound method, proc, or thread backtrace location.
This is our equivalent to RubyVM::AbstractSyntaxTree.of, and could
be leveraged in something like error highlight.

Note that this uses CRuby-specific APIs on CRuby, and falls back
to using location-based APIs when those aren't available.

ruby/prism@02a93356a3
Implements codegen for `ArrayMax` (opt_newarray_max) by calling the `rb_vm_opt_newarray_max` VM helper, following the same pattern as `ArrayHash` and `ArrayInclude`.
Add reusable helpers for getting fields, making C calls, etc. De-indent a bunch of stuff.
I noticed that we're generating machine code that unboxes fixnum
constants.  Since the fixnum is constant, and known at compile time, we
can unbox it eagerly and convert it to a Const CInt64
@pull pull bot locked and limited conversation to collaborators Mar 21, 2026
@pull pull bot added the ⤵️ pull label Mar 21, 2026
@pull pull bot merged commit 4860f35 into turkdevops:master Mar 21, 2026
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants