Mercurial > cpython-lru_cache-weakref
annotate Include/opcode.h @ 17632:fcdde680331e legacy-trunk
Check RefCon backpointer to python object with IsPointerValid() before dereferencing it (carbon only).
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Wed, 25 Apr 2001 22:09:29 +0000 |
| parents | 32e7d0898eab |
| children | 7bc473b2c654 |
| 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 |
| 69 | 8 /* Instruction opcodes for compiled code */ |
| 9 | |
| 86 | 10 #define STOP_CODE 0 |
| 69 | 11 #define POP_TOP 1 |
| 12 #define ROT_TWO 2 | |
| 13 #define ROT_THREE 3 | |
| 86 | 14 #define DUP_TOP 4 |
|
14162
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
15 #define ROT_FOUR 5 |
| 69 | 16 |
| 17 #define UNARY_POSITIVE 10 | |
| 18 #define UNARY_NEGATIVE 11 | |
| 19 #define UNARY_NOT 12 | |
| 20 #define UNARY_CONVERT 13 | |
|
2841
64928f6a8e80
keyword arguments and faster function calls
Guido van Rossum <guido@python.org>
parents:
2803
diff
changeset
|
21 |
|
409
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
22 #define UNARY_INVERT 15 |
| 69 | 23 |
|
3320
4e6d0b26efaf
changes for ** (power) operator
Guido van Rossum <guido@python.org>
parents:
2841
diff
changeset
|
24 #define BINARY_POWER 19 |
|
4e6d0b26efaf
changes for ** (power) operator
Guido van Rossum <guido@python.org>
parents:
2841
diff
changeset
|
25 |
| 69 | 26 #define BINARY_MULTIPLY 20 |
| 27 #define BINARY_DIVIDE 21 | |
| 28 #define BINARY_MODULO 22 | |
| 29 #define BINARY_ADD 23 | |
| 30 #define BINARY_SUBTRACT 24 | |
| 31 #define BINARY_SUBSCR 25 | |
| 32 | |
| 33 #define SLICE 30 | |
| 34 /* Also uses 31-33 */ | |
| 35 | |
| 36 #define STORE_SLICE 40 | |
| 37 /* Also uses 41-43 */ | |
| 38 | |
| 39 #define DELETE_SLICE 50 | |
| 40 /* Also uses 51-53 */ | |
| 41 | |
|
14162
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
42 #define INPLACE_ADD 55 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
43 #define INPLACE_SUBTRACT 56 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
44 #define INPLACE_MULTIPLY 57 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
45 #define INPLACE_DIVIDE 58 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
46 #define INPLACE_MODULO 59 |
| 69 | 47 #define STORE_SUBSCR 60 |
| 48 #define DELETE_SUBSCR 61 | |
| 49 | |
|
409
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
50 #define BINARY_LSHIFT 62 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
51 #define BINARY_RSHIFT 63 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
52 #define BINARY_AND 64 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
53 #define BINARY_XOR 65 |
|
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
54 #define BINARY_OR 66 |
|
14162
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
55 #define INPLACE_POWER 67 |
|
17597
32e7d0898eab
Iterators phase 1. This comprises:
Guido van Rossum <guido@python.org>
parents:
16398
diff
changeset
|
56 #define GET_ITER 68 |
|
409
b5fe6482072f
Added shift and mask ops.
Guido van Rossum <guido@python.org>
parents:
178
diff
changeset
|
57 |
| 69 | 58 #define PRINT_EXPR 70 |
| 59 #define PRINT_ITEM 71 | |
| 60 #define PRINT_NEWLINE 72 | |
|
14098
44e666cc8c07
PEP 214, Extended print Statement, has been accepted by the BDFL.
Barry Warsaw <barry@python.org>
parents:
14038
diff
changeset
|
61 #define PRINT_ITEM_TO 73 |
|
44e666cc8c07
PEP 214, Extended print Statement, has been accepted by the BDFL.
Barry Warsaw <barry@python.org>
parents:
14038
diff
changeset
|
62 #define PRINT_NEWLINE_TO 74 |
|
14162
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
63 #define INPLACE_LSHIFT 75 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
64 #define INPLACE_RSHIFT 76 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
65 #define INPLACE_AND 77 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
66 #define INPLACE_XOR 78 |
|
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
67 #define INPLACE_OR 79 |
| 69 | 68 #define BREAK_LOOP 80 |
|
2841
64928f6a8e80
keyword arguments and faster function calls
Guido van Rossum <guido@python.org>
parents:
2803
diff
changeset
|
69 |
|
78
b1fb4e1f6e51
Added opcodes for classes.
Guido van Rossum <guido@python.org>
parents:
69
diff
changeset
|
70 #define LOAD_LOCALS 82 |
| 69 | 71 #define RETURN_VALUE 83 |
|
14038
18385172fac0
Apply SF patch #101135, adding 'import module as m' and 'from module import
Thomas Wouters <thomas@python.org>
parents:
13930
diff
changeset
|
72 #define IMPORT_STAR 84 |
|
1354
fccd415e2eb8
* bltinmodule.c: removed exec() built-in function.
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
73 #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
|
74 |
| 69 | 75 #define POP_BLOCK 87 |
| 76 #define END_FINALLY 88 | |
|
78
b1fb4e1f6e51
Added opcodes for classes.
Guido van Rossum <guido@python.org>
parents:
69
diff
changeset
|
77 #define BUILD_CLASS 89 |
| 69 | 78 |
| 79 #define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ | |
| 80 | |
| 81 #define STORE_NAME 90 /* Index in name list */ | |
| 82 #define DELETE_NAME 91 /* "" */ | |
|
13930
4eaa463c031a
Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since they
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
83 #define UNPACK_SEQUENCE 92 /* Number of sequence items */ |
|
17597
32e7d0898eab
Iterators phase 1. This comprises:
Guido van Rossum <guido@python.org>
parents:
16398
diff
changeset
|
84 #define FOR_ITER 93 |
|
13930
4eaa463c031a
Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since they
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
85 |
| 69 | 86 #define STORE_ATTR 95 /* Index in name list */ |
| 87 #define DELETE_ATTR 96 /* "" */ | |
| 474 | 88 #define STORE_GLOBAL 97 /* "" */ |
| 89 #define DELETE_GLOBAL 98 /* "" */ | |
|
14162
27d7d89c774b
The real suport for augmented assignment: new opcodes, new PyNumber and
Thomas Wouters <thomas@python.org>
parents:
14147
diff
changeset
|
90 #define DUP_TOPX 99 /* number of items to duplicate */ |
| 69 | 91 #define LOAD_CONST 100 /* Index in const list */ |
| 92 #define LOAD_NAME 101 /* Index in name list */ | |
| 93 #define BUILD_TUPLE 102 /* Number of tuple items */ | |
| 94 #define BUILD_LIST 103 /* Number of list items */ | |
| 95 #define BUILD_MAP 104 /* Always zero for now */ | |
| 96 #define LOAD_ATTR 105 /* Index in name list */ | |
| 97 #define COMPARE_OP 106 /* Comparison operator */ | |
| 98 #define IMPORT_NAME 107 /* Index in name list */ | |
| 99 #define IMPORT_FROM 108 /* Index in name list */ | |
| 100 | |
| 101 #define JUMP_FORWARD 110 /* Number of bytes to skip */ | |
| 102 #define JUMP_IF_FALSE 111 /* "" */ | |
| 103 #define JUMP_IF_TRUE 112 /* "" */ | |
| 104 #define JUMP_ABSOLUTE 113 /* Target byte offset from beginning of code */ | |
| 105 #define FOR_LOOP 114 /* Number of bytes to skip */ | |
| 106 | |
|
178
fb6367d5ff46
Added opcodes to load local/global variables
Guido van Rossum <guido@python.org>
parents:
145
diff
changeset
|
107 #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
|
108 |
|
16398
80c0b280a4f9
Allow 'continue' inside 'try' clause
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
16257
diff
changeset
|
109 #define CONTINUE_LOOP 119 /* Start of loop (absolute) */ |
| 69 | 110 #define SETUP_LOOP 120 /* Target address (absolute) */ |
| 111 #define SETUP_EXCEPT 121 /* "" */ | |
| 112 #define SETUP_FINALLY 122 /* "" */ | |
| 113 | |
|
1262
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
114 #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
|
115 #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
|
116 #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
|
117 |
| 86 | 118 #define SET_LINENO 127 /* Current line number */ |
| 119 | |
|
2803
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
120 #define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ |
|
12082
603db0d0aed1
slightly modified version of Greg Ewing's extended call syntax patch
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
8627
diff
changeset
|
121 /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ |
|
2803
a2363b6e9c86
new opcodes RAISE_VARARGS, CALL_FUNCTION
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
122 #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
|
123 #define MAKE_FUNCTION 132 /* #defaults */ |
|
3832
039bc3e4e64e
Added BUILD_SLICE opcode.
Guido van Rossum <guido@python.org>
parents:
3320
diff
changeset
|
124 #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
|
125 |
|
16257
fd8c7203251f
PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15939
diff
changeset
|
126 #define MAKE_CLOSURE 134 /* #free vars */ |
|
fd8c7203251f
PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15939
diff
changeset
|
127 #define LOAD_CLOSURE 135 /* Load free variable from closure */ |
|
fd8c7203251f
PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15939
diff
changeset
|
128 #define LOAD_DEREF 136 /* Load and dereference from closure cell */ |
|
fd8c7203251f
PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15939
diff
changeset
|
129 #define STORE_DEREF 137 /* Store into cell */ |
|
fd8c7203251f
PEP 227 implementation
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
15939
diff
changeset
|
130 |
|
12082
603db0d0aed1
slightly modified version of Greg Ewing's extended call syntax patch
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
8627
diff
changeset
|
131 /* The next 3 opcodes must be contiguous and satisfy |
|
12085
25b63367385e
remove reference to CALL_FUNCTION_STAR in comment
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
12082
diff
changeset
|
132 (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */ |
|
12082
603db0d0aed1
slightly modified version of Greg Ewing's extended call syntax patch
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
8627
diff
changeset
|
133 #define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */ |
|
603db0d0aed1
slightly modified version of Greg Ewing's extended call syntax patch
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
8627
diff
changeset
|
134 #define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ |
|
603db0d0aed1
slightly modified version of Greg Ewing's extended call syntax patch
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
8627
diff
changeset
|
135 #define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ |
|
603db0d0aed1
slightly modified version of Greg Ewing's extended call syntax patch
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
8627
diff
changeset
|
136 |
|
14147
21ec69a56228
Charles G. Waldman <cgw@fnal.gov>:
Fred Drake <fdrake@acm.org>
parents:
14098
diff
changeset
|
137 /* Support for opargs more than 16 bits long */ |
|
21ec69a56228
Charles G. Waldman <cgw@fnal.gov>:
Fred Drake <fdrake@acm.org>
parents:
14098
diff
changeset
|
138 #define EXTENDED_ARG 143 |
|
21ec69a56228
Charles G. Waldman <cgw@fnal.gov>:
Fred Drake <fdrake@acm.org>
parents:
14098
diff
changeset
|
139 |
| 69 | 140 /* Comparison operator codes (argument to COMPARE_OP) */ |
|
15939
867a4a6e7cda
Rich comparisons: ensure that LT == Py_LT, etc.
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
141 enum cmp_op {LT=Py_LT, LE=Py_LE, EQ=Py_EQ, NE=Py_NE, GT=Py_GT, GE=Py_GE, |
|
867a4a6e7cda
Rich comparisons: ensure that LT == Py_LT, etc.
Guido van Rossum <guido@python.org>
parents:
14375
diff
changeset
|
142 IN, NOT_IN, IS, IS_NOT, EXC_MATCH, BAD}; |
| 86 | 143 |
| 144 #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) | |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
145 |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
146 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
147 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
148 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1288
diff
changeset
|
149 #endif /* !Py_OPCODE_H */ |
