[#13161] hacking on the "heap" implementation in gc.c — Lloyd Hilaiel <lloyd@...>

Hi all,

16 messages 2007/11/01

[#13182] Thinking of dropping YAML from 1.8 — Urabe Shyouhei <shyouhei@...>

Hello all.

14 messages 2007/11/03

[#13315] primary encoding and source encoding — David Flanagan <david@...>

I've got a couple of questions about the handling of primary encoding.

29 messages 2007/11/08
[#13331] Re: primary encoding and source encoding — Yukihiro Matsumoto <matz@...> 2007/11/09

Hi,

[#13368] method names in 1.9 — "David A. Black" <dblack@...>

Hi --

61 messages 2007/11/10
[#13369] Re: method names in 1.9 — Yukihiro Matsumoto <matz@...> 2007/11/10

Hi,

[#13388] Re: method names in 1.9 — Charles Oliver Nutter <charles.nutter@...> 2007/11/11

Yukihiro Matsumoto wrote:

[#13403] Re: method names in 1.9 — "Austin Ziegler" <halostatue@...> 2007/11/11

On 11/11/07, Charles Oliver Nutter <charles.nutter@sun.com> wrote:

[#13410] Re: method names in 1.9 — David Flanagan <david@...> 2007/11/11

Austin Ziegler wrote:

[#13413] Re: method names in 1.9 — Charles Oliver Nutter <charles.nutter@...> 2007/11/11

David Flanagan wrote:

[#13423] Re: method names in 1.9 — Jordi <mumismo@...> 2007/11/12

Summing it up:

[#13386] Re: method names in 1.9 — Trans <transfire@...> 2007/11/11

[#13391] Re: method names in 1.9 — Matthew Boeh <mboeh@...> 2007/11/11

On Sun, Nov 11, 2007 at 05:50:18PM +0900, Trans wrote:

[#13457] mingw rename — "Roger Pack" <rogerpack2005@...>

Currently for different windows' builds, the names for RUBY_PLATFORM

13 messages 2007/11/13

[#13485] Proposal: Array#walker — Wolfgang Nádasi-Donner <ed.odanow@...>

Good morning all together!

23 messages 2007/11/14
[#13486] Re: Proposal: Array#walker — Wolfgang Nádasi-Donner <ed.odanow@...> 2007/11/14

A nicer version may be...

[#13488] Re: Proposal: Array#walker — Trans <transfire@...> 2007/11/14

[#13495] Re: Proposal: Array#walker — Trans <transfire@...> 2007/11/14

[#13498] state of threads in 1.9 — Jordi <mumismo@...>

Are Threads mapped to threads on the underlying operating system in

30 messages 2007/11/14
[#13519] Re: state of threads in 1.9 — "Bill Kelly" <billk@...> 2007/11/14

[#13526] Re: state of threads in 1.9 — Eric Hodel <drbrain@...7.net> 2007/11/14

On Nov 14, 2007, at 11:18 , Bill Kelly wrote:

[#13528] test/unit and miniunit — Ryan Davis <ryand-ruby@...>

When is the 1.9 freeze?

17 messages 2007/11/14

[#13564] Thoughts about Array#compact!, Array#flatten!, Array#reject!, String#strip!, String#capitalize!, String#gsub!, etc. — Wolfgang Nádasi-Donner <ed.odanow@...>

Good evening all together!

53 messages 2007/11/15
[#13575] Re: Thoughts about Array#compact!, Array#flatten!, Array#reject!, String#strip!, String#capitalize!, String#gsub!, etc. — "Nikolai Weibull" <now@...> 2007/11/15

On Nov 15, 2007 8:14 PM, Wolfgang N=E1dasi-Donner <ed.odanow@wonado.de> wro=

[#13578] Re: Thoughts about Array#compact!, Array#flatten!, Array#reject!, String#strip!, String#capitalize!, String#gsub!, etc. — Michael Neumann <mneumann@...> 2007/11/16

Nikolai Weibull schrieb:

[#13598] wondering about #tap (was: Re: Thoughts about Array#compact!, Array#flatten!, Array#reject!, String#strip!, String#capitalize!, String#gsub!, etc.) — "David A. Black" <dblack@...> 2007/11/16

Hi --

[#13605] Re: wondering about #tap (was: Re: Thoughts about Array#compact!, Array#flatten!, Array#reject!, String#strip!, String#capitalize!, String#gsub!, etc.) — Trans <transfire@...> 2007/11/16

[#13612] Re: wondering about #tap (was: Re: Thoughts about Array#compact!, Array#flatten!, Array#reject!, String#strip!, String#capitalize!, String#gsub!, etc.) — "David A. Black" <dblack@...> 2007/11/16

Hi --

[#13624] Re: wondering about #tap (was: Re: Thoughts about Array#compact!, Array#flatten!, Array#reject!, String#strip!, String#capitalize!, String#gsub!, etc.) — "Nikolai Weibull" <now@...> 2007/11/16

On Nov 16, 2007 12:40 PM, David A. Black <dblack@rubypal.com> wrote:

[#13632] Re: wondering about #tap — David Flanagan <david@...> 2007/11/16

David A. Black wrote:

[#13634] Re: wondering about #tap — "David A. Black" <dblack@...> 2007/11/16

Hi --

[#13636] Re: wondering about #tap — "Rick DeNatale" <rick.denatale@...> 2007/11/16

On Nov 16, 2007 12:40 PM, David A. Black <dblack@rubypal.com> wrote:

[#13637] Re: wondering about #tap — murphy <murphy@...> 2007/11/16

Rick DeNatale wrote:

[#13640] Re: wondering about #tap — Wolfgang Nádasi-Donner <ed.odanow@...> 2007/11/16

murphy schrieb:

[#13614] Suggestion for native thread tests — "Eust痃uio Rangel" <eustaquiorangel@...>

Hi!

12 messages 2007/11/16

[#13685] Problems with \M-x in utf-8 encoded strings — Wolfgang Nádasi-Donner <ed.odanow@...>

Hi!

11 messages 2007/11/18

[#13741] retry semantics changed — Dave Thomas <dave@...>

In 1.8, I could write:

46 messages 2007/11/23
[#13742] Re: retry semantics changed — "Brian Mitchell" <binary42@...> 2007/11/23

On Nov 23, 2007 12:06 PM, Dave Thomas <dave@pragprog.com> wrote:

[#13743] Re: retry semantics changed — Dave Thomas <dave@...> 2007/11/23

[#13746] Re: retry semantics changed — Yukihiro Matsumoto <matz@...> 2007/11/23

Hi,

[#13747] Re: retry semantics changed — Dave Thomas <dave@...> 2007/11/23

[#13748] Re: retry semantics changed — Yukihiro Matsumoto <matz@...> 2007/11/23

Hi,

[#13749] Re: retry semantics changed — Dave Thomas <dave@...> 2007/11/23

Re: invoke_method calling private methods when invoked on integers

From: Nobuyoshi Nakada <nobu@...>
Date: 2007-11-07 01:46:32 UTC
List: ruby-core #13255
Hi,

At Wed, 7 Nov 2007 05:44:17 +0900,
David Flanagan wrote in [ruby-core:13245]:
> The rdoc comment for invoke_method includes this example:
> 
>   *     1.invoke_method(:puts, "hello")  # causes NoMethodError
> 
> In fact, however, the current implementation does allows private methods 
> to be invoked if the receiver is any fixnum, symbol, true, false, or nil.

> The patch isn't perfect, as it still treats a receiver of nil as the 
> same as having no receiver at all.

It needs to access VM flags, I guess.


Index: eval.c
===================================================================
--- eval.c	(revision 13827)
+++ eval.c	(working copy)
@@ -1508,9 +1508,9 @@ VALUE
 rb_invoke_method(int argc, VALUE *argv, VALUE recv)
 {
+    int rb_vm_cfunc_funcall_p(rb_control_frame_t *);
     int scope = NOEX_PUBLIC;
     rb_thread_t *th = GET_THREAD();
-    rb_control_frame_t *cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
 
-    if (SPECIAL_CONST_P(cfp->sp[0])) {
+    if (rb_vm_cfunc_funcall_p(th->cfp)) {
 	scope = NOEX_NOSUPER | NOEX_PRIVATE;
     }
Index: insnhelper.ci
===================================================================
--- insnhelper.ci	(revision 13827)
+++ insnhelper.ci	(working copy)
@@ -49,5 +49,5 @@ vm_push_frame(rb_thread_t *th, rb_iseq_t
     cfp->bp = sp + 1;
     cfp->iseq = iseq;
-    cfp->flag = VM_FRAME_FLAG(type);
+    cfp->flag = type;
     cfp->self = self;
     cfp->lfp = lfp;
@@ -348,5 +348,6 @@ call_cfunc(VALUE (*func)(), VALUE recv, 
 static inline VALUE
 vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, int num,
-	      ID id, VALUE recv, VALUE klass, NODE *mn, rb_block_t *blockptr)
+	      ID id, VALUE recv, VALUE klass, VALUE flag,
+	      NODE *mn, rb_block_t *blockptr)
 {
     VALUE val;
@@ -355,6 +356,6 @@ vm_call_cfunc(rb_thread_t *th, rb_contro
     {
 	rb_control_frame_t *cfp =
-	  vm_push_frame(th, 0, FRAME_MAGIC_CFUNC,
-			recv, (VALUE) blockptr, 0, reg_cfp->sp, 0, 1);
+	    vm_push_frame(th, 0, FRAME_MAGIC_CFUNC | flag * (FRAME_MAGIC_MASK + 1),
+			  recv, (VALUE) blockptr, 0, reg_cfp->sp, 0, 1);
 
 	cfp->method_id = id;
@@ -375,4 +376,12 @@ vm_call_cfunc(rb_thread_t *th, rb_contro
 }
 
+static int
+vm_cfunc_flags(rb_control_frame_t *cfp)
+{
+    if (RUBYVM_CFUNC_FRAME_P(cfp))
+	return cfp->flag / (FRAME_MAGIC_MASK + 1);
+    return 0;
+}
+
 static inline VALUE
 vm_call_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv,
@@ -488,5 +497,5 @@ vm_call_method(rb_thread_t *th, rb_contr
 	      }
 	      case NODE_CFUNC:{
-		  val = vm_call_cfunc(th, cfp, num, id, recv, klass, node, blockptr);
+		  val = vm_call_cfunc(th, cfp, num, id, recv, klass, flag, node, blockptr);
 		  break;
 	      }
Index: vm.c
===================================================================
--- vm.c	(revision 13827)
+++ vm.c	(working copy)
@@ -1437,4 +1437,12 @@ rb_vm_call_cfunc(VALUE recv, VALUE (*fun
 }
 
+int
+rb_vm_cfunc_funcall_p(rb_control_frame_t *cfp)
+{
+    if (vm_cfunc_flags(cfp) & (VM_CALL_FCALL_BIT | VM_CALL_VCALL_BIT))
+	return Qtrue;
+    return Qfalse;
+}
+
 /* vm */
 


-- 
Nobu Nakada

In This Thread

Prev Next