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:
László Langó
2016-05-13 14:09:31 +02:00
parent aaa3d22677
commit 92bb551d45
63 changed files with 1612 additions and 1612 deletions
+16 -16
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "mem-allocator.h"
#include "jmem-allocator.h"
#include "test-common.h"
@@ -35,17 +35,17 @@ size_t sizes[test_sub_iters];
bool is_one_chunked[test_sub_iters];
static void
test_heap_give_some_memory_back (mem_try_give_memory_back_severity_t severity)
test_heap_give_some_memory_back (jmem_try_give_memory_back_severity_t severity)
{
int p;
if (severity == MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_LOW)
if (severity == JMEM_TRY_GIVE_MEMORY_BACK_SEVERITY_LOW)
{
p = 8;
}
else
{
JERRY_ASSERT (severity == MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_HIGH);
JERRY_ASSERT (severity == JMEM_TRY_GIVE_MEMORY_BACK_SEVERITY_HIGH);
p = 1;
}
@@ -61,7 +61,7 @@ test_heap_give_some_memory_back (mem_try_give_memory_back_severity_t severity)
JERRY_ASSERT (ptrs[i][k] == 0);
}
mem_heap_free_block_size_stored (ptrs[i]);
jmem_heap_free_block_size_stored (ptrs[i]);
ptrs[i] = NULL;
}
}
@@ -74,27 +74,27 @@ main (int __attr_unused___ argc,
{
TEST_INIT ();
mem_heap_init ();
jmem_heap_init ();
mem_register_a_try_give_memory_back_callback (test_heap_give_some_memory_back);
jmem_register_a_try_give_memory_back_callback (test_heap_give_some_memory_back);
#ifdef MEM_STATS
mem_heap_stats_print ();
#endif /* MEM_STATS */
#ifdef JMEM_STATS
jmem_heap_stats_print ();
#endif /* JMEM_STATS */
for (uint32_t i = 0; i < test_iters; i++)
{
for (uint32_t j = 0; j < test_sub_iters; j++)
{
size_t size = (size_t) rand () % test_threshold_block_size;
ptrs[j] = (uint8_t *) mem_heap_alloc_block_store_size (size);
ptrs[j] = (uint8_t *) jmem_heap_alloc_block_store_size (size);
sizes[j] = size;
JERRY_ASSERT (sizes[j] == 0 || ptrs[j] != NULL);
memset (ptrs[j], 0, sizes[j]);
}
// mem_heap_print (true);
/* jmem_heap_print (true); */
for (uint32_t j = 0; j < test_sub_iters; j++)
{
@@ -105,16 +105,16 @@ main (int __attr_unused___ argc,
JERRY_ASSERT (ptrs[j][k] == 0);
}
mem_heap_free_block_size_stored (ptrs[j]);
jmem_heap_free_block_size_stored (ptrs[j]);
ptrs[j] = NULL;
}
}
}
#ifdef MEM_STATS
mem_heap_stats_print ();
#endif /* MEM_STATS */
#ifdef JMEM_STATS
jmem_heap_stats_print ();
#endif /* JMEM_STATS */
return 0;
} /* main */
+2 -2
View File
@@ -28,7 +28,7 @@ main (int __attr_unused___ argc,
{
TEST_INIT ();
mem_init ();
jmem_init ();
lit_init ();
ecma_init ();
@@ -78,7 +78,7 @@ main (int __attr_unused___ argc,
ecma_finalize ();
lit_finalize ();
mem_finalize (true);
jmem_finalize (true);
return 0;
} /* main */
+2 -2
View File
@@ -91,7 +91,7 @@ main (int __attr_unused___ argc,
lit_utf8_byte_t strings[test_sub_iters][max_characters_in_string + 1];
lit_utf8_size_t lengths[test_sub_iters];
mem_init ();
jmem_init ();
lit_init ();
for (uint32_t i = 0; i < test_iters; i++)
@@ -159,6 +159,6 @@ main (int __attr_unused___ argc,
}
lit_finalize ();
mem_finalize (true);
jmem_finalize (true);
return 0;
} /* main */
+15 -15
View File
@@ -20,8 +20,8 @@
#define JERRY_MEM_POOL_INTERNAL
#include "mem-allocator.h"
#include "mem-poolman.h"
#include "jmem-allocator.h"
#include "jmem-poolman.h"
#include "test-common.h"
@@ -32,7 +32,7 @@ const uint32_t test_iters = 1024;
#define TEST_MAX_SUB_ITERS 1024
uint8_t *ptrs[TEST_MAX_SUB_ITERS];
uint8_t data[TEST_MAX_SUB_ITERS][MEM_POOL_CHUNK_SIZE];
uint8_t data[TEST_MAX_SUB_ITERS][JMEM_POOL_CHUNK_SIZE];
int
main (int __attr_unused___ argc,
@@ -40,7 +40,7 @@ main (int __attr_unused___ argc,
{
TEST_INIT ();
mem_init ();
jmem_init ();
for (uint32_t i = 0; i < test_iters; i++)
{
@@ -48,42 +48,42 @@ main (int __attr_unused___ argc,
for (size_t j = 0; j < subiters; j++)
{
ptrs[j] = (uint8_t *) mem_pools_alloc ();
ptrs[j] = (uint8_t *) jmem_pools_alloc ();
if (ptrs[j] != NULL)
{
for (size_t k = 0; k < MEM_POOL_CHUNK_SIZE; k++)
for (size_t k = 0; k < JMEM_POOL_CHUNK_SIZE; k++)
{
ptrs[j][k] = (uint8_t) (rand () % 256);
}
memcpy (data[j], ptrs[j], MEM_POOL_CHUNK_SIZE);
memcpy (data[j], ptrs[j], JMEM_POOL_CHUNK_SIZE);
}
}
// mem_heap_print (false);
/* jmem_heap_print (false); */
for (size_t j = 0; j < subiters; j++)
{
if (rand () % 256 == 0)
{
mem_pools_collect_empty ();
jmem_pools_collect_empty ();
}
if (ptrs[j] != NULL)
{
JERRY_ASSERT (!memcmp (data[j], ptrs[j], MEM_POOL_CHUNK_SIZE));
JERRY_ASSERT (!memcmp (data[j], ptrs[j], JMEM_POOL_CHUNK_SIZE));
mem_pools_free (ptrs[j]);
jmem_pools_free (ptrs[j]);
}
}
}
#ifdef MEM_STATS
mem_pools_stats_print ();
#endif /* MEM_STATS */
#ifdef JMEM_STATS
jmem_pools_stats_print ();
#endif /* JMEM_STATS */
mem_finalize (false);
jmem_finalize (false);
return 0;
} /* main */
+2 -2
View File
@@ -107,7 +107,7 @@ main (int __attr_unused___ argc,
{
TEST_INIT ();
mem_init ();
jmem_init ();
lit_init ();
ecma_init ();
@@ -221,7 +221,7 @@ main (int __attr_unused___ argc,
ecma_finalize ();
lit_finalize ();
mem_finalize (true);
jmem_finalize (true);
return 0;
} /* main */