diff options
author | Mukul Sabharwal <mjsabby@gmail.com> | 2019-04-25 15:34:19 -0700 |
---|---|---|
committer | Maoni Stephens <Maoni0@users.noreply.github.com> | 2019-04-25 15:34:19 -0700 |
commit | 14458204d17a47eff4323f1f8102eb222b157637 (patch) | |
tree | 576b20da03def7814ff3ca94abfaadb69e4bd51d | |
parent | e30263455e930b63c0f311cf28d4f73a8abb504c (diff) | |
download | coreclr-14458204d17a47eff4323f1f8102eb222b157637.tar.gz coreclr-14458204d17a47eff4323f1f8102eb222b157637.tar.bz2 coreclr-14458204d17a47eff4323f1f8102eb222b157637.zip |
Add IsFrozenObject Profiler API (#24239)
-rw-r--r-- | src/inc/corprof.idl | 3 | ||||
-rw-r--r-- | src/pal/prebuilt/inc/corprof.h | 12 | ||||
-rw-r--r-- | src/vm/proftoeeinterfaceimpl.cpp | 36 | ||||
-rw-r--r-- | src/vm/proftoeeinterfaceimpl.h | 2 |
4 files changed, 53 insertions, 0 deletions
diff --git a/src/inc/corprof.idl b/src/inc/corprof.idl index 25a6201036..b34fd311ca 100644 --- a/src/inc/corprof.idl +++ b/src/inc/corprof.idl @@ -3929,6 +3929,9 @@ interface ICorProfilerInfo10 : ICorProfilerInfo9 { // Given an ObjectID, fetches all its object references and offsets (if any). HRESULT GetObjectReferences(ObjectID objectId, ULONG32 cNumReferences, ULONG32 *pcNumReferences, ObjectID references[], SIZE_T offsets[]); + + // Given an ObjectID, determines whether it is in a read only segment. + HRESULT IsFrozenObject(ObjectID objectId, BOOL *pbFrozen); } /* diff --git a/src/pal/prebuilt/inc/corprof.h b/src/pal/prebuilt/inc/corprof.h index f5f84132cd..0963b030a5 100644 --- a/src/pal/prebuilt/inc/corprof.h +++ b/src/pal/prebuilt/inc/corprof.h @@ -15191,6 +15191,10 @@ EXTERN_C const IID IID_ICorProfilerInfo10; ObjectID references[ ], SIZE_T offsets[ ]) = 0; + virtual HRESULT STDMETHODCALLTYPE IsFrozenObject( + ObjectID objectId, + BOOL *pbFrozen) = 0; + }; @@ -15784,6 +15788,11 @@ EXTERN_C const IID IID_ICorProfilerInfo10; ObjectID references[ ], SIZE_T offsets[ ]); + HRESULT ( STDMETHODCALLTYPE *IsFrozenObject )( + ICorProfilerInfo10 * This, + ObjectID objectId, + BOOL *pbFrozen); + END_INTERFACE } ICorProfilerInfo10Vtbl; @@ -16089,6 +16098,9 @@ EXTERN_C const IID IID_ICorProfilerInfo10; #define ICorProfilerInfo10_GetObjectReferences(This,objectId,cNumReferences,pcNumReferences,references,offsets) \ ( (This)->lpVtbl -> GetObjectReferences(This,objectId,cNumReferences,pcNumReferences,references,offsets) ) +#define ICorProfilerInfo10_IsFrozenObject(This,objectId,pbFrozen) \ + ( (This)->lpVtbl -> IsFrozenObject(This,objectId,pbFrozen) ) + #endif /* COBJMACROS */ diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp index db331f4a73..74985a77bb 100644 --- a/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/vm/proftoeeinterfaceimpl.cpp @@ -6856,6 +6856,42 @@ HRESULT ProfToEEInterfaceImpl::GetObjectReferences(ObjectID objectId, ULONG32 cN } /* + * IsFrozenObject + * + * Determines whether the object is in a read-only segment + * + * Parameters: + * objectId - object id of interest + * + * Returns: + * S_OK if successful + * + */ +HRESULT ProfToEEInterfaceImpl::IsFrozenObject(ObjectID objectId, BOOL *pbFrozen) +{ + CONTRACTL + { + NOTHROW; + GC_NOTRIGGER; + MODE_ANY; + EE_THREAD_NOT_REQUIRED; + CANNOT_TAKE_LOCK; + } + CONTRACTL_END; + + PROFILER_TO_CLR_ENTRYPOINT_SYNC_EX( + kP2EEAllowableAfterAttach, + (LF_CORPROF, + LL_INFO1000, + "**PROF: IsFrozenObject 0x%p.\n", + objectId)); + + *pbFrozen = GCHeapUtilities::GetGCHeap()->IsInFrozenSegment((Object*)objectId) ? TRUE : FALSE; + + return S_OK; +} + +/* * GetStringLayout * * This function describes to a profiler the internal layout of a string. diff --git a/src/vm/proftoeeinterfaceimpl.h b/src/vm/proftoeeinterfaceimpl.h index 2445c43561..d41eec9120 100644 --- a/src/vm/proftoeeinterfaceimpl.h +++ b/src/vm/proftoeeinterfaceimpl.h @@ -609,6 +609,8 @@ public: ObjectID references[], SIZE_T offsets[]); + COM_METHOD IsFrozenObject(ObjectID objectId, BOOL *pbFrozen); + // end ICorProfilerInfo10 protected: |