Typed callables vs Cppia MemReference
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia leggendo issue #1321 e pull request #1324, quindi ripercorri le modifiche di cppia mem-reference descritte in questo issue. Riproduci i casi di callable tipizzato che coinvolgono Int, Float e Dynamic attraverso il confine di cppia; il lavoro è completato quando i casi di callable compatibili non richiedono più di disabilitare object mem references e superano i test pertinenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C++
- Stelle
- 330
- Fork
- 230
- Merge medio
- 1g 6h
- PR unite (30g)
- 9
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HaxeFoundation/hxcpp
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
HaxeFoundation/hxcpp#1217 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
HaxeFoundation/hxcpp#1396 ·
I maintainer di solito rispondono entro 1 giorno
-
Std.isOfType Enum and ClassAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
HaxeFoundation/hxcpp#1391 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Removing some architectures, platforms, or code paths, better support for othersForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
HaxeFoundation/hxcpp#1386 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
HaxeFoundation/hxcpp#1380 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di HaxeFoundation/hxcpp
Issue simili
-
area:runtime good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
WATonomous/wato_f1tenth#39 ·
-
[APP BUG]: Sorting by name after searching can bring up irrelevant resultsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
shadps4-emu/shadps4-qtlauncher#465 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
duckdb/duckdb-excel#104 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
lxqt/lxqt-powermanagement#495 ·
-
`FakeBackendV2.run` fails with `NoiseError` on circuits with delays on qubits where T2 > 2·T1Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Qiskit/qiskit-aer#2466 ·