From 350b686a2c6cc8f27466222cf8520a8fda931ea2 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Tue, 13 Jul 2021 14:56:02 -0400 Subject: First pass at code page GC object. --- yjit_asm.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'yjit_asm.h') diff --git a/yjit_asm.h b/yjit_asm.h index c94b54240c..93762987bc 100644 --- a/yjit_asm.h +++ b/yjit_asm.h @@ -131,6 +131,20 @@ 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 }; @@ -242,8 +256,8 @@ x86opnd_t const_ptr_opnd(const void *ptr); // Machine code allocation uint8_t* alloc_exec_mem(uint32_t mem_size); -uint8_t* alloc_code_page(); -void free_code_page(uint8_t* page_ptr); +code_page_t* alloc_code_page(); +void free_code_page(code_page_t* code_page); // Code block methods void cb_init(codeblock_t* cb, uint8_t* mem_block, uint32_t mem_size); -- cgit v1.2.3