Add way to get table for handle and ADIndex for handletable.
authorAditya Mandaleeka <adityam@microsoft.com>
Sat, 1 Apr 2017 00:09:46 +0000 (17:09 -0700)
committerAditya Mandaleeka <adityam@microsoft.com>
Sat, 1 Apr 2017 02:30:21 +0000 (19:30 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/dab2f6b76a1ed088a871374189e2133db9c9accb

src/coreclr/src/gc/gchandletable.cpp
src/coreclr/src/gc/gchandletableimpl.h
src/coreclr/src/gc/gcinterface.h
src/coreclr/src/vm/gcheaputilities.cpp

index a4c3352..c096d9f 100644 (file)
@@ -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);
+}
index 233e326..eafb0a0 100644 (file)
@@ -13,6 +13,10 @@ public:
     virtual bool Initialize();
 
     virtual void Shutdown();
+
+    virtual void* GetHandleTableContext(HHANDLETABLE hTable);
+
+    virtual HHANDLETABLE GetHandleTableForHandle(OBJECTHANDLE handle);
 };
 
 #endif  // GCHANDLETABLE_H_
index 77425b1..e1e7301 100644 (file)
@@ -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.
index aa90341..e24f1ad 100644 (file)
@@ -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 = {};
-