Skip to content

Commit dd59b19

Browse files
aamcommit-bot@chromium.org
authored andcommitted
Revert 52cace8 as it breaks flutter tests on android nexus 5x.
This reverts 'Reland "[vm/ffi] Support structs on 32bit architectures"' 52cace8 reviewed on https://dart-review.googlesource.com/c/sdk/+/108818, reverts FfiStruct part of https://dart-review.googlesource.com/c/sdk/+/108724. ``` runtime/vm/compiler/ffi.cc:63:1: error: static_assert failed "FFI transformation alignment" static_assert(alignof(double) == 4, "FFI transformation alignment"); ^ ~~~~~~~~~~~~~~~~~~~~ runtime/vm/compiler/ffi.cc:64:1: error: static_assert failed "FFI transformation alignment" static_assert(alignof(uint64_t) == 4, "FFI transformation alignment"); ^ ~~~~~~~~~~~~~~~~~~ ```` Change-Id: I0c3bf985f68b2184261e8999320f8ee89fe3f896 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110362 Commit-Queue: Alexander Aprelev <[email protected]> Reviewed-by: Siva Annamalai <[email protected]>
1 parent 4cba234 commit dd59b19

File tree

17 files changed

+173
-317
lines changed

17 files changed

+173
-317
lines changed

pkg/vm/lib/transformations/ffi.dart

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -86,74 +86,6 @@ const List<int> nativeTypeSizes = [
8686
UNKNOWN, // Struct
8787
];
8888

89-
/// The struct layout in various ABIs.
90-
///
91-
/// ABIs differ per architectures and with different compilers.
92-
/// We pick the default struct layout based on the architecture and OS.
93-
///
94-
/// Compilers _can_ deviate from the default layout, but this prevents
95-
/// executables from making system calls. So this seems rather uncommon.
96-
///
97-
/// In the future, we might support custom struct layouts. For more info see
98-
/// https://github.com/dart-lang/sdk/issues/35768.
99-
enum Abi {
100-
/// Layout in all 64bit ABIs (x64 and arm64).
101-
wordSize64,
102-
103-
/// Layout in System V ABI for x386 (ia32 on Linux) and in iOS Arm 32 bit.
104-
wordSize32Align32,
105-
106-
/// Layout in both the Arm 32 bit ABI and the Windows ia32 ABI.
107-
wordSize32Align64,
108-
}
109-
110-
/// WORD_SIZE in bytes.
111-
const wordSize = <Abi, int>{
112-
Abi.wordSize64: 8,
113-
Abi.wordSize32Align32: 4,
114-
Abi.wordSize32Align64: 4,
115-
};
116-
117-
/// Elements that are not aligned to their size.
118-
///
119-
/// Has an entry for all Abis. Empty entries document that every native
120-
/// type is aligned to it's own size in this ABI.
121-
///
122-
/// See runtime/vm/compiler/ffi.cc for asserts in the VM that verify these
123-
/// alignments.
124-
///
125-
/// TODO(37470): Add uncommon primitive data types when we want to support them.
126-
const nonSizeAlignment = <Abi, Map<NativeType, int>>{
127-
Abi.wordSize64: {},
128-
129-
// x86 System V ABI:
130-
// > uint64_t | size 8 | alignment 4
131-
// > double | size 8 | alignment 4
132-
// https://github.com/hjl-tools/x86-psABI/wiki/intel386-psABI-1.1.pdf page 8.
133-
//
134-
// iOS 32 bit alignment:
135-
// https://developer.apple.com/documentation/uikit/app_and_environment/updating_your_app_from_32-bit_to_64-bit_architecture/updating_data_structures
136-
Abi.wordSize32Align32: {NativeType.kDouble: 4, NativeType.kInt64: 4},
137-
138-
// The default for MSVC x86:
139-
// > The alignment-requirement for all data except structures, unions, and
140-
// > arrays is either the size of the object or the current packing size
141-
// > (specified with either /Zp or the pack pragma, whichever is less).
142-
// https://docs.microsoft.com/en-us/cpp/c-language/padding-and-alignment-of-structure-members?view=vs-2019
143-
//
144-
// GCC _can_ compile on Linux to this alignment with -malign-double, but does
145-
// not do so by default:
146-
// > Warning: if you use the -malign-double switch, structures containing the
147-
// > above types are aligned differently than the published application
148-
// > binary interface specifications for the x86-32 and are not binary
149-
// > compatible with structures in code compiled without that switch.
150-
// https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
151-
//
152-
// Arm always requires 8 byte alignment for 8 byte values:
153-
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf 4.1 Fundamental Data Types
154-
Abi.wordSize32Align64: {},
155-
};
156-
15789
/// [FfiTransformer] contains logic which is shared between
15890
/// _FfiUseSiteTransformer and _FfiDefinitionTransformer.
15991
class FfiTransformer extends Transformer {
@@ -166,7 +98,6 @@ class FfiTransformer extends Transformer {
16698
final Class intClass;
16799
final Class doubleClass;
168100
final Constructor pragmaConstructor;
169-
final Procedure listElementAt;
170101

171102
final Library ffiLibrary;
172103
final Class nativeFunctionClass;
@@ -183,7 +114,6 @@ class FfiTransformer extends Transformer {
183114
final Field addressOfField;
184115
final Constructor structFromPointer;
185116
final Procedure libraryLookupMethod;
186-
final Procedure abiMethod;
187117

188118
/// Classes corresponding to [NativeType], indexed by [NativeType].
189119
final List<Class> nativeTypesClasses;
@@ -194,7 +124,6 @@ class FfiTransformer extends Transformer {
194124
intClass = coreTypes.intClass,
195125
doubleClass = coreTypes.doubleClass,
196126
pragmaConstructor = coreTypes.pragmaConstructor,
197-
listElementAt = coreTypes.index.getMember('dart:core', 'List', '[]'),
198127
ffiLibrary = index.getLibrary('dart:ffi'),
199128
nativeFunctionClass = index.getClass('dart:ffi', 'NativeFunction'),
200129
pointerClass = index.getClass('dart:ffi', 'Pointer'),
@@ -215,7 +144,6 @@ class FfiTransformer extends Transformer {
215144
index.getMember('dart:ffi', 'Pointer', 'fromFunction'),
216145
libraryLookupMethod =
217146
index.getMember('dart:ffi', 'DynamicLibrary', 'lookup'),
218-
abiMethod = index.getTopLevelMember('dart:ffi', '_abi'),
219147
nativeTypesClasses = nativeTypeClassNames
220148
.map((name) => index.getClass('dart:ffi', name))
221149
.toList();

0 commit comments

Comments
 (0)