Pre-translation step performed by ATJ: single-threadedness analysis of Java primitive arrays.
In order to generate Java code that correctly destructively updates (primitive) arrays, we perform a stobj-like analysis to establish that arrays are treated single-threadedly in the ACL2 functions that are translated to Java.
Unlike the other pre-translation steps, this analysis does not modify the ACL2 function bodies. However, this analysis is best carried out between the type annotation pre-translation step and the variable reuse pre-translation step. The reason why this analysis should be carried out after the type annotation step is that we need the type annotations to determine where the arrays are, and subject them to the analysis. The reason why this analysis should be carried out before the variable reuse step is that this step may mark and differentiate array variables that the analysis needs to ensure that they denote the same array so that the array is treated single-threadedly.
This array analysis is similar to ACL2's stobj analysis in the sense that it imposes the same draconian constraints on the use of arrays, namely that the same name is consistently used for each array, that functions with array inputs are passed those names, that every array possibly modified by a function is bound to the same name and is also returned by the surrounding function, and so on.
However, this array analysis also differs from the stobj analysis,
because stobjs are global variables
whose names must be consistently used by all the functions
that manipulate them.
In contrast, (representations of) Java arrays in ACL2 functions
do not have global names, but their names are local to the functions.
Consider a function
Another complication of this array analysis,
which does not happen with stobjs,
is that some functions may create new arrays (directly or indirectly).
These are arrays are not passed as inputs, but returned as outputs afresh.
As such, they do not correspond to any inputs, so there is no name mapping.
This is why
atj-main-function-type and atj-other-function-type
allow unnamed array outputs,
whose meaning is that they must be newly created arrays;
the array analysis checks that.
If