Description
Currently, we can load <X>Ptr
-typed fields in raw (e.g.,<Y>Layout
) objects by using LoadNativeField. However, no analogue exists for fields that are not boxed types (e.g., uint32_t
-typed fields).
This came up while working on #40813, where I needed to be able to inspect the number of fixed and optional parameters for a closure function where the closure function is not known statically, which requires extracting the value of the packed_fields_
field, which is of type uint32_t
.
As a short-term workaround, I have added the right entries into the helper methods used by the LoadIndexed
instruction to make the contents of a FunctionLayout object addressable as if the non-tagged portion was an external uint32_t
array. A better solution for the long term would be to introduce another instruction (LoadUnboxedNativeField
?) with appropriate Slot
-like machinery for defining extractable unboxed fields from raw objects, and then remove the kFunctionCid hack in the various places it appears.