software/dgc/naive.git
2 years agoUse mmap to allocate cells and mprotect to watch them mmap-mprotect
Leandro Lucarella [Sun, 30 Aug 2009 03:33:07 +0000]
Use mmap to allocate cells and mprotect to watch them

Cells are allocated using mmap() to be able to easily mprotect() cell data
to detect mutator reads/writes to freed/swept cells. Using mprotect()
makes the program die with a SIGSEGV *exactly* where it tried to use a
free cell.

This patch assumes a page size of 4096, it uses a full page for the cell
header to be able to mprotect just the cell data (because mprotect ca only
protect full pages), allowing the GC to keep manipulating cell headers as
needed.

2 years agoCompare pointers explicitly against null using is and !is master
Leandro Lucarella [Sun, 6 Sep 2009 20:26:03 +0000]
Compare pointers explicitly against null using is and !is

2 years agoMove cell allocation and freeing to Cell struct
Leandro Lucarella [Sun, 6 Sep 2009 19:35:17 +0000]
Move cell allocation and freeing to Cell struct

This ensures proper Cell initialization and group cell allocation and
freeing in one place, making easier to change the implementation.

2 years agoMake realloc() handle null as a malloc() result
Leandro Lucarella [Sun, 30 Aug 2009 19:29:52 +0000]
Make realloc() handle null as a malloc() result

2 years agoMake calloc() handle null as a malloc() result
Leandro Lucarella [Sun, 30 Aug 2009 19:29:00 +0000]
Make calloc() handle null as a malloc() result

3 years agoInitialize capacity to 0 when allocating a new cell
Alberto Bertogli [Fri, 15 May 2009 02:18:09 +0000]
Initialize capacity to 0 when allocating a new cell

Otherwise, when later we do cell.capacity == 0 we're using uninitialized
memory and can return the wrong result if we're not lucky enough to get 0s.

3 years agoWhen doing a realloc(), take the size of the type into account
Alberto Bertogli [Fri, 15 May 2009 02:18:07 +0000]
When doing a realloc(), take the size of the type into account

3 years agoFix some comments
Alberto Bertogli [Fri, 15 May 2009 02:18:06 +0000]
Fix some comments

Mostly typos and missing 's', but also some minor style improvements.

3 years agoRemove invalid TODO comment
Leandro Lucarella [Fri, 1 May 2009 22:40:51 +0000]
Remove invalid TODO comment

3 years agoRemove alloc module, move all other modules to gc/ and document v0.9
Leandro Lucarella [Sat, 25 Apr 2009 23:37:44 +0000]
Remove alloc module, move all other modules to gc/ and document

There are another bugfixes and restructuration (like debug prints
removal). This version should be the initial commit, the previos version
is keeped only because the alloc module can be useful in the future for
other implementations.

3 years agoInitial import
Leandro Lucarella [Sat, 18 Apr 2009 19:53:22 +0000]
Initial import

All is pretty functional. The alloc module will probably have to go (we
don't want that kind of complexity here).