leviongit
020cfa9283
prefer using mrb_yield to call block arguments
2024-09-04 20:44:51 +02:00
Yukihiro "Matz" Matsumoto
4671459e73
Merge pull request #6343 from mruby/dependabot/bundler/yard-0.9.37
2024-09-05 00:10:42 +09:00
dependabot[bot]
c3615be2ac
build(deps): bump yard from 0.9.36 to 0.9.37
...
Bumps [yard](https://github.com/lsegal/yard ) from 0.9.36 to 0.9.37.
- [Release notes](https://github.com/lsegal/yard/releases )
- [Changelog](https://github.com/lsegal/yard/blob/main/CHANGELOG.md )
- [Commits](https://github.com/lsegal/yard/compare/v0.9.36...v0.9.37 )
---
updated-dependencies:
- dependency-name: yard
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2024-09-04 14:52:41 +00:00
Yukihiro "Matz" Matsumoto
649162624f
Merge pull request #6341 from dearblue/restore-arena
2024-09-04 09:39:41 +09:00
dearblue
e476d9a344
Need to restore the GC arena after some function calls
...
When calling `mrb_equal()` or `mrb_funcall()` family functions, the GC arena should be restored if the loop is repeated by a non-immediate return value.
In my opinion, restoring the GC arena is unnecessary when a non-immediate (true) value causes the function to return (e.g. the `mrb_ary_index_m()` function).
The patch does not take into account the case of recursive calls and may be incomplete.
2024-09-03 21:29:06 +09:00
Yukihiro "Matz" Matsumoto
1d12097bae
mruby-io (mrb_file__gethome): allow avoiding getpwnam(3); ref #5358
...
You have to define `MRB_IO_NO_PWNAM` to skip calling getpwname(3).
2024-09-03 15:27:29 +09:00
Yukihiro "Matz" Matsumoto
96cf9ba230
vm.c (mrb_yield_with_class): merge declaration and initialization
2024-09-03 11:58:20 +09:00
Yukihiro "Matz" Matsumoto
4062069679
gc.c (gc_arena_keep): revert 2 commits regarding arena allocation; #6329
...
We assumed there's no need for gc_arena_keep() when MRB_GC_FIXED_ARENA
is set. But it turned out that gc_protect() still can cause use-after-free
with fixed arena.
Revert "gc.c (gc_protect): should not call gc_arena_keep twice from allocation"
This reverts commit 28ece4ed8b .
Revert "gc.c (gc_arena_keep): reorganized for MRB_GC_FIXED_ARENA; ref #6329 "
This reverts commit 33dd623a02 .
2024-09-02 23:00:09 +09:00
Yukihiro "Matz" Matsumoto
6c4dbe8584
vm.c (eval_under): unify declaration and initialization of variables
2024-09-02 11:52:32 +09:00
Yukihiro "Matz" Matsumoto
f2d9995984
Merge pull request #6332 from dearblue/mruby-compiler
2024-09-01 22:45:07 +09:00
Yukihiro "Matz" Matsumoto
472f699ee6
vm.c (mrb_f_send): unify declaration and initialization of variables
2024-09-01 22:29:46 +09:00
Yukihiro "Matz" Matsumoto
56c3d748fb
Merge pull request #6335 from dearblue/OP_RETURN
2024-08-30 10:53:58 +09:00
Yukihiro "Matz" Matsumoto
fa62129fdc
Merge pull request #6337 from mruby/dependabot/github_actions/super-linter/super-linter-7.1.0
2024-08-29 09:55:03 +09:00
dependabot[bot]
45bb0973fd
build(deps): bump super-linter/super-linter from 7.0.0 to 7.1.0
...
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter ) from 7.0.0 to 7.1.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.0.0...v7.1.0 )
---
updated-dependencies:
- dependency-name: super-linter/super-linter
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2024-08-28 14:08:55 +00:00
Yukihiro "Matz" Matsumoto
6de3009606
Merge pull request #6328 from dearblue/env-obj_free
2024-08-28 16:40:04 +09:00
Yukihiro "Matz" Matsumoto
4a71d4604e
mruby-rational: add typecast to check if a value is fit in mrb_int
2024-08-27 22:48:40 +09:00
Yukihiro "Matz" Matsumoto
540d976f7f
array.c (sort_cmp): mrb_cmp() may return -2 for errors
2024-08-27 22:36:24 +09:00
dearblue
7ec5d47a91
Add return_ci in CHECKPOINT_MAIN() of OP_RETURN
...
For role clarity, distinguish between `ci` and `return_ci`.
2024-08-27 21:39:09 +09:00
Yukihiro "Matz" Matsumoto
28ece4ed8b
gc.c (gc_protect): should not call gc_arena_keep twice from allocation
2024-08-27 11:03:14 +09:00
Yukihiro "Matz" Matsumoto
ef5ae1c629
Merge pull request #6333 from dearblue/heap_p
2024-08-26 05:49:49 +09:00
Yukihiro "Matz" Matsumoto
33dd623a02
gc.c (gc_arena_keep): reorganized for MRB_GC_FIXED_ARENA; ref #6329
2024-08-26 05:47:28 +09:00
Yukihiro "Matz" Matsumoto
1a322449aa
Merge pull request #6331 from dearblue/test-gcarena
2024-08-26 05:47:48 +09:00
Yukihiro "Matz" Matsumoto
b9c93673f9
Merge pull request #6329 from dearblue/mrb_obj_alloc
2024-08-26 05:40:12 +09:00
Yukihiro "Matz" Matsumoto
325c918464
class.c: use mrb_unboxed_type where obj is not immediate for sure
2024-08-26 05:33:19 +09:00
dearblue
98fdfe1037
Reduce the number of branch instructions in the heap_p()
...
As far as `gcc -S` for several CPU architectures has confirmed, it reduces the number of branch instructions by one.
2024-08-25 20:35:41 +09:00
dearblue
cfe410f466
Must not depend on the “host” build to generate mruby-compiler/core/y.tab.c
...
“mruby-compiler” should be able to generate `y.tab.c` files through a separate build configuration if it is not added to the ‘host’ build.
In the example above, the “host/mrbc” build should generate the `y.tab.c` file.
2024-08-25 11:17:56 +09:00
dearblue
79d7ac5f7e
Restore the GC arena with tests.
...
This was the unintentional catalyst for finding the problem in #6329 , but it is preferable to add a test if necessary.
2024-08-25 11:08:40 +09:00
dearblue
1c5839fb01
Fix use-after-free in mrb_obj_alloc()
...
When GC occurs during the expansion of the GC arena by `gc_protect()` in `mrb_obj_alloc()`, the object page just allocated by `add_heap()` is released.
Therefore, as soon as control returns from `gc_protect()`, there is a possibility of illegal writing or reading to the address just released.
This issue was discovered during the investigation of #6326 .
2024-08-25 10:55:15 +09:00
Yukihiro "Matz" Matsumoto
a2db222422
Merge pull request #6330 from dearblue/mrb_env_unshare
2024-08-24 21:47:44 +09:00
dearblue
13571402d2
Add a precondition to call mrb_env_unshare().
...
The following assertions can be added to omit the `if` block
- env object must be non-null
- env object must be in a shared state with the stack
The current caller is believed to satisfy the condition.
2024-08-24 17:30:54 +09:00
dearblue
22b1ac9070
Fix use-after-free in obj_free() for env objects
...
A reference to an invalid address might occur in `is_dead()` of `obj_free()` called from `incremental_sweep_phase()`.
This would happen if the heap page was freed ahead of time in the same `incremental_sweep_phase()`.
fixed #6326
2024-08-24 16:46:27 +09:00
Yukihiro "Matz" Matsumoto
204b81c563
mruby-bin-mirb: fix the issue on macOS; #6327
2024-08-24 07:13:45 +09:00
Yukihiro "Matz" Matsumoto
7ba95e2f5e
Merge pull request #6327 from juchem/master
2024-08-23 22:33:44 +09:00
Yukihiro "Matz" Matsumoto
f35000f2a9
array.c (sort_cmp): comparing objects may be freed by GC; #6326
...
If comparing function (block or `<=>`) modifies the sorting array and GC
happens after the modification, objects passed to comparison may be
freed by GC.
2024-08-23 22:29:45 +09:00
Marcelo Juchem
a6eb3e5c27
fix ncurses linking issues
...
The build configuration for `mruby` assumes only the `ncurses` library
needs to be linked because `tinfo` is implicitly pulled in.
In environments where ncurses is available only as a static library,
`tinfo` needs to be linked explicitly (needed for functions like
`tputs`.
This patch fixes that by linking `tinfo` if available.
It also fixes the build for environments where only the `ncursesw`
version of the library (including wide character support) is present,
while still giving preference to the `ncurses` version (without wide
character support).
2024-08-22 14:11:48 -05:00
Yukihiro "Matz" Matsumoto
58c70834d9
array.c (srot_cmp): need modify check after mrb_cmp as well; #6326
...
mrb_cmp() may also modify the sorting array internally.
2024-08-22 07:49:16 +09:00
Yukihiro "Matz" Matsumoto
4ea6d74d83
mruby-rational: introduce the constants ONE and ZERO
2024-08-21 18:38:51 +09:00
Yukihiro "Matz" Matsumoto
752ebe6b7f
array.c (mrb_ary_sort_bang): check if array is modified in blocks
...
This address at least part of #6326 . CRuby copied the array internally,
but mruby avoid copying to reserve memory.
2024-08-21 18:31:46 +09:00
Yukihiro "Matz" Matsumoto
4b9f567821
vm.c (exec_irep): unify declaration and initialization
2024-08-20 12:49:45 +09:00
Yukihiro "Matz" Matsumoto
98440e095f
vm.c (mrb_ci_nregs): unify declaration and initialization
2024-08-20 10:39:12 +09:00
Yukihiro "Matz" Matsumoto
166262243a
benchmark/bm_so_mandelbrot.rb: add new benchmark
2024-08-18 23:11:29 +09:00
Yukihiro "Matz" Matsumoto
39b9a1a06a
mruby-rational (rational_new): fix compilation condition
2024-08-17 16:29:51 +09:00
Yukihiro "Matz" Matsumoto
44908e5cba
mruby-rational: support bigint numerators & denominators
2024-08-16 15:12:03 +09:00
Yukihiro "Matz" Matsumoto
92f476d8fa
mruby-bigint (mpz_set): trim destination mpz_t
2024-08-16 07:32:05 +09:00
Yukihiro "Matz" Matsumoto
479259b4e1
Merge pull request #6324 from dearblue/localjump_error
2024-08-16 06:22:32 +09:00
Yukihiro "Matz" Matsumoto
b202d00219
Merge pull request #6325 from mruby/dependabot/github_actions/super-linter/super-linter-7.0.0
2024-08-16 06:19:16 +09:00
dependabot[bot]
f3b24009e6
build(deps): bump super-linter/super-linter from 6.9.0 to 7.0.0
...
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter ) from 6.9.0 to 7.0.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/v6.9.0...v7.0.0 )
---
updated-dependencies:
- dependency-name: super-linter/super-linter
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2024-08-15 14:34:20 +00:00
Yukihiro "Matz" Matsumoto
a4225709ef
Merge pull request #6323 from mruby/dependabot/github_actions/super-linter/super-linter-6.9.0
2024-08-15 12:15:17 +09:00
dearblue
9d0617f27b
Remove localjump_error()
...
Suppress heap allocation for strings.
2024-08-15 10:27:53 +09:00
Yukihiro "Matz" Matsumoto
dfe2dbcde6
class.c (init_copy): need to copy float numbers in some cases
...
If `MRB_BOXING_WORD` and `MRB_WORDBOXING_NO_FLOAT_TRANCATE` is defined,
float numbers are packed in the heap object. We need to copy them
explicitly.
2024-08-15 09:57:56 +09:00