mirror of
https://github.com/corda/corda.git
synced 2025-06-06 01:11:45 +00:00
fix Set[Static]DoubleField regression for 32-bit platforms
We were truncating 64-bit doubles to 32-bit values with zany results.
This commit is contained in:
parent
9aae57ee03
commit
6dc9c98604
@ -1631,7 +1631,7 @@ setDoubleField(Thread* t, uintptr_t* arguments)
|
|||||||
{
|
{
|
||||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||||
object field = getField(t, arguments[1]);
|
object field = getField(t, arguments[1]);
|
||||||
jdouble v = bitsToDouble(arguments[2]);
|
jdouble v; memcpy(&v, arguments + 2, sizeof(jdouble));
|
||||||
|
|
||||||
PROTECT(t, field);
|
PROTECT(t, field);
|
||||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||||
@ -1644,9 +1644,10 @@ setDoubleField(Thread* t, uintptr_t* arguments)
|
|||||||
void JNICALL
|
void JNICALL
|
||||||
SetDoubleField(Thread* t, jobject o, jfieldID field, jdouble v)
|
SetDoubleField(Thread* t, jobject o, jfieldID field, jdouble v)
|
||||||
{
|
{
|
||||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
uintptr_t arguments[2 + (sizeof(jdouble) / BytesPerWord)];
|
||||||
field,
|
arguments[0] = reinterpret_cast<uintptr_t>(o);
|
||||||
doubleToBits(v) };
|
arguments[1] = field;
|
||||||
|
memcpy(arguments + 2, &v, sizeof(jdouble));
|
||||||
|
|
||||||
run(t, setDoubleField, arguments);
|
run(t, setDoubleField, arguments);
|
||||||
}
|
}
|
||||||
@ -2133,7 +2134,7 @@ setStaticDoubleField(Thread* t, uintptr_t* arguments)
|
|||||||
initClass(t, jclassVmClass(t, *c));
|
initClass(t, jclassVmClass(t, *c));
|
||||||
|
|
||||||
object field = getStaticField(t, arguments[1]);
|
object field = getStaticField(t, arguments[1]);
|
||||||
jdouble v = bitsToDouble(arguments[2]);
|
jdouble v; memcpy(&v, arguments + 2, sizeof(jdouble));
|
||||||
|
|
||||||
PROTECT(t, field);
|
PROTECT(t, field);
|
||||||
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
ACQUIRE_FIELD_FOR_WRITE(t, field);
|
||||||
@ -2147,9 +2148,10 @@ setStaticDoubleField(Thread* t, uintptr_t* arguments)
|
|||||||
void JNICALL
|
void JNICALL
|
||||||
SetStaticDoubleField(Thread* t, jobject c, jfieldID field, jdouble v)
|
SetStaticDoubleField(Thread* t, jobject c, jfieldID field, jdouble v)
|
||||||
{
|
{
|
||||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c),
|
uintptr_t arguments[2 + (sizeof(jdouble) / BytesPerWord)];
|
||||||
field,
|
arguments[0] = reinterpret_cast<uintptr_t>(c);
|
||||||
doubleToBits(v) };
|
arguments[1] = field;
|
||||||
|
memcpy(arguments + 2, &v, sizeof(jdouble));
|
||||||
|
|
||||||
run(t, setStaticDoubleField, arguments);
|
run(t, setStaticDoubleField, arguments);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user