compiler: rework type and package tracking in exporter

Programming / Compilers / GCC - ian [138bc75d-0d04-0410-961f-82ee72b054a4] - 3 July 2019 00:56 EDT

Revamps the way the exporter tracks exported types and imported packages that need to be mentioned in the export data.

The previous implementation wasn't properly handling the case where an exported non-inlinable function refers to an imported type whose method set includes an inlinable function whose body makes a call to a function in another package that's not directly used in the original package.

This patch integrates together two existing traversal helper classes, "Collect_references_from_inline" and "Find_types_to_prepare" into a single helper "Collect_export_references", so as to have common/shared code that looks for indirectly imported packages.

Fixes golang/go#32778

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183850

adaf97d3009 compiler: rework type and package tracking in exporter
gcc/go/gofrontend/MERGE | 2 +-
gcc/go/gofrontend/export.cc | 649 +++++++++++++++++++++++++-------------------
gcc/go/gofrontend/export.h | 19 +-
gcc/go/gofrontend/gogo.h | 2 +-
gcc/go/gofrontend/names.cc | 2 +-
5 files changed, 384 insertions(+), 290 deletions(-)

Upstream: gcc.gnu.org


  • Share