mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-12 21:34:11 +02:00
Allow BfpThread_GetIntRegisters to fail without crashing
This commit is contained in:
parent
b60c247f1a
commit
3adf9a144e
3 changed files with 14 additions and 1 deletions
|
@ -602,6 +602,7 @@ BFGC::BFGC()
|
||||||
mPaused = false;
|
mPaused = false;
|
||||||
mShutdown = false;
|
mShutdown = false;
|
||||||
mForceDecommit = false;
|
mForceDecommit = false;
|
||||||
|
mCollectFailed = false;
|
||||||
mLastCollectFrame = 0;
|
mLastCollectFrame = 0;
|
||||||
mSkipMark = false;
|
mSkipMark = false;
|
||||||
mGracelessShutdown = false;
|
mGracelessShutdown = false;
|
||||||
|
@ -979,6 +980,11 @@ void BFGC::SweepSpan(tcmalloc_obj::Span* span, int expectedStartPage)
|
||||||
mCurSweepFoundPermanentCount++;
|
mCurSweepFoundPermanentCount++;
|
||||||
|
|
||||||
int markId = objectFlags & BF_OBJECTFLAG_MARK_ID_MASK;
|
int markId = objectFlags & BF_OBJECTFLAG_MARK_ID_MASK;
|
||||||
|
if ((mCollectFailed) && (markId != mCurMarkId))
|
||||||
|
{
|
||||||
|
obj->mObjectFlags = (BfObjectFlags)((obj->mObjectFlags & ~BF_OBJECTFLAG_MARK_ID_MASK) | mCurMarkId);
|
||||||
|
markId = mCurMarkId;
|
||||||
|
}
|
||||||
|
|
||||||
BF_ASSERT(markId != invalidMarkId);
|
BF_ASSERT(markId != invalidMarkId);
|
||||||
|
|
||||||
|
@ -1471,6 +1477,12 @@ bool BFGC::ScanThreads()
|
||||||
BP_ZONE("BfpThread_GetIntRegisters");
|
BP_ZONE("BfpThread_GetIntRegisters");
|
||||||
BfpThread_GetIntRegisters(thread->mThreadHandle, &stackPtr, regVals, ®ValCount, &threadResult);
|
BfpThread_GetIntRegisters(thread->mThreadHandle, &stackPtr, regVals, ®ValCount, &threadResult);
|
||||||
}
|
}
|
||||||
|
if (threadResult != BfpThreadResult_Ok)
|
||||||
|
{
|
||||||
|
mCollectFailed = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
BF_ASSERT(threadResult == BfpThreadResult_Ok);
|
BF_ASSERT(threadResult == BfpThreadResult_Ok);
|
||||||
|
|
||||||
void** threadLoadAddressMap = (void**)((_TEB*)thread->mTEB)->ThreadLocalStorage;
|
void** threadLoadAddressMap = (void**)((_TEB*)thread->mTEB)->ThreadLocalStorage;
|
||||||
|
@ -2388,6 +2400,7 @@ void BFGC::PerformCollection()
|
||||||
#else
|
#else
|
||||||
Beefy::AutoCrit autoCrit(mCritSect);
|
Beefy::AutoCrit autoCrit(mCritSect);
|
||||||
mAllocSinceLastGC = 0;
|
mAllocSinceLastGC = 0;
|
||||||
|
mCollectFailed = false;
|
||||||
|
|
||||||
// This was old "emergency" debugging code to make sure we weren't doing a malloc in the GC code,
|
// This was old "emergency" debugging code to make sure we weren't doing a malloc in the GC code,
|
||||||
// but it's a multi-threaded race condition
|
// but it's a multi-threaded race condition
|
||||||
|
|
|
@ -288,6 +288,7 @@ public:
|
||||||
bool mPaused;
|
bool mPaused;
|
||||||
bool mShutdown;
|
bool mShutdown;
|
||||||
bool mWaitingForGC; // GC.Collect sets this
|
bool mWaitingForGC; // GC.Collect sets this
|
||||||
|
bool mCollectFailed;
|
||||||
int mAllocSinceLastGC; // Added to on alloc and subtracted from on nursery cleanup
|
int mAllocSinceLastGC; // Added to on alloc and subtracted from on nursery cleanup
|
||||||
int mFreeSinceLastGC;
|
int mFreeSinceLastGC;
|
||||||
|
|
||||||
|
|
|
@ -2190,7 +2190,6 @@ BFP_EXPORT void BFP_CALLTYPE BfpThread_GetIntRegisters(BfpThread* thread, intptr
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
int error = GetLastError();
|
int error = GetLastError();
|
||||||
BF_DBG_FATAL("Failed BfpThread_GetIntRegisters");
|
|
||||||
OUTRESULT(BfpThreadResult_UnknownError);
|
OUTRESULT(BfpThreadResult_UnknownError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue