path: root/spec/ruby/command_line
diff options
authorAlan Wu <>2021-11-19 23:44:13 -0500
committerAlan Wu <>2021-12-01 12:25:28 -0500
commitd0772632bf2ff15f73c0d3601d958670a5c77855 (patch)
tree8bf717561d2ab3d49d97cd69d8a2db794504b624 /spec/ruby/command_line
parenta84dc9d80d41db01db4623517ade928ee7f40e36 (diff)
YJIT: Fail gracefully while OOM for new entry points
Previously, YJIT crashes with rb_bug() when asked to compile new methods while out of executable memory. To handle this situation gracefully, this change keeps track of all the blocks compiled each invocation in case YJIT runs out of memory in the middle of a compliation sequence. The list is used to free all blocks in case compilation fails. yjit_gen_block() is renamed to gen_single_block() to make it distinct from gen_block_version(). Call to limit_block_version() and block_t allocation is moved into the function to help tidy error checking in the outer loop. limit_block_version() now returns by value. I feel that an out parameter with conditional mutation is unnecessarily hard to read in code that does not need to go for last drop performance. There is a good chance that the optimizer is able to output identical code anyways.
Notes: Merged:
Diffstat (limited to 'spec/ruby/command_line')
0 files changed, 0 insertions, 0 deletions