From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA12288; Sat, 17 May 2003 15:21:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA11435 for ; Sat, 17 May 2003 15:21:56 +0200 (MET DST) Received: from pacific-carrier-annex.mit.edu (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.7.21.83]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h4HDLtT12201; Sat, 17 May 2003 15:21:55 +0200 (MET DST) Received: from grand-central-station.mit.edu (GRAND-CENTRAL-STATION.MIT.EDU [18.7.21.82]) by pacific-carrier-annex.mit.edu (8.12.4/8.9.2) with ESMTP id h4HDLsZ1005341; Sat, 17 May 2003 09:21:54 -0400 (EDT) Received: from manawatu-mail-centre.mit.edu (MANAWATU-MAIL-CENTRE.MIT.EDU [18.7.7.71]) by grand-central-station.mit.edu (8.12.4/8.9.2) with ESMTP id h4HDLrTX004024; Sat, 17 May 2003 09:21:53 -0400 (EDT) Received: from psi-phi.mit.edu (PSI-PHI.MIT.EDU [18.187.1.35]) ) by manawatu-mail-centre.mit.edu (8.12.4/8.12.4) with ESMTP id h4HDLrFJ002168; Sat, 17 May 2003 09:21:53 -0400 (EDT) Received: (from jfc@localhost) by psi-phi.mit.edu (8.9.3p2) id JAA30974; Sat, 17 May 2003 09:21:52 -0400 Message-Id: <200305171321.JAA30974@psi-phi.mit.edu> To: Xavier Leroy cc: OCaml List Subject: Re: [Caml-list] POSIX Threads: kill In-Reply-To: Your message of "Fri, 16 May 2003 11:54:10 +0200." <20030516115410.A8817@pauillac.inria.fr> Date: Sat, 17 May 2003 09:21:52 -0400 From: John Carr X-Spam: no; 0.00; jfc:01 caml-list:01 posix:01 threads:01 unwind:01 systhreads:01 runtime:01 descriptor:01 model:01 ocaml:01 caml:01 handler:01 descriptors:01 equation:01 overflow:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > The problem is that C++ exception handling is based on unwinding stack > frames one by one till a matching exception handler is found. This > requires stack frames to adhere strictly to a particular format, and > be equipped with stack descriptors that the C++ stack unwind mechanism > understands. But of course the stack frames used ocamlopt-generated > code do not adhere to this format, and do not come with C++ stack > descriptors. Hence, if the "systhreads" library was using > pthread_exit and pthread_cancel, the C/C++ runtime system would try to > unwind Caml stack frames, and just crash the whole program. If I recall correctly, on some systems this is an easy problem to solve because there is little or no runtime overhead in using the standard stack layout and stack descriptor overhead. On the other hand, ocaml does not use register windows on SPARC and fixing that would be a big change. Did somebody determine that the "flat" model was faster, or was it just easier to implement? SPARC v9 may change the equation because it was designed to make save and restore instructions fast, reducing window overflow traps to under 50 cycles. (I remember trying to mix C++, exceptions, and threads back in 1995. The combination was so unreliable that I gave up. If a program used exceptions the exception handlers interfered with thread stack unwinding and caused core dumps inside the Solaris C++ support library.) ------------------- 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