Skip to content

Commit 61b32ee

Browse files
committed
Add Include/internal/pycore_uop.h
1 parent be0b25b commit 61b32ee

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Include/internal/pycore_uop.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#ifndef Py_CORE_UOP_H
2+
#define Py_CORE_UOP_H
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#ifndef Py_BUILD_CORE
8+
# error "this header requires Py_BUILD_CORE define"
9+
#endif
10+
11+
#include <stdint.h>
12+
/* Depending on the format,
13+
* the 32 bits between the oparg and operand are:
14+
* UOP_FORMAT_TARGET:
15+
* uint32_t target;
16+
* UOP_FORMAT_JUMP
17+
* uint16_t jump_target;
18+
* uint16_t error_target;
19+
*/
20+
typedef struct _PyUOpInstruction{
21+
uint16_t opcode:15;
22+
uint16_t format:1;
23+
uint16_t oparg;
24+
union {
25+
uint32_t target;
26+
struct {
27+
uint16_t jump_target;
28+
uint16_t error_target;
29+
};
30+
};
31+
uint64_t operand0; // A cache entry
32+
uint64_t operand1;
33+
#ifdef Py_STATS
34+
uint64_t execution_count;
35+
#endif
36+
} _PyUOpInstruction;
37+
38+
// This is the length of the trace we project initially.
39+
#define UOP_MAX_TRACE_LENGTH 1200
40+
41+
#ifdef __cplusplus
42+
}
43+
#endif
44+
#endif /* !Py_INTERNAL_UOP_H */

0 commit comments

Comments
 (0)