Commit Graph

36 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 30e41242ec doc/internal/gc.md: add practical tuning examples
add workload-specific GC tuning advice based on benchmark data:
- allocation-heavy: interval_ratio 400 for ~12% improvement
- real-time: step_limit for bounded pause times
- large buffers: malloc_threshold
- diagnosing GC overhead with GC.stat

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-23 19:25:27 +09:00
Yukihiro "Matz" Matsumoto 309f450bab gc.c: use actual work done for debt repayment in incremental step
Decrement gc_debt by the actual number of objects processed
instead of the fixed GC_STEP_SIZE. This makes step_ratio
directly affect debt repayment: larger steps repay more debt,
naturally reducing GC invocation frequency.

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-23 19:25:24 +09:00
Yukihiro "Matz" Matsumoto 851da984b4 gc.c: use :debt instead of :threshold in GC.stat
Expose gc_debt directly as :debt in GC.stat without sign negation.
The debt model has no threshold ceiling, so :threshold was a
misleading name. Negative debt means credit, positive means GC
is behind on collection work.

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-23 19:25:24 +09:00
Yukihiro "Matz" Matsumoto 4d03f40204 doc/internal/gc.md: update for debt model and new tuning parameters
Document the debt-based GC trigger model, malloc threshold,
step limit, GC.stat, and tuning guide.

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-23 19:25:23 +09:00
Yukihiro "Matz" Matsumoto 143959b94b doc: fix prettier formatting in markdown files
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-12 14:33:37 +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 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 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 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 b841bd7439 doc/internal/opcode.md: document OP_GETIDX/OP_SETIDX optimization
Add notes section explaining the optimization behavior:
- Which functions are used for direct access
- When fallback to method dispatch occurs
- Why subclasses can override []/[]=

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-25 18:01:44 +09:00
Yukihiro "Matz" Matsumoto 77e08c9193 ops.h: rename OP_LOADI to OP_LOADI8
OP_LOADI stores an 8 bit integer to a register, so we renamed the
instruction name to describe the behavior more precisely, like
OP_LOADI16 and OP_LOADI32.
2024-12-01 19:16:54 +09:00
dearblue 6291b55bba Add links to documentation in README.md
The documentation table is generated by the `rake doc:update-index` command.
The following conditions must be met for links to be added to the documentation table.

  - The file must be placed under the `doc/` directory
  - The file must have the extension `.md`
  - The file must be written at the top of the file with `<! -- summary: ANY-TEXT -->`
2024-11-10 22:39:14 +09:00
John Bampton e12da35645 Fix spelling 2024-09-24 00:14:24 +10:00
Hoshiumi Arata 35571df7ea Update opcode.md: fix wrong column number 2024-07-23 20:25:22 +09:00
dearblue f4f3a061be Changed the instruction table in opcode.md
- Added the index number corresponding to the instruction code.
  - Omitted trailing `|` from table elements.
    The table elements in GitHub Flavored Markdown can't wrap wherever wanted.
    And trying to align the end of it tends to make the whole thing longer.
2024-06-22 23:21:43 +09:00
John Bampton 19d0ea803d Fix pre-commit failure from prettier 2023-12-31 21:57:58 +10:00
John Bampton 4c79fce665 docs: fix spelling 2023-12-17 00:58:24 +10:00
Yukihiro "Matz" Matsumoto 2c261503b5 doc/internal/boxing.md: remove an extra double quote sign. 2023-01-16 19:01:11 +09:00
rmalizia44 1614a88cb7 Add code block in boxing docs to better spacing 2022-12-26 20:12:54 -03:00
Yukihiro "Matz" Matsumoto b3c95f3851 Merge pull request #5863 from dearblue/doc/OP_CALL
Update semantics comment for `OP_CALL`
2022-12-06 14:20:16 +09:00
Yukihiro "Matz" Matsumoto 94b3d48df2 Merge pull request #5862 from dearblue/doc/update-opcode.md
Update `opcode.md` to match the latest implementation
2022-12-06 14:20:03 +09:00
dearblue 32d48a5f0e Escaping pipes in the code of table elements
ref. https://github.github.com/gfm/#example-200
2022-12-03 14:40:30 +09:00
dearblue 478fd615af Update semantics comment for OP_CALL 2022-12-03 14:26:05 +09:00
dearblue 13d8804d88 Update opcode.md to match the latest implementation 2022-12-03 13:59:35 +09:00
dearblue 5e62990748 Add task rake doc:update-opcode.md
Allow to update `doc/internal/opcode.md` file mechanically from `include/mruby/ops.h` file.

At the same time, the `doc/internal/opcode.md` file has been updated.
Consecutive hyphens at the end of the table were removed as they would have created noise as markdown flavours.
2022-11-20 21:58:13 +09:00
fn ⌃ ⌥ 273fcbc347 ops.h: update OP_ARYDUP instruction and rename to OP_ARYSPLAT.
Transforms the value of a splat inside a return statement (similar
to an array). For example, `return *nil` should return `nil.to_a`,
while `return *1` should return `[1]`
2022-10-29 19:54:34 -07:00
John Bampton 8208a836ff Fix spelling: floating point -> floating-point
https://en.wikipedia.org/wiki/Floating-point_arithmetic
2022-10-27 00:09:12 +10:00
John Bampton 696226a60e docs: standardize Markdown lists
Previously for lists we were using both `*` and `-` to start the list items.

This pr changes all lists to use `-`.
2022-10-26 13:09:41 +10:00
John Bampton 7e4eaaa11a Format Markdown tables 2022-03-24 01:00:24 +10:00
Yukihiro "Matz" Matsumoto f69eafc6bd doc/internal/opcode.md: moved from doc/opcode.md 2021-11-20 14:56:59 +09:00
Yukihiro "Matz" Matsumoto a0b58eed46 doc/internal/boxing.md: describe how mrb_value represents values. 2021-11-14 17:45:21 +09:00