Skip to content

Commit

Permalink
Merge pull request #265 from visualfc/go122
Browse files Browse the repository at this point in the history
go 1.22 support
  • Loading branch information
visualfc authored Feb 10, 2024
2 parents 220c124 + c5f6341 commit 72a1ace
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 226 deletions.
110 changes: 0 additions & 110 deletions .github/workflows/go117.yml

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/go116.yml → .github/workflows/go122.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go1.16
name: Go1.22

on:
push:
Expand All @@ -9,14 +9,14 @@ on:
jobs:

macos:
name: Test Go1.16 for macOS
name: Test Go1.22 for macOS
runs-on: macos-latest
steps:

- name: Set up Go 1.16
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.22.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand All @@ -38,14 +38,14 @@ jobs:
run: GOARCH=amd64 go run ./cmd/igoptest

linux:
name: Test Go1.16 for Linux
name: Test Go1.22 for Linux
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.16
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.22.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand All @@ -67,14 +67,14 @@ jobs:
run: GOARCH=amd64 go run ./cmd/igoptest

windows:
name: Test Go1.16 for Windows
name: Test Go1.22 for Windows
runs-on: windows-latest
steps:

- name: Set up Go 1.16
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.22.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# iGo+ The Go/Go+ Interpreter

[![Go1.16](https://github.com/goplus/igop/workflows/Go1.16/badge.svg)](https://github.com/goplus/igop/actions/workflows/go116.yml)
[![Go1.17](https://github.com/goplus/igop/workflows/Go1.17/badge.svg)](https://github.com/goplus/igop/actions/workflows/go117.yml)
github.com/goplus/igop/actions/workflows/go117.yml)
[![Go1.18](https://github.com/goplus/igop/workflows/Go1.18/badge.svg)](https://github.com/goplus/igop/actions/workflows/go118.yml)
[![Go1.19](https://github.com/goplus/igop/workflows/Go1.19/badge.svg)](https://github.com/goplus/igop/actions/workflows/go119.yml)
[![Go1.20](https://github.com/goplus/igop/workflows/Go1.20/badge.svg)](https://github.com/goplus/igop/actions/workflows/go120.yml)
[![Go1.21](https://github.com/goplus/igop/workflows/Go1.21/badge.svg)](https://github.com/goplus/igop/actions/workflows/go121.yml)
[![Go1.22](https://github.com/goplus/igop/workflows/Go1.22/badge.svg)](https://github.com/goplus/igop/actions/workflows/go122.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/goplus/igop.svg)](https://pkg.go.dev/github.com/goplus/igop)


### Go Version

- Go1.16 ~ Go1.21
- Go1.16 ~ Go1.22
- macOS Linux Windows WebAssembly GopherJS and more.

### ABI
Expand All @@ -26,10 +26,11 @@ support ABI0 and ABIInternal
- Go1.19: amd64 arm64 ppc64/ppc64le riscv64
- Go1.20: amd64 arm64 ppc64/ppc64le riscv64
- Go1.21: amd64 arm64 ppc64/ppc64le riscv64
- Go1.22: amd64 arm64 ppc64/ppc64le riscv64

### Generics

- support generics (Go1.18/Go1.19/Go1.20/Go1.21)
- support generics (Go1.18 ~ Go1.22)
- support [Go1.20 nested type-parameterized declarations](https://github.com/golang/go/blob/master/test/typeparam/nested.go) on Go1.18/Go1.19 (Experimental)

### runtime.GC
Expand Down
52 changes: 52 additions & 0 deletions builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,58 @@ func (interp *Interp) callBuiltinByStack(caller *frame, fn string, ssaArgs []ssa
case "clear":
arg0 := caller.reg(ia[0])
valueClear(reflect.ValueOf(arg0))
case "max":
v := reflect.ValueOf(caller.reg(ia[0]))
for _, i := range ia {
arg := reflect.ValueOf(caller.reg(i))
if i > 0 {
switch v.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
if v.Int() < arg.Int() {
v = arg
}
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
if v.Uint() < arg.Uint() {
v = arg
}
case reflect.Float32, reflect.Float64:
if v.Float() < arg.Float() {
v = arg
}
case reflect.String:
if v.String() < arg.String() {
v = arg
}
}
}
}
caller.setReg(ir, v.Interface())
case "min":
v := reflect.ValueOf(caller.reg(ia[0]))
for _, i := range ia {
arg := reflect.ValueOf(caller.reg(i))
if i > 0 {
switch v.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
if v.Int() > arg.Int() {
v = arg
}
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
if v.Uint() > arg.Uint() {
v = arg
}
case reflect.Float32, reflect.Float64:
if v.Float() > arg.Float() {
v = arg
}
case reflect.String:
if v.String() > arg.String() {
v = arg
}
}
}
}
caller.setReg(ir, v.Interface())
default:
panic("unknown built-in: " + fn)
}
Expand Down
20 changes: 18 additions & 2 deletions cmd/igoptest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func init() {

ver := runtime.Version()[:6]
switch ver {
case "go1.17", "go1.18", "go1.19", "go1.20", "go1.21":
case "go1.17", "go1.18", "go1.19", "go1.20", "go1.21", "go1.22":
// gorootTestSkips["fixedbugs/issue45045.go"] = "runtime.SetFinalizer"
// gorootTestSkips["fixedbugs/issue46725.go"] = "runtime.SetFinalizer"
gorootTestSkips["abi/fibish.go"] = "slow, 34s"
Expand All @@ -86,9 +86,21 @@ func init() {
gorootTestSkips["typeparam/cons.go"] = "skip golang.org/x/tools v0.7.0 on go1.18"
gorootTestSkips["typeparam/list2.go"] = "skip golang.org/x/tools v0.7.0 on go1.18"
}
if ver == "go1.21" {
if ver == "go1.21" || ver == "go1.22" {
gorootTestSkips["fixedbugs/issue19658.go"] = "skip command"
}
if ver == "go1.22" {
gorootTestSkips["fixedbugs/bug369.go"] = "skip command"
gorootTestSkips["fixedbugs/issue10607.go"] = "skip command"
gorootTestSkips["fixedbugs/issue21317.go"] = "skip command"
gorootTestSkips["fixedbugs/issue38093.go"] = "skip js"
gorootTestSkips["fixedbugs/issue64565.go"] = "skip command"
gorootTestSkips["fixedbugs/issue9355.go"] = "skip command"
gorootTestSkips["linkmain_run.go"] = "skip link"
gorootTestSkips["linkobj.go"] = "skip link"
gorootTestSkips["linkx_run.go"] = "skip link"
gorootTestSkips["chanlinear.go"] = "skip -gc-exp"
}
case "go1.16":
gorootTestSkips["fixedbugs/issue7740.go"] = "BUG, const float"
case "go1.15":
Expand All @@ -105,6 +117,10 @@ func init() {
gorootTestSkips["fixedbugs/issue15002.go"] = "skip windows"
gorootTestSkips["fixedbugs/issue5493.go"] = "skip windows"
gorootTestSkips["fixedbugs/issue5963.go"] = "skip windows"
if ver == "go1.22" {
gorootTestSkips["recover4.go"] = "skip windows"
gorootTestSkips["sigchld.go"] = "skip windows"
}

skips := make(map[string]string)
for k, v := range gorootTestSkips {
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ go 1.16

require (
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00
github.com/goplus/gop v1.1.9
github.com/goplus/gox v1.12.8
github.com/goplus/mod v0.12.1
github.com/goplus/reflectx v1.2.1
github.com/goplus/gop v1.2.0-pre.1.0.20240207161635-4085ba2e137f
github.com/goplus/gox v1.14.7
github.com/goplus/mod v0.13.0
github.com/goplus/reflectx v1.2.2
github.com/modern-go/reflect2 v1.0.2
github.com/peterh/liner v1.2.2
github.com/qiniu/x v1.13.2
github.com/qiniu/x v1.13.3
github.com/visualfc/funcval v0.1.4
github.com/visualfc/gid v0.1.0
github.com/visualfc/goembed v0.3.2
github.com/visualfc/xtype v0.2.0
golang.org/x/mod v0.14.0
golang.org/x/tools v0.14.0
golang.org/x/tools v0.17.0
)
Loading

0 comments on commit 72a1ace

Please sign in to comment.