8166560: [s390] Basic enablement of s390 port

Also fix problem with ARM Elf configuration.

Reviewed-by: dholmes, coleenp
This commit is contained in:
Goetz Lindenmaier 2016-09-22 18:23:15 +02:00
parent 9a793cb30e
commit 7aed968c10
13 changed files with 64 additions and 32 deletions

View file

@ -39,6 +39,7 @@ define_pd_global(bool, ImplicitNullChecks, true); // Generate code for im
define_pd_global(bool, TrapBasedNullChecks, false); define_pd_global(bool, TrapBasedNullChecks, false);
define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs past to check cast define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs past to check cast
define_pd_global(uintx, CodeCacheSegmentSize, 64 TIERED_ONLY(+64)); // Tiered compilation has large code-entry alignment.
define_pd_global(intx, CodeEntryAlignment, 64); define_pd_global(intx, CodeEntryAlignment, 64);
define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100); define_pd_global(intx, InlineFrequencyCount, 100);

View file

@ -56,6 +56,7 @@ define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES);
define_pd_global(intx, StackReservedPages, DEFAULT_STACK_RESERVED_PAGES); define_pd_global(intx, StackReservedPages, DEFAULT_STACK_RESERVED_PAGES);
// Use large code-entry alignment. // Use large code-entry alignment.
define_pd_global(uintx, CodeCacheSegmentSize, 128);
define_pd_global(intx, CodeEntryAlignment, 128); define_pd_global(intx, CodeEntryAlignment, 128);
define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100); define_pd_global(intx, InlineFrequencyCount, 100);

View file

@ -44,6 +44,7 @@ define_pd_global(bool, ImplicitNullChecks, true); // Generate code for
define_pd_global(bool, TrapBasedNullChecks, false); // Not needed on sparc. define_pd_global(bool, TrapBasedNullChecks, false); // Not needed on sparc.
define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs passed to check cast define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs passed to check cast
define_pd_global(uintx, CodeCacheSegmentSize, 64 TIERED_ONLY(+64)); // Tiered compilation has large code-entry alignment.
define_pd_global(intx, CodeEntryAlignment, 32); define_pd_global(intx, CodeEntryAlignment, 32);
// The default setting 16/16 seems to work best. // The default setting 16/16 seems to work best.
// (For _228_jack 16/16 is 2% better than 4/4, 16/4, 32/32, 32/16, or 16/32.) // (For _228_jack 16/16 is 2% better than 4/4, 16/4, 32/32, 32/16, or 16/32.)

View file

@ -38,6 +38,7 @@ define_pd_global(bool, ImplicitNullChecks, true); // Generate code for im
define_pd_global(bool, TrapBasedNullChecks, false); // Not needed on x86. define_pd_global(bool, TrapBasedNullChecks, false); // Not needed on x86.
define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs passed to check cast define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs passed to check cast
define_pd_global(uintx, CodeCacheSegmentSize, 64 TIERED_ONLY(+64)); // Tiered compilation has large code-entry alignment.
// See 4827828 for this change. There is no globals_core_i486.hpp. I can't // See 4827828 for this change. There is no globals_core_i486.hpp. I can't
// assign a different value for C2 without touching a number of files. Use // assign a different value for C2 without touching a number of files. Use
// #ifdef to minimize the change as it's late in Mantis. -- FIXME. // #ifdef to minimize the change as it's late in Mantis. -- FIXME.

View file

@ -39,6 +39,7 @@ define_pd_global(bool, ImplicitNullChecks, true);
define_pd_global(bool, TrapBasedNullChecks, false); define_pd_global(bool, TrapBasedNullChecks, false);
define_pd_global(bool, UncommonNullCast, true); define_pd_global(bool, UncommonNullCast, true);
define_pd_global(uintx, CodeCacheSegmentSize, 64 TIERED_ONLY(+64)); // Tiered compilation has large code-entry alignment.
define_pd_global(intx, CodeEntryAlignment, 32); define_pd_global(intx, CodeEntryAlignment, 32);
define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, OptoLoopAlignment, 16);
define_pd_global(intx, InlineFrequencyCount, 100); define_pd_global(intx, InlineFrequencyCount, 100);

View file

@ -76,6 +76,9 @@ combination of ptrace and /proc calls.
#include <asm/ptrace.h> #include <asm/ptrace.h>
#define user_regs_struct user_pt_regs #define user_regs_struct user_pt_regs
#endif #endif
#if defined(s390x)
#include <asm/ptrace.h>
#endif
// This C bool type must be int for compatibility with Linux calls and // 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 // it would be a mistake to equivalence it to C++ bool on many platforms

View file

@ -291,7 +291,7 @@ void os::init_system_properties_values() {
// 1: ... // 1: ...
// ... // ...
// 7: The default directories, normally /lib and /usr/lib. // 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" #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib"
#else #else
#define DEFAULT_LIBPATH "/lib:/usr/lib" #define DEFAULT_LIBPATH "/lib:/usr/lib"
@ -1212,8 +1212,8 @@ void os::Linux::clock_init() {
} }
#ifndef SYS_clock_getres #ifndef SYS_clock_getres
#if defined(IA32) || defined(AMD64) #if defined(X86) || defined(PPC64) || defined(S390)
#define SYS_clock_getres IA32_ONLY(266) AMD64_ONLY(229) #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) #define sys_clock_getres(x,y) ::syscall(SYS_clock_getres, x, y)
#else #else
#warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time" #warning "SYS_clock_getres not defined for this platform, disabling fast_thread_cpu_time"
@ -1766,6 +1766,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_PPC64; static Elf32_Half running_arch_code=EM_PPC64;
#elif (defined __powerpc__) #elif (defined __powerpc__)
static Elf32_Half running_arch_code=EM_PPC; static Elf32_Half running_arch_code=EM_PPC;
#elif (defined AARCH64)
static Elf32_Half running_arch_code=EM_AARCH64;
#elif (defined ARM) #elif (defined ARM)
static Elf32_Half running_arch_code=EM_ARM; static Elf32_Half running_arch_code=EM_ARM;
#elif (defined S390) #elif (defined S390)
@ -1780,11 +1782,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_MIPS; static Elf32_Half running_arch_code=EM_MIPS;
#elif (defined M68K) #elif (defined M68K)
static Elf32_Half running_arch_code=EM_68K; static Elf32_Half running_arch_code=EM_68K;
#elif (defined AARCH64)
static Elf32_Half running_arch_code=EM_AARCH64;
#else #else
#error Method os::dll_load requires that one of following is defined:\ #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 #endif
// Identify compatability class for VM's architecture and library's architecture // Identify compatability class for VM's architecture and library's architecture
@ -2192,10 +2192,12 @@ void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
#if defined(AMD64) || defined(IA32) || defined(X32) #if defined(AMD64) || defined(IA32) || defined(X32)
const char* search_string = "model name"; const char* search_string = "model name";
#elif defined(SPARC)
const char* search_string = "cpu";
#elif defined(PPC64) #elif defined(PPC64)
const char* search_string = "cpu"; const char* search_string = "cpu";
#elif defined(S390)
const char* search_string = "processor";
#elif defined(SPARC)
const char* search_string = "cpu";
#else #else
const char* search_string = "Processor"; const char* search_string = "Processor";
#endif #endif
@ -2233,20 +2235,22 @@ void os::get_summary_cpu_info(char* cpuinfo, size_t length) {
} }
// cpuinfo not found or parsing failed, just print generic string. The entire // 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) // /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); strncpy(cpuinfo, "x86_64", length);
#elif defined(ARM) // Order wrt. AARCH64 is relevant!
strncpy(cpuinfo, "ARM", length);
#elif defined(IA32) #elif defined(IA32)
strncpy(cpuinfo, "x86_32", length); strncpy(cpuinfo, "x86_32", length);
#elif defined(IA64) #elif defined(IA64)
strncpy(cpuinfo, "IA64", length); strncpy(cpuinfo, "IA64", 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) #elif defined(PPC)
strncpy(cpuinfo, "PPC64", length); strncpy(cpuinfo, "PPC64", length);
#elif defined(S390)
strncpy(cpuinfo, "S390", length);
#elif defined(SPARC)
strncpy(cpuinfo, "sparcv9", length);
#elif defined(ZERO_LIBARCH) #elif defined(ZERO_LIBARCH)
strncpy(cpuinfo, ZERO_LIBARCH, length); strncpy(cpuinfo, ZERO_LIBARCH, length);
#else #else
@ -3242,8 +3246,15 @@ size_t os::Linux::find_large_page_size() {
// the processor. // the processor.
#ifndef ZERO #ifndef ZERO
large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M) large_page_size =
ARM32_ONLY(2 * M) PPC_ONLY(4 * M) AARCH64_ONLY(2 * M); 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 #endif // ZERO
FILE *fp = fopen("/proc/meminfo", "r"); FILE *fp = fopen("/proc/meminfo", "r");

View file

@ -467,6 +467,9 @@ static const char* native_arch_name() {
#endif #endif
#ifdef LIBARCH_aarch64 #ifdef LIBARCH_aarch64
res = "aarch64"; res = "aarch64";
#endif
#ifdef LIBARCH_s390x
res = "s390:64-bit";
#endif #endif
if (res == NULL) if (res == NULL)
res = "architecture not set in Makefile!"; res = "architecture not set in Makefile!";

View file

@ -547,7 +547,10 @@ void CodeCache::commit(CodeBlob* cb) {
} }
bool CodeCache::contains(void *p) { 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.
S390_ONLY(if (_heaps == NULL) return false;)
// It should be ok to call contains without holding a lock.
FOR_ALL_HEAPS(heap) { FOR_ALL_HEAPS(heap) {
if ((*heap)->contains(p)) { if ((*heap)->contains(p)) {
return true; return true;

View file

@ -221,7 +221,7 @@ class AbstractInterpreter: AllStatic {
} }
static int expr_offset_in_bytes(int i) { 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 return stackElementSize * i + wordSize; // both point to one word past TOS
#else #else
return stackElementSize * i; return stackElementSize * i;

View file

@ -3325,9 +3325,7 @@ public:
"Stack space (bytes) required for JVM_InvokeMethod to complete") \ "Stack space (bytes) required for JVM_InvokeMethod to complete") \
\ \
/* code cache parameters */ \ /* code cache parameters */ \
/* ppc64/tiered compilation has large code-entry alignment. */ \ develop_pd(uintx, CodeCacheSegmentSize, \
develop(uintx, CodeCacheSegmentSize, \
64 PPC64_ONLY(+64) NOT_PPC64(TIERED_ONLY(+64)), \
"Code cache segment size (in bytes) - smallest unit of " \ "Code cache segment size (in bytes) - smallest unit of " \
"allocation") \ "allocation") \
range(1, 1024) \ range(1, 1024) \

View file

@ -170,15 +170,16 @@ const char* Abstract_VM_Version::jre_release_version() {
#define CPU "ppc64le" #define CPU "ppc64le"
#else #else
#define CPU "ppc64" #define CPU "ppc64"
#endif #endif // PPC64
#else #else
#define CPU IA32_ONLY("x86") \ #define CPU AARCH64_ONLY("aarch64") \
IA64_ONLY("ia64") \
AMD64_ONLY("amd64") \ AMD64_ONLY("amd64") \
AARCH64_ONLY("aarch64") \ IA32_ONLY("x86") \
IA64_ONLY("ia64") \
S390_ONLY("s390") \
SPARC_ONLY("sparc") SPARC_ONLY("sparc")
#endif // #endif // !ZERO
#endif #endif // !CPU
const char *Abstract_VM_Version::vm_platform_string() { const char *Abstract_VM_Version::vm_platform_string() {
return OS "-" CPU; return OS "-" CPU;

View file

@ -386,6 +386,14 @@
#define NOT_AMD64(code) code #define NOT_AMD64(code) code
#endif #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 #ifdef SPARC
#define SPARC_ONLY(code) code #define SPARC_ONLY(code) code
#define NOT_SPARC(code) #define NOT_SPARC(code)