diff --git a/src/hotspot/share/code/icBuffer.cpp b/src/hotspot/share/code/icBuffer.cpp index ba44df15c2e..dbceefb7c8e 100644 --- a/src/hotspot/share/code/icBuffer.cpp +++ b/src/hotspot/share/code/icBuffer.cpp @@ -141,7 +141,7 @@ void ICStub::print() { void InlineCacheBuffer::initialize() { if (_buffer != nullptr) return; // already initialized - _buffer = new StubQueue(new ICStubInterface, 10*K, InlineCacheBuffer_lock, "InlineCacheBuffer"); + _buffer = new StubQueue(new ICStubInterface, checked_cast(InlineCacheBufferSize), InlineCacheBuffer_lock, "InlineCacheBuffer"); assert (_buffer != nullptr, "cannot allocate InlineCacheBuffer"); } diff --git a/src/hotspot/share/code/stubs.cpp b/src/hotspot/share/code/stubs.cpp index b5f659a5c5a..a24b3e6ce01 100644 --- a/src/hotspot/share/code/stubs.cpp +++ b/src/hotspot/share/code/stubs.cpp @@ -218,8 +218,6 @@ void StubQueue::verify() { guarantee(0 <= _queue_begin && _queue_begin < _buffer_limit, "_queue_begin out of bounds"); guarantee(0 <= _queue_end && _queue_end <= _buffer_limit, "_queue_end out of bounds"); // verify alignment - guarantee(_buffer_size % stub_alignment() == 0, "_buffer_size not aligned"); - guarantee(_buffer_limit % stub_alignment() == 0, "_buffer_limit not aligned"); guarantee(_queue_begin % stub_alignment() == 0, "_queue_begin not aligned"); guarantee(_queue_end % stub_alignment() == 0, "_queue_end not aligned"); // verify buffer limit/size relationship diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index 10b0f1f04a3..0a04afad9aa 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -498,6 +498,11 @@ bool CompilerConfig::check_args_consistency(bool status) { "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K, min_code_cache_size/K); status = false; + } else if (InlineCacheBufferSize > NonNMethodCodeHeapSize / 2) { + jio_fprintf(defaultStream::error_stream(), + "Invalid InlineCacheBufferSize=" SIZE_FORMAT "K. Must be less than or equal to " SIZE_FORMAT "K.\n", + InlineCacheBufferSize/K, NonNMethodCodeHeapSize/2/K); + status = false; } #ifdef _LP64 diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index c02b0afed3c..e28017a0d4b 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -295,6 +295,9 @@ const int ObjectAlignmentInBytes = 8; product(bool, UseInlineCaches, true, \ "Use Inline Caches for virtual calls ") \ \ + product(size_t, InlineCacheBufferSize, 10*K, EXPERIMENTAL, \ + "InlineCacheBuffer size") \ + \ product(bool, InlineArrayCopy, true, DIAGNOSTIC, \ "Inline arraycopy native that is known to be part of " \ "base library DLL") \