This patch fixes issues with building CRuby 2.3.3 with OPT_STACK_CACHING turned on.
Note that it doesn't fully work yet. This patch does allow the core VM to build, producing the miniruby binary.
But as soon as it runs any substantial Ruby code, e.g. building the cgi
library, it ends up crashing.
The implementation in compile.c
around iseq_set_sequence_stackcaching()
/ REPLACE_ELEM
and friends is probably where the remaining bug is.
It'd be nice to know what caused nobu-san to comment out REPLACE_ELEM
in the first place.
$ make install
...
linking miniruby
generating encdb.h
/private/tmp/ruby-2.3.3/lib/cgi/util.rb:199: [BUG] Stack consistency error (sp: 39, bp: 35)
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin13]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0007 p:0265 s:0039 e:000034 CLASS /private/tmp/ruby-2.3.3/lib/cgi/util.rb:199
c:0006 p:0023 s:0033 e:000032 TOP /private/tmp/ruby-2.3.3/lib/cgi/util.rb:3 [FINISH]
c:0005 p:---- s:0031 e:000030 CFUNC :require
c:0004 p:0008 s:0027 e:000026 TOP /private/tmp/ruby-2.3.3/lib/erb.rb:15 [FINISH]
c:0003 p:---- s:0025 e:000024 CFUNC :require
c:0002 p:0008 s:0021 E:002468 EVAL ./tool/generic_erb.rb:2 [FINISH]
c:0001 p:0000 s:0002 E:001f40 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
./tool/generic_erb.rb:2:in `<main>'
./tool/generic_erb.rb:2:in `require'
/private/tmp/ruby-2.3.3/lib/erb.rb:15:in `<top (required)>'
/private/tmp/ruby-2.3.3/lib/erb.rb:15:in `require'
/private/tmp/ruby-2.3.3/lib/cgi/util.rb:3:in `<top (required)>'
/private/tmp/ruby-2.3.3/lib/cgi/util.rb:199:in `<module:Util>'
-- C level backtrace information -------------------------------------------
0 miniruby 0x0000000104391b44 rb_vm_bugreport + 388
1 miniruby 0x00000001041ed715 rb_bug + 485
2 miniruby 0x000000010434e2fa vm_exec_core + 125082
3 miniruby 0x0000000104381899 vm_exec + 137
4 miniruby 0x00000001041fa99e rb_load_internal0 + 286
5 miniruby 0x00000001041fb11a rb_require_internal + 1434
6 miniruby 0x00000001041faa28 rb_f_require + 24
7 miniruby 0x000000010438f999 vm_call_cfunc + 329
8 miniruby 0x000000010438ed68 vm_call_method_each_type + 104
9 miniruby 0x000000010438eca9 vm_call_method + 265
10 miniruby 0x000000010434d19d vm_exec_core + 120637
11 miniruby 0x0000000104381899 vm_exec + 137
12 miniruby 0x00000001041fa99e rb_load_internal0 + 286
13 miniruby 0x00000001041fb11a rb_require_internal + 1434
14 miniruby 0x00000001041faa28 rb_f_require + 24
15 miniruby 0x000000010438f999 vm_call_cfunc + 329
16 miniruby 0x000000010438ed68 vm_call_method_each_type + 104
17 miniruby 0x000000010438eca9 vm_call_method + 265
18 miniruby 0x000000010434d19d vm_exec_core + 120637
19 miniruby 0x0000000104381899 vm_exec + 137
20 miniruby 0x00000001041f6ce4 ruby_exec_internal + 148
21 miniruby 0x00000001041f6c0e ruby_run_node + 78
22 miniruby 0x00000001041ae09f main + 79
-- Other runtime information -----------------------------------------------
* Loaded script: ./tool/generic_erb.rb
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
make: *** [encdb.h] Abort trap: 6