MemMap

public final class MemMap

A map for a set of variables that share a common location in memory, e.g. through a Fortran COMMON or EQUIVALENCE declaration, a BIND(C), …

Fields

boundaries

public TapList<AlignmentBoundary> boundaries

The (hatted) sequence of boundaries that partition this shared location

name

public String name

A name to identify the shared location, e.g. the COMMON name

Constructors

MemMap

public MemMap(String commonName)

Methods

absorb

public void absorb(MemMap otherMap, int shift, MemoryMaps otherMaps, MemoryMaps thisMaps)

Merge “otherMap” into this MemMap. Update the mapAccesses accordingly.

allocateZones

public void allocateZones(ZoneAllocator zoneAllocator, Unit declarationUnit)

Use the given zoneAllocator to allocate zones for all variables in this MemMap. TODO: Also accumulate into callGraph, for each Unit, the waiting lists of ZoneInfo of this MemMap that the Unit may see (through its ImportsSymbolTable)

getLastOffset

public int getLastOffset(ToBool toInfiniteLastOffset)

Return the offset of the end of this MemMap. Sets true in “toInfiniteLastOffset” if the end is at some indefinite offset.

insertVariableAt

public void insertVariableAt(int offset, int varSize, VariableDecl variableDecl, SymbolTable declSymbolTable, MemoryMaps thisMaps)

Insert “variableDecl”, of size “varSize”, at the given starting “offset” into this MemMap. Update the mapAccesses accordingly.

isActiveRegion

public boolean isActiveRegion(int startOffset, int endOffset, boolean infiniteEndOffset)
Returns

true if at least a part of the region from startOffset to endOffset/infiniteEndOffset(excluded) is marked as active

removeVariableFrom

public void removeVariableFrom(VariableDecl varDecl, MemoryMaps thisMaps)

Remove the given VariableDecl from this MemMap, possibly leaving a hole with no variable.

setActiveRegion

public void setActiveRegion(int startOffset, int endOffset, boolean infiniteEndOffset)

Set boundaries in this MemMap to represent region from startOffset to endOffset/infiniteEndOffset, if these boundaries are not already present. Sets to true the “active” field of all boundaries from startOffset to endOffset(excluded).

toString

public String toString()

touchesSymbolTable

protected boolean touchesSymbolTable(SymbolTable targetSymbolTable)
Returns

true iff this MemMap concerns at least one variable which is declared by the scope “targetSymbolTable”