mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
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:
parent
d4da92d300
commit
7bea2b6b7d
@ -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:
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user