Skip to content

Commit

Permalink
Revert Reland '[vm/ffi] Implement FFI callbacks on AOT for ELF and As…
Browse files Browse the repository at this point in the history
…m snapshots (excl. blobs).' as it breaks flutter profile execution on ios 32-bit platform.

Fixes flutter/flutter#40114

Change-Id: If8d71e9c19c2e794d29f7ecbacb87457890a2fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116883
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
  • Loading branch information
aam authored and commit-bot@chromium.org committed Sep 12, 2019
1 parent 1d01d91 commit 0c481a1
Show file tree
Hide file tree
Showing 58 changed files with 361 additions and 2,119 deletions.
16 changes: 6 additions & 10 deletions pkg/front_end/lib/src/api_unstable/vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,19 @@ export '../fasta/fasta_codes.dart'
show
LocatedMessage,
messageBytecodeLimitExceededTooManyArguments,
messageFfiExceptionalReturnNull,
messageFfiExpectedConstant,
noLength,
templateFfiDartTypeMismatch,
templateFfiExpectedExceptionalReturn,
templateFfiExpectedNoExceptionalReturn,
templateFfiExtendsOrImplementsSealedClass,
templateFfiFieldAnnotation,
templateFfiFieldInitializer,
templateFfiFieldNoAnnotation,
templateFfiNotStatic,
templateFfiStructGeneric,
templateFfiTypeInvalid,
templateFfiTypeMismatch,
templateFfiTypeUnsized,
templateFfiWrongStructInheritance,
templateIllegalRecursiveType;
templateFfiFieldInitializer,
templateIllegalRecursiveType,
templateFfiDartTypeMismatch,
templateFfiExtendsOrImplementsSealedClass,
templateFfiStructGeneric,
templateFfiWrongStructInheritance;

export '../fasta/hybrid_file_system.dart' show HybridFileSystem;

Expand Down
87 changes: 6 additions & 81 deletions pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3754,81 +3754,6 @@ Message _withArgumentsFfiDartTypeMismatch(DartType _type, DartType _type2) {
arguments: {'type': _type, 'type2': _type2});
}

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFfiExceptionalReturnNull = messageFfiExceptionalReturnNull;

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageFfiExceptionalReturnNull = const MessageCode(
"FfiExceptionalReturnNull",
message: r"""Exceptional return value must not be null.""");

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFfiExpectedConstant = messageFfiExpectedConstant;

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageFfiExpectedConstant = const MessageCode(
"FfiExpectedConstant",
message: r"""Exceptional return value must be a constant.""");

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
DartType
_type)> templateFfiExpectedExceptionalReturn = const Template<
Message Function(DartType _type)>(
messageTemplate:
r"""Expected an exceptional return value for a native callback returning '#type'.""",
withArguments: _withArgumentsFfiExpectedExceptionalReturn);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(DartType _type)> codeFfiExpectedExceptionalReturn =
const Code<Message Function(DartType _type)>(
"FfiExpectedExceptionalReturn",
templateFfiExpectedExceptionalReturn,
);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsFfiExpectedExceptionalReturn(DartType _type) {
TypeLabeler labeler = new TypeLabeler();
List<Object> typeParts = labeler.labelType(_type);
String type = typeParts.join();
return new Message(codeFfiExpectedExceptionalReturn,
message:
"""Expected an exceptional return value for a native callback returning '${type}'.""" +
labeler.originMessages,
arguments: {'type': _type});
}

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
DartType
_type)> templateFfiExpectedNoExceptionalReturn = const Template<
Message Function(DartType _type)>(
messageTemplate:
r"""Exceptional return value cannot be provided for a native callback returning '#type'.""",
withArguments: _withArgumentsFfiExpectedNoExceptionalReturn);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(DartType _type)>
codeFfiExpectedNoExceptionalReturn =
const Code<Message Function(DartType _type)>(
"FfiExpectedNoExceptionalReturn",
templateFfiExpectedNoExceptionalReturn,
);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsFfiExpectedNoExceptionalReturn(DartType _type) {
TypeLabeler labeler = new TypeLabeler();
List<Object> typeParts = labeler.labelType(_type);
String type = typeParts.join();
return new Message(codeFfiExpectedNoExceptionalReturn,
message:
"""Exceptional return value cannot be provided for a native callback returning '${type}'.""" +
labeler.originMessages,
arguments: {'type': _type});
}

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateFfiExtendsOrImplementsSealedClass =
Expand Down Expand Up @@ -3859,7 +3784,7 @@ const Template<
Message Function(String name)> templateFfiFieldAnnotation = const Template<
Message Function(String name)>(
messageTemplate:
r"""Field '#name' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs cannot have regular Dart fields.""",
r"""Field '#name' requires exactly one annotation to declare its C++ type, which cannot be Void. dart:ffi Structs cannot have regular Dart fields.""",
withArguments: _withArgumentsFfiFieldAnnotation);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Expand All @@ -3875,7 +3800,7 @@ Message _withArgumentsFfiFieldAnnotation(String name) {
name = demangleMixinApplicationName(name);
return new Message(codeFfiFieldAnnotation,
message:
"""Field '${name}' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs cannot have regular Dart fields.""",
"""Field '${name}' requires exactly one annotation to declare its C++ type, which cannot be Void. dart:ffi Structs cannot have regular Dart fields.""",
arguments: {'name': name});
}

Expand Down Expand Up @@ -3911,7 +3836,7 @@ const Template<
name)> templateFfiFieldNoAnnotation = const Template<
Message Function(String name)>(
messageTemplate:
r"""Field '#name' requires no annotation to declare its native type, it is a Pointer which is represented by the same type in Dart and native code.""",
r"""Field '#name' requires no annotation to declare its C++ type, it is a Pointer which is represented by the same type in Dart and C++.""",
withArguments: _withArgumentsFfiFieldNoAnnotation);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Expand All @@ -3927,7 +3852,7 @@ Message _withArgumentsFfiFieldNoAnnotation(String name) {
name = demangleMixinApplicationName(name);
return new Message(codeFfiFieldNoAnnotation,
message:
"""Field '${name}' requires no annotation to declare its native type, it is a Pointer which is represented by the same type in Dart and native code.""",
"""Field '${name}' requires no annotation to declare its C++ type, it is a Pointer which is represented by the same type in Dart and C++.""",
arguments: {'name': name});
}

Expand All @@ -3936,7 +3861,7 @@ const Template<
Message Function(String name)> templateFfiNotStatic = const Template<
Message Function(String name)>(
messageTemplate:
r"""#name expects a static function as parameter. dart:ffi only supports calling static Dart functions from native code.""",
r"""#name expects a static function as parameter. dart:ffi only supports calling static Dart functions from c.""",
withArguments: _withArgumentsFfiNotStatic);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Expand All @@ -3952,7 +3877,7 @@ Message _withArgumentsFfiNotStatic(String name) {
name = demangleMixinApplicationName(name);
return new Message(codeFfiNotStatic,
message:
"""${name} expects a static function as parameter. dart:ffi only supports calling static Dart functions from native code.""",
"""${name} expects a static function as parameter. dart:ffi only supports calling static Dart functions from c.""",
arguments: {'name': name});
}

Expand Down
4 changes: 0 additions & 4 deletions pkg/front_end/messages.status
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,6 @@ FfiDartTypeMismatch/analyzerCode: Fail
FfiExtendsOrImplementsSealedClass/analyzerCode: Fail
FfiStructGeneric/analyzerCode: Fail
FfiWrongStructInheritance/analyzerCode: Fail
FfiExpectedExceptionalReturn/analyzerCode: Fail
FfiExpectedNoExceptionalReturn/analyzerCode: Fail
FfiExpectedConstant/analyzerCode: Fail
FfiExceptionalReturnNull/analyzerCode: Fail
FieldInitializedOutsideDeclaringClass/part_wrapped_script1: Fail
FieldInitializedOutsideDeclaringClass/script1: Fail
FieldInitializerOutsideConstructor/part_wrapped_script1: Fail
Expand Down
26 changes: 3 additions & 23 deletions pkg/front_end/messages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3495,17 +3495,17 @@ FfiTypeUnsized:

FfiFieldAnnotation:
# Used by dart:ffi
template: "Field '#name' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs cannot have regular Dart fields."
template: "Field '#name' requires exactly one annotation to declare its C++ type, which cannot be Void. dart:ffi Structs cannot have regular Dart fields."
external: test/ffi_test.dart

FfiFieldNoAnnotation:
# Used by dart:ffi
template: "Field '#name' requires no annotation to declare its native type, it is a Pointer which is represented by the same type in Dart and native code."
template: "Field '#name' requires no annotation to declare its C++ type, it is a Pointer which is represented by the same type in Dart and C++."
external: test/ffi_test.dart

FfiNotStatic:
# Used by dart:ffi
template: "#name expects a static function as parameter. dart:ffi only supports calling static Dart functions from native code."
template: "#name expects a static function as parameter. dart:ffi only supports calling static Dart functions from c."
external: test/ffi_test.dart

FfiFieldInitializer:
Expand Down Expand Up @@ -3533,26 +3533,6 @@ FfiDartTypeMismatch:
template: "Expected '#type' to be a subtype of '#type2'."
external: test/ffi_test.dart

FfiExpectedExceptionalReturn:
# Used by dart:ffi
template: "Expected an exceptional return value for a native callback returning '#type'."
external: test/ffi_test.dart

FfiExpectedNoExceptionalReturn:
# Used by dart:ffi
template: "Exceptional return value cannot be provided for a native callback returning '#type'."
external: test/ffi_test.dart

FfiExpectedConstant:
# Used by dart:ffi
template: "Exceptional return value must be a constant."
external: test/ffi_test.dart

FfiExceptionalReturnNull:
# Used by dart:ffi
template: "Exceptional return value must not be null."
external: test/ffi_test.dart

SpreadTypeMismatch:
template: "Unexpected type '#type' of a spread. Expected 'dynamic' or an Iterable."
script:
Expand Down
1 change: 0 additions & 1 deletion pkg/front_end/test/spell_checking_list_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,6 @@ examples
exceeded
except
exception
exceptional
exceptions
exclamation
exclude
Expand Down
6 changes: 0 additions & 6 deletions pkg/vm/lib/transformations/ffi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ class FfiTransformer extends Transformer {
final Constructor structFromPointer;
final Procedure libraryLookupMethod;
final Procedure abiMethod;
final Procedure pointerFromFunctionProcedure;
final Procedure nativeCallbackFunctionProcedure;

/// Classes corresponding to [NativeType], indexed by [NativeType].
final List<Class> nativeTypesClasses;
Expand Down Expand Up @@ -222,10 +220,6 @@ class FfiTransformer extends Transformer {
libraryLookupMethod =
index.getMember('dart:ffi', 'DynamicLibrary', 'lookup'),
abiMethod = index.getTopLevelMember('dart:ffi', '_abi'),
pointerFromFunctionProcedure =
index.getTopLevelMember('dart:ffi', '_pointerFromFunction'),
nativeCallbackFunctionProcedure =
index.getTopLevelMember('dart:ffi', '_nativeCallbackFunction'),
nativeTypesClasses = nativeTypeClassNames
.map((name) => index.getClass('dart:ffi', name))
.toList();
Expand Down

0 comments on commit 0c481a1

Please sign in to comment.