Skip to content

Commit 51ca415

Browse files
authored
Merge branch 'master' into zjit-assert-opcode-present
2 parents 50bcd67 + 0e0008d commit 51ca415

47 files changed

Lines changed: 1028 additions & 357 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/compilers/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ setup_launchable() {
7979
pushd ${srcdir}
8080
# To prevent a slowdown in CI, disable request retries when the Launchable server is unstable.
8181
export LAUNCHABLE_SKIP_TIMEOUT_RETRY=1
82+
export LAUNCHABLE_COMMIT_TIMEOUT=1
8283
# Launchable creates .launchable file in the current directory, but cannot a file to ${srcdir} directory.
8384
# As a workaround, we set LAUNCHABLE_SESSION_DIR to ${builddir}.
8485
export LAUNCHABLE_SESSION_DIR=${builddir}

.github/actions/launchable/setup/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ runs:
123123
echo "LAUNCHABLE_TOKEN=${{ inputs.launchable-token }}" >> $GITHUB_ENV
124124
: # To prevent a slowdown in CI, disable request retries when the Launchable server is unstable.
125125
echo "LAUNCHABLE_SKIP_TIMEOUT_RETRY=1" >> $GITHUB_ENV
126+
echo "LAUNCHABLE_COMMIT_TIMEOUT=1" >> $GITHUB_ENV
126127
if: steps.enable-launchable.outputs.enable-launchable
127128

128129
- name: Set up path

.github/workflows/windows.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ jobs:
2727
include:
2828
- os: 2022
2929
vc: 2019
30-
vcvars: '-vcvars_ver=14.2' # VS 2022 17.13.x is broken at windows-2022
30+
vcvars: '14.2' # VS 2022 17.13.x is broken at windows-2022
3131
test_task: check
3232
- os: 2025
3333
vc: 2019
34-
vcvars: '-vcvars_ver=14.2'
34+
vcvars: '14.2'
3535
test_task: check
3636
- os: 11-arm
3737
test_task: 'btest test-basic test-tool' # check and test-spec are broken yet.
3838
target: arm64
3939
- os: 2022
4040
vc: 2019
41-
vcvars: '-vcvars_ver=14.2'
41+
vcvars: '14.2'
4242
test_task: test-bundled-gems
4343
fail-fast: false
4444

@@ -96,7 +96,9 @@ jobs:
9696
run: |
9797
::- Set up VC ${{ matrix.vc }}
9898
set | uutils sort > old.env
99-
call ..\src\win32\vssetup.cmd -arch=${{ matrix.target || 'amd64' }} ${{ matrix.vcvars || '' }}
99+
call ..\src\win32\vssetup.cmd ^
100+
-arch=${{ matrix.target || 'amd64' }} ^
101+
${{ matrix.vcvars && '-vcvars_ver=' || '' }}${{ matrix.vcvars }}
100102
nmake -f nul
101103
set TMP=%USERPROFILE%\AppData\Local\Temp
102104
set TEMP=%USERPROFILE%\AppData\Local\Temp

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ The following bundled gems are updated.
135135
* net-smtp 0.5.1
136136
* rbs 3.9.4
137137
* base64 0.3.0
138-
* bigdecimal 3.2.1
138+
* bigdecimal 3.2.2
139139
* drb 2.2.3
140140
* syslog 0.3.0
141141
* csv 3.3.5

ext/socket/raddrinfo.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ addrinfo_memsize(const void *ptr)
12111211
static const rb_data_type_t addrinfo_type = {
12121212
"socket/addrinfo",
12131213
{addrinfo_mark, addrinfo_free, addrinfo_memsize,},
1214-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE,
1214+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE | RUBY_TYPED_WB_PROTECTED,
12151215
};
12161216

12171217
static VALUE
@@ -1249,7 +1249,7 @@ alloc_addrinfo(void)
12491249
}
12501250

12511251
static void
1252-
init_addrinfo(rb_addrinfo_t *rai, struct sockaddr *sa, socklen_t len,
1252+
init_addrinfo(VALUE self, rb_addrinfo_t *rai, struct sockaddr *sa, socklen_t len,
12531253
int pfamily, int socktype, int protocol,
12541254
VALUE canonname, VALUE inspectname)
12551255
{
@@ -1261,8 +1261,8 @@ init_addrinfo(rb_addrinfo_t *rai, struct sockaddr *sa, socklen_t len,
12611261
rai->pfamily = pfamily;
12621262
rai->socktype = socktype;
12631263
rai->protocol = protocol;
1264-
rai->canonname = canonname;
1265-
rai->inspectname = inspectname;
1264+
RB_OBJ_WRITE(self, &rai->canonname, canonname);
1265+
RB_OBJ_WRITE(self, &rai->inspectname, inspectname);
12661266
}
12671267

12681268
VALUE
@@ -1275,7 +1275,7 @@ rsock_addrinfo_new(struct sockaddr *addr, socklen_t len,
12751275

12761276
a = addrinfo_s_allocate(rb_cAddrinfo);
12771277
DATA_PTR(a) = rai = alloc_addrinfo();
1278-
init_addrinfo(rai, addr, len, family, socktype, protocol, canonname, inspectname);
1278+
init_addrinfo(a, rai, addr, len, family, socktype, protocol, canonname, inspectname);
12791279
return a;
12801280
}
12811281

@@ -1310,7 +1310,7 @@ call_getaddrinfo(VALUE node, VALUE service,
13101310
static VALUE make_inspectname(VALUE node, VALUE service, struct addrinfo *res);
13111311

13121312
static void
1313-
init_addrinfo_getaddrinfo(rb_addrinfo_t *rai, VALUE node, VALUE service,
1313+
init_addrinfo_getaddrinfo(VALUE self, rb_addrinfo_t *rai, VALUE node, VALUE service,
13141314
VALUE family, VALUE socktype, VALUE protocol, VALUE flags,
13151315
VALUE inspectnode, VALUE inspectservice)
13161316
{
@@ -1324,7 +1324,7 @@ init_addrinfo_getaddrinfo(rb_addrinfo_t *rai, VALUE node, VALUE service,
13241324
OBJ_FREEZE(canonname);
13251325
}
13261326

1327-
init_addrinfo(rai, res->ai->ai_addr, res->ai->ai_addrlen,
1327+
init_addrinfo(self, rai, res->ai->ai_addr, res->ai->ai_addrlen,
13281328
NUM2INT(family), NUM2INT(socktype), NUM2INT(protocol),
13291329
canonname, inspectname);
13301330

@@ -1436,7 +1436,7 @@ addrinfo_list_new(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE
14361436

14371437
#ifdef HAVE_TYPE_STRUCT_SOCKADDR_UN
14381438
static void
1439-
init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
1439+
init_unix_addrinfo(VALUE self, rb_addrinfo_t *rai, VALUE path, int socktype)
14401440
{
14411441
struct sockaddr_un un;
14421442
socklen_t len;
@@ -1452,7 +1452,7 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
14521452
memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
14531453

14541454
len = rsock_unix_sockaddr_len(path);
1455-
init_addrinfo(rai, (struct sockaddr *)&un, len,
1455+
init_addrinfo(self, rai, (struct sockaddr *)&un, len,
14561456
PF_UNIX, socktype, 0, Qnil, Qnil);
14571457
}
14581458

@@ -1556,7 +1556,7 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self)
15561556
flags |= AI_NUMERICSERV;
15571557
#endif
15581558

1559-
init_addrinfo_getaddrinfo(rai, numericnode, service,
1559+
init_addrinfo_getaddrinfo(self, rai, numericnode, service,
15601560
INT2NUM(i_pfamily ? i_pfamily : af), INT2NUM(i_socktype), INT2NUM(i_protocol),
15611561
INT2NUM(flags),
15621562
nodename, service);
@@ -1568,7 +1568,7 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self)
15681568
{
15691569
VALUE path = rb_ary_entry(sockaddr_ary, 1);
15701570
StringValue(path);
1571-
init_unix_addrinfo(rai, path, SOCK_STREAM);
1571+
init_unix_addrinfo(self, rai, path, SOCK_STREAM);
15721572
break;
15731573
}
15741574
#endif
@@ -1581,7 +1581,7 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self)
15811581
StringValue(sockaddr_arg);
15821582
sockaddr_ptr = (struct sockaddr *)RSTRING_PTR(sockaddr_arg);
15831583
sockaddr_len = RSTRING_SOCKLEN(sockaddr_arg);
1584-
init_addrinfo(rai, sockaddr_ptr, sockaddr_len,
1584+
init_addrinfo(self, rai, sockaddr_ptr, sockaddr_len,
15851585
i_pfamily, i_socktype, i_protocol,
15861586
canonname, inspectname);
15871587
}
@@ -2170,7 +2170,7 @@ addrinfo_mload(VALUE self, VALUE ary)
21702170
}
21712171

21722172
DATA_PTR(self) = rai = alloc_addrinfo();
2173-
init_addrinfo(rai, &ss.addr, len,
2173+
init_addrinfo(self, rai, &ss.addr, len,
21742174
pfamily, socktype, protocol,
21752175
canonname, inspectname);
21762176
return self;
@@ -2938,7 +2938,7 @@ addrinfo_s_unix(int argc, VALUE *argv, VALUE self)
29382938

29392939
addr = addrinfo_s_allocate(rb_cAddrinfo);
29402940
DATA_PTR(addr) = rai = alloc_addrinfo();
2941-
init_unix_addrinfo(rai, path, socktype);
2941+
init_unix_addrinfo(self, rai, path, socktype);
29422942
return addr;
29432943
}
29442944

ext/stringio/stringio.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ STRINGIO_VERSION = "3.1.8.dev";
3636
# define rb_class_new_instance_kw(argc, argv, klass, kw_splat) rb_class_new_instance(argc, argv, klass)
3737
#endif
3838

39+
static inline bool
40+
str_chilled_p(VALUE str)
41+
{
42+
#if (RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR >= 4) || RUBY_API_VERSION_MAJOR >= 4
43+
// Do not attempt to modify chilled strings on Ruby 3.4+
44+
// RUBY_FL_USER2 == STR_CHILLED_LITERAL
45+
// RUBY_FL_USER3 == STR_CHILLED_SYMBOL_TO_S
46+
return FL_TEST_RAW(str, RUBY_FL_USER2 | RUBY_FL_USER3);
47+
#else
48+
return false;
49+
#endif
50+
}
51+
3952
#ifndef HAVE_TYPE_RB_IO_MODE_T
4053
typedef int rb_io_mode_t;
4154
#endif
@@ -1865,14 +1878,7 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self)
18651878
}
18661879
}
18671880
ptr->enc = enc;
1868-
if (!NIL_P(ptr->string) && WRITABLE(self)
1869-
#if (RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR >= 4) || RUBY_API_VERSION_MAJOR >= 4
1870-
// Do not attempt to modify chilled strings on Ruby 3.4+
1871-
// RUBY_FL_USER2 == STR_CHILLED_LITERAL
1872-
// RUBY_FL_USER3 == STR_CHILLED_SYMBOL_TO_S
1873-
&& !FL_TEST_RAW(ptr->string, RUBY_FL_USER2 | RUBY_FL_USER3)
1874-
#endif
1875-
) {
1881+
if (!NIL_P(ptr->string) && WRITABLE(self) && !str_chilled_p(ptr->string)) {
18761882
rb_enc_associate(ptr->string, enc);
18771883
}
18781884

gc.c

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,6 @@ typedef struct gc_function_map {
666666
void (*undefine_finalizer)(void *objspace_ptr, VALUE obj);
667667
void (*copy_finalizer)(void *objspace_ptr, VALUE dest, VALUE obj);
668668
void (*shutdown_call_finalizer)(void *objspace_ptr);
669-
// Object ID
670-
VALUE (*object_id)(void *objspace_ptr, VALUE obj);
671-
VALUE (*object_id_to_ref)(void *objspace_ptr, VALUE object_id);
672669
// Forking
673670
void (*before_fork)(void *objspace_ptr);
674671
void (*after_fork)(void *objspace_ptr, rb_pid_t pid);
@@ -1892,16 +1889,35 @@ class_object_id(VALUE klass)
18921889
return id;
18931890
}
18941891

1892+
static inline VALUE
1893+
object_id_get(VALUE obj, shape_id_t shape_id)
1894+
{
1895+
VALUE id;
1896+
if (rb_shape_too_complex_p(shape_id)) {
1897+
id = rb_obj_field_get(obj, ROOT_TOO_COMPLEX_WITH_OBJ_ID);
1898+
}
1899+
else {
1900+
id = rb_obj_field_get(obj, rb_shape_object_id(shape_id));
1901+
}
1902+
1903+
#if RUBY_DEBUG
1904+
if (!(FIXNUM_P(id) || RB_TYPE_P(id, T_BIGNUM))) {
1905+
rb_p(obj);
1906+
rb_bug("Object's shape includes object_id, but it's missing %s", rb_obj_info(obj));
1907+
}
1908+
#endif
1909+
1910+
return id;
1911+
}
1912+
18951913
static VALUE
18961914
object_id0(VALUE obj)
18971915
{
18981916
VALUE id = Qfalse;
1917+
shape_id_t shape_id = RBASIC_SHAPE_ID(obj);
18991918

1900-
if (rb_shape_has_object_id(RBASIC_SHAPE_ID(obj))) {
1901-
shape_id_t object_id_shape_id = rb_shape_transition_object_id(obj);
1902-
id = rb_obj_field_get(obj, object_id_shape_id);
1903-
RUBY_ASSERT(id, "object_id missing");
1904-
return id;
1919+
if (rb_shape_has_object_id(shape_id)) {
1920+
return object_id_get(obj, shape_id);
19051921
}
19061922

19071923
// rb_shape_object_id_shape may lock if the current shape has
@@ -1910,6 +1926,10 @@ object_id0(VALUE obj)
19101926

19111927
id = generate_next_object_id();
19121928
rb_obj_field_set(obj, object_id_shape_id, id);
1929+
1930+
RUBY_ASSERT(RBASIC_SHAPE_ID(obj) == object_id_shape_id);
1931+
RUBY_ASSERT(rb_shape_obj_has_id(obj));
1932+
19131933
if (RB_UNLIKELY(id2ref_tbl)) {
19141934
st_insert(id2ref_tbl, (st_data_t)id, (st_data_t)obj);
19151935
}
@@ -2016,30 +2036,47 @@ obj_free_object_id(VALUE obj)
20162036
return;
20172037
}
20182038

2039+
#if RUBY_DEBUG
2040+
switch (BUILTIN_TYPE(obj)) {
2041+
case T_CLASS:
2042+
case T_MODULE:
2043+
break;
2044+
default:
2045+
if (rb_shape_obj_has_id(obj)) {
2046+
VALUE id = object_id_get(obj, RBASIC_SHAPE_ID(obj)); // Crash if missing
2047+
if (!(FIXNUM_P(id) || RB_TYPE_P(id, T_BIGNUM))) {
2048+
rb_p(obj);
2049+
rb_bug("Corrupted object_id");
2050+
}
2051+
}
2052+
break;
2053+
}
2054+
#endif
2055+
20192056
VALUE obj_id = 0;
20202057
if (RB_UNLIKELY(id2ref_tbl)) {
20212058
switch (BUILTIN_TYPE(obj)) {
20222059
case T_CLASS:
20232060
case T_MODULE:
2024-
if (RCLASS(obj)->object_id) {
2025-
obj_id = RCLASS(obj)->object_id;
2026-
}
2061+
obj_id = RCLASS(obj)->object_id;
20272062
break;
2028-
default:
2029-
if (rb_shape_obj_has_id(obj)) {
2030-
obj_id = object_id(obj);
2063+
default: {
2064+
shape_id_t shape_id = RBASIC_SHAPE_ID(obj);
2065+
if (rb_shape_has_object_id(shape_id)) {
2066+
obj_id = object_id_get(obj, shape_id);
20312067
}
20322068
break;
2069+
}
20332070
}
2034-
}
20352071

2036-
if (RB_UNLIKELY(obj_id)) {
2037-
RUBY_ASSERT(FIXNUM_P(obj_id) || RB_TYPE_P(obj, T_BIGNUM));
2072+
if (RB_UNLIKELY(obj_id)) {
2073+
RUBY_ASSERT(FIXNUM_P(obj_id) || RB_TYPE_P(obj_id, T_BIGNUM));
20382074

2039-
if (!st_delete(id2ref_tbl, (st_data_t *)&obj_id, NULL)) {
2040-
// If we're currently building the table then it's not a bug
2041-
if (id2ref_tbl_built) {
2042-
rb_bug("Object ID seen, but not in _id2ref table: object_id=%llu object=%s", NUM2ULL(obj_id), rb_obj_info(obj));
2075+
if (!st_delete(id2ref_tbl, (st_data_t *)&obj_id, NULL)) {
2076+
// If we're currently building the table then it's not a bug
2077+
if (id2ref_tbl_built) {
2078+
rb_bug("Object ID seen, but not in _id2ref table: object_id=%llu object=%s", NUM2ULL(obj_id), rb_obj_info(obj));
2079+
}
20432080
}
20442081
}
20452082
}
@@ -5163,11 +5200,6 @@ rb_memerror_reentered(void)
51635200
return (ec && rb_ec_raised_p(ec, RAISED_NOMEMORY));
51645201
}
51655202

5166-
void
5167-
rb_malloc_info_show_results(void)
5168-
{
5169-
}
5170-
51715203
static void *
51725204
handle_malloc_failure(void *ptr)
51735205
{

gems/bundled_gems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ racc 1.8.1 https://github.com/ruby/racc
2525
mutex_m 0.3.0 https://github.com/ruby/mutex_m
2626
getoptlong 0.2.1 https://github.com/ruby/getoptlong
2727
base64 0.3.0 https://github.com/ruby/base64
28-
bigdecimal 3.2.1 https://github.com/ruby/bigdecimal
28+
bigdecimal 3.2.2 https://github.com/ruby/bigdecimal
2929
observer 0.1.2 https://github.com/ruby/observer
3030
abbrev 0.1.2 https://github.com/ruby/abbrev
3131
resolv-replace 0.1.1 https://github.com/ruby/resolv-replace

lib/bundler/definition.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,17 +1037,16 @@ def converge_specs(specs)
10371037
lockfile_source = s.source
10381038

10391039
if dep
1040-
gemfile_source = dep.source || default_source
1040+
replacement_source = dep.source
10411041

1042-
deps << dep if !dep.source || lockfile_source.include?(dep.source) || new_deps.include?(dep)
1043-
1044-
# Replace the locked dependency's source with the equivalent source from the Gemfile
1045-
s.source = gemfile_source
1042+
deps << dep if !replacement_source || lockfile_source.include?(replacement_source) || new_deps.include?(dep)
10461043
else
1047-
# Replace the locked dependency's source with the default source, if the locked source is no longer in the Gemfile
1048-
s.source = default_source unless sources.get(lockfile_source)
1044+
replacement_source = sources.get(lockfile_source)
10491045
end
10501046

1047+
# Replace the locked dependency's source with the equivalent source from the Gemfile
1048+
s.source = replacement_source || default_source
1049+
10511050
source = s.source
10521051
next if @sources_to_unlock.include?(source.name)
10531052

0 commit comments

Comments
 (0)