5984cc8c24
The transitions in C++ have asserts which run in debug mode to validate that the transitions are happening in the right order. The transitions in the generated code had no equivalent. This CL introduces the equivalent for the generated code. The transitions to generated code are misnamed currently. They come from either VM or Native, not only Native. For example the FFI callbacks and call return sequence can already transition from native into the VM when entering the safepoint. These checks don't catch the invalid FFI callbacks. Bug: https://github.com/dart-lang/sdk/issues/60021 These are caught when looking up the FFI metadata: https://dart-review.googlesource.com/c/sdk/+/407023 This CL omits to implement the check in ia32, since ia32 is scheduled for removal. The check is only enabled in debug mode. The asserts for the C++ are also only run in debug mode. And enabling this check in release for AOT regresses the parent CL benchmark by ~30% on Mac Arm64. TEST=test/ffi Change-Id: Ieaf1e43533baae294af37b2e171b68bd314fdbe0 Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-arm64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-arm64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-arm64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-tsan-linux-release-arm64-try,vm-tsan-linux-release-x64-try,vm-ubsan-linux-release-arm64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407021 Reviewed-by: Liam Appelbe <liama@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>