[Perl/perl5] 4f406f: perlapi: Rmv obsolete advice regarding Perl_langinfo

2024-01-09 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 4f406f5e0366ad7d322c346827855450d900bf1b
  
https://github.com/Perl/perl5/commit/4f406f5e0366ad7d322c346827855450d900bf1b
  Author: Karl Williamson 
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  perlapi: Rmv obsolete advice regarding Perl_langinfo

The header files have long been adjusted so that the programmer doesn't
have to concern themselves with this bookkeeping.




[Perl/perl5] 3fa85d: locale.c: Use macros to avoid some #ifdef's

2024-01-09 Thread Karl Williamson via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 3fa85d5507f4b5641847a5227e14c8ba16a5c062
  
https://github.com/Perl/perl5/commit/3fa85d5507f4b5641847a5227e14c8ba16a5c062
  Author: Karl Williamson 
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
M locale.c

  Log Message:
  ---
  locale.c: Use macros to avoid some #ifdef's

This #defines these macros once depending on the Configuration to be
either no-ops, or the appropriate expansion.  Then in the code just the
macros instead of #ifdef's.




[Perl/perl5] aed1f3: Renée and Max swapped their release dates/versions

2024-01-09 Thread Max Maischein via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: aed1f3d73a779cd93b1d8d9800f8ccc5e0ca137b
  
https://github.com/Perl/perl5/commit/aed1f3d73a779cd93b1d8d9800f8ccc5e0ca137b
  Author: Max Maischein 
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
M Porting/release_schedule.pod

  Log Message:
  ---
  Renée and Max swapped their release dates/versions




[Perl/perl5]

2024-01-09 Thread iabyn via perl5-changes
  Branch: refs/heads/davem/rc7
  Home:   https://github.com/Perl/perl5


[Perl/perl5] c94929: add Concise tests for state var assignment

2024-01-09 Thread iabyn via perl5-changes
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: c949292055f73373ddef8037677075cfe1a78fc2
  
https://github.com/Perl/perl5/commit/c949292055f73373ddef8037677075cfe1a78fc2
  Author: David Mitchell 
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
M ext/B/t/optree_varinit.t

  Log Message:
  ---
  add Concise tests for state var assignment

Add tests for

state $x = 1;
my $y = state $x = 1;

to check what context is allocated to the various ops. At the moment it
is actually wrong in places, and this commit captures that wrongness.
The next commit will fix this, and those diffs to the tests added in this
commit will help make it clear what has changed.


  Commit: dbcd7f4a222753b4329ac1def41fc1048fbc438b
  
https://github.com/Perl/perl5/commit/dbcd7f4a222753b4329ac1def41fc1048fbc438b
  Author: David Mitchell 
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
M ext/B/t/optree_varinit.t
M op.c

  Log Message:
  ---
  set context in 'state' expressions

The ops associated with a state variable declaration and initial
assignment weren't getting their context (GIMME) assigned.

Background:

state $x = ...;

gets compiled to something similar to

if (first_time)
$x = ...;
else
$x;

Except that the 'if' is performed by an OP_ONCE logop, which checks and
updates a flag in the pad, and branches to op_next or op_other as
appropriate.

During compilation, the context of the state expression wasn't being
passed on to the children of the OP_ONCE. So the assignment (optimised
into a padsv_store) and the padsv were left as UNKNOWN rather than VOID
or SCALAR as appropriate, as in these two examples:

state $x = 1; # should be void
$y = (state $x = 1);  # should be scalar

This commit fixes that. Note that at the moment it makes no practical
difference, since the padsv/padsv_store ops  don't currently change
their behaviour based on context, but that might change.


  Commit: 547324acdb2344f04378d3c32330b611dc0bd519
  
https://github.com/Perl/perl5/commit/547324acdb2344f04378d3c32330b611dc0bd519
  Author: David Mitchell 
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
M gv.c
M op.c
M pp.c

  Log Message:
  ---
  Give OPpTARGET_MY ops real context

Perl has an optimisation whereby an op which returns the RHS of a scalar
assignment to a lexical, and which would normally store its result in
a PADTMP, instead skips the following PADSV and SASSIGN ops and assigns
to the lexical directly, instead of to the PADTMP. For example in

$lex = $a + $b;

the ops (in execution-order) would be changed from

add[t5] sK/2
gvsv[*lex] s
sassign vKS/2
nextstate(main 2 -e:1) v:{

to

add[$lex:1,2] sK/TARGMY,2
nextstate(main 2 -e:1) v:{

However, note that although that the add op is now essentially called in
void context, it is still marked as being in scalar context. This commit
changes it to be be marked as void, i.e.

add[$lex:1,2] vK/TARGMY,2

The main reason for this is to allow for future optimisations in
functions like pp_add(), which will be able to skip pushing the result
onto the stack in in void context. It just so happens that scalar
assignments to lexical vars are typically in void context.

However, since this is a visible change from the perspective of modules
which examine ops or optrees, I'll leave doing any optimisations until
later, in case this commit needs to be reverted.

The main things this commit had to fix up following the change were:
- still call overload methods in scalar context, even though the op is
  now marked as void;
- not issuing "useless use of add in void context" style warnings on
  such ops;
- making pp_push and pp_unshift still set TARG in void context

No matter whether the op's context is marked as scalar or as void, some
parts of perl will misunderstand, and will need to be special-cased
(since the op is really both, depending on your perspective). So this
commit changes the burden of the special-casing code to be in the
non-hot code paths, like during complication or when calling out to an
overload method.


  Commit: c90e7ed39e5df8d5915422454fb76198801f3563
  
https://github.com/Perl/perl5/commit/c90e7ed39e5df8d5915422454fb76198801f3563
  Author: David Mitchell 
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
M ext/B/t/optree_varinit.t
M peep.c
M pp_hot.c
M t/perf/opcount.t

  Log Message:
  ---
  OP_PADSV_STORE: only in void context

For the optimisation which converts $lex  = expr into an OP_PADSV_STORE
op, only optimise if the scalar assign is in VOID context.

This allows us to stop pp_padsv_store() from uselessly pushing the
result onto the stack, only to be immediately popped again by the
following nextstate or unstack op. This becomes more important on
PERL_RC_STACK builds, as each push or pop involves manipulating the SV's
reference count.

I'm working on the a