Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for per-instruction memory statistics #954

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions jerry-core/jerry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1619,16 +1619,14 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
#endif /* !JERRY_ENABLE_LOG */
}

if (flags & (JERRY_FLAG_MEM_STATS | JERRY_FLAG_MEM_STATS_PER_OPCODE | JERRY_FLAG_MEM_STATS_SEPARATE))
if (flags & (JERRY_FLAG_MEM_STATS | JERRY_FLAG_MEM_STATS_SEPARATE))
{
#ifndef MEM_STATS
flags &= ~(JERRY_FLAG_MEM_STATS
| JERRY_FLAG_MEM_STATS_PER_OPCODE
| JERRY_FLAG_MEM_STATS_SEPARATE);
flags &= (jerry_flag_t) ~(JERRY_FLAG_MEM_STATS | JERRY_FLAG_MEM_STATS_SEPARATE);

JERRY_WARNING_MSG ("Ignoring memory statistics option because of '!MEM_STATS' build configuration.\n");
#else /* !MEM_STATS */
if (flags & (JERRY_FLAG_MEM_STATS_PER_OPCODE | JERRY_FLAG_MEM_STATS_SEPARATE))
if (flags & JERRY_FLAG_MEM_STATS_SEPARATE)
{
flags |= JERRY_FLAG_MEM_STATS;
}
Expand Down Expand Up @@ -1735,9 +1733,7 @@ jerry_parse (const jerry_api_char_t *source_p, /**< script source */
}
#endif /* MEM_STATS */

bool is_show_mem_stats_per_instruction = ((jerry_flags & JERRY_FLAG_MEM_STATS_PER_OPCODE) != 0);

vm_init (bytecode_data_p, is_show_mem_stats_per_instruction);
vm_init (bytecode_data_p);

return true;
} /* jerry_parse */
Expand Down Expand Up @@ -2370,7 +2366,7 @@ jerry_exec_snapshot (const void *snapshot_p, /**< snapshot */

if (header_p->is_run_global)
{
vm_init (bytecode_p, false);
vm_init (bytecode_p);

ecma_object_t *error_obj_p = NULL;

Expand Down
24 changes: 11 additions & 13 deletions jerry-core/jerry.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,20 @@ extern "C"
* @{
*/

#define JERRY_FLAG_EMPTY (0u) /**< empty flag set */
#define JERRY_FLAG_SHOW_OPCODES (1u << 0) /**< dump byte-code to stdout after parse */
#define JERRY_FLAG_MEM_STATS (1u << 1) /**< dump memory statistics */
#define JERRY_FLAG_MEM_STATS_PER_OPCODE (1u << 2) /**< dump per-instruction memory statistics during execution
* (in the mode full GC is performed after execution of each
* opcode handler) */
#define JERRY_FLAG_MEM_STATS_SEPARATE (1u << 3) /**< dump memory statistics and reset peak values after parse */
#define JERRY_FLAG_PARSE_ONLY (1u << 4) /**< parse only, prevents script execution (only for testing)
* FIXME: Remove. */
#define JERRY_FLAG_ENABLE_LOG (1u << 5) /**< enable logging */
#define JERRY_FLAG_ABORT_ON_FAIL (1u << 6) /**< abort instead of exit in case of failure */

/**
* Jerry flags
*/
typedef uint32_t jerry_flag_t;
typedef enum
{
JERRY_FLAG_EMPTY = (0u), /**< empty flag set */
JERRY_FLAG_SHOW_OPCODES = (1u << 0), /**< dump byte-code to stdout after parse */
JERRY_FLAG_MEM_STATS = (1u << 1), /**< dump memory statistics */
JERRY_FLAG_MEM_STATS_SEPARATE = (1u << 2), /**< dump memory statistics and reset peak values after parse */
JERRY_FLAG_PARSE_ONLY = (1u << 3), /**< parse only, prevents script execution (only for testing)
* FIXME: Remove. */
JERRY_FLAG_ENABLE_LOG = (1u << 4), /**< enable logging */
JERRY_FLAG_ABORT_ON_FAIL = (1u << 5), /**< abort instead of exit in case of failure */
} jerry_flag_t;

/**
* Error codes
Expand Down
5 changes: 1 addition & 4 deletions jerry-core/vm/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,8 @@ vm_op_set_value (ecma_value_t object, /**< base object */
* Initialize interpreter.
*/
void
vm_init (ecma_compiled_code_t *program_p, /**< pointer to byte-code data */
bool dump_mem_stats) /**< dump per-instruction memory usage change statistics */
vm_init (ecma_compiled_code_t *program_p) /**< pointer to byte-code data */
{
JERRY_ASSERT (!dump_mem_stats);

JERRY_ASSERT (__program == NULL);

__program = program_p;
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/vm/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ typedef enum
VM_EXEC_CONSTRUCT, /**< construct a new object */
} vm_call_operation;

extern void vm_init (ecma_compiled_code_t *, bool);
extern void vm_init (ecma_compiled_code_t *);
extern void vm_finalize (void);
extern jerry_completion_code_t vm_run_global (ecma_object_t **);
extern ecma_value_t vm_run_eval (ecma_compiled_code_t *, bool);
Expand Down
6 changes: 1 addition & 5 deletions main-unix.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -237,10 +237,6 @@ main (int argc,
{
flags |= JERRY_FLAG_MEM_STATS;
}
else if (!strcmp ("--mem-stats-per-opcode", argv[i]))
{
flags |= JERRY_FLAG_MEM_STATS_PER_OPCODE;
}
else if (!strcmp ("--mem-stats-separate", argv[i]))
{
flags |= JERRY_FLAG_MEM_STATS_SEPARATE;
Expand Down
4 changes: 0 additions & 4 deletions targets/nuttx-stm32f4/main-nuttx.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ int jerryscript_entry (int argc, char *argv[])
{
flags |= JERRY_FLAG_MEM_STATS;
}
else if (!strcmp ("--mem-stats-per-opcode", argv[i]))
{
flags |= JERRY_FLAG_MEM_STATS_PER_OPCODE;
}
else if (!strcmp ("--mem-stats-separate", argv[i]))
{
flags |= JERRY_FLAG_MEM_STATS_SEPARATE;
Expand Down