Remove YGNode "reserved_" field (#36991)

Summary:
X-link: https://github.com/facebook/react-native/pull/36991

D15296732 added a byte to each YGNode exposed via private API, to stash random junk in. At the time, not adding to node size because of how fields ended up aligning. I'm not sure if this is still the case, but this is subject to change (e.g. adding a single extra flag).

There is a per-node "context" already that can store arbitrary data, and this reserved space isn't public, so this API is already a bit suspect.

The only place it is used is in instrumentation in fbandroid, enabled only in benchmarks, to store an enum to forward to QPL for what framework it thinks created the Yoga Node.

This is already broken for React Native (worked for Paper only), and afaict isn't used anywhere. But it also has little reason to be caching more information on the node (beyond maybe saving a couple memory accesses) since it derives this information from the node config already.

This removes the field.

Changelog:
[Internal]

Reviewed By: rshest

Differential Revision: D45137133

fbshipit-source-id: 75755b21102f7928b3ad947051c35b1a6566ef40
This commit is contained in:
Nick Gerleman
2023-04-21 13:54:50 -07:00
committed by Facebook GitHub Bot
parent 3138a438af
commit 7afddfd204

View File

@@ -42,7 +42,6 @@ struct YOGA_EXPORT YGNode {
private: private:
void* context_ = nullptr; void* context_ = nullptr;
YGNodeFlags flags_ = {}; YGNodeFlags flags_ = {};
uint8_t reserved_ = 0;
union { union {
YGMeasureFunc noContext; YGMeasureFunc noContext;
MeasureWithContextFn withContext; MeasureWithContextFn withContext;
@@ -114,9 +113,6 @@ public:
// Getters // Getters
void* getContext() const { return context_; } void* getContext() const { return context_; }
uint8_t& reserved() { return reserved_; }
uint8_t reserved() const { return reserved_; }
void print(void*); void print(void*);
bool getHasNewLayout() const { return flags_.hasNewLayout; } bool getHasNewLayout() const { return flags_.hasNewLayout; }