[前][次][番号順一覧][スレッド一覧]

ruby-changes:52752

From: k0kubun <ko1@a...>
Date: Mon, 8 Oct 2018 22:46:47 +0900 (JST)
Subject: [ruby-changes:52752] k0kubun:r64964 (trunk): include/ruby/ruby.h: import external symbols

k0kubun	2018-10-08 22:46:42 +0900 (Mon, 08 Oct 2018)

  New Revision: 64964

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64964

  Log:
    include/ruby/ruby.h: import external symbols
    
    properly on MinGW MJIT.
    
    test_jit.rb: all MJIT tests are now passing on MinGW.

  Modified files:
    trunk/include/ruby/ruby.h
    trunk/test/ruby/test_jit.rb
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 64963)
+++ include/ruby/ruby.h	(revision 64964)
@@ -28,6 +28,12 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L28
 
 #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 */
Index: test/ruby/test_jit.rb
===================================================================
--- test/ruby/test_jit.rb	(revision 64963)
+++ test/ruby/test_jit.rb	(revision 64964)
@@ -77,7 +77,6 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L77
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L163
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L175
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L199
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L338
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L356
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L423
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L491
   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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L797
     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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]