RE: pypy-dev Digest, Vol 13, Issue 2
Rocco Moretti wrote:
How would the interface between the two work if the hand translated sections differ from the C version?
I can give general answers from past experience.
Simplest example is basic types. A Python version would presumably be represented as a class with member functions. But the C code uses calls to accessor functions. How could we redirect the automatically generated code to call member functions as opposed to free floating functions?
One answer: provide such functions, which call the member functions as needed.
A more difficult problem lies when we we start to reorganize the object/structure internals. Good case of this is the frame object. The C version has an array with multiple pointers to internal objects. Once you reorganize the internals, how do you tell the C->Python translator that f_stacktop isn't a PyObject pointer anymore, but an index off of another list?
If the class was providing public attributes, you may not want to change their meaning. f_stacktop could provide an accessor for the old representation. The new representation would be in _f_stacktop or something. -Jerry
participants (1)
-
Gerald S. Williams