Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vm/ffi] Compressed pointer mode arm64 Android FFI callbacks #47259

Closed
dcharkes opened this issue Sep 21, 2021 · 1 comment
Closed

[vm/ffi] Compressed pointer mode arm64 Android FFI callbacks #47259

dcharkes opened this issue Sep 21, 2021 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening library-ffi

Comments

@dcharkes
Copy link
Contributor

FFI callbacks fail on Android arm64 in compressed pointer mode:

==== Running PassStruct9BytesHomogeneousUint8x10
AdbShellExitCode: 134
Stderr:
WARNING: linker: Warning: unable to normalize ""

===== CRASH =====
si_signo=Segmentation fault(11), si_code=1, si_addr=0x54535200a2225c
version=2.15.0-edge.b3cfd293adcdc42b61e435d299e1dd7d582914e3 (be) (Tue Sep 21 10:15:29 2021 +0000) on "android_arm64"
pid=12578, thread=12584, isolate_group=main(0x761f431000), isolate=main(0x761f431800)
isolate_instructions=5555946dc0, vm_instructions=5555946dc0
  pc 0x000000761fa88fb4 fp 0x000000761cbfeae0 Unknown symbol
  pc 0x000000761f207628 fp 0x000000761cbfeb58 Unknown symbol
  pc 0x000000761e37a848 fp 0x000000761cbfeb88 Unknown symbol
  pc 0x000000761e3779e4 fp 0x000000761cbfebe8 Unknown symbol
  pc 0x000000761e376b5c fp 0x000000761cbfec18 Unknown symbol
  pc 0x000000761e376874 fp 0x000000761cbfec70 Unknown symbol
  pc 0x000000761e3336d0 fp 0x000000761cbfeca8 Unknown symbol
  pc 0x000000761e333584 fp 0x000000761cbfecd0 Unknown symbol
  pc 0x000000761e333420 fp 0x000000761cbfed30 Unknown symbol
  pc 0x000000761e331a4c fp 0x000000761cbfed68 Unknown symbol
  pc 0x000000761e3316ac fp 0x000000761cbfedd0 Unknown symbol
  pc 0x000000761e330a94 fp 0x000000761cbfee20 Unknown symbol
  pc 0x000000761f203780 fp 0x000000761cbfeef8 Unknown symbol
  pc 0x0000005555a87568 fp 0x000000761cbfef50 dart::DartEntry::InvokeCode(dart::Code const&, unsigned long, dart::Array const&, dart::Array const&, dart::Thread*)+0x130
  pc 0x0000005555a8717c fp 0x000000761cbfefc0 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0x170
  pc 0x0000005555a89dec fp 0x000000761cbff030 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&)+0x13c
  pc 0x0000005555aba37c fp 0x000000761cbff120 dart::IsolateMessageHandler::HandleMessage(std::__ndk1::unique_ptr<dart::Message, std::__ndk1::default_delete<dart::Message> >)+0x360
  pc 0x0000005555aef260 fp 0x000000761cbff1a0 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool)+0x218
  pc 0x0000005555af004c fp 0x000000761cbff230 dart::MessageHandler::TaskCallback()+0x30c
  pc 0x0000005555c9982c fp 0x000000761cbff2e0 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x1bc
  pc 0x0000005555c9a120 fp 0x000000761cbff350 dart::ThreadPool::Worker::Main(unsigned long)+0x134
  pc 0x0000005555bf14b0 fp 0x000000761cbff3c0 /data/local/tmp/testing/dart+0x69c4b0
  pc 0x000000761f9c9f00 fp 0x000000761cbff430 /system/lib64/libc.so+0x67f00
  pc 0x000000761f97f984 fp 0x000000761cbff440 /system/lib64/libc.so+0x1d984
-- End of DumpStackTrace
../../runtime/vm/stack_frame.cc: 166: error: expected: !code.IsNull()
Aborting re-entrant request for stack trace.
Aborted
ExitCode: -6
Time: 0:00:02.603871

--- Re-run this test:
python3 tools/test.py -n dartk-android-debug-arm64c ffi_2/function_callbacks_structs_by_value_generated_test/0

The test before succeeds

==== Running PassStruct8BytesMixedx10
Calling TestPassStruct8BytesMixedx10(((-1, 2, -3), (4, -5, 6), (-7, 8, -9), (10, -11, 12), (-13, 14, -15), (16, -17, 18), (-19, 20, -21), (22, -23, 24), (-25, 26, -27), (28, -29, 30)))
passStruct8BytesMixedx10((-1.0, 2, -3), (4.0, -5, 6), (-7.0, 8, -9), (10.0, -11, 12), (-13.0, 14, -15), (16.0, -17, 18), (-19.0, 20, -21), (22.0, -23, 24), (-25.0, 26, -27), (28.0, -29, 30))
result = 15.0
result = 15
passStruct8BytesMixedx10((42.0, 2, -3), (4.0, -5, 6), (-7.0, 8, -9), (10.0, -11, 12), (-13.0, 14, -15), (16.0, -17, 18), (-19.0, 20, -21), (22.0, -23, 24), (-25.0, 26, -27), (28.0, -29, 30))
throwing!
passStruct8BytesMixedx10((84.0, 2, -3), (4.0, -5, 6), (-7.0, 8, -9), (10.0, -11, 12), (-13.0, 14, -15), (16.0, -17, 18), (-19.0, 20, -21), (22.0, -23, 24), (-25.0, 26, -27), (28.0, -29, 30))
returning null!
after callback result = 15.0

log: https://dart-ci.appspot.com/log/vm-ffi-android-debug-arm64c/dartk-android-debug-arm64c/6/ffi_2/function_callbacks_structs_by_value_generated_test/0

@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening library-ffi labels Sep 21, 2021
@dcharkes
Copy link
Contributor Author

cc @rmacnak-google, we might have missed a case in FFI callback trampolines for arm64 in the migration PTAL.

@dcharkes dcharkes changed the title [vm/ffi] Compressed pointer mode arm64 Android [vm/ffi] Compressed pointer mode arm64 Android FFI callbacks Sep 21, 2021
copybara-service bot pushed a commit that referenced this issue Sep 22, 2021
HEAP_BITS must be initialized before any variant of LoadCompressed is used.

TEST=ci
Bug: #47259
Change-Id: I01ebb4e6c2eee1e61e15c1d8cc2913d0db27c2bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214124
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening library-ffi
Projects
None yet
Development

No branches or pull requests

2 participants