Open scabug opened 12 years ago
Imported From: https://issues.scala-lang.org/browse/SI-6251?orig=1 Reporter: Adam Klein (aklein-at-novus.com) Affected Versions: 2.10.0 Attachments:
@non said: I think this probably relates to an issue I've known about for a long time: anonymous functions defined in (specialized) generic scope don't end up being specialized properly in many (all?) cases.
Another one for the queue...
This could be a duplicate or variant of #5490, but I'm not sure. Given the code:
I attempted to follow the bytecode to see where it goes wrong, but it's not clear to me from the byte code how this transpires. Instead I'm attaching the runtime call tree that shows how Bar$mcI$sp.bad$mcI$sp invokes Bar$mcI$sp.invoker$mcI$sp, which in turn invokes the interface Function1.apply$mcII$sp, and this call is received by a parent class (AbstractFunction1) that unnecessarily boxes/unboxes; so somehow specfunc1 isn't correctly specialized. Ie:
Function1$class.apply$mcII$sp bytecode (via jprofiler) shows
Whereas, when Bar$mcI$sp.good$mcI$sp invokes Bar$mcl$sp.invoker$mcI$sp, the recipient of the invokeinterface is Test2$$anonfun$1.apply$mcII$sp; ie, the call does not pass up to AbstractFunction1.