mruby.git
5 hours agoMerge pull request #6543 from mruby/add-comments-dump-c-partialmaster
Yukihiro "Matz" Matsumoto [Tue, 3 Jun 2025 00:01:56 +0000 (3 09:01 +0900)]
Merge pull request #6543 from mruby/add-comments-dump-c-partial

5 hours agoAdd descriptive comments to several functions in src/dump.c
google-labs-jules[bot] [Tue, 3 Jun 2025 00:01:24 +0000 (3 00:01 +0000)]
Add descriptive comments to several functions in src/dump.c

This commit adds Doxygen-style comments to the following functions
in src/dump.c, ensuring "@brief" is not used:

Non-static functions (comments reviewed/updated):
- mrb_dump_irep
- mrb_dump_irep_binary
- mrb_dump_irep_cfunc

Static functions (new comments added):
- write_irep_header
- write_iseq_block
- dump_float (if compiled)
- get_pool_block_size
- write_pool_block
- get_syms_block_size
- write_syms_block
- get_irep_record_size

This work is part of a larger effort to document all non-trivial
functions in this file as per your feedback. The remaining functions
will be documented in subsequent commits.

5 hours agoerror.c: add descriptive comments
Yukihiro "Matz" Matsumoto [Mon, 2 Jun 2025 23:53:06 +0000 (3 08:53 +0900)]
error.c: add descriptive comments

The comments are written by Google Jules.

6 hours agoMerge pull request #6542 from mruby/add-symbol-comments
Yukihiro "Matz" Matsumoto [Mon, 2 Jun 2025 23:43:23 +0000 (3 08:43 +0900)]
Merge pull request #6542 from mruby/add-symbol-comments

6 hours agoAdd descriptive comments to MRB_API functions in src/symbol.c
google-labs-jules[bot] [Mon, 2 Jun 2025 23:42:40 +0000 (2 23:42 +0000)]
Add descriptive comments to MRB_API functions in src/symbol.c

This commit adds descriptive comments to all functions marked with MRB_API
in the `src/symbol.c` file. The comments explain the purpose, parameters,
and return values of these functions, improving code readability and
maintainability.

The following functions were commented:
- mrb_intern
- mrb_intern_static
- mrb_intern_cstr
- mrb_intern_str
- mrb_intern_check
- mrb_check_intern
- mrb_intern_check_cstr
- mrb_check_intern_cstr
- mrb_intern_check_str
- mrb_check_intern_str
- mrb_sym_name_len
- mrb_sym_str
- mrb_sym_name
- mrb_sym_dump

22 hours agomruby-time (mrb_to_time_t): separate into smaller functions
Yukihiro "Matz" Matsumoto [Mon, 2 Jun 2025 07:05:44 +0000 (2 16:05 +0900)]
mruby-time (mrb_to_time_t): separate into smaller functions

The code was written by Google Jules.

22 hours agomruby-time: add descriptive comments
Yukihiro "Matz" Matsumoto [Mon, 2 Jun 2025 07:04:54 +0000 (2 16:04 +0900)]
mruby-time: add descriptive comments

The comments were written by Google Jules.

22 hours agomruby-time: replace magic numbers to C macros
Yukihiro "Matz" Matsumoto [Mon, 2 Jun 2025 06:53:55 +0000 (2 15:53 +0900)]
mruby-time: replace magic numbers to C macros

The code is written by Google Jules.

30 hours agoMerge pull request #6541 from mruby/add-api-comments-array
Yukihiro "Matz" Matsumoto [Sun, 1 Jun 2025 23:48:57 +0000 (2 08:48 +0900)]
Merge pull request #6541 from mruby/add-api-comments-array

30 hours agoAdd descriptive comments for MRB_API functions in src/array.c
google-labs-jules[bot] [Sun, 1 Jun 2025 23:48:11 +0000 (1 23:48 +0000)]
Add descriptive comments for MRB_API functions in src/array.c

This change adds C-style multiline comments to all functions
marked with MRB_API in the src/array.c file.

The comments explain each function's purpose, its parameters,
and what it returns, where applicable. This improves the
readability and maintainability of the C API for mruby arrays.

The `@brief` markup was intentionally avoided as per your
requirements.

44 hours agoMerge branch 'jules_wip_7626599795303680331'
Yukihiro "Matz" Matsumoto [Sun, 1 Jun 2025 08:58:39 +0000 (1 17:58 +0900)]
Merge branch 'jules_wip_7626599795303680331'

44 hours agohash.c: add descriptive comments to C-facing MRB_API hash functions
google-labs-jules[bot] [Sat, 31 May 2025 23:33:12 +0000 (31 23:33 +0000)]
hash.c: add descriptive comments to C-facing MRB_API hash functions

This commit adds C-style descriptive comments to MRB_API functions
in `src/hash.c` that are intended for use as part of mruby's C API.
The comments are targeted at C developers using these functions directly.

Comments were added or updated for the following functions:
- mrb_hash_new: Added comment.
- mrb_hash_new_capa: Updated existing comment to be more C API user-centric.
- mrb_hash_dup: Added comment.
- mrb_hash_get: Added comment.
- mrb_hash_fetch: Added comment.
- mrb_hash_set: Added comment.
- mrb_hash_delete_key: Added comment.
- mrb_hash_size: Added comment.
- mrb_hash_merge: Added comment.
- mrb_hash_foreach: Comment updated in a previous phase of work.

This work aligns with the guideline to comment C-facing MRB_API functions,
while avoiding adding new C-API comments to those MRB_API functions
that solely implement Ruby methods and already have extensive Ruby
method documentation (call-seq) in the source. The @brief markup
was avoided as per the original issue request.

2 days agoMerge pull request #6538 from mruby/dependabot/bundler/rake-13.3.0
Yukihiro "Matz" Matsumoto [Sat, 31 May 2025 13:48:52 +0000 (31 22:48 +0900)]
Merge pull request #6538 from mruby/dependabot/bundler/rake-13.3.0

2 days agoMerge pull request #6540 from mruby/add-comments-object-c
Yukihiro "Matz" Matsumoto [Sat, 31 May 2025 13:48:02 +0000 (31 22:48 +0900)]
Merge pull request #6540 from mruby/add-comments-object-c

2 days agoMerge pull request #6539 from mruby/add-string-comments
Yukihiro "Matz" Matsumoto [Sat, 31 May 2025 13:47:45 +0000 (31 22:47 +0900)]
Merge pull request #6539 from mruby/add-string-comments

2 days agoAdd descriptive comments to MRB_API functions in object.c
google-labs-jules[bot] [Sat, 31 May 2025 13:45:31 +0000 (31 13:45 +0000)]
Add descriptive comments to MRB_API functions in object.c

This commit adds and updates C-style block comments for all functions marked with MRB_API in src/object.c.

The comments explain the purpose, parameters, and return values of these functions, adhering to the project's documentation style and avoiding the use of '@brief' markup.

Existing comments were also reviewed and updated for clarity and consistency.

2 days agoHere's the rewritten message:
google-labs-jules[bot] [Sat, 31 May 2025 13:44:19 +0000 (31 13:44 +0000)]
Here's the rewritten message:

Add descriptive comments for MRB_API functions in src/string.c

This commit adds descriptive comments to various MRB_API functions
within the src/string.c file. These comments aim to improve code
readability and maintainability by explaining the purpose,
parameters, and return values of these functions.

3 days agobuild(deps): bump rake from 13.2.1 to 13.3.0
dependabot[bot] [Fri, 30 May 2025 14:40:20 +0000 (30 14:40 +0000)]
build(deps): bump rake from 13.2.1 to 13.3.0

Bumps [rake](https://github.com/ruby/rake) from 13.2.1 to 13.3.0.
- [Release notes](https://github.com/ruby/rake/releases)
- [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc)
- [Commits](https://github.com/ruby/rake/compare/v13.2.1...v13.3.0)

---
updated-dependencies:
- dependency-name: rake
  dependency-version: 13.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
4 days agoMerge pull request #6537 from mruby/add-cdump-comments
Yukihiro "Matz" Matsumoto [Thu, 29 May 2025 22:24:00 +0000 (30 07:24 +0900)]
Merge pull request #6537 from mruby/add-cdump-comments

4 days agoMerge pull request #6536 from mruby/add-debug-comments
Yukihiro "Matz" Matsumoto [Thu, 29 May 2025 22:23:45 +0000 (30 07:23 +0900)]
Merge pull request #6536 from mruby/add-debug-comments

4 days agoThe comments in `cdump.c` have been updated to remove the `@brief` tag from the Doxyg...
google-labs-jules[bot] [Thu, 29 May 2025 22:22:07 +0000 (29 22:22 +0000)]
The comments in `cdump.c` have been updated to remove the `@brief` tag from the Doxygen-style comment for the `mrb_dump_irep_cstruct` function. This change was made based on your feedback.

The rest of the comment, which details the function's purpose, parameters, return values, and conditional compilation, remains unchanged.

5 days agoMerge pull request #6535 from mruby/add-mempool-comments
Yukihiro "Matz" Matsumoto [Thu, 29 May 2025 01:06:32 +0000 (29 10:06 +0900)]
Merge pull request #6535 from mruby/add-mempool-comments

5 days agoMerge pull request #6534 from mruby/add-readfloat-comment
Yukihiro "Matz" Matsumoto [Thu, 29 May 2025 00:25:39 +0000 (29 09:25 +0900)]
Merge pull request #6534 from mruby/add-readfloat-comment

5 days agoAdd descriptive comments to public functions in src/debug.c
google-labs-jules[bot] [Wed, 28 May 2025 22:06:18 +0000 (28 22:06 +0000)]
Add descriptive comments to public functions in src/debug.c

This change adds Doxygen-style comments to the public API functions
in `src/debug.c`, including mrb_packed_int_len, mrb_packed_int_encode,
and mrb_packed_int_decode. The comments explain the purpose of each function,
its parameters, and its return value. This improves the readability
and maintainability of the code.

5 days agoI've added descriptive comments for functions/macros in src/mempool.c.
google-labs-jules[bot] [Wed, 28 May 2025 22:02:53 +0000 (28 22:02 +0000)]
I've added descriptive comments for functions/macros in src/mempool.c.

This commit adds Doxygen-style comments to the public functions,
internal static functions, and structs within the `src/mempool.c` file.
These comments clarify the purpose, parameters, and return values (where applicable)
of these code elements, improving code readability and maintainability.

The following elements were commented:
- struct mempool_page
- struct mempool
- ALIGN_PADDING macro
- mempool_open()
- mempool_close()
- page_alloc()
- mempool_alloc()
- mempool_realloc()

5 days agoAdd descriptive comment to mrb_read_float function
google-labs-jules[bot] [Wed, 28 May 2025 22:01:17 +0000 (28 22:01 +0000)]
Add descriptive comment to mrb_read_float function

This commit adds a descriptive comment at the beginning of the `mrb_read_float` function in `src/readfloat.c`.

The comment explains the function's purpose, its parameters (`str`, `endp`, `fp`), and its return value (`TRUE` or `FALSE`). This improves code readability and understanding.

6 days agoMerge pull request #6533 from katafrakt/fix-extended-callback
Yukihiro "Matz" Matsumoto [Wed, 28 May 2025 02:13:38 +0000 (28 11:13 +0900)]
Merge pull request #6533 from katafrakt/fix-extended-callback

6 days agoclass.c: Remove MRB_INLINE_METHOD_CACHE support from mt_tbl
Yukihiro "Matz" Matsumoto [Tue, 27 May 2025 23:33:21 +0000 (28 08:33 +0900)]
class.c: Remove MRB_INLINE_METHOD_CACHE support from mt_tbl

The sorted array binary search implementation no longer uses the inline
cache array, so remove all MRB_INLINE_METHOD_CACHE definitions and
related code.

6 days agoclass.c: Switch mt_tbl to sorted array binary search for method lookups
Yukihiro "Matz" Matsumoto [Tue, 27 May 2025 22:54:42 +0000 (28 07:54 +0900)]
class.c: Switch mt_tbl to sorted array binary search for method lookups

By replacing the open‐addressing hash with a sorted array and binary
search, we eliminate tombstone management and improve cache locality of
method entries. This preserves the original contiguous values+keys
layout and peak memory usage, while simplifying growth logic and
delivering lookup performance gains.

6 days agoFix calling `extended` callback
Paweł Świątkowski [Tue, 27 May 2025 20:23:35 +0000 (27 22:23 +0200)]
Fix calling `extended` callback

The callback of extending module should be called, not of a singleton
class of an extended object.

7 days agovariable.c (iv_copy): just memcpy sorted array; no iv_put
Yukihiro "Matz" Matsumoto [Tue, 27 May 2025 01:58:41 +0000 (27 10:58 +0900)]
variable.c (iv_copy): just memcpy sorted array; no iv_put

7 days agovariable.c (iv_rehash): just memcpy sorted array; no need to call iv_put
Yukihiro "Matz" Matsumoto [Tue, 27 May 2025 01:53:58 +0000 (27 10:53 +0900)]
variable.c (iv_rehash): just memcpy sorted array; no need to call iv_put

7 days agovariable.c: use binary search for iv_tbl lookups
Yukihiro "Matz" Matsumoto [Tue, 27 May 2025 01:33:09 +0000 (27 10:33 +0900)]
variable.c: use binary search for iv_tbl lookups

Preserve the original iv_tbl heap layout and allocation pattern, but
switch iv_put to maintain sorted keys and iv_get/iv_del to perform
binary search. This eliminates extra probing overhead, improves
read-heavy lookup performance for small tables, and incurs zero
additional allocations.

7 days agovariable.c (iv_size): refactor the function
Yukihiro "Matz" Matsumoto [Tue, 27 May 2025 01:16:12 +0000 (27 10:16 +0900)]
variable.c (iv_size): refactor the function

Along with removing an obsolete comment line.

7 days agovariable.c (mrb_mod_cv_get): initialize local variable
Yukihiro "Matz" Matsumoto [Mon, 26 May 2025 13:59:04 +0000 (26 22:59 +0900)]
variable.c (mrb_mod_cv_get): initialize local variable

To silence compiler warning.

8 days agoarray.c: remove unnecessary blank line
Yukihiro "Matz" Matsumoto [Sat, 24 May 2025 14:24:14 +0000 (24 23:24 +0900)]
array.c: remove unnecessary blank line

8 days agoMerge pull request #6532 from mruby/improve-mt-hash-load-factor
Yukihiro "Matz" Matsumoto [Sun, 25 May 2025 11:57:36 +0000 (25 20:57 +0900)]
Merge pull request #6532 from mruby/improve-mt-hash-load-factor

8 days agoI've reverted method table optimizations to prioritize memory savings for you.
google-labs-jules[bot] [Sun, 25 May 2025 11:40:43 +0000 (25 11:40 +0000)]
I've reverted method table optimizations to prioritize memory savings for you.

My previous attempts to improve method table (mt_tbl) performance by introducing a load factor and adjusting the initial allocation size unfortunately led to undesirable increases in memory consumption.

Given that memory usage is a primary concern, I've reverted the following changes:
- Removed the load factor based rehashing logic.
- Removed the related definitions for the load factor.
- Ensured the initial allocation size is 8.

This restores the method table to its original behavior, where it rehashes only when the table is completely full or during initial allocation. This should bring memory usage back to its baseline level prior to these optimization attempts.

8 days agoMerge pull request #6531 from mruby/improve-mt-hash-load-factor
Yukihiro "Matz" Matsumoto [Sun, 25 May 2025 11:12:46 +0000 (25 20:12 +0900)]
Merge pull request #6531 from mruby/improve-mt-hash-load-factor

9 days agoImprove method table performance by rehashing at 75% load factor.
google-labs-jules[bot] [Sat, 24 May 2025 22:50:29 +0000 (24 22:50 +0000)]
Improve method table performance by rehashing at 75% load factor.

The method table (mt_tbl) in src/class.c previously only rehashed when it became completely full. With linear probing, this could lead to significant performance degradation for lookups and insertions as the table approached full capacity.

This change introduces a load factor (MT_LOAD_FACTOR_NUM/MT_LOAD_FACTOR_DEN, set to 3/4 or 0.75). The mt_put function now checks if adding a new element would cause the table's size to meet or exceed this load factor relative to its allocated capacity. If so, it triggers a rehash before inserting the new element.

This helps maintain more empty slots in the hash table, improving the average-case performance of linear probing and reducing the likelihood of worst-case scenarios. The existing initial allocation size and doubling strategy for rehashing are retained.

10 days agostring.c (popcount): support when sizeof(int) == 4
Yukihiro "Matz" Matsumoto [Fri, 23 May 2025 14:10:45 +0000 (23 23:10 +0900)]
string.c (popcount): support when sizeof(int) == 4

This function is used when the compiler does not support builtin
popcount operation (namely VC++).

10 days agovm.c (stack_init): clear initial stack
Yukihiro "Matz" Matsumoto [Thu, 22 May 2025 07:29:57 +0000 (22 16:29 +0900)]
vm.c (stack_init): clear initial stack

13 days agomruby-rational (int_lshift): check before actual left bit shift
Yukihiro "Matz" Matsumoto [Wed, 21 May 2025 04:22:50 +0000 (21 13:22 +0900)]
mruby-rational (int_lshift): check before actual left bit shift

13 days agomruby-rational (int_lshift): exponential may be bigger than int bits
Yukihiro "Matz" Matsumoto [Wed, 21 May 2025 01:40:02 +0000 (21 10:40 +0900)]
mruby-rational (int_lshift): exponential may be bigger than int bits

13 days agomruby-eval (binding_eval_error_check): re-raise Exception in parsing
Yukihiro "Matz" Matsumoto [Wed, 21 May 2025 01:25:35 +0000 (21 10:25 +0900)]
mruby-eval (binding_eval_error_check): re-raise Exception in parsing

13 days agoerror.c (mrb_vformat): prevent SEGV from %s with NULL
Yukihiro "Matz" Matsumoto [Wed, 21 May 2025 00:52:10 +0000 (21 09:52 +0900)]
error.c (mrb_vformat): prevent SEGV from %s with NULL

13 days agomruby-compiler (gen_move): avoid unnecessary goto's
Yukihiro "Matz" Matsumoto [Tue, 20 May 2025 09:30:41 +0000 (20 18:30 +0900)]
mruby-compiler (gen_move): avoid unnecessary goto's

13 days agomruby-compiler (gen_move): avoid optimization of ADDI/SUBI
Yukihiro "Matz" Matsumoto [Tue, 20 May 2025 09:26:30 +0000 (20 18:26 +0900)]
mruby-compiler (gen_move): avoid optimization of ADDI/SUBI

ADDI/SUBI may fall back to method call that may clear block argument
place holder, which may be a live register. So we cannot directly call
ADDI/SUBI over local variables.

2 weeks agocodedump.c: remove unnecessary tab character from OP_MOVE
Yukihiro "Matz" Matsumoto [Mon, 19 May 2025 14:34:34 +0000 (19 23:34 +0900)]
codedump.c: remove unnecessary tab character from OP_MOVE

2 weeks agocodedump.c: skip string body if it's empty
Yukihiro "Matz" Matsumoto [Mon, 19 May 2025 14:15:27 +0000 (19 23:15 +0900)]
codedump.c: skip string body if it's empty

2 weeks agocodedump.c: output format for OP_ARRAY has changed
Yukihiro "Matz" Matsumoto [Mon, 19 May 2025 14:09:03 +0000 (19 23:09 +0900)]
codedump.c: output format for OP_ARRAY has changed

2 weeks agorange.c (range_num_to_a): C++ compiler eagerly warns goto statement
Yukihiro "Matz" Matsumoto [Mon, 19 May 2025 10:41:01 +0000 (19 19:41 +0900)]
range.c (range_num_to_a): C++ compiler eagerly warns goto statement

2 weeks agorange.c (range_num_to_a): support big integer beg/end in ranges
Yukihiro "Matz" Matsumoto [Mon, 19 May 2025 08:36:05 +0000 (19 17:36 +0900)]
range.c (range_num_to_a): support big integer beg/end in ranges

2 weeks agorange.c (range_num_to_a): improved float support
Yukihiro "Matz" Matsumoto [Mon, 19 May 2025 08:17:24 +0000 (19 17:17 +0900)]
range.c (range_num_to_a): improved float support

2 weeks agomruby-io: provide Kernel#p in this gem
Yukihiro "Matz" Matsumoto [Mon, 19 May 2025 04:31:01 +0000 (19 13:31 +0900)]
mruby-io: provide Kernel#p in this gem

To prevent ordering instability when output from mruby-io and Kernel#p
mixed.

2 weeks agoMerge pull request #6530 from dearblue/visibility
Yukihiro "Matz" Matsumoto [Sun, 18 May 2025 23:11:18 +0000 (19 08:11 +0900)]
Merge pull request #6530 from dearblue/visibility

2 weeks agomruby-compiler: add y.tab.c in the repository again; close #6515
Yukihiro "Matz" Matsumoto [Sun, 18 May 2025 13:22:23 +0000 (18 22:22 +0900)]
mruby-compiler: add y.tab.c in the repository again; close #6515

Since we have introduced lrama, everyone can generate same `y.tab.c`
on any platform, without installing Bison. That was the reason we have
removed `y.tab.c` from the repository. But this change cause #6515 and
bothered out-of-tree builds. So we (reluctantly) added `y.tab.c` again.

2 weeks ago.gitignore: no longer ignore y.tab.c; ref #6515
Yukihiro "Matz" Matsumoto [Sun, 18 May 2025 13:20:48 +0000 (18 22:20 +0900)]
.gitignore: no longer ignore y.tab.c; ref #6515

2 weeks agomruby-compiler: remove mrb_free dependency from codegen.c
Yukihiro "Matz" Matsumoto [Sat, 17 May 2025 14:06:29 +0000 (17 23:06 +0900)]
mruby-compiler: remove mrb_free dependency from codegen.c

2 weeks agomruby-compiler: remove mrb_calloc dependency from parse.y
Yukihiro "Matz" Matsumoto [Sat, 17 May 2025 13:37:11 +0000 (17 22:37 +0900)]
mruby-compiler: remove mrb_calloc dependency from parse.y

2 weeks agomruby-compiler: removed mrb_state dependency from two functions
Yukihiro "Matz" Matsumoto [Fri, 16 May 2025 13:24:16 +0000 (16 22:24 +0900)]
mruby-compiler: removed mrb_state dependency from two functions

- mrb_ccontext_partial_hook
- mrb_ccontext_cleanup_local_variables

2 weeks agostdlib.gembox: add mruby-catch to the gembox
Yukihiro "Matz" Matsumoto [Wed, 14 May 2025 23:00:36 +0000 (15 08:00 +0900)]
stdlib.gembox: add mruby-catch to the gembox

2 weeks agoRevert "class.c (find_visibility_scope): when callinfo returns, *ep == NULL; #6512"
dearblue [Sun, 18 May 2025 09:52:32 +0000 (18 18:52 +0900)]
Revert "class.c (find_visibility_scope): when callinfo returns, *ep == NULL; #6512"

This reverts commit 3879b95a6223846bc6763d84cb8c0282a6792d31.

This is because the code first reported in #6494 no longer works.

2 weeks agoAdd more test code for method visibility
dearblue [Sun, 18 May 2025 09:50:02 +0000 (18 18:50 +0900)]
Add more test code for method visibility

This test corresponds to the first issue of #6494.
Complement to #6512.

2 weeks agoMerge pull request #6529 from mruby/dependabot/github_actions/super-linter/super...
Yukihiro "Matz" Matsumoto [Wed, 14 May 2025 20:46:57 +0000 (15 05:46 +0900)]
Merge pull request #6529 from mruby/dependabot/github_actions/super-linter/super-linter-7.4.0

2 weeks agobuild(deps): bump super-linter/super-linter from 7.3.0 to 7.4.0
dependabot[bot] [Wed, 14 May 2025 14:19:47 +0000 (14 14:19 +0000)]
build(deps): bump super-linter/super-linter from 7.3.0 to 7.4.0

Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 7.3.0 to 7.4.0.
- [Release notes](https://github.com/super-linter/super-linter/releases)
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/super-linter/super-linter/compare/v7.3.0...v7.4.0)

---
updated-dependencies:
- dependency-name: super-linter/super-linter
  dependency-version: 7.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2 weeks agostdlib.gembox: add mruby-enum-chain gem
Yukihiro "Matz" Matsumoto [Wed, 14 May 2025 01:09:49 +0000 (14 10:09 +0900)]
stdlib.gembox: add mruby-enum-chain gem

2 weeks agometaprog.gembox: add two binding gems
Yukihiro "Matz" Matsumoto [Wed, 14 May 2025 01:08:49 +0000 (14 10:08 +0900)]
metaprog.gembox: add two binding gems

- mruby-binding
- mruby-proc-binding

2 weeks agomath.gembox: exclude mruby-cmath from math gembox
Yukihiro "Matz" Matsumoto [Wed, 14 May 2025 01:01:19 +0000 (14 10:01 +0900)]
math.gembox: exclude mruby-cmath from math gembox

2 weeks agoMerge pull request #6528 from jbampton/fix-grammar-spelling
Yukihiro "Matz" Matsumoto [Wed, 14 May 2025 06:58:05 +0000 (14 15:58 +0900)]
Merge pull request #6528 from jbampton/fix-grammar-spelling

2 weeks agoMerge pull request #6418 from jbampton/add-ls-lint
Yukihiro "Matz" Matsumoto [Wed, 14 May 2025 06:55:33 +0000 (14 15:55 +0900)]
Merge pull request #6418 from jbampton/add-ls-lint

2 weeks agomisc: fix spelling
John Bampton [Tue, 13 May 2025 16:01:02 +0000 (14 02:01 +1000)]
misc: fix spelling

2 weeks agoAdd `ls-lint` with GitHub Actions
John Bampton [Wed, 13 Nov 2024 12:00:19 +0000 (13 22:00 +1000)]
Add `ls-lint` with GitHub Actions

Rename files in the `mrbgems` directory

2 weeks agoMerge pull request #6526 from vickash/luckfox-pico
Yukihiro "Matz" Matsumoto [Tue, 13 May 2025 07:46:23 +0000 (13 16:46 +0900)]
Merge pull request #6526 from vickash/luckfox-pico

3 weeks agomruby-compiler: use mrb_basic_alloc_func() directly from compiler
Yukihiro "Matz" Matsumoto [Tue, 13 May 2025 04:20:06 +0000 (13 13:20 +0900)]
mruby-compiler: use mrb_basic_alloc_func() directly from compiler

As a side effect, memory allocation failure may cause segmentation
fault. Maybe we have to add error detection later.

3 weeks agomruby-compiler: use new mempool API
Yukihiro "Matz" Matsumoto [Mon, 12 May 2025 23:13:48 +0000 (13 08:13 +0900)]
mruby-compiler: use new mempool API

3 weeks agomempool.c (mempool_open): avoid using old API in mempool.c
Yukihiro "Matz" Matsumoto [Mon, 12 May 2025 04:04:22 +0000 (12 13:04 +0900)]
mempool.c (mempool_open): avoid using old API in mempool.c

3 weeks agoMerge pull request #6525 from hasse09052/skip-empty-mirb-history
Yukihiro "Matz" Matsumoto [Mon, 12 May 2025 03:59:28 +0000 (12 12:59 +0900)]
Merge pull request #6525 from hasse09052/skip-empty-mirb-history

3 weeks agocompile.h: change `struct mrb_mempool` to `mrb_mempool`
Yukihiro "Matz" Matsumoto [Mon, 12 May 2025 03:30:15 +0000 (12 12:30 +0900)]
compile.h: change `struct mrb_mempool` to `mrb_mempool`

So that compatibility layer can be used without macro definition.

3 weeks agoLuckfox Pico config: Use realpath, comment flags and cmath exclusion
vickash [Mon, 12 May 2025 03:25:32 +0000 (11 23:25 -0400)]
Luckfox Pico config: Use realpath, comment flags and cmath exclusion

3 weeks agoAdd build config for Luckfox Pico embedded SBC
vickash [Mon, 12 May 2025 02:35:05 +0000 (11 22:35 -0400)]
Add build config for Luckfox Pico embedded SBC

3 weeks agomempool.c: remove mrb_state dependency from mempool library
Yukihiro "Matz" Matsumoto [Sun, 11 May 2025 23:26:18 +0000 (12 08:26 +0900)]
mempool.c: remove mrb_state dependency from mempool library

mempool.h provide compatibility layer so that existing programs does not
need to update (but update recommended anyway, since compatibility layer
takes mrb_state that is not used at all).

3 weeks agoclass.c (mt_rehash): Fix mrb_calloc argument order
Yukihiro "Matz" Matsumoto [Sun, 11 May 2025 11:11:56 +0000 (11 20:11 +0900)]
class.c (mt_rehash): Fix mrb_calloc argument order

Since mrb_calloc() (along with mrb_calloc) takes two arguments: nmemb
which is number of array elements, and size which is size of the array.
Of course, revsersing does not change the behavior, but we'd like to
respect the original design intention of calloc(3).

3 weeks agoMerge pull request #6521 from jbampton/add-codespell-config
Yukihiro "Matz" Matsumoto [Sun, 11 May 2025 11:09:25 +0000 (11 20:09 +0900)]
Merge pull request #6521 from jbampton/add-codespell-config

3 weeks agomruby-bin-mirb: skip adding empty input to mirb history
hasse [Sat, 10 May 2025 17:44:04 +0000 (11 02:44 +0900)]
mruby-bin-mirb: skip adding empty input to mirb history

3 weeks agodoc/guides/memory.md: update the document
Yukihiro "Matz" Matsumoto [Sat, 10 May 2025 00:34:20 +0000 (10 09:34 +0900)]
doc/guides/memory.md: update the document

- new API
- detailed hook description
- migration path from old API

3 weeks agoallocf.c: update and enhance documentation in the comment
Yukihiro "Matz" Matsumoto [Sat, 10 May 2025 00:07:35 +0000 (10 09:07 +0900)]
allocf.c: update and enhance documentation in the comment

3 weeks agomruby.h: remove mrb_allocf type
Yukihiro "Matz" Matsumoto [Fri, 9 May 2025 22:38:04 +0000 (10 07:38 +0900)]
mruby.h: remove mrb_allocf type

As a result, we removed (already obsoleted) `mrb_open_allocf()', and
made `mrb_open_core()` take no argument. [incompatible changes]

3 weeks agoallocf.c (mrb_basic_alloc_func): remove ud argument
Yukihiro "Matz" Matsumoto [Fri, 9 May 2025 12:53:09 +0000 (9 21:53 +0900)]
allocf.c (mrb_basic_alloc_func): remove ud argument

3 weeks agoallocf.c: rename mrb_default_alloc to mrb_basic_alloc_func
Yukihiro "Matz" Matsumoto [Fri, 9 May 2025 10:17:13 +0000 (9 19:17 +0900)]
allocf.c: rename mrb_default_alloc to mrb_basic_alloc_func

Along with removing mrb_state first argument from the function. From
mruby 3.2, this function is *not* the default function, but the entry
point that can be redefined for the application. The function in
`src/allocf.c` is the default *implementation* (using malloc / realloc /
free) of the function.

3 weeks agoAdd codespell config file `.codespellrc`
John Bampton [Fri, 2 May 2025 18:21:54 +0000 (3 04:21 +1000)]
Add codespell config file `.codespellrc`

Add `.codespellrc` to the GitHub labeler

Can now run codespell from the command line standalone and it will use
our standard config file. Running codespell with pre-commit will also use this config.

Useful when regenerating the ignored words file on the command line.

https://github.com/codespell-project/codespell?tab=readme-ov-file#using-a-config-file

https://github.com/codespell-project/codespell?tab=readme-ov-file#pre-commit-hook

3 weeks agomruby.h: remove allocf and allocf_ud from mrb_state
Yukihiro "Matz" Matsumoto [Fri, 9 May 2025 09:13:28 +0000 (9 18:13 +0900)]
mruby.h: remove allocf and allocf_ud from mrb_state

This is preparation for memory allocation restructuring.

3 weeks agomruby-random: Random#rand(nil) should raise TypeError
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 08:37:05 +0000 (8 17:37 +0900)]
mruby-random: Random#rand(nil) should raise TypeError

3 weeks agomruby-random: update error messages to be compatible with CRuby; #6523
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 07:42:33 +0000 (8 16:42 +0900)]
mruby-random: update error messages to be compatible with CRuby; #6523

3 weeks agotest/kernel.rb: disable some Kernel#p tests; ref #6524
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 07:21:01 +0000 (8 16:21 +0900)]
test/kernel.rb: disable some Kernel#p tests; ref #6524

3 weeks agoMerge pull request #6523 from leviongit/rand-range
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 07:06:02 +0000 (8 16:06 +0900)]
Merge pull request #6523 from leviongit/rand-range

3 weeks agoMerge pull request #6524 from hasumikin/fix/Kernel#p
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 07:01:35 +0000 (8 16:01 +0900)]
Merge pull request #6524 from hasumikin/fix/Kernel#p

3 weeks agoMerge pull request #6522 from jbampton/label-more-files
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 06:59:47 +0000 (8 15:59 +0900)]
Merge pull request #6522 from jbampton/label-more-files

3 weeks agoclass.c (find_visibility_scope): when callinfo returns, *ep == NULL; #6512
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 03:00:16 +0000 (8 12:00 +0900)]
class.c (find_visibility_scope): when callinfo returns, *ep == NULL; #6512

3 weeks agoclass.c (find_visibility_scope): rename the function; ref #6512
Yukihiro "Matz" Matsumoto [Thu, 8 May 2025 02:58:36 +0000 (8 11:58 +0900)]
class.c (find_visibility_scope): rename the function; ref #6512

Since the function returns either callinfo or env, thus the name does
not describe the current behavior. In addition, we did some refactoring
on the function.