Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Jitted blocks do not scope evals properly #3368
This is the cause of the current TestMarshal failures.
Reduced case follows.
Command line and bug (:there should be :here):
The problem here seems to be that when a block is jitted, it's not framing itself or rooting the eval properly. I have not investigated further than that, but obviously the eval'ed
This breaks TestMarshal because of test_marshal.rb:263-266.
classISO8859_1 = Class.new do attr_accessor "r\xe9sum\xe9".force_encoding(iso_8859_1) eval("def initialize(x); @r\xe9sum\xe9 = x; end".force_encoding(iso_8859_1)) end
This initialize becomes TestMarshal's initialize, As a result, the name of the test passed into TestMarshal.new (as part of test suite initialization) never reaches the TestCase superclass, and the
Note that the method name in the error report is missing.
Closing the loop here...
The problem was that the evalType threadlocal in *IRBlockBody was getting out of sync, due to having MixedModeIRBlockBody wrap a CompiledIRBlockBody. As a result, when CompiledIRBlockBody ran, it did not see that e.g. Class.new had set MixedModeIRBlockBody as an eval'ed block, and as a result the search for method target failed to stop at the Class.new block.
The fix in e9d5c94 shares a single evalType threadlocal between both the container MixedModeIRBlockBody and the contained CompiledIRBlockBody.
There's remaining work needed to clean up all this shared state and do a better job of unifying the different container objects for interpreted and jitted blocks and methods.