- Notifications
You must be signed in to change notification settings - Fork814
Comparing changes
Open a pull request
base repository:mruby/mruby
Uh oh!
There was an error while loading.Please reload this page.
base:master@{1day}
head repository:mruby/mruby
Uh oh!
There was an error while loading.Please reload this page.
compare:master
- 17commits
- 19files changed
- 3contributors
Commits on Jul 11, 2025
mruby-compiler: rename NODE_BEGIN to NODE_STMTS for clarity
Rename NODE_BEGIN to NODE_STMTS to better reflect its purpose as acontainer for statement sequences, not specifically begin-end blocks.This prepares for adding a dedicated node type for explicit begin-endconstructs.- Rename NODE_BEGIN enum to NODE_STMTS in node.h- Update all references in parse.y and codegen.c- Rename new_begin function to new_stmtsCo-Authored-By: Claude <noreply@anthropic.com>
mruby-compiler: optimize NODE_STMTS nesting to reduce AST depth
Modify new_stmts to flatten unnecessary nesting by returning existingNODE_STMTS directly instead of wrapping them. This reduces memory usageand AST complexity when multiple parentheses levels are used.Before: (((expr1; expr2))) creates nested NODE_STMTSAfter: (((expr1; expr2))) creates single NODE_STMTS with statementsCo-authored-by: Claude <noreply@anthropic.com>
Add NODE_BEGIN for explicit begin...end blocks
This commit introduces NODE_BEGIN as a distinct AST node type forexplicit begin...end blocks, separate from NODE_STMTS which representsgeneral statement sequences. This distinction will be essential forimplementing CRuby-compatible begin...end while/until constructs.Key changes:- Added NODE_BEGIN enum in node.h- Added new_begin() function in parse.y using optimized cons() structure- Modified begin...end grammar rule to generate NODE_BEGIN nodes- Added NODE_BEGIN codegen support in codegen.c- Added NODE_BEGIN to parser dump functionalityNODE_BEGIN uses a simpler cons() structure instead of list2() forbetter memory efficiency, as it only contains a single body node.Co-Authored-By: Claude <noreply@anthropic.com>
mruby-compiler: allow at-least-once loop behavior for mruby
mruby does not provide `begin ... end while cond` that behave at-least-onceloop, like CRuby does. It remains in TODO.md for long time. But finally we haveimplemented the behavior.
matz committedJul 11, 2025 test/syntax.rb: add at-least-once loop tests
Co-authored-by: Claude <noreply@anthropic.com>
mruby-compiler: simplify the code for NODE_WHILE_MOD & NODE_UNTIL_MOD
Instead of having dedicated code, we now share the fundamental part withnormal NODE_WHILE and NODE_UNTIL.
matz committedJul 11, 2025 variable.h: add prefetch to bsearch_idx
This commit introduces memory prefetching to the `bsearch_idx` functionsin `src/class.c` and `src/variable.c` to improve performance.A new macro `MRB_MEM_PREFETCH` is defined in `include/mruby/variable.h`which uses `__builtin_prefetch` if available.Co-authored-by: Gemini <gemini@google.com>
hash.c: implement Hash#== in C for better performance
Move Hash#== implementation from Ruby to C to improve performanceand consistency with other core methods. The C implementationprovides the same functionality while being more efficient.Co-authored-by: Claude <noreply@anthropic.com>
hash.c: implement Hash#eql? in C for better performance
Move Hash#eql? implementation from Ruby to C to improve performance andconsistency with other core methods. The C implementation uses mrb_eqlfor value comparison, providing proper eql? semantics.Co-authored-by: Claude <noreply@anthropic.com>
hash.c: add recursion detection to prevent SystemStackError;fix#5531
Add generalized recursion detection system and integrate it into Hash#==and Hash#eql? to prevent infinite recursion with mutually recursive hashstructures. Uses call stack inspection for minimal memory overhead.Co-authored-by: Claude <noreply@anthropic.com>
kernel.c: simplify mrb_inspect_recursive_p using new recursion detection
Replace custom inspect_recursive_p implementation with the newgeneralized mrb_recursive_method_p for better code reuse andconsistency.Co-authored-by: Claude <noreply@anthropic.com>
kernel.c: replace __inspect_recursive? with __method_recursive?
Add more general __method_recursive?(method_name[, arg]) method that cancheck recursion for any method, not just inspect. This provides a moreuseful API for Ruby code while cleaning up the implementation.Co-authored-by: Claude <noreply@anthropic.com>
array.c: add recursion detection to Array#== and Array#eql?
Prevent SystemStackError when comparing arrays with circular references.Uses the same recursion detection mechanism as Hash equality methods.Co-authored-by: Claude <noreply@anthropic.com>
mruby-struct: add recursion detection to Struct#== and Struct#eql?
Prevent SystemStackError when comparing structs with circularreferences. Uses the same recursion detection mechanism as Hash andArray equality methods.Co-authored-by: Claude <noreply@anthropic.com>
kernel.c: remove mrb_inspect_recursive_p();#5531
And use mrb_recursive_method_p() and its helper methods.Co-authored-by: Claude <noreply@anthropic.com>
state.c: optimize mrb_state initialization by deferring method cache …
…clearDuring mrb_state initialization, especially when defining core classes and methods,the method cache is repeatedly cleared. This causes significant overhead inscenarios like mrbtest where mrb_state is initialized multiple times.This commit introduces a `bootstrapping` flag in `struct mrb_state`.When this flag is TRUE (during mrb_open_core), method cache clearstriggered by `mrb_define_method_raw` and `include_module_at` are suppressed.The cache is cleared only once at the very end of `mrb_open_core` afterall core methods are defined, and the flag is then set to FALSE.This optimization significantly reduces the number of method cache clearsduring initialization, improving performance for repeated mrb_state creations.Co-authored-by: Gemini <gemini@google.com>
mruby-array-ext: add comprehensive documentation for values_at and in…
…ternal helpers- Add complete call-seq documentation for Array#values_at method- Add helpful comments for internal helper functions: * ary_ref: helper function for values_at * rev: helper function to reverse array elements in-place * flatten_internal: iterative stack-based flatten implementation * Updated comments for fill, uniq, normalize_index, and fetch helpers- Improves code maintainability and follows mruby documentation standards- Achieves 100% public API documentation coverageCo-authored-by: Atlassian Rovo Dev
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:git diff master@{1day}...master
Uh oh!
There was an error while loading.Please reload this page.