ruby-changes:32223
From: nobu <ko1@a...>
Date: Fri, 20 Dec 2013 19:01:19 +0900 (JST)
Subject: [ruby-changes:32223] nobu:r44302 (trunk): vm_method: set automatically
nobu 2013-12-20 19:01:14 +0900 (Fri, 20 Dec 2013) New Revision: 44302 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44302 Log: vm_method: set automatically * vm_method.c (GLOBAL_METHOD_CACHE_MASK): set from GLOBAL_METHOD_CACHE_SIZE automatically. Modified files: trunk/vm_method.c Index: vm_method.c =================================================================== --- vm_method.c (revision 44301) +++ vm_method.c (revision 44302) @@ -5,8 +5,13 @@ https://github.com/ruby/ruby/blob/trunk/vm_method.c#L5 #ifndef GLOBAL_METHOD_CACHE_SIZE #define GLOBAL_METHOD_CACHE_SIZE 0x800 #endif +#define LSB_ONLY(x) ((x) & ~((x) - 1)) +#define POWOR_OF_2_P(x) ((x) == LSB_ONLY(x)) +#if !POWOR_OF_2_P(GLOBAL_METHOD_CACHE_SIZE) +# error GLOBAL_METHOD_CACHE_SIZE must be power of 2 +#endif #ifndef GLOBAL_METHOD_CACHE_MASK -#define GLOBAL_METHOD_CACHE_MASK 0x7ff +#define GLOBAL_METHOD_CACHE_MASK (GLOBAL_METHOD_CACHE_SIZE-1) #endif #define GLOBAL_METHOD_CACHE_KEY(c,m) ((((c)>>3)^(m))&GLOBAL_METHOD_CACHE_MASK) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/