|
@@ -28,6 +28,7 @@
|
|
|
#include "qemu/mprotect.h"
|
|
|
#include "qemu/memalign.h"
|
|
|
#include "qemu/cacheinfo.h"
|
|
|
+#include "qemu/qtree.h"
|
|
|
#include "qapi/error.h"
|
|
|
#include "exec/exec-all.h"
|
|
|
#include "tcg/tcg.h"
|
|
@@ -36,7 +37,7 @@
|
|
|
|
|
|
struct tcg_region_tree {
|
|
|
QemuMutex lock;
|
|
|
- GTree *tree;
|
|
|
+ QTree *tree;
|
|
|
/* padding to avoid false sharing is computed at run-time */
|
|
|
};
|
|
|
|
|
@@ -163,7 +164,7 @@ static void tcg_region_trees_init(void)
|
|
|
struct tcg_region_tree *rt = region_trees + i * tree_size;
|
|
|
|
|
|
qemu_mutex_init(&rt->lock);
|
|
|
- rt->tree = g_tree_new_full(tb_tc_cmp, NULL, NULL, tb_destroy);
|
|
|
+ rt->tree = q_tree_new_full(tb_tc_cmp, NULL, NULL, tb_destroy);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -202,7 +203,7 @@ void tcg_tb_insert(TranslationBlock *tb)
|
|
|
|
|
|
g_assert(rt != NULL);
|
|
|
qemu_mutex_lock(&rt->lock);
|
|
|
- g_tree_insert(rt->tree, &tb->tc, tb);
|
|
|
+ q_tree_insert(rt->tree, &tb->tc, tb);
|
|
|
qemu_mutex_unlock(&rt->lock);
|
|
|
}
|
|
|
|
|
@@ -212,7 +213,7 @@ void tcg_tb_remove(TranslationBlock *tb)
|
|
|
|
|
|
g_assert(rt != NULL);
|
|
|
qemu_mutex_lock(&rt->lock);
|
|
|
- g_tree_remove(rt->tree, &tb->tc);
|
|
|
+ q_tree_remove(rt->tree, &tb->tc);
|
|
|
qemu_mutex_unlock(&rt->lock);
|
|
|
}
|
|
|
|
|
@@ -232,7 +233,7 @@ TranslationBlock *tcg_tb_lookup(uintptr_t tc_ptr)
|
|
|
}
|
|
|
|
|
|
qemu_mutex_lock(&rt->lock);
|
|
|
- tb = g_tree_lookup(rt->tree, &s);
|
|
|
+ tb = q_tree_lookup(rt->tree, &s);
|
|
|
qemu_mutex_unlock(&rt->lock);
|
|
|
return tb;
|
|
|
}
|
|
@@ -267,7 +268,7 @@ void tcg_tb_foreach(GTraverseFunc func, gpointer user_data)
|
|
|
for (i = 0; i < region.n; i++) {
|
|
|
struct tcg_region_tree *rt = region_trees + i * tree_size;
|
|
|
|
|
|
- g_tree_foreach(rt->tree, func, user_data);
|
|
|
+ q_tree_foreach(rt->tree, func, user_data);
|
|
|
}
|
|
|
tcg_region_tree_unlock_all();
|
|
|
}
|
|
@@ -281,7 +282,7 @@ size_t tcg_nb_tbs(void)
|
|
|
for (i = 0; i < region.n; i++) {
|
|
|
struct tcg_region_tree *rt = region_trees + i * tree_size;
|
|
|
|
|
|
- nb_tbs += g_tree_nnodes(rt->tree);
|
|
|
+ nb_tbs += q_tree_nnodes(rt->tree);
|
|
|
}
|
|
|
tcg_region_tree_unlock_all();
|
|
|
return nb_tbs;
|
|
@@ -296,8 +297,8 @@ static void tcg_region_tree_reset_all(void)
|
|
|
struct tcg_region_tree *rt = region_trees + i * tree_size;
|
|
|
|
|
|
/* Increment the refcount first so that destroy acts as a reset */
|
|
|
- g_tree_ref(rt->tree);
|
|
|
- g_tree_destroy(rt->tree);
|
|
|
+ q_tree_ref(rt->tree);
|
|
|
+ q_tree_destroy(rt->tree);
|
|
|
}
|
|
|
tcg_region_tree_unlock_all();
|
|
|
}
|