From 971dcae669631c8f149c9b5dd1d1d582ea998bdd Mon Sep 17 00:00:00 2001 From: Akos Kiss Date: Mon, 19 Sep 2016 15:33:54 +0200 Subject: [PATCH] Define `__attr_hot___` for `__attribute__((hot))` (#1359) JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu --- jerry-core/jmem/jmem-heap.c | 8 ++++---- jerry-core/jmem/jmem-poolman.c | 4 ++-- jerry-core/jrt/jrt.h | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jerry-core/jmem/jmem-heap.c b/jerry-core/jmem/jmem-heap.c index 523e15c0e..371c86b34 100644 --- a/jerry-core/jmem/jmem-heap.c +++ b/jerry-core/jmem/jmem-heap.c @@ -187,7 +187,7 @@ void jmem_heap_finalize (void) * @return pointer to allocated memory block - if allocation is successful, * NULL - if there is not enough memory. */ -static __attribute__((hot)) +static __attr_hot___ void *jmem_heap_alloc_block_internal (const size_t size) { // Align size @@ -389,7 +389,7 @@ jmem_heap_gc_and_alloc_block (const size_t size, /**< required memory size * @return NULL, if the required memory is 0 * pointer to allocated memory block, otherwise */ -void * __attribute__((hot)) __attr_always_inline___ +void * __attr_hot___ __attr_always_inline___ jmem_heap_alloc_block (const size_t size) /**< required memory size */ { return jmem_heap_gc_and_alloc_block (size, false); @@ -405,7 +405,7 @@ jmem_heap_alloc_block (const size_t size) /**< required memory size */ * also NULL, if the allocation has failed * pointer to the allocated memory block, otherwise */ -void * __attribute__((hot)) __attr_always_inline___ +void * __attr_hot___ __attr_always_inline___ jmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory size */ { return jmem_heap_gc_and_alloc_block (size, true); @@ -414,7 +414,7 @@ jmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory siz /** * Free the memory block. */ -void __attribute__((hot)) +void __attr_hot___ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the block */ const size_t size) /**< size of allocated region */ { diff --git a/jerry-core/jmem/jmem-poolman.c b/jerry-core/jmem/jmem-poolman.c index 0c548f29f..ec3ba841c 100644 --- a/jerry-core/jmem/jmem-poolman.c +++ b/jerry-core/jmem/jmem-poolman.c @@ -97,7 +97,7 @@ jmem_pools_finalize (void) * @return pointer to allocated chunk, if allocation was successful, * or NULL - if not enough memory. */ -inline void * __attribute__((hot)) __attr_always_inline___ +inline void * __attr_hot___ __attr_always_inline___ jmem_pools_alloc (size_t size) /**< size of the chunk */ { #ifdef JMEM_GC_BEFORE_EACH_ALLOC @@ -158,7 +158,7 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */ /** * Free the chunk */ -inline void __attribute__((hot)) __attr_always_inline___ +inline void __attr_hot___ __attr_always_inline___ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */ size_t size) /**< size of the chunk */ { diff --git a/jerry-core/jrt/jrt.h b/jerry-core/jrt/jrt.h index eb391ad19..2613d937e 100644 --- a/jerry-core/jrt/jrt.h +++ b/jerry-core/jrt/jrt.h @@ -30,6 +30,7 @@ #define __noreturn __attribute__((noreturn)) #define __attr_noinline___ __attribute__((noinline)) #define __attr_return_value_should_be_checked___ __attribute__((warn_unused_result)) +#define __attr_hot___ __attribute__((hot)) #ifndef __attr_always_inline___ # define __attr_always_inline___ __attribute__((always_inline)) #endif /* !__attr_always_inline___ */