Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] [ANN] The Missing Library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Wolfgang Lux <wlux@u...>
Subject: [Caml-list] Re: Tail-calls in C code (was: [ANN] The Missing Library)
Marcin 'Qrczak' Kowalczyk wrote:

> The portable variant uses the well-known trampoline style, where each C
> function returns a pointer to the next function to jump into. The stack
> is managed explicitly. But for x86 I process the assembler output of 
> gcc
> and convert code which returns an address (marked with a comment in 
> asm)
> with a jump. This increased performance by about 30%.
>
> If the compiler is ever used on other architectures, someone who knows
> other assemblers might extend the mangler to handle them. I only know
> the x86 assembly.

You can find a somewhat more portable way to achieve a similar effect
using Gnu C in order to emit ``portable assembler'' code instead of
post-processing the compiled assembler code here:
   Fergus Henderson and Thomas Conway and Zoltan Somogyi,
   Compiling logic programs to {C} using {GNU C} as a portable assembler,
   Proc. ILPS '95 Postconference Workshop on Sequential Implementation
   Technologies for Logic Programming, pp. 1-15.
   http://www.cs.mu.oz.au/mercury/information/papers/mercury_to_c.ps.gz

I'm using that in my Curry compiler as well and it works nicely on 
Linux,
Solaris, and other OSes as long as you do not want to compile position
independent code. Unfortunately, it doesn't work on Mac OS X for exactly
that reason.

Wolfgang

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners