Skip to content

Commit e6534b3

Browse files
committed
Merge remote-tracking branch 'gh/master' into zjit-polymorphic-getivar
2 parents d711693 + b94162a commit e6534b3

74 files changed

Lines changed: 6305 additions & 6020 deletions

Some content is hidden

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

.github/workflows/check_misc.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
with:
2323
token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_AUTO_UPDATE_TOKEN || secrets.GITHUB_TOKEN }}
2424

25+
- uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: head
28+
2529
- uses: ./.github/actions/setup/directories
2630
with:
2731
makeup: true
@@ -78,6 +82,11 @@ jobs:
7882
fi
7983
continue-on-error: ${{ steps.now.outputs.mon < 12 }}
8084

85+
- name: Check if date in man pages is up-to-date
86+
run: |
87+
make V=1 GIT=git BASERUBY=ruby update-man-date
88+
git diff --color --no-ext-diff --ignore-submodules --exit-code -- man
89+
8190
- name: Check if to generate documents
8291
id: rdoc
8392
run: |
@@ -111,7 +120,7 @@ jobs:
111120
- name: Generate docs
112121
id: docs
113122
run: |
114-
make XRUBY=ruby RDOC_DEPENDS= RBCONFIG=update-rbconfig html
123+
make XRUBY=ruby RDOC_DEPENDS= RBCONFIG=update-rbconfig HTMLOUT=html html
115124
echo htmlout=ruby-html-${GITHUB_SHA:0:10} >> $GITHUB_OUTPUT
116125
# Generate only when document commit/PR
117126
if: >-

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: 5 additions & 2 deletions
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
@@ -1894,7 +1897,7 @@ sudo-precheck: PHONY
18941897
@$(SUDO) echo > $(NULL)
18951898

18961899
update-man-date: PHONY
1897-
-$(Q) $(BASERUBY) -I"$(tooldir)/lib" -rvcs -i -p \
1900+
$(Q) $(BASERUBY) -I"$(tooldir)/lib" -rvcs -i -p \
18981901
-e 'BEGIN{@vcs=VCS.detect(ARGV.shift)}' \
18991902
-e '$$_.sub!(/^(\.Dd ).*/){$$1+@vcs.modified(ARGF.path).strftime("%B %d, %Y")}' \
19001903
"$(srcdir)" "$(srcdir)"/man/*.1

configure.ac

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4342,9 +4342,6 @@ AS_IF([test -n "${LIBS}"], [
43424342
MAINFLAGS=`echo " $MAINLIBS " | sed "s|$libspat"'||;s/^ *//;s/ *$//'`
43434343
])
43444344
LIBRUBYARG_STATIC="${LIBRUBYARG_STATIC} \$(MAINLIBS)"
4345-
AS_IF([test "$enable_shared" = yes], [
4346-
LIBRUBYARG_SHARED="${LIBRUBYARG_SHARED} \$(MAINLIBS)"
4347-
])
43484345
CPPFLAGS="$CPPFLAGS "'$(DEFS) ${cppflags}'
43494346
AS_IF([test -n "${cflags+set}"], [
43504347
cflagspat=`eval echo '"'"${cflags}"'"' | sed 's/[[][|.*]]/\\&/g;s/^ */ /;s/^ *$/ /'`

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

dln.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ void *xrealloc();
7777
# include <unistd.h>
7878
#endif
7979

80+
#ifndef UNREACHABLE_RETURN
81+
# define UNREACHABLE_RETURN(x) return (x)
82+
#endif
83+
8084
#ifndef dln_loaderror
8185
static void
8286
dln_loaderror(const char *format, ...)
@@ -348,6 +352,7 @@ dln_open(const char *file)
348352
void *handle;
349353

350354
#if defined(_WIN32)
355+
# define DLN_DEFINED
351356
char message[1024];
352357

353358
/* Convert the file path to wide char */
@@ -374,6 +379,7 @@ dln_open(const char *file)
374379
# endif
375380

376381
#elif defined(USE_DLN_DLOPEN)
382+
# define DLN_DEFINED
377383

378384
# ifndef RTLD_LAZY
379385
# define RTLD_LAZY 1
@@ -505,7 +511,7 @@ abi_check_enabled_p(void)
505511
static void *
506512
dln_load_and_init(const char *file, const char *init_fct_name)
507513
{
508-
#if defined(_WIN32) || defined(USE_DLN_DLOPEN)
514+
#if defined(DLN_DEFINED)
509515
void *handle = dln_open(file);
510516

511517
#ifdef RUBY_DLN_CHECK_ABI
@@ -523,6 +529,7 @@ dln_load_and_init(const char *file, const char *init_fct_name)
523529
return handle;
524530

525531
#elif defined(_AIX)
532+
# define DLN_DEFINED
526533
{
527534
void (*init_fct)(void);
528535

@@ -539,33 +546,25 @@ dln_load_and_init(const char *file, const char *init_fct_name)
539546
}
540547
#else
541548
dln_notimplement();
549+
UNREACHABLE_RETURN(0);
542550
#endif
543-
544-
return 0; /* dummy return */
545551
}
546552

547553
void *
548554
dln_load(const char *file)
549555
{
550-
#if defined(_WIN32) || defined(USE_DLN_DLOPEN)
551-
char *init_fct_name;
552-
init_funcname(&init_fct_name, file);
553-
return dln_load_and_init(file, init_fct_name);
554-
#else
555-
dln_notimplement();
556-
return 0;
557-
#endif
556+
return dln_load_feature(file, file);
558557
}
559558

560559
void *
561560
dln_load_feature(const char *file, const char *fname)
562561
{
563-
#if defined(_WIN32) || defined(USE_DLN_DLOPEN)
562+
#if defined(DLN_DEFINED)
564563
char *init_fct_name;
565564
init_funcname(&init_fct_name, fname);
566565
return dln_load_and_init(file, init_fct_name);
567566
#else
568567
dln_notimplement();
569-
return 0;
568+
UNREACHABLE_RETURN(0);
570569
#endif
571570
}

doc/float.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# See:
5252
#
5353
# - https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
54-
# - https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#-why-are-rubys-floats-imprecise
54+
# - https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#user-content--why-are-rubys-floats-imprecise
5555
# - https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
5656
#
5757
# Note that precise storage and computation of rational numbers

doc/jit/yjit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ cd yjit
9494
The YJIT `ruby` binary can be built with either GCC or Clang.
9595
It can be built either in dev (debug) mode or in release mode.
9696
For maximum performance, compile YJIT in release mode with GCC.
97-
See [Building Ruby](../contributing/building_ruby.md#building-ruby).
97+
See [Building Ruby](rdoc-ref:contributing/building_ruby.md@building-ruby).
9898

9999
```sh
100100
# Configure in release mode for maximum performance, build and install

0 commit comments

Comments
 (0)