Re: Problem in Thread.c

Etienne Gagnon <[email protected]> Sun, 16 Apr 2006 19:06:45 -0400
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--===============1759443121==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enigE317713008BED40DE5573561"

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigE317713008BED40DE5573561
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Sebastien,

As you probably saw in gc_copying.c, these are the only roots.  Except
that, in your case, there are additional roots: the inter-generational
pointers.  So, I guess you missed some write barrier somewhere.

A good way to detect that would be to do the following:

1- add an "identity" field to _svmt_object_instance and
   _svmt_array_instance (after the lockword along the magic field).
2- add a global counter in _svmt_JavaVM and assign a unique increasing
   identity to every allocated instance (object and array).

then, at every gc:

3- save a copy of the current heap. (copy A)
4- do a generational gc.
5- save a copy of the resulting heap. (copy B)
6- restore the heap from copy A.
7- do a copying gc.
8- save a copy of the resulting heap. (copy C)
9- compare the surviving objects (using the identity field) of copy B
   and copy C.

When you find a difference, you'll have to narrow down your search to
locate the culprit code that doesn't call the write barrier.  This can
be done by triggering more frequent GCs (using the switch interpreter
and a counter on the number of executed bytecodes).

You should definitely protect such code by some C #ifdef and add a
configure.ac option to turn it on/off.  This code would be a general
facility for debugging new GCs.

Have fun!

Etienne

S=E9bastien Adam wrote:
> When I collect the garbage I pass through the stack of each thread to
> get the roots.  In addition, I scavenge the heap. Each root is then
> updated... Maybe should I pass through some other roots...

--=20
Etienne M. Gagnon, Ph.D.            http://www.info2.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/


--------------enigE317713008BED40DE5573561
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEQs4FjyrJi4rH84gRAkDDAJ92CujMYP9q0fmxZnCPGyu4BtHQSQCcDZvM
s28EdP+DY05vmhsIIomvLA8=
=kG4/
-----END PGP SIGNATURE-----

--------------enigE317713008BED40DE5573561--


--===============1759443121==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
SableVM-devel mailing list
[email protected]
http://sablevm.org/lists/control/listinfo/sablevm-devel

--===============1759443121==--