|
23 | 23 | #include "ecma-builtins.h"
|
24 | 24 | #include "jmem-allocator.h"
|
25 | 25 | #include "jmem-config.h"
|
26 |
| -#include "jrt.h" |
27 | 26 | #include "re-bytecode.h"
|
28 | 27 | #include "vm-defines.h"
|
29 | 28 |
|
|
37 | 36 | /**
|
38 | 37 | * First member of the jerry context
|
39 | 38 | */
|
40 |
| -#define JERRY_CONTEXT_FIRST_MEMBER jmem_heap_allocated_size |
| 39 | +#define JERRY_CONTEXT_FIRST_MEMBER ecma_builtin_objects |
41 | 40 |
|
42 | 41 | /**
|
43 | 42 | * JerryScript context
|
|
47 | 46 | */
|
48 | 47 | typedef struct
|
49 | 48 | {
|
50 |
| - /** |
51 |
| - * Memory manager part. |
52 |
| - */ |
53 |
| - size_t jmem_heap_allocated_size; /**< size of allocated regions */ |
54 |
| - size_t jmem_heap_limit; /**< current limit of heap usage, that is upon being reached, |
55 |
| - * causes call of "try give memory back" callbacks */ |
| 49 | + /* Update JERRY_CONTEXT_FIRST_MEMBER if the first member changes */ |
| 50 | + ecma_object_t *ecma_builtin_objects[ECMA_BUILTIN_ID__COUNT]; /**< pointer to instances of built-in objects */ |
| 51 | +#ifndef CONFIG_DISABLE_REGEXP_BUILTIN |
| 52 | + const re_compiled_code_t *re_cache[RE_CACHE_SIZE]; /**< regex cache */ |
| 53 | +#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */ |
| 54 | + ecma_object_t *ecma_gc_objects_lists[ECMA_GC_COLOR__COUNT]; /**< List of marked (visited during |
| 55 | + * current GC session) and umarked objects */ |
56 | 56 | jmem_heap_free_t *jmem_heap_list_skip_p; /**< This is used to speed up deallocation. */
|
57 | 57 | jmem_pools_chunk_t *jmem_free_chunk_p; /**< list of free pool chunks */
|
58 | 58 | jmem_free_unused_memory_callback_t jmem_free_unused_memory_callback; /**< Callback for freeing up memory. */
|
59 |
| - |
60 |
| -#ifdef JMEM_STATS |
61 |
| - jmem_heap_stats_t jmem_heap_stats; /**< heap's memory usage statistics */ |
62 |
| - jmem_pools_stats_t jmem_pools_stats; /**< pools' memory usage statistics */ |
63 |
| -#endif /* MEM_STATS */ |
64 |
| - |
65 |
| -#ifdef JERRY_VALGRIND_FREYA |
66 |
| - bool valgrind_freya_mempool_request; /**< Tells whether a pool manager |
67 |
| - * allocator request is in progress */ |
68 |
| -#endif /* JERRY_VALGRIND_FREYA */ |
69 |
| - |
70 |
| - /** |
71 |
| - * Literal part. |
72 |
| - */ |
73 | 59 | const lit_utf8_byte_t **lit_magic_string_ex_array; /**< array of external magic strings */
|
74 |
| - uint32_t lit_magic_string_ex_count; /**< external magic strings count */ |
75 | 60 | const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */
|
76 |
| - |
77 |
| - /** |
78 |
| - * Ecma part. |
79 |
| - */ |
80 |
| - ecma_object_t *ecma_builtin_objects[ECMA_BUILTIN_ID__COUNT]; /**< pointer to instances of built-in objects */ |
81 |
| - ecma_object_t *ecma_gc_objects_lists[ECMA_GC_COLOR__COUNT]; /**< List of marked (visited during |
82 |
| - * current GC session) and umarked objects */ |
83 |
| -#ifndef CONFIG_DISABLE_REGEXP_BUILTIN |
84 |
| - const re_compiled_code_t *re_cache[RE_CACHE_SIZE]; /**< regex cache */ |
85 |
| - uint8_t re_cache_idx; /**< evicted item index when regex cache is full (round-robin) */ |
86 |
| -#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */ |
87 |
| - |
88 |
| - bool ecma_gc_visited_flip_flag; /**< current state of an object's visited flag */ |
89 |
| - bool is_direct_eval_form_call; /**< direct call from eval */ |
90 |
| - size_t ecma_gc_objects_number; /**< number of currently allocated objects */ |
91 |
| - size_t ecma_gc_new_objects; /**< number of newly allocated objects since last GC session */ |
92 | 61 | ecma_lit_storage_item_t *string_list_first_p; /**< first item of the literal string list */
|
93 | 62 | ecma_lit_storage_item_t *number_list_first_p; /**< first item of the literal number list */
|
94 | 63 | ecma_object_t *ecma_global_lex_env_p; /**< global lexical environment */
|
95 | 64 | vm_frame_ctx_t *vm_top_context_p; /**< top (current) interpreter context */
|
| 65 | + size_t ecma_gc_objects_number; /**< number of currently allocated objects */ |
| 66 | + size_t ecma_gc_new_objects; /**< number of newly allocated objects since last GC session */ |
| 67 | + size_t jmem_heap_allocated_size; /**< size of allocated regions */ |
| 68 | + size_t jmem_heap_limit; /**< current limit of heap usage, that is upon being reached, |
| 69 | + * causes call of "try give memory back" callbacks */ |
| 70 | + uint32_t lit_magic_string_ex_count; /**< external magic strings count */ |
| 71 | + uint32_t jerry_init_flags; /**< run-time configuration flags */ |
| 72 | + uint8_t ecma_gc_visited_flip_flag; /**< current state of an object's visited flag */ |
| 73 | + uint8_t is_direct_eval_form_call; /**< direct call from eval */ |
| 74 | + uint8_t jerry_api_available; /**< API availability flag */ |
| 75 | +#ifndef CONFIG_DISABLE_REGEXP_BUILTIN |
| 76 | + uint8_t re_cache_idx; /**< evicted item index when regex cache is full (round-robin) */ |
| 77 | +#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */ |
96 | 78 |
|
97 |
| - /** |
98 |
| - * API part. |
99 |
| - */ |
100 |
| - jerry_init_flag_t jerry_init_flags; /**< run-time configuration flags */ |
101 |
| - bool jerry_api_available; /**< API availability flag */ |
| 79 | +#ifdef JMEM_STATS |
| 80 | + jmem_heap_stats_t jmem_heap_stats; /**< heap's memory usage statistics */ |
| 81 | + jmem_pools_stats_t jmem_pools_stats; /**< pools' memory usage statistics */ |
| 82 | +#endif /* JMEM_STATS */ |
| 83 | + |
| 84 | +#ifdef JERRY_VALGRIND_FREYA |
| 85 | + uint8_t valgrind_freya_mempool_request; /**< Tells whether a pool manager |
| 86 | + * allocator request is in progress */ |
| 87 | +#endif /* JERRY_VALGRIND_FREYA */ |
102 | 88 | } jerry_context_t;
|
103 | 89 |
|
104 | 90 | /**
|
|
0 commit comments