ruby-changes:69884
From: nagachika <ko1@a...>
Date: Wed, 24 Nov 2021 12:04:18 +0900 (JST)
Subject: [ruby-changes:69884] 7b3948750e (ruby_3_0): merge revision(s) e1b03b0c2b2449a7794f4701bab8b2382eb15116,007e439fe965871c73127928f7244ebb96a86e58:
https://git.ruby-lang.org/ruby.git/commit/?id=7b3948750e From 7b3948750e1b1dd8cb271c0a7377b911bb3b8f1b Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@r...> Date: Wed, 24 Nov 2021 12:03:46 +0900 Subject: merge revision(s) e1b03b0c2b2449a7794f4701bab8b2382eb15116,007e439fe965871c73127928f7244ebb96a86e58: Enable VM_ASSERT in --jit CIs (#4543) --- .github/workflows/mjit.yml | 2 +- ractor.c | 6 +++--- vm_core.h | 6 +++--- vm_method.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) Do not expect ec on rb_vm_bugreport because a SEGV might happen on an MJIT worker. As you can clearly see from `if (vm && ec) {`, ec is not guaranteed to exist here. --- vm_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- .github/workflows/mjit.yml | 2 +- ractor.c | 6 +++--- version.h | 4 ++-- vm_core.h | 6 +++--- vm_dump.c | 2 +- vm_method.c | 2 +- vm_trace.c | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/mjit.yml b/.github/workflows/mjit.yml index 7695a473592..9e3a6d6ab73 100644 --- a/.github/workflows/mjit.yml +++ b/.github/workflows/mjit.yml @@ -38,7 +38,7 @@ jobs: https://github.com/ruby/ruby/blob/trunk/.github/workflows/mjit.yml#L38 - run: ./autogen.sh working-directory: src - name: Run configure - run: ../src/configure -C --disable-install-doc + run: ../src/configure -C --disable-install-doc cppflags=-DVM_CHECK_MODE - run: make $JOBS incs - run: make $JOBS - run: sudo make $JOBS -s install diff --git a/ractor.c b/ractor.c index 7d6fec76e05..de3ab8c16f5 100644 --- a/ractor.c +++ b/ractor.c @@ -34,7 +34,7 @@ ASSERT_ractor_unlocking(rb_ractor_t *r) https://github.com/ruby/ruby/blob/trunk/ractor.c#L34 { #if RACTOR_CHECK_MODE > 0 // GET_EC is NULL in an MJIT worker - if (GET_EC() != NULL && r->sync.locked_by == rb_ractor_self(GET_RACTOR())) { + if (rb_current_execution_context(false) != NULL && r->sync.locked_by == rb_ractor_self(GET_RACTOR())) { rb_bug("recursive ractor locking"); } #endif @@ -45,7 +45,7 @@ ASSERT_ractor_locking(rb_ractor_t *r) https://github.com/ruby/ruby/blob/trunk/ractor.c#L45 { #if RACTOR_CHECK_MODE > 0 // GET_EC is NULL in an MJIT worker - if (GET_EC() != NULL && r->sync.locked_by != rb_ractor_self(GET_RACTOR())) { + if (rb_current_execution_context(false) != NULL && r->sync.locked_by != rb_ractor_self(GET_RACTOR())) { rp(r->sync.locked_by); rb_bug("ractor lock is not acquired."); } @@ -61,7 +61,7 @@ ractor_lock(rb_ractor_t *r, const char *file, int line) https://github.com/ruby/ruby/blob/trunk/ractor.c#L61 rb_native_mutex_lock(&r->sync.lock); #if RACTOR_CHECK_MODE > 0 - if (GET_EC() != NULL) { // GET_EC is NULL in an MJIT worker + if (rb_current_execution_context(false) != NULL) { // GET_EC is NULL in an MJIT worker r->sync.locked_by = rb_ractor_self(GET_RACTOR()); } #endif diff --git a/version.h b/version.h index 155977aa363..99dfe088e7f 100644 --- a/version.h +++ b/version.h @@ -12,11 +12,11 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L12 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 3 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 153 +#define RUBY_PATCHLEVEL 154 #define RUBY_RELEASE_YEAR 2021 #define RUBY_RELEASE_MONTH 11 -#define RUBY_RELEASE_DAY 23 +#define RUBY_RELEASE_DAY 24 #include "ruby/version.h" diff --git a/vm_core.h b/vm_core.h index edf6da1076f..6ab3608edd5 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1760,7 +1760,7 @@ RUBY_SYMBOL_EXPORT_END https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1760 #define GET_VM() rb_current_vm() #define GET_RACTOR() rb_current_ractor() #define GET_THREAD() rb_current_thread() -#define GET_EC() rb_current_execution_context() +#define GET_EC() rb_current_execution_context(true) static inline rb_thread_t * rb_ec_thread_ptr(const rb_execution_context_t *ec) @@ -1794,7 +1794,7 @@ rb_ec_vm_ptr(const rb_execution_context_t *ec) https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1794 } static inline rb_execution_context_t * -rb_current_execution_context(void) +rb_current_execution_context(bool expect_ec) { #ifdef RB_THREAD_LOCAL_SPECIFIER #if __APPLE__ @@ -1805,7 +1805,7 @@ rb_current_execution_context(void) https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1805 #else rb_execution_context_t *ec = native_tls_get(ruby_current_ec_key); #endif - VM_ASSERT(ec != NULL); + VM_ASSERT(!expect_ec || ec != NULL); return ec; } diff --git a/vm_dump.c b/vm_dump.c index 55095945be2..47fc9f93a62 100644 --- a/vm_dump.c +++ b/vm_dump.c @@ -982,7 +982,7 @@ rb_vm_bugreport(const void *ctx) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L982 enum {other_runtime_info = 0}; #endif const rb_vm_t *const vm = GET_VM(); - const rb_execution_context_t *ec = GET_EC(); + const rb_execution_context_t *ec = rb_current_execution_context(false); if (vm && ec) { SDR(); diff --git a/vm_method.c b/vm_method.c index e55fc4697c7..7fc3f8db974 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1482,7 +1482,7 @@ static void https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1482 scope_visibility_check(void) { /* Check for public/protected/private/module_function called inside a method */ - rb_control_frame_t *cfp = rb_current_execution_context()->cfp+1; + rb_control_frame_t *cfp = GET_EC()->cfp+1; if (cfp && cfp->iseq && cfp->iseq->body->type == ISEQ_TYPE_METHOD) { rb_warn("calling %s without arguments inside a method may not have the intended effect", rb_id2name(rb_frame_this_func())); diff --git a/vm_trace.c b/vm_trace.c index bb4fdefd7c1..6cbb5ed843f 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1595,7 +1595,7 @@ postponed_job_register(rb_execution_context_t *ec, rb_vm_t *vm, https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1595 static rb_execution_context_t * get_valid_ec(rb_vm_t *vm) { - rb_execution_context_t *ec = rb_current_execution_context(); + rb_execution_context_t *ec = rb_current_execution_context(false); if (ec == NULL) ec = rb_vm_main_ractor_ec(vm); return ec; } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/