ruby-changes:26289
From: nobu <ko1@a...>
Date: Wed, 12 Dec 2012 16:07:36 +0900 (JST)
Subject: [ruby-changes:26289] nobu:r38340 (trunk): method.h: NOEX_SAFE_SHIFT_OFFSET
nobu 2012-12-12 16:07:25 +0900 (Wed, 12 Dec 2012) New Revision: 38340 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38340 Log: method.h: NOEX_SAFE_SHIFT_OFFSET * method.h (rb_method_flag_t): name a magic number for NOEX_SAFE and NOEX_WITH as NOEX_SAFE_SHIFT_OFFSET. * method.h (rb_method_type_t, method_optimized_type): C89 forbids a comma after the last element in enum. * proc.c (rb_method_entry_arity), vm_eval.c (vm_call0_body), vm_insnhelper.c (vm_call_method): add VM_METHOD_TYPE__MAX case. Modified files: trunk/ChangeLog trunk/method.h trunk/proc.c trunk/vm_eval.c trunk/vm_insnhelper.c Index: method.h =================================================================== --- method.h (revision 38339) +++ method.h (revision 38340) @@ -22,11 +22,14 @@ typedef enum { https://github.com/ruby/ruby/blob/trunk/method.h#L22 NOEX_MODFUNC = 0x12, NOEX_SUPER = 0x20, NOEX_VCALL = 0x40, - NOEX_RESPONDS = 0x80 + NOEX_RESPONDS = 0x80, + + NOEX_BIT_WIDTH = 8, + NOEX_SAFE_SHIFT_OFFSET = ((NOEX_BIT_WIDTH+3)/4)*4 /* round up to nibble */ } rb_method_flag_t; -#define NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F) -#define NOEX_WITH(n, s) (((s) << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC)) +#define NOEX_SAFE(n) ((int)((n) >> NOEX_SAFE_SHIFT_OFFSET) & 0x0F) +#define NOEX_WITH(n, s) (((s) << NOEX_SAFE_SHIFT_OFFSET) | (n) | (ruby_running ? 0 : NOEX_BASIC)) #define NOEX_WITH_SAFE(n) NOEX_WITH((n), rb_safe_level()) /* method data type */ @@ -44,6 +47,8 @@ typedef enum { https://github.com/ruby/ruby/blob/trunk/method.h#L47 VM_METHOD_TYPE_MISSING, /* wrapper for method_missing(id) */ VM_METHOD_TYPE_CFUNC_FRAMELESS, VM_METHOD_TYPE_REFINED, + + VM_METHOD_TYPE__MAX } rb_method_type_t; struct rb_call_info_struct; @@ -71,7 +76,9 @@ typedef struct rb_method_definition_stru https://github.com/ruby/ruby/blob/trunk/method.h#L76 VALUE proc; /* should be mark */ enum method_optimized_type { OPTIMIZED_METHOD_TYPE_SEND, - OPTIMIZED_METHOD_TYPE_CALL + OPTIMIZED_METHOD_TYPE_CALL, + + OPTIMIZED_METHOD_TYPE__MAX } optimize_type; struct rb_method_entry_struct *orig_me; } body; Index: ChangeLog =================================================================== --- ChangeLog (revision 38339) +++ ChangeLog (revision 38340) @@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Dec 12 16:07:23 2012 Nobuyoshi Nakada <nobu@r...> + + * method.h (rb_method_flag_t): name a magic number for NOEX_SAFE and + NOEX_WITH as NOEX_SAFE_SHIFT_OFFSET. + + * method.h (rb_method_type_t, method_optimized_type): C89 forbids a + comma after the last element in enum. + + * proc.c (rb_method_entry_arity), vm_eval.c (vm_call0_body), + vm_insnhelper.c (vm_call_method): add VM_METHOD_TYPE__MAX case. + Wed Dec 12 14:16:35 2012 Eric Hodel <drbrain@s...> * lib/rdoc/class_module.rb: Added RDoc::ClassModule#documented? which Index: vm_eval.c =================================================================== --- vm_eval.c (revision 38339) +++ vm_eval.c (revision 38340) @@ -227,6 +227,8 @@ vm_call0_body(rb_thread_t* th, rb_call_i https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L227 } case VM_METHOD_TYPE_UNDEF: break; + case VM_METHOD_TYPE__MAX: + break; } rb_bug("vm_call0: unsupported method type (%d)", ci->me->def->type); return Qundef; Index: proc.c =================================================================== --- proc.c (revision 38339) +++ proc.c (revision 38340) @@ -1686,6 +1686,8 @@ rb_method_entry_arity(const rb_method_en https://github.com/ruby/ruby/blob/trunk/proc.c#L1686 } case VM_METHOD_TYPE_REFINED: return -1; + case VM_METHOD_TYPE__MAX: + break; } rb_bug("rb_method_entry_arity: invalid method entry type (%d)", def->type); Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 38339) +++ vm_insnhelper.c (revision 38340) @@ -1786,6 +1786,8 @@ vm_call_method(rb_thread_t *th, rb_contr https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1786 goto zsuper_method_dispatch; } } + case VM_METHOD_TYPE__MAX: + break; } rb_bug("vm_call_method: unsupported method type (%d)", ci->me->def->type); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/