Skip to content

Commit

Permalink
Merge pull request #10613 from mpirvu/TlsFix0220
Browse files Browse the repository at this point in the history
(0.22.0) Check whether TLS storage for comp object was created before freeing it
  • Loading branch information
dsouzai authored Sep 16, 2020
2 parents c019636 + 964d39c commit 3ae448f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions runtime/compiler/control/CompilationController.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
* Copyright (c) 2000, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -42,9 +42,9 @@

TR::CompilationStrategy *TR::CompilationController::_compilationStrategy = NULL;
TR::CompilationInfo * TR::CompilationController::_compInfo = 0;
int32_t TR::CompilationController::_verbose = 0;
bool TR::CompilationController::_useController = false;

int32_t TR::CompilationController::_verbose = 0;
bool TR::CompilationController::_useController = false;
bool TR::CompilationController::_tlsCompObjCreated = false;


//------------------------------------ init -----------------------------------
Expand Down Expand Up @@ -89,6 +89,7 @@ bool TR::CompilationController::init(TR::CompilationInfo *compInfo)
if (options->getOption(TR_EnableCompYieldStats))
TR::Compilation::allocateCompYieldStatsMatrix();
tlsAlloc(OMR::compilation);
_tlsCompObjCreated = true;
return _useController;
}

Expand All @@ -98,7 +99,8 @@ bool TR::CompilationController::init(TR::CompilationInfo *compInfo)
// --------------------------------------------------------------------------
void TR::CompilationController::shutdown()
{
tlsFree(OMR::compilation);
if (_tlsCompObjCreated)
tlsFree(OMR::compilation);
if (!_useController)
return;
// would like to free all entries in the pool of compilation plans
Expand Down

0 comments on commit 3ae448f

Please sign in to comment.