From 21a63450236af6eaae954b367385c071231dc03f Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 5 Apr 2021 17:59:25 -0400 Subject: YJIT: adjust branch shape properly when target already exists The old code decides branch->shape based on the write position of the native code block, which is unsound in case the block already exists and no new code is written to the write position. Make this decision with the start address of the target block instead. Also handle when the branch becomes smaller after patching. --- yjit_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yjit_core.h') diff --git a/yjit_core.h b/yjit_core.h index 1a55408a7b..658a0cc691 100644 --- a/yjit_core.h +++ b/yjit_core.h @@ -156,7 +156,7 @@ typedef void (*branchgen_fn)(codeblock_t* cb, uint8_t* target0, uint8_t* target1 Store info about an outgoing branch in a code segment Note: care must be taken to minimize the size of branch_t objects */ -typedef struct BranchEntry +typedef struct yjit_branch_entry { // Positions where the generated code starts and ends uint32_t start_pos; -- cgit v1.2.3