jit: make gdb_symtab::blocks an std::forward_list
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 16 Dec 2019 21:30:50 +0000 (16:30 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 16 Dec 2019 21:30:50 +0000 (16:30 -0500)
commit0394eed15c5bf24943850f356785152c3d65ab94
tree7c1327661892bd302782015b43c39cb7904bf271
parentb61121178ec07f9da1242e439fe1a23a314ad30e
jit: make gdb_symtab::blocks an std::forward_list

This patch changes the gdb_symtab::blocks manually maintained linked
list to be an std::forward_list, simplifying memory management.

Currently, the list is sorted as blocks are created.  With an
std::forward_list, it is easier (and probably a bit more efficient) to
sort them once at the end, so this is what I did.

A note about the comment on the "next" field:

  /* gdb_blocks are linked into a tree structure.  Next points to the
     next node at the same depth as this block and parent to the
     parent gdb_block.  */

I don't think it's true that "next" points to the next node at the same
depth.  All nodes are in a simple singly linked list, so necessarily
some node will point to some other node that isn't at the same depth.

gdb/ChangeLog:

* jit.c (struct gdb_block) <next>: Remove field.
(struct gdb_symtab) <~gdb_symtab>: Remove.
<blocks>: Change type to std::forward_list<gdb_block>.
(compare_block): Remove.
(jit_block_open_impl): Adjust to std::forward_list.  Place the new
block at the beginning, don't mind about sorting.
(finalize_symtab): Adjust to std::forward_list, sort the blocks list
before using it.
gdb/ChangeLog
gdb/jit.c
This page took 0.02568 seconds and 4 git commands to generate.