Commit graph

8776 commits

Author SHA1 Message Date
BurdetteLamar
6324aaf3d0 [ruby/date] Enhanced RDoc
e80fee4f30
2022-07-05 04:12:43 +09:00
Jean Boussier
890df5f812 ObjectSpace.dump: Include string coderange
I suspect that some shared pages are invalidated because
some static string don't have their coderange set eagerly.

So the first time they are scanned, the entire memory page is
invalidated.

Being able to see the coderange in `ObjectSpace` would help debug
this.

And in addition `dump` currently call `is_broken_string()`  and `is_ascii_string()`
which both end up scanning the string and assigning coderange. I think it's
undesirable as `dump` should be read only.
2022-07-04 20:04:59 +02:00
BurdetteLamar
06f4ca503d [ruby/bigdecimal] Correct indentation in Kernel#BigDecimal
3ede8860a6
2022-07-02 07:58:20 +09:00
Nobuyoshi Nakada
302f353fd9 [ruby/stringio] Fix the result of StringIO#truncate so compatible with File
16847fea32
2022-07-01 00:52:29 +09:00
Nobuyoshi Nakada
50e13870bf [ruby/io-wait] Bump up
0fa6e3f7ba
2022-06-25 18:10:46 +09:00
Nobuyoshi Nakada
8c1d3c2dce [ruby/io-wait] Remove C99-ism for some platforms [ci skip]
Fix https://github.com/ruby/io-wait/pull/11

845f9a1f55
2022-06-25 18:09:11 +09:00
Samuel Williams
f9c8d80883 [ruby/io-wait] Don't add IO#wait* methods when RUBY_IO_WAIT_METHODS is defined by Ruby. (https://github.com/ruby/io-wait/pull/19)
* Fix return value compatibility with Ruby 2.x.

* Don't add `IO#wait*` methods in Ruby 3.2+.

54c504d089
2022-06-25 16:21:54 +09:00
Nobuyoshi Nakada
a0b24f5926 [ruby/io-wait] Remove redundant forward declarations
These were needed before prototype declarations were used.

35f016833a
2022-06-21 12:13:47 +09:00
Nobuyoshi Nakada
4aebbf44e9
Remove unnecessary * before the function name 2022-06-19 23:32:47 +09:00
Nobuyoshi Nakada
5f8c73405e [ruby/etc] [DOC] Markup constant path names
6c9a0b4e5d
2022-06-19 11:06:43 +09:00
Nobuyoshi Nakada
ea38758322 [ruby/etc] [DOC] Markup string literals
a8801e07d1
2022-06-19 10:46:50 +09:00
Nobuyoshi Nakada
cc67a11768 [ruby/etc] [DOC] Fix reference to different module
ea51739974
2022-06-19 10:46:48 +09:00
Nobuyoshi Nakada
c594370c6e [ruby/etc] [DOC] Update
System-dependent feature macros are automatically detected by
extconf.rb, and are not used by users.

e7343b4e69
2022-06-19 10:46:47 +09:00
Jean Boussier
b6c1e1158d GVL Instrumentation API: add STARTED and EXITED events
[Feature #18339]

After experimenting with the initial version of the API I figured there is a need
for an exit event to cleanup instrumentation data. e.g. if you record data in a
{thread_id -> data} table, you need to free associated data when a thread goes away.
2022-06-17 09:08:26 +02:00
John Hawthorn
17d260a87f Restore rb_exec_recursive_outer
This was a public method, so we should probably keep it.
2022-06-15 16:07:29 -07:00
Alan Wu
9357e310fb [ruby/psych] Fix libyaml download failure rescue under miniruby
I tried to build Ruby on a system without libyaml today and realized
that my attempt from <https://github.com/ruby/psych/pull/557> doesn't
fix the error in <https://github.com/ruby/psych/issues/552>. I still got
the same `LoadError` from `digest` which stopped the build.

Since `LoadError` is not a `StandardError`, a plain `rescue` doesn't catch
it. Catch `LoadError` explicitly instead and reduce the scope of the
`begin` block.

I tested this change in a Ruby build on macOS without libyaml installed
and confirmed that `make` continues with a warning instead of aborting:

    *** Following extensions are not compiled:
    psych:
            Could not be configured. It will not be installed.
            ...

This should address <https://bugs.ruby-lang.org/issues/18790>.

251289ba83
2022-06-15 01:05:51 +09:00
John Hawthorn
52da90acee Make method id explicit in rb_exec_recursive_outer
Previously, because opt_aref and opt_aset don't push a frame, when they
would call rb_hash to determine the hash value of the key, the initial
level of recursion would incorrectly use the method id at the top of the
stack instead of "hash".

This commit replaces rb_exec_recursive_outer with
rb_exec_recursive_outer_mid, which takes an explicit method id, so that
we can make the hash calculation behave consistently.

rb_exec_recursive_outer was documented as being internal, so I believe
this should be okay to change.
2022-06-10 14:48:21 -07:00
Jean Boussier
9125374726 [Feature #18339] GVL Instrumentation API
Ref: https://bugs.ruby-lang.org/issues/18339

Design:

- This tries to minimize the overhead when no hook is registered.
  It should only incur an extra unsynchronized boolean check.
- The hook list is protected with a read-write lock as to cause
  contention when some hooks are registered.
- The hooks MUST be thread safe, and MUST NOT call into Ruby as they
  are executed outside the GVL.
- It's simply a noop on Windows.

API:

```
rb_internal_thread_event_hook_t * rb_internal_thread_add_event_hook(rb_internal_thread_event_callback callback, rb_event_flag_t internal_event, void *user_data);
bool rb_internal_thread_remove_event_hook(rb_internal_thread_event_hook_t * hook);
```

You can subscribe to 3 events:

  - READY: called right before attempting to acquire the GVL
  - RESUMED: called right after successfully acquiring the GVL
  - SUSPENDED: called right after releasing the GVL.

The hooks MUST be threadsafe, as they are executed outside of the GVL, they also MUST NOT call any Ruby API.
2022-06-03 15:13:33 +02:00
Nobuyoshi Nakada
d142eff658 [ruby/nkf] Constified invariant tables
b386ddc11c
2022-06-03 20:25:12 +09:00
Nobuyoshi Nakada
7976142791 [ruby/stringio] Fix extracting encoding names in the fallback code
0fe2e0c1e5
2022-05-30 14:48:45 +09:00
Nobuyoshi Nakada
d3e986d9ab [ruby/stringio] Accept external and internal encodings pair
Fix https://github.com/ruby/stringio/pull/16

c8a69e80d2
2022-05-30 14:48:44 +09:00
Jeremy Evans
609d73e892 [ruby/stringio] Fix handling of chomp with paragraph separator
Try to mirror IO behavior, where chomp takes out the entire paragraph
separators between entries, but does not chomp a single line separator
at the end of the string.

Partially Fixes [Bug #18768]

a83ddbb7f0
2022-05-30 13:10:46 +09:00
Jeremy Evans
7e3920f0d9 [ruby/stringio] Update ext/stringio/stringio.c
1edc88587e

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-05-30 13:01:18 +09:00
Jeremy Evans
adaaf12857 [ruby/stringio] Ignore chomp keyword for nil separator
nil separator means no separator at all, so nothing should be
chomped.

Partial fix for Ruby [Bug #18770]

feaa2ec631
2022-05-30 13:01:17 +09:00
Jeremy Evans
1f82269f4e [ruby/stringio] Fix each with multiple character string and chomp
Previously, this could result in an infinite loop.  Always update
the e pointer in this case, setting w when chomping so the chomped
data is not included in the output.

Fixes [Bug #18769]

4bf64d5130
2022-05-30 12:55:47 +09:00
Nobuyoshi Nakada
bb6357cddd [ruby/stringio] Fix expanding size at ungetc/ungetbyte
a35268a3ac
2022-05-30 12:51:37 +09:00
Nobuyoshi Nakada
78785fb990 [ruby/date] Constify gperf-generated table
6d7ab08ffc
2022-05-24 17:23:42 +09:00
Hiroshi SHIBATA
bcc9451bbf
Merge JRuby implementation for stringio and io-wait 2022-05-20 18:45:14 +09:00
Hiroshi SHIBATA
c83ec3aba7
Merge https://github.com/ruby/pathname/pull/8 for pathname 2022-05-20 18:36:01 +09:00
Nobuyoshi Nakada
104fb83ccd
[ruby/io-nonblock] Remove unnecessary files from the gem
3850a4c7ac
2022-05-20 17:49:14 +09:00
Nobuyoshi Nakada
0dfd5d19f3
[ruby/io-nonblock] Rename io_nonblock_mode and extract set_fcntl_flags
22f08574df
2022-05-20 17:49:14 +09:00
Florian Frank
9245b28d34
[flori/json] Bump version to 2.6.2
5de358f655
2022-05-20 17:49:13 +09:00
Andrew Bromwich
a15d0e267a
[flori/json] Fix parser bug for empty string allocation
When `HAVE_RB_ENC_INTERNED_STR` is enabled it is possible to
pass through a null pointer to `rb_enc_interned_str` resulting
in a segfault

Fixes #495

b59368a8c2
2022-05-20 17:49:13 +09:00
Hiroshi SHIBATA
767f3904ee
[flori/json] Doc: Improve documentation on JSON#parse and JSON#parse!
75ada77b96

Co-authored-by: Bruno Gomes da Silva <brunojabs@gmail.com>
2022-05-20 17:49:13 +09:00
Hiroshi SHIBATA
6b6d7df39d
[ruby/psych] Prepare to develop 5.0.0
c3b5183f42
2022-05-18 10:03:48 +09:00
MSP-Greg
3ec066334c
[ruby/psych] [CI] Add/update 'rake install', update Psych version for Ruby 3.1 gem install
2fa5e190b5
2022-05-18 10:03:47 +09:00
MSP-Greg
40be4d4263 [ruby/psych] tr is typically 4 to 5 times faster than gsub
8533be8fe7
2022-05-10 03:20:34 +09:00
Hiroshi SHIBATA
a370eb5a63 [ruby/io-wait] bump up to 0.2.3
f59d1d12e0
2022-05-09 18:19:06 +09:00
Sutou Kouhei
30632efeaa [ruby/stringio] bump up to 3.0.3
64f225bf00
2022-05-09 16:47:28 +09:00
Sutou Kouhei
fbbe7ac7e3 [ruby/stringio] Bump version
b79152d08f
2022-05-09 16:36:01 +09:00
Alan Wu
f90549cd38 Rust YJIT
In December 2021, we opened an [issue] to solicit feedback regarding the
porting of the YJIT codebase from C99 to Rust. There were some
reservations, but this project was given the go ahead by Ruby core
developers and Matz. Since then, we have successfully completed the port
of YJIT to Rust.

The new Rust version of YJIT has reached parity with the C version, in
that it passes all the CRuby tests, is able to run all of the YJIT
benchmarks, and performs similarly to the C version (because it works
the same way and largely generates the same machine code). We've even
incorporated some design improvements, such as a more fine-grained
constant invalidation mechanism which we expect will make a big
difference in Ruby on Rails applications.

Because we want to be careful, YJIT is guarded behind a configure
option:

```shell
./configure --enable-yjit # Build YJIT in release mode
./configure --enable-yjit=dev # Build YJIT in dev/debug mode
```

By default, YJIT does not get compiled and cargo/rustc is not required.
If YJIT is built in dev mode, then `cargo` is used to fetch development
dependencies, but when building in release, `cargo` is not required,
only `rustc`. At the moment YJIT requires Rust 1.60.0 or newer.

The YJIT command-line options remain mostly unchanged, and more details
about the build process are documented in `doc/yjit/yjit.md`.

The CI tests have been updated and do not take any more resources than
before.

The development history of the Rust port is available at the following
commit for interested parties:
1fd9573d8b

Our hope is that Rust YJIT will be compiled and included as a part of
system packages and compiled binaries of the Ruby 3.2 release. We do not
anticipate any major problems as Rust is well supported on every
platform which YJIT supports, but to make sure that this process works
smoothly, we would like to reach out to those who take care of building
systems packages before the 3.2 release is shipped and resolve any
issues that may come up.

[issue]: https://bugs.ruby-lang.org/issues/18481

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
Co-authored-by: Noah Gibbs <the.codefolio.guy@gmail.com>
Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2022-04-27 11:00:22 -04:00
Kazuhiro NISHIYAMA
f4093c5c3b
io.nonblock returns the block's value [ci skip] 2022-04-26 00:17:32 +09:00
Tanaka Akira
671d90eca3 add description for IO.nonblock=. 2022-04-24 23:16:55 +09:00
Akinori MUSHA
cb02324c4e [ruby/pathname] Implement Pathname#lutime
268cb5acff
2022-04-21 17:10:19 +09:00
Peter Zhu
c69bdcf80c [ruby/bigdecimal] Fix docs
rdoc parses f[i] as a link, which results in a broken link.

a18522e9ca
2022-04-18 10:29:25 +09:00
Nobuyoshi Nakada
92361ad9c6 [ruby/bigdecimal] Adjust a local variable type to exponent
70146fb6ad
2022-04-18 10:29:23 +09:00
Nobuyoshi Nakada
be52c72889
Get rid of doubly caching 2022-04-17 18:57:26 +09:00
Nobuyoshi Nakada
2c6876f811
Get rid of magic numbers 2022-04-17 18:53:29 +09:00
Sutou Kouhei
2aca566a10 [ruby/stringio] bump up to 3.0.2.pre1
14ec9bc193
2022-04-16 06:34:31 +09:00
Peter Zhu
a0eb4b14d6 [ruby/nkf] Fix docs
rdoc parses "Z[0-3]" as a link to "0-3", this commit escapes these so
that they don't become links.

269c10061b
2022-04-15 16:07:11 +09:00