File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments