Mercurial > cpython-lru_cache-weakref
annotate Include/opcode.h @ 10072:ecebcd84df37 legacy-trunk
put the preferences file in a folder called "Python" inside the prefs folder, just like the IDE does -- jvr
| author | Just van Rossum <just@lettererror.com> |
|---|---|
| date | Tue, 02 Feb 1999 15:49:03 +0000 |
| parents | 6ed2cc279346 |
| children | 603db0d0aed1 |
| rev | line source |
|---|---|
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
1 #ifndef Py_OPCODE_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
2 #define Py_OPCODE_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
3 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
4 extern "C" { |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
5 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
6 |
| 145 | 7 /*********************************************************** |
| 2058 | 8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 9 The Netherlands. | |
| 145 | 10 |
| 11 All Rights Reserved | |
| 12 | |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
13 Permission to use, copy, modify, and distribute this software and its |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
14 documentation for any purpose and without fee is hereby granted, |
| 145 | 15 provided that the above copyright notice appear in all copies and that |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
16 both that copyright notice and this permission notice appear in |
| 145 | 17 supporting documentation, and that the names of Stichting Mathematisch |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
18 Centrum or CWI or Corporation for National Research Initiatives or |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
19 CNRI not be used in advertising or publicity pertaining to |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
20 distribution of the software without specific, written prior |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
21 permission. |
| 145 | 22 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
23 While CWI is the initial source for this software, a modified version |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
24 is made available by the Corporation for National Research Initiatives |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
25 (CNRI) at the Internet address ftp://ftp.python.org. |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
26 |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
27 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
28 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
29 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
30 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
31 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
32 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
33 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
3832
diff
changeset
|
34 PERFORMANCE OF THIS SOFTWARE. |
| 145 | 35 |
| 36 ******************************************************************/ | |
| 37 | |
| 69 | 38 /* Instruction opcodes for compiled code */ |
| 39 | |
| 86 | 40 #define STOP_CODE 0 |
| 69 | 41 #define POP_TOP 1 |
| 42 #define ROT_TWO 2 | |
| 43 #define ROT_THREE 3 | |
| 86 | 44 #define DUP_TOP 4 |
| 69 | 45 |
| 46 #define UNARY_POSITIVE 10 | |
| 47 #define UNARY_NEGATIVE 11 | |
| 48 #define UNARY_NOT 12 | |
| 49 #define UNARY_CONVERT 13 | |
|
2841
64928f6a8e80
keyword arguments and faster function calls
Guido van Rossum <guido@python.org>
parents:
2803
diff
changeset
|
50 |
|
409
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
51 #define UNARY_INVERT 15 |
| 69 | 52 |
|
3320
4e6d0b26efaf
changes for ** (power) operator
Guido van Rossum <guido@python.org>
parents:
2841
diff
changeset
|
53 #define BINARY_POWER 19 |
|
4e6d0b26efaf
changes for ** (power) operator
Guido van Rossum <guido@python.org>
parents:
2841
diff
changeset
|
54 |
| 69 | 55 #define BINARY_MULTIPLY 20 |
| 56 #define BINARY_DIVIDE 21 | |
| 57 #define BINARY_MODULO 22 | |
| 58 #define BINARY_ADD 23 | |
| 59 #define BINARY_SUBTRACT 24 | |
| 60 #define BINARY_SUBSCR 25 | |
| 61 | |
| 62 #define SLICE 30 | |
| 63 /* Also uses 31-33 */ | |
| 64 | |
| 65 #define STORE_SLICE 40 | |
| 66 /* Also uses 41-43 */ | |
| 67 | |
| 68 #define DELETE_SLICE 50 | |
| 69 /* Also uses 51-53 */ | |
| 70 | |
| 71 #define STORE_SUBSCR 60 | |
| 72 #define DELETE_SUBSCR 61 | |
| 73 | |
|
409
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
74 #define BINARY_LSHIFT 62 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
75 #define BINARY_RSHIFT 63 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
76 #define BINARY_AND 64 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
77 #define BINARY_XOR 65 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
78 #define BINARY_OR 66 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
79 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
80 |
| 69 | 81 #define PRINT_EXPR 70 |
| 82 #define PRINT_ITEM 71 | |
| 83 #define PRINT_NEWLINE 72 | |
| 84 | |
| 85 #define BREAK_LOOP 80 | |
|
2841
64928f6a8e80
keyword arguments and faster function calls
Guido van Rossum <guido@python.org>
parents:
2803
diff
changeset
|
86 |
|
78
b1fb4e1f6e51
Added opcodes for classes.
Guido van Rossum <guido@python.org>
parents:
69
diff
changeset
|
87 #define LOAD_LOCALS 82 |
| 69 | 88 #define RETURN_VALUE 83 |
|
2841
64928f6a8e80
keyword arguments and faster function calls
Guido van Rossum <guido@python.org>
parents:
2803
diff
changeset
|
89 |
|
1354
fccd415e2eb8
* bltinmodule.c: removed exec() built-in function.
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
90 #define EXEC_STMT 85 |
|
1262
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
91 |
| 69 | 92 #define POP_BLOCK 87 |
| 93 #define END_FINALLY 88 | |
|
78
b1fb4e1f6e51
Added opcodes for classes.
Guido van Rossum <guido@python.org>
parents:
69
diff
changeset
|
94 #define BUILD_CLASS 89 |
| 69 | 95 |
| 96 #define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ | |
| 97 | |
| 98 #define STORE_NAME 90 /* Index in name list */ | |
| 99 #define DELETE_NAME 91 /* "" */ | |
| 100 #define UNPACK_TUPLE 92 /* Number of tuple items */ | |
| 101 #define UNPACK_LIST 93 /* Number of list items */ | |
| 102 #define STORE_ATTR 95 /* Index in name list */ | |
| 103 #define DELETE_ATTR 96 /* "" */ | |
| 474 | 104 #define STORE_GLOBAL 97 /* "" */ |
| 105 #define DELETE_GLOBAL 98 /* "" */ | |
| 69 | 106 |
| 107 #define LOAD_CONST 100 /* Index in const list */ | |
| 108 #define LOAD_NAME 101 /* Index in name list */ | |
| 109 #define BUILD_TUPLE 102 /* Number of tuple items */ | |
| 110 #define BUILD_LIST 103 /* Number of list items */ | |
| 111 #define BUILD_MAP 104 /* Always zero for now */ | |
| 112 #define LOAD_ATTR 105 /* Index in name list */ | |
| 113 #define COMPARE_OP 106 /* Comparison operator */ | |
| 114 #define IMPORT_NAME 107 /* Index in name list */ | |
| 115 #define IMPORT_FROM 108 /* Index in name list */ | |
| 116 | |
| 117 #define JUMP_FORWARD 110 /* Number of bytes to skip */ | |
| 118 #define JUMP_IF_FALSE 111 /* "" */ | |
| 119 #define JUMP_IF_TRUE 112 /* "" */ | |
| 120 #define JUMP_ABSOLUTE 113 /* Target byte offset from beginning of code */ | |
| 121 #define FOR_LOOP 114 /* Number of bytes to skip */ | |
| 122 | |
|
178
fb6367d5ff46
Added opcodes to load local/global variables
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
123 #define LOAD_GLOBAL 116 /* Index in name list */ |
|
fb6367d5ff46
Added opcodes to load local/global variables
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
124 |
| 69 | 125 #define SETUP_LOOP 120 /* Target address (absolute) */ |
| 126 #define SETUP_EXCEPT 121 /* "" */ | |
| 127 #define SETUP_FINALLY 122 /* "" */ | |
| 128 | |
|
1262
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
129 #define LOAD_FAST 124 /* Local variable number */ |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
130 #define STORE_FAST 125 /* Local variable number */ |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
131 #define DELETE_FAST 126 /* Local variable number */ |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
132 |
| 86 | 133 #define SET_LINENO 127 /* Current line number */ |
| 134 | |
|
2803
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
135 /* It used to be the case that opcodes should fit in 7 bits. This is |
|
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
136 no longer the case -- 8 bits is fine (the instruction stream is now |
|
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
137 a sequence of unsigned characters). We gladly use the new space |
|
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
138 for new opcodes. */ |
|
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
139 |
|
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
140 #define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ |
|
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
141 #define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ |
|
2841
64928f6a8e80
keyword arguments and faster function calls
Guido van Rossum <guido@python.org>
parents:
2803
diff
changeset
|
142 #define MAKE_FUNCTION 132 /* #defaults */ |
|
3832
039bc3e4e64e
Added BUILD_SLICE opcode.
Guido van Rossum <guido@python.org>
parents:
3320
diff
changeset
|
143 #define BUILD_SLICE 133 /* Number of items */ |
|
2803
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
144 |
| 69 | 145 /* Comparison operator codes (argument to COMPARE_OP) */ |
| 146 enum cmp_op {LT, LE, EQ, NE, GT, GE, IN, NOT_IN, IS, IS_NOT, EXC_MATCH, BAD}; | |
| 86 | 147 |
| 148 #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) | |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
149 |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
150 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
151 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
152 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
153 #endif /* !Py_OPCODE_H */ |
