Re: location of static data (was Re: Problem in Thread.c)

Etienne Gagnon <[email protected]> Mon, 17 Apr 2006 00:09:07 -0400
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--===============1792299578==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enigB0BDDDC71C5C0B99101607BC"

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

Chris Pickett wrote:
> Is it the case that in INVOKESTATIC, the line below deferences an
> _svmt_object_instance ** to an _svmt_object_instance *, and that the ** is
> not located on the heap but the * is?
> 
>   _svmt_object_instance *instance = *(method->class_info->class_instance);

- The method_info structure is located in class loader memory.
- Its class_info field points to a class_info structure, also located in
  class loader memory.
- Its class_instance field point to a global native reference, located
  in globally malloc'ed memory (outside of the heap).
- *(...->class_instance) is the address of the class instance (stored in
  the global native reference).

In other words:
 class_instance -points-to-> native_reference -points-to-> instance
  (cl memory)                 (malloc memory)               (heap)

> When PUTSTATIC_<X> is executed, where does that write?  Previously, I
> thought it wrote to a class field that was outside of the heap.

Yes, for primitive types.

For reference types, it writes to a global native reference.  It's the
address of the global native reference that is stored in the class_info
structure.  This class_instance field is initialized once at class
loading time.

> Do the Class instances move on GC?

Yep.  SableVM's copying GC is a brain dumb copy everything one.  Of
course, with generations, such instances would be put in the oldest
generation.  One could even think of a non-moving heap part for class
instances of classes loaded by the bootstrap class loader.

> If so does that mean the jvalue * below from PUTSTATIC_<X>, which is
> stored in the code array, gets updated when GC happens?
> 
>   jvalue *pvalue = (pc++)->pvalue;
>   pvalue->$3 = stack[--stack_size].$2;

jvalue is not an object.  It is a simple field in the class_info
structure.  It never moves.

Hoping this clarifies things for you. :-)

Etienne

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

--------------enigB0BDDDC71C5C0B99101607BC
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

iD8DBQFEQxTkjyrJi4rH84gRArZUAJ9pAlfheOP0cUdijXZEASlYpDNgxACeMELH
ezSv2DaEHF/cTJ/wudnpwdM=
=bRJ7
-----END PGP SIGNATURE-----

--------------enigB0BDDDC71C5C0B99101607BC--


--===============1792299578==
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

--===============1792299578==--