Open waneck opened 11 years ago
[comment from ncanna...@gmail.com, published at 2013-05-10T07:37:44.000Z] Uhm, apart from handling the case directly in the platform code generator, I'm not sure it's feasible in a generic manner.
[comment from waneck, published at 2013-05-10T11:42:51.000Z] I understand that it would have to be handled in the platform code generator. But still, detect this case after it was inlined is not trivial. Maybe make ofArray() a macro, which can optimize and call literal() on some platforms?
[comment from ncanna...@gmail.com, published at 2013-05-10T11:48:59.000Z] { eexpr = TCall({ eexpr = TField(_,FStatic({ cl_path = (["haxe";"ds"],"Vector") },{ cf_name = "fromArrayCopy" })) },{ eexpr = TArrayDecl el }) } should match it
[comment from ncanna...@gmail.com, published at 2013-05-10T11:49:54.000Z] ah, if inlined then not sure, but I don't think it's worth inlining it given it makes a copy in general which should be much more expensive than having an extra call.
[comment from si...@haxe.org, published at 2013-05-10T11:50:36.000Z] I think that function should not be inlined to begin with.
[comment from waneck, published at 2013-05-10T11:53:43.000Z]
We either have to inline it or use @:generic, for at least Flash10, C++ and Java, as e.g. Vector
[Google Issue #1801 : http://code.google.com/haxe/issues/detail?id=1801] by waneck, at 2013-05-09T23:34:33.000Z It would really make sense for the targets to optimize ofArray when passing an array literal - to avoid the uneeded array duplication. I'd like to do it for Java and C#, but I'm not sure exactly what would be the best approach to it, since ofArray() is an inlined function, and must remain this way for Java,C#,Flash10 and C++.
Any ideas? Use macros? :)