Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(820)

Unified Diff: runtime/vm/object.cc

Issue 2947783002: Avoid unaligned access fault in Int32x4/Float32x4::value() on ARM. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/typed_data/float32x4_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 728e2ffe6446a8833d056194b9aef8d727408440..8ae4f6575bc2f4f2f7c5a2fd1cf26e7946c8674d 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -22352,12 +22352,22 @@ RawFloat32x4* Float32x4::New(simd128_value_t value, Heap::Space space) {
simd128_value_t Float32x4::value() const {
+#if defined(HOST_ARCH_ARM)
zra 2017/06/20 17:44:34 I think you should be able to use bit_cast here. A
+ simd128_value_t temp;
+ memmove(&temp, &raw_ptr()->value_[0], sizeof(temp));
+ return temp;
+#else
return simd128_value_t().readFrom(&raw_ptr()->value_[0]);
+#endif
}
void Float32x4::set_value(simd128_value_t value) const {
+#if defined(HOST_ARCH_ARM)
+ memmove(const_cast<float*>(&raw_ptr()->value_[0]), &value, sizeof(value));
+#else
StoreSimd128(&raw_ptr()->value_[0], value);
+#endif
}
@@ -22487,12 +22497,22 @@ int32_t Int32x4::w() const {
simd128_value_t Int32x4::value() const {
+#if defined(HOST_ARCH_ARM)
+ simd128_value_t temp;
+ memmove(&temp, &raw_ptr()->value_[0], sizeof(temp));
+ return temp;
+#else
return simd128_value_t().readFrom(&raw_ptr()->value_[0]);
+#endif
}
void Int32x4::set_value(simd128_value_t value) const {
+#if defined(HOST_ARCH_ARM)
+ memmove(const_cast<int32_t*>(&raw_ptr()->value_[0]), &value, sizeof(value));
+#else
StoreSimd128(&raw_ptr()->value_[0], value);
+#endif
}
« no previous file with comments | « no previous file | tests/lib/typed_data/float32x4_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698