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

ruby-changes:72178

From: John <ko1@a...>
Date: Thu, 16 Jun 2022 08:07:50 +0900 (JST)
Subject: [ruby-changes:72178] 17d260a87f (master): Restore rb_exec_recursive_outer

https://git.ruby-lang.org/ruby.git/commit/?id=17d260a87f

From 17d260a87fd0cb4433d29c21f3a69ea963c64056 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Tue, 14 Jun 2022 23:52:20 -0700
Subject: Restore rb_exec_recursive_outer

This was a public method, so we should probably keep it.
---
 common.mk                             | 1 +
 ext/-test-/recursion/recursion.c      | 2 +-
 hash.c                                | 1 +
 include/ruby/internal/intern/thread.h | 3 +--
 internal/thread.h                     | 1 +
 thread.c                              | 6 ++++++
 6 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/common.mk b/common.mk
index c36326333d..cbe03365d1 100644
--- a/common.mk
+++ b/common.mk
@@ -7033,6 +7033,7 @@ hash.$(OBJEXT): $(top_srcdir)/internal/serial.h https://github.com/ruby/ruby/blob/trunk/common.mk#L7033
 hash.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
 hash.$(OBJEXT): $(top_srcdir)/internal/string.h
 hash.$(OBJEXT): $(top_srcdir)/internal/symbol.h
+hash.$(OBJEXT): $(top_srcdir)/internal/thread.h
 hash.$(OBJEXT): $(top_srcdir)/internal/time.h
 hash.$(OBJEXT): $(top_srcdir)/internal/vm.h
 hash.$(OBJEXT): $(top_srcdir)/internal/warnings.h
diff --git a/ext/-test-/recursion/recursion.c b/ext/-test-/recursion/recursion.c
index c9935f2de2..13d41f0ba8 100644
--- a/ext/-test-/recursion/recursion.c
+++ b/ext/-test-/recursion/recursion.c
@@ -16,7 +16,7 @@ exec_recursive(VALUE self, VALUE mid) https://github.com/ruby/ruby/blob/trunk/ext/-test-/recursion/recursion.c#L16
 static VALUE
 exec_recursive_outer(VALUE self, VALUE mid)
 {
-    return rb_exec_recursive_outer_mid(recursive_i, self, mid, rb_intern("exec_recursive_outer"));
+    return rb_exec_recursive_outer(recursive_i, self, mid);
 }
 
 void
diff --git a/hash.c b/hash.c
index c6aa83eb0d..7568538214 100644
--- a/hash.c
+++ b/hash.c
@@ -35,6 +35,7 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L35
 #include "internal/object.h"
 #include "internal/proc.h"
 #include "internal/symbol.h"
+#include "internal/thread.h"
 #include "internal/time.h"
 #include "internal/vm.h"
 #include "probes.h"
diff --git a/include/ruby/internal/intern/thread.h b/include/ruby/internal/intern/thread.h
index ef4274e4b3..716375acd7 100644
--- a/include/ruby/internal/intern/thread.h
+++ b/include/ruby/internal/intern/thread.h
@@ -292,7 +292,6 @@ VALUE rb_exec_recursive_paired(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VAL https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/thread.h#L292
  * @param[in]      f  The function that possibly recurs.
  * @param[in,out]  g  Passed as-is to `f`.
  * @param[in,out]  h  Passed as-is to `f`.
- * @param[in]      mid The ID of the method name being called
  * @return         The return value of f.
  *
  * @internal
@@ -300,7 +299,7 @@ VALUE rb_exec_recursive_paired(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VAL https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/thread.h#L299
  * It seems  nobody uses the "it  calls rb_throw_obj()" part of  this function.
  * @shyouhei doesn't understand the needs.
  */
-VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid);
+VALUE rb_exec_recursive_outer(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h);
 
 /**
  * Identical to  rb_exec_recursive_outer(), except it checks  for the recursion
diff --git a/internal/thread.h b/internal/thread.h
index 919ad96580..63f03bb94a 100644
--- a/internal/thread.h
+++ b/internal/thread.h
@@ -35,6 +35,7 @@ int rb_thread_to_be_killed(VALUE thread); https://github.com/ruby/ruby/blob/trunk/internal/thread.h#L35
 void rb_mutex_allow_trap(VALUE self, int val);
 VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data);
 VALUE rb_mutex_owned_p(VALUE self);
+VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid);
 
 int rb_thread_wait_for_single_fd(int fd, int events, struct timeval * timeout);
 
diff --git a/thread.c b/thread.c
index 0b5cbb8197..6c22867bab 100644
--- a/thread.c
+++ b/thread.c
@@ -5172,6 +5172,12 @@ rb_exec_recursive_paired(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE pai https://github.com/ruby/ruby/blob/trunk/thread.c#L5172
  * short-circuited using throw.
  */
 
+VALUE
+rb_exec_recursive_outer(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE arg)
+{
+    return exec_recursive(func, obj, 0, arg, 1, rb_frame_last_func());
+}
+
 VALUE
 rb_exec_recursive_outer_mid(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE arg, ID mid)
 {
-- 
cgit v1.2.1


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

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