Follow-up refactoring of logging-related parts
This patch: * Ensures that all calls to `jerry_port_log` in jerry-core happen via macros defined in jrt.h. Also, it unifies the names of those macros: as `JERRY_ERROR_MSG` and `JERRY_WARNING_MSG` gave a good pattern that was well aligned with the naming scheme of the log level enum, `JERRY_DLOG` and `JERRY_DDLOG` were rewritten to `JERRY_DEBUG_MSG` and `JERRY_TRACE_MSG`. * Ensures that all debug logging code parts of jerry-core (i.e., memory statistics, JS byte-code dumps, and RegExp byte-code dumps) are guarded by macros: `JMEM_STATS`, `PARSER_DUMP_BYTE_CODE`, and `REGEXP_DUMP_BYTE_CODE`, which in turn are controled by cmake build system feature flags `FEATURE_MEM_STATS`, `FEATURE_PARSER_DUMP`, and `FEATURE_REGEXP_DUMP`. * Ensures that all debug logging functionalities can be controled during run time (provided that they were enabled during build time): the engine has `JERRY_INIT_MEM_STATS[_SEPARATE]`, `JERRY_INIT_SHOW_OPCODES`, `JERRY_INIT_SHOW_REGEXP_OPCODES` init flags, and the default unix/linux command line app has corresponding command line switches.` * Drops `FEATURE_LOG`, `JERRY_ENABLE_LOG`, and `JERRY_INIT_ENABLE_LOG`, as their name was misleadingly general, even though they mostly controled the regexp engine only. The above-mentioned `*REGEXP*` things mostly act as their replacements. * Updates build, test, and measurement tool scripts, and documentation. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+22
-15
@@ -143,27 +143,36 @@ jerry_init (jerry_init_flag_t flags) /**< combination of Jerry flags */
|
||||
/* Zero out all members. */
|
||||
memset (&JERRY_CONTEXT (JERRY_CONTEXT_FIRST_MEMBER), 0, sizeof (jerry_context_t));
|
||||
|
||||
if (flags & (JERRY_INIT_ENABLE_LOG))
|
||||
{
|
||||
#ifndef JERRY_ENABLE_LOG
|
||||
JERRY_WARNING_MSG ("Ignoring log options because of '!JERRY_ENABLE_LOG' build configuration.\n");
|
||||
#endif /* !JERRY_ENABLE_LOG */
|
||||
}
|
||||
|
||||
if (flags & (JERRY_INIT_MEM_STATS | JERRY_INIT_MEM_STATS_SEPARATE))
|
||||
{
|
||||
#ifndef JMEM_STATS
|
||||
flags &= (jerry_init_flag_t) ~(JERRY_INIT_MEM_STATS | JERRY_INIT_MEM_STATS_SEPARATE);
|
||||
|
||||
JERRY_WARNING_MSG ("Ignoring memory statistics option because of '!JMEM_STATS' build configuration.\n");
|
||||
JERRY_WARNING_MSG ("Ignoring JERRY_INIT_MEM_STATS flag because of !JMEM_STATS configuration.\n");
|
||||
#else /* JMEM_STATS */
|
||||
if (flags & JERRY_INIT_MEM_STATS_SEPARATE)
|
||||
{
|
||||
flags |= JERRY_INIT_MEM_STATS;
|
||||
}
|
||||
flags |= JERRY_INIT_MEM_STATS;
|
||||
#endif /* !JMEM_STATS */
|
||||
}
|
||||
|
||||
if (flags & JERRY_INIT_SHOW_OPCODES)
|
||||
{
|
||||
#ifndef PARSER_DUMP_BYTE_CODE
|
||||
flags &= (jerry_init_flag_t) ~JERRY_INIT_SHOW_OPCODES;
|
||||
|
||||
JERRY_WARNING_MSG ("Ignoring JERRY_INIT_SHOW_OPCODES flag because of !PARSER_DUMP_BYTE_CODE configuration.\n");
|
||||
#endif /* !PARSER_DUMP_BYTE_CODE */
|
||||
}
|
||||
|
||||
if (flags & JERRY_INIT_SHOW_REGEXP_OPCODES)
|
||||
{
|
||||
#ifndef REGEXP_DUMP_BYTE_CODE
|
||||
flags &= (jerry_init_flag_t) ~JERRY_INIT_SHOW_REGEXP_OPCODES;
|
||||
|
||||
JERRY_WARNING_MSG ("Ignoring JERRY_INIT_SHOW_REGEXP_OPCODES flag "
|
||||
"because of !REGEXP_DUMP_BYTE_CODE configuration.\n");
|
||||
#endif /* !REGEXP_DUMP_BYTE_CODE */
|
||||
}
|
||||
|
||||
JERRY_CONTEXT (jerry_init_flags) = flags;
|
||||
|
||||
jerry_make_api_available ();
|
||||
@@ -182,7 +191,7 @@ jerry_cleanup (void)
|
||||
|
||||
jerry_make_api_unavailable ();
|
||||
ecma_finalize ();
|
||||
jmem_finalize ((JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_MEM_STATS) != 0);
|
||||
jmem_finalize ();
|
||||
} /* jerry_cleanup */
|
||||
|
||||
/**
|
||||
@@ -271,8 +280,6 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
parser_set_show_instrs ((JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_SHOW_OPCODES));
|
||||
|
||||
ecma_compiled_code_t *bytecode_data_p;
|
||||
ecma_value_t parse_status;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user