Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use original accessor to access unreified instance vars. Fix #4455
The invokedynamic logic for accessing instance variables did not account for field-based instance variables that shift table- based variables off in the "logical" index into the object. As a result, once bound the index into the table was used as the logical index, resulting in overridden BasicObject.getVariable in the reified subclasses causing the fields to be accessed instead. This patch modifies indy binding for table-based variables to use the original accessor rather than attempting to get the values from the object directly. The problem in #4455 was that the @opts variable holding options for the dataset was bound to logical index 1 based on table index 1, resulting in the second of three reified instance variables being accessed instead. I will run a few more scenarios from #4455 to ensure those cases are fixed as well. The instance variable subsystem needs a bit of an overhaul. The base RubyBasicObject.getVariable expects a table offset while the overridden versions expect a logical offset. The binding via the accessors is not as direct as it could be, but the accessors contain logic that is hard to do in the direct path. And the methods involved in managing instance variables and reified ivars needs a more complete set of unit tests in Java to ensure they are working properly together.