This optimization has to be rethought in light of $word binding to environments.
Here's a code fragment for assigning the properties:
REBINT n = maybe Try_Get_Binder_Index(
unwrap binder, Cell_Word_Symbol(v)
);
CELL_WORD_INDEX_I32(v) = -(n); // negative or zero signals unbound [2]
Tweak_Cell_Relative_Binding(v, unwrap relative);
For deciphering it:
// there's an attempted acceleration of the search by caching a
// function's identity in WORD! cells and a negative index that tells
// you where to find the variable if that word is searched in a frame
// for that function.
if (
CTX_TYPE(vlist) == TYPE_FRAME
and binding // word has a cache for if it's in an action frame
and Is_Stub_Details(binding)
and Action_Is_Base_Of(
cast(Phase*, binding),
cast(ParamList*, vlist)
)
){
assert(CELL_WORD_INDEX_I32(any_word) <= 0);
if (CELL_WORD_INDEX_I32(any_word) == 0)
goto next_context;
*index_out = -(CELL_WORD_INDEX_I32(any_word));
return vlist;
}
Something from caching that slowed things down and was disabled:
// Note: if frame, caching here seems to slow things down?
if (CTX_TYPE(vlist) == TYPE_FRAME) {
if (CELL_WORD_INDEX_I32(any_word) <= 0) { // cache in unbounds
CELL_WORD_INDEX_I32(
m_cast(Cell*, any_word)
) = -(maybe index);
Tweak_Cell_Binding(
m_cast(Cell*, any_word),
Phase_Details(vlist)
);
}
}