Skip to content

Commit 37505ca

Browse files
committed
Make GraalPyObject smaller; introduce field ob_size to GraalPyVarObject
1 parent 991989e commit 37505ca

File tree

3 files changed

+4
-2
lines changed
  • graalpython
    • com.oracle.graal.python.cext/src
    • com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/structs

3 files changed

+4
-2
lines changed

graalpython/com.oracle.graal.python.cext/src/capi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,13 @@ typedef struct {
113113
} propertyobject;
114114

115115
typedef struct {
116-
PyObject_VAR_HEAD
116+
PyObject_HEAD
117117
int32_t handle_table_index;
118118
} GraalPyObject;
119119

120120
typedef struct {
121121
GraalPyObject ob_base;
122+
Py_ssize_t ob_size;
122123
PyObject **ob_item;
123124
} GraalPyVarObject;
124125

graalpython/com.oracle.graal.python.cext/src/object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ Py_ssize_t PyTruffle_SIZE(PyObject *ob) {
867867
* PyVarObject in future.
868868
*/
869869
if (ptr->ob_type == &PyTuple_Type) {
870-
res = ((PyVarObject *) ptr)->ob_size;
870+
res = ((GraalPyVarObject *) ptr)->ob_size;
871871
#ifndef NDEBUG
872872
if (PyTruffle_Debug_CAPI() && GraalPy_get_PyVarObject_ob_size(a) != res)
873873
{

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/structs/CFields.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public enum CFields {
116116
PyVarObject__ob_size(Py_ssize_t),
117117

118118
GraalPyObject__handle_table_index(Int),
119+
GraalPyVarObject__ob_size(Py_ssize_t),
119120
GraalPyVarObject__ob_item(PyObjectPtr),
120121

121122
PyModuleDef__m_name(ConstCharPtr),

0 commit comments

Comments
 (0)