Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
606 lines (582 sloc) 13.2 KB
/* ex: set ro ft=c: -*- buffer-read-only: t -*-
*
* opnames.h
*
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
* 2008 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.
*
* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
* This file is built by regen/opcode.pl from its data.
* Any changes made here will be lost!
*/
typedef enum opcode {
OP_NULL = 0,
OP_STUB = 1,
OP_SCALAR = 2,
OP_PUSHMARK = 3,
OP_WANTARRAY = 4,
OP_CONST = 5,
OP_GVSV = 6,
OP_GV = 7,
OP_GELEM = 8,
OP_PADSV = 9,
OP_PADAV = 10,
OP_PADHV = 11,
OP_PADANY = 12,
OP_PUSHRE = 13,
OP_SASSIGN = 14,
OP_AASSIGN = 15,
OP_CHOP = 16,
OP_SCHOP = 17,
OP_CHOMP = 18,
OP_SCHOMP = 19,
OP_DEFINED = 20,
OP_UNDEF = 21,
OP_STUDY = 22,
OP_POS = 23,
OP_PREINC = 24,
OP_I_PREINC = 25,
OP_PREDEC = 26,
OP_I_PREDEC = 27,
OP_POSTINC = 28,
OP_I_POSTINC = 29,
OP_POSTDEC = 30,
OP_I_POSTDEC = 31,
OP_POW = 32,
OP_MULTIPLY = 33,
OP_I_MULTIPLY = 34,
OP_U_MULTIPLY = 35,
OP_DIVIDE = 36,
OP_I_DIVIDE = 37,
OP_MODULO = 38,
OP_I_MODULO = 39,
OP_REPEAT = 40,
OP_ADD = 41,
OP_I_ADD = 42,
OP_U_ADD = 43,
OP_SUBTRACT = 44,
OP_I_SUBTRACT = 45,
OP_U_SUBTRACT = 46,
OP_CONCAT = 47,
OP_STRINGIFY = 48,
OP_LEFT_SHIFT = 49,
OP_RIGHT_SHIFT = 50,
OP_LT = 51,
OP_I_LT = 52,
OP_GT = 53,
OP_I_GT = 54,
OP_LE = 55,
OP_I_LE = 56,
OP_GE = 57,
OP_I_GE = 58,
OP_EQ = 59,
OP_I_EQ = 60,
OP_NE = 61,
OP_I_NE = 62,
OP_CMP = 63,
OP_I_CMP = 64,
OP_S_LT = 65,
OP_S_GT = 66,
OP_S_LE = 67,
OP_S_GE = 68,
OP_S_EQ = 69,
OP_S_NE = 70,
OP_S_CMP = 71,
OP_BIT_AND = 72,
OP_BIT_XOR = 73,
OP_BIT_OR = 74,
OP_I_BIT_AND = 75,
OP_I_BIT_XOR = 76,
OP_I_BIT_OR = 77,
OP_S_BIT_AND = 78,
OP_S_BIT_XOR = 79,
OP_S_BIT_OR = 80,
OP_NEGATE = 81,
OP_I_NEGATE = 82,
OP_NOT = 83,
OP_COMPLEMENT = 84,
OP_I_COMPLEMENT = 85,
OP_S_COMPLEMENT = 86,
OP_SMARTMATCH = 87,
OP_ATAN2 = 88,
OP_SIN = 89,
OP_COS = 90,
OP_RAND = 91,
OP_SRAND = 92,
OP_EXP = 93,
OP_LOG = 94,
OP_SQRT = 95,
OP_INT = 96,
OP_HEX = 97,
OP_OCT = 98,
OP_ABS = 99,
OP_RV2GV = 100,
OP_RV2SV = 101,
OP_AV2ARYLEN = 102,
OP_RV2CV = 103,
OP_ANONCODE = 104,
OP_PROTOTYPE = 105,
OP_REFGEN = 106,
OP_SREFGEN = 107,
OP_REF = 108,
OP_BLESS = 109,
OP_BACKTICK = 110,
OP_GLOB = 111,
OP_READLINE = 112,
OP_RCATLINE = 113,
OP_REGCMAYBE = 114,
OP_REGCRESET = 115,
OP_REGCOMP = 116,
OP_MATCH = 117,
OP_QR = 118,
OP_SUBST = 119,
OP_SUBSTCONT = 120,
OP_TRANS = 121,
OP_TRANSR = 122,
OP_LENGTH = 123,
OP_SUBSTR = 124,
OP_VEC = 125,
OP_INDEX = 126,
OP_RINDEX = 127,
OP_SPRINTF = 128,
OP_FORMLINE = 129,
OP_ORD = 130,
OP_CHR = 131,
OP_CRYPT = 132,
OP_UCFIRST = 133,
OP_LCFIRST = 134,
OP_UC = 135,
OP_LC = 136,
OP_QUOTEMETA = 137,
OP_RV2AV = 138,
OP_AELEMFAST = 139,
OP_AELEMFAST_LEX = 140,
OP_AELEM = 141,
OP_I_AELEM = 142,
OP_N_AELEM = 143,
OP_S_AELEM = 144,
OP_AELEMFAST_LEX_U = 145,
OP_AELEM_U = 146,
OP_I_AELEM_U = 147,
OP_N_AELEM_U = 148,
OP_S_AELEM_U = 149,
OP_ASLICE = 150,
OP_KVASLICE = 151,
OP_AEACH = 152,
OP_AKEYS = 153,
OP_AVALUES = 154,
OP_EACH = 155,
OP_VALUES = 156,
OP_KEYS = 157,
OP_DELETE = 158,
OP_EXISTS = 159,
OP_RV2HV = 160,
OP_HELEM = 161,
OP_HSLICE = 162,
OP_KVHSLICE = 163,
OP_MULTIDEREF = 164,
OP_UNPACK = 165,
OP_PACK = 166,
OP_SPLIT = 167,
OP_JOIN = 168,
OP_LIST = 169,
OP_LSLICE = 170,
OP_ANONLIST = 171,
OP_ANONHASH = 172,
OP_SPLICE = 173,
OP_PUSH = 174,
OP_POP = 175,
OP_SHIFT = 176,
OP_UNSHIFT = 177,
OP_SORT = 178,
OP_REVERSE = 179,
OP_GREPSTART = 180,
OP_GREPWHILE = 181,
OP_MAPSTART = 182,
OP_MAPWHILE = 183,
OP_RANGE = 184,
OP_FLIP = 185,
OP_FLOP = 186,
OP_AND = 187,
OP_OR = 188,
OP_XOR = 189,
OP_DOR = 190,
OP_COND_EXPR = 191,
OP_ANDASSIGN = 192,
OP_ORASSIGN = 193,
OP_DORASSIGN = 194,
OP_METHOD = 195,
OP_ENTERSUB = 196,
OP_ENTERXSSUB = 197,
OP_LEAVESUB = 198,
OP_LEAVESUBLV = 199,
OP_CALLER = 200,
OP_WARN = 201,
OP_DIE = 202,
OP_RESET = 203,
OP_LINESEQ = 204,
OP_NEXTSTATE = 205,
OP_DBSTATE = 206,
OP_UNSTACK = 207,
OP_ENTER = 208,
OP_LEAVE = 209,
OP_SCOPE = 210,
OP_ENTERITER = 211,
OP_ITER = 212,
OP_ENTERLOOP = 213,
OP_LEAVELOOP = 214,
OP_RETURN = 215,
OP_LAST = 216,
OP_NEXT = 217,
OP_REDO = 218,
OP_DUMP = 219,
OP_GOTO = 220,
OP_EXIT = 221,
OP_METHOD_NAMED = 222,
OP_METHOD_SUPER = 223,
OP_METHOD_REDIR = 224,
OP_METHOD_REDIR_SUPER = 225,
OP_ENTERGIVEN = 226,
OP_LEAVEGIVEN = 227,
OP_ENTERWHEN = 228,
OP_LEAVEWHEN = 229,
OP_BREAK = 230,
OP_CONTINUE = 231,
OP_OPEN = 232,
OP_CLOSE = 233,
OP_PIPE_OP = 234,
OP_FILENO = 235,
OP_UMASK = 236,
OP_BINMODE = 237,
OP_TIE = 238,
OP_UNTIE = 239,
OP_TIED = 240,
OP_DBMOPEN = 241,
OP_DBMCLOSE = 242,
OP_SSELECT = 243,
OP_SELECT = 244,
OP_GETC = 245,
OP_READ = 246,
OP_ENTERWRITE = 247,
OP_LEAVEWRITE = 248,
OP_PRTF = 249,
OP_PRINT = 250,
OP_SAY = 251,
OP_SYSOPEN = 252,
OP_SYSSEEK = 253,
OP_SYSREAD = 254,
OP_SYSWRITE = 255,
OP_EOF = 256,
OP_TELL = 257,
OP_SEEK = 258,
OP_TRUNCATE = 259,
OP_FCNTL = 260,
OP_IOCTL = 261,
OP_FLOCK = 262,
OP_SEND = 263,
OP_RECV = 264,
OP_SOCKET = 265,
OP_SOCKPAIR = 266,
OP_BIND = 267,
OP_CONNECT = 268,
OP_LISTEN = 269,
OP_ACCEPT = 270,
OP_SHUTDOWN = 271,
OP_GSOCKOPT = 272,
OP_SSOCKOPT = 273,
OP_GETSOCKNAME = 274,
OP_GETPEERNAME = 275,
OP_LSTAT = 276,
OP_STAT = 277,
OP_FTRREAD = 278,
OP_FTRWRITE = 279,
OP_FTREXEC = 280,
OP_FTEREAD = 281,
OP_FTEWRITE = 282,
OP_FTEEXEC = 283,
OP_FTIS = 284,
OP_FTSIZE = 285,
OP_FTMTIME = 286,
OP_FTATIME = 287,
OP_FTCTIME = 288,
OP_FTROWNED = 289,
OP_FTEOWNED = 290,
OP_FTZERO = 291,
OP_FTSOCK = 292,
OP_FTCHR = 293,
OP_FTBLK = 294,
OP_FTFILE = 295,
OP_FTDIR = 296,
OP_FTPIPE = 297,
OP_FTSUID = 298,
OP_FTSGID = 299,
OP_FTSVTX = 300,
OP_FTLINK = 301,
OP_FTTTY = 302,
OP_FTTEXT = 303,
OP_FTBINARY = 304,
OP_CHDIR = 305,
OP_CHOWN = 306,
OP_CHROOT = 307,
OP_UNLINK = 308,
OP_CHMOD = 309,
OP_UTIME = 310,
OP_RENAME = 311,
OP_LINK = 312,
OP_SYMLINK = 313,
OP_READLINK = 314,
OP_MKDIR = 315,
OP_RMDIR = 316,
OP_OPEN_DIR = 317,
OP_READDIR = 318,
OP_TELLDIR = 319,
OP_SEEKDIR = 320,
OP_REWINDDIR = 321,
OP_CLOSEDIR = 322,
OP_FORK = 323,
OP_WAIT = 324,
OP_WAITPID = 325,
OP_SYSTEM = 326,
OP_EXEC = 327,
OP_KILL = 328,
OP_GETPPID = 329,
OP_GETPGRP = 330,
OP_SETPGRP = 331,
OP_GETPRIORITY = 332,
OP_SETPRIORITY = 333,
OP_TIME = 334,
OP_TMS = 335,
OP_LOCALTIME = 336,
OP_GMTIME = 337,
OP_ALARM = 338,
OP_SLEEP = 339,
OP_SHMGET = 340,
OP_SHMCTL = 341,
OP_SHMREAD = 342,
OP_SHMWRITE = 343,
OP_MSGGET = 344,
OP_MSGCTL = 345,
OP_MSGSND = 346,
OP_MSGRCV = 347,
OP_SEMOP = 348,
OP_SEMGET = 349,
OP_SEMCTL = 350,
OP_REQUIRE = 351,
OP_DOFILE = 352,
OP_HINTSEVAL = 353,
OP_ENTEREVAL = 354,
OP_LEAVEEVAL = 355,
OP_ENTERTRY = 356,
OP_LEAVETRY = 357,
OP_GHBYNAME = 358,
OP_GHBYADDR = 359,
OP_GHOSTENT = 360,
OP_GNBYNAME = 361,
OP_GNBYADDR = 362,
OP_GNETENT = 363,
OP_GPBYNAME = 364,
OP_GPBYNUMBER = 365,
OP_GPROTOENT = 366,
OP_GSBYNAME = 367,
OP_GSBYPORT = 368,
OP_GSERVENT = 369,
OP_SHOSTENT = 370,
OP_SNETENT = 371,
OP_SPROTOENT = 372,
OP_SSERVENT = 373,
OP_EHOSTENT = 374,
OP_ENETENT = 375,
OP_EPROTOENT = 376,
OP_ESERVENT = 377,
OP_GPWNAM = 378,
OP_GPWUID = 379,
OP_GPWENT = 380,
OP_SPWENT = 381,
OP_EPWENT = 382,
OP_GGRNAM = 383,
OP_GGRGID = 384,
OP_GGRENT = 385,
OP_SGRENT = 386,
OP_EGRENT = 387,
OP_GETLOGIN = 388,
OP_SYSCALL = 389,
OP_LOCK = 390,
OP_ONCE = 391,
OP_CUSTOM = 392,
OP_REACH = 393,
OP_RKEYS = 394,
OP_RVALUES = 395,
OP_COREARGS = 396,
OP_RUNCV = 397,
OP_FC = 398,
OP_PADCV = 399,
OP_INTROCV = 400,
OP_CLONECV = 401,
OP_PADRANGE = 402,
OP_REFASSIGN = 403,
OP_LVREF = 404,
OP_LVREFSLICE = 405,
OP_LVAVREF = 406,
OP_ANONCONST = 407,
OP_max
} opcode;
#define MAXO 408
#define OP_FREED MAXO
/* PL_opargs encoding */
/* Lowest 10 bits of PL_opargs */
#define OA_MARK 1
#define OA_FOLDCONST 2
#define OA_RETSCALAR 4
#define OA_TARGET 8
#define OA_TARGLEX 24
#define OA_OTHERINT 32
#define OA_DANGEROUS 64
#define OA_DEFGV 128
#define OA_PURE 256
#define OA_BOXRET 512
/* The next 4 bits (10..13) encode op class information */
#define OCSHIFT 10
/* Each remaining 4bit nybbles of PL_opargs (i.e. bits 14..17, 18..21 etc)
* encode the type for each arg */
#define OASHIFT 14
/* arg types */
#define OA_SCALAR 1
#define OA_LIST 2
#define OA_AVREF 3
#define OA_HVREF 4
#define OA_CVREF 5
#define OA_FILEREF 6
#define OA_SCALARREF 7
#define OA_OPTIONAL 8
/* 0b0011_1100_0000_0000 / 0xf000 */
#define OA_CLASS_MASK (0xf << OCSHIFT)
#define OA_BASEOP (0 << OCSHIFT)
#define OA_UNOP (1 << OCSHIFT)
#define OA_BINOP (2 << OCSHIFT)
#define OA_LOGOP (3 << OCSHIFT)
#define OA_LISTOP (4 << OCSHIFT)
#define OA_PMOP (5 << OCSHIFT)
#define OA_SVOP (6 << OCSHIFT)
#define OA_PADOP (7 << OCSHIFT)
#define OA_PVOP_OR_SVOP (8 << OCSHIFT)
#define OA_LOOP (9 << OCSHIFT)
#define OA_COP (10 << OCSHIFT)
#define OA_BASEOP_OR_UNOP (11 << OCSHIFT)
#define OA_FILESTATOP (12 << OCSHIFT)
#define OA_LOOPEXOP (13 << OCSHIFT)
#define OA_METHOP (14 << OCSHIFT)
#define OA_UNOP_AUX (15 << OCSHIFT)
#define OP_HAS_TARGLEX(oc) ((PL_opargs[oc] & OA_TARGLEX) == OA_TARGLEX)
#define OpCLASS(oc) (PL_opargs[(oc)] & OA_CLASS_MASK)
#define OP_IS_BASEOP(oc) (OpCLASS(oc) == OA_BASEOP || OpCLASS(oc) == OA_BASEOP_OR_UNOP)
#define OP_IS_UNOP(oc) (OpCLASS(oc) == OA_UNOP || OpCLASS(oc) == OA_BASEOP_OR_UNOP)
#define OP_IS_BINOP(oc) OpCLASS(oc) == OA_BINOP
#define OP_IS_LOGOP(oc) OpCLASS(oc) == OA_LOGOP
#define OP_IS_LISTOP(oc) OpCLASS(oc) == OA_LISTOP
#define OP_IS_PMOP(oc) OpCLASS(oc) == OA_PMOP
#define OP_IS_SVOP(oc) (OpCLASS(oc) == OA_SVOP || OpCLASS(oc) == OA_PVOP_OR_SVOP)
#define OP_IS_PADOP(oc) OpCLASS(oc) == OA_PADOP
#define OP_IS_LOOP(oc) OpCLASS(oc) == OA_LOOP
#define OP_IS_COP(oc) OpCLASS(oc) == OA_COP
#define OP_IS_FILESTATOP(oc) OpCLASS(oc) == OA_FILESTATOP
#define OP_IS_METHOP(oc) OpCLASS(oc) == OA_METHOP
/* The other OP_IS_* macros are optimized to a simple range check because
all the member OPs are contiguous in regen/opcodes table.
regen/opcode.pl verifies the range contiguity, or generates an OR-equals
expression */
#define OP_HAS_LIST(oc) \
((oc) == OP_AASSIGN || \
(oc) == OP_ANONHASH || \
(oc) == OP_ANONLIST || \
(oc) == OP_ASLICE || \
(oc) == OP_CHMOD || \
(oc) == OP_CHOMP || \
(oc) == OP_CHOP || \
(oc) == OP_CHOWN || \
(oc) == OP_DIE || \
(oc) == OP_ENTERSUB || \
(oc) == OP_ENTERXSSUB || \
(oc) == OP_EXEC || \
(oc) == OP_FORMLINE || \
(oc) == OP_GREPSTART || \
(oc) == OP_HSLICE || \
(oc) == OP_JOIN || \
(oc) == OP_KILL || \
(oc) == OP_KVASLICE || \
(oc) == OP_KVHSLICE || \
(oc) == OP_LIST || \
(oc) == OP_LSLICE || \
(oc) == OP_MAPSTART || \
(oc) == OP_OPEN || \
(oc) == OP_PACK || \
(oc) == OP_PRINT || \
(oc) == OP_PRTF || \
(oc) == OP_PUSH || \
(oc) == OP_REFGEN || \
(oc) == OP_REPEAT || \
(oc) == OP_RETURN || \
(oc) == OP_REVERSE || \
(oc) == OP_SAY || \
(oc) == OP_SORT || \
(oc) == OP_SPLICE || \
(oc) == OP_SPRINTF || \
(oc) == OP_SYSCALL || \
(oc) == OP_SYSTEM || \
(oc) == OP_TIE || \
(oc) == OP_UNLINK || \
(oc) == OP_UNSHIFT || \
(oc) == OP_UTIME || \
(oc) == OP_WARN)
#define OP_IS_SOCKET(oc) \
((oc) >= OP_SEND && (oc) <= OP_GETPEERNAME)
#define OP_IS_FILETEST(oc) \
((oc) >= OP_FTRREAD && (oc) <= OP_FTBINARY)
#define OP_IS_FILETEST_ACCESS(oc) \
((oc) >= OP_FTRREAD && (oc) <= OP_FTEEXEC)
#define OP_IS_NUMCOMPARE(oc) \
((oc) >= OP_LT && (oc) <= OP_I_CMP)
#define OP_IS_DIRHOP(oc) \
((oc) >= OP_READDIR && (oc) <= OP_CLOSEDIR)
#define OP_IS_INFIX_BIT(oc) \
((oc) >= OP_BIT_AND && (oc) <= OP_S_BIT_OR)
/* backcompat old Perl 5 names: */
#if 1
#define OP_NCMP OP_CMP
#define OP_I_NCMP OP_I_CMP
#define OP_SLT OP_S_LT
#define OP_SGT OP_S_GT
#define OP_SLE OP_S_LE
#define OP_SGE OP_S_GE
#define OP_SEQ OP_S_EQ
#define OP_SNE OP_S_NE
#define OP_SCMP OP_S_CMP
#define OP_NBIT_AND OP_I_BIT_AND
#define OP_NBIT_XOR OP_I_BIT_XOR
#define OP_NBIT_OR OP_I_BIT_OR
#define OP_SBIT_AND OP_S_BIT_AND
#define OP_SBIT_XOR OP_S_BIT_XOR
#define OP_SBIT_OR OP_S_BIT_OR
#define OP_NCOMPLEMENT OP_I_COMPLEMENT
#define OP_SCOMPLEMENT OP_S_COMPLEMENT
#define Perl_pp_ncmp Perl_pp_cmp
#define Perl_pp_i_ncmp Perl_pp_i_cmp
#define Perl_pp_slt Perl_pp_s_lt
#define Perl_pp_sgt Perl_pp_s_gt
#define Perl_pp_sle Perl_pp_s_le
#define Perl_pp_sge Perl_pp_s_ge
#define Perl_pp_seq Perl_pp_s_eq
#define Perl_pp_sne Perl_pp_s_ne
#define Perl_pp_scmp Perl_pp_s_cmp
#define Perl_pp_nbit_and Perl_pp_i_bit_and
#define Perl_pp_nbit_xor Perl_pp_i_bit_xor
#define Perl_pp_nbit_or Perl_pp_i_bit_or
#define Perl_pp_sbit_and Perl_pp_s_bit_and
#define Perl_pp_sbit_xor Perl_pp_s_bit_xor
#define Perl_pp_sbit_or Perl_pp_s_bit_or
#define Perl_pp_ncomplement Perl_pp_i_complement
#define Perl_pp_scomplement Perl_pp_s_complement
#endif
/* ex: set ro: */