[gambit-list] Using the tcc compiler
Marc Feeley
feeley at iro.umontreal.ca
Fri Jul 27 18:51:15 EDT 2007
On 27-Jul-07, at 5:28 PM, Christian Jaeger wrote:
> Hello
>
> I've just discovered that tcc¹ is able to compile the C code generated
> by Gambit.
Great! I have toyed with TCC (not in the context of Gambit) and I
think it is a neat tiny and fast C compiler.
> In simple cases the compiled object files work just
> flawlessly (albeit ~3 times slower than when compiled with gcc in a
> fixnum-loop microbenchmark, but that's ok). When I compile one of my
> bigger modules (which takes 3 seconds for compilation from Scheme to C
> and 17 seconds to compile from C to binary with gcc 4.1.2, and only 1
> second to compile from C to binary with tcc 0.9.23), it's doing wrong
> calculations (I'm doing signal processing, with tcc it just outputs
> zeroes all the time).
Are you sure TCC implements floating point?
>
> The way I've used tcc in the above tests was by just linking tcc into
> the PATH as gcc (mkdir ~/bin; ln -s /usr/bin/tcc ~/bin/gcc;
> PATH="~/bin:$PATH";
Another way would be to tweak the file ~~/bin/gsc-cc-o which is
called by gsc to compile the generated source code to the .o1 file.
> start gsc interactively and use compile-file
> (through chjmodule) as usual). Should I take a different approach? Or
> should I start debugging problems / send bug reports with code when
> compiled with tcc?
>
> Having 5 times faster compile times would help development in those
> cases where using the interpreter isn't possible (because it is too
> slow
> or because the modules are including FFI code), albeit it's not a high
> priority. (Alternatively I might possibly speed up gcc by not using
> single-host and no -O flag. How can I achieve those settings from
> inside
> gsc (when using |compile-file|), btw?)
You have to change ~~/bin/gsc-cc-o so that no options are passed to
gcc, and then you pass the C compiler options you want as the third
option of compile-file:
(compile-file "foo.scm" '() "-O0")
The arguments of compile-file are:
(compile-file <filename> [<options> [<cc-options> [<ld-options>]]])
I'll add this to the documentation...
Marc
More information about the Gambit-list
mailing list