Bug #14949
closedtest_jit.rb test_unload_units fails on 32-bit
Description
I get multiple definition warnings from this test. It only
happens on my 32-bit systems (both VM and real HW) on Debian 9.
Attached log was made with below patch:
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -541,32 +541,33 @@ def test_unload_units
Dir.mktmpdir("jit_test_unload_units_") do |dir|
# MIN_CACHE_SIZE is 10
out, err = eval_with_jit({"TMPDIR"=>dir}, "#{<<~"begin;"}\n#{<<~'end;'}", verbose: 1, min_calls: 1, max_cache: 10)
begin;
10.times do |i|
eval(<<-EOS)
def mjit#{i}
print #{i}
end
mjit#{i}
EOS
end
end;
assert_equal('0123456789', out)
compactions, errs = err.lines.partition do |l|
l.match?(/\AJIT compaction \(\d+\.\dms\): Compacted \d+ methods ->/)
end
assert_match(/\A#{JIT_SUCCESS_PREFIX}: block in <main>@-e:/, errs[0])
9.times do |i|
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit#{i}@\(eval\):/, errs[i + 1])
end
+ warn "errs: #{errs.join}"
assert_equal("Too many JIT code -- 1 units unloaded\n", errs[10])
assert_match(/\A#{JIT_SUCCESS_PREFIX}: mjit9@\(eval\):/, errs[11])
# On --jit-wait, when the number of JIT-ed code reaches --jit-max-cache,
# it should trigger compaction.
assert_equal(2, compactions.size)
# verify .o files are deleted on unload_units
assert_send([Dir, :empty?, dir])
end
end
Files
Updated by k0kubun (Takashi Kokubun) almost 6 years ago
Eric, thanks to notify this. To fix it, I want to know the content of MJIT header files. I could see debian i686-linux on rubyci was failing in the same reason, but it looks a little hard to know the path of MJIT header from test_jit.rb for debugging.
If it's reproductive on your local environment, could you attach the rb_mjit_header.h in the build directory and/or rb_mjit_min_header-2.6.0.h in somewhere?
Updated by normalperson (Eric Wong) almost 6 years ago
- File rb_mjit_header.h rb_mjit_header.h added
Attached is rb_mjit_header.h from a 32-bit userspace on 64-bit kernel/HW
and mjit_header_i686_native.h from a 32-bit machine
Updated by normalperson (Eric Wong) almost 6 years ago
Header from native 32-bit machine (can't attach multiple files
w/o JS, it seems)
Updated by MSP-Greg (Greg L) almost 6 years ago
I'm also seeing a lot of error text, 395 items in the errs array. Asserts pass up to the assert_equal at line 562. The matches on errs[10] & errs[11] exist, but they're at 201 & 202 respectively.
I've got rb_mjit_min_header-2.6.0.h
, I can attach it if you'd like, it's about 5 MB in size.
Also, to get it to run, I changed the current loop to what's below.
Thanks, Greg
begin;
1.times do |i|
eval 'def mjit0 ; print 0 end ; mjit0'
eval 'def mjit1 ; print 1 end ; mjit1'
eval 'def mjit2 ; print 2 end ; mjit2'
eval 'def mjit3 ; print 3 end ; mjit3'
eval 'def mjit4 ; print 4 end ; mjit4'
eval 'def mjit5 ; print 5 end ; mjit5'
eval 'def mjit6 ; print 6 end ; mjit6'
eval 'def mjit7 ; print 7 end ; mjit7'
eval 'def mjit8 ; print 8 end ; mjit8'
eval 'def mjit9 ; print 9 end ; mjit9'
end
end;
Updated by k0kubun (Takashi Kokubun) almost 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r64138.
transform_mjit_header.rb: accept having attribute
between a type of return value and function identifier. Like:
rb_control_frame_t *
__attribute__ ((__fastcall__)) rb_vm_opt_struct_aref(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)
{
...
}
[Bug #14949]
Updated by k0kubun (Takashi Kokubun) almost 6 years ago
Eric, thanks to the header information, I could fix at least the RubyCI's Debian 7.11 i686.