develooper Front page | perl.perl5.changes | Postings from August 2022

[Perl/perl5] 819d09: Perl_newRV_noinc - explicitly simplify, convertto...

From:
Richard Leach via perl5-changes
Date:
August 5, 2022 19:53
Subject:
[Perl/perl5] 819d09: Perl_newRV_noinc - explicitly simplify, convertto...
Message ID:
Perl/perl5/push/refs/heads/blead/36d1e5-819d09@github.com
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 819d09b57c6a76b0ba90670a1ea1861730bc457b
      https://github.com/Perl/perl5/commit/819d09b57c6a76b0ba90670a1ea1861730bc457b
  Author: Richard Leach <richardleach@users.noreply.github.com>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

  Changed paths:
    M embed.fnc
    M proto.h
    M sv.c
    M sv_inline.h

  Log Message:
  -----------
  Perl_newRV_noinc - explicitly simplify, convert to inline func

Perl_newRV_noinc creates a new SVt_IV, then calls sv_setrv_noinc,
which will check if the SVt_IV is SvTHINKFIRST (it won't be) and
if it is types other than SVt_IV (it won't be). If those checks
and associated branches are removed, all that remains is some flag
twiddling and setting the sv_u.svu_rv pointer.

A decent compiler *might* figure that all out and simplify
Perl_newRV_noinc right down to the essentials, but if we do that
directly, the entire function is small enough to move to sv_inline.h





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About