Skip to content

Commit b097496

Browse files
authored
Merge branch 'ruby:master' into nmeans/zjit-array-splice-aset
2 parents 3f388c9 + e730ac4 commit b097496

39 files changed

Lines changed: 5707 additions & 5601 deletions

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ Other changes are listed in the following sections. We also listed release
4747
history from the previous bundled version that is Ruby 3.4.0 if it has GitHub
4848
releases.
4949

50-
### The following bundled gem is promoted from default gems.
50+
### The following bundled gems are promoted from default gems.
5151

5252
* tsort 0.2.0
53+
* win32-registry 0.1.2
5354

5455
### The following default gem is added.
5556

@@ -80,6 +81,7 @@ releases.
8081
* repl_type_completor 0.1.13
8182
* pstore 0.2.1
8283
* rdoc 7.2.0
84+
* win32ole 1.9.3
8385
* irb 1.17.0
8486

8587
### RubyGems and Bundler

bootstraptest/test_yjit.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5486,3 +5486,52 @@ def test = foo(1)
54865486
test
54875487
test
54885488
}
5489+
5490+
# regression test for tracing invalidation with on-stack compiled methods
5491+
# Exercises the on_stack_iseqs path in rb_yjit_tracing_invalidate_all
5492+
# where delayed deallocation must not create aliasing &mut references
5493+
# to IseqPayload (use-after-free of version_map backing storage).
5494+
assert_normal_exit %q{
5495+
def deep = 42
5496+
def mid = deep
5497+
def outer = mid
5498+
5499+
# Compile all three methods with YJIT
5500+
10.times { outer }
5501+
5502+
# Enable tracing from within a call chain so that outer/mid/deep
5503+
# are on the stack when rb_yjit_tracing_invalidate_all runs.
5504+
# This triggers the on_stack_iseqs (delayed deallocation) path.
5505+
def deep
5506+
TracePoint.new(:line) {}.enable
5507+
42
5508+
end
5509+
5510+
outer
5511+
5512+
# After invalidation, verify YJIT can recompile and run correctly
5513+
def deep = 42
5514+
10.times { outer }
5515+
}
5516+
5517+
# regression test for tracing invalidation with on-stack fibers
5518+
# Suspended fibers have iseqs on their stack that must survive invalidation.
5519+
assert_equal '42', %q{
5520+
def compiled_method
5521+
Fiber.yield
5522+
42
5523+
end
5524+
5525+
# Compile the method
5526+
10.times { compiled_method rescue nil }
5527+
5528+
fiber = Fiber.new { compiled_method }
5529+
fiber.resume # suspends inside compiled_method — it's now on the fiber's stack
5530+
5531+
# Enable tracing while compiled_method is on the fiber's stack.
5532+
# This triggers rb_yjit_tracing_invalidate_all with on-stack iseqs.
5533+
TracePoint.new(:call) {}.enable
5534+
5535+
# Resume the fiber — compiled_method's iseq must still be valid
5536+
fiber.resume.to_s
5537+
}

common.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,10 @@ RUBYSPEC_CAPIEXT_SRCDIR = $(srcdir)/$(RUBYSPEC_CAPIEXT)
800800
RUBYSPEC_CAPIEXT_DEPS = $(RUBYSPEC_CAPIEXT_SRCDIR)/rubyspec.h $(RUBY_H_INCLUDES) {$(VPATH)}internal/abi.h $(LIBRUBY)
801801
RUBYSPEC_CAPIEXT_BUILD = $(enable_shared:yes=rubyspec-capiext)
802802

803-
rubyspec-capiext: build-ext $(DOT_WAIT)
803+
yes-rubyspec-capiext: build-ext
804+
$(ACTIONS_GROUP)
805+
rubyspec-capiext: build-ext $(DOT_WAIT) yes-rubyspec-capiext $(DOT_WAIT)
806+
$(ACTIONS_ENDGROUP)
804807
# make-dependent rules should be included after this and built after build-ext.
805808

806809
clean-spec: PHONY

defs/gmake.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ fix-depends check-depends: all hello
516516
# order-only-prerequisites doesn't work for $(RUBYSPEC_CAPIEXT)
517517
# because the same named directory exists in the source tree.
518518
$(RUBYSPEC_CAPIEXT)/%.$(DLEXT): $(srcdir)/$(RUBYSPEC_CAPIEXT)/%.c $(RUBYSPEC_CAPIEXT_DEPS) \
519-
| build-ext
519+
| build-ext yes-rubyspec-capiext
520520
$(no_silence:no=$(ECHO) building $@)
521521
$(Q) $(MAKEDIRS) $(@D)
522522
$(Q) $(DLDSHARED) -L. $(XDLDFLAGS) $(XLDFLAGS) $(LDFLAGS) $(INCFLAGS) $(CPPFLAGS) $(OUTFLAG)$@ $< $(LIBRUBYARG)
@@ -525,9 +525,8 @@ ifneq ($(POSTLINK),)
525525
endif
526526
$(Q) $(RMALL) $@.*
527527

528-
RUBYSPEC_CAPIEXT_SO := $(patsubst %.c,$(RUBYSPEC_CAPIEXT)/%.$(DLEXT),$(notdir $(wildcard $(srcdir)/$(RUBYSPEC_CAPIEXT)/*.c)))
529-
rubyspec-capiext: $(RUBYSPEC_CAPIEXT_SO)
530-
@ $(NULLCMD)
528+
RUBYSPEC_CAPIEXT_EXTS := $(patsubst %.c,$(RUBYSPEC_CAPIEXT)/%.$(DLEXT),$(notdir $(wildcard $(srcdir)/$(RUBYSPEC_CAPIEXT)/*.c)))
529+
rubyspec-capiext: $(RUBYSPEC_CAPIEXT_EXTS)
531530

532531
spec/%/ spec/%_spec.rb: programs exts $(RUBYSPEC_CAPIEXT_BUILD) PHONY
533532
+$(RUNRUBY) -r./$(arch)-fake $(srcdir)/spec/mspec/bin/mspec-run -B $(srcdir)/spec/default.mspec $(SPECOPTS) $(patsubst %,$(srcdir)/%,$@)

dir.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,23 +1586,29 @@ dir_chdir(VALUE dir)
15861586
}
15871587

15881588
#ifndef _WIN32
1589-
VALUE
1590-
rb_dir_getwd_ospath(void)
1589+
static VALUE
1590+
getcwd_to_str(VALUE arg)
15911591
{
1592-
char *path;
1593-
VALUE cwd;
1594-
VALUE path_guard;
1595-
1596-
path_guard = rb_imemo_tmpbuf_new();
1597-
path = ruby_getcwd();
1598-
rb_imemo_tmpbuf_set_ptr(path_guard, path);
1592+
const char *path = (const char *)arg;
15991593
#ifdef __APPLE__
1600-
cwd = rb_str_normalize_ospath(path, strlen(path));
1594+
return rb_str_normalize_ospath(path, strlen(path));
16011595
#else
1602-
cwd = rb_str_new2(path);
1596+
return rb_str_new2(path);
16031597
#endif
1604-
rb_free_tmp_buffer(&path_guard);
1605-
return cwd;
1598+
}
1599+
1600+
static VALUE
1601+
getcwd_xfree(VALUE arg)
1602+
{
1603+
xfree((void *)arg);
1604+
return Qnil;
1605+
}
1606+
1607+
VALUE
1608+
rb_dir_getwd_ospath(void)
1609+
{
1610+
char *path = ruby_getcwd();
1611+
return rb_ensure(getcwd_to_str, (VALUE)path, getcwd_xfree, (VALUE)path);
16061612
}
16071613
#endif
16081614

doc/maintainers.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,12 @@ It may needs to make consensus on ruby-core/ruby-dev before making major changes
616616
* https://github.com/ruby/tsort
617617
* https://rubygems.org/gems/tsort
618618

619+
#### win32-registry
620+
621+
* Nakamura Usaku ([unak])
622+
* https://github.com/ruby/win32-registry
623+
* https://rubygems.org/gems/win32-registry
624+
619625
## Platform Maintainers
620626

621627
### mswin64 (Microsoft Windows)

doc/standard_library.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ of each.
124124
- [readline]: Wrapper for the Readline extension and Reline
125125
- [fiddle]: A libffi wrapper for Ruby
126126
- [tsort]: Topological sorting using Tarjan's algorithm
127+
- [win32-registry]: Registry accessor library for the Windows platform.
127128

128129
## Tools
129130

@@ -208,6 +209,7 @@ of each.
208209
[uri]: https://github.com/ruby/uri
209210
[weakref]: https://github.com/ruby/weakref
210211
[win32ole]: https://github.com/ruby/win32ole
212+
[win32-registry]: https://github.com/ruby/win32-registry
211213
[yaml]: https://github.com/ruby/yaml
212214
[zlib]: https://github.com/ruby/zlib
213215

ext/json/lib/json.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@
201201
# defaults to +false+.
202202
#
203203
# With the default, +false+:
204-
# JSON.parse(%{"Hell\\o"}) # invalid escape character in string (JSON::ParserError)
204+
# JSON.parse('"Hell\o"') # invalid escape character in string (JSON::ParserError)
205205
#
206206
# When enabled:
207-
# JSON.parse(%{"Hell\\o"}, allow_invalid_escape: true) # => "Hello"
207+
# JSON.parse('"Hell\o"', allow_invalid_escape: true) # => "Hello"
208208
#
209209
# ====== Output Options
210210
#

0 commit comments

Comments
 (0)