Bug 603560 Workaround for Solaris Studio compiler, it failed to compile static const int x = { 1 }; r=edwsmith,nnethercote
authorGinn Chen <ginn.chen@oracle.com>
Mon, 18 Oct 2010 19:46:04 +0800
changeset 56197 dd3ec76eacea439997114f5493a8495f834aa4db
parent 56196 a2478086e84552d4766538c767cff300053ab1be
child 56198 aedbe1e95c929bbbbd8dfe099119e799253a663f
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersedwsmith, nnethercote
bugs603560
milestone2.0b8pre
Bug 603560 Workaround for Solaris Studio compiler, it failed to compile static const int x = { 1 }; r=edwsmith,nnethercote
js/src/nanojit/NativeCommon.h
js/src/nanojit/Nativei386.cpp
--- a/js/src/nanojit/NativeCommon.h
+++ b/js/src/nanojit/NativeCommon.h
@@ -56,17 +56,22 @@ namespace nanojit
     //
     // XXX: The exception to all the above is that if NJ_USE_UINT32_REGISTER
     // is defined, the back-end is responsible for defining its own Register
     // type, which will probably be an enum.  This is just to give all the
     // back-ends a chance to transition smoothly.
 #if defined(NJ_USE_UINT32_REGISTER)
     #define REGNUM(r) (r)
 
-#elif defined(DEBUG)
+#elif defined(DEBUG) || defined(__SUNPRO_CC)
+    // Always use struct declaration for 'Register' with
+    // Solaris Studio C++ compiler, because it has a bug:
+    // Scalar type can not be initialized by '{1}'.
+    // See bug 603560.
+
     struct Register {
         uint32_t n;     // the register number
     };
 
     static inline uint32_t REGNUM(Register r) {
         return r.n;
     }
 
--- a/js/src/nanojit/Nativei386.cpp
+++ b/js/src/nanojit/Nativei386.cpp
@@ -1132,25 +1132,16 @@ namespace nanojit
     #ifdef _MSC_VER
         _asm
         {
             mov ecx, regs
             bsf eax, set                    // i = first bit set
             btr RegAlloc::free[ecx], eax    // free &= ~rmask(i)
             mov r, eax
         }
-    #elif defined __SUNPRO_CC
-        // Workaround for Sun Studio bug on handler embeded asm code.
-        // See bug 544447 for detail.
-        // https://bugzilla.mozilla.org/show_bug.cgi?id=544447
-         asm(
-             "bsf    %1, %%edi\n\t"
-             "btr    %%edi, (%2)\n\t"
-             "movl   %%edi, %0\n\t"
-             : "=a"(r) : "d"(set), "c"(&regs.free) : "%edi", "memory" );
     #else
         asm(
             "bsf    %1, %%eax\n\t"
             "btr    %%eax, %2\n\t"
             "movl   %%eax, %0\n\t"
             : "=m"(r) : "m"(set), "m"(regs.free) : "%eax", "memory" );
     #endif /* _MSC_VER */
         return r;