Project

General

Profile

Bug #18782 » 0001-Add-RUBY_VM_CRITICAL_SECTION-for-detecting-unexpecte.patch

ioquatix (Samuel Williams), 05/14/2022 11:05 PM

View differences:

thread.c
blocking_region_begin(rb_thread_t *th, struct rb_blocking_region_buffer *region,
rb_unblock_function_t *ubf, void *arg, int fail_if_interrupted)
{
#ifdef RUBY_VM_CRITICAL_SECTION
VM_ASSERT(rb_vm_critical_section_entered == 0);
#endif
region->prev_status = th->status;
if (unblock_function_set(th, ubf, arg, fail_if_interrupted)) {
th->blocking_region_buffer = region;
vm.c
#endif
#include "probes_helper.h"
#ifdef RUBY_VM_CRITICAL_SECTION
int rb_vm_critical_section_entered = 0;
#endif
VALUE rb_str_concat_literals(size_t, const VALUE*);
/* :FIXME: This #ifdef is because we build pch in case of mswin and
vm_core.h
#if VM_CHECK_MODE > 0
#define VM_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(VM_CHECK_MODE > 0, expr, #expr)
#define VM_UNREACHABLE(func) rb_bug(#func ": unreachable")
#define RUBY_VM_CRITICAL_SECTION
#else
#define VM_ASSERT(expr) ((void)0)
#define VM_UNREACHABLE(func) UNREACHABLE
#endif
#if defined(RUBY_VM_CRITICAL_SECTION)
extern int rb_vm_critical_section_entered;
#define RUBY_VM_CRITICAL_SECTION_ENTER rb_vm_critical_section_entered += 1;
#define RUBY_VM_CRITICAL_SECTION_EXIT rb_vm_critical_section_entered -= 1;
#else
#define RUBY_VM_CRITICAL_SECTION_ENTER
#define RUBY_VM_CRITICAL_SECTION_EXIT
#endif
#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
# include "wasm/setjmp.h"
#else
(1-1/5)