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

ruby-changes:61610

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 9 Jun 2020 09:53:07 +0900 (JST)
Subject: [ruby-changes:61610] 877238f2d3 (master): check_cfunc: add assertions

https://git.ruby-lang.org/ruby.git/commit/?id=877238f2d3

From 877238f2d3522381f184d44b308f6e3b68367c56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Wed, 3 Jun 2020 14:21:54 +0900
Subject: check_cfunc: add assertions

For debug.  Must not change generated binary unless VM_ASSERT is on.

diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index f8936b3..0774217 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1653,12 +1653,19 @@ vm_search_method(VALUE cd_owner, struct rb_call_data *cd, VALUE recv) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1653
 static inline int
 check_cfunc(const rb_callable_method_entry_t *me, VALUE (*func)())
 {
-    if (me && me->def->type == VM_METHOD_TYPE_CFUNC &&
-	me->def->body.cfunc.func == func) {
-	return 1;
+    if (! me) {
+        return false;
     }
     else {
-	return 0;
+        VM_ASSERT(IMEMO_TYPE_P(me, imemo_ment));
+        VM_ASSERT(callable_method_entry_p(me));
+        VM_ASSERT(me->def);
+        if (me->def->type != VM_METHOD_TYPE_CFUNC) {
+            return false;
+        }
+        else {
+            return me->def->body.cfunc.func == func;
+        }
     }
 }
 
-- 
cgit v0.10.2


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

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