8205609: [PPC64] Fix PPC64 part of 8010319 and TLH without UseSIGTRAP on AIX

Reviewed-by: dholmes, goetz
This commit is contained in:
Martin Doerr 2018-06-27 11:54:15 +02:00
parent 7c0ca4d75f
commit bcdf345cc2
3 changed files with 16 additions and 25 deletions

View File

@ -725,18 +725,6 @@ class StubGenerator: public StubCodeGenerator {
return start; return start;
} }
// Fairer handling of safepoints for native methods.
//
// Generate code which reads from the polling page. This special handling is needed as the
// linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults in 64bit mode
// (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6), especially when we try
// to read from the safepoint polling page.
address generate_load_from_poll() {
StubCodeMark mark(this, "StubRoutines", "generate_load_from_poll");
address start = __ function_entry();
__ unimplemented("StubRoutines::verify_oop", 95); // TODO PPC port
return start;
}
// -XX:+OptimizeFill : convert fill/copy loops into intrinsic // -XX:+OptimizeFill : convert fill/copy loops into intrinsic
// //

View File

@ -3320,9 +3320,9 @@ void TemplateTable::fast_xaccess(TosState state) {
// - byte_no // - byte_no
// //
// Output: // Output:
// - Rmethod: The method to invoke next. // - Rmethod: The method to invoke next or i-klass (invokeinterface).
// - Rret_addr: The return address to return to. // - Rret_addr: The return address to return to.
// - Rindex: MethodType (invokehandle) or CallSite obj (invokedynamic) // - Rindex: MethodType (invokehandle), CallSite obj (invokedynamic) or Method (invokeinterface)
// - Rrecv: Cache for "this" pointer, might be noreg if static call. // - Rrecv: Cache for "this" pointer, might be noreg if static call.
// - Rflags: Method flags from const pool cache. // - Rflags: Method flags from const pool cache.
// //
@ -3332,7 +3332,7 @@ void TemplateTable::fast_xaccess(TosState state) {
void TemplateTable::prepare_invoke(int byte_no, void TemplateTable::prepare_invoke(int byte_no,
Register Rmethod, // linked method (or i-klass) Register Rmethod, // linked method (or i-klass)
Register Rret_addr,// return address Register Rret_addr,// return address
Register Rindex, // itable index, MethodType, etc. Register Rindex, // itable index, MethodType, Method, etc.
Register Rrecv, // If caller wants to see it. Register Rrecv, // If caller wants to see it.
Register Rflags, // If caller wants to test it. Register Rflags, // If caller wants to test it.
Register Rscratch Register Rscratch
@ -3618,9 +3618,9 @@ void TemplateTable::invokeinterface(int byte_no) {
Register Rscratch = Rflags; // Rflags is dead now. Register Rscratch = Rflags; // Rflags is dead now.
__ profile_final_call(Rscratch1, Rscratch); __ profile_final_call(Rscratch1, Rscratch);
__ profile_arguments_type(Rindex, Rscratch, Rrecv_klass /* scratch */, true); __ profile_arguments_type(Rmethod, Rscratch, Rrecv_klass /* scratch */, true);
__ call_from_interpreter(Rindex, Rret_addr, Rscratch, Rrecv_klass /* scratch */); __ call_from_interpreter(Rmethod, Rret_addr, Rscratch, Rrecv_klass /* scratch */);
__ bind(LnotVFinal); __ bind(LnotVFinal);

View File

@ -38,7 +38,7 @@ void SafepointMechanism::pd_initialize() {
// Allocate one protected page // Allocate one protected page
char* map_address = (char*)MAP_FAILED; char* map_address = (char*)MAP_FAILED;
const size_t page_size = os::vm_page_size(); const size_t map_size = ThreadLocalHandshakes ? 2 * os::vm_page_size() : os::vm_page_size();
const int prot = PROT_READ; const int prot = PROT_READ;
const int flags = MAP_PRIVATE | MAP_ANONYMOUS; const int flags = MAP_PRIVATE | MAP_ANONYMOUS;
@ -68,7 +68,7 @@ void SafepointMechanism::pd_initialize() {
// AIX: AIX needs MAP_FIXED if we provide an address and mmap will // AIX: AIX needs MAP_FIXED if we provide an address and mmap will
// fail if the address is already mapped. // fail if the address is already mapped.
map_address = (char*) ::mmap(address_wishes[i], map_address = (char*) ::mmap(address_wishes[i],
page_size, prot, map_size, prot,
flags | MAP_FIXED, flags | MAP_FIXED,
-1, 0); -1, 0);
log_debug(os)("SafePoint Polling Page address: %p (wish) => %p", log_debug(os)("SafePoint Polling Page address: %p (wish) => %p",
@ -81,24 +81,27 @@ void SafepointMechanism::pd_initialize() {
if (map_address != (char*)MAP_FAILED) { if (map_address != (char*)MAP_FAILED) {
// Map succeeded, but polling_page is not at wished address, unmap and continue. // Map succeeded, but polling_page is not at wished address, unmap and continue.
::munmap(map_address, page_size); ::munmap(map_address, map_size);
map_address = (char*)MAP_FAILED; map_address = (char*)MAP_FAILED;
} }
// Map failed, continue loop. // Map failed, continue loop.
} }
} }
if (map_address == (char*)MAP_FAILED) { if (map_address == (char*)MAP_FAILED) {
map_address = (char*) ::mmap(NULL, page_size, prot, flags, -1, 0); map_address = (char*) ::mmap(NULL, map_size, prot, flags, -1, 0);
} }
guarantee(map_address != (char*)MAP_FAILED, "SafepointMechanism::pd_initialize: failed to allocate polling page"); guarantee(map_address != (char*)MAP_FAILED && map_address != NULL,
"SafepointMechanism::pd_initialize: failed to allocate polling page");
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(map_address)); log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(map_address));
os::set_polling_page((address)(map_address)); os::set_polling_page((address)(map_address));
// Use same page for ThreadLocalHandshakes without SIGTRAP // Use same page for ThreadLocalHandshakes without SIGTRAP
if (ThreadLocalHandshakes) { if (ThreadLocalHandshakes) {
set_uses_thread_local_poll(); set_uses_thread_local_poll();
intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address); os::make_polling_page_unreadable();
_poll_armed_value = reinterpret_cast<void*>(bad_page_val | poll_bit()); intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address),
_poll_disarmed_value = NULL; // Readable on AIX good_page_val = bad_page_val + os::vm_page_size();
_poll_armed_value = reinterpret_cast<void*>(bad_page_val + poll_bit());
_poll_disarmed_value = reinterpret_cast<void*>(good_page_val);
} }
} }