Merge pull request #995 from cpunion/fix-llgo-test-crash

Build on Go 1.24, compatible with Go version directive 1.20-1.24 in go.mod
This commit is contained in:
xushiwei
2025-02-21 06:04:21 +08:00
committed by GitHub
32 changed files with 7543 additions and 5223 deletions

6
.github/codecov.yml vendored
View File

@@ -1,3 +1,9 @@
coverage:
ignore:
- "compiler/chore"
- "compiler/cmd/internal"
- "compiler/internal/build"
- "compiler/internal/llgen"
- "compiler/internal/mockable"
- "compiler/internal/packages"
- "compiler/internal/typepatch"

View File

@@ -15,7 +15,7 @@ jobs:
- name: Set up Go
uses: ./.github/actions/setup-go
with:
go-version: '1.23.6'
go-version: '1.24.0'
- name: Check formatting
run: |

View File

@@ -38,7 +38,7 @@ jobs:
- name: Set up Go
uses: ./.github/actions/setup-go
with:
go-version: '1.23.6'
go-version: '1.24.0'
- name: Build
run: go build -v ./...

View File

@@ -10,7 +10,7 @@ on:
branches: [ "**" ]
jobs:
llgo-test:
llgo:
continue-on-error: true
strategy:
matrix:
@@ -18,7 +18,7 @@ jobs:
- macos-latest
- ubuntu-24.04
llvm: [18]
go: ['1.20.14', '1.21.13', '1.22.12', '1.23.6']
go: ['1.20.14', '1.21.13', '1.22.12', '1.23.6', '1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
@@ -38,7 +38,7 @@ jobs:
- name: Set up Go for build
uses: ./.github/actions/setup-go
with:
go-version: '1.23.6'
go-version: '1.24.0'
- name: Install
working-directory: compiler
@@ -94,13 +94,68 @@ jobs:
echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}"
bash _lldb/runtest.sh -v
helloworld-test:
test:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [18]
go: ['1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Install further optional dependencies for demos
run: |
wget -P ./_demo/llama2-c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin
py_deps=(
numpy # for github.com/goplus/llgo/py/numpy
torch # for github.com/goplus/llgo/py/torch
)
pip3.12 install --break-system-packages "${py_deps[@]}"
- name: Set up Go for build
uses: ./.github/actions/setup-go
with:
go-version: '1.24.0'
- name: Install
working-directory: compiler
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Set up Go for testing
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
- name: Verify Go version
run: |
go_version=$(go version | cut -d' ' -f3 | sed 's/go//')
if [[ "$go_version" != "${{matrix.go}}"* ]]; then
echo "Expected Go version ${{matrix.go}}, but got $go_version"
exit 1
fi
echo "Using Go version: $go_version"
- name: run llgo test
run: |
cd _demo
llgo test -v ./runtest
hello:
continue-on-error: true
strategy:
matrix:
os: [ubuntu-24.04, macos-latest]
llvm: [18]
go: ['1.20.14', '1.21.13', '1.22.12', '1.23.6']
go: ['1.20.14', '1.21.13', '1.22.12', '1.23.6', '1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
@@ -112,7 +167,7 @@ jobs:
- name: Set up Go 1.23 for building llgo
uses: ./.github/actions/setup-go
with:
go-version: '1.23.6'
go-version: '1.24.0'
- name: Install llgo
working-directory: compiler
@@ -126,22 +181,36 @@ jobs:
go-version: ${{matrix.go}}
- name: Test Hello World with go.mod 1.20
if: startsWith(matrix.go, '1.20') || startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23')
if: startsWith(matrix.go, '1.20') || startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: '1.20'
- 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')
if: startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
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')
if: startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
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')
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')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: '1.24'

View File

@@ -32,7 +32,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x
go-version: 1.24.x
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:

View File

@@ -1,396 +1 @@
; ModuleID = 'github.com/goplus/llgo/compiler/cl/_testgo/cgobasic'
source_filename = "github.com/goplus/llgo/compiler/cl/_testgo/cgobasic"
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
@"github.com/goplus/llgo/runtime/internal/runtime.cgoAlwaysFalse" = external global i1, align 1
@_cgo_217b74f897b2_Cfunc__Cmalloc = external global i8, align 1
@_cgo_217b74f897b2_Cfunc_cos = external global i8, align 1
@_cgo_217b74f897b2_Cfunc_free = external global i8, align 1
@_cgo_217b74f897b2_Cfunc_log = external global i8, align 1
@_cgo_217b74f897b2_Cfunc_puts = external global i8, align 1
@_cgo_217b74f897b2_Cfunc_sin = external global i8, align 1
@_cgo_217b74f897b2_Cfunc_sqrt = external global i8, align 1
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc__Cmalloc" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_cos" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_free" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_log" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_puts" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_sin" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_sqrt" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.init$guard" = global i1 false, align 1
@0 = private unnamed_addr constant [13 x i8] c"Hello, World!", align 1
@1 = private unnamed_addr constant [29 x i8] c"Converted back to Go string: ", align 1
@2 = private unnamed_addr constant [23 x i8] c"Length-limited string: ", align 1
@3 = private unnamed_addr constant [33 x i8] c"Converted back to Go byte slice: ", align 1
@_llgo_float64 = linkonce global ptr null, align 8
@4 = private unnamed_addr constant [14 x i8] c"sqrt(%v) = %v\0A", align 1
@5 = private unnamed_addr constant [13 x i8] c"sin(%v) = %v\0A", align 1
@6 = private unnamed_addr constant [13 x i8] c"cos(%v) = %v\0A", align 1
@7 = private unnamed_addr constant [13 x i8] c"log(%v) = %v\0A", align 1
@_llgo_byte = linkonce global ptr null, align 8
@"[]_llgo_byte" = linkonce global ptr null, align 8
@_llgo_Pointer = linkonce global ptr null, align 8
define double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_cos"(double %0) {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%2 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_cos", align 8
%3 = load ptr, ptr %2, align 8
%4 = call double %3(double %0)
ret double %4
}
define [0 x i8] @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_free"(ptr %0) {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%2 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_free", align 8
%3 = load ptr, ptr %2, align 8
%4 = call [0 x i8] %3(ptr %0)
ret [0 x i8] %4
}
define double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_log"(double %0) {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%2 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_log", align 8
%3 = load ptr, ptr %2, align 8
%4 = call double %3(double %0)
ret double %4
}
define i32 @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_puts"(ptr %0) {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%2 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_puts", align 8
%3 = load ptr, ptr %2, align 8
%4 = call i32 %3(ptr %0)
ret i32 %4
}
define double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_sin"(double %0) {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%2 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_sin", align 8
%3 = load ptr, ptr %2, align 8
%4 = call double %3(double %0)
ret double %4
}
define double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_sqrt"(double %0) {
_llgo_0:
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%2 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_sqrt", align 8
%3 = load ptr, ptr %2, align 8
%4 = call double %3(double %0)
ret double %4
}
define ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cgo_ptr"(ptr %0) {
_llgo_0:
ret ptr %0
}
declare void @runtime.cgoUse(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
declare void @runtime.cgoCheckResult(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.init"() {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.init$guard", align 1
call void @syscall.init()
call void @fmt.init()
call void @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.init$after"()
store ptr @_cgo_217b74f897b2_Cfunc_cos, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_cos", align 8
store ptr @_cgo_217b74f897b2_Cfunc_free, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_free", align 8
store ptr @_cgo_217b74f897b2_Cfunc_log, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_log", align 8
store ptr @_cgo_217b74f897b2_Cfunc_puts, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_puts", align 8
store ptr @_cgo_217b74f897b2_Cfunc_sin, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_sin", align 8
store ptr @_cgo_217b74f897b2_Cfunc_sqrt, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc_sqrt", align 8
store ptr @_cgo_217b74f897b2_Cfunc__Cmalloc, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._cgo_217b74f897b2_Cfunc__Cmalloc", align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main"() {
_llgo_0:
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.CString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 13 })
store ptr %1, ptr %0, align 8
%2 = load ptr, ptr %0, align 8
%3 = call i32 @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_puts"(ptr %2)
%4 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 24)
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 4)
%6 = getelementptr inbounds i8, ptr %5, i64 0
store i8 65, ptr %6, align 1
%7 = getelementptr inbounds i8, ptr %5, i64 1
store i8 66, ptr %7, align 1
%8 = getelementptr inbounds i8, ptr %5, i64 2
store i8 67, ptr %8, align 1
%9 = getelementptr inbounds i8, ptr %5, i64 3
store i8 68, ptr %9, align 1
%10 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %5, 0
%11 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %10, i64 4, 1
%12 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %11, i64 4, 2
store %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %12, ptr %4, align 8
%13 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%14 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
%15 = getelementptr inbounds { ptr }, ptr %14, i32 0, i32 0
store ptr %4, ptr %15, align 8
%16 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$1", ptr undef }, ptr %14, 1
%17 = extractvalue { ptr, ptr } %16, 1
%18 = extractvalue { ptr, ptr } %16, 0
%19 = call ptr %18(ptr %17)
store ptr %19, ptr %13, align 8
%20 = load ptr, ptr %0, align 8
%21 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.GoString"(ptr %20)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 29 })
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %21)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%22 = load ptr, ptr %0, align 8
%23 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.GoStringN"(ptr %22, i32 5)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 23 })
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %23)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%24 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
%25 = getelementptr inbounds { ptr }, ptr %24, i32 0, i32 0
store ptr %13, ptr %25, align 8
%26 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$2", ptr undef }, ptr %24, 1
%27 = extractvalue { ptr, ptr } %26, 1
%28 = extractvalue { ptr, ptr } %26, 0
%29 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %28(ptr %27)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 33 })
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %29)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%30 = call double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_sqrt"(double 2.000000e+00)
%31 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 32)
%32 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %31, i64 0
%33 = load ptr, ptr @_llgo_float64, align 8
%34 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %33, 0
%35 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %34, ptr inttoptr (i64 4611686018427387904 to ptr), 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %35, ptr %32, align 8
%36 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %31, i64 1
%37 = load ptr, ptr @_llgo_float64, align 8
%38 = bitcast double %30 to i64
%39 = inttoptr i64 %38 to ptr
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %37, 0
%41 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %40, ptr %39, 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %41, ptr %36, align 8
%42 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %31, 0
%43 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %42, i64 2, 1
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %43, i64 2, 2
%45 = call { i64, %"github.com/goplus/llgo/runtime/internal/runtime.iface" } @fmt.Printf(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 14 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %44)
%46 = call double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_sin"(double 2.000000e+00)
%47 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 32)
%48 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %47, i64 0
%49 = load ptr, ptr @_llgo_float64, align 8
%50 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %49, 0
%51 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %50, ptr inttoptr (i64 4611686018427387904 to ptr), 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %51, ptr %48, align 8
%52 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %47, i64 1
%53 = load ptr, ptr @_llgo_float64, align 8
%54 = bitcast double %46 to i64
%55 = inttoptr i64 %54 to ptr
%56 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %53, 0
%57 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %56, ptr %55, 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %57, ptr %52, align 8
%58 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %47, 0
%59 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %58, i64 2, 1
%60 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %59, i64 2, 2
%61 = call { i64, %"github.com/goplus/llgo/runtime/internal/runtime.iface" } @fmt.Printf(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 13 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %60)
%62 = call double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_cos"(double 2.000000e+00)
%63 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 32)
%64 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %63, i64 0
%65 = load ptr, ptr @_llgo_float64, align 8
%66 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %65, 0
%67 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %66, ptr inttoptr (i64 4611686018427387904 to ptr), 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %67, ptr %64, align 8
%68 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %63, i64 1
%69 = load ptr, ptr @_llgo_float64, align 8
%70 = bitcast double %62 to i64
%71 = inttoptr i64 %70 to ptr
%72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %69, 0
%73 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %72, ptr %71, 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %73, ptr %68, align 8
%74 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %63, 0
%75 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %74, i64 2, 1
%76 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %75, i64 2, 2
%77 = call { i64, %"github.com/goplus/llgo/runtime/internal/runtime.iface" } @fmt.Printf(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 13 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %76)
%78 = call double @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_log"(double 2.000000e+00)
%79 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 32)
%80 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %79, i64 0
%81 = load ptr, ptr @_llgo_float64, align 8
%82 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %81, 0
%83 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %82, ptr inttoptr (i64 4611686018427387904 to ptr), 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %83, ptr %80, align 8
%84 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %79, i64 1
%85 = load ptr, ptr @_llgo_float64, align 8
%86 = bitcast double %78 to i64
%87 = inttoptr i64 %86 to ptr
%88 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %85, 0
%89 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %88, ptr %87, 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %89, ptr %84, align 8
%90 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %79, 0
%91 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %90, i64 2, 1
%92 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %91, i64 2, 2
%93 = call { i64, %"github.com/goplus/llgo/runtime/internal/runtime.iface" } @fmt.Printf(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 13 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %92)
%94 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
%95 = getelementptr inbounds { ptr }, ptr %94, i32 0, i32 0
store ptr %0, ptr %95, align 8
%96 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$3", ptr undef }, ptr %94, 1
%97 = extractvalue { ptr, ptr } %96, 1
%98 = extractvalue { ptr, ptr } %96, 0
call void %98(ptr %97)
%99 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
%100 = getelementptr inbounds { ptr }, ptr %99, i32 0, i32 0
store ptr %13, ptr %100, align 8
%101 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$4", ptr undef }, ptr %99, 1
%102 = extractvalue { ptr, ptr } %101, 1
%103 = extractvalue { ptr, ptr } %101, 0
call void %103(ptr %102)
ret void
}
define ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$1"(ptr %0) {
_llgo_0:
%1 = load { ptr }, ptr %0, align 8
%2 = extractvalue { ptr } %1, 0
%3 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %2, align 8
%4 = load ptr, ptr @_llgo_byte, align 8
%5 = load ptr, ptr @"[]_llgo_byte", align 8
%6 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
store %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %3, ptr %6, align 8
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %5, 0
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %7, ptr %6, 1
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.CBytes"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %3)
ret ptr %9
}
define %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$2"(ptr %0) {
_llgo_0:
%1 = load { ptr }, ptr %0, align 8
%2 = extractvalue { ptr } %1, 0
%3 = load ptr, ptr %2, align 8
%4 = load ptr, ptr @_llgo_Pointer, align 8
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5, ptr %3, 1
%7 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.GoBytes"(ptr %3, i32 4)
ret %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %7
}
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$3"(ptr %0) {
_llgo_0:
%1 = load { ptr }, ptr %0, align 8
%2 = extractvalue { ptr } %1, 0
%3 = load ptr, ptr %2, align 8
%4 = load ptr, ptr @_llgo_Pointer, align 8
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5, ptr %3, 1
%7 = call [0 x i8] @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_free"(ptr %3)
ret void
}
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.main$4"(ptr %0) {
_llgo_0:
%1 = load { ptr }, ptr %0, align 8
%2 = extractvalue { ptr } %1, 0
%3 = load ptr, ptr %2, align 8
%4 = load ptr, ptr @_llgo_Pointer, align 8
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5, ptr %3, 1
%7 = call [0 x i8] @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic._Cfunc_free"(ptr %3)
ret void
}
declare void @runtime.throw(%"github.com/goplus/llgo/runtime/internal/runtime.String")
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
declare void @syscall.init()
declare void @fmt.init()
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.CString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
declare %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.GoString"(ptr)
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
declare %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.GoStringN"(ptr, i64)
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice")
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgobasic.init$after"() {
_llgo_0:
%0 = load ptr, ptr @_llgo_float64, align 8
%1 = icmp eq ptr %0, null
br i1 %1, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 46)
store ptr %2, ptr @_llgo_float64, align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
%3 = load ptr, ptr @_llgo_byte, align 8
%4 = icmp eq ptr %3, null
br i1 %4, label %_llgo_3, label %_llgo_4
_llgo_3: ; preds = %_llgo_2
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
store ptr %5, ptr @_llgo_byte, align 8
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
%6 = load ptr, ptr @"[]_llgo_byte", align 8
%7 = icmp eq ptr %6, null
br i1 %7, label %_llgo_5, label %_llgo_6
_llgo_5: ; preds = %_llgo_4
%8 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.SliceOf"(ptr %8)
store ptr %9, ptr @"[]_llgo_byte", align 8
br label %_llgo_6
_llgo_6: ; preds = %_llgo_5, %_llgo_4
%10 = load ptr, ptr @_llgo_Pointer, align 8
%11 = icmp eq ptr %10, null
br i1 %11, label %_llgo_7, label %_llgo_8
_llgo_7: ; preds = %_llgo_6
%12 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 58)
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %12)
store ptr %12, ptr @_llgo_Pointer, align 8
br label %_llgo_8
_llgo_8: ; preds = %_llgo_7, %_llgo_6
ret void
}
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
declare { i64, %"github.com/goplus/llgo/runtime/internal/runtime.iface" } @fmt.Printf(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.SliceOf"(ptr)
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.CBytes"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice")
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
declare %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.GoBytes"(ptr, i64)
;

View File

@@ -1,171 +1 @@
; ModuleID = 'github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles'
source_filename = "github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles"
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
%"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___3" = type { i32 }
%"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___4" = type { i32, i32 }
%"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___0" = type { i32, i32, i32 }
%"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___1" = type { i32, i32, i32, i32 }
%"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___2" = type { i32, i32, i32, i32, i32 }
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
@"github.com/goplus/llgo/runtime/internal/runtime.cgoAlwaysFalse" = external global i1, align 1
@_cgo_023ff89410ef_Cfunc_test_structs = external global i8, align 1
@"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._cgo_023ff89410ef_Cfunc_test_structs" = global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles.init$guard" = global i1 false, align 1
@"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_int" = linkonce global ptr null, align 8
@0 = private unnamed_addr constant [52 x i8] c"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles", align 1
@1 = private unnamed_addr constant [10 x i8] c"_Ctype_int", align 1
@_llgo_int32 = linkonce global ptr null, align 8
@2 = private unnamed_addr constant [19 x i8] c"test_structs failed", align 1
@_llgo_string = linkonce global ptr null, align 8
define i32 @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Cfunc_test_structs"(ptr %0, ptr %1, ptr %2, ptr %3, ptr %4) {
_llgo_0:
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%6 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._cgo_023ff89410ef_Cfunc_test_structs", align 8
%7 = load ptr, ptr %6, align 8
%8 = call i32 %7(ptr %0, ptr %1, ptr %2, ptr %3, ptr %4)
ret i32 %8
}
define ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Cgo_ptr"(ptr %0) {
_llgo_0:
ret ptr %0
}
declare void @runtime.cgoUse(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
declare void @runtime.cgoCheckResult(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles.init"() {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles.init$guard", align 1
call void @syscall.init()
call void @fmt.init()
call void @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles.init$after"()
store ptr @_cgo_023ff89410ef_Cfunc_test_structs, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._cgo_023ff89410ef_Cfunc_test_structs", align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles.main"() {
_llgo_0:
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 4)
%1 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___3", ptr %0, i32 0, i32 0
store i32 1, ptr %1, align 4
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%3 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___4", ptr %2, i32 0, i32 0
%4 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___4", ptr %2, i32 0, i32 1
store i32 1, ptr %3, align 4
store i32 2, ptr %4, align 4
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 12)
%6 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___0", ptr %5, i32 0, i32 0
%7 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___0", ptr %5, i32 0, i32 1
%8 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___0", ptr %5, i32 0, i32 2
store i32 1, ptr %6, align 4
store i32 2, ptr %7, align 4
store i32 3, ptr %8, align 4
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
%10 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___1", ptr %9, i32 0, i32 0
%11 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___1", ptr %9, i32 0, i32 1
%12 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___1", ptr %9, i32 0, i32 2
%13 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___1", ptr %9, i32 0, i32 3
store i32 1, ptr %10, align 4
store i32 2, ptr %11, align 4
store i32 3, ptr %12, align 4
store i32 4, ptr %13, align 4
%14 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 20)
%15 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___2", ptr %14, i32 0, i32 0
%16 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___2", ptr %14, i32 0, i32 1
%17 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___2", ptr %14, i32 0, i32 2
%18 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___2", ptr %14, i32 0, i32 3
%19 = getelementptr inbounds %"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_struct___2", ptr %14, i32 0, i32 4
store i32 1, ptr %15, align 4
store i32 2, ptr %16, align 4
store i32 3, ptr %17, align 4
store i32 4, ptr %18, align 4
store i32 5, ptr %19, align 4
%20 = call i32 @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Cfunc_test_structs"(ptr %0, ptr %2, ptr %5, ptr %9, ptr %14)
%21 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
%22 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %21, i64 0
%23 = load ptr, ptr @"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_int", align 8
%24 = sext i32 %20 to i64
%25 = inttoptr i64 %24 to ptr
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %23, 0
%27 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %26, ptr %25, 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %27, ptr %22, align 8
%28 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %21, 0
%29 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %28, i64 1, 1
%30 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %29, i64 1, 2
%31 = call { i64, %"github.com/goplus/llgo/runtime/internal/runtime.iface" } @fmt.Println(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %30)
%32 = icmp ne i32 %20, 35
br i1 %32, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%33 = load ptr, ptr @_llgo_string, align 8
%34 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 19 }, ptr %34, align 8
%35 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %33, 0
%36 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %35, ptr %34, 1
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %36)
unreachable
_llgo_2: ; preds = %_llgo_0
ret void
}
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
declare void @syscall.init()
declare void @fmt.init()
define void @"github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles.init$after"() {
_llgo_0:
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 52 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 10 }, i64 5, i64 4, i64 0, i64 0)
store ptr %0, ptr @"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/cgocfiles._Ctype_int", align 8
%1 = load ptr, ptr @_llgo_int32, align 8
%2 = icmp eq ptr %1, null
br i1 %2, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 37)
store ptr %3, ptr @_llgo_int32, align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
%4 = load ptr, ptr @_llgo_int32, align 8
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %0, ptr %4, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
%5 = load ptr, ptr @_llgo_string, align 8
%6 = icmp eq ptr %5, null
br i1 %6, label %_llgo_3, label %_llgo_4
_llgo_3: ; preds = %_llgo_2
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
store ptr %7, ptr @_llgo_string, align 8
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
ret void
}
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
declare { i64, %"github.com/goplus/llgo/runtime/internal/runtime.iface" } @fmt.Println(%"github.com/goplus/llgo/runtime/internal/runtime.Slice")
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
;

View File

@@ -21,15 +21,15 @@ source_filename = "github.com/goplus/llgo/compiler/cl/_testgo/reader"
@1 = private unnamed_addr constant [8 x i8] c"WriterTo", align 1
@"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.Writer" = linkonce global ptr null, align 8
@2 = private unnamed_addr constant [6 x i8] c"Writer", align 1
@_llgo_byte = linkonce global ptr null, align 8
@"[]_llgo_byte" = linkonce global ptr null, align 8
@_llgo_uint8 = linkonce global ptr null, align 8
@"[]_llgo_uint8" = linkonce global ptr null, align 8
@_llgo_int = linkonce global ptr null, align 8
@_llgo_error = linkonce global ptr null, align 8
@3 = private unnamed_addr constant [5 x i8] c"error", align 1
@_llgo_string = linkonce global ptr null, align 8
@"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to" = linkonce global ptr null, align 8
@4 = private unnamed_addr constant [5 x i8] c"Error", align 1
@"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY" = linkonce global ptr null, align 8
@"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk" = linkonce global ptr null, align 8
@5 = private unnamed_addr constant [5 x i8] c"Write", align 1
@_llgo_int64 = linkonce global ptr null, align 8
@"_llgo_func$-AbPruiRubbHNU-z4sJm4RCuzmjax87Xu2vXpjP2-tg" = linkonce global ptr null, align 8
@@ -43,7 +43,7 @@ source_filename = "github.com/goplus/llgo/compiler/cl/_testgo/reader"
@"_llgo_struct$zCmlqK6oRFYpWtMvv6Pe6GqaMY8pH8Js9Fj6dqbrNYo" = linkonce global ptr null, align 8
@10 = private unnamed_addr constant [5 x i8] c"Close", align 1
@"_llgo_func$8rsrSd_r3UHd_2DiYTyaOKR7BYkei4zw5ysG35KF38w" = linkonce global ptr null, align 8
@"_llgo_iface$L2Ik-AJcd0jsoBw5fQ07pQpfUM-kh78Wn2bOeak6M3I" = linkonce global ptr null, align 8
@"_llgo_iface$2bmbYDBStAIdmbXPPn7qIaCcpVcj2I5k6AqgqwAfh84" = linkonce global ptr null, align 8
@"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.nopCloser" = linkonce global ptr null, align 8
@11 = private unnamed_addr constant [9 x i8] c"nopCloser", align 1
@"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.StringWriter" = linkonce global ptr null, align 8
@@ -63,9 +63,9 @@ source_filename = "github.com/goplus/llgo/compiler/cl/_testgo/reader"
@21 = private unnamed_addr constant [3 x i8] c"Len", align 1
@"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA" = linkonce global ptr null, align 8
@22 = private unnamed_addr constant [6 x i8] c"ReadAt", align 1
@"_llgo_func$TY5Etv7VBKM_-2um1BDEeQEE2lP06Pt6G54EuKiNC3c" = linkonce global ptr null, align 8
@"_llgo_func$QoHVzMQ4PMXOd5kbZvdARJn-o_00R6hNyf6LoVk3X_4" = linkonce global ptr null, align 8
@23 = private unnamed_addr constant [8 x i8] c"ReadByte", align 1
@"_llgo_func$6bvVpCcGPUc3z_EmsQTHB0AVT1hP5-NNLVRgm43teCM" = linkonce global ptr null, align 8
@"_llgo_func$lukqSsfDYBoIp_R8GMojGkZnrYDqaq2iHn8RkCjW7iQ" = linkonce global ptr null, align 8
@24 = private unnamed_addr constant [8 x i8] c"ReadRune", align 1
@_llgo_rune = linkonce global ptr null, align 8
@"_llgo_func$CB0CO6hV_feSzhi4pz1P4omza2fKNK930wvOR1T33fU" = linkonce global ptr null, align 8
@@ -76,7 +76,7 @@ source_filename = "github.com/goplus/llgo/compiler/cl/_testgo/reader"
@27 = private unnamed_addr constant [10 x i8] c"UnreadByte", align 1
@28 = private unnamed_addr constant [10 x i8] c"UnreadRune", align 1
@"*_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.stringReader" = linkonce global ptr null, align 8
@"_llgo_iface$OFO8Us9n8ajWCabGedeuoJ-Za2zAMk4Jh0FunAcUCFE" = linkonce global ptr null, align 8
@"_llgo_iface$uycIKA3bbxRhudEjW1hHKWKdLqHQsCVy8NdW1bkQmNw" = linkonce global ptr null, align 8
@"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.errorString" = linkonce global ptr null, align 8
@29 = private unnamed_addr constant [11 x i8] c"errorString", align 1
@"github.com/goplus/llgo/compiler/cl/_testgo/reader.struct$QTufDJA9wEDzuzgkA-ZSrLqW-B6lWN8O25mTSglAoLQ" = linkonce global ptr null, align 8
@@ -108,7 +108,7 @@ _llgo_1: ; preds = %_llgo_5
%8 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/compiler/cl/_testgo/reader.nopCloserWriterTo" %6, ptr %8, align 8
%9 = load ptr, ptr @"_llgo_func$8rsrSd_r3UHd_2DiYTyaOKR7BYkei4zw5ysG35KF38w", align 8
%10 = load ptr, ptr @"_llgo_iface$L2Ik-AJcd0jsoBw5fQ07pQpfUM-kh78Wn2bOeak6M3I", align 8
%10 = load ptr, ptr @"_llgo_iface$2bmbYDBStAIdmbXPPn7qIaCcpVcj2I5k6AqgqwAfh84", align 8
%11 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %10, ptr %7)
%12 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %11, 0
%13 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %12, ptr %8, 1
@@ -123,7 +123,7 @@ _llgo_2: ; preds = %_llgo_5
%17 = load ptr, ptr @"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.nopCloser", align 8
%18 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/compiler/cl/_testgo/reader.nopCloser" %16, ptr %18, align 8
%19 = load ptr, ptr @"_llgo_iface$L2Ik-AJcd0jsoBw5fQ07pQpfUM-kh78Wn2bOeak6M3I", align 8
%19 = load ptr, ptr @"_llgo_iface$2bmbYDBStAIdmbXPPn7qIaCcpVcj2I5k6AqgqwAfh84", align 8
%20 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %19, ptr %17)
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %20, 0
%22 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %21, ptr %18, 1
@@ -327,7 +327,7 @@ _llgo_0:
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @16, i64 11 }, ptr %1, align 8
%2 = load ptr, ptr @"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.stringReader", align 8
%3 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.stringReader", align 8
%4 = load ptr, ptr @"_llgo_iface$OFO8Us9n8ajWCabGedeuoJ-Za2zAMk4Jh0FunAcUCFE", align 8
%4 = load ptr, ptr @"_llgo_iface$uycIKA3bbxRhudEjW1hHKWKdLqHQsCVy8NdW1bkQmNw", align 8
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %4, ptr %3)
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %5, 0
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %6, ptr %0, 1
@@ -944,29 +944,29 @@ _llgo_3: ; preds = %_llgo_2
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
%6 = load ptr, ptr @_llgo_byte, align 8
%6 = load ptr, ptr @_llgo_uint8, align 8
%7 = icmp eq ptr %6, null
br i1 %7, label %_llgo_5, label %_llgo_6
_llgo_5: ; preds = %_llgo_4
%8 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
store ptr %8, ptr @_llgo_byte, align 8
store ptr %8, ptr @_llgo_uint8, align 8
br label %_llgo_6
_llgo_6: ; preds = %_llgo_5, %_llgo_4
%9 = load ptr, ptr @_llgo_byte, align 8
%10 = load ptr, ptr @"[]_llgo_byte", align 8
%9 = load ptr, ptr @_llgo_uint8, align 8
%10 = load ptr, ptr @"[]_llgo_uint8", align 8
%11 = icmp eq ptr %10, null
br i1 %11, label %_llgo_7, label %_llgo_8
_llgo_7: ; preds = %_llgo_6
%12 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
%13 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.SliceOf"(ptr %12)
store ptr %13, ptr @"[]_llgo_byte", align 8
store ptr %13, ptr @"[]_llgo_uint8", align 8
br label %_llgo_8
_llgo_8: ; preds = %_llgo_7, %_llgo_6
%14 = load ptr, ptr @"[]_llgo_byte", align 8
%14 = load ptr, ptr @"[]_llgo_uint8", align 8
%15 = load ptr, ptr @_llgo_int, align 8
%16 = icmp eq ptr %15, null
br i1 %16, label %_llgo_9, label %_llgo_10
@@ -1037,10 +1037,10 @@ _llgo_17: ; preds = %_llgo_16
_llgo_18: ; preds = %_llgo_17, %_llgo_16
%46 = load ptr, ptr @_llgo_error, align 8
%47 = load ptr, ptr @"[]_llgo_byte", align 8
%47 = load ptr, ptr @"[]_llgo_uint8", align 8
%48 = load ptr, ptr @_llgo_int, align 8
%49 = load ptr, ptr @_llgo_error, align 8
%50 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%50 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
%51 = icmp eq ptr %50, null
br i1 %51, label %_llgo_19, label %_llgo_20
@@ -1061,11 +1061,11 @@ _llgo_19: ; preds = %_llgo_18
%62 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %61, i64 2, 2
%63 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %56, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %62, i1 false)
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %63)
store ptr %63, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
store ptr %63, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
br label %_llgo_20
_llgo_20: ; preds = %_llgo_19, %_llgo_18
%64 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%64 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
br i1 %5, label %_llgo_21, label %_llgo_22
_llgo_21: ; preds = %_llgo_20
@@ -1165,8 +1165,8 @@ _llgo_31: ; preds = %_llgo_30
br label %_llgo_32
_llgo_32: ; preds = %_llgo_31, %_llgo_30
%114 = load ptr, ptr @"[]_llgo_byte", align 8
%115 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%114 = load ptr, ptr @"[]_llgo_uint8", align 8
%115 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
br i1 %113, label %_llgo_33, label %_llgo_34
_llgo_33: ; preds = %_llgo_32
@@ -1222,7 +1222,7 @@ _llgo_36: ; preds = %_llgo_35, %_llgo_34
%149 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @10, i64 5 }, ptr undef, ptr undef, ptr undef }, ptr %145, 1
%150 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %149, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*nopCloserWriterTo).Close", 2
%151 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %150, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.nopCloserWriterTo.Close", 3
%152 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%152 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
%153 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 4 }, ptr undef, ptr undef, ptr undef }, ptr %152, 1
%154 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %153, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*nopCloserWriterTo).Read", 2
%155 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %154, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*nopCloserWriterTo).Read", 3
@@ -1258,8 +1258,8 @@ _llgo_36: ; preds = %_llgo_35, %_llgo_34
%179 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %178, i64 3, 2
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %110, ptr %131, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %172, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %179)
%180 = load ptr, ptr @"_llgo_func$8rsrSd_r3UHd_2DiYTyaOKR7BYkei4zw5ysG35KF38w", align 8
%181 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%182 = load ptr, ptr @"_llgo_iface$L2Ik-AJcd0jsoBw5fQ07pQpfUM-kh78Wn2bOeak6M3I", align 8
%181 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
%182 = load ptr, ptr @"_llgo_iface$2bmbYDBStAIdmbXPPn7qIaCcpVcj2I5k6AqgqwAfh84", align 8
%183 = icmp eq ptr %182, null
br i1 %183, label %_llgo_37, label %_llgo_38
@@ -1275,7 +1275,7 @@ _llgo_37: ; preds = %_llgo_36
%190 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %189, i64 2, 1
%191 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %190, i64 2, 2
%192 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 49 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %191)
store ptr %192, ptr @"_llgo_iface$L2Ik-AJcd0jsoBw5fQ07pQpfUM-kh78Wn2bOeak6M3I", align 8
store ptr %192, ptr @"_llgo_iface$2bmbYDBStAIdmbXPPn7qIaCcpVcj2I5k6AqgqwAfh84", align 8
br label %_llgo_38
_llgo_38: ; preds = %_llgo_37, %_llgo_36
@@ -1289,7 +1289,7 @@ _llgo_38: ; preds = %_llgo_37, %_llgo_36
%199 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @10, i64 5 }, ptr undef, ptr undef, ptr undef }, ptr %195, 1
%200 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %199, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*nopCloser).Close", 2
%201 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %200, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.nopCloser.Close", 3
%202 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%202 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
%203 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 4 }, ptr undef, ptr undef, ptr undef }, ptr %202, 1
%204 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %203, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*nopCloser).Read", 2
%205 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %204, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*nopCloser).Read", 3
@@ -1431,17 +1431,17 @@ _llgo_48: ; preds = %_llgo_47, %_llgo_46
%288 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @21, i64 3 }, ptr undef, ptr undef, ptr undef }, ptr %287, 1
%289 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %288, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).Len", 2
%290 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %289, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).Len", 3
%291 = load ptr, ptr @"[]_llgo_byte", align 8
%292 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%291 = load ptr, ptr @"[]_llgo_uint8", align 8
%292 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
%293 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 4 }, ptr undef, ptr undef, ptr undef }, ptr %292, 1
%294 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %293, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).Read", 2
%295 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %294, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).Read", 3
%296 = load ptr, ptr @"[]_llgo_byte", align 8
%297 = load ptr, ptr @"[]_llgo_byte", align 8
%296 = load ptr, ptr @"[]_llgo_uint8", align 8
%297 = load ptr, ptr @"[]_llgo_uint8", align 8
%298 = load ptr, ptr @_llgo_int64, align 8
%299 = load ptr, ptr @_llgo_int, align 8
%300 = load ptr, ptr @_llgo_error, align 8
%301 = load ptr, ptr @"_llgo_func$TY5Etv7VBKM_-2um1BDEeQEE2lP06Pt6G54EuKiNC3c", align 8
%301 = load ptr, ptr @"_llgo_func$QoHVzMQ4PMXOd5kbZvdARJn-o_00R6hNyf6LoVk3X_4", align 8
%302 = icmp eq ptr %301, null
br i1 %302, label %_llgo_49, label %_llgo_50
@@ -1464,17 +1464,17 @@ _llgo_49: ; preds = %_llgo_48
%314 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %313, i64 2, 2
%315 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %308, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %314, i1 false)
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %315)
store ptr %315, ptr @"_llgo_func$TY5Etv7VBKM_-2um1BDEeQEE2lP06Pt6G54EuKiNC3c", align 8
store ptr %315, ptr @"_llgo_func$QoHVzMQ4PMXOd5kbZvdARJn-o_00R6hNyf6LoVk3X_4", align 8
br label %_llgo_50
_llgo_50: ; preds = %_llgo_49, %_llgo_48
%316 = load ptr, ptr @"_llgo_func$TY5Etv7VBKM_-2um1BDEeQEE2lP06Pt6G54EuKiNC3c", align 8
%316 = load ptr, ptr @"_llgo_func$QoHVzMQ4PMXOd5kbZvdARJn-o_00R6hNyf6LoVk3X_4", align 8
%317 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @22, i64 6 }, ptr undef, ptr undef, ptr undef }, ptr %316, 1
%318 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %317, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).ReadAt", 2
%319 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %318, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).ReadAt", 3
%320 = load ptr, ptr @_llgo_byte, align 8
%320 = load ptr, ptr @_llgo_uint8, align 8
%321 = load ptr, ptr @_llgo_error, align 8
%322 = load ptr, ptr @"_llgo_func$6bvVpCcGPUc3z_EmsQTHB0AVT1hP5-NNLVRgm43teCM", align 8
%322 = load ptr, ptr @"_llgo_func$lukqSsfDYBoIp_R8GMojGkZnrYDqaq2iHn8RkCjW7iQ", align 8
%323 = icmp eq ptr %322, null
br i1 %323, label %_llgo_51, label %_llgo_52
@@ -1493,11 +1493,11 @@ _llgo_51: ; preds = %_llgo_50
%333 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %332, i64 2, 2
%334 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %327, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %333, i1 false)
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %334)
store ptr %334, ptr @"_llgo_func$6bvVpCcGPUc3z_EmsQTHB0AVT1hP5-NNLVRgm43teCM", align 8
store ptr %334, ptr @"_llgo_func$lukqSsfDYBoIp_R8GMojGkZnrYDqaq2iHn8RkCjW7iQ", align 8
br label %_llgo_52
_llgo_52: ; preds = %_llgo_51, %_llgo_50
%335 = load ptr, ptr @"_llgo_func$6bvVpCcGPUc3z_EmsQTHB0AVT1hP5-NNLVRgm43teCM", align 8
%335 = load ptr, ptr @"_llgo_func$lukqSsfDYBoIp_R8GMojGkZnrYDqaq2iHn8RkCjW7iQ", align 8
%336 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @23, i64 8 }, ptr undef, ptr undef, ptr undef }, ptr %335, 1
%337 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %336, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).ReadByte", 2
%338 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %337, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/reader.(*stringReader).ReadByte", 3
@@ -1646,8 +1646,8 @@ _llgo_60: ; preds = %_llgo_59, %_llgo_58
%431 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %430)
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %431)
store ptr %431, ptr @"*_llgo_github.com/goplus/llgo/compiler/cl/_testgo/reader.stringReader", align 8
%432 = load ptr, ptr @"_llgo_func$06yPPin-fnDnxFKkLLcJ1GEUhIobjPimde7T_Id_hmY", align 8
%433 = load ptr, ptr @"_llgo_iface$OFO8Us9n8ajWCabGedeuoJ-Za2zAMk4Jh0FunAcUCFE", align 8
%432 = load ptr, ptr @"_llgo_func$G2hch9Iy9DrhKKsg70PbL54bK-XSl-1IUUORN17J2Dk", align 8
%433 = load ptr, ptr @"_llgo_iface$uycIKA3bbxRhudEjW1hHKWKdLqHQsCVy8NdW1bkQmNw", align 8
%434 = icmp eq ptr %433, null
br i1 %434, label %_llgo_61, label %_llgo_62
@@ -1660,7 +1660,7 @@ _llgo_61: ; preds = %_llgo_60
%439 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %438, i64 1, 1
%440 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %439, i64 1, 2
%441 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 49 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %440)
store ptr %441, ptr @"_llgo_iface$OFO8Us9n8ajWCabGedeuoJ-Za2zAMk4Jh0FunAcUCFE", align 8
store ptr %441, ptr @"_llgo_iface$uycIKA3bbxRhudEjW1hHKWKdLqHQsCVy8NdW1bkQmNw", align 8
br label %_llgo_62
_llgo_62: ; preds = %_llgo_61, %_llgo_60

View File

@@ -136,6 +136,7 @@ var convertTests = []struct {
}
}
*/
{V(byte(0)), V(byte(0))},
{V(int8(1)), V(int8(1))},
{V(int8(2)), V(uint8(2))},
{V(uint8(3)), V(int8(3))},

View File

@@ -13,18 +13,18 @@ source_filename = "github.com/goplus/llgo/compiler/cl/_testgo/struczero"
@"_llgo_github.com/goplus/llgo/compiler/cl/_testdata/foo.Foo" = linkonce global ptr null, align 8
@0 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/compiler/cl/_testdata/foo", align 1
@1 = private unnamed_addr constant [3 x i8] c"Foo", align 1
@_llgo_byte = linkonce global ptr null, align 8
@"*_llgo_byte" = linkonce global ptr null, align 8
@_llgo_uint8 = linkonce global ptr null, align 8
@"*_llgo_uint8" = linkonce global ptr null, align 8
@_llgo_float32 = linkonce global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$qQwZyFy_4JRalRxVVsVD8R09X5t58tWjTrtJPtHbEjs" = linkonce global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$gB-6lDCpZ0V7ma2GTPMARivfSutm75zh84uE5OqxsI4" = linkonce global ptr null, align 8
@2 = private unnamed_addr constant [2 x i8] c"pb", align 1
@3 = private unnamed_addr constant [1 x i8] c"F", align 1
@4 = private unnamed_addr constant [52 x i8] c"github.com/goplus/llgo/compiler/cl/_testgo/struczero", align 1
@5 = private unnamed_addr constant [2 x i8] c"Pb", align 1
@"_llgo_func$NfGSLZ1QiKRoFkKeqYSXE5hUU5bpeteSJKrbMNUzYRE" = linkonce global ptr null, align 8
@"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY" = linkonce global ptr null, align 8
@"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/struczero.bar" = linkonce global ptr null, align 8
@6 = private unnamed_addr constant [3 x i8] c"bar", align 1
@"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$Ci43nzKYkRLddRL_N4mkykxLXfJlqJGS5n04LKThPNo" = linkonce global ptr null, align 8
@"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$2215Oa2lkpk-YZ2pdVVs2mMqzhx1jppOCrAxbrX70ko" = linkonce global ptr null, align 8
@7 = private unnamed_addr constant [1 x i8] c"f", align 1
@8 = private unnamed_addr constant [6 x i8] c"notOk:", align 1
@@ -154,18 +154,18 @@ _llgo_1: ; preds = %_llgo_0
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
%3 = load ptr, ptr @_llgo_byte, align 8
%3 = load ptr, ptr @_llgo_uint8, align 8
%4 = icmp eq ptr %3, null
br i1 %4, label %_llgo_3, label %_llgo_4
_llgo_3: ; preds = %_llgo_2
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
store ptr %5, ptr @_llgo_byte, align 8
store ptr %5, ptr @_llgo_uint8, align 8
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
%6 = load ptr, ptr @_llgo_byte, align 8
%7 = load ptr, ptr @"*_llgo_byte", align 8
%6 = load ptr, ptr @_llgo_uint8, align 8
%7 = load ptr, ptr @"*_llgo_uint8", align 8
%8 = icmp eq ptr %7, null
br i1 %8, label %_llgo_5, label %_llgo_6
@@ -173,11 +173,11 @@ _llgo_5: ; preds = %_llgo_4
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
%10 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %9)
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %10)
store ptr %10, ptr @"*_llgo_byte", align 8
store ptr %10, ptr @"*_llgo_uint8", align 8
br label %_llgo_6
_llgo_6: ; preds = %_llgo_5, %_llgo_4
%11 = load ptr, ptr @"*_llgo_byte", align 8
%11 = load ptr, ptr @"*_llgo_uint8", align 8
%12 = load ptr, ptr @_llgo_float32, align 8
%13 = icmp eq ptr %12, null
br i1 %13, label %_llgo_7, label %_llgo_8
@@ -203,21 +203,21 @@ _llgo_8: ; preds = %_llgo_7, %_llgo_6
%25 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %24, i64 2, 1
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %25, i64 2, 2
%27 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 52 }, i64 16, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %26)
store ptr %27, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$qQwZyFy_4JRalRxVVsVD8R09X5t58tWjTrtJPtHbEjs", align 8
%28 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$qQwZyFy_4JRalRxVVsVD8R09X5t58tWjTrtJPtHbEjs", align 8
store ptr %27, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$gB-6lDCpZ0V7ma2GTPMARivfSutm75zh84uE5OqxsI4", align 8
%28 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$gB-6lDCpZ0V7ma2GTPMARivfSutm75zh84uE5OqxsI4", align 8
br i1 %2, label %_llgo_9, label %_llgo_10
_llgo_9: ; preds = %_llgo_8
%29 = load ptr, ptr @"*_llgo_byte", align 8
%30 = load ptr, ptr @"*_llgo_byte", align 8
%31 = load ptr, ptr @"_llgo_func$NfGSLZ1QiKRoFkKeqYSXE5hUU5bpeteSJKrbMNUzYRE", align 8
%29 = load ptr, ptr @"*_llgo_uint8", align 8
%30 = load ptr, ptr @"*_llgo_uint8", align 8
%31 = load ptr, ptr @"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY", align 8
%32 = icmp eq ptr %31, null
br i1 %32, label %_llgo_11, label %_llgo_12
_llgo_10: ; preds = %_llgo_12, %_llgo_8
%33 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 52 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 3 }, i64 25, i64 16, i64 0, i64 0)
store ptr %33, ptr @"_llgo_github.com/goplus/llgo/compiler/cl/_testgo/struczero.bar", align 8
%34 = load ptr, ptr @"*_llgo_byte", align 8
%34 = load ptr, ptr @"*_llgo_uint8", align 8
%35 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
%36 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %35)
%37 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 2 }, ptr %36, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
@@ -232,8 +232,8 @@ _llgo_10: ; preds = %_llgo_12, %_llgo_8
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %43, i64 2, 1
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %44, i64 2, 2
%46 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 52 }, i64 16, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %45)
store ptr %46, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$Ci43nzKYkRLddRL_N4mkykxLXfJlqJGS5n04LKThPNo", align 8
%47 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$Ci43nzKYkRLddRL_N4mkykxLXfJlqJGS5n04LKThPNo", align 8
store ptr %46, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$2215Oa2lkpk-YZ2pdVVs2mMqzhx1jppOCrAxbrX70ko", align 8
%47 = load ptr, ptr @"github.com/goplus/llgo/compiler/cl/_testgo/struczero.struct$2215Oa2lkpk-YZ2pdVVs2mMqzhx1jppOCrAxbrX70ko", align 8
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %33, ptr %47, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
ret void
@@ -250,11 +250,11 @@ _llgo_11: ; preds = %_llgo_9
%56 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %55, i64 1, 2
%57 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %51, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %56, i1 false)
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %57)
store ptr %57, ptr @"_llgo_func$NfGSLZ1QiKRoFkKeqYSXE5hUU5bpeteSJKrbMNUzYRE", align 8
store ptr %57, ptr @"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY", align 8
br label %_llgo_12
_llgo_12: ; preds = %_llgo_11, %_llgo_9
%58 = load ptr, ptr @"_llgo_func$NfGSLZ1QiKRoFkKeqYSXE5hUU5bpeteSJKrbMNUzYRE", align 8
%58 = load ptr, ptr @"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY", align 8
%59 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 2 }, ptr undef, ptr undef, ptr undef }, ptr %58, 1
%60 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %59, ptr @"github.com/goplus/llgo/compiler/cl/_testdata/foo.(*Foo).Pb", 2
%61 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %60, ptr @"github.com/goplus/llgo/compiler/cl/_testdata/foo.(*Foo).Pb", 3

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,9 @@ func main() {
data := []byte{'a', 'b', 'c'}
data = append(data, "def"...)
println(data)
fns := []func(){}
fns = append(fns, func() {})
println(fns)
var i any = 100
println(true, 0, 100, -100, uint(255), int32(-100), 0.0, 100.5, i, &i, uintptr(unsafe.Pointer(&i)))
var dst [3]byte

View File

@@ -247,13 +247,28 @@ _llgo_0:
%88 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %87, ptr @1, i64 3, i64 1)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%89 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
%90 = load ptr, ptr @_llgo_int, align 8
%91 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %90, 0
%92 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %91, ptr inttoptr (i64 100 to ptr), 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %92, ptr %89, align 8
%93 = load %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %89, align 8
%94 = ptrtoint ptr %89 to i64
%89 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 0)
%90 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %89, 0
%91 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %90, i64 0, 1
%92 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %91, i64 0, 2
%93 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
%94 = getelementptr inbounds { ptr, ptr }, ptr %93, i64 0
store { ptr, ptr } { ptr @"__llgo_stub.github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$1", ptr null }, ptr %94, align 8
%95 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %93, 0
%96 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %95, i64 1, 1
%97 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %96, i64 1, 2
%98 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %97, 0
%99 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %97, 1
%100 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %92, ptr %98, i64 %99, i64 16)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %100)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%101 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
%102 = load ptr, ptr @_llgo_int, align 8
%103 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %102, 0
%104 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %103, ptr inttoptr (i64 100 to ptr), 1
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %104, ptr %101, align 8
%105 = load %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %101, align 8
%106 = ptrtoint ptr %101 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 true)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 0)
@@ -270,48 +285,27 @@ _llgo_0:
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double 1.005000e+02)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintEface"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %93)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintEface"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %105)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr %89)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr %101)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %94)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %106)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%95 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 3)
%96 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%97 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %95, 0
%98 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %97, i64 3, 1
%99 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %98, i64 3, 2
%100 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88, 0
%101 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88, 1
%102 = call i64 @"github.com/goplus/llgo/runtime/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %99, ptr %100, i64 %101, i64 1)
store i64 %102, ptr %96, align 4
%103 = load i64, ptr %96, align 4
%104 = getelementptr inbounds i8, ptr %95, i64 0
%105 = load i8, ptr %104, align 1
%106 = getelementptr inbounds i8, ptr %95, i64 1
%107 = load i8, ptr %106, align 1
%108 = getelementptr inbounds i8, ptr %95, i64 2
%109 = load i8, ptr %108, align 1
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %103)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
%110 = zext i8 %105 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %110)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
%111 = zext i8 %107 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %111)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
%112 = zext i8 %109 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %112)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%113 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.NewSlice3"(ptr %95, i64 1, i64 3, i64 1, i64 3, i64 3)
%114 = call i64 @"github.com/goplus/llgo/runtime/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %113, ptr @2, i64 4, i64 1)
store i64 %114, ptr %96, align 4
%115 = load i64, ptr %96, align 4
%116 = getelementptr inbounds i8, ptr %95, i64 0
%107 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 3)
%108 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
%109 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %107, 0
%110 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %109, i64 3, 1
%111 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %110, i64 3, 2
%112 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88, 0
%113 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88, 1
%114 = call i64 @"github.com/goplus/llgo/runtime/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %111, ptr %112, i64 %113, i64 1)
store i64 %114, ptr %108, align 4
%115 = load i64, ptr %108, align 4
%116 = getelementptr inbounds i8, ptr %107, i64 0
%117 = load i8, ptr %116, align 1
%118 = getelementptr inbounds i8, ptr %95, i64 1
%118 = getelementptr inbounds i8, ptr %107, i64 1
%119 = load i8, ptr %118, align 1
%120 = getelementptr inbounds i8, ptr %95, i64 2
%120 = getelementptr inbounds i8, ptr %107, i64 2
%121 = load i8, ptr %120, align 1
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %115)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
@@ -324,120 +318,146 @@ _llgo_0:
%124 = zext i8 %121 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %124)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%125 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
%126 = getelementptr inbounds { ptr }, ptr %125, i32 0, i32 0
store ptr %96, ptr %126, align 8
%127 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$2", ptr undef }, ptr %125, 1
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.demo")
%125 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.NewSlice3"(ptr %107, i64 1, i64 3, i64 1, i64 3, i64 3)
%126 = call i64 @"github.com/goplus/llgo/runtime/internal/runtime.SliceCopy"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %125, ptr @2, i64 4, i64 1)
store i64 %126, ptr %108, align 4
%127 = load i64, ptr %108, align 4
%128 = getelementptr inbounds i8, ptr %107, i64 0
%129 = load i8, ptr %128, align 1
%130 = getelementptr inbounds i8, ptr %107, i64 1
%131 = load i8, ptr %130, align 1
%132 = getelementptr inbounds i8, ptr %107, i64 2
%133 = load i8, ptr %132, align 1
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %127)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.demo")
%134 = zext i8 %129 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %134)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$1")
%135 = zext i8 %131 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %135)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
%128 = extractvalue { ptr, ptr } %127, 0
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr %128)
%136 = zext i8 %133 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 %136)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%129 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewStringIter"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 7 })
%137 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
%138 = getelementptr inbounds { ptr }, ptr %137, i32 0, i32 0
store ptr %108, ptr %138, align 8
%139 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$3", ptr undef }, ptr %137, 1
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.demo")
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.demo")
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$2")
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
%140 = extractvalue { ptr, ptr } %139, 0
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr %140)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%141 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewStringIter"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 7 })
br label %_llgo_1
_llgo_1: ; preds = %_llgo_2, %_llgo_0
%130 = call { i1, i64, i32 } @"github.com/goplus/llgo/runtime/internal/runtime.StringIterNext"(ptr %129)
%131 = extractvalue { i1, i64, i32 } %130, 0
br i1 %131, label %_llgo_2, label %_llgo_3
%142 = call { i1, i64, i32 } @"github.com/goplus/llgo/runtime/internal/runtime.StringIterNext"(ptr %141)
%143 = extractvalue { i1, i64, i32 } %142, 0
br i1 %143, label %_llgo_2, label %_llgo_3
_llgo_2: ; preds = %_llgo_1
%132 = extractvalue { i1, i64, i32 } %130, 1
%133 = extractvalue { i1, i64, i32 } %130, 2
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %132)
%144 = extractvalue { i1, i64, i32 } %142, 1
%145 = extractvalue { i1, i64, i32 } %142, 2
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %144)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
%134 = sext i32 %133 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %134)
%146 = sext i32 %145 to i64
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %146)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
br label %_llgo_1
_llgo_3: ; preds = %_llgo_1
%135 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.Inf"(i64 1)
%136 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.Inf"(i64 -1)
%137 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.NaN"()
%138 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.NaN"()
%139 = call i1 @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.IsNaN"(double %138)
%140 = call i1 @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.IsNaN"(double 1.000000e+00)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %135)
%147 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.Inf"(i64 1)
%148 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.Inf"(i64 -1)
%149 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.NaN"()
%150 = call double @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.NaN"()
%151 = call i1 @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.IsNaN"(double %150)
%152 = call i1 @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.IsNaN"(double 1.000000e+00)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %147)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %136)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %148)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %137)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %149)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %139)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %151)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %140)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %152)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%141 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.StringToBytes"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 7 })
%142 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.StringToRunes"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 7 })
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %141)
%153 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.StringToBytes"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 7 })
%154 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.StringToRunes"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 7 })
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %153)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %142)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %154)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%143 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromBytes"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %141)
%144 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromRunes"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %142)
%145 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %141, 0
%146 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %141, 1
%147 = icmp sge i64 3, %146
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %147)
%148 = getelementptr inbounds i8, ptr %145, i64 3
%149 = load i8, ptr %148, align 1
%150 = sext i8 %149 to i32
%151 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromRune"(i32 %150)
%152 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %142, 0
%153 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %142, 1
%154 = icmp sge i64 0, %153
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %154)
%155 = getelementptr inbounds i32, ptr %152, i64 0
%156 = load i32, ptr %155, align 4
%157 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromRune"(i32 %156)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %143)
%155 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromBytes"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %153)
%156 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromRunes"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %154)
%157 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %153, 0
%158 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %153, 1
%159 = icmp sge i64 3, %158
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %159)
%160 = getelementptr inbounds i8, ptr %157, i64 3
%161 = load i8, ptr %160, align 1
%162 = sext i8 %161 to i32
%163 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromRune"(i32 %162)
%164 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %154, 0
%165 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %154, 1
%166 = icmp sge i64 0, %165
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %166)
%167 = getelementptr inbounds i32, ptr %164, i64 0
%168 = load i32, ptr %167, align 4
%169 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/runtime/internal/runtime.StringFromRune"(i32 %168)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %155)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %144)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %156)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %151)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %163)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %157)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %169)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
%158 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 })
%159 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%160 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%161 = xor i1 %160, true
%162 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%163 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 })
%164 = xor i1 %163, true
%165 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 })
%166 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%167 = xor i1 %166, true
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %158)
%170 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 })
%171 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%172 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%173 = xor i1 %172, true
%174 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%175 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 })
%176 = xor i1 %175, true
%177 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 })
%178 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringLess"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 3 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 3 })
%179 = xor i1 %178, true
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %170)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %159)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %171)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %161)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %173)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %162)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %174)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %164)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %176)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %165)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %177)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %167)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %179)
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
ret void
}
define void @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$1"() {
_llgo_0:
ret void
}
define void @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$2"() {
_llgo_0:
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 2 })
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
ret void
}
define void @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$2"(ptr %0) {
define void @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$3"(ptr %0) {
_llgo_0:
%1 = load { ptr }, ptr %0, align 8
%2 = extractvalue { ptr } %1, 0
@@ -463,6 +483,12 @@ declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"gi
declare %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr, i64, i64)
define linkonce void @"__llgo_stub.github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$1"(ptr %0) {
_llgo_0:
tail call void @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.main$1"()
ret void
}
define void @"github.com/goplus/llgo/compiler/cl/_testrt/builtin.init$after"() {
_llgo_0:
%0 = load ptr, ptr @_llgo_int, align 8

View File

@@ -9,8 +9,8 @@ source_filename = "github.com/goplus/llgo/compiler/cl/_testrt/namedslice"
@"_llgo_github.com/goplus/llgo/compiler/cl/_testrt/namedslice.MyBytes" = linkonce global ptr null, align 8
@0 = private unnamed_addr constant [53 x i8] c"github.com/goplus/llgo/compiler/cl/_testrt/namedslice", align 1
@1 = private unnamed_addr constant [7 x i8] c"MyBytes", align 1
@_llgo_byte = linkonce global ptr null, align 8
@"[]_llgo_byte" = linkonce global ptr null, align 8
@_llgo_uint8 = linkonce global ptr null, align 8
@"[]_llgo_uint8" = linkonce global ptr null, align 8
@2 = private unnamed_addr constant [9 x i8] c"bad slice", align 1
@_llgo_string = linkonce global ptr null, align 8
@@ -87,29 +87,29 @@ _llgo_1: ; preds = %_llgo_0
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
%3 = load ptr, ptr @_llgo_byte, align 8
%3 = load ptr, ptr @_llgo_uint8, align 8
%4 = icmp eq ptr %3, null
br i1 %4, label %_llgo_3, label %_llgo_4
_llgo_3: ; preds = %_llgo_2
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
store ptr %5, ptr @_llgo_byte, align 8
store ptr %5, ptr @_llgo_uint8, align 8
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
%6 = load ptr, ptr @_llgo_byte, align 8
%7 = load ptr, ptr @"[]_llgo_byte", align 8
%6 = load ptr, ptr @_llgo_uint8, align 8
%7 = load ptr, ptr @"[]_llgo_uint8", align 8
%8 = icmp eq ptr %7, null
br i1 %8, label %_llgo_5, label %_llgo_6
_llgo_5: ; preds = %_llgo_4
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
%10 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.SliceOf"(ptr %9)
store ptr %10, ptr @"[]_llgo_byte", align 8
store ptr %10, ptr @"[]_llgo_uint8", align 8
br label %_llgo_6
_llgo_6: ; preds = %_llgo_5, %_llgo_4
%11 = load ptr, ptr @"[]_llgo_byte", align 8
%11 = load ptr, ptr @"[]_llgo_uint8", align 8
br i1 %2, label %_llgo_7, label %_llgo_8
_llgo_7: ; preds = %_llgo_6

View File

@@ -1,6 +1,6 @@
module github.com/goplus/llgo/compiler
go 1.22.4
go 1.22.0
require (
github.com/goplus/gogen v1.16.6
@@ -9,12 +9,12 @@ require (
github.com/goplus/llvm v0.8.1
github.com/goplus/mod v0.13.17
github.com/qiniu/x v1.13.12
golang.org/x/tools v0.29.0
golang.org/x/tools v0.30.0
)
require (
golang.org/x/mod v0.22.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
)
replace github.com/goplus/llgo => ../

View File

@@ -8,9 +8,9 @@ github.com/goplus/mod v0.13.17 h1:aWp14xosENrh7t0/0qcIejDmQEiTgI3ou2+KoLDlSlE=
github.com/goplus/mod v0.13.17/go.mod h1:XlHf8mnQ4QkRDX14Of2tpywuHDd+JVpPStvh3egog+0=
github.com/qiniu/x v1.13.12 h1:UyAwja6dgKUOYWZMzzc02wLodwnZ7wmK/0XzRd0e78g=
github.com/qiniu/x v1.13.12/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=

View File

@@ -206,7 +206,7 @@ func Do(args []string, conf *Config) ([]Package, error) {
env := llvm.New("")
os.Setenv("PATH", env.BinDir()+":"+os.Getenv("PATH")) // TODO(xsw): check windows
output := mode != ModeBuild || conf.OutFile != ""
output := conf.OutFile != ""
ctx := &context{env, cfg, progSSA, prog, dedup, patches, make(map[string]none), initial, mode, 0, output, make(map[*packages.Package]bool), make(map[*packages.Package]bool)}
pkgs, err := buildAllPkgs(ctx, initial, verbose)
check(err)
@@ -226,13 +226,12 @@ func Do(args []string, conf *Config) ([]Package, error) {
linkArgs = append(linkArgs, pkg.LinkArgs...)
}
if ctx.output {
for _, pkg := range initial {
if needLink(pkg, mode) {
linkMainPkg(ctx, pkg, pkgs, linkArgs, conf, mode, verbose)
}
for _, pkg := range initial {
if needLink(pkg, mode) {
linkMainPkg(ctx, pkg, pkgs, linkArgs, conf, mode, verbose)
}
}
return dpkg, nil
}
@@ -276,7 +275,6 @@ type context struct {
}
func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs []*aPackage, err error) {
prog := ctx.prog
pkgs, errPkgs := allPkgs(ctx, initial, verbose)
for _, errPkg := range errPkgs {
for _, err := range errPkg.Errors {
@@ -365,7 +363,7 @@ func buildAllPkgs(ctx *context, initial []*packages.Package, verbose bool) (pkgs
if aPkg.AltPkg != nil {
aPkg.LinkArgs = append(aPkg.LinkArgs, concatPkgLinkFiles(ctx, aPkg.AltPkg.Package, verbose)...)
}
setNeedRuntimeOrPyInit(ctx, pkg, prog.NeedRuntime, prog.NeedPyInit)
setNeedRuntimeOrPyInit(ctx, pkg, aPkg.LPkg.NeedRuntime, aPkg.LPkg.NeedPyInit)
}
}
return
@@ -376,7 +374,15 @@ func linkMainPkg(ctx *context, pkg *packages.Package, pkgs []*aPackage, linkArgs
name := path.Base(pkgPath)
app := conf.OutFile
if app == "" {
app = filepath.Join(conf.BinPath, name+conf.AppExt)
if mode == ModeBuild && len(ctx.initial) > 1 {
// For multiple packages in ModeBuild mode, use temporary file
tmpFile, err := os.CreateTemp("", name+"*"+conf.AppExt)
check(err)
app = tmpFile.Name()
tmpFile.Close()
} else {
app = filepath.Join(conf.BinPath, name+conf.AppExt)
}
}
args := make([]string, 0, len(pkg.Imports)+len(linkArgs)+16)
args = append(
@@ -451,10 +457,6 @@ func linkMainPkg(ctx *context, pkg *packages.Package, pkgs []*aPackage, linkArgs
os.WriteFile(pkg.ExportFile, []byte(lpkg.String()), 0644)
}
if verbose || mode != ModeRun {
fmt.Fprintln(os.Stderr, "#", pkgPath)
}
// add rpath and find libs
exargs := make([]string, 0, ctx.nLibdir<<1)
libs := make([]string, 0, ctx.nLibdir*3)
@@ -610,16 +612,14 @@ func buildPkg(ctx *context, aPkg *aPackage, verbose bool) (cgoLdflags []string,
}
cgoLdflags = append(cgoLdflags, altLdflags...)
}
if ctx.output {
pkg.ExportFile += ".ll"
os.WriteFile(pkg.ExportFile, []byte(ret.String()), 0644)
if debugBuild || verbose {
fmt.Fprintf(os.Stderr, "==> Export %s: %s\n", aPkg.PkgPath, pkg.ExportFile)
}
if IsCheckEnable() {
if err, msg := llcCheck(ctx.env, pkg.ExportFile); err != nil {
fmt.Fprintf(os.Stderr, "==> lcc %v: %v\n%v\n", pkg.PkgPath, pkg.ExportFile, msg)
}
pkg.ExportFile += ".ll"
os.WriteFile(pkg.ExportFile, []byte(ret.String()), 0644)
if debugBuild || verbose {
fmt.Fprintf(os.Stderr, "==> Export %s: %s\n", aPkg.PkgPath, pkg.ExportFile)
}
if IsCheckEnable() {
if err, msg := llcCheck(ctx.env, pkg.ExportFile); err != nil {
fmt.Fprintf(os.Stderr, "==> lcc %v: %v\n%v\n", pkg.PkgPath, pkg.ExportFile, msg)
}
}
return

View File

@@ -0,0 +1,63 @@
package build
import (
"fmt"
"os"
"testing"
"github.com/goplus/llgo/compiler/internal/mockable"
)
func mockRun(args []string, cfg *Config) {
const maxAttempts = 3
var lastErr error
var lastPanic interface{}
for attempt := 0; attempt < maxAttempts; attempt++ {
mockable.EnableMock()
func() {
defer func() {
if r := recover(); r != nil {
if r != "exit" {
lastPanic = r
} else {
exitCode := mockable.ExitCode()
if (exitCode != 0) != false {
lastPanic = fmt.Errorf("got exit code %d", exitCode)
}
}
}
}()
file, _ := os.CreateTemp("", "llgo-*")
cfg.OutFile = file.Name()
file.Close()
defer os.Remove(cfg.OutFile)
_, err := Do(args, cfg)
if err == nil {
return // Success, return immediately from the inner function
}
lastErr = err
}()
if lastPanic == nil && lastErr == nil {
return // Success, return from mockRun
}
// Continue to next attempt if this one failed
}
// If we get here, all attempts failed
if lastPanic != nil {
panic(lastPanic)
}
panic(fmt.Errorf("all %d attempts failed, last error: %v", maxAttempts, lastErr))
}
func TestRun(t *testing.T) {
mockRun([]string{"-v", "../../cl/_testgo/print"}, &Config{Mode: ModeRun})
}
func TestTest(t *testing.T) {
mockRun([]string{"-v", "../../../_demo/runtest"}, &Config{Mode: ModeTest})
}
func TestCmpTest(t *testing.T) {
mockRun([]string{"-v", "../../../_demo/runtest"}, &Config{Mode: ModeCmpTest})
}

View File

@@ -18,6 +18,7 @@ package env
import (
"runtime/debug"
"strings"
)
const (
@@ -36,7 +37,7 @@ func Version() string {
return buildVersion
}
info, ok := debug.ReadBuildInfo()
if ok && info.Main.Version != "" {
if ok && info.Main.Version != "" && !strings.HasSuffix(info.Main.Version, "+dirty") {
return info.Main.Version
}
return devel

View File

@@ -239,7 +239,11 @@ func FullName(pkg *types.Package, name string) string {
// BasicName returns the ABI type name for the specified basic type.
func BasicName(t *types.Basic) string {
return "_llgo_" + t.Name()
name := t.Name()
if name == "byte" {
name = "uint8"
}
return "_llgo_" + name
}
// FuncName returns the ABI type name for the specified function type.

View File

@@ -1169,6 +1169,12 @@ func (b Builder) BuiltinCall(fn string, args ...Expr) (ret Expr) {
ret.impl = b.InlineCall(b.Pkg.rtFunc("SliceAppend"),
src, b.StringData(elem), b.StringLen(elem), b.Prog.Val(int(etSize))).impl
return
default:
etSize := b.Prog.SizeOf(elem.Type)
ret.Type = src.Type
ret.impl = b.InlineCall(b.Pkg.rtFunc("SliceAppend"),
src, elem, b.Const(constant.MakeInt64(1), b.Prog.Int()), b.Prog.Val(int(etSize))).impl
return
}
}
}

View File

@@ -204,9 +204,7 @@ type aProgram struct {
ptrSize int
NeedRuntime bool
NeedPyInit bool
is32Bits bool
is32Bits bool
}
// A Program presents a program.
@@ -281,7 +279,6 @@ func (p Program) runtime() *types.Package {
if p.rt == nil {
p.rt = p.rtget()
}
p.NeedRuntime = true
return p.rt
}
@@ -393,7 +390,6 @@ func (p Program) NewPackage(name, pkgPath string) Package {
goStrs := make(map[string]llvm.Value)
chkabi := make(map[types.Type]bool)
glbDbgVars := make(map[Expr]bool)
p.NeedRuntime = false
// Don't need reset p.needPyInit here
// p.needPyInit = false
ret := &aPackage{
@@ -656,11 +652,15 @@ type aPackage struct {
fnlink func(string) string
iRoutine int
NeedRuntime bool
NeedPyInit bool
}
type Package = *aPackage
func (p Package) rtFunc(fnName string) Expr {
p.NeedRuntime = true
fn := p.Prog.runtime().Scope().Lookup(fnName).(*types.Func)
name := FullName(fn.Pkg(), fnName)
sig := fn.Type().(*types.Signature)

View File

@@ -71,7 +71,7 @@ func (p Program) SetPython(py any) {
// -----------------------------------------------------------------------------
func (p Package) pyFunc(fullName string, sig *types.Signature) Expr {
p.Prog.NeedPyInit = true
p.NeedPyInit = true
return p.NewFunc(fullName, sig, InC).Expr
}
@@ -420,7 +420,7 @@ func (p Package) PyNewFunc(name string, sig *types.Signature, doInit bool) PyObj
prog := p.Prog
obj := p.NewVar(name, prog.PyObjectPtrPtr().RawType(), InC)
if doInit {
prog.NeedPyInit = true
p.NeedPyInit = true
obj.InitNil()
obj.impl.SetLinkage(llvm.LinkOnceAnyLinkage)
}

View File

@@ -234,7 +234,7 @@ source_filename = "foo/bar"
@a = external global {}, align 1
`)
if prog.NeedRuntime {
if pkg.NeedRuntime {
t.Fatal("NeedRuntime?")
}
}

View File

@@ -24,6 +24,11 @@
// with a single network connection.
package textproto
/*
#include <stdint.h>
*/
import "C"
import (
"bufio"
"errors"
@@ -33,12 +38,117 @@ import (
"strings"
"syscall"
"unsafe"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/net"
"github.com/goplus/llgo/c/os"
)
const (
AF_UNSPEC = 0 // unspecified
AF_UNIX = 1 // local to host (pipes)
AF_LOCAL = AF_UNIX // backward compatibility
AF_INET = 2 // internetwork: UDP, TCP, etc.
AF_IMPLINK = 3 // arpanet imp addresses
AF_PUP = 4 // pup protocols: e.g. BSP
AF_CHAOS = 5 // mit CHAOS protocols
AF_NS = 6 // XEROX NS protocols
AF_ISO = 7 // ISO protocols
AF_OSI = AF_ISO
AF_ECMA = 8 // European computer manufacturers
AF_DATAKIT = 9 // datakit protocols
AF_CCITT = 10 // CCITT protocols, X.25 etc
AF_SNA = 11 // IBM SNA
AF_DECnet = 12 // DECnet
AF_DLI = 13 // DEC Direct data link interface
AF_LAT = 14 // LAT
AF_HYLINK = 15 // NSC Hyperchannel
AF_APPLETALK = 16 // Apple Talk
AF_ROUTE = 17 // Internal Routing Protocol
AF_LINK = 18 // Link layer interface
pseudo_AF_XTP = 19 // eXpress Transfer Protocol (no AF)
AF_COIP = 20 // connection-oriented IP, aka ST II
AF_CNT = 21 // Computer Network Technology
pseudo_AF_RTIP = 22 // Help Identify RTIP packets
AF_IPX = 23 // Novell Internet Protocol
AF_SIP = 24 // Simple Internet Protocol
pseudo_AF_PIP = 25 // Help Identify PIP packets
AF_NDRV = 27 // Network Driver 'raw' access
AF_ISDN = 28 // Integrated Services Digital Network
AF_E164 = AF_ISDN // CCITT E.164 recommendation
pseudo_AF_KEY = 29 // Internal key-management function
AF_INET6 = 30 // IPv6
AF_NATM = 31 // native ATM access
AF_SYSTEM = 32 // Kernel event messages
AF_NETBIOS = 33 // NetBIOS
AF_PPP = 34 // PPP communication protocol
pseudo_AF_HDRCMPLT = 35 // Used by BPF to not rewrite headers in interface output routine
AF_RESERVED_36 = 36 // Reserved for internal usage
AF_IEEE80211 = 37 // IEEE 802.11 protocol
AF_UTUN = 38
AF_VSOCK = 40 // VM Sockets
AF_MAX = 41
)
const (
SOCK_STREAM = 1 // stream socket
SOCK_DGRAM = 2 // datagram socket
SOCK_RAW = 3 // raw-protocol interface
SOCK_RDM = 4 // reliably-delivered message
SOCK_SEQPACKET = 5 // sequenced packet stream
)
type SockAddr struct {
Len uint8
Family uint8
Data [14]C.char
}
type AddrInfo struct {
Flags C.int
Family C.int
SockType C.int
Protocol C.int
AddrLen C.uint
CanOnName *C.char
Addr *SockAddr
Next *AddrInfo
}
//go:linkname Getaddrinfo C.getaddrinfo
func Getaddrinfo(host *C.char, port *C.char, addrInfo *AddrInfo, result **AddrInfo) C.int
//go:linkname Freeaddrinfo C.freeaddrinfo
func Freeaddrinfo(addrInfo *AddrInfo) C.int
//go:linkname GoString llgo.string
func GoString(cstr *C.char, __llgo_va_list /* n */ ...any) string
//go:linkname AllocaCStr llgo.allocaCStr
func AllocaCStr(s string) *C.char
//go:linkname Memset C.memset
func Memset(s unsafe.Pointer, c C.int, n uintptr) unsafe.Pointer
//go:linkname Read C.read
func Read(fd C.int, buf unsafe.Pointer, count uintptr) int
//go:linkname Write C.write
func Write(fd C.int, buf unsafe.Pointer, count uintptr) int
//go:linkname Close C.close
func Close(fd C.int) C.int
//go:linkname Strerror strerror
func Strerror(errnum C.int) *C.char
//go:linkname Errno C.cliteErrno
func Errno() C.int
//go:linkname Socket C.socket
func Socket(domain C.int, typ C.int, protocol C.int) C.int
//go:linkname Connect C.connect
func Connect(sockfd C.int, addr *SockAddr, addrlen C.uint) C.int
// -----------------------------------------------------------------------------
// An Error represents a numeric error response from a server.
type Error struct {
Code int
@@ -94,7 +204,7 @@ func Dial(network, addr string) (*Conn, error) {
}
type cConn struct {
socketFd c.Int
socketFd C.int
closed bool
}
@@ -106,9 +216,9 @@ func (conn *cConn) Read(p []byte) (n int, err error) {
return 0, nil
}
for n < len(p) {
result := os.Read(conn.socketFd, unsafe.Pointer(&p[n:][0]), uintptr(len(p)-n))
result := Read(conn.socketFd, unsafe.Pointer(&p[n:][0]), uintptr(len(p)-n))
if result < 0 {
if os.Errno() == c.Int(syscall.EINTR) {
if Errno() == C.int(syscall.EINTR) {
continue
}
return n, errors.New("read error")
@@ -126,9 +236,9 @@ func (conn *cConn) Write(p []byte) (n int, err error) {
return 0, fs.ErrClosed
}
for n < len(p) {
result := os.Write(conn.socketFd, unsafe.Pointer(&p[n:][0]), uintptr(len(p)-n))
result := Write(conn.socketFd, unsafe.Pointer(&p[n:][0]), uintptr(len(p)-n))
if result < 0 {
if os.Errno() == c.Int(syscall.EINTR) {
if Errno() == C.int(syscall.EINTR) {
continue
}
return n, errors.New("write error")
@@ -149,9 +259,9 @@ func (conn *cConn) Close() error {
return fs.ErrClosed
}
conn.closed = true
result := os.Close(conn.socketFd)
result := Close(conn.socketFd)
if result < 0 {
return errors.New(c.GoString(c.Strerror(os.Errno())))
return errors.New(GoString(Strerror(Errno())))
}
return nil
}
@@ -161,29 +271,29 @@ func dialNetWork(network, addr string) (*cConn, error) {
if err != nil {
return nil, err
}
var hints net.AddrInfo
var res *net.AddrInfo
c.Memset(unsafe.Pointer(&hints), 0, unsafe.Sizeof(hints))
hints.Family = net.AF_UNSPEC
hints.SockType = net.SOCK_STREAM
status := net.Getaddrinfo(c.AllocaCStr(host), c.AllocaCStr(port), &hints, &res)
var hints AddrInfo
var res *AddrInfo
Memset(unsafe.Pointer(&hints), 0, unsafe.Sizeof(hints))
hints.Family = AF_UNSPEC
hints.SockType = SOCK_STREAM
status := Getaddrinfo(AllocaCStr(host), AllocaCStr(port), &hints, &res)
if status != 0 {
return nil, errors.New("getaddrinfo error")
}
socketFd := net.Socket(res.Family, res.SockType, res.Protocol)
socketFd := Socket(res.Family, res.SockType, res.Protocol)
if socketFd == -1 {
net.Freeaddrinfo(res)
Freeaddrinfo(res)
return nil, errors.New("socket error")
}
if net.Connect(socketFd, res.Addr, res.AddrLen) == -1 {
os.Close(socketFd)
net.Freeaddrinfo(res)
if Connect(socketFd, res.Addr, res.AddrLen) == -1 {
Close(socketFd)
Freeaddrinfo(res)
return nil, errors.New("connect error")
}
net.Freeaddrinfo(res)
Freeaddrinfo(res)
return &cConn{
socketFd: socketFd,
}, nil

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,10 @@
package runtime
import (
"strings"
)
func SkipToBuild(pkgPath string) bool {
if _, ok := hasAltPkg[pkgPath]; ok {
return false
}
if _, ok := supportedInternal[pkgPath]; ok {
return false
}
switch pkgPath {
case "unsafe":
return true
default:
return strings.HasPrefix(pkgPath, "internal/") ||
strings.HasPrefix(pkgPath, "runtime/internal/")
}
return pkgPath == "unsafe"
}
func HasAltPkg(path string) (b bool) {
@@ -66,10 +53,3 @@ var hasAltPkg = map[string]none{
"runtime/internal/syscall": {},
"io": {},
}
var supportedInternal = map[string]none{
"internal/race": {},
"internal/stringslite": {},
"internal/filepathlite": {},
"internal/fmtsort": {},
}

View File

@@ -1,13 +1,13 @@
package godebug
func setUpdate(update func(string, string)) {
println("todo: godebug.setUpdate")
// println("todo: godebug.setUpdate")
}
func registerMetric(name string, read func() uint64) {
println("todo: godebug.registerMetric")
// println("todo: godebug.registerMetric")
}
func setNewIncNonDefault(newIncNonDefault func(string) func()) {
println("todo: godebug.setNewIncNonDefault")
// println("todo: godebug.setNewIncNonDefault")
}

View File

@@ -296,6 +296,80 @@ func (f flag) mustBeAssignableSlow() {
}
}
// Equal reports true if v is equal to u.
// For two invalid values, Equal will report true.
// For an interface value, Equal will compare the value within the interface.
// Otherwise, If the values have different types, Equal will report false.
// Otherwise, for arrays and structs Equal will compare each element in order,
// and report false if it finds non-equal elements.
// During all comparisons, if values of the same type are compared,
// and the type is not comparable, Equal will panic.
func (v Value) Equal(u Value) bool {
if v.Kind() == Interface {
v = v.Elem()
}
if u.Kind() == Interface {
u = u.Elem()
}
if !v.IsValid() || !u.IsValid() {
return v.IsValid() == u.IsValid()
}
if v.Kind() != u.Kind() || v.Type() != u.Type() {
return false
}
// Handle each Kind directly rather than calling valueInterface
// to avoid allocating.
switch v.Kind() {
default:
panic("reflect.Value.Equal: invalid Kind")
case Bool:
return v.Bool() == u.Bool()
case Int, Int8, Int16, Int32, Int64:
return v.Int() == u.Int()
case Uint, Uint8, Uint16, Uint32, Uint64, Uintptr:
return v.Uint() == u.Uint()
case Float32, Float64:
return v.Float() == u.Float()
case Complex64, Complex128:
return v.Complex() == u.Complex()
case String:
return v.String() == u.String()
case Chan, Pointer, UnsafePointer:
return v.Pointer() == u.Pointer()
case Array:
// u and v have the same type so they have the same length
vl := v.Len()
if vl == 0 {
// panic on [0]func()
if !v.Type().Elem().Comparable() {
break
}
return true
}
for i := 0; i < vl; i++ {
if !v.Index(i).Equal(u.Index(i)) {
return false
}
}
return true
case Struct:
// u and v have the same type so they have the same fields
nf := v.NumField()
for i := 0; i < nf; i++ {
if !v.Field(i).Equal(u.Field(i)) {
return false
}
}
return true
case Func, Map, Slice:
break
}
panic("reflect.Value.Equal: values of type " + v.Type().String() + " are not comparable")
}
// Addr returns a pointer value representing the address of v.
// It panics if CanAddr() returns false.
// Addr is typically used to obtain a pointer to a struct field

View File

@@ -10,6 +10,12 @@ var go_parser_resolver string
//go:embed _overlay/testing/testing.go
var testing_testing string
//go:embed _overlay/testing/testing_go123.go
var testing_testing_go123 string
//go:embed _overlay/testing/testing_go124.go
var testing_testing_go124 string
//go:embed _overlay/net/textproto/textproto.go
var net_textproto string
@@ -17,5 +23,7 @@ var OverlayFiles = map[string]string{
"math/exp_amd64.go": "package math;",
"go/parser/resolver.go": go_parser_resolver,
"testing/testing.go": testing_testing,
"testing/testing_go123.go": testing_testing_go123,
"testing/testing_go124.go": testing_testing_go124,
"net/textproto/textproto.go": net_textproto,
}