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 B5DA37ED5C for ; Mon, 6 Aug 2012 14:16:43 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dmitry.bely@gmail.com) identity=pra; client-ip=209.85.212.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dmitry.bely@gmail.com"; x-sender="dmitry.bely@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of dmitry.bely@gmail.com designates 209.85.212.54 as permitted sender) identity=mailfrom; client-ip=209.85.212.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dmitry.bely@gmail.com"; x-sender="dmitry.bely@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-vb0-f54.google.com) identity=helo; client-ip=209.85.212.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="dmitry.bely@gmail.com"; x-sender="postmaster@mail-vb0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjECALWPH1DRVdQ2jWdsb2JhbABFuTYIIgEBAQEJCQsJEgYjgiABAQEEEgIsARseAwwGBQsNLiIBEQEFARwZIodbAQMMnQIJA4wjgnGEXgoZJw1XiHEBBQyLPoNogxwDiEeNAo4vPoQD X-IronPort-AV: E=Sophos;i="4.77,718,1336341600"; d="scan'208";a="152526488" Received: from mail-vb0-f54.google.com ([209.85.212.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Aug 2012 14:16:42 +0200 Received: by vbmv11 with SMTP id v11so2018470vbm.27 for ; Mon, 06 Aug 2012 05:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=oAMR0T4ah4DZ2PKUgjB60hhGNTEGenT7ffNSRKDvGfE=; b=pN09vE037LxjVwst1+QvI2OQ04WPNR5apUEtvw+JI42RHBGx3JtvuznTPtMc3l0OHw UEFXRtWyOFr/PBr9lOj967iuz5oPAy0OWnepUzhe7dWr5f8OuzVdOVqXghvKStEYk2IT zL9QR97e2uA6YvlrIYTah043qpJ3nPdffDyAzn4N2V3JytqbYZyIjRvHGadnp4DJwkGc ywKalSnUkz+6z4dJf7pHNNuJeIzJDe1k35662j7LTk8n4e72+qdxStK8exIPZuTvMz0/ UfjDHwSNhnZW3pqzgl043oG6dHzdbpoZB2/9738PdwdKX4t4zZfxN4/8cpQ8PUdI/lid 8nDA== MIME-Version: 1.0 Received: by 10.52.21.174 with SMTP id w14mr6841485vde.24.1344255401993; Mon, 06 Aug 2012 05:16:41 -0700 (PDT) Received: by 10.220.117.66 with HTTP; Mon, 6 Aug 2012 05:16:41 -0700 (PDT) In-Reply-To: <501FAB4A.107@frisch.fr> References: <501F9855.6080709@frisch.fr> <501F9DB9.2050805@frisch.fr> <501FAB4A.107@frisch.fr> Date: Mon, 6 Aug 2012 16:16:41 +0400 Message-ID: From: Dmitry Bely To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Compiler bug? On Mon, Aug 6, 2012 at 3:32 PM, Alain Frisch wrote: > 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. OK, you are right. Now I think I understand better how it works. So the problem is elsewhere (as expected). Thanks for the help! - Dmitry Bely