mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
68e2a2e5ce
commit
d4d671f2b0
2 changed files with 1 additions and 16 deletions
2
tool/ruby_vm/models/bare_instructions.rb
Normal file → Executable file
2
tool/ruby_vm/models/bare_instructions.rb
Normal file → Executable file
|
@ -128,7 +128,7 @@ class RubyVM::BareInstructions
|
||||||
generate_attribute 'rb_num_t', 'popn', pops.size
|
generate_attribute 'rb_num_t', 'popn', pops.size
|
||||||
generate_attribute 'rb_num_t', 'retn', rets.size
|
generate_attribute 'rb_num_t', 'retn', rets.size
|
||||||
generate_attribute 'rb_num_t', 'width', width
|
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
|
generate_attribute 'bool', 'handles_frame', false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -101,22 +101,7 @@ enum vm_regan_acttype {
|
||||||
#define DEC_SP(x) (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
|
#define DEC_SP(x) (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
|
||||||
#define SET_SV(x) (*GET_SP() = (x))
|
#define SET_SV(x) (*GET_SP() = (x))
|
||||||
/* set current stack value as 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)
|
#define ADJ_SP(x) INC_SP(x)
|
||||||
#endif
|
|
||||||
|
|
||||||
/* instruction sequence C struct */
|
/* instruction sequence C struct */
|
||||||
#define GET_ISEQ() (GET_CFP()->iseq)
|
#define GET_ISEQ() (GET_CFP()->iseq)
|
||||||
|
|
Loading…
Add table
Reference in a new issue