compiler: refactor method names

This commit includes two changes:

  * It makes unexported interface methods package-private, so that it's
    not possible to type-assert on an unexported method in a different
    package.
  * It makes the globals used to identify interface methods defined
    globals, so that they can (eventually) be left in the program for an
    eventual non-LTO build mode.
This commit is contained in:
Ayke van Laethem
2021-06-04 14:43:25 +02:00
committed by Ron Evans
parent 52d640967b
commit f2e8d7112c
8 changed files with 47 additions and 32 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ func OptimizeStringEqual(mod llvm.Module) {
// As of this writing, the (reflect.Type).Interface method has not yet been
// implemented so this optimization is critical for the encoding/json package.
func OptimizeReflectImplements(mod llvm.Module) {
implementsSignature := mod.NamedGlobal("func Implements(reflect.Type) bool")
implementsSignature := mod.NamedGlobal("reflect/methods.Implements(reflect.Type) bool")
if implementsSignature.IsNil() {
return
}