ruby-changes:49985
From: nobu <ko1@a...>
Date: Tue, 30 Jan 2018 12:21:58 +0900 (JST)
Subject: [ruby-changes:49985] nobu:r62103 (trunk): bare_instructions.rb: sp_inc is signed
nobu 2018-01-30 12:21:52 +0900 (Tue, 30 Jan 2018) New Revision: 62103 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62103 Log: bare_instructions.rb: sp_inc is signed * tool/ruby_vm/models/bare_instructions.rb (predefine_attributes): `sp_inc` attribute which may return negative values must be signed `rb_snum_t`, to be signed-expanded at type promotion. * vm_insnhelper.h (ADJ_SP): removed the workaround for platforms where rb_num_t is wider than int. Modified files: trunk/tool/ruby_vm/models/bare_instructions.rb trunk/vm_insnhelper.h Index: tool/ruby_vm/models/bare_instructions.rb =================================================================== --- tool/ruby_vm/models/bare_instructions.rb (revision 62102) +++ tool/ruby_vm/models/bare_instructions.rb (revision 62103) @@ -128,7 +128,7 @@ class RubyVM::BareInstructions https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/models/bare_instructions.rb#L128 generate_attribute 'rb_num_t', 'popn', pops.size generate_attribute 'rb_num_t', 'retn', rets.size generate_attribute 'rb_num_t', 'width', width - generate_attribute 'rb_num_t', 'sp_inc', rets.size - pops.size + generate_attribute 'rb_snum_t', 'sp_inc', rets.size - pops.size generate_attribute 'bool', 'handles_frame', false end Property changes on: tool/ruby_vm/models/bare_instructions.rb ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: vm_insnhelper.h =================================================================== --- vm_insnhelper.h (revision 62102) +++ vm_insnhelper.h (revision 62103) @@ -101,22 +101,7 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L101 #define DEC_SP(x) (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x)))) #define SET_SV(x) (*GET_SP() = (x)) /* set current stack value as x */ -#ifdef _MSC_VER -/* Workaround needed for adding negative number to a pointer */ -#define ADJ_SP(x) do { \ - rb_snum_t adj = (x); \ - if (adj >= 0) { \ - INC_SP(adj); \ - } \ - else { \ - SIGNED_VALUE dec = -1; \ - dec *= adj; \ - DEC_SP(dec); \ - } \ -} while (0) -#else #define ADJ_SP(x) INC_SP(x) -#endif /* instruction sequence C struct */ #define GET_ISEQ() (GET_CFP()->iseq) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/