summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2021-11-15 21:28:20 +0000
committerPeter Zhu <peter@peterzhu.ca>2022-01-04 10:27:46 -0500
commitad007bc6ea1c75c2547be2481fba60b38dd1add1 (patch)
tree96f223208bef4d185915bfbede2f00f55d9f55b7 /include
parent615e9b28658c5b44a4474e04a53b84ae83b8e3fd (diff)
Switch `is_pointer_to_heap` to use library bsearch
This commit switches from a custom implemented bsearch algorithm to use the one provided by the C standard library. Because `is_pointer_to_heap` will only return true if the pointer being searched for is a valid slot starting address within the heap page body, we've extracted the bsearch call site into a more general function so we can use it elsewhere. The new function `heap_page_for_ptr` returns the heap page for any heap page pointer, regardless of whether that is at the start of a slot or in the middle of one. We then use this function as the basis of `is_pointer_to_heap`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5187
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions