Rework usages/naming of configuration macros [part 2] (#2903)

There are quite a few configuration macros in the project.
As discussed in the #2520 issue there are a few awkward constructs.

Main changes:

* The following macros are now 0/1 switches:
** Renamed CONFIG_ECMA_LCACHE_DISABLE to JERRY_LCACHE.
** Renamed CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE to JERRY_PROPERTY_HASHMAP.
** Renamed CONFIG_DISABLE_UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION.
** Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE.
** Renamed JERRY_DISABLE_JS_PARSER to JERRY_PARSER.
** Renamed JERRY_ENABLE_ERROR_MESSAGES to JERRY_ERROR_MESSAGES.
** Renamed JERRY_ENABLE_EXTERNAL_CONTEXT to JERRY_EXTERNAL_CONTEXT.
** Renamed JERRY_ENABLE_LINE_INFO to JERRY_LINE_INFO.
** Renamed JERRY_ENABLE_LOGGING to JERRY_LOGGING.
** Renamed JERRY_ENABLE_SNAPSHOT_EXEC to JERRY_SNAPSHOT_EXEC.
** Renamed JERRY_ENABLE_SNAPSHOT_SAVE to JERRY_SNAPSHOT_SAVE.
** Renamed JERRY_SYSTEM_ALLOCATOR to JERRY_SYSTEM_ALLOCATOR.
** Renamed JERRY_VM_EXEC_STOP to JERRY_VM_EXEC_STOP.
** Renamed JMEM_GC_BEFORE_EACH_ALLOC to JERRY_MEM_GC_BEFORE_EACH_ALLOC.
** Renamed JMEM_STATS to JERRY_MEM_STATS.
** Renamed PARSER_DUMP_BYTE_CODE to JERRY_PARSER_DUMP_BYTE_CODE.
** Renamed REGEXP_DUMP_BYTE_CODE to JERRY_REGEXP_DUMP_BYTE_CODE.
* Recursion check changes:
** Renamed REGEXP_RECURSION_LIMIT to JERRY_REGEXP_RECURSION_LIMIT.
** Renamed VM_RECURSION_LIMIT to JERRY_VM_RECURSION_LIMIT.
* Attribute macro changes:
** Renamed JERRY_CONST_DATA to JERRY_ATTR_CONST_DATA.
** Renamed JERRY_HEAP_SECTION_ATTR to JERRY_ATTR_GLOBAL_HEAP.
  Now the macro can specify any attribute for the global heap object.
* Other macro changes:
** Renamed CONFIG_MEM_HEAP_AREA_SIZE to JERRY_GLOBAL_HEAP_SIZE.
   Then new macro now specify the global heap size in kilobytes.
* Updated documentations to reflect the new macro names.

For more deatils please see jerry-core/config.h.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Péter Gál
2019-06-19 12:28:21 +02:00
committed by Dániel Bátyai
parent 985de93d04
commit 01ecc7bb7b
77 changed files with 1154 additions and 795 deletions
+5 -5
View File
@@ -79,7 +79,7 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
size_t code_buffer_size, /**< size of the buffer */
uint32_t parse_opts) /**< ecma_parse_opts_t option bits */
{
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
JERRY_ASSERT (code_p != NULL);
ecma_compiled_code_t *bytecode_data_p;
@@ -91,9 +91,9 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
parse_opts &= (uint32_t) ~ECMA_PARSE_STRICT_MODE;
}
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
JERRY_CONTEXT (resource_name) = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
#if ENABLED (JERRY_ES2015_CLASS)
ECMA_CLEAR_SUPER_EVAL_PARSER_OPTS ();
@@ -112,13 +112,13 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
}
return vm_run_eval (bytecode_data_p, parse_opts);
#else /* JERRY_DISABLE_JS_PARSER */
#else /* !ENABLED (JERRY_PARSER) */
JERRY_UNUSED (code_p);
JERRY_UNUSED (code_buffer_size);
JERRY_UNUSED (parse_opts);
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */
} /* ecma_op_eval_chars_buffer */
/**
+6 -6
View File
@@ -25,9 +25,9 @@
#include "jcontext.h"
#include "jrt.h"
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
#include "vm.h"
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
/** \addtogroup ecma ECMA
* @{
@@ -140,7 +140,7 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
((ecma_extended_object_t *) new_error_obj_p)->u.class_prop.class_id = LIT_MAGIC_STRING_ERROR_UL;
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
/* The "stack" identifier is not a magic string. */
const char * const stack_id_p = "stack";
@@ -156,7 +156,7 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
prop_value_p->value = backtrace_value;
ecma_deref_object (ecma_get_object_from_value (backtrace_value));
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
return new_error_obj_p;
} /* ecma_new_standard_error */
@@ -240,7 +240,7 @@ ecma_raise_standard_error (ecma_standard_error_t error_type, /**< error type */
return ECMA_VALUE_ERROR;
} /* ecma_raise_standard_error */
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
/**
* Raise a standard ecma-error with the given format string and arguments.
@@ -335,7 +335,7 @@ ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, /**< er
return ECMA_VALUE_ERROR;
} /* ecma_raise_standard_error_with_format */
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
/**
* Raise a common error with the given message.
+5 -5
View File
@@ -26,11 +26,11 @@
* @{
*/
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
#define ECMA_ERR_MSG(msg) msg
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
#define ECMA_ERR_MSG(msg) NULL
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
/**
* Native errors.
@@ -53,9 +53,9 @@ typedef enum
ecma_standard_error_t ecma_get_error_type (ecma_object_t *error_object);
ecma_object_t *ecma_new_standard_error (ecma_standard_error_t error_type);
ecma_object_t *ecma_new_standard_error_with_message (ecma_standard_error_t error_type, ecma_string_t *message_string_p);
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
ecma_value_t ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, const char *msg_p, ...);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
ecma_value_t ecma_raise_common_error (const char *msg_p);
ecma_value_t ecma_raise_range_error (const char *msg_p);
ecma_value_t ecma_raise_reference_error (const char *msg_p);
@@ -128,12 +128,12 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
size_t function_object_size = sizeof (ecma_extended_object_t);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
function_object_size = sizeof (ecma_static_function_t);
}
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
function_object_size,
@@ -160,7 +160,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
/* 10., 11., 12. */
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p);
@@ -171,10 +171,10 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
ext_func_p->u.function.bytecode_cp = ECMA_NULL_POINTER;
((ecma_static_function_t *) func_p)->bytecode_p = bytecode_data_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
/* 14., 15., 16., 17., 18. */
/*
@@ -204,12 +204,12 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
size_t arrow_function_object_size = sizeof (ecma_arrow_function_t);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
arrow_function_object_size = sizeof (ecma_static_arrow_function_t);
}
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
arrow_function_object_size,
@@ -219,7 +219,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
ECMA_SET_NON_NULL_POINTER (arrow_func_p->scope_cp, scope_p);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
ECMA_SET_NON_NULL_POINTER (arrow_func_p->bytecode_cp, bytecode_data_p);
@@ -230,10 +230,10 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
arrow_func_p->bytecode_cp = ECMA_NULL_POINTER;
((ecma_static_arrow_function_t *) func_p)->bytecode_p = bytecode_data_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
ECMA_SET_NON_NULL_POINTER (arrow_func_p->bytecode_cp, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
arrow_func_p->this_binding = ecma_copy_value_if_not_object (this_binding);
return func_p;
@@ -280,7 +280,7 @@ ecma_op_create_external_function_object (ecma_external_handler_t handler_cb) /**
inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE
ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< function pointer */
{
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (function_p->u.function.bytecode_cp != ECMA_NULL_POINTER)
{
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
@@ -290,10 +290,10 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun
{
return ((ecma_static_function_t *) function_p)->bytecode_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
function_p->u.function.bytecode_cp);
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
} /* ecma_op_function_get_compiled_code */
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
@@ -306,7 +306,7 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun
inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE
ecma_op_arrow_function_get_compiled_code (ecma_arrow_function_t *arrow_function_p) /**< arrow function pointer */
{
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (arrow_function_p->bytecode_cp != ECMA_NULL_POINTER)
{
return ECMA_GET_NON_NULL_POINTER (const ecma_compiled_code_t,
@@ -316,10 +316,10 @@ ecma_op_arrow_function_get_compiled_code (ecma_arrow_function_t *arrow_function_
{
return ((ecma_static_arrow_function_t *) arrow_function_p)->bytecode_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
return ECMA_GET_NON_NULL_POINTER (const ecma_compiled_code_t,
arrow_function_p->bytecode_cp);
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
} /* ecma_op_arrow_function_get_compiled_code */
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
@@ -93,13 +93,13 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
}
*ref_base_lex_env_p = NULL;
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
return ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
ecma_make_string_value (name_p));
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* ENABLED (JERRY_ERROR_MESSAGES) */
return ecma_raise_reference_error (NULL);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
} /* ecma_op_get_value_lex_env_base */
@@ -250,13 +250,13 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
if (is_strict)
{
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
return ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
ecma_make_string_value (name_p));
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
return ecma_raise_reference_error (NULL);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
}
ecma_value_t completion = ecma_op_object_put (ecma_builtin_get_global (),
@@ -475,26 +475,26 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
JERRY_ASSERT (current_property_type == ECMA_PROPERTY_TYPE_NAMEDDATA);
ecma_free_value_if_not_object (value_p->value);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
getter_setter_pair_p->getter_p = JMEM_CP_NULL;
getter_setter_pair_p->setter_p = JMEM_CP_NULL;
ECMA_SET_POINTER (value_p->getter_setter_pair_cp, getter_setter_pair_p);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
value_p->getter_setter_pair.getter_p = JMEM_CP_NULL;
value_p->getter_setter_pair.setter_p = JMEM_CP_NULL;
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
}
else
{
JERRY_ASSERT (current_property_type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_POINTER (ecma_getter_setter_pointers_t,
value_p->getter_setter_pair_cp);
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
value_p->value = ECMA_VALUE_UNDEFINED;
}
+5 -5
View File
@@ -118,7 +118,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
{
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
ecma_property_t *property_p = ecma_lcache_lookup (binding_obj_p, name_p);
if (property_p != NULL)
@@ -142,7 +142,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
ecma_value_t base_value = ecma_make_object_value (binding_obj_p);
return ecma_op_function_call (getter_p, base_value, NULL, 0);
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
ecma_value_t prop_value = ecma_op_object_find (binding_obj_p, name_p);
@@ -163,14 +163,14 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
lex_env_p = ecma_get_lex_env_outer_reference (lex_env_p);
}
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
ecma_value_t name_val = ecma_make_string_value (name_p);
ecma_value_t error_value = ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
name_val);
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* ENABLED (JERRY_ERROR_MESSAGES) */
ecma_value_t error_value = ecma_raise_reference_error (NULL);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* !ENABLED (JERRY_ERROR_MESSAGES) */
return error_value;
} /* ecma_op_resolve_reference_value */
@@ -66,9 +66,9 @@
/*
* Check RegExp recursion depth limit
*/
#ifdef REGEXP_RECURSION_LIMIT
JERRY_STATIC_ASSERT (REGEXP_RECURSION_LIMIT > 0, regexp_recursion_limit_must_be_greater_than_zero);
#endif /* REGEXP_RECURSION_LIMIT */
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
JERRY_STATIC_ASSERT (JERRY_REGEXP_RECURSION_LIMIT > 0, regexp_recursion_limit_must_be_greater_than_zero);
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT) != 0) */
/**
* Parse RegExp flags (global, ignoreCase, multiline)
@@ -28,7 +28,7 @@
* @{
*/
#ifdef REGEXP_RECURSION_LIMIT
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
/**
* Decrease the recursion counter and test it.
* If the counter reaches the limit of the recursion depth
@@ -50,8 +50,8 @@
/**
* Set the recursion counter to the max depth of the recursion.
*/
#define REGEXP_RECURSION_COUNTER_INIT() (re_ctx.recursion_counter = REGEXP_RECURSION_LIMIT)
#else /* !REGEXP_RECURSION_LIMIT */
#define REGEXP_RECURSION_COUNTER_INIT() (re_ctx.recursion_counter = JERRY_REGEXP_RECURSION_LIMIT)
#else /* !(defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)) */
/**
* Decrease the recursion counter and test it.
* If the counter reaches the limit of the recursion depth
@@ -66,7 +66,7 @@
* Set the recursion counter to the max depth of the recursion.
*/
#define REGEXP_RECURSION_COUNTER_INIT()
#endif /* REGEXP_RECURSION_LIMIT */
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0) */
/**
* RegExp flags
@@ -88,9 +88,9 @@ typedef struct
const lit_utf8_byte_t **saved_p; /**< saved result string pointers, ECMA 262 v5, 15.10.2.1, State */
const lit_utf8_byte_t *input_start_p; /**< start of input pattern string */
const lit_utf8_byte_t *input_end_p; /**< end of input pattern string */
#ifdef REGEXP_RECURSION_LIMIT
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
uint32_t recursion_counter; /**< RegExp recursion counter */
#endif /* REGEXP_RECURSION_LIMIT */
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0) */
uint32_t num_of_captures; /**< number of capture groups */
uint32_t num_of_non_captures; /**< number of non-capture groups */
uint32_t *num_of_iterations_p; /**< number of iterations */