Exemplo n.º 1
0
PPPoE::vendor_spec_type PPPoE::vendor_specific() const {
    const tag* t = search_tag(VENDOR_SPECIFIC);
    if (!t) {
        throw option_not_found();
    }
    return t->to<vendor_spec_type>();
}
Exemplo n.º 2
0
bool file_location_go(struct file_location *loc)
{
	struct window *w = window;
	struct view *v = window_open_buffer(w, loc->filename, true, NULL);
	bool ok = true;

	if (!v) {
		// failed to open file. error message should be visible
		return false;
	}
	if (w->view != v) {
		set_view(v);
		// force centering view to the cursor because file changed
		v->force_center = true;
	}
	if (loc->pattern != NULL) {
		bool err = false;
		search_tag(loc->pattern, &err);
		ok = !err;
	} else if (loc->line > 0) {
		move_to_line(v, loc->line);
		if (loc->column > 0) {
			move_to_column(v, loc->column);
		}
	}
	return ok;
}
Exemplo n.º 3
0
// for each pair of (cache_set, loop_level), get its #TAGS (conflicting memory
// blocks)
static void
get_loop_tags()
{
    int		    i, j;
    unsigned short  set, tag;
    mem_blk_t	    *mblk;
    loop_t	    *lp;
    tag_link_t	    *p;
    addr_t	    addr;

    loop_cache_tags = (tag_link_t ***) calloc(num_tcfg_loops, sizeof(tag_link_t **));
    for (i = 0; i < num_tcfg_loops; i++)
        loop_cache_tags[i] = (tag_link_t **) calloc(cache.ns, sizeof(tag_link_t *));
    num_mblk_conflicts = (int **) calloc(num_tcfg_loops, sizeof(int *));
    for (i = 0; i < num_tcfg_loops; i++)
        num_mblk_conflicts[i] = (int *) calloc(cache.ns, sizeof(int));

    for (i = 0; i < num_tcfg_nodes; i++) {
        lp = loop_map[i];
        if (lp == NULL)
            continue;
        for (j = 0; j < num_mblks[i]; j++) {
            set = gen[i][j].set;
            tag = gen[i][j].tag;
            if (search_tag(lp->id, set, tag) == NULL)
                add_tag(lp->id, set, tag);
        }
        // sequential fetch before branch redirection happens
        addr = tcfg[i]->bb->sa +  tcfg[i]->bb->size;
        for (j = 0; j < pipe_ibuf_size - 1; j++) {
            set = SET(addr);
            tag = TAG(addr);
            if (search_tag(lp->id, set, tag) == NULL)
                add_tag(lp->id, set, tag);
            addr += tcfg[i]->bb->code[0].size;
        }
    }
    //dump_loop_tags();

    // XXX: can be optimized if children info is maintained
    for (i = 0; i < num_tcfg_loops; i++) {
        lp = loops[i];
        for (j = 0; j < num_tcfg_loops; j++) {
            if (i == j)
                continue;
            if (loop_comm_ances[i][j] != lp)
                continue;
            for (set = 0; set < cache.ns; set++) {
                for (p = loop_cache_tags[j][set]; p != NULL; p = p->next) {
                    if (search_tag(lp->id, set, p->tag) == NULL)
                        add_tag(lp->id, set, p->tag);
                }
            }
        }
    }
    //dump_loop_tags();

    for (i = 0; i < num_tcfg_loops; i++) {
        for (set = 0; set < cache.ns; set++) {
            for (p = loop_cache_tags[i][set]; p != NULL; p = p->next) {
                num_mblk_conflicts[i][set]++;
            }
            //printf("conflicts: (%d, %d): %d\n", i, set, num_mblk_conflicts[i][set]);
        }
    }
}