Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from upstream #32

Merged
merged 105 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
cb899a9
Disable YJIT support when cross-compiling
nobu Nov 6, 2022
9627aab
`--disable-jit-support` should disable YJIT successfully
nobu Nov 6, 2022
fc842c9
Check `rustc` with the target
nobu Nov 6, 2022
12883f8
GNU make 4.4 now uses a fifo for the jobserver
nobu Nov 6, 2022
180d37c
Set `autoclose:` for inherited FDs only [ci skip]
nobu Nov 7, 2022
ab01b8f
jobserver option may not be at the last
nobu Nov 7, 2022
b02b8e7
Let other test runners follow the change of GNU make 4.4 jobserver
nobu Nov 7, 2022
ee86b57
Revert jobserver handling in spec
nobu Nov 7, 2022
011d4c5
[Bug #19106] Normalize time at 24:00:00 with a timezone object
nobu Nov 7, 2022
0fb7a1c
[rubygems/rubygems] Drop support for HP-UX
peterzhu2118 Nov 3, 2022
1e53eba
[rubygems/rubygems] Drop support for bitrig
peterzhu2118 Nov 3, 2022
b228eff
[rubygems/rubygems] Drop support for IRIX
peterzhu2118 Nov 3, 2022
33bc398
[rubygems/rubygems] Fix rubocop violations
peterzhu2118 Nov 3, 2022
72c7dba
[ruby/fileutils] Revert "FileUtils.rm* methods swallows only Errno::E…
mame Aug 30, 2022
ca0b592
[ruby/irb] Don't lazily retrieve gem specs for completion
st0012 Nov 6, 2022
7442cb4
YJIT: Free pages after ObjectSpace API usages (#6676)
k0kubun Nov 7, 2022
9001e53
[ruby/irb] Support non-string input in show_source
k0kubun Nov 7, 2022
c99e4c4
Update to ruby/mspec@1e16420
eregon Nov 7, 2022
83decbb
Update to ruby/spec@740ccc8
eregon Nov 7, 2022
b14f133
[DOC] Improve building_ruby.md
peterzhu2118 Nov 7, 2022
cb2323a
Thread#native_thread_id is very platform specific
nobu Nov 8, 2022
7456647
[DOC] Properly number the list in building_ruby.md
peterzhu2118 Nov 8, 2022
f7db1af
Set default %printer for NODE nterms
yui-knk Sep 23, 2022
4a7d6c2
Fix false LocalJumpError when branch coverage is enabled
mame Nov 8, 2022
0016060
Suppress false warning by a bug of gcc
nobu Nov 8, 2022
4e72848
[ruby/error_highlight] Bump version
mame Nov 8, 2022
cdb3ec3
Update default gems list at 4e728486b93eaec876ea8f876df9ec [ci skip]
matzbot Nov 8, 2022
eacedcf
mutex: Raise a ThreadError when detecting a fiber deadlock (#6680)
casperisfine Nov 8, 2022
3703a81
YJIT: improve/fix code to automatically build YJIT when available (#6…
maximecb Nov 8, 2022
2244d50
[rubygems/rubygems] Map 'universal' to the real arch in Bundler for p…
Bo98 Oct 12, 2022
0df47fd
[rubygems/rubygems] Add tests for universal Ruby with arch-specific p…
Bo98 Oct 15, 2022
b7b78f0
[ruby/irb] Add execute_lines to reduce command tests' boilerplate
st0012 Nov 8, 2022
5643d2b
YJIT: Make more stats accessible from Ruby code (#6685)
k0kubun Nov 8, 2022
aada904
[doc] Clarify how to build OpenSSL on macOS
eightbitraptor Nov 8, 2022
1a65ab2
Implement optimize call (#6691)
jimmyhmiller Nov 8, 2022
1466682
YJIT: Improve checking message for rustc version (#6693)
XrXr Nov 8, 2022
5d95cd9
YJIT: Reset dropped_bytes when patching code
XrXr Nov 7, 2022
ef1c1dd
Use `rb_sprintf` instead of deprecated `sprintf`
nobu Nov 9, 2022
558137d
[DOC] Fix missing type name
nobu Nov 9, 2022
c3de7a3
Make pending_interrupt?(Exception) work
mame Nov 8, 2022
230267d
Now bison 3.0 or later is required
nobu Nov 9, 2022
881bf9a
Implement cache optimization for regexp matching
makenowjust Oct 3, 2022
f07dea1
Keep cache optimization info to MatchArg for global matching
makenowjust Oct 3, 2022
8c9e4d3
Fix look-around like operators and cclass
makenowjust Oct 4, 2022
d84edce
Increment num_fail on OP_POP too
makenowjust Oct 4, 2022
aefb7e5
Add static declaration to new functions
makenowjust Oct 4, 2022
cbabba9
Add index to the latest NULL_CHECK_STACK for fast matching
makenowjust Oct 6, 2022
70f8e9e
Enable optimization for ANYCHAR_STAR opcodes
makenowjust Oct 12, 2022
1134fa4
Enable optimization for PUSH_IF/OR opcodes
makenowjust Oct 12, 2022
3c79731
Fix to compile when USE_CACHE_MATCH_OPT is disabled
makenowjust Oct 19, 2022
ea3d989
Reduce warnings
makenowjust Oct 19, 2022
f25bb29
Support OP_REPEAT and OP_REPEAT_INC
makenowjust Oct 20, 2022
37613fe
Clear cache on OP_NULL_CHECK_END_MEMST
makenowjust Oct 27, 2022
ff2998a
Remove debug printf
makenowjust Nov 6, 2022
80d145f
Fix and add regexp tests
makenowjust Nov 7, 2022
71c76d1
Update timeout seconds
makenowjust Nov 7, 2022
0a14825
Update timeout seconds for square test
makenowjust Nov 8, 2022
2229473
Refactor field names
makenowjust Nov 8, 2022
a1c1fc5
Revert "Refactor field names"
makenowjust Nov 8, 2022
ff5dba8
Return ONIGERR_MEMORY if it fails to allocate memory for cache_match_opt
mame Nov 8, 2022
537286d
Prevent GCC warnings
mame Nov 8, 2022
14845ab
Ensure that the table size for CACHE_MATCH fits with int
mame Nov 8, 2022
d868f4c
Check for integer overflow in the allocation of match_cache table
mame Nov 8, 2022
36ff052
Use long instead of int
makenowjust Nov 9, 2022
1dc4128
Reduce warnings
makenowjust Nov 9, 2022
0e1e1b1
[DOC] Enhanced RDoc for IO (#6669)
BurdetteLamar Nov 9, 2022
9ab978b
Fix exit locations dump (#6703)
eileencodes Nov 9, 2022
5a4d9f9
Update required Bison version in building_ruby.md [ci skip]
yui-knk Nov 9, 2022
b7504af
Preprocess for older bison is no longer needed
nobu Nov 9, 2022
0ae5de1
Adjust indents [ci skip]
nobu Nov 10, 2022
6eaed20
Add version to the interface of Random extensions
nobu Nov 8, 2022
b7e8876
[Bug #19100] Add `init_int32` function to `rb_random_interface_t`
nobu Nov 9, 2022
68bd1d6
Fix compiler issues in test on C99
peterzhu2118 Nov 10, 2022
199b59f
Fix bug in array pack with shared strings
jemmaissroff Nov 9, 2022
9986697
Omit test on IO Buffers which relies on String being embedded
jemmaissroff Nov 8, 2022
5246f40
Transition shape when object's capacity changes
jemmaissroff Nov 8, 2022
c726c48
Remove numiv from RObject
jemmaissroff Nov 8, 2022
c771d83
Set up EXTSTATIC before checking it
XrXr Nov 10, 2022
bab8051
[Bug #19100] [DOC] Add NEWS about PRNG update and incompatiblity
nobu Nov 9, 2022
0de3bc9
[ruby/irb] Make $ and @ default aliases
k0kubun Nov 10, 2022
8b33479
Enable --yjit-stats for release builds (#6694)
jimmyhmiller Nov 10, 2022
354791c
Remove inconsistency
k0kubun Nov 10, 2022
7ee1cac
Extract `rb_shape_get_parent` helper
jemmaissroff Nov 10, 2022
d905632
Define YJIT_STATS on --enable-yjit=stats (#6710)
k0kubun Nov 10, 2022
2b8191b
YJIT: Invalidate JIT code only for ISEQ_TRACE_EVENTS (#6695)
k0kubun Nov 10, 2022
51d1619
[ruby/racc] Make racc test more flexible (for JRuby).
enebo Nov 10, 2022
06e17d7
Run EnvUtil.apply_timeout_scale outside of assert_separately
mame Nov 10, 2022
b5f809c
[rubygems/rubygems] Load "bundler/setup" in lib/rubygems.rb
mame Oct 28, 2022
d5513da
[rubygems/rubygems] Update bundler/spec/bundler/shared_helpers_spec.rb
mame Oct 28, 2022
8fa83fa
[ruby/irb] Transform ls's --grep/-G option to keyword args
k0kubun Nov 10, 2022
4c55409
wasm/README.md: Add a note about the Ruby built for wasm. [ci skip]
junaruga Nov 10, 2022
adfbee8
Allow a float error for Regexp.timeout
mame Nov 11, 2022
ceeefb5
[rubygems/rubygems] github source should default to secure protocol
jasonkarns Oct 28, 2022
c7d0430
[rubygems/rubygems] Add 'call for update' to RubyGems install command.
simi Sep 11, 2022
7ce0f81
[rubygems/rubygems] Use file in XDG_STATE_HOME directory to store las…
simi Oct 29, 2022
de159c5
[rubygems/rubygems] Store last check even when upgrade is not availab…
simi Nov 4, 2022
28611be
Merge RubyGems/Bundler master from ee2f8398324af4bc1b95f7565ce2fda981…
hsbt Nov 11, 2022
a0fcbce
Try to use ossf/scorecards
hsbt Nov 11, 2022
800caf4
Use secrets.SCORECARD_READ_TOKEN
hsbt Nov 11, 2022
5a1ddc4
Test with topic-branch
hsbt Nov 11, 2022
90bbc89
Enable only master-branch
hsbt Nov 11, 2022
04c5adf
YJIT: Fix staying in invalidated code after proc calls
XrXr Nov 10, 2022
4d9ada2
[ruby/net-http] Prettify class hierarchies in Net::HTTP
BurdetteLamar Nov 9, 2022
a48e01c
[ruby/net-http] Update lib/net/http.rb
BurdetteLamar Nov 10, 2022
ae3b485
Merge from upstream
chrisseaton Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ jobs:
- name: Install libraries
run: |
brew upgrade
brew install gmp libffi openssl@1.1 zlib autoconf automake libtool readline
brew install gmp libffi openssl@1.1 zlib autoconf automake libtool readline bison
working-directory: src
- name: Set ENV
run: |
echo "MAKEFLAGS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV
echo "PATH="/usr/local/opt/bison/bin:$PATH"" >> $GITHUB_ENV
- run: ./autogen.sh
working-directory: src
- name: Run configure
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: Scorecards supply-chain security
on:
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '22 4 * * 2'
push:
branches: [ "master" ]

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write
# Uncomment the permissions below if installing in a private repository.
# contents: read
# actions: read

steps:
- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
with:
results_file: results.sarif
results_format: sarif
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}

# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27
with:
sarif_file: results.sarif
18 changes: 17 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Note: We're only listing outstanding class updates.
* cgi 0.3.3
* date 3.2.3
* erb 3.0.0
* error_highlight 0.4.0
* error_highlight 0.5.0
* etc 1.4.0
* fiddle 1.1.1
* io-console 0.5.11
Expand Down Expand Up @@ -291,6 +291,11 @@ The following deprecated methods are removed.
* `Kernel#trust`, `Kernel#untrust`, `Kernel#untrusted?`
[[Feature #16131]]

### Source code incompatiblity of extension libraries [[Bug #19100]]

* Extension libraries provide PRNG, subclasses of `Random`, need updates.
See [PRNG update] below for more information.

## Stdlib compatibility issues

* `Psych` no longer bundles libyaml sources.
Expand All @@ -300,6 +305,16 @@ The following deprecated methods are removed.

## C API updates

### Updated C APIs

The following APIs are updated.

* PRNG update

`rb_random_interface_t` updated and versioned.
Extension libraries which use this interface and built for older versions.
Also `init_int32` function needs to be defined.

### Removed C APIs

The following deprecated APIs are removed.
Expand Down Expand Up @@ -400,3 +415,4 @@ The following deprecated APIs are removed.
[Feature #19013]: https://bugs.ruby-lang.org/issues/19013
[Feature #19026]: https://bugs.ruby-lang.org/issues/19026
[Feature #19060]: https://bugs.ruby-lang.org/issues/19060
[Bug #19100]: https://bugs.ruby-lang.org/issues/19100
12 changes: 9 additions & 3 deletions bootstraptest/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,16 @@ def putc(c)

def wn=(wn)
unless wn == 1
if /(?:\A|\s)--jobserver-(?:auth|fds)=\K(\d+),(\d+)/ =~ ENV.delete("MAKEFLAGS")
if /(?:\A|\s)--jobserver-(?:auth|fds)=(?:(\d+),(\d+)|fifo:((?:\\.|\S)+))/ =~ ENV.delete("MAKEFLAGS")
begin
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
if fifo = $3
fifo.gsub!(/\\(?=.)/, '')
r = File.open(fifo, IO::RDONLY|IO::NONBLOCK|IO::BINARY)
w = File.open(fifo, IO::WRONLY|IO::NONBLOCK|IO::BINARY)
else
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
end
rescue => e
r.close if r
else
Expand Down
4 changes: 2 additions & 2 deletions class.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class_alloc(VALUE flags, VALUE klass)
{
size_t alloc_size = sizeof(struct RClass);

#if USE_RVARGC
#if RCLASS_EXT_EMBEDDED
alloc_size += sizeof(rb_classext_t);
#endif

Expand All @@ -206,7 +206,7 @@ class_alloc(VALUE flags, VALUE klass)
if (RGENGC_WB_PROTECTED_CLASS) flags |= FL_WB_PROTECTED;
RVARGC_NEWOBJ_OF(obj, struct RClass, klass, flags, alloc_size);

#if USE_RVARGC
#if RCLASS_EXT_EMBEDDED
memset(RCLASS_EXT(obj), 0, sizeof(rb_classext_t));
#else
obj->ptr = ZALLOC(rb_classext_t);
Expand Down
14 changes: 11 additions & 3 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ showflags:
" LC_ALL = $(LC_ALL)" \
" LC_CTYPE = $(LC_CTYPE)" \
" MFLAGS = $(MFLAGS)" \
" RUST = $(RUST)" \
" RUSTC = $(RUSTC)" \
" YJIT_RUSTC_ARGS = $(YJIT_RUSTC_ARGS)" \
$(MESSAGE_END)
-@$(CC_VERSION)
Expand Down Expand Up @@ -956,8 +956,6 @@ PHONY:
{$(srcdir)}.y.c:
$(ECHO) generating $@
$(Q)$(BASERUBY) $(tooldir)/id2token.rb $(SRC_FILE) > parse.tmp.y
$(Q)$(BASERUBY) $(tooldir)/pure_parser.rb parse.tmp.y $(YACC)
$(Q)$(RM) parse.tmp.y.bak
$(Q)$(YACC) -d $(YFLAGS) -o y.tab.c parse.tmp.y
$(Q)$(RM) parse.tmp.y
$(Q)sed -f $(tooldir)/ytab.sed -e "/^#/s|parse\.tmp\.[iy]|$(SRC_FILE)|" -e "/^#/s!y\.tab\.c!$@!" y.tab.c > $@.new
Expand Down Expand Up @@ -6040,6 +6038,7 @@ enumerator.$(OBJEXT): {$(VPATH)}missing.h
enumerator.$(OBJEXT): {$(VPATH)}onigmo.h
enumerator.$(OBJEXT): {$(VPATH)}oniguruma.h
enumerator.$(OBJEXT): {$(VPATH)}ruby_assert.h
enumerator.$(OBJEXT): {$(VPATH)}shape.h
enumerator.$(OBJEXT): {$(VPATH)}st.h
enumerator.$(OBJEXT): {$(VPATH)}subst.h
error.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
Expand Down Expand Up @@ -9378,6 +9377,7 @@ memory_view.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
memory_view.$(OBJEXT): {$(VPATH)}memory_view.c
memory_view.$(OBJEXT): {$(VPATH)}memory_view.h
memory_view.$(OBJEXT): {$(VPATH)}missing.h
memory_view.$(OBJEXT): {$(VPATH)}shape.h
memory_view.$(OBJEXT): {$(VPATH)}st.h
memory_view.$(OBJEXT): {$(VPATH)}subst.h
memory_view.$(OBJEXT): {$(VPATH)}util.h
Expand Down Expand Up @@ -10631,6 +10631,7 @@ object.$(OBJEXT): {$(VPATH)}shape.h
object.$(OBJEXT): {$(VPATH)}st.h
object.$(OBJEXT): {$(VPATH)}subst.h
object.$(OBJEXT): {$(VPATH)}util.h
object.$(OBJEXT): {$(VPATH)}variable.h
pack.$(OBJEXT): $(hdrdir)/ruby/ruby.h
pack.$(OBJEXT): $(top_srcdir)/internal/array.h
pack.$(OBJEXT): $(top_srcdir)/internal/bits.h
Expand Down Expand Up @@ -10812,6 +10813,7 @@ pack.$(OBJEXT): {$(VPATH)}onigmo.h
pack.$(OBJEXT): {$(VPATH)}oniguruma.h
pack.$(OBJEXT): {$(VPATH)}pack.c
pack.$(OBJEXT): {$(VPATH)}pack.rbinc
pack.$(OBJEXT): {$(VPATH)}shape.h
pack.$(OBJEXT): {$(VPATH)}st.h
pack.$(OBJEXT): {$(VPATH)}subst.h
pack.$(OBJEXT): {$(VPATH)}util.h
Expand Down Expand Up @@ -11024,6 +11026,7 @@ parse.$(OBJEXT): {$(VPATH)}ractor.h
parse.$(OBJEXT): {$(VPATH)}regenc.h
parse.$(OBJEXT): {$(VPATH)}regex.h
parse.$(OBJEXT): {$(VPATH)}ruby_assert.h
parse.$(OBJEXT): {$(VPATH)}shape.h
parse.$(OBJEXT): {$(VPATH)}st.h
parse.$(OBJEXT): {$(VPATH)}subst.h
parse.$(OBJEXT): {$(VPATH)}symbol.h
Expand Down Expand Up @@ -11855,6 +11858,7 @@ random.$(OBJEXT): {$(VPATH)}ractor.h
random.$(OBJEXT): {$(VPATH)}random.c
random.$(OBJEXT): {$(VPATH)}random.h
random.$(OBJEXT): {$(VPATH)}ruby_atomic.h
random.$(OBJEXT): {$(VPATH)}shape.h
random.$(OBJEXT): {$(VPATH)}siphash.c
random.$(OBJEXT): {$(VPATH)}siphash.h
random.$(OBJEXT): {$(VPATH)}st.h
Expand Down Expand Up @@ -12047,6 +12051,7 @@ range.$(OBJEXT): {$(VPATH)}missing.h
range.$(OBJEXT): {$(VPATH)}onigmo.h
range.$(OBJEXT): {$(VPATH)}oniguruma.h
range.$(OBJEXT): {$(VPATH)}range.c
range.$(OBJEXT): {$(VPATH)}shape.h
range.$(OBJEXT): {$(VPATH)}st.h
range.$(OBJEXT): {$(VPATH)}subst.h
rational.$(OBJEXT): $(hdrdir)/ruby/ruby.h
Expand Down Expand Up @@ -14026,6 +14031,7 @@ shape.$(OBJEXT): {$(VPATH)}constant.h
shape.$(OBJEXT): {$(VPATH)}debug_counter.h
shape.$(OBJEXT): {$(VPATH)}defines.h
shape.$(OBJEXT): {$(VPATH)}encoding.h
shape.$(OBJEXT): {$(VPATH)}gc.h
shape.$(OBJEXT): {$(VPATH)}id.h
shape.$(OBJEXT): {$(VPATH)}id_table.h
shape.$(OBJEXT): {$(VPATH)}intern.h
Expand Down Expand Up @@ -16009,6 +16015,7 @@ time.$(OBJEXT): {$(VPATH)}missing.h
time.$(OBJEXT): {$(VPATH)}onigmo.h
time.$(OBJEXT): {$(VPATH)}oniguruma.h
time.$(OBJEXT): {$(VPATH)}ruby_assert.h
time.$(OBJEXT): {$(VPATH)}shape.h
time.$(OBJEXT): {$(VPATH)}st.h
time.$(OBJEXT): {$(VPATH)}subst.h
time.$(OBJEXT): {$(VPATH)}time.c
Expand Down Expand Up @@ -16373,6 +16380,7 @@ transient_heap.$(OBJEXT): {$(VPATH)}internal/warning_push.h
transient_heap.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
transient_heap.$(OBJEXT): {$(VPATH)}missing.h
transient_heap.$(OBJEXT): {$(VPATH)}ruby_assert.h
transient_heap.$(OBJEXT): {$(VPATH)}shape.h
transient_heap.$(OBJEXT): {$(VPATH)}st.h
transient_heap.$(OBJEXT): {$(VPATH)}subst.h
transient_heap.$(OBJEXT): {$(VPATH)}transient_heap.c
Expand Down
25 changes: 24 additions & 1 deletion compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7449,7 +7449,30 @@ compile_iter(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
ISEQ_TYPE_BLOCK, line);
CHECK(COMPILE(ret, "iter caller", node->nd_iter));
}
ADD_LABEL(ret, retry_end_l);

{
// We need to put the label "retry_end_l" immediately after the last "send" instruction.
// This because vm_throw checks if the break cont is equal to the index of next insn of the "send".
// (Otherwise, it is considered "break from proc-closure". See "TAG_BREAK" handling in "vm_throw_start".)
//
// Normally, "send" instruction is at the last.
// However, qcall under branch coverage measurement adds some instructions after the "send".
//
// Note that "invokesuper" appears instead of "send".
INSN *iobj;
LINK_ELEMENT *last_elem = LAST_ELEMENT(ret);
iobj = IS_INSN(last_elem) ? (INSN*) last_elem : (INSN*) get_prev_insn((INSN*) last_elem);
while (INSN_OF(iobj) != BIN(send) && INSN_OF(iobj) != BIN(invokesuper)) {
iobj = (INSN*) get_prev_insn(iobj);
}
ELEM_INSERT_NEXT(&iobj->link, (LINK_ELEMENT*) retry_end_l);

// LINK_ANCHOR has a pointer to the last element, but ELEM_INSERT_NEXT does not update it
// even if we add an insn to the last of LINK_ANCHOR. So this updates it manually.
if (&iobj->link == LAST_ELEMENT(ret)) {
ret->last = (LINK_ELEMENT*) retry_end_l;
}
}

if (popped) {
ADD_INSN(ret, line_node, pop);
Expand Down
Loading