The experimental `dart:ffi` support predates deferred loading
implementation. Any use of FFI features would lazily import `ffi.memory`
into the (fixed coded) main module.
This CL now lazily imports the `ffi.memory` module into all modules that
operate on the memory.
=> This will now allow a flutter app that is compiled with dart2wasm
in deferred loading mode to possibly defer parts of flutter
engine code that uses FFI into deferred modules.
Issue https://github.com/dart-lang/sdk/issues/56952
Change-Id: Idf821ce2dd92c36ac1be9dae24307516a1ae86d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510760
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
'canInvokeTypeEquality' was assuming that if a single case was a Type expression, then type equality should be used for the whole switch statement. This is incorrect because if a single case is a type expression but the rest are, for example, ints (as in the fixed test) then the int cases should be compared with identical while only the type expression should be compared with ==.
More importantly, the expected type of the case expression constants should be top type rather than the Type type. Top type is the union of Type and the other case type.
Switches that only include Type expressions will now use "top" type as well but in general switching on a Type expression is an antipattern we shouldn't optimize for. And the impact of not specializing the switch type to Type should be very minimal.
Fixes: https://github.com/dart-lang/sdk/issues/63476
Change-Id: Ib96172f157d8cf3093199e5127d4835e7b25011c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
When generating SSA jump instructions (HContinue and HBreak) for AST break statements, ensure that we only select labels from the target's label list that are explicitly marked as valid continue (isContinueTarget) or break (isBreakTarget) targets.
Previously, handler.labels.first was selected indiscriminately if non-empty, which caused unlabeled continue statements inside loops that had an outer break label to incorrectly generate labeled continue jumps targeting the break label.
Fixes: https://github.com/dart-lang/sdk/issues/63456
Change-Id: Ic497776141a192edb0930f4585cdaae2feecb3d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510280
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Also fix --check-clean. `ninja target -t commands` reports the commands for the default target, fix to use `ninja -t commands target` instead.
Change-Id: Ice179290e75b083a96abadb7540ca960eafcc982
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510440
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
The lint will fire even when there is a comment in the body, such as
```dart
class C() {
this { /* comment */ }
}
```
I think this is the right behavior because I can't think of any useful
comment that wouldn't be better somewhere else, but let me know if you
disagree.
This doesn't yet have a fix, but it should.
Change-Id: Ia5ffa6b06c75a6a7400ec32a9d22209c08a9c73d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510401
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
For clients outside the library the useful property in
`FormalParameterElement.type`, not *how* this type was specified
syntactically: `void f(int a<T>())` vs. `void f(int Function<T>() a)`.
This way, we have to think about these type parameters and formal
parameters only locally, like for example about local variables - they
exist, enclosed in a fragment, but don't leak outside into the element
model of a method.
I found this while working on the augmentations: that formal parameters
have to have the same types in the introductory declaration, and in
augmentations.
Change-Id: Ie4e92ebd0cd0204c4ba80200a9497e95859cc3e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Do not expose recovery type parameter and formal parameter elements
through the public element model. Recovery fragments are still needed
internally to link augmentation chains with mismatched shapes, but they
should not change the effective arity or callable signature of the
declaration being augmented.
Filter fragments marked as originating from another enclosing fragment
when computing executable formal parameters, executable type parameters,
and instance type parameters. This keeps function types, class arity,
and constructor or method signatures based on the real declaration
rather than on synthetic recovery elements introduced for invalid
augmentations.
Change-Id: I455a8a18bc07cdae30006754e069d687659aab1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510182
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Put local actions in a common pool, especially
- Assembler (many run for boringssl)
- Linker (high memory use)
- Dart (high memory use)
This should limit the number of concurrent local actions to the number of harts available, avoiding the racing actions triggering out-of-memory failures.
Change-Id: Ifa168012d73472a3db349acc36545dd176385bbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510190
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Several C++-only warning suppressions were incorrectly placed in the
shared 'default_warning_flags' list instead of
'default_warning_flags_cc'. This caused these flags (such as
-Wno-microsoft-unqualified-friend, -Wno-microsoft-cast)
to be applied to pure C targets (like zlib and BoringSSL assembly).
This CL moves these C++-only warnings to 'default_warning_flags_cc',
ensuring they are only applied to C++ compilation units. This improves
compile database accuracy, prevents IDE/clangd from surfacing phantom
diagnostics on C files, and makes the build configuration explicit and
robust.
Change-Id: I117de03496164d7e2e39b5deab7754fd85452923
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510181
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
The CallMarshaller is used not only from the compiler, but also
from the FfiCall runtime entry used by the interpreter. Since it
only has one use of the thread's CompilerState, looking up the
TypedData class, move the storage of that class from the compiler
state to the object store and remove this dependency.
TEST=ffi/address_of_array_generated_test
ffi/address_of_cast_test
fii/address_of_struct_generated_test
ffi/address_of_typeddata_generated_test
Fixes: https://github.com/dart-lang/sdk/issues/61913
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: Ia4fc5d9ecef370aa9476b998e37cc4ae94ee447f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498563
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This doesn't roll the latest dart_style main branch in because that has some style changes and there are other style changes still in flight. I want to roll all of those in all in one batch later.
Instead, this brings in a single commit whose parent is the current dart_style commit in the SDK. That commit contains only a fix for a crash bug when an analysis_options.yaml file contains an include pointing to a non-existent file. See:
https://github.com/dart-lang/dart_style/pull/1855
This gets the main branch in sync with the stable branch which has a cherry-pick with that same fix.
Change-Id: I97e3adec1c93175d372bb972989fe6a2860cf31f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510222
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This changes to handling of default value tokens on primary constructor fields to eager read the token of the fragment. This avoid leaking the token when field type inference isn't needed for the declared field.
Change-Id: I1cd7a2de7020bd403b843e1f0a456ab26a98e5ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510342
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Some recent changes to the parser looked like they should have cost
basically nothing but ended up costing a little bit anyway.
This CL marks the new functions for inlining recovering at least some of
the cost.
Change-Id: I599d557eb25bee892c8975d794618e837fec0caa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/510320
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This adds internal nodes for VariableStatement, VariableDeclaration, Let, and ForStatement. The prepares for separating Variable from InternalVariable and allows for the removal of Variable.asVariableDeclaration.
Change-Id: Ib0593f64b3d22ce99c187ab4af32c8dc8cbea6e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509980
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>