Commit Graph

18478 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 7ac96912e9 pre-commit: fix prettier formatting in doc/guides/capi.md
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-12 13:09:44 +09:00
Yukihiro "Matz" Matsumoto 6a7561da5f pre-commit: remove JSON references from prettier hook
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-12 11:41:17 +09:00
Yukihiro "Matz" Matsumoto 628cf498a7 pre-commit: remove markdown-link-check hook
External link checkers are inherently flaky in CI due to
websites blocking automated requests (e.g. 403 errors).
Also remove JSON hooks (pretty-format-json, check-json)
since no JSON files remain in the repository.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-12 11:32:37 +09:00
Yukihiro "Matz" Matsumoto cfc83bb6ac Merge pull request #6734 from mruby/fix/array-chunking 2026-03-10 17:01:28 +09:00
Yukihiro "Matz" Matsumoto 46e8101c03 Merge pull request #6733 from mruby/fix/presym-include 2026-03-10 16:59:51 +09:00
Yukihiro "Matz" Matsumoto fff7db05bf Merge pull request #6732 from mruby/fix/language-md-markup 2026-03-10 16:58:34 +09:00
Yukihiro "Matz" Matsumoto f98d6414dc codegen.c: chunk array literals at 64 elements to reduce register pressure
Array literals were being built by loading all elements into registers
before constructing the array, requiring nregs proportional to the array
size (e.g. nregs=99 for 100 elements). This exceeds mruby/c's register
limit. Restore 3.4-era chunking at GEN_LIT_ARY_MAX (64) elements.

fixes mruby/mruby#6731

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 16:50:59 +09:00
Yukihiro "Matz" Matsumoto 8956c5abb5 mruby.h: include mruby/presym.h for all source files
Since presym is now mandatory, mruby.h includes presym.h so that
MRB_SYM() macros are available everywhere without explicit include.
Remove redundant #include <mruby/presym.h> from all source files.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 16:50:58 +09:00
Yukihiro "Matz" Matsumoto 8f3917f361 language.md: remove unnecessary bold markup from "operator"
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 16:50:54 +09:00
Yukihiro "Matz" Matsumoto 72c9e5d027 Merge pull request #6598 from dearblue/method_missing 2026-03-09 16:38:08 +09:00
Yukihiro "Matz" Matsumoto 295b40534f Merge pull request #6730 from dearblue/presym 2026-03-09 10:35:42 +09:00
Yukihiro "Matz" Matsumoto 5acc520a1e Merge pull request #6729 from dearblue/gensym 2026-03-09 10:34:02 +09:00
dearblue f6f1a42039 Simplifying presym file generation actions
By performing output to presym files after header files, there is no longer a need to check for the existence of header files.
Furthermore, concentrating the file output logic into an "if" block eliminates the need for the `update` variable.

Strict atomicity between presym files and header files is still not guaranteed, as before.
If atomicity is truly required, it can be achieved by deleting the presym file before updating the header files.
2026-03-08 22:45:45 +09:00
dearblue 9fff63b436 Simplifying dependency addition for gensym task
The `gensym_task` variable was only used for dependency addition and is no longer needed.
2026-03-08 22:43:47 +09:00
Yukihiro "Matz" Matsumoto 17ab42d4c9 Merge pull request #6728 from mruby/dependabot/github_actions/actions/upload-artifact-7 2026-03-06 08:17:12 +09:00
dependabot[bot] fcb665b88c build(deps): bump actions/upload-artifact from 6 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-05 14:52:19 +00:00
Yukihiro "Matz" Matsumoto 64263ebcea Merge pull request #6727 from leviongit/lims/ovld 2026-03-05 08:49:54 +09:00
leviongit 87f88a1ce8 fix grammar
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-03 13:58:23 +01:00
leviongit ab06ed825a change wording of the "overloading" section
the previous wording may have been taken as mruby not permitting the
overloading of operators on any class
2026-03-03 13:49:03 +01:00
Yukihiro "Matz" Matsumoto 736ec46ba0 version.h: bump version to mruby 4.0.0
update MRUBY_RUBY_VERSION to "4.0", MRUBY_RELEASE_MAJOR to 4,
MRUBY_RELEASE_MINOR to 0. update README.md references accordingly.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-03 11:10:18 +09:00
Yukihiro "Matz" Matsumoto a3861dcb53 vm.c: scope down tc variable from function to block scope
Inline L_DEF_METHOD body into OP_TDEF and OP_SDEF, making `tc`
(target class) a block-local variable in each case. This eliminates
the cross-case goto and frees one register at function scope.

`ch` (catch handler) cannot be scoped down because UNWIND_ENSURE
sets it before goto L_CATCH_TAGGED_BREAK where ch->target is
consumed (cross-goto flow requires function-scope visibility).

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-02 12:04:48 +09:00
Yukihiro "Matz" Matsumoto e94adf1d57 AUTHORS: update entries [ci skip] 2026-03-02 11:50:38 +09:00
Yukihiro "Matz" Matsumoto 02877f043a amalgamation.md: document platform dependency of HAL gems
Amalgamated files include HAL gem source code selected at build time,
making them platform-specific. Document this as expected behavior.

Ref #6726.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-02 10:34:55 +09:00
Yukihiro "Matz" Matsumoto b9a1a1fb23 presym.rake: add presym dependencies for all builds, not just internal
Previously, explicit .o => presym.list_path dependencies were only
added for internal builds (mrbc sub-builds). When only a CrossBuild
is configured without an explicit Build.new, the implicit host build
is not internal, so its .o files had no ordering against presym header
generation. This caused "mruby/presym/id.h not found" errors when the
cross build's presym scanning triggered host compilation.

Fixes #6725.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-02 10:23:35 +09:00
Yukihiro "Matz" Matsumoto 74267ce91e error.h: fix RBreak size overflow on 32-bit platforms with MRB_NO_BOXING
On 32-bit platforms where alignof(int64_t) == 8 (ARM, MIPS, PowerPC,
RISC-V, MinGW), struct RBreak with MRB_USE_RBREAK_VALUE_UNION was 24
bytes (6 words) due to alignment padding before the union
mrb_value_union field. This exceeds the 5-word RVALUE limit, causing
a static assertion failure.

Replace union mrb_value_union with uint32_t[] storage (alignof == 4)
and use memcpy for value access. This gives exactly 20 bytes on all
32-bit platforms. Ref #6722

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-02 09:56:25 +09:00
Yukihiro "Matz" Matsumoto 98bc495fd2 getting-started.md: add links to language and C API guides
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-28 11:35:28 +09:00
Yukihiro "Matz" Matsumoto 0313800b10 doc: add README.md as documentation index
Organizes 22 doc files by audience (getting started, embedders,
contributors) so visitors can find the right document quickly.
Rendered automatically by GitHub when browsing the doc/ directory.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-28 10:42:54 +09:00
Yukihiro "Matz" Matsumoto 438a3bdffc docs: fix version labels, add navigation aids
limitations.md: use consistent CRuby/mruby labels for remaining
entries that still had specific version strings.

language.md: add upfront summary of major CRuby differences so
porting developers see the key gotchas before reading the full doc.

capi.md: add table of contents for navigating the 800+ line
reference.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 22:03:39 +09:00
Yukihiro "Matz" Matsumoto 3ce3453e9c docs: improve usability of new documentation
language.md: reorganize stdlib tables by class name instead of gem
name so users can quickly find "does mruby have Time/File/Set?"

capi.md: fix mrb_protect example (mrb->exc is cleared after protect,
so mrb_print_error does not work; show mrb_inspect instead); fix
fiber yield example to show correct usage as return value.

gc.md, compiler.md, vm.md: add "read this if" guidance paragraphs
to help developers decide whether they need each document.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 19:03:29 +09:00
Yukihiro "Matz" Matsumoto 1c7b9b1f26 architecture.md: add cross-references to standalone internal docs
Replace duplicated GC, compiler, and VM details with concise
summaries linking to gc.md, compiler.md, and vm.md.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:36:09 +09:00
Yukihiro "Matz" Matsumoto c561b21d43 vm.md: add VM internals documentation
Covers execution context, call frames, stack layout, argument
encoding, dispatch loop, method lookup with cache, exception
handling, closure environments, and fiber switching.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:36:04 +09:00
Yukihiro "Matz" Matsumoto 95954d3905 compiler.md: add compiler pipeline documentation
Covers parser/lexer, code generator, IRep structure, operand
encoding with OP_EXT1/2/3, OP_ENTER aspec format, presym system,
and RITE binary format.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:35:58 +09:00
Yukihiro "Matz" Matsumoto 985b5108d5 gc.md: add GC internals documentation
Covers heap structure, tri-color marking, incremental phases, gray
stack, write barriers, arena management, generational mode, and
tuning parameters.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:35:52 +09:00
Yukihiro "Matz" Matsumoto 366d9be721 limitations.md: update version references and add missing limitations
Update CRuby/mruby version labels to generic names. Add sections for
refinements, Encoding, integer precision by boxing mode, and
ObjectSpace limitations.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:35:47 +09:00
Yukihiro "Matz" Matsumoto 0a5a305a01 capi.md: add error handling, fibers, procs, and compilation context sections
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:35:42 +09:00
Yukihiro "Matz" Matsumoto aa7556acdb language.md: add Ruby language subset guide
Covers supported syntax, numeric types by boxing mode, core classes,
standard library gemboxes, and key differences from CRuby.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:35:37 +09:00
Yukihiro "Matz" Matsumoto 449627d085 gc-arena-howto.md: update Array#inspect example to current code
The old inspect_ary() function no longer exists. Replace with the
current mrb_ary_to_s() implementation from src/array.c.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:04:35 +09:00
Yukihiro "Matz" Matsumoto 301436d400 mrbconf.md: update macro documentation for mruby 4.0
- add MRB_NO_BOXING, MRB_WORDBOX_NO_INLINE_FLOAT documentation
- update MRB_WORD_BOXING description (inline floats on 64-bit)
- add MRB_INT64 restriction note for 32-bit platforms
- fix MRB_MALLOC_TRIM -> MRB_USE_MALLOC_TRIM (renamed)
- fix MRB_ARY_LENGTH_MAX default (131072, not 1MB)
- remove stale MRB_USE_LINK_TIME_RO_DATA_P reference
- add MRB_SYMBOL_LINEAR_THRESHOLD and tuning profiles section
- remove outdated heap page size calculation (referenced mruby 3.1.0)

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 18:03:32 +09:00
Yukihiro "Matz" Matsumoto 5c1aaa0259 boxing.md: add inline float details and comparison table
Add sections on 64-bit inline float rotation encoding and 32-bit
RFloat heap allocation with char[] buffer for alignment safety.
Add comparison table of all three boxing modes and ABI note.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 17:19:08 +09:00
Yukihiro "Matz" Matsumoto 55348ce0da opcode.md: update instruction table to match current ops.h
Add 13 new opcodes (OP_GETIDX0, OP_MATCHERR, OP_SSEND0,
OP_SEND0, OP_BLKCALL, OP_RETSELF, OP_RETNIL, OP_RETTRUE,
OP_RETFALSE, OP_ADDILV, OP_SUBILV, OP_TDEF, OP_SDEF).
Fix renamed instructions (OP_LOADT -> OP_LOADTRUE, etc.).
Update title and introduction to reflect current state.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 17:05:47 +09:00
Yukihiro "Matz" Matsumoto 46b4a0400b gc.c: use renamed MRB_WORDBOX_NO_INLINE_FLOAT macro in RVALUE union
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 11:29:10 +09:00
Yukihiro "Matz" Matsumoto 05295bca32 Merge pull request #6723 from dearblue/RVALUE
Add `RInteger` and `RFloat` to `RVALUE`
2026-02-27 11:24:08 +09:00
Yukihiro "Matz" Matsumoto ad46759550 NEWS.md: add notes for macro rename and MRB_INT64 restriction
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 11:21:31 +09:00
Yukihiro "Matz" Matsumoto ccb2eb9b74 fmt_fp.c: fix float formatting on 32-bit x87 FPU
The power-of-10 normalization loop can leave f >= 10.0 when x87
extended precision (80-bit) produces different rounding than 64-bit
SSE2. This caused garbled output (e.g. "0.0,6.04*2000001e+19"
instead of "1.0e+20") because negative digit values were added to
'0'. Add a correction step after the loop, and clamp extracted
digits to [0,9] for robustness.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 11:16:03 +09:00
Yukihiro "Matz" Matsumoto 07a4b755fb object.h: fix MRB_OBJ_SHAPED_P false positive on 32-bit Hash
MRB_FL_OBJ_SHAPED uses bit 5 of flags, which on 32-bit conflicts
with Hash's ea_n_used field (bits 5-9). A Hash with entries would
falsely match MRB_OBJ_SHAPED_P, causing SEGV when its iv pointer
was misinterpreted as mrb_shaped_iv. Add tt == MRB_TT_OBJECT check
to the predicate.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 11:06:04 +09:00
Yukihiro "Matz" Matsumoto 59e1fe29d6 mrbconf.h: rename MRB_WORDBOX_NO_FLOAT_TRUNCATE to MRB_WORDBOX_NO_INLINE_FLOAT
The old name referred to "truncation" of float precision, which no
longer happens with rotation encoding. The new name describes the
actual behavior: disabling inline float encoding in word boxing.
The old name is kept as an obsolete alias for backward compatibility.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 10:30:01 +09:00
Yukihiro "Matz" Matsumoto 32f99a622d boxing_word.h: use memcpy-based RFloat access for unaligned 32-bit
On 32-bit with MRB_WORDBOX_NO_FLOAT_TRUNCATE, RFloat stores a double
(8-byte alignment) but GC heap slots only guarantee 4-byte alignment.
Use char array + memcpy accessors to avoid misaligned access (SIGBUS
on MIPS, undefined behavior per C standard).

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 10:08:37 +09:00
Yukihiro "Matz" Matsumoto eaaa66b39b mrbconf.h: prohibit MRB_INT64 on 32-bit with word/NaN boxing
Heap-allocated RInteger with int64_t requires 8-byte alignment,
but GC heap slots on 32-bit may not guarantee it, causing SIGBUS
on architectures like MIPS. MRB_NO_BOXING is still allowed since
integers are stored inline in mrb_value (no heap RInteger).

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 09:55:21 +09:00
Yukihiro "Matz" Matsumoto 4ed338bdb9 doc: add getting-started guide, C API reference, and architecture overview
Three new documents:
- doc/guides/getting-started.md: building, running, and embedding mruby
- doc/guides/capi.md: C API reference for values, classes, methods, etc.
- doc/internal/architecture.md: internal architecture for developers

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 09:18:17 +09:00
Yukihiro "Matz" Matsumoto b76d92db2d NEWS.md: add object shapes entry
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 08:40:32 +09:00