From b26ece67a06a8c2e2a24e4149e527832052d5720 Mon Sep 17 00:00:00 2001 From: Ginn Chen Date: Wed, 6 Jan 2010 15:25:56 +0800 Subject: [PATCH] Bug 537371 [x86_64]nanojit failed to compile with Sun Studio r=gal --- js/src/nanojit/avmplus.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/src/nanojit/avmplus.h b/js/src/nanojit/avmplus.h index 0f5fc9db469..692d312e941 100644 --- a/js/src/nanojit/avmplus.h +++ b/js/src/nanojit/avmplus.h @@ -111,7 +111,7 @@ __declspec(naked) static inline __int64 rdtsc() ret; } } -#elif defined(SOLARIS) +#elif defined(__SUNPRO_C) || defined (__SUNPRO_CC) static inline unsigned long long rdtsc(void) { unsigned long long int x; @@ -129,12 +129,21 @@ static __inline__ unsigned long long rdtsc(void) #elif defined(__x86_64__) +#if defined(__SUNPRO_C) || defined (__SUNPRO_CC) +static inline uint64_t rdtsc(void) +{ + unsigned hi, lo; + asm volatile ("rdtsc" : "=a"(lo), "=d"(hi)); + return ( (uint64_t)lo)|( ((uint64_t)hi)<<32 ); +} +#else static __inline__ uint64_t rdtsc(void) { unsigned hi, lo; __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); return ( (uint64_t)lo)|( ((uint64_t)hi)<<32 ); } +#endif #elif defined(_MSC_VER) && defined(_M_AMD64)