Fix MSVC sensitivity to symbols called 'far'
authorGraydon Hoare <>
Tue, 04 Nov 2008 16:28:05 -0800
changeset 21499 5712af41e2045d9fe389ea60144def55b482519f
parent 21498 82f0753225094a5791ee37f3b8c93233e911f899
child 21500 54246bd0b6174ee3ee685233a8f337a45a35ab52
push id3558
push dateSat, 08 Nov 2008 09:06:43 +0000
treeherdermozilla-central@17747605490c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Fix MSVC sensitivity to symbols called 'far'
--- a/js/src/nanojit/Nativei386.cpp
+++ b/js/src/nanojit/Nativei386.cpp
@@ -820,77 +820,77 @@ namespace nanojit
             ST(rd, dd+4, t);
             LD(t, ds+4, rs);
             ST(rd, dd, t);
             LD(t, ds, rs);
-	NIns* Assembler::asm_branch(bool branchOnFalse, LInsp cond, NIns* targ, bool far)
+	NIns* Assembler::asm_branch(bool branchOnFalse, LInsp cond, NIns* targ, bool isfar)
 		NIns* at = 0;
 		LOpcode condop = cond->opcode();
 		if (condop >= LIR_feq && condop <= LIR_fge)
 			return asm_jmpcc(branchOnFalse, cond, targ);
 		// produce the branch
 		if (branchOnFalse)
 			if (condop == LIR_eq)
-				JNE(targ, far);
+				JNE(targ, isfar);
 			else if (condop == LIR_ov)
-				JNO(targ, far);
+				JNO(targ, isfar);
 			else if (condop == LIR_cs)
-				JNC(targ, far);
+				JNC(targ, isfar);
 			else if (condop == LIR_lt)
-				JNL(targ, far);
+				JNL(targ, isfar);
 			else if (condop == LIR_le)
-				JNLE(targ, far);
+				JNLE(targ, isfar);
 			else if (condop == LIR_gt)
-				JNG(targ, far);
+				JNG(targ, isfar);
 			else if (condop == LIR_ge)
-				JNGE(targ, far);
+				JNGE(targ, isfar);
 			else if (condop == LIR_ult)
-				JNB(targ, far);
+				JNB(targ, isfar);
 			else if (condop == LIR_ule)
-				JNBE(targ, far);
+				JNBE(targ, isfar);
 			else if (condop == LIR_ugt)
-				JNA(targ, far);
+				JNA(targ, isfar);
 			else //if (condop == LIR_uge)
-				JNAE(targ, far);
+				JNAE(targ, isfar);
 		else // op == LIR_xt
 			if (condop == LIR_eq)
-				JE(targ, far);
+				JE(targ, isfar);
 			else if (condop == LIR_ov)
-				JO(targ, far);
+				JO(targ, isfar);
 			else if (condop == LIR_cs)
-				JC(targ, far);
+				JC(targ, isfar);
 			else if (condop == LIR_lt)
-				JL(targ, far);
+				JL(targ, isfar);
 			else if (condop == LIR_le)
-				JLE(targ, far);
+				JLE(targ, isfar);
 			else if (condop == LIR_gt)
-				JG(targ, far);
+				JG(targ, isfar);
 			else if (condop == LIR_ge)
-				JGE(targ, far);
+				JGE(targ, isfar);
 			else if (condop == LIR_ult)
-				JB(targ, far);
+				JB(targ, isfar);
 			else if (condop == LIR_ule)
-				JBE(targ, far);
+				JBE(targ, isfar);
 			else if (condop == LIR_ugt)
-				JA(targ, far);
+				JA(targ, isfar);
 			else //if (condop == LIR_uge)
-				JAE(targ, far);
+				JAE(targ, isfar);
 		at = _nIns;
 		return at;
 	void Assembler::asm_cmp(LIns *cond)
--- a/js/src/nanojit/Nativei386.h
+++ b/js/src/nanojit/Nativei386.h
@@ -382,20 +382,20 @@ namespace nanojit
 	NanoAssert(((unsigned)r)<8); \
 	*(--_nIns) = (uint8_t) ( 0x58 | (r) ); \
 	asm_output1("pop %s",gpn(r)); } while(0)
 #define JCC32 0x0f
 #define JMP8  0xeb
 #define JMP32 0xe9  
-#define JCC(o,t,far,n) do { \
+#define JCC(o,t,isfar,n) do { \
 	underrunProtect(6);	\
 	intptr_t tt = (intptr_t)t - (intptr_t)_nIns;	\
-	if (isS8(tt) && !far) { \
+	if (isS8(tt) && !isfar) { \
 		verbose_only( NIns* next = _nIns; (void)next; ) \
 		_nIns -= 2; \
 		_nIns[0] = (uint8_t) ( 0x70 | (o) ); \
 		_nIns[1] = (uint8_t) (tt); \
 		asm_output2("%s %p",(n),(next+tt)); \
 	} else { \
 		verbose_only( NIns* next = _nIns; ) \
 		IMM32(tt); \
@@ -427,45 +427,45 @@ namespace nanojit
 // this should only be used when you can guarantee there is enough room on the page
 #define JMP_long_nochk_offset(o) do {\
 		verbose_only( NIns* next = _nIns; (void)next; ) \
  		IMM32((o)); \
  		*(--_nIns) = JMP32; \
 		asm_output1("jmp %p",(next+(o))); } while(0)
-#define JE(t, far)	   JCC(0x04, t, far, "je")
-#define JNE(t, far)	   JCC(0x05, t, far, "jne")
-#define JP(t, far)	   JCC(0x0A, t, far, "jp")
-#define JNP(t, far)	   JCC(0x0B, t, far, "jnp")
+#define JE(t, isfar)	   JCC(0x04, t, isfar, "je")
+#define JNE(t, isfar)	   JCC(0x05, t, isfar, "jne")
+#define JP(t, isfar)	   JCC(0x0A, t, isfar, "jp")
+#define JNP(t, isfar)	   JCC(0x0B, t, isfar, "jnp")
-#define JB(t, far)	   JCC(0x02, t, far, "jb")
-#define JNB(t, far)	   JCC(0x03, t, far, "jnb")
-#define JBE(t, far)	   JCC(0x06, t, far, "jbe")
-#define JNBE(t, far)   JCC(0x07, t, far, "jnbe")
+#define JB(t, isfar)	   JCC(0x02, t, isfar, "jb")
+#define JNB(t, isfar)	   JCC(0x03, t, isfar, "jnb")
+#define JBE(t, isfar)	   JCC(0x06, t, isfar, "jbe")
+#define JNBE(t, isfar)   JCC(0x07, t, isfar, "jnbe")
-#define JA(t, far)	   JCC(0x07, t, far, "ja")
-#define JNA(t, far)	   JCC(0x06, t, far, "jna")
-#define JAE(t, far)	   JCC(0x03, t, far, "jae")
-#define JNAE(t, far)   JCC(0x02, t, far, "jnae")
+#define JA(t, isfar)	   JCC(0x07, t, isfar, "ja")
+#define JNA(t, isfar)	   JCC(0x06, t, isfar, "jna")
+#define JAE(t, isfar)	   JCC(0x03, t, isfar, "jae")
+#define JNAE(t, isfar)   JCC(0x02, t, isfar, "jnae")
-#define JL(t, far)	   JCC(0x0C, t, far, "jl")
-#define JNL(t, far)	   JCC(0x0D, t, far, "jnl")
-#define JLE(t, far)	   JCC(0x0E, t, far, "jle")
-#define JNLE(t, far)   JCC(0x0F, t, far, "jnle")
+#define JL(t, isfar)	   JCC(0x0C, t, isfar, "jl")
+#define JNL(t, isfar)	   JCC(0x0D, t, isfar, "jnl")
+#define JLE(t, isfar)	   JCC(0x0E, t, isfar, "jle")
+#define JNLE(t, isfar)   JCC(0x0F, t, isfar, "jnle")
-#define JG(t, far)	   JCC(0x0F, t, far, "jg")
-#define JNG(t, far)	   JCC(0x0E, t, far, "jng")
-#define JGE(t, far)	   JCC(0x0D, t, far, "jge")
-#define JNGE(t, far)   JCC(0x0C, t, far, "jnge")
+#define JG(t, isfar)	   JCC(0x0F, t, isfar, "jg")
+#define JNG(t, isfar)	   JCC(0x0E, t, isfar, "jng")
+#define JGE(t, isfar)	   JCC(0x0D, t, isfar, "jge")
+#define JNGE(t, isfar)   JCC(0x0C, t, isfar, "jnge")
-#define JC(t, far)     JCC(0x02, t, far, "jc")
-#define JNC(t, far)    JCC(0x03, t, far, "jnc")
-#define JO(t, far)     JCC(0x00, t, far, "jo")
-#define JNO(t, far)    JCC(0x01, t, far, "jno")
+#define JC(t, isfar)     JCC(0x02, t, isfar, "jc")
+#define JNC(t, isfar)    JCC(0x03, t, isfar, "jnc")
+#define JO(t, isfar)     JCC(0x00, t, isfar, "jo")
+#define JNO(t, isfar)    JCC(0x01, t, isfar, "jno")
 // sse instructions 
 #define SSE(c,d,s)  \
 		underrunProtect(9);	\
 		MODRM((d),(s));	\
 		_nIns -= 3; \
  		_nIns[0] = (uint8_t)(((c)>>16)&0xff); \
 		_nIns[1] = (uint8_t)(((c)>>8)&0xff); \