summaryrefslogtreecommitdiff
path: root/yjit_codegen.h
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-11-04 12:30:30 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-11-22 18:23:28 -0500
commit13d1ded253940585a993e92648ab9f77d355586d (patch)
tree40cd992d429c0e7c53e6e3c4b829b69d662099ff /yjit_codegen.h
parente42f994f6b20416853af0252029af94ff7c9b9a9 (diff)
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
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5145
Diffstat (limited to 'yjit_codegen.h')
-rw-r--r--yjit_codegen.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/yjit_codegen.h b/yjit_codegen.h
index 1e87c85393..4ae2536423 100644
--- a/yjit_codegen.h
+++ b/yjit_codegen.h
@@ -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);