Skip to content

Commit

Permalink
Merged PR 902922: Get Object chakra-core#1 (WebGLActiveInfo) onto the…
Browse files Browse the repository at this point in the history
… chakra heap for tracing and finalizing

Create macros that allow for CBase and other types of objects to use the templated ThreadAlloc's for allocation.
Use the macro for WebGLActiveInfo.
Convert AddRef/Release to RootAddRef/RootRelease calls
Virtual all non-public ref counting methods on CBase and abandon if they are called
neuter JSBind_* methods related to refcounting
Implement a Trace that simply traces the Var (which we actually know will already be marked due to how this object is reachable)
Add a basic leak detector to the new type (interim, more as a sanity check)
Modify callers creating this type of object to just new into a raw pointer on the stack.

Call Passivate (if exists) in Dispose
Ensure pointer is 16-byte aligned so that it is marked from CEO Var

Patch up the IRecyclerVisitedObject interface to not take Recycler, but instead encapsulate that inside FinalizableObject
Remove assert that prevented interior marking when in parallel/concurrent and recycler state not set (recycler state currently only used by MemGC)

Modify assert in CBase::Passivate that expects Var to be nullptr by opting out GC traced objects
  • Loading branch information
dlibby- committed Sep 28, 2017
1 parent 3fd05c8 commit 1b7c665
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
8 changes: 8 additions & 0 deletions lib/Common/Core/FinalizableObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ class FinalizableObject : public IRecyclerVisitedObject
{
public:
virtual void __stdcall OnMark() {}

void __stdcall Mark(RecyclerHeapHandle recycler) final
{
Mark(static_cast<Recycler*>(recycler));
}

bool __stdcall Trace(IRecyclerHeapMarkingContext* markingContext) final
{
AssertMsg(false, "Trace called on object that isn't implemented by the host");
return true;
}

virtual void __stdcall Mark(Recycler* recycler) = 0;
};
9 changes: 2 additions & 7 deletions lib/Common/Core/RecyclerVisitedObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
//-------------------------------------------------------------------------------------------------------
#pragma once

typedef void* RecyclerHeapMarkingContext;
interface IRecyclerHeapMarkingContext;

namespace Memory
{
class Recycler;
}
typedef void* RecyclerHeapHandle;

interface IRecyclerVisitedObject
{
Expand All @@ -25,7 +20,7 @@ interface IRecyclerVisitedObject
STDMETHOD_(void, Dispose)(bool isShutdown) = 0;

// Used only by TrackableObjects (created with TrackedBit on by RecyclerNew*Tracked)
STDMETHOD_(void, Mark)(Memory::Recycler* recycler) = 0;
STDMETHOD_(void, Mark)(RecyclerHeapHandle recycler) = 0;

// Special behavior on certain GC's
STDMETHOD_(void, OnMark)() = 0;
Expand Down
6 changes: 0 additions & 6 deletions lib/Common/Memory/MarkContext.inl
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ void MarkContext::Mark(void * candidate, void * parentReference)

if (interior)
{
#if ENABLE_CONCURRENT_GC
Assert(recycler->enableScanInteriorPointers
|| (!recycler->IsConcurrentState() && recycler->collectionState != CollectionStateParallelMark));
#else
Assert(recycler->enableScanInteriorPointers || recycler->collectionState != CollectionStateParallelMark);
#endif
recycler->heapBlockMap.MarkInterior<parallel>(candidate, this);
return;
}
Expand Down

0 comments on commit 1b7c665

Please sign in to comment.