mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
- 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
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
/* Copyright JS Foundation and other contributors, http://js.foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include "jcontext.h"
|
|
|
|
/** \addtogroup context Context
|
|
* @{
|
|
*/
|
|
|
|
#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.
|
|
*/
|
|
#ifndef JERRY_HEAP_SECTION_ATTR
|
|
#define JERRY_GLOBAL_HEAP_SECTION
|
|
#else /* JERRY_HEAP_SECTION_ATTR */
|
|
#define JERRY_GLOBAL_HEAP_SECTION JERRY_ATTR_SECTION (JERRY_HEAP_SECTION_ATTR)
|
|
#endif /* !JERRY_HEAP_SECTION_ATTR */
|
|
|
|
/**
|
|
* 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 */
|
|
|
|
/**
|
|
* @}
|
|
*/
|