summaryrefslogtreecommitdiff
path: root/src/vm/inlinetracking.h
diff options
context:
space:
mode:
authorDavid Mason <davmason@microsoft.com>2019-05-13 21:40:29 -0700
committerGitHub <noreply@github.com>2019-05-13 21:40:29 -0700
commit1fc8b490bc086cce155f374db2805f2ed5e4e6c1 (patch)
tree180432500053cab7739b99262dcdb60b36e0c2e1 /src/vm/inlinetracking.h
parent287d6af711f63149123cb67c5de9ae6684749016 (diff)
downloadcoreclr-1fc8b490bc086cce155f374db2805f2ed5e4e6c1.tar.gz
coreclr-1fc8b490bc086cce155f374db2805f2ed5e4e6c1.tar.bz2
coreclr-1fc8b490bc086cce155f374db2805f2ed5e4e6c1.zip
Profiler API to request ReJIT with inliners (#24461)
This API is necessary for attaching profilers to be able to ReJIT methods and replace everything that uses the old IL.
Diffstat (limited to 'src/vm/inlinetracking.h')
-rw-r--r--src/vm/inlinetracking.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/vm/inlinetracking.h b/src/vm/inlinetracking.h
index e885f1bb00..236d1caf8e 100644
--- a/src/vm/inlinetracking.h
+++ b/src/vm/inlinetracking.h
@@ -29,6 +29,7 @@
#include "sarray.h"
#include "crsttypes.h"
#include "daccess.h"
+#include "crossloaderallocatorhash.h"
@@ -371,5 +372,56 @@ public:
typedef DPTR(PersistentInlineTrackingMapR2R) PTR_PersistentInlineTrackingMapR2R;
#endif //FEATURE_READYTORUN
+#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
+// For inline tracking of JIT methods at runtime we use the CrossLoaderAllocatorHash
+class InliningInfoTrackerHashTraits : public NoRemoveDefaultCrossLoaderAllocatorHashTraits<MethodDesc *, MethodDesc *>
+{
+};
+
+typedef CrossLoaderAllocatorHash<InliningInfoTrackerHashTraits> InliningInfoTrackerHash;
+
+class JITInlineTrackingMap
+{
+public:
+ JITInlineTrackingMap(LoaderAllocator *pAssociatedLoaderAllocator);
+
+ void AddInlining(MethodDesc *inliner, MethodDesc *inlinee);
+ void AddInliningDontTakeLock(MethodDesc *inliner, MethodDesc *inlinee);
+
+ template <class VisitFunc>
+ void VisitInliners(MethodDesc *inlinee, VisitFunc &func)
+ {
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_TRIGGERS;
+ CAN_TAKE_LOCK;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ GCX_COOP();
+ CrstHolder holder(&m_mapCrst);
+
+ auto lambda = [&](OBJECTREF obj, MethodDesc *lambdaInlinee, MethodDesc *lambdaInliner)
+ {
+ _ASSERTE(lambdaInlinee == inlinee);
+
+ return func(lambdaInliner, lambdaInlinee);
+ };
+
+ m_map.VisitValuesOfKey(inlinee, lambda);
+ }
+
+private:
+ BOOL InliningExistsDontTakeLock(MethodDesc *inliner, MethodDesc *inlinee);
+
+ Crst m_mapCrst;
+ InliningInfoTrackerHash m_map;
+};
+
+typedef DPTR(JITInlineTrackingMap) PTR_JITInlineTrackingMap;
+
+#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
#endif //INLINETRACKING_H_