awslabs / ar-go-tools

ar-go-tools (Argot) is a collection of analysis tools for Go
Apache License 2.0
9 stars 1 forks source link

Add support for reflection to escape analysis #58

Closed amzn-jasonrk closed 7 months ago

amzn-jasonrk commented 8 months ago

This PR adds support for reflection to the escape analysis. This is primarily achieved by adding specific handling for certain critical functions, such as reflect.ValueOf. The json marshalling functions are special cased as well, as they make use of complicated reflection functions that would be very difficult to add general support for.

This work is somewhat incomplete in that the reflection used in Printf and related functions appears to confuse how the escape analysis queries the callees of the .String() methods for custom stringification. Thus, the analysis does not yet handle custom stringification that may have side effects.