CSPECControl Specification
CSPECCommon Systems Planning and Engineering Center (Qwest)
References in periodicals archive ?
tcc implements the assignments to these cspecs by assignments to pointers to closures, as illustrated in Figure 5.
Simplified code-generating functions for these cspecs appear in Figure 6.
Generating efficient code from composed cspecs requires optimization analogous to function inlining and interprocedural optimization.
For example, if a register is reserved (getreg'd) across a cspec composition point, it becomes unavailable for allocation in the nested cspec and in all cspecs nested within it.
However, if the dynamic code contains large basic blocks with high register pressure, or if cspecs are dynamically combined in a way that forces many spills, code quality suffers.
The function newton takes as arguments the maximum allowed number of iterations, a tolerance, an initial estimate, and two pointers to functions that return cspecs to evaluate a function and its derivative.
double newton(int n, double tol, double usr_p0, dptr f, dptr fprime) { void cspec cs = `{ int i; double p, p0 = usr_p0; for (i = 0; i < $n; i++) { p = p0 - f(p0) / fprime(p0); /* Compose cspecs returned by f and fprime */ if (abs(p - p0) < tol) return p; /* Return result if we've converged enough */ p0 = p; /* Seed the next iteration */ } error( "method failed after %d iterations\n", i); }; return (*compile(cs,double))(); /* Compile, call, and return the result.