ZoneAllocator

final class ZoneAllocator

Allocates memory zone information.

Fields

ambiguousWithoutIndices

public boolean ambiguousWithoutIndices

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

commonName

public String commonName

endOffset

public int endOffset

infiniteEndOffset

public boolean infiniteEndOffset

intZoneInfos

public TapList<ZoneInfo> intZoneInfos

nextIntZone

public int nextIntZone

nextPtrZone

public int nextPtrZone

nextRealZone

public int nextRealZone

nextZone

public int nextZone

ptrZoneInfos

public TapList<ZoneInfo> ptrZoneInfos

realZoneInfos

public TapList<ZoneInfo> realZoneInfos

startOffset

public int startOffset

targetSymbolTable

public SymbolTable targetSymbolTable

The SymbolTable that will host the table of all ZoneInfo’s created by this ZoneAllocator

zoneInfos

public TapList<ZoneInfo> zoneInfos

Constructors

ZoneAllocator

public ZoneAllocator(SymbolTable targetSymbolTable)

Methods

addArgRank

public void addArgRank(TapList zonesTree, int argRank)

addVarDecl

public void addVarDecl(TapList zonesTree, SymbolDecl symbolDecl)

allocateOneZone

public TapList allocateOneZone(WrapperTypeSpec type, int accessTypeModifier, TapList<ZoneInfoAccessElements> accesses, WrapperTypeSpec rootType, int accessArgRankOrResultZero, boolean isInt, boolean isReal, boolean isPtr, boolean isAllocatable, ZoneInfo targetZoneOf)

allocateZones

public TapList allocateZones(WrapperTypeSpec type, int typeModifier, TapList<String> declExtraInfo, TapList<ZoneInfoAccessElements> accesses, WrapperTypeSpec rootType, int accessArgRankOrResultZero, boolean isInt, boolean isReal, boolean isPtr, ZoneInfo targetZoneOf, SymbolTable declSymbolTable, TapList<TapPair<CompositeTypeSpec, TapList>> dejaVu)

Allocates a new set of zones for all objects accessed by the given “accesses”, which must all be of the same type “type+typeModifier+declExtraInfo”. In general, “accesses” is a singleton, containing only one declared symbol. However they may be several in the case of COMMON, BIND(C), EQUIVALENCE…

Parameters
  • rootType – the root type, i.e. the type of the root symbol(s) declared

  • accessArgRankOrResultZero – when the (singleton) accesses is a formal argument, its rank, and zero for function result.

  • isReal – true to force the allocated zones below to have the real kind.

  • isInt – true to force the allocated zones below to have the integer kind.

  • isPtr – true to force the allocated zones below to have the pointer kind.

  • targetZoneOf – when non-null, all allocated zones below will be marked as initial destinations of this pointer zone.

  • declSymbolTable – the SymbolTable of the main declaration location. Only used for a dubious last attempt to fix size modifiers, probably too late anyway as COMMON alignements are already fixed.

  • dejaVu – mechanism to avoid infinite looping in recursive types.

Returns

the tree of all zone ranks allocated for the given “accesses”.

extractAllZoneInfosAsExternalShape

public ZoneInfo[] extractAllZoneInfosAsExternalShape()

extractAllZoneInfosIntoTargetSymbolTable

public void extractAllZoneInfosIntoTargetSymbolTable(TapList<ZoneInfo> toAllocatedZones)

lastAllocated

public ZoneInfo lastAllocated()

setAllocateZonesForPointed

public void setAllocateZonesForPointed(boolean allocateZonesForPointed)

When set to true, allocation of a zone z1 for pointer p triggers allocation of a zone z2 for *p, so that z1 initial default destination is z2.

setCommonName

public void setCommonName(String commonName)

setNeedsAccessTree

public void setNeedsAccessTree(boolean needsAccessTree)

setOffsets

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

setPossiblyMultiple

public void setPossiblyMultiple(boolean possiblyMultiple)

setZoneNumber4

public void setZoneNumber4(int[] zoneNumber4)