Yukihiro "Matz" Matsumoto
ca6dc4ec2d
variable.c (iv_size): refactor the function
...
Along with removing an obsolete comment line.
2025-05-27 10:16:12 +09:00
Yukihiro "Matz" Matsumoto
7c02e17e25
variable.c (mrb_mod_cv_get): initialize local variable
...
To silence compiler warning.
2025-05-26 22:59:04 +09:00
Yukihiro "Matz" Matsumoto
11bf789730
array.c: remove unnecessary blank line
2025-05-26 14:32:19 +09:00
Yukihiro "Matz" Matsumoto
9537d9b75a
Merge pull request #6532 from mruby/improve-mt-hash-load-factor
2025-05-25 20:57:36 +09:00
google-labs-jules[bot]
e82f49adf7
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.
2025-05-25 11:40:43 +00:00
Yukihiro "Matz" Matsumoto
ed8ec097a2
Merge pull request #6531 from mruby/improve-mt-hash-load-factor
2025-05-25 20:12:46 +09:00
google-labs-jules[bot]
8a91c91a69
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.
2025-05-24 22:50:29 +00:00
Yukihiro "Matz" Matsumoto
0c51a72bfe
string.c (popcount): support when sizeof(int) == 4
...
This function is used when the compiler does not support builtin
popcount operation (namely VC++).
2025-05-23 23:10:45 +09:00
Yukihiro "Matz" Matsumoto
ca526044d3
vm.c (stack_init): clear initial stack
2025-05-23 23:09:53 +09:00
Yukihiro "Matz" Matsumoto
86ef7a912d
mruby-rational (int_lshift): check before actual left bit shift
2025-05-21 13:25:08 +09:00
Yukihiro "Matz" Matsumoto
f4b01ed19e
mruby-rational (int_lshift): exponential may be bigger than int bits
2025-05-21 10:40:02 +09:00
Yukihiro "Matz" Matsumoto
1fa9eaa2b5
mruby-eval (binding_eval_error_check): re-raise Exception in parsing
2025-05-21 10:25:35 +09:00
Yukihiro "Matz" Matsumoto
77d08772a5
error.c (mrb_vformat): prevent SEGV from %s with NULL
2025-05-21 09:52:10 +09:00
Yukihiro "Matz" Matsumoto
1726b61481
mruby-compiler (gen_move): avoid unnecessary goto's
2025-05-20 18:31:51 +09:00
Yukihiro "Matz" Matsumoto
d329d9af79
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.
2025-05-20 18:31:21 +09:00
Yukihiro "Matz" Matsumoto
d08276a052
codedump.c: remove unnecessary tab character from OP_MOVE
2025-05-19 23:36:16 +09:00
Yukihiro "Matz" Matsumoto
82d03b32f2
codedump.c: skip string body if it's empty
2025-05-19 23:34:02 +09:00
Yukihiro "Matz" Matsumoto
f9414456a5
codedump.c: output format for OP_ARRAY has changed
2025-05-19 23:09:03 +09:00
Yukihiro "Matz" Matsumoto
1d426c50bf
range.c (range_num_to_a): C++ compiler eagerly warns goto statement
2025-05-19 19:41:01 +09:00
Yukihiro "Matz" Matsumoto
94d9f6cfc7
range.c (range_num_to_a): support big integer beg/end in ranges
2025-05-19 17:36:54 +09:00
Yukihiro "Matz" Matsumoto
ff4109735f
range.c (range_num_to_a): improved float support
2025-05-19 17:36:45 +09:00
Yukihiro "Matz" Matsumoto
18c43c2a5a
mruby-io: provide Kernel#p in this gem
...
To prevent ordering instability when output from mruby-io and Kernel#p
mixed.
2025-05-19 13:31:01 +09:00
Yukihiro "Matz" Matsumoto
65247613b9
Merge pull request #6530 from dearblue/visibility
2025-05-19 08:11:18 +09:00
Yukihiro "Matz" Matsumoto
31ebcb349e
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.
2025-05-19 08:00:37 +09:00
Yukihiro "Matz" Matsumoto
c356e8f2ff
.gitignore: no longer ignore y.tab.c; ref #6515
2025-05-19 08:00:36 +09:00
Yukihiro "Matz" Matsumoto
96cbde7988
mruby-compiler: remove mrb_free dependency from codegen.c
2025-05-19 08:00:36 +09:00
Yukihiro "Matz" Matsumoto
bb712f9467
mruby-compiler: remove mrb_calloc dependency from parse.y
2025-05-19 08:00:36 +09:00
Yukihiro "Matz" Matsumoto
9fc58852e3
mruby-compiler: removed mrb_state dependency from two functions
...
- mrb_ccontext_partial_hook
- mrb_ccontext_cleanup_local_variables
2025-05-19 08:00:36 +09:00
Yukihiro "Matz" Matsumoto
fa19d7d3b5
stdlib.gembox: add mruby-catch to the gembox
2025-05-19 08:00:36 +09:00
dearblue
36df859333
Revert "class.c (find_visibility_scope): when callinfo returns, *ep == NULL; #6512 "
...
This reverts commit 3879b95a62 .
This is because the code first reported in #6494 no longer works.
2025-05-18 18:52:32 +09:00
dearblue
4417321d1c
Add more test code for method visibility
...
This test corresponds to the first issue of #6494 .
Complement to #6512 .
2025-05-18 18:50:02 +09:00
Yukihiro "Matz" Matsumoto
b952ca30cd
Merge pull request #6529 from mruby/dependabot/github_actions/super-linter/super-linter-7.4.0
2025-05-15 05:46:57 +09:00
dependabot[bot]
ef840eced0
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] <support@github.com >
2025-05-14 14:19:47 +00:00
Yukihiro "Matz" Matsumoto
923b1c9e37
stdlib.gembox: add mruby-enum-chain gem
2025-05-14 15:58:24 +09:00
Yukihiro "Matz" Matsumoto
9e6ddbb2ad
metaprog.gembox: add two binding gems
...
- mruby-binding
- mruby-proc-binding
2025-05-14 15:58:24 +09:00
Yukihiro "Matz" Matsumoto
d414e3f912
math.gembox: exclude mruby-cmath from math gembox
2025-05-14 15:58:23 +09:00
Yukihiro "Matz" Matsumoto
34bd571a65
Merge pull request #6528 from jbampton/fix-grammar-spelling
2025-05-14 15:58:05 +09:00
Yukihiro "Matz" Matsumoto
1fcaa3995e
Merge pull request #6418 from jbampton/add-ls-lint
2025-05-14 15:55:33 +09:00
John Bampton
781edbd446
misc: fix spelling
2025-05-14 02:01:02 +10:00
John Bampton
4f2f2cfd20
Add ls-lint with GitHub Actions
...
Rename files in the `mrbgems` directory
2025-05-14 01:14:02 +10:00
Yukihiro "Matz" Matsumoto
93a7e5ec26
Merge pull request #6526 from vickash/luckfox-pico
2025-05-13 16:46:23 +09:00
Yukihiro "Matz" Matsumoto
75466f9aab
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.
2025-05-13 13:20:06 +09:00
Yukihiro "Matz" Matsumoto
9ef2f551b7
mruby-compiler: use new mempool API
2025-05-13 08:13:48 +09:00
Yukihiro "Matz" Matsumoto
dbc9d12254
mempool.c (mempool_open): avoid using old API in mempool.c
2025-05-12 13:04:22 +09:00
Yukihiro "Matz" Matsumoto
ebca0cbf6a
Merge pull request #6525 from hasse09052/skip-empty-mirb-history
2025-05-12 12:59:28 +09:00
Yukihiro "Matz" Matsumoto
c2d5a402ba
compile.h: change struct mrb_mempool to mrb_mempool
...
So that compatibility layer can be used without macro definition.
2025-05-12 12:30:15 +09:00
vickash
6700c327ac
Luckfox Pico config: Use realpath, comment flags and cmath exclusion
2025-05-11 23:25:32 -04:00
vickash
f98a05c738
Add build config for Luckfox Pico embedded SBC
2025-05-11 22:35:05 -04:00
Yukihiro "Matz" Matsumoto
6566099dbb
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).
2025-05-12 08:26:18 +09:00
Yukihiro "Matz" Matsumoto
6766fcb905
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).
2025-05-11 20:11:56 +09:00