From f7187fbd2efc3cdb6aacddeed584692dfcc27287 Mon Sep 17 00:00:00 2001 From: zhang-cui11 Date: Wed, 18 Jan 2023 11:15:43 +0800 Subject: [PATCH] Malloc hook instruction optimization Signed-off-by: zhang-cui11 --- musl_template.gni | 14 +++++++------- porting/linux/user/src/hook/malloc_common.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/musl_template.gni b/musl_template.gni index 912db5ec..41863ae0 100644 --- a/musl_template.gni +++ b/musl_template.gni @@ -730,14 +730,14 @@ template("musl_libs") { "//build/config/compiler:compiler", ":soft_hook", ] - } - cflags = [ - "-mllvm", - "--instcombine-max-iterations=0", - "-ffp-contract=fast", - "-O3", - ] + cflags = [ + "-mllvm", + "--instcombine-max-iterations=0", + "-ffp-contract=fast", + "-O3", + ] + } source_set("soft_musl_jemalloc") { sources = [ "./porting/linux/user/src/malloc/jemalloc/jemalloc.c" ] diff --git a/porting/linux/user/src/hook/malloc_common.c b/porting/linux/user/src/hook/malloc_common.c index fc870f4e..39fb2215 100644 --- a/porting/linux/user/src/hook/malloc_common.c +++ b/porting/linux/user/src/hook/malloc_common.c @@ -18,7 +18,7 @@ void* malloc(size_t bytes) if (!__get_global_hook_flag()) { return MuslFunc(malloc)(bytes); } - else if (!__get_hook_flag()) { + if (!__get_hook_flag()) { return MuslFunc(malloc)(bytes); } return dispatch_table->malloc(bytes); @@ -39,7 +39,7 @@ void free(void* mem) MuslFunc(free)(mem); return; } - else if (!__get_hook_flag()) { + if (!__get_hook_flag()) { MuslFunc(free)(mem); return; } -- GitLab