fix putstatic/putfield for 64-bit volatiles

We must call acquireMonitorForObject before popping the
putstatic/pushfield operands off the stack to avoid clobbering said
operands.
This commit is contained in:
Joel Dice 2011-05-23 12:35:01 -06:00
parent d4da92d300
commit 7bea2b6b7d
2 changed files with 21 additions and 13 deletions

View File

@ -5521,18 +5521,6 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
}
}
Compiler::Operand* value = popField(t, frame, fieldCode);
Compiler::Operand* table;
if (instruction == putstatic) {
PROTECT(t, field);
table = frame->append(staticTable);
} else {
table = frame->popObject();
}
if (fieldFlags(t, field) & ACC_VOLATILE) {
if (BytesPerWord == 4
and (fieldCode == DoubleField or fieldCode == LongField))
@ -5550,6 +5538,18 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
}
}
Compiler::Operand* value = popField(t, frame, fieldCode);
Compiler::Operand* table;
if (instruction == putstatic) {
PROTECT(t, field);
table = frame->append(staticTable);
} else {
table = frame->popObject();
}
switch (fieldCode) {
case ByteField:
case BooleanField:

View File

@ -1,4 +1,10 @@
public class Longs {
public class Longs {
private static volatile long volatileLong = getConstant();
private static long getConstant() {
return 0x123456789ABCDEFL;
}
private static void expect(boolean v) {
if (! v) throw new RuntimeException();
}
@ -60,6 +66,8 @@ public class Longs {
}
public static void main(String[] args) throws Exception {
expect(volatileLong == getConstant());
{ long a = 0x1FFFFFFFFL;
long b = -1;
expect(a != b);