Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2004-05-03 (11:31)
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.

I'm using that in my Curry compiler as well and it works nicely on 
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.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: