Date:2010-04-20 23:01:16 (13 years 11 months ago)
Author:werner
Commit:59335b63b0bfc2e874d64fdd661d501124b9c2bd
Message:The partial order algorithm in dump.c sometimes dumped objects before a vector they referenced. As a band-aid, we now explicitly keep track of which vectors have been dumped, and defer objects accordingly. A more correct solution would be to properly abstract the partial order algorithms (along with the heuristics for maximizing the number of ".") and to implement it properly.

- fpd.y (debug_item): new rule for %dump and %exit, which can appear also among
measurements
- fpd.y (frame_items, measurements): rearranged grammar to allow debug_item
also in measurements. To avoid ambiguities, the "measurements" section can no
longer be empty, but it can be omitted as a whole.
- obj.h, dump.c (later, recurse_vec, order_frame): vectors now also have a
"dumped" flag which is used in "later" to defer dumping an object until all
the vectors it depends on have been dumped.



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5928 99fdad57-331a-0410-800a-d7fa5415bdb3
Files: dump.c (5 diffs)
fpd.y (3 diffs)
obj.h (1 diff)

Change Details

dump.c
7575
7676static int later(const struct vec *base, const struct vec *prev)
7777{
78    return base && !base->dumped;
79#if 0
7880    while (1) {
7981        prev = prev->next;
8082        if (!prev)
...... 
8385            return 1;
8486    }
8587    return 0;
88#endif
8689}
8790
8891
...... 
134137}
135138
136139/*
137 * Tricky logic ahead: when dumping a vector, we search for a vectors that
140 * Tricky logic ahead: when dumping a vector, we search for a vector that
138141 * depends on that vector for ".". If we find one, we dump it immediately after
139142 * this vector.
140143 */
...... 
144147    struct vec *next;
145148    struct obj *obj;
146149
150    vec->dumped = 1;
147151    add_item(curr, vec, NULL);
148152    for (obj = vec->frame->objs; obj; obj = obj->next)
149153        if (may_put_obj_now(obj, vec))
...... 
178182        if (obj->type != ot_meas)
179183            n++;
180184
185    for (vec = frame->vecs; vec; vec = vec->next)
186        vec->dumped = 0;
181187    for (obj = frame->objs; obj; obj = obj->next)
182188        obj->dumped = 0;
183189
fpd.y
404404    ;
405405
406406frame_items:
407    measurements
407    | measurements
408408    | frame_item frame_items
409409    ;
410410
...... 
459459            if (!dbg_print($2))
460460                YYABORT;
461461        }
462    | TOK_DBG_DUMP
462    | debug_item
463    ;
464
465debug_item:
466    TOK_DBG_DUMP
463467        {
464468            /*
465469             * It's okay to do append the root frame multiple
...... 
718722    ;
719723
720724measurements:
725    meas
726        {
727            *next_obj = $1;
728            next_obj = &$1->next;
729        }
721730    | measurements meas
722731        {
723732            *next_obj = $2;
724733            next_obj = &$2->next;
725734        }
735    | measurements debug_item
726736    ;
727737
728738meas:
obj.h
142142    /* for re-ordering after a move */
143143    int mark;
144144
145    /* for dumping */
146    int dumped;
147
145148    /* for the GUI */
146149    GtkWidget *list_widget; /* NULL if items aren't shown */
147150};

Archive Download the corresponding diff file

Branches:
master



interactive