Replace vera++ with clang-format (#4518)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
+14
-15
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "ecma-gc.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jmem.h"
|
||||
#include "jrt-bit-fields.h"
|
||||
@@ -47,7 +48,7 @@
|
||||
#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) (p))
|
||||
#define JMEM_HEAP_GET_ADDR_FROM_OFFSET(u) ((jmem_heap_free_t *) (u))
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
|
||||
#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) ((uint8_t *) (p) - JERRY_HEAP_CONTEXT (area)))
|
||||
#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) ((uint8_t *) (p) -JERRY_HEAP_CONTEXT (area)))
|
||||
#define JMEM_HEAP_GET_ADDR_FROM_OFFSET(u) ((jmem_heap_free_t *) (JERRY_HEAP_CONTEXT (area) + (u)))
|
||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
|
||||
/**
|
||||
@@ -59,7 +60,7 @@
|
||||
*
|
||||
* @return pointer to the end of the region
|
||||
*/
|
||||
static inline jmem_heap_free_t * JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_PURE
|
||||
static inline jmem_heap_free_t *JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_PURE
|
||||
jmem_heap_get_region_end (jmem_heap_free_t *curr_p) /**< current region */
|
||||
{
|
||||
return (jmem_heap_free_t *) ((uint8_t *) curr_p + curr_p->size);
|
||||
@@ -119,7 +120,7 @@ jmem_heap_finalize (void)
|
||||
* @return pointer to allocated memory block - if allocation is successful,
|
||||
* NULL - if there is not enough memory.
|
||||
*/
|
||||
static void * JERRY_ATTR_HOT
|
||||
static void *JERRY_ATTR_HOT
|
||||
jmem_heap_alloc (const size_t size) /**< size of requested block */
|
||||
{
|
||||
#if !JERRY_SYSTEM_ALLOCATOR
|
||||
@@ -130,8 +131,7 @@ jmem_heap_alloc (const size_t size) /**< size of requested block */
|
||||
JMEM_VALGRIND_DEFINED_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t));
|
||||
|
||||
/* Fast path for 8 byte chunks, first region is guaranteed to be sufficient. */
|
||||
if (required_size == JMEM_ALIGNMENT
|
||||
&& JERRY_LIKELY (JERRY_HEAP_CONTEXT (first).next_offset != JMEM_HEAP_END_OF_LIST))
|
||||
if (required_size == JMEM_ALIGNMENT && JERRY_LIKELY (JERRY_HEAP_CONTEXT (first).next_offset != JMEM_HEAP_END_OF_LIST))
|
||||
{
|
||||
data_space_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (JERRY_HEAP_CONTEXT (first).next_offset);
|
||||
JERRY_ASSERT (jmem_is_heap_pointer (data_space_p));
|
||||
@@ -303,7 +303,7 @@ jmem_heap_gc_and_alloc_block (const size_t size, /**< required memory size */
|
||||
/**
|
||||
* Internal method for allocating a memory block.
|
||||
*/
|
||||
extern inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
|
||||
extern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
|
||||
jmem_heap_alloc_block_internal (const size_t size) /**< required memory size */
|
||||
{
|
||||
return jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_FULL);
|
||||
@@ -318,7 +318,7 @@ jmem_heap_alloc_block_internal (const size_t size) /**< required memory size */
|
||||
* @return NULL, if the required memory is 0
|
||||
* pointer to allocated memory block, otherwise
|
||||
*/
|
||||
extern inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
|
||||
extern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
|
||||
jmem_heap_alloc_block (const size_t size) /**< required memory size */
|
||||
{
|
||||
void *block_p = jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_FULL);
|
||||
@@ -336,7 +336,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
|
||||
*/
|
||||
extern inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
|
||||
extern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
|
||||
jmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory size */
|
||||
{
|
||||
void *block_p = jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_HIGH);
|
||||
@@ -358,7 +358,7 @@ jmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory siz
|
||||
* @return pointer to the preceeding block
|
||||
*/
|
||||
static jmem_heap_free_t *
|
||||
jmem_heap_find_prev (const jmem_heap_free_t * const block_p) /**< which memory block's predecessor we're looking for */
|
||||
jmem_heap_find_prev (const jmem_heap_free_t *const block_p) /**< which memory block's predecessor we're looking for */
|
||||
{
|
||||
const jmem_heap_free_t *prev_p;
|
||||
|
||||
@@ -378,7 +378,7 @@ jmem_heap_find_prev (const jmem_heap_free_t * const block_p) /**< which memory b
|
||||
/* Find position of region in the list. */
|
||||
while (prev_p->next_offset < block_offset)
|
||||
{
|
||||
const jmem_heap_free_t * const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
|
||||
const jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
|
||||
JERRY_ASSERT (jmem_is_heap_pointer (next_p));
|
||||
|
||||
JMEM_VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));
|
||||
@@ -489,7 +489,7 @@ jmem_heap_free_block_internal (void *ptr, /**< pointer to beginning of data spac
|
||||
*
|
||||
* @return pointer to the reallocated region
|
||||
*/
|
||||
void * JERRY_ATTR_HOT
|
||||
void *JERRY_ATTR_HOT
|
||||
jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
|
||||
const size_t old_size, /**< current size of the region */
|
||||
const size_t new_size) /**< desired new size */
|
||||
@@ -500,7 +500,7 @@ jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
|
||||
JERRY_ASSERT (old_size != 0);
|
||||
JERRY_ASSERT (new_size != 0);
|
||||
|
||||
jmem_heap_free_t * const block_p = (jmem_heap_free_t *) ptr;
|
||||
jmem_heap_free_t *const block_p = (jmem_heap_free_t *) ptr;
|
||||
const size_t aligned_new_size = (new_size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;
|
||||
const size_t aligned_old_size = (old_size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;
|
||||
|
||||
@@ -544,7 +544,7 @@ jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
|
||||
|
||||
jmem_heap_free_t *prev_p = jmem_heap_find_prev (block_p);
|
||||
JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
|
||||
jmem_heap_free_t * const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
|
||||
jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
|
||||
|
||||
/* Check if block can be extended at the end */
|
||||
if (((jmem_heap_free_t *) ((uint8_t *) block_p + aligned_old_size)) == next_p)
|
||||
@@ -738,8 +738,7 @@ jmem_heap_stats_print (void)
|
||||
|
||||
JERRY_DEBUG_MSG ("Heap stats:\n");
|
||||
#if !JERRY_SYSTEM_ALLOCATOR
|
||||
JERRY_DEBUG_MSG (" Heap size = %zu bytes\n",
|
||||
heap_stats->size);
|
||||
JERRY_DEBUG_MSG (" Heap size = %zu bytes\n", heap_stats->size);
|
||||
#endif /* !JERRY_SYSTEM_ALLOCATOR */
|
||||
JERRY_DEBUG_MSG (" Allocated = %zu bytes\n"
|
||||
" Peak allocated = %zu bytes\n"
|
||||
|
||||
Reference in New Issue
Block a user