diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-04-13 16:34:34 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-04-13 16:34:34 (GMT) |
commit | 6906aa19b7ac4c14615c30d15bfb26b0b86557d5 (patch) | |
tree | f0fb0b6ea116e4ec87f33b3b4198f6dc4c88766c /src/analysis/decomp | |
parent | acc7b5f33e93bae3bf43e8f029976b7f74260b52 (diff) |
Simplified the way links between instructions are handled.
Diffstat (limited to 'src/analysis/decomp')
-rw-r--r-- | src/analysis/decomp/il.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/analysis/decomp/il.c b/src/analysis/decomp/il.c index e8ca49e..f409550 100644 --- a/src/analysis/decomp/il.c +++ b/src/analysis/decomp/il.c @@ -559,6 +559,8 @@ static void build_ite_branches(GITEInstruction *decomp, GFlowBlock *block, GDecC g_object_unref(G_OBJECT(sub_ctx)); } + g_object_unref(G_OBJECT(next)); + } /* Branche 'false' */ @@ -576,6 +578,8 @@ static void build_ite_branches(GITEInstruction *decomp, GFlowBlock *block, GDecC g_object_unref(G_OBJECT(sub_ctx)); } + g_object_unref(G_OBJECT(next)); + } g_ite_instruction_set_branches(decomp, true_dinstr, false_dinstr); @@ -610,9 +614,9 @@ static void close_case_decomp_instructions(GDecInstruction *case_dinstr, GInstrB vmpa_t common_addr; /* Adresse commune de suite */ bool is_common; /* Suite commune ? */ GArchInstruction *last; /* Dernière instruction de bloc*/ - instr_link_t *dests; /* Instr. visées par une autre */ size_t dcount; /* Nombre de liens de dest. */ size_t j; /* Boucle de parcours #2 */ + instr_link_t *dest; /* Instr. visée par une autre */ vmpa_t addr; /* Adresse d'une instruction */ bool jump_to_case; /* Suite dans le cas suivant ? */ @@ -638,11 +642,15 @@ static void close_case_decomp_instructions(GDecInstruction *case_dinstr, GInstrB for (i = 0; i < lcount && is_common; i++) { g_flow_block_get_boundary(G_FLOW_BLOCK(leafs[i]), NULL, &last); - dcount = g_arch_instruction_get_destinations(last, &dests); + + g_arch_instruction_lock_dest(last); + dcount = g_arch_instruction_count_destinations(last); for (j = 0; j < dcount && is_common; j++) { - g_arch_instruction_get_location(dests[j].linked, NULL, NULL, &addr); + dest = g_arch_instruction_get_destination(last, j); + + g_arch_instruction_get_location(dest->linked, NULL, NULL, &addr); if (common_addr == VMPA_MAX) common_addr = addr; @@ -651,6 +659,8 @@ static void close_case_decomp_instructions(GDecInstruction *case_dinstr, GInstrB } + g_arch_instruction_unlock_dest(last); + } /* La sortie du cas est unique ! */ |