Last active
August 29, 2015 14:13
-
-
Save donaldh/91a212b38725642131be to your computer and use it in GitHub Desktop.
Cause of NQPMatch serialization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./perl6 --target=jar -o match.jar match.p6 | |
# | |
# An NQPMatch will be serialized into match.jar | |
sub f() { | |
X::NYI.new(feature => 'broken').throw; | |
} |
Three possible solutions:
- Node.shallow_clone() could always clear the annotations.
- add_inlining_info_if_possible could clear the annotations.
- add_inlining_info_if_possible could copy and sanitize the annotations.
Implemented #2
Before
CORE.setting.jar 2.9M
% jar tvf CORE.setting.jar
25 Mon Jan 19 11:58:26 GMT 2015 META-INF/MANIFEST.MF
10787719 Mon Jan 19 11:58:26 GMT 2015 07E78BB789BE74AF2F60C21C9A44E246EB0613F6.class
8321848 Mon Jan 19 11:58:26 GMT 2015 07E78BB789BE74AF2F60C21C9A44E246EB0613F6.serialized
After
CORE.setting.jar 2.6M
% jar tvf CORE.setting.jar
25 Mon Jan 19 12:03:04 GMT 2015 META-INF/MANIFEST.MF
9176483 Mon Jan 19 12:03:04 GMT 2015 7C526785F6867A079A6061202A27DDB0F8CE8C25.class
8178018 Mon Jan 19 12:03:04 GMT 2015 7C526785F6867A079A6061202A27DDB0F8CE8C25.serialized
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The root cause of this is that QAST annotations can reference NQPMatch objects and the annotations don't get sanitized when QAST nodes get cloned. This happens during add_inlining_info_if_possible and results in NQPMatch objects being serialized in the setting. The offending annotation in this situation is before_promotion but I guess any annotation that references the AST could be problematic.