Bug 484291 - INS_CONSTPTR should not cast to void*; callers should do their own casting if they want to interpret numbers as pointers. r=gal
authorJeff Walden <jwalden@mit.edu>
Thu, 19 Mar 2009 16:58:23 -0700
changeset 26405 790dbbb477d4914dc2643a090126c39728154739
parent 26404 7420047c0e68b718b2faa0a28e199944bee24e48
child 26406 19d25e2a170fb2d482dd9db556d253be782543e9
push id6049
push userrsayre@mozilla.com
push dateFri, 20 Mar 2009 07:37:42 +0000
treeherdermozilla-central@19d25e2a170f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal
bugs484291
milestone1.9.2a1pre
Bug 484291 - INS_CONSTPTR should not cast to void*; callers should do their own casting if they want to interpret numbers as pointers. r=gal
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -217,17 +217,17 @@ js_InitJITStatsClass(JSContext *cx, JSOb
 }
 
 #define AUDIT(x) (jitstats.x++)
 #else
 #define AUDIT(x) ((void)0)
 #endif /* JS_JIT_SPEW */
 
 #define INS_CONST(c)        addName(lir->insImm(c), #c)
-#define INS_CONSTPTR(p)     addName(lir->insImmPtr((void*) (p)), #p)
+#define INS_CONSTPTR(p)     addName(lir->insImmPtr(p), #p)
 #define INS_CONSTFUNPTR(p)  addName(lir->insImmPtr(JS_FUNC_TO_DATA_PTR(void*, p)), #p)
 
 using namespace avmplus;
 using namespace nanojit;
 
 static GC gc = GC();
 static avmplus::AvmCore s_core = avmplus::AvmCore();
 static avmplus::AvmCore* core = &s_core;
@@ -5007,17 +5007,17 @@ TraceRecorder::ifop()
                       lir->ins2(LIR_feq, v_ins, v_ins),
                       lir->ins_eq0(lir->ins2(LIR_feq, v_ins, lir->insImmq(0))));
     } else if (JSVAL_IS_STRING(v)) {
         cond = JSSTRING_LENGTH(JSVAL_TO_STRING(v)) != 0;
         x = lir->ins2(LIR_piand,
                       lir->insLoad(LIR_ldp,
                                    v_ins,
                                    (int)offsetof(JSString, length)),
-                      INS_CONSTPTR(JSSTRING_LENGTH_MASK));
+                      INS_CONSTPTR(reinterpret_cast<void *>(JSSTRING_LENGTH_MASK)));
     } else {
         JS_NOT_REACHED("ifop");
         return false;
     }
     flipIf(cx->fp->regs->pc, cond);
     guard(cond, x, BRANCH_EXIT);
     return true;
 }
@@ -6420,17 +6420,17 @@ TraceRecorder::record_JSOP_NOT()
     }
     if (JSVAL_TAG(v) == JSVAL_OBJECT) {
         set(&v, lir->ins_eq0(get(&v)));
         return true;
     }
     JS_ASSERT(JSVAL_IS_STRING(v));
     set(&v, lir->ins_eq0(lir->ins2(LIR_piand,
                                    lir->insLoad(LIR_ldp, get(&v), (int)offsetof(JSString, length)),
-                                   INS_CONSTPTR(JSSTRING_LENGTH_MASK))));
+                                   INS_CONSTPTR(reinterpret_cast<void *>(JSSTRING_LENGTH_MASK)))));
     return true;
 }
 
 JS_REQUIRES_STACK bool
 TraceRecorder::record_JSOP_BITNOT()
 {
     return unary(LIR_not);
 }
@@ -9352,29 +9352,29 @@ TraceRecorder::record_JSOP_LENGTH()
     if (JSVAL_IS_PRIMITIVE(l)) {
         if (!JSVAL_IS_STRING(l))
             ABORT_TRACE("non-string primitive JSOP_LENGTH unsupported");
         LIns* str_ins = get(&l);
         LIns* len_ins = lir->insLoad(LIR_ldp, str_ins, (int)offsetof(JSString, length));
 
         LIns* masked_len_ins = lir->ins2(LIR_piand,
                                          len_ins,
-                                         INS_CONSTPTR(JSSTRING_LENGTH_MASK));
-
-        LIns *choose_len_ins =
+                                         INS_CONSTPTR(reinterpret_cast<void *>(JSSTRING_LENGTH_MASK)));
+
+        LIns* choose_len_ins =
             lir->ins_choose(lir->ins_eq0(lir->ins2(LIR_piand,
                                                    len_ins,
-                                                   INS_CONSTPTR(JSSTRFLAG_DEPENDENT))),
+                                                   INS_CONSTPTR(reinterpret_cast<void *>(JSSTRFLAG_DEPENDENT)))),
                             masked_len_ins,
                             lir->ins_choose(lir->ins_eq0(lir->ins2(LIR_piand,
                                                                    len_ins,
-                                                                   INS_CONSTPTR(JSSTRFLAG_PREFIX))),
+                                                                   INS_CONSTPTR(reinterpret_cast<void *>(JSSTRFLAG_PREFIX)))),
                                             lir->ins2(LIR_piand,
                                                       len_ins,
-                                                      INS_CONSTPTR(JSSTRDEP_LENGTH_MASK)),
+                                                      INS_CONSTPTR(reinterpret_cast<void *>(JSSTRDEP_LENGTH_MASK))),
                                             masked_len_ins));
 
         set(&l, lir->ins1(LIR_i2f, choose_len_ins));
         return true;
     }
 
     JSObject* obj = JSVAL_TO_OBJECT(l);
     LIns* obj_ins = get(&l);