Skip to content

Commit

Permalink
all: Go 1.21 support
Browse files Browse the repository at this point in the history
  • Loading branch information
aykevl committed Jul 6, 2023
1 parent 3871b83 commit 6edf612
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# statically linked binary.
runs-on: ubuntu-latest
container:
image: golang:1.20-alpine
image: golang:1.21-alpine
steps:
- name: Install apk dependencies
# tar: needed for actions/cache@v3
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
cache: true
- name: Install wasmtime
run: |
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
cache: true
- name: Install Node.js
uses: actions/setup-node@v3
Expand Down Expand Up @@ -290,7 +290,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
cache: true
- name: Restore LLVM source cache
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -407,7 +407,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
cache: true
- name: Restore LLVM source cache
uses: actions/cache/restore@v3
Expand Down
2 changes: 1 addition & 1 deletion builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewConfig(options *compileopts.Options) (*compileopts.Config, error) {
if err != nil {
return nil, fmt.Errorf("could not read version from GOROOT (%v): %v", goroot, err)
}
if major != 1 || minor < 18 || minor > 20 {
if major != 1 || minor < 18 || minor > 21 {
// Note: when this gets updated, also update the Go compatibility matrix:
// https://github.com/tinygo-org/tinygo-site/blob/dev/content/docs/reference/go-compat-matrix.md
return nil, fmt.Errorf("requires go version 1.18 through 1.20, got go%d.%d", major, minor)
Expand Down
10 changes: 10 additions & 0 deletions src/internal/bytealg/bytealg.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,13 @@ func IndexRabinKarp(s, substr string) int {
}
return -1
}

// MakeNoZero makes a slice of length and capacity n without zeroing the bytes.
// It is the caller's responsibility to ensure uninitialized bytes
// do not leak to the end user.
func MakeNoZero(n int) []byte {
// Note: this does zero the buffer even though that's not necessary.
// For performance reasons we might want to change this (similar to the
// malloc function implemented in the runtime).
return make([]byte, n)
}
2 changes: 2 additions & 0 deletions src/runtime/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func growHeap() bool {

//export malloc
func libc_malloc(size uintptr) unsafe.Pointer {
// Note: this zeroes the returned buffer which is not necessary.
// The same goes for bytealg.MakeNoZero.
return alloc(size, nil)
}

Expand Down
5 changes: 5 additions & 0 deletions src/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@ func godebug_setUpdate(update func(string, string)) {
// variable changes (for example, via os.Setenv).
godebugUpdate = update
}

//go:linkname godebug_setNewIncNonDefault internal/godebug.setNewIncNonDefault
func godebug_setNewIncNonDefault(newIncNonDefault func(string) func()) {
// Dummy function necessary in Go 1.21.
}
5 changes: 4 additions & 1 deletion src/runtime/symtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ type Frames struct {
}

type Frame struct {
PC uintptr

Func *Func

Function string

File string
Line int
PC uintptr
}

func CallersFrames(callers []uintptr) *Frames {
Expand Down

0 comments on commit 6edf612

Please sign in to comment.