Skip to content

Add opt-in "mruby-*-prism" mgem family#6896

Draft
hasumikin wants to merge 3 commits into
mruby:masterfrom
hasumikin:mruby-compiler-prism
Draft

Add opt-in "mruby-*-prism" mgem family#6896
hasumikin wants to merge 3 commits into
mruby:masterfrom
hasumikin:mruby-compiler-prism

Conversation

@hasumikin

Copy link
Copy Markdown
Contributor

ref #6707

Import PicoRuby's Prism-based compiler (mruby-compiler2) as mruby-compiler-prism and add Prism variants of the compiler-dependent tools (PicoRuby also uses them):

  • mruby-bin-mrbc-prism
  • mruby-bin-mruby-prism
  • mruby-bin-mirb-prism
  • mruby-eval-prism

Add build_config/prism.rb and mrbgems/prism.gembox so the Prism stack can be tested explicitly. Also add MRB_COMPILER_PRISM=yes as a shorthand for the Prism build config when no MRUBY_CONFIG/CONFIG is already set.

Keep normal mruby builds unchanged by excluding *-prism gems from full-core.gembox. This prevents regular CI from accidentally mixing mruby-compiler and mruby-compiler-prism.

Adapt the imported compiler for standalone mruby while keeping the compiler library embeddable:

  • select MRC_TARGET_MRUBY / MRC_TARGET_MRUBYC from build defines
  • keep mruby-only compatibility code behind MRC_TARGET_MRUBY
  • move global_mrb ownership out of the compiler library
  • define global_mrb in mrbc-prism, mruby-prism, mirb-prism, and Prism-enabled mrbtest
  • make Prism test builds link successfully
  • update Prism bintests for the new command names

global_mrb is mruby's process-wide mrb_state * hook used by executable frontends and test runners for APIs and callbacks that do not carry an explicit owner mrb_state. It is runtime/frontend state, so mruby-compiler-prism must not define or own it. PicoRuby and FemtoRuby provide their own VM ownership model and must remain able to link the compiler without mruby-specific global state.

Please read mruby-compiler-prism/README.md documenting the current Prism status, test split, known remaining failures, and compatibility boundaries for PicoRuby/FemtoRuby.

Verified

  • rake MRUBY_CONFIG=ci/gcc-clang -T
  • MRB_COMPILER_PRISM=yes rake -T
  • MRB_COMPILER_PRISM=yes rake test:build
  • build/host/bin/mruby-prism -e 'p 1 + 2'
  • build/host/bin/mruby-prism -e 'p eval("1 + 2")'

Known remaining work

  • Prism bintests still have behavioral/output differences.
  • Full MRB_COMPILER_PRISM=yes rake test is not expected to pass yet.

Plus, I think we need to consider a testing strategy to allow mruby-compiler and mruby-compiler-prism to coexist for the time being

ref mruby#6707

Import PicoRuby's Prism-based compiler (mruby-compiler2) as `mruby-compiler-prism`
and add Prism variants of the compiler-dependent tools (PicoRuby also uses them):

- `mruby-bin-mrbc-prism`
- `mruby-bin-mruby-prism`
- `mruby-bin-mirb-prism`
- `mruby-eval-prism`

Add `build_config/prism.rb` and `mrbgems/prism.gembox` so the Prism stack can
be tested explicitly. Also add `MRB_COMPILER_PRISM=yes` as a shorthand for the
Prism build config when no `MRUBY_CONFIG`/`CONFIG` is already set.

Keep normal mruby builds unchanged by excluding `*-prism` gems from
`full-core.gembox`. This prevents regular CI from accidentally mixing
`mruby-compiler` and `mruby-compiler-prism`.

Adapt the imported compiler for standalone mruby while keeping the compiler
library embeddable:

- select `MRC_TARGET_MRUBY` / `MRC_TARGET_MRUBYC` from build defines
- keep mruby-only compatibility code behind `MRC_TARGET_MRUBY`
- move `global_mrb` ownership out of the compiler library
- define `global_mrb` in `mrbc-prism`, `mruby-prism`, `mirb-prism`, and
  Prism-enabled `mrbtest`
- make Prism test builds link successfully
- update Prism bintests for the new command names

`global_mrb` is mruby's process-wide `mrb_state *` hook used by executable
frontends and test runners for APIs and callbacks that do not carry an explicit
owner `mrb_state`. It is runtime/frontend state, so `mruby-compiler-prism` must
not define or own it. PicoRuby and FemtoRuby provide their own VM ownership
model and must remain able to link the compiler without mruby-specific global
state.

Please read `mruby-compiler-prism/README.md` documenting the current Prism
status, test split, known remaining failures, and compatibility boundaries
for PicoRuby/FemtoRuby.

Verified:

- `rake MRUBY_CONFIG=ci/gcc-clang -T`
- `MRB_COMPILER_PRISM=yes rake -T`
- `MRB_COMPILER_PRISM=yes rake test:build`
- `build/host/bin/mruby-prism -e 'p 1 + 2'`
- `build/host/bin/mruby-prism -e 'p eval("1 + 2")'`

Known remaining work:

- Prism bintests still have behavioral/output differences.
- Full `MRB_COMPILER_PRISM=yes rake test` is not expected to pass yet.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Prism-based compiler support for mruby by adding several new gems and tools, including mruby-compiler-prism, mruby-bin-mrbc-prism, mruby-bin-mruby-prism, mruby-bin-mirb-prism (which features a custom multi-line editor with syntax highlighting and tab completion), and mruby-eval-prism. It also integrates the ruby/prism parser as a git submodule and updates the test suite to support the new compiler path. The review feedback suggests updating the README files for mruby-bin-mirb-prism and mruby-bin-mruby-prism to correctly reflect the Prism-specific command names and descriptions instead of using copied placeholders.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mrbgems/mruby-bin-mirb-prism/README.md Outdated
Comment thread mrbgems/mruby-bin-mruby-prism/README.md Outdated
hasumikin and others added 2 commits June 18, 2026 19:07
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant