summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2023-10-27 11:05:27 +0200
committer VladimĂ­r Marko <vmarko@google.com> 2023-10-30 15:37:52 +0000
commitfe7f7aa33d085ed3097ab499277c63aafdfd0e5c (patch)
treee7c3b5dd11b3a9d459a70dd933d77cb76d48dae5 /compiler/optimizing/code_generator.cc
parent178e647cfc23649acd4340fb60ce4d0f5207a526 (diff)
Replace `gUseReadBarrier` with compiler option in compiler.
Leave a few `gUseReadBarrier` uses in JNI macro assemblers. We shall deaal with these later. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 289805127 Change-Id: I9d2aa245cee4c650129f169a82beda7dc0dd6a35
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r--compiler/optimizing/code_generator.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index 404a42771f..80c0f84d6e 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -142,6 +142,22 @@ static bool CheckTypeConsistency(HInstruction* instruction) {
return true;
}
+bool CodeGenerator::EmitReadBarrier() const {
+ return GetCompilerOptions().EmitReadBarrier();
+}
+
+bool CodeGenerator::EmitBakerReadBarrier() const {
+ return kUseBakerReadBarrier && GetCompilerOptions().EmitReadBarrier();
+}
+
+bool CodeGenerator::EmitNonBakerReadBarrier() const {
+ return !kUseBakerReadBarrier && GetCompilerOptions().EmitReadBarrier();
+}
+
+ReadBarrierOption CodeGenerator::GetCompilerReadBarrierOption() const {
+ return EmitReadBarrier() ? kWithReadBarrier : kWithoutReadBarrier;
+}
+
ScopedArenaAllocator* CodeGenerator::GetScopedAllocator() {
DCHECK(code_generation_data_ != nullptr);
return code_generation_data_->GetScopedAllocator();
@@ -1624,8 +1640,7 @@ void CodeGenerator::ValidateInvokeRuntime(QuickEntrypointEnum entrypoint,
// When (non-Baker) read barriers are enabled, some instructions
// use a slow path to emit a read barrier, which does not trigger
// GC.
- (gUseReadBarrier &&
- !kUseBakerReadBarrier &&
+ (EmitNonBakerReadBarrier() &&
(instruction->IsInstanceFieldGet() ||
instruction->IsPredicatedInstanceFieldGet() ||
instruction->IsStaticFieldGet() ||