SomeRanDev / reflaxe.CPP

An alternative C++ target for Haxe that generates dependent-less, GC-less C++17 code.
MIT License
72 stars 5 forks source link

Honour @:keep meta #30

Open fourst4r opened 1 year ago

fourst4r commented 1 year ago

Reflaxe does not honour the @:keep meta which says

If used on a class, the class along with all fields is unaffected by DCE. If used on a field, that field is unaffected by DCE.

https://haxe.org/manual/cr-dce.html

Other targets will always generate a class that has @:keep meta regardless of if it is used or not.

SomeRanDev commented 1 year ago

Yeahhh, reflaxe/C++ has its own custom DCE system (kind of like the JS target), but I completely forgot to account for @:keep. Good find!! ^^

fourst4r commented 1 year ago

Hah, that explains why the DCE is so good, on the Lua target compiling function main() {} with --dce=full outputs about 700 lines of Lua.

Also FYI there's a @:dce meta you can apply to types as well which

Forces dead code elimination even when --dce full is not specified.

SomeRanDev commented 1 year ago

@:keep should be fixed if you update Reflaxe, but leaving this open since also need to resolve @:dce 👌

neimanpinchas commented 3 months ago

Aha now it make sense In my go target, I had too keep smartDCE off otherwise I was losing some importent classes, next time I will try to fine a common denominator.