Skip to content

Commit

Permalink
Remove FrontEnd::singleton() in lieu of FrontEnd::instance()
Browse files Browse the repository at this point in the history
`instance()` is the more consistent name for single class instances in the code base.

Signed-off-by: Daryl Maier <[email protected]>
  • Loading branch information
0xdaryl committed Nov 28, 2024
1 parent b017dbf commit beda391
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 19 deletions.
14 changes: 7 additions & 7 deletions compiler/control/CompileMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ compileMethodFromDetails(
int32_t &rc)
{
uint64_t translationStartTime = TR::Compiler->vm.getUSecClock();
TR::FrontEnd &fe = TR::FrontEnd::singleton();
auto jitConfig = fe.jitConfig();
TR::FrontEnd *fe = TR::FrontEnd::instance();
auto jitConfig = fe->jitConfig();
TR::RawAllocator rawAllocator;
TR::SystemSegmentProvider defaultSegmentProvider(1 << 16, rawAllocator);
TR::DebugSegmentProvider debugSegmentProvider(1 << 16, rawAllocator);
Expand All @@ -283,7 +283,7 @@ compileMethodFromDetails(
static_cast<TR::SegmentAllocator &>(debugSegmentProvider) :
static_cast<TR::SegmentAllocator &>(defaultSegmentProvider);
TR::Region dispatchRegion(scratchSegmentProvider, rawAllocator);
TR_Memory trMemory(*fe.persistentMemory(), dispatchRegion);
TR_Memory trMemory(*(fe->persistentMemory()), dispatchRegion);
TR_ResolvedMethod & compilee = *((TR_ResolvedMethod *)details.getMethod());

TR::CompileIlGenRequest request(details);
Expand All @@ -295,7 +295,7 @@ compileMethodFromDetails(

TR_FilterBST *filterInfo = 0;
TR_OptimizationPlan *plan = 0;
if (!methodCanBeCompiled(&fe, compilee, filterInfo, &trMemory))
if (!methodCanBeCompiled(fe, compilee, filterInfo, &trMemory))
{
if (TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseCompileExclude))
TR_VerboseLog::writeLineLocked(TR_Vlog_INFO, "%s cannot be translated", compilee.signature(&trMemory));
Expand Down Expand Up @@ -328,7 +328,7 @@ compileMethodFromDetails(
// FIXME: perhaps use stack memory instead

TR_ASSERT(TR::comp() == NULL, "there seems to be a current TLS TR::Compilation object %p for this thread. At this point there should be no current TR::Compilation object", TR::comp());
TR::Compilation compiler(0, omrVMThread, &fe, &compilee, request, options, dispatchRegion, &trMemory, plan);
TR::Compilation compiler(0, omrVMThread, fe, &compilee, request, options, dispatchRegion, &trMemory, plan);
TR_ASSERT(TR::comp() == &compiler, "the TLS TR::Compilation object %p for this thread does not match the one %p just created.", TR::comp(), &compiler);

try
Expand Down Expand Up @@ -369,7 +369,7 @@ compileMethodFromDetails(
{

// not ready yet...
//OMR::MethodMetaDataPOD *metaData = fe.createMethodMetaData(&compiler);
//OMR::MethodMetaDataPOD *metaData = fe->createMethodMetaData(&compiler);

startPC = (uint8_t*)compiler.getMethodSymbol()->getMethodAddress();
uint64_t translationTime = TR::Compiler->vm.getUSecClock() - translationStartTime;
Expand Down Expand Up @@ -403,7 +403,7 @@ compileMethodFromDetails(
|| compiler.getOption(TR_EmitRelocatableELFFile)
)
{
TR::CodeCacheManager &codeCacheManager(fe.codeCacheManager());
TR::CodeCacheManager &codeCacheManager(fe->codeCacheManager());
TR::CodeGenerator &codeGenerator(*compiler.cg());
codeCacheManager.registerCompiledMethod(compiler.externalName(), startPC, codeGenerator.getCodeLength());
if (compiler.getOption(TR_EmitRelocatableELFFile))
Expand Down
6 changes: 0 additions & 6 deletions compiler/env/OMRFrontEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ OMR::FrontEnd::FrontEnd() :
::trPersistentMemory = &_persistentMemory;
}

TR::FrontEnd &
OMR::FrontEnd::singleton()
{
return *_instance;
}

TR::FrontEnd *
OMR::FrontEnd::instance()
{
Expand Down
2 changes: 0 additions & 2 deletions compiler/env/OMRFrontEnd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ class OMR_EXTENSIBLE FrontEnd : public ::TR_FrontEnd

FrontEnd();

static TR::FrontEnd &singleton();

static TR::FrontEnd *instance();

virtual TR_Debug *createDebug(TR::Compilation *comp = NULL);
Expand Down
2 changes: 1 addition & 1 deletion compiler/env/OMRJitConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ OMR::JitConfig::JitConfig()
TR::JitConfig *
OMR::JitConfig::instance()
{
return TR::FrontEnd::singleton().jitConfig();
return TR::FrontEnd::instance()->jitConfig();
}
2 changes: 1 addition & 1 deletion compiler/runtime/Trampoline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extern void registerTrampoline(uint8_t *start, uint32_t size, const char *name);
void
ppcCreateHelperTrampolines(uint8_t *trampPtr, int32_t numHelpers)
{
TR::CodeCacheManager &manager = TR::FrontEnd::singleton().codeCacheManager();
TR::CodeCacheManager &manager = TR::FrontEnd::instance()->codeCacheManager();
TR::CodeCacheConfig &config = manager.codeCacheConfig();
char name[256];

Expand Down
4 changes: 2 additions & 2 deletions fvtest/compilerunittest/CompilerUnitTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ class CompilerUnitTest : public ::testing::Test {
_rawAllocator(),
_segmentProvider(1 << 16, _rawAllocator),
_dispatchRegion(_segmentProvider, _rawAllocator),
_trMemory(*TR::FrontEnd::singleton().persistentMemory(), _dispatchRegion),
_trMemory(*(TR::FrontEnd::instance()->persistentMemory()), _dispatchRegion),
_types(),
_options(),
_ilGenRequest(),
_method("compunittest", "0", "test", 0, NULL, _types.NoType, NULL, NULL),
_comp(0, NULL, &TR::FrontEnd::singleton(), &_method, _ilGenRequest, _options, _dispatchRegion, &_trMemory, TR_OptimizationPlan::alloc(warm)) {
_comp(0, NULL, TR::FrontEnd::instance(), &_method, _ilGenRequest, _options, _dispatchRegion, &_trMemory, TR_OptimizationPlan::alloc(warm)) {
_symbol = TR::ResolvedMethodSymbol::create(_comp.trStackMemory(), &_method, &_comp);
TR::CFG* cfg = new (region()) TR::CFG(&_comp, _symbol, region());
_symbol->setFlowGraph(cfg);
Expand Down

0 comments on commit beda391

Please sign in to comment.