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

ruby-changes:58578

From: Lars <ko1@a...>
Date: Tue, 5 Nov 2019 15:31:41 +0900 (JST)
Subject: [ruby-changes:58578] 853d91a04a (master): Fix coroutine support on win32

https://git.ruby-lang.org/ruby.git/commit/?id=853d91a04a

From 853d91a04a4d133fc90b35c90570dc1c656a7922 Mon Sep 17 00:00:00 2001
From: Lars Kanis <kanis@c...>
Date: Mon, 4 Nov 2019 11:00:13 +0100
Subject: Fix coroutine support on win32

Ruby master branch currently fails on win32 MINGW at this spec:
https://github.com/ruby/spec/blob/master/core/thread/element_set_spec.rb

MINGW makes use of setjmp3() implemented in MSVCRT.DLL.
This function traverses the SEH list up to a terminating pointer 0xFFFFFFFF.
It therefore currently segfaults on NULL.
The SEH linked list must be terminated by 0xFFFFFFFF instead of NULL.

This fixes the issue mentioned here:
  https://github.com/ruby/ruby/pull/2279#issuecomment-509508810

diff --git a/coroutine/win32/Context.h b/coroutine/win32/Context.h
index c70b65c..299515e 100644
--- a/coroutine/win32/Context.h
+++ b/coroutine/win32/Context.h
@@ -42,7 +42,7 @@ static inline void coroutine_initialize( https://github.com/ruby/ruby/blob/trunk/coroutine/win32/Context.h#L42
     *--context->stack_pointer = (void*)start;
 
     /* Windows Thread Information Block */
-    *--context->stack_pointer = 0; /* fs:[0] */
+    *--context->stack_pointer = (void*)0xFFFFFFFF; /* fs:[0] */
     *--context->stack_pointer = (void*)top; /* fs:[4] */
     *--context->stack_pointer = (void*)stack;  /* fs:[8] */
 
-- 
cgit v0.10.2


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

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