The following line in this comment in pl-comp.c has me confused.
This is the case, for predicates for which the body is defined from another module as the head and the predicate is not a meta-predicate.
It has me thinking the head of a predicate is in one module and the body is another, but I don’t see how that can be right.
Here is the entire comment:
Now compile the body. After the I_ENTER, we check whether we need to insert an I_CONTEXT instruction to change the context. This is the case, for predicates for which the body is defined from another module as the head and the predicate is not a meta-predicate. In principle, we could delay this until we decided there may be a meta-call, but this will harm automatic update if a predicate is later defined as meta-predicate.
Not that this is also the case for predicates that have previous clauses that have an I_CONTEXT because we need to reset the context.