ZoneInfo

public final class ZoneInfo

Memory zone information.

Fields

accessIndexes

public TapList<TapPair<Tree, Tree>> accessIndexes

When this zone contains arrays, contains the list of their dimensions expressions.

accessTree

public Tree accessTree

The typical expression that accesses this zone, starting from some visible variable (or common, or global…) name. Having an access tree does not mean the zone is accessible: it may still be Hidden!

ambiguousWithoutIndices

public boolean ambiguousWithoutIndices

When true, a single variable name is not enough to designate this ZoneInfo, and therefore the name must be shown with indices.

commonName

public String commonName

When in a COMMON, name of the common.

declarationUnit

public Unit declarationUnit

description

public String description

A textual description of this zone, used e.g. in messages, comments, and logs and that should have an acceptable meaning even if the zone is Hidden.

endOffset

public int endOffset

from

public ZoneInfo from

When this ZoneInfo is a copy of an original ZoneInfo, this holds the original ZoneInfo. This happens e.g. when a ZoneInfo is a copy built while copying a SymbolTable.

index

public int index

for PARAMETER: index of the parameter (from 1 up), for RESULT: 0 for GLOBAL: index of the (declared) zone Otherwise undefined.

infiniteEndOffset

public boolean infiniteEndOffset

intZoneNb

public int intZoneNb

The reduced zone number of this int-type zoneInfo.

isAllocatable

public boolean isAllocatable

True iff this ZoneInfo is a pointer to a location built with allocate, and therefore a pointer which cannot be redirected elsewhere (except by a deallocate() followed by a new allocate()).

isChannelOrIO

public boolean isChannelOrIO

True when this is either an MPI channel or an IO stream zone

isHidden

public boolean isHidden

True when this ZoneInfo is about a memory location that cannot be accessed from the current scope, i.e. the SymbolTable from where this ZoneInfo was searched for, given its rank. This can be the case for zones stored at the root SymbolTables or stored in the zone arrays of the importsSymbolTable’s.

multiple

public boolean multiple

When true, this zone represents several zones, and therefore an access to it is never total

ownerSymbolDecl

public SymbolDecl ownerSymbolDecl

One of the SymbolDecl’s that owns this zone.

ptrZoneNb

public int ptrZoneNb

The reduced zone number of this pointer-type zoneInfo.

realZoneNb

public int realZoneNb

The reduced zone number of this real-type zoneInfo.

rebased

public boolean rebased

Will become true as soon as there exists a pointer that may point to this zone and that may be restored by a call to poppointer() while this zone has beed relocated, therefore requiring a call to ADMM_rebase. In that case, then this zone must be registered at the time when it is allocated/declared by a call to ADMM_register and unregistered when it is deallocated/out-of-scope by a call to ADMM_unregister.

rebasedDiff

public boolean rebasedDiff

Same as rebased, but concerning the adjoint differentiated zone of this zone.

relocated

public boolean relocated

Will become true if at some point in execution of the adjoint code, this zone is deallocated or falls out of scope, and this execution point is not immediately followed by its reverse sweep (i.e. deallocation is diff-live). In that case this zone’s memory chunk will be effectively deallocated then re-allocated later to a different memory location, and therefore every TBR push/poppointer pair possibly pointing to this location must be rebased by a call to ADMM_rebase, and also (independently of push/pops) every allocation of this zone must be ADMM_register’ed so that size information are available for the re-allocation.

relocatedDiff

public boolean relocatedDiff

Same as relocated, but concerning the adjoint differentiated zone of this zone.

rootAccessType

public WrapperTypeSpec rootAccessType

The type of the root of the accessTree.

startOffset

public int startOffset

When this zone is in a COMMON, its memory offset inside this COMMON.

targetZoneOf

public ZoneInfo targetZoneOf

Reverse info of “targetZonesTree”. If the current ZoneInfo represents a part of the (initial) destination of a pointer, this holds the ZoneInfo of this pointer.

targetZonesTree

public TapList targetZonesTree

If this zoneInfo is for a pointer, contains a tree of (extended declared) zone numbers which will be used to represent the (initial) destination of this pointer.

type

public WrapperTypeSpec type

The type of this zone. This can be a (modified) primitive type or pointer type.

typeSizeModifier

public int typeSizeModifier

The size modifier that applies to the type.

zoneNb

public int zoneNb

The zone number of this zoneInfo.

Constructors

ZoneInfo

public ZoneInfo(int startOffset, int endOffset, boolean infiniteEndOffset)

Methods

accessTreePrint

public String accessTreePrint(int language)

addVariableName

protected void addVariableName(String varName)

bestVarName

public String bestVarName()

comesFromAllocate

public boolean comesFromAllocate()
Returns

True when this is a zone created by an allocate (aka malloc) instruction. Testing is done by checking that the access tree contains op_allocate.

containsOffset

public boolean containsOffset(int testedOffset)

copy

public ZoneInfo copy()

crossLanguageAccessTree

public Tree crossLanguageAccessTree(CallArrow callArrow, ToBool toSkip, boolean onlyWhenTotal)

Return the access Tree to this zone, possibly modified to take into account the various address manipulations that are made implicitly by cross-language calls.

dump

public void dump()

Prints in detail the contents of this ZoneInfo, onto TapEnv.curOutputStream().

eqOrCopyOfEq

public static boolean eqOrCopyOfEq(ZoneInfo z1, ZoneInfo z2)

isCommon

public boolean isCommon()

isConstant

public boolean isConstant()

isControl

public boolean isControl()

isGlobal

public boolean isGlobal()

isOnceActive

public boolean isOnceActive()

isParameter

public boolean isParameter()

isRemanentLocal

public boolean isRemanentLocal()
Returns

true if this zone, although declared locally (i.e. not a PARAMETER, RESULT, nor an official GLOBAL), is remanent i.e. SAVE, or DATA or initialized in declaration (which imply SAVE).

isResult

public boolean isResult()

kind

public int kind()
Returns

kind of ZoneInfo, in {PARAMETER, LOCAL, RESULT, GLOBAL (for language C)}.

kindZoneNb

public int kindZoneNb(int whichKind)
Parameters
  • whichKind – kind of ZoneInfo.

Returns

reduced zone number.

knownSize

public int knownSize(SymbolTable symbolTable)

When it is possible to find it (statically).

Returns

the integer number of bytes occupied by this zone. Otherwise returns -1.

listAllZones

public static TapIntList listAllZones(TapList<?> zonesTree, boolean throughPointers)

Lists all zones in zonesTree, excluding zones 0 and 1 (i.e. NULL and Undef pointer destinations)

listAllZonesWithNU

public static TapIntList listAllZonesWithNU(TapList<?> zonesTree, boolean throughPointers)

Lists all zones in zonesTree, possibly including zones 0 and 1 (NULL and Undef) if they are in zonesTree.

Parameters
  • zonesTree – The Tree to be explored: a tree of TapIntList of (extended) zones numbers.

  • throughPointers – when true, exploration of “zoneTree” goes into pointer derefs.

Returns

the list of all zones from “zonesTree”, with no duplicates.

passesByValue

public boolean passesByValue(Unit inUnit, int callerLanguage)

pointerDestType

public WrapperTypeSpec pointerDestType()

publicName

public String publicName()

same

public static boolean same(ZoneInfo zi1, ZoneInfo zi2)

setAmbiguousWithoutIndices

public void setAmbiguousWithoutIndices()

setKind

public void setKind(int kind)

setMultiple

public void setMultiple()

setOnceActive

public void setOnceActive()

Declare this ZoneInfo as differentiated (once-active).

setVariableNames

protected void setVariableNames(TapList<String> varNames)

shareActivity

public void shareActivity(ZoneInfo model)

toString

public String toString()

variableNames

public TapList<String> variableNames()