Skip to content

Commit 8c3e8b9

Browse files
committed
diagram
1 parent e62ccbf commit 8c3e8b9

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

jit.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,19 @@ rb_jit_reserve_addr_space(uint32_t mem_size)
744744
// to improve odds of being in range for 32-bit relative call instructions.
745745
uint8_t *req_addr = cfunc_sample_addr;
746746
for (int i = 0; i < max_probe_trials; i++) {
747-
// Downwards to probe away from the heap. (On x86/A64 Linux
748-
// main_code_addr < heap_addr, and in case we are in a shared
749-
// library mapped higher than the heap, downwards is still better
750-
// since it's towards the end of the heap rather than the stack.)
747+
// The address space on x86-64/A64 Linux tends to look like:
748+
//
749+
// high addr +---------------+
750+
// | | [stack] |
751+
// | | DSO text |
752+
// | | [heap] |
753+
// | | main exe text |
754+
// v | 0 |
755+
// low addr +---------------+
756+
//
757+
// We always probe downwards from one of the program text areas
758+
// to avoid getting in the way of the stack's downwards growth.
759+
// If we happen to start from the main text, we also avoid the heap.
751760
req_addr -= probe_stride;
752761

753762
// Align the requested address to page size

0 commit comments

Comments
 (0)