mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-10 18:11:04 +09:00
syncblocks escape the backpointed obj
This commit is contained in:
parent
a44aaffcee
commit
01748e2d65
5 changed files with 29 additions and 17 deletions
|
@ -19,8 +19,10 @@
|
|||
|
||||
#include "objecthandle.h"
|
||||
#include "handletablepriv.h"
|
||||
#include "satori/SatoriObject.inl"
|
||||
#include "satori/SatoriRegion.inl"
|
||||
|
||||
#if FEATURE_SATORI_GC
|
||||
#include "../gc/satori/SatoriObject.h"
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_PERF_COUNTERS) || defined(FEATURE_EVENT_TRACE)
|
||||
DWORD g_dwHandles = 0;
|
||||
|
@ -542,18 +544,6 @@ void HndLogSetEvent(OBJECTHANDLE handle, _UNCHECKED_OBJECTREF value)
|
|||
|
||||
#ifndef DACCESS_COMPILE
|
||||
|
||||
void MarkEscapeSatori(Object* ref)
|
||||
{
|
||||
#if FEATURE_SATORI_GC
|
||||
SatoriObject* obj = (SatoriObject*)ref;
|
||||
SatoriRegion* region = obj->ContainingRegion();
|
||||
if (region->OwnedByCurrentThread())
|
||||
{
|
||||
obj->ContainingRegion()->EscapeRecursively(obj);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* HndWriteBarrierWorker
|
||||
*
|
||||
|
@ -564,7 +554,9 @@ void HndWriteBarrierWorker(OBJECTHANDLE handle, _UNCHECKED_OBJECTREF value)
|
|||
{
|
||||
_ASSERTE (value != NULL);
|
||||
|
||||
MarkEscapeSatori(OBJECTREFToObject(value));
|
||||
#if FEATURE_SATORI_GC
|
||||
((SatoriObject*)OBJECTREFToObject(value))->EscapeCheck();
|
||||
#endif
|
||||
|
||||
// find the write barrier for this handle
|
||||
uint8_t *barrier = (uint8_t *)((uintptr_t)handle & HANDLE_SEGMENT_ALIGN_MASK);
|
||||
|
|
|
@ -21,7 +21,7 @@ void SatoriObject::Initialize()
|
|||
s_emptyObjectMt = GCToEEInterface::GetFreeObjectMethodTable();
|
||||
}
|
||||
|
||||
void SatoriObject::ClearPinned()
|
||||
NOINLINE void SatoriObject::ClearPinned()
|
||||
{
|
||||
if (!IsEscaped())
|
||||
{
|
||||
|
@ -29,6 +29,15 @@ void SatoriObject::ClearPinned()
|
|||
}
|
||||
}
|
||||
|
||||
void SatoriObject::EscapeCheck()
|
||||
{
|
||||
SatoriRegion* region = ContainingRegion();
|
||||
if (region->OwnedByCurrentThread())
|
||||
{
|
||||
region->EscapeRecursively(this);
|
||||
}
|
||||
}
|
||||
|
||||
SatoriObject* SatoriObject::FormatAsFree(size_t location, size_t size)
|
||||
{
|
||||
_ASSERTE(location == ALIGN_UP(location, Satori::OBJECT_ALIGNMENT));
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
bool IsEscapedOrPinned();
|
||||
int MarkBitOffset(size_t* bitmapIndex);
|
||||
|
||||
void EscapeCheck();
|
||||
|
||||
bool IsFinalizationSuppressed();
|
||||
|
||||
int32_t GetNextInMarkStack();
|
||||
|
|
|
@ -124,7 +124,7 @@ inline void SatoriObject::ClearPinnedAndMarked()
|
|||
ClearBit(0);
|
||||
if (IsPinned())
|
||||
{
|
||||
//TODO: VS make sure this does not inline.
|
||||
// this would be rare. do not inline.
|
||||
ClearPinned();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
#include "runtimecallablewrapper.h"
|
||||
#endif // FEATURE_COMINTEROP
|
||||
|
||||
#if FEATURE_SATORI_GC
|
||||
#include "../gc/satori/SatoriObject.h"
|
||||
#endif
|
||||
|
||||
// Allocate 4K worth. Typically enough
|
||||
#define MAXSYNCBLOCK (0x1000-sizeof(void*))/sizeof(SyncBlock)
|
||||
#define SYNC_TABLE_INITIAL_SIZE 250
|
||||
|
@ -946,6 +950,11 @@ DWORD SyncBlockCache::NewSyncBlockSlot(Object *obj)
|
|||
|
||||
CardTableSetBit (indexNewEntry);
|
||||
|
||||
// effectively we are creating a weak handle to the obj
|
||||
#if FEATURE_SATORI_GC
|
||||
((SatoriObject*)obj)->EscapeCheck();
|
||||
#endif
|
||||
|
||||
// In debug builds the m_SyncBlock at indexNewEntry should already be null, since we should
|
||||
// start out with a null table and always null it out on delete.
|
||||
_ASSERTE(SyncTableEntry::GetSyncTableEntry() [indexNewEntry].m_SyncBlock == NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue