Re: location of static data
Etienne Gagnon <[email protected]> Mon, 17 Apr 2006 10:08:21 -0400
| Newsgroups | gmane.comp.java.vm.sablevm.devel |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--===============1430774952==
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature";
boundary="------------enig5CC708FA23C4779C25EFCC14"
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig5CC708FA23C4779C25EFCC14
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Chris Pickett wrote:
>>>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.
>
> Ok, I can see that now. It writes to some element of _svmt_field_info
> *fields in _svmt_class_info.
Not really. Actually, it's all stored in a _svmt_field_info structure
which is accessible from the class_info.
struct _svmt_class_field_data_struct
{
jvalue value;
};
struct _svmt_field_info_struct
{
...
union
{
_svmt_instance_field_data instance_field;
_svmt_class_field_data class_field;
}
data;
};
To understand all the little details, why don't you a have a look at
prepare.c:
_svmf_prepare_noninterface_fields
{
...
if (_svmf_is_set_flag (class->fields[i].access_flags,
SVM_ACC_STATIC))
{
/* if reference, allocate native global */
if (class->fields[i].type == SVM_TYPE_REFERENCE)
{
if (_svmm_new_native_global
(env,
class->fields[i].data.class_field.value.l) !=
JNI_OK)
{
return JNI_ERR;
}
}
}
...
}
>
>
>>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.
>
>
> I'm a little confused here by the last sentence above. I meant when you
> write to any static reference:
>
> static Object o;
>
> static void m() {
> o = new Object();
> }
See above.
> from PUTSTATIC_REFERENCE. The address of the global native reference is
> stored in fields[] like the primitive type fields. In the code above this
> address is pvalue->l. The global native ref is *(pvalue->l).
Yep.
May the Source be with you! ;-)
Etienne
--
Etienne M. Gagnon, Ph.D. http://www.info2.uqam.ca/~egagnon/
SableVM: http://www.sablevm.org/
SableCC: http://www.sablecc.org/
--------------enig5CC708FA23C4779C25EFCC14
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
iD8DBQFEQ6FVjyrJi4rH84gRAozjAJ49WdYLLgEV3GVUkQ9Wb9XFm+N0sQCfUszc
HClorQIFz2WxZ8DqqgQl5Ok=
=c4rU
-----END PGP SIGNATURE-----
--------------enig5CC708FA23C4779C25EFCC14--
--===============1430774952==
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
--===============1430774952==--