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
WIP | =sink is now =move #11248
WIP | =sink is now =move #11248
Conversation
Note: I'm taking over, I really want this in 0.20. |
797fb24
to
605a266
Compare
TODO:
EDIT: I think this elides destructors too agressively, investigating.. |
You need to patch the C codegen so that if owner.kind in {skProc, skFunc, skMethod, skIterator, skConverter}:
let params = owner.typ.n
for i in 1 ..< params.len:
let param = params[i].sym
if isSinkTypeForParam(param.typ) and hasDestructor(param.typ.skipTypes({tySink})):
c.destroys.add genDestroy(c, param.typ.skipTypes({tyGenericInst, tyAlias, tySink}), params[i]) needs to be removed, the caller is responsible for cleaning up what was passed as a sink parameter. |
d510937
to
7a9a1d4
Compare
01525b2
to
582d40a
Compare
c62c052
to
92454d5
Compare
b5cdd4d
to
a70c846
Compare
TODO:
type
Obj* = object
f*: seq[int]
var o = Obj(f: @[1, 2, 3]) will be transformed to: eq__qdqSn882Av3rQxYVfnQyMg((&colontmpD_), TM_mDIVXahtYVExBX9bJLnfz0Q_76); //Copy, because const seq
T2_.f = colontmpD_;
eqmove__C1DzWNOtypwtWid2xBvXLg((&o), (&T2_));
//...
eqdestroy__39bIYiz25XeqkqfTm4wBXNg((&colontmpD_));
eqdestroy__9aQE9amztaLIv7YEpj9agHaSg((&o)); which will cause a double free segfault, since |
6634013
to
fd3f7df
Compare
This turned out to solve a problem that doesn't exist, and also hurt performance by 5% on avg. |
... which makes self-assignments work correctly.
Refs #11217