@@ -24,102 +24,83 @@ jobs:
2424 ref : bug/blocking-operation-gc
2525 path : ruby-src
2626
27- - name : Configure Ruby (shared flags for all cases)
28- working-directory : ruby-src
29- run : |
30- ./autogen.sh
31- ./configure \
32- --prefix=$HOME/.rubies/ruby-caseA \
33- --enable-shared \
34- --disable-install-doc \
35- --enable-yjit \
36- cppflags="-DENABLE_PATH_CHECK=0"
37-
3827 # ── CASE_A: NULL, full O3 (expected to crash) ─────────────────────────
3928 - name : Patch to CASE_A — operation = NULL
4029 working-directory : ruby-src
4130 run : |
31+ ./autogen.sh
32+ ./configure --prefix=$HOME/.rubies/ruby-caseA --enable-shared --disable-install-doc cppflags="-DENABLE_PATH_CHECK=0"
4233 sed -i 's/rb_fiber_scheduler_blocking_operation_t \*operation = get_blocking_operation(blocking_operation);/rb_fiber_scheduler_blocking_operation_t *operation = NULL;/' scheduler.c
4334 grep -n "operation = NULL" scheduler.c
4435
4536 - name : Build + install CASE_A
4637 working-directory : ruby-src
4738 run : make -j$(nproc) && make install
4839
49- - name : Set up io-event for CASE_A
50- run : |
51- $HOME/.rubies/ruby-caseA/bin/gem install bundler --no-document
52- $HOME/.rubies/ruby-caseA/bin/bundle install
53- $HOME/.rubies/ruby-caseA/bin/bundle exec ruby -e "require 'io/event'; puts IO::Event::Selector.default"
54- $HOME/.rubies/ruby-caseA/bin/bundle exec rake build 2>/dev/null || \
55- $HOME/.rubies/ruby-caseA/bin/bundle exec ruby ext/extconf.rb && make -C ext
56-
57- - name : Build io-event extension for CASE_A
58- run : |
59- $HOME/.rubies/ruby-caseA/bin/ruby ext/io/event/extconf.rb
60- make -C ext
61-
62- - name : Run tcp_socket test CASE_A (expect crash)
63- id : test_caseA
64- run : |
65- $HOME/.rubies/ruby-caseA/bin/bundle exec ruby test/tcp_socket.rb 2>&1 | tail -5 || true
66- echo "status=$?" >> $GITHUB_OUTPUT
67- continue-on-error : true
68-
6940 # ── CASE_C: NULL + O0 on function ─────────────────────────────────────
70- - name : Patch to CASE_C — add __attribute__((optimize("O0"))) + NULL
41+ - name : Patch to CASE_C — CASE_A + __attribute__((optimize("O0")))
7142 working-directory : ruby-src
7243 run : |
7344 git checkout scheduler.c
7445 sed -i 's/rb_fiber_scheduler_blocking_operation_t \*operation = get_blocking_operation(blocking_operation);/rb_fiber_scheduler_blocking_operation_t *operation = NULL;/' scheduler.c
7546 sed -i 's/^VALUE rb_fiber_scheduler_blocking_operation_wait(/__attribute__((optimize("O0"))) VALUE rb_fiber_scheduler_blocking_operation_wait(/' scheduler.c
7647 grep -n 'optimize\|operation = NULL' scheduler.c | head -5
77- ./configure \
78- --prefix=$HOME/.rubies/ruby-caseC \
79- --enable-shared \
80- --disable-install-doc \
81- --enable-yjit \
82- cppflags="-DENABLE_PATH_CHECK=0"
48+ ./configure --prefix=$HOME/.rubies/ruby-caseC --enable-shared --disable-install-doc cppflags="-DENABLE_PATH_CHECK=0"
8349
8450 - name : Build + install CASE_C
8551 working-directory : ruby-src
8652 run : make -j$(nproc) && make install
8753
88- - name : Build io-event extension for CASE_C
89- run : |
90- $HOME/.rubies/ruby-caseC/bin/ruby ext/io/event/extconf.rb
91- make -C ext
92-
93- - name : Run tcp_socket test CASE_C (does O0 fix the crash?)
94- id : test_caseC
95- run : |
96- $HOME/.rubies/ruby-caseC/bin/bundle exec ruby test/tcp_socket.rb 2>&1 | tail -5 || true
97- echo "status=$?" >> $GITHUB_OUTPUT
98- continue-on-error : true
99-
100- # ── Compare disassembly ────────────────────────────────────────────────
101- - name : Disassemble CASE_A vs CASE_C (key function only)
54+ # ── Disassemble both ───────────────────────────────────────────────────
55+ - name : Disassemble CASE_A and CASE_C
10256 run : |
10357 echo "=== CASE_A (O3, operation=NULL) ==="
10458 objdump -d --no-show-raw-insn -M intel $HOME/.rubies/ruby-caseA/lib/libruby.so.4.1 \
10559 | awk '/^[0-9a-f]+ <rb_fiber_scheduler_blocking_operation_wait>:/{found=1} found{print} found && /^$/{exit}' \
10660 > /tmp/case_a.asm
107- wc -l /tmp/case_a.asm
61+ cat /tmp/case_a.asm
62+ echo ""
10863 echo "=== CASE_C (O0 on fn, operation=NULL) ==="
10964 objdump -d --no-show-raw-insn -M intel $HOME/.rubies/ruby-caseC/lib/libruby.so.4.1 \
11065 | awk '/^[0-9a-f]+ <rb_fiber_scheduler_blocking_operation_wait>:/{found=1} found{print} found && /^$/{exit}' \
11166 > /tmp/case_c.asm
112- wc -l /tmp/case_c.asm
67+ cat /tmp/case_c.asm
11368
114- - name : Upload disassembly
69+ - name : Upload disassembly artifacts
11570 uses : actions/upload-artifact@v4
11671 if : always()
11772 with :
11873 name : disassembly-A-vs-C
11974 path : /tmp/case_*.asm
12075
76+ # ── Build io-event extension for each Ruby and test ───────────────────
77+ - name : Build io-event for CASE_A
78+ run : |
79+ export PATH=$HOME/.rubies/ruby-caseA/bin:$PATH
80+ gem install bundler --no-document
81+ bundle install
82+ cd ext/io/event && ruby extconf.rb && make
83+
84+ - name : Run worker_pool test CASE_A (expect crash)
85+ id : test_caseA
86+ run : |
87+ export PATH=$HOME/.rubies/ruby-caseA/bin:$PATH
88+ (bundle exec ruby test/io/event/worker_pool.rb 2>&1 | tail -10; echo "exit:$?") || true
89+ continue-on-error : true
90+
91+ - name : Build io-event for CASE_C
92+ run : |
93+ export PATH=$HOME/.rubies/ruby-caseC/bin:$PATH
94+ cd ext/io/event && ruby extconf.rb && make
95+
96+ - name : Run worker_pool test CASE_C (does O0 fix the crash?)
97+ id : test_caseC
98+ run : |
99+ export PATH=$HOME/.rubies/ruby-caseC/bin:$PATH
100+ (bundle exec ruby test/io/event/worker_pool.rb 2>&1 | tail -10; echo "exit:$?") || true
101+ continue-on-error : true
102+
121103 - name : Summary
104+ if : always()
122105 run : |
123- echo "CASE_A (O3, NULL): status ${{ steps.test_caseA.outputs.status }}"
124- echo "CASE_C (O0, NULL): status ${{ steps.test_caseC.outputs.status }}"
125- echo "If CASE_A crashes and CASE_C passes -> optimization-level is the cause"
106+ echo "If CASE_A crashes and CASE_C passes -> optimization level is the cause"
0 commit comments