Yukihiro "Matz" Matsumoto
00339b3aa8
Merge pull request #5904 from dearblue/env-unshare-on-top-run
...
Call `mrb_env_unshare()` in `mrb_top_run()` if necessary
2023-01-10 18:22:43 +09:00
Yukihiro "Matz" Matsumoto
1bba8cf53b
mruby-dir: remove files needed for an independent gem
2023-01-10 10:53:15 +09:00
Yukihiro "Matz" Matsumoto
a800988239
mruby-set: remove files needed for an independent gem
2023-01-10 10:51:23 +09:00
dearblue
c101261f45
Call mrb_env_unshare() in mrb_top_run() if necessary
...
This is to keep the local variables of the previously created blocks consistent in case the `mrbc_context` passed to `mrb_load_exec()` is `NULL` or different.
Switching between `mrbc_context` pointers that are non `NULL` can be done safely by calling `mrbc_cleanup_local_variables()`.
Before this patch, the result of the following code is not as expected.
```console
% cat loadstr.c
#include <mruby.h>
#include <mruby/compile.h>
int
main(int argc, char *argv[])
{
mrb_state *mrb = mrb_open();
mrb_load_string(
mrb,
"(a, b, c, d, e, f, g) = [1, 2, 3, 4, 5, 6, 7] \n"
"$lambda = -> { p [a, b, c, d, e, f, g] }");
mrb_load_string(mrb, "$lambda.call");
mrb_close(mrb);
return 0;
}
% $(bin/mruby-config --cc --cflags --ldflags) loadstr.c $(bin/mruby-config --libs) && ./a.out
[main, nil, nil, main, nil, nil, main]
```
Also, since `mrb_env_unshare()` was not used before, the internal stack of simply detached `env` objects could show invalid addresses by `stack_extend()`.
ref. https://github.com/kou/mruby-pp/commit/ef5951aca870183d8767cb61f6414240988ca35e
2023-01-09 22:47:37 +09:00
Yukihiro "Matz" Matsumoto
e2ffcbab6e
mruby-io/io.c: cast return pointer from malloc/realloc for C++
2023-01-09 19:58:30 +09:00
Yukihiro "Matz" Matsumoto
8b7e240e67
mruby-io/io.c: improve code around io_cloexec_open()
2023-01-09 19:43:37 +09:00
Yukihiro "Matz" Matsumoto
91727f38de
mruby-io/io.c: change the implementation of read buffers
...
The original implementations used plain Ruby strings referenced from
instance variable (`@buf`) as buffers. We replaced those buffers by C
structure (`struct mrb_io_buf`) referenced directly from `fptr`.
The result is significant improvement of both performance and memory
consumption. Our simple benchmarks (reading `README.md` 10,000 times)
runs 5+ times faster, and `mrbtest` test suites consumes 85% less
memory.
Recent changes on `mruby-io` is preparation for this improvement.
2023-01-09 10:18:35 +09:00
Yukihiro "Matz" Matsumoto
6bc44f8aa8
Remove non-existent ISO section numbers suffixed with "(x)" [ci skip]
...
We don't know how we introduced these section references.
Weak memories.
2023-01-08 22:32:16 +09:00
Yukihiro "Matz" Matsumoto
29fa3d9950
AUTHORS: update entries [ci skip]
2023-01-08 16:56:13 +09:00
Yukihiro "Matz" Matsumoto
4462e3d8b3
string.c: add assertion for positive length
2023-01-08 16:36:20 +09:00
Yukihiro "Matz" Matsumoto
e45e57fe22
mruby-io: update ISO section numbers
2023-01-07 16:39:59 +09:00
Yukihiro "Matz" Matsumoto
6de5e00a6c
pre-commit-config.yaml: update
2023-01-07 16:39:46 +09:00
Yukihiro "Matz" Matsumoto
ad7802a3a0
Merge pull request #5901 from dearblue/doc/gem-block
...
Added tips for giving blocks to `MRuby::Build#gem`
2023-01-06 09:50:31 +09:00
Yukihiro "Matz" Matsumoto
e7052f78b7
Merge pull request #5900 from dearblue/doc/dup-allsyms
...
Remove duplicate entry `MRB_USE_ALL_SYMBOLS`
2023-01-06 09:49:37 +09:00
Yukihiro "Matz" Matsumoto
fadb39a096
mruby-io/io.c: remove unused method _bufread
2023-01-06 08:52:02 +09:00
Yukihiro "Matz" Matsumoto
412b1f0fb3
mruby-io/io.c: implement IO#readlines in C
2023-01-06 08:51:21 +09:00
Yukihiro "Matz" Matsumoto
7827808d3b
mruby-io/io.c: remove Ruby implementation of IO#gets
2023-01-05 23:54:46 +09:00
dearblue
9016acf54e
Added tips for giving blocks to MRuby::Build#gem
...
ref. #5860
2023-01-05 21:50:17 +09:00
dearblue
c5163fe29f
Remove duplicate entry MRB_USE_ALL_SYMBOLS
2023-01-05 21:50:17 +09:00
Yukihiro "Matz" Matsumoto
9797138aca
mruby-io/io.c: rename io_read_buf_noraise to io_read_buf
2023-01-05 19:50:17 +09:00
Yukihiro "Matz" Matsumoto
714cc254c0
mruby-io/io.c: remove unused function io_read_buf()
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
cd01f1173a
mruby-io/io.c: implement IO#gets in C
...
In addition, reimplement `IO#readline` using `IO#gets`.
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
b7147bbd8d
mruby-io/io.c: implement IO#getbyte in C
...
In addition, reimplement `IO#readbyte` using `IO#getbyte`.
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
eec546a9cf
mruby-io/io.c: implement IO#getc in C
...
In addition, reimplement `IO#readchar` using `IO#getc`.
2023-01-05 19:50:16 +09:00
Yukihiro "Matz" Matsumoto
6e7322a3fe
mruby-io/io.c (eof_error): a new function to raise EOFError exception
2023-01-05 19:50:15 +09:00
Yukihiro "Matz" Matsumoto
40039d93ab
mruby-io/io.c: implement IO#getline in C
2023-01-05 19:50:15 +09:00
Yukihiro "Matz" Matsumoto
a9c98ab855
mruby-io/io.c: implement IO#read in C
2023-01-05 19:50:15 +09:00
Yukihiro "Matz" Matsumoto
99dffb6daf
mruby-io/io.c: use RSTR_SET_LEN() instead of mrb_str_resize()
...
since the latter may shrink allocated buffer, and may cause repeated
allocations.
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
1bc0be3e43
mruby-io/io.c: implement IO#eof? in C
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
9e808512d5
mruby-io/io.c: remove duplicated initializations after io_alloc()
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
2b90937a2e
mruby-io/io.c: add ISO section comments
2023-01-05 19:50:14 +09:00
Yukihiro "Matz" Matsumoto
d57540118b
mruby-io/io.c: rename _common functions
2023-01-05 19:50:13 +09:00
Yukihiro "Matz" Matsumoto
64bf33adb4
Merge pull request #5899 from mruby/dependabot/github_actions/github/super-linter-4.10.0
...
build(deps): bump github/super-linter from 4.9.7 to 4.10.0
2023-01-05 09:15:06 +09:00
dependabot[bot]
fd57c5284b
build(deps): bump github/super-linter from 4.9.7 to 4.10.0
...
Bumps [github/super-linter](https://github.com/github/super-linter ) from 4.9.7 to 4.10.0.
- [Release notes](https://github.com/github/super-linter/releases )
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md )
- [Commits](https://github.com/github/super-linter/compare/v4.9.7...v4.10.0 )
---
updated-dependencies:
- dependency-name: github/super-linter
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2023-01-04 14:02:05 +00:00
Yukihiro "Matz" Matsumoto
51dca6eda8
mruby-io/io.c: rename receiver names from self to io in this file
2023-01-02 10:01:09 +09:00
Yukihiro "Matz" Matsumoto
0e25448a20
mruby-io/io.c (io_check_readable): hide internal method in backtraces
2023-01-02 10:01:08 +09:00
Yukihiro "Matz" Matsumoto
7cc6a720f3
mruby-io/io.c: implement IO#readchar in C
2023-01-02 10:01:08 +09:00
Yukihiro "Matz" Matsumoto
10a5edd978
mruby-io/io.c: implement IO#getbyte in C
2023-01-02 10:01:08 +09:00
Yukihiro "Matz" Matsumoto
a117095ca1
Merge pull request #5897 from dearblue/doc/MRB_HEAP_PAGE_SIZE
...
Added more description of the `MRB_HEAP_PAGE_SIZE` configuration
2023-01-02 10:00:30 +09:00
dearblue
4a39a9f1c4
Added more description of the MRB_HEAP_PAGE_SIZE configuration
2023-01-01 21:59:24 +09:00
Yukihiro "Matz" Matsumoto
170326cb41
Merge pull request #5896 from dearblue/dir-open
...
Avoid `IOError` when returning from `Dir.open`
2023-01-01 19:27:45 +09:00
dearblue
72ab1821de
Avoid IOError when returning from Dir.open
...
Ignore `IOError` if `Dir#close` was done in the block.
2023-01-01 17:40:50 +09:00
Yukihiro "Matz" Matsumoto
0c9798373a
mruby-io/io.c (fptr_finalize): close stdin/out/err as well
...
if not during the termination process.
2022-12-31 17:53:20 +09:00
Yukihiro "Matz" Matsumoto
965997d91b
mruby-io/io.c: implement IO#flush in C
2022-12-31 10:39:05 +09:00
Yukihiro "Matz" Matsumoto
0628669790
mruby-data/data.c (to_s): add class name in string representation
2022-12-31 07:51:09 +09:00
Yukihiro "Matz" Matsumoto
b79563af60
mruby-io/test: remove test for internal IO#_read_buf
2022-12-30 13:59:21 +09:00
Yukihiro "Matz" Matsumoto
a68b1200c2
mruby-io/test: test IO#ungetc
2022-12-30 13:59:01 +09:00
Yukihiro "Matz" Matsumoto
26f458baab
mruby-io/io.c: implement IO#ungetc in C
2022-12-30 13:59:01 +09:00
Yukihiro "Matz" Matsumoto
99a4c1f703
mruby-io/io.c (io_buf): protect @buf from modification
...
Users may re-assign `@buf` using `instance_variable_set` for example.
2022-12-30 13:59:00 +09:00
Yukihiro "Matz" Matsumoto
9a6a251460
mruby-io/io.c (io_bufread_m): remove unnecessary checks
2022-12-30 13:59:00 +09:00