On 06/30/2017 12:41 AM, Richard Henderson wrote:
On 06/29/2017 01:28 PM, Emilio G. Cota wrote:
+/* @key is already in the tree so it's safe to use container_of on it */
+static gint tc_ptr_cmp(gconstpointer candidate, gconstpointer key)
+{
+ uintptr_t a = *(uintptr_t *)candidate;
+ const TranslationBlock *tb = container_of(key, TranslationBlock, tc_ptr);
This I'm not keen on. It'd be one thing if it was our own datastructure, but I
see nothing in the GTree documentation that says that the comparison must
always be done this way.
What if we bundle tc_ptr + tc_size into a struct and only reference that? We'd
embed that struct into the TB. In tb_find_pc, create that struct on the stack,
setting tc_size = 0.
r~