1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Assert in_gc >= 0 instead of guarding it (#3687)

This commit is contained in:
Takashi Kokubun 2020-10-22 21:59:13 -07:00 committed by GitHub
parent 7cf34cfaa3
commit 40bad72f31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2020-10-23 13:59:41 +09:00
Merged-By: k0kubun <takashikkbn@gmail.com>

4
mjit.c
View file

@ -109,9 +109,7 @@ mjit_gc_exit_hook(void)
return;
CRITICAL_SECTION_START(4, "mjit_gc_exit_hook");
in_gc--;
if (in_gc < 0) { // Don't allow underflow
in_gc = 0;
}
RUBY_ASSERT_ALWAYS(in_gc >= 0);
if (!in_gc) {
verbose(4, "Sending wakeup signal to workers after GC");
rb_native_cond_broadcast(&mjit_gc_wakeup);