-
Notifications
You must be signed in to change notification settings - Fork 683
Turn some global variables static const
#892
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
Turn some global variables static const
#892
Conversation
@bzsolt, could you measure this patch with MEM_STATS builds on RPi2? @akiss77, I think we can find a few more from this. We should check it and extend this PR if we found more. |
LGTM |
{ | ||
(const uint8_t *) "get", 3, LEXER_IDENT_LITERAL, PARSER_FALSE | ||
}; | ||
|
||
static lexer_lit_location_t lexer_set_literal = | ||
static const lexer_lit_location_t lexer_set_literal = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A qestion: the compiler should complain that lexer_same_identifiers arguments should be const. Did you run make precommit?
Generally, it helps the optimizing passes of the compiler if global varibles are `static`, and it is good for RAM usage to have data marked read-only `const`. Found some globals, which could benefit from these qualifiers. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
I've measured the read-only and read/write section sizes in the built binaries, both on current master and on this PR. Results below. (I've expected more data savings from the
@LaszloLango I went trough all the global variables that were listed by the doxygen documentation and found only these with incorrect (or suboptimal) qualifiers. @zherczeg I've built both master and this PR with |
LGTM |
0ac8af9
to
ad6107b
Compare
RPi2 results by tools/run-mem-stats-test.sh The results are the same, except in one case. The parenthesized value shows the result on the master branch.
|
Generally, it helps the optimizing passes of the compiler if global
varibles are
static
, and it is good for RAM usage to have datamarked read-only
const
. Found some globals, which could benefitfrom these qualifiers.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu