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:
@@ -38,7 +38,7 @@ util_free_literal (lexer_literal_t *literal_p) /**< literal */
|
||||
{
|
||||
if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
|
||||
{
|
||||
mem_heap_free_block_size_stored ((void *) literal_p->u.char_p);
|
||||
jmem_heap_free_block_size_stored ((void *) literal_p->u.char_p);
|
||||
}
|
||||
}
|
||||
else if ((literal_p->type == LEXER_FUNCTION_LITERAL)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "lit-literal.h"
|
||||
#include "mem-heap.h"
|
||||
#include "jmem-heap.h"
|
||||
|
||||
/* Immediate management. */
|
||||
|
||||
|
||||
@@ -1202,7 +1202,7 @@ lexer_process_char_literal (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (has_escape)
|
||||
{
|
||||
literal_p->u.char_p = (uint8_t *) mem_heap_alloc_block_store_size (length);
|
||||
literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block_store_size (length);
|
||||
memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
/* Maximum code size.
|
||||
* Limit: 16777215. Recommended: 65535, 16777215. */
|
||||
#ifndef PARSER_MAXIMUM_CODE_SIZE
|
||||
#define PARSER_MAXIMUM_CODE_SIZE (65535 << (MEM_ALIGNMENT_LOG))
|
||||
#define PARSER_MAXIMUM_CODE_SIZE (65535 << (JMEM_ALIGNMENT_LOG))
|
||||
#endif /* !PARSER_MAXIMUM_CODE_SIZE */
|
||||
|
||||
/* Maximum number of values pushed onto the stack by a function.
|
||||
|
||||
@@ -39,7 +39,7 @@ parser_malloc (parser_context_t *context_p, /**< context */
|
||||
void *result;
|
||||
|
||||
JERRY_ASSERT (size > 0);
|
||||
result = mem_heap_alloc_block (size);
|
||||
result = jmem_heap_alloc_block (size);
|
||||
if (result == 0)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_OUT_OF_MEMORY);
|
||||
@@ -53,7 +53,7 @@ parser_malloc (parser_context_t *context_p, /**< context */
|
||||
void parser_free (void *ptr, /**< pointer to free */
|
||||
size_t size) /**< size of the memory block */
|
||||
{
|
||||
mem_heap_free_block (ptr, size);
|
||||
jmem_heap_free_block (ptr, size);
|
||||
} /* parser_free */
|
||||
|
||||
/**
|
||||
@@ -68,7 +68,7 @@ parser_malloc_local (parser_context_t *context_p, /**< context */
|
||||
void *result;
|
||||
|
||||
JERRY_ASSERT (size > 0);
|
||||
result = mem_heap_alloc_block (size);
|
||||
result = jmem_heap_alloc_block (size);
|
||||
if (result == 0)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_OUT_OF_MEMORY);
|
||||
@@ -82,7 +82,7 @@ parser_malloc_local (parser_context_t *context_p, /**< context */
|
||||
void parser_free_local (void *ptr, /**< pointer to free */
|
||||
size_t size) /**< size of the memory */
|
||||
{
|
||||
mem_heap_free_block (ptr, size);
|
||||
jmem_heap_free_block (ptr, size);
|
||||
} /* parser_free_local */
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
@@ -105,7 +105,7 @@ parser_compute_indicies (parser_context_t *context_p, /**< context */
|
||||
|
||||
if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
|
||||
{
|
||||
mem_heap_free_block_size_stored ((void *) char_p);
|
||||
jmem_heap_free_block_size_stored ((void *) char_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,7 +527,7 @@ parser_generate_initializers (parser_context_t *context_p, /**< context */
|
||||
if (!context_p->is_show_opcodes
|
||||
&& !(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
|
||||
{
|
||||
mem_heap_free_block_size_stored ((void *) literal_p->u.char_p);
|
||||
jmem_heap_free_block_size_stored ((void *) literal_p->u.char_p);
|
||||
}
|
||||
#else /* !PARSER_DUMP_BYTE_CODE */
|
||||
literal_pool_p[literal_p->prop.index] = literal_p->u.value;
|
||||
@@ -1460,12 +1460,12 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
|
||||
total_size += length + context_p->literal_count * sizeof (lit_cpointer_t);
|
||||
total_size = JERRY_ALIGNUP (total_size, MEM_ALIGNMENT);
|
||||
total_size = JERRY_ALIGNUP (total_size, JMEM_ALIGNMENT);
|
||||
|
||||
compiled_code_p = (ecma_compiled_code_t *) parser_malloc (context_p, total_size);
|
||||
|
||||
byte_code_p = (uint8_t *) compiled_code_p;
|
||||
compiled_code_p->size = (uint16_t) (total_size >> MEM_ALIGNMENT_LOG);
|
||||
compiled_code_p->size = (uint16_t) (total_size >> JMEM_ALIGNMENT_LOG);
|
||||
compiled_code_p->refs = 1;
|
||||
compiled_code_p->status_flags = CBC_CODE_FLAGS_FUNCTION;
|
||||
|
||||
@@ -1695,7 +1695,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
if ((literal_p->type == LEXER_IDENT_LITERAL || literal_p->type == LEXER_STRING_LITERAL)
|
||||
&& !(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
|
||||
{
|
||||
mem_heap_free_block_size_stored ((void *) literal_p->u.char_p);
|
||||
jmem_heap_free_block_size_stored ((void *) literal_p->u.char_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,11 +54,11 @@ re_realloc_regexp_bytecode_block (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytec
|
||||
JERRY_ASSERT (bc_ctx_p->current_p >= bc_ctx_p->block_start_p);
|
||||
size_t current_ptr_offset = (size_t) (bc_ctx_p->current_p - bc_ctx_p->block_start_p);
|
||||
|
||||
uint8_t *new_block_start_p = (uint8_t *) mem_heap_alloc_block (new_block_size);
|
||||
uint8_t *new_block_start_p = (uint8_t *) jmem_heap_alloc_block (new_block_size);
|
||||
if (bc_ctx_p->current_p)
|
||||
{
|
||||
memcpy (new_block_start_p, bc_ctx_p->block_start_p, (size_t) (current_ptr_offset));
|
||||
mem_heap_free_block (bc_ctx_p->block_start_p, old_size);
|
||||
jmem_heap_free_block (bc_ctx_p->block_start_p, old_size);
|
||||
}
|
||||
bc_ctx_p->block_start_p = new_block_start_p;
|
||||
bc_ctx_p->block_end_p = new_block_start_p + new_block_size;
|
||||
@@ -109,10 +109,10 @@ re_bytecode_list_insert (re_bytecode_ctx_t *bc_ctx_p, /**< RegExp bytecode conte
|
||||
{
|
||||
uint8_t *dest_p = src_p + length;
|
||||
uint8_t *tmp_block_start_p;
|
||||
tmp_block_start_p = (uint8_t *) mem_heap_alloc_block (re_get_bytecode_length (bc_ctx_p) - offset);
|
||||
tmp_block_start_p = (uint8_t *) jmem_heap_alloc_block (re_get_bytecode_length (bc_ctx_p) - offset);
|
||||
memcpy (tmp_block_start_p, src_p, (size_t) (re_get_bytecode_length (bc_ctx_p) - offset));
|
||||
memcpy (dest_p, tmp_block_start_p, (size_t) (re_get_bytecode_length (bc_ctx_p) - offset));
|
||||
mem_heap_free_block (tmp_block_start_p, re_get_bytecode_length (bc_ctx_p) - offset);
|
||||
jmem_heap_free_block (tmp_block_start_p, re_get_bytecode_length (bc_ctx_p) - offset);
|
||||
}
|
||||
memcpy (src_p, bytecode_p, length);
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ typedef enum
|
||||
typedef struct
|
||||
{
|
||||
ecma_compiled_code_t header; /**< compiled code header */
|
||||
mem_cpointer_t pattern_cp; /**< original RegExp pattern */
|
||||
jmem_cpointer_t pattern_cp; /**< original RegExp pattern */
|
||||
uint32_t num_of_captures; /**< number of capturing brackets */
|
||||
uint32_t num_of_non_captures; /**< number of non capturing brackets */
|
||||
} re_compiled_code_t;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "mem-heap.h"
|
||||
#include "jmem-heap.h"
|
||||
#include "re-bytecode.h"
|
||||
#include "re-compiler.h"
|
||||
#include "re-parser.h"
|
||||
@@ -597,7 +597,7 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
|
||||
{
|
||||
/* Compilation failed, free bytecode. */
|
||||
JERRY_DDLOG ("RegExp compilation failed!\n");
|
||||
mem_heap_free_block (bc_ctx.block_start_p, byte_code_size);
|
||||
jmem_heap_free_block (bc_ctx.block_start_p, byte_code_size);
|
||||
*out_bytecode_p = NULL;
|
||||
}
|
||||
else
|
||||
@@ -610,7 +610,7 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
|
||||
JERRY_ASSERT (bc_ctx.block_start_p != NULL);
|
||||
*out_bytecode_p = (re_compiled_code_t *) bc_ctx.block_start_p;
|
||||
|
||||
((re_compiled_code_t *) bc_ctx.block_start_p)->header.size = (uint16_t) (byte_code_size >> MEM_ALIGNMENT_LOG);
|
||||
((re_compiled_code_t *) bc_ctx.block_start_p)->header.size = (uint16_t) (byte_code_size >> JMEM_ALIGNMENT_LOG);
|
||||
|
||||
if (cache_idx == RE_CACHE_SIZE)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user