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

ruby-changes:45221

From: nobu <ko1@a...>
Date: Tue, 10 Jan 2017 19:57:33 +0900 (JST)
Subject: [ruby-changes:45221] nobu:r57294 (trunk): thread.c: fix todo

nobu	2017-01-10 19:57:26 +0900 (Tue, 10 Jan 2017)

  New Revision: 57294

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

  Log:
    thread.c: fix todo
    
    * thread.c (rb_threadptr_pending_interrupt_check_mask): traverse
      the super class chain instead of making ancestors array.

  Modified files:
    trunk/thread.c
Index: thread.c
===================================================================
--- thread.c	(revision 57293)
+++ thread.c	(revision 57294)
@@ -1587,19 +1587,23 @@ rb_threadptr_pending_interrupt_check_mas https://github.com/ruby/ruby/blob/trunk/thread.c#L1587
     VALUE mask;
     long mask_stack_len = RARRAY_LEN(th->pending_interrupt_mask_stack);
     const VALUE *mask_stack = RARRAY_CONST_PTR(th->pending_interrupt_mask_stack);
-    VALUE ancestors = rb_mod_ancestors(err); /* TODO: GC guard */
-    long ancestors_len = RARRAY_LEN(ancestors);
-    const VALUE *ancestors_ptr = RARRAY_CONST_PTR(ancestors);
-    int i, j;
+    VALUE mod;
+    long i;
 
     for (i=0; i<mask_stack_len; i++) {
 	mask = mask_stack[mask_stack_len-(i+1)];
 
-	for (j=0; j<ancestors_len; j++) {
-	    VALUE klass = ancestors_ptr[j];
+	for (mod = err; mod; mod = RCLASS_SUPER(mod)) {
+	    VALUE klass = mod;
 	    VALUE sym;
 
-	    /* TODO: remove rb_intern() */
+	    if (BUILTIN_TYPE(mod) == T_ICLASS) {
+		klass = RBASIC(mod)->klass;
+	    }
+	    else if (mod != RCLASS_ORIGIN(mod)) {
+		continue;
+	    }
+
 	    if ((sym = rb_hash_aref(mask, klass)) != Qnil) {
 		if (sym == sym_immediate) {
 		    return INTERRUPT_IMMEDIATE;

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

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