Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0b26861
build: prototype load-time source patches
cpunion Mar 28, 2026
ce3401e
test: lock iter source patch routing
cpunion Mar 28, 2026
02ec9ee
build: support skip directives in source patches
cpunion Mar 28, 2026
83c51d8
build: extend source patch directives
cpunion Mar 28, 2026
21dad23
build: default source patches to active
cpunion Mar 28, 2026
239b023
build: migrate unique to source patch
cpunion Mar 28, 2026
3c10b84
build: migrate reflectlite to source patch
cpunion Mar 28, 2026
532e073
build: preserve source patch positions
cpunion Mar 28, 2026
e09fe00
build: migrate runtime internals to source patches
cpunion Mar 28, 2026
1f663fa
build: narrow source patch package coverage
cpunion Mar 28, 2026
65522dd
build: tighten source patch helpers
cpunion Mar 28, 2026
ab1e850
build: narrow source patch package coverage
cpunion Mar 28, 2026
3cfa0ae
build: skip source patches for missing stdlib packages
cpunion Mar 28, 2026
5c187de
build: resolve source patch goroot from go env
cpunion Mar 28, 2026
d48e159
build: keep sync atomic on alt patches
cpunion Mar 28, 2026
2242f98
build: preserve source patch diagnostics
cpunion Mar 28, 2026
0de323e
build: honor build tags in source patches
cpunion Mar 28, 2026
730a986
runtime: restore maps field comments
cpunion Mar 28, 2026
beda8b0
build: drop source patch nopatch directive
cpunion Mar 28, 2026
46822e8
runtime: keep unique changes off source patch proto
cpunion Mar 28, 2026
b4e2d60
runtime: drop sync atomic skip from source patch proto
cpunion Mar 28, 2026
f81b151
build: simplify source patch diagnostics
cpunion Mar 29, 2026
ee679ac
build: add case-based source patch fixtures
cpunion Mar 29, 2026
bd685f8
test: flatten source patch fixture cases
cpunion Mar 29, 2026
7424944
test: cover generic source patch declarations
cpunion Mar 30, 2026
e0c2ea2
cl: add boolToUint8 intrinsic
cpunion Mar 29, 2026
9a5e5bb
runtime: add incremental go1.26 compat
cpunion Mar 28, 2026
0d55b19
ci: extend llgo coverage to go1.26
cpunion Mar 28, 2026
919a4e8
runtime: enable synctest compat on linux
cpunion Mar 28, 2026
43f9242
test: isolate go1.26 source patch coverage
cpunion Mar 28, 2026
c3ccf9c
runtime: keep unique compat on go1.26 branch
cpunion Mar 28, 2026
ac44259
runtime: move go1.26 sync source patch files
cpunion Mar 29, 2026
6b1e842
runtime: source patch crypto internal constanttime
cpunion Mar 29, 2026
3ce72bb
test: add goroot runner baseline and sharded CI
cpunion Mar 26, 2026
fd5f75f
test: record go1.25 goroot xfails for ci
cpunion Mar 26, 2026
4b0819a
test: expand goroot xfail entries
cpunion Mar 26, 2026
0708915
test: address goroot runner review feedback
cpunion Mar 26, 2026
ab5a053
test: tolerate missing goroot test dirs
cpunion Mar 26, 2026
0cb9a52
ci: expand goroot matrix across go versions
cpunion Mar 26, 2026
4ab3995
ci: drop unsupported low go versions from goroot matrix
cpunion Mar 26, 2026
d774ece
ci: drop go1.23 from goroot matrix
cpunion Mar 26, 2026
e434045
test: record go1.24 and go1.26 goroot xfails
cpunion Mar 26, 2026
0e375b3
goroot: drop stale linux xfails for go1.25 and go1.26
cpunion Mar 31, 2026
0187bbc
goroot: drop stale darwin xfails for go1.25 and go1.26
cpunion Mar 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
132 changes: 132 additions & 0 deletions .github/workflows/goroot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: GOROOT

on:
push:
branches:
- "**"
- "!dependabot/**"
- "!xgopilot/**"
pull_request:
branches: ["**"]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
goroot:
name: GOROOT (${{ matrix.os }}, Go ${{ matrix.go-version }}, shard ${{ matrix.shard-label }})
continue-on-error: ${{ matrix.required != 'true' }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
llvm: 19
go-version: "1.24.11"
shard-index: "0"
shard-total: "2"
shard-label: "0/2"
required: "false"
- os: macos-latest
llvm: 19
go-version: "1.24.11"
shard-index: "1"
shard-total: "2"
shard-label: "1/2"
required: "false"
- os: ubuntu-latest
llvm: 19
go-version: "1.24.11"
shard-index: "0"
shard-total: "2"
shard-label: "0/2"
required: "false"
- os: ubuntu-latest
llvm: 19
go-version: "1.24.11"
shard-index: "1"
shard-total: "2"
shard-label: "1/2"
required: "false"
- os: macos-latest
llvm: 19
go-version: "1.25.0"
shard-index: "0"
shard-total: "2"
shard-label: "0/2"
required: "true"
- os: macos-latest
llvm: 19
go-version: "1.25.0"
shard-index: "1"
shard-total: "2"
shard-label: "1/2"
required: "true"
- os: ubuntu-latest
llvm: 19
go-version: "1.25.0"
shard-index: "0"
shard-total: "2"
shard-label: "0/2"
required: "true"
- os: ubuntu-latest
llvm: 19
go-version: "1.25.0"
shard-index: "1"
shard-total: "2"
shard-label: "1/2"
required: "true"
- os: macos-latest
llvm: 19
go-version: "1.26.0"
shard-index: "0"
shard-total: "2"
shard-label: "0/2"
required: "false"
- os: macos-latest
llvm: 19
go-version: "1.26.0"
shard-index: "1"
shard-total: "2"
shard-label: "1/2"
required: "false"
- os: ubuntu-latest
llvm: 19
go-version: "1.26.0"
shard-index: "0"
shard-total: "2"
shard-label: "0/2"
required: "false"
- os: ubuntu-latest
llvm: 19
go-version: "1.26.0"
shard-index: "1"
shard-total: "2"
shard-label: "1/2"
required: "false"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6

- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{ matrix.llvm }}

- name: Set up Go
uses: ./.github/actions/setup-go
with:
go-version: ${{ matrix.go-version }}

- name: Show toolchain versions
run: |
go version
clang --version

- name: Run GOROOT runner
run: |
bash dev/test_goroot.sh -- \
-shard-index "${{ matrix.shard-index }}" \
-shard-total "${{ matrix.shard-total }}"
34 changes: 26 additions & 8 deletions .github/workflows/llgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- macos-15-intel
- ubuntu-latest
llvm: [19]
go: ["1.21.13", "1.24.2"]
go: ["1.21.13", "1.24.2", "1.26.0"]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v6
Expand Down Expand Up @@ -97,9 +97,15 @@ jobs:
pip3.12 install --break-system-packages "${py_deps[@]}"

- name: Set up Go for build
if: ${{ !startsWith(matrix.go, '1.26') }}
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Set up Go 1.26 for build
if: ${{ startsWith(matrix.go, '1.26') }}
uses: ./.github/actions/setup-go
with:
go-version: "1.26.0"

- name: Install
run: |
Expand Down Expand Up @@ -192,7 +198,7 @@ jobs:
- macos-latest
- ubuntu-latest
llvm: [19]
go: ["1.24.2"]
go: ["1.24.2", "1.26.0"]
shard: ["0", "1", "2", "3"]
runs-on: ${{matrix.os}}
steps:
Expand All @@ -210,9 +216,15 @@ jobs:
pip3.12 install --break-system-packages "${py_deps[@]}"

- name: Set up Go for build
if: ${{ !startsWith(matrix.go, '1.26') }}
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Set up Go 1.26 for build
if: ${{ startsWith(matrix.go, '1.26') }}
uses: ./.github/actions/setup-go
with:
go-version: "1.26.0"

- name: Install
run: |
Expand Down Expand Up @@ -268,7 +280,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
llvm: [19]
go: ["1.21.13", "1.24.2"]
go: ["1.21.13", "1.24.2", "1.26.0"]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v6
Expand All @@ -277,10 +289,16 @@ jobs:
with:
llvm-version: ${{matrix.llvm}}

- name: Set up Go 1.23 for building llgo
- name: Set up Go for build
if: ${{ !startsWith(matrix.go, '1.26') }}
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Set up Go 1.26 for build
if: ${{ startsWith(matrix.go, '1.26') }}
uses: ./.github/actions/setup-go
with:
go-version: "1.26.0"

- name: Install llgo
run: |
Expand All @@ -293,28 +311,28 @@ jobs:
go-version: ${{matrix.go}}

- name: Test Hello World with go.mod 1.21
if: startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
if: startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24') || startsWith(matrix.go, '1.25') || startsWith(matrix.go, '1.26')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.21"

- name: Test Hello World with go.mod 1.22
if: startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
if: startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24') || startsWith(matrix.go, '1.25') || startsWith(matrix.go, '1.26')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.22"

- name: Test Hello World with go.mod 1.23
if: startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
if: startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24') || startsWith(matrix.go, '1.25') || startsWith(matrix.go, '1.26')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.23"

- name: Test Hello World with go.mod 1.24
if: startsWith(matrix.go, '1.24')
if: startsWith(matrix.go, '1.24') || startsWith(matrix.go, '1.25') || startsWith(matrix.go, '1.26')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
Expand Down
37 changes: 37 additions & 0 deletions cl/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,40 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
}
`)
}

func TestIntrinsicBoolToUint8(t *testing.T) {
testCompile(t, `package foo

import _ "unsafe"

//go:linkname boolToUint8 llgo.boolToUint8
func boolToUint8(b bool) uint8

func use(b bool) uint8 {
return boolToUint8(b)
}
`, `; ModuleID = 'foo'
source_filename = "foo"

@"foo.init$guard" = global i1 false, align 1

define void @foo.init() {
_llgo_0:
%0 = load i1, ptr @"foo.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1

_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"foo.init$guard", align 1
br label %_llgo_2

_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}

define i8 @foo.use(i1 %0) {
_llgo_0:
%1 = select i1 %0, i8 1, i8 0
ret i8 %1
}
`)
}
1 change: 1 addition & 0 deletions cl/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ const (
llgoSyscall = llgoInstrBase + 0x44
llgoAtomicCmpXchgOK = llgoInstrBase + 0x45
llgoAtomicAddReturnNew = llgoInstrBase + 0x46
llgoBoolToUint8 = llgoInstrBase + 0x47

llgoAtomicOpLast = llgoAtomicOpBase + int(llssa.OpUMin)
)
Expand Down
16 changes: 16 additions & 0 deletions cl/instr.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,16 @@ func (p *context) atomicCmpXchgOK(b llssa.Builder, args []llssa.Expr) llssa.Expr
return b.Extract(ret, 1)
}

func (p *context) boolToUint8(b llssa.Builder, args []llssa.Expr) llssa.Expr {
if len(args) == 1 {
retType := p.type_(types.Typ[types.Uint8], llssa.InGo)
one := p.prog.IntVal(1, retType)
zero := p.prog.Zero(retType)
return b.SelectValue(args[0], one, zero)
}
panic("boolToUint8(b bool) uint8: invalid arguments")
}

// -----------------------------------------------------------------------------

var llgoInstrs = map[string]int{
Expand All @@ -567,6 +577,7 @@ var llgoInstrs = map[string]int{
"funcPCABI0": llgoFuncPCABI0,
"skip": llgoSkip,
"syscall": llgoSyscall,
"boolToUint8": llgoBoolToUint8,
"pystr": llgoPyStr,
"pyList": llgoPyList,
"pyTuple": llgoPyTuple,
Expand Down Expand Up @@ -790,6 +801,11 @@ func (p *context) call(b llssa.Builder, act llssa.DoAction, call *ssa.CallCommon
}
case llgoSyscall:
ret = p.syscallIntrinsic(b, args, call.Signature().Results())
case llgoBoolToUint8:
args := p.compileValues(b, args, kind)
ret = b.Do(act, llssa.Nil, func(b llssa.Builder, _ llssa.Expr, args ...llssa.Expr) llssa.Expr {
return p.boolToUint8(b, args)
}, args...)
case llgoUnreachable: // func unreachable()
b.Unreachable()
case llgoAtomicLoad:
Expand Down
41 changes: 41 additions & 0 deletions dev/test_goroot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

runner_args=()
goroots=()
after_delim=0
for arg in "$@"; do
if [[ "$arg" == "--" ]]; then
after_delim=1
continue
fi
if [[ $after_delim -eq 1 ]]; then
runner_args+=("$arg")
else
goroots+=("$arg")
fi
done

if [[ ${#goroots[@]} -eq 0 ]]; then
if [[ -n "${LLGO_GOROOT_MATRIX:-}" ]]; then
IFS=':' read -r -a goroots <<<"${LLGO_GOROOT_MATRIX}"
else
goroots=("$(go env GOROOT)")
fi
fi

for goroot in "${goroots[@]}"; do
go_bin="$goroot/bin/go"
if [[ ! -x "$go_bin" ]]; then
echo "error: missing go binary: $go_bin" >&2
exit 2
fi
version="$("$go_bin" env GOVERSION)"
echo "==== $version ($goroot) ===="
(
cd "$repo_root"
go test ./test/goroot -count=1 -timeout 90m -args -goroot "$goroot" "${runner_args[@]}"
)
done
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
)

require (
github.com/goplus/plan9asm v0.0.0-20260307134905-822503d6bf44
github.com/goplus/plan9asm v0.1.1-0.20260327232615-ec1a30b9181f
github.com/marcinbor85/gohex v0.0.0-20210308104911-55fb1c624d84
github.com/mattn/go-tty v0.0.7
github.com/sigurn/crc16 v0.0.0-20240131213347-83fcde1e29d1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ github.com/goplus/plan9asm v0.0.0-20260307044640-a5f1e3b27fc1 h1:hlVAtc3x34x6CQo
github.com/goplus/plan9asm v0.0.0-20260307044640-a5f1e3b27fc1/go.mod h1:nnr49+IlbnOI5c0yb1fkbilBRcr50RPX0JAreDdYTUI=
github.com/goplus/plan9asm v0.0.0-20260307134905-822503d6bf44 h1:zZXTz5CBO1uZIJGZSGWov5gE1CbulJ1QH6ruTMv3UdY=
github.com/goplus/plan9asm v0.0.0-20260307134905-822503d6bf44/go.mod h1:gpS4VVNoRykYTtc8kPFBowraN5SrBj8lIjW8/lNjaG4=
github.com/goplus/plan9asm v0.1.1-0.20260327232615-ec1a30b9181f h1:DICfzr9FWlZPnKJcS0tMnIRQ1oWk1sFU4S1uYJ0jOTo=
github.com/goplus/plan9asm v0.1.1-0.20260327232615-ec1a30b9181f/go.mod h1:gpS4VVNoRykYTtc8kPFBowraN5SrBj8lIjW8/lNjaG4=
github.com/marcinbor85/gohex v0.0.0-20210308104911-55fb1c624d84 h1:hyAgCuG5nqTMDeUD8KZs7HSPs6KprPgPP8QmGV8nyvk=
github.com/marcinbor85/gohex v0.0.0-20210308104911-55fb1c624d84/go.mod h1:Pb6XcsXyropB9LNHhnqaknG/vEwYztLkQzVCHv8sQ3M=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
Expand Down
Loading
Loading