void oo_devirtualize_local(ir_graph *irg) { //dump_ir_graph(irg, "--before"); rta_init(); init_irtypeinfo(); set_irg_typeinfo_state(irg, ir_typeinfo_consistent); compute_inh_transitive_closure(); bool changed; do { changed = false; irg_walk_graph(irg, infer_typeinfo_walker, NULL, (void*)&changed); } while (changed); //dump_ir_graph(irg, "--typeinfo"); set_opt_dyn_meth_dispatch(1); transform_node_func oldfunc = get_op_ops(get_op_Sel())->transform_node; ((ir_op_ops*)get_op_ops(get_op_Sel()))->transform_node = transform_node_Sel2; local_optimize_graph(irg); ((ir_op_ops*)get_op_ops(get_op_Sel()))->transform_node = oldfunc; // restore free_irtypeinfo(); rta_cleanup(); //dump_ir_graph(irg, "--devirtualize-local"); }
/*************************************************************** * rta_config_dir(): - Set the default directory for all RTA * savefiles. The directory specified here is prepended to * all file names before a load of the .sql file is attempted. * * Input: char * -- the config directory or path * Output: 0 if the dir seems OK, -1 otherwise **************************************************************/ int rta_config_dir(char *configdir) { struct stat statbuf; /* to verify input is a directory */ int len; /* length of the path */ /* Initialize the RTA tables if this is the first call to add_table */ if (rta_Ntbl == -1) rta_init(); /* Perform some sanity checks */ if (!stat(configdir, &statbuf) && S_ISDIR(statbuf.st_mode)) { ConfigDir = strdup(configdir); if (ConfigDir) { len = strlen(ConfigDir); if (len != 1 && ConfigDir[len -1] == '/') { ConfigDir[len - 1] = (char) 0; } return(0); } } return(-1); }
/*************************************************************** * rta_add_table(): - Add one table to the list of * tables in the system. If the table has an associated * "savefile" we try to open the savefile and execute any SQL * commands found there. * * Input: ptbl: pointer to the table to add * Output: RTA_SUCCESS - Add successful * RTA_DUP - Table is already in the list. (Note * that this might not be an error since * we can allow redefinition of a table) * RTA_ERROR - The passed table definition has a * problem which prevents its addition. * A syslog error message describes the * problem **************************************************************/ int rta_add_table(RTA_TBLDEF *ptbl) { extern RTA_TBLDEF rta_columnsTable; int i, j; /* a loop index */ /* Initialize the RTA tables if this is the first call to add_table */ if (rta_Ntbl == -1) rta_init(); /* Error if at rta_Ntbl limit */ if (rta_Ntbl == RTA_MX_TBL) { rta_log(LOC, Er_Max_Tbls); return (RTA_ERROR); } /* verify that table name is unique */ i = 0; while (i < rta_Ntbl) { if (!strncmp(ptbl->name, rta_Tbl[i]->name, RTA_MXTBLNAME)) { rta_log(LOC, Er_Tbl_Dup, ptbl->name); return (RTA_ERROR); } i++; } /* verify length of table name */ if (strlen(ptbl->name) > RTA_MXTBLNAME) { rta_log(LOC, Er_Tname_Big, ptbl->name); return (RTA_ERROR); } /* verify table name is not a reserved word */ if (is_reserved(ptbl->name)) { rta_log(LOC, Er_Reserved, ptbl->name); return (RTA_ERROR); } /* verify savefile name is a valid pointer */ if (ptbl->savefile == (char *) 0) { rta_log(LOC, Er_Col_Type, "savefile"); return (RTA_ERROR); } /* Check the upper bound on # columns / table */ if (ptbl->ncol > RTA_NCMDCOLS) { rta_log(LOC, Er_Cmd_Cols, ptbl->name); return (RTA_ERROR); } /* verify that column names are unique within table */ for (i = 0; i < ptbl->ncol; i++) { for (j = 0; j < i; j++) { if (!strncmp(ptbl->cols[i].name, ptbl->cols[j].name, RTA_MXCOLNAME)) { rta_log(LOC, Er_Col_Dup, ptbl->name, ptbl->cols[i].name); return (RTA_ERROR); } } } /* verify column name length, help length, data type, flag contents, and that column table name is valid */ for (i = 0; i < ptbl->ncol; i++) { if (strlen(ptbl->cols[i].name) > RTA_MXCOLNAME) { rta_log(LOC, Er_Cname_Big, ptbl->cols[i].name); return (RTA_ERROR); } if (is_reserved(ptbl->cols[i].name)) { rta_log(LOC, Er_Reserved, ptbl->cols[i].name); return (RTA_ERROR); } if (strlen(ptbl->cols[i].help) > RTA_MXHELPSTR) { rta_log(LOC, Er_Hname_Big, ptbl->cols[i].name); return (RTA_ERROR); } if (ptbl->cols[i].type > RTA_MXCOLTYPE) { rta_log(LOC, Er_Col_Type, ptbl->cols[i].name); return (RTA_ERROR); } if (ptbl->cols[i].flags > RTA_DISKSAVE + RTA_READONLY) { rta_log(LOC, Er_Col_Flag, ptbl->cols[i].name); return (RTA_ERROR); } if (strcmp(ptbl->cols[i].table, ptbl->name)) { rta_log(LOC, Er_Col_Name, ptbl->cols[i].name); return (RTA_ERROR); } } /* Verify that we can add the columns */ if ((rta_Ncol + ptbl->ncol) >= RTA_MX_COL) { rta_log(LOC, Er_Max_Cols); return (RTA_ERROR); } /* Everything looks OK. Add table and columns */ rta_Tbl[rta_Ntbl++] = ptbl; rta_Tbl[0]->nrows = rta_Ntbl; /* Add columns to list of column pointers */ for (i = 0; i < ptbl->ncol; i++) { rta_Col[rta_Ncol++] = &(ptbl->cols[i]); } rta_columnsTable.nrows += ptbl->ncol; /* Execute commands in the save file to restore */ if (ptbl->savefile && strlen(ptbl->savefile) > 0) (void) rta_load(ptbl, ptbl->savefile); return (RTA_SUCCESS); }