Skip to content

Commit d829fe4

Browse files
authored
Merge pull request #32 from mmtk/merge-from-upstream
Merge from upstream
2 parents 19e523d + ae3b485 commit d829fe4

File tree

232 files changed

+4894
-2373
lines changed

Some content is hidden

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

232 files changed

+4894
-2373
lines changed

.github/workflows/macos.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ jobs:
5151
- name: Install libraries
5252
run: |
5353
brew upgrade
54-
brew install gmp libffi [email protected] zlib autoconf automake libtool readline
54+
brew install gmp libffi [email protected] zlib autoconf automake libtool readline bison
5555
working-directory: src
5656
- name: Set ENV
5757
run: |
5858
echo "MAKEFLAGS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV
59+
echo "PATH="/usr/local/opt/bison/bin:$PATH"" >> $GITHUB_ENV
5960
- run: ./autogen.sh
6061
working-directory: src
6162
- name: Run configure

.github/workflows/scorecards.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecards supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '22 4 * * 2'
14+
push:
15+
branches: [ "master" ]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecards analysis
23+
runs-on: ubuntu-latest
24+
permissions:
25+
# Needed to upload the results to code-scanning dashboard.
26+
security-events: write
27+
# Needed to publish results and get a badge (see publish_results below).
28+
id-token: write
29+
# Uncomment the permissions below if installing in a private repository.
30+
# contents: read
31+
# actions: read
32+
33+
steps:
34+
- name: "Checkout code"
35+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
36+
with:
37+
persist-credentials: false
38+
39+
- name: "Run analysis"
40+
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
41+
with:
42+
results_file: results.sarif
43+
results_format: sarif
44+
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
45+
# - you want to enable the Branch-Protection check on a *public* repository, or
46+
# - you are installing Scorecards on a *private* repository
47+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
48+
repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
49+
50+
# Public repositories:
51+
# - Publish results to OpenSSF REST API for easy access by consumers
52+
# - Allows the repository to include the Scorecard badge.
53+
# - See https://github.com/ossf/scorecard-action#publishing-results.
54+
# For private repositories:
55+
# - `publish_results` will always be set to `false`, regardless
56+
# of the value entered here.
57+
publish_results: true
58+
59+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
60+
# format to the repository Actions tab.
61+
- name: "Upload artifact"
62+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
63+
with:
64+
name: SARIF file
65+
path: results.sarif
66+
retention-days: 5
67+
68+
# Upload the results to GitHub's code scanning dashboard.
69+
- name: "Upload to code-scanning"
70+
uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27
71+
with:
72+
sarif_file: results.sarif

NEWS.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Note: We're only listing outstanding class updates.
232232
* cgi 0.3.3
233233
* date 3.2.3
234234
* erb 3.0.0
235-
* error_highlight 0.4.0
235+
* error_highlight 0.5.0
236236
* etc 1.4.0
237237
* fiddle 1.1.1
238238
* io-console 0.5.11
@@ -291,6 +291,11 @@ The following deprecated methods are removed.
291291
* `Kernel#trust`, `Kernel#untrust`, `Kernel#untrusted?`
292292
[[Feature #16131]]
293293

294+
### Source code incompatiblity of extension libraries [[Bug #19100]]
295+
296+
* Extension libraries provide PRNG, subclasses of `Random`, need updates.
297+
See [PRNG update] below for more information.
298+
294299
## Stdlib compatibility issues
295300

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

301306
## C API updates
302307

308+
### Updated C APIs
309+
310+
The following APIs are updated.
311+
312+
* PRNG update
313+
314+
`rb_random_interface_t` updated and versioned.
315+
Extension libraries which use this interface and built for older versions.
316+
Also `init_int32` function needs to be defined.
317+
303318
### Removed C APIs
304319

305320
The following deprecated APIs are removed.
@@ -400,3 +415,4 @@ The following deprecated APIs are removed.
400415
[Feature #19013]: https://bugs.ruby-lang.org/issues/19013
401416
[Feature #19026]: https://bugs.ruby-lang.org/issues/19026
402417
[Feature #19060]: https://bugs.ruby-lang.org/issues/19060
418+
[Bug #19100]: https://bugs.ruby-lang.org/issues/19100

bootstraptest/runner.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,16 @@ def putc(c)
108108

109109
def wn=(wn)
110110
unless wn == 1
111-
if /(?:\A|\s)--jobserver-(?:auth|fds)=\K(\d+),(\d+)/ =~ ENV.delete("MAKEFLAGS")
111+
if /(?:\A|\s)--jobserver-(?:auth|fds)=(?:(\d+),(\d+)|fifo:((?:\\.|\S)+))/ =~ ENV.delete("MAKEFLAGS")
112112
begin
113-
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
114-
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
113+
if fifo = $3
114+
fifo.gsub!(/\\(?=.)/, '')
115+
r = File.open(fifo, IO::RDONLY|IO::NONBLOCK|IO::BINARY)
116+
w = File.open(fifo, IO::WRONLY|IO::NONBLOCK|IO::BINARY)
117+
else
118+
r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
119+
w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
120+
end
115121
rescue => e
116122
r.close if r
117123
else

class.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class_alloc(VALUE flags, VALUE klass)
197197
{
198198
size_t alloc_size = sizeof(struct RClass);
199199

200-
#if USE_RVARGC
200+
#if RCLASS_EXT_EMBEDDED
201201
alloc_size += sizeof(rb_classext_t);
202202
#endif
203203

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

209-
#if USE_RVARGC
209+
#if RCLASS_EXT_EMBEDDED
210210
memset(RCLASS_EXT(obj), 0, sizeof(rb_classext_t));
211211
#else
212212
obj->ptr = ZALLOC(rb_classext_t);

common.mk

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ showflags:
303303
" LC_ALL = $(LC_ALL)" \
304304
" LC_CTYPE = $(LC_CTYPE)" \
305305
" MFLAGS = $(MFLAGS)" \
306-
" RUST = $(RUST)" \
306+
" RUSTC = $(RUSTC)" \
307307
" YJIT_RUSTC_ARGS = $(YJIT_RUSTC_ARGS)" \
308308
$(MESSAGE_END)
309309
-@$(CC_VERSION)
@@ -956,8 +956,6 @@ PHONY:
956956
{$(srcdir)}.y.c:
957957
$(ECHO) generating $@
958958
$(Q)$(BASERUBY) $(tooldir)/id2token.rb $(SRC_FILE) > parse.tmp.y
959-
$(Q)$(BASERUBY) $(tooldir)/pure_parser.rb parse.tmp.y $(YACC)
960-
$(Q)$(RM) parse.tmp.y.bak
961959
$(Q)$(YACC) -d $(YFLAGS) -o y.tab.c parse.tmp.y
962960
$(Q)$(RM) parse.tmp.y
963961
$(Q)sed -f $(tooldir)/ytab.sed -e "/^#/s|parse\.tmp\.[iy]|$(SRC_FILE)|" -e "/^#/s!y\.tab\.c!$@!" y.tab.c > [email protected]
@@ -6040,6 +6038,7 @@ enumerator.$(OBJEXT): {$(VPATH)}missing.h
60406038
enumerator.$(OBJEXT): {$(VPATH)}onigmo.h
60416039
enumerator.$(OBJEXT): {$(VPATH)}oniguruma.h
60426040
enumerator.$(OBJEXT): {$(VPATH)}ruby_assert.h
6041+
enumerator.$(OBJEXT): {$(VPATH)}shape.h
60436042
enumerator.$(OBJEXT): {$(VPATH)}st.h
60446043
enumerator.$(OBJEXT): {$(VPATH)}subst.h
60456044
error.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
@@ -9378,6 +9377,7 @@ memory_view.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
93789377
memory_view.$(OBJEXT): {$(VPATH)}memory_view.c
93799378
memory_view.$(OBJEXT): {$(VPATH)}memory_view.h
93809379
memory_view.$(OBJEXT): {$(VPATH)}missing.h
9380+
memory_view.$(OBJEXT): {$(VPATH)}shape.h
93819381
memory_view.$(OBJEXT): {$(VPATH)}st.h
93829382
memory_view.$(OBJEXT): {$(VPATH)}subst.h
93839383
memory_view.$(OBJEXT): {$(VPATH)}util.h
@@ -10631,6 +10631,7 @@ object.$(OBJEXT): {$(VPATH)}shape.h
1063110631
object.$(OBJEXT): {$(VPATH)}st.h
1063210632
object.$(OBJEXT): {$(VPATH)}subst.h
1063310633
object.$(OBJEXT): {$(VPATH)}util.h
10634+
object.$(OBJEXT): {$(VPATH)}variable.h
1063410635
pack.$(OBJEXT): $(hdrdir)/ruby/ruby.h
1063510636
pack.$(OBJEXT): $(top_srcdir)/internal/array.h
1063610637
pack.$(OBJEXT): $(top_srcdir)/internal/bits.h
@@ -10812,6 +10813,7 @@ pack.$(OBJEXT): {$(VPATH)}onigmo.h
1081210813
pack.$(OBJEXT): {$(VPATH)}oniguruma.h
1081310814
pack.$(OBJEXT): {$(VPATH)}pack.c
1081410815
pack.$(OBJEXT): {$(VPATH)}pack.rbinc
10816+
pack.$(OBJEXT): {$(VPATH)}shape.h
1081510817
pack.$(OBJEXT): {$(VPATH)}st.h
1081610818
pack.$(OBJEXT): {$(VPATH)}subst.h
1081710819
pack.$(OBJEXT): {$(VPATH)}util.h
@@ -11024,6 +11026,7 @@ parse.$(OBJEXT): {$(VPATH)}ractor.h
1102411026
parse.$(OBJEXT): {$(VPATH)}regenc.h
1102511027
parse.$(OBJEXT): {$(VPATH)}regex.h
1102611028
parse.$(OBJEXT): {$(VPATH)}ruby_assert.h
11029+
parse.$(OBJEXT): {$(VPATH)}shape.h
1102711030
parse.$(OBJEXT): {$(VPATH)}st.h
1102811031
parse.$(OBJEXT): {$(VPATH)}subst.h
1102911032
parse.$(OBJEXT): {$(VPATH)}symbol.h
@@ -11855,6 +11858,7 @@ random.$(OBJEXT): {$(VPATH)}ractor.h
1185511858
random.$(OBJEXT): {$(VPATH)}random.c
1185611859
random.$(OBJEXT): {$(VPATH)}random.h
1185711860
random.$(OBJEXT): {$(VPATH)}ruby_atomic.h
11861+
random.$(OBJEXT): {$(VPATH)}shape.h
1185811862
random.$(OBJEXT): {$(VPATH)}siphash.c
1185911863
random.$(OBJEXT): {$(VPATH)}siphash.h
1186011864
random.$(OBJEXT): {$(VPATH)}st.h
@@ -12047,6 +12051,7 @@ range.$(OBJEXT): {$(VPATH)}missing.h
1204712051
range.$(OBJEXT): {$(VPATH)}onigmo.h
1204812052
range.$(OBJEXT): {$(VPATH)}oniguruma.h
1204912053
range.$(OBJEXT): {$(VPATH)}range.c
12054+
range.$(OBJEXT): {$(VPATH)}shape.h
1205012055
range.$(OBJEXT): {$(VPATH)}st.h
1205112056
range.$(OBJEXT): {$(VPATH)}subst.h
1205212057
rational.$(OBJEXT): $(hdrdir)/ruby/ruby.h
@@ -14026,6 +14031,7 @@ shape.$(OBJEXT): {$(VPATH)}constant.h
1402614031
shape.$(OBJEXT): {$(VPATH)}debug_counter.h
1402714032
shape.$(OBJEXT): {$(VPATH)}defines.h
1402814033
shape.$(OBJEXT): {$(VPATH)}encoding.h
14034+
shape.$(OBJEXT): {$(VPATH)}gc.h
1402914035
shape.$(OBJEXT): {$(VPATH)}id.h
1403014036
shape.$(OBJEXT): {$(VPATH)}id_table.h
1403114037
shape.$(OBJEXT): {$(VPATH)}intern.h
@@ -16009,6 +16015,7 @@ time.$(OBJEXT): {$(VPATH)}missing.h
1600916015
time.$(OBJEXT): {$(VPATH)}onigmo.h
1601016016
time.$(OBJEXT): {$(VPATH)}oniguruma.h
1601116017
time.$(OBJEXT): {$(VPATH)}ruby_assert.h
16018+
time.$(OBJEXT): {$(VPATH)}shape.h
1601216019
time.$(OBJEXT): {$(VPATH)}st.h
1601316020
time.$(OBJEXT): {$(VPATH)}subst.h
1601416021
time.$(OBJEXT): {$(VPATH)}time.c
@@ -16373,6 +16380,7 @@ transient_heap.$(OBJEXT): {$(VPATH)}internal/warning_push.h
1637316380
transient_heap.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
1637416381
transient_heap.$(OBJEXT): {$(VPATH)}missing.h
1637516382
transient_heap.$(OBJEXT): {$(VPATH)}ruby_assert.h
16383+
transient_heap.$(OBJEXT): {$(VPATH)}shape.h
1637616384
transient_heap.$(OBJEXT): {$(VPATH)}st.h
1637716385
transient_heap.$(OBJEXT): {$(VPATH)}subst.h
1637816386
transient_heap.$(OBJEXT): {$(VPATH)}transient_heap.c

compile.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7449,7 +7449,30 @@ compile_iter(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
74497449
ISEQ_TYPE_BLOCK, line);
74507450
CHECK(COMPILE(ret, "iter caller", node->nd_iter));
74517451
}
7452-
ADD_LABEL(ret, retry_end_l);
7452+
7453+
{
7454+
// We need to put the label "retry_end_l" immediately after the last "send" instruction.
7455+
// This because vm_throw checks if the break cont is equal to the index of next insn of the "send".
7456+
// (Otherwise, it is considered "break from proc-closure". See "TAG_BREAK" handling in "vm_throw_start".)
7457+
//
7458+
// Normally, "send" instruction is at the last.
7459+
// However, qcall under branch coverage measurement adds some instructions after the "send".
7460+
//
7461+
// Note that "invokesuper" appears instead of "send".
7462+
INSN *iobj;
7463+
LINK_ELEMENT *last_elem = LAST_ELEMENT(ret);
7464+
iobj = IS_INSN(last_elem) ? (INSN*) last_elem : (INSN*) get_prev_insn((INSN*) last_elem);
7465+
while (INSN_OF(iobj) != BIN(send) && INSN_OF(iobj) != BIN(invokesuper)) {
7466+
iobj = (INSN*) get_prev_insn(iobj);
7467+
}
7468+
ELEM_INSERT_NEXT(&iobj->link, (LINK_ELEMENT*) retry_end_l);
7469+
7470+
// LINK_ANCHOR has a pointer to the last element, but ELEM_INSERT_NEXT does not update it
7471+
// even if we add an insn to the last of LINK_ANCHOR. So this updates it manually.
7472+
if (&iobj->link == LAST_ELEMENT(ret)) {
7473+
ret->last = (LINK_ELEMENT*) retry_end_l;
7474+
}
7475+
}
74537476

74547477
if (popped) {
74557478
ADD_INSN(ret, line_node, pop);

0 commit comments

Comments
 (0)