Skip to content

Commit

Permalink
Remove FrontEnd getDesignatedCodeCache
Browse files Browse the repository at this point in the history
Replace with a direct call to the `CodeCacheManager::reserveCodeCache`
function instead.  Remove FrontEnd API.

Signed-off-by: Daryl Maier <maier@ca.ibm.com>
  • Loading branch information
0xdaryl committed Jan 30, 2019
1 parent 5d31a9a commit df28c96
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 29 deletions.
9 changes: 0 additions & 9 deletions compiler/codegen/FrontEnd.cpp
Expand Up @@ -361,15 +361,6 @@ TR_FrontEnd::getClassClassPointer(TR_OpaqueClassBlock *objectClassPointer)
return 0;
}


TR::CodeCache *
TR_FrontEnd::getDesignatedCodeCache(TR::Compilation *comp)
{
notImplemented("getDesignatedCodeCache");
return 0;
}


void
TR_FrontEnd::reserveTrampolineIfNecessary(TR::Compilation *, TR::SymbolReference *symRef, bool inBinaryEncoding)
{
Expand Down
1 change: 0 additions & 1 deletion compiler/codegen/FrontEnd.hpp
Expand Up @@ -242,7 +242,6 @@ class TR_FrontEnd : public TR_Uncopyable

virtual uint8_t * allocateCodeMemory(TR::Compilation *, uint32_t warmCodeSize, uint32_t coldCodeSize, uint8_t ** coldCode, bool isMethodHeaderNeeded=true);
virtual void releaseCodeMemory(void *, uint8_t);
virtual TR::CodeCache *getDesignatedCodeCache(TR::Compilation* comp); // MCT
virtual void reserveTrampolineIfNecessary(TR::Compilation *, TR::SymbolReference *symRef, bool inBinaryEncoding);
virtual intptrj_t methodTrampolineLookup(TR::Compilation *, TR::SymbolReference *symRef, void * callSite);
virtual intptrj_t indexedTrampolineLookup(int32_t helperIndex, void * callSite); // No TR::Compilation parameter so this can be called from runtime code
Expand Down
21 changes: 14 additions & 7 deletions compiler/codegen/OMRCodeGenerator.cpp
Expand Up @@ -107,6 +107,7 @@
#include "ras/Delimiter.hpp" // for Delimiter
#include "runtime/CodeCache.hpp"
#include "runtime/CodeCacheExceptions.hpp"
#include "runtime/CodeCacheManager.hpp"
#include "runtime/Runtime.hpp" // for HI_VALUE, etc
#include "stdarg.h" // for va_end, etc

Expand Down Expand Up @@ -1711,19 +1712,25 @@ OMR::CodeGenerator::addressesMatch(TR::Node *addr1, TR::Node *addr2, bool addres
void
OMR::CodeGenerator::reserveCodeCache()
{
_codeCache = self()->fe()->getDesignatedCodeCache(self()->comp());
int32_t numReserved = 0;
int32_t compThreadID = 0;

_codeCache = TR::CodeCacheManager::instance()->reserveCodeCache(false, 0, compThreadID, &numReserved);

if (!_codeCache) // Cannot reserve a cache; all are used
{
// We may reach this point if all code caches have been used up
// If some code caches have some space but cannot be used because they are reserved
// we will throw an exception in the call to getDesignatedCodeCache
TR::Compilation *comp = self()->comp();

if (self()->comp()->compileRelocatableCode())
// We may reach this point if all code caches have been used up.
// If some code caches have some space but cannot be used because they are reserved
// we will throw an exception in the call to TR::CodeCacheManager::reserveCodeCache
//
if (comp->compileRelocatableCode())
{
self()->comp()->failCompilation<TR::RecoverableCodeCacheError>("Cannot reserve code cache");
comp->failCompilation<TR::RecoverableCodeCacheError>("Cannot reserve code cache");
}

self()->comp()->failCompilation<TR::CodeCacheError>("Cannot reserve code cache");
comp->failCompilation<TR::CodeCacheError>("Cannot reserve code cache");
}
}

Expand Down
2 changes: 0 additions & 2 deletions compiler/env/FEBase.hpp
Expand Up @@ -92,8 +92,6 @@ class FEBase : public FECommon
JitConfig *jitConfig() { return &_config; }
TR::CodeCacheManager &codeCacheManager() { return _codeCacheManager; }

virtual TR::CodeCache *getDesignatedCodeCache(TR::Compilation *);

virtual uint8_t *allocateCodeMemory(TR::Compilation *comp, uint32_t warmCodeSize, uint32_t coldCodeSize,
uint8_t **coldCode, bool isMethodHeaderNeeded);
virtual uint8_t * allocateRelocationData(TR::Compilation* comp, uint32_t size);
Expand Down
10 changes: 0 additions & 10 deletions compiler/env/FEBase_t.hpp
Expand Up @@ -35,16 +35,6 @@
namespace TR
{

template <class Derived>
TR::CodeCache *
FEBase<Derived>::getDesignatedCodeCache(TR::Compilation *)
{
int32_t numReserved = 0;
int32_t compThreadID = 0;
return codeCacheManager().reserveCodeCache(false, 0, compThreadID, &numReserved);
}


template <class Derived>
uint8_t *
FEBase<Derived>::allocateCodeMemory(TR::Compilation *comp, uint32_t warmCodeSize, uint32_t coldCodeSize,
Expand Down

0 comments on commit df28c96

Please sign in to comment.