-
Notifications
You must be signed in to change notification settings - Fork 576
eval: ensure debugging saved lines have an IV part #23171
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
Conversation
Improvement, why is this code using SVt_PVMG and not the smaller PVIV body struct? git blame shows Larry typed in "PVMG" for unknown reasons
|
perldebguts documents that the lines stored in @{"_<$filename"} arrays have a numeric value in addition to the text of the source, ensure that is true for evals. Non-zero IV values indicate the lines are breakable (they represent the address of the COP for that line) Fixes Perl#23151
These were saved as PVMG but as bulk88 suggested in Perl#23171 (comment) we only need PVIV, since the source lines don't need magic, aren't blessed and store an integer, not an NV. So create them as PVIV instead. If it turns out we do need PVMG instead for some future use, simply remove the test added here, it's simply to confirm we don't need PVMG here.
7d8e243
to
3b40a0a
Compare
Good point, I've added changing from PVMG to PVIV. |
Fixes #23151 |
else { | ||
sv = *av_fetch(av, 0, 1); | ||
SvUPGRADE(sv, SVt_PVMG); | ||
SvUPGRADE(sv, SVt_PVIV); | ||
} | ||
if (!SvPOK(sv)) SvPVCLEAR(sv); |
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.
Unroll SvUPGRADE()
, add {}
to SvPVCLEAR(sv);
, add 2 goto
skipping if(!SvPOK(sv))
test and jump right into the branch, if was < SVt_PV
or we did a newSV_type(SVt_PVIV);
. We know the SV* is undef and/or doesn't have POK_on
, so we can skip the if(!SvPOK(sv))
conditional jump CPU opcode/opcodes.
These were saved as PVMG but as bulk88 suggested in #23171 (comment) we only need PVIV, since the source lines don't need magic, aren't blessed and store an integer, not an NV. So create them as PVIV instead. If it turns out we do need PVMG instead for some future use, simply remove the test added here, it's simply to confirm we don't need PVMG here.
perldebguts documents that the lines stored in @{"_<$filename"}
arrays have a numeric value in addition to the text of the source,
ensure that is true for evals.
Non-zero IV values indicate the lines are breakable (they represent
the address of the COP for that line)