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:
Akos Kiss
2016-08-05 21:46:41 +02:00
parent 1b996a9a56
commit a2d5acb43c
30 changed files with 333 additions and 362 deletions
+68 -68
View File
@@ -232,7 +232,7 @@ re_insert_u32 (re_bytecode_ctx_t *bc_ctx_p, /**< RegExp bytecode context */
re_bytecode_list_insert (bc_ctx_p, offset, (uint8_t *) &value, sizeof (uint32_t));
} /* re_insert_u32 */
#ifdef JERRY_ENABLE_LOG
#ifdef REGEXP_DUMP_BYTE_CODE
/**
* RegExp bytecode dumper
*/
@@ -240,9 +240,9 @@ void
re_dump_bytecode (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
{
re_compiled_code_t *compiled_code_p = (re_compiled_code_t *) bc_ctx_p->block_start_p;
JERRY_DLOG ("%d ", compiled_code_p->header.status_flags);
JERRY_DLOG ("%d ", compiled_code_p->num_of_captures);
JERRY_DLOG ("%d | ", compiled_code_p->num_of_non_captures);
JERRY_DEBUG_MSG ("%d ", compiled_code_p->header.status_flags);
JERRY_DEBUG_MSG ("%d ", compiled_code_p->num_of_captures);
JERRY_DEBUG_MSG ("%d | ", compiled_code_p->num_of_non_captures);
uint8_t *bytecode_p = (uint8_t *) (compiled_code_p + 1);
@@ -253,188 +253,188 @@ re_dump_bytecode (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
{
case RE_OP_MATCH:
{
JERRY_DLOG ("MATCH, ");
JERRY_DEBUG_MSG ("MATCH, ");
break;
}
case RE_OP_CHAR:
{
JERRY_DLOG ("CHAR ");
JERRY_DLOG ("%c, ", (char) re_get_char (&bytecode_p));
JERRY_DEBUG_MSG ("CHAR ");
JERRY_DEBUG_MSG ("%c, ", (char) re_get_char (&bytecode_p));
break;
}
case RE_OP_CAPTURE_NON_GREEDY_ZERO_GROUP_START:
{
JERRY_DLOG ("N");
JERRY_DEBUG_MSG ("N");
/* FALLTHRU */
}
case RE_OP_CAPTURE_GREEDY_ZERO_GROUP_START:
{
JERRY_DLOG ("GZ_START ");
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("GZ_START ");
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_CAPTURE_GROUP_START:
{
JERRY_DLOG ("START ");
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("START ");
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_CAPTURE_NON_GREEDY_GROUP_END:
{
JERRY_DLOG ("N");
JERRY_DEBUG_MSG ("N");
/* FALLTHRU */
}
case RE_OP_CAPTURE_GREEDY_GROUP_END:
{
JERRY_DLOG ("G_END ");
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("G_END ");
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_NON_CAPTURE_NON_GREEDY_ZERO_GROUP_START:
{
JERRY_DLOG ("N");
JERRY_DEBUG_MSG ("N");
/* FALLTHRU */
}
case RE_OP_NON_CAPTURE_GREEDY_ZERO_GROUP_START:
{
JERRY_DLOG ("GZ_NC_START ");
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("GZ_NC_START ");
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_NON_CAPTURE_GROUP_START:
{
JERRY_DLOG ("NC_START ");
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("NC_START ");
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_NON_CAPTURE_NON_GREEDY_GROUP_END:
{
JERRY_DLOG ("N");
JERRY_DEBUG_MSG ("N");
/* FALLTHRU */
}
case RE_OP_NON_CAPTURE_GREEDY_GROUP_END:
{
JERRY_DLOG ("G_NC_END ");
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("G_NC_END ");
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_SAVE_AT_START:
{
JERRY_DLOG ("RE_START ");
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("RE_START ");
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_SAVE_AND_MATCH:
{
JERRY_DLOG ("RE_END, ");
JERRY_DEBUG_MSG ("RE_END, ");
break;
}
case RE_OP_GREEDY_ITERATOR:
{
JERRY_DLOG ("GREEDY_ITERATOR ");
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("GREEDY_ITERATOR ");
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_NON_GREEDY_ITERATOR:
{
JERRY_DLOG ("NON_GREEDY_ITERATOR ");
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("NON_GREEDY_ITERATOR ");
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_PERIOD:
{
JERRY_DLOG ("PERIOD ");
JERRY_DEBUG_MSG ("PERIOD ");
break;
}
case RE_OP_ALTERNATIVE:
{
JERRY_DLOG ("ALTERNATIVE ");
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("ALTERNATIVE ");
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_ASSERT_START:
{
JERRY_DLOG ("ASSERT_START ");
JERRY_DEBUG_MSG ("ASSERT_START ");
break;
}
case RE_OP_ASSERT_END:
{
JERRY_DLOG ("ASSERT_END ");
JERRY_DEBUG_MSG ("ASSERT_END ");
break;
}
case RE_OP_ASSERT_WORD_BOUNDARY:
{
JERRY_DLOG ("ASSERT_WORD_BOUNDARY ");
JERRY_DEBUG_MSG ("ASSERT_WORD_BOUNDARY ");
break;
}
case RE_OP_ASSERT_NOT_WORD_BOUNDARY:
{
JERRY_DLOG ("ASSERT_NOT_WORD_BOUNDARY ");
JERRY_DEBUG_MSG ("ASSERT_NOT_WORD_BOUNDARY ");
break;
}
case RE_OP_LOOKAHEAD_POS:
{
JERRY_DLOG ("LOOKAHEAD_POS ");
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("LOOKAHEAD_POS ");
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_LOOKAHEAD_NEG:
{
JERRY_DLOG ("LOOKAHEAD_NEG ");
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("LOOKAHEAD_NEG ");
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_BACKREFERENCE:
{
JERRY_DLOG ("BACKREFERENCE ");
JERRY_DLOG ("%d, ", re_get_value (&bytecode_p));
JERRY_DEBUG_MSG ("BACKREFERENCE ");
JERRY_DEBUG_MSG ("%d, ", re_get_value (&bytecode_p));
break;
}
case RE_OP_INV_CHAR_CLASS:
{
JERRY_DLOG ("INV_");
JERRY_DEBUG_MSG ("INV_");
/* FALLTHRU */
}
case RE_OP_CHAR_CLASS:
{
JERRY_DLOG ("CHAR_CLASS ");
JERRY_DEBUG_MSG ("CHAR_CLASS ");
uint32_t num_of_class = re_get_value (&bytecode_p);
JERRY_DLOG ("%d", num_of_class);
JERRY_DEBUG_MSG ("%d", num_of_class);
while (num_of_class)
{
JERRY_DLOG (" %d", re_get_char (&bytecode_p));
JERRY_DLOG ("-%d", re_get_char (&bytecode_p));
JERRY_DEBUG_MSG (" %d", re_get_char (&bytecode_p));
JERRY_DEBUG_MSG ("-%d", re_get_char (&bytecode_p));
num_of_class--;
}
JERRY_DLOG (", ");
JERRY_DEBUG_MSG (", ");
break;
}
default:
{
JERRY_DLOG ("UNKNOWN(%d), ", (uint32_t) op);
JERRY_DEBUG_MSG ("UNKNOWN(%d), ", (uint32_t) op);
break;
}
}
}
JERRY_DLOG ("EOF\n");
JERRY_DEBUG_MSG ("EOF\n");
} /* re_dump_bytecode */
#endif /* JERRY_ENABLE_LOG */
#endif /* REGEXP_DUMP_BYTE_CODE */
/**
* @}