Commit Graph

21206 Commits

Author SHA1 Message Date
Jonas Termansen 6eaec1ec42 [test] Check platform in exported_symbols_test.
llvm-nm for Linux and macOS needs to be for the right operating system
if the local checkout contains clang toolchains for other operating
systems.

Change-Id: I8de702474a6fa14f06b48e3e60756b3f414272f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342940
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-12-21 14:00:34 +00:00
Daco Harkes 562f66b313 [gardening][vm] Adjust timeouts inside test
Also removes the status file entry. This test is not slow, it hangs.
So don't give it more time to hang.

Bug: https://github.com/dart-lang/sdk/issues/53878
Change-Id: Ifa5112f25edb16cffd8f26fb71917d1672eed34d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343140
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-12-21 09:37:03 +00:00
Simon Binder 6ce0504924 [vm/ffi] Support native array fields
This lifts the restriction preventing `@Native` fields from having
`Array` types.

Closes https://github.com/dart-lang/sdk/issues/54337

TEST=tests/ffi/vmspecific_static_checks_native_test.dart
TEST=pkg/analyzer/test/src/diagnostics/ffi_native_test.dart
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try
Change-Id: Ic485c86bac9a42ab06097a84a01aba3c481b98e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-12-21 08:47:58 +00:00
Simon Binder ada6b81761 [vm/ffi] Improve error messages on Windows
Use `FormatMessageA` to allocate an English description of an error code.
Previously, only the error code itself was shown.

Closes https://github.com/dart-lang/sdk/issues/52790

TEST=tests/ffi/dylib_open_test.dart
Cq-Include-Trybots: luci.dart.try:vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-aot-win-debug-x64c-try,vm-aot-asan-linux-release-x64-try,vm-asan-linux-release-x64-try
Change-Id: Iccae6c763fb16d4bb999b9c260fcfea9c5de276b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328420
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-12-20 13:24:16 +00:00
Jonas Termansen 669060f8c7 [build] Omit SDK and Git hashes on RBE.
Bug: b/296994239
Change-Id: I70c10fddc3bd01fef5ed5182e1d28d0797c431e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342421
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-12-20 12:23:56 +00:00
Alexander Markov 6b12473f75 [vm] Adjust return value of async/async*/sync* after the language spec change
Calculation of element type for the value returned from
async/async*/sync* functions was recently adjusted
in the spec to address soundness issue
(https://github.com/dart-lang/language/pull/3218).

This change adjusts Dart VM to conform to the new spec.

TEST=language/async/regression_54311_test
TEST=co19/Language/Functions/element_type_*

Fixes https://github.com/dart-lang/sdk/issues/54316
Issue https://github.com/dart-lang/sdk/issues/54311
Issue https://github.com/dart-lang/sdk/issues/54159

Change-Id: I4c51e7cba704d034350519375210bdb2086c5432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342082
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-12-19 16:14:39 +00:00
Chloe Stefantsova 3eeba4a4e2 [cfe] Refactor FunctionNode.futureValueType into emitted value type
Previously we would encode the type of the value returned in `async`
functions as the field `futureValueType` on `FunctionNode`. For all
other kinds of functions, such as `sync`, `sync*`, and `async*`, that
field would be null. This CL renames `futureValueType` into
`emittedVAlueType`, and for functions of kinds `async`, `sync*`, and
`async*` that is expected to be the type of values emitted via
`return` or `yield` statements. For `sync` functions that field is
supposed to contain `null`.

In response to https://github.com/dart-lang/sdk/issues/54159

TEST=existing

Change-Id: I1efdbcc4e75d150f5618c7ca50cfe49a0e54fce6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341662
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-12-19 08:44:43 +00:00
asiva 794d3adf93 [VM] - Minor cleanups
TEST=ci

Change-Id: I5c2839fe48f1a4f1f48aa86cee948dc99fcca511
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342383
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-12-18 21:39:09 +00:00
Zach Anderson c84edaefe9 Check in //third_party/root_certificates.
No one could remember why this code was in a separate repo, and
checking it in to the SDK repo will make eliminating the
flutter buildroot repo a tiny bit easier.

TEST=It builds.
Change-Id: Ia34ca0c284fee1dd1734f45ef7acb9dd5cde808c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342083
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2023-12-18 19:40:36 +00:00
Jonas Termansen 37b2209722 [vm] Remove timer non-zero assertions.
For some reason, these assertions fire when snapshots are trained on RBE
inside a docker container. It's potentially a race condition if the
timer resolution is low enough or RBE is lying about the time. However,
there is no need to check if the start time is non-zero since there's
already a running_ variable protecting against stopping times that
haven't been started.

TEST=CQ, locally, and on RBE

Bug: b/296994239
Change-Id: I2a5b36d0b1cb9b939e94fe6aabb5f41fec077f2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342401
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2023-12-18 17:01:18 +00:00
Simon Binder f2329a703f [vm/ffi] Fix field tests on Windows
Fields used in Dart test with `@Native` fields must be `extern "C"` to
avoid name mangling.
As seen from build and test failures, MSVC doesn't seem to consistently
use C fields for `extern "C"` fields defined in a C++ file.
By moving these fields into a C file, they can be referenced both from
the other C++ test functions and via Dart fields.

TEST=Windows CI build

Cq-Include-Trybots: luci.dart.try:vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-aot-win-debug-x64c-try
Change-Id: Ia504a1d6e04efd00bdd50de54f4b65292ec7a41a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342260
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-12-18 16:55:01 +00:00
Daco Harkes c963fbeb68 [vm/ffi] Fix windows
This **partially** the fixes the breakage caused by https://dart-review.googlesource.com/c/sdk/+/338020

TEST=Windows CI build
TEST=tests/ffi

Bug: https://github.com/dart-lang/sdk/issues/54382
Change-Id: Ic71f15c751ac35f06b362a607c6a397911fd44e6
Cq-Include-Trybots: luci.dart.try:vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-aot-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342120
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2023-12-15 22:23:06 +00:00
Alexander Markov 5bff7fa6a3 [vm/aot] Keep import graph connected when tree-shaking libraries
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_54324.dart
Fixes https://github.com/dart-lang/sdk/issues/54324

Change-Id: Ifefb490dfd5f4fea7b94d1841385a9761f258ba8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341783
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-12-15 17:17:29 +00:00
Ryan Macnak 04d606aaff [vm] Account for --no_retain_function_objects in Code::Name.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54344
Change-Id: Ic72b877efaf36a5b68285caa595604e203ea83b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341821
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-12-15 17:08:56 +00:00
Ben Konyi 9a96a8eb97 [ VM ] Fix timestamp overflow when building Perfetto protos on IA32
Fixes https://github.com/dart-lang/sdk/issues/54290

TEST=pkg/vm_service/test/get_perfetto_cpu_samples_rpc_test.dart should start passing on IA32

Change-Id: I826c7e965a88f11b678e1f836eb4140292160e35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342060
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-12-15 16:48:37 +00:00
Alexander Markov dcdfcc2b8d Reland "[vm/ffi] Express FFI call closures explicitly in AST"
This reverts commit 1800039c2a.

The changes fd2e9b9f1a and
c20f9eaf6f are relanded as is.

Reason for revert was fixed separately in
https://dart-review.googlesource.com/c/sdk/+/341621

TEST=ci

CoreLibraryReviewExempt: Implementation change only.
Issue: https://github.com/dart-lang/sdk/issues/54172
Issue: https://github.com/dart-lang/sdk/issues/39692
Change-Id: I1a2324768502e5ffbce328127938c0d3c96c38ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341642
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-12-15 15:25:29 +00:00
Simon Binder 150e61a662 [vm/ffi] Support @Native fields
Allow annotating top-level or static fields with `@Native` to create
fields backed by native memory.
By using the `_addressOf` operator implemented in the VM, these fields
can be implemented in the CFE by replacing them with accessors looking
up the pointer and then using existing methods to load and store the
value.

Closes https://github.com/dart-lang/sdk/issues/50551

TEST=tests/ffi/native_assets/asset_*_test.dart
TEST=pkg/analyzer/test/src/diagnostics/ffi_native_test.dart

CoreLibraryReviewExempt: VM & dart2wasm only feature
Change-Id: I61dccc88076723d6a6ba02d7fd848b18e4caf780
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338020
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-12-15 11:20:23 +00:00
Ryan Macnak 877dbd7226 [vm, service] Fix heap snapshot generation to account for there no longer being a kMaxImagePages.
With deferred loading, the number of image pages can be arbitrarily large. The compactor already has the analogous change.

TEST=ci
Change-Id: Ie5a1ff0902e56aaebf1d1c679ce26b35e8a03ec3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341781
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-12-14 22:48:49 +00:00
Ryan Macnak 09a1fa143c [test] Shrink write barrier elimination stress tests.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54167
Change-Id: Ic707b1dc039f65a8f5367c5e679594e1b4aafd6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341622
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-12-14 20:49:07 +00:00
Paul Berry 949f3af120 Remove kernel flag Procedure.isAbstractFieldAccessor.
This used to be used solely by field promotion, to recognize when a
getter arose from a declaration of an abstract field, so that abstract
fields would be promotable but explicitly declared abstract getters
would not be.

However, with the adoption of
https://github.com/dart-lang/language/issues/3328, both abstract
fields and abstract getters are now considered promotable, so there is
no longer any need to distinguish them.

Bug: https://github.com/dart-lang/language/issues/3328
Change-Id: Idc14512568eb0a11dae4e364df453d117adff2e3
Tested: standard presubmit bots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338643
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-12-14 18:06:52 +00:00
Alexander Markov 508cdb51c2 [vm] Fix handling of force-optimized functions in debugger
Force-optimized functions where not consistenly checked when
deoptimizing world and querying local variables in debugger.

TEST=Manual testing of repro from https://github.com/flutter/flutter/issues/140074
Fixes https://github.com/flutter/flutter/issues/140074

Change-Id: I097ea60dd2371757f29d89ffbe5b85119e31e15d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341621
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-12-14 18:01:32 +00:00
Ryan Macnak 2d01bf3779 [vm, gc] Interrupt to finalize concurrent marking.
STW marking is no longer O(new-space), so there's no longer a reason to delay finalizing marking hoping for a scavenge to make new-space mostly empty.

TEST=ci
Change-Id: Ie782e88852714d30e0c75aa9aecac62e56c434ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319880
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-12-14 17:27:49 +00:00
Brian Quinlan da0b9aa8b3 Revert "Call tzset() in OS::Init() on Android so localtime_r() has populated timezone information."
This reverts commit 49f6657c37.

Reason for revert: This caused a performance regression in Android startup time.

Original change's description:
> Call tzset() in OS::Init() on Android so localtime_r() has populated timezone information.
>
> POSIX and glibc do not guarantee that timezone setup is done by localtime_r().
>
> Android <= 7.1.1 did *not* do timezone setup in localtime_r(), which means that users will see their timezone as "GMT".
>
> macOS/iOS seem to guarantee that timezone setup is done in localtime_r() but the wording is vague:
>
>   localtime_r() and gmtime_r() functions provide the same functionality
>   as localtime() and gmtime()...
>
> N.B.: localtime() is guaranteed to do timezone setup
>
> Bug:https://github.com/dart-lang/sdk/issues/53276
> Change-Id: I8f6abfbfcf07a61cb341c1dbbd8323440cb8f581
> Tested: manually tested on Android 7.1.1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340281
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Brian Quinlan <bquinlan@google.com>

Bug: https://github.com/dart-lang/sdk/issues/53276
Change-Id: I02ae79d5c3a3f5a3a9003fae71b81ff5a10ac272
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341338
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-12-14 16:33:21 +00:00
Shikhar Soni efb60eac59 [ffi]: Add extension operator methods(+,-) for pointer arithmetic
Closes [#54250](https://github.com/dart-lang/sdk/issues/54250).

TEST=test/ffi

Change-Id: I2299e019b6c0b0db74662e4f9439feac46bc9b40
CoreLibraryReviewExempt: FFI only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341420
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Shikhar <shikharish05@gmail.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-12-14 11:42:38 +00:00
Alexander Markov 1800039c2a Revert "[vm/ffi] Express FFI call closures explicitly in AST"
This reverts commit fd2e9b9f1a.

Revert "[vm/ffi] Cleanup FFI call trampolines"

This reverts commit c20f9eaf6f.

Reason: https://github.com/flutter/flutter/issues/140074
TEST=ci
CoreLibraryReviewExempt: Implementation change only.
Change-Id: Ib193d8f015fc66461fe3cc90550a92e1ba65f236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341620
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-12-14 01:14:58 +00:00
Alexander Markov c20f9eaf6f [vm/ffi] Cleanup FFI call trampolines
After [1], FFI call sequence is generated inside a Dart closure
function and separate FFI call trampolines are no longer used.
This change removes all code related to FFI call trampolines.

[1] https://dart-review.googlesource.com/c/sdk/+/339662

TEST=existing

Change-Id: I0af0be6441009fb4db885ee172b0487f4796fd18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340302
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-12-12 19:19:45 +00:00
Alexander Markov fd2e9b9f1a [vm/ffi] Express FFI call closures explicitly in AST
Instead of implicitly creating closures for FFI
asFunction/lookupFunction APIs in the VM, now they are explicitly expressed in the kernel AST. That makes it possible to analyze
them in TFA.

FFI calls from Dart code into native are now performed in the following way:

```
  block {
    Pointer #ffiTarget0 = target;
    @pragma('vm:ffi:call-closure', _FfiCall<Int32 Function(Int32)>(isLeaf: false))
    #ffiClosure0(int arg1) {
      _nativeEffect(arg1);
      return _ffiCall<int>(#ffiTarget0);
    }
  } =>#ffiClosure0;
```

_ffiCall method is recognized by the VM and its call is replaced
directly with FFI calling sequence. _ffiCall uses closure
parameters implicitly. No extra trampolines are generated for FFI calls.

TEST=existing
Fixes https://github.com/dart-lang/sdk/issues/54172
Issue https://github.com/dart-lang/sdk/issues/39692

CoreLibraryReviewExempt: Implementation change only.
Change-Id: I92b3ff7391470686151ad0807e2cdbbf1a69d256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339662
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-12-12 18:34:39 +00:00
Ryan Macnak d65b47846b [build] Make analyze_snapshot GN target available for riscv64.
Flutter refers to this target.

Bug: https://github.com/flutter/flutter/issues/99963
Bug: https://github.com/flutter/flutter/issues/117973
Change-Id: I7a4464216c50f7248fc73664af1c5b217d1a7b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341101
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-12-12 18:16:59 +00:00
Alexander Markov 804a306895 [vm] Preserve pragma annotations on hot reload
TEST=vm/cc/IsolateReload_KeepPragma{1,2,3}

Change-Id: Ib698b918a27382e3573b5d3f0670d9f4e13c8064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341100
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-12-12 02:09:27 +00:00
Ryan Macnak a3b7c323b0 [vm, gc] Mark through new-space.
- Initial and final marking no longer visit all of new-space, reducing the STW pause for major GC.
 - A scavenge during concurrent marking must forward / filter objects in the marking worklist that are moved / collected, increasing the STW pause for minor GC.
 - Unreachable intergenerational cycles and weak references are collected in the next mark-sweep instead of first requiring enough scavenges to promote the whole cycle or weak target into old-space.
 - Artificial minor GCs are no longer needed to avoid memory leaks from back-to-back major GCs.
 - reachabilityBarrier is now just a count of major GCs.

TEST=ci
Change-Id: Ic7754e8d972763654eae2b7faa8670735d9cda3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340644
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-12-12 01:56:15 +00:00
Daco Harkes 40094c8cfd [vm/ffi] Unwrap typed data in FFI calls
Enables passing inner pointers to typed data in FFI leaf calls.

This works for typed data's in the Dart heap, external typed datas
(constructed from `Pointer.asTypedList`), and typed data views.

Notable implementation details:
1. The Dart signature is used in the Marshaller now. This means it
   needs to keep track of whether there's a pointer argument in the
   signature (`asFunction`) or not (`@Native`).
2. Unwrapping is done in `FfiCallInstr::EmitNativeCode` before moving
   the arguments to their native location. This ensures we can use
   the assembler logic to load the `TypedDataBase::data` field.
3. The `XXXList` user visible classes don't have predefined cids.
   So the implementation uses symbols for comparison.
4. The type checking logic takes `isLeaf` as input to reject typed
   data. This leads to an error message about the type not accepted.
   Alternatively, we could consider adding an error message that
   specifically says the function should be leaf.
5. To cover all calling convention variants, tests are generated with
   up to 20 arguments.

TEST=pkg/analyzer/test/src/diagnostics/ffi_unwrap_typed_data_test.dart
TEST=tests/ffi/unwrap_typeddata_generated_native_test.dart
TEST=tests/ffi/unwrap_typeddata_generated_test.dart
TEST=tests/ffi/vmspecific_static_checks_typeddata_test.dart

Closes: https://github.com/dart-lang/sdk/issues/44589
Change-Id: Ia78f18bf3238d42ac6882929b441f6dc432fcefe
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_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-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-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-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-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-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-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/+/338620
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-12-12 00:05:02 +00:00
John McCutchan 33ad2086c1 Expose Dart_Null_DL from dart_api_dl.h
R=dacoharkes@google.com

https://github.com/dart-lang/sdk/issues/54296

TEST=tests/ffi/vmspecific_handle_dynamically_linked_test.dart

Change-Id: Ibcf6a387a4b6385b17c13ed4b3ce6422291a5f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341061
Auto-Submit: John McCutchan <johnmccutchan@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: John McCutchan <johnmccutchan@google.com>
2023-12-11 21:06:37 +00:00
yamichonghe 1ddafec2d3 [ssl/win] Always free the X509 certificates after use, fix leak.
R=aam@google.com, asiva@google.com

Bug: https://github.com/dart-lang/sdk/issues/54251
TEST=manually on win
Change-Id: Ia8ce28e69d91606e2b7fe2af8335abd815b0e7d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340720
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: yami yami <yaminet1024@gmail.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-12-11 17:49:58 +00:00
Alexander Aprelev 7850a1cf99 [vm/win] Redirect warn/error/assert informaion into stderr.
Currently crt warn/error/asserts will disappear, so redirecting them to stderr sounds like a better approach.

TEST=manual win run

Change-Id: Iee0a2effd93fbe104dbeab77abebc54beaecb5dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340583
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-12-08 20:20:10 +00:00
Alexander Aprelev 229e8ef687 [gardening] Use RecordType::New() instead of thread-unsafe Object::Clone() in RecordType::ToNullability.
Fixes https://github.com/dart-lang/sdk/issues/54123

TEST=tsan ci

Change-Id: Ie5e326e9400286360c1152c870539cbfd179c8f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340288
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-12-08 20:13:38 +00:00
Alexander Aprelev 087278428e [vm/win] Ensure no message boxes for crashes on windows debug builds.
Follow-up to https://dart.googlesource.com/sdk/+/543dbdd708de6da4a461e15147940e08231bba9d

TEST=manually on windows
BUG=https://github.com/dart-lang/sdk/issues/54275

Change-Id: Iec70cb37ab6b6133ce7599fead3ffabc5ba92312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340388
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-12-08 17:24:59 +00:00
Alexander Aprelev 87c791ed9a [gardening] Fix stress_test_list for a test that just got renamed.
Follow-up to 004f564f40

TEST=ci

Change-Id: Ice18a92cef283042bcaa81594e31356c35eb850d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340389
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Auto-Submit: Alexander Aprelev <aam@google.com>
2023-12-08 01:48:32 +00:00
Alexander Aprelev 543dbdd708 [gardening] Skip vm/dart/in_memory_elf_test on windows debug aot bots - it's flaky and too slow.
Fixes https://github.com/dart-lang/sdk/issues/54275
TEST=ci

Change-Id: I344598f1305ac1df5e604aa72b1c80edace5e4ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340287
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-12-08 00:44:02 +00:00
Alexander Markov fe2ea6a55f [vm] Add minimal support for mirrors of extension type members
Support extension type members in dart:mirrors similarly to extensions.
Add MethodMirror.isExtensionTypeMember and VariableMirror.isExtensionTypeMember.

TEST=tests/lib/mirrors/method_mirror_extension_test.dart
Fixes https://github.com/dart-lang/sdk/issues/54266

CoreLibraryReviewExempt: VM-only dart:mirrors API change
Change-Id: I9c1c22118ee52e98d5013c881eb6ad5686df656e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340284
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-12-07 21:48:50 +00:00
Alexander Aprelev 514df6fd60 [gardening] Fix fuchsia build breakage
Follow-up to https://dart.googlesource.com/sdk/+/0ea04d407d74503fb7a7ae581727523ec979a2ed

TEST=ci

Change-Id: I335b3a0bdeed6b0d1d58bf9ea2ec671e7c9cf7c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340381
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-12-07 17:42:19 +00:00
Jens Johansen c959173b4c [CFE/VM] Expression compilation when inside an extension type method
VM: De-mangle names as done with extension methods.
CFE: Handle #this as with extension methods.

TEST=ci
Change-Id: I512798632a016025bf30edf8a0586d9085b4e3cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339960
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-12-07 11:15:25 +00:00
Filip Filmar 0ea04d407d [fuchsia] Adds the new ICU tzdata dir /config/tzdata
This is in line with the most up to date Fuchsia namespace
conventions.

TEST=fuchsia tests
Bug: #54176
Change-Id: Ic3891ea9119308052a8abd3d23110c35e270967a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338588
Auto-Submit: Filip Filmar <fmil@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-12-07 08:41:14 +00:00
Brian Quinlan 49f6657c37 Call tzset() in OS::Init() on Android so localtime_r() has populated timezone information.
POSIX and glibc do not guarantee that timezone setup is done by localtime_r().

Android <= 7.1.1 did *not* do timezone setup in localtime_r(), which means that users will see their timezone as "GMT".

macOS/iOS seem to guarantee that timezone setup is done in localtime_r() but the wording is vague:

  localtime_r() and gmtime_r() functions provide the same functionality
  as localtime() and gmtime()...

N.B.: localtime() is guaranteed to do timezone setup

Bug:https://github.com/dart-lang/sdk/issues/53276
Change-Id: I8f6abfbfcf07a61cb341c1dbbd8323440cb8f581
Tested: manually tested on Android 7.1.1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340281
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-12-07 01:34:31 +00:00
Martin Kustermann 4163bb1277 [vm] Do not call isolate group shutdown callback for vm isolate
Closes https://github.com/dart-lang/sdk/issues/54199

TEST=

Change-Id: I1b562a082766a2d02bc9d51f4eca597f4d109caf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339940
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-12-06 08:02:49 +00:00
Ryan Macnak 9c0b1e06db [vm, profiler] Remove race between sample processor and stub code initialization.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/54226
Change-Id: I54ce983acae28474c4a31200922b902dd19cf95d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339643
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-12-05 17:29:05 +00:00
Ryan Macnak ea57365feb [standalone] Fix finding symbols when argv[0] is not an absolute path or relative to CWD.
TEST=vm/dart/symbolized_crash_test
Change-Id: I941045db6ab78b24bd529e775380be80c1d71121
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339782
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-12-05 17:25:39 +00:00
Daco Harkes 7abab94d97 Revert "[vm, compiler] Unwind record alignment."
This reverts commit b91dcdf422.

Reason for revert: Broke g3 Windows cross compilation.
`unwinding_records_win.cc: 80: error: Failed to add growable function table: 0xc0000095`
https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/google/42584/overview

Original change's description:
> [vm, compiler] Unwind record alignment.
>
> TEST=vm/dart/in_memory_elf_test
> Bug: https://github.com/dart-lang/sdk/issues/54206
> Change-Id: I3a0e15ee3f3b98602cd2cf8921f0334539e64a17
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339225
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Bug: https://github.com/dart-lang/sdk/issues/54206
Change-Id: I8b57862f53af254040d0425e78abab0e608e33e7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339942
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2023-12-05 15:07:47 +00:00
Simon Binder a44a524bb0 [vm/ffi]: Add Native.addressOf
This adds the `Native.addressOf` function, which takes a constant tear-
off of a method annotated with `@Native` as a parameter and returns a
pointer to the underlying C function.

The CFE will resolve these calls in two steps: First, the existing
transformer for `@Native` methods adds a pragma describing the fully-
resolved native annotation (with the asset id inferred from the library
if not given explicitly). Then, the FFI use sites transformer rewrites
calls to `Native.addressOf` by searching for this pragma on the passed
function and passing the `Native` constants to `Native._addressOf`. The
latter method is implemented in the VM, which can re-use existing parts
already used for `@Native` calls.
An alternative implementation strategy would have been to forward
`addressOf` calls to `Native.ffi_resolver_function` directly without
any special consideration in the VM. However, the chosen approach makes
it easier to support static linking in the future, as this requires
unresolved symbols in the generated assembly.

Closes https://github.com/dart-lang/sdk/issues/50552

TEST=pkg/vm/testcases/transformations/ffi/ffinative.dart
TEST=tests/ffi/native_assets/asset_*_test.dart
TEST=tests/ffi/vmspecific_static_checks_ffinative_test.dart
TEST=pkg/analyzer/test/src/diagnostics/ffi_native_test.dart

Cq-Include-Trybots: luci.dart.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-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-kernel-precomp-linux-release-x64-try
CoreLibraryReviewExempt: VM & dart2wasm only feature
Change-Id: Ic8e3a390146dffd44c95578f975a4472db79a0ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-12-05 13:10:36 +00:00
Ryan Macnak b91dcdf422 [vm, compiler] Unwind record alignment.
TEST=vm/dart/in_memory_elf_test
Bug: https://github.com/dart-lang/sdk/issues/54206
Change-Id: I3a0e15ee3f3b98602cd2cf8921f0334539e64a17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339225
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-12-04 21:49:24 +00:00
Ryan Macnak 719a0b7587 [test] Remove use of waitFor from isolate stress tests.
Change-Id: Icaaadc63f661a4a531c232a52ca9230bf93f2f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339700
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-12-04 21:26:59 +00:00