-
Notifications
You must be signed in to change notification settings - Fork 686
Add feature to remove parser. #1476
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
Add feature to remove parser. #1476
Conversation
jerry-core/parser/js/js-parser.c
Outdated
| #include "jcontext.h" | ||
| #include "js-parser-internal.h" | ||
|
|
||
| #ifndef CONFIG_DISABLE_PARSER_BUILTIN |
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.
Parser is not exactly a built-in. JERRY_DISABLE_PARSER would sound better. Shouldn't we guard the other files too?
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.
Sounds good, i was not certain how to call it. Let me change it,
I checked on the rest of the code and you guys don't guard the includes, that is why is there after the js-parser-internal.h
5c41e41 to
db062ac
Compare
|
I mean all files in parser/js should have guards. I know the linker can eliminate dead code, but I would prefer a complete solution. Btw how much is the binary size gain on your system? |
|
It is quite a good saving. Parser On Parser Off I will add the guards to the rest of the files. |
db062ac to
9112714
Compare
zherczeg
left a comment
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.
I think after a few more changes we are ready to land this patch.
jerry-core/CMakeLists.txt
Outdated
| set(FEATURE_REGEXP_DUMP OFF CACHE BOOL "Enable regexp byte-code dumps?") | ||
| set(FEATURE_SNAPSHOT_SAVE OFF CACHE BOOL "Enable saving snapshot files?") | ||
| set(FEATURE_SNAPSHOT_EXEC OFF CACHE BOOL "Enable executing snapshot files?") | ||
| set(FEATURE_PARSER_DISABLE OFF CACHE BOOL "Disable the parser and 'eval' and use only snapshots?") |
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.
It seems to me these features are in alphabetic order except the first few (perhaps that should be fixed in a separate patch). You should put this before FEATURE_PARSER_DUMP.
jerry-core/CMakeLists.txt
Outdated
| message(STATUS "FEATURE_REGEXP_DUMP " ${FEATURE_REGEXP_DUMP}) | ||
| message(STATUS "FEATURE_SNAPSHOT_SAVE " ${FEATURE_SNAPSHOT_SAVE}) | ||
| message(STATUS "FEATURE_SNAPSHOT_EXEC " ${FEATURE_SNAPSHOT_EXEC}) | ||
| message(STATUS "FEATURE_PARSER_DISABLE " ${FEATURE_PARSER_DISABLE}) |
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.
Ditto.
jerry-core/CMakeLists.txt
Outdated
| set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DISABLE_PARSER) | ||
| set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_SNAPSHOT_EXEC) | ||
| endif() | ||
|
|
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.
It seems these checks also follows the order in the feature list.
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.
I think it would be better to set the FEATURE_SNAPSHOT_EXEC option to ON in case of disabled parser instead of set this define. I am suggesting to do this check before the status messages or you can create another message which will reports that the FEATURE_SNAPSHOT_EXEC is enabled now (if it was disabled earlier).
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.
Sounds reasonable
jerry-core/parser/js/js-parser.c
Outdated
| JERRY_UNUSED (is_strict); | ||
| JERRY_UNUSED (bytecode_data_p); | ||
|
|
||
| return ecma_raise_syntax_error (""); |
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.
Please add a valid error message enclosed in ECMA_ERR_MSG, since disabling the parser does not mean disabling error messages.
44dbda7 to
0d919de
Compare
LaszloLango
left a comment
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.
LGTM
Remove the parser so we can save space if we are only interested in running snapshots. Removing the parser enables the snapshot execution. JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
0d919de to
b6940b4
Compare
Remove the parser so we can save space if we are only interested in running snapshots.
Removing the parser enables the snapshot execution.
JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com