Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/perl5Public

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mauke merged 4 commits intoPerl:bleadfromtonycoz:23151-eval-dblines
Apr 19, 2025

Conversation

tonycoz
Copy link
Contributor

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)


  • This set of changes requires a perldelta entry, and it is included.

@bulk88
Copy link
Contributor

        SV * const tmpstr = newSV_type(SVt_PVMG);        t = (const char *)memchr(s, '\n', send - s);        if (t)            t++;        else            t = send;        sv_setpvn_fresh(tmpstr, s, t - s);        /* not breakable until we compile a COP for it */        SvIV_set(tmpstr, 0);

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

STATIC voidS_save_lines(pTHX_ AV *array, SV *sv){    const char *s = SvPVX_const(sv);    const char * const send = SvPVX_const(sv) + SvCUR(sv);    I32 line = 1;    while (s && s < send) {const char *t;SV * const tmpstr = newSV(0);sv_upgrade(tmpstr, SVt_PVMG);t = strchr(s, '\n');if (t)    t++;
Revision: a0d0e21ea6ea90a22318550944fe6cb09ae10cdaAuthor: Larry Wall <larry@wall.org>Date: 10/17/1994 7:00:00 PMMessage:perl 5.000

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 representthe address of the COP for that line)FixesPerl#23151
These were saved as PVMG but as bulk88 suggested inPerl#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, simplyremove the test added here, it's simply to confirm we don't needPVMG here.
@tonycoz
Copy link
ContributorAuthor

Improvement, why is this code using SVt_PVMG and not the smaller PVIV body struct?

Good point, I've added changing from PVMG to PVIV.

@tonycoz
Copy link
ContributorAuthor

Fixes#23151

else {
sv = *av_fetch(av, 0, 1);
SvUPGRADE(sv,SVt_PVMG);
SvUPGRADE(sv,SVt_PVIV);
}
if (!SvPOK(sv)) SvPVCLEAR(sv);
Copy link
Contributor

Choose a reason for hiding this comment

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

UnrollSvUPGRADE(), add{} toSvPVCLEAR(sv);, add 2goto skippingif(!SvPOK(sv)) test and jump right into the branch, if was< SVt_PV or we did anewSV_type(SVt_PVIV);. We know the SV* is undef and/or doesn't havePOK_on, so we can skip theif(!SvPOK(sv)) conditional jump CPU opcode/opcodes.

@maukemauke merged commita707dec intoPerl:bleadApr 19, 2025
33 checks passed
mauke pushed a commit that referenced this pull requestApr 19, 2025
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, simplyremove the test added here, it's simply to confirm we don't needPVMG here.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@bulk88bulk88bulk88 left review comments

@maukemaukemauke approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@tonycoz@bulk88@mauke

[8]ページ先頭

©2009-2025 Movatter.jp