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

ruby-changes:33182

From: normal <ko1@a...>
Date: Mon, 3 Mar 2014 08:24:43 +0900 (JST)
Subject: [ruby-changes:33182] normal:r45261 (trunk): vm_method.c: disable GMC writing if GMC is disabled

normal	2014-03-03 08:24:38 +0900 (Mon, 03 Mar 2014)

  New Revision: 45261

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45261

  Log:
    vm_method.c: disable GMC writing if GMC is disabled
    
    * vm_method.c (rb_method_entry_get_without_cache): disable GMC
      writing if GMC is disabled
      [ruby-core:61218]

  Modified files:
    trunk/ChangeLog
    trunk/vm_method.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45260)
+++ ChangeLog	(revision 45261)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar  3 08:10:04 2014  Eric Wong  <e@8...>
+
+	* vm_method.c (rb_method_entry_get_without_cache): disable GMC
+	  writing if GMC is disabled.
+	  [ruby-core:61218]
+
 Mon Mar  3 07:47:17 2014  Eric Wong  <e@8...>
 
 	* README.EXT: wrap GetDBM with do/while(0)
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 45260)
+++ vm_method.c	(revision 45261)
@@ -2,6 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/vm_method.c#L2
  * This file is included by vm.c
  */
 
+#if OPT_GLOBAL_METHOD_CACHE
 #ifndef GLOBAL_METHOD_CACHE_SIZE
 #define GLOBAL_METHOD_CACHE_SIZE 0x800
 #endif
@@ -16,6 +17,9 @@ https://github.com/ruby/ruby/blob/trunk/vm_method.c#L17
 
 #define GLOBAL_METHOD_CACHE_KEY(c,m) ((((c)>>3)^(m))&GLOBAL_METHOD_CACHE_MASK)
 #define GLOBAL_METHOD_CACHE(c,m) (global_method_cache + GLOBAL_METHOD_CACHE_KEY(c,m))
+#else
+#define GLOBAL_METHOD_CACHE(c,m) 0,rb_bug("global method cache disabled improperly")
+#endif
 #include "method.h"
 
 #define NOEX_NOREDEF 0
@@ -42,7 +46,10 @@ struct cache_entry { https://github.com/ruby/ruby/blob/trunk/vm_method.c#L46
     VALUE defined_class;
 };
 
+#if OPT_GLOBAL_METHOD_CACHE
 static struct cache_entry global_method_cache[GLOBAL_METHOD_CACHE_SIZE];
+#endif
+
 #define ruby_running (GET_VM()->running)
 /* int ruby_running = 0; */
 
@@ -575,19 +582,24 @@ rb_method_entry_get_without_cache(VALUE https://github.com/ruby/ruby/blob/trunk/vm_method.c#L582
 	defined_class = me->klass;
 
     if (ruby_running) {
-	struct cache_entry *ent;
-	ent = GLOBAL_METHOD_CACHE(klass, id);
-	ent->class_serial = RCLASS_SERIAL(klass);
-	ent->method_state = GET_GLOBAL_METHOD_STATE();
-	ent->defined_class = defined_class;
-	ent->mid = id;
-
-	if (UNDEFINED_METHOD_ENTRY_P(me)) {
-	    ent->me = 0;
-	    me = 0;
+	if (OPT_GLOBAL_METHOD_CACHE) {
+	    struct cache_entry *ent;
+	    ent = GLOBAL_METHOD_CACHE(klass, id);
+	    ent->class_serial = RCLASS_SERIAL(klass);
+	    ent->method_state = GET_GLOBAL_METHOD_STATE();
+	    ent->defined_class = defined_class;
+	    ent->mid = id;
+
+	    if (UNDEFINED_METHOD_ENTRY_P(me)) {
+		ent->me = 0;
+		me = 0;
+	    }
+	    else {
+		ent->me = me;
+	    }
 	}
-	else {
-	    ent->me = me;
+	else if (UNDEFINED_METHOD_ENTRY_P(me)) {
+	    me = 0;
 	}
     }
 

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

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