Skip to content

Commit 05bc6c1

Browse files
committed
Update HPy inlined files: 51c0baa
1 parent 58241d6 commit 05bc6c1

File tree

25 files changed

+772
-317
lines changed

25 files changed

+772
-317
lines changed

graalpython/com.oracle.graal.python.cext/include/common/autogen_hpyslot.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ typedef enum {
4343
HPy_nb_true_divide = 37,
4444
HPy_nb_xor = 38,
4545
HPy_sq_item = 44,
46+
HPy_sq_length = 45,
4647
HPy_tp_init = 60,
4748
HPy_tp_new = 65,
4849
HPy_tp_repr = 66,
@@ -85,6 +86,7 @@ typedef enum {
8586
#define _HPySlot_SIG__HPy_nb_true_divide HPyFunc_BINARYFUNC
8687
#define _HPySlot_SIG__HPy_nb_xor HPyFunc_BINARYFUNC
8788
#define _HPySlot_SIG__HPy_sq_item HPyFunc_SSIZEARGFUNC
89+
#define _HPySlot_SIG__HPy_sq_length HPyFunc_LENFUNC
8890
#define _HPySlot_SIG__HPy_tp_init HPyFunc_INITPROC
8991
#define _HPySlot_SIG__HPy_tp_new HPyFunc_KEYWORDS
9092
#define _HPySlot_SIG__HPy_tp_repr HPyFunc_REPRFUNC

graalpython/com.oracle.graal.python.cext/include/common/hpydef.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ typedef struct {
126126
};
127127

128128

129-
#define HPyDef_METH(SYM, NAME, IMPL, SIG) \
129+
#define HPyDef_METH(SYM, NAME, IMPL, SIG, ...) \
130130
HPyFunc_DECLARE(IMPL, SIG); \
131131
HPyFunc_TRAMPOLINE(SYM##_trampoline, IMPL, SIG); \
132132
HPyDef SYM = { \
@@ -135,7 +135,8 @@ typedef struct {
135135
.name = NAME, \
136136
.impl = IMPL, \
137137
.cpy_trampoline = SYM##_trampoline, \
138-
.signature = SIG \
138+
.signature = SIG, \
139+
__VA_ARGS__ \
139140
} \
140141
};
141142

graalpython/com.oracle.graal.python.cext/include/common/runtime.h

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef HPY_COMMON_RUNTIME_CTX_TRACKER_H
2+
#define HPY_COMMON_RUNTIME_CTX_TRACKER_H
3+
4+
#include "hpy.h"
5+
6+
_HPy_HIDDEN HPyTracker
7+
ctx_Tracker_New(HPyContext ctx, HPy_ssize_t size);
8+
9+
_HPy_HIDDEN int
10+
ctx_Tracker_Add(HPyContext ctx, HPyTracker ht, HPy h);
11+
12+
_HPy_HIDDEN void
13+
ctx_Tracker_RemoveAll(HPyContext ctx, HPyTracker ht);
14+
15+
_HPy_HIDDEN void
16+
ctx_Tracker_Free(HPyContext ctx, HPyTracker ht);
17+
18+
#endif /* HPY_COMMON_RUNTIME_CTX_TRACKER_H */

graalpython/com.oracle.graal.python.cext/include/common/typeslots.h

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
// automatically generated by setup.py:get_scm_config()
3+
#define HPY_VERSION "0.1.dev618+g2f53dbf"
4+
#define HPY_GIT_REVISION "2f53dbf"

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
typedef struct { PyObject *_o; } HPy;
3333
typedef struct { Py_ssize_t _lst; } HPyListBuilder;
3434
typedef struct { Py_ssize_t _tup; } HPyTupleBuilder;
35+
typedef struct { void *_o; } HPyTracker;
3536
typedef Py_ssize_t HPy_ssize_t;
3637
typedef Py_hash_t HPy_hash_t;
3738

@@ -141,6 +142,7 @@ HPy_AsPyObject(HPyContext ctx, HPy h)
141142
#include "../common/runtime/ctx_module.h"
142143
#include "../common/runtime/ctx_type.h"
143144
#include "../common/runtime/ctx_listbuilder.h"
145+
#include "../common/runtime/ctx_tracker.h"
144146
#include "../common/runtime/ctx_tuple.h"
145147
#include "../common/runtime/ctx_tuplebuilder.h"
146148

@@ -236,4 +238,28 @@ HPyTuple_FromArray(HPyContext ctx, HPy items[], HPy_ssize_t n)
236238
return ctx_Tuple_FromArray(ctx, items, n);
237239
}
238240

241+
HPyAPI_FUNC(HPyTracker)
242+
HPyTracker_New(HPyContext ctx, HPy_ssize_t size)
243+
{
244+
return ctx_Tracker_New(ctx, size);
245+
}
246+
247+
HPyAPI_FUNC(int)
248+
HPyTracker_Add(HPyContext ctx, HPyTracker ht, HPy h)
249+
{
250+
return ctx_Tracker_Add(ctx, ht, h);
251+
}
252+
253+
HPyAPI_FUNC(void)
254+
HPyTracker_RemoveAll(HPyContext ctx, HPyTracker ht)
255+
{
256+
ctx_Tracker_RemoveAll(ctx, ht);
257+
}
258+
259+
HPyAPI_FUNC(void)
260+
HPyTracker_Free(HPyContext ctx, HPyTracker ht)
261+
{
262+
ctx_Tracker_Free(ctx, ht);
263+
}
264+
239265
#endif /* !HPy_CPYTHON_H */

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

Lines changed: 0 additions & 65 deletions
This file was deleted.

graalpython/com.oracle.graal.python.cext/include/universal/autogen_ctx.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,8 @@ struct _HPyContext_s {
126126
void (*ctx_TupleBuilder_Set)(HPyContext ctx, HPyTupleBuilder builder, HPy_ssize_t index, HPy h_item);
127127
HPy (*ctx_TupleBuilder_Build)(HPyContext ctx, HPyTupleBuilder builder);
128128
void (*ctx_TupleBuilder_Cancel)(HPyContext ctx, HPyTupleBuilder builder);
129+
HPyTracker (*ctx_Tracker_New)(HPyContext ctx, HPy_ssize_t size);
130+
int (*ctx_Tracker_Add)(HPyContext ctx, HPyTracker ht, HPy h);
131+
void (*ctx_Tracker_RemoveAll)(HPyContext ctx, HPyTracker ht);
132+
void (*ctx_Tracker_Free)(HPyContext ctx, HPyTracker ht);
129133
};

graalpython/com.oracle.graal.python.cext/include/universal/autogen_trampolines.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,19 @@ static inline void HPyTupleBuilder_Cancel(HPyContext ctx, HPyTupleBuilder builde
420420
ctx->ctx_TupleBuilder_Cancel ( ctx, builder );
421421
}
422422

423+
static inline HPyTracker HPyTracker_New(HPyContext ctx, HPy_ssize_t size) {
424+
return ctx->ctx_Tracker_New ( ctx, size );
425+
}
426+
427+
static inline int HPyTracker_Add(HPyContext ctx, HPyTracker ht, HPy h) {
428+
return ctx->ctx_Tracker_Add ( ctx, ht, h );
429+
}
430+
431+
static inline void HPyTracker_RemoveAll(HPyContext ctx, HPyTracker ht) {
432+
ctx->ctx_Tracker_RemoveAll ( ctx, ht );
433+
}
434+
435+
static inline void HPyTracker_Free(HPyContext ctx, HPyTracker ht) {
436+
ctx->ctx_Tracker_Free ( ctx, ht );
437+
}
438+

0 commit comments

Comments
 (0)