Commit Graph

15873 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto ca29aa81bd Merge pull request #6247 from jbampton/clean-up-dockerignore
Clean up the `.dockerignore` file
2024-04-22 09:49:52 +09:00
Yukihiro "Matz" Matsumoto 34c8e8253a Merge pull request #6249 from jbampton/fix-grammar
Fix grammar in `src/vm.c`; `catched` -> `caught`
2024-04-22 09:49:19 +09:00
Yukihiro "Matz" Matsumoto 9c2fa6239e Merge pull request #6248 from jbampton/pre-commit-autoupdate
pre-commit autoupdate
2024-04-22 09:47:53 +09:00
Yukihiro "Matz" Matsumoto 87b756086f Merge pull request #6246 from jbampton/fix-spelling
Fix typo in `test/t/hash.rb`
2024-04-22 09:47:22 +09:00
Yukihiro "Matz" Matsumoto 5661cf6939 Merge pull request #6245 from jbampton/gha-label-more-files
gha: add labels to more files
2024-04-22 09:46:58 +09:00
John Bampton f9c2ea2f11 Fix grammar in src/vm.c; catched -> caught
Saying 'catched' instead of 'caught' is a grammatical error
2024-04-22 00:01:21 +10:00
John Bampton fef91724cb pre-commit autoupdate
https://pre-commit.com/#pre-commit-autoupdate
2024-04-21 23:21:46 +10:00
John Bampton 7e8ec85f6b Clean up the .dockerignore file 2024-04-21 22:46:19 +10:00
John Bampton 983a13f342 Fix typo in test/t/hash.rb 2024-04-21 22:21:57 +10:00
John Bampton b71092d440 gha: add labels to more files 2024-04-21 21:32:03 +10:00
Yukihiro "Matz" Matsumoto ad476c3684 Merge pull request #6243 from dearblue/base64 2024-04-21 08:25:56 +09:00
dearblue 6c2f570d79 Fixed base64 decoding in mruby-pack
Previously `\x80` was incorrectly mapped to `0`.

```ruby
"\x80\x80\x80\x80".unpack("m*")
# before => "\x00\x00\x00"
# after  => ""
```

The reason is that the C string terminator is placed in `base64_dec_tab[128]` and the array length is obtained by `sizeof`.
Therefore, the length of `base64_dec_tab[]` is strictly specified and replaced with element-by-element initialization.

Also, similar changes are made to `base64chars[]`.
2024-04-20 09:56:08 +09:00
Yukihiro "Matz" Matsumoto 4a27a18807 dump.c: adjust local variable declarations 2024-04-20 09:54:55 +09:00
Yukihiro "Matz" Matsumoto c445723fa4 enum.c: adjust local variable declaration 2024-04-19 16:20:36 +09:00
Yukihiro "Matz" Matsumoto 8350106896 etc.c: adjust local variable initializations 2024-04-18 15:49:19 +09:00
Yukihiro "Matz" Matsumoto ca26f41b57 mruby-sprintf: remove unnecessary assignment 2024-04-18 15:48:45 +09:00
Yukihiro "Matz" Matsumoto e52b608ed9 Merge pull request #6241 from mruby/dependabot/github_actions/super-linter/super-linter-6.4.0
build(deps): bump super-linter/super-linter from 6.3.1 to 6.4.0
2024-04-18 07:53:16 +09:00
dependabot[bot] e2f7c5daff build(deps): bump super-linter/super-linter from 6.3.1 to 6.4.0
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 6.3.1 to 6.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/v6.3.1...v6.4.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-04-17 14:28:32 +00:00
Yukihiro "Matz" Matsumoto c01899a8d3 Merge pull request #6235 from leviongit/array/delete
fix `Array#delete` always firing the block when deleting `nil`
2024-04-16 07:35:59 +09:00
Yukihiro "Matz" Matsumoto aec67dcd17 Merge pull request #6237 from dearblue/env-strict
Stricter env objects to attach to ci
2024-04-15 13:59:32 +09:00
Yukihiro "Matz" Matsumoto 93c02e96d5 Merge pull request #6238 from dearblue/init-stack
Minimize zero initialization of the stack
2024-04-15 13:59:14 +09:00
Yukihiro "Matz" Matsumoto c183e12d68 Merge pull request #6236 from leviongit/array/filters
unify the code for filter methods (and speed up `#reject!`)
2024-04-15 00:05:12 +09:00
Yukihiro "Matz" Matsumoto bc8b76a7a5 cdump.c: adjust local variable declarations 2024-04-15 00:01:11 +09:00
dearblue a4b57aa47b Minimize zero initialization of the stack 2024-04-13 22:22:39 +09:00
dearblue e3d51497cf Stricter env objects to attach to ci
- Don't create multiple envs on one ci.
  - Don't share a env to different ci.
  - Don't attach a closed env to any ci.

Changes in `envadjust()` can be simplified with those guarantees.
2024-04-13 22:13:04 +09:00
Yukihiro "Matz" Matsumoto 3174488851 backtrace.c: remove uninitialized local variable declaration 2024-04-13 16:17:47 +09:00
leviongit 81bb520919 unify the code for filter methods (and speed up #reject!)
the worst case for `Array#reject!` (i.e. a proc always returning `true`)
is at least 5x worse than the worst case for `Array#select!` (proc
always returning `false`)

this commit unifies these implementations and inlines the (effective)
call of `#select!` in `#keep_if` and `#reject!` in `#delete_if`
2024-04-13 08:53:32 +02:00
leviongit bb78c2cbc9 reimplement Array#delete with a helper method 2024-04-13 07:41:00 +02:00
leviongit 312d49c59f reimplement Array#delete in ruby 2024-04-13 07:21:51 +02:00
leviongit c04afb9e99 revert moving Array#delete to c 2024-04-13 06:52:37 +02:00
leviongit d46e9a9480 fix shared array mistake 2024-04-12 18:12:51 +02:00
leviongit 14bd875d70 fix Array#delete
reimplement `Array#delete` in c, fixing `ary.delete(nil, &blk)` firing the block regardless of removal

minimal reproduction:
```rb
ary = [nil]
ret = ary.delete(nil) { "not deleted?" }
```
2024-04-12 17:30:03 +02:00
Yukihiro "Matz" Matsumoto f30e8240d2 array.c: adjust local variable declarations 2024-04-12 18:07:51 +09:00
Yukihiro "Matz" Matsumoto d761561be3 Merge pull request #6233 from dearblue/fiber-end-free
Free stack memory at end of fiber
2024-04-11 23:31:54 +09:00
Yukihiro "Matz" Matsumoto 1c021a5c3a hash.c (obj_eql): simplify the expression 2024-04-11 15:39:45 +09:00
Yukihiro "Matz" Matsumoto 492d8331e1 mruby-io/ext/io.h: reorder struct mrb_io to reduce the size; #6231
The `sizeof(struct mrb_io)` is reduced from 32 bytes to 24 bytes on
x86_64-linux.
2024-04-10 13:35:03 +09:00
Yukihiro "Matz" Matsumoto 0ad669eb80 Merge pull request #6231 from Asmod4n/add_close_fd_to_io
Add a way to let other gems handle closing of fds in mruby-io
2024-04-10 13:29:20 +09:00
Yukihiro "Matz" Matsumoto 6c4f5a34cc Revert "object.c (mrb_eql): avoid mrb_funcall_argv() when possible"
This reverts commit bc012deef9.
Ref #6168
2024-04-10 13:28:28 +09:00
dearblue f3b393272c Free stack memory at end of fiber
Immediately frees the call stack and data stack at the end of a non-root fiber.
If the env object needs to be detached, the data stack is reused through `mrb_realloc()`.

Previously, it was not necessary to take into account that `c->cibase` could be `NULL`.
Note that this is no longer the case due to this patch.
In fact, changes to "mruby-fiber" are now required.
2024-04-09 21:13:32 +09:00
Yukihiro "Matz" Matsumoto 7403cb57ac AUTHORS: update entries [ci skip]
From now on, we exclude merge commits (add `--no-merges` option to
`git shortlog` command in the counting script) to count contribution
fairly.
2024-04-09 08:03:50 +09:00
Yukihiro "Matz" Matsumoto 3ce5f3acbc Merge pull request #6232 from dearblue/free-env
Fold the code for freeing `env`
2024-04-08 23:37:24 +09:00
Yukihiro "Matz" Matsumoto 6eeb06795f Merge pull request #6230 from dearblue/fiber-err-switch
Fix status of fiber after switched by exception raised
2024-04-08 23:37:09 +09:00
Yukihiro "Matz" Matsumoto f3f7df0da0 vm.c: update ci after switching context
0614a1 removed too much `ci` updates, as @dearblue pointed out.
2024-04-08 08:38:23 +09:00
Asmod4n 96b5cd757d Add a way to let other gems handle closing of FDs 2024-04-07 13:46:11 +02:00
dearblue 1a9282914e Fold the code for freeing env
Also, `e->stack = NULL` is not needed.
This is because "use-after-free" can be detected with `MRB_DEBUG` + `MRB_GC_STRESS`.
2024-04-07 20:45:10 +09:00
dearblue 4956584ff1 Fix status of fiber after switched by exception raised
The state of a fiber switched due to an exception occurrence was incorrectly set to "Suspended".

```ruby
Fiber.new {
  begin
    Fiber.new { 0 / 0 }.resume
  rescue
    p Fiber.current
    # before  => #<Fiber:0x159f61e43ce0 fiber.rb:1 (suspended by resuming)>
    # after   => #<Fiber:0x159f61e43ce0 fiber.rb:1 (resumed)>
  end
}.resume
```
2024-04-07 20:08:12 +09:00
dearblue 307812ff20 Revert "env referred from top-level callinfo should not be unshared; fix #4019"
This reverts commit 72581696d3.

The #4012 that may have been the trigger for issue #4019 was later reverted by #4039 due to issue #4021.
2024-04-06 08:59:51 +09:00
Yukihiro "Matz" Matsumoto d503d9b113 Merge pull request #6229 from mruby/dependabot/bundler/rake-13.2.1
build(deps): bump rake from 13.2.0 to 13.2.1
2024-04-06 08:51:07 +09:00
dependabot[bot] b174ea5847 build(deps): bump rake from 13.2.0 to 13.2.1
Bumps [rake](https://github.com/ruby/rake) from 13.2.0 to 13.2.1.
- [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.0...v13.2.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-05 14:52:46 +00:00
Yukihiro "Matz" Matsumoto 47642f70cb Merge pull request #6227 from leviongit/array/shuffle_b
fix: `Array#shuffle(!)` result distribution
2024-04-05 08:33:04 +09:00