From: Aditya Mandaleeka Date: Sat, 1 Apr 2017 00:09:46 +0000 (-0700) Subject: Add way to get table for handle and ADIndex for handletable. X-Git-Tag: submit/tizen/20210909.063632~11030^2~7329^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=468ccf53dbe6b04c50fe7da2c31df57799f74ec3;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Add way to get table for handle and ADIndex for handletable. Commit migrated from https://github.com/dotnet/coreclr/commit/dab2f6b76a1ed088a871374189e2133db9c9accb --- diff --git a/src/coreclr/src/gc/gchandletable.cpp b/src/coreclr/src/gc/gchandletable.cpp index a4c3352..c096d9f 100644 --- a/src/coreclr/src/gc/gchandletable.cpp +++ b/src/coreclr/src/gc/gchandletable.cpp @@ -22,3 +22,13 @@ void GCHandleTable::Shutdown() { Ref_Shutdown(); } + +void* GCHandleTable::GetHandleTableContext(HHANDLETABLE hTable) +{ + return (void*)((uintptr_t)::HndGetHandleTableADIndex(hTable).m_dwIndex); +} + +HHANDLETABLE GCHandleTable::GetHandleTableForHandle(OBJECTHANDLE handle) +{ + return ::HndGetHandleTable(handle); +} diff --git a/src/coreclr/src/gc/gchandletableimpl.h b/src/coreclr/src/gc/gchandletableimpl.h index 233e326..eafb0a0 100644 --- a/src/coreclr/src/gc/gchandletableimpl.h +++ b/src/coreclr/src/gc/gchandletableimpl.h @@ -13,6 +13,10 @@ public: virtual bool Initialize(); virtual void Shutdown(); + + virtual void* GetHandleTableContext(HHANDLETABLE hTable); + + virtual HHANDLETABLE GetHandleTableForHandle(OBJECTHANDLE handle); }; #endif // GCHANDLETABLE_H_ diff --git a/src/coreclr/src/gc/gcinterface.h b/src/coreclr/src/gc/gcinterface.h index 77425b1..e1e7301 100644 --- a/src/coreclr/src/gc/gcinterface.h +++ b/src/coreclr/src/gc/gcinterface.h @@ -149,10 +149,18 @@ struct segment_info void * pvMem; // base of the allocation, not the first object (must add ibFirstObject) size_t ibFirstObject; // offset to the base of the first object in the segment size_t ibAllocated; // limit of allocated memory in the segment (>= firstobject) - size_t ibCommit; // limit of committed memory in the segment (>= alllocated) + size_t ibCommit; // limit of committed memory in the segment (>= allocated) size_t ibReserved; // limit of reserved memory in the segment (>= commit) }; + +/* + * handle to handle table + */ +typedef DPTR(struct HandleTable) PTR_HandleTable; +typedef DPTR(PTR_HandleTable) PTR_PTR_HandleTable; +typedef PTR_HandleTable HHANDLETABLE; +typedef PTR_PTR_HandleTable PTR_HHANDLETABLE; #ifdef PROFILING_SUPPORTED #define GC_PROFILING //Turn on profiling #endif // PROFILING_SUPPORTED @@ -391,6 +399,10 @@ public: virtual bool Initialize() = 0; virtual void Shutdown() = 0; + + virtual void* GetHandleTableContext(HHANDLETABLE hTable) = 0; + + virtual HHANDLETABLE GetHandleTableForHandle(OBJECTHANDLE handle) = 0; }; // IGCHeap is the interface that the VM will use when interacting with the GC. diff --git a/src/coreclr/src/vm/gcheaputilities.cpp b/src/coreclr/src/vm/gcheaputilities.cpp index aa90341..e24f1ad 100644 --- a/src/coreclr/src/vm/gcheaputilities.cpp +++ b/src/coreclr/src/vm/gcheaputilities.cpp @@ -35,4 +35,3 @@ bool g_sw_ww_enabled_for_gc_heap = false; #endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP gc_alloc_context g_global_alloc_context = {}; -