Class FieldSlots
java.lang.Object
org.ek9lang.compiler.support.FieldSlots
- All Implemented Interfaces:
ToIntBiFunction<ISymbol,String>
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 (InheritedSlotCount). 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) 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.
Was FieldSlots.indexOf; externFootprint, externFootprints and
inheritedSlotCount are ExternFootprint (its FOOTPRINTS constant) and
InheritedSlotCount (no-statics lane S3, 2026-10-29).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintapplyAsInt(ISymbol owner, String fieldName) 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.
-
Constructor Details
-
FieldSlots
public FieldSlots()
-
-
Method Details
-
applyAsInt
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).- Specified by:
applyAsIntin interfaceToIntBiFunction<ISymbol,String>
-