Define __attr_hot___ for __attribute__((hot)) (#1359)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2016-09-19 15:33:54 +02:00
committed by GitHub
parent dcaec22c0c
commit 971dcae669
3 changed files with 7 additions and 6 deletions
+4 -4
View File
@@ -187,7 +187,7 @@ void jmem_heap_finalize (void)
* @return pointer to allocated memory block - if allocation is successful, * @return pointer to allocated memory block - if allocation is successful,
* NULL - if there is not enough memory. * NULL - if there is not enough memory.
*/ */
static __attribute__((hot)) static __attr_hot___
void *jmem_heap_alloc_block_internal (const size_t size) void *jmem_heap_alloc_block_internal (const size_t size)
{ {
// Align 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 * @return NULL, if the required memory is 0
* pointer to allocated memory block, otherwise * 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 */ jmem_heap_alloc_block (const size_t size) /**< required memory size */
{ {
return jmem_heap_gc_and_alloc_block (size, false); 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 * also NULL, if the allocation has failed
* pointer to the allocated memory block, otherwise * 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 */ jmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory size */
{ {
return jmem_heap_gc_and_alloc_block (size, true); 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. * 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 */ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the block */
const size_t size) /**< size of allocated region */ const size_t size) /**< size of allocated region */
{ {
+2 -2
View File
@@ -97,7 +97,7 @@ jmem_pools_finalize (void)
* @return pointer to allocated chunk, if allocation was successful, * @return pointer to allocated chunk, if allocation was successful,
* or NULL - if not enough memory. * 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 */ jmem_pools_alloc (size_t size) /**< size of the chunk */
{ {
#ifdef JMEM_GC_BEFORE_EACH_ALLOC #ifdef JMEM_GC_BEFORE_EACH_ALLOC
@@ -158,7 +158,7 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */
/** /**
* Free 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 */ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
size_t size) /**< size of the chunk */ size_t size) /**< size of the chunk */
{ {
+1
View File
@@ -30,6 +30,7 @@
#define __noreturn __attribute__((noreturn)) #define __noreturn __attribute__((noreturn))
#define __attr_noinline___ __attribute__((noinline)) #define __attr_noinline___ __attribute__((noinline))
#define __attr_return_value_should_be_checked___ __attribute__((warn_unused_result)) #define __attr_return_value_should_be_checked___ __attribute__((warn_unused_result))
#define __attr_hot___ __attribute__((hot))
#ifndef __attr_always_inline___ #ifndef __attr_always_inline___
# define __attr_always_inline___ __attribute__((always_inline)) # define __attr_always_inline___ __attribute__((always_inline))
#endif /* !__attr_always_inline___ */ #endif /* !__attr_always_inline___ */