Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into Ractor-Local-GC-v…
Browse files Browse the repository at this point in the history
…ersion-2
  • Loading branch information
rm155 committed Feb 29, 2024
2 parents 4e49fc2 + cb78408 commit 3c01235
Show file tree
Hide file tree
Showing 26 changed files with 381 additions and 203 deletions.
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# YJIT sources and tests
yjit* @ruby/yjit
yjit/**/* @ruby/yjit
doc/yjit/* @ruby/yjit
bootstraptest/test_yjit* @ruby/yjit
test/ruby/test_yjit* @ruby/yjit
yjit/src/cruby_bindings.inc.rs
9 changes: 8 additions & 1 deletion .github/actions/launchable/record-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ inputs:
Test options that determine how tests are run.
This value is used in the Launchable flavor.
srcdir:
required: false
default: ${{ github.workspace }}
description: >-
Directory to (re-)checkout source codes. Launchable retrives the commit information
from the directory.
outputs: {} # nothing?

runs:
using: composite

steps:
- name: Launchable - record tests
working-directory: ${{ inputs.builddir }}
working-directory: ${{ inputs.srcdir }}
shell: bash
run: |
test_opts="$(echo ${{ inputs.test-opts }} | sed 's/=/:/g' | sed 's/ //g')"
Expand Down
8 changes: 8 additions & 0 deletions .github/actions/launchable/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ inputs:
Launchable token is needed if you want to run Launchable on your forked repository.
See https://github.com/ruby/ruby/wiki/CI-Servers#launchable-ci for details.
srcdir:
required: false
default: ${{ github.workspace }}
description: >-
Directory to (re-)checkout source codes. Launchable retrives the commit information
from the directory.
outputs:
enable-launchable:
description: "The boolean value indicating whether Launchable is enabled or not"
Expand Down Expand Up @@ -66,6 +73,7 @@ runs:

- name: Set up Launchable
shell: bash
working-directory: ${{ inputs.srcdir }}
run: |
set -x
PATH=$PATH:$(python -msite --user-base)/bin
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/setup/directories/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ inputs:
description: >-
If set to true, creates dummy files in build dir.
fetch-depth:
required: false
default: '1'
description: The depth of commit history fetched from the remote repository

outputs: {} # nothing?

runs:
Expand Down Expand Up @@ -79,6 +84,7 @@ runs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: ${{ inputs.srcdir }}
fetch-depth: ${{ inputs.fetch-depth }}

- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
Expand Down
13 changes: 0 additions & 13 deletions .github/auto_request_review.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/auto_request_review.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ jobs:
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
# Set fetch-depth: 0 so that Launchable can receive commits information.
fetch-depth: 0

- name: Install libraries
uses: ./.github/actions/setup/macos
Expand All @@ -68,6 +66,8 @@ jobs:
builddir: build
makeup: true
dummy-files: ${{ matrix.test_task == 'check' }}
# Set fetch-depth: 0 so that Launchable can receive commits information.
fetch-depth: 10

- name: Run configure
run: ../src/configure -C --disable-install-doc
Expand All @@ -89,6 +89,7 @@ jobs:
uses: ./.github/actions/launchable/setup
with:
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
srcdir: src

- name: Set extra test options
run: echo "TESTS=$TESTS ${{ matrix.test_opts }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -118,9 +119,10 @@ jobs:
with:
# We need to configure the `build` directory because
# this composite action is executed in the default working directory.
report-path: build/launchable_reports.json
report-path: ../build/launchable_reports.json
os: ${{ matrix.os }}
test-opts: ${{ matrix.test_opts }}
srcdir: src
if: ${{ always() && steps.enable-launchable.outputs.enable-launchable }}

- uses: ./.github/actions/slack
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ jobs:
builddir: build
makeup: true
dummy-files: ${{ matrix.test_task == 'check' }}
# Set fetch-depth: 10 so that Launchable can receive commits information.
fetch-depth: 10

- uses: ruby/setup-ruby@d4526a55538b775af234ba4af27118ed6f8f6677 # v1.172.0
with:
Expand Down Expand Up @@ -100,6 +102,7 @@ jobs:
uses: ./.github/actions/launchable/setup
with:
launchable-token: ${{ secrets.LAUNCHABLE_TOKEN }}
srcdir: src

- name: make ${{ matrix.test_task }}
run: >-
Expand All @@ -126,9 +129,10 @@ jobs:
with:
# We need to configure the `build` directory because
# this composite action is executed in the default working directory.
report-path: build/launchable_reports.json
report-path: ../build/launchable_reports.json
os: ubuntu-20.04
test-opts: ${{ matrix.configure }}
srcdir: src
if: ${{ always() && steps.enable-launchable.outputs.enable-launchable }}

- uses: ./.github/actions/slack
Expand Down
16 changes: 16 additions & 0 deletions bootstraptest/test_yjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4658,3 +4658,19 @@ def test_cfunc_vargs_splat(sub_instance, array_class, empty_kw_hash)
test_cfunc_vargs_splat(Foo.new, Array, Hash.ruby2_keywords_hash({}))
}

# Class#new (arity=-1), splat, and ruby2_keywords
assert_equal '[0, {1=>1}]', %q{
class KwInit
attr_reader :init_args
def initialize(x = 0, **kw)
@init_args = [x, kw]
end
end
def test(klass, args)
klass.new(*args).init_args
end
test(KwInit, [Hash.ruby2_keywords_hash({1 => 1})])
}
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ main()
[wasi*],[ LIBS="-lm -lwasi-emulated-mman -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks $LIBS"
RUBY_APPEND_OPTIONS(CFLAGS, -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_GETPID -D_WASI_EMULATED_PROCESS_CLOCKS)
RUBY_APPEND_OPTIONS(CPPFLAGS, -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_GETPID -D_WASI_EMULATED_PROCESS_CLOCKS)
POSTLINK="\$(WASMOPT) --asyncify \$(wasmoptflags) --pass-arg=asyncify-ignore-imports -o \$@ \$@${POSTLINK:+; $POSTLINK}"
POSTLINK="\$(WASMOPT) --asyncify \$(wasmoptflags) -o \$@ \$@${POSTLINK:+; $POSTLINK}"
# wasi-libc's sys/socket.h is not compatible with -std=gnu99,
# so re-declare shutdown in include/ruby/missing.h
ac_cv_func_shutdown=no
Expand Down
16 changes: 7 additions & 9 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5293,7 +5293,7 @@ should_be_finalizable(VALUE obj)
rb_check_frozen(obj);
}

VALUE
static VALUE
rb_define_finalizer_no_check(VALUE obj, VALUE block)
{
rb_objspace_t *objspace = &rb_objspace;
Expand Down Expand Up @@ -5439,10 +5439,10 @@ rb_gc_copy_finalizer(VALUE dest, VALUE obj)
WITH_OBJSPACE_OF_VALUE_ENTER(dest, objspace);
{
st_insert(finalizer_table, dest, table);
FL_SET(dest, FL_FINALIZE);
}
WITH_OBJSPACE_OF_VALUE_LEAVE(objspace);
}
FL_SET(dest, FL_FINALIZE);
}

static VALUE
Expand Down Expand Up @@ -5512,6 +5512,7 @@ run_final(rb_objspace_t *objspace, VALUE zombie)

st_data_t key = (st_data_t)zombie;
if (FL_TEST_RAW(zombie, FL_FINALIZE)) {
FL_UNSET(zombie, FL_FINALIZE);
st_data_t table;
if (st_delete(finalizer_table, &key, &table)) {
run_finalizer(objspace, zombie, (VALUE)table);
Expand Down Expand Up @@ -5701,11 +5702,12 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
st_foreach(finalizer_table, force_chain_object, (st_data_t)&list);
while (list) {
struct force_finalize_list *curr = list;
run_finalizer(objspace, curr->obj, curr->table);
FL_UNSET(curr->obj, FL_FINALIZE);

st_data_t obj = (st_data_t)curr->obj;
st_delete(finalizer_table, &obj, 0);
FL_UNSET(curr->obj, FL_FINALIZE);

run_finalizer(objspace, curr->obj, curr->table);

list = curr->next;
xfree(curr);
Expand Down Expand Up @@ -6651,7 +6653,7 @@ static VALUE
count_objects(int argc, VALUE *argv, VALUE os)
{
rb_objspace_t *objspace = &rb_objspace;
size_t counts[T_MASK+1];
size_t counts[T_MASK + 1] = { 0 };
size_t freed = 0;
size_t total = 0;
size_t i;
Expand All @@ -6663,10 +6665,6 @@ count_objects(int argc, VALUE *argv, VALUE os)
rb_raise(rb_eTypeError, "non-hash given");
}

for (i = 0; i <= T_MASK; i++) {
counts[i] = 0;
}

rb_ractor_t *r = GET_RACTOR();
for (i = 0; i < heap_allocated_pages; i++) {
struct heap_page *page = heap_pages_sorted[i];
Expand Down
2 changes: 1 addition & 1 deletion gems/bundled_gems
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ net-pop 0.1.2 https://github.com/ruby/net-pop
net-smtp 0.4.0.1 https://github.com/ruby/net-smtp
matrix 0.4.2 https://github.com/ruby/matrix
prime 0.1.2 https://github.com/ruby/prime
rbs 3.4.4 https://github.com/ruby/rbs
rbs 3.4.4 https://github.com/ruby/rbs 56ae86bb5f4864f5057778bd45b280248b012329
typeprof 0.21.11 https://github.com/ruby/typeprof
debug 1.9.1 https://github.com/ruby/debug 2d602636d99114d55a32fedd652c9c704446a749
racc 1.7.3 https://github.com/ruby/racc
Expand Down
1 change: 0 additions & 1 deletion internal/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ size_t rb_gc_obj_slot_size(VALUE obj);
bool rb_gc_size_allocatable_p(size_t size);
int rb_objspace_garbage_object_p(VALUE obj);
bool rb_gc_is_ptr_to_obj(const void *ptr);
VALUE rb_define_finalizer_no_check(VALUE obj, VALUE block);

int rb_during_local_gc(void);
int rb_during_global_gc(void);
Expand Down
4 changes: 2 additions & 2 deletions iseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ pm_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, V
VALUE error;
if (RB_TYPE_P(src, T_FILE)) {
VALUE filepath = rb_io_path(src);
error = pm_parse_file(&result, filepath);
error = pm_load_parse_file(&result, filepath);
RB_GC_GUARD(filepath);
}
else {
Expand Down Expand Up @@ -1650,7 +1650,7 @@ iseqw_s_compile_file_prism(int argc, VALUE *argv, VALUE self)
pm_parse_result_t result = { 0 };
result.options.line = 1;

VALUE error = pm_parse_file(&result, file);
VALUE error = pm_load_parse_file(&result, file);

if (error == Qnil) {
make_compile_option(&option, opt);
Expand Down
2 changes: 1 addition & 1 deletion load.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ load_iseq_eval(rb_execution_context_t *ec, VALUE fname)
pm_parse_result_t result = { 0 };
result.options.line = 1;

VALUE error = pm_parse_file(&result, fname);
VALUE error = pm_load_parse_file(&result, fname);

if (error == Qnil) {
iseq = pm_iseq_new_top(&result.node, rb_fstring_lit("<top (required)>"), fname, realpath_internal_cached(realpath_map, fname), NULL);
Expand Down
Loading

0 comments on commit 3c01235

Please sign in to comment.