Fix winmo macro madness breakage
authorRick Reitmaier <rreitmai@adobe.com>
Thu, 27 May 2010 11:29:47 -0700
changeset 43272 22f85f696bc2af8e7549bb85daae7b57f0eb2f4a
parent 43271 f0d5f28aa61e4dbf92dd570af2d87d8c0f3c7879
child 43273 e2405f332a7bc270a2e5c755906cff1cf2070f10
push idunknown
push userunknown
push dateunknown
milestone1.9.3a5pre
Fix winmo macro madness breakage Extra parenthesis needed in order to correctly resolve macros; NativeARM.cpp(2040) : error C2105: '--' needs l-value
js/src/nanojit/NativeARM.h
--- a/js/src/nanojit/NativeARM.h
+++ b/js/src/nanojit/NativeARM.h
@@ -602,97 +602,97 @@ enum {
 #define MR(d,s)                     MOV(d,s)
 #define ST(base,offset,reg)         STR(reg,base,offset)
 
 // Load a byte (8 bits). The offset range is ±4095.
 #define LDRB(_d,_n,_off) do {                                           \
         NanoAssert(IsGpReg(_d) && IsGpReg(_n));                         \
         underrunProtect(4);                                             \
         if (_off < 0) {                                                 \
-            NanoAssert(isU12(-_off));                                   \
-            *(--_nIns) = (NIns)( COND_AL | (0x55<<20) | ((_n)<<16) | ((_d)<<12) | ((-_off)&0xfff)  ); \
+            NanoAssert(isU12(-(_off)));                                 \
+            *(--_nIns) = (NIns)( COND_AL | (0x55<<20) | ((_n)<<16) | ((_d)<<12) | ((-(_off))&0xfff)  ); \
         } else {                                                        \
             NanoAssert(isU12(_off));                                    \
             *(--_nIns) = (NIns)( COND_AL | (0x5D<<20) | ((_n)<<16) | ((_d)<<12) | ((_off)&0xfff)  ); \
         }                                                               \
         asm_output("ldrb %s, [%s,#%d]", gpn(_d),gpn(_n),(_off));        \
     } while(0)
 
 // Load a byte (8 bits), sign-extend to 32 bits. The offset range is
 // ±255 (different from LDRB, same as LDRH/LDRSH)
 #define LDRSB(_d,_n,_off) do {                                          \
         NanoAssert(IsGpReg(_d) && IsGpReg(_n));                         \
         underrunProtect(4);                                             \
         if (_off < 0) {                                                 \
-            NanoAssert(isU8(-_off));                                    \
-            *(--_nIns) = (NIns)( COND_AL | (0x15<<20) | ((_n)<<16) | ((_d)<<12) | ((0xD)<<4) | (((-_off)&0xf0)<<4) | ((-_off)&0xf) ); \
+            NanoAssert(isU8(-(_off)));                                  \
+            *(--_nIns) = (NIns)( COND_AL | (0x15<<20) | ((_n)<<16) | ((_d)<<12) | ((0xD)<<4) | (((-(_off))&0xf0)<<4) | ((-(_off))&0xf) ); \
         } else {                                                        \
             NanoAssert(isU8(_off));                                     \
             *(--_nIns) = (NIns)( COND_AL | (0x1D<<20) | ((_n)<<16) | ((_d)<<12) | ((0xD)<<4) | (((_off)&0xf0)<<4) | ((_off)&0xf) ); \
         }                                                               \
         asm_output("ldrsb %s, [%s,#%d]", gpn(_d),gpn(_n),(_off));       \
     } while(0)
 
 // Load and sign-extend a half word (16 bits). The offset range is ±255, and
 // must be aligned to two bytes on some architectures (the caller is responsible
 // for ensuring appropriate alignment)
 #define LDRH(_d,_n,_off) do {                                           \
         NanoAssert(IsGpReg(_d) && IsGpReg(_n));                         \
         underrunProtect(4);                                             \
         if (_off < 0) {                                                 \
-            NanoAssert(isU8(-_off));                                    \
-            *(--_nIns) = (NIns)( COND_AL | (0x15<<20) | ((_n)<<16) | ((_d)<<12) | ((0xB)<<4) | (((-_off)&0xf0)<<4) | ((-_off)&0xf) ); \
+            NanoAssert(isU8(-(_off)));                                  \
+            *(--_nIns) = (NIns)( COND_AL | (0x15<<20) | ((_n)<<16) | ((_d)<<12) | ((0xB)<<4) | (((-(_off))&0xf0)<<4) | ((-(_off))&0xf) ); \
         } else {                                                        \
             NanoAssert(isU8(_off));                                     \
             *(--_nIns) = (NIns)( COND_AL | (0x1D<<20) | ((_n)<<16) | ((_d)<<12) | ((0xB)<<4) | (((_off)&0xf0)<<4) | ((_off)&0xf) ); \
         }                                                               \
         asm_output("ldrh %s, [%s,#%d]", gpn(_d),gpn(_n),(_off));       \
     } while(0)
 
 // Load and sign-extend a half word (16 bits). The offset range is ±255, and
 // must be aligned to two bytes on some architectures (the caller is responsible
 // for ensuring appropriate alignment)
 #define LDRSH(_d,_n,_off) do {                                          \
         NanoAssert(IsGpReg(_d) && IsGpReg(_n));                         \
         underrunProtect(4);                                             \
         if (_off < 0) {                                                 \
-            NanoAssert(isU8(-_off));                                    \
-            *(--_nIns) = (NIns)( COND_AL | (0x15<<20) | ((_n)<<16) | ((_d)<<12) | ((0xF)<<4) | (((-_off)&0xf0)<<4) | ((-_off)&0xf) ); \
+            NanoAssert(isU8(-(_off)));                                  \
+            *(--_nIns) = (NIns)( COND_AL | (0x15<<20) | ((_n)<<16) | ((_d)<<12) | ((0xF)<<4) | (((-(_off))&0xf0)<<4) | ((-(_off))&0xf) ); \
         } else {                                                        \
             NanoAssert(isU8(_off));                                     \
             *(--_nIns) = (NIns)( COND_AL | (0x1D<<20) | ((_n)<<16) | ((_d)<<12) | ((0xF)<<4) | (((_off)&0xf0)<<4) | ((_off)&0xf) ); \
         }                                                               \
         asm_output("ldrsh %s, [%s,#%d]", gpn(_d),gpn(_n),(_off));       \
     } while(0)
 
 // Valid offset for STR and STRB is +/- 4095, STRH only has +/- 255
 #define STR(_d,_n,_off) do {                                            \
         NanoAssert(IsGpReg(_d) && IsGpReg(_n));                         \
-        NanoAssert(isU12(_off) || isU12(-_off));                        \
+        NanoAssert(isU12(_off) || isU12(-(_off)));                      \
         underrunProtect(4);                                             \
         if ((_off)<0)   *(--_nIns) = (NIns)( COND_AL | (0x50<<20) | ((_n)<<16) | ((_d)<<12) | ((-(_off))&0xFFF) ); \
         else            *(--_nIns) = (NIns)( COND_AL | (0x58<<20) | ((_n)<<16) | ((_d)<<12) | ((_off)&0xFFF) ); \
         asm_output("str %s, [%s, #%d]", gpn(_d), gpn(_n), (_off)); \
     } while(0)
 
 #define STRB(_d,_n,_off) do {                                           \
         NanoAssert(IsGpReg(_d) && IsGpReg(_n));                         \
-        NanoAssert(isU12(_off) || isU12(-_off));                        \
+        NanoAssert(isU12(_off) || isU12(-(_off)));                      \
         underrunProtect(4);                                             \
         if ((_off)<0)   *(--_nIns) = (NIns)( COND_AL | (0x54<<20) | ((_n)<<16) | ((_d)<<12) | ((-(_off))&0xFFF) ); \
         else            *(--_nIns) = (NIns)( COND_AL | (0x5C<<20) | ((_n)<<16) | ((_d)<<12) | ((_off)&0xFFF) ); \
         asm_output("strb %s, [%s, #%d]", gpn(_d), gpn(_n), (_off)); \
     } while(0)
 
 // Only +/- 255 range, unlike STRB/STR
 #define STRH(_d,_n,_off) do {                                           \
         NanoAssert(IsGpReg(_d) && IsGpReg(_n));                         \
         underrunProtect(4);                                             \
         if ((_off)<0) {                                                 \
-            NanoAssert(isU8(-_off));                                    \
+            NanoAssert(isU8(-(_off)));                                  \
             *(--_nIns) = (NIns)( COND_AL | (0x14<<20) | ((_n)<<16) | ((_d)<<12) | (((-(_off))&0xF0)<<4) | (0xB<<4) | ((-(_off))&0xF) ); \
         } else {                                                        \
             NanoAssert(isU8(_off));                                     \
             *(--_nIns) = (NIns)( COND_AL | (0x1C<<20) | ((_n)<<16) | ((_d)<<12) | (((_off)&0xF0)<<4) | (0xB<<4) | ((_off)&0xF) ); \
         }                                                               \
         asm_output("strh %s, [%s, #%d]", gpn(_d), gpn(_n), (_off));     \
     } while(0)