Date:2011-09-19 00:11:17 (8 years 1 day ago)
Author:Werner Almesberger
Commit:60cf6f5e9afa2db2ad98370ddcc94967d9e8362c
Message:m1/perf/sched.c: added asserts and list poisoning

Files: m1/perf/sched.c (8 diffs)

Change Details

m1/perf/sched.c
2222#include <stdlib.h>
2323#include <stdio.h>
2424#include <string.h>
25#include <assert.h>
2526
2627#include <fpvm/is.h>
2728#include <fpvm/fpvm.h>
...... 
135136 * Use the naming conventions of include/linux/list.h
136137 */
137138
139
140#ifdef DEBUG
141
142static void list_poison(struct list *list)
143{
144    list->next = list->prev = NULL;
145}
146
147#else /* DEBUG */
148
149#define list_poison(list)
150
151#endif /* !DEBUG */
152
153
138154static void list_init(struct list *list)
139155{
140156    list->next = list->prev = list;
...... 
143159
144160static void list_del(struct list *item)
145161{
162    assert(item->next != item);
146163    item->prev->next = item->next;
147164    item->next->prev = item->prev;
165    list_poison(item);
148166}
149167
150168
...... 
186204        b->prev->next = a;
187205        a->prev = b->prev;
188206    }
189    list_init(b);
207    list_poison(b);
190208}
191209
192210
...... 
249267        return;
250268
251269    vm_idx = reg2idx(vm_reg);
270    assert(sc->regs[vm_idx].refs);
252271    if (--sc->regs[vm_idx].refs)
253272        return;
254273
255274    Dprintf(" free reg %d\n", regs[vm_idx].pfpu_reg);
256275
257276#ifdef REG_STATS
277    assert(sc->curr_regs);
258278    sc->curr_regs--;
259279#endif
260280
...... 
335355        Dprintf("insn %lu: reg %d setter %lu unresolved %d\n",
336356            insn-sc->insns, reg_num, reg->setter-sc->insns,
337357            insn->unresolved);
338    } else {
339        list_init(&ref->more);
340358    }
341359    return reg;
342360}
...... 
428446    foreach (ref, &insn->dependants) {
429447        if (ref->insn->earliest <= end)
430448            ref->insn->earliest = end+1;
449        assert(ref->insn->unresolved);
431450        if (!--ref->insn->unresolved) {
432451            Dprintf(" unlocked %lu -> %u\n", ref->insn-insns,
433452                ref->insn->earliest);
...... 
509528        end = PFPU_PROGSIZE;
510529    while (i != end) {
511530        if (FIELD(code[i]).dest)
512            last = i+1; /* @@@ ? */
531            last = i+1;
513532        i++;
514533    }
515534    return last;

Archive Download the corresponding diff file

Branches:
master



interactive