multiconcat: don't fold adjacent constants
authorDavid Mitchell <davem@iabyn.com>
Mon, 4 Dec 2017 11:50:53 +0000 (11:50 +0000)
committerDavid Mitchell <davem@iabyn.com>
Mon, 4 Dec 2017 12:36:25 +0000 (12:36 +0000)
commitbcc30fd0276e8f6d4ac27d6f4c719b70a266b1fc
treeb1c021234c186d26b557128c4f1dc701615fdb46
parent56e48c10762ae388167c2f2449eea8553b396093
multiconcat: don't fold adjacent constants

RT #132385

In something like

    $overloaded . "a" . "b"

perl used to do

    $overloaded->concat("a")->concat("b")

but since the introduction of OP_MULTICONCAT, started doing:

    $overloaded->concat("ab")

This commit restores the old behaviour, by keeping every second adjacent
OP_CONST as an arg rather than optimising it away and adding its contents
to the constant string in the aux struct.

But note that

    $overloaded .=  "a" . "b"

originally, and still, constant folds.
lib/overload.t
op.c
t/perf/opcount.t