8220049: Obsolete ThreadLocalHandshakes

Reviewed-by: dholmes, dcubed, mdoerr
This commit is contained in:
Robbin Ehn 2019-12-11 15:30:07 +01:00
parent f5929f55cc
commit 0df5be808d
28 changed files with 38 additions and 135 deletions

View file

@ -71,8 +71,6 @@ define_pd_global(bool, CompactStrings, true);
// Clear short arrays bigger than one word in an arch-specific way // Clear short arrays bigger than one word in an arch-specific way
define_pd_global(intx, InitArrayShortSize, BytesPerLong); define_pd_global(intx, InitArrayShortSize, BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, true);
#if defined(COMPILER1) || defined(COMPILER2) #if defined(COMPILER1) || defined(COMPILER2)
define_pd_global(intx, InlineSmallCode, 1000); define_pd_global(intx, InlineSmallCode, 1000);
#endif #endif

View file

@ -70,8 +70,6 @@ define_pd_global(bool, CompactStrings, false);
define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, false);
#define ARCH_FLAGS(develop, \ #define ARCH_FLAGS(develop, \
product, \ product, \
diagnostic, \ diagnostic, \

View file

@ -74,8 +74,6 @@ define_pd_global(bool, CompactStrings, true);
// 2x unrolled loop is shorter with more than 9 HeapWords. // 2x unrolled loop is shorter with more than 9 HeapWords.
define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong); define_pd_global(intx, InitArrayShortSize, 9*BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, true);
// Platform dependent flag handling: flags only defined on this platform. // Platform dependent flag handling: flags only defined on this platform.
#define ARCH_FLAGS(develop, \ #define ARCH_FLAGS(develop, \
product, \ product, \

View file

@ -76,8 +76,6 @@ define_pd_global(bool, CompactStrings, true);
// 8146801 (Short Array Allocation): No performance work done here yet. // 8146801 (Short Array Allocation): No performance work done here yet.
define_pd_global(intx, InitArrayShortSize, 1*BytesPerLong); define_pd_global(intx, InitArrayShortSize, 1*BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, true);
#define ARCH_FLAGS(develop, \ #define ARCH_FLAGS(develop, \
product, \ product, \
diagnostic, \ diagnostic, \

View file

@ -80,8 +80,6 @@ define_pd_global(bool, CompactStrings, true);
define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, true);
#define ARCH_FLAGS(develop, \ #define ARCH_FLAGS(develop, \
product, \ product, \
diagnostic, \ diagnostic, \

View file

@ -89,8 +89,6 @@ define_pd_global(bool, PreserveFramePointer, false);
define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
define_pd_global(bool, ThreadLocalHandshakes, true);
#define ARCH_FLAGS(develop, \ #define ARCH_FLAGS(develop, \
product, \ product, \
diagnostic, \ diagnostic, \

View file

@ -73,8 +73,6 @@ define_pd_global(bool, PreserveFramePointer, false);
// No performance work done here yet. // No performance work done here yet.
define_pd_global(bool, CompactStrings, false); define_pd_global(bool, CompactStrings, false);
define_pd_global(bool, ThreadLocalHandshakes, true);
#define ARCH_FLAGS(develop, \ #define ARCH_FLAGS(develop, \
product, \ product, \
diagnostic, \ diagnostic, \

View file

@ -32,14 +32,14 @@
void SafepointMechanism::pd_initialize() { void SafepointMechanism::pd_initialize() {
// No special code needed if we can use SIGTRAP // No special code needed if we can use SIGTRAP
if (ThreadLocalHandshakes && USE_POLL_BIT_ONLY) { if (USE_POLL_BIT_ONLY) {
default_initialize(); default_initialize();
return; return;
} }
// Allocate one protected page // Allocate one protected page
char* map_address = (char*)MAP_FAILED; char* map_address = (char*)MAP_FAILED;
const size_t map_size = ThreadLocalHandshakes ? 2 * os::vm_page_size() : os::vm_page_size(); const size_t map_size = 2 * 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;
@ -99,13 +99,10 @@ void SafepointMechanism::pd_initialize() {
// Register polling page with NMT. // Register polling page with NMT.
MemTracker::record_virtual_memory_reserve_and_commit(map_address, map_size, CALLER_PC, mtSafepoint); MemTracker::record_virtual_memory_reserve_and_commit(map_address, map_size, CALLER_PC, mtSafepoint);
// Use same page for ThreadLocalHandshakes without SIGTRAP // Use same page for thread local handshakes without SIGTRAP
if (ThreadLocalHandshakes) { os::make_polling_page_unreadable();
set_uses_thread_local_poll(); intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address),
os::make_polling_page_unreadable(); good_page_val = bad_page_val + os::vm_page_size();
intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address), _poll_armed_value = reinterpret_cast<void*>(bad_page_val + poll_bit());
good_page_val = bad_page_val + os::vm_page_size(); _poll_disarmed_value = reinterpret_cast<void*>(good_page_val);
_poll_armed_value = reinterpret_cast<void*>(bad_page_val + poll_bit());
_poll_disarmed_value = reinterpret_cast<void*>(good_page_val);
}
} }

View file

@ -185,7 +185,6 @@ void AOTLib::verify_config() {
verify_flag(_config->_compactFields, CompactFields, "CompactFields"); verify_flag(_config->_compactFields, CompactFields, "CompactFields");
verify_flag(_config->_enableContended, EnableContended, "EnableContended"); verify_flag(_config->_enableContended, EnableContended, "EnableContended");
verify_flag(_config->_restrictContended, RestrictContended, "RestrictContended"); verify_flag(_config->_restrictContended, RestrictContended, "RestrictContended");
verify_flag(_config->_threadLocalHandshakes, ThreadLocalHandshakes, "ThreadLocalHandshakes");
if (!TieredCompilation && _config->_tieredAOT) { if (!TieredCompilation && _config->_tieredAOT) {
handle_config_error("Shared file %s error: Expected to run with tiered compilation on", _name); handle_config_error("Shared file %s error: Expected to run with tiered compilation on", _name);

View file

@ -92,7 +92,7 @@ typedef struct {
} AOTHeader; } AOTHeader;
typedef struct { typedef struct {
enum { CONFIG_SIZE = 8 * jintSize + 11 }; enum { CONFIG_SIZE = 8 * jintSize + 10 };
// 8 int values // 8 int values
int _config_size; int _config_size;
int _narrowOopShift; int _narrowOopShift;
@ -113,7 +113,6 @@ typedef struct {
bool _enableContended; bool _enableContended;
bool _restrictContended; bool _restrictContended;
bool _omitAssertions; bool _omitAssertions;
bool _threadLocalHandshakes;
} AOTConfiguration; } AOTConfiguration;
class AOTLib : public CHeapObj<mtCode> { class AOTLib : public CHeapObj<mtCode> {

View file

@ -45,6 +45,7 @@
#include "runtime/atomic.hpp" #include "runtime/atomic.hpp"
#include "runtime/handshake.hpp" #include "runtime/handshake.hpp"
#include "runtime/prefetch.inline.hpp" #include "runtime/prefetch.inline.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/thread.hpp" #include "runtime/thread.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
@ -454,7 +455,7 @@ bool ZMark::flush(bool at_safepoint) {
bool ZMark::try_flush(volatile size_t* nflush) { bool ZMark::try_flush(volatile size_t* nflush) {
// Only flush if handshakes are enabled // Only flush if handshakes are enabled
if (!ThreadLocalHandshakes) { if (!SafepointMechanism::uses_thread_local_poll()) {
return false; return false;
} }

View file

@ -4205,20 +4205,6 @@ jint Arguments::apply_ergo() {
} }
#endif #endif
#if defined(IA32)
// Only server compiler can optimize safepoints well enough.
if (!is_server_compilation_mode_vm()) {
FLAG_SET_ERGO_IF_DEFAULT(ThreadLocalHandshakes, false);
}
#endif
// ThreadLocalHandshakesConstraintFunc handles the constraints.
if (FLAG_IS_DEFAULT(ThreadLocalHandshakes) || !SafepointMechanism::supports_thread_local_poll()) {
log_debug(ergo)("ThreadLocalHandshakes %s", ThreadLocalHandshakes ? "enabled." : "disabled.");
} else {
log_info(ergo)("ThreadLocalHandshakes %s", ThreadLocalHandshakes ? "enabled." : "disabled.");
}
return JNI_OK; return JNI_OK;
} }

View file

@ -36,6 +36,7 @@
#include "runtime/biasedLocking.hpp" #include "runtime/biasedLocking.hpp"
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "runtime/handshake.hpp" #include "runtime/handshake.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/task.hpp" #include "runtime/task.hpp"
#include "runtime/threadSMR.hpp" #include "runtime/threadSMR.hpp"
#include "runtime/vframe.hpp" #include "runtime/vframe.hpp"
@ -665,8 +666,8 @@ BiasedLocking::Condition BiasedLocking::single_revoke_with_handshake(Handle obj,
// Caller should have instantiated a ResourceMark object before calling this method // Caller should have instantiated a ResourceMark object before calling this method
void BiasedLocking::walk_stack_and_revoke(oop obj, JavaThread* biased_locker) { void BiasedLocking::walk_stack_and_revoke(oop obj, JavaThread* biased_locker) {
assert(!SafepointSynchronize::is_at_safepoint() || !ThreadLocalHandshakes, assert(!SafepointSynchronize::is_at_safepoint() || !SafepointMechanism::uses_thread_local_poll(),
"if ThreadLocalHandshakes is enabled this should always be executed outside safepoints"); "if SafepointMechanism::uses_thread_local_poll() is enabled this should always be executed outside safepoints");
assert(Thread::current() == biased_locker || Thread::current()->is_VM_thread(), "wrong thread"); assert(Thread::current() == biased_locker || Thread::current()->is_VM_thread(), "wrong thread");
markWord mark = obj->mark(); markWord mark = obj->mark();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -130,13 +130,3 @@ JVMFlag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) {
return JVMFlag::SUCCESS; return JVMFlag::SUCCESS;
} }
} }
JVMFlag::Error ThreadLocalHandshakesConstraintFunc(bool value, bool verbose) {
if (value) {
if (!SafepointMechanism::supports_thread_local_poll()) {
JVMFlag::printError(verbose, "ThreadLocalHandshakes not yet supported on this platform\n");
return JVMFlag::VIOLATES_CONSTRAINT;
}
}
return JVMFlag::SUCCESS;
}

View file

@ -44,7 +44,4 @@ JVMFlag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose);
JVMFlag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose); JVMFlag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose);
JVMFlag::Error ThreadLocalHandshakesConstraintFunc(bool value, bool verbose);
#endif // SHARE_RUNTIME_FLAGS_JVMFLAGCONSTRAINTSRUNTIME_HPP #endif // SHARE_RUNTIME_FLAGS_JVMFLAGCONSTRAINTSRUNTIME_HPP

View file

@ -163,10 +163,6 @@ const size_t minimumSymbolTableSize = 1024;
develop(bool, CleanChunkPoolAsync, true, \ develop(bool, CleanChunkPoolAsync, true, \
"Clean the chunk pool asynchronously") \ "Clean the chunk pool asynchronously") \
\ \
product_pd(bool, ThreadLocalHandshakes, \
"Use thread-local polls instead of global poll for safepoints.") \
constraint(ThreadLocalHandshakesConstraintFunc,AfterErgo) \
\
diagnostic(uint, HandshakeTimeout, 0, \ diagnostic(uint, HandshakeTimeout, 0, \
"If nonzero set a timeout in milliseconds for handshakes") \ "If nonzero set a timeout in milliseconds for handshakes") \
\ \

View file

@ -282,7 +282,7 @@ void HandshakeThreadsOperation::do_handshake(JavaThread* thread) {
} }
void Handshake::execute(HandshakeClosure* thread_cl) { void Handshake::execute(HandshakeClosure* thread_cl) {
if (ThreadLocalHandshakes) { if (SafepointMechanism::uses_thread_local_poll()) {
HandshakeThreadsOperation cto(thread_cl); HandshakeThreadsOperation cto(thread_cl);
VM_HandshakeAllThreads handshake(&cto); VM_HandshakeAllThreads handshake(&cto);
VMThread::execute(&handshake); VMThread::execute(&handshake);
@ -293,7 +293,7 @@ void Handshake::execute(HandshakeClosure* thread_cl) {
} }
bool Handshake::execute(HandshakeClosure* thread_cl, JavaThread* target) { bool Handshake::execute(HandshakeClosure* thread_cl, JavaThread* target) {
if (ThreadLocalHandshakes) { if (SafepointMechanism::uses_thread_local_poll()) {
HandshakeThreadsOperation cto(thread_cl); HandshakeThreadsOperation cto(thread_cl);
VM_HandshakeOneThread handshake(&cto, target); VM_HandshakeOneThread handshake(&cto, target);
VMThread::execute(&handshake); VMThread::execute(&handshake);

View file

@ -881,7 +881,7 @@ void SafepointSynchronize::block(JavaThread *thread) {
void SafepointSynchronize::handle_polling_page_exception(JavaThread *thread) { void SafepointSynchronize::handle_polling_page_exception(JavaThread *thread) {
assert(thread->is_Java_thread(), "polling reference encountered by VM thread"); assert(thread->is_Java_thread(), "polling reference encountered by VM thread");
assert(thread->thread_state() == _thread_in_Java, "should come from Java code"); assert(thread->thread_state() == _thread_in_Java, "should come from Java code");
if (!ThreadLocalHandshakes) { if (!SafepointMechanism::uses_thread_local_poll()) {
assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization"); assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization");
} }

View file

@ -31,13 +31,11 @@
#include "services/memTracker.hpp" #include "services/memTracker.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
SafepointMechanism::PollingType SafepointMechanism::_polling_type = SafepointMechanism::_global_page_poll;
void* SafepointMechanism::_poll_armed_value; void* SafepointMechanism::_poll_armed_value;
void* SafepointMechanism::_poll_disarmed_value; void* SafepointMechanism::_poll_disarmed_value;
void SafepointMechanism::default_initialize() { void SafepointMechanism::default_initialize() {
if (ThreadLocalHandshakes) { if (uses_thread_local_poll()) {
set_uses_thread_local_poll();
// Poll bit values // Poll bit values
intptr_t poll_armed_value = poll_bit(); intptr_t poll_armed_value = poll_bit();

View file

@ -32,14 +32,8 @@
// This is the abstracted interface for the safepoint implementation // This is the abstracted interface for the safepoint implementation
class SafepointMechanism : public AllStatic { class SafepointMechanism : public AllStatic {
enum PollingType {
_global_page_poll,
_thread_local_poll
};
static PollingType _polling_type;
static void* _poll_armed_value; static void* _poll_armed_value;
static void* _poll_disarmed_value; static void* _poll_disarmed_value;
static void set_uses_thread_local_poll() { _polling_type = _thread_local_poll; }
static void* poll_armed_value() { return _poll_armed_value; } static void* poll_armed_value() { return _poll_armed_value; }
static void* poll_disarmed_value() { return _poll_disarmed_value; } static void* poll_disarmed_value() { return _poll_disarmed_value; }
@ -65,10 +59,8 @@ class SafepointMechanism : public AllStatic {
public: public:
static intptr_t poll_bit() { return _poll_bit; } static intptr_t poll_bit() { return _poll_bit; }
static bool uses_global_page_poll() { return _polling_type == _global_page_poll; } static bool uses_global_page_poll() { return !uses_thread_local_poll(); }
static bool uses_thread_local_poll() { return _polling_type == _thread_local_poll; } static bool uses_thread_local_poll() {
static bool supports_thread_local_poll() {
#ifdef THREAD_LOCAL_POLL #ifdef THREAD_LOCAL_POLL
return true; return true;
#else #else

View file

@ -250,7 +250,7 @@ void NMethodSweeper::mark_active_nmethods() {
CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() { CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() {
#ifdef ASSERT #ifdef ASSERT
if (ThreadLocalHandshakes) { if (SafepointMechanism::uses_thread_local_poll()) {
assert(Thread::current()->is_Code_cache_sweeper_thread(), "must be executed under CodeCache_lock and in sweeper thread"); assert(Thread::current()->is_Code_cache_sweeper_thread(), "must be executed under CodeCache_lock and in sweeper thread");
assert_lock_strong(CodeCache_lock); assert_lock_strong(CodeCache_lock);
} else { } else {
@ -317,7 +317,7 @@ CodeBlobClosure* NMethodSweeper::prepare_reset_hotness_counters() {
void NMethodSweeper::do_stack_scanning() { void NMethodSweeper::do_stack_scanning() {
assert(!CodeCache_lock->owned_by_self(), "just checking"); assert(!CodeCache_lock->owned_by_self(), "just checking");
if (wait_for_stack_scanning()) { if (wait_for_stack_scanning()) {
if (ThreadLocalHandshakes) { if (SafepointMechanism::uses_thread_local_poll()) {
CodeBlobClosure* code_cl; CodeBlobClosure* code_cl;
{ {
MutexLocker ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag); MutexLocker ccl(CodeCache_lock, Mutex::_no_safepoint_check_flag);

View file

@ -67,8 +67,6 @@ public final class BinaryContainer implements SymbolTable {
private final int codeEntryAlignment; private final int codeEntryAlignment;
private final boolean threadLocalHandshakes;
/** /**
* Container holding code bits and any other related information. * Container holding code bits and any other related information.
*/ */
@ -294,8 +292,6 @@ public final class BinaryContainer implements SymbolTable {
this.codeEntryAlignment = graalHotSpotVMConfig.codeEntryAlignment; this.codeEntryAlignment = graalHotSpotVMConfig.codeEntryAlignment;
this.threadLocalHandshakes = graalHotSpotVMConfig.threadLocalHandshakes;
// Section unique name is limited to 8 characters due to limitation on Windows. // Section unique name is limited to 8 characters due to limitation on Windows.
// Name could be longer but only first 8 characters are stored on Windows. // Name could be longer but only first 8 characters are stored on Windows.
@ -341,7 +337,6 @@ public final class BinaryContainer implements SymbolTable {
graalHotSpotVMConfig.enableContended, graalHotSpotVMConfig.enableContended,
graalHotSpotVMConfig.restrictContended, graalHotSpotVMConfig.restrictContended,
graphBuilderConfig.omitAssertions(), graphBuilderConfig.omitAssertions(),
graalHotSpotVMConfig.threadLocalHandshakes
}; };
int[] intFlags = { graalHotSpotVMConfig.getOopEncoding().getShift(), int[] intFlags = { graalHotSpotVMConfig.getOopEncoding().getShift(),
@ -454,10 +449,6 @@ public final class BinaryContainer implements SymbolTable {
return codeEntryAlignment; return codeEntryAlignment;
} }
public boolean getThreadLocalHandshakes() {
return threadLocalHandshakes;
}
/** /**
* Gets the global AOT symbol associated with the function name. * Gets the global AOT symbol associated with the function name.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -56,11 +56,8 @@ final class MarkProcessor {
break; break;
case POLL_FAR: case POLL_FAR:
case POLL_RETURN_FAR: case POLL_RETURN_FAR:
if (binaryContainer.getThreadLocalHandshakes()) { // skip relocation
// skip relocation break;
break;
}
// fallthrough
case CARD_TABLE_ADDRESS: case CARD_TABLE_ADDRESS:
case HEAP_TOP_ADDRESS: case HEAP_TOP_ADDRESS:
case HEAP_END_ADDRESS: case HEAP_END_ADDRESS:

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -81,11 +81,7 @@ public class AArch64HotSpotSafepointOp extends AArch64LIRInstruction {
} }
public static void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm, GraalHotSpotVMConfig config, boolean onReturn, Register thread, Register scratch, LIRFrameState state) { public static void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm, GraalHotSpotVMConfig config, boolean onReturn, Register thread, Register scratch, LIRFrameState state) {
if (config.threadLocalHandshakes) { emitThreadLocalPoll(crb, masm, config, onReturn, thread, scratch, state);
emitThreadLocalPoll(crb, masm, config, onReturn, thread, scratch, state);
} else {
emitGlobalPoll(crb, masm, config, onReturn, scratch, state);
}
} }
private static void emitGlobalPoll(CompilationResultBuilder crb, AArch64MacroAssembler masm, GraalHotSpotVMConfig config, boolean onReturn, Register scratch, LIRFrameState state) { private static void emitGlobalPoll(CompilationResultBuilder crb, AArch64MacroAssembler masm, GraalHotSpotVMConfig config, boolean onReturn, Register scratch, LIRFrameState state) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -67,12 +67,7 @@ public final class AMD64HotSpotSafepointOp extends AMD64LIRInstruction {
this.state = state; this.state = state;
this.config = config; this.config = config;
this.thread = thread; this.thread = thread;
if (config.threadLocalHandshakes || isPollingPageFar(config) || ImmutableCode.getValue(tool.getOptions())) { temp = tool.getLIRGeneratorTool().newVariable(LIRKind.value(tool.getLIRGeneratorTool().target().arch.getWordKind()));
temp = tool.getLIRGeneratorTool().newVariable(LIRKind.value(tool.getLIRGeneratorTool().target().arch.getWordKind()));
} else {
// Don't waste a register if it's unneeded
temp = Value.ILLEGAL;
}
} }
@Override @Override
@ -81,11 +76,7 @@ public final class AMD64HotSpotSafepointOp extends AMD64LIRInstruction {
} }
public static void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread, Register scratch) { public static void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler asm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread, Register scratch) {
if (config.threadLocalHandshakes) { emitThreadLocalPoll(crb, asm, config, atReturn, state, thread, scratch);
emitThreadLocalPoll(crb, asm, config, atReturn, state, thread, scratch);
} else {
emitGlobalPoll(crb, asm, config, atReturn, state, scratch);
}
} }
/** /**

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,7 @@ public class SPARCAllocatorTest extends AllocatorTest {
@Test @Test
public void test1() { public void test1() {
testAllocation("test1snippet", config.threadLocalHandshakes ? 1 : 2, 0, 0); testAllocation("test1snippet", 1 , 0, 0);
} }
public static long test1snippet(long x) { public static long test1snippet(long x) {
@ -56,7 +56,7 @@ public class SPARCAllocatorTest extends AllocatorTest {
@Test @Test
public void test2() { public void test2() {
testAllocation("test2snippet", config.threadLocalHandshakes ? 1 : 2, 0, 0); testAllocation("test2snippet", 1, 0, 0);
} }
public static long test2snippet(long x) { public static long test2snippet(long x) {
@ -65,7 +65,7 @@ public class SPARCAllocatorTest extends AllocatorTest {
@Test @Test
public void test3() { public void test3() {
testAllocation("test3snippet", config.threadLocalHandshakes ? 3 : 4, 0, 0); testAllocation("test3snippet", 3, 0, 0);
} }
public static long test3snippet(long x) { public static long test3snippet(long x) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -75,11 +75,7 @@ public class SPARCHotSpotSafepointOp extends SPARCLIRInstruction {
public static void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread, public static void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm, GraalHotSpotVMConfig config, boolean atReturn, LIRFrameState state, Register thread,
Value safepointPollAddress) { Value safepointPollAddress) {
if (config.threadLocalHandshakes) { emitThreadLocalPoll(crb, masm, config, atReturn, state, thread);
emitThreadLocalPoll(crb, masm, config, atReturn, state, thread);
} else {
emitGlobalPoll(crb, masm, config, atReturn, state, asRegister(safepointPollAddress));
}
} }
/** /**
@ -117,19 +113,10 @@ public class SPARCHotSpotSafepointOp extends SPARCLIRInstruction {
} }
static AllocatableValue getSafepointAddressValue(SPARCHotSpotLIRGenerator gen) { static AllocatableValue getSafepointAddressValue(SPARCHotSpotLIRGenerator gen) {
if (gen.config.threadLocalHandshakes) { return Value.ILLEGAL;
return Value.ILLEGAL;
} else {
return gen.newVariable(LIRKind.value(gen.target().arch.getWordKind()));
}
} }
static void emitPrologue(SPARCHotSpotNodeLIRBuilder lir, SPARCHotSpotLIRGenerator gen) { static void emitPrologue(SPARCHotSpotNodeLIRBuilder lir, SPARCHotSpotLIRGenerator gen) {
if (!gen.config.threadLocalHandshakes) {
AllocatableValue var = gen.getSafepointAddressValue();
lir.append(new SPARCHotSpotSafepointOp.SPARCLoadSafepointPollAddress(var, gen.config));
gen.append(((HotSpotDebugInfoBuilder) lir.getDebugInfoBuilder()).lockStack());
}
} }
public static class SPARCLoadSafepointPollAddress extends SPARCLIRInstruction { public static class SPARCLoadSafepointPollAddress extends SPARCLIRInstruction {

View file

@ -96,7 +96,6 @@ public class GraalHotSpotVMConfig extends GraalHotSpotVMConfigBase {
public final boolean useAESCTRIntrinsics = getFlag("UseAESCTRIntrinsics", Boolean.class, false); public final boolean useAESCTRIntrinsics = getFlag("UseAESCTRIntrinsics", Boolean.class, false);
public final boolean useCRC32Intrinsics = getFlag("UseCRC32Intrinsics", Boolean.class); public final boolean useCRC32Intrinsics = getFlag("UseCRC32Intrinsics", Boolean.class);
public final boolean useCRC32CIntrinsics = versioned.useCRC32CIntrinsics; public final boolean useCRC32CIntrinsics = versioned.useCRC32CIntrinsics;
public final boolean threadLocalHandshakes = getFlag("ThreadLocalHandshakes", Boolean.class, false);
private final boolean useMultiplyToLenIntrinsic = getFlag("UseMultiplyToLenIntrinsic", Boolean.class); private final boolean useMultiplyToLenIntrinsic = getFlag("UseMultiplyToLenIntrinsic", Boolean.class);
private final boolean useSHA1Intrinsics = getFlag("UseSHA1Intrinsics", Boolean.class); private final boolean useSHA1Intrinsics = getFlag("UseSHA1Intrinsics", Boolean.class);