Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. CodeCacheManager readability improvements #3546

Merged
merged 1 commit into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions compiler/runtime/OMRCodeCacheManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ OMR::CodeCacheManager::initialize(
|| config.maxNumberOfCodeCaches() == 1
#if !defined(TR_HOST_POWER)
|| (!TR::Options::getCmdLineOptions()->getOption(TR_StressTrampolines) &&
_codeCacheRepositorySegment &&
self()->usingRepository() &&
config.codeCacheTotalKB() <= REACHEABLE_RANGE_KB)
#endif
);
Expand Down Expand Up @@ -761,12 +761,13 @@ OMR::CodeCacheManager::allocateCodeMemoryWithRetries(size_t warmCodeSize,


TR::CodeCacheMemorySegment *
OMR::CodeCacheManager::getNewCacheMemorySegment(size_t segmentSize,
size_t & codeCacheSizeAllocated)
OMR::CodeCacheManager::getNewCodeCacheMemorySegment(
size_t segmentSize,
size_t & codeCacheSizeAllocated)
{
TR::CodeCacheMemorySegment *codeCacheSegment;

if (_codeCacheRepositorySegment)
if (self()->usingRepository())
{
codeCacheSegment = self()->carveCodeCacheSpaceFromRepository(segmentSize, codeCacheSizeAllocated);
if (!codeCacheSegment)
Expand Down Expand Up @@ -967,7 +968,7 @@ OMR::CodeCacheManager::increaseFreeSpaceInCodeCacheRepository(size_t size)

// Either use monitors or atomic operations for the following because
// multiple compilation threads can adjust this value
if (_codeCacheRepositorySegment) // check whether we use the repository at all
if (self()->usingRepository())
{
RepositoryMonitorCriticalSection updateRepository(self());
_repositoryCodeCache->setColdCodeAlloc(_repositoryCodeCache->getColdCodeAlloc() + size);
Expand All @@ -984,7 +985,7 @@ OMR::CodeCacheManager::decreaseFreeSpaceInCodeCacheRepository(size_t size)

// Either use monitors or atomic operations for the following because
// multiple compilation threads can adjust this value
if (_codeCacheRepositorySegment) // check whether we use the repository at all
if (self()->usingRepository())
{
RepositoryMonitorCriticalSection updateRepository(self());
_repositoryCodeCache->setColdCodeAlloc(_repositoryCodeCache->getColdCodeAlloc() - size);
Expand Down Expand Up @@ -1147,7 +1148,7 @@ OMR::CodeCacheManager::allocateCodeCacheFromNewSegment(
bool verboseCodeCache = config.verboseCodeCache();

size_t actualCodeCacheSizeAllocated;
TR::CodeCacheMemorySegment *codeCacheSegment = self()->getNewCacheMemorySegment(segmentSizeInBytes, actualCodeCacheSizeAllocated);
TR::CodeCacheMemorySegment *codeCacheSegment = self()->getNewCodeCacheMemorySegment(segmentSizeInBytes, actualCodeCacheSizeAllocated);

if (codeCacheSegment)
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/runtime/OMRCodeCacheManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class OMR_EXTENSIBLE CodeCacheManager

void addCodeCache(TR::CodeCache *codeCache);

TR::CodeCacheMemorySegment *getNewCacheMemorySegment(size_t segmentSize, size_t & codeCacheSizeAllocated);
TR::CodeCacheMemorySegment *getNewCodeCacheMemorySegment(size_t segmentSize, size_t & codeCacheSizeAllocated);

void unreserveCodeCache(TR::CodeCache *codeCache);
TR::CodeCache * reserveCodeCache(bool compilationCodeAllocationsMustBeContiguous,
Expand Down