mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
YJIT: Make block invalidation more robust
This commit adds an entry_exit field to block_t for use in invalidate_block_version(). By patching the start of the block while invalidating it, invalidate_block_version() can function correctly while there is no executable memory left for new branch stubs. This change additionally fixes correctness for situations where we cannot patch incoming jumps to the invalidated block. In situations such as Shopify/yjit#226, the address to the start of the block is saved and used later, possibly after the block is invalidated. The assume_* family of function now generate block->entry_exit before remembering blocks for invalidation. RubyVM::YJIT.simulate_oom! is introduced for testing out of memory conditions. The test for it is disabled for now because OOM triggers other failure conditions not addressed by this commit. Fixes Shopify/yjit#226
This commit is contained in:
parent
e42f994f6b
commit
13d1ded253
Notes:
git
2021-11-23 08:23:50 +09:00
7 changed files with 233 additions and 59 deletions
|
@ -10,6 +10,8 @@ typedef enum codegen_status {
|
|||
// Code generation function signature
|
||||
typedef codegen_status_t (*codegen_fn)(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb);
|
||||
|
||||
static void jit_ensure_block_entry_exit(jitstate_t *jit);
|
||||
|
||||
static uint8_t *yjit_entry_prologue(codeblock_t *cb, const rb_iseq_t *iseq);
|
||||
|
||||
static void yjit_gen_block(block_t *block, rb_execution_context_t *ec);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue