From: David Gurr <gurr@mrs.med.ge.com>
To: frisch@clipper.ens.fr
Cc: caml-list@inria.fr, gurr@mrs.mrs.med.ge.com
Subject: GC of custom blocks Re: [Caml-list] User-defined equality on types?
Date: Thu, 19 Apr 2001 15:31:41 -0700 (PDT) [thread overview]
Message-ID: <200104192231.PAA21666@mrs.mrs.med.ge.com> (raw)
Alain Frisch:
> I support this suggestion. The standard equality/ordering/hashing
> functions are often adequate for most of the data structures, and it would
> be useful to use them and just place a hook on specific types to provide
> specialized implementation. It could almost be done with
> the "custom" block tag; the problem is that such blocks are not garbage
> collected. What about "custom Caml blocks" ?
The memory manager Cmm (not to be confused with the IL in ocamlopt)
gives a generic garbage collection interface that allows custom garbage
collectors and custom heaps in such a way that one can use multiple
collectors with multiple heaps including collection of cross heap
pointers. It is designed to do garbage collection of C++ so it is
complicated by C++ details. But the basic design is good. To use the
Cmm design with custom blocks would require
-- defining a heap interface type
struct heap_operations {
value (*alloc)(heap h, unsigned long size, mlsize_t mem, mlsize_t max);
value (*alloc_block)(heap h, tag_t tag, mlsize_t size, mlsize_t mem, mlsize_t max);
void (*register_root)(heap h, value r);
void (*unregister_root)(heap h, value r);
void (*scavenge)(heap h, value v); /* ie mark, copy, etc */
void (*collect)(heap h);
void (*collect_slice)(heap h); /* may need more parameters */
void (*compact)(heap h);
};
-- an addtional operation pointer:
struct custom_operations {
...
void (*traverse)(value v); /* walks v calling scavenge on its pointers */
};
-- using the existing minor and major heaps to implement heap interfaces
value alloc_shr_prime(heap h, tag_t tag, mlsize_t size, mlsize_t mem, mlsize_t max){
return alloc_shr(tag,size);
}
...
struct heap_operations major_heap = {
0, /* you can only alloc standard blocks in the major heap */
&alloc_shr_prime,
®ister_global_root_prime,
... };
See
ftp://ftp.di.unipi.it/pub/project/posso/cmm/
for Cmm papers and source. Kaffe (an open source Java implementation)
also has custom allocators and collectors but I have forgotten the details.
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
reply other threads:[~2001-04-19 22:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200104192231.PAA21666@mrs.mrs.med.ge.com \
--to=gurr@mrs.med.ge.com \
--cc=caml-list@inria.fr \
--cc=frisch@clipper.ens.fr \
--cc=gurr@mrs.mrs.med.ge.com \
/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