Skip to content

Commit d4d671f

Browse files
committed
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
1 parent 68e2a2e commit d4d671f

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

tool/ruby_vm/models/bare_instructions.rb

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def predefine_attributes
128128
generate_attribute 'rb_num_t', 'popn', pops.size
129129
generate_attribute 'rb_num_t', 'retn', rets.size
130130
generate_attribute 'rb_num_t', 'width', width
131-
generate_attribute 'rb_num_t', 'sp_inc', rets.size - pops.size
131+
generate_attribute 'rb_snum_t', 'sp_inc', rets.size - pops.size
132132
generate_attribute 'bool', 'handles_frame', false
133133
end
134134

vm_insnhelper.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,22 +101,7 @@ enum vm_regan_acttype {
101101
#define DEC_SP(x) (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
102102
#define SET_SV(x) (*GET_SP() = (x))
103103
/* set current stack value as x */
104-
#ifdef _MSC_VER
105-
/* Workaround needed for adding negative number to a pointer */
106-
#define ADJ_SP(x) do { \
107-
rb_snum_t adj = (x); \
108-
if (adj >= 0) { \
109-
INC_SP(adj); \
110-
} \
111-
else { \
112-
SIGNED_VALUE dec = -1; \
113-
dec *= adj; \
114-
DEC_SP(dec); \
115-
} \
116-
} while (0)
117-
#else
118104
#define ADJ_SP(x) INC_SP(x)
119-
#endif
120105

121106
/* instruction sequence C struct */
122107
#define GET_ISEQ() (GET_CFP()->iseq)

0 commit comments

Comments
 (0)