Commit Graph

45 Commits

Author SHA1 Message Date
Alexander Markov 53defca14d [vm,dyn_modules] Fix type parameter indices in nested function types in bytecode
TEST=ci (co19/LanguageFeatures/Generic-functions-as-type-args/typedef1_A01_t04)

Change-Id: Ia3146e91b4da4adaf14fe34d9dcf5d4129daba9d
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444180
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2025-08-07 06:44:59 -07:00
Alexander Markov 8ef843ef4f [vm,dyn_modules] Support implicit dynamic calls in bytecode
TEST=ci (co19/Language/Expressions/Function_Invocation/Function_Expression_Invocation/call_A04_t01)

Change-Id: I49faf7c6f8d8f9353683dd94e9aa9a7ac7d30921
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443882
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-08-07 06:44:40 -07:00
Alexander Markov e32c2ac796 [vm,dyn_modules] Remove enclosing function type parameters from instantiated types
VM treats instantiated function types with NumParentTypeArguments() != 0
as non-instantiated (as they potentially depend on the numbering of
enclosing type parameters) and would explicitly instantiate such types.

So bytecode generator needs to make sure that instantiated types,
instantiated type arguments and types used in constants always have
NumParentTypeArguments() == 0, so they would not need unnecessary
instantiation.

TEST=ci

Change-Id: I3ea54a0b535655611893d28edb54ffd50dcda1f0
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443630
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-08-06 06:25:02 -07:00
Alexander Markov 610097050c [vm,dyn_modules] Fix capturing of 'this' in instance field initializers
TEST=ci (co19/Language/Classes/access_to_this_A01_t02)

Change-Id: If08c23cdc2d751e76d63d81f6aad511cd2a31fae
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443635
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-08-06 06:08:49 -07:00
Paul Berry 111e84b958 Rename CFE DiagnosticMessage class.
The analyzer already has a class with the same name, but a slightly
different purpose. (The analyzer's class represents a single message
associated with a source location, whereas the CFE's class represents
a message along with related context messages).

I'm currently embarking on an arc of work that I hope will eventually
culminate in unifying the analyzer and CFE diagnostic message
representations into a single set of classes. Until that unification
is complete, both representations will have to co-exist in the
`_fe_analyzer_shared` package. To reduce confusion during that time
period, I would like the classes to have distinct names.

Since the analyzer's `DiagnosticMessage` class is exposed through the
analyzer public API, analyzer clients may depend on the name. So it
makes sense to rename the CFE's `DiagnosticMessage` class.

Tested: standard trybots
Change-Id: I6b6948fe9da18c7b6688333fa12ffeea8e81436f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441831
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-08-04 11:20:23 -07:00
Alexander Markov c7bf13176f [vm,dyn_modules] Support reachabilityFence and _nativeEffect from dart:_internal in bytecode
TEST=ci

Change-Id: I68c7b74b6ccc75139b5690f3216c47ab843cc544
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442245
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-07-28 07:58:10 -07:00
Alexander Markov 644d0d4c49 [vm,dyn_modules] Include assertion text into bytecode
Extract the text of assert condition and put it into bytecode
instead of relying on runtime to find the source text
(which is most likely unavailable for a dynamic module).

TEST=ci (language/vm/regress_27671_test, vm/dart/asserts_test)

Change-Id: Id6643333164b37c5046fa1dfecdbe9338f53c93d
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442244
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-07-28 07:40:42 -07:00
Alexander Markov 9f72f1034c [vm,dyn_modules] Support class modifiers in bytecode
TEST=ci

Change-Id: I521b27c793269dc6076b353f50e2cdaa629002e9
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441987
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-07-24 06:02:35 -07:00
Alexander Markov 87beee922a [dart2bytecode] Generate instance field initializers for hot reload
Hot reload needs to run instance field initializers for all newly
added fields except fields initialized with null.

TEST=ci (vm/cc/IsolateReload_RunNewFieldInitializers)

Change-Id: I3ead726aa12b9d6c5aa515c7297deca0ddd9eb9f
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441861
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-07-22 16:08:20 -07:00
Alexander Markov bbb5e731c3 [vm,dyn_modules] Initial support for hot reloading bytecode
TEST=ci

Change-Id: I879ff1c085ee06dda7836d01e2018d93e075f132
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try,vm-reload-linux-debug-x64-try,vm-reload-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439803
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-07-15 09:29:41 -07:00
Alexander Markov 3e462c1343 [vm,dyn_modules] Support external/native methods in bytecode
TEST=ci

Change-Id: I2827c95f7b4d4bfa40239369d3675ef6adba4ab2
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439545
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-07-11 06:31:19 -07:00
Chloe Stefantsova 433c0998d0 [cfe] Remove Nullability.legacy
TEST=existing

Change-Id: Id924e4ef64ddabc1986cb885f558382ff139b481
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436620
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-07-02 23:50:12 -07:00
Alexander Markov 0aaa86cd87 [vm,dyn_modules] Initial support for interpreter frames in debugger
Also, support reading local variables information from bytecode.

TEST=pkg/vm_service

Change-Id: Iab482316891f0e474af0011e9b1765c4e8312bc9
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437281
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-30 20:21:03 -07:00
Alexander Markov bcaf426cdf [vm,dyn_modules] Fix canonicalization of types when serializing bytecode
Avoid caching generic types C<T1,...,Tn> in the object table if
any of type arguments T1,...,Tn are not cacheable.
Otherwise, bytecode reader might create function type
'C<Y0> Function<Y0>()' where cached type 'C<Y0>' references parameter
type Y0 which belongs to a wrong owner, such as another function type
'C<Y0> Function<Y0>(int)'.

Also, fix equivalence of default values of function type parameters
in case matching 'null' (meaning all dynamic) and '[dynamic, ..., dynamic]'.
This may happen during canonicalization before '[dynamic, ..., dynamic]'
type arguments are replaced with 'null'.

TEST=ci

Change-Id: If81736fb18a62fd16fd93e59436c8cd7ccce94ff
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437522
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-30 15:56:04 -07:00
Alexander Markov 05c2f3b0b1 [vm,dyn_modules] Hook interpreter to the standalone VM
When dynamic modules are enabled, standalone VM can now run bytecode
binaries directly. Also, if --interpreter flag is specified, Dart
source is compiled to bytecode and interpreter is used to run it.

This will allow us to test VM service capabilities including
debugging and hot reload against the interpreter.

TEST=manual

Change-Id: Ibb5a67f4844485c4ed90b8a7568dc42fa552fcac
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436421
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-24 05:59:21 -07:00
Ryan Macnak ab4f9351b1 Rename vm_platform_strong.dill to vm_platform.dill.
The name has always been annoying because it did not add strong typing. And now there aren't variants of the VM platform to distinguish.

Leave a copy at the old name to not immediately break illegal uses.

TEST=ci
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,flutter-frontend-try,flutter-linux-try
Change-Id: Ie76fa7f16940aa1ba8d582eb5197f0ae55dc8938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429828
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-06-16 18:33:38 -07:00
Chloe Stefantsova 39810ffbe4 [cfe] Cleanup interface of subtype queries
Under the hood, there is no difference between
`isSubtypeWhenUsingNullabilities` and
`isSubtypeWhenIgnoringNullabilities` by now. This CL makes the
corresponding renames and removals in the CFE and its clients.

TEST=existing

Change-Id: I22060c29834179c30ba62562aa254146b1d7530d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433480
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-06-13 02:02:54 -07:00
Alexander Markov f9860f9db9 [dyn_modules] Add source positions to bytecode
dart2bytecode can optionally add source position information
(including line starts) to the generated bytecode
(when '--bytecode-options=source-positions' flag is specified).

If bytecode has source positions, they are now shown in stack traces
involving interpreter frames.

TEST=ci

Change-Id: I1ae3326bac21201040be32c712514e71e96f51e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433760
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-10 12:15:25 -07:00
Alexander Markov ea27d17793 [dyn_modules,dart2bytecode] Fix isTop predicate for extension types in bytecode generator
Bytecode generator needs to know the runtime semantics of Dart types,
but TypeEnvironment.isTop predicate does not use erasure of extension
types and does not return true for extension types based on other top
types (e.g. dynamic).

TEST=language/dot_shorthands/member/static_method_cascade_test

Change-Id: If8323d11293498fb39d8d936c406bc9bb7e85ce9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426983
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-05-09 10:56:33 -07:00
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -07:00
Alexander Markov 18a44b3095 [vm, dynamic_modules] Support required named parameters in function types
TEST=language/nnbd/subtyping/function_type_required_params_test

Change-Id: I050f8fdd331985512f204b265d81c7deec0d67fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415640
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-03-18 14:50:45 -07:00
Devon Carew 3c973fb292 [lints] address diagnostics related to strict_top_level_inference
Change-Id: I228058202855900f0adba73c1ab04d35180a6e5d
Tested: this is an analyzer diagnostic only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414900
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-03-17 08:27:57 -07:00
Sigurd Meldgaard 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00
Sigurd Meldgaard a9ab52bcbb Language version bumps for publish_to: none pkgs
Also a separate pubspec for the tools/ folder

Extracted from https://dart-review.googlesource.com/c/sdk/+/397164

Change-Id: If49a6ede07e4864d0c0fcb210c04c18c804849df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412041
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-02-27 00:48:40 -08:00
Alexander Markov dd4f341e15 [dart2bytecode] Add API to invoke dart2bytecode programmatically
TEST=ci
Bug: b/394206952
Change-Id: Icd606c83bfed335e45498fceed6add784c465826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407820
Reviewed-by: Jia Hao Goh <jiahaog@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-02-06 08:44:12 -08:00
Johnni Winther 81b669dc45 [cfe] Create enum elements through SourcePropertyBuilder
TEST=existing

Change-Id: I94ffff0ca5d891b43e0bc7b64d78eb0c03e3dd12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404103
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-01-16 01:17:42 -08:00
Chloe Stefantsova 3393befc99 [cfe] Remove constructors for alpha renaming
In this CL methods StructuralParameterType.forAlphaRenaming,
StructuralParameterType.forAlphaRenamingFromTypeParameter,
TypeParameterType.forAlphaRenaming, and
TypeParameterType.forAlphaRenamingFromStructuralParameter are removed,
and their call sites are replaced with invocations of other
constructors of StructuralParameterType and TypeParameterType. The
reason for this change is call sites having more information for
correct computing of type nullabilities.

In addition to the primary update, the following related changes are
made in this CL.

* Method StructuralParameterType.computeDefaultNullabilityForLibrary
  is renamed into StructuralParameterType.computeDefaultNullability,
  and TypeParameterType.computeDefaultNullabilityForLibrary is renamed
  into TypeParameterType.computeDefaultNullability. The parameter
  `library` is removed from both methods, since it's no longer needed.
* The static methods named `computeNullabilityFromBound` are removed
  from `StructuralParameterType` and `TypeParameterType` and
  re-introduced as instance members in classes `StructuralParameter`
  and `TestParameter` respectively

TEST=existing

Change-Id: I26cccf17ccc9bda1e8b750196f427325b544a7ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-01-07 01:16:48 -08:00
Alexander Markov e200a3a722 [dart2bytecode] Avoid merging function types with different number of enclosing type parameters
When creating function types, VM takes number of parent function type
arguments into account. So function types with distinct number of
parent function type arguments should not be merged in the bytecode
object table and should be represented as distinct types.

TEST=language/mixin/type_parameter_inference_test
Fixes https://github.com/dart-lang/sdk/issues/59633

Change-Id: I9c8b0923c52b1b95628ff8daa3bbfa135c559912
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398500
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-12-09 15:19:43 +00:00
Alexander Markov c409e77d1e Validation of dynamic modules
TEST=pkg/front_end/testcases/general/dynamic_modules


Change-Id: I591d029ed163961f5ece859233874f828d63c857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388442
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-10-24 16:51:53 +00:00
Johnni Winther 27048206ce [cfe] Rename TypeVariable to TypeParameter
This makes the CFE and kernel terminology consistent.

Change-Id: I6e35d9f4ea58d50eac0ab84763633bf5e445771d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390861
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-10-21 09:35:06 +00:00
Alexander Markov 80b092de04 [dart2bytecode] Throw exception instead of crashing when external member is called
TEST=ci

Change-Id: I60a598dd5f8ac05a4f5f3283d257c2c6a74490e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384820
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-12 14:52:58 +00:00
Alexander Markov ad94d963ed [dart2bytecode] Remove the requirement for dynamic module to have 'main'
TEST=DART_CONFIGURATION=DebugX64 out/DebugX64/dart-sdk/bin/dart pkg/dynamic_modules/test/runner/main.dart -r aot --verbose

Change-Id: I8647822982b051b4846dfe4ed7e51a19ef466cf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384311
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-09-10 14:37:00 +00:00
Alexander Markov 6903672599 [dart2bytecode] Add document describing Dart bytecode file format
TEST=ci

Change-Id: Id12824cf667181122d4d2c4e7af7dc6206d1f85b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384043
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-10 13:39:57 +00:00
Alexander Markov fcdcdeddad [dart2bytecode, vm] Adjust bytecode file format
* Switch UInt32 from big-endian to little-endian encoding.
* Reorder object kinds, constant tags, type tags and constant pool tags.
* Reorder field and function flags.
* Cleanup yield point marker from source positions.

TEST=ci

Change-Id: I05ee940b6393a478831af11ac93fee9ec1441c4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384040
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-10 13:37:29 +00:00
Alexander Markov 1225b45bc7 [dart2bytecode, vm/interpreter] Async exceptions
TEST=ci (vm-aot-dyn-linux-debug-x64)

Change-Id: I9d5bb0f7f2544e41078ec9aeb75bce6224087976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383706
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-09-09 13:44:04 +00:00
Alexander Markov a17bc048b4 [dart2bytecode, vm/interpreter] Late final fields and variables
* Also, add implicitly overridden _Enum._enumToString to dynamic
  interface.

TEST=ci (vm-aot-dyn-linux-debug-x64)

Change-Id: I9d9d368715d0837d8b1039a46451152e03be7eec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383024
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-04 14:18:09 +00:00
Erik Ernst 61b9b42b70 Rename a few declarations in test instance_creation.dart
This CL renames a declaration in the test instance_creation.dart:
The class `K` is renamed to `L`, and its type parameters are renamed
from `A` and `B` to `S` and `T`.

The point is that these changes eliminate situations which are linted
with the update in https://github.com/dart-lang/linter/issues/5066.

Change-Id: Iac6b77dc8cfeebedef98a739817049afba1f41d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382890
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-09-03 14:35:09 +00:00
Alexander Markov ce571036e1 [vm] Cleanup legacy AssertBoolean checks
With sound null safety front-end guarantees that all logical
expressions have a non-nullable bool type, so legacy AssertBoolean
checks are no longer needed and can be removed.

TEST=ci

Change-Id: If952da7bd0ac83c43de3e5d98845c5e5d8d29f6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382744
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-29 16:45:00 +00:00
Alexander Markov a3b7c9fb5a [dart2bytecode, vm/interpreter] Small fixes
* Use AllocateClosure instruction for closure instantiations in order
  to initialize closure entry point.

* Fix null handling in operator== to be before argument type checks.

* Add _InvocationMirror._withType to dynamic interface as it is
  implicitly used by noSuchMethod forwarders.

* Fix AssertAssignable for null objects.

TEST=language tests in vm-aot-dyn-linux-debug-x64 configuration

Change-Id: I7b1a037d4fde4d22ed32969e0f099b31ea4432ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382500
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-29 14:28:40 +00:00
Alexander Markov 2e63d3135a [dart2bytecode, vm/interpreter] Records
TEST=language tests in vm-aot-dyn-linux-debug-x64 configuration

Change-Id: I6dd7d5617f5c076c722304ab2a753159f22c0bf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382421
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-08-28 13:12:48 +00:00
Alexander Markov 062b0738e3 [dart2bytecode, vm/interpreter] await/yield/yield*
TEST=language tests in vm-aot-dyn-linux-debug-x64 configuration

Change-Id: I205bec19c2072fe9ac11a3211123bba43cb99d5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381945
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-08-26 20:35:18 +00:00
Alexander Markov 9685ee28df [vm,dart2bytecode] Fix function types and local functions in bytecode
When reading function types from bytecode, number of implicit
parameters should be set in the FunctionType.

Capture variable holding a local function when local function
invocation happens from a different function scope.

Also remove debug prints from bytecode reader.

TEST=corelib/list_for_each_test
TEST=language/closure/closure6_test

Change-Id: I69c92ba2749509a24d13e8b2a10c5dea76973a56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381081
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-08-19 13:09:31 +00:00
Vyacheslav Egorov 196f6c90c2 [vm] Create dart:_compact_hash library.
This opens possibility for other core libraries to access implementation
details of compact hash maps/sets and call special "core-library-only"
methods.

TEST=ci

CoreLibraryReviewExempt: VM only library change
Change-Id: I1d7524932c34e6fbe2428853dd547d58bef2d061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379840
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-08-13 09:20:05 +00:00
Alexander Markov 3abf78212c Bytecode compiler
Add dart2bytecode tool which takes Dart sources and produces
Dart bytecode. The tool uses common front-end (CFE) to parse Dart
source code and contains bytecode generator which translates
kernel AST to bytecode.

Change-Id: I90bd6e72c619cf0edc556da0640760b30e81091d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378560
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-08-08 18:08:58 +00:00