Skip to content

Commit aa2a6f8

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
[vm/ffi] Change type of typedDataBase parameter for load and store
So that it can be invoked from `CArray` which has a backing store that is either TypedData or Pointer. Bug: #35763 TEST=tests/ffi(_2)/* Change-Id: I30bb0c1e848f2ac4f47919009106d5428ed66453 Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183683 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Aske Simon Christensen <[email protected]>
1 parent b60e0aa commit aa2a6f8

File tree

2 files changed

+55
-49
lines changed

2 files changed

+55
-49
lines changed

runtime/vm/compiler/recognized_methods_list.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -166,30 +166,30 @@ namespace dart {
166166
V(::, _abi, FfiAbi, 0x7c4ab775) \
167167
V(::, _asFunctionInternal, FfiAsFunctionInternal, 0xbbcb235a) \
168168
V(::, _nativeCallbackFunction, FfiNativeCallbackFunction, 0x3ff5ae9c) \
169-
V(::, _loadInt8, FfiLoadInt8, 0xa54bed8c) \
170-
V(::, _loadInt16, FfiLoadInt16, 0x828b3ee3) \
171-
V(::, _loadInt32, FfiLoadInt32, 0x84694d79) \
172-
V(::, _loadInt64, FfiLoadInt64, 0x7536cd59) \
173-
V(::, _loadUint8, FfiLoadUint8, 0x77952a87) \
174-
V(::, _loadUint16, FfiLoadUint16, 0xa31d6aa0) \
175-
V(::, _loadUint32, FfiLoadUint32, 0x8cb59e0b) \
176-
V(::, _loadUint64, FfiLoadUint64, 0x9b4d0b82) \
177-
V(::, _loadIntPtr, FfiLoadIntPtr, 0x8220c1f4) \
178-
V(::, _loadFloat, FfiLoadFloat, 0x8f209213) \
179-
V(::, _loadDouble, FfiLoadDouble, 0x8d53d3cf) \
180-
V(::, _loadPointer, FfiLoadPointer, 0xc50e1486) \
181-
V(::, _storeInt8, FfiStoreInt8, 0x000b2742) \
182-
V(::, _storeInt16, FfiStoreInt16, 0xf9086b68) \
183-
V(::, _storeInt32, FfiStoreInt32, 0x1ca0a493) \
184-
V(::, _storeInt64, FfiStoreInt64, 0x128e85b0) \
185-
V(::, _storeUint8, FfiStoreUint8, 0x26284b2c) \
186-
V(::, _storeUint16, FfiStoreUint16, 0x03b82314) \
187-
V(::, _storeUint32, FfiStoreUint32, 0x069260fb) \
188-
V(::, _storeUint64, FfiStoreUint64, 0x0393aa6f) \
189-
V(::, _storeIntPtr, FfiStoreIntPtr, 0x28bcdede) \
190-
V(::, _storeFloat, FfiStoreFloat, 0x853f68b4) \
191-
V(::, _storeDouble, FfiStoreDouble, 0x6354049a) \
192-
V(::, _storePointer, FfiStorePointer, 0x0cfd005b) \
169+
V(::, _loadInt8, FfiLoadInt8, 0x0f04dfd6) \
170+
V(::, _loadInt16, FfiLoadInt16, 0xec44312d) \
171+
V(::, _loadInt32, FfiLoadInt32, 0xee223fc3) \
172+
V(::, _loadInt64, FfiLoadInt64, 0xdeefbfa3) \
173+
V(::, _loadUint8, FfiLoadUint8, 0xe14e1cd1) \
174+
V(::, _loadUint16, FfiLoadUint16, 0x0cd65cea) \
175+
V(::, _loadUint32, FfiLoadUint32, 0xf66e9055) \
176+
V(::, _loadUint64, FfiLoadUint64, 0x0505fdcc) \
177+
V(::, _loadIntPtr, FfiLoadIntPtr, 0xebd9b43e) \
178+
V(::, _loadFloat, FfiLoadFloat, 0xf8d9845d) \
179+
V(::, _loadDouble, FfiLoadDouble, 0xf70cc619) \
180+
V(::, _loadPointer, FfiLoadPointer, 0x4e79d0fc) \
181+
V(::, _storeInt8, FfiStoreInt8, 0xdf50af0c) \
182+
V(::, _storeInt16, FfiStoreInt16, 0xd84df332) \
183+
V(::, _storeInt32, FfiStoreInt32, 0xfbe62c5d) \
184+
V(::, _storeInt64, FfiStoreInt64, 0xf1d40d7a) \
185+
V(::, _storeUint8, FfiStoreUint8, 0x056dd2f6) \
186+
V(::, _storeUint16, FfiStoreUint16, 0xe2fdaade) \
187+
V(::, _storeUint32, FfiStoreUint32, 0xe5d7e8c5) \
188+
V(::, _storeUint64, FfiStoreUint64, 0xe2d93239) \
189+
V(::, _storeIntPtr, FfiStoreIntPtr, 0x080266a8) \
190+
V(::, _storeFloat, FfiStoreFloat, 0x6484f07e) \
191+
V(::, _storeDouble, FfiStoreDouble, 0x42998c64) \
192+
V(::, _storePointer, FfiStorePointer, 0xea6b7751) \
193193
V(::, _fromAddress, FfiFromAddress, 0xfd8cb1cc) \
194194
V(Pointer, get:address, FfiGetAddress, 0x7cde87be) \
195195
V(::, reachabilityFence, ReachabilityFence, 0x619235c1) \

sdk/lib/_internal/vm/lib/ffi_patch.dart

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,89 +168,95 @@ void _memCopy(Object target, int targetOffsetInBytes, Object source,
168168
// and GCing new spaces takes a lot of the benchmark time. The next speedup is
169169
// getting rid of these allocations by inlining these functions.
170170
@pragma("vm:recognized", "other")
171-
int _loadInt8(Pointer pointer, int offsetInBytes) native "Ffi_loadInt8";
171+
int _loadInt8(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt8";
172172

173173
@pragma("vm:recognized", "other")
174-
int _loadInt16(Pointer pointer, int offsetInBytes) native "Ffi_loadInt16";
174+
int _loadInt16(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt16";
175175

176176
@pragma("vm:recognized", "other")
177-
int _loadInt32(Pointer pointer, int offsetInBytes) native "Ffi_loadInt32";
177+
int _loadInt32(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt32";
178178

179179
@pragma("vm:recognized", "other")
180-
int _loadInt64(Pointer pointer, int offsetInBytes) native "Ffi_loadInt64";
180+
int _loadInt64(Object typedDataBase, int offsetInBytes) native "Ffi_loadInt64";
181181

182182
@pragma("vm:recognized", "other")
183-
int _loadUint8(Pointer pointer, int offsetInBytes) native "Ffi_loadUint8";
183+
int _loadUint8(Object typedDataBase, int offsetInBytes) native "Ffi_loadUint8";
184184

185185
@pragma("vm:recognized", "other")
186-
int _loadUint16(Pointer pointer, int offsetInBytes) native "Ffi_loadUint16";
186+
int _loadUint16(Object typedDataBase, int offsetInBytes)
187+
native "Ffi_loadUint16";
187188

188189
@pragma("vm:recognized", "other")
189-
int _loadUint32(Pointer pointer, int offsetInBytes) native "Ffi_loadUint32";
190+
int _loadUint32(Object typedDataBase, int offsetInBytes)
191+
native "Ffi_loadUint32";
190192

191193
@pragma("vm:recognized", "other")
192-
int _loadUint64(Pointer pointer, int offsetInBytes) native "Ffi_loadUint64";
194+
int _loadUint64(Object typedDataBase, int offsetInBytes)
195+
native "Ffi_loadUint64";
193196

194197
@pragma("vm:recognized", "other")
195-
int _loadIntPtr(Pointer pointer, int offsetInBytes) native "Ffi_loadIntPtr";
198+
int _loadIntPtr(Object typedDataBase, int offsetInBytes)
199+
native "Ffi_loadIntPtr";
196200

197201
@pragma("vm:recognized", "other")
198-
double _loadFloat(Pointer pointer, int offsetInBytes) native "Ffi_loadFloat";
202+
double _loadFloat(Object typedDataBase, int offsetInBytes)
203+
native "Ffi_loadFloat";
199204

200205
@pragma("vm:recognized", "other")
201-
double _loadDouble(Pointer pointer, int offsetInBytes) native "Ffi_loadDouble";
206+
double _loadDouble(Object typedDataBase, int offsetInBytes)
207+
native "Ffi_loadDouble";
202208

203209
@pragma("vm:recognized", "other")
204210
Pointer<S> _loadPointer<S extends NativeType>(
205-
Pointer pointer, int offsetInBytes) native "Ffi_loadPointer";
211+
Object typedDataBase, int offsetInBytes) native "Ffi_loadPointer";
206212

207213
@pragma("vm:recognized", "other")
208-
void _storeInt8(Pointer pointer, int offsetInBytes, int value)
214+
void _storeInt8(Object typedDataBase, int offsetInBytes, int value)
209215
native "Ffi_storeInt8";
210216

211217
@pragma("vm:recognized", "other")
212-
void _storeInt16(Pointer pointer, int offsetInBytes, int value)
218+
void _storeInt16(Object typedDataBase, int offsetInBytes, int value)
213219
native "Ffi_storeInt16";
214220

215221
@pragma("vm:recognized", "other")
216-
void _storeInt32(Pointer pointer, int offsetInBytes, int value)
222+
void _storeInt32(Object typedDataBase, int offsetInBytes, int value)
217223
native "Ffi_storeInt32";
218224

219225
@pragma("vm:recognized", "other")
220-
void _storeInt64(Pointer pointer, int offsetInBytes, int value)
226+
void _storeInt64(Object typedDataBase, int offsetInBytes, int value)
221227
native "Ffi_storeInt64";
222228

223229
@pragma("vm:recognized", "other")
224-
void _storeUint8(Pointer pointer, int offsetInBytes, int value)
230+
void _storeUint8(Object typedDataBase, int offsetInBytes, int value)
225231
native "Ffi_storeUint8";
226232

227233
@pragma("vm:recognized", "other")
228-
void _storeUint16(Pointer pointer, int offsetInBytes, int value)
234+
void _storeUint16(Object typedDataBase, int offsetInBytes, int value)
229235
native "Ffi_storeUint16";
230236

231237
@pragma("vm:recognized", "other")
232-
void _storeUint32(Pointer pointer, int offsetInBytes, int value)
238+
void _storeUint32(Object typedDataBase, int offsetInBytes, int value)
233239
native "Ffi_storeUint32";
234240

235241
@pragma("vm:recognized", "other")
236-
void _storeUint64(Pointer pointer, int offsetInBytes, int value)
242+
void _storeUint64(Object typedDataBase, int offsetInBytes, int value)
237243
native "Ffi_storeUint64";
238244

239245
@pragma("vm:recognized", "other")
240-
void _storeIntPtr(Pointer pointer, int offsetInBytes, int value)
246+
void _storeIntPtr(Object typedDataBase, int offsetInBytes, int value)
241247
native "Ffi_storeIntPtr";
242248

243249
@pragma("vm:recognized", "other")
244-
void _storeFloat(Pointer pointer, int offsetInBytes, double value)
250+
void _storeFloat(Object typedDataBase, int offsetInBytes, double value)
245251
native "Ffi_storeFloat";
246252

247253
@pragma("vm:recognized", "other")
248-
void _storeDouble(Pointer pointer, int offsetInBytes, double value)
254+
void _storeDouble(Object typedDataBase, int offsetInBytes, double value)
249255
native "Ffi_storeDouble";
250256

251257
@pragma("vm:recognized", "other")
252-
void _storePointer<S extends NativeType>(Pointer pointer, int offsetInBytes,
253-
Pointer<S> value) native "Ffi_storePointer";
258+
void _storePointer<S extends NativeType>(Object typedDataBase,
259+
int offsetInBytes, Pointer<S> value) native "Ffi_storePointer";
254260

255261
Pointer<Int8> _elementAtInt8(Pointer<Int8> pointer, int index) =>
256262
Pointer.fromAddress(pointer.address + 1 * index);

0 commit comments

Comments
 (0)