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:
@@ -27,10 +27,10 @@ lit_cpointer_compress (lit_record_t *pointer) /**< pointer to compress */
|
||||
{
|
||||
if (pointer == NULL)
|
||||
{
|
||||
return MEM_CP_NULL;
|
||||
return JMEM_CP_NULL;
|
||||
}
|
||||
|
||||
return (lit_cpointer_t) mem_compress_pointer (pointer);
|
||||
return (lit_cpointer_t) jmem_compress_pointer (pointer);
|
||||
} /* lit_cpointer_compress */
|
||||
|
||||
/**
|
||||
@@ -41,12 +41,12 @@ lit_cpointer_compress (lit_record_t *pointer) /**< pointer to compress */
|
||||
inline lit_record_t * __attr_pure___ __attr_always_inline___
|
||||
lit_cpointer_decompress (lit_cpointer_t compressed_pointer) /**< recordset-specific compressed pointer */
|
||||
{
|
||||
if (compressed_pointer == MEM_CP_NULL)
|
||||
if (compressed_pointer == JMEM_CP_NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (lit_record_t *) mem_decompress_pointer (compressed_pointer);
|
||||
return (lit_record_t *) jmem_decompress_pointer (compressed_pointer);
|
||||
} /* lit_cpointer_decompress */
|
||||
|
||||
/**
|
||||
@@ -57,5 +57,5 @@ lit_cpointer_decompress (lit_cpointer_t compressed_pointer) /**< recordset-speci
|
||||
inline lit_cpointer_t __attr_pure___ __attr_always_inline___
|
||||
lit_cpointer_null_cp (void)
|
||||
{
|
||||
return MEM_CP_NULL;
|
||||
return JMEM_CP_NULL;
|
||||
} /* lit_cpointer_null_cp */
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
#define LIT_CPOINTER_H
|
||||
|
||||
#include "lit-literal-storage.h"
|
||||
#include "mem-allocator.h"
|
||||
#include "jmem-allocator.h"
|
||||
|
||||
#define LIT_CPOINTER_WIDTH (MEM_CP_WIDTH + MEM_ALIGNMENT_LOG - MEM_ALIGNMENT_LOG)
|
||||
#define LIT_CPOINTER_WIDTH (JMEM_CP_WIDTH + JMEM_ALIGNMENT_LOG - JMEM_ALIGNMENT_LOG)
|
||||
|
||||
/**
|
||||
* Dynamic storage-specific extended compressed pointer
|
||||
*
|
||||
* Note:
|
||||
* the pointer can represent addresses aligned by lit_DYN_STORAGE_LENGTH_UNIT,
|
||||
* while mem_cpointer_t can only represent addresses aligned by MEM_ALIGNMENT.
|
||||
* while jmem_cpointer_t can only represent addresses aligned by JMEM_ALIGNMENT.
|
||||
*/
|
||||
typedef uint16_t lit_cpointer_t;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ lit_record_t *
|
||||
lit_create_charset_literal (const lit_utf8_byte_t *str_p, /**< string to be placed into the record */
|
||||
const lit_utf8_size_t buf_size) /**< size in bytes of the buffer which holds the string */
|
||||
{
|
||||
lit_charset_record_t *rec_p = (lit_charset_record_t *) mem_heap_alloc_block (buf_size + LIT_CHARSET_HEADER_SIZE);
|
||||
lit_charset_record_t *rec_p = (lit_charset_record_t *) jmem_heap_alloc_block (buf_size + LIT_CHARSET_HEADER_SIZE);
|
||||
|
||||
rec_p->type = LIT_RECORD_TYPE_CHARSET;
|
||||
rec_p->next = (uint16_t) lit_cpointer_compress (lit_storage);
|
||||
@@ -52,7 +52,7 @@ lit_create_charset_literal (const lit_utf8_byte_t *str_p, /**< string to be plac
|
||||
lit_record_t *
|
||||
lit_create_magic_literal (const lit_magic_string_id_t id) /**< id of magic string */
|
||||
{
|
||||
lit_magic_record_t *rec_p = (lit_magic_record_t *) mem_heap_alloc_block (sizeof (lit_magic_record_t));
|
||||
lit_magic_record_t *rec_p = (lit_magic_record_t *) jmem_heap_alloc_block (sizeof (lit_magic_record_t));
|
||||
rec_p->type = LIT_RECORD_TYPE_MAGIC_STR;
|
||||
rec_p->next = (uint16_t) lit_cpointer_compress (lit_storage);
|
||||
lit_storage = (lit_record_t *) rec_p;
|
||||
@@ -70,7 +70,7 @@ lit_create_magic_literal (const lit_magic_string_id_t id) /**< id of magic strin
|
||||
lit_record_t *
|
||||
lit_create_magic_literal_ex (const lit_magic_string_ex_id_t id) /**< id of magic string */
|
||||
{
|
||||
lit_magic_record_t *rec_p = (lit_magic_record_t *) mem_heap_alloc_block (sizeof (lit_magic_record_t));
|
||||
lit_magic_record_t *rec_p = (lit_magic_record_t *) jmem_heap_alloc_block (sizeof (lit_magic_record_t));
|
||||
rec_p->type = LIT_RECORD_TYPE_MAGIC_STR_EX;
|
||||
rec_p->next = (uint16_t) lit_cpointer_compress (lit_storage);
|
||||
lit_storage = (lit_record_t *) rec_p;
|
||||
@@ -88,7 +88,7 @@ lit_create_magic_literal_ex (const lit_magic_string_ex_id_t id) /**< id of magic
|
||||
lit_record_t *
|
||||
lit_create_number_literal (const ecma_number_t num) /**< numeric value */
|
||||
{
|
||||
lit_number_record_t *rec_p = (lit_number_record_t *) mem_heap_alloc_block (sizeof (lit_number_record_t));
|
||||
lit_number_record_t *rec_p = (lit_number_record_t *) jmem_heap_alloc_block (sizeof (lit_number_record_t));
|
||||
|
||||
rec_p->type = (uint8_t) LIT_RECORD_TYPE_NUMBER;
|
||||
rec_p->next = (uint16_t) lit_cpointer_compress (lit_storage);
|
||||
@@ -150,7 +150,7 @@ lit_record_t *
|
||||
lit_free_literal (lit_record_t *lit_p) /**< literal record */
|
||||
{
|
||||
lit_record_t *const ret_p = lit_cpointer_decompress (lit_p->next);
|
||||
mem_heap_free_block (lit_p, lit_get_literal_size (lit_p));
|
||||
jmem_heap_free_block (lit_p, lit_get_literal_size (lit_p));
|
||||
return ret_p;
|
||||
} /* lit_free_literal */
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ lit_save_literals_for_snapshot (uint8_t *buffer_p, /**< [out] output snapshot bu
|
||||
|
||||
size_t id_map_size = sizeof (lit_mem_to_snapshot_id_map_entry_t) * literals_num;
|
||||
lit_mem_to_snapshot_id_map_entry_t *id_map_p;
|
||||
id_map_p = (lit_mem_to_snapshot_id_map_entry_t *) mem_heap_alloc_block_store_size (id_map_size);
|
||||
id_map_p = (lit_mem_to_snapshot_id_map_entry_t *) jmem_heap_alloc_block_store_size (id_map_size);
|
||||
|
||||
uint32_t literal_index = 0;
|
||||
lit_literal_t lit;
|
||||
@@ -207,7 +207,7 @@ lit_save_literals_for_snapshot (uint8_t *buffer_p, /**< [out] output snapshot bu
|
||||
|
||||
if (!is_ok)
|
||||
{
|
||||
mem_heap_free_block_size_stored (id_map_p);
|
||||
jmem_heap_free_block_size_stored (id_map_p);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ lit_save_literals_for_snapshot (uint8_t *buffer_p, /**< [out] output snapshot bu
|
||||
*out_map_p = id_map_p;
|
||||
}
|
||||
|
||||
uint32_t aligned_size = JERRY_ALIGNUP (lit_table_size, MEM_ALIGNMENT);
|
||||
uint32_t aligned_size = JERRY_ALIGNUP (lit_table_size, JMEM_ALIGNMENT);
|
||||
|
||||
if (aligned_size != lit_table_size)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ lit_load_literals_from_snapshot (const uint8_t *lit_table_p, /**< buffer with li
|
||||
|
||||
size_t id_map_size = sizeof (lit_mem_to_snapshot_id_map_entry_t) * literals_num;
|
||||
lit_mem_to_snapshot_id_map_entry_t *id_map_p;
|
||||
id_map_p = (lit_mem_to_snapshot_id_map_entry_t *) mem_heap_alloc_block_store_size (id_map_size);
|
||||
id_map_p = (lit_mem_to_snapshot_id_map_entry_t *) jmem_heap_alloc_block_store_size (id_map_size);
|
||||
|
||||
bool is_ok = true;
|
||||
uint32_t lit_index;
|
||||
@@ -395,7 +395,7 @@ lit_load_literals_from_snapshot (const uint8_t *lit_table_p, /**< buffer with li
|
||||
return true;
|
||||
}
|
||||
|
||||
mem_heap_free_block_size_stored (id_map_p);
|
||||
jmem_heap_free_block_size_stored (id_map_p);
|
||||
return false;
|
||||
} /* lit_load_literals_from_snapshot */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user