|
41 | 41 | #include "capi.h"
|
42 | 42 |
|
43 | 43 |
|
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 |
| - |
50 | 44 | static void initialize_type_structure(PyTypeObject* structure, const char* typname, void* typeid) {
|
51 | 45 | PyTypeObject* ptype = (PyTypeObject*)UPCALL_CEXT_O("PyTruffle_Type", polyglot_from_string(typname, SRC_CS));
|
52 | 46 |
|
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 |
| - |
57 | 47 | // Store the Sulong struct type id to be used for instances of this class
|
58 | 48 | polyglot_invoke(PY_TRUFFLE_CEXT, "PyTruffle_Set_SulongType", ptype, typeid);
|
59 | 49 |
|
@@ -125,30 +115,24 @@ POLYGLOT_DECLARE_TYPE(PyObjectPtr);
|
125 | 115 | static void initialize_globals() {
|
126 | 116 | // None
|
127 | 117 | PyObject* jnone = UPCALL_CEXT_O("Py_None");
|
128 |
| - force_to_native(jnone); |
129 | 118 | truffle_assign_managed(&_Py_NoneStruct, jnone);
|
130 | 119 |
|
131 | 120 | // NotImplemented
|
132 | 121 | void *jnotimpl = UPCALL_CEXT_O("Py_NotImplemented");
|
133 |
| - force_to_native(jnotimpl); |
134 | 122 | truffle_assign_managed(&_Py_NotImplementedStruct, jnotimpl);
|
135 | 123 |
|
136 | 124 | // Ellipsis
|
137 | 125 | void *jellipsis = UPCALL_CEXT_O("Py_Ellipsis");
|
138 |
| - force_to_native(jellipsis); |
139 | 126 | truffle_assign_managed(&_Py_EllipsisObject, jellipsis);
|
140 | 127 |
|
141 | 128 | // True, False
|
142 | 129 | void *jtrue = UPCALL_CEXT_O("Py_True");
|
143 |
| - force_to_native(jtrue); |
144 | 130 | truffle_assign_managed(&_Py_TrueStruct, jtrue);
|
145 | 131 | void *jfalse = UPCALL_CEXT_O("Py_False");
|
146 |
| - force_to_native(jfalse); |
147 | 132 | truffle_assign_managed(&_Py_FalseStruct, jfalse);
|
148 | 133 |
|
149 | 134 | // error marker
|
150 | 135 | void *jerrormarker = UPCALL_CEXT_PTR("Py_ErrorHandler");
|
151 |
| - force_to_native(jerrormarker); |
152 | 136 | truffle_assign_managed(&marker_struct, jerrormarker);
|
153 | 137 | }
|
154 | 138 |
|
|
0 commit comments