aboutsummaryrefslogtreecommitdiff
path: root/libjava/boehm.cc
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@mckinlay.net.nz>2003-09-29 07:13:40 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2003-09-29 08:13:40 +0100
commite7c4333b11f72d09dd2d1d8df45182bbee92e72f (patch)
tree1397c42e60d3ad4a753c51532cfbbe1d9cbc64da /libjava/boehm.cc
parent5560a945d8497667c898b73d3f4eea2f4ad016d8 (diff)
boehm.cc (_Jv_BuildGCDescr): Put first word of object in most significant bit of descriptor.
* boehm.cc (_Jv_BuildGCDescr): Put first word of object in most significant bit of descriptor. Include the vtable and sync_info fields. From-SVN: r71895
Diffstat (limited to 'libjava/boehm.cc')
-rw-r--r--libjava/boehm.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/libjava/boehm.cc b/libjava/boehm.cc
index 95721c7fbeb..af5f979197d 100644
--- a/libjava/boehm.cc
+++ b/libjava/boehm.cc
@@ -331,12 +331,20 @@ void *
_Jv_BuildGCDescr(jclass self)
{
jlong desc = 0;
+ jint bits_per_word = CHAR_BIT * sizeof (void *);
// Note: for now we only consider a bitmap mark descriptor. We
// could also handle the case where the first N fields of a type are
// references. However, this is not very likely to be used by many
// classes, and it is easier to compute things this way.
+ // The vtable pointer.
+ desc |= 1ULL << (bits_per_word - 1);
+#ifndef JV_HASH_SYNCHRONIZATION
+ // The sync_info field.
+ desc |= 1ULL << (bits_per_word - 2);
+#endif
+
for (jclass klass = self; klass != NULL; klass = klass->getSuperclass())
{
jfieldID field = JvGetFirstInstanceField(klass);
@@ -351,13 +359,12 @@ _Jv_BuildGCDescr(jclass self)
if (off % sizeof (void *) != 0)
return (void *) (GCJ_DEFAULT_DESCR);
off /= sizeof (void *);
- // Bottom 2 bits are reserved.
- off += 2;
// If we find a field outside the range of our bitmap,
- // fall back to procedure marker.
- if (off > CHAR_BIT * sizeof (void *))
+ // fall back to procedure marker. The bottom 2 bits are
+ // reserved.
+ if (off >= bits_per_word - 2)
return (void *) (GCJ_DEFAULT_DESCR);
- desc |= 1ULL << off;
+ desc |= 1ULL << (bits_per_word - off - 1);
}
field = field->getNextField();