Commit Graph

16167 Commits

Author SHA1 Message Date
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
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
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
dependabot[bot] eb6d7afd7e build(deps): bump super-linter/super-linter from 6.8.0 to 6.9.0
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 6.8.0 to 6.9.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.8.0...v6.9.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-14 14:56:30 +00:00
Yukihiro "Matz" Matsumoto e9c4486e27 mruby-bigint: add fast path to mrb_bint_mul() & mrb_bint_div() 2024-08-14 22:36:47 +09:00
Yukihiro "Matz" Matsumoto 16f5000794 Merge pull request #6320 from dearblue/OP_BREAK 2024-08-14 18:02:34 +09:00
Yukihiro "Matz" Matsumoto 6e5a493ff3 mruby-bigint (mrb_bint_new_float): add fast path for FIXABLE_FLOAT 2024-08-14 16:11:27 +09:00
Yukihiro "Matz" Matsumoto 92302df49d Merge pull request #6322 from hoshiumiarata/fix_mrb_ro_data_p 2024-08-13 17:50:35 +09:00
Hoshiumi Arata da54da1923 Fix mrb_ro_data_p on Intel Mac 2024-08-13 17:27:08 +09:00
Yukihiro "Matz" Matsumoto 1e503f902d Merge pull request #6321 from dearblue/lib-warnings 2024-08-13 11:48:21 +09:00
Yukihiro "Matz" Matsumoto c853dc4090 vm.c (funcall): move va_list declaration right before va_start() 2024-08-12 22:57:05 +09:00
dearblue 79f4a67268 Avoid warnings in lib/**/*.rb
```console
% find -s lib -type f -name '*.rb' -exec ruby -cw {} \;
lib/mruby/build/command.rb:320: warning: `+' after local variable or literal is interpreted as binary operator
lib/mruby/build/command.rb:320: warning: even though it seems like unary operator
Syntax OK
Syntax OK
Syntax OK
Syntax OK
Syntax OK
lib/mruby/gem.rb:469: warning: `&' interpreted as argument prefix
Syntax OK
Syntax OK
Syntax OK
Syntax OK
```
2024-08-12 21:06:31 +09:00
dearblue 682583a609 Shrinking the code in OP_BREAK and OP_RETURN_BLK
- Can refer directly to `proc->e.env` after `MRB_PROC_ENV_P()`.
  - Can omit `MRB_ENV_ONSTACK_P()` since `mrb->c` is never NULL and can be directly compared to `env->cxt`.
  - Can avoid `goto` by putting the code block that raises the `LocalJumpError` at the end.
2024-08-12 20:54:55 +09:00
Yukihiro "Matz" Matsumoto 22eb7e87af vm.c (uvenv): move declaration to initialization 2024-08-11 23:45:40 +09:00
Yukihiro "Matz" Matsumoto 7ca60a0964 vm.c (stack_extend_alloc): move variable declaration to initialization 2024-08-10 21:57:51 +09:00
Yukihiro "Matz" Matsumoto 56a82009aa Revert "The lex_state after literals should be EXPR_ENDARG."; fix #6298
This reverts commit e98823f189.
2024-08-10 19:17:49 +09:00
Yukihiro "Matz" Matsumoto a267dfd76b vm.c (OP_CLASS,OP_MODULE): combine declarations with initializers 2024-08-08 06:11:52 +09:00
Yukihiro "Matz" Matsumoto 22ec76f46c vm.c (OP_RANGE_INC): remove unnecessary local variable 2024-08-08 06:10:35 +09:00
Yukihiro "Matz" Matsumoto 320c757186 Merge pull request #6318 from dearblue/shrink-vm-vars
Shrink variables in `mrb_vm_exec()`
2024-08-06 12:21:36 +09:00
Yukihiro "Matz" Matsumoto aad2aacf25 range.c (mrb_get_values_at): support bigint too 2024-08-05 16:35:41 +09:00
Yukihiro "Matz" Matsumoto 6da2e60edc mruby-bigint (mpz_get_str): avoid malloc when base is a power of 2 2024-08-05 10:43:47 +09:00
Yukihiro "Matz" Matsumoto 0e6ef15b0f AUTHORS: update entries [ci skip] 2024-08-04 23:19:25 +09:00
Yukihiro "Matz" Matsumoto e8bb03da40 numeric.rb (step): iterate over integers even if end is a float
It used to check all `start`, `end` and `step`. If either of them are
float number, `#step` iterated over float number. Now we don't check the
type of `end` argument.
2024-08-03 13:35:09 +09:00
Yukihiro "Matz" Matsumoto 6d6e26661d gc.c: remove unnecessary argument from add_gray_list() 2024-08-02 21:14:58 +09:00
Yukihiro "Matz" Matsumoto 3324773f56 gc.c (mrb_gc_register): protect obj from GC during execution
Because `mrb_ary_new()` and `mrb_ary_push()` can cause GC; fix #6317
2024-08-02 04:52:11 +09:00
Yukihiro "Matz" Matsumoto 16fe4b2701 Merge pull request #6319 from mruby/dependabot/github_actions/super-linter/super-linter-6.8.0 2024-08-02 04:47:42 +09:00
dependabot[bot] 7db4cfd5cd build(deps): bump super-linter/super-linter from 6.7.0 to 6.8.0
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 6.7.0 to 6.8.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.7.0...v6.8.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-01 14:32:11 +00:00
Yukihiro "Matz" Matsumoto aa06432776 mruby-array-ext: index should be within mrb_int range
Type check is done by `__to_int` method.
2024-08-01 07:34:20 +09:00
dearblue 822e3fdfd7 Remove pool and syms variables in mrb_vm_exec()
Can be referenced by traversing through the `irep` pointer.
2024-07-31 22:27:04 +09:00
dearblue f2a139a616 Avoid assignments to pc and proc parameters in mrb_vm_exec()
Introduce the `ci` variable instead and refer to it indirectly.
2024-07-31 22:27:04 +09:00
Yukihiro "Matz" Matsumoto a668e6d81e Merge pull request #6310 from dearblue/ci-extend 2024-07-31 11:09:23 +09:00