Skip to content

Conversation

@headius
Copy link
Member

@headius headius commented Dec 11, 2025

In order to allow Data types to specialize their fields completely, we introduced a copy constructor for VariableTableManager that duplicates the Data type's VTM into the new subclass. But because that duplicate still used the same realClass, variable accessors would frequently return to the original Data type's VTM rather than use the duplicate.

This patch fixes the duplication process to also reset the realClass to the new Data type subclass, keeping all future usages and updates at the correct level. Without this, new instance variables discovered on subtypes would add an accessor on the subtype, but then proceed to allocate the variable table based on the size of the table in the old VTM from the Data supertype.

In order to allow Data types to specialize their fields completely,
we introduced a copy constructor for VariableTableManager that
duplicates the Data type's VTM into the new subclass. But because
that duplicate still used the same realClass, variable accessors
would frequently return to the original Data type's VTM rather than
use the duplicate.

This patch fixes the duplication process to also reset the
realClass to the new Data type subclass, keeping all future usages
and updates at the correct level. Without this, new instance
variables discovered on subtypes would add an accessor on the
subtype, but then proceed to allocate the variable table based on
the size of the table in the old VTM from the Data supertype.
@headius headius added this to the JRuby 10.0.3.0 milestone Dec 11, 2025
@headius headius marked this pull request as ready for review December 11, 2025 23:54
@headius headius merged commit 3148630 into jruby:master Dec 11, 2025
77 checks passed
@headius headius deleted the data_vtm_copy_fix branch December 11, 2025 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant