From 9c63d082849a75a6c74173391a792fd88e51d016 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 25 Apr 2011 23:00:28 +0200 Subject: [PATCH] BugFix: fixed broken refactoring, associated link cannot be used for chains. The associated link combinaes onbe lowered awith one unlowered type, it cannot be used for chains of unlowered types. Removes the get_type_[un]lowered() API and restores the get_associated_type() API. However, the whole concept of lowered types should be replaced by type attributes ... This fixes the asserts in stabs debug output. --- ir/be/bestabs.c | 3 ++- ir/lower/lower_calls.c | 5 +++-- ir/tr/type_t.h | 17 +++++------------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/ir/be/bestabs.c b/ir/be/bestabs.c index 3a164ae68..63997b5cf 100644 --- a/ir/be/bestabs.c +++ b/ir/be/bestabs.c @@ -699,7 +699,8 @@ static void stabs_method_begin(dbg_handle *handle, const ir_entity *ent) /* create the method entry */ mtp = get_entity_type(ent); - mtp = get_type_unlowered(mtp); + if (is_lowered_type(mtp)) + mtp = get_associated_type(mtp); if (get_method_n_ress(mtp) > 0) rtp = get_method_res_type(mtp, 0); else diff --git a/ir/lower/lower_calls.c b/ir/lower/lower_calls.c index a7c896920..51ae47fb0 100644 --- a/ir/lower/lower_calls.c +++ b/ir/lower/lower_calls.c @@ -84,7 +84,7 @@ static ir_type *create_modified_mtd_type(const lower_params_t *lp, ir_type *mtp) int changed = 0; ir_variadicity var; - lowered = get_type_lowered(mtp); + lowered = get_associated_type(mtp); if (lowered != NULL) return lowered; @@ -510,7 +510,8 @@ static void add_hidden_param(ir_graph *irg, size_t n_com, ir_node **ins, cl_entr size_t i; size_t j; - ctp = get_type_unlowered(ctp); + if (is_lowered_type(ctp)) + ctp = get_associated_type(ctp); for (j = i = 0; i < get_method_n_ress(ctp); ++i) { ir_type *rtp = get_method_res_type(ctp, i); diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index 6a70e0cc3..e61a951bb 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -313,15 +313,12 @@ static inline int is_lowered_type(const ir_type *tp) return tp->flags & tf_lowered_type; } -static inline ir_type *get_type_unlowered(const ir_type *tp) -{ - assert (is_lowered_type(tp)); - return tp->assoc_type; -} - -static inline ir_type *get_type_lowered(const ir_type *tp) +/** + * Gets the lowered/unlowered type of a type or NULL if this type + * has no lowered/unlowered one. + */ +static inline ir_type *get_associated_type(const ir_type *tp) { - assert (tp->assoc_type == NULL || is_lowered_type(tp->assoc_type)); return tp->assoc_type; } @@ -329,10 +326,6 @@ static inline void set_lowered_type(ir_type *tp, ir_type *lowered_type) { assert (is_type(tp) && is_type(lowered_type)); lowered_type->flags |= tf_lowered_type; - /* there might be a chain of lowerings, get to the start */ - while (is_lowered_type(tp)) { - tp = tp->assoc_type; - } tp->assoc_type = lowered_type; lowered_type->assoc_type = tp; } -- 2.20.1