dart-sdk/runtime
Daco Harkes 7cfbfc6a25 [vm/ffi] Change late Finalizable implementation
This CL replaces `late Finalizable` variables with the original and
a nullable non-late variable. Every assignment is done first to the
late variable, and the immediately to the nullable non-late shadow
variable. The reachability fences are then inserted only for the
nullable non-late shadow variable.

The advantage of this is that the semantics are fully valid and none
of the further compiler pipeline has to know about late Finalizables.
(1) We remove the special casing in the VM.
(2) The TFA logic with finalizables is no longer blocked.

The downside of this approach is that we use more memory, we need
two fields at runtime, one storing a null and the other storing a
sentinel on initiazation. Moreover, we get some extra store
instructions.

TEST=pkg/vm/testcases/transformations/ffi/finalizable_late.dart
TEST=pkg/vm/testcases/transformations/ffi/finalizable_late_2.dart
TEST=tests/language/vm/regress_49005_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51511
Change-Id: Ifedd3387a368233a2d01e1bcaa9f5e3eceb76856
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286782
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-03-07 10:10:25 +00:00
..
bin [vm] Update to variadic FATAL. 2023-03-06 22:06:59 +00:00
docs [vm] Timeline docs. 2023-03-06 21:33:24 +00:00
include [vm] Fix Dart_CObject_Type breaking change 2023-02-20 11:59:19 +00:00
lib [vm] Update to variadic FATAL. 2023-03-06 22:06:59 +00:00
observatory [vm] Remove malloc profiler. 2023-03-06 21:00:30 +00:00
observatory_2 [vm] Remove malloc profiler. 2023-03-06 21:00:30 +00:00
platform [vm] Update to variadic FATAL. 2023-03-06 22:06:59 +00:00
tests [vm] Remove malloc profiler. 2023-03-06 21:00:30 +00:00
third_party Spelling pkg analyzer lib 2023-01-25 14:08:27 +00:00
tools [vm] Remove malloc profiler. 2023-03-06 21:00:30 +00:00
vm [vm/ffi] Change late Finalizable implementation 2023-03-07 10:10:25 +00:00
.clang-tidy
.gitignore
BUILD.gn [vm] Remove malloc profiler. 2023-03-06 21:00:30 +00:00
codereview.settings
configs.gni
CPPLINT.cfg [cpplint] Disable runtime/references lint 2023-01-23 18:21:48 +00:00
OWNERS
PRESUBMIT.py Revert "[VM] Begin supporting Perfetto file recorder" 2023-02-28 12:41:00 +00:00
runtime_args.gni [vm] Remove malloc profiler. 2023-03-06 21:00:30 +00:00