diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | insnhelper.h | 6 | ||||
-rw-r--r-- | insns.def | 6 |
3 files changed, 15 insertions, 6 deletions
@@ -1,3 +1,12 @@ +Fri Jun 1 13:02:35 2007 NAKAMURA Usaku <usa@ruby-lang.org> + + * insnhelper.h (INC_SP): shouldn't cast ``x'' to unsigned type because + it might be a negative value. + + * insnhelper.h, insns.def: shoudn't use unary minus operator in index + operator. some compilers (such as VC++8 x64) cannot deal it with + expected way. + Fri Jun 1 11:33:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> * numeric.c (num_round): should convert self to Float. diff --git a/insnhelper.h b/insnhelper.h index b4ced7a50a..1c13dd4df2 100644 --- a/insnhelper.h +++ b/insnhelper.h @@ -27,7 +27,7 @@ #define TOPN(n) (*(GET_SP()-(n)-1)) #define POPN(n) (INC_SP(-(n))) #define POP() (INC_SP(-1)) -#define STACK_ADDR_FROM_TOP(n) (&GET_SP()[-(n)]) +#define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n)) #define GET_TOS() (tos) /* dummy */ @@ -83,7 +83,7 @@ /* SP */ #define GET_SP() (USAGE_ANALYSIS_REGISTER_HELPER(1, 0, REG_SP)) #define SET_SP(x) (REG_SP = (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x)))) -#define INC_SP(x) (REG_SP += ((VALUE)(USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (VALUE)(x))))) +#define INC_SP(x) (REG_SP += (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x)))) #define SET_SV(x) (*GET_SP() = (x)) /* set current stack value as x */ @@ -98,7 +98,7 @@ /* deal with variables */ /**********************************************************/ -#define GET_CURRENT_DYNAMIC(idx) (GET_DFP()[-idx]) +#define GET_CURRENT_DYNAMIC(idx) (*(GET_DFP() -(idx))) #define GET_PREV_DFP(dfp) ((VALUE *)((dfp)[0] & ~0x03)) #define GET_GLOBAL(entry) rb_gvar_get((struct global_entry*)entry) @@ -806,7 +806,7 @@ setn (..., VALUE val) (VALUE val) // inc += 0 { - GET_SP()[-n] = val; + TOPN(n-1) = val; } /** @@ -1183,8 +1183,8 @@ send id = SYMBOL_P(sym) ? SYM2ID(sym) : rb_to_id(sym); /* shift arguments */ - for (i=1; i<num; i++) { - GET_SP()[-num+i-1] = GET_SP()[(-num+i-1)+1]; + for (i=num-1; i>0; i--) { + TOPN(i) = TOPN(i-1); } mn = rb_method_node(klass, id); |