include/ruby/ruby.h: import external symbols

properly on MinGW MJIT.

test_jit.rb: all MJIT tests are now passing on MinGW.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-10-08 13:46:42 +00:00
parent 1ce45a446e
commit ad2d2e3f0f
2 changed files with 6 additions and 16 deletions

View File

@ -28,6 +28,12 @@ extern "C" {
#include "defines.h"
/* For MinGW, we need __declspec(dllimport) for RUBY_EXTERN on MJIT. mswin's RUBY_EXTERN already has that. */
#if defined(MJIT_HEADER) && defined(_WIN32) && defined(__GNUC__)
# undef RUBY_EXTERN
# define RUBY_EXTERN extern __declspec(dllimport)
#endif
#if defined(__cplusplus)
/* __builtin_choose_expr and __builtin_types_compatible aren't available
* on C++. See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */

View File

@ -77,7 +77,6 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_blockparam
skip_on_mingw
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '3', success_count: 2, insns: %i[getblockparam setblockparam])
begin;
def foo(&b)
@ -164,8 +163,6 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_putspecialobject_putiseq
skip_on_mingw # [Bug #14948]
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hellohello', success_count: 2, insns: %i[putspecialobject putiseq])
begin;
print 2.times.map {
@ -178,7 +175,6 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_putstring_concatstrings_tostring
skip_on_mingw
assert_compile_once('"a#{}b" + "c"', result_inspect: '"abc"', insns: %i[putstring concatstrings tostring])
end
@ -203,7 +199,6 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_intern_duparray
skip_on_mingw
assert_compile_once('[:"#{0}"] + [1,2,3]', result_inspect: '[:"0", 1, 2, 3]', insns: %i[intern duparray])
end
@ -343,7 +338,6 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_invokesuper
skip_on_mingw
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '3', success_count: 4, insns: %i[invokesuper])
begin;
mod = Module.new {
@ -362,7 +356,6 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_invokeblock_leave
skip_on_mingw
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '2', success_count: 2, insns: %i[invokeblock leave])
begin;
def foo
@ -430,7 +423,6 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_once
skip_on_mingw
assert_compile_once('/#{true}/o =~ "true" && $~.to_a', result_inspect: '["true"]', insns: %i[once])
end
@ -499,12 +491,10 @@ class TestJIT < Test::Unit::TestCase
end
def test_compile_insn_opt_aref_with
skip_on_mingw
assert_compile_once("{ '1' => 2 }['1']", result_inspect: '2', insns: %i[opt_aref_with])
end
def test_compile_insn_opt_aset
skip_on_mingw
assert_compile_once("#{<<~"begin;"}\n#{<<~"end;"}", result_inspect: '5', insns: %i[opt_aset opt_aset_with])
begin;
hash = { '1' => 2 }
@ -807,12 +797,6 @@ class TestJIT < Test::Unit::TestCase
ENV['APPVEYOR'] == 'True' && RUBY_PLATFORM.match?(/mswin/)
end
def skip_on_mingw
if RUBY_PLATFORM.match?(/mingw/)
skip 'This test does not succeed on mingw yet.'
end
end
# The shortest way to test one proc
def assert_compile_once(script, result_inspect:, insns: [])
if script.match?(/\A\n.+\n\z/m)