diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-11-19 23:44:13 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-12-01 12:25:28 -0500 |
commit | d0772632bf2ff15f73c0d3601d958670a5c77855 (patch) | |
tree | 8bf717561d2ab3d49d97cd69d8a2db794504b624 /rubystub.c | |
parent | a84dc9d80d41db01db4623517ade928ee7f40e36 (diff) | |
download | ruby-d0772632bf2ff15f73c0d3601d958670a5c77855.tar.gz |
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.
Diffstat (limited to 'rubystub.c')
0 files changed, 0 insertions, 0 deletions