diff --git a/MultiSource/Benchmarks/Olden/bh/args.c b/MultiSource/Benchmarks/Olden/bh/args.c index 171cc7178..4ea937a91 100644 --- a/MultiSource/Benchmarks/Olden/bh/args.c +++ b/MultiSource/Benchmarks/Olden/bh/args.c @@ -1,12 +1,10 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ #include -#pragma CHECKED_SCOPE ON - extern int NumNodes; extern int nbody; -int dealwithargs(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)) { +int dealwithargs(int argc, char *argv[]) { int level; if (argc > 2) diff --git a/MultiSource/Benchmarks/Olden/bh/code.h b/MultiSource/Benchmarks/Olden/bh/code.h index 91070d71d..e81e9c92a 100644 --- a/MultiSource/Benchmarks/Olden/bh/code.h +++ b/MultiSource/Benchmarks/Olden/bh/code.h @@ -6,7 +6,6 @@ * It's free because it's yours. */ -#pragma CHECKED_SCOPE ON /* Former global variables. convert to #defines */ @@ -21,7 +20,7 @@ extern int nbody; -#pragma CHECKED_SCOPE OFF + diff --git a/MultiSource/Benchmarks/Olden/bh/defs.h b/MultiSource/Benchmarks/Olden/bh/defs.h index 09405dced..396ac79e2 100644 --- a/MultiSource/Benchmarks/Olden/bh/defs.h +++ b/MultiSource/Benchmarks/Olden/bh/defs.h @@ -7,7 +7,7 @@ */ #ifdef TORONTO -#include +#include #define chatting printf #define PLAIN #define LOCAL(xxx) xxx @@ -26,12 +26,9 @@ int NumNodes; #define THREEDIM #include "vectmath.h" -#pragma CHECKED_SCOPE ON - #define MAX_NUM_NODES 64 -extern double fabs(double); +extern double fabs(); -#define printf(...) _Unchecked { printf(__VA_ARGS__); } /* * BODY and CELL data structures are used to represent the tree: @@ -65,10 +62,9 @@ typedef struct node{ int proc; /* parent's processor number */ int new_proc; /* processor where this node will reside */ #ifdef JUMP - _Ptr next_few_node; + struct node * next_few_node; #endif -} node; -typedef _Ptr nodeptr; +} node, *nodeptr; /*** #define Type(x) (((nodeptr) (x))->type) @@ -89,7 +85,7 @@ typedef _Ptr nodeptr; #define BODY 01 /* type code for bodies */ -typedef _Ptr bodyptr; +typedef struct bnode *bodyptr; typedef struct bnode { short type; @@ -98,7 +94,7 @@ typedef struct bnode { int proc; /* parent's processor number */ int new_proc; #ifdef JUMP - _Ptr next_few_node; + struct node * next_few_node; #endif vector vel; /* velocity of body */ vector acc; /* acceleration of body */ @@ -131,7 +127,7 @@ typedef struct bnode { #define NSUB (1 << NDIM) /* subcells per cell */ -typedef _Ptr cellptr; +typedef struct cnode *cellptr; typedef struct cnode { short type; @@ -140,9 +136,9 @@ typedef struct cnode { int proc; int new_proc; #ifdef JUMP - _Ptr next_few_node; + struct node * next_few_node; #endif - nodeptr subp _Checked[NSUB]; /* descendents of cell */ + nodeptr subp[NSUB]; /* descendents of cell */ cellptr next; /* for free list */ } cell; @@ -156,13 +152,12 @@ typedef struct cnode { #define FL_Next(x) ((x)->next) typedef struct { - real rmin _Checked[3]; + real rmin[3]; real rsize; nodeptr root; - bodyptr bodytab _Checked[MAX_NUM_NODES]; - bodyptr bodiesperproc _Checked[MAX_NUM_NODES]; -} tree; -typedef _Ptr treeptr; + bodyptr bodytab[MAX_NUM_NODES]; + bodyptr bodiesperproc[MAX_NUM_NODES]; +} tree, *treeptr; #define Root(t) ((t)->root) #define Rmin(t) ((t)->rmin) @@ -173,24 +168,23 @@ typedef _Ptr treeptr; -struct { +typedef struct { real tnow; real tout; int nsteps; -} timerecord; -typedef _Ptr timeptr; +} timerecord, *timeptr; #define Tnow(t) ((t)->tnow) #define Tout(t) ((t)->tout) #define Nsteps(t) ((t)->nsteps) typedef struct { - int xp _Checked[NDIM]; + int xp[NDIM]; bool inb; } icstruct; typedef struct { - double v _Checked[NDIM]; + double v[NDIM]; } vecstruct; @@ -228,10 +222,10 @@ global real xxxrsize; /* side-length of integer coordinate box */ typedef struct { real mtot; /* total mass of N-body system */ - real etot _Checked[3]; /* binding, kinetic, potential energy */ + real etot[3]; /* binding, kinetic, potential energy */ matrix keten; /* kinetic energy tensor */ matrix peten; /* potential energy tensor */ - vector cmphase _Checked[2]; /* center of mass coordinates */ + vector cmphase[2]; /* center of mass coordinates */ vector amvec; /* angular momentum vector */ } ostruct; @@ -250,5 +244,5 @@ extern int nbody; -#pragma CHECKED_SCOPE OFF + diff --git a/MultiSource/Benchmarks/Olden/bh/newbh.c b/MultiSource/Benchmarks/Olden/bh/newbh.c index 045c5e481..d55a1909a 100644 --- a/MultiSource/Benchmarks/Olden/bh/newbh.c +++ b/MultiSource/Benchmarks/Olden/bh/newbh.c @@ -12,11 +12,11 @@ #include "defs.h" #include "code.h" -#pragma CHECKED_SCOPE ON int nbody; -double sqrt(double), xrand(double, double, double), my_rand(double); +double sqrt(), xrand(), my_rand(); +real pow(); extern icstruct intcoord(bodyptr p, treeptr t); extern int BhDebug; @@ -35,10 +35,10 @@ typedef struct { } datapoints; -bodyptr testdata(void); +bodyptr testdata(); datapoints uniform_testdata(int proc, int nbody, int seedfactor); void stepsystem(treeptr t, int nstep); -treeptr old_main(void); +treeptr old_main(); void my_free(nodeptr n); bodyptr ubody_alloc(int p); bodyptr movebodies(bodyptr list, int proc); @@ -46,14 +46,14 @@ void freetree(nodeptr n); void freetree1(nodeptr n); int old_subindex(icstruct ic, int l); -int dealwithargs(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)); -int error(char *msg : itype(_Nt_array_ptr)); +int dealwithargs(); +int error(); int arg1; /* Used to setup runtime system, get arguments-- see old_main */ -int main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)) { - treeptr t = NULL; +int main(int argc, char **argv) { + treeptr t; /* Initialize the runtime system */ dealwithargs(argc, argv); @@ -66,23 +66,23 @@ int main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)) { /* global! */ /* Main routine from original program */ -treeptr old_main(void) { +treeptr old_main() { real tnow; real tout; int i, nsteps, nprocs; - treeptr t = NULL; - bodyptr bt0 = NULL, p = NULL; + treeptr t; + bodyptr bt0,p; long t1, t2; vector cmr, cmv; bodyptr prev=NULL; int tmp=0, range=((1<(sizeof(tree)); + t = (treeptr)malloc(sizeof(tree)); Root(t) = NULL; t->rmin[0] = -2.0; t->rmin[1] = -2.0; @@ -95,7 +95,7 @@ treeptr old_main(void) { /* Creates a list of bodies */ for (i=0; i < 32; i++) { - datapoints points = { 0.0 }; + datapoints points; int processor= i/(32/NumNodes); points=uniform_testdata(processor, nbody/32, i+1); @@ -191,11 +191,11 @@ treeptr old_main(void) { #define MFRAC 0.999 /* mass cut off at MFRAC of total */ /* don't use this unless it is fixed on random numbers, &c */ -bodyptr testdata(void) +bodyptr testdata() { real rsc, vsc, r, v, x, y; vector cmr, cmv; - bodyptr head = NULL, p = NULL, prev = NULL; + bodyptr head, p, prev; register int i; double temp, t1; double seed = 123.0; @@ -282,9 +282,9 @@ bodyptr testdata(void) extern int EventCount; void stepsystem(treeptr t, int nstep) { - bodyptr bt = NULL, bt0 = NULL, q = NULL; + bodyptr bt, bt0, q; int i; - nodeptr root = NULL; + nodeptr root; int barge,cflctdiff,misstemp,diff; /*unsigned long t5, t1, t2, t3, t4; */ @@ -320,7 +320,7 @@ void freetree1(nodeptr n) void freetree(nodeptr n) { - register nodeptr r = NULL; + register nodeptr r; register int i; /*NOTEST();*/ @@ -329,7 +329,7 @@ void freetree(nodeptr n) /* Type(n) == CELL */ for (i=NSUB-1; i >= 0; i--) { - _Unchecked { r = Subp(_Assume_bounds_cast(n))[i]; } + r = Subp((cellptr) n)[i]; if (r != NULL) { freetree(r); } @@ -339,7 +339,8 @@ void freetree(nodeptr n) RETEST(); } -cellptr cp_free_list = NULL; + +nodeptr cp_free_list = NULL; bodyptr bp_free_list = NULL; @@ -347,24 +348,20 @@ bodyptr bp_free_list = NULL; void my_free(nodeptr n) { if (Type(n) == BODY) { - bodyptr p = 0; - _Unchecked { p = _Assume_bounds_cast(n); } - Next(p) = bp_free_list; - bp_free_list = p; + Next((bodyptr) n) = bp_free_list; + bp_free_list = (bodyptr) n; } else /* CELL */ { - cellptr p = 0; - _Unchecked { p = _Assume_bounds_cast(n); } - FL_Next(p) = cp_free_list; - cp_free_list = p; + FL_Next((cellptr) n) = (cellptr) cp_free_list; + cp_free_list = n; } } bodyptr ubody_alloc(int p) -{ register bodyptr tmp = NULL; +{ register bodyptr tmp; - tmp = malloc(sizeof(body)); + tmp = (bodyptr)malloc(sizeof(body)); Type(tmp) = BODY; Proc(tmp) = p; @@ -376,16 +373,16 @@ bodyptr ubody_alloc(int p) cellptr cell_alloc(int p) -{ register cellptr tmp = NULL; +{ register cellptr tmp; register int i; if (cp_free_list != NULL) { - tmp = cp_free_list; - cp_free_list = FL_Next(cp_free_list); + tmp = (cellptr) cp_free_list; + cp_free_list = (nodeptr) FL_Next((cellptr) cp_free_list); } else { - tmp = malloc(sizeof(cell)); + tmp = (cellptr)malloc(sizeof(cell)); } Type(tmp) = CELL; Proc(tmp) = p; @@ -401,9 +398,9 @@ cellptr cell_alloc(int p) datapoints uniform_testdata(int proc, int nbodyx, int seedfactor) { - datapoints retval = { 0.0 }; + datapoints retval; real rsc, vsc, r, v, x, y; - bodyptr head = NULL, p = NULL, prev = NULL; + bodyptr head, p, prev; register int i; double temp, t1; double seed = 123.0 * (double) seedfactor; @@ -510,8 +507,8 @@ void computegrav(treeptr t, int nstep) { register int i; real rsize; real dthf; - nodeptr root = NULL; - bodyptr blist = NULL; + nodeptr root; + bodyptr blist; /* loop over particles */ rsize = Rsize(t); @@ -528,7 +525,7 @@ void computegrav(treeptr t, int nstep) void grav(real rsize, nodeptr rt, bodyptr bodies, int nstep, real dthf) { - register bodyptr p = NULL, q = NULL; + register bodyptr p, q; int i=0; @@ -652,7 +649,7 @@ void gravstep(real rsize, nodeptr rt, bodyptr p, int nstep, real dthf) void hackgrav(bodyptr p, real rsize, nodeptr rt) { - hgstruct hg = {0}; + hgstruct hg; real szsq; NOTEST(); @@ -731,7 +728,7 @@ hgstruct gravsub(nodeptr p, hgstruct hg) bool subdivp(nodeptr p, real dsq, real tolsq, hgstruct hg) { - register nodeptr local_p = NULL; + register nodeptr local_p; vector dr; vector pos; real drsq; @@ -753,7 +750,7 @@ hgstruct gravsub(nodeptr p, hgstruct hg) * It's free because it's yours. */ -double ceil(double); +double ceil(); bodyptr body_alloc(int p, real p0, real p1, real p2, real v0, real v1, real v2, real a0, real a1, real a2, real mass, bodyptr ob); bodyptr ubody_alloc(int p); @@ -789,9 +786,9 @@ void dis_number (nodeptr n); nodeptr maketree(bodyptr btab, int nb, treeptr t, int nsteps, int proc) { - register bodyptr q = NULL; + register bodyptr q; int tmp; - nodeptr node1 = NULL; + nodeptr node1; icstruct xqic; int holder; @@ -839,8 +836,8 @@ void expandbox(bodyptr p, treeptr t, int nsteps, int proc) icstruct ic; int k; vector rmid; - cellptr newt = NULL; - tree tmp = { 0.0 }; + cellptr newt; + tree tmp; real rsize; int inbox; @@ -901,8 +898,8 @@ void expandbox(bodyptr p, treeptr t, int nsteps, int proc) nodeptr loadtree(bodyptr p, icstruct xpic, nodeptr t, int l, treeptr tr) { int si; - cellptr c = NULL; - nodeptr rt = NULL; + cellptr c; + nodeptr rt; if (t == NULL) { @@ -918,15 +915,15 @@ nodeptr loadtree(bodyptr p, icstruct xpic, nodeptr t, int l, treeptr tr) /*printtree(t); printtree(p);*/ i = PID(t); c = (cellptr) cell_alloc(i); - _Unchecked { si = subindex(_Assume_bounds_cast(t), tr, l); } + si = subindex((bodyptr) t, tr, l); Subp(c)[si] = (nodeptr) t; /* put body in cell */ t = (nodeptr) c; /* link cell in tree */ } si = old_subindex(xpic, l); /* move down one level */ - _Unchecked { rt = Subp(_Assume_bounds_cast(t))[si]; } - _Unchecked { Subp(_Assume_bounds_cast(t))[si] = loadtree(p, xpic, rt, l >> 1, tr); } + rt = Subp((cellptr) t)[si]; + Subp((cellptr) t)[si] = loadtree(p, xpic, rt, l >> 1, tr); } return (t); } @@ -939,7 +936,7 @@ nodeptr loadtree(bodyptr p, icstruct xpic, nodeptr t, int l, treeptr tr) /* called from expandbox */ icstruct intcoord1(double rp0, double rp1, double rp2, treeptr t) { - double xsc, floor(double); + double xsc, floor(); /*double rmin,rsize;*/ icstruct ic; @@ -988,7 +985,7 @@ icstruct intcoord1(double rp0, double rp1, double rp2, treeptr t) icstruct intcoord(bodyptr p, treeptr t) { register double xsc; - double floor(double); + double floor(); icstruct ic; register real rsize; vector pos; @@ -1037,7 +1034,7 @@ icstruct intcoord(bodyptr p, treeptr t) int ic_test(bodyptr p, treeptr t) { - double xsc, rsize, floor(double); + double xsc, rsize, floor(); int result; vector pos; @@ -1086,8 +1083,8 @@ int subindex(bodyptr p, treeptr t , int l) { register int i, k; register real rsize; - double xsc, floor(double); - int xp _Checked[NDIM]; + double xsc, floor(); + int xp[NDIM]; vector pos; pos[0] = Pos(p)[0]; @@ -1138,7 +1135,7 @@ int old_subindex(icstruct ic, int l) real hackcofm(nodeptr q) { register int i; - register nodeptr r = NULL; + register nodeptr r; vector tmpv; vector tmp_pos; register real mq, mr; @@ -1148,7 +1145,7 @@ real hackcofm(nodeptr q) mq = 0.0; CLRV(tmp_pos); /* and c. of m. */ for (i=0; i < NSUB; i++) { - _Unchecked { r = Subp(_Assume_bounds_cast(q))[i]; } + r = Subp((cellptr) q)[i]; if (r != NULL) { mr = hackcofm(r); mq = mr + mq; @@ -1186,7 +1183,7 @@ void printtree(nodeptr n) void ptree(nodeptr n, int level) { - nodeptr r = NULL; + nodeptr r; if (n != NULL) { @@ -1198,7 +1195,7 @@ void ptree(nodeptr n, int level) chatting("%2d CELL@%x %f, %f, %f\n", level, n,Pos(n)[0], Pos(n)[1], Pos(n)[2]); for (i = 0; i < NSUB; i++) { - _Unchecked { r = Subp(_Assume_bounds_cast(n))[i]; } + r = Subp((cellptr) n)[i]; ptree(r, level+1); } } @@ -1213,7 +1210,7 @@ typedef struct { int bits; int split; cellptr new; - nodeptr non_local _Checked[NSUB]; + nodeptr non_local[NSUB]; } dt3_struct; @@ -1237,11 +1234,11 @@ int dis2_number(nodeptr n, int prev_bodies, int tnperproc) else { /* cell */ register int i; - register nodeptr r = NULL; + register nodeptr r; /*NOTEST();*/ for (i=0; i < NSUB; i++) { - _Unchecked { r = Subp(_Assume_bounds_cast(n))[i]; } + r = Subp((cellptr) n)[i]; prev_bodies = dis2_number(r, prev_bodies, tnperproc); } diff --git a/MultiSource/Benchmarks/Olden/bh/stdinc.h b/MultiSource/Benchmarks/Olden/bh/stdinc.h index 49943f4eb..8788da865 100644 --- a/MultiSource/Benchmarks/Olden/bh/stdinc.h +++ b/MultiSource/Benchmarks/Olden/bh/stdinc.h @@ -12,22 +12,20 @@ #ifndef FILE #ifdef TORONTO -#include +#include #else # include "stdio.h" #endif #endif -#include -#include - -#pragma CHECKED_SCOPE ON +#include +#include /* * STREAM: a replacement for FILE *. */ -typedef _Ptr stream; +typedef FILE *stream; /* * NULL: denotes a pointer to no object. @@ -57,7 +55,7 @@ typedef unsigned char byte; * STRING: for null-terminated strings which are not taken apart. */ -typedef _Nt_array_ptr string; +typedef char *string; /* * REAL: default type is double; if single precision calculation is @@ -65,11 +63,9 @@ typedef _Nt_array_ptr string; */ #ifndef SINGLEPREC - typedef double real; - typedef _Ptr realptr; + typedef double real, *realptr; #else - typedef float real; - typedef _Ptr realptr; + typedef float real, *realptr; #endif /* @@ -87,9 +83,9 @@ typedef _Nt_array_ptr string; * real-valued functions, respectively. */ -typedef _Ptr proc; -typedef _Ptr iproc; -typedef _Ptr rproc; +typedef void (*proc)(); +typedef int (*iproc)(); +typedef real (*rproc)(); /* * PRIVATE: declare something to be local to a file. @@ -124,5 +120,3 @@ typedef _Ptr rproc; #define ABS(x) (((x) < 0) ? -(x) : (x)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) #define MIN(x,y) (((x) < (y)) ? (x) : (y)) - -#pragma CHECKED_SCOPE OFF diff --git a/MultiSource/Benchmarks/Olden/bh/util.c b/MultiSource/Benchmarks/Olden/bh/util.c index df628250e..802e1f6ad 100644 --- a/MultiSource/Benchmarks/Olden/bh/util.c +++ b/MultiSource/Benchmarks/Olden/bh/util.c @@ -9,8 +9,6 @@ #include "stdinc.h" #include -#pragma CHECKED_SCOPE ON - #define A 16807.0 #define M 2147483647.0 @@ -22,7 +20,7 @@ void exit(int); double my_rand(double seed) { double t = A*seed + 1; - double floor(double); + double floor(); seed = t - (M * floor(t / M)); @@ -48,7 +46,7 @@ double xrand(double xl, double xh, double r) * ERROR: scream and die quickly. */ -error(char *msg : itype(_Nt_array_ptr)) _Unchecked +error(char *msg) { fprintf(stderr, msg); if (errno != 0) diff --git a/MultiSource/Benchmarks/Olden/bh/vectmath.h b/MultiSource/Benchmarks/Olden/bh/vectmath.h index f14c16819..f70ed5ef8 100644 --- a/MultiSource/Benchmarks/Olden/bh/vectmath.h +++ b/MultiSource/Benchmarks/Olden/bh/vectmath.h @@ -6,8 +6,6 @@ * It's free because it's yours. */ -#pragma CHECKED_SCOPE ON - #ifndef THREEDIM # ifndef TWODIM # ifndef NDIM @@ -24,7 +22,7 @@ # define NDIM 3 #endif -typedef real vector _Checked[NDIM], matrix _Checked[NDIM][NDIM]; +typedef real vector[NDIM], matrix[NDIM][NDIM]; #ifdef TORONTO extern double sqrt(double x); #endif @@ -294,7 +292,7 @@ extern double sqrt(double x); -#pragma CHECKED_SCOPE OFF + diff --git a/MultiSource/Benchmarks/Olden/bh/walksub.c b/MultiSource/Benchmarks/Olden/bh/walksub.c index e66545372..34fd06f61 100644 --- a/MultiSource/Benchmarks/Olden/bh/walksub.c +++ b/MultiSource/Benchmarks/Olden/bh/walksub.c @@ -1,15 +1,12 @@ #define global #include "defs.h" -#pragma CHECKED_SCOPE ON - typedef struct { bodyptr pskip; /* body to skip in force evaluation */ vector pos0; /* point at which to evaluate field */ real phi0; /* computed potential at pos0 */ vector acc0; /* computed acceleration at pos0 */ -} hgstruct; -typedef _Ptr hgsptr; +} hgstruct, *hgsptr; /* * WALKSUB: recursive routine to do hackwalk operation. @@ -23,13 +20,13 @@ hgstruct gravsub(nodeptr p, hgstruct hg); hgstruct walksub(nodeptr p, real dsq, real tolsq, hgstruct hg, int level) { register int k, i; - register nodeptr r = NULL; - nodeptr tmp _Checked[NSUB] = {0}; + register nodeptr r; + nodeptr tmp[NSUB]; if (subdivp(p, dsq, tolsq, hg)) { /* should p be opened? */ for (k = 0; k < NSUB; k++) { /* loop over the subcells */ - _Unchecked { r = Subp(_Assume_bounds_cast(p))[k];} /* <-- 6.7% load penalty */ + r = Subp((cellptr) p)[k]; /* <-- 6.7% load penalty */ if (r != NULL) /* does this one exist? */ hg = walksub(r, dsq / 4.0, tolsq, hg, level+1); } diff --git a/MultiSource/Benchmarks/Olden/bisort/args.c b/MultiSource/Benchmarks/Olden/bisort/args.c index 946ec28dc..53132b6de 100644 --- a/MultiSource/Benchmarks/Olden/bisort/args.c +++ b/MultiSource/Benchmarks/Olden/bisort/args.c @@ -1,9 +1,6 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include #include -#pragma CHECKED_SCOPE ON - extern int NumNodes,NDim; extern int flag; @@ -14,7 +11,7 @@ int mylog(int num) { return j; } -int dealwithargs(int argc, array_ptr> argv : count(argc)) +int dealwithargs(int argc, char *argv[]) { int size; diff --git a/MultiSource/Benchmarks/Olden/bisort/bitonic.c b/MultiSource/Benchmarks/Olden/bisort/bitonic.c index 906c0c832..a2cbc15b3 100644 --- a/MultiSource/Benchmarks/Olden/bisort/bitonic.c +++ b/MultiSource/Benchmarks/Olden/bisort/bitonic.c @@ -6,10 +6,6 @@ #include "proc.h" /* Procedure Types/Nums */ #include -#pragma CHECKED_SCOPE ON - -#define printf(...) _Unchecked { printf(__VA_ARGS__); } - #define CONST_m1 10000 #define CONST_b 31415821 #define RANGE 100 @@ -17,13 +13,12 @@ int NumNodes, NDim; int random(int); -void *calloc(size_t nmemb, size_t size) : byte_count(nmemb * size); int flag=0,foo=0; #define LocalNewNode(h,v) \ { \ - h = (ptr) calloc(1,sizeof(struct node)); \ + h = (HANDLE *) malloc(sizeof(struct node)); \ h->value = v; \ h->left = NIL; \ h->right = NIL; \ @@ -31,8 +26,8 @@ int flag=0,foo=0; #define NewNode(h,v,procid) LocalNewNode(h,v) -void InOrder(ptr h) { - ptr l = NIL, r = NIL; +void InOrder(HANDLE *h) { + HANDLE *l, *r; if ((h != NIL)) { l = h->left; r = h->right; @@ -62,10 +57,10 @@ int random(int seed) { return mult(seed,CONST_b)+1; } -ptr RandTree(int n, int seed, int node, int level) { +HANDLE* RandTree(int n, int seed, int node, int level) { int next_val,my_name; - future_cell_int f_left = { 0 }, f_right = {0}; - ptr h = NIL; + future_cell_int f_left, f_right; + HANDLE *h; my_name=foo++; if (n > 1) { int newnode; @@ -87,9 +82,7 @@ ptr RandTree(int n, int seed, int node, int level) { return h; } -// CHECKED-C: The only two conversions that checked-c-convert could -// perform automatically were these two. -void SwapValue(ptr l, ptr r) { +void SwapValue(HANDLE *l, HANDLE *r) { int temp,temp2; temp = l->value; @@ -100,8 +93,13 @@ void SwapValue(ptr l, ptr r) { void /***********/ -SwapValLeft(ptr l, ptr r, ptr ll, ptr rl, int lval, int rval) +SwapValLeft(l,r,ll,rl,lval,rval) /***********/ +HANDLE *l; +HANDLE *r; +HANDLE *ll; +HANDLE *rl; +int lval, rval; { r->value = lval; r->left = ll; @@ -112,8 +110,13 @@ SwapValLeft(ptr l, ptr r, ptr ll, ptr rl, int lv void /************/ -SwapValRight(ptr l, ptr r, ptr lr, ptr rr, int lval, int rval) +SwapValRight(l,r,lr,rr,lval,rval) /************/ +HANDLE *l; +HANDLE *r; +HANDLE *lr; +HANDLE *rr; +int lval, rval; { r->value = lval; r->right = lr; @@ -124,15 +127,17 @@ SwapValRight(ptr l, ptr r, ptr lr, ptr rr, int l int /********************/ -Bimerge(ptr root, int spr_val, int dir) +Bimerge(root,spr_val,dir) /********************/ +HANDLE *root; +int spr_val,dir; { int rightexchange; int elementexchange; - ptr pl = NIL, pll = NIL, plr = NIL; - ptr pr = NIL, prl = NIL, prr = NIL; - ptr rl = NIL; - ptr rr = NIL; + HANDLE *pl,*pll,*plr; + HANDLE *pr,*prl,*prr; + HANDLE *rl; + HANDLE *rr; int rv,lv; @@ -197,11 +202,13 @@ Bimerge(ptr root, int spr_val, int dir) int /*******************/ -Bisort(ptr root, int spr_val, int dir) +Bisort(root,spr_val,dir) /*******************/ +HANDLE *root; +int spr_val,dir; -{ ptr l = NIL; - ptr r = NIL; +{ HANDLE *l; + HANDLE *r; int val; /*printf("bisort %x\n", root);*/ if ((root->left == NIL)) /* <---- 8.7% load penalty */ @@ -229,8 +236,8 @@ Bisort(ptr root, int spr_val, int dir) return spr_val; } -int main(int argc, array_ptr> argv : count(argc)) { - ptr h = NIL; +int main(int argc, char **argv) { + HANDLE *h; int sval; int n; diff --git a/MultiSource/Benchmarks/Olden/bisort/node.h b/MultiSource/Benchmarks/Olden/bisort/node.h index 852b3e63e..6c8cb3a7c 100644 --- a/MultiSource/Benchmarks/Olden/bisort/node.h +++ b/MultiSource/Benchmarks/Olden/bisort/node.h @@ -2,22 +2,18 @@ /* =============== NODE STRUCTURE =================== */ -#include - -#pragma CHECKED_SCOPE ON - struct node { int value; - ptr left; - ptr right; + struct node *left; + struct node *right; }; typedef struct node HANDLE; typedef struct future_cell_int{ - ptr value; + HANDLE *value; } future_cell_int; -#define NIL ((ptr) 0) +extern void *malloc(unsigned); -#pragma CHECKED_SCOPE OFF +#define NIL ((HANDLE *) 0) diff --git a/MultiSource/Benchmarks/Olden/bisort/proc.h b/MultiSource/Benchmarks/Olden/bisort/proc.h index 0f372f5aa..1fd192b76 100644 --- a/MultiSource/Benchmarks/Olden/bisort/proc.h +++ b/MultiSource/Benchmarks/Olden/bisort/proc.h @@ -2,17 +2,12 @@ /* ========== PROCEDURE TYPES/NUMS ================== */ -#include -#pragma CHECKED_SCOPE ON +HANDLE *RandTree(); -ptr RandTree(int, int, int, int); - -void SwapValue(ptr, ptr); -void SwapValLeft(ptr, ptr, ptr, ptr, int, int); -void SwapValRight(ptr, ptr, ptr, ptr, int, int); -int Bimerge(ptr, int, int); -int Bisort(ptr, int, int); -int dealwithargs(int argc, array_ptr> argv : count(argc)); - -#pragma CHECKED_SCOPE OFF +void SwapValue(); +void SwapValLeft(); +void SwapValRight(); +int Bimerge(); +int Bisort(); +int dealwithargs(int argc, char *argv[]); diff --git a/MultiSource/Benchmarks/Olden/em3d/args.c b/MultiSource/Benchmarks/Olden/em3d/args.c index b70a9d719..b2ab03431 100644 --- a/MultiSource/Benchmarks/Olden/em3d/args.c +++ b/MultiSource/Benchmarks/Olden/em3d/args.c @@ -1,15 +1,12 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ #include "em3d.h" -#include #ifndef TORONTO #include #include #endif -#pragma CHECKED_SCOPE ON - #ifdef TORONTO int NumNodes; #else @@ -21,7 +18,7 @@ extern int __NumNodes; extern int DebugFlag; #ifndef TORONTO -unchecked void filestuff() +void filestuff() { CMMD_fset_io_mode(stdout, CMMD_independent); fcntl(fileno(stdout), F_SETFL, O_APPEND); @@ -30,7 +27,7 @@ unchecked void filestuff() } #endif -void dealwithargs(int argc, array_ptr> argv : count(argc)) +void dealwithargs(int argc, char *argv[]) { #ifdef TORONTO if (argc > 4) diff --git a/MultiSource/Benchmarks/Olden/em3d/em3d.c b/MultiSource/Benchmarks/Olden/em3d/em3d.c index 43eba9066..f95563002 100644 --- a/MultiSource/Benchmarks/Olden/em3d/em3d.c +++ b/MultiSource/Benchmarks/Olden/em3d/em3d.c @@ -1,17 +1,17 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ #include "em3d.h" -#pragma CHECKED_SCOPE ON int nonlocals=0; -void compute_nodes(register ptr nodelist) +void compute_nodes(nodelist) +register node_t *nodelist; { register int i; - register ptr localnode = NULL; + register node_t *localnode; for (; nodelist; ) { register double cur_value; register int from_count ; - register _Ptr other_value = NULL; + register double *other_value; register double coeff; register double value; /*register double *coeffs;*/ diff --git a/MultiSource/Benchmarks/Olden/em3d/em3d.h b/MultiSource/Benchmarks/Olden/em3d/em3d.h index c1021c0e7..af451f9ea 100644 --- a/MultiSource/Benchmarks/Olden/em3d/em3d.h +++ b/MultiSource/Benchmarks/Olden/em3d/em3d.h @@ -10,58 +10,48 @@ #ifndef EM3D #define EM3D -#include - -void dealwithargs(int argc, array_ptr> argv : count(argc)); +void dealwithargs(int argc, char *argv[]); void printstats(void); void srand48(long); long lrand48(void); -#include -#include +#include +#include -#pragma CHECKED_SCOPE ON -#define chatting(...) unchecked { printf(__VA_ARGS__); } +#define chatting printf -// extern char * min_ptr; -// extern char * max_ptr; +extern char * min_ptr; +extern char * max_ptr; extern int n_nodes; /* number of nodes (E and H) */ extern int d_nodes; /* degree of nodes */ extern int local_p; /* percentage of local edges */ #define PROCS 1 -#define assert(a) if (!a) { puts("Assertion failure"); exit(-1); } +#define assert(a) if (!a) {printf("Assertion failure\n"); exit(-1);} typedef struct node_t { - ptr value; - ptr next; - array_ptr> to_nodes : count(degree); /* array of nodes pointed to */ - array_ptr> from_values : count(from_count); /* array of ptrs to vals where data comes from */ - array_ptr coeffs : count(from_count); /* array of coeffs on edges */ + double *value; + struct node_t *next; + struct node_t **to_nodes; /* array of nodes pointed to */ + double **from_values; /* array of ptrs to vals where data comes from */ + double *coeffs; /* array of coeffs on edges */ int from_count; int from_length; - int degree; } node_t; typedef struct graph_t { - ptr e_nodes checked[PROCS]; - ptr h_nodes checked[PROCS]; + node_t *e_nodes[PROCS]; + node_t *h_nodes[PROCS]; } graph_t; -typedef struct table_arr_t { - array_ptr> table : count(size); - int size; -} table_arr_t; - typedef struct table_t { - table_arr_t e_table checked[PROCS]; - table_arr_t h_table checked[PROCS]; + node_t **e_table[PROCS]; + node_t **h_table[PROCS]; } table_t; /* Perform 1 step for a nodelist */ -void compute_nodes(ptr nodelist); +void compute_nodes(node_t *nodelist); double gen_uniform_double(void); -#pragma CHECKED_SCOPE OFF #endif diff --git a/MultiSource/Benchmarks/Olden/em3d/main.c b/MultiSource/Benchmarks/Olden/em3d/main.c index feb77c86c..bb8d2be89 100644 --- a/MultiSource/Benchmarks/Olden/em3d/main.c +++ b/MultiSource/Benchmarks/Olden/em3d/main.c @@ -2,16 +2,15 @@ #include "em3d.h" #include "make_graph.h" -#include -#pragma CHECKED_SCOPE ON extern int NumNodes; int DebugFlag; -void print_graph(ptr graph, int id) +void print_graph(graph_t *graph, int id) { - ptr cur_node = graph->e_nodes[id]; + node_t *cur_node; + cur_node=graph->e_nodes[id]; for(; cur_node; cur_node=cur_node->next) { @@ -28,10 +27,10 @@ void print_graph(ptr graph, int id) extern int nonlocals; -int main(int argc, array_ptr> argv : count(argc)) +int main(int argc, char *argv[]) { int i; - ptr graph = NULL; + graph_t *graph; dealwithargs(argc,argv); @@ -42,8 +41,10 @@ int main(int argc, array_ptr> argv : count(argc)) for(i=0; ie_nodes[0]); compute_nodes(graph->h_nodes[0]); + chatting("nonlocals = %d\n",nonlocals); printstats(); diff --git a/MultiSource/Benchmarks/Olden/em3d/make_graph.c b/MultiSource/Benchmarks/Olden/em3d/make_graph.c index c10bb5556..430e0ad0e 100644 --- a/MultiSource/Benchmarks/Olden/em3d/make_graph.c +++ b/MultiSource/Benchmarks/Olden/em3d/make_graph.c @@ -14,9 +14,6 @@ #include "em3d.h" #include "util.h" -#include -#include "hacks.h" -#pragma CHECKED_SCOPE ON extern int NumNodes; int NumMisses; @@ -25,35 +22,30 @@ int n_nodes; int d_nodes; int local_p; -array_ptr> make_table(int size, int procname) : count(size) { - array_ptr> retval : count(size) = calloc>(size, sizeof(ptr)); +node_t **make_table(int size, int procname) { + node_t **retval = (node_t **)malloc(size*sizeof(node_t *)); assert(retval); return retval; } /* We expect node_table to be a local table of e or h nodes */ -void fill_table(array_ptr> node_table : count(size), array_ptr values : count(size), int size, int procname) +void fill_table(node_t **node_table, double *values, int size, int procname) { - ptr cur_node = NULL; - ptr prev_node = NULL; + node_t *cur_node, *prev_node; int i; - prev_node = calloc(1, sizeof(node_t)); + prev_node = (node_t *)malloc(sizeof(node_t)); node_table[0] = prev_node; *values = gen_uniform_double(); - _Unchecked { prev_node->value = values++; } - prev_node->from_count = 0, - prev_node->from_values = _Dynamic_bounds_cast>>(prev_node->from_values, count(prev_node->from_count)), - prev_node->coeffs = _Dynamic_bounds_cast>(prev_node->coeffs, count(prev_node->from_count)); + prev_node->value = values++; + prev_node->from_count = 0; /* Now we fill the node_table with allocated nodes */ for (i=1; i(1, sizeof(node_t)); + cur_node = (node_t *)malloc(sizeof(node_t)); *values = gen_uniform_double(); - _Unchecked { cur_node->value = values++; } - cur_node->from_count = 0, - cur_node->from_values = _Dynamic_bounds_cast>>(cur_node->from_values, count(cur_node->from_count)), - cur_node->coeffs = _Dynamic_bounds_cast>(cur_node->coeffs, count(cur_node->from_count)); + cur_node->value = values++; + cur_node->from_count = 0; node_table[i] = cur_node; prev_node->next = cur_node; prev_node = cur_node; @@ -61,24 +53,25 @@ void fill_table(array_ptr> node_table : count(size), array_ptrnext = NULL; } -void make_neighbors(ptr nodelist, array_ptr table : count(PROCS), int tablesz, +void make_neighbors(node_t *nodelist, node_t **table[], int tablesz, int degree, int percent_local, int id) { - ptr cur_node = nodelist; + node_t *cur_node; - for(; cur_node; cur_node=cur_node->next) { - ptr other_node = NULL; + for(cur_node = nodelist; cur_node; cur_node=cur_node->next) { + node_t *other_node; int j,k; int dest_proc; - array_ptr> tmp : count(degree) = calloc>(degree, (sizeof(ptr))); - dynamic_check(tmp != NULL); - - _Unchecked { cur_node->degree = degree, cur_node->to_nodes = tmp; } + cur_node->to_nodes = (node_t **)malloc(degree*(sizeof(node_t *))); + if (!cur_node->to_nodes) { + chatting("Uncaught malloc error\n"); + exit(0); + } for (j=0; j> local_table : count(tablesz) = NULL; + node_t **local_table; int number = gen_number(tablesz); if (check_percent(percent_local)) { @@ -88,22 +81,16 @@ void make_neighbors(ptr nodelist, array_ptr table : count(P } /* We expect these accesses to be remote */ - _Unchecked { local_table = table[dest_proc].table; } + local_table = table[dest_proc]; other_node = local_table[number]; /* <------ 4% load miss penalty */ if (!other_node) { chatting("Error! on dest %d @ %d\n",number,dest_proc); exit(1); } - array_ptr> ub = tmp + j; - UncheckedBoundsInit(array_ptr>, tmp2, bounds(tmp2, ub), tmp); - for ( ; tmp2 < ub; tmp2++) - if (other_node == *tmp2) break; - k = tmp2 - tmp; - /* Original code: for (k=0; kto_nodes[k]) break; - */ + #if 0 if ((((unsigned long long) other_node) >> 7) < 2048) chatting("pre other_node = 0x%x,number = %d,dest = %d\n", @@ -118,57 +105,55 @@ void make_neighbors(ptr nodelist, array_ptr table : count(P exit(1); } - cur_node->to_nodes[j] = other_node; /* <------ 6.5% store penalty */ + cur_node->to_nodes[j]=other_node; /* <------ 6.5% store penalty */ #if 0 if ((((unsigned long long) other_node) >> 7) < 2048) chatting("post other_node = 0x%x\n",other_node); #endif - ++other_node->from_count, /* <----- 12% load miss penalty */ - other_node->from_values = _Dynamic_bounds_cast>>(other_node->from_values, count(other_node->from_count)), - other_node->coeffs = _Dynamic_bounds_cast>(other_node->coeffs, count(other_node->from_count)); + ++other_node->from_count; /* <----- 12% load miss penalty */ } } } -void update_from_coeffs(ptr nodelist) { - ptr cur_node = nodelist; +void update_from_coeffs(node_t *nodelist) { + node_t *cur_node; /* Setup coefficient and from_nodes vectors for h nodes */ - for (; cur_node; cur_node=cur_node->next) { + for (cur_node = nodelist; cur_node; cur_node=cur_node->next) { int from_count = cur_node->from_count; if (from_count < 1) { chatting("Help! no from count (from_count=%d) \n", from_count); - cur_node->from_values = calloc>(20, sizeof(ptr)); - cur_node->coeffs = calloc(20, sizeof(double)); + cur_node->from_values = (double **)malloc(20 * sizeof(double *)); + cur_node->coeffs = (double *)malloc(20 * sizeof(double)); cur_node->from_length = 0; } else { - cur_node->from_values = calloc>(from_count, sizeof(ptr)); - cur_node->coeffs = calloc(from_count, sizeof(double)); + cur_node->from_values = (double **)malloc(from_count * sizeof(double *)); + cur_node->coeffs = (double *)malloc(from_count * sizeof(double)); cur_node->from_length = 0; } } } -void fill_from_fields(ptr nodelist, int degree) { - ptr cur_node = nodelist; - for(; cur_node; cur_node = cur_node->next) { +void fill_from_fields(node_t *nodelist, int degree) { + node_t *cur_node; + for(cur_node = nodelist; cur_node; cur_node = cur_node->next) { int j; for (j=0; j other_node = cur_node->to_nodes[j]; /* <-- 6% load miss penalty */ - array_ptr> otherlist : count(other_node->from_count) = NULL; - ptr value = cur_node->value; + node_t *other_node = cur_node->to_nodes[j]; /* <-- 6% load miss penalty */ + double **otherlist; + double *value = cur_node->value; - if (!other_node) { chatting("Help!!\n"); } + if (!other_node) chatting("Help!!\n"); count=(other_node->from_length)++; /* <----- 30% load miss penalty */ - _Unchecked { otherlist=other_node->from_values; /* <----- 10% load miss penalty */ } + otherlist=other_node->from_values; /* <----- 10% load miss penalty */ thecount=other_node->from_count; if (!otherlist) { /*chatting("node 0x%p list 0x%p count %d\n", other_node,otherlist,thecount);*/ - _Unchecked { otherlist = other_node->from_values; } + otherlist = other_node->from_values; /*chatting("No from list!! 0x%p\n",otherlist);*/ } @@ -180,10 +165,10 @@ void fill_from_fields(ptr nodelist, int degree) { } } -void localize_local(ptr nodelist) { - ptr cur_node = nodelist; +void localize_local(node_t *nodelist) { + node_t *cur_node; - for(; cur_node; cur_node = cur_node->next) { + for(cur_node = nodelist; cur_node; cur_node = cur_node->next) { cur_node->coeffs = cur_node->coeffs; cur_node->from_values = cur_node->from_values; cur_node->value = cur_node->value; @@ -191,123 +176,99 @@ void localize_local(ptr nodelist) { } -void make_tables(ptr table,int groupname) { - array_ptr> h_table : count(n_nodes/PROCS) = NULL; - array_ptr> e_table : count(n_nodes/PROCS) = NULL; - array_ptr h_values : count(n_nodes/PROCS) = NULL; - array_ptr e_values : count(n_nodes/PROCS) = NULL; +void make_tables(table_t *table,int groupname) { + node_t **h_table,**e_table; + double *h_values, *e_values; int procname = 0; init_random(SEED1*groupname); - h_values = calloc(n_nodes/PROCS, sizeof(double)); + h_values = (double *)malloc(n_nodes/PROCS*sizeof(double)); h_table = make_table(n_nodes/PROCS,procname); fill_table(h_table,h_values,n_nodes/PROCS,procname); - e_values = calloc(n_nodes/PROCS, sizeof(double)); + e_values = (double *)malloc(n_nodes/PROCS*sizeof(double)); e_table = make_table(n_nodes/PROCS,procname); fill_table(e_table,e_values,n_nodes/PROCS,procname); /* This is done on procname-- we expect table to be remote */ /* We use remote writes */ - _Unchecked { - table->e_table[groupname].size = n_nodes/PROCS, - table->e_table[groupname].table = e_table; - } - _Unchecked { - table->h_table[groupname].size = n_nodes/PROCS, - table->h_table[groupname].table = h_table; - } + table->e_table[groupname] = e_table; + table->h_table[groupname] = h_table; } -void make_all_neighbors(ptr table,int groupname) { - ptr first_node = NULL; - int local_table_size = 1; - int local_table_bounds = local_table_size; - array_ptr> local_table : count(local_table_bounds) = NULL; - array_ptr local_table_array : count(1) = NULL; +void make_all_neighbors(table_t *table,int groupname) { + node_t *first_node; + node_t **local_table; + node_t ***local_table_array; init_random(SEED2*groupname); /* We expect table to be remote */ - local_table_size = table->h_table[groupname].size; - _Unchecked { local_table = table->h_table[groupname].table; } - _Unchecked { local_table_array = table->e_table; } + local_table = table->h_table[groupname]; + local_table_array = table->e_table; first_node = local_table[0]; make_neighbors(first_node, local_table_array,n_nodes/PROCS, d_nodes,local_p,groupname); - local_table_size = table->e_table[groupname].size; - _Unchecked { local_table = table->e_table[groupname].table; } - _Unchecked { local_table_array = table->h_table; } + local_table = table->e_table[groupname]; + local_table_array = table->h_table; first_node = local_table[0]; make_neighbors(first_node, local_table_array,n_nodes/PROCS, d_nodes,local_p,groupname); } -void update_all_from_coeffs(ptr table, int groupname) +void update_all_from_coeffs(table_t *table, int groupname) { - int local_table_size = 1; - int local_table_bounds = local_table_size; - array_ptr> local_table : count(local_table_bounds) = NULL; - ptr first_node = NULL; + node_t **local_table; + node_t *first_node; /* Done by do_all, table not local */ - local_table_size = table->h_table[groupname].size; - _Unchecked { local_table = table->h_table[groupname].table; } + local_table = table->h_table[groupname]; /* We expect this to be local */ first_node = local_table[0]; update_from_coeffs(first_node); - local_table_size = table->e_table[groupname].size; - _Unchecked { local_table = table->e_table[groupname].table; } + local_table = table->e_table[groupname]; first_node = local_table[0]; update_from_coeffs(first_node); } -void fill_all_from_fields(ptr table, int groupname) +void fill_all_from_fields(table_t *table, int groupname) { - int local_table_size = 1; - int local_table_bounds = local_table_size; - array_ptr> local_table : count(local_table_bounds) = NULL; - ptr first_node = NULL; + node_t **local_table; + node_t *first_node; init_random(SEED3*groupname); - local_table_size = table->h_table[groupname].size; - _Unchecked { local_table = table->h_table[groupname].table; } + local_table = table->h_table[groupname]; first_node = local_table[0]; fill_from_fields(first_node,d_nodes); - local_table_size = table->e_table[groupname].size; - _Unchecked { local_table = table->e_table[groupname].table; } + local_table = table->e_table[groupname]; first_node = local_table[0]; fill_from_fields(first_node,d_nodes); } -void localize(ptr table, int groupname) +void localize(table_t *table, int groupname) { - int local_table_size = 1; - int local_table_bounds = local_table_size; - array_ptr> local_table : count(local_table_bounds) = NULL; - ptr first_node = NULL; + node_t **local_table; + node_t *first_node; - local_table_size = table->h_table[groupname].size; - _Unchecked { local_table = table->h_table[groupname].table; } + local_table = table->h_table[groupname]; first_node = local_table[0]; localize_local(first_node); - local_table_size = table->e_table[groupname].size; - _Unchecked { local_table = table->e_table[groupname].table; } + local_table = table->e_table[groupname]; first_node = local_table[0]; localize_local(first_node); } -void clear_nummiss(ptr table, int groupname) +void clear_nummiss(table_t *table, int groupname) { NumMisses = 0; } -void do_all(ptr table, int groupname, int nproc, - ptr, int)> func, int groupsize) { +void do_all(table_t *table, int groupname, int nproc, + void func(table_t *, int),int groupsize) { /*chatting("do all group %d with %d\n",groupname,nproc);*/ if (nproc > 1) { do_all(table,groupname+nproc/2,nproc/2,func,groupsize); @@ -317,14 +278,14 @@ void do_all(ptr table, int groupname, int nproc, } } -ptr initialize_graph(void) { - ptr table = NULL; - ptr retval = NULL; +graph_t *initialize_graph() { + table_t *table; + graph_t *retval; int i,j,blocksize; int groupsize; - table = calloc(1, sizeof(table_t)); - retval = calloc(1, sizeof(graph_t)); + table = (table_t *)malloc(sizeof(table_t)); + retval = (graph_t *)malloc(sizeof(graph_t)); groupsize = PROCS/NumNodes; @@ -352,34 +313,26 @@ ptr initialize_graph(void) { chatting("cleanup for return now\n"); for (i=0; ie_table[i*blocksize].size; - int local_table_bounds = local_table_size; - array_ptr> local_table : count(local_table_bounds) = NULL; - _Unchecked { local_table = table->e_table[i*blocksize].table; } - ptr local_node_r = local_table[0]; + node_t **local_table = table->e_table[i*blocksize]; + node_t *local_node_r = local_table[0]; retval->e_nodes[i] = local_node_r; - local_table_size = table->h_table[i*blocksize].size; - _Unchecked { local_table = table->h_table[i*blocksize].table; } + local_table = table->h_table[i*blocksize]; local_node_r = local_table[0]; retval->h_nodes[i] = local_node_r; for (j = 1; j < blocksize; j++) { - _Ptr local_node_l = NULL; + node_t *local_node_l; - local_table_size = table->e_table[i*blocksize+j-1].size; - _Unchecked { local_table = table->e_table[i*blocksize+j-1].table; } - local_node_l = (_Ptr)local_table[(n_nodes/PROCS)-1]; - local_table_size = table->e_table[i*blocksize+j].size; - _Unchecked { local_table = table->e_table[i*blocksize+j].table; } + local_table = table->e_table[i*blocksize+j-1]; + local_node_l = local_table[(n_nodes/PROCS)-1]; + local_table = table->e_table[i*blocksize+j]; local_node_r = local_table[0]; local_node_l->next = local_node_r; - local_table_size = table->h_table[i*blocksize+j-1].size; - _Unchecked { local_table = table->h_table[i*blocksize+j-1].table; } - local_node_l = (_Ptr)local_table[(n_nodes/PROCS)-1]; - local_table_size = table->h_table[i*blocksize+j].size; - _Unchecked { local_table = table->h_table[i*blocksize+j].table; } + local_table = table->h_table[i*blocksize+j-1]; + local_node_l = local_table[(n_nodes/PROCS)-1]; + local_table = table->h_table[i*blocksize+j]; local_node_r = local_table[0]; local_node_l->next = local_node_r; } diff --git a/MultiSource/Benchmarks/Olden/em3d/make_graph.h b/MultiSource/Benchmarks/Olden/em3d/make_graph.h index 818ae34cf..bf5999983 100644 --- a/MultiSource/Benchmarks/Olden/em3d/make_graph.h +++ b/MultiSource/Benchmarks/Olden/em3d/make_graph.h @@ -7,9 +7,7 @@ * */ - #include - /* initialize graph returns a structure with pointers to lists of e and h * nodes. */ -ptr initialize_graph(void); +graph_t *initialize_graph(); diff --git a/MultiSource/Benchmarks/Olden/em3d/util.c b/MultiSource/Benchmarks/Olden/em3d/util.c index 910691306..9528f18a1 100644 --- a/MultiSource/Benchmarks/Olden/em3d/util.c +++ b/MultiSource/Benchmarks/Olden/em3d/util.c @@ -2,9 +2,9 @@ #include #include "em3d.h" -#pragma CHECKED_SCOPE ON #ifdef TORONTO +#define chatting printf #endif #ifdef __MINGW32__ @@ -12,7 +12,7 @@ #define lrand48() (rand() << 16 | rand()) #define drand48() (1.0*rand() / RAND_MAX) #else -extern double drand48(void); +extern double drand48(); #endif static int percentcheck=0,numlocal=0; @@ -41,7 +41,7 @@ int gen_signed_number(int range) } /* Generate a double from 0.0 to 1.0 */ -double gen_uniform_double(void) +double gen_uniform_double() { return drand48(); } diff --git a/MultiSource/Benchmarks/Olden/health/args.c b/MultiSource/Benchmarks/Olden/health/args.c index 451d5f048..98ef323f6 100644 --- a/MultiSource/Benchmarks/Olden/health/args.c +++ b/MultiSource/Benchmarks/Olden/health/args.c @@ -5,12 +5,11 @@ * To be used with health.c. * *****************************************************************/ -#include #include #include #include "health.h" -void dealwithargs(int argc, array_ptr> argv : count(argc)) { +void dealwithargs(int argc, char *argv[]) { if (argc < 4) { max_level = 3; max_time = 15; diff --git a/MultiSource/Benchmarks/Olden/health/health.c b/MultiSource/Benchmarks/Olden/health/health.c index dcd8240a6..258955f68 100644 --- a/MultiSource/Benchmarks/Olden/health/health.c +++ b/MultiSource/Benchmarks/Olden/health/health.c @@ -9,21 +9,20 @@ #include #include "health.h" #include -#pragma CHECKED_SCOPE ON int max_level; long max_time; long long seed; -ptr alloc_tree(int level, int label, ptr back) { +struct Village *alloc_tree(int level, int label, struct Village *back) { if (level == 0) return NULL; else { - ptr new = NULL; + struct Village *new; int i; - ptr fval checked[4] = { NULL, NULL, NULL, NULL }; + struct Village *fval[4]; - new = calloc(1, sizeof(struct Village)); + new = (struct Village *)malloc(sizeof(struct Village)); for (i = 3; i >= 0; i--) fval[i] = alloc_tree(level - 1, label*4 + i + 1, new); @@ -57,11 +56,11 @@ ptr alloc_tree(int level, int label, ptr back) { } -struct Results get_results(ptr village) { +struct Results get_results(struct Village *village) { int i; - ptr list = NULL; - ptr p = NULL; - struct Results fval checked[4]; + struct List *list; + struct Patient *p; + struct Results fval[4]; struct Results r1; r1.total_hosps = 0.0; @@ -71,7 +70,7 @@ struct Results get_results(ptr village) { if (village == NULL) return r1; for (i = 3; i > 0; i--) { - ptr V = village->forward[i]; + struct Village *V = village->forward[i]; fval[i] = get_results(V); } @@ -95,10 +94,10 @@ struct Results get_results(ptr village) { return r1; } -void check_patients_inside(ptr village, ptr list) +void check_patients_inside(struct Village *village, struct List *list) { - ptr l = NULL; - ptr p = NULL; + struct List *l; + struct Patient *p; int t; while (list != NULL) { @@ -108,18 +107,18 @@ void check_patients_inside(ptr village, ptr list) if (p->time_left == 0) { t = village->hosp.free_personnel; village->hosp.free_personnel = t+1; - _Unchecked { l = &(village->hosp.inside); } + l = &(village->hosp.inside); removeList(l, p); - _Unchecked { l = &(village->returned); } + l = &(village->returned); addList(l, p); } list = list->forward; /* :) adt_pf detected */ } } -ptr check_patients_assess(ptr village, ptr list) { +struct List *check_patients_assess(struct Village *village, struct List *list) { float rand; - ptr p = NULL; - ptr up = NULL; + struct Patient *p; + struct List *up = NULL; long long s; int label, t; @@ -154,9 +153,9 @@ ptr check_patients_assess(ptr village, ptr village, ptr list) { +void check_patients_waiting(struct Village *village, struct List *list) { int i, t; - ptr p = NULL; + struct Patient *p; while (list != NULL) { i = village->hosp.free_personnel; @@ -177,7 +176,7 @@ void check_patients_waiting(ptr village, ptr list) } -void put_in_hosp(ptr hosp, ptr patient) { +void put_in_hosp(struct Hosp *hosp, struct Patient *patient) { int t = patient->hosps_visited; patient->hosps_visited = t + 1; @@ -193,10 +192,10 @@ void put_in_hosp(ptr hosp, ptr patient) { } } -ptr generate_patient(ptr village) +struct Patient *generate_patient(struct Village *village) { long long s,newseed; - ptr patient = NULL; + struct Patient *patient; float rand; int label; @@ -206,7 +205,7 @@ ptr generate_patient(ptr village) newseed = village->seed; label = village->label; if (rand > 0.666) { - patient = calloc(1, sizeof(struct Patient)); + patient = (struct Patient *)malloc(sizeof(struct Patient)); patient->hosps_visited = 0; patient->time = 0; patient->time_left = 0; @@ -216,10 +215,10 @@ ptr generate_patient(ptr village) return NULL; } -int main(int argc, array_ptr> argv : count(argc)) +int main(int argc, char *argv[]) { struct Results results; - ptr top = NULL; + struct Village *top = 0; int i; float total_time, total_patients, total_hosps; @@ -234,7 +233,7 @@ int main(int argc, array_ptr> argv : count(argc)) sim(top); } /* :) adt_pf detected */ - chatting("Getting Results\n"); + printf("Getting Results\n"); results = get_results(top); /* :) adt_pf detected */ total_patients = results.total_patients; total_time = results.total_time; @@ -252,13 +251,13 @@ int main(int argc, array_ptr> argv : count(argc)) } -ptr sim(ptr village) +struct List *sim(struct Village *village) { int i; - ptr patient = NULL; - ptr l = NULL, up = NULL; - ptr h = NULL; - ptr val checked[4] = {NULL, NULL, NULL, NULL}; + struct Patient *patient; + struct List *l, *up; + struct Hosp *h; + struct List *val[4]; int label; if (village == NULL) return NULL; @@ -266,8 +265,8 @@ ptr sim(ptr village) label = village->label; for (i = 3; i > 0; i--) { - ptr V = village->forward[i]; - ptr L = sim(V); + struct Village *V = village->forward[i]; + struct List *L = sim(V); val[i] = L; } @@ -275,7 +274,7 @@ ptr sim(ptr village) h = &village->hosp; for (i = 3; i >= 0; i--) { - ptr valI = l = val[i]; + struct List *valI = l = val[i]; if (l != NULL) { l = l->forward; while (l != NULL) { diff --git a/MultiSource/Benchmarks/Olden/health/health.h b/MultiSource/Benchmarks/Olden/health/health.h index 2dcf08a2e..680143ac2 100644 --- a/MultiSource/Benchmarks/Olden/health/health.h +++ b/MultiSource/Benchmarks/Olden/health/health.h @@ -8,12 +8,10 @@ #ifndef _HEALTH #define _HEALTH -#include -#include -#include -#pragma CHECKED_SCOPE ON +#include +#include -#define chatting(...) unchecked { printf(__VA_ARGS__); } +#define chatting printf #define IA 16807 #define IM 2147483647 @@ -33,16 +31,16 @@ struct Results { }; struct Patient { - int hosps_visited; - int time; - int time_left; - ptr home_village; + int hosps_visited; + int time; + int time_left; + struct Village *home_village; }; struct List { - ptr forward; - ptr patient; - ptr back; + struct List *forward; + struct Patient *patient; + struct List *back; }; struct Hosp { @@ -67,8 +65,8 @@ struct Hosp { struct Village { #if 1 - ptr forward checked[4]; - ptr back; + struct Village *forward[4]; + struct Village *back; struct List returned; struct Hosp hosp; int label; @@ -76,29 +74,28 @@ struct Village { #else struct Hosp hosp; long seed; - ptr forward checked[4]; + struct Village *forward[4]; int label; struct List returned; - ptr back; + struct Village *back; #endif }; -ptr alloc_tree(int level, int label, ptr back); -void dealwithargs(int argc, array_ptr> argv : count(argc)); +struct Village *alloc_tree(int level, int label, struct Village *back); +void dealwithargs(int argc, char *argv[]); float my_rand(long long idum); -ptr generate_patient(ptr village); -void put_in_hosp(ptr hosp, ptrpatient); -void addList(ptr list, ptr patient); -void removeList(ptr list, ptr patient); -ptr sim(ptr village); -void check_patients_inside(ptr village, ptr list); -ptr check_patients_assess(ptr village, ptr list); -void check_patients_waiting(ptr village, ptr list); -float get_num_people(ptr village); -float get_total_time(ptr village); -float get_total_hosps(ptr village); -struct Results get_results(ptr village); +struct Patient *generate_patient(struct Village *village); +void put_in_hosp(struct Hosp *hosp, struct Patient *patient); +void addList(struct List *list, struct Patient *patient); +void removeList(struct List *list, struct Patient *patient); +struct List *sim(struct Village *village); +void check_patients_inside(struct Village *village, struct List *list); +struct List *check_patients_assess(struct Village *village, struct List *list); +void check_patients_waiting(struct Village *village, struct List *list); +float get_num_people(struct Village *village); +float get_total_time(struct Village *village); +float get_total_hosps(struct Village *village); +struct Results get_results(struct Village *village); -#pragma CHECKED_SCOPE OFF #endif diff --git a/MultiSource/Benchmarks/Olden/health/list.c b/MultiSource/Benchmarks/Olden/health/list.c index 161e22a93..4ab5af73b 100644 --- a/MultiSource/Benchmarks/Olden/health/list.c +++ b/MultiSource/Benchmarks/Olden/health/list.c @@ -5,30 +5,29 @@ * To be used with health.c * ********************************************************************/ -#include #include #include #include "health.h" -#pragma CHECKED_SCOPE ON -void addList(ptr list, ptr patient) { - ptr b = NULL; +void addList(struct List *list, struct Patient *patient) { + struct List *b; while (list != NULL) { b = list; list = list->forward; } - list = calloc(1, sizeof(struct List)); + list = (struct List *)malloc(sizeof(struct List)); list->patient = patient; list->forward = NULL; list->back = b; b->forward = list; } -void removeList(ptr list, ptr patient) { - ptr l1 = NULL, l2 = NULL; - ptr p = list->patient; +void removeList(struct List *list, struct Patient *patient) { + struct List *l1,*l2; + struct Patient *p; + p = list->patient; while(p != patient) { list = list->forward; p = list->patient; diff --git a/MultiSource/Benchmarks/Olden/health/poisson.c b/MultiSource/Benchmarks/Olden/health/poisson.c index f6e1c2053..8b1ecbca9 100644 --- a/MultiSource/Benchmarks/Olden/health/poisson.c +++ b/MultiSource/Benchmarks/Olden/health/poisson.c @@ -7,7 +7,6 @@ #include #include #include "health.h" -#pragma CHECKED_SCOPE ON float my_rand(long long idum) { diff --git a/MultiSource/Benchmarks/Olden/mst/args.c b/MultiSource/Benchmarks/Olden/mst/args.c index 0861404f4..b00a4fd10 100644 --- a/MultiSource/Benchmarks/Olden/mst/args.c +++ b/MultiSource/Benchmarks/Olden/mst/args.c @@ -1,13 +1,10 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include -#pragma CHECKED_SCOPE ON - -extern int atoi(const char * : itype(nt_array_ptr)); +extern int atoi(const char *); int NumNodes = 1; -int dealwithargs(int argc, array_ptr> argv : count(argc)) { +int dealwithargs(int argc, char *argv[]) { int level; if (argc > 1) diff --git a/MultiSource/Benchmarks/Olden/mst/hash.c b/MultiSource/Benchmarks/Olden/mst/hash.c index bab60d9eb..44153ccb0 100644 --- a/MultiSource/Benchmarks/Olden/mst/hash.c +++ b/MultiSource/Benchmarks/Olden/mst/hash.c @@ -1,26 +1,22 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include #include #include "hash.h" -#pragma CHECKED_SCOPE ON -#define printf(...) unchecked { printf(__VA_ARGS__); } #define assert(num,a) if (!(a)) {printf("Assertion failure:%d in hash\n",num); exit(-1);} -#include "hacks.h" static int remaining = 0; -static array_ptr temp : count(remaining); +static char *temp; -static array_ptr localmalloc(int size) : byte_count(size) +static char *localmalloc(int size) { - array_ptr blah; + char *blah; if (size>remaining) { - remaining = 32768; - temp = calloc(remaining, sizeof(char)); + temp = (char *) malloc(32768); if (!temp) printf("Error! malloc returns null\n"); + remaining = 32768; } blah = temp; temp += size; @@ -30,24 +26,24 @@ static array_ptr localmalloc(int size) : byte_count(size) #define localfree(sz) -Hash MakeHash(int size, ptr map) +Hash MakeHash(int size, int (*map)(unsigned int)) { - Hash retval = NULL; + Hash retval; int i; retval = (Hash) localmalloc(sizeof(*retval)); - retval->size = size, - retval->array = (array_ptr)localmalloc(size*sizeof(HashEntry)); + retval->array = (HashEntry *) localmalloc(size*sizeof(HashEntry)); for (i=0; iarray[i] = NULL; + retval->array[i]=NULL; retval->mapfunc = map; + retval->size = size; return retval; } -unchecked void *HashLookup(unsigned int key, Hash hash) +void *HashLookup(unsigned int key, Hash hash) { int j; - HashEntry ent = NULL; + HashEntry ent; j = (hash->mapfunc)(key); /* 14% miss in hash->mapfunc */ assert(1,j>=0); @@ -60,15 +56,15 @@ unchecked void *HashLookup(unsigned int key, Hash hash) return NULL; } -unchecked void HashInsert(void *entry,unsigned int key,Hash hash) +void HashInsert(void *entry,unsigned int key,Hash hash) { - HashEntry ent = NULL; + HashEntry ent; int j; assert(3,!HashLookup(key,hash)); j = (hash->mapfunc)(key); - ent = (HashEntry)localmalloc(sizeof(*ent)); + ent = (HashEntry) localmalloc(sizeof(*ent)); ent->next = hash->array[j]; hash->array[j]=ent; ent->key = key; @@ -76,11 +72,9 @@ unchecked void HashInsert(void *entry,unsigned int key,Hash hash) } void HashDelete(unsigned key, Hash hash) { - HashEntry tmp = NULL; + HashEntry tmp; int j = (hash->mapfunc)(key); - int size = hash->size; - _Dynamic_check(j <= size); - UncheckedPtrInit(ptr, ent, &hash->array[j]); + HashEntry *ent = &hash->array[j]; while (*ent && (*ent)->key != key) { ent = &(*ent)->next; diff --git a/MultiSource/Benchmarks/Olden/mst/hash.h b/MultiSource/Benchmarks/Olden/mst/hash.h index 8bd652c0b..e8c443608 100644 --- a/MultiSource/Benchmarks/Olden/mst/hash.h +++ b/MultiSource/Benchmarks/Olden/mst/hash.h @@ -1,29 +1,20 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include -#include +#include "stdio.h" -struct hash_entry { +typedef struct hash_entry { unsigned int key; void *entry; - ptr next; -}; + struct hash_entry *next; +} *HashEntry; -#pragma CHECKED_SCOPE ON - -typedef ptr HashEntry; - -struct hash { - array_ptr array : count(size); - ptr mapfunc; +typedef struct hash { + HashEntry *array; + int (*mapfunc)(unsigned int); int size; -}; +} *Hash; -typedef ptr Hash; - -Hash MakeHash(int size, ptr map); -unchecked void *HashLookup(unsigned int key, Hash hash); -unchecked void HashInsert(void *entry, unsigned int key, Hash hash); +Hash MakeHash(int size, int (*map)(unsigned int)); +void *HashLookup(unsigned int key, Hash hash); +void HashInsert(void *entry,unsigned int key, Hash hash); void HashDelete(unsigned int key, Hash hash); - -#pragma CHECKED_SCOPE OFF diff --git a/MultiSource/Benchmarks/Olden/mst/main.c b/MultiSource/Benchmarks/Olden/mst/main.c index 870ad828f..4daacb619 100644 --- a/MultiSource/Benchmarks/Olden/mst/main.c +++ b/MultiSource/Benchmarks/Olden/mst/main.c @@ -1,7 +1,6 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ #include "mst.h" -#pragma CHECKED_SCOPE ON typedef struct blue_return { Vertex vert; @@ -16,9 +15,9 @@ typedef struct fc_br { static BlueReturn BlueRule(Vertex inserted, Vertex vlist) { - BlueReturn retval = {0}; - Vertex tmp = NULL, prev = NULL; - Hash hash = NULL; + BlueReturn retval; + Vertex tmp,prev; + Hash hash; int dist,dist2; int count; @@ -31,7 +30,7 @@ static BlueReturn BlueRule(Vertex inserted, Vertex vlist) retval.vert = vlist; retval.dist = vlist->mindist; hash = vlist->edgehash; - unchecked { dist = (int) HashLookup((unsigned int) inserted, hash); } + dist = (int) HashLookup((unsigned int) inserted, hash); /*printf("Found %d at 0x%x for 0x%x\n",dist,inserted,vlist);*/ if (dist) { @@ -50,14 +49,16 @@ static BlueReturn BlueRule(Vertex inserted, Vertex vlist) count++; if (tmp==inserted) { - Vertex next = tmp->next; + Vertex next; + + next = tmp->next; prev->next = next; } else { hash = tmp->edgehash; /* <------ 6% miss in tmp->edgehash */ dist2 = tmp->mindist; - unchecked { dist = (int) HashLookup((unsigned int) inserted, hash); } + dist = (int) HashLookup((unsigned int) inserted, hash); /*printf("Found %d at 0x%x for 0x%x\n",dist,inserted,tmp);*/ if (dist) { @@ -84,8 +85,8 @@ static BlueReturn BlueRule(Vertex inserted, Vertex vlist) static Vertex MyVertexList = NULL; static BlueReturn Do_all_BlueRule(Vertex inserted, int nproc, int pn) { - future_cell_BlueReturn fcleft = {0}; - BlueReturn retright = {0}; + future_cell_BlueReturn fcleft; + BlueReturn retright; if (nproc > 1) { fcleft.value = Do_all_BlueRule(inserted,nproc/2,pn+nproc/2); @@ -106,23 +107,23 @@ static BlueReturn Do_all_BlueRule(Vertex inserted, int nproc, int pn) { static int ComputeMst(Graph graph,int numproc,int numvert) { - Vertex inserted = NULL, tmp = NULL; + Vertex inserted,tmp; int cost=0,dist; /* make copy of graph */ printf("Compute phase 1\n"); /* Insert first node */ - _Unchecked { inserted = (Vertex)graph->vlist[0].starting_vertex; } + inserted = graph->vlist[0]; tmp = inserted->next; - _Unchecked { graph->vlist[0].starting_vertex = tmp; } + graph->vlist[0] = tmp; MyVertexList = tmp; numvert--; /* Announce insertion and find next one */ printf("Compute phase 2\n"); while (numvert) { - BlueReturn br = {0}; + BlueReturn br; br = Do_all_BlueRule(inserted,numproc,0); inserted = br.vert; @@ -133,9 +134,9 @@ static int ComputeMst(Graph graph,int numproc,int numvert) return cost; } -int main(int argc, array_ptr> argv : count(argc)) +int main(int argc, char *argv[]) { - Graph graph = NULL; + Graph graph; int dist; int size; diff --git a/MultiSource/Benchmarks/Olden/mst/makegraph.c b/MultiSource/Benchmarks/Olden/mst/makegraph.c index b957ac85d..014004dd9 100644 --- a/MultiSource/Benchmarks/Olden/mst/makegraph.c +++ b/MultiSource/Benchmarks/Olden/mst/makegraph.c @@ -1,10 +1,9 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ #include "mst.h" -#pragma CHECKED_SCOPE ON /*#define assert(num,a) \ - if (!(a)) unchecked {printf("Assertion failure:%d in makegraph\n",num); exit(-1);}*/ + if (!(a)) {printf("Assertion failure:%d in makegraph\n",num); exit(-1);}*/ #define CONST_m1 10000 #define CONST_b 31415821 @@ -42,31 +41,30 @@ static int hashfunc(unsigned int key) static void AddEdges(int count1, Graph retval, int numproc, int perproc, int numvert, int j) { - Vertex tmp = NULL; - VertexArray helper checked[MAXPROC] = {0}; + Vertex tmp; + Vertex helper[MAXPROC]; int i; for (i=0; ivlist[i]; } - _Unchecked { tmp = retval->vlist[j].starting_vertex; } - for (; tmp; tmp=tmp->next) + for (tmp = retval->vlist[j]; tmp; tmp=tmp->next) { for (i=0; iedgehash; - unchecked { HashInsert((void*)dist,(unsigned int) dest,hash); } + HashInsert((void *) dist,(unsigned int) dest,hash); /*assert(4, HashLookup((unsigned int) dest,hash) == (void*) dist);*/ } } /* for i... */ @@ -79,34 +77,29 @@ Graph MakeGraph(int numvert, int numproc) int perproc = numvert/numproc; int i,j; int count1; - Vertex v = NULL, tmp = NULL; - array_ptr block : count(perproc) = NULL; - Graph retval = NULL; - - retval = calloc(1, sizeof(*retval)); + Vertex v,tmp; + Vertex block; + Graph retval; + retval = (Graph)malloc(sizeof(*retval)); for (i=0; ivlist[i].starting_vertex = NULL; + retval->vlist[i]=NULL; } chatting("Make phase 2\n"); for (j=numproc-1; j>=0; j--) { - block = calloc(perproc, sizeof(*tmp)); + block = (Vertex) malloc(perproc*(sizeof(*tmp))); v = NULL; for (i=0; imindist = 9999999; tmp->edgehash = MakeHash(numvert/4,hashfunc); tmp->next = v; - v = tmp; + v=tmp; } - _Unchecked { - retval->vlist[j].len = perproc, - retval->vlist[j].block = block, - retval->vlist[j].starting_vertex = v; - } + retval->vlist[j] = v; } chatting("Make phase 3\n"); @@ -121,9 +114,7 @@ Graph MakeGraph(int numvert, int numproc) return retval; } -void chatting(nt_array_ptr str) { - printf("%s", str); -} + diff --git a/MultiSource/Benchmarks/Olden/mst/mst.h b/MultiSource/Benchmarks/Olden/mst/mst.h index ee3297e03..d75b246ce 100644 --- a/MultiSource/Benchmarks/Olden/mst/mst.h +++ b/MultiSource/Benchmarks/Olden/mst/mst.h @@ -1,40 +1,23 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include -#include +#include #include "hash.h" -#pragma CHECKED_SCOPE ON #define MAXPROC 1 -#define printf(...) unchecked { printf(__VA_ARGS__); } +#define chatting printf extern int NumNodes; -struct vert_st { +typedef struct vert_st { int mindist; - ptr next; + struct vert_st *next; Hash edgehash; -}; +} *Vertex; -typedef ptr Vertex; - -struct vert_arr_st { - array_ptr block : count(len); - int len; - array_ptr starting_vertex : bounds(block, block + len); -}; - -typedef struct vert_arr_st VertexArray; - -struct graph_st { - struct vert_arr_st vlist checked[MAXPROC]; -}; - -typedef ptr Graph; +typedef struct graph_st { + Vertex vlist[MAXPROC]; +} *Graph; Graph MakeGraph(int numvert, int numproc); -int dealwithargs(int argc, array_ptr> argv : count(argc)); - -int atoi(const char * : itype(nt_array_ptr)); -void chatting(nt_array_ptr str); +int dealwithargs(int argc, char *argv[]); -#pragma CHECKED_SCOPE OFF +int atoi(const char *); diff --git a/MultiSource/Benchmarks/Olden/perimeter/args.c b/MultiSource/Benchmarks/Olden/perimeter/args.c index 0bd5f81ae..48c62eff9 100644 --- a/MultiSource/Benchmarks/Olden/perimeter/args.c +++ b/MultiSource/Benchmarks/Olden/perimeter/args.c @@ -1,15 +1,11 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include - -#pragma CHECKED_SCOPE ON - #ifndef TORONTO #include #include #endif -extern int atoi(const char * : itype(nt_array_ptr)); +extern int atoi(const char *); #ifndef TORONTO extern int __NumNodes; @@ -27,7 +23,7 @@ void filestuff() } #endif -int dealwithargs(int argc, array_ptr> argv : count(argc)) +int dealwithargs(int argc, char *argv[]) { int level; diff --git a/MultiSource/Benchmarks/Olden/perimeter/main.c b/MultiSource/Benchmarks/Olden/perimeter/main.c index cca7b7af5..229630c3d 100644 --- a/MultiSource/Benchmarks/Olden/perimeter/main.c +++ b/MultiSource/Benchmarks/Olden/perimeter/main.c @@ -1,14 +1,9 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include #include "perimeter.h" #include #include -#define printf(...) unchecked { printf(__VA_ARGS__); } - -#pragma CHECKED_SCOPE ON - static int adj(Direction d, ChildType ct) { switch (d) @@ -65,8 +60,9 @@ static ChildType reflect(Direction d, ChildType ct) int CountTree(QuadTree tree) { - QuadTree nw = tree->nw, ne = tree->ne, sw = tree->sw, se = tree->se; + QuadTree nw,ne,sw,se; + nw = tree->nw; ne = tree->ne; sw = tree->sw; se = tree->se; if (nw==NULL && ne==NULL && sw==NULL && se==NULL) return 1; else @@ -97,9 +93,10 @@ static QuadTree child(QuadTree tree, ChildType ct) static QuadTree gtequal_adj_neighbor(QuadTree tree, Direction d) { - QuadTree q = NULL, parent = tree->parent; + QuadTree q,parent; ChildType ct; + parent=tree->parent; ct=tree->childtype; if ((parent!=NULL) && adj(d,ct)) q=gtequal_adj_neighbor(parent,d); @@ -127,11 +124,11 @@ static int sum_adjacent(QuadTree p, ChildType q1, ChildType q2, int size) int perimeter(QuadTree tree, int size) { int retval = 0; - QuadTree neighbor = NULL; + QuadTree neighbor; if (tree->color==grey) { - QuadTree child = NULL; + QuadTree child; #ifdef FUTURES future_cell_int fc_sw,fc_se,fc_ne; #endif @@ -186,11 +183,11 @@ int perimeter(QuadTree tree, int size) return retval; } -extern int dealwithargs(int argc, array_ptr> argv : count(argc)); +extern int dealwithargs(int argc, char * argv[]); -int main(int argc, array_ptr> argv : count(argc)) +int main(int argc, char *argv[]) { - QuadTree tree = NULL; + QuadTree tree; int count; int level; diff --git a/MultiSource/Benchmarks/Olden/perimeter/maketree.c b/MultiSource/Benchmarks/Olden/perimeter/maketree.c index ab89ac7be..651fafdc5 100644 --- a/MultiSource/Benchmarks/Olden/perimeter/maketree.c +++ b/MultiSource/Benchmarks/Olden/perimeter/maketree.c @@ -1,11 +1,8 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ -#include #include "perimeter.h" #include -#pragma CHECKED_SCOPE ON - static int CheckOutside(int x, int y) { int euclid = x*x+y*y; @@ -35,12 +32,12 @@ QuadTree MakeTree(int size, int center_x, int center_y, int lo_proc, int hi_proc, QuadTree parent, ChildType ct, int level) { int intersect=0; - QuadTree retval = NULL; + QuadTree retval; #ifdef FUTURES retval = (QuadTree) ALLOC(lo_proc,sizeof(*retval)); #else - retval = calloc(1, sizeof(*retval)); + retval = (QuadTree) malloc(sizeof(*retval)); #endif retval->parent = parent; retval->childtype = ct; diff --git a/MultiSource/Benchmarks/Olden/perimeter/perimeter.h b/MultiSource/Benchmarks/Olden/perimeter/perimeter.h index 50d20c740..8f738806a 100644 --- a/MultiSource/Benchmarks/Olden/perimeter/perimeter.h +++ b/MultiSource/Benchmarks/Olden/perimeter/perimeter.h @@ -1,14 +1,11 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ - -#include - -#pragma CHECKED_SCOPE ON - #ifdef TORONTO extern int NumNodes; #define chatting printf #endif +#define NULL 0 + #ifndef TORONTO #include #ifdef FUTURES @@ -27,22 +24,20 @@ typedef struct quad_struct { ChildType childtype; #ifndef TORONTO - ptr nw {50}; - ptr ne {50}; - ptr sw {50}; - ptr se {50}; - ptr parent {50}; + struct quad_struct *nw {50}; + struct quad_struct *ne {50}; + struct quad_struct *sw {50}; + struct quad_struct *se {50}; + struct quad_struct *parent {50}; #else - ptr nw; - ptr ne; - ptr sw; - ptr se; - ptr parent; + struct quad_struct *nw; + struct quad_struct *ne; + struct quad_struct *sw; + struct quad_struct *se; + struct quad_struct *parent; #endif -} quad_struct; - -typedef ptr QuadTree; +} quad_struct, *QuadTree; QuadTree MakeTree(int size, int center_x, int center_y, int lo_proc, @@ -55,4 +50,5 @@ QuadTree MakeTree(int size, int center_x, int center_y, int lo_proc, -#pragma CHECKED_SCOPE OFF + + diff --git a/MultiSource/Benchmarks/Olden/power/build.c b/MultiSource/Benchmarks/Olden/power/build.c index 2159d797d..92c020da6 100644 --- a/MultiSource/Benchmarks/Olden/power/build.c +++ b/MultiSource/Benchmarks/Olden/power/build.c @@ -10,18 +10,15 @@ * University of California at Berkeley */ -#include #include "power.h" -#pragma CHECKED_SCOPE ON - -Root build_tree(void) +Root build_tree() { int i; - Root t = 0; - Lateral l = 0; + Root t; + Lateral l; - t = calloc(1, sizeof(*t)); + t = (Root) malloc(sizeof(*t)); for (i=0; i(1, sizeof(*l)); + l = (Lateral) malloc(sizeof(*l)); next = build_lateral(i,num-1); b = build_branch(i*BRANCHES_PER_LATERAL,(num-1)*BRANCHES_PER_LATERAL, @@ -57,12 +54,12 @@ Lateral build_lateral(int i, int num) Branch build_branch(int i, int j, int num) { - Leaf l = 0; - Branch b = 0; + Leaf l; + Branch b; if (num == 0) return NULL; /* allocate branch */ - b = calloc(1, sizeof(*b)); + b = (Branch) malloc(sizeof(*b)); /* fill in children */ b->next_branch= build_branch(i,j,num-1); @@ -80,10 +77,10 @@ Branch build_branch(int i, int j, int num) return b; } -Leaf build_leaf(void) { - Leaf l = 0; +Leaf build_leaf() { + Leaf l; - l = calloc(1, sizeof(*l)); + l = (Leaf) malloc(sizeof(*l)); l->D.P = 1.0; l->D.Q = 1.0; return l; diff --git a/MultiSource/Benchmarks/Olden/power/compute.c b/MultiSource/Benchmarks/Olden/power/compute.c index 1460a24f0..23a0a548e 100644 --- a/MultiSource/Benchmarks/Olden/power/compute.c +++ b/MultiSource/Benchmarks/Olden/power/compute.c @@ -11,11 +11,8 @@ * */ -#include #include "power.h" -#pragma CHECKED_SCOPE ON - /*----------------------------------------------------------------------*/ /* Leaf optimization 'global' variables */ @@ -27,18 +24,18 @@ static double Q=1.0; /* Leaf optimization procedures */ void optimize_node (double pi_R, double pi_I); -double find_g (void); -double find_h (void); -double find_gradient_f (double pi_R, double pi_I, _Array_ptr gradient : count(2)); -double find_gradient_g (_Array_ptr gradient : count(2)); -double find_gradient_h (_Array_ptr gradient : count(2)); -void find_dd_grad_f (double pi_R, double pi_I, _Array_ptr dd_grad : count(2)); -double make_orthogonal (_Array_ptr v_mod : count(2), _Array_ptr v_static : count(2)); +double find_g (); +double find_h (); +double find_gradient_f (double pi_R, double pi_I, double* gradient); +double find_gradient_g (double* gradient); +double find_gradient_h (double* gradient); +void find_dd_grad_f (double pi_R, double pi_I, double* dd_grad); +double make_orthogonal (double* v_mod, double* v_static); void Compute_Tree(Root r) { int i; - Lateral l = 0; + Lateral l; Demand a; Demand tmp; double theta_R,theta_I; @@ -63,8 +60,8 @@ Demand Compute_Lateral(Lateral l, double theta_R, double theta_I, Demand a2; double new_pi_R, new_pi_I; double a,b,c,root; - Lateral next = 0; - Branch br = 0; + Lateral next; + Branch br; new_pi_R = pi_R + l->alpha*(theta_R+(theta_I*l->X)/l->R); new_pi_I = pi_I + l->beta*(theta_I+(theta_R*l->R)/l->X); @@ -106,8 +103,8 @@ Demand Compute_Branch(Branch br, double theta_R, double theta_I, Demand a2,tmp; double new_pi_R, new_pi_I; double a,b,c,root; - Leaf l = 0; - Branch next = 0; + Leaf l; + Branch next; int i; Demand a1; @@ -175,10 +172,10 @@ void optimize_node (double pi_R, double pi_I) double g; double h; - double grad_f _Checked[2]; - double grad_g _Checked[2]; - double grad_h _Checked[2]; - double dd_grad_f _Checked[2]; + double grad_f[2]; + double grad_g[2]; + double grad_h[2]; + double dd_grad_f[2]; double magnitude; int i; @@ -237,17 +234,17 @@ void optimize_node (double pi_R, double pi_I) fabs (grad_f[0]*grad_h[1]-grad_f[1]*grad_h[0])>F_EPSILON)); } -double find_g (void) +double find_g () { return (P*P+Q*Q-0.8); } -double find_h (void) +double find_h () { return (P-5*Q); } -double find_gradient_f (double pi_R, double pi_I, _Array_ptr gradient : count(2)) +double find_gradient_f (double pi_R, double pi_I, double* gradient) { int i; double magnitude=0.0; @@ -263,7 +260,7 @@ double find_gradient_f (double pi_R, double pi_I, _Array_ptr gradient : return magnitude; } -double find_gradient_g (_Array_ptr gradient : count(2)) +double find_gradient_g (double* gradient) { int i; double magnitude=0.0; @@ -279,7 +276,7 @@ double find_gradient_g (_Array_ptr gradient : count(2)) return magnitude; } -double find_gradient_h (_Array_ptr gradient : count(2)) +double find_gradient_h (double* gradient) { int i; double magnitude=0.0; @@ -295,7 +292,7 @@ double find_gradient_h (_Array_ptr gradient : count(2)) return magnitude; } -void find_dd_grad_f (double pi_R, double pi_I, _Array_ptr dd_grad : count(2)) +void find_dd_grad_f (double pi_R, double pi_I, double* dd_grad) { double P_plus_1_inv=1/(P+1); double Q_plus_1_inv=1/(Q+1); @@ -309,7 +306,7 @@ void find_dd_grad_f (double pi_R, double pi_I, _Array_ptr dd_grad : coun dd_grad[1]=-Q_plus_1_inv*Q_plus_1_inv*Q_grad_term/grad_mag; } -double make_orthogonal (_Array_ptr v_mod : count(2), _Array_ptr v_static : count(2)) +double make_orthogonal (double* v_mod, double* v_static) { int i; double total=0.0; diff --git a/MultiSource/Benchmarks/Olden/power/main.c b/MultiSource/Benchmarks/Olden/power/main.c index cbdc460cd..863533ec6 100644 --- a/MultiSource/Benchmarks/Olden/power/main.c +++ b/MultiSource/Benchmarks/Olden/power/main.c @@ -14,10 +14,8 @@ #include "power.h" #include -#pragma CHECKED_SCOPE ON - /* Domain of thetaR->P map is 0.65 to 1.00 [index*0.01+0.65] */ -double map_P _Checked[36] = +double map_P[36] = {8752.218091048, 8446.106670416, 8107.990680283, 7776.191574285, 7455.920518777, 7146.602181352, 6847.709026813, 6558.734204024, 6279.213382291, @@ -36,7 +34,7 @@ double map_P _Checked[36] = #define MAX_THETA_R 0.995 /* Domain of thetaI->Q map is 0.130 to 0.200 [index*0.002+0.130] */ -double map_Q _Checked[36] = +double map_Q[36] = {1768.846590190, 1706.229490046, 1637.253873079, 1569.637451623, 1504.419525242, 1441.477913810, 1380.700660446, 1321.980440476, 1265.218982201, @@ -53,11 +51,10 @@ double map_Q _Checked[36] = #define MIN_THETA_I 0.13 #define PER_INDEX_I 0.002 #define MAX_THETA_I 0.199 -#define printf(...) _Unchecked { printf(__VA_ARGS__); } -int main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)) +int main(int argc,char *argv[]) { - Root r = 0; + Root r; int i,finished=0; double d_theta_R,d_theta_I; diff --git a/MultiSource/Benchmarks/Olden/power/power.h b/MultiSource/Benchmarks/Olden/power/power.h index f499845e8..aa26d8198 100644 --- a/MultiSource/Benchmarks/Olden/power/power.h +++ b/MultiSource/Benchmarks/Olden/power/power.h @@ -12,6 +12,8 @@ * */ +void *malloc(unsigned Size); + typedef struct demand { double P; double Q; @@ -19,7 +21,7 @@ typedef struct demand { #include -#pragma CHECKED_SCOPE ON +#define NULL 0 #ifdef SMALL_PROBLEM_SIZE /* __llvm__ SCALED BACK SETTINGS */ #define NUM_FEEDERS 8 @@ -45,55 +47,47 @@ typedef struct demand { #define H_EPSILON 0.000001 #define ROOT_EPSILON 0.00001 -struct root { +typedef struct root { Demand D; double theta_R; double theta_I; Demand last; double last_theta_R; double last_theta_I; - _Ptr feeders _Checked[NUM_FEEDERS]; -}; /* sizeof(struct root) = 108 bytes */ - -typedef _Ptr Root; + struct lateral *feeders[NUM_FEEDERS]; +} *Root; /* sizeof(struct root) = 108 bytes */ -struct lateral { +typedef struct lateral { Demand D; double alpha; double beta; double R; double X; - _Ptr next_lateral; - _Ptr branch; -}; /* sizeof(struct lateral) = 64 bytes */ - -typedef _Ptr Lateral; + struct lateral *next_lateral; + struct branch *branch; +} *Lateral; /* sizeof(struct lateral) = 64 bytes */ -struct branch { +typedef struct branch { Demand D; double alpha; double beta; double R; double X; - _Ptr next_branch; - _Ptr leaves _Checked[LEAVES_PER_BRANCH]; -}; /* sizeof(struct branch) = 92 bytes */ + struct branch *next_branch; + struct leaf *leaves[LEAVES_PER_BRANCH]; +} *Branch; /* sizeof(struct branch) = 92 bytes */ -typedef _Ptr Branch; - -struct leaf { +typedef struct leaf { Demand D; double pi_R; double pi_I; -}; /* sizeof(struct leaf) = 32 bytes */ - -typedef _Ptr Leaf; +} *Leaf; /* sizeof(struct leaf) = 32 bytes */ /* Prototypes */ Root build_tree(void); Lateral build_lateral(int i, int num); Branch build_branch(int i, int j, int num); -Leaf build_leaf(void); +Leaf build_leaf(); void Compute_Tree(Root r); Demand Compute_Lateral(Lateral l, double theta_R, double theta_I, @@ -102,4 +96,3 @@ Demand Compute_Branch(Branch b, double theta_R, double theta_I, double pi_R, double pi_I); Demand Compute_Leaf(Leaf l, double pi_R, double pi_I); -#pragma CHECKED_SCOPE OFF diff --git a/MultiSource/Benchmarks/Olden/treeadd/args.c b/MultiSource/Benchmarks/Olden/treeadd/args.c index f089b934f..bd91e51d4 100644 --- a/MultiSource/Benchmarks/Olden/treeadd/args.c +++ b/MultiSource/Benchmarks/Olden/treeadd/args.c @@ -5,17 +5,13 @@ #include #endif -#include "tree.h" - -#pragma CHECKED_SCOPE ON - #ifdef TORONTO int NumNodes; #else extern int __NumNodes; #endif -extern int atoi(const char * : itype(nt_array_ptr)); +extern int atoi(const char *); #ifndef TORONTO void filestuff() @@ -27,7 +23,7 @@ void filestuff() } #endif -int dealwithargs(int argc, array_ptr> argv : count(argc)) +int dealwithargs(int argc, char *argv[]) { int level; diff --git a/MultiSource/Benchmarks/Olden/treeadd/node.c b/MultiSource/Benchmarks/Olden/treeadd/node.c index 20934beb3..9e09a373b 100644 --- a/MultiSource/Benchmarks/Olden/treeadd/node.c +++ b/MultiSource/Benchmarks/Olden/treeadd/node.c @@ -17,21 +17,19 @@ #include #include "tree.h" -#pragma CHECKED_SCOPE ON - #ifdef TORONTO extern int NumNodes; #endif -int dealwithargs(int argc, array_ptr> argv : count(argc)); +int dealwithargs(int argc, char *argv[]); typedef struct { long level; } startmsg_t; -int main (int argc, array_ptr> argv : count(argc)) +int main (int argc, char *argv[]) { - ptr root = NULL; + tree_t *root; int level,result; #ifdef FUTURES @@ -54,7 +52,7 @@ int main (int argc, array_ptr> argv : count(argc)) level, __NumNodes); #endif /* only processor 0 will continue here. */ - chatting("About to enter TreeAlloc\n"); + chatting("About to enter TreeAlloc\n"); #ifndef TORONTO CMMD_node_timer_start(0); #endif @@ -68,7 +66,7 @@ int main (int argc, array_ptr> argv : count(argc)) #ifndef TORONTO CMMD_node_timer_stop(0); #endif - chatting("About to enter TreeAdd\n"); + chatting("About to enter TreeAdd\n"); #ifndef PLAIN ClearAllStats(); @@ -94,11 +92,12 @@ int main (int argc, array_ptr> argv : count(argc)) #endif exit(0); + } /* TreeAdd: */ -int TreeAdd (ptr t) +int TreeAdd (tree_t *t) { if (t == NULL) { return 0; @@ -107,7 +106,7 @@ int TreeAdd (ptr t) #ifdef FUTURES future_cell_int leftval; int rightval; - ptr tleft = NULL, tright = NULL; + tree_t *tleft, *tright; int value; tleft = t->left; @@ -125,7 +124,7 @@ int TreeAdd (ptr t) #else int leftval; int rightval; - ptr tleft = NULL, tright = NULL; + tree_t *tleft, *tright; int value; tleft = t->left; /* <---- 57% load penalty */ diff --git a/MultiSource/Benchmarks/Olden/treeadd/par-alloc.c b/MultiSource/Benchmarks/Olden/treeadd/par-alloc.c index db09a72de..97828a8cf 100644 --- a/MultiSource/Benchmarks/Olden/treeadd/par-alloc.c +++ b/MultiSource/Benchmarks/Olden/treeadd/par-alloc.c @@ -9,20 +9,19 @@ #endif #include "tree.h" +extern void *malloc(unsigned); -#pragma CHECKED_SCOPE ON - -ptr TreeAlloc (int level, int lo, int proc) { +tree_t *TreeAlloc (int level, int lo, int proc) { if (level == 0) return NULL; else { - ptr new = NULL, right = NULL, left = NULL; - new = calloc(1, sizeof(tree_t)); + struct tree *new, *right, *left; + new = (struct tree *) malloc(sizeof(tree_t)); left = TreeAlloc(level -1, lo+proc/2, proc/2); right=TreeAlloc(level-1,lo,proc/2); new->val = 1; - new->left = left; - new->right = right; + new->left = (struct tree *) left; + new->right = (struct tree *) right; return new; } } diff --git a/MultiSource/Benchmarks/Olden/treeadd/tree.h b/MultiSource/Benchmarks/Olden/treeadd/tree.h index 30364f6c7..630e4e4f1 100644 --- a/MultiSource/Benchmarks/Olden/treeadd/tree.h +++ b/MultiSource/Benchmarks/Olden/treeadd/tree.h @@ -3,30 +3,23 @@ /* tree.h */ -#include -#include -#include -#include - -#pragma CHECKED_SCOPE ON - #ifdef TORONTO -#define chatting(...) _Unchecked { printf(__VA_ARGS__); } +#include +#define chatting printf #define PLAIN #endif typedef struct tree { int val; - ptr left; - ptr right; + struct tree *left, *right; } tree_t; -extern ptr TreeAlloc(int level, int lo, int hi); -int TreeAdd (ptr t); +extern tree_t *TreeAlloc (int level, int lo, int hi); +int TreeAdd (tree_t *t); + -#pragma CHECKED_SCOPE OFF diff --git a/MultiSource/Benchmarks/Olden/tsp/args.c b/MultiSource/Benchmarks/Olden/tsp/args.c index 2e9e3d86d..6426f854c 100644 --- a/MultiSource/Benchmarks/Olden/tsp/args.c +++ b/MultiSource/Benchmarks/Olden/tsp/args.c @@ -2,9 +2,6 @@ #include #include "tsp.h" - -#pragma CHECKED_SCOPE ON - int NumNodes, NDim; int flag; @@ -14,9 +11,9 @@ int mylog(int num) while(k> argv : count(argc)) +int dealwithargs(int argc, char *argv[]) { int num; diff --git a/MultiSource/Benchmarks/Olden/tsp/build.c b/MultiSource/Benchmarks/Olden/tsp/build.c index f75f73f09..d3b095a00 100644 --- a/MultiSource/Benchmarks/Olden/tsp/build.c +++ b/MultiSource/Benchmarks/Olden/tsp/build.c @@ -33,13 +33,13 @@ extern double log(double x); #define M_E3 20.08553692318766774179 #define M_E6 403.42879349273512264299 #define M_E12 162754.79141900392083592475 +#define NULL 0 #include "tsp.h" #ifdef FUTURES #include "future-cell.h" #endif -#pragma CHECKED_SCOPE ON static double median(double min,double max,int n); static double uniform(double min, double max); @@ -76,14 +76,14 @@ static double uniform(double min, double max) { Tree build_tree(int n,int dir,int lo,int num_proc,double min_x, double max_x,double min_y,double max_y) { double med; - Tree t = NULL; + Tree t; #ifdef FUTURES future_cell_int fc; #endif if (n==0) return NULL; - t = (Tree) ALLOC(struct tree, lo, sizeof(*t)); + t = (Tree) ALLOC(lo,sizeof(*t)); if (dir) { dir = !dir; diff --git a/MultiSource/Benchmarks/Olden/tsp/main.c b/MultiSource/Benchmarks/Olden/tsp/main.c index f536af7e4..f0928d291 100644 --- a/MultiSource/Benchmarks/Olden/tsp/main.c +++ b/MultiSource/Benchmarks/Olden/tsp/main.c @@ -1,14 +1,13 @@ /* For copyright information, see olden_v1.0/COPYRIGHT */ #include "tsp.h" - -#pragma CHECKED_SCOPE ON +#include #define conquer_thresold 150 /* tsp() will use conquer for problems <= conquer_thresold */ extern int flag; void print_tree(Tree t) { - Tree left = NULL, right = NULL; + Tree left,right; double x,y; @@ -22,7 +21,7 @@ void print_tree(Tree t) void print_list(Tree t) { - Tree tmp = NULL; + Tree tmp; double x,y; if (!t) return; @@ -35,9 +34,9 @@ void print_list(Tree t) } } -int main(int argc,array_ptr> argv : count(argc)) +int main(int argc,char *argv[]) { - Tree t = NULL; + Tree t; int num; num=dealwithargs(argc,argv); @@ -48,7 +47,7 @@ int main(int argc,array_ptr> argv : count(argc)) if (flag) chatting("newgraph\n"); if (flag) chatting("newcurve pts\n"); - chatting("Call tsp(t, %d, %d)\n", conquer_thresold, NumNodes); + printf("Call tsp(t, %d, %d)\n", conquer_thresold, NumNodes); tsp(t,conquer_thresold, NumNodes); if (flag) print_list(t); diff --git a/MultiSource/Benchmarks/Olden/tsp/tsp.c b/MultiSource/Benchmarks/Olden/tsp/tsp.c index 34a1a7fdd..3eed314b1 100644 --- a/MultiSource/Benchmarks/Olden/tsp/tsp.c +++ b/MultiSource/Benchmarks/Olden/tsp/tsp.c @@ -4,8 +4,7 @@ #ifdef FUTURES #include "future-cell.h" #endif - -#pragma CHECKED_SCOPE ON +#define NULL 0 static Tree conquer(Tree t); static Tree merge(Tree a, Tree b, Tree t, int nproc); @@ -26,8 +25,8 @@ static double distance(Tree a, Tree b) { /* sling tree nodes into a list -- requires root to be tail of list */ /* only fills in next field, not prev */ static Tree makelist(Tree t) { - Tree left = NULL, right = NULL; - Tree tleft = NULL, tright = NULL; + Tree left, right; + Tree tleft,tright; Tree retval = t; if (!t) return NULL; @@ -44,7 +43,7 @@ static Tree makelist(Tree t) { /* reverse orientation of list */ static void reverse(Tree t) { - Tree prev = NULL,back = NULL, next = NULL, tmp = NULL; + Tree prev,back,next,tmp; if (!t) return; /*chatting("REVERSE\n");*/ @@ -68,8 +67,7 @@ static void reverse(Tree t) { /* Use closest-point heuristic from Cormen Leiserson and Rivest */ static Tree conquer(Tree t) { - Tree cycle = NULL, tmp = NULL, min = NULL, prev = NULL, next = NULL, - donext = NULL; + Tree cycle,tmp,min,prev,next,donext; double mindist,test; double mintonext, mintoprev, ttonext, ttoprev; @@ -121,9 +119,9 @@ static Tree conquer(Tree t) { /* Merge two cycles as per Karp */ static Tree merge(Tree a, Tree b, Tree t, int nproc) { - Tree min = NULL, next = NULL, prev = NULL, tmp = NULL; + Tree min,next,prev,tmp; double mindist,test,mintonext,mintoprev,ttonext,ttoprev; - Tree n1 = NULL, p1 = NULL, n2 = NULL, p2 = NULL; + Tree n1,p1,n2,p2; double tton1,ttop1,tton2,ttop2; double n1ton2,n1top2,p1ton2,p1top2; int choice; @@ -266,12 +264,12 @@ static Tree merge(Tree a, Tree b, Tree t, int nproc) { /* Compute TSP for the tree t -- use conquer for problems <= sz */ Tree tsp(Tree t,int sz,int nproc) { - Tree left = NULL, right = NULL; - Tree leftval = NULL; + Tree left,right; + Tree leftval; #ifdef FUTURES future_cell_pointer fc; #endif - Tree rightval = NULL; + Tree rightval; int nproc_2 = nproc/2; if (t->sz <= sz) return conquer(t); diff --git a/MultiSource/Benchmarks/Olden/tsp/tsp.h b/MultiSource/Benchmarks/Olden/tsp/tsp.h index 6dc615ecc..e3d946bfa 100644 --- a/MultiSource/Benchmarks/Olden/tsp/tsp.h +++ b/MultiSource/Benchmarks/Olden/tsp/tsp.h @@ -1,41 +1,29 @@ -#include -#include -#include -#include - -#pragma CHECKED_SCOPE ON - #ifdef TORONTO /* Toronto's hack */ -#define ALLOC(p, sz) calloc(1, sz) -#define ALLOC(T, p, sz) calloc(1, sz) -#define chatting(...) _Unchecked { printf(__VA_ARGS__); } +#define ALLOC(p, sz) malloc(sz) +#define chatting printf extern int NumNodes, NDim; #endif extern int flag; -int atoi(const char * : itype(nt_array_ptr)); -int dealwithargs(int argc, array_ptr> argv : count(argc)); +int atoi(const char *); +int dealwithargs(int argc, char *argv[]); + /* For copyright information, see olden_v1.0/COPYRIGHT */ -struct tree { +typedef struct tree { int sz; double x,y; - ptr left; - ptr right; + struct tree *left, *right; #ifdef TORONTO - ptr next; - ptr prev; + struct tree *next, *prev; #else - ptr next {95}; - ptr prev {95}; + struct tree *next {95}, *prev {95}; #endif -}; - -typedef ptr Tree; +} *Tree; #ifdef ORDER @@ -67,4 +55,4 @@ Tree tsp(Tree t, int sz, int nproc); -#pragma CHECKED_SCOPE OFF + diff --git a/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c b/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c index de1b1b486..6322617a1 100644 --- a/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c +++ b/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c @@ -130,17 +130,12 @@ #include #include -#include #include #include #include #include +#include #include -#include "hacks.h" - -jmp_buf jbAnagram; - -#pragma CHECKED_SCOPE ON /* Before compiling, make sure Quad and MASK_BITS are set properly. For best * results, make Quad the largest integer size supported on your machine. @@ -205,14 +200,14 @@ typedef unsigned long Quad; /* for building our bit mask */ /* A Word remembers the information about a candidate word. */ typedef struct { - Quad aqMask _Checked [MAX_QUADS]; /* the word's mask */ - _Array_ptr pchWord : count(cchLength); /* the word itself */ + Quad aqMask[MAX_QUADS]; /* the word's mask */ + char * pchWord; /* the word itself */ unsigned cchLength; /* letters in the word */ } Word; -typedef _Ptr PWord; -typedef _Array_ptr PPWord; +typedef Word * PWord; +typedef Word * * PPWord; -PWord apwCand _Checked [MAXCAND]; /* candidates we've found so far */ +PWord apwCand[MAXCAND]; /* candidates we've found so far */ unsigned cpwCand; /* how many of them? */ @@ -226,17 +221,15 @@ typedef struct { unsigned uBits; /* the bit mask itself */ unsigned iq; /* which Quad to inspect? */ } Letter; -typedef _Ptr PLetter; +typedef Letter * PLetter; -Letter alPhrase _Checked [ALPHABET]; /* statistics on the current phrase */ +Letter alPhrase[ALPHABET]; /* statistics on the current phrase */ #define lPhrase(ch) alPhrase[ch2i(ch)] /* quick access to a letter */ int cchPhraseLength; /* number of letters in phrase */ -Quad aqMainMask _Checked [MAX_QUADS];/* the bit field for the full phrase */ -Quad aqMainSign _Checked [MAX_QUADS];/* where the sign bits are */ - -char achPhrase _Checked [255]; +Quad aqMainMask[MAX_QUADS];/* the bit field for the full phrase */ +Quad aqMainSign[MAX_QUADS];/* where the sign bits are */ int cchMinLength = 3; @@ -244,28 +237,19 @@ int cchMinLength = 3; * over all candidate words. This is used to decide which letter to attack * first. */ -unsigned auGlobalFrequency _Checked [ALPHABET]; -char achByFrequency _Checked [ALPHABET]; /* for sorting */ +unsigned auGlobalFrequency[ALPHABET]; +char achByFrequency[ALPHABET]; /* for sorting */ -unsigned long pchDictionarySize; -_Array_ptr pchDictionary : count(pchDictionarySize); /* the dictionary is read here */ +char * pchDictionary; /* the dictionary is read here */ #define Zero(t) memset(t, 0, sizeof(t)) /* quickly zero out an integer array */ -#define fprintf(...) _Unchecked { fprintf(__VA_ARGS__); } -#define printf(...) _Unchecked { printf(__VA_ARGS__); } /* Fatal -- print a message before expiring */ -void Fatal(_Nt_array_ptr pchMsg, unsigned u) { +void Fatal(char *pchMsg, unsigned u) { fprintf(stderr, pchMsg, u); exit(1); } -#undef isalpha -#undef isdigit -#undef tolower -#undef bzero -void bzero(void *s : byte_count(n), size_t n); - /* ReadDict -- read the dictionary file into memory and preprocess it * * A word of length cch in the dictionary is encoded as follows: @@ -278,11 +262,11 @@ void bzero(void *s : byte_count(n), size_t n); * byte streams are concatenated, and terminated with a 0. */ -int stat(const char * restrict path : itype(restrict _Nt_array_ptr), - struct stat * restrict buf : itype(restrict _Ptr)); - -void ReadDict(_Nt_array_ptr pchFile) { - _Ptr fp = 0; +void ReadDict(char *pchFile) { + FILE *fp; + char * pch; + char * pchBase; + unsigned long ulLen; unsigned cWords = 0; unsigned cLetters; int ch; @@ -290,12 +274,8 @@ void ReadDict(_Nt_array_ptr pchFile) { if (stat(pchFile, &statBuf)) Fatal("Cannot stat dictionary\n", 0); - unsigned long ulLen; - pchDictionarySize = ulLen = statBuf.st_size + 2 * (unsigned long)MAXWORDS; - _Array_ptr buffer : count(ulLen) = 0; - _Array_ptr pchBase : bounds(buffer, buffer+ulLen) = 0; - pchBase = buffer = pchDictionary = calloc(pchDictionarySize, sizeof(char)); - _Array_ptr pch : bounds(buffer, buffer+ulLen) = 0; + ulLen = statBuf.st_size + 2 * (unsigned long)MAXWORDS; + pchBase = pchDictionary = (char *)malloc(ulLen); if(pchDictionary == NULL) Fatal("Unable to allocate memory for dictionary\n", 0); @@ -326,7 +306,7 @@ void ReadDict(_Nt_array_ptr pchFile) { fprintf(stderr, "%lu bytes wasted\n", ulLen - (pchBase - pchDictionary)); } -void BuildMask(_Array_ptr pchPhrase : bounds(achPhrase, achPhrase+255)) { +void BuildMask(char * pchPhrase) { int i; int ch; unsigned iq; /* which Quad? */ @@ -382,8 +362,11 @@ void BuildMask(_Array_ptr pchPhrase : bounds(achPhrase, achPhrase+255)) { } } -PWord NewWord(void) { - PWord pw = calloc(1, sizeof(Word)); +PWord +NewWord(void) { + PWord pw; + + pw = (Word *)malloc(sizeof(Word)); if (pw == NULL) Fatal("Out of memory after %d candidates\n", cpwCand); return pw; @@ -394,7 +377,7 @@ PWord NewWord(void) { * We would normally just use printf, but the string being printed is * is a huge pointer (on an IBM PC), so special care must be taken. */ -void wprint(_Nt_array_ptr pch) { +void wprint(char * pch) { printf("%s ", pch); } @@ -402,7 +385,7 @@ PWord NextWord(void); /* NextWord -- get another candidate entry, creating if necessary */ PWord NextWord(void) { - PWord pw = 0; + PWord pw; if (cpwCand >= MAXCAND) Fatal("Too many candidates\n", 0); pw = apwCand[cpwCand++]; @@ -415,12 +398,11 @@ PWord NextWord(void) { /* BuildWord -- build a Word structure from an ASCII word * If the word does not fit, then do nothing. */ -void BuildWord(_Array_ptr pchWord : bounds(wordStart, wordEnd), - _Array_ptr wordStart, _Array_ptr wordEnd) { - unsigned char cchFrequency _Checked [ALPHABET]; +void BuildWord(char * pchWord) { + unsigned char cchFrequency[ALPHABET]; int i; - _Array_ptr pch : bounds(wordStart, wordEnd) = pchWord; - PWord pw = 0; + char * pch = pchWord; + PWord pw; int cchLength = 0; bzero(cchFrequency, sizeof(unsigned char)*ALPHABET); @@ -447,7 +429,8 @@ void BuildWord(_Array_ptr pchWord : bounds(wordStart, wordEnd), pw = NextWord(); bzero(pw->aqMask, sizeof(Quad)*MAX_QUADS); /* Zero(pw->aqMask); */ - _Unchecked { pw->cchLength = cchLength, pw->pchWord = pchWord; } + pw->pchWord = pchWord; + pw->cchLength = cchLength; for (i = 0; i < ALPHABET; i++) { pw->aqMask[alPhrase[i].iq] |= (Quad)cchFrequency[i] << alPhrase[i].uShift; @@ -457,22 +440,14 @@ void BuildWord(_Array_ptr pchWord : bounds(wordStart, wordEnd), /* AddWords -- build the list of candidates */ void AddWords(void) { - _Array_ptr pchLowerBounds = pchDictionary; - _Array_ptr pchUpperBounds = pchDictionary + pchDictionarySize; - UncheckedBoundsInit(_Array_ptr, pch, bounds(pchLowerBounds, pchUpperBounds), pchDictionary) /* walk through the dictionary */ + char * pch = pchDictionary; /* walk through the dictionary */ cpwCand = 0; while (*pch) { if ((pch[1] >= cchMinLength && pch[1]+cchMinLength <= cchPhraseLength) || pch[1] == cchPhraseLength) - { - unsigned char wordLength = pch[0]; - _Array_ptr wordStart = pch; - _Array_ptr wordEnd = pch+wordLength; - _Dynamic_check(wordEnd <= pchUpperBounds); - _Unchecked { BuildWord(pch+2, wordStart, wordEnd); } - } + BuildWord(pch+2); pch += *pch; } @@ -487,7 +462,7 @@ void DumpCandidates(void) { printf("\n"); } -PWord apwSol _Checked [MAXSOL]; /* the answers */ +PWord apwSol[MAXSOL]; /* the answers */ int cpwLast; Debug( @@ -510,31 +485,34 @@ static int X; int i; X = (X+1) & 1023; if (X != 0) return; - for (i = 0; i < cpwLast; i++) _Unchecked { wprint((_Nt_array_ptr)apwSol[i]->pchWord); } + for (i = 0; i < cpwLast; i++) wprint(apwSol[i]->pchWord); printf("\n"); } Stat(unsigned long ulHighCount; unsigned long ulLowCount;) +jmp_buf jbAnagram; + #define OneStep(i) \ if ((aqNext[i] = pqMask[i] - pw->aqMask[i]) & aqMainSign[i]) { \ ppwStart++; \ continue; \ } -void FindAnagram(_Array_ptr pqMask : count(MAX_QUADS), - PPWord ppwStart : bounds(ppwStart, apwCand+MAXCAND), int iLetter) + +void +FindAnagram(Quad * pqMask, PPWord ppwStart, int iLetter) { - Quad aqNext _Checked [MAX_QUADS]; - register PWord pw = 0; + Quad aqNext[MAX_QUADS]; + register PWord pw; Quad qMask; unsigned iq; - UncheckedBoundsInit(PPWord, ppwEnd, bounds(ppwStart, apwCand+cpwCand), &apwCand[0]) + PPWord ppwEnd = &apwCand[0]; ppwEnd += cpwCand; ; - if (HaltProcessing()) _Unchecked { longjmp(jbAnagram, 1); } + if (HaltProcessing()) longjmp(jbAnagram, 1); Debug(printf("Trying :"); DumpWord(pqMask); printf(":\n");) @@ -548,10 +526,6 @@ void FindAnagram(_Array_ptr pqMask : count(MAX_QUADS), Debug(printf("Pivoting on %c\n", i2ch(achByFrequency[iLetter]));) - // Manually Hoisted Check, (including path condition) from first iteration of the loop. - _Dynamic_check(ppwStart != NULL); - _Dynamic_check(ppwStart < ppwEnd && ppwEnd <= (apwCand+MAXCAND)); - while (ppwStart < ppwEnd) { /* Half of the program execution */ pw = *ppwStart; /* time is spent in these three */ @@ -591,10 +565,10 @@ void FindAnagram(_Array_ptr pqMask : count(MAX_QUADS), /* The recursive call scrambles the tail, so we have to be * pessimistic. */ - _Unchecked { ppwEnd = &apwCand[0]; } + ppwEnd = &apwCand[0]; ppwEnd += cpwCand; - _Unchecked { FindAnagram(&aqNext[0], - ppwStart, iLetter); } + FindAnagram(&aqNext[0], + ppwStart, iLetter); } else DumpWords(); /* found one */ cchPhraseLength += pw->cchLength; --cpwLast; @@ -605,9 +579,7 @@ void FindAnagram(_Array_ptr pqMask : count(MAX_QUADS), ; } -int Cdecl CompareFrequency(_Ptr ch1, _Ptr ch2) { - _Ptr pch1 = (_Ptr)ch1; - _Ptr pch2 = (_Ptr)ch2; +int Cdecl CompareFrequency(char *pch1, char *pch2) { if (auGlobalFrequency[*pch1] < auGlobalFrequency[*pch2]) return -1; if (auGlobalFrequency[*pch1] > auGlobalFrequency[*pch2]) @@ -625,33 +597,32 @@ void SortCandidates(void) { /* Sort the letters by frequency */ for (i = 0; i < ALPHABET; i++) achByFrequency[i] = i; qsort(achByFrequency, ALPHABET, sizeof(char), - CompareFrequency); + (int (*)(const void *, const void *))CompareFrequency); fprintf(stderr, "Order of search will be "); - for (i = 0; i < ALPHABET; i++) { - char val = i2ch(achByFrequency[i]); - fputc(val, stderr); - } + for (i = 0; i < ALPHABET; i++) + fputc(i2ch(achByFrequency[i]), stderr); fputc('\n', stderr); } int fInteractive; -_Array_ptr GetPhrase(_Array_ptr pch : count(size), int size) - : count(size) { +char * GetPhrase(char * pch, int size) { if (fInteractive) printf(">"); fflush(stdout); - _Unchecked { if (fgets(pch, size, stdin) == NULL) _Checked { + if (fgets(pch, size, stdin) == NULL) { #ifdef PLUS_STATS PrintDerefStats(stderr); PrintHeapSize(stderr); #endif /* PLUS_STATS */ exit(0); - } } + } return(pch); } -int Cdecl main(int cpchArgc, _Array_ptr<_Nt_array_ptr> ppchArgv : count(cpchArgc)) { +char achPhrase[255]; + +int Cdecl main(int cpchArgc, char **ppchArgv) { if (cpchArgc != 2 && cpchArgc != 3) Fatal("Usage: anagram dictionary [length]\n", 0); @@ -665,21 +636,20 @@ int Cdecl main(int cpchArgc, _Array_ptr<_Nt_array_ptr> ppchArgv : count(cp while (GetPhrase(&achPhrase[0], sizeof(achPhrase)) != NULL) { if (isdigit(achPhrase[0])) { - _Unchecked { cchMinLength = atoi((_Nt_array_ptr)achPhrase); } + cchMinLength = atoi(achPhrase); printf("New length: %d\n", cchMinLength); } else if (achPhrase[0] == '?') { DumpCandidates(); } else { BuildMask(&achPhrase[0]); AddWords(); - if (cpwCand == 0 || cchPhraseLength == 0) continue; Stat(ulHighCount = ulLowCount = 0;) cpwLast = 0; SortCandidates(); - _Unchecked{ if (setjmp(jbAnagram) == 0) - FindAnagram(&aqMainMask[0], &apwCand[0], 0); } + if (setjmp(jbAnagram) == 0) + FindAnagram(&aqMainMask[0], &apwCand[0], 0); Stat(printf("%lu:%lu probes\n", ulHighCount, ulLowCount);) } } diff --git a/MultiSource/Benchmarks/Ptrdist/ft/Fheap.c b/MultiSource/Benchmarks/Ptrdist/ft/Fheap.c index 227cd3069..46df8bb12 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/Fheap.c +++ b/MultiSource/Benchmarks/Ptrdist/ft/Fheap.c @@ -42,25 +42,23 @@ #include "Fheap.h" #include "Fstruct.h" -#pragma CHECKED_SCOPE ON - #ifdef DO_INLINE #define INLINE inline #else #define INLINE #endif -static _Ptr hTable _Checked[MAX_RANK]; +static HeapP * hTable[MAX_RANK]; -void CombineLists(_Ptr , _Ptr ); -void AddEntry(_Ptr , _Ptr ); -_Ptr RemoveEntry(_Ptr ); -_Ptr NewHeap(_Ptr ); -void RemoveChild(_Ptr ); -void FixRank(_Ptr , int); +void CombineLists(HeapP *, HeapP *); +void AddEntry(HeapP *, HeapP *); +HeapP * RemoveEntry(HeapP *); +HeapP * NewHeap(Item *); +void RemoveChild(HeapP *); +void FixRank(HeapP *, int); INLINE void -InitFHeap(void) +InitFHeap() { int j; @@ -70,14 +68,14 @@ InitFHeap(void) } } -INLINE _Ptr -MakeHeap(void) +INLINE HeapP * +MakeHeap() { return(NULL); } -INLINE _Ptr -FindMin(_Ptr h) +INLINE Item * +FindMin(HeapP * h) { if(h == NULL) { @@ -89,18 +87,18 @@ FindMin(_Ptr h) } } -INLINE _Ptr -Insert(_Ptr<_Ptr> h, _Ptr i) +INLINE HeapP * +Insert(HeapP * * h, Item * i) { - _Ptr h1 = 0; + HeapP * h1; h1 = NewHeap(i); *h = Meld(*h, h1); return(h1); } -INLINE _Ptr -Meld(_Ptr h1, _Ptr h2) +INLINE HeapP * +Meld(HeapP * h1, HeapP * h2) { if(h2 == NULL) { @@ -124,14 +122,14 @@ Meld(_Ptr h1, _Ptr h2) /* * This function needs some aesthetic changes. */ -INLINE _Ptr -DeleteMin(_Ptr h) +INLINE HeapP * +DeleteMin(HeapP * h) { int r, rMax, j; - _Ptr h1 = 0; - _Ptr h2 = 0; - _Ptr h3 = 0; - _Ptr min = 0; + HeapP * h1; + HeapP * h2; + HeapP * h3; + HeapP * min; rMax = 0; @@ -144,7 +142,7 @@ DeleteMin(_Ptr h) if(h1 == NULL) { - free(h); + free(h); return(NULL); } @@ -170,7 +168,6 @@ DeleteMin(_Ptr h) r = RANK(h2); assert(r < MAX_RANK); - while(hTable[r] != NULL) { if(LessThan(ITEM(hTable[r]), ITEM(h2))) @@ -266,13 +263,13 @@ DeleteMin(_Ptr h) } } - free(h); + free(h); return(min); } -INLINE _Ptr -DecreaseKey(_Ptr h, _Ptr i, int delta) +INLINE HeapP * +DecreaseKey(HeapP * h, HeapP * i, int delta) { assert(h != NULL); assert(i != NULL); @@ -297,9 +294,9 @@ DecreaseKey(_Ptr h, _Ptr i, int delta) * Note: i must have a parent (;-). */ INLINE void -RemoveChild(_Ptr i) +RemoveChild(HeapP * i) { - _Ptr parent = 0; + HeapP * parent; assert(i != NULL); @@ -327,7 +324,7 @@ RemoveChild(_Ptr i) } INLINE void -FixRank(_Ptr h, int delta) +FixRank(HeapP * h, int delta) { assert(h != NULL); assert(delta > 0); @@ -340,11 +337,11 @@ FixRank(_Ptr h, int delta) while(h != NULL); } -INLINE _Ptr -Delete(_Ptr h, _Ptr i) +INLINE HeapP * +Delete(HeapP * h, HeapP * i) { - _Ptr h1 = 0; - _Ptr h2 = 0; + HeapP * h1; + HeapP * h2; assert(h != NULL); assert(i != NULL); @@ -388,7 +385,7 @@ Delete(_Ptr h, _Ptr i) while(h1 != CHILD(i)); } - free(i); + free(i); return(h); } @@ -406,9 +403,9 @@ Delete(_Ptr h, _Ptr i) * none */ INLINE void -CombineLists(_Ptr h1, _Ptr h2) +CombineLists(HeapP * h1, HeapP * h2) { - _Ptr h = 0; + HeapP * h; assert((h1 != NULL) && (h2 != NULL)); @@ -435,7 +432,7 @@ CombineLists(_Ptr h1, _Ptr h2) * h1 with h2 as new child of h1. */ INLINE void -AddEntry(_Ptr h1, _Ptr h2) +AddEntry(HeapP * h1, HeapP * h2) { assert((h1 != NULL) && (h2 != NULL)); @@ -465,8 +462,8 @@ AddEntry(_Ptr h1, _Ptr h2) * Return values: * a smaller heap, possibly NULL */ -INLINE _Ptr -RemoveEntry(_Ptr h) +INLINE HeapP * +RemoveEntry(HeapP * h) { assert(h != NULL); @@ -494,12 +491,12 @@ RemoveEntry(_Ptr h) * Return values: * a single entry heap */ -INLINE _Ptr -NewHeap(_Ptr i) +INLINE HeapP * +NewHeap(Item * i) { - _Ptr h = 0; + HeapP * h; - h = calloc(1, sizeof(HeapP)); + h = (HeapP *)malloc(sizeof(HeapP)); if(h == NULL) { @@ -517,17 +514,17 @@ NewHeap(_Ptr i) return(h); } -INLINE _Ptr -ItemOf(_Ptr h) +INLINE Item * +ItemOf(HeapP * h) { return(ITEM(h)); } -INLINE _Ptr -Find(_Ptr h, _Ptr item) +INLINE HeapP * +Find(HeapP * h, Item * item) { - _Ptr h1 = 0; - _Ptr h2 = 0; + HeapP * h1; + HeapP * h2; if(h == NULL) { diff --git a/MultiSource/Benchmarks/Ptrdist/ft/Fheap.h b/MultiSource/Benchmarks/Ptrdist/ft/Fheap.h index ce9f7345d..226f0d3cf 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/Fheap.h +++ b/MultiSource/Benchmarks/Ptrdist/ft/Fheap.h @@ -51,19 +51,14 @@ */ #include "item.h" -#pragma CHECKED_SCOPE ON - -#define printf(...) _Unchecked { printf(__VA_ARGS__); } -#define fprintf(...) _Unchecked { fprintf(__VA_ARGS__); } - typedef struct _Heap { - _Ptr item; + Item * item; - _Ptr parent; - _Ptr child; - _Ptr forward; - _Ptr backward; + struct _Heap * parent; + struct _Heap * child; + struct _Heap * forward; + struct _Heap * backward; int rank; short marked; } HeapP; @@ -83,7 +78,7 @@ typedef struct _Heap * Return values: * none */ -void InitFHeap(void); +void InitFHeap(); /* * Create a heap structure. @@ -97,7 +92,7 @@ void InitFHeap(void); * Return values: * a heap, to be precise an empty, i.e. NULL_HEAP */ -_Ptr MakeHeap(void); +HeapP * MakeHeap(); /* * Find the item with lowest key. @@ -112,7 +107,7 @@ _Ptr MakeHeap(void); * an item if the heap is not empty * NULL_ITEM otherwise */ -_Ptr FindMin(_Ptr h); +Item * FindMin(HeapP * h); /* * Insert an item in a heap. @@ -128,7 +123,7 @@ _Ptr FindMin(_Ptr h); * a handle to the inserted item, useful in connection with Delete() * and DecreaseKey(). */ -_Ptr Insert(_Ptr<_Ptr> h, _Ptr i); +HeapP * Insert(HeapP * * h, Item * i); /* * Meld to heaps. @@ -142,7 +137,7 @@ _Ptr Insert(_Ptr<_Ptr> h, _Ptr i); * Return values: * a bigger heap, possibly NULL_HEAP */ -_Ptr Meld(_Ptr h1, _Ptr h2); +HeapP * Meld(HeapP * h1, HeapP * h2); /* * Remove the smallest item in a heap @@ -156,7 +151,7 @@ _Ptr Meld(_Ptr h1, _Ptr h2); * Return values: * a smaller heap, possibly NULL_HEAP */ -_Ptr DeleteMin(_Ptr h); +HeapP * DeleteMin(HeapP * h); /* * Decrease the key of an item in a heap. @@ -174,7 +169,7 @@ _Ptr DeleteMin(_Ptr h); * Return values: * a heap, possibly NULL_HEAP */ -_Ptr DecreaseKey(_Ptr h, _Ptr i, int delta); +HeapP * DecreaseKey(HeapP * h, HeapP * i, int delta); /* * Delete an entry in a heap. @@ -190,7 +185,7 @@ _Ptr DecreaseKey(_Ptr h, _Ptr i, int delta); * Return values: * a smaller heap, possibly NULL_HEAP */ -_Ptr Delete(_Ptr h, _Ptr i); +HeapP * Delete(HeapP * h, HeapP * i); /* * Search for an item with a particular key in a heap. @@ -207,7 +202,7 @@ _Ptr Delete(_Ptr h, _Ptr i); * Return values: * an handle to the item, possibly NULL_HEAP */ -_Ptr Find(_Ptr h, _Ptr item); +HeapP * Find(HeapP * h, Item * item); /* * Converts a item handle into an item pointer. @@ -221,8 +216,6 @@ _Ptr Find(_Ptr h, _Ptr item); * Return values: * an pointer to the item */ -_Ptr ItemOf(_Ptr h); - -#pragma CHECKED_SCOPE OFF +Item * ItemOf(HeapP * h); #endif diff --git a/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.c b/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.c index a40c80849..c69cebc81 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.c +++ b/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.c @@ -32,12 +32,10 @@ #include "Fheap.h" #include "Fstruct.h" -#pragma CHECKED_SCOPE ON - int -SanityCheck1(_Ptr h, _Ptr i) +SanityCheck1(HeapP * h, Item * i) { - _Ptr h1 = 0; + HeapP * h1; if(h == NULL_HEAP) { @@ -64,11 +62,11 @@ SanityCheck1(_Ptr h, _Ptr i) } int -SanityCheck2(_Ptr h) +SanityCheck2(HeapP * h) { int sum; - _Ptr h1 = 0; - _Ptr h2 = 0; + HeapP * h1; + HeapP * h2; if(h == NULL_HEAP) { @@ -108,11 +106,11 @@ SanityCheck2(_Ptr h) } int -SanityCheck3(_Ptr h, int rank) +SanityCheck3(HeapP * h, int rank) { int sum; - _Ptr h1 = 0; - _Ptr h2 = 0; + HeapP * h1; + HeapP * h2; if((h == NULL_HEAP) && (rank == 0)) { @@ -145,9 +143,9 @@ SanityCheck3(_Ptr h, int rank) } void -PrettyPrint(_Ptr h) +PrettyPrint(HeapP * h) { - _Ptr h1 = 0; + HeapP * h1; if(h == NULL_HEAP) { @@ -170,4 +168,3 @@ PrettyPrint(_Ptr h) printf(")"); } -#pragma CHECKED_SCOPE OFF diff --git a/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.h b/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.h index 9682d432d..39f7b37ad 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.h +++ b/MultiSource/Benchmarks/Ptrdist/ft/Fsanity.h @@ -31,8 +31,6 @@ #ifndef _fsanity_h #define _fsanity_h -#pragma CHECKED_SCOPE ON - /* * Check the entry ordering in the structure. * @@ -49,7 +47,7 @@ * FALSE: check failed * TRUE: check succeeded */ -int SanityCheck1(_Ptr h, _Ptr i); +int SanityCheck1(Heap * h, Item * i); /* * Check the rank fields in the structure. @@ -64,7 +62,7 @@ int SanityCheck1(_Ptr h, _Ptr i); * FALSE: check failed * TRUE: check succeeded */ -int SanityCheck2(_Ptr h); +int SanityCheck2(Heap * h); /* * Check the rank fields in the structure. @@ -82,7 +80,7 @@ int SanityCheck2(_Ptr h); * FALSE: check failed * TRUE: check succeeded */ -int SanityCheck3(_Ptr h, int rank); +int SanityCheck3(Heap * h, int rank); /* * Print the structure in some human readable form. It is printed in a @@ -98,8 +96,6 @@ int SanityCheck3(_Ptr h, int rank); * Return values: * none */ -void PrettyPrint(_Ptr h); - -#pragma CHECKED_SCOPE OFF +void PrettyPrint(Heap * h); #endif diff --git a/MultiSource/Benchmarks/Ptrdist/ft/Fstruct.h b/MultiSource/Benchmarks/Ptrdist/ft/Fstruct.h index f1ae8637f..43074a74c 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/Fstruct.h +++ b/MultiSource/Benchmarks/Ptrdist/ft/Fstruct.h @@ -39,8 +39,6 @@ #ifndef _fstruct_h #define _fstruct_h -#pragma CHECKED_SCOPE ON - #define ITEM(P) ((*(P)).item) #define PARENT(P) ((*(P)).parent) #define CHILD(P) ((*(P)).child) @@ -57,6 +55,4 @@ #define FALSE 0 #define MAX_RANK 10000 -#pragma CHECKED_SCOPE OFF - #endif diff --git a/MultiSource/Benchmarks/Ptrdist/ft/ft.c b/MultiSource/Benchmarks/Ptrdist/ft/ft.c index 0c387d78d..0cb047993 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/ft.c +++ b/MultiSource/Benchmarks/Ptrdist/ft/ft.c @@ -44,8 +44,6 @@ #include "Fheap.h" #include "graph.h" -#pragma CHECKED_SCOPE ON - #define MINUS_INFINITY INT_MIN #define PLUS_INFINITY INT_MAX @@ -59,8 +57,8 @@ /* * Local functions. */ -void PrintMST(_Ptr graph); -_Ptr MST(_Ptr graph); +void PrintMST(Vertices * graph); +Vertices * MST(Vertices * graph); /* * Local variables. @@ -68,11 +66,11 @@ _Ptr MST(_Ptr graph); int debug = 1; int -main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc) ) +main(int argc, char *argv[]) { int nVertex; int nEdge; - _Ptr graph = 0; + Vertices * graph; nVertex = DEFAULT_N_VERTEX; nEdge = DEFAULT_N_EDGE; @@ -124,12 +122,12 @@ main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc) ) return 0; } -_Ptr -MST(_Ptr graph) +Vertices * +MST(Vertices * graph) { - _Ptr heap = 0; - _Ptr vertex = 0; - _Ptr edge = 0; + HeapP * heap; + Vertices * vertex; + Edges * edge; ; InitFHeap(); @@ -144,7 +142,7 @@ MST(_Ptr graph) vertex = graph; KEY(vertex) = 0; heap = MakeHeap(); - (void)Insert(&heap, vertex); + (void)Insert(&heap, (Item *)vertex); vertex = NEXT_VERTEX(vertex); while(vertex != graph) @@ -177,9 +175,9 @@ MST(_Ptr graph) } void -PrintMST(_Ptr graph) +PrintMST(Vertices * graph) { - _Ptr vertex = 0; + Vertices * vertex; assert(graph != NULL_VERTEX); diff --git a/MultiSource/Benchmarks/Ptrdist/ft/graph.c b/MultiSource/Benchmarks/Ptrdist/ft/graph.c index 8a24e4733..de686d1ca 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/graph.c +++ b/MultiSource/Benchmarks/Ptrdist/ft/graph.c @@ -33,8 +33,6 @@ #include #include "graph.h" -#pragma CHECKED_SCOPE ON - #define TRUE 1 #define FALSE 0 @@ -52,14 +50,14 @@ static int generatedEdges; /* * Local functions. */ -_Ptr GenTree(int vertex); -_Ptr AddEdges(_Ptr graph, int nVertex, int nEdge); -_Ptr PickVertex(_Ptr graph, int whichVertex); -void Connect(_Ptr vertex1, _Ptr vertex2); -int Duplicate(_Ptr vertex1, _Ptr vertex2); -_Ptr NewVertex(void); -_Ptr NewEdge(void); -void PrintNeighbors(_Ptr vertex); +Vertices * GenTree(int vertex); +Vertices * AddEdges(Vertices * graph, int nVertex, int nEdge); +Vertices * PickVertex(Vertices * graph, int whichVertex); +void Connect(Vertices * vertex1, Vertices * vertex2); +int Duplicate(Vertices * vertex1, Vertices * vertex2); +Vertices * NewVertex(); +Edges * NewEdge(); +void PrintNeighbors(Vertices * vertex); /* * Local variables. @@ -73,10 +71,10 @@ static id = 1; * Apparently a good reference is Tinhofer G., , * C. Hanser, Verlag, M\"{u}nchen 1980. */ -_Ptr +Vertices * GenGraph(int nVertex, int nEdge) { - _Ptr graph = 0; + Vertices * graph; assert(nEdge + 1 >= nVertex); assert(nEdge <= nVertex * (nVertex - 1) / 2); @@ -88,14 +86,14 @@ GenGraph(int nVertex, int nEdge) return(graph); } -_Ptr +Vertices * GenTree(int nVertex) { int i; int weight; - _Ptr vertex = 0; - _Ptr graph = 0; - _Ptr edge = 0; + Vertices * vertex; + Vertices * graph; + Edges * edge; graph = NewVertex(); NEXT_VERTEX(graph) = graph; @@ -139,12 +137,12 @@ GenTree(int nVertex) return(graph); } -_Ptr -AddEdges(_Ptr graph, int nVertex, int nEdge) +Vertices * +AddEdges(Vertices * graph, int nVertex, int nEdge) { int i; - _Ptr vertex1 = 0; - _Ptr vertex2 = 0; + Vertices * vertex1; + Vertices * vertex2; assert(graph != NULL_VERTEX); assert(nEdge >= 0); @@ -165,8 +163,8 @@ AddEdges(_Ptr graph, int nVertex, int nEdge) return(graph); } -_Ptr -PickVertex(_Ptr graph, int whichVertex) +Vertices * +PickVertex(Vertices * graph, int whichVertex) { int i; @@ -179,10 +177,10 @@ PickVertex(_Ptr graph, int whichVertex) } void -Connect(_Ptr vertex1, _Ptr vertex2) +Connect(Vertices * vertex1, Vertices * vertex2) { int weight; - _Ptr edge = 0; + Edges * edge; weight = GET_WEIGHT; @@ -202,9 +200,9 @@ Connect(_Ptr vertex1, _Ptr vertex2) } int -Duplicate(_Ptr vertex1, _Ptr vertex2) +Duplicate(Vertices * vertex1, Vertices * vertex2) { - _Ptr edge = 0; + Edges * edge; edge = EDGES(vertex1); @@ -221,12 +219,12 @@ Duplicate(_Ptr vertex1, _Ptr vertex2) return(FALSE); } -_Ptr -NewVertex(void) +Vertices * +NewVertex() { - _Ptr vertex = 0; + Vertices * vertex; - vertex = calloc(1, sizeof(Vertices)); + vertex = (Vertices *)malloc(sizeof(Vertices)); if(vertex == NULL) { @@ -241,12 +239,12 @@ NewVertex(void) return(vertex); } -_Ptr -NewEdge(void) +Edges * +NewEdge() { - _Ptr edge = 0; + Edges * edge; - edge = calloc(1, sizeof(Edges)); + edge = (Edges *)malloc(sizeof(Edges)); if(edge == NULL) { @@ -262,9 +260,9 @@ NewEdge(void) } void -PrintGraph(_Ptr graph) +PrintGraph(Vertices * graph) { - _Ptr vertex = 0; + Vertices * vertex; assert(graph != NULL); @@ -280,9 +278,9 @@ PrintGraph(_Ptr graph) } void -PrintNeighbors(_Ptr vertex) +PrintNeighbors(Vertices * vertex) { - _Ptr edge = 0; + Edges * edge; edge = EDGES(vertex); while(edge != NULL) diff --git a/MultiSource/Benchmarks/Ptrdist/ft/graph.h b/MultiSource/Benchmarks/Ptrdist/ft/graph.h index b02d0be11..e45fd9c0a 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/graph.h +++ b/MultiSource/Benchmarks/Ptrdist/ft/graph.h @@ -31,33 +31,28 @@ #ifndef _graph_h #define _graph_h -#pragma CHECKED_SCOPE ON - -#define printf(...) _Unchecked { printf(__VA_ARGS__); } -#define fprintf(...) _Unchecked { fprintf(__VA_ARGS__); } - struct _Vertices; typedef struct _Edges { int weight; - _Ptr source; - _Ptr vertex; - _Ptr next; + struct _Vertices * source; + struct _Vertices * vertex; + struct _Edges * next; } Edges; typedef struct _Vertices { int id; - _Ptr edges; - _Ptr next; + Edges * edges; + struct _Vertices * next; /* * For the ft algorithm. */ int key; - _Ptr chosenEdge; + Edges * chosenEdge; } Vertices; #define NULL_EDGE ((void *) 0) @@ -77,9 +72,7 @@ typedef struct _Vertices #define KEY(V) ((*(V)).key) #define CHOSEN_EDGE(V) ((*(V)).chosenEdge) -_Ptr GenGraph(int nVertex, int nEdge); -void PrintGraph(_Ptr graph); - -#pragma CHECKED_SCOPE OFF +Vertices * GenGraph(int nVertex, int nEdge); +void PrintGraph(Vertices * graph); #endif diff --git a/MultiSource/Benchmarks/Ptrdist/ft/item.c b/MultiSource/Benchmarks/Ptrdist/ft/item.c index 630cab7cd..a6ddda42a 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/item.c +++ b/MultiSource/Benchmarks/Ptrdist/ft/item.c @@ -34,19 +34,17 @@ #include "item.h" -#pragma CHECKED_SCOPE ON - -int LessThan(_Ptr item1, _Ptr item2) +int LessThan(Item * item1, Item * item2) { return(KEY(item1) < KEY(item2)); } -int Equal(_Ptr item1, _Ptr item2) +int Equal(Item * item1, Item * item2) { return(KEY(item1) == KEY(item2)); } -_Ptr Subtract(_Ptr item, int delta) +Item * Subtract(Item * item, int delta) { assert(delta > 0); diff --git a/MultiSource/Benchmarks/Ptrdist/ft/item.h b/MultiSource/Benchmarks/Ptrdist/ft/item.h index 398b9a095..fe663dcd5 100644 --- a/MultiSource/Benchmarks/Ptrdist/ft/item.h +++ b/MultiSource/Benchmarks/Ptrdist/ft/item.h @@ -33,16 +33,12 @@ #include "graph.h" -#pragma CHECKED_SCOPE ON - typedef Vertices Item; #define NULL_ITEM NULL_VERTEX -int LessThan(_Ptr , _Ptr ); -int Equal(_Ptr , _Ptr ); -_Ptr Subtract(_Ptr , int); - -#pragma CHECKED_SCOPE OFF +int LessThan(Item *, Item *); +int Equal(Item *, Item *); +Item * Subtract(Item *, int); #endif diff --git a/MultiSource/Benchmarks/Ptrdist/ks/KS-1.c b/MultiSource/Benchmarks/Ptrdist/ks/KS-1.c index 045937c98..5c109b97a 100644 --- a/MultiSource/Benchmarks/Ptrdist/ks/KS-1.c +++ b/MultiSource/Benchmarks/Ptrdist/ks/KS-1.c @@ -15,41 +15,40 @@ #include "KS.h" -#pragma CHECKED_SCOPE ON - -NetPtr modules _Checked [G_SZ]; /* all modules -> nets */ +NetPtr modules[G_SZ]; /* all modules -> nets */ unsigned long numModules; -ModulePtr nets _Checked [G_SZ]; /* all nets -> modules */ +ModulePtr nets[G_SZ]; /* all nets -> modules */ unsigned long numNets; ModuleList groupA, groupB; /* current A, B */ ModuleList swapToA, swapToB; /* swapped from A,B, ordered */ -float GP _Checked [G_SZ]; /* GPs, ordered */ +float GP[G_SZ]; /* GPs, ordered */ -Groups moduleToGroup _Checked [G_SZ]; /* current inverse mapping */ -float D _Checked [G_SZ]; /* module costs */ -float cost _Checked [G_SZ]; /* net costs */ +Groups moduleToGroup[G_SZ]; /* current inverse mapping */ +float D[G_SZ]; /* module costs */ +float cost[G_SZ]; /* net costs */ /* read the netlist into the nets[] structure */ void -ReadNetList(_Nt_array_ptr fname) +ReadNetList(char *fname) { - _Ptr inFile = 0; - char line _Nt_checked[BUF_LEN + 1] = { 0 }; + FILE *inFile; + char line[BUF_LEN]; + char *tok; unsigned long net, dest; - ModulePtr node = 0, prev = 0, head = 0; + ModulePtr node, prev, head; TRY(inFile = fopen(fname, "r"), inFile != NULL, "ReadData", - "unable to open input file [%s]", fname, 0, 0, + "unable to open input file [%s]", inFile, 0, 0, exit(1)); - _Unchecked { TRY(fgets(line, BUF_LEN, inFile), - sscanf((const char*)line, "%lu %lu", &numNets, &numModules) == 2, "ReadData", - "unable to parse header in file [%s]", fname, 0, 0, - exit(1)); } + TRY(fgets(line, BUF_LEN, inFile), + sscanf(line, "%lu %lu", &numNets, &numModules) == 2, "ReadData", + "unable to parse header in file [%s]", inFile, 0, 0, + exit(1)); for (net = 0; net < numNets; net++) { fgets(line, BUF_LEN, inFile); @@ -58,15 +57,14 @@ ReadNetList(_Nt_array_ptr fname) dest = atol(strtok(line, " \t\n"))-1; /* parse out all the net module connections */ - TRY(head = prev = calloc(1, sizeof(Module)), + TRY(head = prev = (Module *)malloc(sizeof(Module)), prev != NULL, "ReadData", "unable to allocate a module list node", 0, 0, 0, exit(1)); (*prev).module = atol(strtok(NULL, " \t\n"))-1; (*prev).next = NULL; - _Nt_array_ptr tok = NULL; while ((tok = strtok(NULL, " \t\n")) != NULL) { - TRY(node = calloc(1, sizeof(Module)), + TRY(node = (Module *)malloc(sizeof(Module)), node != NULL, "ReadData", "unable to allocate a module list node", 0, 0, 0, exit(1)); @@ -84,15 +82,15 @@ void NetsToModules(void) { unsigned long net, mod; - ModulePtr modNode = 0; - NetPtr netNode = 0; + ModulePtr modNode; + NetPtr netNode; for (mod = 0; mod(1, sizeof(Net)), + TRY(netNode = (Net *)malloc(sizeof(Net)), netNode != NULL, "NetsToModules", "unable to allocate net list node", 0, 0, 0, exit(1)); @@ -132,7 +130,7 @@ void InitLists(void) { unsigned long p; - ModuleRecPtr mr = 0; + ModuleRecPtr mr; groupA.head = groupA.tail = NULL; groupB.head = groupB.tail = NULL; @@ -141,7 +139,7 @@ InitLists(void) for (p = 0; p(1, sizeof(ModuleRec)), + TRY(mr = (ModuleRec *)malloc(sizeof(ModuleRec)), mr != NULL, "main", "unable to allocate ModuleRec", 0, 0, 0, exit(1)); @@ -160,7 +158,7 @@ InitLists(void) moduleToGroup[p] = GroupA; /* build the group B module list */ - TRY(mr = calloc(1, sizeof(ModuleRec));, + TRY(mr = (ModuleRec *)malloc(sizeof(ModuleRec)), mr != NULL, "main", "unable to allocate ModuleRec", 0, 0, 0, exit(1)); @@ -191,11 +189,11 @@ ComputeDs(ModuleListPtr group, Groups myGroup, Groups mySwap) { #ifdef KS_MODE - NetPtr netNode = 0; - ModulePtr modNode = 0; - ModuleRecPtr groupNode = 0; + NetPtr netNode; + ModulePtr modNode; + ModuleRecPtr groupNode; unsigned long numInG, numInNet; - ModulePtr oneInG = 0; + ModulePtr oneInG; /* for all modules in group */ for (groupNode = (*group).head; @@ -236,9 +234,9 @@ ComputeDs(ModuleListPtr group, Groups myGroup, Groups mySwap) float I, E; - NetPtr netNode = 0; - ModulePtr modNode = 0; - ModuleRecPtr groupNode = 0; + NetPtr netNode; + ModulePtr modNode; + ModuleRecPtr groupNode; /* for all modules in group */ for (groupNode = (*group).head; diff --git a/MultiSource/Benchmarks/Ptrdist/ks/KS-2.c b/MultiSource/Benchmarks/Ptrdist/ks/KS-2.c index 04e05ea6e..ab5d846dc 100644 --- a/MultiSource/Benchmarks/Ptrdist/ks/KS-2.c +++ b/MultiSource/Benchmarks/Ptrdist/ks/KS-2.c @@ -15,14 +15,12 @@ #include "KS.h" -#pragma CHECKED_SCOPE ON - /* handle special cases where both nodes are switched */ float CAiBj(ModuleRecPtr mrA, ModuleRecPtr mrB) { - NetPtr netNode = 0; - ModulePtr modNode = 0; + NetPtr netNode; + ModulePtr modNode; float gain = 0.0; float netCost; unsigned long module = (*mrB).module; @@ -86,8 +84,8 @@ SwapNode(ModuleRecPtr maxPrev, ModuleRecPtr max, void UpdateDs(ModuleRecPtr max, Groups group) { - NetPtr net = 0; - ModulePtr mod = 0; + NetPtr net; + ModulePtr mod; /* for all nets this is connected to */ for (net = modules[(*max).module]; net != NULL; net = (*net).next) { @@ -107,10 +105,10 @@ UpdateDs(ModuleRecPtr max, Groups group) /* find the best swap available and do it */ float -FindMaxGpAndSwap(void) +FindMaxGpAndSwap() { - ModuleRecPtr mrA = 0, mrPrevA = 0, mrB = 0, mrPrevB = 0; - ModuleRecPtr maxA = 0, maxPrevA = 0, maxB = 0, maxPrevB = 0; + ModuleRecPtr mrA, mrPrevA, mrB, mrPrevB; + ModuleRecPtr maxA, maxPrevA, maxB, maxPrevB; float gp, gpMax; gpMax = -9999999; @@ -138,9 +136,9 @@ FindMaxGpAndSwap(void) /* swap the nodes out, into the swap lists */ assert(maxA != NULL); - _Unchecked { SwapNode(maxPrevA, maxA, &(groupA), &(swapToB)); } + SwapNode(maxPrevA, maxA, &(groupA), &(swapToB)); assert(maxB != NULL); - _Unchecked { SwapNode(maxPrevB, maxB, &(groupB), &(swapToA)); } + SwapNode(maxPrevB, maxB, &(groupB), &(swapToA)); /* update the inverse mapping, these two node are now gone */ @@ -161,7 +159,7 @@ FindMaxGpAndSwap(void) /* find the best point, during the last numModules/2 swaps */ float -FindGMax(_Ptr iMax) +FindGMax(unsigned long * iMax) { int i; float gMax; @@ -182,7 +180,7 @@ void SwapSubsetAndReset(unsigned long iMax) { unsigned long i; - ModuleRecPtr mrPrevA = 0, mrA = 0, mrPrevB = 0, mrB = 0; + ModuleRecPtr mrPrevA, mrA, mrPrevB, mrB; /* re-splice the lists @ iMax pointers into the lists */ for (mrPrevA = NULL, mrA = swapToA.head, @@ -227,16 +225,16 @@ struct { unsigned long total; unsigned long edgesCut; unsigned long netsCut; -} netStats _Checked [256]; +} netStats[256]; long maxStat; /* print the current groups, and their edge and net cut counts */ void PrintResults(int verbose) { - ModuleRecPtr mr = 0; - NetPtr nn = 0; - ModulePtr mn = 0; + ModuleRecPtr mr; + NetPtr nn; + ModulePtr mn; unsigned long cuts; Groups grp; int i, netSz; @@ -326,11 +324,11 @@ PrintResults(int verbose) } int -main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)) +main(int argc, char **argv) { unsigned long p, iMax; float gMax, lastGMax; - ModuleRecPtr mr = 0; + ModuleRecPtr mr; ; /* parse argument */ @@ -341,9 +339,9 @@ main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)) } /* prepare the data structures */ - ReadNetList(argv[1]); - NetsToModules(); - ComputeNetCosts(); + ReadNetList(argv[1]); + NetsToModules(); + ComputeNetCosts(); assert((numModules % 2) == 0); @@ -356,8 +354,8 @@ main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)) #ifndef KS_MODE /* compute the swap costs */ - _Unchecked { ComputeDs(&(groupA), GroupA, SwappedToA); } - _Unchecked { ComputeDs(&(groupB), GroupB, SwappedToB); } + ComputeDs(&(groupA), GroupA, SwappedToA); + ComputeDs(&(groupB), GroupB, SwappedToB); #endif /* !KS_MODE */ /* for all pairs of nodes in A,B */ diff --git a/MultiSource/Benchmarks/Ptrdist/ks/KS.h b/MultiSource/Benchmarks/Ptrdist/ks/KS.h index e5068fed8..a480da22a 100644 --- a/MultiSource/Benchmarks/Ptrdist/ks/KS.h +++ b/MultiSource/Benchmarks/Ptrdist/ks/KS.h @@ -13,8 +13,6 @@ #include #include -#pragma CHECKED_SCOPE ON - /* * module configuration */ @@ -29,11 +27,9 @@ #define BUF_LEN 1024 /* maximum line length */ #define G_SZ 1024 /* maximum group size */ -#define fprintf(...) _Unchecked { fprintf(__VA_ARGS__); } - /* simple exception handler */ #define TRY(exp, accpt_tst, fn, fail_fmt, arg1, arg2, arg3, fail_action) { \ - exp; \ + (exp); \ if (!(accpt_tst)) { \ fprintf(stderr, "(%s:%s():%d): ", __FILE__, fn, __LINE__); \ fprintf(stderr, fail_fmt, arg1, arg2, arg3); \ @@ -47,47 +43,47 @@ */ /* modular view */ typedef struct _Net { - _Ptr next; + struct _Net * next; unsigned long net; } Net; -typedef _Ptr NetPtr; +typedef Net * NetPtr; -extern NetPtr modules _Checked [G_SZ]; /* all modules -> nets */ +extern NetPtr modules[G_SZ]; /* all modules -> nets */ extern unsigned long numModules; /* net-ular view */ typedef struct _Module { - _Ptr next; + struct _Module * next; unsigned long module; } Module; -typedef _Ptr ModulePtr; +typedef Module * ModulePtr; -extern ModulePtr nets _Checked [G_SZ]; /* all nets -> modules */ +extern ModulePtr nets[G_SZ]; /* all nets -> modules */ extern unsigned long numNets; typedef struct _ModuleRec { - _Ptr next; + struct _ModuleRec * next; unsigned long module; } ModuleRec; -typedef _Ptr ModuleRecPtr; +typedef ModuleRec * ModuleRecPtr; typedef struct _ModuleList { ModuleRecPtr head; ModuleRecPtr tail; } ModuleList; -typedef _Ptr ModuleListPtr; +typedef ModuleList * ModuleListPtr; extern ModuleList groupA, groupB; /* current A, B */ extern ModuleList swapToA, swapToB; /* swapped from A,B, ordered */ -extern float GP _Checked [G_SZ]; /* GPs, ordered */ +extern float GP[G_SZ]; /* GPs, ordered */ typedef enum { GroupA, GroupB, SwappedToA, SwappedToB } Groups; -extern Groups moduleToGroup _Checked [G_SZ]; /* current inverse mapping */ -extern float D _Checked [G_SZ]; /* module costs */ -extern float cost _Checked [G_SZ]; /* net costs */ +extern Groups moduleToGroup[G_SZ]; /* current inverse mapping */ +extern float D[G_SZ]; /* module costs */ +extern float cost[G_SZ]; /* net costs */ -void ReadNetList(_Nt_array_ptr fname); +void ReadNetList(char *fname); void NetsToModules(void); void ComputeNetCosts(void); void InitLists(void); @@ -96,9 +92,7 @@ float CAiBj(ModuleRecPtr mrA, ModuleRecPtr mrB); void SwapNode(ModuleRecPtr maxPrev, ModuleRecPtr max, ModuleListPtr group, ModuleListPtr swapTo); void UpdateDs(ModuleRecPtr max, Groups group); -float FindMaxGpAndSwap(void); +float FindMaxGpAndSwap(); void SwapSubsetAndReset(unsigned long iMax); void PrintResults(int verbose); -int main(int argc, _Array_ptr<_Nt_array_ptr> argv : count(argc)); - -#pragma CHECKED_SCOPE OFF +int main(int argc, char **argv); diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/assign.c b/MultiSource/Benchmarks/Ptrdist/yacr2/assign.c index 8f334dd0d..6b9c94d00 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/assign.c +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/assign.c @@ -23,8 +23,6 @@ #include "vcg.h" #include "hcg.h" -#pragma CHECKED_SCOPE ON -#define printf(...) _Unchecked { printf(__VA_ARGS__); } /* * @@ -40,22 +38,21 @@ AllocAssign(void) /* * Allocate cost matrix. */ - costMatrix = malloc((channelNets+1) * sizeof(struct costMatrixRow)); + costMatrix = (long * *)malloc((channelNets+1) * sizeof(long *)); for (net = 1; net <= channelNets; net++) { - costMatrix[net].len = channelTracks + 2, - costMatrix[net].row = malloc((channelTracks+2) * sizeof(long)); + costMatrix[net] = (long *)malloc((channelTracks+2) * sizeof(long)); } /* * Allocate structures associated with cost matrix. */ - tracksNotPref = malloc((channelTracks+2) * sizeof(ulong)); - tracksTopNotPref = malloc((channelTracks+2) * sizeof(ulong)); - tracksBotNotPref = malloc((channelTracks+2) * sizeof(ulong)); - tracksNoHCV = malloc((channelTracks+2) * sizeof(ulong)); - tracksAssign = malloc((channelTracks+2) * sizeof(ulong)); - netsAssign = malloc((channelNets+1) * sizeof(ulong)); - netsAssignCopy = malloc((channelNets+1) * sizeof(ulong)); + tracksNotPref = (ulong *)malloc((channelTracks+2) * sizeof(ulong)); + tracksTopNotPref = (ulong *)malloc((channelTracks+2) * sizeof(ulong)); + tracksBotNotPref = (ulong *)malloc((channelTracks+2) * sizeof(ulong)); + tracksNoHCV = (ulong *)malloc((channelTracks+2) * sizeof(ulong)); + tracksAssign = (ulong *)malloc((channelTracks+2) * sizeof(ulong)); + netsAssign = (ulong *)malloc((channelNets+1) * sizeof(ulong)); + netsAssignCopy = (ulong *)malloc((channelNets+1) * sizeof(ulong)); } void @@ -67,20 +64,20 @@ FreeAssign(void) * Free cost matrix. */ for (net = 1; net <= channelNets; net++) { - _Unchecked { free(costMatrix[net].row); } + free(costMatrix[net]); } - _Unchecked { free(costMatrix); } + free(costMatrix); /* * Free structures associated with cost matrix. */ - _Unchecked { free(tracksNotPref); } - _Unchecked { free(tracksTopNotPref); } - _Unchecked { free(tracksBotNotPref); } - _Unchecked { free(tracksNoHCV); } - _Unchecked { free(tracksAssign); } - _Unchecked { free(netsAssign); } - _Unchecked { free(netsAssignCopy); } + free(tracksNotPref); + free(tracksTopNotPref); + free(tracksBotNotPref); + free(tracksNoHCV); + free(tracksAssign); + free(netsAssign); + free(netsAssignCopy); } void @@ -133,7 +130,7 @@ MaxNetsAssign(void) #ifdef VERBOSE printf("density = %d\n", channelDensity); - printf("pivot = %d\n\n", channelDensityColumn); + printf("pivot = %d\n\n", channelDensityColumn); #endif /* @@ -315,8 +312,8 @@ LeftNetsAssign(void) } void -Assign(_Array_ptr VCG : count(channelNets + 1), - _Array_ptr assign : count(channelNets + 1), +Assign(nodeVCGType * VCG, + ulong * assign, ulong select) { long dist; @@ -327,7 +324,7 @@ Assign(_Array_ptr VCG : count(channelNets + 1), ulong vcv; long vcvDist; ulong vcvAssign; - _Array_ptr costNet : count(channelTracks + 2) = NULL; + long * costNet; ; #ifdef VERBOSE @@ -351,22 +348,22 @@ Assign(_Array_ptr VCG : count(channelNets + 1), IdealTrack(channelTracks, cardTopNotPref, cardBotNotPref, &ideal); #ifdef VERBOSE - printf("HCV's:\n"); + printf("HCV's:\n"); for (track = 1; track <= channelTracks; track++) { if (tracksNoHCV[track]) { printf("[%d] no hcv\n", track); } else { - printf("[%d] hcv\n", track); + printf("[%d] hcv\n", track); } } - printf("\n"); + printf("\n"); #endif /* * What tracks to consider for assign. */ - _Unchecked { costNet = costMatrix[select].row; } + costNet = costMatrix[select]; assert((select >= 1) && (select <= channelNets)); tracks = 0; for (track = 1; track <= channelTracks; track++) { @@ -510,16 +507,16 @@ Assign(_Array_ptr VCG : count(channelNets + 1), } void -Select(_Array_ptr VCG : count(channelNets + 1), - _Array_ptr HCG : count(channelNets + 1), - _Array_ptr netsAssign : count(channelNets + 1), - _Ptr netSelect, - _Array_ptr CROSSING : count(channelNets + 1)) +Select(nodeVCGType * VCG, + nodeHCGType * HCG, + ulong * netsAssign, + ulong * netSelect, + ulong * CROSSING) { ulong net; ulong track; ulong select; - _Array_ptr costNet : count(channelTracks + 2) = NULL; + long * costNet; long cost; long largest; @@ -537,7 +534,7 @@ Select(_Array_ptr VCG : count(channelNets + 1), for (net = 1; net <= channelNets; net++) { if (CROSSING[net]) { cost = 0; - _Unchecked { costNet = costMatrix[net].row; } + costNet = costMatrix[net]; for (track = 1; track <= channelTracks; track++) { cost += costNet[track]; } @@ -556,24 +553,24 @@ Select(_Array_ptr VCG : count(channelNets + 1), } void -BuildCostMatrix(_Array_ptr VCG : count(channelNets + 1), - _Array_ptr HCG : count(channelNets + 1), - _Array_ptr netsAssign : count(channelNets + 1), - _Array_ptr CROSSING : count(channelNets + 1)) +BuildCostMatrix(nodeVCGType * VCG, + nodeHCGType * HCG, + ulong * netsAssign, + ulong * CROSSING) { ulong net; ulong track; ulong ideal; long dist; long mult; - _Array_ptr costNet : count(channelTracks + 2) = NULL; + long * costNet; ; /* * Initialize cost matrix. */ for (net = 1; net <= channelNets; net++) { - _Unchecked { costNet = costMatrix[net].row; } + costNet = costMatrix[net]; for (track = 1; track <= channelTracks; track++) { costNet[track] = 0; } @@ -585,7 +582,7 @@ BuildCostMatrix(_Array_ptr VCG : count(channelNets + 1), * Compute one column in cost matrix. * That is, the cost associated with each track for some net. */ - _Unchecked { costNet = costMatrix[net].row; } + costNet = costMatrix[net]; /* * Compute measures related to cost. @@ -639,7 +636,7 @@ void IdealTrack(ulong tracks, ulong top, ulong bot, - _Ptr ideal) + ulong * ideal) { ulong num; ulong den; diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/assign.h b/MultiSource/Benchmarks/Ptrdist/yacr2/assign.h index 70421b111..0f240754f 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/assign.h +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/assign.h @@ -18,7 +18,7 @@ #ifndef ASSIGN_H #define ASSIGN_H -#pragma CHECKED_SCOPE ON + /* * * Defines. @@ -37,11 +37,6 @@ * */ -struct costMatrixRow { - _Array_ptr row : count(len); - ulong len; -}; - /* * @@ -49,36 +44,33 @@ struct costMatrixRow { * */ -extern ulong channelNets; -extern ulong channelTracks; - #ifdef ASSIGN_CODE -_Array_ptr costMatrix : count(channelNets + 1); -_Array_ptr tracksNoHCV : count(channelTracks+2); -_Array_ptr tracksNotPref : count(channelTracks+2); -_Array_ptr tracksTopNotPref : count(channelTracks+2); -_Array_ptr tracksBotNotPref : count(channelTracks+2); +long * * costMatrix; +ulong * tracksNoHCV; +ulong * tracksNotPref; +ulong * tracksTopNotPref; +ulong * tracksBotNotPref; ulong cardNotPref; ulong cardTopNotPref; ulong cardBotNotPref; -_Array_ptr tracksAssign : count(channelTracks+2); -_Array_ptr netsAssign : count(channelNets + 1); -_Array_ptr netsAssignCopy : count(channelNets + 1); +ulong * tracksAssign; +ulong * netsAssign; +ulong * netsAssignCopy; #else /* ASSIGN_CODE */ -extern _Array_ptr costMatrix : count(channelNets + 1); // 2dim, second dim is (channelTracks + 2) -extern _Array_ptr tracksNoHCV : count(channelTracks+2); -extern _Array_ptr tracksNotPref : count(channelTracks+2); -extern _Array_ptr tracksTopNotPref : count(channelTracks+2); -extern _Array_ptr tracksBotNotPref : count(channelTracks+2); -extern ulong cardNotPref; -extern ulong cardTopNotPref; -extern ulong cardBotNotPref; -extern _Array_ptr tracksAssign : count(channelTracks+2); -extern _Array_ptr netsAssign : count(channelNets + 1); -extern _Array_ptr netsAssignCopy : count(channelNets + 1); +extern ulong * * costMatrix; +extern ulong * tracksNoHCV; +extern ulong * tracksNotPref; +extern ulong * tracksTopNotPref; +extern ulong * tracksBotNotPref; +extern ulong cardNotPref; +extern ulong cardTopNotPref; +extern ulong cardBotNotPref; +extern ulong * tracksAssign; +extern ulong * netsAssign; +extern ulong * netsAssignCopy; #endif /* ASSIGN_CODE */ @@ -110,28 +102,28 @@ void LeftNetsAssign(void); void -Assign(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), +Assign(nodeVCGType *, + ulong *, ulong); void -Select(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Ptr, - _Array_ptr : count(channelNets + 1)); +Select(nodeVCGType *, + nodeHCGType *, + ulong *, + ulong *, + ulong *); void -BuildCostMatrix(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1)); +BuildCostMatrix(nodeVCGType *, + nodeHCGType *, + ulong *, + ulong *); void IdealTrack(ulong, ulong, ulong, - _Ptr); + ulong *); #else /* ASSIGN_CODE */ @@ -154,31 +146,30 @@ extern void LeftNetsAssign(void); extern void -Assign(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), +Assign(nodeVCGType *, + ulong *, ulong); extern void -Select(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Ptr, - _Array_ptr : count(channelNets + 1)); +Select(nodeVCGType *, + nodeHCGType *, + ulong *, + ulong *, + ulong *); extern void -BuildCostMatrix(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1)); +BuildCostMatrix(nodeVCGType *, + nodeHCGType *, + ulong *, + ulong *); extern void IdealTrack(ulong, ulong, ulong, - _Ptr); + ulong *); #endif /* ASSIGN_CODE */ -#pragma CHECKED_SCOPE OFF #endif /* ASSIGN_H */ diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c b/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c index 7ef4d27e5..2f26ee04b 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c @@ -19,8 +19,6 @@ #include "types.h" #include "channel.h" -#pragma CHECKED_SCOPE ON -#define printf(...) _Unchecked { printf(__VA_ARGS__); } /* * @@ -54,7 +52,7 @@ BuildChannel(void) void DimensionChannel(void) { - _Ptr channelFP = NULL; + FILE *channelFP; ulong line; ulong dim; ulong net; @@ -90,7 +88,7 @@ DimensionChannel(void) do { line++; unsigned int c1, b1, t1; - _Unchecked { stat = fscanf(channelFP, "%u%u%u", &c1, &b1, &t1); } + stat = fscanf(channelFP, "%u%u%u", &c1, &b1, &t1); col = c1; bot = b1; top = t1; if (stat != EOF) { if (stat == 3) { @@ -125,7 +123,7 @@ DimensionChannel(void) /* * Close channel description file. - */ + */ if (fclose(channelFP) == EOF) { /* * Error in channel file description. @@ -158,7 +156,7 @@ DimensionChannel(void) void DescribeChannel(void) { - _Ptr channelFP = NULL; + FILE *channelFP; ulong line; ulong col; ulong bot; @@ -168,12 +166,12 @@ DescribeChannel(void) /* * Top terminals of channel. */ - TOP = malloc((channelColumns+1) * sizeof(ulong)); + TOP = (ulong *)malloc((channelColumns+1) * sizeof(ulong)); /* * Bottom terminals of channel. */ - BOT = malloc((channelColumns+1) * sizeof(ulong)); + BOT = (ulong *)malloc((channelColumns+1) * sizeof(ulong)); /* * Initialize terminals of channel. @@ -208,7 +206,7 @@ DescribeChannel(void) do { line++; unsigned int c1, b1, t1; - _Unchecked { stat = fscanf(channelFP, "%u%u%u", &c1, &b1, &t1); } + stat = fscanf(channelFP, "%u%u%u", &c1, &b1, &t1); col = c1; bot = b1; top = t1; if (stat != EOF) { if (stat == 3) { @@ -269,10 +267,10 @@ DensityChannel(void) /* * Allocate track dimension structures. */ - FIRST = malloc((channelNets+1) * sizeof(ulong)); - LAST = malloc((channelNets+1) * sizeof(ulong)); - DENSITY = malloc((channelColumns+1) * sizeof(ulong)); - CROSSING = malloc((channelNets+1) * sizeof(ulong)); + FIRST = (ulong *)malloc((channelNets+1) * sizeof(ulong)); + LAST = (ulong *)malloc((channelNets+1) * sizeof(ulong)); + DENSITY = (ulong *)malloc((channelColumns+1) * sizeof(ulong)); + CROSSING = (ulong *)malloc((channelNets+1) * sizeof(ulong)); /* * Initialize track dimension structures. diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/channel.h b/MultiSource/Benchmarks/Ptrdist/yacr2/channel.h index b6540683d..986af45f0 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/channel.h +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/channel.h @@ -19,7 +19,6 @@ #define CHANNEL_H -#pragma CHECKED_SCOPE ON /* * * Defines. @@ -42,35 +41,35 @@ #ifdef CHANNEL_CODE +ulong * TOP; +ulong * BOT; +ulong * FIRST; +ulong * LAST; +ulong * DENSITY; +ulong * CROSSING; ulong channelNets; ulong channelColumns; -_Array_ptr TOP : count(channelColumns + 1); -_Array_ptr BOT : count(channelColumns + 1); -_Array_ptr FIRST : count(channelNets + 1); -_Array_ptr LAST : count(channelNets + 1); -_Array_ptr DENSITY : count(channelColumns + 1); -_Array_ptr CROSSING : count(channelNets + 1); ulong channelTracks; ulong channelTracksCopy; ulong channelDensity; ulong channelDensityColumn; -_Nt_array_ptr channelFile; +char * channelFile; #else /* CHANNEL_CODE */ +extern ulong * TOP; +extern ulong * BOT; +extern ulong * FIRST; +extern ulong * LAST; +extern ulong * DENSITY; +extern ulong * CROSSING; extern ulong channelNets; extern ulong channelColumns; -extern _Array_ptr TOP : count(channelColumns + 1); -extern _Array_ptr BOT : count(channelColumns + 1); -extern _Array_ptr FIRST : count(channelNets + 1); -extern _Array_ptr LAST : count(channelNets + 1); -extern _Array_ptr DENSITY : count(channelColumns + 1); -extern _Array_ptr CROSSING : count(channelNets + 1); extern ulong channelTracks; extern ulong channelTracksCopy; extern ulong channelDensity; extern ulong channelDensityColumn; -extern _Nt_array_ptr channelFile; +extern char * channelFile; #endif /* CHANNEL_CODE */ @@ -111,5 +110,4 @@ DensityChannel(void); #endif /* CHANNEL_CODE */ -#pragma CHECKED_SCOPE OFF #endif /* CHANNEL_H */ diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.c b/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.c index 28649315a..04b72fc9b 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.c +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.c @@ -21,8 +21,7 @@ #include "hcg.h" #include "channel.h" -#pragma CHECKED_SCOPE ON -#define printf(...) _Unchecked { printf(__VA_ARGS__); } + /* * * Code. @@ -32,17 +31,17 @@ void AllocHCG(void) { - HCG = malloc((channelNets + 1) * sizeof(nodeHCGType)); - storageRootHCG = malloc((channelNets + 1) * (channelNets + 1) * sizeof(ulong)); - _Unchecked { storageHCG = storageRootHCG; } + HCG = (nodeHCGType *)malloc((channelNets + 1) * sizeof(nodeHCGType)); + storageRootHCG = (ulong *)malloc((channelNets + 1) * (channelNets + 1) * sizeof(ulong)); + storageHCG = storageRootHCG; storageLimitHCG = (channelNets + 1) * (channelNets + 1); } void FreeHCG(void) { - _Unchecked { free(HCG); } - _Unchecked { free(storageRootHCG); } + free(HCG); + free(storageRootHCG); storageLimitHCG = 0; } @@ -69,8 +68,7 @@ BuildHCG(void) first = FIRST[net]; last = LAST[net]; constraint = 0; - HCG[net].nets = constraint; - _Unchecked { HCG[net].netsHook = storageHCG; } + HCG[net].netsHook = storageHCG; for (which = 1; which <= channelNets; which++) { if (((FIRST[which] < first) && (LAST[which] < first)) || ((FIRST[which] > last) && (LAST[which] > last))) { /* @@ -97,7 +95,6 @@ BuildHCG(void) * Add constraint. */ assert(storageLimitHCG > 0); - HCG[net].nets = constraint; HCG[net].netsHook[constraint] = which; storageHCG++; storageLimitHCG--; @@ -109,7 +106,7 @@ BuildHCG(void) } void -DFSClearHCG(_Array_ptr HCG : count(channelNets + 1)) +DFSClearHCG(nodeHCGType * HCG) { ulong net; @@ -119,7 +116,7 @@ DFSClearHCG(_Array_ptr HCG : count(channelNets + 1)) } void -DumpHCG(_Array_ptr HCG : count(channelNets + 1)) +DumpHCG(nodeHCGType * HCG) { ulong net; ulong which; @@ -134,10 +131,10 @@ DumpHCG(_Array_ptr HCG : count(channelNets + 1)) } void -NoHCV(_Array_ptr HCG : count(channelNets + 1), +NoHCV(nodeHCGType * HCG, ulong select, - _Array_ptr netsAssign : count(channelNets + 1), - _Array_ptr tracksNoHCV : count(channelTracks + 2)) + ulong * netsAssign, + ulong * tracksNoHCV) { ulong track; ulong net; diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.h b/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.h index 9cb2e8f07..e10e0c000 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.h +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/hcg.h @@ -17,7 +17,6 @@ #ifndef HCG_H #define HCG_H -#pragma CHECKED_SCOPE ON /* * * Defines. @@ -32,7 +31,7 @@ */ typedef struct _nodeHCGType { - _Array_ptr netsHook : count(nets + 1); + ulong * netsHook; ulong nets; ulong netsReached; } nodeHCGType; @@ -44,21 +43,18 @@ typedef struct _nodeHCGType { * */ -extern ulong channelNets; -extern ulong channelTracks; - #ifdef HCG_CODE -_Array_ptr HCG : count(channelNets + 1); -_Array_ptr storageRootHCG : count(channelNets + 1); -_Array_ptr storageHCG : bounds(storageRootHCG, storageRootHCG + channelNets + 1); +nodeHCGType * HCG; +ulong * storageRootHCG; +ulong * storageHCG; ulong storageLimitHCG; #else /* HCG_CODE */ -extern _Array_ptr HCG : count(channelNets + 1); -extern _Array_ptr storageRootHCG : count(channelNets + 1); -extern _Array_ptr storageHCG : bounds(storageRootHCG, storageRootHCG + channelNets + 1); +extern nodeHCGType * HCG; +extern ulong * storageRootHCG; +extern ulong * storageHCG; extern ulong storageLimitHCG; #endif /* HCG_CODE */ @@ -82,16 +78,16 @@ void BuildHCG(void); void -DFSClearHCG(_Array_ptr : count(channelNets + 1)); +DFSClearHCG(nodeHCGType *); void -DumpHCG(_Array_ptr : count(channelNets + 1)); +DumpHCG(nodeHCGType *); void -NoHCV(_Array_ptr : count(channelNets + 1), +NoHCV(nodeHCGType *, ulong, - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelTracks + 2)); + ulong *, + ulong *); #else /* HCG_CODE */ @@ -105,18 +101,17 @@ extern void BuildHCG(void); extern void -DFSClearHCG(_Array_ptr : count(channelNets + 1)); +DFSClearHCG(nodeHCGType *); extern void -DumpHCG(_Array_ptr : count(channelNets + 1)); +DumpHCG(nodeHCGType *); extern void -NoHCV(_Array_ptr : count(channelNets + 1), +NoHCV(nodeHCGType *, ulong, - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelTracks + 2)); + ulong *, + ulong *); #endif /* HCG_CODE */ -#pragma CHECKED_SCOPE OFF #endif /* HCG_H */ diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/main.c b/MultiSource/Benchmarks/Ptrdist/yacr2/main.c index e08c99ecd..5f2231be7 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/main.c +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/main.c @@ -26,8 +26,6 @@ #include "maze.h" -#pragma CHECKED_SCOPE ON -#define printf(...) _Unchecked { printf(__VA_ARGS__); } /* * * Code. @@ -36,7 +34,7 @@ int main(int argc, - _Array_ptr<_Nt_array_ptr> argv : count(argc)) + char *argv[]) { ulong done; ulong fail; diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/maze.c b/MultiSource/Benchmarks/Ptrdist/yacr2/maze.c index 5f9711e66..5640ea770 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/maze.c +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/maze.c @@ -1,21 +1,15 @@ #include #include -#include +#include #include #include "channel.h" #include "assign.h" -#pragma CHECKED_SCOPE ON -#define printf(...) _Unchecked { printf(__VA_ARGS__); } -#define fprintf(...) _Unchecked { fprintf(__VA_ARGS__); } - #define min(a,b) ((a horzPlane : count((channelColumns+1)*(channelTracks+3)); /* horizontal plane allocation map */ +static char * horzPlane; /* horizontal plane allocation map */ /* r/lvalue for accessing horizontal plane allocation map */ #define HORZ(x,y) ACCESS_MAP(horzPlane, x, y) -static _Array_ptr vertPlane : count((channelColumns+1)*(channelTracks+3)); /* vertical plane allocation map */ +static char * vertPlane; /* vertical plane allocation map */ /* r/lvalue for accessing vertical plane allocation map */ #define VERT(x,y) ACCESS_MAP(vertPlane, x, y) -static _Array_ptr viaPlane : count((channelColumns+1)*(channelTracks+3)); /* via plane allocation map */ +static char * viaPlane; /* via plane allocation map */ /* r/lvalue for accessing via plane allocation map */ #define VIA(x,y) ACCESS_MAP(viaPlane, x, y) -static _Array_ptr mazeRoute : count(channelColumns+1); /* true if the col needs to be maze routed */ +static char * mazeRoute; /* true if the col needs to be maze routed */ + /* * set up the plane allocation maps, note: the channel @@ -55,10 +50,10 @@ void InitAllocMaps(void) { /* allocate maps */ - horzPlane = malloc((channelColumns+1)*(channelTracks+3)); - vertPlane = malloc((channelColumns+1)*(channelTracks+3)); - viaPlane = malloc((channelColumns+1)*(channelTracks+3)); - mazeRoute = malloc((channelColumns+1)); + horzPlane = (char *)malloc((channelColumns+1)*(channelTracks+3)); + vertPlane = (char *)malloc((channelColumns+1)*(channelTracks+3)); + viaPlane = (char *)malloc((channelColumns+1)*(channelTracks+3)); + mazeRoute = (char *)malloc((channelColumns+1)); /* if (!horzPlane || !vertPlane || !viaPlane || !mazeRoute) { */ @@ -73,10 +68,10 @@ InitAllocMaps(void) void FreeAllocMaps(void) { - _Unchecked { free(horzPlane); } - _Unchecked { free(vertPlane); } - _Unchecked { free(viaPlane); } - _Unchecked { free(mazeRoute); } + free(horzPlane); + free(vertPlane); + free(viaPlane); + free(mazeRoute); } @@ -89,7 +84,7 @@ FreeAllocMaps(void) * they are sorted as needed by the line drawer */ void -DrawSegment(_Array_ptr plane : count((channelColumns+1)*(channelTracks+2)), +DrawSegment(char * plane, unsigned long x1, unsigned long y1, unsigned long x2, unsigned long y2) { @@ -163,7 +158,7 @@ HasVia(unsigned long x, unsigned long y) * they are sorted as needed by the line drawer */ int -SegmentFree(_Array_ptr plane : count((channelColumns+1)*(channelTracks+2)), +SegmentFree(char * plane, unsigned long x1, unsigned long y1, unsigned long x2, unsigned long y2) { @@ -228,52 +223,52 @@ PrintChannel(void) printf(" "); for (x=1; x<=channelColumns; x++) { if (VERT(x,y)&FROM_TOP) - printf(" | ") + printf(" | "); else - printf(" ") + printf(" "); } printf("\n"); printf("Track %3d: ", y); for (x=1; x<=channelColumns; x++) { if ((HORZ(x,y)&FROM_LEFT) && (VERT(x,y)&FROM_LEFT)) - printf("=") + printf("="); else if (HORZ(x,y)&FROM_LEFT) - printf("-") + printf("-"); else if (VERT(x,y)&FROM_LEFT) - printf("^") + printf("^"); else - printf(" ") + printf(" "); if (VIA(x,y)) - printf("X") + printf("X"); else if (HORZ(x,y) && VERT(x,y)) - printf("+") + printf("+"); else if (HORZ(x,y)) - printf("-") + printf("-"); else if (VERT(x,y)) - printf("|") + printf("|"); else - printf(" ") + printf(" "); if ((HORZ(x,y)&FROM_RIGHT) && (VERT(x,y)&FROM_RIGHT)) - printf("=") + printf("="); else if (HORZ(x,y)&FROM_RIGHT) - printf("-") + printf("-"); else if (VERT(x,y)&FROM_RIGHT) - printf("^") + printf("^"); else - printf(" ") + printf(" "); } printf("\n"); printf(" "); for (x=1; x<=channelColumns; x++) { if (VERT(x,y)&FROM_BOT) - printf(" | ") + printf(" | "); else - printf(" ") + printf(" "); } printf("\n"); } @@ -318,21 +313,21 @@ DrawNets(void) int numLeft = 0; /* initialize maps to empty */ - _Unchecked { bzero(horzPlane, - (int)((channelColumns+1)*(channelTracks+2))); } - _Unchecked { bzero(vertPlane, - (int)((channelColumns+1)*(channelTracks+2))); } - _Unchecked { bzero(viaPlane, - (int)((channelColumns+1)*(channelTracks+2))); } - _Unchecked { bzero(mazeRoute, - (int)(channelColumns+1)); } + bzero(horzPlane, + (int)((channelColumns+1)*(channelTracks+2))); + bzero(vertPlane, + (int)((channelColumns+1)*(channelTracks+2))); + bzero(viaPlane, + (int)((channelColumns+1)*(channelTracks+2))); + bzero(mazeRoute, + (int)(channelColumns+1)); /* draw all horizontal segments */ for (i=1; i<=channelNets; i++) { if (FIRST[i] != LAST[i]) - _Unchecked { DrawSegment(horzPlane, + DrawSegment(horzPlane, FIRST[i], netsAssign[i], - LAST[i], netsAssign[i]); } + LAST[i], netsAssign[i]); #ifdef VERBOSE printf("Just routed net %d...\n", i); PrintChannel(); @@ -346,43 +341,43 @@ DrawNets(void) } else if ((BOT[i] == 0) && (TOP[i] != 0)) { /* only one segment, therefore no vertical constraint violation */ - _Unchecked { DrawSegment(vertPlane, + DrawSegment(vertPlane, i, 0, - i, netsAssign[TOP[i]]); } + i, netsAssign[TOP[i]]); DrawVia(i, netsAssign[TOP[i]]); } else if ((TOP[i] == 0) && (BOT[i] != 0)) { /* only one segment, therefore no vertical constraint violation */ - _Unchecked { DrawSegment(vertPlane, + DrawSegment(vertPlane, i, netsAssign[BOT[i]], - i, channelTracks+1); } + i, channelTracks+1); DrawVia(i, netsAssign[BOT[i]]); } /* two segments to route */ else if ((TOP[i] == BOT[i]) && (FIRST[TOP[i]] == LAST[TOP[i]])) { /* same net, no track needed to route */ assert((FIRST[TOP[i]] == i) && (LAST[TOP[i]] == i)); - _Unchecked { DrawSegment(vertPlane, + DrawSegment(vertPlane, i, 0, - i, channelTracks+1); } + i, channelTracks+1); } else if (TOP[i] == BOT[i]) { /* connecting to same track, therefore no vcv */ - _Unchecked { DrawSegment(vertPlane, + DrawSegment(vertPlane, i, 0, - i, channelTracks+1); } + i, channelTracks+1); DrawVia(i, netsAssign[BOT[i]]); } /* two segments to route, going to different tracks */ else if (netsAssign[TOP[i]] < netsAssign[BOT[i]]) { /* no vertical constraint violation */ - _Unchecked { DrawSegment(vertPlane, + DrawSegment(vertPlane, i, 0, - i, netsAssign[TOP[i]]); } + i, netsAssign[TOP[i]]); DrawVia(i, netsAssign[TOP[i]]); - _Unchecked { DrawSegment(vertPlane, + DrawSegment(vertPlane, i, netsAssign[BOT[i]], - i, channelTracks+1); } + i, channelTracks+1); DrawVia(i, netsAssign[BOT[i]]); } /* otherwise, maze routing is required */ @@ -490,7 +485,7 @@ Maze1Mech(unsigned long i, /* column */ unsigned long b1, /* bent channel from b1 to b2 */ unsigned long b2, /* s1, b1 are at the terminals */ int bXdelta, int bYdelta) /* bend X, Y delta from s */ -_Unchecked { +{ if (SegmentFree(vertPlane, /* straight vert seg in col i */ i, s1, i, s2) && @@ -650,7 +645,7 @@ Maze1(void) * can this track be extended to the range specified, return result */ int -ExtendOK(unsigned long net, _Array_ptr plane : count((channelColumns + 1)*(channelTracks + 3)), +ExtendOK(unsigned long net, char * plane, unsigned long _x1, unsigned long _y1, /* start seg */ unsigned long _x2, unsigned long _y2) /* end seg */ { @@ -668,24 +663,24 @@ ExtendOK(unsigned long net, _Array_ptr plane : count((channelColumns + 1)* return 1; /* inside the net */ if ((x1 < FIRST[net]) && (x2 > LAST[net])) { /* subsumes */ - _Unchecked { return (SegmentFree(plane, + return (SegmentFree(plane, x1, y1, FIRST[net]-1, y1) && SegmentFree(plane, LAST[net]+1, y1, - x2, y1)); } + x2, y1)); } else if (x1 < FIRST[net]) { /* to the left possibly overlapping */ - _Unchecked { return SegmentFree(plane, + return SegmentFree(plane, x1, y1, - FIRST[net]-1, y1); } + FIRST[net]-1, y1); } else if (x2 > LAST[net]) { /* to the right possibly overlapping */ - _Unchecked { return SegmentFree(plane, + return SegmentFree(plane, LAST[net]+1, y1, - x2, y1); } + x2, y1); } /* should not get here */ abort(); @@ -717,7 +712,7 @@ Maze2Mech(unsigned long bentNet, /* net to bend */ colFree = 1; for (col = xStart; colFree && (col != xEnd); - col += bXdelta) _Unchecked { /* search for col */ // _Unchecked Required for all calls to SegmentFree and DrawSegment + col += bXdelta) { /* search for col */ if ((colFree = SegmentFree(horzPlane, /* bent horz seg */ i, row, col, row)) && @@ -884,7 +879,7 @@ Maze2(void) void FindFreeHorzSeg(unsigned long startCol, unsigned long row, - _Ptr rowStart, _Ptr rowEnd) + unsigned long * rowStart, unsigned long * rowEnd) { unsigned long i; @@ -923,7 +918,7 @@ Maze3Mech(unsigned long topNet, /* top net to bend */ if (botEnd <= botStart) continue; for (topCol = topStart; topCol <= topEnd; topCol++) { - for (botCol = botStart; botCol <= botEnd; botCol++) _Unchecked { // Required for all calls to SegmentFree and DrawSegment + for (botCol = botStart; botCol <= botEnd; botCol++) { if ((topCol != i) && (botCol != i) && (topRow != botRow) && (topCol != botCol) && SegmentFree(vertPlane, /* top down */ diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/maze.h b/MultiSource/Benchmarks/Ptrdist/yacr2/maze.h index fb4bd972b..9aac438ff 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/maze.h +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/maze.h @@ -2,7 +2,6 @@ #ifndef MAZE_H #define MAZE_H -#pragma CHECKED_SCOPE ON void InitAllocMaps(void); void FreeAllocMaps(void); void PrintChannel(void); @@ -11,5 +10,4 @@ int Maze1(void); int Maze2(void); int Maze3(void); -#pragma CHECKED_SCOPE OFF #endif /* MAZE_H */ diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/option.c b/MultiSource/Benchmarks/Ptrdist/yacr2/option.c index 80fc1e767..5fa882cdc 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/option.c +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/option.c @@ -20,8 +20,6 @@ #include #include "channel.h" -#pragma CHECKED_SCOPE ON -#define printf(...) _Unchecked { printf(__VA_ARGS__); } /* * @@ -31,7 +29,7 @@ void Option(int argc, - _Array_ptr<_Nt_array_ptr> argv : count(argc)) + char *argv[]) { /* * Check arguments. @@ -44,5 +42,5 @@ Option(int argc, /* * Specified options. */ - _Unchecked { channelFile = argv[1]; } + channelFile = argv[1]; } diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/option.h b/MultiSource/Benchmarks/Ptrdist/yacr2/option.h index 942a686a9..34fd38540 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/option.h +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/option.h @@ -15,7 +15,6 @@ #ifndef OPTION_H #define OPTION_H -#pragma CHECKED_SCOPE ON /* * @@ -53,16 +52,15 @@ #ifdef OPTION_CODE void -Option(int argc, - _Array_ptr<_Nt_array_ptr> : count(argc)); +Option(int, + char (*[])); #else /* OPTION_CODE */ extern void -Option(int argc, - _Array_ptr<_Nt_array_ptr> : count(argc)); +Option(int, + char (*[])); #endif /* OPTION_CODE */ -#pragma CHECKED_SCOPE OFF #endif /* OPTION_H */ diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.c b/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.c index 00582c99e..ea5f7cbaa 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.c +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.c @@ -23,8 +23,6 @@ #include "assign.h" #include "channel.h" -#pragma CHECKED_SCOPE ON -#define printf(...) _Unchecked { printf(__VA_ARGS__); } /* * @@ -35,24 +33,24 @@ void AllocVCG(void) { - VCG = malloc((channelNets + 1) * sizeof(nodeVCGType)); - storageRootVCG = malloc((channelNets + 1) * (channelNets + 1) * sizeof(constraintVCGType)); + VCG = (nodeVCGType *)malloc((channelNets + 1) * sizeof(nodeVCGType)); + storageRootVCG = (constraintVCGType *)malloc((channelNets + 1) * (channelNets + 1) * sizeof(constraintVCGType)); storageVCG = storageRootVCG; storageLimitVCG = (channelNets + 1) * (channelNets + 1); - SCC = malloc((channelNets + 1) * sizeof(ulong)); - perSCC = malloc((channelNets + 1) * sizeof(ulong)); - removeVCG = malloc<_Ptr>((channelNets + 1) * (channelNets + 1) * sizeof(constraintVCGType *)); + SCC = (ulong *)malloc((channelNets + 1) * sizeof(ulong)); + perSCC = (ulong *)malloc((channelNets + 1) * sizeof(ulong)); + removeVCG = (constraintVCGType * *)malloc((channelNets + 1) * (channelNets + 1) * sizeof(constraintVCGType *)); } void FreeVCG(void) { - _Unchecked { free(VCG); } - _Unchecked { free(storageRootVCG); } + free(VCG); + free(storageRootVCG); storageLimitVCG = 0; - _Unchecked { free(SCC); } - _Unchecked { free(perSCC); } - _Unchecked { free<_Ptr>(removeVCG); } + free(SCC); + free(perSCC); + free(removeVCG); } void @@ -77,7 +75,7 @@ BuildVCG(void) * Above constraints. */ constraint = 0; - _Unchecked { VCG[net].netsAboveHook = storageVCG; } + VCG[net].netsAboveHook = storageVCG; for (col = 1; col <= channelColumns; col++) { if ((TOP[col] == net) && (BOT[col] != net) && (BOT[col] != 0)) { /* @@ -95,8 +93,7 @@ BuildVCG(void) * Add constraint. */ if (add) { - assert(storageLimitVCG > 0); - VCG[net].netsAbove = constraint; + assert(storageLimitVCG > 0); VCG[net].netsAboveHook[constraint].top = TOP[col]; VCG[net].netsAboveHook[constraint].bot = BOT[col]; VCG[net].netsAboveHook[constraint].col = col; @@ -113,7 +110,7 @@ BuildVCG(void) * Below constraints. */ constraint = 0; - _Unchecked { VCG[net].netsBelowHook = storageVCG; } + VCG[net].netsBelowHook = storageVCG; for (col = 1; col <= channelColumns; col++) { if ((BOT[col] == net) && (TOP[col] != net) && (TOP[col] != 0)) { /* @@ -131,8 +128,7 @@ BuildVCG(void) * Add constraint. */ if (add) { - assert(storageLimitVCG > 0); - VCG[net].netsBelow = constraint; + assert(storageLimitVCG > 0); VCG[net].netsBelowHook[constraint].top = TOP[col]; VCG[net].netsBelowHook[constraint].bot = BOT[col]; VCG[net].netsBelowHook[constraint].col = col; @@ -148,7 +144,7 @@ BuildVCG(void) } void -DFSClearVCG(_Array_ptr VCG : count(channelNets + 1)) +DFSClearVCG(nodeVCGType * VCG) { ulong net; @@ -161,7 +157,7 @@ DFSClearVCG(_Array_ptr VCG : count(channelNets + 1)) } void -DumpVCG(_Array_ptr VCG : count(channelNets + 1)) +DumpVCG(nodeVCGType * VCG) { ulong net; ulong which; @@ -177,7 +173,7 @@ DumpVCG(_Array_ptr VCG : count(channelNets + 1)) } printf("\n"); - printf("below: "); + printf("below: "); for (which = 0; which < VCG[net].netsBelow; which++) { if (! VCG[net].netsBelowHook[which].removed) { assert(VCG[net].netsBelowHook[which].bot == net); @@ -189,7 +185,7 @@ DumpVCG(_Array_ptr VCG : count(channelNets + 1)) } void -DFSAboveVCG(_Array_ptr VCG : count(channelNets + 1), +DFSAboveVCG(nodeVCGType * VCG, ulong net) { ulong s; @@ -208,7 +204,7 @@ DFSAboveVCG(_Array_ptr VCG : count(channelNets + 1), } void -DFSBelowVCG(_Array_ptr VCG : count(channelNets + 1), +DFSBelowVCG(nodeVCGType * VCG, ulong net) { ulong s; @@ -227,10 +223,9 @@ DFSBelowVCG(_Array_ptr VCG : count(channelNets + 1), } void -SCCofVCG(_Array_ptr VCG : count(channelNets + 1), - _Array_ptr SCC : count(channelNets + 1), - _Array_ptr perSCC : count(countSCC + 1), - ulong countSCC) +SCCofVCG(nodeVCGType * VCG, + ulong * SCC, + ulong * perSCC) { ulong net; ulong scc; @@ -308,9 +303,9 @@ SCCofVCG(_Array_ptr VCG : count(channelNets + 1), } void -SCC_DFSAboveVCG(_Array_ptr VCG : count(channelNets + 1), +SCC_DFSAboveVCG(nodeVCGType * VCG, ulong net, - _Ptr label) + ulong * label) { ulong s; ulong above; @@ -330,7 +325,7 @@ SCC_DFSAboveVCG(_Array_ptr VCG : count(channelNets + 1), } void -SCC_DFSBelowVCG(_Array_ptr VCG : count(channelNets + 1), +SCC_DFSBelowVCG(nodeVCGType * VCG, ulong net, ulong label) { @@ -351,8 +346,8 @@ SCC_DFSBelowVCG(_Array_ptr VCG : count(channelNets + 1), } void -DumpSCC(_Array_ptr SCC : count(channelNets + 1), - _Array_ptr perSCC : count(totalSCC + 1)) +DumpSCC(ulong * SCC, + ulong * perSCC) { ulong net; ulong scc; @@ -402,7 +397,7 @@ AcyclicVCG(void) * Check acyclic (and more). */ DFSClearVCG(VCG); - SCCofVCG(VCG, SCC, perSCC, channelNets); + SCCofVCG(VCG, SCC, perSCC); for (scc = 1; scc <= totalSCC; scc++) { if (perSCC[scc] > 1) { acyclic = FALSE; @@ -459,7 +454,7 @@ AcyclicVCG(void) */ cycle = FALSE; DFSClearVCG(VCG); - SCCofVCG(VCG, SCC, perSCC, channelNets); + SCCofVCG(VCG, SCC, perSCC); for (scc = 1; scc <= totalSCC; scc++) { if (perSCC[scc] > 1) { cycle = TRUE; @@ -503,10 +498,10 @@ AcyclicVCG(void) } void -RemoveConstraintVCG(_Array_ptr VCG : count(channelNets + 1), - _Array_ptr SCC : count(channelNets + 1), - _Array_ptr perSCC : count(channelNets + 1), - _Array_ptr<_Ptr> removeVCG : count((channelNets + 1) * (channelNets + 1))) +RemoveConstraintVCG(nodeVCGType * VCG, + ulong * SCC, + ulong * perSCC, + constraintVCGType * * removeVCG) { ulong scc; ulong net; @@ -516,7 +511,7 @@ RemoveConstraintVCG(_Array_ptr VCG : count(channelNets + 1), ulong top; ulong bot; ulong col; - _Ptr remove = NULL; + constraintVCGType * remove; for (scc = 1; scc <= totalSCC; scc++) { /* @@ -606,7 +601,7 @@ RemoveConstraintVCG(_Array_ptr VCG : count(channelNets + 1), */ if (weight < best) { best = weight; - _Unchecked { remove = &VCG[net].netsAboveHook[which]; } + remove = &VCG[net].netsAboveHook[which]; } } } @@ -643,7 +638,7 @@ RemoveConstraintVCG(_Array_ptr VCG : count(channelNets + 1), } ulong -ExistPathAboveVCG(_Array_ptr VCG : count(channelNets + 1), +ExistPathAboveVCG(nodeVCGType * VCG, ulong above, ulong below) { @@ -653,7 +648,7 @@ ExistPathAboveVCG(_Array_ptr VCG : count(channelNets + 1), } void -LongestPathVCG(_Array_ptr VCG : count(channelNets + 1), +LongestPathVCG(nodeVCGType * VCG, ulong net) { ulong track; @@ -717,7 +712,7 @@ LongestPathVCG(_Array_ptr VCG : count(channelNets + 1), } ulong -DFSAboveLongestPathVCG(_Array_ptr VCG : count(channelNets + 1), +DFSAboveLongestPathVCG(nodeVCGType * VCG, ulong net) { ulong s; @@ -743,7 +738,7 @@ DFSAboveLongestPathVCG(_Array_ptr VCG : count(channelNets + 1), } ulong -DFSBelowLongestPathVCG(_Array_ptr VCG : count(channelNets + 1), +DFSBelowLongestPathVCG(nodeVCGType * VCG, ulong net) { ulong s; @@ -769,10 +764,10 @@ DFSBelowLongestPathVCG(_Array_ptr VCG : count(channelNets + 1), } ulong -VCV(_Array_ptr VCG : count(channelNets + 1), +VCV(nodeVCGType * VCG, ulong check, ulong track, - _Array_ptr assign : count(channelNets + 1)) + ulong * assign) { ulong net; ulong vcv; diff --git a/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.h b/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.h index d2036eafd..8d2b139d2 100644 --- a/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.h +++ b/MultiSource/Benchmarks/Ptrdist/yacr2/vcg.h @@ -18,7 +18,6 @@ #ifndef VCG_H #define VCG_H -#pragma CHECKED_SCOPE ON /* * * Defines. @@ -47,11 +46,11 @@ typedef struct _constraintVCGType { } constraintVCGType; typedef struct _nodeVCGType { - _Array_ptr netsAboveHook : count(netsAbove + 1); + constraintVCGType * netsAboveHook; ulong netsAbove; ulong netsAboveLabel; ulong netsAboveReached; - _Array_ptr netsBelowHook : count(netsBelow + 1); + constraintVCGType * netsBelowHook; ulong netsBelow; ulong netsBelowLabel; ulong netsBelowReached; @@ -64,31 +63,29 @@ typedef struct _nodeVCGType { * */ -extern ulong channelNets; - #ifdef VCG_CODE -_Array_ptr VCG : count(channelNets + 1); -_Array_ptr storageRootVCG : count((channelNets + 1) * (channelNets + 1)); -_Array_ptr storageVCG : bounds(storageRootVCG, storageRootVCG + (channelNets + 1) * (channelNets + 1)); +nodeVCGType * VCG; +constraintVCGType * storageRootVCG; +constraintVCGType * storageVCG; ulong storageLimitVCG; -_Array_ptr<_Ptr> removeVCG : count((channelNets + 1) * (channelNets + 1)); +constraintVCGType * * removeVCG; ulong removeTotalVCG; -_Array_ptr SCC : count(channelNets + 1); +ulong * SCC; ulong totalSCC; -_Array_ptr perSCC : count(channelNets + 1); +ulong * perSCC; #else /* VCG_CODE */ -extern _Array_ptr VCG : count(channelNets + 1); -extern _Array_ptr storageRootVCG : count((channelNets + 1) * (channelNets + 1)); -extern _Array_ptr storageVCG : bounds(storageRootVCG, storageRootVCG + (channelNets + 1) * (channelNets + 1)); -extern ulong storageLimitVCG; -extern _Array_ptr<_Ptr> removeVCG : count((channelNets + 1) * (channelNets + 1)); -extern ulong removeTotalVCG; -extern _Array_ptr SCC : count(channelNets + 1); -extern ulong totalSCC; -extern _Array_ptr perSCC : count(channelNets + 1); +extern nodeVCGType * VCG; +extern constraintVCGType * storageRootVCG; +extern constraintVCGType * storageVCG; +extern ulong storageLimitVCG; +extern constraintVCGType * * removeVCG; +extern ulong removeTotalVCG; +extern ulong * SCC; +extern ulong totalSCC; +extern ulong * perSCC; #endif /* VCG_CODE */ @@ -111,70 +108,69 @@ void BuildVCG(void); void -DFSClearVCG(_Array_ptr : count(channelNets + 1)); +DFSClearVCG(nodeVCGType *); void -DumpVCG(_Array_ptr : count(channelNets + 1)); +DumpVCG(nodeVCGType *); void -DFSAboveVCG(_Array_ptr : count(channelNets + 1), +DFSAboveVCG(nodeVCGType *, ulong); void -DFSBelowVCG(_Array_ptr : count(channelNets + 1), +DFSBelowVCG(nodeVCGType *, ulong); void -SCCofVCG(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(countSCC + 1), - ulong countSCC); +SCCofVCG(nodeVCGType *, + ulong *, + ulong *); void -SCC_DFSAboveVCG(_Array_ptr : count(channelNets + 1), - ulong, - _Ptr); +SCC_DFSAboveVCG(nodeVCGType *, + ulong, + ulong *); void -SCC_DFSBelowVCG(_Array_ptr : count(channelNets + 1), +SCC_DFSBelowVCG(nodeVCGType *, ulong, ulong); void -DumpSCC(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(totalSCC + 1)); +DumpSCC(ulong *, + ulong *); void AcyclicVCG(void); void -RemoveConstraintVCG(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr<_Ptr> : count((channelNets + 1) * (channelNets + 1))); +RemoveConstraintVCG(nodeVCGType *, + ulong *, + ulong *, + constraintVCGType * *); ulong -ExistPathAboveVCG(_Array_ptr : count(channelNets + 1), - ulong above, - ulong below); +ExistPathAboveVCG(nodeVCGType *, + ulong, + ulong); void -LongestPathVCG(_Array_ptr : count(channelNets + 1), +LongestPathVCG(nodeVCGType *, ulong); ulong -DFSAboveLongestPathVCG(_Array_ptr : count(channelNets + 1), +DFSAboveLongestPathVCG(nodeVCGType *, ulong); ulong -DFSBelowLongestPathVCG(_Array_ptr : count(channelNets + 1), +DFSBelowLongestPathVCG(nodeVCGType *, ulong); ulong -VCV(_Array_ptr : count(channelNets + 1), +VCV(nodeVCGType *, ulong, ulong, - _Array_ptr : count(channelNets + 1)); + ulong *); #else /* VCG_CODE */ @@ -188,72 +184,70 @@ extern void BuildVCG(void); extern void -DFSClearVCG(_Array_ptr : count(channelNets + 1)); +DFSClearVCG(nodeVCGType *); extern void -DumpVCG(_Array_ptr : count(channelNets + 1)); +DumpVCG(nodeVCGType *); extern void -DFSAboveVCG(_Array_ptr : count(channelNets + 1), +DFSAboveVCG(nodeVCGType *, ulong); extern void -DFSBelowVCG(_Array_ptr : count(channelNets + 1), +DFSBelowVCG(nodeVCGType *, ulong); extern void -SCCofVCG(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(countSCC + 1), - ulong countSCC); +SCCofVCG(nodeVCGType *, + ulong *, + ulong *); extern void -SCC_DFSAboveVCG(_Array_ptr : count(channelNets + 1), - ulong, - _Ptr); +SCC_DFSAboveVCG(nodeVCGType *, + ulong, + ulong *); extern void -SCC_DFSBelowVCG(_Array_ptr : count(channelNets + 1), +SCC_DFSBelowVCG(nodeVCGType *, ulong, ulong); extern void -DumpSCC(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(totalSCC + 1)); +DumpSCC(ulong *, + ulong *); extern void AcyclicVCG(void); extern void -RemoveConstraintVCG(_Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr : count(channelNets + 1), - _Array_ptr<_Ptr> : count((channelNets + 1) * (channelNets + 1))); +RemoveConstraintVCG(nodeVCGType *, + ulong *, + ulong *, + constraintVCGType * *); extern ulong -ExistPathAboveVCG(_Array_ptr : count(channelNets + 1), +ExistPathAboveVCG(nodeVCGType *, ulong, ulong); extern void -LongestPathVCG(_Array_ptr : count(channelNets + 1), +LongestPathVCG(nodeVCGType *, ulong); extern ulong -DFSAboveLongestPathVCG(_Array_ptr : count(channelNets + 1), +DFSAboveLongestPathVCG(nodeVCGType *, ulong); extern ulong -DFSBelowLongestPathVCG(_Array_ptr : count(channelNets + 1), +DFSBelowLongestPathVCG(nodeVCGType *, ulong); extern ulong -VCV(_Array_ptr : count(channelNets + 1), - ulong, - ulong, - _Array_ptr : count(channelNets + 1)); +VCV(nodeVCGType *, + ulong, + ulong, + ulong *); #endif /* VCG_CODE */ -#pragma CHECKED_SCOPE OFF #endif /* VCG_H */