Reorganize heap context related elements (#2500)

- Moved global context's `JMEM_HEAP_SIZE` to jcontext.h as external
  context's heap size is declared there, too.
- Moved the assert on `jmem_heap_t` vs `JMEM_HEAP_SIZE` to jcontext.c,
  as both entities are declared in the corresponding header.
- Removed superfluous checks on `JMEM_HEAP_SIZE` as it is not a
  publicly configurable macro (opposed to `CONFIG_MEM_HEAP_AREA_SIZE`).
- Ensured that all definitions of and references to `jmem_heap_t`,
  `JERRY_HEAP_CONTEXT`, `JERRY_HEAP_SIZE`, and `JERRY_HEAP_AREA_SIZE`
  are guarded by `#ifndef JERRY_SYSTEM_ALLOCATOR`, as they are
  meaningless if the system allocator is used.

The commit also contains some stylistic changes in jcontext.h

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2018-08-31 14:58:11 +02:00
committed by GitHub
parent 6049c0378d
commit c3b6bfe8b6
4 changed files with 61 additions and 71 deletions
+10 -1
View File
@@ -20,11 +20,20 @@
*/
#ifndef JERRY_ENABLE_EXTERNAL_CONTEXT
/**
* Global context.
*/
jerry_context_t jerry_global_context;
#ifndef JERRY_SYSTEM_ALLOCATOR
/**
* Check size of heap is corresponding to configuration
*/
JERRY_STATIC_ASSERT (sizeof (jmem_heap_t) <= JMEM_HEAP_SIZE,
size_of_mem_heap_must_be_less_than_or_equal_to_JMEM_HEAP_SIZE);
/**
* Jerry global heap section attribute.
*/
@@ -34,11 +43,11 @@ jerry_context_t jerry_global_context;
#define JERRY_GLOBAL_HEAP_SECTION JERRY_ATTR_SECTION (JERRY_HEAP_SECTION_ATTR)
#endif /* !JERRY_HEAP_SECTION_ATTR */
#ifndef JERRY_SYSTEM_ALLOCATOR
/**
* Global heap.
*/
jmem_heap_t jerry_global_heap JERRY_ATTR_ALIGNED (JMEM_ALIGNMENT) JERRY_GLOBAL_HEAP_SECTION;
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !JERRY_ENABLE_EXTERNAL_CONTEXT */