This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Oops. Failed to remove the now obsolete comment about custom ops.
[perl5.git]
/
opcode.pl
diff --git
a/opcode.pl
b/opcode.pl
index
898a248
..
ab8f31e
100755
(executable)
--- a/
opcode.pl
+++ b/
opcode.pl
@@
-1,11
+1,13
@@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
+use strict;
+
BEGIN {
# Get function prototypes
require 'regen_lib.pl';
}
BEGIN {
# Get function prototypes
require 'regen_lib.pl';
}
-$opcode_new = 'opcode.h-new';
-$opname_new = 'opnames.h-new';
+
my
$opcode_new = 'opcode.h-new';
+
my
$opname_new = 'opnames.h-new';
open(OC, ">$opcode_new") || die "Can't create $opcode_new: $!\n";
binmode OC;
open(ON, ">$opname_new") || die "Can't create $opname_new: $!\n";
open(OC, ">$opcode_new") || die "Can't create $opcode_new: $!\n";
binmode OC;
open(ON, ">$opname_new") || die "Can't create $opname_new: $!\n";
@@
-14,11
+16,15
@@
select OC;
# Read data.
# Read data.
+my %seen;
+my (@ops, %desc, %check, %ckname, %flags, %args);
+
while (<DATA>) {
chop;
next unless $_;
next if /^#/;
while (<DATA>) {
chop;
next unless $_;
next if /^#/;
- ($key, $desc, $check, $flags, $args) = split(/\t+/, $_, 5);
+ my ($key, $desc, $check, $flags, $args) = split(/\t+/, $_, 5);
+ $args = '' unless defined $args;
warn qq[Description "$desc" duplicates $seen{$desc}\n] if $seen{$desc};
die qq[Opcode "$key" duplicates $seen{$key}\n] if $seen{$key};
warn qq[Description "$desc" duplicates $seen{$desc}\n] if $seen{$desc};
die qq[Opcode "$key" duplicates $seen{$key}\n] if $seen{$key};
@@
-40,7
+46,7
@@
my %alias;
# Format is "this function" => "does these op names"
my @raw_alias = (
Perl_do_kv => [qw( keys values )],
# Format is "this function" => "does these op names"
my @raw_alias = (
Perl_do_kv => [qw( keys values )],
- Perl_unimplemented_op => [qw(padany
threadsv mapstart
)],
+ Perl_unimplemented_op => [qw(padany
mapstart custom
)],
# All the ops with a body of { return NORMAL; }
Perl_pp_null => [qw(scalar regcmaybe lineseq scope)],
# All the ops with a body of { return NORMAL; }
Perl_pp_null => [qw(scalar regcmaybe lineseq scope)],
@@
-78,6
+84,13
@@
my @raw_alias = (
Perl_pp_or => ['orassign'],
Perl_pp_ucfirst => ['lcfirst'],
Perl_pp_sle => [qw(slt sgt sge)],
Perl_pp_or => ['orassign'],
Perl_pp_ucfirst => ['lcfirst'],
Perl_pp_sle => [qw(slt sgt sge)],
+ Perl_pp_print => ['say'],
+ Perl_pp_index => ['rindex'],
+ Perl_pp_oct => ['hex'],
+ Perl_pp_shift => ['pop'],
+ Perl_pp_sin => [qw(cos exp log sqrt)],
+ Perl_pp_bit_or => ['bit_xor'],
+ Perl_pp_rv2av => ['rv2hv'],
);
while (my ($func, $names) = splice @raw_alias, 0, 2) {
);
while (my ($func, $names) = splice @raw_alias, 0, 2) {
@@
-86,14
+99,13
@@
while (my ($func, $names) = splice @raw_alias, 0, 2) {
# Emit defines.
# Emit defines.
-$i = 0;
print <<"END";
/* -*- buffer-read-only: t -*-
*
* opcode.h
*
print <<"END";
/* -*- buffer-read-only: t -*-
*
* opcode.h
*
- * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 200
0, 2001, 2002, 2003, 2004, 2005
by Larry Wall and others
+ * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000,
+ * 200
1, 2002, 2003, 2004, 2005, 2006, 2007
by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
@@
-119,7
+131,8
@@
print ON <<"END";
*
* opnames.h
*
*
* opnames.h
*
- * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, by Larry Wall and others
+ * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ * 2007 by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
@@
-133,6
+146,7
@@
print ON <<"END";
typedef enum opcode {
END
typedef enum opcode {
END
+my $i = 0;
for (@ops) {
print ON "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
}
for (@ops) {
print ON "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
}
@@
-212,18
+226,20
@@
print <<END;
START_EXTERN_C
#ifdef PERL_GLOBAL_STRUCT_INIT
START_EXTERN_C
#ifdef PERL_GLOBAL_STRUCT_INIT
+# define PERL_PPADDR_INITED
static const Perl_ppaddr_t Gppaddr[]
#else
# ifndef PERL_GLOBAL_STRUCT
static const Perl_ppaddr_t Gppaddr[]
#else
# ifndef PERL_GLOBAL_STRUCT
+# define PERL_PPADDR_INITED
EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
# endif
#endif /* PERL_GLOBAL_STRUCT */
#if (defined(DOINIT) && !defined(PERL_GLOBAL_STRUCT)) || defined(PERL_GLOBAL_STRUCT_INIT)
EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
# endif
#endif /* PERL_GLOBAL_STRUCT */
#if (defined(DOINIT) && !defined(PERL_GLOBAL_STRUCT)) || defined(PERL_GLOBAL_STRUCT_INIT)
+# define PERL_PPADDR_INITED
= {
END
for (@ops) {
= {
END
for (@ops) {
- $_ eq "custom" and next;
if (my $name = $alias{$_}) {
print "\tMEMBER_TO_FPTR($name),\t/* Perl_pp_$_ */\n";
}
if (my $name = $alias{$_}) {
print "\tMEMBER_TO_FPTR($name),\t/* Perl_pp_$_ */\n";
}
@@
-235,7
+251,9
@@
for (@ops) {
print <<END;
}
#endif
print <<END;
}
#endif
+#ifdef PERL_PPADDR_INITED
;
;
+#endif
END
END
@@
-243,13
+261,16
@@
END
print <<END;
#ifdef PERL_GLOBAL_STRUCT_INIT
print <<END;
#ifdef PERL_GLOBAL_STRUCT_INIT
+# define PERL_CHECK_INITED
static const Perl_check_t Gcheck[]
#else
# ifndef PERL_GLOBAL_STRUCT
static const Perl_check_t Gcheck[]
#else
# ifndef PERL_GLOBAL_STRUCT
+# define PERL_CHECK_INITED
EXT Perl_check_t PL_check[] /* or perlvars.h */
# endif
#endif
#if (defined(DOINIT) && !defined(PERL_GLOBAL_STRUCT)) || defined(PERL_GLOBAL_STRUCT_INIT)
EXT Perl_check_t PL_check[] /* or perlvars.h */
# endif
#endif
#if (defined(DOINIT) && !defined(PERL_GLOBAL_STRUCT)) || defined(PERL_GLOBAL_STRUCT_INIT)
+# define PERL_CHECK_INITED
= {
END
= {
END
@@
-260,7
+281,9
@@
for (@ops) {
print <<END;
}
#endif
print <<END;
}
#endif
+#ifdef PERL_CHECK_INITED
;
;
+#endif /* #ifdef PERL_CHECK_INITED */
END
END
@@
-270,22
+293,22
@@
print <<END;
#ifndef PERL_GLOBAL_STRUCT_INIT
#ifndef DOINIT
#ifndef PERL_GLOBAL_STRUCT_INIT
#ifndef DOINIT
-EXT
const
U32 PL_opargs[];
+EXT
CONST
U32 PL_opargs[];
#else
#else
-EXT
const
U32 PL_opargs[] = {
+EXT
CONST
U32 PL_opargs[] = {
END
END
-%argnum = (
-
S, 1,
# scalar
-
L, 2,
# list
-
A, 3,
# array value
-
H, 4,
# hash value
-
C, 5,
# code value
-
F, 6,
# file value
-
R, 7,
# scalar reference
+
my
%argnum = (
+
'S', 1,
# scalar
+
'L', 2,
# list
+
'A', 3,
# array value
+
'H', 4,
# hash value
+
'C', 5,
# code value
+
'F', 6,
# file value
+
'R', 7,
# scalar reference
);
);
-%opclass = (
+
my
%opclass = (
'0', 0, # baseop
'1', 1, # unop
'2', 2, # binop
'0', 0, # baseop
'1', 1, # unop
'2', 2, # binop
@@
-306,8
+329,8
@@
my %OP_IS_SOCKET;
my %OP_IS_FILETEST;
for (@ops) {
my %OP_IS_FILETEST;
for (@ops) {
- $argsum = 0;
- $flags = $flags{$_};
+
my
$argsum = 0;
+
my
$flags = $flags{$_};
$argsum |= 1 if $flags =~ /m/; # needs stack mark
$argsum |= 2 if $flags =~ /f/; # fold constants
$argsum |= 4 if $flags =~ /s/; # always produces scalar
$argsum |= 1 if $flags =~ /m/; # needs stack mark
$argsum |= 2 if $flags =~ /f/; # fold constants
$argsum |= 4 if $flags =~ /s/; # always produces scalar
@@
-319,13
+342,13
@@
for (@ops) {
$argsum |= 128 if $flags =~ /u/; # defaults to $_
$flags =~ /([\W\d_])/ or die qq[Opcode "$_" has no class indicator];
$argsum |= $opclass{$1} << 9;
$argsum |= 128 if $flags =~ /u/; # defaults to $_
$flags =~ /([\W\d_])/ or die qq[Opcode "$_" has no class indicator];
$argsum |= $opclass{$1} << 9;
-
$mul = 0x2000;
# 2 ^ OASHIFT
- for $arg (split(' ',$args{$_})) {
+
my $mul = 0x2000;
# 2 ^ OASHIFT
+ for
my
$arg (split(' ',$args{$_})) {
if ($arg =~ /^F/) {
$OP_IS_SOCKET{$_} = 1 if $arg =~ s/s//;
$OP_IS_FILETEST{$_} = 1 if $arg =~ s/-//;
}
if ($arg =~ /^F/) {
$OP_IS_SOCKET{$_} = 1 if $arg =~ s/s//;
$OP_IS_FILETEST{$_} = 1 if $arg =~ s/-//;
}
- $argnum = ($arg =~ s/\?//) ? 8 : 0;
+
my
$argnum = ($arg =~ s/\?//) ? 8 : 0;
die "op = $_, arg = $arg\n" unless length($arg) == 1;
$argnum += $argnum{$arg};
warn "# Conflicting bit 32 for '$_'.\n"
die "op = $_, arg = $arg\n" unless length($arg) == 1;
$argnum += $argnum{$arg};
warn "# Conflicting bit 32 for '$_'.\n"
@@
-341,9
+364,10
@@
print <<END;
};
#endif
};
#endif
+#endif /* !PERL_GLOBAL_STRUCT_INIT */
+
END_EXTERN_C
END_EXTERN_C
-#endif /* !PERL_GLOBAL_STRUCT_INIT */
END
if (keys %OP_IS_SOCKET) {
END
if (keys %OP_IS_SOCKET) {
@@
-372,8
+396,8
@@
foreach ('opcode.h', 'opnames.h') {
safer_rename $opcode_new, 'opcode.h';
safer_rename $opname_new, 'opnames.h';
safer_rename $opcode_new, 'opcode.h';
safer_rename $opname_new, 'opnames.h';
-$pp_proto_new = 'pp_proto.h-new';
-$pp_sym_new = 'pp.sym-new';
+
my
$pp_proto_new = 'pp_proto.h-new';
+
my
$pp_sym_new = 'pp.sym-new';
open PP, ">$pp_proto_new" or die "Error creating $pp_proto_new: $!";
binmode PP;
open PP, ">$pp_proto_new" or die "Error creating $pp_proto_new: $!";
binmode PP;
@@
-434,7
+458,7
@@
END {
###########################################################################
sub tab {
###########################################################################
sub tab {
-
local
($l, $t) = @_;
+
my
($l, $t) = @_;
$t .= "\t" x ($l - (length($t) + 1) / 8);
$t;
}
$t .= "\t" x ($l - (length($t) + 1) / 8);
$t;
}
@@
-498,7
+522,8
@@
sub tab {
__END__
__END__
-# New ops always go at the end, just before 'custom'
+# New ops always go at the end
+# The restriction on having custom as the last op has been removed
# A recapitulation of the format of this file:
# The file consists of five columns: the name of the op, an English
# A recapitulation of the format of this file:
# The file consists of five columns: the name of the op, an English
@@
-569,10
+594,10
@@
bless bless ck_fun s@ S S?
# Pushy I/O.
# Pushy I/O.
-backtick quoted execution (``, qx) ck_open t
%
+backtick quoted execution (``, qx) ck_open t
u% S?
# glob defaults its first arg to $_
glob glob ck_glob t@ S?
# glob defaults its first arg to $_
glob glob ck_glob t@ S?
-readline <HANDLE> ck_
null
t% F?
+readline <HANDLE> ck_
readline
t% F?
rcatline append I/O operator ck_null t$
# Bindable operators.
rcatline append I/O operator ck_null t$
# Bindable operators.
@@
-868,30
+893,31
@@
fteread -r ck_ftst isu- F-
ftewrite -w ck_ftst isu- F-
fteexec -x ck_ftst isu- F-
ftis -e ck_ftst isu- F-
ftewrite -w ck_ftst isu- F-
fteexec -x ck_ftst isu- F-
ftis -e ck_ftst isu- F-
-fteowned -o ck_ftst isu- F-
-ftrowned -O ck_ftst isu- F-
-ftzero -z ck_ftst isu- F-
ftsize -s ck_ftst istu- F-
ftmtime -M ck_ftst stu- F-
ftatime -A ck_ftst stu- F-
ftctime -C ck_ftst stu- F-
ftsize -s ck_ftst istu- F-
ftmtime -M ck_ftst stu- F-
ftatime -A ck_ftst stu- F-
ftctime -C ck_ftst stu- F-
+ftrowned -O ck_ftst isu- F-
+fteowned -o ck_ftst isu- F-
+ftzero -z ck_ftst isu- F-
ftsock -S ck_ftst isu- F-
ftchr -c ck_ftst isu- F-
ftblk -b ck_ftst isu- F-
ftfile -f ck_ftst isu- F-
ftdir -d ck_ftst isu- F-
ftpipe -p ck_ftst isu- F-
ftsock -S ck_ftst isu- F-
ftchr -c ck_ftst isu- F-
ftblk -b ck_ftst isu- F-
ftfile -f ck_ftst isu- F-
ftdir -d ck_ftst isu- F-
ftpipe -p ck_ftst isu- F-
-ftlink -l ck_ftst isu- F-
ftsuid -u ck_ftst isu- F-
ftsgid -g ck_ftst isu- F-
ftsvtx -k ck_ftst isu- F-
ftsuid -u ck_ftst isu- F-
ftsgid -g ck_ftst isu- F-
ftsvtx -k ck_ftst isu- F-
+ftlink -l ck_ftst isu- F-
fttty -t ck_ftst is- F-
fttext -T ck_ftst isu- F-
ftbinary -B ck_ftst isu- F-
# File calls.
fttty -t ck_ftst is- F-
fttext -T ck_ftst isu- F-
ftbinary -B ck_ftst isu- F-
# File calls.
-chdir chdir ck_fun isT% S?
+# chdir really behaves as if it had both "S?" and "F?"
+chdir chdir ck_chdir isT% S?
chown chown ck_fun imsT@ L
chroot chroot ck_fun isTu% S?
unlink unlink ck_fun imsTu@ L
chown chown ck_fun imsT@ L
chroot chroot ck_fun isTu% S?
unlink unlink ck_fun imsTu@ L
@@
-956,9
+982,9
@@
msgrcv msgrcv ck_fun imst@ S S S S S
# Semaphores.
# Semaphores.
+semop semop ck_fun imst@ S S
semget semget ck_fun imst@ S S S
semctl semctl ck_fun imst@ S S S S
semget semget ck_fun imst@ S S S
semctl semctl ck_fun imst@ S S S S
-semop semop ck_fun imst@ S S
# Eval.
# Eval.
@@
-1010,7
+1036,6
@@
syscall syscall ck_fun imst@ S L
# For multi-threading
lock lock ck_rfun s% R
# For multi-threading
lock lock ck_rfun s% R
-threadsv per-thread value ck_null ds0
# Control (contd.)
setstate set statement info ck_null s;
# Control (contd.)
setstate set statement info ck_null s;
@@
-1019,6
+1044,14
@@
method_named method with known name ck_null d$
dor defined or (//) ck_null |
dorassign defined or assignment (//=) ck_null s|
dor defined or (//) ck_null |
dorassign defined or assignment (//=) ck_null s|
-# Add new ops before this, the custom operator.
+entergiven given() ck_null d|
+leavegiven leave given block ck_null 1
+enterwhen when() ck_null d|
+leavewhen leave when block ck_null 1
+break break ck_null 0
+continue continue ck_null 0
+smartmatch smart match ck_smartmatch s2
+
+say say ck_listiob ims@ F? L
custom unknown custom operator ck_null 0
custom unknown custom operator ck_null 0