summaryrefslogtreecommitdiff
path: root/yjit_asm.h
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2021-11-04 13:05:41 -0700
committerGitHub <noreply@github.com>2021-11-04 16:05:41 -0400
commit2421527d6e4737c371bca0cf7e694f8a2a0f923d (patch)
tree90621ade7e47fab78ce7c885d55aed1c99fdc434 /yjit_asm.h
parent85b4cf16e2cae0577633c1acb1dc7413d58fcb5a (diff)
YJIT code pages refactoring for code GC (#5073)
* New code page allocation logic * Fix leaked globals * Fix leaked symbols, yjit asm tests * Make COUNTED_EXIT take a jit argument, so we can eliminate global ocb * Remove extra whitespace * Change block start_pos/end_pos to be pointers instead of uint32_t * Change branch end_pos and start_pos to end_addr, start_addr
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'yjit_asm.h')
-rw-r--r--yjit_asm.h26
1 files changed, 2 insertions, 24 deletions
diff --git a/yjit_asm.h b/yjit_asm.h
index 30682b5078..b1b2baae2e 100644
--- a/yjit_asm.h
+++ b/yjit_asm.h
@@ -5,12 +5,6 @@
#include <stddef.h>
#include <stdbool.h>
-// Size of code pages to allocate
-#define CODE_PAGE_SIZE 16 * 1024
-
-// How many code pages to allocate at once
-#define PAGES_PER_ALLOC 512
-
// Maximum number of labels to link
#define MAX_LABELS 32
@@ -137,20 +131,6 @@ typedef struct X86Opnd
} x86opnd_t;
-// Struct representing a code page
-typedef struct code_page_struct
-{
- // Chunk of executable memory
- uint8_t *mem_block;
-
- // Size of the executable memory chunk
- uint32_t page_size;
-
- // Next node in the free list (private)
- struct code_page_struct *_next;
-
-} code_page_t;
-
// Dummy none/null operand
static const x86opnd_t NO_OPND = { OPND_NONE, 0, .as.imm = 0 };
@@ -264,12 +244,10 @@ static inline x86opnd_t const_ptr_opnd(const void *ptr);
sizeof(((struct_type*)0)->member_name[0]) * idx) \
)
-// Machine code allocation
+// Allocate executable memory
static uint8_t *alloc_exec_mem(uint32_t mem_size);
-static code_page_t *alloc_code_page(void);
-static void free_code_page(code_page_t *code_page);
-
+// Code block functions
static inline void cb_init(codeblock_t *cb, uint8_t *mem_block, uint32_t mem_size);
static inline void cb_align_pos(codeblock_t *cb, uint32_t multiple);
static inline void cb_set_pos(codeblock_t *cb, uint32_t pos);