Skip to content

Commit 5c7f7be

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
[vm/ffi] Remove entry-point from Structs #sizeOf
Removes the entry-point on the `#sizeOf` field of `Struct` subtypes, because we are no longer using it in the runtime. Does not remove the entry-point from the constructor yet, because FFI trampolines can instantiate these objects. Updated the TODOs to reflect this. Bug: #38721 TEST=tests/ffi(_2)/* in precompiled mode. Change-Id: If3889e782b8fe34ef1c34cf8af83da041b4d2ef5 Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185540 Reviewed-by: Aske Simon Christensen <[email protected]> Commit-Queue: Daco Harkes <[email protected]>
1 parent 9f68048 commit 5c7f7be

10 files changed

+140
-157
lines changed

pkg/front_end/testcases/general_nnbd_opt_out/ffi_sample.dart.weak.transformed.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ import "dart:ffi" as ffi;
66
import "dart:ffi";
77
import "package:ffi/ffi.dart";
88

9-
@#C3
10-
@#C9
9+
@#C6
1110
class Coordinate extends ffi::Struct {
12-
@#C3
13-
static final field core::int* #sizeOf = (#C12).{core::List::[]}(ffi::_abi());
14-
@#C3
11+
static final field core::int* #sizeOf = (#C9).{core::List::[]}(ffi::_abi());
12+
@#C12
1513
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1614
: super ffi::Struct::_fromPointer(#pointer)
1715
;
@@ -49,18 +47,18 @@ class Coordinate extends ffi::Struct {
4947
static method main() → dynamic {}
5048

5149
constants {
52-
#C1 = "vm:entry-point"
53-
#C2 = null
54-
#C3 = core::pragma {name:#C1, options:#C2}
55-
#C4 = "vm:ffi:struct-fields"
56-
#C5 = TypeLiteralConstant(ffi::Double)
57-
#C6 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
58-
#C7 = <core::Type>[#C5, #C5, #C6]
59-
#C8 = ffi::_FfiStructLayout {fieldTypes:#C7}
60-
#C9 = core::pragma {name:#C4, options:#C8}
61-
#C10 = 24
62-
#C11 = 20
63-
#C12 = <core::int*>[#C10, #C11, #C10]
50+
#C1 = "vm:ffi:struct-fields"
51+
#C2 = TypeLiteralConstant(ffi::Double)
52+
#C3 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
53+
#C4 = <core::Type>[#C2, #C2, #C3]
54+
#C5 = ffi::_FfiStructLayout {fieldTypes:#C4}
55+
#C6 = core::pragma {name:#C1, options:#C5}
56+
#C7 = 24
57+
#C8 = 20
58+
#C9 = <core::int*>[#C7, #C8, #C7]
59+
#C10 = "vm:entry-point"
60+
#C11 = null
61+
#C12 = core::pragma {name:#C10, options:#C11}
6462
#C13 = 0
6563
#C14 = <core::int*>[#C13, #C13, #C13]
6664
#C15 = 8

pkg/front_end/testcases/incremental_initialize_from_dill/ffi_01.yaml.world.1.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ library from "org-dartlang-test:///lib.dart" as lib {
33

44
import "dart:ffi";
55

6-
@#C3
7-
@#C9
6+
@#C6
87
class Coordinate extends dart.ffi::Struct {
9-
@#C3
10-
static final field dart.core::int* #sizeOf = (#C12).{dart.core::List::[]}(dart.ffi::_abi());
11-
@#C3
8+
static final field dart.core::int* #sizeOf = (#C9).{dart.core::List::[]}(dart.ffi::_abi());
9+
@#C12
1210
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1311
: super dart.ffi::Struct::_fromPointer(#pointer)
1412
;
@@ -52,18 +50,18 @@ library from "org-dartlang-test:///main.dart" as main {
5250
}
5351
}
5452
constants {
55-
#C1 = "vm:entry-point"
56-
#C2 = null
57-
#C3 = dart.core::pragma {name:#C1, options:#C2}
58-
#C4 = "vm:ffi:struct-fields"
59-
#C5 = TypeLiteralConstant(dart.ffi::Double)
60-
#C6 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
61-
#C7 = <dart.core::Type>[#C5, #C5, #C6]
62-
#C8 = dart.ffi::_FfiStructLayout {fieldTypes:#C7}
63-
#C9 = dart.core::pragma {name:#C4, options:#C8}
64-
#C10 = 24
65-
#C11 = 20
66-
#C12 = <dart.core::int*>[#C10, #C11, #C10]
53+
#C1 = "vm:ffi:struct-fields"
54+
#C2 = TypeLiteralConstant(dart.ffi::Double)
55+
#C3 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
56+
#C4 = <dart.core::Type>[#C2, #C2, #C3]
57+
#C5 = dart.ffi::_FfiStructLayout {fieldTypes:#C4}
58+
#C6 = dart.core::pragma {name:#C1, options:#C5}
59+
#C7 = 24
60+
#C8 = 20
61+
#C9 = <dart.core::int*>[#C7, #C8, #C7]
62+
#C10 = "vm:entry-point"
63+
#C11 = null
64+
#C12 = dart.core::pragma {name:#C10, options:#C11}
6765
#C13 = 0
6866
#C14 = <dart.core::int*>[#C13, #C13, #C13]
6967
#C15 = 8

pkg/front_end/testcases/incremental_initialize_from_dill/ffi_01.yaml.world.2.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ library from "org-dartlang-test:///lib.dart" as lib {
33

44
import "dart:ffi";
55

6-
@#C3
7-
@#C9
6+
@#C6
87
class Coordinate extends dart.ffi::Struct {
9-
@#C3
10-
static final field dart.core::int* #sizeOf = (#C12).{dart.core::List::[]}(dart.ffi::_abi());
11-
@#C3
8+
static final field dart.core::int* #sizeOf = (#C9).{dart.core::List::[]}(dart.ffi::_abi());
9+
@#C12
1210
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1311
: super dart.ffi::Struct::_fromPointer(#pointer)
1412
;
@@ -56,18 +54,18 @@ library from "org-dartlang-test:///main.dart" as main {
5654
}
5755
}
5856
constants {
59-
#C1 = "vm:entry-point"
60-
#C2 = null
61-
#C3 = dart.core::pragma {name:#C1, options:#C2}
62-
#C4 = "vm:ffi:struct-fields"
63-
#C5 = TypeLiteralConstant(dart.ffi::Double)
64-
#C6 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
65-
#C7 = <dart.core::Type>[#C5, #C5, #C6]
66-
#C8 = dart.ffi::_FfiStructLayout {fieldTypes:#C7}
67-
#C9 = dart.core::pragma {name:#C4, options:#C8}
68-
#C10 = 24
69-
#C11 = 20
70-
#C12 = <dart.core::int*>[#C10, #C11, #C10]
57+
#C1 = "vm:ffi:struct-fields"
58+
#C2 = TypeLiteralConstant(dart.ffi::Double)
59+
#C3 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
60+
#C4 = <dart.core::Type>[#C2, #C2, #C3]
61+
#C5 = dart.ffi::_FfiStructLayout {fieldTypes:#C4}
62+
#C6 = dart.core::pragma {name:#C1, options:#C5}
63+
#C7 = 24
64+
#C8 = 20
65+
#C9 = <dart.core::int*>[#C7, #C8, #C7]
66+
#C10 = "vm:entry-point"
67+
#C11 = null
68+
#C12 = dart.core::pragma {name:#C10, options:#C11}
7169
#C13 = 0
7270
#C14 = <dart.core::int*>[#C13, #C13, #C13]
7371
#C15 = 8

pkg/front_end/testcases/incremental_initialize_from_dill/ffi_02.yaml.world.1.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ library from "org-dartlang-test:///lib.dart" as lib {
33

44
import "dart:ffi";
55

6-
@#C3
7-
@#C9
6+
@#C6
87
class Coordinate extends dart.ffi::Struct {
9-
@#C3
10-
static final field dart.core::int* #sizeOf = (#C12).{dart.core::List::[]}(dart.ffi::_abi());
11-
@#C3
8+
static final field dart.core::int* #sizeOf = (#C9).{dart.core::List::[]}(dart.ffi::_abi());
9+
@#C12
1210
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1311
: super dart.ffi::Struct::_fromPointer(#pointer)
1412
;
@@ -53,18 +51,18 @@ library from "org-dartlang-test:///main.dart" as main {
5351
}
5452
}
5553
constants {
56-
#C1 = "vm:entry-point"
57-
#C2 = null
58-
#C3 = dart.core::pragma {name:#C1, options:#C2}
59-
#C4 = "vm:ffi:struct-fields"
60-
#C5 = TypeLiteralConstant(dart.ffi::Double)
61-
#C6 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
62-
#C7 = <dart.core::Type>[#C5, #C5, #C6]
63-
#C8 = dart.ffi::_FfiStructLayout {fieldTypes:#C7}
64-
#C9 = dart.core::pragma {name:#C4, options:#C8}
65-
#C10 = 24
66-
#C11 = 20
67-
#C12 = <dart.core::int*>[#C10, #C11, #C10]
54+
#C1 = "vm:ffi:struct-fields"
55+
#C2 = TypeLiteralConstant(dart.ffi::Double)
56+
#C3 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
57+
#C4 = <dart.core::Type>[#C2, #C2, #C3]
58+
#C5 = dart.ffi::_FfiStructLayout {fieldTypes:#C4}
59+
#C6 = dart.core::pragma {name:#C1, options:#C5}
60+
#C7 = 24
61+
#C8 = 20
62+
#C9 = <dart.core::int*>[#C7, #C8, #C7]
63+
#C10 = "vm:entry-point"
64+
#C11 = null
65+
#C12 = dart.core::pragma {name:#C10, options:#C11}
6866
#C13 = 0
6967
#C14 = <dart.core::int*>[#C13, #C13, #C13]
7068
#C15 = 8

pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_35.yaml.world.1.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ library from "org-dartlang-test:///lib.dart" as lib {
33

44
import "dart:ffi";
55

6-
@#C3
7-
@#C9
6+
@#C6
87
class Coordinate extends dart.ffi::Struct {
9-
@#C3
10-
static final field dart.core::int* #sizeOf = (#C12).{dart.core::List::[]}(dart.ffi::_abi());
11-
@#C3
8+
static final field dart.core::int* #sizeOf = (#C9).{dart.core::List::[]}(dart.ffi::_abi());
9+
@#C12
1210
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1311
: super dart.ffi::Struct::_fromPointer(#pointer)
1412
;
@@ -52,18 +50,18 @@ library from "org-dartlang-test:///main.dart" as main {
5250
}
5351
}
5452
constants {
55-
#C1 = "vm:entry-point"
56-
#C2 = null
57-
#C3 = dart.core::pragma {name:#C1, options:#C2}
58-
#C4 = "vm:ffi:struct-fields"
59-
#C5 = TypeLiteralConstant(dart.ffi::Double)
60-
#C6 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
61-
#C7 = <dart.core::Type>[#C5, #C5, #C6]
62-
#C8 = dart.ffi::_FfiStructLayout {fieldTypes:#C7}
63-
#C9 = dart.core::pragma {name:#C4, options:#C8}
64-
#C10 = 24
65-
#C11 = 20
66-
#C12 = <dart.core::int*>[#C10, #C11, #C10]
53+
#C1 = "vm:ffi:struct-fields"
54+
#C2 = TypeLiteralConstant(dart.ffi::Double)
55+
#C3 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
56+
#C4 = <dart.core::Type>[#C2, #C2, #C3]
57+
#C5 = dart.ffi::_FfiStructLayout {fieldTypes:#C4}
58+
#C6 = dart.core::pragma {name:#C1, options:#C5}
59+
#C7 = 24
60+
#C8 = 20
61+
#C9 = <dart.core::int*>[#C7, #C8, #C7]
62+
#C10 = "vm:entry-point"
63+
#C11 = null
64+
#C12 = dart.core::pragma {name:#C10, options:#C11}
6765
#C13 = 0
6866
#C14 = <dart.core::int*>[#C13, #C13, #C13]
6967
#C15 = 8

pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_35.yaml.world.2.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ library from "org-dartlang-test:///lib.dart" as lib {
33

44
import "dart:ffi";
55

6-
@#C3
7-
@#C9
6+
@#C6
87
class Coordinate extends dart.ffi::Struct {
9-
@#C3
10-
static final field dart.core::int* #sizeOf = (#C12).{dart.core::List::[]}(dart.ffi::_abi());
11-
@#C3
8+
static final field dart.core::int* #sizeOf = (#C9).{dart.core::List::[]}(dart.ffi::_abi());
9+
@#C12
1210
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1311
: super dart.ffi::Struct::_fromPointer(#pointer)
1412
;
@@ -53,18 +51,18 @@ library from "org-dartlang-test:///main.dart" as main {
5351
}
5452
}
5553
constants {
56-
#C1 = "vm:entry-point"
57-
#C2 = null
58-
#C3 = dart.core::pragma {name:#C1, options:#C2}
59-
#C4 = "vm:ffi:struct-fields"
60-
#C5 = TypeLiteralConstant(dart.ffi::Double)
61-
#C6 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
62-
#C7 = <dart.core::Type>[#C5, #C5, #C6]
63-
#C8 = dart.ffi::_FfiStructLayout {fieldTypes:#C7}
64-
#C9 = dart.core::pragma {name:#C4, options:#C8}
65-
#C10 = 24
66-
#C11 = 20
67-
#C12 = <dart.core::int*>[#C10, #C11, #C10]
54+
#C1 = "vm:ffi:struct-fields"
55+
#C2 = TypeLiteralConstant(dart.ffi::Double)
56+
#C3 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
57+
#C4 = <dart.core::Type>[#C2, #C2, #C3]
58+
#C5 = dart.ffi::_FfiStructLayout {fieldTypes:#C4}
59+
#C6 = dart.core::pragma {name:#C1, options:#C5}
60+
#C7 = 24
61+
#C8 = 20
62+
#C9 = <dart.core::int*>[#C7, #C8, #C7]
63+
#C10 = "vm:entry-point"
64+
#C11 = null
65+
#C12 = dart.core::pragma {name:#C10, options:#C11}
6866
#C13 = 0
6967
#C14 = <dart.core::int*>[#C13, #C13, #C13]
7068
#C15 = 8

pkg/front_end/testcases/incremental_initialize_from_dill/no_outline_change_35.yaml.world.3.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ library from "org-dartlang-test:///lib.dart" as lib {
33

44
import "dart:ffi";
55

6-
@#C3
7-
@#C9
6+
@#C6
87
class Coordinate extends dart.ffi::Struct {
9-
@#C3
10-
static final field dart.core::int* #sizeOf = (#C12).{dart.core::List::[]}(dart.ffi::_abi());
11-
@#C3
8+
static final field dart.core::int* #sizeOf = (#C9).{dart.core::List::[]}(dart.ffi::_abi());
9+
@#C12
1210
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1311
: super dart.ffi::Struct::_fromPointer(#pointer)
1412
;
@@ -54,18 +52,18 @@ library from "org-dartlang-test:///main.dart" as main {
5452
}
5553
}
5654
constants {
57-
#C1 = "vm:entry-point"
58-
#C2 = null
59-
#C3 = dart.core::pragma {name:#C1, options:#C2}
60-
#C4 = "vm:ffi:struct-fields"
61-
#C5 = TypeLiteralConstant(dart.ffi::Double)
62-
#C6 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
63-
#C7 = <dart.core::Type>[#C5, #C5, #C6]
64-
#C8 = dart.ffi::_FfiStructLayout {fieldTypes:#C7}
65-
#C9 = dart.core::pragma {name:#C4, options:#C8}
66-
#C10 = 24
67-
#C11 = 20
68-
#C12 = <dart.core::int*>[#C10, #C11, #C10]
55+
#C1 = "vm:ffi:struct-fields"
56+
#C2 = TypeLiteralConstant(dart.ffi::Double)
57+
#C3 = TypeLiteralConstant(dart.ffi::Pointer<dart.ffi::NativeType>)
58+
#C4 = <dart.core::Type>[#C2, #C2, #C3]
59+
#C5 = dart.ffi::_FfiStructLayout {fieldTypes:#C4}
60+
#C6 = dart.core::pragma {name:#C1, options:#C5}
61+
#C7 = 24
62+
#C8 = 20
63+
#C9 = <dart.core::int*>[#C7, #C8, #C7]
64+
#C10 = "vm:entry-point"
65+
#C11 = null
66+
#C12 = dart.core::pragma {name:#C10, options:#C11}
6967
#C13 = 0
7068
#C14 = <dart.core::int*>[#C13, #C13, #C13]
7169
#C15 = 8

pkg/front_end/testcases/nnbd/ffi_sample.dart.strong.transformed.expect

+15-17
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ import "dart:ffi" as ffi;
66
import "dart:ffi";
77
import "package:ffi/ffi.dart";
88

9-
@#C3
10-
@#C9
9+
@#C6
1110
class Coordinate extends ffi::Struct {
12-
@#C3
13-
static final field core::int* #sizeOf = (#C12).{core::List::[]}(ffi::_abi())/*isLegacy*/;
14-
@#C3
11+
static final field core::int* #sizeOf = (#C9).{core::List::[]}(ffi::_abi())/*isLegacy*/;
12+
@#C12
1513
constructor #fromTypedDataBase(dynamic #pointer) → dynamic
1614
: super ffi::Struct::_fromPointer(#pointer)
1715
;
@@ -42,18 +40,18 @@ class Coordinate extends ffi::Struct {
4240
static method main() → dynamic {}
4341

4442
constants {
45-
#C1 = "vm:entry-point"
46-
#C2 = null
47-
#C3 = core::pragma {name:#C1, options:#C2}
48-
#C4 = "vm:ffi:struct-fields"
49-
#C5 = TypeLiteralConstant(ffi::Double)
50-
#C6 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
51-
#C7 = <core::Type>[#C5, #C5, #C6]
52-
#C8 = ffi::_FfiStructLayout {fieldTypes:#C7}
53-
#C9 = core::pragma {name:#C4, options:#C8}
54-
#C10 = 24
55-
#C11 = 20
56-
#C12 = <core::int*>[#C10, #C11, #C10]
43+
#C1 = "vm:ffi:struct-fields"
44+
#C2 = TypeLiteralConstant(ffi::Double)
45+
#C3 = TypeLiteralConstant(ffi::Pointer<ffi::NativeType>)
46+
#C4 = <core::Type>[#C2, #C2, #C3]
47+
#C5 = ffi::_FfiStructLayout {fieldTypes:#C4}
48+
#C6 = core::pragma {name:#C1, options:#C5}
49+
#C7 = 24
50+
#C8 = 20
51+
#C9 = <core::int*>[#C7, #C8, #C7]
52+
#C10 = "vm:entry-point"
53+
#C11 = null
54+
#C12 = core::pragma {name:#C10, options:#C11}
5755
#C13 = ffi::Double {}
5856
#C14 = 0
5957
#C15 = <core::int*>[#C14, #C14, #C14]

0 commit comments

Comments
 (0)