]> sourceware.org Git - glibc.git/commit
malloc: Use global flag instead of function pointer dispatch for mtag
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 27 Jan 2021 15:45:43 +0000 (15:45 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 19 Mar 2021 11:46:20 +0000 (11:46 +0000)
commitd4f0f405ca8553dfd5a8e6b1a5debff66e9d092d
tree95ef49e80f37937eea676be706c9d393741d82df
parent2689b5c71b4c5ca4bddb011a5ca62c586f62bc58
malloc: Use global flag instead of function pointer dispatch for mtag

A flag check can be faster than function pointers because of how
branch prediction and speculation works and it can also remove a layer
of indirection when there is a mismatch between the malloc internal
tag_* api and __libc_mtag_* target hooks.

Memory tagging wrapper functions are moved to malloc.c from arena.c and
the logic now checks mmap_enabled.  The definition of tag_new_usable is
moved after chunk related definitions.

This refactoring also allows using mtag_enabled checks instead of
USE_MTAG ifdefs when memory tagging support only changes code logic
when memory tagging is enabled at runtime. Note: an "if (false)" code
block is optimized away even at -O0 by gcc.

Reviewed-by: DJ Delorie <dj@redhat.com>
malloc/arena.c
malloc/malloc.c
This page took 0.056338 seconds and 5 git commands to generate.