Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
0676680
wip: add metadata package summary model
luoliwoshang May 20, 2026
3b5392c
wip: persist package summary metadata in build cache
luoliwoshang May 20, 2026
b1ea4db
wip: emit semantic metadata summaries
luoliwoshang May 20, 2026
4e788ff
wip: emit type children metadata
luoliwoshang May 20, 2026
ba87854
wip: extract ordinary metadata edges
luoliwoshang May 20, 2026
23cfb43
wip: add metadata cache debug tooling
luoliwoshang May 20, 2026
fde3580
wip: add metadata-driven deadcode overrides
luoliwoshang May 20, 2026
8a1843f
fix deadcode interface method matching
luoliwoshang May 20, 2026
bb16367
fix deadcode propagation for interface-used type refs
luoliwoshang May 20, 2026
ed040b9
remove cache meta read timing log
luoliwoshang May 20, 2026
83b0ae0
fix dce unreachable method slots
luoliwoshang May 20, 2026
ae572d9
fix dce runtime init root
luoliwoshang May 21, 2026
7b1bcc3
Merge branch 'main' into wip/deadcode-analyzer
luoliwoshang Jun 21, 2026
dfb4ae2
test: update metadata expectations for method stubs
luoliwoshang Jun 21, 2026
40a546b
fix: record interface use from pointer boxing
luoliwoshang Jun 21, 2026
21d5f01
feat: add internal/meta package with mmap-based package summary cache…
luoliwoshang Jun 26, 2026
3552666
feat: migrate DCE pipeline from internal/metadata to internal/meta
luoliwoshang Jun 27, 2026
9861150
perf: make MethodSlots/InterfaceMethods lazy in GlobalSummary
luoliwoshang Jun 27, 2026
3c14a84
refactor: make PackageMeta an internal view; add N-prefix count methods
luoliwoshang Jun 27, 2026
1542da5
style: go fmt
luoliwoshang Jun 27, 2026
38b5154
style: go fmt collect_test.go
luoliwoshang Jun 27, 2026
782c8e8
Merge remote-tracking branch 'upstream/main' into wip/deadcode-mmap
luoliwoshang Jun 29, 2026
7fd02e9
fix(ssa): emit interface metadata from type descriptors
luoliwoshang Jun 30, 2026
55a77fe
fix(ssa): align named interface metadata
luoliwoshang Jun 30, 2026
400407f
fix(ssa): keep interface metadata descriptor stable
luoliwoshang Jun 30, 2026
eb81ecb
fix deadcode interface method demands
luoliwoshang Jun 30, 2026
d2b514d
fix deadcode interface info for method demands
luoliwoshang Jun 30, 2026
019f13a
update deadcode meta golden files
luoliwoshang Jun 30, 2026
092af96
Emit interface metadata from defining packages
luoliwoshang Jul 1, 2026
77f72ae
Add generic interface metadata coverage
luoliwoshang Jul 1, 2026
6bd134a
test: add deadcode drop regression suite
luoliwoshang Jul 1, 2026
fd8d8cb
meta: split function demands from ordinary edges
luoliwoshang Jul 2, 2026
9379516
meta: emit interface info at callsites
luoliwoshang Jul 2, 2026
ea939c3
test: fix generic interface meta golden newline
luoliwoshang Jul 3, 2026
6e76191
meta: remove legacy metadata package
luoliwoshang Jul 3, 2026
8653a64
test: drop interface hash patch path experiment
luoliwoshang Jul 4, 2026
3b029f8
meta: record interface method demands structurally
luoliwoshang Jul 4, 2026
9b1783d
meta: canonicalize patched interface demands
luoliwoshang Jul 4, 2026
8d9d092
test: update reflect meta golden
luoliwoshang Jul 4, 2026
49dbe59
build: add deadcode drop switch
luoliwoshang Jul 6, 2026
c4488bc
ssa: simplify interface metadata symbol naming
luoliwoshang Jul 7, 2026
b5c41a0
meta: hide edge dispatch behind typed builder api
luoliwoshang Jul 7, 2026
71789ea
meta: keep builder boundary notes local
luoliwoshang Jul 7, 2026
948d221
ssa: move interface metadata recording to builder
luoliwoshang Jul 7, 2026
2812286
Merge remote-tracking branch 'upstream/main' into wip/deadcode-mmap
luoliwoshang Jul 8, 2026
b6b355e
cl: avoid duplicate reflect value meta demand
luoliwoshang Jul 8, 2026
9d0c1ab
cl: fold reflect type meta demand into check
luoliwoshang Jul 8, 2026
71586ea
Merge remote-tracking branch 'upstream/main' into wip/deadcode-mmap
luoliwoshang Jul 8, 2026
f09a7a7
ssa: finish package metadata during compilation
luoliwoshang Jul 8, 2026
4aec1d9
build: disable deadcode drop when Go global DCE runs
luoliwoshang Jul 8, 2026
f216a21
ssa: inline reflect method name demand recording
luoliwoshang Jul 8, 2026
2370650
ssa: create package metadata builder during package init
luoliwoshang Jul 8, 2026
0e6ca9e
doc: remove package summary cache format note
luoliwoshang Jul 8, 2026
765e006
ssa: trust reflect method demand caller symbol
luoliwoshang Jul 8, 2026
7021eb8
ssa: shorten reflect method demand marker
luoliwoshang Jul 8, 2026
e17ad31
ssa: trust ordinary edge collection inputs
luoliwoshang Jul 8, 2026
773ad0c
Merge remote-tracking branch 'upstream/main' into wip/deadcode-mmap
luoliwoshang Jul 9, 2026
dd72e74
ssa: simplify interface imethod symbol naming
luoliwoshang Jul 9, 2026
871794e
ssa: keep interface descriptor imethod names local
luoliwoshang Jul 9, 2026
3c30449
ssa: keep structural interface imethod globals
luoliwoshang Jul 9, 2026
f203fe0
ssa: unify ABI method name metadata
luoliwoshang Jul 10, 2026
729f408
deadcode: consolidate global function demands
luoliwoshang Jul 10, 2026
d709a75
ssa: avoid unused unexported method names
luoliwoshang Jul 10, 2026
dd638ee
meta: tighten package summary API
luoliwoshang Jul 10, 2026
ee15f77
meta: simplify function demand recording
luoliwoshang Jul 11, 2026
d9ac998
meta: unify symbol identifiers
luoliwoshang Jul 11, 2026
0574f1e
meta: simplify global owner selection
luoliwoshang Jul 11, 2026
ccfae66
meta: remove global translation caches
luoliwoshang Jul 11, 2026
c81d79a
Merge remote-tracking branch 'upstream/main' into wip/meta-emit
luoliwoshang Jul 11, 2026
b7d1b79
meta: preserve owner fact priority
luoliwoshang Jul 11, 2026
4a43d98
ssa: exclude interfaces from type children
luoliwoshang Jul 11, 2026
9aa3370
Revert "meta: preserve owner fact priority"
luoliwoshang Jul 11, 2026
480461b
ssa: tighten metadata emission coverage
luoliwoshang Jul 11, 2026
39233ca
meta: cover demand formatting and recording
luoliwoshang Jul 11, 2026
080d9bc
meta: tighten collection and cache handling
luoliwoshang Jul 11, 2026
32ffd87
meta: document version 1 wire layout
luoliwoshang Jul 11, 2026
c3695ec
test: defer deadcode drop regression suite
luoliwoshang Jul 11, 2026
23558d2
build: defer deadcode analysis and overrides
luoliwoshang Jul 11, 2026
2f0292d
meta: remove redundant query guards
luoliwoshang Jul 11, 2026
4d36cd9
meta: use iface naming in global summary
luoliwoshang Jul 12, 2026
0a9fb30
ssa: cover ordinary edge filtering
luoliwoshang Jul 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions chore/gentests/gentests.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func main() {
llgenDir(dir + "/cl/_testgo")
llgenDir(dir + "/cl/_testpy")
llgenDir(dir + "/cl/_testdata")
genMetaDir(dir + "/cl/_testmeta")

genExpects(dir)
}
Expand Down Expand Up @@ -77,6 +78,34 @@ func genExpects(root string) {
runExpectDir(root, "cl/_testdata")
}

func genMetaDir(dir string) {
fis, err := os.ReadDir(dir)
check(err)
for _, fi := range fis {
name := fi.Name()
if !fi.IsDir() || strings.HasPrefix(name, "_") {
continue
}
testDir := filepath.Join(dir, name)
if _, err := os.Stat(filepath.Join(testDir, "in.go")); err != nil {
if os.IsNotExist(err) {
continue
}
check(err)
}
relPath, err := filepath.Rel(filepath.Dir(filepath.Dir(dir)), testDir)
check(err)
relPath = filepath.ToSlash(relPath)
fmt.Fprintln(os.Stderr, "meta", relPath)
meta, err := cltest.CaptureMeta("./"+relPath, testDir)
if err != nil {
fmt.Fprintln(os.Stderr, "error:", relPath, err)
continue
}
check(os.WriteFile(filepath.Join(testDir, "meta-expect.txt"), []byte(meta), 0644))
}
}

func runExpectDir(root, relDir string, configure ...func(*build.Config)) {
dir := filepath.Join(root, relDir)
fis, err := os.ReadDir(dir)
Expand Down
63 changes: 63 additions & 0 deletions chore/metadump/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2024 The XGo Authors (xgo.dev). All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package main

import (
"flag"
"fmt"
"os"

"github.com/goplus/llgo/internal/meta"
)

func main() {
var out string
flag.StringVar(&out, "o", "", "write decoded metadata to file")
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage: metadump [-o output] file.meta\n")
flag.PrintDefaults()
}
flag.Parse()

if flag.NArg() != 1 {
flag.Usage()
os.Exit(2)
}

if err := run(flag.Arg(0), out); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}

func run(input, output string) error {
pm, err := meta.Open(input)
if err != nil {
return fmt.Errorf("read %s: %w", input, err)
}
defer pm.Close()
text := pm.String()

if output == "" {
fmt.Print(text)
return nil
}
if err := os.WriteFile(output, []byte(text), 0o644); err != nil {
return fmt.Errorf("write %s: %w", output, err)
}
return nil
}
11 changes: 11 additions & 0 deletions cl/_testmeta/ifaceuse_basic/in.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

type T struct{}

func sink(v any) {
_ = v
}

func main() {
sink(T{})
}
26 changes: 26 additions & 0 deletions cl/_testmeta/ifaceuse_basic/meta-expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[TypeChildren]
*_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T:
_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T

[OrdinaryEdges]
*_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T:
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequalptr
_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequal0:
github.com/goplus/llgo/runtime/internal/runtime.memequal0
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequalptr:
github.com/goplus/llgo/runtime/internal/runtime.memequalptr
_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T:
*_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequal0
github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.init:
github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.init$guard
github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.main:
_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T
github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.sink
github.com/goplus/llgo/runtime/internal/runtime.AllocU

[UseIface]
github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.main:
_llgo_github.com/goplus/llgo/cl/_testmeta/ifaceuse_basic.T

18 changes: 18 additions & 0 deletions cl/_testmeta/interface_anyonmous/in.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

type T struct{}

func (T) M() {}
func (T) N() {}

func use(v interface {
M()
N()
}) {
v.M()
v.N()
}

func main() {
use(T{})
}
84 changes: 84 additions & 0 deletions cl/_testmeta/interface_anyonmous/meta-expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[TypeChildren]
*_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac:
_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac
*_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T:
_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T
*_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo:
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo

[OrdinaryEdges]
*_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac:
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequalptr
_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac
*_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T:
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequalptr
_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T
*_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo:
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequalptr
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo
__llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).M:
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).M
__llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).N:
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).N
__llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.M:
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.M
__llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.N:
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.N
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.interequal:
github.com/goplus/llgo/runtime/internal/runtime.interequal
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequal0:
github.com/goplus/llgo/runtime/internal/runtime.memequal0
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequalptr:
github.com/goplus/llgo/runtime/internal/runtime.memequalptr
_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac:
*_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac
_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T:
*_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.memequal0
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo:
*_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo
__llgo_stub.github.com/goplus/llgo/runtime/internal/runtime.interequal
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo$imethods
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo$imethods:
_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).M:
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.M
github.com/goplus/llgo/runtime/internal/runtime.AssertNilDeref
github.com/goplus/llgo/runtime/internal/runtime.PanicWrapNilPointer
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).N:
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.N
github.com/goplus/llgo/runtime/internal/runtime.AssertNilDeref
github.com/goplus/llgo/runtime/internal/runtime.PanicWrapNilPointer
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.init:
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.init$guard
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.main:
_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.use
github.com/goplus/llgo/runtime/internal/runtime.AllocU
github.com/goplus/llgo/runtime/internal/runtime.NewItab
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.use:
github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData

[UseIface]
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.main:
_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T

[UseIfaceMethod]
github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.use:
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo M _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo N _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac

[MethodInfo]
*_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T:
0 M _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).M __llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).M
1 N _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).N __llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).N
_llgo_github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T:
0 M _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).M __llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.M
1 N _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.(*T).N __llgo_stub.github.com/goplus/llgo/cl/_testmeta/interface_anyonmous.T.N

[InterfaceInfo]
_llgo_iface$f14WsslTA1u5wwC83jLU0HU2u2mmAWxBVE38vPBbRAo:
M _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac
N _llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac

8 changes: 8 additions & 0 deletions cl/_testmeta/interface_exported_var/in.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package main

import "encoding/binary"

func main() {
var order binary.ByteOrder = binary.LittleEndian
_ = order.Uint16([]byte{1, 2})
}
Loading
Loading