Skip to content

Revisit unused global functions in jerry-core #2450

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

Merged
merged 1 commit into from
Aug 8, 2018

Conversation

akosthekiss
Copy link
Member

There are some leftover global functions in the code that are not
referenced at all anymore. These functions are removed by this
patch.

There are also some global functions that are only used in their
own modules. These functions are made static by this patch.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]

@akosthekiss
Copy link
Member Author

akosthekiss commented Aug 7, 2018

Unused global functions (removed):

  • ecma_alloc_getter_setter_pointers
  • ecma_dealloc_getter_setter_pointers
  • ecma_raise_eval_error
  • lit_char_is_format_control

Global functions unused outside their modules (made static):

  • ecma_builtin_helper_json_create_separated_properties
  • ecma_new_ecma_string_from_magic_string_ex_id
  • ecma_number_get_fraction_and_exponent
  • ecma_number_make_normal_positive_from_fraction_and_exponent
  • ecma_op_object_get_property
  • ecma_promise_get_result
  • ecma_promise_get_state
  • ecma_promise_set_result
  • ecma_promise_set_state
  • ecma_raise_standard_error
  • jmem_stats_print
  • lit_get_magic_string_size_block_start
  • parser_send_breakpoints

For future reference, code used to find these functions:

tools/build.py --clean --debug --profile=es2015-subset --error-messages=on --snapshot-exec=on --snapshot-save=on --line-info=on --jerry-debugger=on --mem-stats=on --show-opcodes=on --show-regexp-opcodes=on
cd build/lib
nm libjerry-core.a | grep ' U ' | cut -d 'U' -f 2 | cut -d ' ' -f 2 | sort -u >core-referenced.txt
nm libjerry-core.a | grep ' T ' | cut -d 'T' -f 2 | cut -d ' ' -f 2 | sort -u >core-globals.txt 
comm -23 core-globals.txt core-referenced.txt | grep -v jerry_

Copy link
Member

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zherczeg
Copy link
Member

zherczeg commented Aug 8, 2018

Still LGTM just squash commits.

There are some leftover global functions in the code that are not
referenced at all anymore. These functions are removed by this
patch.

There are also some global functions that are only used in their
own modules. These functions are made static by this patch.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
@akosthekiss
Copy link
Member Author

Commits squashed. (I've also edited my comment above listing the touched functions and the commands used to find them.)

Copy link
Contributor

@yichoi yichoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yichoi yichoi merged commit 58c568a into jerryscript-project:master Aug 8, 2018
@akosthekiss akosthekiss deleted the unused-globals branch August 8, 2018 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants