Mon, 04 May 2015 23:23:37 -0400
8077674: BSD build failures due to undefined macros
Reviewed-by: dsamersoff, kbarrett, hseigel
1.1 --- a/src/os/bsd/vm/os_bsd.cpp Mon May 04 16:53:05 2015 +0000 1.2 +++ b/src/os/bsd/vm/os_bsd.cpp Mon May 04 23:23:37 2015 -0400 1.3 @@ -1197,12 +1197,18 @@ 1.4 guarantee(retval != 0, "just checking"); 1.5 return retval; 1.6 1.7 -#elif __FreeBSD__ 1.8 +#else 1.9 + #ifdef __FreeBSD__ 1.10 retval = syscall(SYS_thr_self); 1.11 -#elif __OpenBSD__ 1.12 + #else 1.13 + #ifdef __OpenBSD__ 1.14 retval = syscall(SYS_getthrid); 1.15 -#elif __NetBSD__ 1.16 + #else 1.17 + #ifdef __NetBSD__ 1.18 retval = (pid_t) syscall(SYS__lwp_self); 1.19 + #endif 1.20 + #endif 1.21 + #endif 1.22 #endif 1.23 1.24 if (retval == -1) {
2.1 --- a/src/os/linux/vm/os_linux.cpp Mon May 04 16:53:05 2015 +0000 2.2 +++ b/src/os/linux/vm/os_linux.cpp Mon May 04 23:23:37 2015 -0400 2.3 @@ -209,17 +209,23 @@ 2.4 2.5 #ifndef SYS_gettid 2.6 // i386: 224, ia64: 1105, amd64: 186, sparc 143 2.7 -#ifdef __ia64__ 2.8 -#define SYS_gettid 1105 2.9 -#elif __i386__ 2.10 -#define SYS_gettid 224 2.11 -#elif __amd64__ 2.12 -#define SYS_gettid 186 2.13 -#elif __sparc__ 2.14 -#define SYS_gettid 143 2.15 -#else 2.16 -#error define gettid for the arch 2.17 -#endif 2.18 + #ifdef __ia64__ 2.19 + #define SYS_gettid 1105 2.20 + #else 2.21 + #ifdef __i386__ 2.22 + #define SYS_gettid 224 2.23 + #else 2.24 + #ifdef __amd64__ 2.25 + #define SYS_gettid 186 2.26 + #else 2.27 + #ifdef __sparc__ 2.28 + #define SYS_gettid 143 2.29 + #else 2.30 + #error define gettid for the arch 2.31 + #endif 2.32 + #endif 2.33 + #endif 2.34 + #endif 2.35 #endif 2.36 2.37 // Cpu architecture string
3.1 --- a/src/os/windows/vm/os_windows.cpp Mon May 04 16:53:05 2015 +0000 3.2 +++ b/src/os/windows/vm/os_windows.cpp Mon May 04 23:23:37 2015 -0400 3.3 @@ -110,11 +110,13 @@ 3.4 static FILETIME process_kernel_time; 3.5 3.6 #ifdef _M_IA64 3.7 -#define __CPU__ ia64 3.8 -#elif _M_AMD64 3.9 -#define __CPU__ amd64 3.10 + #define __CPU__ ia64 3.11 #else 3.12 -#define __CPU__ i486 3.13 + #ifdef _M_AMD64 3.14 + #define __CPU__ amd64 3.15 + #else 3.16 + #define __CPU__ i486 3.17 + #endif 3.18 #endif 3.19 3.20 // save DLL module handle, used by GetModuleFileName 3.21 @@ -2138,20 +2140,22 @@ 3.22 // at the beginning of the target bundle. 3.23 exceptionInfo->ContextRecord->StIPSR &= 0xFFFFF9FFFFFFFFFF; 3.24 assert(((DWORD64)handler & 0xF) == 0, "Target address must point to the beginning of a bundle!"); 3.25 -#elif _M_AMD64 3.26 +#else 3.27 + #ifdef _M_AMD64 3.28 // Do not blow up if no thread info available. 3.29 if (thread) { 3.30 thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Rip); 3.31 } 3.32 // Set pc to handler 3.33 exceptionInfo->ContextRecord->Rip = (DWORD64)handler; 3.34 -#else 3.35 + #else 3.36 // Do not blow up if no thread info available. 3.37 if (thread) { 3.38 thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Eip); 3.39 } 3.40 // Set pc to handler 3.41 exceptionInfo->ContextRecord->Eip = (DWORD)(DWORD_PTR)handler; 3.42 + #endif 3.43 #endif 3.44 3.45 // Continue the execution 3.46 @@ -2250,7 +2254,8 @@ 3.47 // (division by zero is handled explicitly) 3.48 #ifdef _M_IA64 3.49 assert(0, "Fix Handle_IDiv_Exception"); 3.50 -#elif _M_AMD64 3.51 +#else 3.52 + #ifdef _M_AMD64 3.53 PCONTEXT ctx = exceptionInfo->ContextRecord; 3.54 address pc = (address)ctx->Rip; 3.55 assert(pc[0] == 0xF7, "not an idiv opcode"); 3.56 @@ -2261,7 +2266,7 @@ 3.57 ctx->Rax = (DWORD)min_jint; // result 3.58 ctx->Rdx = (DWORD)0; // remainder 3.59 // Continue the execution 3.60 -#else 3.61 + #else 3.62 PCONTEXT ctx = exceptionInfo->ContextRecord; 3.63 address pc = (address)ctx->Eip; 3.64 assert(pc[0] == 0xF7, "not an idiv opcode"); 3.65 @@ -2272,6 +2277,7 @@ 3.66 ctx->Eax = (DWORD)min_jint; // result 3.67 ctx->Edx = (DWORD)0; // remainder 3.68 // Continue the execution 3.69 + #endif 3.70 #endif 3.71 return EXCEPTION_CONTINUE_EXECUTION; 3.72 } 3.73 @@ -2351,10 +2357,12 @@ 3.74 // This is needed for IA64 because "relocation" / "implicit null check" / "poll instruction" 3.75 // information is saved in the Unix format. 3.76 address pc_unix_format = (address) ((((uint64_t)pc) & 0xFFFFFFFFFFFFFFF0) | ((((uint64_t)pc) & 0xF) >> 2)); 3.77 -#elif _M_AMD64 3.78 +#else 3.79 + #ifdef _M_AMD64 3.80 address pc = (address) exceptionInfo->ContextRecord->Rip; 3.81 -#else 3.82 + #else 3.83 address pc = (address) exceptionInfo->ContextRecord->Eip; 3.84 + #endif 3.85 #endif 3.86 Thread* t = ThreadLocalStorage::get_thread_slow(); // slow & steady 3.87