Skip to content

Commit 14da62c

Browse files
committed
Merge branch 'python-import' into topic/GR-21420
2 parents 31313b2 + 8887d67 commit 14da62c

810 files changed

Lines changed: 88526 additions & 47394 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

graalpython/com.oracle.graal.python.cext/include/abstract.h

Lines changed: 21 additions & 286 deletions
Large diffs are not rendered by default.

graalpython/com.oracle.graal.python.cext/include/ceval.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
3838
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
3939
PyAPI_FUNC(void) _PyEval_SetCoroutineOriginTrackingDepth(int new_depth);
4040
PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void);
41-
PyAPI_FUNC(void) _PyEval_SetCoroutineWrapper(PyObject *);
42-
PyAPI_FUNC(PyObject *) _PyEval_GetCoroutineWrapper(void);
4341
PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *);
4442
PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void);
4543
PyAPI_FUNC(void) _PyEval_SetAsyncGenFinalizer(PyObject *);
@@ -63,7 +61,6 @@ PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
6361
#endif
6462

6563
PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg);
66-
PyAPI_FUNC(void) _PyEval_SignalReceived(void);
6764
PyAPI_FUNC(int) Py_MakePendingCalls(void);
6865

6966
/* Protection against deeply nested recursive calls
@@ -188,14 +185,10 @@ PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);
188185

189186
PyAPI_FUNC(int) PyEval_ThreadsInitialized(void);
190187
PyAPI_FUNC(void) PyEval_InitThreads(void);
191-
#ifndef Py_LIMITED_API
192-
PyAPI_FUNC(void) _PyEval_FiniThreads(void);
193-
#endif /* !Py_LIMITED_API */
194-
PyAPI_FUNC(void) PyEval_AcquireLock(void) Py_DEPRECATED(3.2);
195-
PyAPI_FUNC(void) PyEval_ReleaseLock(void) /* Py_DEPRECATED(3.2) */;
188+
Py_DEPRECATED(3.2) PyAPI_FUNC(void) PyEval_AcquireLock(void);
189+
/* Py_DEPRECATED(3.2) */ PyAPI_FUNC(void) PyEval_ReleaseLock(void);
196190
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
197191
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
198-
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
199192

200193
#ifndef Py_LIMITED_API
201194
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
@@ -217,7 +210,6 @@ PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc);
217210
#ifndef Py_LIMITED_API
218211
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
219212
PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *);
220-
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void);
221213
#endif
222214

223215
/* Masks and values used by FORMAT_VALUE opcode. */

graalpython/com.oracle.graal.python.cext/include/classobject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ typedef struct {
1919
PyObject *im_func; /* The callable object implementing the method */
2020
PyObject *im_self; /* The instance it is bound to */
2121
PyObject *im_weakreflist; /* List of weak references */
22+
vectorcallfunc vectorcall;
2223
} PyMethodObject;
2324

2425
PyAPI_DATA(PyTypeObject) PyMethod_Type;

graalpython/com.oracle.graal.python.cext/include/code.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ typedef uint16_t _Py_CODEUNIT;
2323
# define _Py_OPARG(word) ((word) >> 8)
2424
#endif
2525

26+
typedef struct _PyOpcache _PyOpcache;
27+
2628
/* Bytecode object */
2729
typedef struct {
2830
PyObject_HEAD
2931
int co_argcount; /* #arguments, except *args */
32+
int co_posonlyargcount; /* #positional only arguments */
3033
int co_kwonlyargcount; /* #keyword only arguments */
3134
int co_nlocals; /* #local variables */
3235
int co_stacksize; /* #entries needed for evaluation stack */
@@ -54,6 +57,21 @@ typedef struct {
5457
Type is a void* to keep the format private in codeobject.c to force
5558
people to go through the proper APIs. */
5659
void *co_extra;
60+
61+
/* Per opcodes just-in-time cache
62+
*
63+
* To reduce cache size, we use indirect mapping from opcode index to
64+
* cache object:
65+
* cache = co_opcache[co_opcache_map[next_instr - first_instr] - 1]
66+
*/
67+
68+
// co_opcache_map is indexed by (next_instr - first_instr).
69+
// * 0 means there is no cache for this opcode.
70+
// * n > 0 means there is cache in co_opcache[n-1].
71+
unsigned char *co_opcache_map;
72+
_PyOpcache *co_opcache;
73+
int co_opcache_flag; // used to determine when create a cache.
74+
unsigned char co_opcache_size; // length of co_opcache.
5775
} PyCodeObject;
5876

5977
/* Masks for co_flags above */
@@ -111,6 +129,11 @@ PyAPI_FUNC(PyCodeObject *) PyCode_New(
111129
int, int, int, int, int, PyObject *, PyObject *,
112130
PyObject *, PyObject *, PyObject *, PyObject *,
113131
PyObject *, PyObject *, int, PyObject *);
132+
133+
PyAPI_FUNC(PyCodeObject *) PyCode_NewWithPosOnlyArgs(
134+
int, int, int, int, int, int, PyObject *, PyObject *,
135+
PyObject *, PyObject *, PyObject *, PyObject *,
136+
PyObject *, PyObject *, int, PyObject *);
114137
/* same as struct above */
115138

116139
/* Creates a new empty code object with the specified source location. */

graalpython/com.oracle.graal.python.cext/include/compile.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
2828
#define PyCF_DONT_IMPLY_DEDENT 0x0200
2929
#define PyCF_ONLY_AST 0x0400
3030
#define PyCF_IGNORE_COOKIE 0x0800
31+
#define PyCF_TYPE_COMMENTS 0x1000
32+
#define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
3133

3234
#ifndef Py_LIMITED_API
3335
typedef struct {
3436
int cf_flags; /* bitmask of CO_xxx flags relevant to future */
37+
int cf_feature_version; /* minor Python version (PyCF_ONLY_AST) */
3538
} PyCompilerFlags;
39+
40+
#define _PyCompilerFlags_INIT \
41+
(PyCompilerFlags){.cf_flags = 0, .cf_feature_version = PY_MINOR_VERSION}
3642
#endif
3743

3844
/* Future feature support */
@@ -81,6 +87,7 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
8187

8288
#define PY_INVALID_STACK_EFFECT INT_MAX
8389
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
90+
PyAPI_FUNC(int) PyCompile_OpcodeStackEffectWithJump(int opcode, int oparg, int jump);
8491

8592
PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, int optimize);
8693

@@ -90,10 +97,10 @@ PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena, int optimize);
9097

9198
#endif /* !Py_LIMITED_API */
9299

93-
/* These definitions must match corresponding definitions in graminit.h.
94-
There's code in compile.c that checks that they are the same. */
100+
/* These definitions must match corresponding definitions in graminit.h. */
95101
#define Py_single_input 256
96102
#define Py_file_input 257
97103
#define Py_eval_input 258
104+
#define Py_func_type_input 345
98105

99106
#endif /* !Py_COMPILE_H */

0 commit comments

Comments
 (0)