-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Some ffi/function_callbacks_many tests failing after changing Class::RareType() #52843
Comments
/cc @dcharkes since he may have ideas of what code path is exercised in those two versions of the test but not the others. The different options at the top:
So it's not failing with |
Okay, checking the generated assembly before and after reveal a single change: the type testing stub for
But after the change to
That's the only difference I see, and that difference should be fine. This should only fail (in that the check would succeed though it shouldn't) if an invalid instantiation of |
Actually, I just noticed another change in the generated code: the first version used I wonder if somehow an unboxed ffi function pointer with an odd address is somehow getting sent to the TTS... but that shouldn't be the case, as RISCV instructions should be aligned either on 32-bit or 16-bit (for some extensions) boundaries. Hmm. |
Oh, checking the results page, this change did actually have some positive improvements for the same arch: |
The tests succeed on all other archs: https://dart-current-results.web.app/#/filter=ffi/function_callbacks_many_test
@rmacnak-google implemented the FFI on RISC-V. We don't support everything in RISC-V yet (#48645), but this test does not exercise those signatures. Another thing that's different on RISC-V is that TMP and TMP2 conflict with argument registers. But this might be a completely different failure. |
Yeah, I'm just concerned about it if there's some really subtle bug that somehow is only getting exercised in very rare conditions :/ But I've been looking at it off and on today while doing other stuff (especially because |
At least the |
Cross linking:
|
Previously, the FFI transformer could produce is checks where the type to check against was Pointer<dynamic>. However, given that the Pointer class is defined as: abstract class Pointer<X extends NativeType> ... the instantiated to bounds version of its type is Pointer<NativeType>. Pointer<dynamic> is not a subtype of Pointer<NativeType>, and thus is an invalid instantiation, but the only place this type could occur was as the right hand side of an is check. Before 7cc005e, Class::RareType() returned the class instantiated with the null (all-dynamic) type arguments vector. Among other things, this "rare" type was compared to the right-hand side of is checks and, if it matched, performed a simple (cid-only) check of the instance type arguments in unoptimized code. Afterwards, Class::RareType() returns the class instantiated with a type arguments vector where each type parameter is instantiated to bounds, so now the "rare" type check fails and it falls back to the full check of the instance type arguments, which causes a ~25% regression in some unoptimized benchmarks. This CL fixes the generation of those is checks in the FFI transformer to use the instantiated to bounds version of the Pointer type instead. TEST=pkg/front_end/test Issue: #52843 Issue: #52848 Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-riscv64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-linux-debug-x64-try,vm-linux-debug-x64-try Change-Id: Ic9ac6d75ba2743e233065444fad13ab098094349 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312400 Reviewed-by: Daco Harkes <dacoharkes@google.com> Reviewed-by: Erik Ernst <eernst@google.com> Auto-Submit: Tess Strickland <sstrickl@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
Passing at top-of-tree. Probably fixed incidentally during other RISC-V fixes. |
There are new test failures on [vm] Make Class::RareType() the instantiated to bounds type..
The tests
are failing on configurations
Logs:
ffi/function_callbacks_many_test/0
ffi/function_callbacks_many_test/2
Doesn't reproduce locally with either release or debug, but given the value of
pc
in an example stack trace:I'm guessing a Smi got loaded in there, and since
Class::RareType()
is used in IL/assembly generation for Smi checking, wouldn't be surprised if it's something involved in that. However, I'd have expected that to cause more widespread failures than tests on a single emulated architecture that I can't even reproduce locally (and the brokenFileIOSink
benchmarks on golem), so whatever it is must be quite subtle.The text was updated successfully, but these errors were encountered: