Skip to content

Commit b99223c

Browse files
committed
Remove 'force-to-native' workaround.
1 parent 309b0fe commit b99223c

File tree

1 file changed

+0
-16
lines changed
  • graalpython/com.oracle.graal.python.cext/src

1 file changed

+0
-16
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,9 @@
4141
#include "capi.h"
4242

4343

44-
MUST_INLINE static void force_to_native(void* obj) {
45-
if (polyglot_is_value(obj)) {
46-
polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_Set_Ptr", obj, truffle_deref_handle_for_managed(obj));
47-
}
48-
}
49-
5044
static void initialize_type_structure(PyTypeObject* structure, const char* typname, void* typeid) {
5145
PyTypeObject* ptype = (PyTypeObject*)UPCALL_CEXT_O("PyTruffle_Type", polyglot_from_string(typname, SRC_CS));
5246

53-
// We eagerly create a native pointer for all builtin types. This is necessary for pointer comparisons to work correctly.
54-
// TODO Remove this as soon as this is properly supported.
55-
force_to_native(ptype);
56-
5747
// Store the Sulong struct type id to be used for instances of this class
5848
polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_Set_SulongType", ptype, typeid);
5949

@@ -125,30 +115,24 @@ POLYGLOT_DECLARE_TYPE(PyObjectPtr);
125115
static void initialize_globals() {
126116
// None
127117
PyObject* jnone = UPCALL_CEXT_O("Py_None");
128-
force_to_native(jnone);
129118
truffle_assign_managed(&_Py_NoneStruct, jnone);
130119

131120
// NotImplemented
132121
void *jnotimpl = UPCALL_CEXT_O("Py_NotImplemented");
133-
force_to_native(jnotimpl);
134122
truffle_assign_managed(&_Py_NotImplementedStruct, jnotimpl);
135123

136124
// Ellipsis
137125
void *jellipsis = UPCALL_CEXT_O("Py_Ellipsis");
138-
force_to_native(jellipsis);
139126
truffle_assign_managed(&_Py_EllipsisObject, jellipsis);
140127

141128
// True, False
142129
void *jtrue = UPCALL_CEXT_O("Py_True");
143-
force_to_native(jtrue);
144130
truffle_assign_managed(&_Py_TrueStruct, jtrue);
145131
void *jfalse = UPCALL_CEXT_O("Py_False");
146-
force_to_native(jfalse);
147132
truffle_assign_managed(&_Py_FalseStruct, jfalse);
148133

149134
// error marker
150135
void *jerrormarker = UPCALL_CEXT_PTR("Py_ErrorHandler");
151-
force_to_native(jerrormarker);
152136
truffle_assign_managed(&marker_struct, jerrormarker);
153137
}
154138

0 commit comments

Comments
 (0)