FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_testinternalcapi/testbytecodes.c at main · python/cpython · GitHub
python
cpython
Repository navigation
Code
Issues
5k+
(5k+)
Pull requests
2.7k
(2.7k)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Modules
/
_testinternalcapi
/
testbytecodes.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
177 lines (160 loc) · 5.16 KB
Breadcrumbs
cpython
/
Modules
/
_testinternalcapi
/
testbytecodes.c
Copy path
File metadata and controls
177 lines (160 loc) · 5.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// This file contains instruction definitions.
// It is read by generators stored in Tools/cases_generator/
// to generate Python/generated_cases.c.h and others.
// Note that there is some dummy C code at the top and bottom of the file
// to fool text editors like VS Code into believing this is valid C code.
// The actual instruction definitions start at // BEGIN BYTECODES //.
// See Tools/cases_generator/README.md for more information.
#include
"Python.h"
#include
"pycore_abstract.h"
// _PyIndex_Check()
#include
"pycore_audit.h"
// _PySys_Audit()
#include
"pycore_backoff.h"
#include
"pycore_cell.h"
// PyCell_GetRef()
#include
"pycore_code.h"
#include
"pycore_emscripten_signal.h"
// _Py_CHECK_EMSCRIPTEN_SIGNALS
#include
"pycore_function.h"
#include
"pycore_instruments.h"
#include
"pycore_interpolation.h"
// _PyInterpolation_Build()
#include
"pycore_intrinsics.h"
#include
"pycore_long.h"
// _PyLong_ExactDealloc(), _PyLong_GetZero()
#include
"pycore_moduleobject.h"
// PyModuleObject
#include
"pycore_object.h"
// _PyObject_GC_TRACK()
#include
"pycore_opcode_metadata.h"
// uop names
#include
"pycore_opcode_utils.h"
// MAKE_FUNCTION_*
#include
"pycore_pyatomic_ft_wrappers.h"
// FT_ATOMIC_*
#include
"pycore_pyerrors.h"
// _PyErr_GetRaisedException()
#include
"pycore_pystate.h"
// _PyInterpreterState_GET()
#include
"pycore_range.h"
// _PyRangeIterObject
#include
"pycore_setobject.h"
// _PySet_NextEntry()
#include
"pycore_sliceobject.h"
// _PyBuildSlice_ConsumeRefs
#include
"pycore_stackref.h"
#include
"pycore_template.h"
// _PyTemplate_Build()
#include
"pycore_tuple.h"
// _PyTuple_ITEMS()
#include
"pycore_typeobject.h"
// _PySuper_Lookup()
#include
"pycore_dict.h"
#include
"dictobject.h"
#include
"pycore_frame.h"
#include
"opcode.h"
#include
"optimizer.h"
#include
"pydtrace.h"
#include
"setobject.h"
#define
USE_COMPUTED_GOTOS
0
#include
"ceval_macros.h"
/* Flow control macros */
#define
inst
(
name
, ...) case name:
#define
op
(
name
, ...)
/* NAME is ignored */
#define
macro
(
name
) static int MACRO_##name
#define
super
(
name
) static int SUPER_##name
#define
family
(
name
, ...) static int family_##name
#define
pseudo
(
name
) static int pseudo_##name
#define
label
(
name
) name:
/* Annotations */
#define
guard
#define
override
#define
specializing
#define
replicate
(
TIMES
)
#define
tier1
#define
no_save_ip
// Dummy variables for stack effects.
static
PyObject
*
value
,
*
value1
,
*
value2
,
*
left
,
*
right
,
*
res
,
*
sum
,
*
prod
,
*
sub
;
static
PyObject
*
container
,
*
start
,
*
stop
,
*
v
,
*
lhs
,
*
rhs
,
*
res2
;
static
PyObject
*
list
,
*
tuple
,
*
dict
,
*
owner
,
*
set
,
*
str
,
*
tup
,
*
map
,
*
keys
;
static
PyObject
*
exit_func
,
*
lasti
,
*
val
,
*
retval
,
*
obj
,
*
iter
,
*
exhausted
;
static
PyObject
*
aiter
,
*
awaitable
,
*
iterable
,
*
w
,
*
exc_value
,
*
bc
,
*
locals
;
static
PyObject
*
orig
,
*
excs
,
*
update
,
*
b
,
*
fromlist
,
*
level
,
*
from
;
static
PyObject
*
*
pieces
,
*
*
values
;
static
size_t
jump
;
// Dummy variables for cache effects
static
uint16_t
invert
,
counter
,
index
,
hint
;
#define
unused
0 // Used in a macro def, can't be static
static
uint32_t
type_version
;
static
_PyExecutorObject
*
current_executor
;
static
PyObject
*
dummy_func
(
PyThreadState
*
tstate
,
_PyInterpreterFrame
*
frame
,
unsigned
char
opcode
,
unsigned
int
oparg
,
_Py_CODEUNIT
*
next_instr
,
PyObject
*
*
stack_pointer
,
int
throwflag
,
PyObject
*
args
[]
)
{
// Dummy labels.
pop_1_error
:
// Dummy locals.
PyObject
*
dummy
;
_Py_CODEUNIT
*
this_instr
;
PyObject
*
attr
;
PyObject
*
attrs
;
PyObject
*
bottom
;
PyObject
*
callable
;
PyObject
*
callargs
;
PyObject
*
codeobj
;
PyObject
*
cond
;
PyObject
*
descr
;
PyObject
*
exc
;
PyObject
*
exit
;
PyObject
*
fget
;
PyObject
*
fmt_spec
;
PyObject
*
func
;
uint32_t
func_version
;
PyObject
*
getattribute
;
PyObject
*
kwargs
;
PyObject
*
kwdefaults
;
PyObject
*
len_o
;
PyObject
*
match
;
PyObject
*
match_type
;
PyObject
*
method
;
PyObject
*
mgr
;
Py_ssize_t
min_args
;
PyObject
*
names
;
PyObject
*
new_exc
;
PyObject
*
next
;
PyObject
*
none
;
PyObject
*
null
;
PyObject
*
prev_exc
;
PyObject
*
receiver
;
PyObject
*
rest
;
int
result
;
PyObject
*
self
;
PyObject
*
seq
;
PyObject
*
slice
;
PyObject
*
step
;
PyObject
*
subject
;
PyObject
*
top
;
PyObject
*
type
;
PyObject
*
typevars
;
PyObject
*
val0
;
PyObject
*
val1
;
int
values_or_none
;
switch
(
opcode
) {
// BEGIN BYTECODES //
// Override an op
override
op
(
_CHECK_PERIODIC_IF_NOT_YIELD_FROM
, (
--
)) {
Test_EvalFrame_Resumes
++
;
if
((
oparg
&
RESUME_OPARG_LOCATION_MASK
)
<
RESUME_AFTER_YIELD_FROM
) {
int
err
=
check_periodics
(
tstate
);
ERROR_IF
(
err
!=
0
);
}
}
// Override an inst
override
inst
(
LOAD_CONST
, (
--
value
)) {
Test_EvalFrame_Loads
++
;
PyObject
*
obj
=
GETITEM
(
FRAME_CO_CONSTS
,
oparg
);
value
=
PyStackRef_FromPyObjectBorrow
(
obj
);
}
// END BYTECODES //
}
dispatch_opcode
:
error
:
exception_unwind
:
exit_unwind
:
handle_eval_breaker
:
resume_frame
:
start_frame
:
unbound_local_error
:
;
}
// Future families go below this point //
Back
|
FazBrowse Home
|
New Git URL