Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Change m_fPreemptiveGCDisabled to bool (#27648)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi1024e authored and jkotas committed Nov 4, 2019
1 parent c2ae7de commit 96e08af
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 44 deletions.
13 changes: 4 additions & 9 deletions src/gc/sample/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,14 @@ bool GCToEEInterface::IsPreemptiveGCDisabled()

bool GCToEEInterface::EnablePreemptiveGC()
{
bool bToggleGC = false;
Thread* pThread = ::GetThread();

if (pThread)
if (pThread && pThread->PreemptiveGCDisabled())
{
bToggleGC = !!pThread->PreemptiveGCDisabled();
if (bToggleGC)
{
pThread->EnablePreemptiveGC();
}
pThread->EnablePreemptiveGC();
return true;
}

return bToggleGC;
return false;
}

void GCToEEInterface::DisablePreemptiveGC()
Expand Down
4 changes: 2 additions & 2 deletions src/gc/sample/gcenv.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct alloc_context;

class Thread
{
uint32_t m_fPreemptiveGCDisabled;
bool m_fPreemptiveGCDisabled;
uintptr_t m_alloc_context[16]; // Reserve enough space to fix allocation context

friend class ThreadStore;
Expand All @@ -105,7 +105,7 @@ class Thread

bool PreemptiveGCDisabled()
{
return !!m_fPreemptiveGCDisabled;
return m_fPreemptiveGCDisabled;
}

void EnablePreemptiveGC()
Expand Down
2 changes: 1 addition & 1 deletion src/gc/unix/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class GCEvent::Impl
TimeSpecAdd(&endTime, milliseconds);
}
#else
#error "Don't know how to perfom timed wait on this platform"
#error "Don't know how to perform timed wait on this platform"
#endif

int st = 0;
Expand Down
31 changes: 13 additions & 18 deletions src/md/enc/metamodelrw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,23 +1422,21 @@ CMiniMdRW::InitOnMem(
int iCol;

// Look at all the tables, or until mixed sizes are discovered.
for (i=0; i<(int)m_TblCount && fMixed == false; i++)
for (i=0; i<(int)m_TblCount && !fMixed; i++)
{ // Look at all the columns of the table.
pCols = m_TableDefs[i].m_pColDefs;
for (iCol = 0; iCol < m_TableDefs[i].m_cCols && !fMixed; iCol++)
{ // If not a fixed size column...
if (!IsFixedType(m_TableDefs[i].m_pColDefs[iCol].m_Type))
{ // If this is the first non-fixed size column...
if (iSize == 0)
{ // remember it's size.
{ // remember its size.
iSize = m_TableDefs[i].m_pColDefs[iCol].m_cbColumn;
}
else
{ // Not first non-fixed size, so if a different size...
if (iSize != m_TableDefs[i].m_pColDefs[iCol].m_cbColumn)
{ // ...the table has mixed column sizes.
fMixed = true;
}
else if (iSize != m_TableDefs[i].m_pColDefs[iCol].m_cbColumn)
{ // Not first non-fixed size, so if a different size
// the table has mixed column sizes.
fMixed = true;
}
}
}
Expand All @@ -1449,18 +1447,15 @@ CMiniMdRW::InitOnMem(
IfFailGo(ExpandTables());
ComputeGrowLimits(FALSE /* ! small*/);
}
else if (iSize == 2)
{
// small schema
ComputeGrowLimits(TRUE /* small */);
}
else
{
if (iSize == 2)
{
// small schema
ComputeGrowLimits(TRUE /* small */);
}
else
{
// large schema
ComputeGrowLimits(FALSE /* ! small */);
}
// large schema
ComputeGrowLimits(FALSE /* ! small */);
}
}
else
Expand Down
20 changes: 6 additions & 14 deletions src/vm/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,31 +369,23 @@ bool GCToEEInterface::IsPreemptiveGCDisabled()
WRAPPER_NO_CONTRACT;

Thread* pThread = ::GetThread();
if (pThread)
{
return !!pThread->PreemptiveGCDisabled();
}

return false;

return (pThread && pThread->PreemptiveGCDisabled());
}

bool GCToEEInterface::EnablePreemptiveGC()
{
WRAPPER_NO_CONTRACT;

bool bToggleGC = false;
Thread* pThread = ::GetThread();

if (pThread)
if (pThread && pThread->PreemptiveGCDisabled())
{
bToggleGC = !!pThread->PreemptiveGCDisabled();
if (bToggleGC)
{
pThread->EnablePreemptiveGC();
}
pThread->EnablePreemptiveGC();
return true;
}

return bToggleGC;
return false;
}

void GCToEEInterface::DisablePreemptiveGC()
Expand Down

0 comments on commit 96e08af

Please sign in to comment.