Class FieldSlots
java.lang.Object
org.ek9lang.compiler.support.FieldSlots
THE field-slot rule: the index of a property in an object's flat field layout, as every back end lays it out and
as the IR's
LOAD_FIELD/STORE_FIELD/RELEASE_FIELD index states it (Contract 2: the index is
the slot). An object holds its super chain's properties first, then its own. A super that is an extern built-in
(Exception, Money, ...) declares its state as Java/C struct fields, not EK9 properties, so it
contributes its native FOOTPRINT (externFootprint(String)) and the walk stops there.
Use this - never count getProperties() by hand. There were three rules (review A-D2): phase 7 read
other.x without the extern footprint, so on a sub-type of Exception it read the C struct's first
word; assignment counted only the declaring type's own properties; the native layout counted it right.
-
Method Summary
Modifier and TypeMethodDescriptionstatic OptionalIntexternFootprint(String fullyQualifiedTypeName) The native footprint of a field-bearing extern base, or empty for a user type or a field-less extern type.The immutable footprint map - for the drift test that holds it against the C structs.static intThe slot offieldNamein an object ofowner: the nearest declaration of that property in the chain, at its declaring type's inherited slot count plus its position there.static intinheritedSlotCount(IAggregateSymbol aggregate) The slots an aggregate's super chain occupies before its own properties.
-
Method Details
-
externFootprint
The native footprint of a field-bearing extern base, or empty for a user type or a field-less extern type. -
externFootprints
-
inheritedSlotCount
The slots an aggregate's super chain occupies before its own properties. -
indexOf
The slot offieldNamein an object ofowner: the nearest declaration of that property in the chain, at its declaring type's inherited slot count plus its position there. 0 when it is not an EK9 property of the chain (the IR's historical answer for a non-aggregate owner).
-