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

ruby-changes:45893

From: nobu <ko1@a...>
Date: Tue, 14 Mar 2017 13:03:52 +0900 (JST)
Subject: [ruby-changes:45893] nobu:r57966 (trunk): vm_core.h: assertions for Proc

nobu	2017-03-14 13:03:48 +0900 (Tue, 14 Mar 2017)

  New Revision: 57966

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

  Log:
    vm_core.h: assertions for Proc
    
    * vm_core.h (vm_proc_block): assert before accessing.
    
    * vm_core.h (vm_proc_iseq): remove duplicate assertion.

  Modified files:
    trunk/vm_core.h
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 57965)
+++ vm_core.h	(revision 57966)
@@ -1309,9 +1309,8 @@ vm_block_type_set(const struct rb_block https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1309
 static inline const struct rb_block *
 vm_proc_block(VALUE procval)
 {
-    rb_proc_t *proc = RTYPEDDATA_DATA(procval);
     VM_ASSERT(rb_obj_is_proc(procval));
-    return &proc->block;
+    return &((rb_proc_t *)RTYPEDDATA_DATA(procval))->block;
 }
 
 static inline const rb_iseq_t *vm_block_iseq(const struct rb_block *block);
@@ -1320,7 +1319,6 @@ static inline const VALUE *vm_block_ep(c https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1319
 static inline const rb_iseq_t *
 vm_proc_iseq(VALUE procval)
 {
-    VM_ASSERT(rb_obj_is_proc(procval));
     return vm_block_iseq(vm_proc_block(procval));
 }
 

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

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