Skip to content

Commit 6467593

Browse files
authored
Merge branch 'master' into zjit-framestate-getlocal
2 parents 937c795 + 55892f5 commit 6467593

143 files changed

Lines changed: 3311 additions & 836 deletions

File tree

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/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: >-
55
inputs:
66
tag:
77
required: false
8-
default: clang-18
8+
default: clang-20
99
description: >-
1010
container image tag to use in this run.
1111

.github/workflows/compilers.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ jobs:
109109
- { uses: './.github/actions/compilers', name: 'clang 21', with: { tag: 'clang-21' } }
110110
- { uses: './.github/actions/compilers', name: 'clang 20', with: { tag: 'clang-20' } }
111111
- { uses: './.github/actions/compilers', name: 'clang 19', with: { tag: 'clang-19' } }
112-
- { uses: './.github/actions/compilers', name: 'clang 18', with: { tag: 'clang-18' } }
112+
# clang-18 has a bug causing ruby_current_ec to sometimes be null
113+
# - { uses: './.github/actions/compilers', name: 'clang 18', with: { tag: 'clang-18' } }
113114
- { uses: './.github/actions/compilers', name: 'clang 17', with: { tag: 'clang-17' } }
114115
- { uses: './.github/actions/compilers', name: 'clang 16', with: { tag: 'clang-16' } }
115116
- { uses: './.github/actions/compilers', name: 'clang 15', with: { tag: 'clang-15' } }

.github/workflows/macos.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
os: macos-14
4646
- test_task: check
4747
os: macos-15
48-
extra_checks: [capi]
4948
fail-fast: false
5049

5150
env:

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
8282
iwr -useb get.scoop.sh | iex
8383
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
84-
scoop install vcpkg uutils-coreutils cmake@3.31.6
84+
scoop install vcpkg uutils-coreutils
8585
shell: pwsh
8686

8787
- name: Restore vcpkg artifact

bootstraptest/test_ractor.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,3 +2350,23 @@ def call_test(obj)
23502350
end
23512351
:ok
23522352
RUBY
2353+
2354+
assert_equal 'ok', <<~'RUBY'
2355+
begin
2356+
100.times do |i|
2357+
Ractor.new(i) do |j|
2358+
1000.times do |i|
2359+
"#{j}-#{i}"
2360+
end
2361+
Ractor.receive
2362+
end
2363+
pid = fork { }
2364+
_, status = Process.waitpid2 pid
2365+
raise unless status.success?
2366+
end
2367+
2368+
:ok
2369+
rescue NotImplementedError
2370+
:ok
2371+
end
2372+
RUBY

box.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,17 +1047,16 @@ rb_f_dump_classext(VALUE recv, VALUE klass)
10471047
/*
10481048
* Document-class: Ruby::Box
10491049
*
1050-
* Ruby::Box is designed to provide separated spaces in a Ruby
1051-
* process, to isolate applications and libraries.
1052-
* See {Ruby::Box}[rdoc-ref:box.md].
1050+
* :markup: markdown
1051+
* :include: doc/_box.md
10531052
*/
10541053
void
10551054
Init_Box(void)
10561055
{
10571056
tmp_dir = system_tmpdir();
10581057
tmp_dir_has_dirsep = (strcmp(tmp_dir + (strlen(tmp_dir) - strlen(DIRSEP)), DIRSEP) == 0);
10591058

1060-
VALUE mRuby = rb_path2class("Ruby");
1059+
VALUE mRuby = rb_define_module("Ruby");
10611060

10621061
rb_cBox = rb_define_class_under(mRuby, "Box", rb_cModule);
10631062
rb_define_method(rb_cBox, "initialize", box_initialize, 0);

class.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ rb_class_set_box_classext(VALUE obj, const rb_box_t *box, rb_classext_t *ext)
183183
};
184184

185185
st_update(RCLASS_CLASSEXT_TBL(obj), (st_data_t)box->box_object, rb_class_set_box_classext_update, (st_data_t)&args);
186+
187+
// FIXME: This is done here because this is the first time the objects in
188+
// the classext are exposed via this class. It's likely that if GC
189+
// compaction occurred between the VALUEs being copied in and this
190+
// writebarrier trigger the values will be stale.
191+
rb_gc_writebarrier_remember(obj);
186192
}
187193

188194
RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state;

common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ RUN_OPTS = --disable-gems
4646

4747
GIT_IN_SRC = $(GIT) -C $(srcdir)
4848
GIT_LOG = $(GIT_IN_SRC) log --no-show-signature
49-
GIT_LOG_FORMAT = $(GIT_LOG) --pretty=format:
49+
GIT_LOG_FORMAT = $(GIT_LOG) "--pretty=format:"
5050

5151
# GITPULLOPTIONS = --no-tags
5252

complex.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,15 +913,16 @@ comp_mul(VALUE areal, VALUE aimag, VALUE breal, VALUE bimag, VALUE *real, VALUE
913913

914914
/*
915915
* call-seq:
916-
* complex * numeric -> new_complex
916+
* self * other -> numeric
917917
*
918-
* Returns the product of +self+ and +numeric+:
918+
* Returns the numeric product of +self+ and +other+:
919919
*
920+
* Complex.rect(9, 8) * 4 # => (36+32i)
921+
* Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
920922
* Complex.rect(2, 3) * Complex.rect(2, 3) # => (-5+12i)
921923
* Complex.rect(900) * Complex.rect(1) # => (900+0i)
922924
* Complex.rect(-2, 9) * Complex.rect(-9, 2) # => (0-85i)
923-
* Complex.rect(9, 8) * 4 # => (36+32i)
924-
* Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
925+
* Complex.rect(9, 8) * Rational(2, 3) # => ((6/1)+(16/3)*i)
925926
*
926927
*/
927928
VALUE

cont.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ struct rb_fiber_struct {
268268

269269
unsigned int killed : 1;
270270

271+
rb_serial_t serial;
272+
271273
struct coroutine_context context;
272274
struct fiber_pool_stack stack;
273275
};
@@ -1010,6 +1012,13 @@ rb_fiber_threadptr(const rb_fiber_t *fiber)
10101012
return fiber->cont.saved_ec.thread_ptr;
10111013
}
10121014

1015+
rb_serial_t
1016+
rb_fiber_serial(const rb_fiber_t *fiber)
1017+
{
1018+
VM_ASSERT(fiber->serial >= 1);
1019+
return fiber->serial;
1020+
}
1021+
10131022
static VALUE
10141023
cont_thread_value(const rb_context_t *cont)
10151024
{
@@ -1995,6 +2004,13 @@ fiber_alloc(VALUE klass)
19952004
return TypedData_Wrap_Struct(klass, &fiber_data_type, 0);
19962005
}
19972006

2007+
static rb_serial_t
2008+
next_fiber_serial(void)
2009+
{
2010+
static rbimpl_atomic_uint64_t fiber_serial = 1;
2011+
return (rb_serial_t)ATOMIC_U64_FETCH_ADD(fiber_serial, 1);
2012+
}
2013+
19982014
static rb_fiber_t*
19992015
fiber_t_alloc(VALUE fiber_value, unsigned int blocking)
20002016
{
@@ -2011,6 +2027,7 @@ fiber_t_alloc(VALUE fiber_value, unsigned int blocking)
20112027
fiber->cont.type = FIBER_CONTEXT;
20122028
fiber->blocking = blocking;
20132029
fiber->killed = 0;
2030+
fiber->serial = next_fiber_serial();
20142031
cont_init(&fiber->cont, th);
20152032

20162033
fiber->cont.saved_ec.fiber_ptr = fiber;
@@ -2563,6 +2580,7 @@ rb_threadptr_root_fiber_setup(rb_thread_t *th)
25632580
fiber->cont.saved_ec.thread_ptr = th;
25642581
fiber->blocking = 1;
25652582
fiber->killed = 0;
2583+
fiber->serial = next_fiber_serial();
25662584
fiber_status_set(fiber, FIBER_RESUMED); /* skip CREATED */
25672585
th->ec = &fiber->cont.saved_ec;
25682586
cont_init_jit_cont(&fiber->cont);

0 commit comments

Comments
 (0)