fix regression in static field offset calculation

One of the changes in commit 5b4f179 broke this calculation.
This commit is contained in:
Joel Dice 2011-09-28 11:12:21 -06:00
parent 0372d999d3
commit 4e4d109787
2 changed files with 7 additions and 4 deletions

View File

@ -496,8 +496,10 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
}
if (fieldFlags(t, field) & ACC_STATIC) {
while (targetStaticOffset % targetSize) {
++ targetStaticOffset;
unsigned excess = (targetStaticOffset % targetSize)
% TargetBytesPerWord;
if (excess) {
targetStaticOffset += TargetBytesPerWord - excess;
}
buildStaticOffset = fieldOffset(t, field);

View File

@ -1145,8 +1145,9 @@ parseFieldTable(Thread* t, Stream& s, object class_, object pool)
unsigned size = fieldSize(t, code);
if (flags & ACC_STATIC) {
while (staticOffset % size) {
++ staticOffset;
unsigned excess = (staticOffset % size) % BytesPerWord;
if (excess) {
staticOffset += BytesPerWord - excess;
}
fieldOffset(t, field) = staticOffset;