[Perl/perl5] 02cc71: embed.pl: functions may declare acceptance of NULL...

[email protected] (Karl Williamson via perl5-changes)
Newsgroups perl.perl5.changes
Message-ID <Perl/perl5/push/refs/heads/blead/[email protected]>
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 02cc7189489d6f870e98339024d4e44a374359b8
      https://github.com/Perl/perl5/commit/02cc7189489d6f870e98339024d4e44a374359b8
  Author: Karl Williamson <[email protected]>
  Date:   2026-08-09 (Sun, 09 Aug 2026)

  Changed paths:
    M autodoc.pl
    M embed.fnc
    M embed.h
    M perl.h
    M regen/embed.pl

  Log Message:
  -----------
  embed.pl: functions may declare acceptance of NULL aTHX.

This adds the 't' flag so that function entries in embed.fnc may now
declare that the implicit aTHX parameter on builds that have them may
point to NULL.

The next commit will use this new capability.


  Commit: f06f49a5c87e48ddf006976e8965dda4627e2813
      https://github.com/Perl/perl5/commit/f06f49a5c87e48ddf006976e8965dda4627e2813
  Author: Karl Williamson <[email protected]>
  Date:   2026-08-09 (Sun, 09 Aug 2026)

  Changed paths:
    M deb.c
    M embed.fnc
    M proto.h
    M util.c

  Log Message:
  -----------
  Change a few functions to handle NULL aTHX

It is not that uncommon for a function to need aTHX only in order to be
able to raise diagnostics for rarely encountered error cases.

This commit changes several of the diagnostic functions so that they can
be called with a NULL aTHX, and they will extract it themselves.

This allows a function that doesn't have an implicit context parameter
to not have to extract it; it's only extracted when needed.  The
immediate impetus of this commit was converting an API function (which
hence can't be changed) without thread context to calling another
function that has thread context, but it only needs that for raising
diagnostics.

The only downside is that there is an extra conditional executed within
these diagnostic-raising functions that wouldn't have to be there for
the normal case.  But it is branch-predicted, and raising diagnosics is
expensive anyway, so this is a negligible addition.

If this mechanism had been in place, the 'nocontext' functions we have
could have been simple macros.  But people actually do pass pointers to
some of these functions, so you can't ever eliminate a public function.


Compare: https://github.com/Perl/perl5/compare/39ab46e0f4bf...f06f49a5c87e

To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.