atom_t may point to static memory or garbage-collectable memory if I understand correctly.
Other foreign interface types could also list:
As of SWI-Prolog 7.3.12, the arity of terms has changed from int to size_t.
It's a bit weird to see
arity labeled as of type
size_t but why not. 🤔
"Type size_t is a s typedef that's an alias for some unsigned integer type, typically unsigned int or unsigned long , but possibly even unsigned long long . Each Standard C implementation is supposed to choose the unsigned integer that's big enough–but no bigger than needed–to represent the size of the largest possible object on the target platform."
There needs to be a discussion of the stacks and memory regions.
The page https://en.wikipedia.org/wiki/Warren_Abstract_Machine has some very light pointers.
It may be like the following:
- The "global stack" (aka the heap)
- Rolled back to an earlier version at backtracking.
- "Compounds, large integers, floats and strings are all allocated on the global stack."
- "Foreign frames" (aka "foreign contexts"?) are created in this memory area.
- The "local stack"
- For environment frames and choice-points (it is unclear what data structure corresponds to "choice point")
- New variables are allocated here (i.e. the "holes" or "unbound logical variables"; these correspond to term_t instances referencing nothing)
- This may be the same as the "Environment stack" containing variables.
- The "trail" to record which variables bindings ought to be undone on backtracking.
- There is also something called "Runtime stacks of the calling thread" as in PL_check_stats()