[vm] Align 64-bit atomic variables for 32-bit iOS.
Change-Id: I2bbe637fce59bd5d84f7db8a44960e36fe63d2d9
Reviewed-on: https://dart-review.googlesource.com/53822
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
diff --git a/runtime/platform/atomic_android.h b/runtime/platform/atomic_android.h
index 8178d6e..42dda56 100644
--- a/runtime/platform/atomic_android.h
+++ b/runtime/platform/atomic_android.h
@@ -28,6 +28,9 @@
}
inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) {
+ // Some ARM implementations require 8-byte alignment for atomic access but
+ // not non-atomic access.
+ ASSERT((reinterpret_cast<uword>(p) % 8) == 0);
__sync_fetch_and_add(p, value);
}
diff --git a/runtime/platform/atomic_linux.h b/runtime/platform/atomic_linux.h
index 627bc9f..3db8d73 100644
--- a/runtime/platform/atomic_linux.h
+++ b/runtime/platform/atomic_linux.h
@@ -28,6 +28,9 @@
}
inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) {
+ // Some ARM implementations require 8-byte alignment for atomic access but
+ // not non-atomic access.
+ ASSERT((reinterpret_cast<uword>(p) % 8) == 0);
__sync_fetch_and_add(p, value);
}
diff --git a/runtime/platform/atomic_macos.h b/runtime/platform/atomic_macos.h
index e8c1545..b08ba4f 100644
--- a/runtime/platform/atomic_macos.h
+++ b/runtime/platform/atomic_macos.h
@@ -28,6 +28,9 @@
}
inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) {
+ // Some ARM implementations require 8-byte alignment for atomic access but
+ // not non-atomic access.
+ ASSERT((reinterpret_cast<uword>(p) % 8) == 0);
__sync_fetch_and_add(p, value);
}
diff --git a/runtime/vm/compiler_stats.h b/runtime/vm/compiler_stats.h
index 412cb61..4a7d49f 100644
--- a/runtime/vm/compiler_stats.h
+++ b/runtime/vm/compiler_stats.h
@@ -78,27 +78,27 @@
Timer graphcompiler_timer; // Included in codegen_timer.
Timer codefinalizer_timer; // Included in codegen_timer.
- int64_t num_tokens_total; // Isolate + VM isolate
- int64_t num_tokens_scanned;
- int64_t num_tokens_consumed;
- int64_t num_cached_consts;
- int64_t num_const_cache_hits;
- int64_t num_execute_const;
+ ALIGN8 int64_t num_tokens_total; // Isolate + VM isolate
+ ALIGN8 int64_t num_tokens_scanned;
+ ALIGN8 int64_t num_tokens_consumed;
+ ALIGN8 int64_t num_cached_consts;
+ ALIGN8 int64_t num_const_cache_hits;
+ ALIGN8 int64_t num_execute_const;
- int64_t num_classes_parsed;
- int64_t num_class_tokens;
- int64_t num_functions_parsed; // Num parsed functions.
- int64_t num_functions_compiled; // Num unoptimized compilations.
- int64_t num_functions_optimized; // Num optimized compilations.
- int64_t num_func_tokens_compiled;
- int64_t num_implicit_final_getters;
- int64_t num_method_extractors;
+ ALIGN8 int64_t num_classes_parsed;
+ ALIGN8 int64_t num_class_tokens;
+ ALIGN8 int64_t num_functions_parsed; // Num parsed functions.
+ ALIGN8 int64_t num_functions_compiled; // Num unoptimized compilations.
+ ALIGN8 int64_t num_functions_optimized; // Num optimized compilations.
+ ALIGN8 int64_t num_func_tokens_compiled;
+ ALIGN8 int64_t num_implicit_final_getters;
+ ALIGN8 int64_t num_method_extractors;
- int64_t src_length; // Total number of characters in source.
- int64_t total_code_size; // Bytes allocated for code and meta info.
- int64_t total_instr_size; // Total size of generated code in bytes.
- int64_t pc_desc_size;
- int64_t vardesc_size;
+ ALIGN8 int64_t src_length; // Total number of characters in source.
+ ALIGN8 int64_t total_code_size; // Bytes allocated for code and meta info.
+ ALIGN8 int64_t total_instr_size; // Total size of generated code in bytes.
+ ALIGN8 int64_t pc_desc_size;
+ ALIGN8 int64_t vardesc_size;
char* text;
bool use_benchmark_output;
diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h
index 79d0c68..b657c8d 100644
--- a/runtime/vm/profiler.h
+++ b/runtime/vm/profiler.h
@@ -32,20 +32,20 @@
struct ProfilerCounters {
// Count of bail out reasons:
- int64_t bail_out_unknown_task;
- int64_t bail_out_jump_to_exception_handler;
- int64_t bail_out_check_isolate;
+ ALIGN8 int64_t bail_out_unknown_task;
+ ALIGN8 int64_t bail_out_jump_to_exception_handler;
+ ALIGN8 int64_t bail_out_check_isolate;
// Count of single frame sampling reasons:
- int64_t single_frame_sample_deoptimizing;
- int64_t single_frame_sample_register_check;
- int64_t single_frame_sample_get_and_validate_stack_bounds;
+ ALIGN8 int64_t single_frame_sample_deoptimizing;
+ ALIGN8 int64_t single_frame_sample_register_check;
+ ALIGN8 int64_t single_frame_sample_get_and_validate_stack_bounds;
// Count of stack walkers used:
- int64_t stack_walker_native;
- int64_t stack_walker_dart_exit;
- int64_t stack_walker_dart;
- int64_t stack_walker_none;
+ ALIGN8 int64_t stack_walker_native;
+ ALIGN8 int64_t stack_walker_dart_exit;
+ ALIGN8 int64_t stack_walker_dart;
+ ALIGN8 int64_t stack_walker_none;
// Count of failed checks:
- int64_t failure_native_allocation_sample;
+ ALIGN8 int64_t failure_native_allocation_sample;
};
class Profiler : public AllStatic {
diff --git a/runtime/vm/timer.h b/runtime/vm/timer.h
index 7d0efcb..c9e4a19 100644
--- a/runtime/vm/timer.h
+++ b/runtime/vm/timer.h
@@ -87,10 +87,10 @@
return stop_ - start_;
}
- int64_t start_;
- int64_t stop_;
- int64_t total_;
- int64_t max_contiguous_;
+ ALIGN8 int64_t start_;
+ ALIGN8 int64_t stop_;
+ ALIGN8 int64_t total_;
+ ALIGN8 int64_t max_contiguous_;
bool report_;
bool running_;
const char* message_;