add a simple default-enabled autovivification feature #18650
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unlike other features, the work for this is done at runtime, but we only get to this point when autovivification is needed, so I expect the total cost is small enough not to matter.
The only real way to eliminate all the cost would be to have alternate ops that don't autovivify, since an op flag would have about the same runtime cost.
The runtime-ness of this feature revealed a bug in my original work that reflected feature changes to %^H to PL_compiling.cop_features - the cop_features value wasn't being copied to the next/dbstate op. This was (fortunately) harmless since current features only work at compile-time (using PL_compiling), and other feature tests that anyone outside of core might want to do need to check the hinthash value from caller().