Skip to content

Commit aebd4c2

Browse files
committed
drop unused link-time method metadata collection
Result: {"status":"keep","warm_internal_build_wall":29.279,"go_reported_s":28.415,"baseline_s":31.157,"patched_s":29.279,"delta_s":-1.878,"base_go_reported_s":30.589,"patched_go_reported_s":28.415,"wall_s":29.279}
1 parent c2dae2c commit aebd4c2

2 files changed

Lines changed: 8 additions & 20 deletions

File tree

internal/build/build.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,6 @@ func linkMainPkg(ctx *context, pkg *packages.Package, pkgs []*aPackage, outputPa
10501050
needRuntime := false
10511051
needPyInit := false
10521052
var needAbiInit int
1053-
methodByIndex := make(map[int]none)
1054-
methodByName := make(map[string]none)
10551053
allPkgs := []*packages.Package{pkg}
10561054
for _, v := range pkgs {
10571055
allPkgs = append(allPkgs, v.Package)
@@ -1107,12 +1105,6 @@ func linkMainPkg(ctx *context, pkg *packages.Package, pkgs []*aPackage, outputPa
11071105
needRuntime = needRuntime || need1
11081106
needPyInit = needPyInit || need2
11091107
needAbiInit |= aPkg.LPkg.NeedAbiInit
1110-
for k, _ := range aPkg.LPkg.MethodByIndex {
1111-
methodByIndex[k] = none{}
1112-
}
1113-
for k, _ := range aPkg.LPkg.MethodByName {
1114-
methodByName[k] = none{}
1115-
}
11161108

11171109
linkArgs = append(linkArgs, aPkg.LinkArgs...)
11181110
if aPkg.ArchiveFile != "" {
@@ -1130,12 +1122,10 @@ func linkMainPkg(ctx *context, pkg *packages.Package, pkgs []*aPackage, outputPa
11301122
// This is compiled directly to .o and added to linkInputs (not cached)
11311123
// Use a stable synthetic name to avoid confusing it with the real main package in traces/logs.
11321124
entryPkg := genMainModule(ctx, llssa.PkgRuntime, pkg, &genConfig{
1133-
rtInit: needRuntime,
1134-
pyInit: needPyInit,
1135-
abiInit: needAbiInit,
1136-
methodByIndex: methodByIndex,
1137-
methodByName: methodByName,
1138-
abiSymbols: linkedModuleGlobals(linkedOrder),
1125+
rtInit: needRuntime,
1126+
pyInit: needPyInit,
1127+
abiInit: needAbiInit,
1128+
abiSymbols: linkedModuleGlobals(linkedOrder),
11391129
})
11401130
entryObjFile, err := exportObject(ctx, "entry_main", entryPkg.ExportFile, entryPkg.LPkg)
11411131
if err != nil {

internal/build/main_module.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ import (
3737
)
3838

3939
type genConfig struct {
40-
rtInit bool
41-
pyInit bool
42-
abiInit int
43-
methodByIndex map[int]none
44-
methodByName map[string]none
45-
abiSymbols map[string]none
40+
rtInit bool
41+
pyInit bool
42+
abiInit int
43+
abiSymbols map[string]none
4644
}
4745

4846
// genMainModule generates the main entry module for an llgo program.

0 commit comments

Comments
 (0)