提交 f8d4bcb8 编写于 作者: R roland

8054054: 8040121 is broken

Summary: C++ code pattern from 8040121 is incorrect
Reviewed-by: kvn
上级 02c05fb8
...@@ -783,7 +783,8 @@ void Compile::FillLocArray( int idx, MachSafePointNode* sfpt, Node *local, ...@@ -783,7 +783,8 @@ void Compile::FillLocArray( int idx, MachSafePointNode* sfpt, Node *local,
// grow downwards in all implementations. // grow downwards in all implementations.
// (If, on some machine, the interpreter's Java locals or stack // (If, on some machine, the interpreter's Java locals or stack
// were to grow upwards, the embedded doubles would be word-swapped.) // were to grow upwards, the embedded doubles would be word-swapped.)
jlong_accessor acc = { jlong_cast(d) }; jlong_accessor acc;
acc.long_value = jlong_cast(d);
array->append(new ConstantIntValue(acc.words[1])); array->append(new ConstantIntValue(acc.words[1]));
array->append(new ConstantIntValue(acc.words[0])); array->append(new ConstantIntValue(acc.words[0]));
#endif #endif
...@@ -802,7 +803,8 @@ void Compile::FillLocArray( int idx, MachSafePointNode* sfpt, Node *local, ...@@ -802,7 +803,8 @@ void Compile::FillLocArray( int idx, MachSafePointNode* sfpt, Node *local,
// grow downwards in all implementations. // grow downwards in all implementations.
// (If, on some machine, the interpreter's Java locals or stack // (If, on some machine, the interpreter's Java locals or stack
// were to grow upwards, the embedded doubles would be word-swapped.) // were to grow upwards, the embedded doubles would be word-swapped.)
jlong_accessor acc = { d }; jlong_accessor acc;
acc.long_value = d;
array->append(new ConstantIntValue(acc.words[1])); array->append(new ConstantIntValue(acc.words[1]));
array->append(new ConstantIntValue(acc.words[0])); array->append(new ConstantIntValue(acc.words[0]));
#endif #endif
......
...@@ -42,29 +42,34 @@ typedef union { ...@@ -42,29 +42,34 @@ typedef union {
} DoubleIntConv; } DoubleIntConv;
static inline int high(double d) { static inline int high(double d) {
DoubleIntConv x = { d }; DoubleIntConv x;
x.d = d;
return x.split.hi; return x.split.hi;
} }
static inline int low(double d) { static inline int low(double d) {
DoubleIntConv x = { d }; DoubleIntConv x;
x.d = d;
return x.split.lo; return x.split.lo;
} }
static inline void set_high(double* d, int high) { static inline void set_high(double* d, int high) {
DoubleIntConv conv = { *d }; DoubleIntConv conv;
conv.d = *d;
conv.split.hi = high; conv.split.hi = high;
*d = conv.d; *d = conv.d;
} }
static inline void set_low(double* d, int low) { static inline void set_low(double* d, int low) {
DoubleIntConv conv = { *d }; DoubleIntConv conv;
conv.d = *d;
conv.split.lo = low; conv.split.lo = low;
*d = conv.d; *d = conv.d;
} }
static double copysignA(double x, double y) { static double copysignA(double x, double y) {
DoubleIntConv convX = { x }; DoubleIntConv convX;
convX.d = x;
convX.split.hi = (convX.split.hi & 0x7fffffff) | (high(y) & 0x80000000); convX.split.hi = (convX.split.hi & 0x7fffffff) | (high(y) & 0x80000000);
return convX.d; return convX.d;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册