Skip to content

Revised Array Modelling & Memory Model

Frederik Hennig requested to merge fhennig/array-modelling into v2.0-dev

This MR revises the way C arrays, as well as heap memory and pointers, are modelled and translated by pystencils.

Changes concerning arrays:

  • Change PsArrayType to receive a fixed, n-dimensional, nonempty shape, and a non-const, non-array element type
  • Change PsSubscript to only work on arrays via an n-dimensional index tuple
  • Change PsArrayInitList to an n-dimensional matrix of expressions
  • Add contextual and default typing for array declarations and inline array literals

Changes concerning pointers and memory:

  • Remove PsDeref
  • Introduce PsMemAcc to access memory by pointers
  • Assume all non-field raw pointers to be aliases of each other, adapt loop-invariant code motion accordingly
  • Introduce mem_acc front-end function for accessing memory by pointer in SymPy

Changes to the typifier:

  • Remove constness handling from the type context; only work with non-const data types while processing expressions
  • In PsAssignment, use a seperate algorithm to determine the mutated memory object and its constness

Merge request reports