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

ruby-changes:2060

From: ko1@a...
Date: 28 Sep 2007 23:17:40 +0900
Subject: [ruby-changes:2060] matz - Ruby:r13551 (trunk): * insnhelper.ci (vm_call_method): allow send! to call protected

matz	2007-09-28 23:17:28 +0900 (Fri, 28 Sep 2007)

  New Revision: 13551

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/insnhelper.ci
    trunk/vm_core.h

  Log:
    * insnhelper.ci (vm_call_method): allow send! to call protected
      methods as well.  [ruby-core:12280]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/insnhelper.ci?r1=13551&r2=13550
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=13551&r2=13550
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13551&r2=13550
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_core.h?r1=13551&r2=13550

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13550)
+++ ChangeLog	(revision 13551)
@@ -1,3 +1,8 @@
+Fri Sep 28 23:15:31 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* insnhelper.ci (vm_call_method): allow send! to call protected
+	  methods as well.  [ruby-core:12280]
+
 Fri Sep 28 22:33:47 2007  Koichi Sasada  <ko1@a...>
 
 	* benchmark/bm_so_fasta.rb: added.
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 13550)
+++ vm_core.h	(revision 13551)
@@ -539,6 +539,7 @@
 #define VM_CALL_TAILRECURSION_BIT  (0x01 << 6)
 #define VM_CALL_SUPER_BIT          (0x01 << 7)
 #define VM_CALL_SEND_BIT           (0x01 << 8)
+#define VM_CALL_SEND_BANG_BIT      (0x01 << 9)
 
 /* inline (method|const) cache */
 #define NEW_INLINE_CACHE_ENTRY() NEW_WHILE(Qundef, 0, 0)
Index: compile.c
===================================================================
--- compile.c	(revision 13550)
+++ compile.c	(revision 13551)
@@ -1487,6 +1487,9 @@
 	    mid == id__send__ ) {
 	    OPERAND_AT(iobj, 3) |= INT2FIX(VM_CALL_SEND_BIT);
 	}
+	if (mid == idSendBang || mid == id__send_bang) {
+	    OPERAND_AT(iobj, 3) |= INT2FIX(VM_CALL_SEND_BANG_BIT);
+	}
     }
     return COMPILE_OK;
 }
Index: insnhelper.ci
===================================================================
--- insnhelper.ci	(revision 13550)
+++ insnhelper.ci	(revision 13551)
@@ -537,7 +537,8 @@
 		}
 		val = vm_method_missing(th, id, recv, num, blockptr, stat);
 	    }
-	    else if ((mn->nd_noex & NOEX_MASK) & NOEX_PROTECTED) {
+	    else if (((mn->nd_noex & NOEX_MASK) & NOEX_PROTECTED) &&
+		     !(flag & VM_CALL_SEND_BANG_BIT)) {
 		VALUE defined_class = mn->nd_clss;
 
 		if (TYPE(defined_class) == T_ICLASS) {

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

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