Thu, 31 Jul 2014 19:59:36 +0200
8054054: 8040121 is broken
Summary: C++ code pattern from 8040121 is incorrect
Reviewed-by: kvn
src/share/vm/opto/output.cpp | file | annotate | diff | comparison | revisions | |
src/share/vm/runtime/sharedRuntimeMath.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/opto/output.cpp Tue Jul 29 13:56:29 2014 +0200 1.2 +++ b/src/share/vm/opto/output.cpp Thu Jul 31 19:59:36 2014 +0200 1.3 @@ -783,7 +783,8 @@ 1.4 // grow downwards in all implementations. 1.5 // (If, on some machine, the interpreter's Java locals or stack 1.6 // were to grow upwards, the embedded doubles would be word-swapped.) 1.7 - jlong_accessor acc = { jlong_cast(d) }; 1.8 + jlong_accessor acc; 1.9 + acc.long_value = jlong_cast(d); 1.10 array->append(new ConstantIntValue(acc.words[1])); 1.11 array->append(new ConstantIntValue(acc.words[0])); 1.12 #endif 1.13 @@ -802,7 +803,8 @@ 1.14 // grow downwards in all implementations. 1.15 // (If, on some machine, the interpreter's Java locals or stack 1.16 // were to grow upwards, the embedded doubles would be word-swapped.) 1.17 - jlong_accessor acc = { d }; 1.18 + jlong_accessor acc; 1.19 + acc.long_value = d; 1.20 array->append(new ConstantIntValue(acc.words[1])); 1.21 array->append(new ConstantIntValue(acc.words[0])); 1.22 #endif
2.1 --- a/src/share/vm/runtime/sharedRuntimeMath.hpp Tue Jul 29 13:56:29 2014 +0200 2.2 +++ b/src/share/vm/runtime/sharedRuntimeMath.hpp Thu Jul 31 19:59:36 2014 +0200 2.3 @@ -42,29 +42,34 @@ 2.4 } DoubleIntConv; 2.5 2.6 static inline int high(double d) { 2.7 - DoubleIntConv x = { d }; 2.8 + DoubleIntConv x; 2.9 + x.d = d; 2.10 return x.split.hi; 2.11 } 2.12 2.13 static inline int low(double d) { 2.14 - DoubleIntConv x = { d }; 2.15 + DoubleIntConv x; 2.16 + x.d = d; 2.17 return x.split.lo; 2.18 } 2.19 2.20 static inline void set_high(double* d, int high) { 2.21 - DoubleIntConv conv = { *d }; 2.22 + DoubleIntConv conv; 2.23 + conv.d = *d; 2.24 conv.split.hi = high; 2.25 *d = conv.d; 2.26 } 2.27 2.28 static inline void set_low(double* d, int low) { 2.29 - DoubleIntConv conv = { *d }; 2.30 + DoubleIntConv conv; 2.31 + conv.d = *d; 2.32 conv.split.lo = low; 2.33 *d = conv.d; 2.34 } 2.35 2.36 static double copysignA(double x, double y) { 2.37 - DoubleIntConv convX = { x }; 2.38 + DoubleIntConv convX; 2.39 + convX.d = x; 2.40 convX.split.hi = (convX.split.hi & 0x7fffffff) | (high(y) & 0x80000000); 2.41 return convX.d; 2.42 }