* [Local GC] FEATURE_EVENT_TRACE 2/n: Scaffolding for porting known events to callbacks on GCToEEInterface
* Code review feedback: remove `descriptor` system for known events and instead use the gcevents xmacro to generate calls to `GCEventStatus::IsEnabled` with known constants
* Remove more event descriptor code
static bool CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name);
static void WalkAsyncPinnedForPromotion(Object* object, ScanContext* sc, promote_func* callback);
static void WalkAsyncPinned(Object* object, void* context, void(*callback)(Object*, Object*, void*));
+ static IGCToCLREventSink* EventSink();
};
#endif // __GCENV_EE_H__
return g_theGCToCLR->WalkAsyncPinned(object, context, callback);
}
+inline IGCToCLREventSink* GCToEEInterface::EventSink()
+{
+ assert(g_theGCToCLR != nullptr);
+ return g_theGCToCLR->EventSink();
+}
+
#endif // __GCTOENV_EE_STANDALONE_INL__
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+#ifndef KNOWN_EVENT
+ #define KNOWN_EVENT(name, provider, level, keyword)
+#endif // KNOWN_EVENT
+
+#ifndef DYNAMIC_EVENT
+ #define DYNAMIC_EVENT(name, provider, level, keyword, ...)
+#endif // DYNAMIC_EVENT
+
+#undef KNOWN_EVENT
+#undef DYNAMIC_EVENT
GCEventStatus() = delete;
};
+class GCDynamicEvent
+{
+ /* TODO(segilles) - Not Yet Implemented */
+};
+
+#if FEATURE_EVENT_TRACE
+#define KNOWN_EVENT(name, _provider, _level, _keyword) \
+ inline bool GCEventEnabled##name() { return GCEventStatus::IsEnabled(_provider, _level, _keyword); }
+#include "gcevents.h"
+
+#define EVENT_ENABLED(name) GCEventEnabled##name()
+#define FIRE_EVENT(name, ...) \
+ do { \
+ IGCToCLREventSink* sink = GCToEEInterface::EventSink(); \
+ assert(sink != nullptr); \
+ sink->Fire##name(__VA_ARGS__); \
+ } while(0)
+#else
+#define EVENT_ENABLED(name) false
+#define FIRE_EVENT(name, ...) 0
+#endif // FEATURE_EVENT_TRACE
+
#endif // __GCEVENTSTATUS_H__
#ifndef _GCINTERFACE_EE_H_
#define _GCINTERFACE_EE_H_
+
+// This interface provides functions that the GC can use to fire events.
+// Events fired on this interface are split into two categories: "known"
+// events and "dynamic" events. Known events are events that are baked-in
+// to the hosting runtime's event manifest and are part of the GC/EE interface.
+// There is one callback on IGCToCLREventSink for each known event.
+//
+// Dynamic events are constructed at runtime by the GC and are not known
+// to the EE. ([LOCALGC TODO dynamic event implementation])
+class IGCToCLREventSink
+{
+ /* [LOCALGC TODO] This will be filled with events as they get ported */
+};
+
// This interface provides the interface that the GC will use to speak to the rest
// of the execution engine. Everything that the GC does that requires the EE
// to be informed or that requires EE action must go through this interface.
// This function is a no-op if "object" is not an OverlappedData object.
virtual
void WalkAsyncPinned(Object* object, void* context, void(*callback)(Object*, Object*, void*)) = 0;
+
+ // Returns an IGCToCLREventSink instance that can be used to fire events.
+ virtual
+ IGCToCLREventSink* EventSink() = 0;
};
#endif // _GCINTERFACE_EE_H_
formattype.cpp
fptrstubs.cpp
frames.cpp
+ gctoclreventsink.cpp
gcheaputilities.cpp
gchandleutilities.cpp
genericdict.cpp
}
}
}
+
+IGCToCLREventSink* GCToEEInterface::EventSink()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return &g_gcToClrEventSink;
+}
bool CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name);
void WalkAsyncPinnedForPromotion(Object* object, ScanContext* sc, promote_func* callback);
void WalkAsyncPinned(Object* object, void* context, void(*callback)(Object*, Object*, void*));
+ IGCToCLREventSink* EventSink();
};
} // namespace standalone
#include "comcallablewrapper.h"
#endif // FEATURE_COMINTEROP
+#include "gctoclreventsink.h"
+
// the method table for the WeakReference class
extern MethodTable* pWeakReferenceMT;
#include "comcallablewrapper.h"
#endif // FEATURE_COMINTEROP
+#include "gctoclreventsink.h"
+
// the method table for the WeakReference class
extern MethodTable* pWeakReferenceMT;
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "common.h"
+#include "gctoclreventsink.h"
+
+GCToCLREventSink g_gcToClrEventSink;
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#ifndef __GCTOCLREVENTSINK_H__
+#define __GCTOCLREVENTSINK_H__
+
+#include "gcinterface.h"
+
+class GCToCLREventSink : public IGCToCLREventSink
+{
+ /* [LOCALGC TODO] This will be filled with events as they get ported */
+};
+
+extern GCToCLREventSink g_gcToClrEventSink;
+
+#endif // __GCTOCLREVENTSINK_H__
+