Move all remaining globals to the global context.

Zero out all globals (and remove unnecessary init() functions).
Move snapshot globals to a temporary stack variable.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-08-01 04:25:32 -07:00
parent b14ca4e248
commit d1b0b58729
18 changed files with 200 additions and 290 deletions
+30 -2
View File
@@ -20,10 +20,12 @@
#ifndef JCONTEXT_H
#define JCONTEXT_H
#include "jrt.h"
#include "ecma-globals.h"
#include "ecma-builtins.h"
#include "jmem-allocator.h"
#include "jmem-config.h"
#include "jrt.h"
#include "re-bytecode.h"
#include "vm-defines.h"
/** \addtogroup context Jerry context
* @{
@@ -32,6 +34,11 @@
* @{
*/
/**
* First member of the jerry context
*/
#define JERRY_CONTEXT_FIRST_MEMBER jmem_heap_allocated_size
/**
* JerryScript context
*
@@ -60,17 +67,38 @@ typedef struct
* allocator request is in progress */
#endif /* JERRY_VALGRIND_FREYA */
/**
* Literal part.
*/
const lit_utf8_byte_t **lit_magic_string_ex_array; /**< array of external magic strings */
uint32_t lit_magic_string_ex_count; /**< external magic strings count */
const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */
/**
* Ecma part.
*/
ecma_object_t *ecma_builtin_objects[ECMA_BUILTIN_ID__COUNT]; /**< pointer to instances of built-in objects */
ecma_object_t *ecma_gc_objects_lists[ECMA_GC_COLOR__COUNT]; /**< List of marked (visited during
* current GC session) and umarked objects */
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN
const re_compiled_code_t *re_cache[RE_CACHE_SIZE]; /**< regex cache */
uint8_t re_cache_idx; /**< evicted item index when regex cache is full (round-robin) */
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
bool ecma_gc_visited_flip_flag; /**< current state of an object's visited flag */
bool is_direct_eval_form_call; /**< direct call from eval */
size_t ecma_gc_objects_number; /**< number of currently allocated objects */
size_t ecma_gc_new_objects; /**< number of newly allocated objects since last GC session */
ecma_lit_storage_item_t *string_list_first_p; /**< first item of the literal string list */
ecma_lit_storage_item_t *number_list_first_p; /**< first item of the literal number list */
ecma_object_t *ecma_global_lex_env_p; /**< global lexical environment */
vm_frame_ctx_t *vm_top_context_p; /**< top (current) interpreter context */
/**
* API part.
*/
jerry_init_flag_t jerry_init_flags; /**< run-time configuration flags */
bool jerry_api_available; /**< API availability flag */
} jerry_context_t;
/**