Commit 5c749a5e authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

removed whole flag:

with this flag set, external visible methods were removed, which is wrong.

[r3932]
parent abaf5686
...@@ -53,7 +53,7 @@ static eset * entities = NULL; ...@@ -53,7 +53,7 @@ static eset * entities = NULL;
/** Bestimmt die eindeutige Methode, die die Methode fr den /** Bestimmt die eindeutige Methode, die die Methode fr den
* bergebenen (dynamischen) Typ berschreibt. */ * bergebenen (dynamischen) Typ berschreibt. */
static entity * get_implementation(type * class, entity * method) { static entity * get_implementation(type * class, entity * method) {
int i; int i;
if (get_entity_peculiarity(method) != peculiarity_description && if (get_entity_peculiarity(method) != peculiarity_description &&
...@@ -81,13 +81,16 @@ static entity * get_implementation(type * class, entity * method) { ...@@ -81,13 +81,16 @@ static entity * get_implementation(type * class, entity * method) {
static entity *get_inherited_methods_implementation(entity *inh_meth) { static entity *get_inherited_methods_implementation(entity *inh_meth) {
entity *impl_meth = NULL; entity *impl_meth = NULL;
ir_node *addr = get_atomic_ent_value(inh_meth); ir_node *addr = get_atomic_ent_value(inh_meth);
assert(addr && "constant entity without value"); assert(addr && "constant entity without value");
if ((get_irn_op(addr) == op_SymConst) && 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); impl_meth = get_SymConst_entity(addr);
} else { } else {
assert(0 && "Complex constant values not supported -- address of method should be straight constant!"); assert(0 && "Complex constant values not supported -- address of method should be straight constant!");
} }
if (impl_meth && (get_entity_peculiarity(impl_meth) != peculiarity_existent)) { if (impl_meth && (get_entity_peculiarity(impl_meth) != peculiarity_existent)) {
/* /*
printf("this_meth: "); DDMEO(inh_meth); printf("this_meth: "); DDMEO(inh_meth);
...@@ -719,25 +722,23 @@ static void free_ana_walker(ir_node * node, eset * set) { ...@@ -719,25 +722,23 @@ static void free_ana_walker(ir_node * node, eset * set) {
* SymConst-Operationen mssen in passende Const-Operationen * SymConst-Operationen mssen in passende Const-Operationen
* umgewandelt worden sein, d.h. SymConst-Operationen verweisen immer * umgewandelt worden sein, d.h. SymConst-Operationen verweisen immer
* auf eine echt externe Methode. */ * auf eine echt externe Methode. */
static entity ** get_free_methods(int whole) static entity ** get_free_methods(void)
{ {
eset * set = eset_create(); eset * set = eset_create();
int i; int i;
entity ** arr = NEW_ARR_F(entity *, 0); entity ** arr = NEW_ARR_F(entity *, 0);
entity * ent; entity * ent;
if (! whole) { for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
for (i = get_irp_n_irgs() - 1; i >= 0; --i) { ir_graph * irg = get_irp_irg(i);
ir_graph * irg = get_irp_irg(i); entity * ent = get_irg_entity(irg);
entity * ent = get_irg_entity(irg); /* insert "external visible" methods. */
/* insert "external visible" methods. */ if (get_entity_visibility(ent) != visibility_local) {
if (get_entity_visibility(ent) != visibility_local) { eset_insert(set, ent);
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);
} }
/* 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 */ /* insert sticky methods, too */
...@@ -764,12 +765,12 @@ static entity ** get_free_methods(int whole) ...@@ -764,12 +765,12 @@ static entity ** get_free_methods(int whole)
return arr; return arr;
} }
void cgana(int *length, entity ***free_methods, int whole) { void cgana(int *length, entity ***free_methods) {
entity ** free_meths; entity ** free_meths;
int i; int i;
sel_methods_init(); sel_methods_init();
free_meths = get_free_methods(whole); free_meths = get_free_methods();
callee_ana(); callee_ana();
sel_methods_dispose(); sel_methods_dispose();
......
...@@ -55,17 +55,18 @@ ...@@ -55,17 +55,18 @@
* and Craig Chambers. * and Craig Chambers.
* *
* Performs some optimizations possible by the analysed information: * Performs some optimizations possible by the analysed information:
* - Replace SymConst nodes by Const nodes if possible, * - Replace SymConst-name nodes by SymConst-entity nodes if possible.
* - Replace (Sel-method(Alloc)) by Const method, * - Replace (Sel-method(Alloc)) by SymConst-entity.
* - Replaces Sel nodes by Bad if there is no implementation for the selected entity. (@@@ was genau meint unreachable?) * - Replaces Sel nodes by Bad if there is no implementation for the
* - Replaces Sel-method by Const if the Method is never overwritten * selected entity. (@@@ was genau meint unreachable?)
* - Replaces Calls by Tuple containing Bads if callee array is empty (there is no implementation to call) * - Replaces Sel-method by SymConst-entity if the method is never overwritten.
* * - Replaces Calls by Tuple containing Bads if callee array is empty
* (there is no implementation to call)
* *
* Leaves Bad control predecessors in the graph! * Leaves Bad control predecessors in the graph!
*/ */
/* @@@ I assume this can not be called via JNI :-( -- how to obtain the array pointer? */ /* @@@ I assume this can not be called via JNI :-( -- how to obtain the array pointer? */
void cgana(int *len, entity ***free_methods, int whole); void cgana(int *len, entity ***free_methods);
/** Free callee information. /** Free callee information.
* *
...@@ -78,4 +79,6 @@ void free_callee_info(ir_graph *irg); ...@@ -78,4 +79,6 @@ void free_callee_info(ir_graph *irg);
/* @@@ move to irgopt ?! */ /* @@@ move to irgopt ?! */
/* @@@ not fully implemented as buggy !!! */ /* @@@ not fully implemented as buggy !!! */
void opt_call_addrs(void); void opt_call_addrs(void);
#endif /* _CGANA_H_ */ #endif /* _CGANA_H_ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment