You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I change pragma to @pragma('vm:entry-point', 'call'), I get the following error (both in AOT and Kernel mode):
ERROR: To retrieve the value of 'file:///usr/local/google/home/iinozemtsev/work/dart-sdk/sdk/samples/embedder/timer.dart::ticks (kind GetterFunction)' from native code, it must be annotated.
ERROR: See https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md
When I change pragma to @pragma('vm:entry-point', 'get'), then it works fine in Kernel mode, but in AOT mode it fails with the following error:
../../runtime/vm/dart_entry.cc: 145: error: expected: function.HasCode()
version=3.7.0-edge.193a852639ed45c9314d9e6f72f763338fba86e3 (main) (Thu Jan 16 13:45:19 2025 +0100) on "linux_x64"
pid=1218004, thread=1218004, isolate_group=file://out/DebugX64/timer_aot.snapshot(0x55597b637410), isolate=file://out/DebugX64/timer_aot.snapshot(0x55597b63ebe0)
os=linux, arch=x64, comp=no, sim=no
isolate_instructions=7f85cdb36f40, vm_instructions=7f85cdb2f000
fp=7ffe8fdb0b40, sp=7ffe8fdb0a10, pc=7f85cf1749ac
pc 0x00007f85cf1749ac fp 0x00007ffe8fdb0b40 /usr/local/google/home/iinozemtsev/work/dart-sdk/sdk/out/DebugX64/libeasy_embedder_aot_shared.so+0x5749ac
pc 0x00007f85cef920a4 fp 0x00007ffe8fdb0c20 /usr/local/google/home/iinozemtsev/work/dart-sdk/sdk/out/DebugX64/libeasy_embedder_aot_shared.so+0x3920a4
pc 0x00007f85cf025122 fp 0x00007ffe8fdb0c90 /usr/local/google/home/iinozemtsev/work/dart-sdk/sdk/out/DebugX64/libeasy_embedder_aot_shared.so+0x425122
pc 0x00007f85cf6f3285 fp 0x00007ffe8fdb0d70 Dart_GetField+0x475
pc 0x000055594517db9a fp 0x00007ffe8fdb0e00 out/DebugX64/run_timer_aot+0x39b9a
-- End of DumpStackTrace
The text was updated successfully, but these errors were encountered:
iinozemtsev
added
the
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
label
Jan 16, 2025
The issue here is that VerifyEntryPoint, used by the various Invoke/InvokeGetter/InvokeSetter functions, is out of sync with the precompiler.
If a non-true or null pragma argument is provided, then VerifyEntryPoint requires that
getters are annotated with "get" ("call" makes no sense with them, even when used with Dart_Invoke, because Dart_Invoke on a getter is the equivalent of Dart_GetField and then Dart_InvokeClosure on the retrieved value), and
setters are annotated with "set" (as they can only be used with Dart_SetField).
This matches how Invoke/InvokeGetter/InvokeSetter have traditionally treated getters and setters.
However, the precompiler and the pragma checks in native_code.dart do not treat getters and setters differently from other procedures (other than disallowing "get" for setters). They treat "get" on a getter as if it would closurize the getter instead of calling it to retrieve the value, and they treat "call" on both getters and setters as if they were invoked by Dart_Invoke.
I'm currently working on a CL to align all the various parts and also update the entry point pragma documentation appropriately, which should fix the issue here.
In https://dart-review.googlesource.com/c/sdk/+/402860 I have a getter I am trying to call from the native code.
In Dart code, the getter is called like this:
And in native code, I am trying to call it like this:
When I change pragma to
@pragma('vm:entry-point', 'call')
, I get the following error (both in AOT and Kernel mode):When I change pragma to
@pragma('vm:entry-point', 'get')
, then it works fine in Kernel mode, but in AOT mode it fails with the following error:The text was updated successfully, but these errors were encountered: