Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f64654d
cl: make frontend options request local
zhouguangyuan0718 Jul 29, 2026
b6fc181
ssa: introduce compilation symbol namers
zhouguangyuan0718 Jul 29, 2026
7b3736a
ssa: make main prefix rewriting program local
zhouguangyuan0718 Jul 29, 2026
05b1efd
ssa: keep type equivalence within program naming
zhouguangyuan0718 Jul 30, 2026
e018a21
test: cover legacy symbol naming wrappers
zhouguangyuan0718 Jul 31, 2026
fe35ab3
build: split package compilation stages
zhouguangyuan0718 Jul 30, 2026
df990fc
test: cover package build stage boundaries
zhouguangyuan0718 Jul 30, 2026
b273adf
test: cover empty package dependencies
zhouguangyuan0718 Jul 30, 2026
7687a22
test: cover cgo command environment parsing
zhouguangyuan0718 Jul 30, 2026
b8fd898
test: cover cgo pkg-config invocation
zhouguangyuan0718 Jul 30, 2026
93f7d8a
test: cover cgo pkg-config failures
zhouguangyuan0718 Jul 31, 2026
a3ebe54
build: archive LLVM package objects in memory
zhouguangyuan0718 Jul 31, 2026
dcb891d
build: snapshot package linker state
zhouguangyuan0718 Jul 30, 2026
fb7f717
build: isolate package backend sessions
zhouguangyuan0718 Jul 30, 2026
431411a
build: run package backends in parallel
zhouguangyuan0718 Jul 30, 2026
466c31a
test: cover parallel backend task setup
zhouguangyuan0718 Jul 30, 2026
66d3e9f
test: cover package scheduling boundaries
zhouguangyuan0718 Jul 30, 2026
8cf9718
test: cover Plan9 asm package selection
zhouguangyuan0718 Jul 30, 2026
4501ff4
build: replay locality state in backend sessions
zhouguangyuan0718 Jul 31, 2026
b7c5539
build: pipeline package SSA into backends
zhouguangyuan0718 Jul 31, 2026
25c203a
build: add Chrome scheduler trace
zhouguangyuan0718 Jul 31, 2026
35b4170
build: publish package archives concurrently
zhouguangyuan0718 Jul 31, 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
12 changes: 3 additions & 9 deletions cl/caller_frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,7 @@ func TestRuntimeFrameNameNormalization(t *testing.T) {
}

func TestCompileRuntimeCallerFrameInstrumentation(t *testing.T) {
old := emitShadowStackInstrumentation
emitShadowStackInstrumentation = true
defer func() { emitShadowStackInstrumentation = old }()
t.Setenv("LLGO_SHADOW_STACK", "1")
ssapkg, files := buildCallerFrameSSAPackage(t, "example.com/foo", `package foo
import "runtime/debug"

Expand Down Expand Up @@ -744,9 +742,7 @@ func top() {
}

func TestCompileRuntimeCallerFrameUsesGoNameForLinkname(t *testing.T) {
old := emitShadowStackInstrumentation
emitShadowStackInstrumentation = true
defer func() { emitShadowStackInstrumentation = old }()
t.Setenv("LLGO_SHADOW_STACK", "1")
ssapkg, files := buildCallerFrameSSAPackage(t, "command-line-arguments", `package main
import "runtime"

Expand Down Expand Up @@ -825,9 +821,7 @@ func f() { _ = runtime.FuncForPC(0) }
}

func TestCompileRuntimeCallerLocationOnlyForRuntimePaths(t *testing.T) {
old := emitShadowStackInstrumentation
emitShadowStackInstrumentation = true
defer func() { emitShadowStackInstrumentation = old }()
t.Setenv("LLGO_SHADOW_STACK", "1")
ssapkg, files := buildCallerFrameSSAPackage(t, "example.com/foo", `package foo
import "runtime"

Expand Down
111 changes: 111 additions & 0 deletions cl/caller_tracking_precompute_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//go:build !llgo

/*
* Copyright (c) 2026 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 cl

import (
"sync"
"testing"

gossa "golang.org/x/tools/go/ssa"
)

func TestCallerTrackingPrecomputeFreezesConcurrentReads(t *testing.T) {
dep, root := buildCallerFrameSSAProgram(t,
"example.com/dep", `package dep
import "runtime"
func Where() { runtime.Caller(0) }
`,
"example.com/root", `package root
import "example.com/dep"
func Logs() { dep.Where() }
`)
tracking := NewCallerTracking()
tracking.Precompute([]*gossa.Package{root})
if !tracking.frozen {
t.Fatal("CallerTracking was not frozen after precomputation")
}
if !runtimeCallerBaseSet(tracking, dep)[dep.Func("Where")] {
t.Fatal("precomputed base set lost runtime caller function")
}
if !runtimeCallerFuncSet(tracking, root)[root.Func("Logs")] {
t.Fatal("precomputed extended set lost cross-package caller")
}

var wg sync.WaitGroup
errs := make(chan struct{}, 32)
for range 32 {
wg.Add(1)
go func() {
defer wg.Done()
if !runtimeCallerBaseSet(tracking, dep)[dep.Func("Where")] ||
!runtimeCallerFuncSet(tracking, root)[root.Func("Logs")] {
errs <- struct{}{}
}
}()
}
wg.Wait()
close(errs)
if len(errs) != 0 {
t.Fatal("concurrent read lost precomputed caller tracking data")
}

delete(tracking.base, dep)
if got := runtimeCallerBaseSet(tracking, dep); got != nil {
t.Fatalf("frozen base lookup for unknown package = %v, want nil", got)
}
delete(tracking.extended, root)
if got := runtimeCallerFuncSet(tracking, root); got != nil {
t.Fatalf("frozen extended lookup for unknown package = %v, want nil", got)
}
}

func TestNewPackageCallerTrackingMatchesWholeProgramPrecompute(t *testing.T) {
dep, root := buildCallerFrameSSAProgram(t,
"example.com/dep", `package dep
import "runtime"
func Where() { runtime.Caller(0) }
`,
"example.com/root", `package root
import "example.com/dep"
func Logs() { dep.Where() }
`)

whole := NewCallerTracking()
whole.Precompute([]*gossa.Package{root})
local := NewPackageCallerTracking(
root,
SummarizeCallerTracking(dep),
SummarizeCallerTracking(root),
)
if !local.frozen {
t.Fatal("package caller tracking was not frozen")
}
if got, want := local.base[dep][dep.Func("Where")], whole.base[dep][dep.Func("Where")]; got != want {
t.Fatalf("dependency base tracking = %v, want %v", got, want)
}
if got, want := local.extended[root][root.Func("Logs")], whole.extended[root][root.Func("Logs")]; got != want {
t.Fatalf("root extended tracking = %v, want %v", got, want)
}
if len(local.extended) != 1 {
t.Fatalf("package snapshot computed %d extended package sets, want 1", len(local.extended))
}
if len(local.base) != 2 {
t.Fatalf("package snapshot retained %d base package sets, want 2", len(local.base))
}
}
Loading
Loading