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
Problems with ocamlopt under windows?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: STARYNKEVITCH Basile <Basile.Starynkevitch@c...>
Subject: Problems with ocamlopt under windows?
>>>>> "Manuel" == Manuel Fahndrich <> writes:

    Manuel> I'm wondering if other people are experiencing problems
    Manuel> with ocamlopt under windows.

This is probably not Windows related, but x86 related. I discovered it
on Linux/x86 too.

    Manuel> I have a program that works fine as bytecode, but it runs
    Manuel> out of stack space when compiled with ocamlopt. I'm
    Manuel> suspecting an infinite loop.

On x86 (and other architectures too) tail-recursive 
calls are passing their arguments thru the machine registers. The x86
has only few of them (8, of which a couple of them are reserved).

So a tail-recursive call with more than about 6 or 7 arguments is not
executed tail-recursively (in constant stack space) but pushes stuff
on the stack.

On the bytecode machine all tail-rec calls are done correctly (in
constant stack space) even those with many arguments.

(I did happen to tell this bug to Ocaml developper team at JFLA2000 in
february 2000).

My wish would be at least an ocamlopt warning when the ocamlopt
compile handles a big tail-recursive call as a non-tail-rec one.


N.B. Any opinions expressed here are only mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
DTA/LETI/DEIN/SLA * CEA/Saclay b.528 (p111f) * 91191 GIF/YVETTE CEDEX * France
phone: 1,; fax: home: 1,
email: Basile point Starynkevitch at cea point fr