[v3 PATCH] Use single-visitation in variant assignment and swap.
Ville Voutilainen
ville.voutilainen@gmail.com
Mon Apr 1 08:45:00 GMT 2019
On Sat, 30 Mar 2019 at 20:00, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
>
> This patch makes assignments correct, because they need to
> match indices instead of types. In addition, we cut down the
> codegen size. The symbols are longer than before, the the amount
> of them is roughly the same, so there's no longer an explosion
> in their amount.
>
> Relops are the last bit in these fixes, I'll fix them during the weekend.
Here. This does produce 17 symbols instead of 9 for a test with a
single operator== comparison.
But it's not 47 like it is with the code before this patch.
2019-04-01 Ville Voutilainen <ville.voutilainen@gmail.com>
Use single-visitation in variant assignment and swap.
Also use indices instead of types when checking whether
variants hold the same thing.
* include/std/variant (__do_visit): Add a template parameter
for index visitation, invoke with indices if index visitation
is used.
(__variant_idx_cookie): New.
(__visit_with_index): Likewise.
(_Copy_assign_base::operator=): Do single-visitation with
an index visitor.
(_Move_assign_base::operator=): Likewise.
(_Extra_visit_slot_needed): Adjust.
(__visit_invoke): Call with indices if it's an index visitor.
(relops): Do single-visitation with an index visitor.
(swap): Likewise.
(__visitor_result_type): New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: variant-single-visit_2.diff
Type: text/x-patch
Size: 11070 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190401/a106d090/attachment.bin>
More information about the Gcc-patches
mailing list