Change 'mem' namspace to 'jmem'
The 'mem_' prefix is too general, so it might clash with symbols in other libraries. Renamed the directory, file, funtion and type names. Related issue: #1052 JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-lcache.h"
|
||||
#include "jrt.h"
|
||||
#include "mem-poolman.h"
|
||||
#include "jmem-poolman.h"
|
||||
|
||||
JERRY_STATIC_ASSERT (sizeof (ecma_property_value_t) == sizeof (ecma_value_t),
|
||||
size_of_ecma_property_value_t_must_be_equal_to_size_of_ecma_value_t);
|
||||
@@ -65,7 +65,7 @@ JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t)
|
||||
#define ALLOC(ecma_type) ecma_ ## ecma_type ## _t * \
|
||||
ecma_alloc_ ## ecma_type (void) \
|
||||
{ \
|
||||
ecma_ ## ecma_type ## _t *p ## ecma_type = (ecma_ ## ecma_type ## _t *) mem_pools_alloc (); \
|
||||
ecma_ ## ecma_type ## _t *p ## ecma_type = (ecma_ ## ecma_type ## _t *) jmem_pools_alloc (); \
|
||||
\
|
||||
JERRY_ASSERT (p ## ecma_type != NULL); \
|
||||
\
|
||||
@@ -78,7 +78,7 @@ JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t)
|
||||
#define DEALLOC(ecma_type) void \
|
||||
ecma_dealloc_ ## ecma_type (ecma_ ## ecma_type ## _t *p ## ecma_type) \
|
||||
{ \
|
||||
mem_pools_free ((uint8_t *) p ## ecma_type); \
|
||||
jmem_pools_free ((uint8_t *) p ## ecma_type); \
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ DECLARE_ROUTINES_FOR (external_pointer)
|
||||
ecma_property_pair_t *
|
||||
ecma_alloc_property_pair (void)
|
||||
{
|
||||
return mem_heap_alloc_block (sizeof (ecma_property_pair_t));
|
||||
return jmem_heap_alloc_block (sizeof (ecma_property_pair_t));
|
||||
} /* ecma_alloc_property_pair */
|
||||
|
||||
/**
|
||||
@@ -113,7 +113,7 @@ ecma_alloc_property_pair (void)
|
||||
extern void
|
||||
ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */
|
||||
{
|
||||
mem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));
|
||||
jmem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));
|
||||
} /* ecma_dealloc_property_pair */
|
||||
|
||||
/**
|
||||
|
||||
@@ -564,10 +564,10 @@ ecma_gc_run (void)
|
||||
* Try to free some memory (depending on severity).
|
||||
*/
|
||||
void
|
||||
ecma_try_to_give_back_some_memory (mem_try_give_memory_back_severity_t severity) /**< severity of
|
||||
* the request */
|
||||
ecma_try_to_give_back_some_memory (jmem_try_give_memory_back_severity_t severity) /**< severity of
|
||||
* the request */
|
||||
{
|
||||
if (severity == MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_LOW)
|
||||
if (severity == JMEM_TRY_GIVE_MEMORY_BACK_SEVERITY_LOW)
|
||||
{
|
||||
/*
|
||||
* If there is enough newly allocated objects since last GC, probably it is worthwhile to start GC now.
|
||||
@@ -580,7 +580,7 @@ ecma_try_to_give_back_some_memory (mem_try_give_memory_back_severity_t severity)
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (severity == MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_HIGH);
|
||||
JERRY_ASSERT (severity == JMEM_TRY_GIVE_MEMORY_BACK_SEVERITY_HIGH);
|
||||
|
||||
/* Freeing as much memory as we currently can */
|
||||
ecma_lcache_invalidate_all ();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define ECMA_GC_H
|
||||
|
||||
#include "ecma-globals.h"
|
||||
#include "mem-allocator.h"
|
||||
#include "jmem-allocator.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
@@ -31,7 +31,7 @@ extern void ecma_init_gc_info (ecma_object_t *);
|
||||
extern void ecma_ref_object (ecma_object_t *);
|
||||
extern void ecma_deref_object (ecma_object_t *);
|
||||
extern void ecma_gc_run (void);
|
||||
extern void ecma_try_to_give_back_some_memory (mem_try_give_memory_back_severity_t);
|
||||
extern void ecma_try_to_give_back_some_memory (jmem_try_give_memory_back_severity_t);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-magic-strings.h"
|
||||
#include "mem-allocator.h"
|
||||
#include "jmem-allocator.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
@@ -36,15 +36,15 @@
|
||||
* Ecma-pointer field is used to calculate ecma value's address.
|
||||
*
|
||||
* Ecma-pointer contains value's shifted offset from common Ecma-pointers' base.
|
||||
* The offset is shifted right by MEM_ALIGNMENT_LOG.
|
||||
* Least significant MEM_ALIGNMENT_LOG bits of non-shifted offset are zeroes.
|
||||
* The offset is shifted right by JMEM_ALIGNMENT_LOG.
|
||||
* Least significant JMEM_ALIGNMENT_LOG bits of non-shifted offset are zeroes.
|
||||
*/
|
||||
#define ECMA_POINTER_FIELD_WIDTH MEM_CP_WIDTH
|
||||
#define ECMA_POINTER_FIELD_WIDTH JMEM_CP_WIDTH
|
||||
|
||||
/**
|
||||
* The NULL value for compressed pointers
|
||||
*/
|
||||
#define ECMA_NULL_POINTER MEM_CP_NULL
|
||||
#define ECMA_NULL_POINTER JMEM_CP_NULL
|
||||
|
||||
/**
|
||||
* @}
|
||||
@@ -98,7 +98,7 @@ typedef int32_t ecma_integer_value_t;
|
||||
#if UINTPTR_MAX <= UINT32_MAX
|
||||
|
||||
/**
|
||||
* MEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t
|
||||
* JMEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t
|
||||
*/
|
||||
#define ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
|
||||
|
||||
@@ -335,7 +335,7 @@ typedef struct
|
||||
{
|
||||
ecma_property_t types[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< two property type slot. The first represent
|
||||
* the type of this property (e.g. property pair) */
|
||||
mem_cpointer_t next_property_cp; /**< next cpointer */
|
||||
jmem_cpointer_t next_property_cp; /**< next cpointer */
|
||||
} ecma_property_header_t;
|
||||
|
||||
/**
|
||||
@@ -343,8 +343,8 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
mem_cpointer_t getter_p; /**< pointer to getter object */
|
||||
mem_cpointer_t setter_p; /**< pointer to setter object */
|
||||
jmem_cpointer_t getter_p; /**< pointer to getter object */
|
||||
jmem_cpointer_t setter_p; /**< pointer to setter object */
|
||||
} ecma_getter_setter_pointers_t;
|
||||
|
||||
/**
|
||||
@@ -363,7 +363,7 @@ typedef struct
|
||||
{
|
||||
ecma_property_header_t header; /**< header of the property */
|
||||
ecma_property_value_t values[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property value slots */
|
||||
mem_cpointer_t names_cp[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property name slots */
|
||||
jmem_cpointer_t names_cp[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property name slots */
|
||||
} ecma_property_pair_t;
|
||||
|
||||
/**
|
||||
@@ -488,13 +488,13 @@ typedef struct ecma_object_t
|
||||
uint16_t type_flags_refs;
|
||||
|
||||
/** next in the object chain maintained by the garbage collector */
|
||||
mem_cpointer_t gc_next_cp;
|
||||
jmem_cpointer_t gc_next_cp;
|
||||
|
||||
/** compressed pointer to property list or bound object */
|
||||
mem_cpointer_t property_list_or_bound_object_cp;
|
||||
jmem_cpointer_t property_list_or_bound_object_cp;
|
||||
|
||||
/** object prototype or outer reference */
|
||||
mem_cpointer_t prototype_or_outer_reference_cp;
|
||||
jmem_cpointer_t prototype_or_outer_reference_cp;
|
||||
} ecma_object_t;
|
||||
|
||||
/**
|
||||
@@ -730,10 +730,10 @@ typedef struct
|
||||
ecma_length_t unit_number;
|
||||
|
||||
/** Compressed pointer to first chunk with collection's data */
|
||||
mem_cpointer_t first_chunk_cp;
|
||||
jmem_cpointer_t first_chunk_cp;
|
||||
|
||||
/** Compressed pointer to last chunk with collection's data */
|
||||
mem_cpointer_t last_chunk_cp;
|
||||
jmem_cpointer_t last_chunk_cp;
|
||||
} ecma_collection_header_t;
|
||||
|
||||
/**
|
||||
@@ -742,10 +742,10 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
/** Characters */
|
||||
lit_utf8_byte_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) ];
|
||||
lit_utf8_byte_t data[ sizeof (uint64_t) - sizeof (jmem_cpointer_t) ];
|
||||
|
||||
/** Compressed pointer to next chunk */
|
||||
mem_cpointer_t next_chunk_cp;
|
||||
jmem_cpointer_t next_chunk_cp;
|
||||
} ecma_collection_chunk_t;
|
||||
|
||||
/**
|
||||
@@ -809,10 +809,10 @@ typedef struct ecma_string_t
|
||||
union
|
||||
{
|
||||
/** Index of string in literal table */
|
||||
mem_cpointer_t lit_cp;
|
||||
jmem_cpointer_t lit_cp;
|
||||
|
||||
/** Compressed pointer to an ecma_collection_header_t */
|
||||
mem_cpointer_t utf8_collection_cp;
|
||||
jmem_cpointer_t utf8_collection_cp;
|
||||
|
||||
/**
|
||||
* Actual data of an ascii string type
|
||||
@@ -820,13 +820,13 @@ typedef struct ecma_string_t
|
||||
struct
|
||||
{
|
||||
/** Compressed pointer to a raw character array */
|
||||
mem_cpointer_t ascii_collection_cp;
|
||||
jmem_cpointer_t ascii_collection_cp;
|
||||
/** Size of ascii string in bytes */
|
||||
uint16_t size;
|
||||
} ascii_string;
|
||||
|
||||
/** Compressed pointer to an ecma_number_t */
|
||||
mem_cpointer_t number_cp;
|
||||
jmem_cpointer_t number_cp;
|
||||
|
||||
/** UInt32-represented number placed locally in the descriptor */
|
||||
uint32_t uint32_number;
|
||||
@@ -852,7 +852,7 @@ typedef uintptr_t ecma_external_pointer_t;
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t size; /**< real size >> MEM_ALIGNMENT_LOG */
|
||||
uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */
|
||||
uint16_t refs; /**< reference counter for the byte code */
|
||||
uint16_t status_flags; /**< various status flags:
|
||||
* CBC_CODE_FLAGS_FUNCTION flag tells whether
|
||||
|
||||
@@ -185,7 +185,7 @@ ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 stri
|
||||
{
|
||||
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_ASCII_STRING | ECMA_STRING_REF_ONE;
|
||||
const size_t data_size = string_size;
|
||||
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) mem_heap_alloc_block (data_size);
|
||||
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (data_size);
|
||||
string_desc_p->u.ascii_string.size = (uint16_t) string_size;
|
||||
memcpy (data_p, string_p, string_size);
|
||||
ECMA_SET_NON_NULL_POINTER (string_desc_p->u.ascii_string.ascii_collection_cp, data_p);
|
||||
@@ -194,7 +194,7 @@ ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 stri
|
||||
{
|
||||
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_UTF8_STRING | ECMA_STRING_REF_ONE;
|
||||
const size_t data_size = string_size + sizeof (ecma_string_heap_header_t);
|
||||
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) mem_heap_alloc_block (data_size);
|
||||
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) jmem_heap_alloc_block (data_size);
|
||||
|
||||
JERRY_ASSERT (string_length <= UINT16_MAX);
|
||||
|
||||
@@ -370,7 +370,7 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
|
||||
{
|
||||
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_ASCII_STRING | ECMA_STRING_REF_ONE;
|
||||
const size_t data_size = new_size;
|
||||
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) mem_heap_alloc_block (data_size);
|
||||
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (data_size);
|
||||
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string1_p, data_p, str1_size);
|
||||
JERRY_ASSERT (bytes_copied == str1_size);
|
||||
bytes_copied = ecma_string_to_utf8_string (string2_p, data_p + str1_size, str2_size);
|
||||
@@ -386,7 +386,7 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
|
||||
{
|
||||
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_UTF8_STRING | ECMA_STRING_REF_ONE;
|
||||
const size_t data_size = new_size + sizeof (ecma_string_heap_header_t);
|
||||
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) mem_heap_alloc_block (data_size);
|
||||
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) jmem_heap_alloc_block (data_size);
|
||||
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string1_p,
|
||||
(lit_utf8_byte_t *) (data_p + 1),
|
||||
str1_size);
|
||||
@@ -459,7 +459,7 @@ ecma_copy_ecma_string (ecma_string_t *string_desc_p) /**< string descriptor */
|
||||
string_desc_p->u.utf8_collection_cp);
|
||||
JERRY_ASSERT (data_p != NULL);
|
||||
const size_t data_size = data_p->size + sizeof (ecma_string_heap_header_t);
|
||||
ecma_string_heap_header_t *new_data_p = (ecma_string_heap_header_t *) mem_heap_alloc_block (data_size);
|
||||
ecma_string_heap_header_t *new_data_p = (ecma_string_heap_header_t *) jmem_heap_alloc_block (data_size);
|
||||
memcpy (new_data_p, data_p, data_size);
|
||||
|
||||
ECMA_SET_NON_NULL_POINTER (new_str_p->u.utf8_collection_cp, new_data_p);
|
||||
@@ -478,7 +478,7 @@ ecma_copy_ecma_string (ecma_string_t *string_desc_p) /**< string descriptor */
|
||||
|
||||
JERRY_ASSERT (data_p != NULL);
|
||||
const size_t data_size = string_desc_p->u.ascii_string.size;
|
||||
lit_utf8_byte_t *new_data_p = (lit_utf8_byte_t *) mem_heap_alloc_block (data_size);
|
||||
lit_utf8_byte_t *new_data_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (data_size);
|
||||
memcpy (new_data_p, data_p, data_size);
|
||||
|
||||
ECMA_SET_NON_NULL_POINTER (new_str_p->u.ascii_string.ascii_collection_cp, new_data_p);
|
||||
@@ -552,7 +552,7 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */
|
||||
ecma_string_heap_header_t *const data_p = ECMA_GET_NON_NULL_POINTER (ecma_string_heap_header_t,
|
||||
string_p->u.utf8_collection_cp);
|
||||
|
||||
mem_heap_free_block (data_p, data_p->size + sizeof (ecma_string_heap_header_t));
|
||||
jmem_heap_free_block (data_p, data_p->size + sizeof (ecma_string_heap_header_t));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -561,7 +561,7 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */
|
||||
lit_utf8_byte_t *const data_p = ECMA_GET_NON_NULL_POINTER (lit_utf8_byte_t,
|
||||
string_p->u.ascii_string.ascii_collection_cp);
|
||||
|
||||
mem_heap_free_block (data_p, string_p->u.ascii_string.size);
|
||||
jmem_heap_free_block (data_p, string_p->u.ascii_string.size);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -802,7 +802,7 @@ ecma_string_get_number_in_desc_size (const uint32_t uint32_number) /**< number i
|
||||
* @return number of bytes in the buffer
|
||||
*/
|
||||
static inline lit_utf8_size_t __attr_always_inline___
|
||||
ecma_string_get_heap_number_size (mem_cpointer_t number_cp) /**< Compressed pointer to an ecma_number_t */
|
||||
ecma_string_get_heap_number_size (jmem_cpointer_t number_cp) /**< Compressed pointer to an ecma_number_t */
|
||||
{
|
||||
const ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (ecma_number_t, number_cp);
|
||||
lit_utf8_byte_t buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER];
|
||||
@@ -1052,7 +1052,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
|
||||
}
|
||||
else
|
||||
{
|
||||
utf8_string1_p = (lit_utf8_byte_t *) mem_heap_alloc_block ((size_t) strings_size);
|
||||
utf8_string1_p = (lit_utf8_byte_t *) jmem_heap_alloc_block ((size_t) strings_size);
|
||||
|
||||
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string1_p, utf8_string1_p, strings_size);
|
||||
JERRY_ASSERT (bytes_copied == strings_size);
|
||||
@@ -1083,7 +1083,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
|
||||
}
|
||||
else
|
||||
{
|
||||
utf8_string2_p = (lit_utf8_byte_t *) mem_heap_alloc_block ((size_t) strings_size);
|
||||
utf8_string2_p = (lit_utf8_byte_t *) jmem_heap_alloc_block ((size_t) strings_size);
|
||||
|
||||
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string2_p, utf8_string2_p, strings_size);
|
||||
JERRY_ASSERT (bytes_copied == strings_size);
|
||||
@@ -1094,12 +1094,12 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
|
||||
|
||||
if (is_utf8_string1_on_heap)
|
||||
{
|
||||
mem_heap_free_block ((void *) utf8_string1_p, (size_t) strings_size);
|
||||
jmem_heap_free_block ((void *) utf8_string1_p, (size_t) strings_size);
|
||||
}
|
||||
|
||||
if (is_utf8_string2_on_heap)
|
||||
{
|
||||
mem_heap_free_block ((void *) utf8_string2_p, (size_t) strings_size);
|
||||
jmem_heap_free_block ((void *) utf8_string2_p, (size_t) strings_size);
|
||||
}
|
||||
|
||||
return is_equal;
|
||||
@@ -1188,7 +1188,7 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
|
||||
|
||||
if (sizeof (utf8_string1_buffer) < utf8_string1_size)
|
||||
{
|
||||
utf8_string1_p = (lit_utf8_byte_t *) mem_heap_alloc_block (utf8_string1_size);
|
||||
utf8_string1_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (utf8_string1_size);
|
||||
is_utf8_string1_on_heap = true;
|
||||
}
|
||||
else
|
||||
@@ -1230,7 +1230,7 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
|
||||
|
||||
if (sizeof (utf8_string2_buffer) < utf8_string2_size)
|
||||
{
|
||||
utf8_string2_p = (lit_utf8_byte_t *) mem_heap_alloc_block (utf8_string2_size);
|
||||
utf8_string2_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (utf8_string2_size);
|
||||
is_utf8_string2_on_heap = true;
|
||||
}
|
||||
else
|
||||
@@ -1249,12 +1249,12 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
|
||||
|
||||
if (is_utf8_string1_on_heap)
|
||||
{
|
||||
mem_heap_free_block ((void *) utf8_string1_p, (size_t) utf8_string1_size);
|
||||
jmem_heap_free_block ((void *) utf8_string1_p, (size_t) utf8_string1_size);
|
||||
}
|
||||
|
||||
if (is_utf8_string2_on_heap)
|
||||
{
|
||||
mem_heap_free_block ((void *) utf8_string2_p, (size_t) utf8_string2_size);
|
||||
jmem_heap_free_block ((void *) utf8_string2_p, (size_t) utf8_string2_size);
|
||||
}
|
||||
|
||||
return is_first_less_than_second;
|
||||
@@ -1387,7 +1387,7 @@ ecma_string_get_char_at_pos (const ecma_string_t *string_p, /**< ecma-string */
|
||||
|
||||
ecma_char_t ch;
|
||||
|
||||
MEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
|
||||
JMEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
|
||||
|
||||
lit_utf8_size_t sz = ecma_string_to_utf8_string (string_p, utf8_str_p, buffer_size);
|
||||
JERRY_ASSERT (sz == buffer_size);
|
||||
@@ -1399,7 +1399,7 @@ ecma_string_get_char_at_pos (const ecma_string_t *string_p, /**< ecma-string */
|
||||
|
||||
ch = utf8_str_p[index];
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
|
||||
JMEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
|
||||
|
||||
return ch;
|
||||
} /* ecma_string_get_char_at_pos */
|
||||
@@ -1547,7 +1547,7 @@ ecma_string_substr (const ecma_string_t *string_p, /**< pointer to an ecma strin
|
||||
*/
|
||||
ecma_string_t *ecma_string_p;
|
||||
|
||||
MEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
|
||||
JMEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
|
||||
|
||||
lit_utf8_size_t sz = ecma_string_to_utf8_string (string_p, utf8_str_p, buffer_size);
|
||||
JERRY_ASSERT (sz == buffer_size);
|
||||
@@ -1578,7 +1578,7 @@ ecma_string_substr (const ecma_string_t *string_p, /**< pointer to an ecma strin
|
||||
ecma_string_p = ecma_new_ecma_string_from_utf8 (start_p, (lit_utf8_size_t) (end_p - start_p));
|
||||
}
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
|
||||
JMEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
|
||||
|
||||
return ecma_string_p;
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ JERRY_STATIC_ASSERT (ECMA_TYPE___MAX <= ECMA_VALUE_TYPE_MASK,
|
||||
JERRY_STATIC_ASSERT ((ECMA_VALUE_FULL_MASK + 1) == (1 << ECMA_VALUE_SHIFT),
|
||||
ecma_value_part_must_start_after_flags);
|
||||
|
||||
JERRY_STATIC_ASSERT (ECMA_VALUE_SHIFT <= MEM_ALIGNMENT_LOG,
|
||||
JERRY_STATIC_ASSERT (ECMA_VALUE_SHIFT <= JMEM_ALIGNMENT_LOG,
|
||||
ecma_value_shift_must_be_less_than_or_equal_than_mem_alignment_log);
|
||||
|
||||
JERRY_STATIC_ASSERT ((sizeof (ecma_value_t) * JERRY_BITSINBYTE)
|
||||
>= (sizeof (mem_cpointer_t) * JERRY_BITSINBYTE + ECMA_VALUE_SHIFT),
|
||||
>= (sizeof (jmem_cpointer_t) * JERRY_BITSINBYTE + ECMA_VALUE_SHIFT),
|
||||
ecma_value_must_be_large_enough_to_store_compressed_pointers);
|
||||
|
||||
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
|
||||
@@ -86,7 +86,7 @@ ecma_pointer_to_ecma_value (const void *ptr) /**< pointer */
|
||||
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
|
||||
|
||||
mem_cpointer_t ptr_cp;
|
||||
jmem_cpointer_t ptr_cp;
|
||||
ECMA_SET_NON_NULL_POINTER (ptr_cp, ptr);
|
||||
return ((ecma_value_t) ptr_cp) << ECMA_VALUE_SHIFT;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ ecma_new_values_collection (const ecma_value_t values_buffer[], /**< ecma values
|
||||
|
||||
header_p->unit_number = values_number;
|
||||
|
||||
mem_cpointer_t *next_chunk_cp_p = &header_p->first_chunk_cp;
|
||||
jmem_cpointer_t *next_chunk_cp_p = &header_p->first_chunk_cp;
|
||||
ecma_collection_chunk_t *last_chunk_p = NULL;
|
||||
ecma_value_t *cur_value_buf_iter_p = NULL;
|
||||
ecma_value_t *cur_value_buf_end_p = NULL;
|
||||
@@ -303,7 +303,7 @@ ecma_collection_iterator_init (ecma_collection_iterator_t *iterator_p, /**< cont
|
||||
ecma_collection_header_t *collection_p) /**< header of collection */
|
||||
{
|
||||
iterator_p->header_p = collection_p;
|
||||
iterator_p->next_chunk_cp = (collection_p != NULL ? collection_p->first_chunk_cp : MEM_CP_NULL);
|
||||
iterator_p->next_chunk_cp = (collection_p != NULL ? collection_p->first_chunk_cp : JMEM_CP_NULL);
|
||||
iterator_p->current_index = 0;
|
||||
iterator_p->current_value_p = NULL;
|
||||
iterator_p->current_chunk_end_p = NULL;
|
||||
|
||||
@@ -106,7 +106,7 @@ ecma_create_object (ecma_object_t *prototype_object_p, /**< pointer to prototybe
|
||||
|
||||
ecma_init_gc_info (new_object_p);
|
||||
|
||||
new_object_p->property_list_or_bound_object_cp = MEM_CP_NULL;
|
||||
new_object_p->property_list_or_bound_object_cp = JMEM_CP_NULL;
|
||||
|
||||
ECMA_SET_POINTER (new_object_p->prototype_or_outer_reference_cp,
|
||||
prototype_object_p);
|
||||
@@ -134,7 +134,7 @@ ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p) /**< outer
|
||||
|
||||
ecma_init_gc_info (new_lexical_environment_p);
|
||||
|
||||
new_lexical_environment_p->property_list_or_bound_object_cp = MEM_CP_NULL;
|
||||
new_lexical_environment_p->property_list_or_bound_object_cp = JMEM_CP_NULL;
|
||||
|
||||
ECMA_SET_POINTER (new_lexical_environment_p->prototype_or_outer_reference_cp,
|
||||
outer_lexical_environment_p);
|
||||
@@ -398,7 +398,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
|
||||
{
|
||||
JERRY_ASSERT (ECMA_PROPERTY_PAIR_ITEM_COUNT == 2);
|
||||
|
||||
mem_cpointer_t *property_list_head_p = &object_p->property_list_or_bound_object_cp;
|
||||
jmem_cpointer_t *property_list_head_p = &object_p->property_list_or_bound_object_cp;
|
||||
bool has_hashmap = false;
|
||||
|
||||
if (*property_list_head_p != ECMA_NULL_POINTER)
|
||||
@@ -1468,7 +1468,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
|
||||
|
||||
for (uint32_t i = const_literal_end; i < literal_end; i++)
|
||||
{
|
||||
mem_cpointer_t bytecode_cpointer = literal_start_p[i];
|
||||
jmem_cpointer_t bytecode_cpointer = literal_start_p[i];
|
||||
ecma_compiled_code_t *bytecode_literal_p = ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t,
|
||||
bytecode_cpointer);
|
||||
|
||||
@@ -1488,8 +1488,8 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
|
||||
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
|
||||
}
|
||||
|
||||
mem_heap_free_block (bytecode_p,
|
||||
((size_t) bytecode_p->size) << MEM_ALIGNMENT_LOG);
|
||||
jmem_heap_free_block (bytecode_p,
|
||||
((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
|
||||
} /* ecma_bytecode_deref */
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#define ECMA_HELPERS_H
|
||||
|
||||
#include "ecma-globals.h"
|
||||
#include "jmem-allocator.h"
|
||||
#include "lit-cpointer.h"
|
||||
#include "lit-strings.h"
|
||||
#include "mem-allocator.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
@@ -32,25 +32,25 @@
|
||||
/**
|
||||
* Get value of pointer from specified non-null compressed pointer.
|
||||
*/
|
||||
#define ECMA_GET_NON_NULL_POINTER(type, field) MEM_CP_GET_NON_NULL_POINTER (type, field)
|
||||
#define ECMA_GET_NON_NULL_POINTER(type, field) JMEM_CP_GET_NON_NULL_POINTER (type, field)
|
||||
|
||||
/**
|
||||
* Get value of pointer from specified compressed pointer.
|
||||
*/
|
||||
#define ECMA_GET_POINTER(type, field) MEM_CP_GET_POINTER (type, field)
|
||||
#define ECMA_GET_POINTER(type, field) JMEM_CP_GET_POINTER (type, field)
|
||||
|
||||
/**
|
||||
* Set value of non-null compressed pointer so that it will correspond
|
||||
* to specified non_compressed_pointer.
|
||||
*/
|
||||
#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) MEM_CP_SET_NON_NULL_POINTER (field, \
|
||||
non_compressed_pointer)
|
||||
#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) JMEM_CP_SET_NON_NULL_POINTER (field, \
|
||||
non_compressed_pointer)
|
||||
|
||||
/**
|
||||
* Set value of compressed pointer so that it will correspond
|
||||
* to specified non_compressed_pointer.
|
||||
*/
|
||||
#define ECMA_SET_POINTER(field, non_compressed_pointer) MEM_CP_SET_POINTER (field, non_compressed_pointer)
|
||||
#define ECMA_SET_POINTER(field, non_compressed_pointer) JMEM_CP_SET_POINTER (field, non_compressed_pointer)
|
||||
|
||||
/**
|
||||
* Convert ecma-string's contents to a cesu-8 string and put it into a buffer.
|
||||
@@ -65,7 +65,7 @@
|
||||
\
|
||||
if (utf8_ptr == NULL) \
|
||||
{ \
|
||||
utf8_ptr = (const lit_utf8_byte_t *) (mem_heap_alloc_block (utf8_str_size)); \
|
||||
utf8_ptr = (const lit_utf8_byte_t *) jmem_heap_alloc_block (utf8_str_size); \
|
||||
lit_utf8_size_t sz = ecma_string_to_utf8_string (ecma_str_ptr, (lit_utf8_byte_t *) utf8_ptr, utf8_str_size); \
|
||||
JERRY_ASSERT (sz == utf8_str_size); \
|
||||
utf8_ptr ## must_be_freed = true; \
|
||||
@@ -110,7 +110,7 @@
|
||||
if (utf8_ptr ## must_be_freed) \
|
||||
{ \
|
||||
JERRY_ASSERT (utf8_ptr != NULL); \
|
||||
mem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
|
||||
jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
|
||||
}
|
||||
|
||||
/* ecma-helpers-value.c */
|
||||
@@ -226,7 +226,7 @@ extern ecma_collection_header_t *ecma_new_strings_collection (ecma_string_t *[],
|
||||
typedef struct
|
||||
{
|
||||
ecma_collection_header_t *header_p; /**< collection header */
|
||||
mem_cpointer_t next_chunk_cp; /**< compressed pointer to next chunk */
|
||||
jmem_cpointer_t next_chunk_cp; /**< compressed pointer to next chunk */
|
||||
ecma_length_t current_index; /**< index of current element */
|
||||
const ecma_value_t *current_value_p; /**< pointer to current element */
|
||||
const ecma_value_t *current_chunk_beg_p; /**< pointer to beginning of current chunk's data */
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "ecma-init-finalize.h"
|
||||
#include "ecma-lcache.h"
|
||||
#include "ecma-lex-env.h"
|
||||
#include "mem-allocator.h"
|
||||
#include "jmem-allocator.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
@@ -39,7 +39,7 @@ ecma_init (void)
|
||||
ecma_lcache_init ();
|
||||
ecma_init_environment ();
|
||||
|
||||
mem_register_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
|
||||
jmem_register_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
|
||||
} /* ecma_init */
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ ecma_init (void)
|
||||
void
|
||||
ecma_finalize (void)
|
||||
{
|
||||
mem_unregister_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
|
||||
jmem_unregister_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
|
||||
|
||||
ecma_finalize_environment ();
|
||||
ecma_lcache_invalidate_all ();
|
||||
|
||||
@@ -37,10 +37,10 @@ typedef struct
|
||||
ecma_property_t *prop_p;
|
||||
|
||||
/** Compressed pointer to object (ECMA_NULL_POINTER marks record empty) */
|
||||
mem_cpointer_t object_cp;
|
||||
jmem_cpointer_t object_cp;
|
||||
|
||||
/** Compressed pointer to property's name */
|
||||
mem_cpointer_t prop_name_cp;
|
||||
jmem_cpointer_t prop_name_cp;
|
||||
} ecma_lcache_hash_entry_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
* Compute the total size of the property hashmap.
|
||||
*/
|
||||
#define ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE(max_property_count) \
|
||||
(sizeof (ecma_property_hashmap_t) + (max_property_count * sizeof (mem_cpointer_t)) + (max_property_count >> 3))
|
||||
(sizeof (ecma_property_hashmap_t) + (max_property_count * sizeof (jmem_cpointer_t)) + (max_property_count >> 3))
|
||||
|
||||
/**
|
||||
* Number of items in the stepping table.
|
||||
@@ -110,7 +110,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
|
||||
|
||||
size_t total_size = ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (max_property_count);
|
||||
|
||||
ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) mem_heap_alloc_block (total_size);
|
||||
ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) jmem_heap_alloc_block (total_size);
|
||||
memset (hashmap_p, 0, total_size);
|
||||
|
||||
hashmap_p->header.types[0].type_and_flags = ECMA_PROPERTY_TYPE_HASHMAP;
|
||||
@@ -118,7 +118,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
|
||||
hashmap_p->max_property_count = max_property_count;
|
||||
hashmap_p->null_count = max_property_count - named_property_count;
|
||||
|
||||
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
|
||||
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
|
||||
uint8_t *bits_p = (uint8_t *) (pair_list_p + max_property_count);
|
||||
uint32_t mask = max_property_count - 1;
|
||||
|
||||
@@ -225,8 +225,8 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
|
||||
|
||||
object_p->property_list_or_bound_object_cp = property_p->next_property_cp;
|
||||
|
||||
mem_heap_free_block (hashmap_p,
|
||||
ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
|
||||
jmem_heap_free_block (hashmap_p,
|
||||
ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
|
||||
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
|
||||
(void) object_p;
|
||||
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
|
||||
@@ -275,7 +275,7 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
|
||||
uint32_t start_entry_index = entry_index;
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
|
||||
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
|
||||
|
||||
while (pair_list_p[entry_index] != ECMA_NULL_POINTER)
|
||||
{
|
||||
@@ -333,7 +333,7 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
|
||||
uint32_t entry_index = name_p->hash;
|
||||
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
|
||||
uint32_t mask = hashmap_p->max_property_count - 1;
|
||||
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
|
||||
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
|
||||
uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);
|
||||
|
||||
if (mask < (1u << LIT_STRING_HASH_BITS))
|
||||
@@ -442,7 +442,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
|
||||
uint32_t entry_index = name_p->hash;
|
||||
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
|
||||
uint32_t mask = hashmap_p->max_property_count - 1;
|
||||
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
|
||||
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
|
||||
uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);
|
||||
|
||||
if (mask < (1u << LIT_STRING_HASH_BITS))
|
||||
|
||||
Reference in New Issue
Block a user