Commit Graph

15974 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto fbe21a0321 tools/lrama: bundle Lrama 0.6.9 (copied from CRuby source) 2024-06-10 14:26:26 +09:00
Yukihiro "Matz" Matsumoto d6da2d4760 mruby-compiler: use @1 in parse.y to enable YYLTYPE
This change itself does nothing good, but it is a preparation for the
future Bison to Lrama migration. As of 0.6.9, Lrama has a compatibility
issue for grammar files without `@n`.
2024-06-10 08:23:36 +09:00
Yukihiro "Matz" Matsumoto 473206c5d8 class.c: adjust local variable declarations with initialization 2024-06-10 08:23:36 +09:00
Yukihiro "Matz" Matsumoto b6b74b3a5b Merge pull request #6290 from dearblue/libdir
Allow to change the output directory name of the `libmruby` file
2024-06-10 08:22:52 +09:00
dearblue 0fcf54b47d Allow to change the output directory name of the libmruby file
Add the `MRuby::Build#libdir_name` accessor and the `MRUBY_SYSTEM_LIBDIR_NAME` environment variable.

Resolved #6240
2024-06-09 22:49:46 +09:00
Yukihiro "Matz" Matsumoto 43b3536803 Merge pull request #6288 from dearblue/closing
Detach `env` of ci explicitly on atexit
2024-06-09 19:40:21 +09:00
Yukihiro "Matz" Matsumoto b60cd351a1 Merge pull request #6289 from dearblue/orphan-block
Simplify `OP_RETURN_BLK` and `OP_BREAK
2024-06-08 23:51:48 +09:00
dearblue f48ac7469b Simplify OP_RETURN_BLK and `OP_BREAK
- There was some unnecessary complexity in `OP_BREAK` introduced in commit ad2e626 (#6282).
  - Since `mrb->c` is never NULL, there is no need to check it with `MRB_ENV_ONSTACK_P()` beforehand.
2024-06-08 13:46:28 +09:00
dearblue bd596153f1 Detach env of ci explicitly on atexit
Supplement to commit 177debacc5 (#6276).

If the ci is incomplete, the previous method may cause the application to crash because `env->stack` points to an invalid address when expanding the data stack.
Since the ci is in an abnormal state, control it by putting `NULL` in `env->stack`.

If the ci is fine and top-level, detach `env` as usual with `mrb_env_unshare()`.
2024-06-06 21:35:24 +09:00
Yukihiro "Matz" Matsumoto 8c1e12263e Merge pull request #6287 from mruby/dependabot/github_actions/super-linter/super-linter-6.6.0
build(deps): bump super-linter/super-linter from 6.5.1 to 6.6.0
2024-06-05 21:26:23 +09:00
Yukihiro "Matz" Matsumoto 889af10090 mruby-compiler: prohibit dynamic assignment to constants; #3521
Along with some declaration adjustments to minimize `y.tab.c` diff.
2024-06-05 18:56:11 +09:00
dependabot[bot] bc930d68ab build(deps): bump super-linter/super-linter from 6.5.1 to 6.6.0
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 6.5.1 to 6.6.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.5.1...v6.6.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-06-04 14:49:19 +00:00
Yukihiro "Matz" Matsumoto 5072358276 vm.c: remove unnecessary type cast to blk; ref #6282 2024-06-03 19:45:53 +09:00
Yukihiro "Matz" Matsumoto dcdd94c04c Merge pull request #6282 from dearblue/orphan-block
Delegate the care of a directly given block from `cipop()` to `cipush()`
2024-06-02 22:02:58 +09:00
Yukihiro "Matz" Matsumoto 95dcc52e16 Merge pull request #6283 from dearblue/env
Simplify `uvenv()`
2024-06-01 22:51:02 +09:00
dearblue d0b06446f2 Simplify uvenv()
The part removed in this patch was introduced by commit c7c9543bed.

The current mechanism should be able to trace from block objects created by `eval` to higher level blocks without any problems.
2024-06-01 20:36:22 +09:00
Yukihiro "Matz" Matsumoto 00a874cff6 Merge pull request #6281 from dearblue/binding
Fixes local variables in `mruby-binding`.
2024-05-31 22:56:04 +09:00
Yukihiro "Matz" Matsumoto 8d79cfdc83 Merge pull request #6280 from dearblue/env
Remove `MRB_ENV_CLOSED` flag
2024-05-31 22:50:56 +09:00
Yukihiro "Matz" Matsumoto 7b9b0997e0 string.c: adjust local variable declarations 2024-05-31 22:49:25 +09:00
dearblue ad2e626e7a Delegate the care of a directly given block from cipop() to cipush()
Outlines:
  - Removed `mrb_callinfo::blk`
  - Added `mrb_callinfo::flags`
  - Added `MRB_CI_COMPANION_BLOCK` flag
2024-05-31 22:03:15 +09:00
dearblue e82b36035e Fixes local variables in mruby-binding.
There are two issues to be fixed:
  - `mrb_irep` could leak if `mrb_calloc()` encountered an out-of-memory exception
  - `mrb_proc_merge_lvar()` allocated one extra variable name.

`irep->lv` can always refer to only one less range than `irep->nlocals`.
Also, when `mrb_proc_merge_lvar()` extends `irep->lv`, `mrb_realloc()` with `NULL` has the same behavior as `mrb_malloc()`.
2024-05-30 21:25:30 +09:00
dearblue 7ab6386cc6 Remove MRB_ENV_CLOSED flag
Set `env->cxt` to `NULL` when it is detached from the call frame.
In other words, we can determine if `env->cxt` is `NULL` or not.

Also, `mruby-binding` had been setting `env->cxt` unnecessarily, so this has been fixed.
2024-05-30 21:09:49 +09:00
Yukihiro "Matz" Matsumoto 0a11af74f4 Merge pull request #6279 from kou/windows-lean-and-mean-include
Include headers for malloc() explicitly; fix #6277
2024-05-29 14:37:10 +09:00
Sutou Kouhei c258ead85b Include headers for malloc() explicitly; fix #6277
We need to include stdlib.h and malloc.h to use malloc()/free() but
they aren't included in src/string.c with WIN32_LEAN_AND_MEAN. It
generates build time warnings.

We can solve this by including stdlib.h and malloc.h explicitly.
2024-05-29 09:45:36 +09:00
Yukihiro "Matz" Matsumoto f1dec3959f mruby-range-ext (range_size): raise TypeError if not iterable
According ruby/ruby#8663, `Range#size` behavior has changed.
2024-05-28 15:30:08 +09:00
Yukihiro "Matz" Matsumoto f2dc44215c Merge pull request #6276 from dearblue/closing
Always run `atexit` on the top-level call frame
2024-05-27 12:40:52 +09:00
Yukihiro "Matz" Matsumoto bf244d65db Merge pull request #6275 from dearblue/binding.eval
Fixed `Binding#eval` that failed to assign to the same variable
2024-05-27 08:49:14 +09:00
dearblue 177debacc5 Always run atexit on the top-level call frame
In the following example, the fiber context and call stack may be in an incomplete state.
  - In case another thread running mruby is terminated abnormally
  - In case of a global jump that is out of management by mruby
2024-05-26 21:17:00 +09:00
Yukihiro "Matz" Matsumoto d03394fbc4 mruby-os-memsize: adjust local variable declarations 2024-05-26 18:01:15 +09:00
Yukihiro "Matz" Matsumoto 681bcdbcd3 mruby-bigint: adjust local variable declarations 2024-05-26 07:38:34 +09:00
dearblue 75b0d06c41 Fixed Binding#eval that failed to assign to the same variable
In `Binding#eval`, two times parsing is executed.
The problem found in this case was caused by not passing an upper block to hold variables of the binding object during the first parsing.

The problem was uncovered by <https://github.com/mruby/mruby/discussions/6274>.
2024-05-25 21:55:02 +09:00
Yukihiro "Matz" Matsumoto 20cf58d1d3 Merge pull request #6273 from dearblue/closing
Improvements to `mrb_protect_atexit()`
2024-05-25 16:48:56 +09:00
Yukihiro "Matz" Matsumoto d415a45a33 AUTHORS: update entries [ci skip] 2024-05-25 16:47:08 +09:00
Yukihiro "Matz" Matsumoto 10bc15c23e mruby-class-ext: adjust variable declarations 2024-05-25 16:41:24 +09:00
Yukihiro "Matz" Matsumoto 292f7ef0ce mruby-proc-ext (mrb_proc_parameters): adjust variable declarations 2024-05-25 16:39:32 +09:00
Yukihiro "Matz" Matsumoto 89c70aeea0 mruby-range-ext: move local variable declarations to minimize scope 2024-05-25 16:39:32 +09:00
Yukihiro "Matz" Matsumoto 7c2be58e2a mruby-rational (rational_pow): fix wrong power calculation
`a/b ** -n` can be calculated by `b/a ** n` for correctness.
2024-05-25 16:39:32 +09:00
Yukihiro "Matz" Matsumoto d148bf8c0b mruby-rational: adjust local variable declarations with initialization 2024-05-25 16:39:32 +09:00
Yukihiro "Matz" Matsumoto 68e093729b string.c: refactor bit operation (e.g. SWAR)
To generate a bit mask of `0x8080...` of the word size, we prepare
`MASK01` which is `0x0101...` and multiply masking word (e.g., `0x80).
2024-05-25 16:39:32 +09:00
Yukihiro "Matz" Matsumoto bff68cbf17 mruby-socket (inet_ntop): refactor addrinfo loop 2024-05-25 16:39:31 +09:00
Yukihiro "Matz" Matsumoto 4e824048c0 mruby-socket: adjust local variable declarations 2024-05-25 16:39:31 +09:00
Yukihiro "Matz" Matsumoto bd7efbe75f string.c: check if the index points character boundary; fix #6267 2024-05-25 16:39:31 +09:00
dearblue b12ea17d0b Improvements to mrb_protect_atexit()
- Initialize the GC arena each time `atexit` is called.
  - To reduce the overhead of `MRB_TRY()`, an internal loop is also performed.
2024-05-25 10:48:16 +09:00
Yukihiro "Matz" Matsumoto f2e1cf2d3c Merge pull request #6272 from mruby/dependabot/github_actions/super-linter/super-linter-6.5.1
build(deps): bump super-linter/super-linter from 6.5.0 to 6.5.1
2024-05-25 07:57:55 +09:00
dependabot[bot] ccc34c37b9 build(deps): bump super-linter/super-linter from 6.5.0 to 6.5.1
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 6.5.0 to 6.5.1.
- [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.5.0...v6.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-24 14:22:15 +00:00
Yukihiro "Matz" Matsumoto 86f620822f Merge pull request #6269 from mruby/dependabot/github_actions/super-linter/super-linter-6.5.0
build(deps): bump super-linter/super-linter from 6.4.1 to 6.5.0
2024-05-16 07:09:41 +09:00
Yukihiro "Matz" Matsumoto c635456f16 mruby-dir: fix indentation 2024-05-16 07:06:59 +09:00
dependabot[bot] e36f0fd266 build(deps): bump super-linter/super-linter from 6.4.1 to 6.5.0
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 6.4.1 to 6.5.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.4.1...v6.5.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-05-15 14:28:17 +00:00
Yukihiro "Matz" Matsumoto 156c7ecae3 Merge pull request #6266 from dearblue/array-delete
Passes the nonexistent key as a block argument in `Array#delete`
2024-05-14 09:49:36 +09:00
Yukihiro "Matz" Matsumoto 7865593823 mruby-dir: enumerating methods should return enumerators; #6265 2024-05-14 09:42:38 +09:00