Skip to content
  • Alan Wu's avatar
    d0772632
    YJIT: Fail gracefully while OOM for new entry points · d0772632
    Alan Wu authored
    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.
    d0772632
    YJIT: Fail gracefully while OOM for new entry points
    Alan Wu authored
    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.
Loading