summaryrefslogtreecommitdiff
path: root/yjit_asm.c
diff options
context:
space:
mode:
authorAlan Wu <alanwu@ruby-lang.org>2021-10-20 19:04:22 -0400
committerAlan Wu <alanwu@ruby-lang.org>2021-10-20 19:04:22 -0400
commit6a9e2b3cc381fd1b6c5ec5eddb077ea5468ef75e (patch)
treeba37c7ac5cd57483638f052b52be95147c12dcae /yjit_asm.c
parent00be5846e4793b718da19dafec3f4ecf2d6d0692 (diff)
YJIT: Show GCC that the mmap probing loop runs at least once
Fixes: ./src/yjit_asm.c:196:8: warning: 'mem_block' may be used uninitialized [-Wmaybe-uninitialized]
Diffstat (limited to 'yjit_asm.c')
-rw-r--r--yjit_asm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/yjit_asm.c b/yjit_asm.c
index 5e433f5ea4..0d074d5e4d 100644
--- a/yjit_asm.c
+++ b/yjit_asm.c
@@ -158,8 +158,7 @@ uint8_t *alloc_exec_mem(uint32_t mem_size)
uint32_t page_size = (uint32_t)sysconf(_SC_PAGESIZE);
uint8_t *req_addr = align_ptr((uint8_t*)&alloc_exec_mem, page_size);
- while (req_addr < (uint8_t*)&alloc_exec_mem + INT32_MAX)
- {
+ do {
// Try to map a chunk of memory as executable
mem_block = (uint8_t*)mmap(
(void*)req_addr,
@@ -177,7 +176,7 @@ uint8_t *alloc_exec_mem(uint32_t mem_size)
// +4MB
req_addr += 4 * 1024 * 1024;
- }
+ } while (req_addr < (uint8_t*)&alloc_exec_mem + INT32_MAX);
// On MacOS and other platforms
#else