mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
85b4cf16e2
commit
2421527d6e
Notes:
git
2021-11-05 05:06:08 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>
8 changed files with 195 additions and 160 deletions
26
yjit_asm.h
26
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue