From f824db7bc207621b05f041646a3e68163fb57d98 Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Fri, 1 Oct 2021 18:33:26 +0000 Subject: [PATCH] [vm/compiler] Debug prints for flaky crash in compiler This change adds debug prints for flaky crash in compiler which only appears on bots. TEST=ci Issue: https://github.com/dart-lang/sdk/issues/47314 Change-Id: I6653df11612d24e8a8e67e3e177484a70e308dcc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215152 Auto-Submit: Alexander Markov Commit-Queue: Siva Annamalai Reviewed-by: Siva Annamalai --- .../compiler/backend/flow_graph_compiler.cc | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc index 274a04fde7c..9355b011c9e 100644 --- a/runtime/vm/compiler/backend/flow_graph_compiler.cc +++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc @@ -1621,8 +1621,15 @@ void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) { blocked_registers[loc.reg()] = true; } else if (loc.IsFpuRegister()) { // Check that a register is not specified twice in the summary. - ASSERT(!blocked_fpu_registers[loc.fpu_reg()]); - blocked_fpu_registers[loc.fpu_reg()] = true; + const FpuRegister fpu_reg = loc.fpu_reg(); + if ((fpu_reg < 0) || (fpu_reg >= kNumberOfFpuRegisters)) { + // Debug prints for https://github.com/dart-lang/sdk/issues/47314. + OS::PrintErr("input(%" Pd ") fpu_reg = %d\n", i, fpu_reg); + OS::PrintErr("instr = %s\n", instr->ToCString()); + UNREACHABLE(); + } + ASSERT(!blocked_fpu_registers[fpu_reg]); + blocked_fpu_registers[fpu_reg] = true; } } @@ -1634,8 +1641,15 @@ void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) { blocked_registers[loc.reg()] = true; } else if (loc.IsFpuRegister()) { // Check that a register is not specified twice in the summary. - ASSERT(!blocked_fpu_registers[loc.fpu_reg()]); - blocked_fpu_registers[loc.fpu_reg()] = true; + const FpuRegister fpu_reg = loc.fpu_reg(); + if ((fpu_reg < 0) || (fpu_reg >= kNumberOfFpuRegisters)) { + // Debug prints for https://github.com/dart-lang/sdk/issues/47314. + OS::PrintErr("temp(%" Pd ") fpu_reg = %d\n", i, fpu_reg); + OS::PrintErr("instr = %s\n", instr->ToCString()); + UNREACHABLE(); + } + ASSERT(!blocked_fpu_registers[fpu_reg]); + blocked_fpu_registers[fpu_reg] = true; } }