duhl@ontologic.UUCP (Joshua Duhl) (04/17/91)
At Ontologic, we have been using a utility called cback, a companion product to cfront based C++ translators, to process cfront C output and produce easy to read, smaller, faster and more portable C code. cback C output is usually smaller and more concise than cfront generated code, resulting in smaller object files, library archives and executables. In tests on ONTOS, which is our C++ database product comprising 7 Mb. of executables, we have seen an average reduction in object file and executable size of 12% and as high as 27%. In some library archives we have seen as much as a 40% reduction. To our knowledge, cback produces accurate and flawless C code for either cfront 1.2 or 2.X versions. cback is a fast, rule driven, C to C translator that in addition to producing human readable C code, carefully eliminates unreferenced declarations, unreferenced static functions, redundant assignments to virtual table pointers and performs many other cfront specific cleanups. All of cback's rules can be switched on or off to suit a variety of different needs. On the average, cback will decrease elapsed compile times by up to 10% and link times of up to 50%! Time spent in cback is made up by shorter C compilation times. cback fits seamlessly into standard compilation sequences and debugging environments. It recreates line numbers and, for Sun cfront compilers, it will recreate symbol table information for dbx. cback is also particularly appropriate for development where cfront output is cross compiled. The C code output from cback readily compiles on a variety of C compilers and is maintainable. cback is available on SUN3, SUN4, IBM RS/6000, Interactive Unix and SCO Xenix/Unix. I highly recommend using cback as part of your day to day development process. Below is an example of cfront output that has been transformed by cback. It is impressive! C++ CODE -------------------------------------------------------------------------- inline klink::klink (int m, int c) : kaboom (m), link (c) { } CFRONT OUTPUT --------------------------------------------------------------------------- static struct klink *__ct__5klinkFiT1 (__0this , __0link , __0m , __0c ) struct klink *__0this ; struct link *__0link ; int __0m ; int __0c ; { if (__0this || (__0this = (struct klink *)__nw__FUi ( sizeof (struct klink )) ))( ( (__0this -> Plink= ((__0link == 0 )?((__0link = (((struct link *)(( ((char *)__0this ))+ 12)))), __ct__4linkFi ( ((struct link *)((((char *) __0this ))+ 12)), __0c ) ) :__0link )), __ct__6kaboomFi (((struct kaboom *) __0this ), __0m ) ) , (__0this -> __vptr__6kaboom = (struct __mptr *) __ptbl__5klink)) ; return __0this ; } CBACK OUTPUT ---------------------------------------------------------------------------- static struct klink *__ct__5klinkFiT1 (this, link, m, c) struct klink *this; struct link *link; int m; int c; { if (this || (this = (struct klink *) __nw__FUi (sizeof (struct klink)))) { this->Plink = link ? link : (link = &this->Olink, __ct__4linkFi (&this->Olink, c)); __ct__6kaboomFi (this, m); this->__vptr = __vtbl__5klink; } return this; } -------------------------------------------------------------------------- Newcode can be reached at: Newcode Technology, Ltd., 200 Boston Ave., Medford, MA 02155 Tel: (617) 396-3009 Fax: (617) 395-9452 Network: uunet!cybvax0!zeev zeev%cybvax0@uunet.uu.net