Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit a501328

Browse files
committed
usenamedanoncv: named __ANON__ => name@
See [cperl #370]: We should no throw away information for no good reason. Mark anonymised functions with a @ suffix, keeping their old name. Esp. with upcoming more and more cvref's without GV. Only if a sub has no name, like my $anon = sub {}; use __ANON__. Add GV_ANON flag to create named anonymous XS functions via newXS_len_flags(). $ cperl -Dt -d:NYTProf -e0 ... (-e:0) nextstate (-e:0) pushmark (-e:0) const(PV("Devel::NYTProf")) (-e:0) method_named(->import) (-e:0) entersub(import@) # was entersub(__ANON_) (-e:0) enterxssub(import@) # was enterxssub(__ANON_) (-e:0) leavesub The import XS method has no name (but an attached CV), so a dummy anon CvGV is created. Devel::NYTProf even creates numbered variants, like BEGIN@4. This might be too expensive here. We could then use the @ CvNAME suffix for marking multi methods (new@int, new@int,str) (i.e. same name, but different methods), as well as marking multiple variants of special blocks (BEGIN@1) for easier identification.
1 parent d2f0a66 commit a501328

File tree

25 files changed

+1488
-1330
lines changed

25 files changed

+1488
-1330
lines changed

Configure

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,7 @@ yaccflags=''
14091409
CONFIG=''
14101410
usecperl=''
14111411
fake_signatures=''
1412+
usenamedanoncv=''
14121413

14131414
: Detect odd OSs
14141415
define='define'
@@ -23790,6 +23791,32 @@ case "$ans" in
2379023791
exit 1 ;;
2379123792
esac
2379223793

23794+
case "$usenamedanoncv" in
23795+
$define|true|[yY]*) dflt='y' ;;
23796+
undef|[nN]*) dflt='n' ;;
23797+
*) case "$usecperl" in
23798+
define) dflt='y' ;;
23799+
*) dflt='n' ;;
23800+
esac
23801+
;;
23802+
esac
23803+
cat <<EOM
23804+
23805+
Would you like to build Perl with named anonymous CVs instead of using
23806+
the old __ANON__ name? With usenamedanoncv every anonymous CV gets the
23807+
old name plus a @ appended, to mark this name as orphaned or anon.
23808+
23809+
If this doesn't make any sense to you, just accept the default '$dflt'.
23810+
EOM
23811+
rp='Use usenamedanoncv?'
23812+
. ./myread
23813+
case "$ans" in
23814+
y|Y) val="$define" ;;
23815+
*) val="$undef" ;;
23816+
esac
23817+
set usenamedanoncv
23818+
eval $setvar
23819+
2379323820
: Check extensions
2379423821
echo " "
2379523822
echo "Looking for extensions..." >&4
@@ -25478,6 +25505,7 @@ usemallocwrap='$usemallocwrap'
2547825505
usemorebits='$usemorebits'
2547925506
usemultiplicity='$usemultiplicity'
2548025507
usemymalloc='$usemymalloc'
25508+
usenamedanoncv='$usenamedanoncv'
2548125509
usenm='$usenm'
2548225510
usensgetexecutablepath='$usensgetexecutablepath'
2548325511
useopcode='$useopcode'

Cross/config.sh-arm-linux

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ usemallocwrap='define'
11461146
usemorebits='undef'
11471147
usemultiplicity='undef'
11481148
usemymalloc='n'
1149+
usenamedanoncv='define'
11491150
usenm='false'
11501151
usensgetexecutablepath='undef'
11511152
useopcode='true'

NetWare/config.wc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,7 @@ usemallocwrap='undef'
11091109
usemorebits='undef'
11101110
usemultiplicity='define'
11111111
usemymalloc='n'
1112+
usenamedanoncv='define'
11121113
usenm='false'
11131114
usensgetexecutablepath='undef'
11141115
useopcode='true'

Porting/config.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,7 @@ usemallocwrap='define'
11931193
usemorebits='undef'
11941194
usemultiplicity='undef'
11951195
usemymalloc='n'
1196+
usenamedanoncv='define'
11961197
usenm='false'
11971198
usensgetexecutablepath='undef'
11981199
useopcode='true'

config_h.SH

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5432,6 +5432,15 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
54325432
#$fake_signatures PERL_FAKE_SIGNATURE /**/
54335433
#endif
54345434
5435+
/* USE_NAMED_ANONCV:
5436+
* This symbol, if defined, indicates that Perl is compiled with usenamedanoncv,
5437+
* using name@ instead of __ANON__.
5438+
* It is the default since cperl-5.28.0.
5439+
*/
5440+
#ifndef USE_NAMED_ANONCV
5441+
#$usenamedanoncv USE_NAMED_ANONCV /**/
5442+
#endif
5443+
54355444
/* USE_SANITIZE_ADDRESS:
54365445
* This symbol, if defined, indicates that Perl is compiled with -fsanitize=address
54375446
*/

configure.com

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,6 +2744,28 @@ $ if ans.eqs."TWO_POT" then use_two_pot_malloc = "Y"
27442744
$ if ans.eqs."PACK_MALLOC" then use_pack_malloc = "Y"
27452745
$ ENDIF
27462746
$!
2747+
$!
2748+
$ echo ""
2749+
$ echo "Would you like to build Perl with named anonymous CVs instead of using"
2750+
$ echo "the old __ANON__ name? With usenamedanoncv every anonymous CV gets the"
2751+
$ echo "old name plus a @ appended, to mark this name as orphaned or anon."
2752+
$ echo ""
2753+
$ bool_dflt = "y"
2754+
$ IF F$TYPE(usenamedanoncv) .nes. ""
2755+
$ then
2756+
$ if usenamedanoncv .and. usenamedanoncv .eqs. "undef" then bool_dflt = "n"
2757+
$ endif
2758+
$ rp = "Use named anoncv? [''bool_dflt'] "
2759+
$ GOSUB myread
2760+
$ usenamedanoncv = ans
2761+
$ IF usenamedanoncv
2762+
$ THEN
2763+
$ usenamedanoncv = "define"
2764+
$ ELSE
2765+
$ usenamedanoncv = "undef"
2766+
$ ENDIF
2767+
$ !
2768+
$ !
27472769
$ xs_extensions = ""
27482770
$ xxx = ""
27492771
$ OPEN/READ CONFIG 'manifestfound'
@@ -6822,6 +6844,7 @@ $ WC "uselongdouble='" + uselongdouble + "'"
68226844
$ WC "usemorebits='" + usemorebits + "'"
68236845
$ WC "usemultiplicity='" + usemultiplicity + "'"
68246846
$ WC "usemymalloc='" + usemymalloc + "'"
6847+
$ WC "usenamedanoncv='" + usenamedanoncv + "'"
68256848
$ WC "useperlio='define'"
68266849
$ WC "useposix='false'"
68276850
$ WC "usequadmath='undef'"

ext/Config/Config_xs.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,7 @@ usemallocwrap, T_INV,0,ALN64I"@@usemallocwrap@@"
14951495
usemorebits, T_INV,0,ALN64I"@@usemorebits@@"
14961496
usemultiplicity, T_INV,0,ALN64I"@@usemultiplicity@@"
14971497
usemymalloc, T_INV,0,ALN64I"@@usemymalloc@@"
1498+
usenamedanoncv, T_INV,0,ALN64I"@@usenamedanoncv@@"
14981499
usenm, T_INV,0,ALN64I"@@usenm@@"
14991500
usensgetexecutablepath, T_INV,0,ALN64I"@@usensgetexecutablepath@@"
15001501
useopcode, T_INV,0,ALN64I"@@useopcode@@"

0 commit comments

Comments
 (0)