Commit graph

142 commits

Author SHA1 Message Date
Anis Alibegić
40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
Daco Harkes
80c742ea11 [samples/ffi] Run the async samples in sequence
The log prints are not very useful when running multiple similar tests
in paralel.
This CL changes the async tests to be run in sequence.

Bug: https://github.com/dart-lang/sdk/issues/49361
Change-Id: I73feb673c770be366cb0c6d2e80379dff53da987
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250086
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2022-06-29 09:48:46 +00:00
Ahmed Ashour
85700570f6 Fix typos
Fixes #49241

TEST=ci

Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 11:08:28 +00:00
Daco Harkes
81584f5d03 [samples/ffi] Update sqlite sample
The sample wasn't working for the longest time.

Fixes:

- Null safety, and late fields.
- `dart pub` instead of `pub`.
- Use the new `NativeFinalizer` and `Finalizable` features.

Change-Id: I0a397abae511ab3f6762d1b2c4047226d15e36d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143804
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-06-07 12:11:39 +00:00
Alexander Aprelev
46a10e2e4b [ffi/sample] Rev up ffi dependency to fix compilation error.
Fixes https://github.com/dart-lang/sdk/issues/48689

Change-Id: Ief95a720114215a24b56b0983c37b7b617f6f8be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239123
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-04-04 14:16:51 +00:00
Alexander Thomas
30beab0f43 [infra] Add OWNERS to the Dart SDK
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.

For additional background information see go/dart-sdk-owners.

TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-02-14 14:06:34 +00:00
Ryan Macnak
b6ab7350be [test] Inform status files about the new simulated architectures.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/37299
Bug: https://github.com/dart-lang/sdk/issues/38587
Change-Id: I6f1a749690b894b14f465d608f37acf62568cdef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231521
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-02-03 20:32:16 +00:00
Vyacheslav Egorov
bda70c8489 [vm] Remove support for dart-ext: imports
Per breaking change #45451 we are removing support for dart-ext:
style native extensions from the Dart VM.

This CL removes the associated VM code, tests and samples. It also ports
a single test which used dart-ext: import to use FFI instead.

TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/45451
Change-Id: Iae984bce32baf29a950b5de1323939006a217b94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212050
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-02 14:14:35 +00:00
Nate Bosch
8b2cacf9ca Update to the latest package:ffi
Remove SDK copies of `arena.dart` which is now in `package:ffi`.

Change-Id: Ic4808c473043be7d34cd1334406897a935c19263
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204020
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-06-18 07:24:51 +00:00
Daco Harkes
0b8091e0cd [vm/ffi] Improve Pool samples 2 and rename to Arena
Addressing follow up comments on
https://dart-review.googlesource.com/c/sdk/+/179180
before merging it into `package:ffi` in
https://github.com/dart-lang/ffi/pull/103.

Also adds the tests from the PR.

Change-Id: I9f9e7bdef00c758f0496e73c36e23116c65d95d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201186
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-05-25 15:01:46 +00:00
Clement Skau
4d5055805f [VM/FFI] Adds FFI leaf calls.
This CL adds FFI leaf calls by adding `lookupFunction(.., isLeaf)`
and `_asFunctionInternal(.., isLeaf)`, which generate FFI leaf calls.
These calls skip a lot of the usual frame building and generated <->
native transition overhead.

`benchmark/FfiCall/` shows a 1.1x - 4.3x speed-up between the regular
FFI calls and their leaf call counterparts (JIT, x64, release).

TEST=Adds `tests/ffi{,_2}/vmspecific_leaf_call_test.dart`. Tested FFI tests.

Closes: https://github.com/dart-lang/sdk/issues/36707
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-release-arm64-try,vm-ffi-android-release-arm-try,vm-ffi-android-product-arm64-try,vm-ffi-android-product-arm-try,vm-ffi-android-debug-arm64-try,vm-ffi-android-debug-arm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/36707
Change-Id: Id8824f36b0006bf09951207bd004356fe6e9f46e
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179768
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-05-21 11:12:02 +00:00
Alexander Aprelev
e70690e415 [native_extensions] Convert uri to path so that on Windows native extension loading works.
Lookup of native extension library on Windows works when the library is next
to Platform.executable, this CL fixes lookup when it's next to the script.

Fixes https://github.com/dart-lang/sdk/issues/45370

TEST=updated sample_extension test

Change-Id: I91226be19ceec05e45cf90fd85428a62d95769c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193741
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-04-01 03:22:35 +00:00
Ryan Macnak
5a385890b9 [test] Apply simarm64 status file entries to simarm64c.
Remove references to the removed simarmv6 architecture.

TEST=ci
Change-Id: I10e9fc8291c3e5b6b9a4bd71ca05de95e53f22c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187500
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-25 21:18:02 +00:00
Ryan Macnak
e1f5039854 [test] Remove assumption that machine word size implies Smi size.
This assumption will soon become false with compressed pointers.

TEST=ci
Change-Id: Ia95ffdcd0c55d649190fcd4764dc3878ecdeb6a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184540
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-02-12 17:08:23 +00:00
Daco Harkes
f358afca9e [vm/ffi] Migrate package:ffi Utf8 and Utf16 uses
Change-Id: I41d79969881015266273a3ce566ee402df11791d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184481
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-11 13:13:32 +00:00
Daco Harkes
a45276ab91 Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque"
This can only be landed when `Allocator`, `Opaque`, and `AllocatorAlloc`
have rolled into Flutter/engine, that into Flutter/flutter, and into g3.

Deletes all the copies of `_CallocAllocator` and uses the one from
`package:ffi` instead.

Bug: https://github.com/dart-lang/sdk/issues/44622
Bug: https://github.com/dart-lang/sdk/issues/43974
Bug: https://github.com/dart-lang/sdk/issues/44621
Bug: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I486034b379b5a63cad4aefd503ccd0f2ce5dd45e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180188
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-10 10:19:28 +00:00
Daco Harkes
6d58f653b1 [samples/ffi] Fix integer overflow
Closes: https://github.com/dart-lang/sdk/issues/44887

Change-Id: Ia45a9109ab4e7688e18669cbed2c30c1f92277f4
Cq-Include-Trybots: luci.dart.try:vm-kernel-ubsan-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183641
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-08 14:47:17 +00:00
Daco Harkes
302de78b2f [samples/ffi] Fix binding signatures
Change-Id: Ie691c2f7c0ac13b8fef72cd77728520b4db1159a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183004
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-05 10:22:17 +00:00
Daco Harkes
24a7e4387d [vm/ffi] Migrate off .addressOf in samples
Removes invocations of `.addressOf` in samples.

Removes the constructor from the Coordinate testing class which
has become useless with no access to the underlying pointer.

Issue: https://github.com/dart-lang/sdk/issues/40667


Change-Id: I1e55a4b159662654e1d14b2d51b0b43d734d5010
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181405
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-28 21:32:55 +00:00
Alexander Markov
91b0f16663 Migrate samples/sample_extension to null safety
Closes https://github.com/dart-lang/sdk/issues/43711

Change-Id: I7628e4a6192efb26a12f8051b4fa87dfafabab9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180960
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-01-25 20:06:43 +00:00
Daco Harkes
3cfcc5a8e5 Revert "[vm/ffi] Roll package:ffi to Allocator and Opaque"
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: I128e7b096faea650e0ba0850a411eed3e97c00e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180185
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00
Daco Harkes
7d648e3ae7 [vm/ffi] Roll package:ffi to Allocator and Opaque
This can only be landed when `Allocator` and `Opaque` have rolled into
Flutter/engine, that into Flutter/flutter, and that into g3.
flutter/flutter/commit/a706cd211240f27be3b61f06d70f958c7a4156fe

Deletes all the copies of `_CallocAllocator` and uses the one from
`package:ffi` instead.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974
Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I50b3b4c31a2b839b35e3e057bd54f463b90bc55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179540
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-20 18:08:25 +00:00
Daco Harkes
73bd44d363 [vm/ffi] Improve Pool samples
Addressing comments from
https://dart-review.googlesource.com/c/sdk/+/177706/20

Change-Id: I0cf023a5613978eebcb4aca84c9db24796687602
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179180
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-01-15 18:04:12 +00:00
Daco Harkes
ac805dff54 [vm/ffi] Migrate to empty Structs to Opaque
This CL migrates empty `Struct`s to `Opaque` native types.
It stops using `.ref` on `Pointer`s to these types.
And stops using `.ref` on `Pointer<Utf8>` which will be migrated in
`package:ffi`.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

Change-Id: I3aa256af7d4ceaa8ee37b1b2ada71f870f43617b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179181
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-15 10:52:53 +00:00
Daco Harkes
d37e833e23 [vm/ffi] Migrate samples(_2)/ffi to CallocAllocator
This CL does not yet roll `package:ffi` to use `Allocator`, because that
breaks the checked in Dart in Flutter in g3. Instead, this copies
`_CallocAllocator` from `package:ffi` into the samples.

New API landed in: https://dart-review.googlesource.com/c/sdk/+/177705

Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I83da349c2e52d7f079aa1569b4726318fee24c9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177706
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-14 13:57:03 +00:00
Daco Harkes
5d40d52fca [vm/ffi] Add Opaque type
Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

TEST=samples/ffi/sqlite/lib/src/bindings/types.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ib9e72df6a07b1bc2b72a7db66f945652814baf51
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178984
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-01-13 17:04:08 +00:00
Daco Harkes
550d580d5e [vm/ffi] Fuchsia FFI testing package
This does not include enabling the FFI on Fuchsia. So these tests will
fail without the dependent CL.

This CL adds an `all_positive.dart` test file to be packaged in the
.far file, such that it is easier to run all FFI tests in one go.

We don't run tests on the bots, but we do build this test package on
the bots.

To build the .far files locally:
```
tools/build.py --os=fuchsia -m debug fuchsia_ffi_test_package
tools/build.py --os=fuchsia -m debug -a arm64 fuchsia_ffi_test_package
```

Issue: https://github.com/dart-lang/sdk/issues/44434

Change-Id: Iec418e0c10d77afbf811fb83151664bcc2710b99
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175484
Reviewed-by: Liam Appelbe <liama@google.com>
2020-12-10 12:15:17 +00:00
Daco Harkes
da008fb3fc [samples] Migrate ffi samples to NNBD
Closes: https://github.com/dart-lang/sdk/issues/43600.

TEST=samples/ffi

Change-Id: I620e6a73c8e37dd72f8f3921fa37dd4f8966e45c
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,dart-sdk-linux-try,analyzer-nnbd-linux-release-try,analyzer-linux-release-try,front-end-nnbd-linux-release-x64-try,front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173542
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2020-11-24 18:50:28 +00:00
sheunglaili
7d64a93199 API doc issue: Update sqlite-tutorial CString section with correct ascii code
Closes https://github.com/dart-lang/sdk/pull/44042
https://github.com/dart-lang/sdk/pull/44042

GitOrigin-RevId: 2783fe93da270636d5453e03c6cd2c15b8e3c4cd
Change-Id: I663e840cee0d73002c401541bace0bd4016d8e36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170161
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-11-04 10:31:47 +00:00
Daco Harkes
5278383736 [vm] Native API: Make Dart_NewWeakPersistentHandle not auto delete
Changes Dart_NewWeakPersistentHandle to no longer auto delete the
weak persistent handle.

Changes the signatures of WeakPersistentHandleFinalizers to no longer
have access to the handle.

Flutter PR: https://github.com/flutter/engine/pull/19843
g3 presubmit: cl/318028238

Issue: https://github.com/dart-lang/sdk/issues/42312

TEST=runtime/vm/dart_api_impl_test.cc

Change-Id: I3f77db9954d9486759f903b78c03a494f73c68ba
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151525
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-03 10:27:44 +00:00
Leaf Petersen
745f112ef6 Opt out some files from null safety.
Opt an initial batch of files under samples, samples-dev,
utils, and runtime/tools/dartfuzz out of null safety in preparation
for switching the flag on by default.

Change-Id: Icdfd52a5a969e678a7205903332f73fe3841c223
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166960
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2020-10-12 22:15:42 +00:00
Alexander Aprelev
38ec554d6b Revert "[samples/ffi] Generate sqlite3 bindings with package:ffigen"
This reverts commit af4940fc57 as it broke
flutter engine license script, engine autoroller - it introduced dart
file with unrecognizable license.

Bug: https://bugs.chromium.org/p/skia/issues/detail?id=10598
Change-Id: I351931808316638d9bbc1b18aaf5a2525f04ee6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158108
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-08-11 19:38:18 +00:00
Daco Harkes
af4940fc57 [samples/ffi] Generate sqlite3 bindings with package:ffigen
Cleanup handwritten code now that we do have a generator.

We don't need package:ffigen in the DEPS, because we don't run it
anywhere in the SDK build or tests. It is a dev dependency and the
generated file is checked in.

Change-Id: I02784ca5895b4e878a0fed696a34c546a71c2702
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152141
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2020-08-11 09:15:59 +00:00
Daco Harkes
202e32afeb [vm] Native API: Introduce Dart_FinalizableHandle
Introduces Dart_NewFinalizableHandle which does auto delete itself,
but does not allow accessing the weak referenced object.

Issue: https://github.com/dart-lang/sdk/issues/42312

Change-Id: I24ea732925122c453213c4fa3f629761c352f838
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154695
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-23 11:30:39 +00:00
Daco Harkes
7eac9f355e [vm/ffi] Expose a subset of dart_(native_)api.h for dynamic linking.
This CL introduces dart_api_dl.h which exposes a subset of dart_api.h
and dart_native_api.h for dynamic linking at runtime through the FFI.
Dynamic linking is done through including dart_api_dl.cc in a shared
library and passing NativeApi.initializeApiDLData to the init function.

This CL also includes Native API versioning to deal with possible
version skew between native api version against which native libraries
are compiled and the version in the DartVM the code is run on.

The subset of symbols in the CL includes handle related symbols, error
related symbols, handle scope symbols, and native port sumbols.

Design: http://go/dart-ffi-expose-dart-api

Closes: https://github.com/dart-lang/sdk/issues/40607
Closes: https://github.com/dart-lang/sdk/issues/36858
Closes: https://github.com/dart-lang/sdk/issues/41319
Closes: https://github.com/flutter/flutter/issues/46887
Closes: https://github.com/flutter/flutter/issues/47061

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

Change-Id: I9e557808dbc99b341f23964cbddbb05f26d7a6c5
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145592
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-18 07:30:43 +00:00
Daco Harkes
54903e5bf0 [vm/ffi] Rename members in NativeApi to not contain nativeApi
Follow up of: https://dart-review.googlesource.com/c/sdk/+/136962

Change-Id: Icdc8e7f701b0dbc7e476a140e68bcb15b3ac64ae
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138283
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-04 15:21:55 +00:00
Daco Harkes
f7192b63cb [vm/ffi] Expose dart_native_api.h symbols via dart:ffi
This enables dynamic linking of the symbols in dart_native_api.h to work around the Windows linking issue and Dart embedders not exposing symbols.

Issue: https://github.com/dart-lang/sdk/issues/40607
Closes: https://github.com/dart-lang/sdk/issues/40564

Change-Id: I6f797cc915b53ec63fa5953529f17c40e52a2aed
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136962
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-28 18:44:45 +00:00
Daco Harkes
cb60e4b78e [samples/ffi] Sample for asynchronous native port calls
Issue: https://github.com/dart-lang/sdk/issues/37022#issuecomment-567122704

Change-Id: I774befa1d9843c043883038e59c0f8b629bf3c77
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134822
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-18 08:42:16 +00:00
Daco Harkes
76ef075b71 [samples/ffi] Sample for asynchronous callbacks
Issue: https://github.com/dart-lang/sdk/issues/37022#issuecomment-567122704

Change-Id: If30d168e6666131b6d96d5885a0dbe32291b1ef9
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134704
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-18 08:42:16 +00:00
Daco Harkes
a228bf5e1a [vm/ffi] Test alignment of small stack arguments
Test exercises alignment on stack, will currently fail on iOS arm64.

In addition, the Dart functions used as callbacks in tests now print their arguments for debugging purposes.

Issue: https://github.com/dart-lang/sdk/issues/39637

Splitting test off large CL (https://dart-review.googlesource.com/c/sdk/+/129081) to be able to land separately.

Change-Id: Iba3c63338f5d91d6e3819e54c166bbfade48d53f
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131074
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-01-14 10:50:25 +00:00
Daco Harkes
4bd3166529 [samples/ffi] Native resource lifetime management
Samples for managing native memory without finalizers.

Design: go/dart-ffi-resource-lifetime

Related issue: https://github.com/dart-lang/sdk/issues/35770

Change-Id: I2d0ac1acb65a78db9f57aea3dd5f25b4948ef6d6
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123662
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2019-12-12 10:27:22 +00:00
netroby
1f791e0668 Fixed #39679 make sqlite ffi sample run success
Closes #39680
https://github.com/dart-lang/sdk/pull/39680

GitOrigin-RevId: 08a6f2c661d645f14ff41c13292002028bc10323
Change-Id: I5100521fa011be5167d00e5610bd87cb2f78093b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127456
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-12-12 09:04:11 +00:00
Brett Morgan
740cd89ad8 Fix link markup in ffi README
Closes #39196
https://github.com/dart-lang/sdk/pull/39196

GitOrigin-RevId: 0a3c0cf7fb3abd496fc54c018e5603a79c767a17
Change-Id: I67d5e0a3408e24bd732a0c8f2d1f4674965acf99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123691
Reviewed-by: Michael Thomsen <mit@google.com>
2019-11-04 09:31:27 +00:00
Daco Harkes
75bee2083a [samples/ffi] Add bitfield sample
Issue: https://github.com/dart-lang/sdk/issues/38954
Change-Id: I04b2b81d83a19c5ff88d4364256b23594fe2139b
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122762
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-24 17:40:27 +00:00
Daco Harkes
e4f7893545 [samples/ffi] Fix samples and run them as test - fix status file
Follow up of: https://dart-review.googlesource.com/c/sdk/+/122382.

Change-Id: I366f24d2330aa4743bcec3598321ff54b00ac25e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122763
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-10-24 15:57:44 +00:00
Daco Harkes
aa36c1fbc5 [samples/ffi] Fix samples and run them as test
Change-Id: I49eeba32d99c9cf916d25150b46fa6d74ece0092
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122382
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-23 22:20:37 +00:00
Sam Rawlins
4f0c8cba56 Add README for samples/sample_extension
Bug: https://github.com/dart-lang/sdk/issues/35839
Change-Id: I35fe0d5b6be7ead081e164ddce2f8dc8e273158a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122160
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-10-18 15:33:06 +00:00
Daco Harkes
d82ca1a9c7 [vm/ffi] Remove Struct type argument
This has coupled changes in package:ffi and package:tflite_native which are pinned in DEPS.

This CL includes the required analyzer changes from https://dart-review.googlesource.com/c/sdk/+/121647.

Issue: https://github.com/dart-lang/sdk/issues/38611

Change-Id: I712a886fd28ce0a2954fc42c90e1dfa495057732
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-reload-mac-release-simdbc64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try,dart-sdk-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121422
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-15 18:35:57 +00:00
Samir Jindel
4ee5ef9f10 [vm/ffi] Use Pointer<Null> as the type of nullptr.
Also clean up test/benchmark/sample code using nullptr and fix pubspec.yaml in the SQLite sample.

Fixes https://github.com/dart-lang/sdk/issues/37362

Change-Id: I6fa0522374af28020ef8f096ac22b23712aedb5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121122
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-11 14:39:47 +00:00
Samir Jindel
8859206dba [vm/ffi] Remove Pointer.offsetBy.
Fixes https://github.com/dart-lang/sdk/issues/35883

Change-Id: Idf4b113d655a6cf7063f1ee7732ddd2001247dee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121124
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-10-10 15:44:27 +00:00