Skip to content

Commit ad3c7ca

Browse files
committed
Merge remote-tracking branch 'origin/master' into tim/graalpy-25-fast-forward-mk2
2 parents 4dad324 + 82ef956 commit ad3c7ca

File tree

371 files changed

+2523
-17668
lines changed

Some content is hidden

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

371 files changed

+2523
-17668
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,28 @@ repos:
44
- id: checkcopyrights
55
name: Copyright check
66
language: system
7+
require_serial: true
78
entry: bash scripts/pre-commit-checkcopyrights.sh
89
types: [text]
910
- id: eclipseformat
1011
name: Eclipse formatter
1112
language: system
13+
require_serial: true
1214
entry: bash scripts/pre-commit-eclipseformat.sh
1315
types: [text]
1416
files: '\.java$'
1517
- id: checkstyle
1618
name: Checkstyle
1719
language: system
20+
require_serial: true
1821
entry: bash scripts/pre-commit-checkstyle.sh
1922
types: [text]
2023
files: '\.java$'
2124
- id: pylint
2225
name: Pylint on mx files
2326
language: system
2427
pass_filenames: false
28+
require_serial: true
2529
entry: bash scripts/pre-commit-pylint.sh
2630
types: [text]
2731
files: '^mx\.graalpython/.*\.py$'

ci.jsonnet

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -196,46 +196,6 @@
196196
"darwin:aarch64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
197197
"windows:amd64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST) + batches(2),
198198
}),
199-
"python-unittest-gradle-plugin": gpgate + platform_spec(no_jobs) + platform_spec({
200-
"linux:amd64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE),
201-
"linux:aarch64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE),
202-
"darwin:aarch64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE),
203-
"darwin:amd64:jdk-latest" : daily + t("02:00:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
204-
"windows:amd64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE) + batches(2),
205-
"linux:amd64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
206-
"linux:aarch64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
207-
"darwin:aarch64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
208-
"windows:amd64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST) + batches(2),
209-
}),
210-
"python-unittest-gradle-plugin-long-run": gpgate + platform_spec(no_jobs) + platform_spec({
211-
"linux:amd64:jdk-latest" : post_merge + t("02:30:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
212-
"linux:aarch64:jdk-latest" : post_merge + t("02:30:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
213-
"darwin:aarch64:jdk-latest" : post_merge + t("02:30:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
214-
"windows:amd64:jdk-latest" : post_merge + t("03:59:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST) + batches(2),
215-
}),
216-
"python-unittest-maven-plugin": gpgate_maven + platform_spec(no_jobs) + platform_spec({
217-
"linux:amd64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE),
218-
"linux:aarch64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE),
219-
"darwin:aarch64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE),
220-
"darwin:amd64:jdk-latest" : daily + t("02:00:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
221-
"windows:amd64:jdk21" : daily + t("02:00:00") + require(GPY_JVM21_STANDALONE) + batches(2),
222-
"linux:amd64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
223-
"linux:aarch64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
224-
"darwin:aarch64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
225-
"windows:amd64:jdk-latest" : post_merge + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST) + batches(2),
226-
}),
227-
"python-junit-vfsutils": gpgate + platform_spec(no_jobs) + platform_spec({
228-
"linux:amd64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE),
229-
"linux:aarch64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE),
230-
"darwin:aarch64:jdk-latest" : tier3 + require(GPY_JVM_STANDALONE),
231-
"windows:amd64:jdk-latest" : post_merge + t("03:59:00") + require(GPY_JVM_STANDALONE),
232-
}),
233-
"python-unittest-maven-plugin-long-run": gpgate_maven + platform_spec(no_jobs) + platform_spec({
234-
"linux:amd64:jdk-latest" : post_merge + t("02:30:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
235-
"linux:aarch64:jdk-latest" : post_merge + t("02:30:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
236-
"darwin:aarch64:jdk-latest" : post_merge + t("02:30:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST),
237-
"windows:amd64:jdk-latest" : post_merge + t("02:30:00") + require(GPY_JVM_STANDALONE) + require(GRAAL_JDK_LATEST) + batches(2),
238-
}),
239199
"python-junit": gpgate + platform_spec(no_jobs) + platform_spec({
240200
"linux:amd64:jdk21" : daily + t("01:00:00"),
241201
"linux:aarch64:jdk21" : daily + t("01:30:00"),

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2018, 2024, Oracle and/or its affiliates.
1+
/* Copyright (c) 2018, 2025, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2020 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -755,13 +755,12 @@ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
755755
#define PySequence_Fast_GET_ITEM(o, i)\
756756
(PyList_Check(o) ? PyList_GET_ITEM((o), (i)) : PyTuple_GET_ITEM((o), (i)))
757757

758-
// GraalPy-specific
759-
PyAPI_FUNC(PyObject **) PyTruffleSequence_Fast_ITEMS(PyObject *o);
760-
761758
/* Return a pointer to the underlying item array for
762759
an object returned by PySequence_Fast */
763760
// GraalPy change
764-
#define PySequence_Fast_ITEMS(sf) PyTruffleSequence_Fast_ITEMS(sf)
761+
#define PySequence_Fast_ITEMS(sf) \
762+
(PyList_Check(sf) ? GraalPyList_ITEMS(_PyObject_CAST((sf))) \
763+
: GraalPyTuple_ITEMS(_PyObject_CAST((sf))))
765764

766765
/* Return the number of occurrences on value on 'o', that is, return
767766
the number of keys for which o[key] == value.

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2020, 2024, Oracle and/or its affiliates.
1+
/* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2020 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -165,13 +165,10 @@ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
165165

166166
/* === Sequence protocol ================================================ */
167167

168-
// GraalPy-specific
169-
PyAPI_FUNC(PyObject*) PyTruffleSequence_ITEM(PyObject* obj, Py_ssize_t index);
170-
171168
/* Assume tp_as_sequence and sq_item exist and that 'i' does not
172169
need to be corrected for a negative index. */
173-
// GraalPy change
174-
#define PySequence_ITEM(o, i) PyTruffleSequence_ITEM((o), (i))
170+
#define PySequence_ITEM(o, i)\
171+
( Py_TYPE(o)->tp_as_sequence->sq_item((o), (i)) )
175172

176173
#define PY_ITERSEARCH_COUNT 1
177174
#define PY_ITERSEARCH_INDEX 2

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2022, 2024, Oracle and/or its affiliates.
1+
/* Copyright (c) 2022, 2025, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2022 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -374,9 +374,9 @@ PyAPI_FUNC(PyObject *) PyCode_GetCellvars(PyCodeObject *code);
374374
/* Equivalent to getattr(code, 'co_freevars') in Python. */
375375
PyAPI_FUNC(PyObject *) PyCode_GetFreevars(PyCodeObject *code);
376376

377-
/* GraalPy specific to avoid direct field access. Used by (at least) pytorch */
378-
PyAPI_FUNC(PyObject*) PyCode_GetFileName(PyCodeObject* code);
379-
PyAPI_FUNC(PyObject*) PyCode_GetName(PyCodeObject* code);
377+
/* GraalPy public API to avoid direct field access. Used by (at least) pytorch patch */
378+
PyAPI_FUNC(PyObject*) GraalPyCode_GetFileName(PyCodeObject* code);
379+
PyAPI_FUNC(PyObject*) GraalPyCode_GetName(PyCodeObject* code);
380380

381381
typedef enum _PyCodeLocationInfoKind {
382382
/* short forms are 0 to 9 */

graalpython/com.oracle.graal.python.cext/include/cpython/descrobject.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, Oracle and/or its affiliates.
1+
/* Copyright (c) 2023, 2025, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2023 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -37,8 +37,8 @@ typedef struct {
3737

3838
#define PyDescr_COMMON PyDescrObject d_common
3939

40-
#define PyDescr_TYPE(x) PyDescrObject_GetType((PyObject*)(x))
41-
#define PyDescr_NAME(x) PyDescrObject_GetName((PyObject*)(x))
40+
#define PyDescr_TYPE(x) GraalPyDescrObject_GetType((PyObject*)(x))
41+
#define PyDescr_NAME(x) GraalPyDescrObject_GetName((PyObject*)(x))
4242

4343
typedef struct {
4444
PyDescr_COMMON;
@@ -67,3 +67,12 @@ PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type;
6767
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
6868
struct wrapperbase *, void *);
6969
PyAPI_FUNC(int) PyDescr_IsData(PyObject *);
70+
71+
// GraalPy public API to replace struct accessors
72+
PyAPI_FUNC(PyMethodDef*) GraalPyMethodDescrObject_GetMethod(PyObject*);
73+
PyAPI_FUNC(PyTypeObject*) GraalPyDescrObject_GetType(PyObject*);
74+
PyAPI_FUNC(PyObject*) GraalPyDescrObject_GetName(PyObject*);
75+
// Deprecated aliases kept for current versions of Cython
76+
// Remove in 27.0
77+
#define PyDescrObject_GetType GraalPyDescrObject_GetType
78+
#define PyMethodDescrObject_GetMethod GraalPyMethodDescrObject_GetMethod

graalpython/com.oracle.graal.python.cext/include/cpython/floatobject.h

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,17 @@ typedef struct {
1212
double ob_fval;
1313
} PyFloatObject;
1414

15-
// GraalPy addition
16-
typedef struct {
17-
GraalPyObject ob_base;
18-
double ob_fval;
19-
} GraalPyFloatObject;
20-
2115
#define _PyFloat_CAST(op) \
2216
(assert(PyFloat_Check(op)), _Py_CAST(PyFloatObject*, op))
2317

18+
// GraalPy public API
19+
PyAPI_FUNC(double) GraalPyFloat_AS_DOUBLE(PyObject* op);
20+
2421
// Static inline version of PyFloat_AsDouble() trading safety for speed.
2522
// It doesn't check if op is a double object.
2623
static inline double PyFloat_AS_DOUBLE(PyObject *op) {
27-
#if 0 // GraalPy change
28-
return _PyFloat_CAST(op)->ob_fval;
29-
#else // GraalPy change
30-
if (points_to_py_handle_space(op)) {
31-
return ((GraalPyFloatObject*) pointer_to_stub(op))->ob_fval;
32-
} else {
33-
return _PyFloat_CAST(op)->ob_fval;
34-
}
35-
#endif // GraalPy change
24+
// GraalPy change
25+
return GraalPyFloat_AS_DOUBLE(op);
3626
}
3727
#define PyFloat_AS_DOUBLE(op) PyFloat_AS_DOUBLE(_PyObject_CAST(op))
3828

graalpython/com.oracle.graal.python.cext/include/cpython/frameobject.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2022, 2023, Oracle and/or its affiliates.
1+
/* Copyright (c) 2022, 2025, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2022 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -33,4 +33,7 @@ PyAPI_FUNC(int) _PyFrame_IsEntryFrame(PyFrameObject *frame);
3333
PyAPI_FUNC(int) PyFrame_FastToLocalsWithError(PyFrameObject *f);
3434
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
3535

36-
PyAPI_FUNC(void) _PyFrame_SetLineNumber(PyFrameObject *, int);
36+
// GraalPy public API to avoid struct access
37+
PyAPI_FUNC(void) GraalPyFrame_SetLineNumber(PyFrameObject *, int);
38+
// Deprecated alias used by current Cython, remove in 27.0
39+
#define _PyFrame_SetLineNumber GraalPyFrame_SetLineNumber

graalpython/com.oracle.graal.python.cext/include/cpython/listobject.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2022, 2024, Oracle and/or its affiliates.
1+
/* Copyright (c) 2022, 2025, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2022 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -43,12 +43,13 @@ static inline Py_ssize_t PyList_GET_SIZE(PyObject *op) {
4343

4444
#define PyList_GET_ITEM(op, index) (PyList_GetItem((PyObject*)(op), (index)))
4545

46-
// GraalPy-specific
47-
PyAPI_FUNC(PyObject **) PyTruffleList_GetItems(PyObject *op);
46+
// GraalPy public API to replace direct access to ob_item
47+
PyAPI_FUNC(PyObject **) GraalPyList_ITEMS(PyObject *op);
48+
PyAPI_FUNC(void) GraalPyList_SET_ITEM(PyObject* a, Py_ssize_t b, PyObject* c);
4849

4950
static inline void
5051
PyList_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
51-
PyTruffleList_GetItems(op)[index] = value;
52+
GraalPyList_SET_ITEM(op, index, value);
5253
}
5354
#define PyList_SET_ITEM(op, index, value) \
5455
PyList_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))

graalpython/com.oracle.graal.python.cext/include/cpython/methodobject.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2022, 2024, Oracle and/or its affiliates.
1+
/* Copyright (c) 2022, 2025, Oracle and/or its affiliates.
22
* Copyright (C) 1996-2022 Python Software Foundation
33
*
44
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
@@ -39,6 +39,14 @@ PyAPI_DATA(PyTypeObject) PyCMethod_Type;
3939
#define PyCMethod_CheckExact(op) Py_IS_TYPE((op), &PyCMethod_Type)
4040
#define PyCMethod_Check(op) PyObject_TypeCheck((op), &PyCMethod_Type)
4141

42+
// GraalPy public API functions to replace struct access. Return borrowed references
43+
PyAPI_FUNC(PyTypeObject *) GraalPyCMethod_GetClass(PyObject *func);
44+
PyAPI_FUNC(const char*) GraalPyCFunction_GetDoc(PyObject *func);
45+
PyAPI_FUNC(void) GraalPyCFunction_SetDoc(PyObject *func, const char *doc);
46+
PyAPI_FUNC(PyObject*) GraalPyCFunction_GetModule(PyObject* a);
47+
PyAPI_FUNC(PyMethodDef*) GraalPyCFunction_GetMethodDef(PyObject* a);
48+
PyAPI_FUNC(void) GraalPyCFunction_SetModule(PyObject* a, PyObject* b);
49+
PyAPI_FUNC(void) GraalPyCFunction_SetMethodDef(PyObject* a, PyMethodDef *b);
4250

4351
/* Static inline functions for direct access to these values.
4452
Type checks are *not* done, so use with care. */
@@ -58,15 +66,6 @@ static inline int PyCFunction_GET_FLAGS(PyObject *func) {
5866
#define PyCFunction_GET_FLAGS(func) PyCFunction_GET_FLAGS(_PyObject_CAST(func))
5967

6068
static inline PyTypeObject* PyCFunction_GET_CLASS(PyObject *func_obj) {
61-
return PyCMethod_GetClass(func_obj);
69+
return GraalPyCMethod_GetClass(func_obj);
6270
}
6371
#define PyCFunction_GET_CLASS(func) PyCFunction_GET_CLASS(_PyObject_CAST(func))
64-
65-
/*
66-
* XXX These functions are GraalPy-only. We need them to replace field access.
67-
* Currently inserted by our autopatch_capi.py
68-
*/
69-
PyAPI_FUNC(PyObject*) _PyCFunction_GetModule(PyObject* a);
70-
PyAPI_FUNC(PyMethodDef*) _PyCFunction_GetMethodDef(PyObject* a);
71-
PyAPI_FUNC(void) _PyCFunction_SetModule(PyObject* a, PyObject* b);
72-
PyAPI_FUNC(void) _PyCFunction_SetMethodDef(PyObject* a, PyMethodDef *b);

0 commit comments

Comments
 (0)