ruby-changes:34612
From: ko1 <ko1@a...>
Date: Fri, 4 Jul 2014 18:26:09 +0900 (JST)
Subject: [ruby-changes:34612] ko1:r46693 (trunk): * parse.y (must_be_dynamic_symbol): refactoring.
ko1 2014-07-04 18:11:05 +0900 (Fri, 04 Jul 2014) New Revision: 46693 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46693 Log: * parse.y (must_be_dynamic_symbol): refactoring. * add `inline'. * use UNLIKELY(). * check only DYNAMIC_SYM_P(), otherwise it is a bug. * lookup_id_str() is not needed in second condition. Modified files: trunk/ChangeLog trunk/parse.y Index: ChangeLog =================================================================== --- ChangeLog (revision 46692) +++ ChangeLog (revision 46693) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 4 18:03:35 2014 Koichi Sasada <ko1@a...> + + * parse.y (must_be_dynamic_symbol): refactoring. + * add `inline'. + * use UNLIKELY(). + * check only DYNAMIC_SYM_P(), otherwise it is a bug. + * lookup_id_str() is not needed in second condition. + Fri Jul 4 11:53:56 2014 Koichi Sasada <ko1@a...> * parse.y: remove unused code Index: parse.y =================================================================== --- parse.y (revision 46692) +++ parse.y (revision 46693) @@ -10414,16 +10414,23 @@ sym_check_asciionly(VALUE str) https://github.com/ruby/ruby/blob/trunk/parse.y#L10414 */ static ID intern_str(VALUE str); -static void +static inline void must_be_dynamic_symbol(VALUE x) { - st_data_t data; - if (STATIC_SYM_P(x) && lookup_id_str(RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT), &data)) { - rb_bug("wrong argument :%s (inappropriate Symbol)", RSTRING_PTR((VALUE)data)); - } - if (SPECIAL_CONST_P(x) || BUILTIN_TYPE(x) != T_SYMBOL) { - rb_bug("wrong argument type %s (expected Symbol)", - rb_builtin_class_name(x)); + if (UNLIKELY(DYNAMIC_SYM_P(x))) { + if (STATIC_SYM_P(x)) { + VALUE str; + + if (lookup_id_str(RSHIFT((unsigned long)(x),RUBY_SPECIAL_SHIFT), (st_data_t *)&str)) { + rb_bug("wrong argument: %s (inappropriate Symbol)", RSTRING_PTR(str)); + } + else { + rb_bug("wrong argument: inappropriate Symbol (%p)", (void *)x); + } + } + else { + rb_bug("wrong argument type %s (expected Symbol)", rb_builtin_class_name(x)); + } } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/