ed169c4bb0
This reverts commit be209f7846.
Reason for revert: failures on dartkb and windows bots
Original change's description:
> [vm/ffi] FFI callbacks on X64.
>
> For context on the design, see go/dart-ffi-callbacks
>
> Change-Id: I2482e3c932e73f9a4c00fa7e218ff85f9328fc51
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100240
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
TBR=sjindel@google.com,ajcbik@google.com,dacoharkes@google.com
Change-Id: I4cb3d93675d68a51ac9e125ad1d572c47e8b5903
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102983
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
56 lines
1.6 KiB
Dart
56 lines
1.6 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import "dart:_internal" show patch;
|
|
|
|
@patch
|
|
Pointer<T> allocate<T extends NativeType>({int count: 1}) native "Ffi_allocate";
|
|
|
|
@patch
|
|
T fromAddress<T extends Pointer>(int ptr) native "Ffi_fromAddress";
|
|
|
|
@patch
|
|
int sizeOf<T extends NativeType>() native "Ffi_sizeOf";
|
|
|
|
@patch
|
|
Pointer<NativeFunction<T>> fromFunction<T extends Function>(
|
|
@DartRepresentationOf("T") Function f) native "Ffi_fromFunction";
|
|
|
|
@patch
|
|
@pragma("vm:entry-point")
|
|
class Pointer<T extends NativeType> {
|
|
@patch
|
|
void store(Object value) native "Ffi_store";
|
|
|
|
@patch
|
|
R load<R>() native "Ffi_load";
|
|
|
|
@patch
|
|
int get address native "Ffi_address";
|
|
|
|
// Note this could also be implmented without an extra native as offsetBy
|
|
// (elementSize()*index). This would be 2 native calls rather than one. What
|
|
// would be better?
|
|
@patch
|
|
Pointer<T> elementAt(int index) native "Ffi_elementAt";
|
|
|
|
// Note this could also be implmented without an extra native as
|
|
// fromAddress(address). This would be 2 native calls rather than one.
|
|
// What would be better?
|
|
@patch
|
|
Pointer<T> offsetBy(int offsetInBytes) native "Ffi_offsetBy";
|
|
|
|
// Note this could also be implemented without an extra native as
|
|
// fromAddress(address). This would be 2 native calls rather than one.
|
|
// What would be better?
|
|
@patch
|
|
U cast<U extends Pointer>() native "Ffi_cast";
|
|
|
|
@patch
|
|
R asFunction<R extends Function>() native "Ffi_asFunction";
|
|
|
|
@patch
|
|
void free() native "Ffi_free";
|
|
}
|