Commit graph

8998 commits

Author SHA1 Message Date
Peter Zhu
68869e9bd9 Revert "Revert "Remove SHAPE_CAPACITY_CHANGE shapes""
This reverts commit 5f3fb4f4e3.
2023-11-13 18:26:36 -05:00
John Hawthorn
b41270842a Record more info from CALLCACHE in heap dumps
This records the called_id and klass from imemo_callcache objects in
heap dumps.
2023-11-13 15:03:11 -08:00
Jean Boussier
9ca41e9991 GVL Instrumentation: pass thread->self as part of event data
Context: https://github.com/ivoanjo/gvl-tracing/pull/4

Some hooks may want to collect data on a per thread basis.
Right now the only way to identify the concerned thread is to
use `rb_nativethread_self()` or similar, but even then because
of the thread cache or MaNy, two distinct Ruby threads may report
the same native thread id.

By passing `thread->self`, hooks can use it as a key to store
the metadata.

NB: Most hooks are executed outside the GVL, so such data collection
need to use a thread-safe data-structure, and shouldn't use the
reference in other ways from inside the hook.

They must also either pin that value or handle compaction.
2023-11-13 08:45:20 +01:00
Peter Zhu
5f3fb4f4e3 Revert "Remove SHAPE_CAPACITY_CHANGE shapes"
This reverts commit f6910a6112.

We're seeing crashes in the test suite of Shopify's core monolith after
this change.
2023-11-10 11:27:49 -05:00
Nobuyoshi Nakada
cdd6127c82 [ruby/io-console] bump up to 0.6.1.dev.1
057ab96a73
2023-11-10 19:00:50 +09:00
Nobuyoshi Nakada
83064592a6 [ruby/io-console] Include FFI version version.rb
b0c688c57e
2023-11-10 19:00:48 +09:00
Nobuyoshi Nakada
f08400a07a [ruby/io-console] Define IO::ConsoleMode::VERSION from gemspec
ebdbebf461
2023-11-10 19:00:46 +09:00
Nobuyoshi Nakada
5309e3c406 [ruby/io-console] Update file list in gemspec
0bfde8372c
2023-11-10 19:00:45 +09:00
Peter Zhu
f6910a6112 Remove SHAPE_CAPACITY_CHANGE shapes
We don't need to create a shape to transition capacity as we can
transition the capacity when the capacity of the SHAPE_IVAR changes.
2023-11-09 09:25:02 -05:00
Nobuyoshi Nakada
195a09cc7f [ruby/digest] Suppress implicit cast down warnings
2f3505bf3f
2023-11-09 07:20:00 +00:00
Sutou Kouhei
8cd6c65af1 [ruby/stringio] Development of 3.1.0 started.
a2f8ef1a6a
2023-11-08 07:04:15 +00:00
Sutou Kouhei
7ed37388fb [ruby/stringio] Add missing row separator encoding conversion
(https://github.com/ruby/stringio/pull/69)

The conversion logic is borrowed from ruby/ruby's io.c:
40391faeab/io.c (L4059-L4079)

Fix ruby/stringio#68

Reported by IWAMOTO Kouichi. Thanks!!!

4b170c1a68
2023-11-08 00:46:17 +00:00
Sutou Kouhei
ce8301084f [ruby/strscan] Bump version
1b3393be05
2023-11-08 09:26:58 +09:00
Sutou Kouhei
9c2e0d49fe [ruby/fiddle] Remove garbage
bbcb66e16e
2023-11-08 09:25:45 +09:00
Sutou Kouhei
c19ea1066a [ruby/fiddle] Include stdbool.h explicitly for old Ruby
74a05fb358
2023-11-08 09:25:45 +09:00
Sutou Kouhei
2a6d6d3d65 [ruby/fiddle] Use Ruby's true/false for C bool
GitHub: fix https://github.com/ruby/fiddle/pull/130

Reported by Benoit Daloze. Thanks!!!

2640e0148e
2023-11-08 09:25:44 +09:00
BurdetteLamar
d12e881009
[flori/json] Enhanced RDoc for Range extensions
ec47749b53
2023-11-08 09:04:28 +09:00
Nobuyoshi Nakada
1910bd4247
String for string literal is not resizable 2023-11-08 00:59:45 +09:00
Jean Boussier
ced84beb25 [ruby/cgi] Add snake case aliases for escapeURIComponent
As agreed in [Feature #18822]

9d1161ec9d
2023-11-07 10:22:30 +00:00
Hiroshi SHIBATA
3d5fef7712 [ruby/zlib] Bump up 3.1.0
2561e122ac
2023-11-07 08:50:40 +00:00
Hiroshi SHIBATA
79544157e4 [ruby/zlib] Support Ruby 2.5+ again
661ea3ec5f
2023-11-07 08:47:03 +00:00
Hiroshi SHIBATA
fbb63605c4 [ruby/pathname] Bump up 0.3.0
f3d23679b0
2023-11-07 07:55:13 +00:00
Hiroshi SHIBATA
d63c29ceca [ruby/fcntl] Bump up 1.1.0
fe780abe07
2023-11-07 06:55:45 +00:00
Hiroshi SHIBATA
eaf0ca4cfe [ruby/win32ole] Bump up 1.8.10
9a18f388a9
2023-11-07 05:52:50 +00:00
Tim Kretschmer
e584a619e1 [ruby/bigdecimal] fixed docs for .scale
the scale of `1` is actually 0

9a8bc9c417
2023-11-07 05:35:18 +00:00
Koichi ITO
f0abe610a3 [ruby/bigdecimal] Update doc for bigdecimal/util
Follow up https://github.com/ruby/bigdecimal/issues/89.

`BigDecimal.new` has already been removed. This PR replaces `BigDecimal.new` with
`Kernel.BigDecimal` in the documentation, following the message below:

> BigDecimal.new is deprecated; use Kernel.BigDecimal method instead.

26d84ba766

dd52adf3b2
2023-11-07 05:32:49 +00:00
Hiroshi SHIBATA
da2cf947bc [ruby/date] Bump up 3.3.4
50e18d2684
2023-11-07 04:16:02 +00:00
Yusuke Endoh
49b6dc8f07 Prevent cpu_set_t overflow even if there are more than 63 cores
Do not use `pthread_attr_setaffinity_np` if `sched_getcpu()` exceeds
`CPU_SETSIZE`. (Using `CPU_ALLOC()` would be more appropriate.)
2023-11-07 04:39:09 +09:00
Yusuke Endoh
deb6dd76e1 Fix a memory leak
pointed by @nobu
2023-11-07 04:39:09 +09:00
Yusuke Endoh
dc636fec2a Use pthread_attr_setaffinity_np instead of pthread_setaffinity_np 2023-11-07 04:39:09 +09:00
Yusuke Endoh
d0066211f2 Detach a pthread after pthread_setaffinity_np
After a pthread for getaddrinfo is detached, we cannot predict when the
thread will exit. It would lead to a segfault by setting
pthread_setaffinity to the terminated pthread.  I guess this problem
would be more likely to occur in high-load environments.

This change detaches the pthread after pthread_setaffinity is called.
[Feature #19965]
2023-11-07 04:39:09 +09:00
Yusuke Endoh
15560cce5f Revert "Do not use pthread_setaffinity_np on s390x"
This reverts commit de82439215.
2023-11-07 04:39:09 +09:00
Nobuyoshi Nakada
40391faeab [ruby/etc] Fix inconsistent dll linkage warning
e4c71e5996
2023-11-05 11:50:07 +00:00
Nobuyoshi Nakada
79d0879536 [ruby/stringio] Make STRINGIO_VERSION uniform
4400bf3380
2023-11-04 19:28:49 +09:00
Nobuyoshi Nakada
b30783e02e [ruby/stringio] Move Java version to Java directory
3f90a0d619
2023-11-04 19:28:39 +09:00
Peter Zhu
38ba040d8b Make every initial size pool shape a root shape
This commit makes every initial size pool shape a root shape and assigns
it a capacity of 0.
2023-11-02 13:42:11 -04:00
Daisuke Aritomo
4adf418be9 [Feature #10602] Add new API rb_profile_thread_frames()
Add a new API rb_profile_thread_frames(), which is essentialy a
per-thread version of rb_profile_frames().

While the original rb_profile_frames() always returns results about the
current active thread obtained by GET_EC(), this new API takes a Thread
to be profiled as an argument.

This should come in handy when profiling I/O-bound programs such as
webapps, since this new API allows us to learn about Threads performing
I/O (which do not have the GVL).

Profiling worker threads (such as Sidekiq workers) may be another
application.

Implements [Feature #10602]

Co-authored-by: Mike Perham <mike@perham.net>
2023-10-31 11:16:18 +09:00
Nobuyoshi Nakada
88f1d380ea [ruby/etc] Start 1.4.3
a9e4d4730d
2023-10-29 07:15:24 +00:00
KJ Tsanaktsidis
e74ea904ad [ruby/zlib] Check for z_size_t along with {crc,adler}32_z in
extconf.rb
(https://github.com/ruby/zlib/pull/69)

The android NDK (android-ndk-r21e) does not have crc32_z, adler32_z, nor
z_size_t in its zlib.h header file. However, it _does_ have the crc32_z
and adler32_z symbols in the libz.a static library!

mkmf performs two tests for have_func:
* It sees if a program that includes the header and takes the address of
  the symbol can compile
* It sees if a program that defines the symbol as `extern void sym_name()`
  and calls it can be linked

If either test works, it considers the function present. The
android-ndk-r21e is passing the second test but not the first for
crc32_z/adler32_z. So, we define HAVE_ZLIB_SIZE_T_FUNCS, but then can't
actually compile the extension (since the prototypes aren't in the
header file).

We can keep this working how it was working before by _also_ checking
for `have_type("z_size_t", "zlib.h")`. The have_type check _only_ looks
in the header file for the type; if a program including the header file
and using the type can't compile, the type is considered absent
regardless of what might be in libz.a.

3b9fe962d8
2023-10-26 09:56:21 +00:00
KJ Tsanaktsidis
ac4d687656 [ruby/zlib] Fix misdetection of {crc32,alder32}_z in cloudflare zlib fork
We use the Cloudflare fork of zlib
(https://github.com/cloudflare/zlib), which we find gives improved
performance on AWS Graviton ARM instances. That fork does not define
crc32_z and alder32_z functions.

Until two days ago, Ruby's zlib gem worked fine, because cloudflare zlib
_also_ did not define z_size_t, which meant Ruby did not try and use
these functions.

Since a3ba99596d
however, cloudflare zlib _does_ define z_size_t (but NOT crc32_z or
alder32_z). The zlib gem would try and use these nonexistant
functions and not compile.

This patch fixes it by actually specifically detecting the functions
that the gem wants to call, rather than just the presence of the
z_size_t type.

c96e8b9a57
2023-10-26 02:17:54 +00:00
Yusuke Endoh
de82439215 Do not use pthread_setaffinity_np on s390x
Looks like it randomly causes a segfault

20231025T093302Z.fail.html.gz
```
[11186/26148] TestNetHTTP_v1_2#test_set_form/home/chkbuild/build/20231025T093302Z/ruby/tool/lib/webrick/httprequest.rb:197: [BUG] Segmentation fault at 0x000003ff1ffff000
ruby 3.3.0dev (2023-10-25T07:50:00Z master 526292d9fe) [s390x-linux]
```
2023-10-25 20:04:18 +09:00
Yusuke Endoh
25c1204fe7 rb_getaddrinfo should return EAI_AGAIN instead of EAGAIN 2023-10-24 12:22:53 +09:00
Yusuke Endoh
c08020254e Indent critical regions with blocks
Cosmetic change per ko1's preference
2023-10-24 12:22:53 +09:00
Yusuke Endoh
acd774263c Do not use pthread on mingw 2023-10-24 12:22:53 +09:00
Yusuke Endoh
16d6a22757 Make rb_getnameinfo interruptible
Same as previous commit for rb_getnameinfo.
2023-10-24 12:22:53 +09:00
Yusuke Endoh
3dc311bdc8 Make rb_getaddrinfo interruptible
When pthread_create is available, rb_getaddrinfo creates a pthread and
executes getaddrinfo(3) in it. The caller thread waits for the pthread
to complete, but detaches it if interrupted. This allows name resolution
to be interuppted by Timeout.timeout, etc. even if it takes a long time
(for example, when the DNS server does not respond).  [Feature #19965]
2023-10-24 12:22:53 +09:00
Yusuke Endoh
efd58f19ea Expand macro branches to make them plain 2023-10-24 12:22:53 +09:00
Yusuke Endoh
25ef8d262a Refactor GETADDRINFO_IMPL instead of GETADDRINFO_EMU
This is a preparation for introducing cancellable
getaddrinfo/getnameinfo.
2023-10-24 12:22:53 +09:00
Yusuke Endoh
9ce607a8d4 refactor a call to getaddrinfo 2023-10-24 12:22:53 +09:00
Samuel Williams
30f5a2bbcd [ruby/io-nonblock] Don't define nonblock methods if they are defined by core.
5d3991859c
2023-10-23 22:53:00 +00:00