summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2012-01-14 00:05:53 (GMT)
committerDavid Malcolm <dmalcolm@redhat.com>2012-01-14 00:05:53 (GMT)
commite75f80d759f42a24f564952dd393568c5a83b529 (patch)
treedca1ac3cd742365adb18b0dec187103a798305dd
parent6133f8ce881b7e1d4bc80b749940abe78e608d40 (diff)
downloadgcc-python-plugin-e75f80d759f42a24f564952dd393568c5a83b529.zip
gcc-python-plugin-e75f80d759f42a24f564952dd393568c5a83b529.tar.gz
gcc-python-plugin-e75f80d759f42a24f564952dd393568c5a83b529.tar.xz
allow registration of callbacks on gcc.PLUGIN_GGC_{START,MARKING,FINISH}
-rw-r--r--gcc-python-callbacks.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc-python-callbacks.c b/gcc-python-callbacks.c
index c7296e4..d4bca14 100644
--- a/gcc-python-callbacks.c
+++ b/gcc-python-callbacks.c
@@ -253,6 +253,41 @@ gcc_python_callback_for_FINISH_UNIT(void *gcc_data, void *user_data)
user_data);
}
+static void
+gcc_python_callback_for_GGC_START(void *gcc_data, void *user_data)
+{
+ PyGILState_STATE gstate;
+
+ gstate = PyGILState_Ensure();
+
+ gcc_python_finish_invoking_callback(gstate,
+ 0, NULL,
+ user_data);
+}
+
+static void
+gcc_python_callback_for_GGC_MARKING(void *gcc_data, void *user_data)
+{
+ PyGILState_STATE gstate;
+
+ gstate = PyGILState_Ensure();
+
+ gcc_python_finish_invoking_callback(gstate,
+ 0, NULL,
+ user_data);
+}
+
+static void
+gcc_python_callback_for_GGC_END(void *gcc_data, void *user_data)
+{
+ PyGILState_STATE gstate;
+
+ gstate = PyGILState_Ensure();
+
+ gcc_python_finish_invoking_callback(gstate,
+ 0, NULL,
+ user_data);
+}
PyObject*
@@ -318,6 +353,25 @@ gcc_python_register_callback(PyObject *self, PyObject *args, PyObject *kwargs)
closure);
break;
+ case PLUGIN_GGC_START:
+ register_callback("python", // FIXME
+ (enum plugin_event)event,
+ gcc_python_callback_for_GGC_START,
+ closure);
+ break;
+ case PLUGIN_GGC_MARKING:
+ register_callback("python", // FIXME
+ (enum plugin_event)event,
+ gcc_python_callback_for_GGC_MARKING,
+ closure);
+ break;
+ case PLUGIN_GGC_END:
+ register_callback("python", // FIXME
+ (enum plugin_event)event,
+ gcc_python_callback_for_GGC_END,
+ closure);
+ break;
+
default:
PyErr_Format(PyExc_ValueError, "event type %i invalid (or not wired up yet)", event);
return NULL;