caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dmitry.bely@gmail.com>
To: Damien Doligez <damien.doligez@inria.fr>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] GC interface question
Date: Fri, 1 Jul 2011 16:06:40 +0400	[thread overview]
Message-ID: <BANLkTintOnuK6ioEU1M_Uu0YVw9Jn-xoCA@mail.gmail.com> (raw)
In-Reply-To: <77C1708E-F0E9-4630-BDA5-9B81C51DC5B1@inria.fr>

On Fri, Jul 1, 2011 at 3:49 PM, Damien Doligez <damien.doligez@inria.fr> wrote:
>
> On 2011-07-01, at 11:09, Dmitry Bely wrote:
>
>> Does this fragment violate GC interface rules:
>>
>>  Begin_roots_block(_varg, 2)
>>    _varg[0] = ((struct camlidl_intf *) this)->caml_object;
>>    _varg[1] = camlidl_alloc_small(1, Abstract_tag);
>>    Field(_varg[1], 0) = (value) log;
>>  End_roots();
>>  _vres = caml_callbackN_exn(caml_get_public_method(_varg[0],
>> Val_int(1007700946)), 2, _varg);
>>
>> It's unsafe to pass _varg to caml_callbackN_exn when it is not
>> referenced from local_roots, right?
>
>
> You're right, this code looks buggy.

I tend to think now that this part is OK; _varg is not used after
caml_callbackN_exn so local_roots are not needed. But what happens
inside caml_callbackN_exn()? How it assures that _varg is not
garbage-collected before the closure is applied?

This is camlidl-generated code (slightly modified to be thread-safe)
and I have an access violation (segmentation fault) error in
multi-threaded environment under heavy load. Just trying to figure out
what can be wrong here...

- Dmitry Bely


  reply	other threads:[~2011-07-01 12:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01  9:09 Dmitry Bely
2011-07-01 11:49 ` Damien Doligez
2011-07-01 12:06   ` Dmitry Bely [this message]
2011-07-01 11:56 ` Fabrice Le Fessant
2011-07-01 12:54   ` Dmitry Bely
2011-07-01 13:37     ` Fabrice Le Fessant
2011-07-01 14:44       ` Dmitry Bely
     [not found]       ` <801099288.1616121.1309531501115.JavaMail.root@zmbs4.inria.fr>
2011-07-01 15:09         ` Fabrice Le Fessant
2011-07-01 15:41           ` Dmitry Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTintOnuK6ioEU1M_Uu0YVw9Jn-xoCA@mail.gmail.com \
    --to=dmitry.bely@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=damien.doligez@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).