Skip to content
Calum Freeman edited this page Sep 12, 2018 · 5 revisions

This may or may not be useful to future developers, however, these are words/concepts that appeared confusing at some point or other(even if some are actually simple once understood).

Patterns of linking

There are 3(or 4) ways in which a C API PyObject can be linked to a Jython PyObject conceptually. The details of adding types are given on this page.

C wraps java

section 4.1 https://arxiv.org/pdf/1404.6390.pdf

mirroring

section 4.2 https://arxiv.org/pdf/1404.6390.pdf

java wraps C

section 4.3 https://arxiv.org/pdf/1404.6390.pdf

partial mirroring

Partial mirroring involves mirroring part of an object while delegating as much to Jython as possible. This involves keeping some part of the memory in sync, to do this all memory up to and including the part that is being sync'ed must be allocated and included in truncate_trailing in the builtintypes map.

Object types

jobject

This is effectively a pointer to a java object, it is helpful to read a guide on JNI to understand this. It is distinct from primitive types (eg jint) or jstring.

Jython PyObject

This is the Jython implementation of a PyObject, when discussing C code, the "Jython PyObject" is of type jobject in C. The jobject points to the java side object of type PyDictionary or other subclass of org.python.core.PyObject

PyObject

This is the object that the C API expects to have available.

JyObject

This is explained in section 4.4 of https://arxiv.org/pdf/1404.6390.pdf and in this issue Essentially, it is the object used to convert between Jython PyObjects and PyObjects it contains the jobject for the relevant Jython PyObject, the relevant PyObject and some meta information.

Delegate (to Jython)

This often just means using JNI to call the relevant Jython method that will perform the expected function on the right object. In the case of objects, delegating basically means all of the C methods just call into Jython via JNI and the object's data is stored in Jython. Basically there is only a façade in C which calls into Jython where everything really is.

misc

GIL

This is the global interpreter lock, it is to do with how python handles threading.