From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 47A0B7ED5C for ; Mon, 6 Aug 2012 13:32:29 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=193.252.23.211; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=193.252.23.211; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@msa.smtpout.orange.fr) identity=helo; client-ip=193.252.23.211; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@msa.smtpout.orange.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoUCALWPH1DB/BfTlGdsb2JhbABFtg2DUwEBAQEJCwkJFAMkgiABAQU4QRALGAklDwJGBg0BBwEBiA27IYtKhwQDlUmFW40S X-IronPort-AV: E=Sophos;i="4.77,718,1336341600"; d="scan'208";a="152523275" Received: from msa02.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.211]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Aug 2012 13:32:28 +0200 Received: from [192.168.1.105] ([86.195.1.229]) by mwinf5d27 with ME id jPYT1j00A4wTVSm03PYTk6; Mon, 06 Aug 2012 13:32:28 +0200 Message-ID: <501FAB4A.107@frisch.fr> Date: Mon, 06 Aug 2012 13:32:26 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Dmitry Bely CC: caml-list@inria.fr References: <501F9855.6080709@frisch.fr> <501F9DB9.2050805@frisch.fr> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Compiler bug? On 08/06/2012 01:03 PM, Dmitry Bely wrote: > _caml_call_gc: > ; Record lowest stack address and return address > mov eax, [esp] > mov _caml_last_return_address, eax > lea eax, [esp+4] > mov _caml_bottom_of_stack, eax > ; Save all regs used by the code generator > L105: push ebp > push edi > push esi > push edx > push ecx > push ebx > push eax > mov _caml_gc_regs, esp > ; Call the garbage collector > call _caml_garbage_collection > ; Restore all regs used by the code generator > pop eax > pop ebx > pop ecx > pop edx > pop esi > pop edi > pop ebp > ; Return to caller > ret > > it preserves registers and so it cannot update them No, this code does not preserves registers. It stores them on the stack, pass a pointer to them to the C code (in caml_gc_regs), and then restore their values from the stack. In between, the C code has updated the values on the stack, so the restored values are not the saved ones. -- Alain