__ CallRuntime(runtime_entry_, num_args, /*tsan_enter_exit=*/false);
Most uses of CallRuntime are like
```
EnterStubFrame
Push arg
Push arg
CallRuntime
Pop result
LeaveStubFrame
```
so the default is for CallRuntime to emit the tsan_func_entry/exit, but here we're calling the runtime directly from the function's frame that already did it.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
if (block->IsFunctionEntry() || block->IsNativeEntry()) {
`NativeEntryInstr` extends `FunctionEntryInstr`, so `IsFunctionEntry()` should cover both.
for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
`DartReturn`, `TailCall` and `NativeReturn` instructions are always last in their basic blocks. So you can just check `block->last_instruction()` instead of iterating all instructions in the block.
__ cmpq(CALLEE_SAVED_TEMP, Immediate(0));
Nit: `sub` sets Z flag according to the result, so there is no need to `cmp` with 0. If you omit `cmp`, `j(NOT_ZERO, &loop)` would be more readable.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
if (block->IsFunctionEntry() || block->IsNativeEntry()) {
`NativeEntryInstr` extends `FunctionEntryInstr`, so `IsFunctionEntry()` should cover both.
Done
for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
`DartReturn`, `TailCall` and `NativeReturn` instructions are always last in their basic blocks. So you can just check `block->last_instruction()` instead of iterating all instructions in the block.
Done
Nit: `sub` sets Z flag according to the result, so there is no need to `cmp` with 0. If you omit `cmp`, `j(NOT_ZERO, &loop)` would be more readable.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
24 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: runtime/vm/compiler/backend/flow_graph.cc
Insertions: 9, Deletions: 11.
@@ -2734,21 +2734,19 @@
for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done();
block_it.Advance()) {
BlockEntryInstr* block = block_it.Current();
- if (block->IsFunctionEntry() || block->IsNativeEntry()) {
+ if (block->IsFunctionEntry()) {
auto* tsan_entry = new (Z) TsanFuncEntryExitInstr(
TsanFuncEntryExitInstr::kEntry, block->source());
InsertAfter(block, tsan_entry, /*env=*/nullptr, kEffect);
}
- for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
- Instruction* current = it.Current();
- if ((current->IsDartReturn() &&
- !parsed_function_.function().IsAsyncFunction() &&
- !parsed_function_.function().IsAsyncGenerator()) ||
- current->IsTailCall() || current->IsNativeReturn()) {
- auto* tsan_exit = new (Z) TsanFuncEntryExitInstr(
- TsanFuncEntryExitInstr::kExit, current->source());
- InsertBefore(current, tsan_exit, /*env=*/nullptr, kEffect);
- }
+ Instruction* last = block->last_instruction();
+ if ((last->IsDartReturn() &&
+ !parsed_function_.function().IsAsyncFunction() &&
+ !parsed_function_.function().IsAsyncGenerator()) ||
+ last->IsTailCall() || last->IsNativeReturn()) {
+ auto* tsan_exit = new (Z)
+ TsanFuncEntryExitInstr(TsanFuncEntryExitInstr::kExit, last->source());
+ InsertBefore(last, tsan_exit, /*env=*/nullptr, kEffect);
}
}
}
```
```
The name of the file: runtime/vm/compiler/stub_code_compiler_x64.cc
Insertions: 1, Deletions: 2.
@@ -1198,8 +1198,7 @@
__ movq(CallingConventions::kArg1Reg, Immediate(42));
__ TsanFuncEntry(/*preserve_registers=*/false); // Unoptimized frames.
__ subq(CALLEE_SAVED_TEMP, Immediate(1));
- __ cmpq(CALLEE_SAVED_TEMP, Immediate(0));
- __ j(NOT_EQUAL, &loop);
+ __ j(NOT_ZERO, &loop);
}
if (kind == kLazyDeoptFromReturn) {
// Restore result into RBX.
```
[vm] Record stack for JIT TSAN.
The main interesting thing is that deopt can expand one optimized frame to multiple unoptimized frames, so deopt needs to call __tsan_func_entry enough times to rebalance the stack.
Also fixes stack balance for throw error slow paths for AOT.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/61352
Change-Id: I3fdc8481bc8db7a3aec0fa1938ac3e0e96ac13a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452943
Commit-Queue: Ryan Macnak <rma...@google.com>
Reviewed-by: Alexander Markov <alexm...@google.com>
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |