|
From: | Richard Henderson |
Subject: | Re: [Qemu-devel] [RFC 3/7] translate-all: use a binary search tree to track TBs in TBContext |
Date: | Fri, 30 Jun 2017 00:49:37 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |