Yukihiro "Matz" Matsumoto
97b522d778
src/fmt_fp.c: change condition order for memory safety
2023-12-22 15:35:21 +09:00
Yukihiro "Matz" Matsumoto
cfee5c2753
doc/guides/memory.md: guide to memory management customization
2023-12-21 16:48:33 +09:00
Yukihiro "Matz" Matsumoto
28b526cf81
Update .pre-commit-config.yaml
2023-12-21 16:47:16 +09:00
Yukihiro "Matz" Matsumoto
34c5d96e86
allof.c: mrb_default_allocf() definition in the separate file
...
So that the user can define their own version of mrb_default_alloc
function to override memory allocation of mruby.
2023-12-21 15:28:04 +09:00
Yukihiro "Matz" Matsumoto
899a09152b
mruby.h (mrb_alloc): better description for the function type
2023-12-20 19:39:09 +09:00
Yukihiro "Matz" Matsumoto
72ca266ed7
mruby-io: rename some functions with io_buf prefix
...
Now all functions with `io_buf` takes `mrb_io_buf` as an argument.
Renamed functions (old names):
- io_init_buf (io_buf_init)
- io_fill_buf (io_buf_fill)
- io_fill_buf_comp (io_buf_fill_comp) for UTF-8 encoding
2023-12-20 08:59:46 +09:00
Yukihiro "Matz" Matsumoto
84fb9f40f0
mruby-io: some functions take mrb_io_buf as an argument
...
- io_buf_reset
- io_buf_shift
- io_buf_cat
- io_buf_cat_all
2023-12-20 08:59:46 +09:00
Yukihiro "Matz" Matsumoto
054f5b5284
mruby-io (io_eof): avoid unnecessary read(2) call
2023-12-20 08:59:46 +09:00
Yukihiro "Matz" Matsumoto
2e8bede6ea
mruby-io (io_read): small refactoring; ref #6118
...
If `outbuf` is `nil` we allocate a buffer string, if `outbuf` is a
string, we resize it to zero length. In the function `io_read`, this
condition is done twice, so we refactor out to `io_reset_outbuf()`.
2023-12-20 08:59:46 +09:00
Yukihiro "Matz" Matsumoto
2e24c94873
Merge pull request #6120 from dearblue/file-EBADF
...
Set `EBADF` if `check_file_descriptor()` fails
2023-12-20 08:59:29 +09:00
Yukihiro "Matz" Matsumoto
82ed1c2600
Merge pull request #6118 from dearblue/io.read
...
Fixed `IO#read` with `buf`.
2023-12-19 08:00:42 +09:00
Yukihiro "Matz" Matsumoto
992bd49344
Merge pull request #6116 from dearblue/send-branch
...
Improve branching in the execution part of the `OP_SEND` block
2023-12-18 12:17:39 +09:00
Yukihiro "Matz" Matsumoto
e8a36235d8
Merge pull request #6115 from dearblue/loop-inclusion
...
Replace `for` and `CHECKPOINT` block comprehensions
2023-12-18 12:16:38 +09:00
dearblue
5e3e75ed7b
Set EBADF if check_file_descriptor() fails
2023-12-17 10:50:59 +09:00
Yukihiro "Matz" Matsumoto
b20418cf78
Merge pull request #6119 from jbampton/fix-spelling
...
docs: fix spelling
2023-12-17 07:14:17 +09:00
John Bampton
4c79fce665
docs: fix spelling
2023-12-17 00:58:24 +10:00
dearblue
7611dc8338
Fixed IO#read with buf.
...
I hit the following two problems.
- `io.read(0, buf)` always returned a new empty string object.
- `io.read(num, buf)` was appending data to the given `buf`.
This also meant that `buf` was never empty if EOF was reached.
2023-12-16 14:42:52 +09:00
Yukihiro "Matz" Matsumoto
d14a269f49
Merge pull request #6114 from dearblue/integrate-catch
...
Move `L_RAISE` and `L_BREAK` blocks to `OP_RAISEIF`
2023-12-16 13:08:33 +09:00
Yukihiro "Matz" Matsumoto
ecea3f2531
Merge pull request #6117 from mruby/dependabot/github_actions/actions/upload-artifact-4
...
build(deps): bump actions/upload-artifact from 3 to 4
2023-12-16 13:05:38 +09:00
Yukihiro "Matz" Matsumoto
6fad067ded
mruby-binding: raise in upper count check
...
We count `Proc` upper links then check for upper bounds (default:20),
but now we raise an exception as soon as the count exceeds the limit so
that we can avoid traverse unnecessary upper links.
2023-12-16 12:21:55 +09:00
dependabot[bot]
1b7f2fb175
build(deps): bump actions/upload-artifact from 3 to 4
...
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact ) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases )
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4 )
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2023-12-15 14:22:12 +00:00
dearblue
990e18ad59
Improve branching in the execution part of the OP_SEND block
...
The `MRB_METHOD_CFUNC_P()` macro contains several branches, which will be replaced by simple branches.
2023-12-15 21:46:00 +09:00
dearblue
7144eab350
Replace for and CHECKPOINT block comprehensions
...
I think it will make the eyes less tired for a process flow.
2023-12-15 21:46:00 +09:00
dearblue
e9904ddb2a
Move L_RAISE and L_BREAK blocks to OP_RAISEIF
...
`OP_RAISEIF` should be easier to relate than `OP_RETURN`.
2023-12-15 21:46:00 +09:00
Yukihiro "Matz" Matsumoto
24eca2e50b
mruby-fiber (fiber_to_s): omit position info for terminated fibers
...
Since Fiber#to_s did not include location information before #6105 ,
when location information cannot be retrieved for terminated fibers,
instead of meaningless information such as "(unknown):0", we omit
positional information altogether for terminated fibers; ref #6111
2023-12-14 18:56:19 +09:00
Yukihiro "Matz" Matsumoto
e9237f444a
Merge pull request #6111 from dearblue/fiber-to_s.1
...
Consider proc to be GC'ed if fiber is terminated
2023-12-14 14:59:18 +09:00
Yukihiro "Matz" Matsumoto
5311d1aa1b
Merge pull request #6106 from dearblue/fiber-limits-ease
...
Ease fiber limitations
2023-12-13 16:10:42 +09:00
Yukihiro "Matz" Matsumoto
ae8dcb82ba
vm.c: CINFO_SKIP should not be called with prev_jmp == NULL
...
We have added assertion to ensure.
2023-12-12 16:49:11 +09:00
Yukihiro "Matz" Matsumoto
89d4e8c851
Merge pull request #6113 from dearblue/unreachable
...
Remove unreachable code in `OP_R_BREAK`
2023-12-12 16:48:55 +09:00
dearblue
38c7936c94
Remove unreachable code in OP_R_BREAK
...
Termination of fiber by `break` results in a `LocalJumpError`, so the indicated code will not be executed.
2023-12-11 21:25:08 +09:00
Yukihiro "Matz" Matsumoto
93d842e045
Merge pull request #6112 from dearblue/labeler
...
Update labeler.yml for version 5
2023-12-10 20:01:17 +09:00
dearblue
c0b5bc4ae8
Consider proc to be GC'ed if fiber is terminated
...
When fiber is terminated, the pointer indicated by `f->cxt->cibase->proc` is not protected from GC.
I should have done this patch way as of commit 9af6264d6b (#6105 ).
2023-12-09 22:28:47 +09:00
dearblue
88571052e8
Update labeler.yml for version 5
2023-12-09 17:28:13 +09:00
Yukihiro "Matz" Matsumoto
34346e75a4
Merge pull request #6103 from dearblue/RBreak-ci
...
RBreak remembers the CI location
2023-12-09 11:35:23 +09:00
Yukihiro "Matz" Matsumoto
645a464b2d
mruby-fiber (fiber_to_s): retrieve position from terminated fibers; #6105
...
Since `cxt->ci` points to the last active callinfo, `cxt->ci == cxt->cibase`
does not mean it does not have correct `proc` information, so we have
removed the `f->cxt->ci > f->cxt->cibase` check. Instead, just in case
`proc` does not have `irep` information, we try to confirm `proc` does not
point to `CFUNC` nor is not an alias.
2023-12-08 09:33:05 +09:00
Yukihiro "Matz" Matsumoto
fdea7924fe
mruby-fiber (fiber_to_s): do not rely on mrb_any_to_s(); ref #6105
2023-12-08 09:25:46 +09:00
Yukihiro "Matz" Matsumoto
b7949e81d7
mruby-fiber (fiber_to_s): use "(unknown):0" for unknown position
...
Ref #6105
2023-12-08 09:22:59 +09:00
Yukihiro "Matz" Matsumoto
cb54138b81
Merge pull request #6105 from dearblue/fiber.to_s
...
Implement `Fiber#to_s` method
2023-12-08 09:00:05 +09:00
dearblue
73c8330cbd
RBreak remembers the CI location
...
It is now possible to specify return destination directly.
This allows callinfo to distinguish between calls to the same proc object.
At the same time, the `Kernel#catch` method is adjusted.
By removing the previously required double lambda object, the REnv object is no longer created as well.
2023-12-07 21:33:14 +09:00
Yukihiro "Matz" Matsumoto
658d5a51ac
mruby-string-ext: add test for String#valid_encoding?
2023-12-07 11:34:10 +09:00
Yukihiro "Matz" Matsumoto
eabe2d96e2
mruby-string-ext: add String#valid_encoding? method
2023-12-07 10:58:20 +09:00
Yukihiro "Matz" Matsumoto
bef7eea468
mruby-method: small refactoring mostly regarding declarations
2023-12-06 22:20:38 +09:00
Yukihiro "Matz" Matsumoto
b01eb03d2a
Merge pull request #6110 from mruby/dependabot/github_actions/actions/labeler-5
...
build(deps): bump actions/labeler from 4 to 5
2023-12-06 15:58:59 +09:00
Yukihiro "Matz" Matsumoto
fab3dfc145
Merge pull request #6107 from mruby/dependabot/github_actions/super-linter/super-linter-5.7.2
...
build(deps): bump super-linter/super-linter from 5.7.0 to 5.7.2
2023-12-06 15:58:47 +09:00
Yukihiro "Matz" Matsumoto
5a258f0872
Merge pull request #6109 from dearblue/fix-6108
...
Needs `cipop()` before crossing the C boundary
2023-12-06 15:57:16 +09:00
Yukihiro "Matz" Matsumoto
abd26b7ca6
mruby-bin-mrbc/mrbc.c: replace mrbc_ prefix by mrb_ccontext
...
This is a most confusion file because it contained both `mrbc_` from
"mruby compiler" (e.g. mrbc_args) and `mrbc_` from "mruby compiler
context".
2023-12-06 15:54:33 +09:00
Yukihiro "Matz" Matsumoto
7be67d3acf
mruby-bin-mirb: replace mrbc_ prefix by mrb_ccontext
2023-12-06 15:51:20 +09:00
Yukihiro "Matz" Matsumoto
72689b0b9c
mruby-eval: replace mrbc_ prefix by mrb_ccontext
2023-12-06 15:49:21 +09:00
Yukihiro "Matz" Matsumoto
7e74dbeed3
mruby-bin-mruby: replace mrbc_ prefix by mrb_ccontext
2023-12-06 15:45:01 +09:00
Yukihiro "Matz" Matsumoto
c36b212fa9
mruby-bin-debugger: replace mrbc_ prefix by mrb_ccontext
2023-12-06 15:41:15 +09:00