summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/graph/cluster.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/gtkext/graph/cluster.c b/src/gtkext/graph/cluster.c
index 9aee82c..413af86 100644
--- a/src/gtkext/graph/cluster.c
+++ b/src/gtkext/graph/cluster.c
@@ -904,9 +904,9 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
{
unsigned int level; /* Niveau du nouvel ensemble */
GArchInstruction *last; /* Dernière instruction du bloc*/
- instr_link_t *dests; /* Instr. visées par une autre */
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours #1 */
+ instr_link_t *dest; /* Instr. visée par une autre */
GGraphCluster *target; /* Bloc ciblé par un lien */
leaving_edge *leaving; /* Point de départ d'un lien */
unsigned int target_level; /* Rang du bloc ciblé */
@@ -920,11 +920,14 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
g_basic_block_get_boundary(cluster->block, NULL, &last);
- g_arch_instruction_rlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests);
+ g_arch_instruction_lock_dest(last);
+ dcount = g_arch_instruction_count_destinations(last);
for (i = 0; i < dcount; i++)
- switch (dests[i].type)
+ {
+ dest = g_arch_instruction_get_destination(last, i);
+
+ switch (dest->type)
{
case ILT_EXEC_FLOW:
case ILT_JUMP:
@@ -932,7 +935,7 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
case ILT_JUMP_IF_TRUE:
case ILT_JUMP_IF_FALSE:
- target = G_GRAPH_CLUSTER(g_hash_table_lookup(all, dests[i].linked));
+ target = G_GRAPH_CLUSTER(g_hash_table_lookup(all, dest->linked));
assert(target != NULL);
/* Point de départ */
@@ -982,7 +985,7 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
leaving->index = cluster->ba_count - 1;
- incoming->type = dests[i].type;
+ incoming->type = dest->type;
if (incoming->type == ILT_JUMP_IF_TRUE)
incoming->edge = g_graph_edge_new_true(&leaving->start, &incoming->y, &incoming->end);
@@ -1027,7 +1030,9 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
}
- g_arch_instruction_runlock_dest(last);
+ }
+
+ g_arch_instruction_unlock_dest(last);
@@ -1508,9 +1513,9 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
#ifndef NDEBUG
gboolean new; /* Bloc déjà traité ? */
#endif
- instr_link_t *dests; /* Instr. visées par une autre */
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours #1 */
+ instr_link_t *dest; /* Instr. visée par une autre */
GBasicBlock *target; /* Bloc ciblé par un lien */
size_t j; /* Boucle de parcours #2 */
bool changed; /* Un ajout a été effectué ? */
@@ -1533,11 +1538,14 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
/* Détermination des blocs suivants */
- g_arch_instruction_rlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests);
+ g_arch_instruction_lock_dest(last);
+ dcount = g_arch_instruction_count_destinations(last);
for (i = 0; i < dcount; i++)
- switch (dests[i].type)
+ {
+ dest = g_arch_instruction_get_destination(last, i);
+
+ switch (dest->type)
{
case ILT_EXEC_FLOW:
case ILT_JUMP:
@@ -1545,7 +1553,7 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
case ILT_JUMP_IF_TRUE:
case ILT_JUMP_IF_FALSE:
- target = g_block_list_find_by_starting_instr(list, dests[i].linked);
+ target = g_block_list_find_by_starting_instr(list, dest->linked);
/**
* Les sauts ne se font pas toujours à l'intérieur d'une même fonction.
@@ -1558,7 +1566,7 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
*
*/
- printf(" NEW BLK :: %d -> %p\n", dests[i].type, target);
+ printf(" NEW BLK :: %d -> %p\n", dest->type, target);
if (target != NULL)
{
@@ -1588,11 +1596,11 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
* la table globale.
*/
- if (!g_hash_table_contains(all, dests[i].linked))
+ if (!g_hash_table_contains(all, dest->linked))
{
assert((pending->count + 1) < g_block_list_count_blocks(list));
pending->list[pending->count++] = target;
- printf(" --push-- %d -> %p\n", dests[i].type, target);
+ printf(" --push-- %d -> %p\n", dest->type, target);
}
}
@@ -1618,7 +1626,9 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
}
- g_arch_instruction_runlock_dest(last);
+ }
+
+ g_arch_instruction_unlock_dest(last);
/* Intégration de tous les blocs en attente */