ruby-changes:69161
From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:21:03 +0900 (JST)
Subject: [ruby-changes:69161] a10cf74e5c (master): style: align pointer "*" to the right
https://git.ruby-lang.org/ruby.git/commit/?id=a10cf74e5c From a10cf74e5c727cce2612958dca1c5ac6ece1a098 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Wed, 29 Sep 2021 14:58:01 -0400 Subject: style: align pointer "*" to the right --- yjit_asm.c | 330 ++++++++++++++++++++++++++++----------------------------- yjit_asm.h | 290 +++++++++++++++++++++++++------------------------- yjit_codegen.c | 238 ++++++++++++++++++++--------------------- yjit_codegen.h | 6 +- yjit_core.c | 112 ++++++++++---------- yjit_iface.c | 26 ++--- yjit_iface.h | 4 +- yjit_utils.c | 14 +-- yjit_utils.h | 10 +- 9 files changed, 515 insertions(+), 515 deletions(-) diff --git a/yjit_asm.c b/yjit_asm.c index 001856395f..4b7205e14a 100644 --- a/yjit_asm.c +++ b/yjit_asm.c @@ -128,7 +128,7 @@ x86opnd_t const_ptr_opnd(const void *ptr) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L128 } // Align the current write position to a multiple of bytes -static uint8_t* align_ptr(uint8_t* ptr, uint32_t multiple) +static uint8_t *align_ptr(uint8_t *ptr, uint32_t multiple) { // Compute the pointer modulo the given alignment boundary uint32_t rem = ((uint32_t)(uintptr_t)ptr) % multiple; @@ -144,16 +144,16 @@ static uint8_t* align_ptr(uint8_t* ptr, uint32_t multiple) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L144 } // Allocate a block of executable memory -uint8_t* alloc_exec_mem(uint32_t mem_size) +uint8_t *alloc_exec_mem(uint32_t mem_size) { #ifndef _WIN32 - uint8_t* mem_block; + uint8_t *mem_block; // On Linux #if defined(MAP_FIXED_NOREPLACE) && defined(_SC_PAGESIZE) // Align the requested address to page size uint32_t page_size = (uint32_t)sysconf(_SC_PAGESIZE); - uint8_t* req_addr = align_ptr((uint8_t*)&alloc_exec_mem, page_size); + uint8_t *req_addr = align_ptr((uint8_t*)&alloc_exec_mem, page_size); while (req_addr < (uint8_t*)&alloc_exec_mem + INT32_MAX) { @@ -223,16 +223,16 @@ uint8_t* alloc_exec_mem(uint32_t mem_size) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L223 code_page_t *freelist = NULL; // Allocate a single code page from a pool of free pages -code_page_t* alloc_code_page() +code_page_t *alloc_code_page() { // If the free list is empty if (!freelist) { // Allocate many pages at once - uint8_t* code_chunk = alloc_exec_mem(PAGES_PER_ALLOC * CODE_PAGE_SIZE); + uint8_t *code_chunk = alloc_exec_mem(PAGES_PER_ALLOC * CODE_PAGE_SIZE); // Do this in reverse order so we allocate our pages in order for (int i = PAGES_PER_ALLOC - 1; i >= 0; --i) { - code_page_t* code_page = malloc(sizeof(code_page_t)); + code_page_t *code_page = malloc(sizeof(code_page_t)); code_page->mem_block = code_chunk + i * CODE_PAGE_SIZE; assert ((intptr_t)code_page->mem_block % CODE_PAGE_SIZE == 0); code_page->page_size = CODE_PAGE_SIZE; @@ -241,21 +241,21 @@ code_page_t* alloc_code_page() https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L241 } } - code_page_t* free_page = freelist; + code_page_t *free_page = freelist; freelist = freelist->_next; return free_page; } // Put a code page back into the allocation pool -void free_code_page(code_page_t* code_page) +void free_code_page(code_page_t *code_page) { code_page->_next = freelist; freelist = code_page; } // Initialize a code block object -void cb_init(codeblock_t* cb, uint8_t* mem_block, uint32_t mem_size) +void cb_init(codeblock_t *cb, uint8_t *mem_block, uint32_t mem_size) { assert (mem_block); cb->mem_block = mem_block; @@ -266,11 +266,11 @@ void cb_init(codeblock_t* cb, uint8_t* mem_block, uint32_t mem_size) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L266 } // Align the current write position to a multiple of bytes -void cb_align_pos(codeblock_t* cb, uint32_t multiple) +void cb_align_pos(codeblock_t *cb, uint32_t multiple) { // Compute the pointer modulo the given alignment boundary - uint8_t* ptr = &cb->mem_block[cb->write_pos]; - uint8_t* aligned_ptr = align_ptr(ptr, multiple); + uint8_t *ptr = &cb->mem_block[cb->write_pos]; + uint8_t *aligned_ptr = align_ptr(ptr, multiple); // Pad the pointer by the necessary amount to align it ptrdiff_t pad = aligned_ptr - ptr; @@ -278,14 +278,14 @@ void cb_align_pos(codeblock_t* cb, uint32_t multiple) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L278 } // Set the current write position -void cb_set_pos(codeblock_t* cb, uint32_t pos) +void cb_set_pos(codeblock_t *cb, uint32_t pos) { assert (pos < cb->mem_size); cb->write_pos = pos; } // Set the current write position from a pointer -void cb_set_write_ptr(codeblock_t* cb, uint8_t* code_ptr) +void cb_set_write_ptr(codeblock_t *cb, uint8_t *code_ptr) { intptr_t pos = code_ptr - cb->mem_block; assert (pos < cb->mem_size); @@ -293,20 +293,20 @@ void cb_set_write_ptr(codeblock_t* cb, uint8_t* code_ptr) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L293 } // Get a direct pointer into the executable memory block -uint8_t* cb_get_ptr(codeblock_t* cb, uint32_t index) +uint8_t *cb_get_ptr(codeblock_t *cb, uint32_t index) { assert (index < cb->mem_size); return &cb->mem_block[index]; } // Get a direct pointer to the current write position -uint8_t* cb_get_write_ptr(codeblock_t* cb) +uint8_t *cb_get_write_ptr(codeblock_t *cb) { return cb_get_ptr(cb, cb->write_pos); } // Write a byte at the current position -void cb_write_byte(codeblock_t* cb, uint8_t byte) +void cb_write_byte(codeblock_t *cb, uint8_t byte) { assert (cb->mem_block); assert (cb->write_pos + 1 <= cb->mem_size); @@ -314,7 +314,7 @@ void cb_write_byte(codeblock_t* cb, uint8_t byte) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L314 } // Write multiple bytes starting from the current position -void cb_write_bytes(codeblock_t* cb, uint32_t num_bytes, ...) +void cb_write_bytes(codeblock_t *cb, uint32_t num_bytes, ...) { va_list va; va_start(va, num_bytes); @@ -329,7 +329,7 @@ void cb_write_bytes(codeblock_t* cb, uint32_t num_bytes, ...) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L329 } // Write a signed integer over a given number of bits at the current position -void cb_write_int(codeblock_t* cb, uint64_t val, uint32_t num_bits) +void cb_write_int(codeblock_t *cb, uint64_t val, uint32_t num_bits) { assert (num_bits > 0); assert (num_bits % 8 == 0); @@ -378,7 +378,7 @@ void cb_write_int(codeblock_t* cb, uint64_t val, uint32_t num_bits) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L378 } // Allocate a new label with a given name -uint32_t cb_new_label(codeblock_t* cb, const char* name) +uint32_t cb_new_label(codeblock_t *cb, const char *name) { //if (hasASM) // writeString(to!string(label) ~ ":"); @@ -396,14 +396,14 @@ uint32_t cb_new_label(codeblock_t* cb, const char* name) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L396 } // Write a label at the current address -void cb_write_label(codeblock_t* cb, uint32_t label_idx) +void cb_write_label(codeblock_t *cb, uint32_t label_idx) { assert (label_idx < MAX_LABELS); cb->label_addrs[label_idx] = cb->write_pos; } // Add a label reference at the current write position -void cb_label_ref(codeblock_t* cb, uint32_t label_idx) +void cb_label_ref(codeblock_t *cb, uint32_t label_idx) { assert (label_idx < MAX_LABELS); assert (cb->num_refs < MAX_LABEL_REFS); @@ -414,7 +414,7 @@ void cb_label_ref(codeblock_t* cb, uint32_t label_idx) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L414 } // Link internal label references -void cb_link_labels(codeblock_t* cb) +void cb_link_labels(codeblock_t *cb) { uint32_t orig_pos = cb->write_pos; @@ -516,7 +516,7 @@ uint32_t disp_size(x86opnd_t opnd) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L516 // Write the REX byte static void cb_write_rex( - codeblock_t* cb, + codeblock_t *cb, bool w_flag, uint8_t reg_no, uint8_t idx_reg_no, @@ -539,7 +539,7 @@ static void cb_write_rex( https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L539 } // Write an opcode byte with an embedded register operand -static void cb_write_opcode(codeblock_t* cb, uint8_t opcode, x86opnd_t reg) +static void cb_write_opcode(codeblock_t *cb, uint8_t opcode, x86opnd_t reg) { // Write the reg field into the opcode byte uint8_t op_byte = opcode | (reg.as.reg.reg_no & 7); @@ -548,7 +548,7 @@ static void cb_write_opcode(codeblock_t* cb, uint8_t opcode, x86opnd_t reg) https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L548 // Encode an RM instruction void cb_write_rm( - codeblock_t* cb, + codeblock_t *cb, bool szPref, bool rexW, x86opnd_t r_opnd, @@ -709,8 +709,8 @@ void cb_write_rm( https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L709 // Encode a mul-like single-operand RM instruction void write_rm_unary( - codeblock_t* cb, - const char* mnem, + codeblock_t *cb, + const char *mnem, uint8_t opMemReg8, uint8_t opMemRegPref, uint8_t opExt, @@ -738,8 +738,8 @@ void write_rm_unary( https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L738 // Encode an add-like RM instruction with multiple possible encodings void cb_write_rm_multi( - codeblock_t* cb, - const char* mnem, + codeblock_t *cb, + const char *mnem, uint8_t opMemReg8, uint8_t opMemRegPref, uint8_t opRegMem8, @@ -837,8 +837,8 @@ void cb_write_rm_multi( https://github.com/ruby/ruby/blob/trunk/yjit_asm.c#L837 // Encode a single-operand shift instruction void cb_write_shift( - codeblock_t* cb, - const char* mnem, + codeblock_t *cb, + const char *mnem, uint8_t opMemOnePref, uint8_t opMemClPref, uint8_t opMemImmPref, @@ -887,7 +887,7 @@ void cb_write_shift( https://github.com/ruby/ruby/blob/trunk/yjit_asm.c (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/