Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit symbol hash and marshal fixes from #4576 #5460

Merged
merged 12 commits into from Nov 21, 2018

Conversation

@headius
Copy link
Member

@headius headius commented Nov 20, 2018

This PR replaces #4576. I will re-port each fix as necessary.

headius added 12 commits Apr 27, 2017
The problem here was that when using ObjectSpace (or object_id,
or FFI) we need to insert some hidden state into objects. This
state goes into the variable table, but does not get marshaled.
However, if we had both reserved space for instance variables and
for one of these hidden variables, we always would proceed to
marshal the object as though it might have instance variables. If
none of the non-hidden variables had been set, we marshaled the
object as having instance variables, but of zero length. This
broke several marshal specs, since objects that would otherwise
have no instance variable were marshaled as such.

This fix uses a second check against the variable list to ensure
that there are real variables to marshal (or an encoding variable)
before proceeding to emit the instance variable sigil and list.
This is not directly used other than to provide a more accurate
guess as to whether there are any non-hidden variable in use by
a given type. 0b6e3c0 fixes the original issue (marshal dumping
zero-length instance var lists).

The accessors of the lazy fields are now deprecated. Use the read
or write calls to get an accessor for the hidden fields.
In MRI most of these types are derived from the internal DATA
class.
We would like to have the table consider encoding, but until we
only use ByteList for identifiers this is not possible. We still
use Java's String in many places, in which case we only have
access to the raw bytes and not the encoding they should be
associated with, so the String-based lookup would never be able
to add this additional mask.

Unfortunately removing this additional hash dimension breaks one
Symbol marshal spec, but it was broken before this work as well.

This was the cause of Kernel#eval regressions in #4576.
@headius headius added this to the JRuby 9.2.5.0 milestone Nov 21, 2018
@headius headius merged commit 275fc86 into jruby:master Nov 21, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@headius headius deleted the headius:symbol_marshal_work branch Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant