From fe7f7aa33d085ed3097ab499277c63aafdfd0e5c Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 27 Oct 2023 11:05:27 +0200 Subject: 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 --- compiler/optimizing/code_generator.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/code_generator.cc') 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() || -- cgit v1.2.3-59-g8ed1b