/** Bestimmt die eindeutige Methode, die die Methode für den
- * übergebenen (dynamischen) Typ überschreibt. */
+ * übergebenen (dynamischen) Typ überschreibt. */
static entity * get_implementation(type * class, entity * method) {
int i;
if (get_entity_peculiarity(method) != peculiarity_description &&
static entity *get_inherited_methods_implementation(entity *inh_meth) {
entity *impl_meth = NULL;
ir_node *addr = get_atomic_ent_value(inh_meth);
+
assert(addr && "constant entity without value");
+
if ((get_irn_op(addr) == op_SymConst) &&
- (get_SymConst_kind(addr) == symconst_addr_ent)) {
+ (get_SymConst_kind(addr) == symconst_addr_ent)) {
impl_meth = get_SymConst_entity(addr);
} else {
assert(0 && "Complex constant values not supported -- address of method should be straight constant!");
}
+
if (impl_meth && (get_entity_peculiarity(impl_meth) != peculiarity_existent)) {
/*
printf("this_meth: "); DDMEO(inh_meth);
int i;
if (get_entity_peculiarity(method) == peculiarity_existent) {
- if (get_entity_visibility(method) == visibility_external_allocated) {
- assert(get_entity_irg(method) == NULL);
+ if ((get_entity_visibility(method) == visibility_external_allocated)
+ && (NULL == get_entity_irg(method))) {
*open = true;
} else {
assert(get_entity_irg(method) != NULL);
*/
static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
- /* SymConst(name)-Operation durch SymConst(ent)-Operation ersetzen. */
+ /* replace SymConst(name)-operations by SymConst(ent) */
if (get_irn_op(node) == op_SymConst) {
if (get_SymConst_kind(node) == symconst_addr_name) {
pmap_entry * entry = pmap_find(ldname_map, (void *) get_SymConst_name(node));
/** Datenstruktur initialisieren. Zusätzlich werden alle
- * SymConst-Operationen, die auf interne Methoden verweisen, durch
- * Const-Operationen ersetzt. */
+ * SymConst(name)-Operationen, die auf interne Methoden verweisen, durch
+ * SymConst(entity)-Operationen ersetzt. */
static void sel_methods_init(void) {
int i;
- pmap * ldname_map = pmap_create(); /* Map entitiy names to entities: to replace SymConst by Const(ent). */
+ pmap * ldname_map = pmap_create(); /* Map entitiy names to entities: to replace SymConst(name) by SymConst(ent). */
+
assert(entities == NULL);
entities = eset_create();
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
irg_walk_graph(get_irp_irg(i), callee_walker, remove_Tuples, NULL);
set_irg_callee_info_state(get_irp_irg(i), irg_callee_info_consistent);
}
- //set_irp_callee_info_state(irg_callee_info_consistent);
+ set_irp_callee_info_state(irg_callee_info_consistent);
}
static void free_mark(ir_node * node, eset * set) {
int i;
- assert(mode_is_reference(get_irn_mode(node)));
+// assert(mode_is_reference(get_irn_mode(node)));
if (get_irn_link(node) == MARK) {
return; /* already visited */
}
* SymConst-Operationen müssen in passende Const-Operationen
* umgewandelt worden sein, d.h. SymConst-Operationen verweisen immer
* auf eine echt externe Methode. */
-static entity ** get_free_methods(int whole)
+static entity ** get_free_methods(void)
{
eset * set = eset_create();
int i;
entity ** arr = NEW_ARR_F(entity *, 0);
entity * ent;
- if (! whole) {
- for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
- ir_graph * irg = get_irp_irg(i);
- entity * ent = get_irg_entity(irg);
- /* insert "external visible" methods. */
- if (get_entity_visibility(ent) != visibility_local) {
- eset_insert(set, ent);
- }
- /* Finde alle Methoden die in dieser Methode extern sichtbar werden,
- z.B. da die Adresse einer Methode abgespeichert wird. */
- irg_walk_graph(irg, NULL, (irg_walk_func *) free_ana_walker, set);
+ for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
+ ir_graph * irg = get_irp_irg(i);
+ entity * ent = get_irg_entity(irg);
+ /* insert "external visible" methods. */
+ if (get_entity_visibility(ent) != visibility_local) {
+ eset_insert(set, ent);
}
+ /* Finde alle Methoden die in dieser Methode extern sichtbar werden,
+ z.B. da die Adresse einer Methode abgespeichert wird. */
+ irg_walk_graph(irg, NULL, (irg_walk_func *) free_ana_walker, set);
}
/* insert sticky methods, too */
return arr;
}
-void cgana(int *length, entity ***free_methods, int whole) {
- entity ** free_meths;
- int i;
+void cgana(int *length, entity ***free_methods) {
+ entity ** free_meths, **p;
sel_methods_init();
- free_meths = get_free_methods(whole);
+ free_meths = get_free_methods();
callee_ana();
sel_methods_dispose();
/* Convert the flexible array to an array that can be handled
by standard C. */
- *length = ARR_LEN(free_meths);
- *free_methods = (entity **)malloc(sizeof(entity *) * (*length));
- for (i = 0; i < (*length); i++) (*free_methods)[i] = free_meths[i];
+ p = (entity **)malloc(sizeof(*p) * ARR_LEN(free_meths));
+ memcpy(p, free_meths, ARR_LEN(free_meths) * sizeof(*p));
+
+ *length = ARR_LEN(free_meths);
+ *free_methods = p;
+
DEL_ARR_F(free_meths);
}