# HG changeset patch # User goetz # Date 1474561395 -7200 # Node ID de402e9ccaf3d9d5735c29fe810c35e12e387076 # Parent 8899d50bd985969d05fd1cfe5db1d1c1e7ce81df 8166560: [s390] Basic enablement of s390 port. diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc.h @@ -76,6 +76,9 @@ #include #define user_regs_struct user_pt_regs #endif +#if defined(s390x) +#include +#endif // This C bool type must be int for compatibility with Linux calls and // it would be a mistake to equivalence it to C++ bool on many platforms diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -291,7 +291,7 @@ // 1: ... // ... // 7: The default directories, normally /lib and /usr/lib. -#if defined(AMD64) || defined(_LP64) && (defined(SPARC) || defined(PPC) || defined(S390)) +#if defined(AMD64) || (defined(_LP64) && defined(SPARC)) || defined(PPC64) || defined(S390) #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib" #else #define DEFAULT_LIBPATH "/lib:/usr/lib" @@ -1212,8 +1212,8 @@ } #ifndef SYS_clock_getres - #if defined(IA32) || defined(AMD64) - #define SYS_clock_getres IA32_ONLY(266) AMD64_ONLY(229) + #if defined(X86) || defined(PPC64) || defined(S390) + #define SYS_clock_getres AMD64_ONLY(229) IA32_ONLY(266) PPC64_ONLY(247) S390_ONLY(261) #define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y) #else #warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time" @@ -1766,7 +1766,7 @@ static Elf32_Half running_arch_code=EM_PPC64; #elif (defined __powerpc__) static Elf32_Half running_arch_code=EM_PPC; -#elif (defined ARM) +#elif (defined ARM) // ARM must come before AARCH64 because the closed 64-bit port requires so. static Elf32_Half running_arch_code=EM_ARM; #elif (defined S390) static Elf32_Half running_arch_code=EM_S390; @@ -1784,7 +1784,7 @@ static Elf32_Half running_arch_code=EM_AARCH64; #else #error Method os::dll_load requires that one of following is defined:\ - IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64 + AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, S390, __sparc #endif // Identify compatability class for VM's architecture and library's architecture @@ -2192,10 +2192,12 @@ #if defined(AMD64) || defined(IA32) || defined(X32) const char* search_string = "model name"; +#elif defined(PPC64) +const char* search_string = "cpu"; +#elif defined(S390) +const char* search_string = "processor"; #elif defined(SPARC) const char* search_string = "cpu"; -#elif defined(PPC64) -const char* search_string = "cpu"; #else const char* search_string = "Processor"; #endif @@ -2233,20 +2235,22 @@ } // cpuinfo not found or parsing failed, just print generic string. The entire // /proc/cpuinfo file will be printed later in the file (or enough of it for x86) -#if defined(AMD64) +#if defined(AARCH64) + strncpy(cpuinfo, "AArch64", length); +#elif defined(AMD64) strncpy(cpuinfo, "x86_64", length); +#elif defined(ARM) // Order wrt. AARCH64 is relevant! + strncpy(cpuinfo, "ARM", length); #elif defined(IA32) strncpy(cpuinfo, "x86_32", length); #elif defined(IA64) strncpy(cpuinfo, "IA64", length); +#elif defined(PPC) + strncpy(cpuinfo, "PPC64", length); +#elif defined(S390) + strncpy(cpuinfo, "S390", length); #elif defined(SPARC) strncpy(cpuinfo, "sparcv9", length); -#elif defined(AARCH64) - strncpy(cpuinfo, "AArch64", length); -#elif defined(ARM) - strncpy(cpuinfo, "ARM", length); -#elif defined(PPC) - strncpy(cpuinfo, "PPC64", length); #elif defined(ZERO_LIBARCH) strncpy(cpuinfo, ZERO_LIBARCH, length); #else @@ -3242,8 +3246,15 @@ // the processor. #ifndef ZERO - large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M) - ARM32_ONLY(2 * M) PPC_ONLY(4 * M) AARCH64_ONLY(2 * M); + large_page_size = + AARCH64_ONLY(2 * M) + AMD64_ONLY(2 * M) + ARM32_ONLY(2 * M) + IA32_ONLY(4 * M) + IA64_ONLY(256 * M) + PPC_ONLY(4 * M) + S390_ONLY(1 * M) + SPARC_ONLY(4 * M); #endif // ZERO FILE *fp = fopen("/proc/meminfo", "r"); diff --git a/src/share/tools/hsdis/hsdis.c b/src/share/tools/hsdis/hsdis.c --- a/src/share/tools/hsdis/hsdis.c +++ b/src/share/tools/hsdis/hsdis.c @@ -468,6 +468,9 @@ #ifdef LIBARCH_aarch64 res = "aarch64"; #endif +#ifdef LIBARCH_s390x + res = "s390:64-bit"; +#endif if (res == NULL) res = "architecture not set in Makefile!"; return res; diff --git a/src/share/vm/code/codeCache.cpp b/src/share/vm/code/codeCache.cpp --- a/src/share/vm/code/codeCache.cpp +++ b/src/share/vm/code/codeCache.cpp @@ -547,7 +547,10 @@ } bool CodeCache::contains(void *p) { - // It should be ok to call contains without holding a lock + // S390 uses contains() in current_frame(), which is used before + // code cache initialization if NativeMemoryTracking=detail is set. + if (_heaps == NULL) return false; + // It should be ok to call contains without holding a lock. FOR_ALL_HEAPS(heap) { if ((*heap)->contains(p)) { return true; diff --git a/src/share/vm/interpreter/abstractInterpreter.hpp b/src/share/vm/interpreter/abstractInterpreter.hpp --- a/src/share/vm/interpreter/abstractInterpreter.hpp +++ b/src/share/vm/interpreter/abstractInterpreter.hpp @@ -221,7 +221,7 @@ } static int expr_offset_in_bytes(int i) { -#if !defined(ZERO) && (defined(PPC) || defined(SPARC)) +#if !defined(ZERO) && (defined(PPC) || defined(S390) || defined(SPARC)) return stackElementSize * i + wordSize; // both point to one word past TOS #else return stackElementSize * i; diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -3328,9 +3328,11 @@ "Stack space (bytes) required for JVM_InvokeMethod to complete") \ \ /* code cache parameters */ \ - /* ppc64/tiered compilation has large code-entry alignment. */ \ + /* ppc64/s390/tiered compilation has large code-entry alignment. */ \ develop(uintx, CodeCacheSegmentSize, \ - 64 PPC64_ONLY(+64) NOT_PPC64(TIERED_ONLY(+64)), \ + 64 \ + PPC64_ONLY(+64) S390_ONLY(+192) \ + NOT_PPC64(NOT_S390(TIERED_ONLY(+64))), \ "Code cache segment size (in bytes) - smallest unit of " \ "allocation") \ range(1, 1024) \ diff --git a/src/share/vm/runtime/vm_version.cpp b/src/share/vm/runtime/vm_version.cpp --- a/src/share/vm/runtime/vm_version.cpp +++ b/src/share/vm/runtime/vm_version.cpp @@ -170,15 +170,16 @@ #define CPU "ppc64le" #else #define CPU "ppc64" -#endif +#endif // PPC64 #else -#define CPU IA32_ONLY("x86") \ +#define CPU AARCH64_ONLY("aarch64") \ + AMD64_ONLY("amd64") \ + IA32_ONLY("x86") \ IA64_ONLY("ia64") \ - AMD64_ONLY("amd64") \ - AARCH64_ONLY("aarch64") \ + S390_ONLY("s390") \ SPARC_ONLY("sparc") -#endif // -#endif +#endif // !ZERO +#endif // !CPU const char *Abstract_VM_Version::vm_platform_string() { return OS "-" CPU; diff --git a/src/share/vm/utilities/macros.hpp b/src/share/vm/utilities/macros.hpp --- a/src/share/vm/utilities/macros.hpp +++ b/src/share/vm/utilities/macros.hpp @@ -386,6 +386,14 @@ #define NOT_AMD64(code) code #endif +#ifdef S390 +#define S390_ONLY(code) code +#define NOT_S390(code) +#else +#define S390_ONLY(code) +#define NOT_S390(code) code +#endif + #ifdef SPARC #define SPARC_ONLY(code) code #define NOT_SPARC(code)