From a290271dea55a883133e676da0d1a38bb925d2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Crelier?= Date: Wed, 28 Aug 2019 22:20:53 +0000 Subject: [PATCH] [vm/bytecode] Throw should be 'debug checked', but not ReThrow. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since both throw and rethrow statements share the same 'Throw' bytecode opcode (differentiated by an operand), we make the opcode not implicitly 'debug checked' anymore. Instead, we emit a 'DebugCheck' opcode for the throw statement only. This fixes the following test: service/async_single_step_exception_test Change-Id: I4e540ea0a640fda5365d51933ce4e5125548e2f2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114754 Commit-Queue: Régis Crelier Reviewed-by: Alexander Markov --- pkg/vm/lib/bytecode/gen_bytecode.dart | 4 ++++ runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc | 2 -- runtime/vm/constants_kbc.h | 1 - runtime/vm/interpreter.cc | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart index dad71357a07..e4e408b362a 100644 --- a/pkg/vm/lib/bytecode/gen_bytecode.dart +++ b/pkg/vm/lib/bytecode/gen_bytecode.dart @@ -3174,6 +3174,10 @@ class BytecodeGenerator extends RecursiveVisitor { @override visitThrow(Throw node) { _generateNode(node.expression); + + if (options.emitDebuggerStops) { + asm.emitDebugCheck(); + } asm.emitThrow(0); } diff --git a/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc b/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc index 4afe6362026..cc29958f390 100644 --- a/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc +++ b/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc @@ -1569,8 +1569,6 @@ void BytecodeFlowGraphBuilder::BuildThrow() { UNIMPLEMENTED(); // TODO(alexmarkov): interpreter } - BuildDebugStepCheck(); - if (DecodeOperandA().value() == 0) { // throw LoadStackSlots(1); diff --git a/runtime/vm/constants_kbc.h b/runtime/vm/constants_kbc.h index bda63ccc7f2..f5e373e864d 100644 --- a/runtime/vm/constants_kbc.h +++ b/runtime/vm/constants_kbc.h @@ -994,7 +994,6 @@ class KernelBytecode { case KernelBytecode::kDynamicCall: case KernelBytecode::kDynamicCall_Wide: case KernelBytecode::kReturnTOS: - case KernelBytecode::kThrow: case KernelBytecode::kEqualsNull: case KernelBytecode::kNegateInt: case KernelBytecode::kNegateDouble: diff --git a/runtime/vm/interpreter.cc b/runtime/vm/interpreter.cc index fa8075c4041..71aa86cd161 100644 --- a/runtime/vm/interpreter.cc +++ b/runtime/vm/interpreter.cc @@ -1780,7 +1780,6 @@ SwitchDispatch: { BYTECODE(Throw, A); - DEBUG_CHECK; { SP[1] = 0; // Space for result. Exit(thread, FP, SP + 2, pc);