Typed callables vs Cppia MemReference
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc issue #1321 và pull request #1324, sau đó theo dõi các thay đổi cppia mem-reference được mô tả trong issue này. Tái hiện các trường hợp typed-callable liên quan đến Int, Float và Dynamic qua ranh giới cppia; được xem là hoàn tất khi các trường hợp callable tương thích không còn yêu cầu tắt object mem references và vượt qua các bài kiểm thử liên quan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
As part of the typed callables work I had to disable cppia mem references in two places to get all the tests passing, this was due to an unfortunate edge case involving haxe functions.
E.g. Haxe is perfectly happy to treat the following signatures as compatible without any user casting or manual wrapping.
Int->Void = Dynamic->Void
Float->Void = Int->Void
Without cppia this is all fine as the new callable types constructor deals with all this mangling, but with cppia there are a few annoying edge cases. Cppia erases all objects to hx::Object*, so when you pass an object like hx::ObjectPtr<hx::Callable<Int->Void>> from haxe into cppia it gets erased to just a object pointer. But this also means if you pass in a Haxe compatible hx::ObjectPtr<hx::Callable<Dynamic->Void>> it will also be erased to hx::Object* and the mem reference setter will just replace the pointer. The problems then start to occur when we try and pull that function object out of cppia and back into cpp. The pointer will be blindly reinterpreted to the original hx::ObjectPtr<hx::Callable<Int->Void>> (or whatever haxe deems the expression to be) which will cause a memory access violation if that pointer holds the one where Dynamic is the argument as they're incompatible types. Previously this would "just work" as all function closures invoked dynamically.
The other edge case surrounding passing these odd compatible callables over the cppia boundary is that you can end up with a callable object pointer in cpp holding a pointer to a hx::CppiaClosure which does not inherit a callable type, again this is due to pointers being reinterpreted by mem reference instead of going through the required callable constructor.
I still have a screenshot of this second one since it was fixed in a follow up merge.
https://github.com/HaxeFoundation/hxcpp/issues/1321
https://github.com/HaxeFoundation/hxcpp/pull/1324
Hopefully this makes sense, I'm not massively familiar with cppia so I found the easiest fix was to disable mem references for objects which is obviously not great. I'll try and remember to dig out some concrete examples of both of these.
Pinging @hughsando since he asked about it in a commit message.
- Ngôn ngữ chính
- C++
- Star
- 330
- Fork
- 230
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của HaxeFoundation/hxcpp
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
HaxeFoundation/hxcpp#1217 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Use std::quick_exit when exitingĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
HaxeFoundation/hxcpp#1396 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Std.isOfType Enum and ClassĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
HaxeFoundation/hxcpp#1391 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Removing some architectures, platforms, or code paths, better support for othersCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
HaxeFoundation/hxcpp#1386 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
HaxeFoundation/hxcpp#1380 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của HaxeFoundation/hxcpp
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
lldb
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
llvm/llvm-project#229592 · 11 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bump libCEED to v1 in superbuildĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
llvm/offload-test-suite#1560 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:Windows bug MEDIUM performance tooling
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày