Newshot

A Partial Evaluator for C

Original text(via Hacker News)

Tempo Specializer - A Partial Evaluator for C

  • What is Tempo?
  • An overview of Tempo
  • Applications
  • Related projects
  • Distribution
  • Contact information

What is Tempo?

An Overview of Tempo

Tempo is an off-line specializer; it is divided into two phases: analysis and specialization.

Following the analysis phase, the specialization phase generates a specialized program based on the annotated program and the values of the known inputs. Tempo can specialize programs at compile time (i.e., source-to-source tranformation) as well as run time (i.e., run-time binary code generation).

Program Analysis


        miniprintf(char fmt[], int val[])
{
  int i = 0;
  while( *fmt != '\0' ) {
    if( *fmt != '%' )
       putchar(*fmt);
    else
      switch(*++fmt) {
        case 'd' : putint(val[i++]); break;
        case '%' : putchar('%');     break;
        default  : prterror(*fmt);   break;
      }
    fmt++;
  }
}
      

        /*  LEGEND:  STATIC  DYNAMIC
 */
miniprintf(char fmt[], int val[])
{
  int i = 0;
  while( *fmt != '\0' ) {
    if( *fmt != '%' )
       putchar(*fmt);
    else
      switch(*++fmt) {
        case 'd' : putint(val[i++]); break;
        case '%' : putchar('%');     break;
        default  : prterror(*fmt);   break;
      }
    fmt++;
  }
}
      

The visualization of the analysis is very important for the user to assess the amount of specialization in the code. Furthermore, the analysis speeds up the specialization process (as opposed to on-line partial evaluators). The analysis is inter-procedural and takes into account pointer aliases and side-effects.

Compile-Time Specialization


        miniprintf_1(int val[])
{
  putchar( '<'    );
  putint ( val[0] );
  putchar( ','    );
  putint ( val[1] );
  putchar( '>'    );
}
      

Runtime Specialization


        /*
 * Some dynamic execution context for variable 'format'
 */
spec_printf = rts_miniprintf_1(format);
...
(*spec_printf)(val1);   /* <=> miniprintf(format,val1) */
(*spec_printf)(val2);   /* <=> miniprintf(format,val2) */
      

Applications of Tempo

  • Operating system and networking:
  • Sun RPC, Chorus IPC, BSD packet filter, Unix signals, active networks,
  • Computer graphics (various filtering algorithms),
  • Scientific computation (trajectory, FFT, math libraries),
  • Software architectures and mechanisms:
  • Domain specific languages GAL, PLAN-P),
  • Selective broadcast (implicit invocation),
  • Pattern matching,
  • Interpreters,
  • Software layers,
  • Generic libraries.

Besides C, Tempo is currently being used as a back-end for specializing Java programs using Harissa, a JavaVM-to-C compiler. Fortran and C++ programs have also been specialized using translators to C.

Projects Related to Tempo

Workshop

Depending on request, if the distribution of Tempo is a success, we might organize another workshop later. It would less be like a ``winter school'' but rather like a real workshop with users presenting applications and open discussions about possible improvements. It would be preceded by an optional one-day tutorial for people not knowing partial evaluation or Tempo.

Distribution

Getting access to Tempo no longer requires signing a license agreement. Tempo is simply available via anonymous FTP, as described below. In any case, we would very much like to hear from you if you are an active Tempo user. If you are, please also let us know if and for what purpose you are using Tempo, by sending an email to [email protected]. We will by default add you to our tempo talk mailing list [email protected], where future Tempo releases will be announced, and Tempo users can discuss practical problems using Tempo.

Tempo can be downloaded :

  • Here is a Tempo release that have been made publicly available: i386 Linux
  • Most recent Tempo binary distribution for i386 Linux (tested on RedHat 6.1).

In case of any problem with getting or installing the distribution, get in touch with us: mailto:[email protected]

References

Contact Information

  • Tempo Specializer home page: tempo

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by Hacker News
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗