< prev index next >
src/share/vm/oops/valueKlass.cpp
Print this page
@@ -40,17 +40,22 @@
}
return NULL;
}
int ValueKlass::first_field_offset() {
- // Really inefficient, should be cached somewhere
+#ifdef ASSERT
instanceKlassHandle k(this);
int first_offset = INT_MAX;
for (JavaFieldStream fs(k()); !fs.done(); fs.next()) {
if (fs.offset() < first_offset) first_offset= fs.offset();
}
- return first_offset;
+#endif
+ int base_offset = instanceOopDesc::base_offset_in_bytes();
+ // The first field of value types is aligned on a long boundary
+ base_offset = align_size_up(base_offset, BytesPerLong);
+ assert(base_offset = first_offset, "inconsistent offsets");
+ return base_offset;
}
bool ValueKlass::is_atomic() {
return (nonstatic_field_size() * heapOopSize) <= longSize;
}
< prev index next >