From 07fc6c849f00fb70a71e7db48187316cfb4df357 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 4 Jun 2019 16:40:50 -0700 Subject: [PATCH 001/126] error on escape to heap --- src/runtime/defs_linux_amd64.go | 139 ++++++++++++++++++++++++++++++++ src/runtime/os_linux.go | 6 ++ src/runtime/signal_unix.go | 34 ++++++-- src/runtime/sys_linux_amd64.s | 52 ++++++++++++ 4 files changed, 226 insertions(+), 5 deletions(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index ddad7fddd4..0880822393 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -261,3 +261,142 @@ type sockaddr_un struct { family uint16 path [108]byte } + +type PerfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + _ uint32 +} + +const ( + PERF_TYPE_HARDWARE = 0x0 + PERF_TYPE_SOFTWARE = 0x1 + PERF_TYPE_TRACEPOINT = 0x2 + PERF_TYPE_HW_CACHE = 0x3 + PERF_TYPE_RAW = 0x4 + PERF_TYPE_BREAKPOINT = 0x5 + + PERF_COUNT_HW_CPU_CYCLES = 0x0 + PERF_COUNT_HW_INSTRUCTIONS = 0x1 + PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + PERF_COUNT_HW_CACHE_MISSES = 0x3 + PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + PERF_COUNT_HW_BRANCH_MISSES = 0x5 + PERF_COUNT_HW_BUS_CYCLES = 0x6 + PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + PERF_COUNT_HW_CACHE_L1D = 0x0 + PERF_COUNT_HW_CACHE_L1I = 0x1 + PERF_COUNT_HW_CACHE_LL = 0x2 + PERF_COUNT_HW_CACHE_DTLB = 0x3 + PERF_COUNT_HW_CACHE_ITLB = 0x4 + PERF_COUNT_HW_CACHE_BPU = 0x5 + PERF_COUNT_HW_CACHE_NODE = 0x6 + + PERF_COUNT_HW_CACHE_OP_READ = 0x0 + PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + PERF_COUNT_SW_CPU_CLOCK = 0x0 + PERF_COUNT_SW_TASK_CLOCK = 0x1 + PERF_COUNT_SW_PAGE_FAULTS = 0x2 + PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + PERF_COUNT_SW_DUMMY = 0x9 + PERF_COUNT_SW_BPF_OUTPUT = 0xa + + PERF_SAMPLE_IP = 0x1 + PERF_SAMPLE_TID = 0x2 + PERF_SAMPLE_TIME = 0x4 + PERF_SAMPLE_ADDR = 0x8 + PERF_SAMPLE_READ = 0x10 + PERF_SAMPLE_CALLCHAIN = 0x20 + PERF_SAMPLE_ID = 0x40 + PERF_SAMPLE_CPU = 0x80 + PERF_SAMPLE_PERIOD = 0x100 + PERF_SAMPLE_STREAM_ID = 0x200 + PERF_SAMPLE_RAW = 0x400 + PERF_SAMPLE_BRANCH_STACK = 0x800 + + PERF_SAMPLE_BRANCH_USER = 0x1 + PERF_SAMPLE_BRANCH_KERNEL = 0x2 + PERF_SAMPLE_BRANCH_HV = 0x4 + PERF_SAMPLE_BRANCH_ANY = 0x8 + PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + PERF_SAMPLE_BRANCH_IN_TX = 0x100 + PERF_SAMPLE_BRANCH_NO_TX = 0x200 + PERF_SAMPLE_BRANCH_COND = 0x400 + PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + PERF_SAMPLE_BRANCH_CALL = 0x2000 + PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + PERF_FORMAT_ID = 0x4 + PERF_FORMAT_GROUP = 0x8 + + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 + PERF_RECORD_MMAP2 = 0xa + PERF_RECORD_AUX = 0xb + PERF_RECORD_ITRACE_START = 0xc + PERF_RECORD_LOST_SAMPLES = 0xd + PERF_RECORD_SWITCH = 0xe + PERF_RECORD_SWITCH_CPU_WIDE = 0xf + PERF_RECORD_NAMESPACES = 0x10 + + PERF_CONTEXT_HV = -0x20 + PERF_CONTEXT_KERNEL = -0x80 + PERF_CONTEXT_USER = -0x200 + + PERF_CONTEXT_GUEST = -0x800 + PERF_CONTEXT_GUEST_KERNEL = -0x880 + PERF_CONTEXT_GUEST_USER = -0xa00 + + PERF_FLAG_FD_NO_GROUP = 0x1 + PERF_FLAG_FD_OUTPUT = 0x2 + PERF_FLAG_PID_CGROUP = 0x4 + PERF_FLAG_FD_CLOEXEC = 0x8 +) + +type fOwnerEx struct { + category int + pid uint32 +} diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index d4a9bd4ff5..69915769b1 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -356,6 +356,12 @@ func sigaltstack(new, old *stackt) //go:noescape func setitimer(mode int32, new, old *itimerval) +//go:noescape +func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (int64, int64, int64) +func ioctl(fd, req, arg int64) int64 +// func fcntl(fd, cmd, arg int64) (int64, int64) +func fcntl(fd, cmd int64, arg interface{}) (int64, int64) + //go:noescape func rtsigprocmask(how int32, new, old *sigset, size int32) diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 1dd56989b4..6bcc11ecdb 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -254,14 +254,38 @@ func setProcessCPUProfiler(hz int32) { // setThreadCPUProfiler makes any thread-specific changes required to // implement profiling at a rate of hz. func setThreadCPUProfiler(hz int32) { - var it itimerval if hz == 0 { + var it itimerval setitimer(_ITIMER_PROF, &it, nil) } else { - it.it_interval.tv_sec = 0 - it.it_interval.set_usec(1000000 / hz) - it.it_value = it.it_interval - setitimer(_ITIMER_PROF, &it, nil) + // it.it_interval.tv_sec = 0 + // it.it_interval.set_usec(1000000 / hz) + // it.it_value = it.it_interval + // setitimer(_ITIMER_PROF, &it, nil) + + var attr PerfEventAttr + attr.Type = PERF_TYPE_HARDWARE + attr.Size = uint32(unsafe.Sizeof(attr)) + attr.Config = PERF_COUNT_HW_CPU_CYCLES + attr.Sample = 10000000 + + fd, _, err := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) + r, err := fcntl(fd, /*F_GETFL*/ 0x3, 0) + r, err = fcntl(fd, /*F_SETFL*/ 0x4, r | 0x2000) + r, err = fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPROF) + + // fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, gettid()} + // r, err = fcntl(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); + + printstring("r, err ") + printnl() + printint(int64(r)) + printstring(" ") + printint(int64(err)) + printnl() + + // ioctl(fd, /*PERF_EVENT_IOC_RESET*/ 0x2403, 0); + // ioctl(fd, /*PERF_EVENT_IOC_ENABLE*/ 0x2400, 0); } _g_ := getg() _g_.m.profilehz = hz diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 5c300f553d..0809809387 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -21,6 +21,7 @@ #define SYS_rt_sigaction 13 #define SYS_rt_sigprocmask 14 #define SYS_rt_sigreturn 15 +#define SYS_ioctl 16 #define SYS_sched_yield 24 #define SYS_mincore 27 #define SYS_madvise 28 @@ -46,6 +47,7 @@ #define SYS_faccessat 269 #define SYS_epoll_pwait 281 #define SYS_epoll_create1 291 +#define SYS_perfEventOpen 298 TEXT runtime·exit(SB),NOSPLIT,$0-4 MOVL code+0(FP), DI @@ -166,6 +168,56 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0-24 SYSCALL RET +// func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r1, r2, err int64) +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVQ a1+0(FP), DI + MOVQ a2+8(FP), SI + MOVQ a3+16(FP), DX + MOVQ a4+24(FP), R10 + MOVQ a5+32(FP), R8 + MOVQ a6+40(FP), R9 + MOVQ $SYS_perfEventOpen, AX // syscall entry + SYSCALL + CMPQ AX, $0xfffffffffffff001 + JLS ok + MOVQ $-1, r1+48(FP) + MOVQ $0, r2+56(FP) + NEGQ AX + MOVQ AX, err+64(FP) + RET +ok: + MOVQ AX, r1+48(FP) + MOVQ DX, r2+56(FP) + MOVQ $0, err+64(FP) + RET + +// func ioctl(fd int, req uint, arg uintptr) err int64 +TEXT runtime·ioctl(SB),NOSPLIT,$0 + MOVQ a1+0(FP), DI + MOVQ a2+8(FP), SI + MOVQ a3+16(FP), DX + MOVQ $SYS_ioctl, AX + SYSCALL + RET + +// func fcntl(fd, cmd, arg int64) (r, err int64) +TEXT runtime·fcntl(SB),NOSPLIT,$0 + MOVQ a1+0(FP), DI + MOVQ a2+8(FP), SI + MOVQ a3+16(FP), DX + MOVQ $SYS_fcntl, AX + SYSCALL + CMPQ AX, $0xfffffffffffff001 + JLS ok + MOVQ $-1, r+24(FP) + NEGQ AX + MOVQ AX, err+32(FP) + RET +ok: + MOVQ AX, r1+24(FP) + MOVQ $0, err+32(FP) + RET + TEXT runtime·mincore(SB),NOSPLIT,$0-28 MOVQ addr+0(FP), DI MOVQ n+8(FP), SI From cb3f988cbd7e813d0bf62ad52ab1eb5812d17967 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 4 Jun 2019 16:42:48 -0700 Subject: [PATCH 002/126] minor --- src/runtime/signal_unix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 6bcc11ecdb..7093794765 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -274,8 +274,8 @@ func setThreadCPUProfiler(hz int32) { r, err = fcntl(fd, /*F_SETFL*/ 0x4, r | 0x2000) r, err = fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPROF) - // fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, gettid()} - // r, err = fcntl(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); + fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, gettid()} + r, err = fcntl(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); printstring("r, err ") printnl() From 87a6fec2048306b751cd9006d48a6f96a7a55345 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 5 Jun 2019 15:27:18 -0700 Subject: [PATCH 003/126] disable escaping to heap and deliver SIGPROF to the correspoind signal handler --- src/runtime/defs_linux_amd64.go | 47 +++++++++++++-------------- src/runtime/os_linux.go | 11 +++++-- src/runtime/signal_sighandler.go | 6 ++-- src/runtime/signal_unix.go | 21 +++++++------ src/runtime/sys_linux_amd64.s | 54 +++++++++++++++++++++----------- 5 files changed, 83 insertions(+), 56 deletions(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 0880822393..1e4ba1e5cb 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -262,27 +262,6 @@ type sockaddr_un struct { path [108]byte } -type PerfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - _ uint32 -} - const ( PERF_TYPE_HARDWARE = 0x0 PERF_TYPE_SOFTWARE = 0x1 @@ -396,7 +375,29 @@ const ( PERF_FLAG_FD_CLOEXEC = 0x8 ) +type PerfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + _ uint32 +} + type fOwnerEx struct { - category int - pid uint32 + Type int32 + Pid int32 + } diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 69915769b1..ab9b216078 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -357,10 +357,15 @@ func sigaltstack(new, old *stackt) func setitimer(mode int32, new, old *itimerval) //go:noescape -func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (int64, int64, int64) +func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r, r2, err int64) + func ioctl(fd, req, arg int64) int64 -// func fcntl(fd, cmd, arg int64) (int64, int64) -func fcntl(fd, cmd int64, arg interface{}) (int64, int64) + +// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) +func fcntl(fd, cmd, arg int64) (r, err int64) + +//go:noescape +func fcntl2(fd, cmd int64, arg *fOwnerEx) (r, err int64) //go:noescape func rtsigprocmask(how int32, new, old *sigset, size int32) diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index bec4653218..9c446e56f7 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -34,8 +34,10 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { _g_ := getg() c := &sigctxt{info, ctxt} - if sig == _SIGPROF { - sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) + if sig == _SIGPROF { + // printint(int64(info.si_signo)) + // printnl() + sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) return } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 7093794765..276210ce75 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -267,22 +267,23 @@ func setThreadCPUProfiler(hz int32) { attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) attr.Config = PERF_COUNT_HW_CPU_CYCLES - attr.Sample = 10000000 + attr.Sample = uint64(hz) + fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) - fd, _, err := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) - r, err := fcntl(fd, /*F_GETFL*/ 0x3, 0) - r, err = fcntl(fd, /*F_SETFL*/ 0x4, r | 0x2000) - r, err = fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPROF) - - fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, gettid()} - r, err = fcntl(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); + r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) + fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) + fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPROF) + fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} + fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); + + /* printstring("r, err ") - printnl() printint(int64(r)) - printstring(" ") + printnl() printint(int64(err)) printnl() + */ // ioctl(fd, /*PERF_EVENT_IOC_RESET*/ 0x2403, 0); // ioctl(fd, /*PERF_EVENT_IOC_ENABLE*/ 0x2400, 0); diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 0809809387..5a00025b67 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -168,43 +168,44 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0-24 SYSCALL RET -// func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r1, r2, err int64) +// func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r, r2, err int64) TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 - MOVQ a1+0(FP), DI - MOVQ a2+8(FP), SI - MOVQ a3+16(FP), DX - MOVQ a4+24(FP), R10 - MOVQ a5+32(FP), R8 - MOVQ a6+40(FP), R9 + MOVQ attr+0(FP), DI + MOVQ pid+8(FP), SI + MOVQ cpu+16(FP), DX + MOVQ groupFd+24(FP), R10 + MOVQ flags+32(FP), R8 + MOVQ dummy+40(FP), R9 MOVQ $SYS_perfEventOpen, AX // syscall entry SYSCALL CMPQ AX, $0xfffffffffffff001 JLS ok - MOVQ $-1, r1+48(FP) + MOVQ $-1, r+48(FP) MOVQ $0, r2+56(FP) NEGQ AX MOVQ AX, err+64(FP) RET ok: - MOVQ AX, r1+48(FP) + MOVQ AX, r+48(FP) MOVQ DX, r2+56(FP) MOVQ $0, err+64(FP) RET -// func ioctl(fd int, req uint, arg uintptr) err int64 +// func ioctl(fd, req, arg int64) int64 TEXT runtime·ioctl(SB),NOSPLIT,$0 - MOVQ a1+0(FP), DI - MOVQ a2+8(FP), SI - MOVQ a3+16(FP), DX + MOVQ fd+0(FP), DI + MOVQ req+8(FP), SI + MOVQ arg+16(FP), DX MOVQ $SYS_ioctl, AX SYSCALL + MOVQ AX, ret+24(FP) RET -// func fcntl(fd, cmd, arg int64) (r, err int64) +// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) TEXT runtime·fcntl(SB),NOSPLIT,$0 - MOVQ a1+0(FP), DI - MOVQ a2+8(FP), SI - MOVQ a3+16(FP), DX + MOVQ fd+0(FP), DI + MOVQ cmd+8(FP), SI + MOVQ arg+16(FP), DX MOVQ $SYS_fcntl, AX SYSCALL CMPQ AX, $0xfffffffffffff001 @@ -214,7 +215,24 @@ TEXT runtime·fcntl(SB),NOSPLIT,$0 MOVQ AX, err+32(FP) RET ok: - MOVQ AX, r1+24(FP) + MOVQ AX, r+24(FP) + MOVQ $0, err+32(FP) + RET + +TEXT runtime·fcntl2(SB),NOSPLIT,$0 + MOVQ fd+0(FP), DI + MOVQ cmd+8(FP), SI + MOVQ arg+16(FP), DX + MOVQ $SYS_fcntl, AX + SYSCALL + CMPQ AX, $0xfffffffffffff001 + JLS ok + MOVQ $-1, r+24(FP) + NEGQ AX + MOVQ AX, err+32(FP) + RET +ok: + MOVQ AX, r+24(FP) MOVQ $0, err+32(FP) RET From 59beecdb6302e6110db5270aa4c2ed0439ac978c Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 5 Jun 2019 15:33:24 -0700 Subject: [PATCH 004/126] minor --- src/runtime/signal_unix.go | 3 --- src/runtime/sys_linux_amd64.s | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 276210ce75..0dac5beb4c 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -278,11 +278,8 @@ func setThreadCPUProfiler(hz int32) { fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); /* - printstring("r, err ") printint(int64(r)) printnl() - printint(int64(err)) - printnl() */ // ioctl(fd, /*PERF_EVENT_IOC_RESET*/ 0x2403, 0); diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 5a00025b67..ee4df25f0e 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -201,7 +201,7 @@ TEXT runtime·ioctl(SB),NOSPLIT,$0 MOVQ AX, ret+24(FP) RET -// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) +// func fcntl(fd, cmd arg int64) (r int64, err int64) TEXT runtime·fcntl(SB),NOSPLIT,$0 MOVQ fd+0(FP), DI MOVQ cmd+8(FP), SI From ad7bef95f5520fb988e7d5f1c487e099035a506c Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 5 Jun 2019 18:44:46 -0700 Subject: [PATCH 005/126] disable/enable PMU counters in the signal handler --- src/runtime/defs_linux_amd64.go | 18 +++++++++++++++++- src/runtime/signal_sighandler.go | 9 ++++++--- src/runtime/signal_unix.go | 7 +++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 1e4ba1e5cb..c1e3144736 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -126,7 +126,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 + si_addr uint64 + si_fd int64 // missed out by Golang's developers + } type itimerval struct { @@ -373,8 +375,22 @@ const ( PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 PERF_FLAG_FD_CLOEXEC = 0x8 + + PERF_EVENT_IOC_DISABLE = 0x2401 + PERF_EVENT_IOC_ENABLE = 0x2400 + PERF_EVENT_IOC_ID = 0x80082407 + PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + PERF_EVENT_IOC_PERIOD = 0x40082404 + PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + PERF_EVENT_IOC_REFRESH = 0x2402 + PERF_EVENT_IOC_RESET = 0x2403 + PERF_EVENT_IOC_SET_BPF = 0x40042408 + PERF_EVENT_IOC_SET_FILTER = 0x40082406 + PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) + type PerfEventAttr struct { Type uint32 Size uint32 diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 9c446e56f7..f98a23b012 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -35,10 +35,13 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { c := &sigctxt{info, ctxt} if sig == _SIGPROF { - // printint(int64(info.si_signo)) - // printnl() + fd := info.si_fd + // printint(fd) + // printnl() + ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) - return + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + return } if sig == _SIGTRAP && testSigtrap != nil && testSigtrap(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp) { diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 0dac5beb4c..ec542274ab 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -267,7 +267,9 @@ func setThreadCPUProfiler(hz int32) { attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) attr.Config = PERF_COUNT_HW_CPU_CYCLES - attr.Sample = uint64(hz) + // attr.Sample = uint64(hz) + attr.Sample = 1000000 + fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) @@ -281,9 +283,6 @@ func setThreadCPUProfiler(hz int32) { printint(int64(r)) printnl() */ - - // ioctl(fd, /*PERF_EVENT_IOC_RESET*/ 0x2403, 0); - // ioctl(fd, /*PERF_EVENT_IOC_ENABLE*/ 0x2400, 0); } _g_ := getg() _g_.m.profilehz = hz From 014d49c777ae2d1ec9b118ec629ccb11966a728a Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 5 Jun 2019 19:49:04 -0700 Subject: [PATCH 006/126] note --- src/runtime/defs_linux_amd64.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index c1e3144736..9aa88cbde4 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -127,7 +127,9 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 - si_fd int64 // missed out by Golang's developers + + // psu: an unreliable workaround and need to figure out a better solution + si_fd int64 } From 0b450d5295ab82b2a77c6c35ad6269e982b89a8a Mon Sep 17 00:00:00 2001 From: psu-wm Date: Fri, 7 Jun 2019 20:12:44 -0700 Subject: [PATCH 007/126] test cases for PMU --- src/runtime/signal_sighandler.go | 3 +- src/runtime/signal_unix.go | 19 +-- test/pmu/cycle/test1.go | 185 +++++++++++++++++++++++++++++ test/pmu/cycle/test1.out | 10 ++ test/pmu/cycle/test2.go | 193 +++++++++++++++++++++++++++++++ test/pmu/cycle/test2.out | 10 ++ test/pmu/cycle/test3.go | 188 ++++++++++++++++++++++++++++++ test/pmu/cycle/test3.out | 10 ++ test/run.go | 2 +- 9 files changed, 602 insertions(+), 18 deletions(-) create mode 100644 test/pmu/cycle/test1.go create mode 100644 test/pmu/cycle/test1.out create mode 100644 test/pmu/cycle/test2.go create mode 100644 test/pmu/cycle/test2.out create mode 100644 test/pmu/cycle/test3.go create mode 100644 test/pmu/cycle/test3.out diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index f98a23b012..481ba3800f 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -36,8 +36,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { if sig == _SIGPROF { fd := info.si_fd - // printint(fd) - // printnl() + // print(fd, "\n") ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index ec542274ab..3c54347f90 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -254,21 +254,13 @@ func setProcessCPUProfiler(hz int32) { // setThreadCPUProfiler makes any thread-specific changes required to // implement profiling at a rate of hz. func setThreadCPUProfiler(hz int32) { - if hz == 0 { - var it itimerval - setitimer(_ITIMER_PROF, &it, nil) - } else { - // it.it_interval.tv_sec = 0 - // it.it_interval.set_usec(1000000 / hz) - // it.it_value = it.it_interval - // setitimer(_ITIMER_PROF, &it, nil) - + if hz != 0 { var attr PerfEventAttr attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) attr.Config = PERF_COUNT_HW_CPU_CYCLES - // attr.Sample = uint64(hz) - attr.Sample = 1000000 + attr.Sample = 3e9 / uint64(hz) // match itimer's sampling rate + // attr.Sample = 1e6 fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) @@ -279,10 +271,7 @@ func setThreadCPUProfiler(hz int32) { fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); - /* - printint(int64(r)) - printnl() - */ + // print(r, "\n") } _g_ := getg() _g_.m.profilehz = hz diff --git a/test/pmu/cycle/test1.go b/test/pmu/cycle/test1.go new file mode 100644 index 0000000000..0a5b52dd0d --- /dev/null +++ b/test/pmu/cycle/test1.go @@ -0,0 +1,185 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "runtime/pprof" + "sync" +) + +//go:noinline +func fun1(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun2(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun3(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun4(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun5(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun6(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun7(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun8(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun9(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun10(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func main() { + cpuf, err := os.Create("test1_profile") + if err != nil { + log.Fatal(err) + } + pprof.StartCPUProfile(cpuf) + defer pprof.StopCPUProfile() + + var wg sync.WaitGroup + wg.Add(10) // fun1-fun10 + defer wg.Wait() // similar to pthread_join + + go fun1(&wg) + go fun2(&wg) + go fun3(&wg) + go fun4(&wg) + go fun5(&wg) + go fun6(&wg) + go fun7(&wg) + go fun8(&wg) + go fun9(&wg) + go fun10(&wg) +} diff --git a/test/pmu/cycle/test1.out b/test/pmu/cycle/test1.out new file mode 100644 index 0000000000..9546171295 --- /dev/null +++ b/test/pmu/cycle/test1.out @@ -0,0 +1,10 @@ +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 diff --git a/test/pmu/cycle/test2.go b/test/pmu/cycle/test2.go new file mode 100644 index 0000000000..952f44823d --- /dev/null +++ b/test/pmu/cycle/test2.go @@ -0,0 +1,193 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "runtime/pprof" +) + +//go:noinline +func fun1(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun2(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun3(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun4(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun5(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun6(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun7(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun8(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun9(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun10(c chan int) { + defer close(c) + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func waitForChans(chans ...chan int) { + for _, v := range chans { + <-v + } +} + +func main() { + cpuf, err := os.Create("test2_profile") + if err != nil { + log.Fatal(err) + } + pprof.StartCPUProfile(cpuf) + defer pprof.StopCPUProfile() + + var chans [10]chan int + for i := range chans { + chans[i] = make(chan int) + } + + go fun1(chans[0]) + go fun2(chans[1]) + go fun3(chans[2]) + go fun4(chans[3]) + go fun5(chans[4]) + go fun6(chans[5]) + go fun7(chans[6]) + go fun8(chans[7]) + go fun9(chans[8]) + go fun10(chans[9]) + + waitForChans(chans[0], chans[1], chans[2], chans[3], chans[4], chans[5], chans[6], chans[7], chans[8], chans[9]) +} diff --git a/test/pmu/cycle/test2.out b/test/pmu/cycle/test2.out new file mode 100644 index 0000000000..9546171295 --- /dev/null +++ b/test/pmu/cycle/test2.out @@ -0,0 +1,10 @@ +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 diff --git a/test/pmu/cycle/test3.go b/test/pmu/cycle/test3.go new file mode 100644 index 0000000000..3428fd4677 --- /dev/null +++ b/test/pmu/cycle/test3.go @@ -0,0 +1,188 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "runtime/pprof" + "sync" +) + +//go:noinline +func fun1(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun2(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun3(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun4(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func fun5(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun6(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun7(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun8(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func fun9(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +//go:noinline +func fun10(wg *sync.WaitGroup) { + defer wg.Done() + + var sum int + for i:= 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i / 3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func main() { + cpuf, err := os.Create("test3_profile") + if err != nil { + log.Fatal(err) + } + pprof.StartCPUProfile(cpuf) + defer pprof.StopCPUProfile() + + var wg [10]sync.WaitGroup + for i := range wg { + wg[i].Add(1) + } + + go fun1(&(wg[0])) + go fun2(&(wg[1])) + go fun3(&(wg[2])) + go fun4(&(wg[3])) + go fun5(&(wg[4])) + go fun6(&(wg[5])) + go fun7(&(wg[6])) + go fun8(&(wg[7])) + go fun9(&(wg[8])) + go fun10(&(wg[9])) + + for i:= range wg { + wg[i].Wait() + } +} diff --git a/test/pmu/cycle/test3.out b/test/pmu/cycle/test3.out new file mode 100644 index 0000000000..9546171295 --- /dev/null +++ b/test/pmu/cycle/test3.out @@ -0,0 +1,10 @@ +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 diff --git a/test/run.go b/test/run.go index 28ed865c50..ff1fcef9b1 100644 --- a/test/run.go +++ b/test/run.go @@ -50,7 +50,7 @@ var ( // dirs are the directories to look for *.go files in. // TODO(bradfitz): just use all directories? - dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime"} + dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "pmu/cycle"} // ratec controls the max number of tests running at a time. ratec chan bool From 508ab840711fea0d18b8d1f8c1812fd5445a6de0 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 9 Jun 2019 19:46:00 -0700 Subject: [PATCH 008/126] test --- test/pmu/cycle/test3.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/pmu/cycle/test3.go b/test/pmu/cycle/test3.go index 3428fd4677..e9e0e7f61d 100644 --- a/test/pmu/cycle/test3.go +++ b/test/pmu/cycle/test3.go @@ -4,6 +4,7 @@ package main import ( "fmt" + "flag" "log" "os" "runtime/pprof" @@ -158,7 +159,15 @@ func fun10(wg *sync.WaitGroup) { fmt.Println(sum) } +var args = flag.String("p", "", "itimer() is used by default") + func main() { + flag.Parse() + + if *args != "" { + pprof.EnablePMU(*args) + } + cpuf, err := os.Create("test3_profile") if err != nil { log.Fatal(err) From e70dce461cfaa1fd2c4cd748ba3d41db23ed5548 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 9 Jun 2019 19:47:14 -0700 Subject: [PATCH 009/126] separete PMU from the execution path of itimer() --- src/runtime/cpuprof.go | 29 +++++++++++++ src/runtime/defs_linux_amd64.go | 1 + src/runtime/proc.go | 48 +++++++++++++++++++++- src/runtime/runtime2.go | 6 ++- src/runtime/signal_sighandler.go | 8 +++- src/runtime/signal_unix.go | 70 ++++++++++++++++++++++++-------- 6 files changed, 138 insertions(+), 24 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 81038f5c48..9256567760 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -81,6 +81,35 @@ func SetCPUProfileRate(hz int) { unlock(&cpuprof.lock) } +func SetCPUPMUProfile(event int32, hz int) { + if hz < 0 { + hz = 0 + } + if hz > 1000000 { + hz = 1000000 + } + lock(&cpuprof.lock) + if hz > 0 { + if cpuprof.on || cpuprof.log != nil { + print("runtime: cannot set cpu profile rate until previous profile has finished.\n") + unlock(&cpuprof.lock) + return + } + + cpuprof.on = true + cpuprof.log = newProfBuf(1, 1<<17, 1<<14) + hdr := [1]uint64{uint64(hz)} + cpuprof.log.write(nil, nanotime(), hdr[:], nil) + setcpupmuprofile(event, int32(hz)) + } else if cpuprof.on { + setcpupmuprofile(event, 0) + cpuprof.on = false + cpuprof.addExtra() + cpuprof.log.close() + } + unlock(&cpuprof.lock) +} + // add adds the stack trace to the profile. // It is called from signal handlers and other limited environments // and cannot allocate memory or acquire locks that might be diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 9aa88cbde4..00260f15a8 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -57,6 +57,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f + _SIGRTMIN = 0x22 _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/proc.go b/src/runtime/proc.go index e9eca23138..c8ed1cb5f8 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2134,7 +2134,7 @@ func gcstopm() { // acquiring a P in several places. // //go:yeswritebarrierrec -func execute(gp *g, inheritTime bool) { +func execute(gp *g, inheritTime bool) { // psu: is it always invoked later than setcpupmuprofile() _g_ := getg() casgstatus(gp, _Grunnable, _Grunning) @@ -2149,8 +2149,14 @@ func execute(gp *g, inheritTime bool) { // Check whether the profiler needs to be turned on or off. hz := sched.profilehz + event := sched.event + isPMUEnabled := sched.isPMUEnabled if _g_.m.profilehz != hz { - setThreadCPUProfiler(hz) + if isPMUEnabled { + setThreadCPUPMUProfiler(event, hz) + } else { + setThreadCPUProfiler(hz) + } } if trace.enabled { @@ -3887,6 +3893,7 @@ func setcpuprofilerate(hz int32) { atomic.Store(&prof.signalLock, 0) lock(&sched.lock) + sched.isPMUEnabled = false sched.profilehz = hz unlock(&sched.lock) @@ -3897,6 +3904,43 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } +func setcpupmuprofile(event int32, hz int32) { + // Force sane arguments. + if hz < 0 { + hz = 0 + } + // Disable preemption, otherwise we can be rescheduled to another thread + // that has profiling enabled. + _g_ := getg() + _g_.m.locks++ + + // Stop profiler on this thread so that it is safe to lock prof. + // if a profiling signal came in while we had prof locked, + // it would deadlock. + setThreadCPUPMUProfiler(event, 0) + + for !atomic.Cas(&prof.signalLock, 0, 1) { + osyield() + } + if prof.hz != hz { + setProcessCPUPMUProfiler(hz) + prof.hz = hz + } + atomic.Store(&prof.signalLock, 0) + + lock(&sched.lock) + sched.profilehz = hz + sched.isPMUEnabled = true + sched.event = event + unlock(&sched.lock) + + if hz != 0 { + setThreadCPUPMUProfiler(event, hz) + } + + _g_.m.locks-- + } + // init initializes pp, which may be a freshly allocated p or a // previously destroyed p, and transitions it to status _Pgcstop. func (pp *p) init(id int32) { diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index bc5b48222b..e8e579d905 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,7 +473,7 @@ type m struct { locks int32 dying int32 profilehz int32 - spinning bool // m is out of work and is actively looking for work + spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack printlock int8 @@ -673,7 +673,9 @@ type schedt struct { safePointWait int32 safePointNote note - profilehz int32 // cpu profiling rate + profilehz int32 // cpu profiling rate + isPMUEnabled bool + event int32 procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 481ba3800f..d850a61e0e 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -34,14 +34,18 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { _g_ := getg() c := &sigctxt{info, ctxt} - if sig == _SIGPROF { + if sig == _SIGRTMIN + 3 { fd := info.si_fd - // print(fd, "\n") ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return } + + if sig == _SIGPROF { + sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) + return + } if sig == _SIGTRAP && testSigtrap != nil && testSigtrap(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp) { return diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 3c54347f90..d872b30de6 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -149,11 +149,11 @@ func sigenable(sig uint32) { return } - // SIGPROF is handled specially for profiling. - if sig == _SIGPROF { + // SIGPROF and _SIGRTMIN + 3 are handled specially for profiling. + if sig == _SIGPROF || sig == _SIGRTMIN + 3 { return } - + t := &sigtable[sig] if t.flags&_SigNotify != 0 { ensureSigM() @@ -174,8 +174,8 @@ func sigdisable(sig uint32) { return } - // SIGPROF is handled specially for profiling. - if sig == _SIGPROF { + // SIGPROF and _SIGRTMIN + 3 are handled specially for profiling. + if sig == _SIGPROF || sig == _SIGRTMIN + 3 { return } @@ -203,8 +203,8 @@ func sigignore(sig uint32) { return } - // SIGPROF is handled specially for profiling. - if sig == _SIGPROF { + // SIGPROF and _SIGRTMIN + 3 are handled specially for profiling. + if sig == _SIGPROF || sig == _SIGRTMIN + 3 { return } @@ -251,30 +251,64 @@ func setProcessCPUProfiler(hz int32) { } } +func setProcessCPUPMUProfiler(hz int32) { + if hz != 0 { + // Enable the Go signal handler if not enabled. + if atomic.Cas(&handlingSig[_SIGRTMIN + 3], 0, 1) { + atomic.Storeuintptr(&fwdSig[_SIGRTMIN + 3], getsig(_SIGRTMIN + 3)) + setsig(_SIGRTMIN + 3, funcPC(sighandler)) + } + } else { + // If the Go signal handler should be disabled by default, + // disable it if it is enabled. + if !sigInstallGoHandler(_SIGRTMIN + 3) { + if atomic.Cas(&handlingSig[_SIGRTMIN + 3], 1, 0) { + setsig(_SIGRTMIN + 3, atomic.Loaduintptr(&fwdSig[_SIGRTMIN + 3])) + } + } + } +} + // setThreadCPUProfiler makes any thread-specific changes required to // implement profiling at a rate of hz. func setThreadCPUProfiler(hz int32) { - if hz != 0 { + var it itimerval + if hz == 0 { + setitimer(_ITIMER_PROF, &it, nil) + } else { + it.it_interval.tv_sec = 0 + it.it_interval.set_usec(1000000 / hz) + it.it_value = it.it_interval + setitimer(_ITIMER_PROF, &it, nil) + } + _g_ := getg() + _g_.m.profilehz = hz +} + +func setThreadCPUPMUProfiler(event int32, hz int32) { + // if hz == 0 { + // Todo: close the perf event + + // } else { + if hz != 0 { var attr PerfEventAttr attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) - attr.Config = PERF_COUNT_HW_CPU_CYCLES + attr.Config = /*PERF_COUNT_HW_CPU_CYCLES*/ uint64(event) attr.Sample = 3e9 / uint64(hz) // match itimer's sampling rate - // attr.Sample = 1e6 + // attr.Sample = uint64(hz) fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) - fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPROF) + fcntl(fd, /*F_SETSIG*/ 0xa, _SIGRTMIN + 3) fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); - - // print(r, "\n") - } - _g_ := getg() - _g_.m.profilehz = hz + } + _g_ := getg() + _g_.m.profilehz = hz } func sigpipe() { @@ -302,7 +336,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { g := getg() if g == nil { c := &sigctxt{info, ctx} - if sig == _SIGPROF { + if sig == _SIGPROF || sig == _SIGRTMIN + 3 { sigprofNonGoPC(c.sigpc()) return } @@ -459,7 +493,7 @@ func dieFromSignal(sig uint32) { // thread, and the Go program does not want to handle it (that is, the // program has not called os/signal.Notify for the signal). func raisebadsignal(sig uint32, c *sigctxt) { - if sig == _SIGPROF { + if sig == _SIGPROF || sig == _SIGRTMIN + 3 { // Ignore profiling signals that arrive on non-Go threads. return } From 51c4d159ebd5396b4cd6100d72677ec50b2965b9 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 9 Jun 2019 19:48:58 -0700 Subject: [PATCH 010/126] minor --- src/runtime/proc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index c8ed1cb5f8..52ca644028 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2134,7 +2134,7 @@ func gcstopm() { // acquiring a P in several places. // //go:yeswritebarrierrec -func execute(gp *g, inheritTime bool) { // psu: is it always invoked later than setcpupmuprofile() +func execute(gp *g, inheritTime bool) { // psu: Is it always invoked later than setcpupmuprofile()? _g_ := getg() casgstatus(gp, _Grunnable, _Grunning) From cbddb3b29ea8e9f2eb1e7839451b8d94504682d0 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 11 Jun 2019 17:08:46 -0700 Subject: [PATCH 011/126] disable ioctl and close file descriptor when go rountine --- src/runtime/runtime2.go | 1 + src/runtime/signal_unix.go | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index e8e579d905..981ea1b690 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,6 +473,7 @@ type m struct { locks int32 dying int32 profilehz int32 + eventFd int32 spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index d872b30de6..9306fc4f22 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -286,29 +286,30 @@ func setThreadCPUProfiler(hz int32) { } func setThreadCPUPMUProfiler(event int32, hz int32) { - // if hz == 0 { - // Todo: close the perf event - - // } else { - if hz != 0 { + _g_ := getg() + _g_.m.profilehz = hz + + if hz == 0 { // Go routine is finished + fd := _g_.m.eventFd + ioctl(int64(fd), PERF_EVENT_IOC_DISABLE, 0) + closefd(fd) + } else { var attr PerfEventAttr attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) attr.Config = /*PERF_COUNT_HW_CPU_CYCLES*/ uint64(event) attr.Sample = 3e9 / uint64(hz) // match itimer's sampling rate - // attr.Sample = uint64(hz) fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) - + _g_.m.eventFd = int32(fd) + r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) fcntl(fd, /*F_SETSIG*/ 0xa, _SIGRTMIN + 3) fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} - fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx); + fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) } - _g_ := getg() - _g_.m.profilehz = hz } func sigpipe() { From 1e4ffc3c1486c26334568a3cea6f58f467ef6bcc Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 12 Jun 2019 15:22:06 -0700 Subject: [PATCH 012/126] export env variabls instead of cmd arguments --- src/runtime/cpuprof.go | 6 ++--- src/runtime/pprof/pprof.go | 54 +++++++++++++++++++++++++++++++++++--- src/runtime/proc.go | 10 +++---- src/runtime/runtime2.go | 1 - src/runtime/signal_unix.go | 4 +-- 5 files changed, 59 insertions(+), 16 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 9256567760..0f448243db 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -81,7 +81,7 @@ func SetCPUProfileRate(hz int) { unlock(&cpuprof.lock) } -func SetCPUPMUProfile(event int32, hz int) { +func SetCPUPMUProfile(hz int) { if hz < 0 { hz = 0 } @@ -100,9 +100,9 @@ func SetCPUPMUProfile(event int32, hz int) { cpuprof.log = newProfBuf(1, 1<<17, 1<<14) hdr := [1]uint64{uint64(hz)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) - setcpupmuprofile(event, int32(hz)) + setcpupmuprofile(int32(hz)) } else if cpuprof.on { - setcpupmuprofile(event, 0) + setcpupmuprofile(0) cpuprof.on = false cpuprof.addExtra() cpuprof.log.close() diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 74cdd15cfb..f686a38edd 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -73,10 +73,12 @@ package pprof import ( - "bufio" + "os" + "bufio" "bytes" "fmt" "io" + "strconv" "runtime" "sort" "strings" @@ -727,6 +729,36 @@ var cpu struct { done chan bool } +var pmuConfig struct { + isEnabled bool + event int32 + period int32 +} + +func EnablePMU(str string) { + strs := strings.Split(str, "@") + + if len(strs) != 2 { + return + } + event, err := strconv.ParseInt(strs[0], 10, 32) + if err != nil { + return + } + period, err := strconv.ParseInt(strs[1], 10, 32) + if err != nil { + return + } + if event < 0 || period < 0 { + return + } + + pmuConfig.isEnabled = true + pmuConfig.event = int32(event) +} + +var isPMUEnabled bool + // StartCPUProfile enables CPU profiling for the current process. // While profiling, the profile will be buffered and written to w. // StartCPUProfile returns an error if profiling is already enabled. @@ -760,8 +792,17 @@ func StartCPUProfile(w io.Writer) error { return fmt.Errorf("cpu profiling already in use") } cpu.profiling = true - runtime.SetCPUProfileRate(hz) - go profileWriter(w) + + interval, err := strconv.Atoi(os.Getenv("PMU_SAPLE_INTERVAL")) + if err == nil && interval > 0 { + isPMUEnabled = true + runtime.SetCPUPMUProfile(hz) + } else { + isPMUEnabled = false + runtime.SetCPUProfileRate(hz) + } + + go profileWriter(w) return nil } @@ -805,7 +846,12 @@ func StopCPUProfile() { return } cpu.profiling = false - runtime.SetCPUProfileRate(0) + + if isPMUEnabled { + runtime.SetCPUPMUProfile(0) + } else { + runtime.SetCPUProfileRate(0) + } <-cpu.done } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 52ca644028..e3a7220760 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2149,11 +2149,10 @@ func execute(gp *g, inheritTime bool) { // psu: Is it always invoked later than // Check whether the profiler needs to be turned on or off. hz := sched.profilehz - event := sched.event isPMUEnabled := sched.isPMUEnabled if _g_.m.profilehz != hz { if isPMUEnabled { - setThreadCPUPMUProfiler(event, hz) + setThreadCPUPMUProfiler(hz) } else { setThreadCPUProfiler(hz) } @@ -3904,7 +3903,7 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } -func setcpupmuprofile(event int32, hz int32) { +func setcpupmuprofile(hz int32) { // Force sane arguments. if hz < 0 { hz = 0 @@ -3917,7 +3916,7 @@ func setcpupmuprofile(event int32, hz int32) { // Stop profiler on this thread so that it is safe to lock prof. // if a profiling signal came in while we had prof locked, // it would deadlock. - setThreadCPUPMUProfiler(event, 0) + setThreadCPUPMUProfiler(0) for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() @@ -3931,11 +3930,10 @@ func setcpupmuprofile(event int32, hz int32) { lock(&sched.lock) sched.profilehz = hz sched.isPMUEnabled = true - sched.event = event unlock(&sched.lock) if hz != 0 { - setThreadCPUPMUProfiler(event, hz) + setThreadCPUPMUProfiler(hz) } _g_.m.locks-- diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 981ea1b690..e83fd0769a 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -676,7 +676,6 @@ type schedt struct { profilehz int32 // cpu profiling rate isPMUEnabled bool - event int32 procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 9306fc4f22..1fef94d370 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -285,7 +285,7 @@ func setThreadCPUProfiler(hz int32) { _g_.m.profilehz = hz } -func setThreadCPUPMUProfiler(event int32, hz int32) { +func setThreadCPUPMUProfiler(hz int32) { _g_ := getg() _g_.m.profilehz = hz @@ -297,7 +297,7 @@ func setThreadCPUPMUProfiler(event int32, hz int32) { var attr PerfEventAttr attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) - attr.Config = /*PERF_COUNT_HW_CPU_CYCLES*/ uint64(event) + attr.Config = PERF_COUNT_HW_CPU_CYCLES attr.Sample = 3e9 / uint64(hz) // match itimer's sampling rate fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) From dd728345bbb74d56f5897f9f1ca113823e1e163c Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 12 Jun 2019 15:26:53 -0700 Subject: [PATCH 013/126] minor --- src/runtime/pprof/pprof.go | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index f686a38edd..ee02ff399e 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -729,34 +729,6 @@ var cpu struct { done chan bool } -var pmuConfig struct { - isEnabled bool - event int32 - period int32 -} - -func EnablePMU(str string) { - strs := strings.Split(str, "@") - - if len(strs) != 2 { - return - } - event, err := strconv.ParseInt(strs[0], 10, 32) - if err != nil { - return - } - period, err := strconv.ParseInt(strs[1], 10, 32) - if err != nil { - return - } - if event < 0 || period < 0 { - return - } - - pmuConfig.isEnabled = true - pmuConfig.event = int32(event) -} - var isPMUEnabled bool // StartCPUProfile enables CPU profiling for the current process. From c802fafd448e1615419b6ceb76e312c1a6e48986 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 12 Jun 2019 19:10:15 -0700 Subject: [PATCH 014/126] minor --- src/runtime/cpuprof.go | 17 ++++++++--------- src/runtime/pprof/pprof.go | 24 +++++++++++++++--------- src/runtime/proc.go | 18 +++++++++--------- src/runtime/signal_unix.go | 12 ++++++------ 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 0f448243db..e6877bf3ef 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -81,15 +81,13 @@ func SetCPUProfileRate(hz int) { unlock(&cpuprof.lock) } -func SetCPUPMUProfile(hz int) { - if hz < 0 { - hz = 0 - } - if hz > 1000000 { - hz = 1000000 +func SetCPUPMUProfile(interval int) { + if interval > 0 && interval < 300 { // Clamp hz to something reasonable. + interval = 300 } + lock(&cpuprof.lock) - if hz > 0 { + if interval > 0 { if cpuprof.on || cpuprof.log != nil { print("runtime: cannot set cpu profile rate until previous profile has finished.\n") unlock(&cpuprof.lock) @@ -98,9 +96,10 @@ func SetCPUPMUProfile(hz int) { cpuprof.on = true cpuprof.log = newProfBuf(1, 1<<17, 1<<14) - hdr := [1]uint64{uint64(hz)} + // hdr := [1]uint64{uint64(hz)} + hdr := [1]uint64{uint64(interval)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) - setcpupmuprofile(int32(hz)) + setcpupmuprofile(int32(interval)) } else if cpuprof.on { setcpupmuprofile(0) cpuprof.on = false diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index ee02ff399e..d372b200e9 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -729,7 +729,7 @@ var cpu struct { done chan bool } -var isPMUEnabled bool +var sampleInterval int // StartCPUProfile enables CPU profiling for the current process. // While profiling, the profile will be buffered and written to w. @@ -765,14 +765,20 @@ func StartCPUProfile(w io.Writer) error { } cpu.profiling = true - interval, err := strconv.Atoi(os.Getenv("PMU_SAPLE_INTERVAL")) - if err == nil && interval > 0 { - isPMUEnabled = true - runtime.SetCPUPMUProfile(hz) - } else { - isPMUEnabled = false + if sampleInterval == 0 { // first time StartCPUProfile() is invoked + interval, err := strconv.Atoi(os.Getenv("PMU_SAMPLE_INTERVAL")) + if err == nil && interval > 0 { + sampleInterval = interval + runtime.SetCPUPMUProfile(sampleInterval) + } else { + sampleInterval = -1 + runtime.SetCPUProfileRate(hz) + } + } else if sampleInterval < 0 { runtime.SetCPUProfileRate(hz) - } + } else { + runtime.SetCPUPMUProfile(sampleInterval) + } go profileWriter(w) return nil @@ -819,7 +825,7 @@ func StopCPUProfile() { } cpu.profiling = false - if isPMUEnabled { + if sampleInterval > 0 { runtime.SetCPUPMUProfile(0) } else { runtime.SetCPUProfileRate(0) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index e3a7220760..9065aa3e6d 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3903,10 +3903,10 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } -func setcpupmuprofile(hz int32) { +func setcpupmuprofile(interval int32) { // Force sane arguments. - if hz < 0 { - hz = 0 + if interval > 0 && interval < 300 { + interval = 300 } // Disable preemption, otherwise we can be rescheduled to another thread // that has profiling enabled. @@ -3921,19 +3921,19 @@ func setcpupmuprofile(hz int32) { for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } - if prof.hz != hz { - setProcessCPUPMUProfiler(hz) - prof.hz = hz + if prof.hz != interval { + setProcessCPUPMUProfiler(interval) + prof.hz = interval } atomic.Store(&prof.signalLock, 0) lock(&sched.lock) - sched.profilehz = hz + sched.profilehz = interval sched.isPMUEnabled = true unlock(&sched.lock) - if hz != 0 { - setThreadCPUPMUProfiler(hz) + if interval != 0 { + setThreadCPUPMUProfiler(interval) } _g_.m.locks-- diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 1fef94d370..82150920d8 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -251,8 +251,8 @@ func setProcessCPUProfiler(hz int32) { } } -func setProcessCPUPMUProfiler(hz int32) { - if hz != 0 { +func setProcessCPUPMUProfiler(interval int32) { + if interval != 0 { // Enable the Go signal handler if not enabled. if atomic.Cas(&handlingSig[_SIGRTMIN + 3], 0, 1) { atomic.Storeuintptr(&fwdSig[_SIGRTMIN + 3], getsig(_SIGRTMIN + 3)) @@ -285,11 +285,11 @@ func setThreadCPUProfiler(hz int32) { _g_.m.profilehz = hz } -func setThreadCPUPMUProfiler(hz int32) { +func setThreadCPUPMUProfiler(interval int32) { _g_ := getg() - _g_.m.profilehz = hz + _g_.m.profilehz = interval - if hz == 0 { // Go routine is finished + if interval == 0 { // Go routine is finished fd := _g_.m.eventFd ioctl(int64(fd), PERF_EVENT_IOC_DISABLE, 0) closefd(fd) @@ -298,7 +298,7 @@ func setThreadCPUPMUProfiler(hz int32) { attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) attr.Config = PERF_COUNT_HW_CPU_CYCLES - attr.Sample = 3e9 / uint64(hz) // match itimer's sampling rate + attr.Sample = uint64(interval) fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) _g_.m.eventFd = int32(fd) From 456f93cd185c2200ec09153cf1727b0053815ad5 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 12 Jun 2019 23:43:55 -0700 Subject: [PATCH 015/126] sth to todo --- src/runtime/cpuprof.go | 4 ++-- src/runtime/proc.go | 4 ++-- src/runtime/signal_unix.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index e6877bf3ef..65925f1947 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -82,7 +82,8 @@ func SetCPUProfileRate(hz int) { } func SetCPUPMUProfile(interval int) { - if interval > 0 && interval < 300 { // Clamp hz to something reasonable. + // Clamp interval to something reasonable. + if interval > 0 && interval < 300 { interval = 300 } @@ -96,7 +97,6 @@ func SetCPUPMUProfile(interval int) { cpuprof.on = true cpuprof.log = newProfBuf(1, 1<<17, 1<<14) - // hdr := [1]uint64{uint64(hz)} hdr := [1]uint64{uint64(interval)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) setcpupmuprofile(int32(interval)) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 9065aa3e6d..931a25d9aa 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3921,14 +3921,14 @@ func setcpupmuprofile(interval int32) { for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } - if prof.hz != interval { + if prof.hz != interval { // Todo: declare a new field in prof, say prof.interval, and replace prof.hz with prof.interval setProcessCPUPMUProfiler(interval) prof.hz = interval } atomic.Store(&prof.signalLock, 0) lock(&sched.lock) - sched.profilehz = interval + sched.profilehz = interval // Todo: declare a new field in sched, say sched.profileInterval, and replace sched.profilehz with sched.profileInterval sched.isPMUEnabled = true unlock(&sched.lock) diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 82150920d8..efb31283e0 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -287,7 +287,7 @@ func setThreadCPUProfiler(hz int32) { func setThreadCPUPMUProfiler(interval int32) { _g_ := getg() - _g_.m.profilehz = interval + _g_.m.profilehz = interval // Todo: declare a new field in m, say m.profileInterval, and replace m.profilehz with m.profileInterval if interval == 0 { // Go routine is finished fd := _g_.m.eventFd From 825961c232b074e63246c01362121f122ee9d268 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 17 Jun 2019 15:54:55 -0700 Subject: [PATCH 016/126] merge Joshua's patch --- src/runtime/cpuprof.go | 16 ++--- src/runtime/pprof/pprof.go | 122 ++++++++++++++++++++++++++++--------- src/runtime/proc.go | 25 ++++---- src/runtime/signal_unix.go | 12 ++-- 4 files changed, 120 insertions(+), 55 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 65925f1947..2291813b5e 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -81,14 +81,14 @@ func SetCPUProfileRate(hz int) { unlock(&cpuprof.lock) } -func SetCPUPMUProfile(interval int) { - // Clamp interval to something reasonable. - if interval > 0 && interval < 300 { - interval = 300 +func SetPMUProfilePeriod(period int) { + // Clamp period to something reasonable. + if period > 0 && period < 300 { + period = 300 } lock(&cpuprof.lock) - if interval > 0 { + if period > 0 { if cpuprof.on || cpuprof.log != nil { print("runtime: cannot set cpu profile rate until previous profile has finished.\n") unlock(&cpuprof.lock) @@ -97,11 +97,11 @@ func SetCPUPMUProfile(interval int) { cpuprof.on = true cpuprof.log = newProfBuf(1, 1<<17, 1<<14) - hdr := [1]uint64{uint64(interval)} + hdr := [1]uint64{uint64(period)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) - setcpupmuprofile(int32(interval)) + setpmuprofileperiod(int32(period)) } else if cpuprof.on { - setcpupmuprofile(0) + setpmuprofileperiod(0) cpuprof.on = false cpuprof.addExtra() cpuprof.log.close() diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index d372b200e9..70bb0be5ff 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -73,12 +73,11 @@ package pprof import ( - "os" "bufio" "bytes" - "fmt" + "errors" + "fmt" "io" - "strconv" "runtime" "sort" "strings" @@ -727,9 +726,15 @@ var cpu struct { sync.Mutex profiling bool done chan bool -} -var sampleInterval int + // config state implemented by StartCPUProfile, customized by any + // ProfilingOptions passed to it. + profileHz int + + // PMU profiling config + pmuProfileHz int + pmuProfilePeriod int +} // StartCPUProfile enables CPU profiling for the current process. // While profiling, the profile will be buffered and written to w. @@ -742,7 +747,7 @@ var sampleInterval int // not to the one used by Go. To make it work, call os/signal.Notify // for syscall.SIGPROF, but note that doing so may break any profiling // being done by the main program. -func StartCPUProfile(w io.Writer) error { +func StartCPUProfile(w io.Writer, opts ...ProfilingOption) error { // The runtime routines allow a variable profiling rate, // but in practice operating systems cannot trigger signals // at more than about 500 Hz, and our processing of the @@ -752,7 +757,9 @@ func StartCPUProfile(w io.Writer) error { // system, and a nice round number to make it easy to // convert sample counts to seconds. Instead of requiring // each client to specify the frequency, we hard code it. - const hz = 100 + if len(opts) == 0 { + opts = []ProfilingOption{WithProfilingRate(100)} + } cpu.Lock() defer cpu.Unlock() @@ -764,26 +771,76 @@ func StartCPUProfile(w io.Writer) error { return fmt.Errorf("cpu profiling already in use") } cpu.profiling = true - - if sampleInterval == 0 { // first time StartCPUProfile() is invoked - interval, err := strconv.Atoi(os.Getenv("PMU_SAMPLE_INTERVAL")) - if err == nil && interval > 0 { - sampleInterval = interval - runtime.SetCPUPMUProfile(sampleInterval) - } else { - sampleInterval = -1 - runtime.SetCPUProfileRate(hz) - } - } else if sampleInterval < 0 { - runtime.SetCPUProfileRate(hz) - } else { - runtime.SetCPUPMUProfile(sampleInterval) - } - + + for _, opt := range opts { + if err := opt.apply(); err != nil { + return err + } + } + + if cpu.profileHz != 0 { + runtime.SetCPUProfileRate(cpu.profileHz) + } + + if cpu.pmuProfilePeriod != 0 { + runtime.SetPMUProfilePeriod(cpu.pmuProfilePeriod) + } + + /* + if cpu.pmuProfileHz != 0 { + runtime.SetPMUProfileRate(cpu.pmuProfileHz) + } + */ + go profileWriter(w) return nil } +func WithProfilingRate(hz int) ProfilingOption { + return profilingOptionFunc(func() error { + cpu.profileHz = hz + return nil + }) +} + +func WithProfilingCycleRate(hz int) ProfilingOption { + return profilingOptionFunc(func() error { + cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate + + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { + return errors.New("not implemneted") + } + cpu.pmuProfileHz = hz + + return nil + }) +} + +func WithProfilingCyclePeriod(period int) ProfilingOption { + return profilingOptionFunc(func() error { + cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate + + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { + return errors.New("not implemneted") + } + cpu.pmuProfilePeriod = period + + return nil + }) +} + +// func WithProfilingCacheMisses(/* TODO */) ProfilingOption + +// func WithPMUFancy(w io.Writer) ProfilingOption + +type ProfilingOption interface { + apply() error +} + +type profilingOptionFunc func() error + +func (pof profilingOptionFunc) apply() error { return pof() } + // readProfile, provided by the runtime, returns the next chunk of // binary CPU profiling stack trace data, blocking until data is available. // If profiling is turned off and all the profile data accumulated while it was @@ -825,12 +882,19 @@ func StopCPUProfile() { } cpu.profiling = false - if sampleInterval > 0 { - runtime.SetCPUPMUProfile(0) - } else { - runtime.SetCPUProfileRate(0) - } - <-cpu.done + if cpu.profileHz != 0 { + runtime.SetCPUProfileRate(0) + } + + if cpu.pmuProfilePeriod != 0 { + runtime.SetPMUProfilePeriod(0) + } + /* + if cpu.pmuProfileHz != 0 { + runtime.SetPMUProfileRate(0) + } + */ + <-cpu.done } // countBlock returns the number of records in the blocking profile. diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 931a25d9aa..0b0146673a 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2134,7 +2134,7 @@ func gcstopm() { // acquiring a P in several places. // //go:yeswritebarrierrec -func execute(gp *g, inheritTime bool) { // psu: Is it always invoked later than setcpupmuprofile()? +func execute(gp *g, inheritTime bool) { // psu: Is it always invoked later than setpmuprofileperiod()? _g_ := getg() casgstatus(gp, _Grunnable, _Grunning) @@ -2152,7 +2152,7 @@ func execute(gp *g, inheritTime bool) { // psu: Is it always invoked later than isPMUEnabled := sched.isPMUEnabled if _g_.m.profilehz != hz { if isPMUEnabled { - setThreadCPUPMUProfiler(hz) + setThreadPMUProfiler(hz) } else { setThreadCPUProfiler(hz) } @@ -3903,11 +3903,12 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } -func setcpupmuprofile(interval int32) { +func setpmuprofileperiod(period int32) { // Force sane arguments. - if interval > 0 && interval < 300 { - interval = 300 + if period < 0 { + period = 0 } + // Disable preemption, otherwise we can be rescheduled to another thread // that has profiling enabled. _g_ := getg() @@ -3916,24 +3917,24 @@ func setcpupmuprofile(interval int32) { // Stop profiler on this thread so that it is safe to lock prof. // if a profiling signal came in while we had prof locked, // it would deadlock. - setThreadCPUPMUProfiler(0) + setThreadPMUProfiler(0) for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } - if prof.hz != interval { // Todo: declare a new field in prof, say prof.interval, and replace prof.hz with prof.interval - setProcessCPUPMUProfiler(interval) - prof.hz = interval + if prof.hz != period { // Todo: declare a new field in prof, say prof.period, and replace prof.hz with prof.period + setProcessPMUProfiler(period) + prof.hz = period } atomic.Store(&prof.signalLock, 0) lock(&sched.lock) - sched.profilehz = interval // Todo: declare a new field in sched, say sched.profileInterval, and replace sched.profilehz with sched.profileInterval + sched.profilehz = period // Todo: declare a new field in sched, say sched.profilePeriod, and replace sched.profilehz with sched.profilePeriod sched.isPMUEnabled = true unlock(&sched.lock) - if interval != 0 { - setThreadCPUPMUProfiler(interval) + if period != 0 { + setThreadPMUProfiler(period) } _g_.m.locks-- diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index efb31283e0..7181589a92 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -251,8 +251,8 @@ func setProcessCPUProfiler(hz int32) { } } -func setProcessCPUPMUProfiler(interval int32) { - if interval != 0 { +func setProcessPMUProfiler(period int32) { + if period != 0 { // Enable the Go signal handler if not enabled. if atomic.Cas(&handlingSig[_SIGRTMIN + 3], 0, 1) { atomic.Storeuintptr(&fwdSig[_SIGRTMIN + 3], getsig(_SIGRTMIN + 3)) @@ -285,11 +285,11 @@ func setThreadCPUProfiler(hz int32) { _g_.m.profilehz = hz } -func setThreadCPUPMUProfiler(interval int32) { +func setThreadPMUProfiler(period int32) { _g_ := getg() - _g_.m.profilehz = interval // Todo: declare a new field in m, say m.profileInterval, and replace m.profilehz with m.profileInterval + _g_.m.profilehz = period // Todo: declare a new field in m, say m.profilePeriod, and replace m.profilehz with m.profilePeriod - if interval == 0 { // Go routine is finished + if period == 0 { // Go routine is finished fd := _g_.m.eventFd ioctl(int64(fd), PERF_EVENT_IOC_DISABLE, 0) closefd(fd) @@ -298,7 +298,7 @@ func setThreadCPUPMUProfiler(interval int32) { attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) attr.Config = PERF_COUNT_HW_CPU_CYCLES - attr.Sample = uint64(interval) + attr.Sample = uint64(period) fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) _g_.m.eventFd = int32(fd) From d2fcc3bae972aaaa374c1becfb2fa728194c7ce1 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 17 Jun 2019 17:23:59 -0700 Subject: [PATCH 017/126] minor --- src/runtime/defs_linux_amd64.go | 3 ++- src/runtime/os_linux.go | 10 +++++----- src/runtime/pprof/pprof.go | 2 +- src/runtime/signal_unix.go | 6 +++--- src/runtime/sys_linux_amd64.s | 16 ++++++++-------- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 00260f15a8..1695e38a3d 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -130,7 +130,8 @@ type siginfo struct { si_addr uint64 // psu: an unreliable workaround and need to figure out a better solution - si_fd int64 + // si_fd int64 + si_fd int32 } diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index ab9b216078..8cc582e249 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -357,15 +357,15 @@ func sigaltstack(new, old *stackt) func setitimer(mode int32, new, old *itimerval) //go:noescape -func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r, r2, err int64) +func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) -func ioctl(fd, req, arg int64) int64 +func ioctl(fd int32, req, arg int64) int64 -// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) -func fcntl(fd, cmd, arg int64) (r, err int64) +// func fcntl(fd, cmd int64, arg interface{}) (r int32, err int64) +func fcntl(fd int32, cmd, arg int64) (r int64, err int64) //go:noescape -func fcntl2(fd, cmd int64, arg *fOwnerEx) (r, err int64) +func fcntl2(fd int32, cmd int64, arg *fOwnerEx) (r int64, err int64) //go:noescape func rtsigprocmask(how int32, new, old *sigset, size int32) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 70bb0be5ff..a3569889b6 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -821,7 +821,7 @@ func WithProfilingCyclePeriod(period int) ProfilingOption { cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemneted") + return errors.New("not implemented") } cpu.pmuProfilePeriod = period diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 7181589a92..fc65cdba5d 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -291,7 +291,7 @@ func setThreadPMUProfiler(period int32) { if period == 0 { // Go routine is finished fd := _g_.m.eventFd - ioctl(int64(fd), PERF_EVENT_IOC_DISABLE, 0) + // ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) closefd(fd) } else { var attr PerfEventAttr @@ -301,8 +301,8 @@ func setThreadPMUProfiler(period int32) { attr.Sample = uint64(period) fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) - _g_.m.eventFd = int32(fd) - + _g_.m.eventFd = fd + r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) fcntl(fd, /*F_SETSIG*/ 0xa, _SIGRTMIN + 3) diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index ee4df25f0e..64dd7160d1 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -168,7 +168,7 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0-24 SYSCALL RET -// func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r, r2, err int64) +// func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 MOVQ attr+0(FP), DI MOVQ pid+8(FP), SI @@ -180,20 +180,20 @@ TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 SYSCALL CMPQ AX, $0xfffffffffffff001 JLS ok - MOVQ $-1, r+48(FP) + MOVL $-1, r+48(FP) MOVQ $0, r2+56(FP) NEGQ AX MOVQ AX, err+64(FP) RET ok: - MOVQ AX, r+48(FP) + MOVL AX, r+48(FP) MOVQ DX, r2+56(FP) MOVQ $0, err+64(FP) RET -// func ioctl(fd, req, arg int64) int64 +// func ioctl(fd int32, req, arg int64) int64 TEXT runtime·ioctl(SB),NOSPLIT,$0 - MOVQ fd+0(FP), DI + MOVL fd+0(FP), DI MOVQ req+8(FP), SI MOVQ arg+16(FP), DX MOVQ $SYS_ioctl, AX @@ -201,9 +201,9 @@ TEXT runtime·ioctl(SB),NOSPLIT,$0 MOVQ AX, ret+24(FP) RET -// func fcntl(fd, cmd arg int64) (r int64, err int64) +// func fcntl(fd int32, cmd arg int64) (r int64, err int64) TEXT runtime·fcntl(SB),NOSPLIT,$0 - MOVQ fd+0(FP), DI + MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX MOVQ $SYS_fcntl, AX @@ -220,7 +220,7 @@ ok: RET TEXT runtime·fcntl2(SB),NOSPLIT,$0 - MOVQ fd+0(FP), DI + MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX MOVQ $SYS_fcntl, AX From 66654bf0f1e21af184589e232e74bb52986283d9 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 17 Jun 2019 17:25:15 -0700 Subject: [PATCH 018/126] minor --- src/runtime/os_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 8cc582e249..334a7b4223 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -361,7 +361,7 @@ func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) ( func ioctl(fd int32, req, arg int64) int64 -// func fcntl(fd, cmd int64, arg interface{}) (r int32, err int64) +// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) func fcntl(fd int32, cmd, arg int64) (r int64, err int64) //go:noescape From e4c59d157ab6851fcedac1ff40ad57f40dbdf37f Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 17 Jun 2019 20:52:15 -0700 Subject: [PATCH 019/126] minor --- src/runtime/cpuprof.go | 2 +- src/runtime/proc.go | 34 ++++++++++++++++------------------ src/runtime/runtime2.go | 5 +++-- src/runtime/signal_unix.go | 2 +- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 2291813b5e..6d4af0d36c 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -121,7 +121,7 @@ func (p *cpuProfile) add(gp *g, stk []uintptr) { osyield() } - if prof.hz != 0 { // implies cpuprof.log != nil + if prof.hz != 0 || prof.period != 0 { // implies cpuprof.log != nil if p.numExtra > 0 || p.lostExtra > 0 { p.addExtra() } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 0b0146673a..d3cb45af1f 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2134,7 +2134,7 @@ func gcstopm() { // acquiring a P in several places. // //go:yeswritebarrierrec -func execute(gp *g, inheritTime bool) { // psu: Is it always invoked later than setpmuprofileperiod()? +func execute(gp *g, inheritTime bool) { _g_ := getg() casgstatus(gp, _Grunnable, _Grunning) @@ -2149,14 +2149,14 @@ func execute(gp *g, inheritTime bool) { // psu: Is it always invoked later than // Check whether the profiler needs to be turned on or off. hz := sched.profilehz - isPMUEnabled := sched.isPMUEnabled + period := sched.profilePeriod + if _g_.m.profilehz != hz { - if isPMUEnabled { - setThreadPMUProfiler(hz) - } else { - setThreadCPUProfiler(hz) - } - } + setThreadCPUProfiler(hz) + } + if _g_.m.profilePeriod != period { + setThreadPMUProfiler(period) + } if trace.enabled { // GoSysExit has to happen when we have a P, but before GoStart. @@ -3623,6 +3623,7 @@ func mcount() int32 { var prof struct { signalLock uint32 hz int32 + period int32 } func _System() { _System() } @@ -3639,10 +3640,9 @@ var lostAtomic64Count uint64 // Called by the signal handler, may run during STW. //go:nowritebarrierrec func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { - if prof.hz == 0 { + if prof.hz == 0 && prof.period == 0 { // psu: is it safe to do so? return } - // On mips{,le}, 64bit atomics are emulated with spinlocks, in // runtime/internal/atomic. If SIGPROF arrives while the program is inside // the critical section, it creates a deadlock (when writing the sample). @@ -3791,7 +3791,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { } } - if prof.hz != 0 { + if prof.hz != 0 || prof.period != 0 { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostAtomic64Count > 0 { cpuprof.addLostAtomic64(lostAtomic64Count) lostAtomic64Count = 0 @@ -3814,7 +3814,7 @@ var sigprofCallersUse uint32 //go:nosplit //go:nowritebarrierrec func sigprofNonGo() { - if prof.hz != 0 { + if prof.hz != 0 || prof.period != 0 { n := 0 for n < len(sigprofCallers) && sigprofCallers[n] != 0 { n++ @@ -3831,7 +3831,7 @@ func sigprofNonGo() { //go:nosplit //go:nowritebarrierrec func sigprofNonGoPC(pc uintptr) { - if prof.hz != 0 { + if prof.hz != 0 || prof.period != 0 { stk := []uintptr{ pc, funcPC(_ExternalCode) + sys.PCQuantum, @@ -3892,7 +3892,6 @@ func setcpuprofilerate(hz int32) { atomic.Store(&prof.signalLock, 0) lock(&sched.lock) - sched.isPMUEnabled = false sched.profilehz = hz unlock(&sched.lock) @@ -3922,15 +3921,14 @@ func setpmuprofileperiod(period int32) { for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } - if prof.hz != period { // Todo: declare a new field in prof, say prof.period, and replace prof.hz with prof.period + if prof.period != period { setProcessPMUProfiler(period) - prof.hz = period + prof.period = period } atomic.Store(&prof.signalLock, 0) lock(&sched.lock) - sched.profilehz = period // Todo: declare a new field in sched, say sched.profilePeriod, and replace sched.profilehz with sched.profilePeriod - sched.isPMUEnabled = true + sched.profilePeriod = period unlock(&sched.lock) if period != 0 { diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index e83fd0769a..226d5a053e 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,6 +473,7 @@ type m struct { locks int32 dying int32 profilehz int32 + profilePeriod int32 eventFd int32 spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note @@ -519,6 +520,7 @@ type m struct { dlogPerM mOS + } type p struct { @@ -675,8 +677,7 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - isPMUEnabled bool - + profilePeriod int32 procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index fc65cdba5d..8925f3360b 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -287,7 +287,7 @@ func setThreadCPUProfiler(hz int32) { func setThreadPMUProfiler(period int32) { _g_ := getg() - _g_.m.profilehz = period // Todo: declare a new field in m, say m.profilePeriod, and replace m.profilehz with m.profilePeriod + _g_.m.profilePeriod = period if period == 0 { // Go routine is finished fd := _g_.m.eventFd From 31956bfd5da2a309091bcd07357b2d822e9e5774 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 18 Jun 2019 21:29:50 -0700 Subject: [PATCH 020/126] separate PMU's output from itimer's --- src/runtime/pprof/pprof.go | 57 +++++++++++++++------- src/runtime/pprof/proto.go | 97 +++++++++++++++++++++++++++++++++++++- 2 files changed, 135 insertions(+), 19 deletions(-) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index a3569889b6..ee3e3a48e5 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -777,6 +777,10 @@ func StartCPUProfile(w io.Writer, opts ...ProfilingOption) error { return err } } + + if cpu.profileHz != 0 && cpu.pmuProfilePeriod != 0 { + return fmt.Errorf("itimer- and PMU-based profilings cannot work simultaneouly") + } if cpu.profileHz != 0 { runtime.SetCPUProfileRate(cpu.profileHz) @@ -785,7 +789,7 @@ func StartCPUProfile(w io.Writer, opts ...ProfilingOption) error { if cpu.pmuProfilePeriod != 0 { runtime.SetPMUProfilePeriod(cpu.pmuProfilePeriod) } - + /* if cpu.pmuProfileHz != 0 { runtime.SetPMUProfileRate(cpu.pmuProfileHz) @@ -808,7 +812,7 @@ func WithProfilingCycleRate(hz int) ProfilingOption { cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemneted") + return errors.New("not implemented") } cpu.pmuProfileHz = hz @@ -851,22 +855,39 @@ func readProfile() (data []uint64, tags []unsafe.Pointer, eof bool) func profileWriter(w io.Writer) { b := newProfileBuilder(w) var err error - for { - time.Sleep(100 * time.Millisecond) - data, tags, eof := readProfile() - if e := b.addCPUData(data, tags); e != nil && err == nil { - err = e - } - if eof { - break - } - } - if err != nil { - // The runtime should never produce an invalid or truncated profile. - // It drops records that can't fit into its log buffers. - panic("runtime/pprof: converting profile: " + err.Error()) - } - b.build() + if cpu.profileHz != 0 { + for { + time.Sleep(100 * time.Millisecond) + data, tags, eof := readProfile() + if e := b.addCPUData(data, tags); e != nil && err == nil { + err = e + } + if eof { + break + } + } + if err != nil { + // The runtime should never produce an invalid or truncated profile. + // It drops records that can't fit into its log buffers. + panic("runtime/pprof: converting profile: " + err.Error()) + } + b.build() + } else { // i.e., cpu.pmuProfilePeriod != 0 + for { + time.Sleep(100 * time.Millisecond) + data, tags, eof := readProfile() + if e := b.addPMUData(data, tags); e != nil && err == nil { + err = e + } + if eof { + break + } + } + if err != nil { + panic("runtime/pprof: converting profile: " + err.Error()) + } + b.pmuBuild() + } cpu.done <- true } diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index 7864dd79ad..a409c83350 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -33,6 +33,7 @@ type profileBuilder struct { end time.Time havePeriod bool period int64 + isPMUEnabled bool m profMap // encoding state @@ -374,6 +375,47 @@ func (b *profileBuilder) addCPUData(data []uint64, tags []unsafe.Pointer) error return nil } +func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error { + if !b.isPMUEnabled { + // first record is period + if len(data) < 3 { + return fmt.Errorf("truncated profile") + } + if data[0] != 3 || data[2] == 0 { + return fmt.Errorf("malformed profile") + } + b.isPMUEnabled = true + data = data[3:] + } + + for len(data) > 0 { + if len(data) < 3 || data[0] > uint64(len(data)) { + return fmt.Errorf("truncated profile") + } + if data[0] < 3 || tags != nil && len(tags) < 1 { + return fmt.Errorf("malformed profile") + } + count := data[2] + stk := data[3:data[0]] + data = data[data[0]:] + var tag unsafe.Pointer + if tags != nil { + tag = tags[0] + tags = tags[1:] + } + + if count == 0 && len(stk) == 1 { + // overflow record + count = uint64(stk[0]) + stk = []uint64{ + uint64(funcPC(lostProfileEvent)), + } + } + b.m.lookup(stk, tag).count += int64(count) + } + return nil +} + // build completes and returns the constructed profile. func (b *profileBuilder) build() { b.end = time.Now() @@ -381,7 +423,7 @@ func (b *profileBuilder) build() { b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) if b.havePeriod { // must be CPU profile b.pbValueType(tagProfile_SampleType, "samples", "count") - b.pbValueType(tagProfile_SampleType, "cpu", "nanoseconds") + b.pbValueType(tagProfile_SampleType, "cpu", "nanoseconds") b.pb.int64Opt(tagProfile_DurationNanos, b.end.Sub(b.start).Nanoseconds()) b.pbValueType(tagProfile_PeriodType, "cpu", "nanoseconds") b.pb.int64Opt(tagProfile_Period, b.period) @@ -435,6 +477,59 @@ func (b *profileBuilder) build() { b.zw.Close() } +func (b *profileBuilder) pmuBuild() { + b.end = time.Now() + + b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) + b.pbValueType(tagProfile_SampleType, "samples", "count") + b.pbValueType(tagProfile_SampleType, "cpu cycles", "count") + // b.pb.int64Opt(tagProfile_DurationNanos, b.end.Sub(b.start).Nanoseconds()) + + values := []int64{0, 0} + var locs []uint64 + for e := b.m.all; e != nil; e = e.nextAll { + values[0] = e.count + values[1] = e.count * 100 + + var labels func() + if e.tag != nil { + labels = func() { + for k, v := range *(*labelMap)(e.tag) { + b.pbLabel(tagSample_Label, k, v, 0) + } + } + } + + locs = locs[:0] + for i, addr := range e.stk { + // Addresses from stack traces point to the + // next instruction after each call, except + // for the leaf, which points to where the + // signal occurred. locForPC expects return + // PCs, so increment the leaf address to look + // like a return PC. + if i == 0 { + addr++ + } + l := b.locForPC(addr) + if l == 0 { // runtime.goexit + continue + } + locs = append(locs, l) + } + b.pbSample(values, locs, labels) + } + + for i, m := range b.mem { + hasFunctions := m.funcs == lookupTried // lookupTried but not lookupFailed + b.pbMapping(tagProfile_Mapping, uint64(i+1), uint64(m.start), uint64(m.end), m.offset, m.file, m.buildID, hasFunctions) + } + + b.pb.strings(tagProfile_StringTable, b.strings) + b.zw.Write(b.pb.data) + b.zw.Close() +} + // readMapping reads /proc/self/maps and writes mappings to b.pb. // It saves the address ranges of the mappings in b.mem for use // when emitting locations. From 4966a3a752f52ebe68cb82da656a605835be24cc Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 20 Jun 2019 14:36:24 -0700 Subject: [PATCH 021/126] precise ip --- src/runtime/cpuprof.go | 9 ++-- src/runtime/pprof/perf_event_linux_amd64.go | 51 ++++++++++++++++++++ src/runtime/pprof/pprof.go | 53 ++++++++++++++++----- src/runtime/pprof/proto.go | 12 ++--- src/runtime/proc.go | 20 +++++--- src/runtime/runtime2.go | 5 +- src/runtime/signal_unix.go | 30 ++++++++++-- 7 files changed, 145 insertions(+), 35 deletions(-) create mode 100644 src/runtime/pprof/perf_event_linux_amd64.go diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 6d4af0d36c..ee0ae142b7 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -81,8 +81,11 @@ func SetCPUProfileRate(hz int) { unlock(&cpuprof.lock) } -func SetPMUProfilePeriod(period int) { +func SetPMUProfilePeriod(event int, period int) { // Clamp period to something reasonable. + if period < 0 { + period = 0 + } if period > 0 && period < 300 { period = 300 } @@ -99,9 +102,9 @@ func SetPMUProfilePeriod(period int) { cpuprof.log = newProfBuf(1, 1<<17, 1<<14) hdr := [1]uint64{uint64(period)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) - setpmuprofileperiod(int32(period)) + setpmuprofileperiod(int32(event), int32(period)) } else if cpuprof.on { - setpmuprofileperiod(0) + setpmuprofileperiod(int32(event), 0) cpuprof.on = false cpuprof.addExtra() cpuprof.log.close() diff --git a/src/runtime/pprof/perf_event_linux_amd64.go b/src/runtime/pprof/perf_event_linux_amd64.go new file mode 100644 index 0000000000..06bccd9fa0 --- /dev/null +++ b/src/runtime/pprof/perf_event_linux_amd64.go @@ -0,0 +1,51 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs1_linux.go + +package pprof + +const ( + PERF_TYPE_HARDWARE = 0x0 + PERF_TYPE_SOFTWARE = 0x1 + PERF_TYPE_TRACEPOINT = 0x2 + PERF_TYPE_HW_CACHE = 0x3 + PERF_TYPE_RAW = 0x4 + PERF_TYPE_BREAKPOINT = 0x5 + + PERF_COUNT_HW_CPU_CYCLES = 0x0 + PERF_COUNT_HW_INSTRUCTIONS = 0x1 + PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + PERF_COUNT_HW_CACHE_MISSES = 0x3 + PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + PERF_COUNT_HW_BRANCH_MISSES = 0x5 + PERF_COUNT_HW_BUS_CYCLES = 0x6 + PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + PERF_COUNT_HW_CACHE_L1D = 0x0 + PERF_COUNT_HW_CACHE_L1I = 0x1 + PERF_COUNT_HW_CACHE_LL = 0x2 + PERF_COUNT_HW_CACHE_DTLB = 0x3 + PERF_COUNT_HW_CACHE_ITLB = 0x4 + PERF_COUNT_HW_CACHE_BPU = 0x5 + PERF_COUNT_HW_CACHE_NODE = 0x6 + + PERF_COUNT_HW_CACHE_OP_READ = 0x0 + PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + PERF_COUNT_SW_CPU_CLOCK = 0x0 + PERF_COUNT_SW_TASK_CLOCK = 0x1 + PERF_COUNT_SW_PAGE_FAULTS = 0x2 + PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + PERF_COUNT_SW_DUMMY = 0x9 + PERF_COUNT_SW_BPF_OUTPUT = 0xa +) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index ee3e3a48e5..16c92b9463 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -733,7 +733,8 @@ var cpu struct { // PMU profiling config pmuProfileHz int - pmuProfilePeriod int + pmuProfileCyclePeriod int + pmuProfileCacheMissPeriod int } // StartCPUProfile enables CPU profiling for the current process. @@ -778,21 +779,29 @@ func StartCPUProfile(w io.Writer, opts ...ProfilingOption) error { } } - if cpu.profileHz != 0 && cpu.pmuProfilePeriod != 0 { - return fmt.Errorf("itimer- and PMU-based profilings cannot work simultaneouly") + if cpu.profileHz != 0 && (cpu.pmuProfileCyclePeriod != 0 || cpu.pmuProfileCacheMissPeriod != 0) { + return fmt.Errorf("itimer- and PMU-based profilings cannot be enabled simultaneously\n") + } + + if cpu.pmuProfileCyclePeriod != 0 && cpu.pmuProfileCacheMissPeriod != 0 { + return fmt.Errorf("Only a single PMU event can be enabled simultaneously!\n") } if cpu.profileHz != 0 { runtime.SetCPUProfileRate(cpu.profileHz) } - if cpu.pmuProfilePeriod != 0 { - runtime.SetPMUProfilePeriod(cpu.pmuProfilePeriod) + if cpu.pmuProfileCyclePeriod != 0 { + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, cpu.pmuProfileCyclePeriod) + } + + if cpu.pmuProfileCacheMissPeriod != 0 { + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, cpu.pmuProfileCacheMissPeriod) } /* if cpu.pmuProfileHz != 0 { - runtime.SetPMUProfileRate(cpu.pmuProfileHz) + runtime.SetPMUProfileRate(PERF_COUNT_HW_CPU_CYCLES, cpu.pmuProfileCycleHz) } */ @@ -827,13 +836,24 @@ func WithProfilingCyclePeriod(period int) ProfilingOption { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") } - cpu.pmuProfilePeriod = period + cpu.pmuProfileCyclePeriod = period return nil }) } -// func WithProfilingCacheMisses(/* TODO */) ProfilingOption +func WithProfilingCacheMissPeriod(period int) ProfilingOption { + return profilingOptionFunc(func() error { + cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate + + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { + return errors.New("not implemented") + } + cpu.pmuProfileCacheMissPeriod = period + + return nil + }) +} // func WithPMUFancy(w io.Writer) ProfilingOption @@ -872,7 +892,7 @@ func profileWriter(w io.Writer) { panic("runtime/pprof: converting profile: " + err.Error()) } b.build() - } else { // i.e., cpu.pmuProfilePeriod != 0 + } else { // cpu.pmuProfileCyclePeriod != 0 or cpu.pmuProfileCacheMissPeriod != 0 for { time.Sleep(100 * time.Millisecond) data, tags, eof := readProfile() @@ -886,7 +906,12 @@ func profileWriter(w io.Writer) { if err != nil { panic("runtime/pprof: converting profile: " + err.Error()) } - b.pmuBuild() + if cpu.pmuProfileCyclePeriod != 0 { + b.pmuBuild("cycles") + } + if cpu.pmuProfileCacheMissPeriod != 0 { + b.pmuBuild("cache misses") + } } cpu.done <- true } @@ -907,8 +932,12 @@ func StopCPUProfile() { runtime.SetCPUProfileRate(0) } - if cpu.pmuProfilePeriod != 0 { - runtime.SetPMUProfilePeriod(0) + if cpu.pmuProfileCyclePeriod != 0 { + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, 0) + } + + if cpu.pmuProfileCacheMissPeriod != 0 { + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, 0) } /* if cpu.pmuProfileHz != 0 { diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index a409c83350..b754e197ff 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -385,6 +385,7 @@ func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error return fmt.Errorf("malformed profile") } b.isPMUEnabled = true + b.period = int64(data[2]) data = data[3:] } @@ -477,19 +478,18 @@ func (b *profileBuilder) build() { b.zw.Close() } -func (b *profileBuilder) pmuBuild() { - b.end = time.Now() - +func (b *profileBuilder) pmuBuild(event string) { b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) b.pbValueType(tagProfile_SampleType, "samples", "count") - b.pbValueType(tagProfile_SampleType, "cpu cycles", "count") - // b.pb.int64Opt(tagProfile_DurationNanos, b.end.Sub(b.start).Nanoseconds()) + b.pbValueType(tagProfile_SampleType, event, "count") + b.pbValueType(tagProfile_PeriodType, event, "count") + b.pb.int64Opt(tagProfile_Period, b.period) values := []int64{0, 0} var locs []uint64 for e := b.m.all; e != nil; e = e.nextAll { values[0] = e.count - values[1] = e.count * 100 + values[1] = e.count * b.period var labels func() if e.tag != nil { diff --git a/src/runtime/proc.go b/src/runtime/proc.go index d3cb45af1f..e752be7324 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2150,12 +2150,17 @@ func execute(gp *g, inheritTime bool) { // Check whether the profiler needs to be turned on or off. hz := sched.profilehz period := sched.profilePeriod + event := sched.profileEvent - if _g_.m.profilehz != hz { + if _g_.m.profilehz != hz && _g_.m.profilePeriod != period { + print("should never reach here!\n") + } + + if _g_.m.profilehz != hz { setThreadCPUProfiler(hz) } if _g_.m.profilePeriod != period { - setThreadPMUProfiler(period) + setThreadPMUProfiler(event, period) } if trace.enabled { @@ -3902,7 +3907,7 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } -func setpmuprofileperiod(period int32) { +func setpmuprofileperiod(event int32, period int32) { // Force sane arguments. if period < 0 { period = 0 @@ -3916,23 +3921,24 @@ func setpmuprofileperiod(period int32) { // Stop profiler on this thread so that it is safe to lock prof. // if a profiling signal came in while we had prof locked, // it would deadlock. - setThreadPMUProfiler(0) + setThreadPMUProfiler(event, 0) for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } - if prof.period != period { + if prof.period != period { setProcessPMUProfiler(period) prof.period = period } atomic.Store(&prof.signalLock, 0) lock(&sched.lock) - sched.profilePeriod = period + sched.profilePeriod = period + sched.profileEvent = event unlock(&sched.lock) if period != 0 { - setThreadPMUProfiler(period) + setThreadPMUProfiler(event, period) } _g_.m.locks-- diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 226d5a053e..bd0b637684 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -676,8 +676,9 @@ type schedt struct { safePointWait int32 safePointNote note - profilehz int32 // cpu profiling rate - profilePeriod int32 + profilehz int32 // cpu profiling rate + profilePeriod int32 + profileEvent int32 procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 8925f3360b..45ca085a82 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -285,21 +285,41 @@ func setThreadCPUProfiler(hz int32) { _g_.m.profilehz = hz } -func setThreadPMUProfiler(period int32) { +func getPreciseIP() int32 { + if ip, ok := atoi32(gogetenv("PMU_PRECISE_IP")); ok { + if ip < 0 { + ip = 0 + } else if ip > 3 { + ip = 3 + } + return ip + } + return 0 // PMU_PRECISE_IP is not set +} + +var preciseIP int32 = -1 + +func setThreadPMUProfiler(event int32, period int32) { _g_ := getg() - _g_.m.profilePeriod = period + _g_.m.profilePeriod = period if period == 0 { // Go routine is finished fd := _g_.m.eventFd - // ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) closefd(fd) } else { + if preciseIP == -1 { + preciseIP = getPreciseIP() // never equals to -1 again + } + var attr PerfEventAttr attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) - attr.Config = PERF_COUNT_HW_CPU_CYCLES + attr.Config = uint64(event) attr.Sample = uint64(period) - + attr.Bits = uint64(preciseIP) << 15 // precise ip + attr.Bits += 0b100000 // don't count kernel + attr.Bits += 0b1000000 // don't count hypervisor + fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) _g_.m.eventFd = fd From 22805e45d958945b28b2a072848bf7a0baf9f431 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 23 Jun 2019 23:24:16 -0700 Subject: [PATCH 022/126] enable multiple PMU events --- src/runtime/cpuprof.go | 40 +---- src/runtime/pmuprof.go | 180 +++++++++++++++++++++ src/runtime/pprof/pprof.go | 270 ++++++++++++++++--------------- src/runtime/pprof/proto.go | 6 +- src/runtime/proc.go | 181 ++++++++++++++++++--- src/runtime/runtime2.go | 13 +- src/runtime/signal_sighandler.go | 12 +- src/runtime/signal_unix.go | 21 ++- 8 files changed, 516 insertions(+), 207 deletions(-) create mode 100644 src/runtime/pmuprof.go diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index ee0ae142b7..31a9409838 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -51,6 +51,7 @@ var cpuprof cpuProfile // the testing package's -test.cpuprofile flag instead of calling // SetCPUProfileRate directly. func SetCPUProfileRate(hz int) { +// func SetCPUProfileRate(hz int) { // Clamp hz to something reasonable. if hz < 0 { hz = 0 @@ -59,7 +60,7 @@ func SetCPUProfileRate(hz int) { hz = 1000000 } - lock(&cpuprof.lock) + lock(&cpuprof.lock) // cpuprof[event].lock if hz > 0 { if cpuprof.on || cpuprof.log != nil { print("runtime: cannot set cpu profile rate until previous profile has finished.\n") @@ -70,48 +71,17 @@ func SetCPUProfileRate(hz int) { cpuprof.on = true cpuprof.log = newProfBuf(1, 1<<17, 1<<14) hdr := [1]uint64{uint64(hz)} - cpuprof.log.write(nil, nanotime(), hdr[:], nil) + cpuprof.log.write(nil, nanotime(), hdr[:], nil) setcpuprofilerate(int32(hz)) } else if cpuprof.on { setcpuprofilerate(0) cpuprof.on = false - cpuprof.addExtra() + cpuprof.addExtra() // cpuprof[event].addExtra() cpuprof.log.close() } unlock(&cpuprof.lock) } -func SetPMUProfilePeriod(event int, period int) { - // Clamp period to something reasonable. - if period < 0 { - period = 0 - } - if period > 0 && period < 300 { - period = 300 - } - - lock(&cpuprof.lock) - if period > 0 { - if cpuprof.on || cpuprof.log != nil { - print("runtime: cannot set cpu profile rate until previous profile has finished.\n") - unlock(&cpuprof.lock) - return - } - - cpuprof.on = true - cpuprof.log = newProfBuf(1, 1<<17, 1<<14) - hdr := [1]uint64{uint64(period)} - cpuprof.log.write(nil, nanotime(), hdr[:], nil) - setpmuprofileperiod(int32(event), int32(period)) - } else if cpuprof.on { - setpmuprofileperiod(int32(event), 0) - cpuprof.on = false - cpuprof.addExtra() - cpuprof.log.close() - } - unlock(&cpuprof.lock) -} - // add adds the stack trace to the profile. // It is called from signal handlers and other limited environments // and cannot allocate memory or acquire locks that might be @@ -124,7 +94,7 @@ func (p *cpuProfile) add(gp *g, stk []uintptr) { osyield() } - if prof.hz != 0 || prof.period != 0 { // implies cpuprof.log != nil + if prof.hz != 0 { // implies cpuprof.log != nil if p.numExtra > 0 || p.lostExtra > 0 { p.addExtra() } diff --git a/src/runtime/pmuprof.go b/src/runtime/pmuprof.go new file mode 100644 index 0000000000..a8ed27b053 --- /dev/null +++ b/src/runtime/pmuprof.go @@ -0,0 +1,180 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// CPU profiling. +// +// The signal handler for the profiling clock tick adds a new stack trace +// to a log of recent traces. The log is read by a user goroutine that +// turns it into formatted profile data. If the reader does not keep up +// with the log, those writes will be recorded as a count of lost records. +// The actual profile buffer is in profbuf.go. + +package runtime + +import ( + "runtime/internal/atomic" + "runtime/internal/sys" + "unsafe" +) + +const maxPMUProfStack = 64 +const maxPMUEvents = 10 + +type pmuProfile struct { + lock mutex + on bool // profiling is on + log *profBuf // profile events written here + + // extra holds extra stacks accumulated in addNonGo + // corresponding to profiling signals arriving on + // non-Go-created threads. Those stacks are written + // to log the next time a normal Go thread gets the + // signal handler. + // Assuming the stacks are 2 words each (we don't get + // a full traceback from those threads), plus one word + // size for framing, 100 Hz profiling would generate + // 300 words per second. + // Hopefully a normal Go thread will get the profiling + // signal at least once every few seconds. + extra [1000]uintptr + numExtra int + lostExtra uint64 // count of frames lost because extra is full +} + +var pmuprof [maxPMUEvents]pmuProfile // event -> cpuProfile + +func SetPMUProfilePeriod(eventId int, period int) { + // Clamp period to something reasonable. + if period < 0 { + period = 0 + } + if period > 0 && period < 300 { // follow what hpctoolkit did + period = 300 + } + lock(&pmuprof[eventId].lock) + if period > 0 { + if pmuprof[eventId].on || pmuprof[eventId].log != nil { + print("runtime: cannot set pmu profile rate until previous profile has finished.\n") + unlock(&pmuprof[eventId].lock) + return + } + + pmuprof[eventId].on = true + pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) + hdr := [1]uint64{uint64(period)} + pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) + setpmuprofileperiod(int32(eventId), int32(period)) + } else if pmuprof[eventId].on { + setpmuprofileperiod(int32(eventId), 0) + pmuprof[eventId].on = false + pmuprof[eventId].addExtra(eventId) + pmuprof[eventId].log.close() + } + unlock(&pmuprof[eventId].lock) +} + +// add adds the stack trace to the profile. +// It is called from signal handlers and other limited environments +// and cannot allocate memory or acquire locks that might be +// held at the time of the signal, nor can it use substantial amounts +// of stack. +//go:nowritebarrierrec +func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { + // Simple cas-lock to coordinate with setpmuprofilerate. + for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { + osyield() + } + + if profs[eventId].period != 0 { // implies pmuprof[eventId].log != nil + if p.numExtra > 0 || p.lostExtra > 0 { + p.addExtra(eventId) + } + hdr := [1]uint64{1} + // Note: write "knows" that the argument is &gp.labels, + // because otherwise its write barrier behavior may not + // be correct. See the long comment there before + // changing the argument here. + pmuprof[eventId].log.write(&gp.labels, nanotime(), hdr[:], stk) + } + + atomic.Store(&profs[eventId].signalLock, 0) +} + +// addNonGo adds the non-Go stack trace to the profile. +// It is called from a non-Go thread, so we cannot use much stack at all, +// nor do anything that needs a g or an m. +// In particular, we can't call cpuprof.log.write. +// Instead, we copy the stack into cpuprof.extra, +// which will be drained the next time a Go thread +// gets the signal handling event. +//go:nosplit +//go:nowritebarrierrec +func (p *pmuProfile) addNonGo(stk []uintptr, eventId int) { + // (Other calls to add or addNonGo should be blocked out + // by the fact that only one SIGPROF can be handled by the + // process at a time. If not, this lock will serialize those too.) + for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { + osyield() + } + + if pmuprof[eventId].numExtra+1+len(stk) < len(pmuprof[eventId].extra) { + i := pmuprof[eventId].numExtra + pmuprof[eventId].extra[i] = uintptr(1 + len(stk)) + copy(pmuprof[eventId].extra[i+1:], stk) + pmuprof[eventId].numExtra += 1 + len(stk) + } else { + pmuprof[eventId].lostExtra++ + } + + atomic.Store(&profs[eventId].signalLock, 0) +} + +// addExtra adds the "extra" profiling events, +// queued by addNonGo, to the profile log. +// addExtra is called either from a signal handler on a Go thread +// or from an ordinary goroutine; either way it can use stack +// and has a g. The world may be stopped, though. +func (p *pmuProfile) addExtra(eventId int) { + // Copy accumulated non-Go profile events. + hdr := [1]uint64{1} + for i := 0; i < p.numExtra; { + p.log.write(nil, 0, hdr[:], p.extra[i+1:i+int(p.extra[i])]) + i += int(p.extra[i]) + } + p.numExtra = 0 + + // Report any lost events. + if p.lostExtra > 0 { + hdr := [1]uint64{p.lostExtra} + lostStk := [2]uintptr{ + funcPC(_LostExternalCode) + sys.PCQuantum, + funcPC(_ExternalCode) + sys.PCQuantum, + } + pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) + p.lostExtra = 0 + } +} + +func (p *pmuProfile) addLostAtomic64(count uint64, eventId int) { + hdr := [1]uint64{count} + lostStk := [2]uintptr{ + funcPC(_LostSIGPROFDuringAtomic64) + sys.PCQuantum, + funcPC(_System) + sys.PCQuantum, + } + pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) +} + +//go:linkname runtime_pprof_readPMUProfile runtime/pprof.readPMUProfile +func runtime_pprof_readPMUProfile(eventId int) ([]uint64, []unsafe.Pointer, bool) { + lock(&pmuprof[eventId].lock) + log := pmuprof[eventId].log + unlock(&pmuprof[eventId].lock) + data, tags, eof := log.read(profBufBlocking) + if len(data) == 0 && eof { + lock(&pmuprof[eventId].lock) + pmuprof[eventId].log = nil + unlock(&pmuprof[eventId].lock) + } + return data, tags, eof +} diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 16c92b9463..00ff9fb3e8 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -726,15 +726,16 @@ var cpu struct { sync.Mutex profiling bool done chan bool + profileHz int +} - // config state implemented by StartCPUProfile, customized by any - // ProfilingOptions passed to it. - profileHz int - - // PMU profiling config - pmuProfileHz int - pmuProfileCyclePeriod int - pmuProfileCacheMissPeriod int +var pmu struct { + sync.Mutex + profiling bool + done chan bool + profileCyclePeriod int + profileCacheMissPeriod int + profileCacheRefPeriod int } // StartCPUProfile enables CPU profiling for the current process. @@ -748,115 +749,114 @@ var cpu struct { // not to the one used by Go. To make it work, call os/signal.Notify // for syscall.SIGPROF, but note that doing so may break any profiling // being done by the main program. -func StartCPUProfile(w io.Writer, opts ...ProfilingOption) error { - // The runtime routines allow a variable profiling rate, - // but in practice operating systems cannot trigger signals - // at more than about 500 Hz, and our processing of the - // signal is not cheap (mostly getting the stack trace). - // 100 Hz is a reasonable choice: it is frequent enough to - // produce useful data, rare enough not to bog down the - // system, and a nice round number to make it easy to - // convert sample counts to seconds. Instead of requiring - // each client to specify the frequency, we hard code it. - if len(opts) == 0 { - opts = []ProfilingOption{WithProfilingRate(100)} +func StartCPUProfile(w io.Writer, hz ...int) error { + // The runtime routines allow a variable profiling rate, + // but in practice operating systems cannot trigger signals + // at more than about 500 Hz, and our processing of the + // signal is not cheap (mostly getting the stack trace). + // 100 Hz is a reasonable choice: it is frequent enough to + // produce useful data, rare enough not to bog down the + // system, and a nice round number to make it easy to + // convert sample counts to seconds. Instead of requiring + // each client to specify the frequency, we hard code it. + if len(hz) == 0 { + cpu.profileHz = 100 + } else { + cpu.profileHz = hz[0] } - cpu.Lock() - defer cpu.Unlock() - if cpu.done == nil { - cpu.done = make(chan bool) + cpu.Lock() + defer cpu.Unlock() + if cpu.done == nil { + cpu.done = make(chan bool) + } + // Double-check. + if cpu.profiling { + return fmt.Errorf("cpu profiling already in use") + } + cpu.profiling = true + runtime.SetCPUProfileRate(cpu.profileHz) + go profileWriter(w) + return nil +} + + +func StartPMUProfile(opts ...ProfilingOption) error { + pmu.Lock() + defer pmu.Unlock() + if pmu.done == nil { + pmu.done = make(chan bool, len(opts)) } // Double-check. - if cpu.profiling { - return fmt.Errorf("cpu profiling already in use") + if pmu.profiling { + return fmt.Errorf("pmu profiling already in use") } - cpu.profiling = true - - for _, opt := range opts { + pmu.profiling = true + + for _, opt := range opts { if err := opt.apply(); err != nil { return err } } - - if cpu.profileHz != 0 && (cpu.pmuProfileCyclePeriod != 0 || cpu.pmuProfileCacheMissPeriod != 0) { - return fmt.Errorf("itimer- and PMU-based profilings cannot be enabled simultaneously\n") - } - - if cpu.pmuProfileCyclePeriod != 0 && cpu.pmuProfileCacheMissPeriod != 0 { - return fmt.Errorf("Only a single PMU event can be enabled simultaneously!\n") - } - - if cpu.profileHz != 0 { - runtime.SetCPUProfileRate(cpu.profileHz) - } - - if cpu.pmuProfileCyclePeriod != 0 { - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, cpu.pmuProfileCyclePeriod) - } - - if cpu.pmuProfileCacheMissPeriod != 0 { - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, cpu.pmuProfileCacheMissPeriod) - } - - /* - if cpu.pmuProfileHz != 0 { - runtime.SetPMUProfileRate(PERF_COUNT_HW_CPU_CYCLES, cpu.pmuProfileCycleHz) - } - */ - - go profileWriter(w) return nil } -func WithProfilingRate(hz int) ProfilingOption { +func WithProfilingRate(w io.Writer, hz int) ProfilingOption { return profilingOptionFunc(func() error { - cpu.profileHz = hz + if hz != 0 { + cpu.profileHz = hz + runtime.SetCPUProfileRate(cpu.profileHz) + go profileWriter(w) + } return nil }) } -func WithProfilingCycleRate(hz int) ProfilingOption { +func WithProfilingCyclePeriod(w io.Writer, period int) ProfilingOption { return profilingOptionFunc(func() error { - cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemented") + return errors.New("not implemented") } - cpu.pmuProfileHz = hz - + if period <= 0 { + return errors.New("period should be > 0") + } + pmu.profileCyclePeriod = period + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, pmu.profileCyclePeriod) + go pmuProfileWriter(w, PERF_COUNT_HW_CPU_CYCLES, "cycles") return nil }) } -func WithProfilingCyclePeriod(period int) ProfilingOption { +func WithProfilingCacheMissPeriod(w io.Writer, period int) ProfilingOption { return profilingOptionFunc(func() error { - cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") } - cpu.pmuProfileCyclePeriod = period - + if period <= 0 { + return errors.New("period should be > 0") + } + pmu.profileCacheMissPeriod = period + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, pmu.profileCacheMissPeriod) + go pmuProfileWriter(w, PERF_COUNT_HW_CACHE_MISSES, "cache misses") return nil }) } -func WithProfilingCacheMissPeriod(period int) ProfilingOption { +func WithProfilingCacheRefPeriod(w io.Writer, period int) ProfilingOption { return profilingOptionFunc(func() error { - cpu.profileHz = 0 // NOTE it disable any prior WithProfilingRate - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") } - cpu.pmuProfileCacheMissPeriod = period - + if period <= 0 { + return errors.New("period should be > 0") + } + pmu.profileCacheRefPeriod = period + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_REFERENCES, pmu.profileCacheRefPeriod) + go pmuProfileWriter(w, PERF_COUNT_HW_CACHE_REFERENCES, "cache references") return nil }) } -// func WithPMUFancy(w io.Writer) ProfilingOption - type ProfilingOption interface { apply() error } @@ -875,76 +875,90 @@ func readProfile() (data []uint64, tags []unsafe.Pointer, eof bool) func profileWriter(w io.Writer) { b := newProfileBuilder(w) var err error - if cpu.profileHz != 0 { - for { - time.Sleep(100 * time.Millisecond) - data, tags, eof := readProfile() - if e := b.addCPUData(data, tags); e != nil && err == nil { - err = e - } - if eof { - break - } + for { + time.Sleep(100 * time.Millisecond) + data, tags, eof := readProfile() + if e := b.addCPUData(data, tags); e != nil && err == nil { + err = e } - if err != nil { - // The runtime should never produce an invalid or truncated profile. - // It drops records that can't fit into its log buffers. - panic("runtime/pprof: converting profile: " + err.Error()) + if eof { + break } - b.build() - } else { // cpu.pmuProfileCyclePeriod != 0 or cpu.pmuProfileCacheMissPeriod != 0 - for { - time.Sleep(100 * time.Millisecond) - data, tags, eof := readProfile() - if e := b.addPMUData(data, tags); e != nil && err == nil { - err = e - } - if eof { - break - } + } + if err != nil { + // The runtime should never produce an invalid or truncated profile. + // It drops records that can't fit into its log buffers. + panic("runtime/pprof: converting profile: " + err.Error()) + } + b.build() + cpu.done <- true +} + +func readPMUProfile(eventId int) (data []uint64, tags []unsafe.Pointer, eof bool) + +func pmuProfileWriter(w io.Writer, eventId int, eventName string) { + b := newProfileBuilder(w) + var err error + for { + time.Sleep(10 * time.Millisecond) + data, tags, eof := readPMUProfile(eventId) + // if len(data) != 0 { + // fmt.Println(eventId, " ", len(data)) + // } + if e := b.addPMUData(data, tags); e != nil && err == nil { + err = e } - if err != nil { - panic("runtime/pprof: converting profile: " + err.Error()) + if eof { + break } - if cpu.pmuProfileCyclePeriod != 0 { - b.pmuBuild("cycles") - } - if cpu.pmuProfileCacheMissPeriod != 0 { - b.pmuBuild("cache misses") - } - } - cpu.done <- true + } + if err != nil { + panic("runtime/pprof: converting profile: " + err.Error()) + } + b.pmuBuild(eventName) + pmu.done <- true } // StopCPUProfile stops the current CPU profile, if any. // StopCPUProfile only returns after all the writes for the // profile have completed. func StopCPUProfile() { - cpu.Lock() - defer cpu.Unlock() + cpu.Lock() + defer cpu.Unlock() + + if !cpu.profiling { + return + } + cpu.profiling = false + runtime.SetCPUProfileRate(0) + <-cpu.done +} + - if !cpu.profiling { +func StopPMUProfile() { + pmu.Lock() + defer pmu.Unlock() + + if !pmu.profiling { return } - cpu.profiling = false + pmu.profiling = false - if cpu.profileHz != 0 { - runtime.SetCPUProfileRate(0) - } - - if cpu.pmuProfileCyclePeriod != 0 { + if pmu.profileCyclePeriod != 0 { runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, 0) } - - if cpu.pmuProfileCacheMissPeriod != 0 { + if pmu.profileCacheMissPeriod != 0 { runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, 0) } - /* - if cpu.pmuProfileHz != 0 { - runtime.SetPMUProfileRate(0) + if pmu.profileCacheRefPeriod != 0 { + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_REFERENCES, 0) } - */ - <-cpu.done + + for i := 0; i < cap(pmu.done); i++ { + <-pmu.done + } + + } // countBlock returns the number of records in the blocking profile. diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index b754e197ff..916c967e7e 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -478,11 +478,11 @@ func (b *profileBuilder) build() { b.zw.Close() } -func (b *profileBuilder) pmuBuild(event string) { +func (b *profileBuilder) pmuBuild(eventName string) { b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) b.pbValueType(tagProfile_SampleType, "samples", "count") - b.pbValueType(tagProfile_SampleType, event, "count") - b.pbValueType(tagProfile_PeriodType, event, "count") + b.pbValueType(tagProfile_SampleType, eventName, "count") + b.pbValueType(tagProfile_PeriodType, eventName, "count") b.pb.int64Opt(tagProfile_Period, b.period) values := []int64{0, 0} diff --git a/src/runtime/proc.go b/src/runtime/proc.go index e752be7324..793b3333c1 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2149,20 +2149,22 @@ func execute(gp *g, inheritTime bool) { // Check whether the profiler needs to be turned on or off. hz := sched.profilehz - period := sched.profilePeriod - event := sched.profileEvent - - if _g_.m.profilehz != hz && _g_.m.profilePeriod != period { - print("should never reach here!\n") - } + period := sched.profilePMUPeriod + + // if _g_.m.profilehz != hz && _g_.m.profilePeriod != period { + // println("should never reach here!") + // } if _g_.m.profilehz != hz { setThreadCPUProfiler(hz) } - if _g_.m.profilePeriod != period { - setThreadPMUProfiler(event, period) + + for eventId := 0; eventId < 10; eventId++ { + if _g_.m.profilePMUPeriod[eventId] != period[eventId] { + setThreadPMUProfiler(int32(eventId), period[eventId]) + } } - + if trace.enabled { // GoSysExit has to happen when we have a P, but before GoStart. // So we emit it here. @@ -3628,6 +3630,10 @@ func mcount() int32 { var prof struct { signalLock uint32 hz int32 +} + +var profs [10]struct { + signalLock uint32 period int32 } @@ -3645,7 +3651,7 @@ var lostAtomic64Count uint64 // Called by the signal handler, may run during STW. //go:nowritebarrierrec func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { - if prof.hz == 0 && prof.period == 0 { // psu: is it safe to do so? + if prof.hz == 0 { return } // On mips{,le}, 64bit atomics are emulated with spinlocks, in @@ -3657,7 +3663,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { if GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm" { if f := findfunc(pc); f.valid() { if hasPrefix(funcname(f), "runtime/internal/atomic") { - lostAtomic64Count++ + lostAtomic64Count++ // lostAtomic64Count[event]++ return } } @@ -3796,12 +3802,112 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { } } - if prof.hz != 0 || prof.period != 0 { + if prof.hz != 0 { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostAtomic64Count > 0 { cpuprof.addLostAtomic64(lostAtomic64Count) - lostAtomic64Count = 0 + lostAtomic64Count = 0 // lostAtomic64Count[event] = 0 + } + cpuprof.add(gp, stk[:n]) // cpuprof[event].add(gp, stk[:n]) + } + getg().m.mallocing-- +} + +var lostPMUAtomic64Count[10] uint64 + +//go:nowritebarrierrec +func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { + if profs[eventId].period == 0 { + return + } + // On mips{,le}, 64bit atomics are emulated with spinlocks, in + // runtime/internal/atomic. If SIGPROF arrives while the program is inside + // the critical section, it creates a deadlock (when writing the sample). + // As a workaround, create a counter of SIGPROFs while in critical section + // to store the count, and pass it to sigprof.add() later when SIGPROF is + // received from somewhere else (with _LostSIGPROFDuringAtomic64 as pc). + if GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm" { + if f := findfunc(pc); f.valid() { + if hasPrefix(funcname(f), "runtime/internal/atomic") { + lostPMUAtomic64Count[eventId]++ + return + } + } + } + + // Profiling runs concurrently with GC, so it must not allocate. + // Set a trap in case the code does allocate. + // Note that on windows, one thread takes profiles of all the + // other threads, so mp is usually not getg().m. + // In fact mp may not even be stopped. + // See golang.org/issue/17165. + getg().m.mallocing++ + + traceback := true + if gp == nil || sp < gp.stack.lo || gp.stack.hi < sp || setsSP(pc) || (mp != nil && mp.vdsoSP != 0) { + traceback = false + } + var stk [maxPMUProfStack]uintptr + n := 0 + if mp.ncgo > 0 && mp.curg != nil && mp.curg.syscallpc != 0 && mp.curg.syscallsp != 0 { + cgoOff := 0 + // Check cgoCallersUse to make sure that we are not + // interrupting other code that is fiddling with + // cgoCallers. We are running in a signal handler + // with all signals blocked, so we don't have to worry + // about any other code interrupting us. + if atomic.Load(&mp.cgoCallersUse) == 0 && mp.cgoCallers != nil && mp.cgoCallers[0] != 0 { + for cgoOff < len(mp.cgoCallers) && mp.cgoCallers[cgoOff] != 0 { + cgoOff++ + } + copy(stk[:], mp.cgoCallers[:cgoOff]) + mp.cgoCallers[0] = 0 + } + + // Collect Go stack that leads to the cgo call. + n = gentraceback(mp.curg.syscallpc, mp.curg.syscallsp, 0, mp.curg, 0, &stk[cgoOff], len(stk)-cgoOff, nil, nil, 0) + if n > 0 { + n += cgoOff + } + } else if traceback { + n = gentraceback(pc, sp, lr, gp, 0, &stk[0], len(stk), nil, nil, _TraceTrap|_TraceJumpStack) + } + + if n <= 0 { + // Normal traceback is impossible or has failed. + // See if it falls into several common cases. + n = 0 + if (GOOS == "windows" || GOOS == "solaris" || GOOS == "illumos" || GOOS == "darwin" || GOOS == "aix") && mp.libcallg != 0 && mp.libcallpc != 0 && mp.libcallsp != 0 { + // Libcall, i.e. runtime syscall on windows. + // Collect Go stack that leads to the call. + n = gentraceback(mp.libcallpc, mp.libcallsp, 0, mp.libcallg.ptr(), 0, &stk[0], len(stk), nil, nil, 0) + } + if n == 0 && mp != nil && mp.vdsoSP != 0 { + n = gentraceback(mp.vdsoPC, mp.vdsoSP, 0, gp, 0, &stk[0], len(stk), nil, nil, _TraceTrap|_TraceJumpStack) + } + if n == 0 { + // If all of the above has failed, account it against abstract "System" or "GC". + n = 2 + if inVDSOPage(pc) { + pc = funcPC(_VDSO) + sys.PCQuantum + } else if pc > firstmoduledata.etext { + // "ExternalCode" is better than "etext". + pc = funcPC(_ExternalCode) + sys.PCQuantum + } + stk[0] = pc + if mp.preemptoff != "" { + stk[1] = funcPC(_GC) + sys.PCQuantum + } else { + stk[1] = funcPC(_System) + sys.PCQuantum + } } - cpuprof.add(gp, stk[:n]) + } + + if profs[eventId].period != 0 { + if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostPMUAtomic64Count[eventId] > 0 { + pmuprof[eventId].addLostAtomic64(lostPMUAtomic64Count[eventId], eventId) + lostPMUAtomic64Count[eventId] = 0 + } + pmuprof[eventId].add(gp, stk[:n], eventId) } getg().m.mallocing-- } @@ -3819,7 +3925,7 @@ var sigprofCallersUse uint32 //go:nosplit //go:nowritebarrierrec func sigprofNonGo() { - if prof.hz != 0 || prof.period != 0 { + if prof.hz != 0 { n := 0 for n < len(sigprofCallers) && sigprofCallers[n] != 0 { n++ @@ -3830,13 +3936,27 @@ func sigprofNonGo() { atomic.Store(&sigprofCallersUse, 0) } +//go:nosplit +//go:nowritebarrierrec +func sigpmuNonGo(eventId int) { + if profs[eventId].period != 0 { + n := 0 + for n < len(sigprofCallers) && sigprofCallers[n] != 0 { + n++ + } + pmuprof[eventId].addNonGo(sigprofCallers[:n], eventId) + } + + atomic.Store(&sigprofCallersUse, 0) +} + // sigprofNonGoPC is called when a profiling signal arrived on a // non-Go thread and we have a single PC value, not a stack trace. // g is nil, and what we can do is very limited. //go:nosplit //go:nowritebarrierrec func sigprofNonGoPC(pc uintptr) { - if prof.hz != 0 || prof.period != 0 { + if prof.hz != 0 { stk := []uintptr{ pc, funcPC(_ExternalCode) + sys.PCQuantum, @@ -3845,6 +3965,18 @@ func sigprofNonGoPC(pc uintptr) { } } +//go:nosplit +//go:nowritebarrierrec +func sigpmuNonGoPC(pc uintptr, eventId int) { + if profs[eventId].period != 0 { + stk := []uintptr{ + pc, + funcPC(_ExternalCode) + sys.PCQuantum, + } + pmuprof[eventId].addNonGo(stk, eventId) + } +} + // Reports whether a function will set the SP // to an absolute value. Important that // we don't traceback when these are at the bottom @@ -3907,7 +4039,7 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } -func setpmuprofileperiod(event int32, period int32) { +func setpmuprofileperiod(eventId int32, period int32) { // Force sane arguments. if period < 0 { period = 0 @@ -3921,24 +4053,23 @@ func setpmuprofileperiod(event int32, period int32) { // Stop profiler on this thread so that it is safe to lock prof. // if a profiling signal came in while we had prof locked, // it would deadlock. - setThreadPMUProfiler(event, 0) + setThreadPMUProfiler(eventId, 0) - for !atomic.Cas(&prof.signalLock, 0, 1) { + for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { osyield() } - if prof.period != period { + if profs[eventId].period != period { setProcessPMUProfiler(period) - prof.period = period + profs[eventId].period = period } - atomic.Store(&prof.signalLock, 0) + atomic.Store(&profs[eventId].signalLock, 0) lock(&sched.lock) - sched.profilePeriod = period - sched.profileEvent = event + sched.profilePMUPeriod[eventId] = period unlock(&sched.lock) if period != 0 { - setThreadPMUProfiler(event, period) + setThreadPMUProfiler(eventId, period) } _g_.m.locks-- diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index bd0b637684..ab1193115a 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,8 +473,10 @@ type m struct { locks int32 dying int32 profilehz int32 - profilePeriod int32 - eventFd int32 + // profilePeriod int32 + eventFd [10]int32 + profilePMUPeriod [10]int32 // event Id -> period + eventMap map[int32]int32 // fd->event Id spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack @@ -677,9 +679,10 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - profilePeriod int32 - profileEvent int32 - procresizetime int64 // nanotime() of last change to gomaxprocs + // profilePeriod int32 + // profileEvent int32 + profilePMUPeriod [10]int32 // event Id -> period + procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index d850a61e0e..338b28a1b1 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -35,10 +35,14 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { c := &sigctxt{info, ctxt} if sig == _SIGRTMIN + 3 { - fd := info.si_fd - ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) - sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) - ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + fd := info.si_fd + // ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) + if _g_.m.eventMap == nil { + println("should not reach here") + } + eventId := _g_.m.eventMap[fd] + sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, int(eventId)) + // ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 45ca085a82..b7a3a884d1 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -299,12 +299,15 @@ func getPreciseIP() int32 { var preciseIP int32 = -1 -func setThreadPMUProfiler(event int32, period int32) { +func setThreadPMUProfiler(eventId int32, period int32) { _g_ := getg() - _g_.m.profilePeriod = period + _g_.m.profilePMUPeriod[eventId] = period + if _g_.m.eventMap == nil { + _g_.m.eventMap = make(map[int32]int32) + } if period == 0 { // Go routine is finished - fd := _g_.m.eventFd + fd := _g_.m.eventFd[eventId] closefd(fd) } else { if preciseIP == -1 { @@ -314,15 +317,15 @@ func setThreadPMUProfiler(event int32, period int32) { var attr PerfEventAttr attr.Type = PERF_TYPE_HARDWARE attr.Size = uint32(unsafe.Sizeof(attr)) - attr.Config = uint64(event) + attr.Config = uint64(eventId) attr.Sample = uint64(period) attr.Bits = uint64(preciseIP) << 15 // precise ip attr.Bits += 0b100000 // don't count kernel attr.Bits += 0b1000000 // don't count hypervisor fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) - _g_.m.eventFd = fd - + _g_.m.eventFd[eventId] = fd + _g_.m.eventMap[fd] = eventId r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) fcntl(fd, /*F_SETSIG*/ 0xa, _SIGRTMIN + 3) @@ -357,9 +360,13 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { g := getg() if g == nil { c := &sigctxt{info, ctx} - if sig == _SIGPROF || sig == _SIGRTMIN + 3 { + if sig == _SIGPROF { sigprofNonGoPC(c.sigpc()) return + } else if sig == _SIGRTMIN + 3 { + // sigpmuNonGoPC(c.sigpc()) + println("how do I know which pmu event delivers this signal") + return } c.fixsigcode(sig) badsignal(uintptr(sig), c) From 60231ccfdee6d7e76c4b12656c0ea3485ba40b40 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Mon, 24 Jun 2019 00:07:06 -0700 Subject: [PATCH 023/126] minor --- src/runtime/signal_sighandler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 338b28a1b1..0cc47c1242 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -36,13 +36,14 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { if sig == _SIGRTMIN + 3 { fd := info.si_fd - // ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) + ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) if _g_.m.eventMap == nil { println("should not reach here") + return } eventId := _g_.m.eventMap[fd] sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, int(eventId)) - // ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return } From da609e8b02ae22108280b1f1ef30f3ce8e618757 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Mon, 24 Jun 2019 00:10:18 -0700 Subject: [PATCH 024/126] minor --- src/runtime/signal_sighandler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 0cc47c1242..61b88e1edf 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -37,10 +37,13 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { if sig == _SIGRTMIN + 3 { fd := info.si_fd ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) + if _g_.m.eventMap == nil { println("should not reach here") + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return } + eventId := _g_.m.eventMap[fd] sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, int(eventId)) ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) From 03afced30c6978685065299f1cbe7b4147869475 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 24 Jun 2019 17:41:13 -0700 Subject: [PATCH 025/126] minor --- src/runtime/pmuprof.go | 2 +- src/runtime/runtime2.go | 11 ++++------- src/runtime/signal_sighandler.go | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/runtime/pmuprof.go b/src/runtime/pmuprof.go index a8ed27b053..af783d8b1b 100644 --- a/src/runtime/pmuprof.go +++ b/src/runtime/pmuprof.go @@ -49,7 +49,7 @@ func SetPMUProfilePeriod(eventId int, period int) { if period < 0 { period = 0 } - if period > 0 && period < 300 { // follow what hpctoolkit did + if period > 0 && period < 300 { // follows what hpctoolkit did period = 300 } lock(&pmuprof[eventId].lock) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index ab1193115a..97b4d2724e 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,10 +473,9 @@ type m struct { locks int32 dying int32 profilehz int32 - // profilePeriod int32 - eventFd [10]int32 - profilePMUPeriod [10]int32 // event Id -> period - eventMap map[int32]int32 // fd->event Id + eventFd [maxPMUProfStack]int32 + profilePMUPeriod [maxPMUProfStack]int32 // event Id -> period + eventMap map[int32]int32 // fd->event Id spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack @@ -679,9 +678,7 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - // profilePeriod int32 - // profileEvent int32 - profilePMUPeriod [10]int32 // event Id -> period + profilePMUPeriod [maxPMUProfStack]int32 // event Id -> period procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 61b88e1edf..605f58c416 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -35,7 +35,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { c := &sigctxt{info, ctxt} if sig == _SIGRTMIN + 3 { - fd := info.si_fd + fd := info.si_fd ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) if _g_.m.eventMap == nil { From 37ea0212a6ab55f81e5e8bf2a2abcbb23acc5481 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 2 Jul 2019 13:14:04 -0700 Subject: [PATCH 026/126] close file descriptors when finished --- src/runtime/pprof/pprof.go | 26 ++++++++++++++++++++------ src/runtime/proc.go | 2 +- src/runtime/signal_unix.go | 5 ++++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 00ff9fb3e8..e95caa78f7 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -734,6 +734,7 @@ var pmu struct { profiling bool done chan bool profileCyclePeriod int + profileInstPeriod int profileCacheMissPeriod int profileCacheRefPeriod int } @@ -827,6 +828,21 @@ func WithProfilingCyclePeriod(w io.Writer, period int) ProfilingOption { }) } +func WithProfilingInstPeriod(w io.Writer, period int) ProfilingOption { + return profilingOptionFunc(func() error { + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { + return errors.New("not implemented") + } + if period <= 0 { + return errors.New("period should be > 0") + } + pmu.profileInstPeriod = period + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_INSTRUCTIONS, pmu.profileInstPeriod) + go pmuProfileWriter(w, PERF_COUNT_HW_INSTRUCTIONS, "instructions") + return nil + }) +} + func WithProfilingCacheMissPeriod(w io.Writer, period int) ProfilingOption { return profilingOptionFunc(func() error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { @@ -900,11 +916,8 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { b := newProfileBuilder(w) var err error for { - time.Sleep(10 * time.Millisecond) + time.Sleep(100 * time.Millisecond) data, tags, eof := readPMUProfile(eventId) - // if len(data) != 0 { - // fmt.Println(eventId, " ", len(data)) - // } if e := b.addPMUData(data, tags); e != nil && err == nil { err = e } @@ -947,6 +960,9 @@ func StopPMUProfile() { if pmu.profileCyclePeriod != 0 { runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, 0) } + if pmu.profileInstPeriod != 0 { + runtime.SetPMUProfilePeriod(PERF_COUNT_HW_INSTRUCTIONS, 0) + } if pmu.profileCacheMissPeriod != 0 { runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, 0) } @@ -957,8 +973,6 @@ func StopPMUProfile() { for i := 0; i < cap(pmu.done); i++ { <-pmu.done } - - } // countBlock returns the number of records in the blocking profile. diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 793b3333c1..d84b666d79 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2159,7 +2159,7 @@ func execute(gp *g, inheritTime bool) { setThreadCPUProfiler(hz) } - for eventId := 0; eventId < 10; eventId++ { + for eventId := 0; eventId < maxPMUEvents; eventId++ { if _g_.m.profilePMUPeriod[eventId] != period[eventId] { setThreadPMUProfiler(int32(eventId), period[eventId]) } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index b7a3a884d1..a446f39635 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -308,7 +308,10 @@ func setThreadPMUProfiler(eventId int32, period int32) { if period == 0 { // Go routine is finished fd := _g_.m.eventFd[eventId] - closefd(fd) + if _, ok := _g_.m.eventMap[fd]; ok { + delete(_g_.m.eventMap, fd) // delete it from the map + closefd(fd) + } } else { if preciseIP == -1 { preciseIP = getPreciseIP() // never equals to -1 again From 2b986ed49dbb2c982fa916bebe78abc726f8f539 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 2 Jul 2019 20:27:19 -0700 Subject: [PATCH 027/126] removal --- test/pmu/cycle/test1.go | 185 ------------------------------------ test/pmu/cycle/test1.out | 10 -- test/pmu/cycle/test2.go | 193 -------------------------------------- test/pmu/cycle/test2.out | 10 -- test/pmu/cycle/test3.go | 197 --------------------------------------- test/pmu/cycle/test3.out | 10 -- 6 files changed, 605 deletions(-) delete mode 100644 test/pmu/cycle/test1.go delete mode 100644 test/pmu/cycle/test1.out delete mode 100644 test/pmu/cycle/test2.go delete mode 100644 test/pmu/cycle/test2.out delete mode 100644 test/pmu/cycle/test3.go delete mode 100644 test/pmu/cycle/test3.out diff --git a/test/pmu/cycle/test1.go b/test/pmu/cycle/test1.go deleted file mode 100644 index 0a5b52dd0d..0000000000 --- a/test/pmu/cycle/test1.go +++ /dev/null @@ -1,185 +0,0 @@ -// run - -package main - -import ( - "fmt" - "log" - "os" - "runtime/pprof" - "sync" -) - -//go:noinline -func fun1(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun2(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun3(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun4(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun5(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun6(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun7(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun8(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun9(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun10(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -func main() { - cpuf, err := os.Create("test1_profile") - if err != nil { - log.Fatal(err) - } - pprof.StartCPUProfile(cpuf) - defer pprof.StopCPUProfile() - - var wg sync.WaitGroup - wg.Add(10) // fun1-fun10 - defer wg.Wait() // similar to pthread_join - - go fun1(&wg) - go fun2(&wg) - go fun3(&wg) - go fun4(&wg) - go fun5(&wg) - go fun6(&wg) - go fun7(&wg) - go fun8(&wg) - go fun9(&wg) - go fun10(&wg) -} diff --git a/test/pmu/cycle/test1.out b/test/pmu/cycle/test1.out deleted file mode 100644 index 9546171295..0000000000 --- a/test/pmu/cycle/test1.out +++ /dev/null @@ -1,10 +0,0 @@ -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 diff --git a/test/pmu/cycle/test2.go b/test/pmu/cycle/test2.go deleted file mode 100644 index 952f44823d..0000000000 --- a/test/pmu/cycle/test2.go +++ /dev/null @@ -1,193 +0,0 @@ -// run - -package main - -import ( - "fmt" - "log" - "os" - "runtime/pprof" -) - -//go:noinline -func fun1(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun2(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun3(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun4(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun5(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun6(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun7(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun8(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun9(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun10(c chan int) { - defer close(c) - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -func waitForChans(chans ...chan int) { - for _, v := range chans { - <-v - } -} - -func main() { - cpuf, err := os.Create("test2_profile") - if err != nil { - log.Fatal(err) - } - pprof.StartCPUProfile(cpuf) - defer pprof.StopCPUProfile() - - var chans [10]chan int - for i := range chans { - chans[i] = make(chan int) - } - - go fun1(chans[0]) - go fun2(chans[1]) - go fun3(chans[2]) - go fun4(chans[3]) - go fun5(chans[4]) - go fun6(chans[5]) - go fun7(chans[6]) - go fun8(chans[7]) - go fun9(chans[8]) - go fun10(chans[9]) - - waitForChans(chans[0], chans[1], chans[2], chans[3], chans[4], chans[5], chans[6], chans[7], chans[8], chans[9]) -} diff --git a/test/pmu/cycle/test2.out b/test/pmu/cycle/test2.out deleted file mode 100644 index 9546171295..0000000000 --- a/test/pmu/cycle/test2.out +++ /dev/null @@ -1,10 +0,0 @@ -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 diff --git a/test/pmu/cycle/test3.go b/test/pmu/cycle/test3.go deleted file mode 100644 index e9e0e7f61d..0000000000 --- a/test/pmu/cycle/test3.go +++ /dev/null @@ -1,197 +0,0 @@ -// run - -package main - -import ( - "fmt" - "flag" - "log" - "os" - "runtime/pprof" - "sync" -) - -//go:noinline -func fun1(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun2(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun3(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun4(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -func fun5(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun6(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun7(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun8(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -func fun9(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -//go:noinline -func fun10(wg *sync.WaitGroup) { - defer wg.Done() - - var sum int - for i:= 0; i < 500000000; i++ { - sum -= i / 2 - sum *= i - sum /= i / 3 + 1 - sum -= i / 4 - } - - fmt.Println(sum) -} - -var args = flag.String("p", "", "itimer() is used by default") - -func main() { - flag.Parse() - - if *args != "" { - pprof.EnablePMU(*args) - } - - cpuf, err := os.Create("test3_profile") - if err != nil { - log.Fatal(err) - } - pprof.StartCPUProfile(cpuf) - defer pprof.StopCPUProfile() - - var wg [10]sync.WaitGroup - for i := range wg { - wg[i].Add(1) - } - - go fun1(&(wg[0])) - go fun2(&(wg[1])) - go fun3(&(wg[2])) - go fun4(&(wg[3])) - go fun5(&(wg[4])) - go fun6(&(wg[5])) - go fun7(&(wg[6])) - go fun8(&(wg[7])) - go fun9(&(wg[8])) - go fun10(&(wg[9])) - - for i:= range wg { - wg[i].Wait() - } -} diff --git a/test/pmu/cycle/test3.out b/test/pmu/cycle/test3.out deleted file mode 100644 index 9546171295..0000000000 --- a/test/pmu/cycle/test3.out +++ /dev/null @@ -1,10 +0,0 @@ -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 -44438869911 From 14b10275962252cb3fd70a9e79e3c29b22e22242 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 2 Jul 2019 20:30:50 -0700 Subject: [PATCH 028/126] test cases --- test/pmu/test1.go | 189 +++++++++++++++++++++++++++++++++++++++ test/pmu/test1.out | 10 +++ test/pmu/test2.go | 218 +++++++++++++++++++++++++++++++++++++++++++++ test/pmu/test2.out | 10 +++ 4 files changed, 427 insertions(+) create mode 100644 test/pmu/test1.go create mode 100644 test/pmu/test1.out create mode 100644 test/pmu/test2.go create mode 100644 test/pmu/test2.out diff --git a/test/pmu/test1.go b/test/pmu/test1.go new file mode 100644 index 0000000000..412de9e4e7 --- /dev/null +++ b/test/pmu/test1.go @@ -0,0 +1,189 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "sync" + "runtime/pprof" +) + +var wg sync.WaitGroup + +func f1() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f2() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f3() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f4() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f5() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f6() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f7() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f8() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f9() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f10() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + + +func run() error { + cycle, err := os.Create("cycle_profile") + if err != nil { + return err + } + defer cycle.Close() + + if err := pprof.StartPMUProfile(pprof.WithProfilingCyclePeriod(cycle, 20000000)); err != nil { + return err + } + defer pprof.StopPMUProfile() + + wg.Add(10) + defer wg.Wait() + + go f1() + go f2() + go f3() + go f4() + go f5() + go f6() + go f7() + go f8() + go f9() + go f10() + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/test1.out b/test/pmu/test1.out new file mode 100644 index 0000000000..9546171295 --- /dev/null +++ b/test/pmu/test1.out @@ -0,0 +1,10 @@ +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 diff --git a/test/pmu/test2.go b/test/pmu/test2.go new file mode 100644 index 0000000000..1e1b3ed420 --- /dev/null +++ b/test/pmu/test2.go @@ -0,0 +1,218 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "sync" + "runtime/pprof" +) + +var wg sync.WaitGroup + +func f1() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f2() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f3() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f4() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f5() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f6() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f7() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f8() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f9() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f10() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + + +func run() error { + itimer, err := os.Create("itimer_profile") + if err != nil { + return err + } + defer itimer.Close() + + cycle, err := os.Create("cycle_profile") + if err != nil { + return err + } + defer cycle.Close() + + inst, err := os.Create("inst_profile") + if err != nil { + return err + } + defer inst.Close() + + cacheRef, err := os.Create("cacheRef_profile") + if err != nil { + return err + } + defer cacheRef.Close() + + cacheMiss, err := os.Create("cacheMiss_profile") + if err != nil { + return err + } + defer cacheMiss.Close() + + if err := pprof.StartCPUProfile(itimer); err != nil { + return err + } + defer pprof.StopCPUProfile() + + if err := pprof.StartPMUProfile(pprof.WithProfilingCyclePeriod(cycle, 20000000), pprof.WithProfilingInstPeriod(inst, 20000000), pprof.WithProfilingCacheRefPeriod(cacheRef, 1000), pprof.WithProfilingCacheMissPeriod(cacheMiss, 1)); err != nil { + return err + } + defer pprof.StopPMUProfile() + + wg.Add(10) + defer wg.Wait() + + go f1() + go f2() + go f3() + go f4() + go f5() + go f6() + go f7() + go f8() + go f9() + go f10() + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/test2.out b/test/pmu/test2.out new file mode 100644 index 0000000000..9546171295 --- /dev/null +++ b/test/pmu/test2.out @@ -0,0 +1,10 @@ +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 From 372160413e947090b09ad012e74f0c8c2682861b Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 3 Jul 2019 10:47:04 -0700 Subject: [PATCH 029/126] redefine the interface --- src/runtime/defs_user_data.go | 11 +++ src/runtime/pmuprof.go | 22 ++---- src/runtime/pprof/pprof.go | 122 ++++++++++++++++++++++--------- src/runtime/proc.go | 38 +++++----- src/runtime/runtime2.go | 8 +- src/runtime/signal_sighandler.go | 4 +- src/runtime/signal_unix.go | 56 +++++--------- 7 files changed, 149 insertions(+), 112 deletions(-) create mode 100644 src/runtime/defs_user_data.go diff --git a/src/runtime/defs_user_data.go b/src/runtime/defs_user_data.go new file mode 100644 index 0000000000..988fe53de5 --- /dev/null +++ b/src/runtime/defs_user_data.go @@ -0,0 +1,11 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs1_linux.go + +package runtime + +type PMUEvent struct { + Cat uint32 // don't use type, which is a keyword reserved in golang + Code uint64 + Period uint64 + PreciseIP uint8 +} diff --git a/src/runtime/pmuprof.go b/src/runtime/pmuprof.go index af783d8b1b..f8154a32e2 100644 --- a/src/runtime/pmuprof.go +++ b/src/runtime/pmuprof.go @@ -44,16 +44,10 @@ type pmuProfile struct { var pmuprof [maxPMUEvents]pmuProfile // event -> cpuProfile -func SetPMUProfilePeriod(eventId int, period int) { - // Clamp period to something reasonable. - if period < 0 { - period = 0 - } - if period > 0 && period < 300 { // follows what hpctoolkit did - period = 300 - } +func SetPMUProfile(eventId int, event *PMUEvent) { + lock(&pmuprof[eventId].lock) - if period > 0 { + if event != nil { if pmuprof[eventId].on || pmuprof[eventId].log != nil { print("runtime: cannot set pmu profile rate until previous profile has finished.\n") unlock(&pmuprof[eventId].lock) @@ -62,11 +56,11 @@ func SetPMUProfilePeriod(eventId int, period int) { pmuprof[eventId].on = true pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) - hdr := [1]uint64{uint64(period)} + hdr := [1]uint64{event.Period} pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) - setpmuprofileperiod(int32(eventId), int32(period)) + setpmuprofile(int32(eventId), event) } else if pmuprof[eventId].on { - setpmuprofileperiod(int32(eventId), 0) + setpmuprofile(int32(eventId), nil) pmuprof[eventId].on = false pmuprof[eventId].addExtra(eventId) pmuprof[eventId].log.close() @@ -81,12 +75,12 @@ func SetPMUProfilePeriod(eventId int, period int) { // of stack. //go:nowritebarrierrec func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { - // Simple cas-lock to coordinate with setpmuprofilerate. + // Simple cas-lock to coordinate with setpmuprofile. for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { osyield() } - if profs[eventId].period != 0 { // implies pmuprof[eventId].log != nil + if profs[eventId].event != nil { // implies pmuprof[eventId].log != nil if p.numExtra > 0 || p.lostExtra > 0 { p.addExtra(eventId) } diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index e95caa78f7..e7f0a96e94 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -733,10 +733,6 @@ var pmu struct { sync.Mutex profiling bool done chan bool - profileCyclePeriod int - profileInstPeriod int - profileCacheMissPeriod int - profileCacheRefPeriod int } // StartCPUProfile enables CPU profiling for the current process. @@ -813,7 +809,18 @@ func WithProfilingRate(w io.Writer, hz int) ProfilingOption { }) } -func WithProfilingCyclePeriod(w io.Writer, period int) ProfilingOption { +func getPreciseIP(preciseIP int8) uint8 { + if preciseIP < 0 { + preciseIP = 0 + } else if preciseIP > 3 { + preciseIP = 3 + } + return uint8(preciseIP) +} + +// type PMUEvent runtime.PMUEvent + +func WithProfilingCycle(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { return profilingOptionFunc(func() error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") @@ -821,14 +828,28 @@ func WithProfilingCyclePeriod(w io.Writer, period int) ProfilingOption { if period <= 0 { return errors.New("period should be > 0") } - pmu.profileCyclePeriod = period - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, pmu.profileCyclePeriod) - go pmuProfileWriter(w, PERF_COUNT_HW_CPU_CYCLES, "cycles") + + // Clamp period to something reasonable + // Refer to hpctoolkit + if period < 300 { + period = 300 + } + + var cycle runtime.PMUEvent + cycle.Cat = PERF_TYPE_HARDWARE + cycle.Code = PERF_COUNT_HW_CPU_CYCLES + cycle.Period = uint64(period) + if len(preciseIP) != 0 { + cycle.PreciseIP = getPreciseIP(preciseIP[0]) + } + + runtime.SetPMUProfile(/*event ID*/ 0, &cycle) + go pmuProfileWriter(w, /*event ID*/ 0, "cycles") return nil }) } -func WithProfilingInstPeriod(w io.Writer, period int) ProfilingOption { +func WithProfilingInstr(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { return profilingOptionFunc(func() error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") @@ -836,14 +857,28 @@ func WithProfilingInstPeriod(w io.Writer, period int) ProfilingOption { if period <= 0 { return errors.New("period should be > 0") } - pmu.profileInstPeriod = period - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_INSTRUCTIONS, pmu.profileInstPeriod) - go pmuProfileWriter(w, PERF_COUNT_HW_INSTRUCTIONS, "instructions") + + // Clamp period to something reasonable + // Refer to hpctoolkit + if period < 300 { + period = 300 + } + + var instr runtime.PMUEvent + instr.Cat = PERF_TYPE_HARDWARE + instr.Code = PERF_COUNT_HW_INSTRUCTIONS + instr.Period = uint64(period) + if len(preciseIP) != 0 { + instr.PreciseIP = getPreciseIP(preciseIP[0]) + } + + runtime.SetPMUProfile(/*event ID*/ 1, &instr) + go pmuProfileWriter(w, /*event ID*/ 1, "instructions") return nil }) } -func WithProfilingCacheMissPeriod(w io.Writer, period int) ProfilingOption { +func WithProfilingCacheRef(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { return profilingOptionFunc(func() error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") @@ -851,14 +886,28 @@ func WithProfilingCacheMissPeriod(w io.Writer, period int) ProfilingOption { if period <= 0 { return errors.New("period should be > 0") } - pmu.profileCacheMissPeriod = period - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, pmu.profileCacheMissPeriod) - go pmuProfileWriter(w, PERF_COUNT_HW_CACHE_MISSES, "cache misses") + + // Clamp period to something reasonable + // Refer to hpctoolkit + if period < 300 { + period = 300 + } + + var cacheRef runtime.PMUEvent + cacheRef.Cat = PERF_TYPE_HARDWARE + cacheRef.Code = PERF_COUNT_HW_CACHE_REFERENCES + cacheRef.Period = uint64(period) + if len(preciseIP) != 0 { + cacheRef.PreciseIP = getPreciseIP(preciseIP[0]) + } + + runtime.SetPMUProfile(/*event ID*/ 2, &cacheRef) + go pmuProfileWriter(w, /*event ID*/ 2, "cache references") return nil }) } -func WithProfilingCacheRefPeriod(w io.Writer, period int) ProfilingOption { +func WithProfilingCacheMiss(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { return profilingOptionFunc(func() error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") @@ -866,9 +915,23 @@ func WithProfilingCacheRefPeriod(w io.Writer, period int) ProfilingOption { if period <= 0 { return errors.New("period should be > 0") } - pmu.profileCacheRefPeriod = period - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_REFERENCES, pmu.profileCacheRefPeriod) - go pmuProfileWriter(w, PERF_COUNT_HW_CACHE_REFERENCES, "cache references") + + // Clamp period to something reasonable + // Refer to hpctoolkit + if period < 300 { + period = 300 + } + + var cacheMiss runtime.PMUEvent + cacheMiss.Cat = PERF_TYPE_HARDWARE + cacheMiss.Code = PERF_COUNT_HW_CACHE_MISSES + cacheMiss.Period = uint64(period) + if len(preciseIP) != 0 { + cacheMiss.PreciseIP = getPreciseIP(preciseIP[0]) + } + + runtime.SetPMUProfile(/*event ID*/ 3, &cacheMiss) + go pmuProfileWriter(w, /*event ID*/ 3, "cache misses") return nil }) } @@ -916,7 +979,7 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { b := newProfileBuilder(w) var err error for { - time.Sleep(100 * time.Millisecond) + time.Sleep(10 * time.Millisecond) data, tags, eof := readPMUProfile(eventId) if e := b.addPMUData(data, tags); e != nil && err == nil { err = e @@ -947,7 +1010,6 @@ func StopCPUProfile() { <-cpu.done } - func StopPMUProfile() { pmu.Lock() defer pmu.Unlock() @@ -957,22 +1019,12 @@ func StopPMUProfile() { } pmu.profiling = false - if pmu.profileCyclePeriod != 0 { - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CPU_CYCLES, 0) - } - if pmu.profileInstPeriod != 0 { - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_INSTRUCTIONS, 0) - } - if pmu.profileCacheMissPeriod != 0 { - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_MISSES, 0) - } - if pmu.profileCacheRefPeriod != 0 { - runtime.SetPMUProfilePeriod(PERF_COUNT_HW_CACHE_REFERENCES, 0) + for i := 0; i < cap(pmu.done); i++ { + runtime.SetPMUProfile(i, nil) } - for i := 0; i < cap(pmu.done); i++ { <-pmu.done - } + } } // countBlock returns the number of records in the blocking profile. diff --git a/src/runtime/proc.go b/src/runtime/proc.go index d84b666d79..38b08d8ff7 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2149,7 +2149,7 @@ func execute(gp *g, inheritTime bool) { // Check whether the profiler needs to be turned on or off. hz := sched.profilehz - period := sched.profilePMUPeriod + events := sched.events // if _g_.m.profilehz != hz && _g_.m.profilePeriod != period { // println("should never reach here!") @@ -2160,8 +2160,8 @@ func execute(gp *g, inheritTime bool) { } for eventId := 0; eventId < maxPMUEvents; eventId++ { - if _g_.m.profilePMUPeriod[eventId] != period[eventId] { - setThreadPMUProfiler(int32(eventId), period[eventId]) + if _g_.m.events[eventId] != events[eventId] { + setThreadPMUProfiler(int32(eventId), events[eventId]) } } @@ -3632,9 +3632,9 @@ var prof struct { hz int32 } -var profs [10]struct { +var profs [maxPMUEvents]struct { // TODO: come up with a bettter name signalLock uint32 - period int32 + event *PMUEvent } func _System() { _System() } @@ -3816,7 +3816,7 @@ var lostPMUAtomic64Count[10] uint64 //go:nowritebarrierrec func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { - if profs[eventId].period == 0 { + if profs[eventId].event == nil { return } // On mips{,le}, 64bit atomics are emulated with spinlocks, in @@ -3902,7 +3902,7 @@ func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { } } - if profs[eventId].period != 0 { + if profs[eventId].event != nil { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostPMUAtomic64Count[eventId] > 0 { pmuprof[eventId].addLostAtomic64(lostPMUAtomic64Count[eventId], eventId) lostPMUAtomic64Count[eventId] = 0 @@ -3939,7 +3939,7 @@ func sigprofNonGo() { //go:nosplit //go:nowritebarrierrec func sigpmuNonGo(eventId int) { - if profs[eventId].period != 0 { + if profs[eventId].event != nil { n := 0 for n < len(sigprofCallers) && sigprofCallers[n] != 0 { n++ @@ -3968,7 +3968,7 @@ func sigprofNonGoPC(pc uintptr) { //go:nosplit //go:nowritebarrierrec func sigpmuNonGoPC(pc uintptr, eventId int) { - if profs[eventId].period != 0 { + if profs[eventId].event != nil { stk := []uintptr{ pc, funcPC(_ExternalCode) + sys.PCQuantum, @@ -4039,11 +4039,7 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } -func setpmuprofileperiod(eventId int32, period int32) { - // Force sane arguments. - if period < 0 { - period = 0 - } +func setpmuprofile(eventId int32, event *PMUEvent) { // Disable preemption, otherwise we can be rescheduled to another thread // that has profiling enabled. @@ -4053,23 +4049,23 @@ func setpmuprofileperiod(eventId int32, period int32) { // Stop profiler on this thread so that it is safe to lock prof. // if a profiling signal came in while we had prof locked, // it would deadlock. - setThreadPMUProfiler(eventId, 0) + setThreadPMUProfiler(eventId, nil) for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { osyield() } - if profs[eventId].period != period { - setProcessPMUProfiler(period) - profs[eventId].period = period + if profs[eventId].event != event { + setProcessPMUProfiler(event) + profs[eventId].event = event } atomic.Store(&profs[eventId].signalLock, 0) lock(&sched.lock) - sched.profilePMUPeriod[eventId] = period + sched.events[eventId] = event unlock(&sched.lock) - if period != 0 { - setThreadPMUProfiler(eventId, period) + if event != nil { + setThreadPMUProfiler(eventId, event) } _g_.m.locks-- diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 97b4d2724e..cfda44cc3d 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,9 +473,9 @@ type m struct { locks int32 dying int32 profilehz int32 - eventFd [maxPMUProfStack]int32 - profilePMUPeriod [maxPMUProfStack]int32 // event Id -> period - eventMap map[int32]int32 // fd->event Id + fds [maxPMUProfStack]int32 + events [maxPMUProfStack]*PMUEvent + fdToEventIdMap map[int32]int32 // fd->event Id spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack @@ -678,7 +678,7 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - profilePMUPeriod [maxPMUProfStack]int32 // event Id -> period + events [maxPMUProfStack]*PMUEvent procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 605f58c416..0d9ed2ae00 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -38,13 +38,13 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { fd := info.si_fd ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) - if _g_.m.eventMap == nil { + if _g_.m.fdToEventIdMap == nil { println("should not reach here") ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return } - eventId := _g_.m.eventMap[fd] + eventId := _g_.m.fdToEventIdMap[fd] sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, int(eventId)) ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index a446f39635..bb5acc147d 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -251,8 +251,8 @@ func setProcessCPUProfiler(hz int32) { } } -func setProcessPMUProfiler(period int32) { - if period != 0 { +func setProcessPMUProfiler(event *PMUEvent) { + if event != nil { // Enable the Go signal handler if not enabled. if atomic.Cas(&handlingSig[_SIGRTMIN + 3], 0, 1) { atomic.Storeuintptr(&fwdSig[_SIGRTMIN + 3], getsig(_SIGRTMIN + 3)) @@ -285,50 +285,33 @@ func setThreadCPUProfiler(hz int32) { _g_.m.profilehz = hz } -func getPreciseIP() int32 { - if ip, ok := atoi32(gogetenv("PMU_PRECISE_IP")); ok { - if ip < 0 { - ip = 0 - } else if ip > 3 { - ip = 3 - } - return ip - } - return 0 // PMU_PRECISE_IP is not set -} - -var preciseIP int32 = -1 - -func setThreadPMUProfiler(eventId int32, period int32) { +func setThreadPMUProfiler(eventId int32, event *PMUEvent) { _g_ := getg() - _g_.m.profilePMUPeriod[eventId] = period - if _g_.m.eventMap == nil { - _g_.m.eventMap = make(map[int32]int32) + if _g_.m.fdToEventIdMap == nil { + _g_.m.fdToEventIdMap = make(map[int32]int32) } - if period == 0 { // Go routine is finished - fd := _g_.m.eventFd[eventId] - if _, ok := _g_.m.eventMap[fd]; ok { - delete(_g_.m.eventMap, fd) // delete it from the map - closefd(fd) - } + if event == nil { // Go routine is finished + if _g_.m.events[eventId] != nil { + fd := _g_.m.fds[eventId] + if _, ok := _g_.m.fdToEventIdMap[fd]; ok { + delete(_g_.m.fdToEventIdMap, fd) // delete it from the map + closefd(fd) + } + } } else { - if preciseIP == -1 { - preciseIP = getPreciseIP() // never equals to -1 again - } - var attr PerfEventAttr - attr.Type = PERF_TYPE_HARDWARE + attr.Type = event.Cat attr.Size = uint32(unsafe.Sizeof(attr)) - attr.Config = uint64(eventId) - attr.Sample = uint64(period) - attr.Bits = uint64(preciseIP) << 15 // precise ip + attr.Config = event.Code + attr.Sample = event.Period + attr.Bits = uint64(event.PreciseIP) << 15 // precise ip attr.Bits += 0b100000 // don't count kernel attr.Bits += 0b1000000 // don't count hypervisor fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) - _g_.m.eventFd[eventId] = fd - _g_.m.eventMap[fd] = eventId + _g_.m.fds[eventId] = fd + _g_.m.fdToEventIdMap[fd] = eventId r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) fcntl(fd, /*F_SETSIG*/ 0xa, _SIGRTMIN + 3) @@ -336,6 +319,7 @@ func setThreadPMUProfiler(eventId int32, period int32) { fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) } + _g_.m.events[eventId] = event } func sigpipe() { From 7362ce085af4078cda11b369661f52c30fba2074 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 3 Jul 2019 10:47:38 -0700 Subject: [PATCH 030/126] test cases --- test/pmu/test1.go | 2 +- test/pmu/test2.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 412de9e4e7..8b14f0daf2 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -160,7 +160,7 @@ func run() error { } defer cycle.Close() - if err := pprof.StartPMUProfile(pprof.WithProfilingCyclePeriod(cycle, 20000000)); err != nil { + if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycle, 20000000)); err != nil { return err } defer pprof.StopPMUProfile() diff --git a/test/pmu/test2.go b/test/pmu/test2.go index 1e1b3ed420..d8eaa8849b 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -166,11 +166,11 @@ func run() error { } defer cycle.Close() - inst, err := os.Create("inst_profile") + instr, err := os.Create("instr_profile") if err != nil { return err } - defer inst.Close() + defer instr.Close() cacheRef, err := os.Create("cacheRef_profile") if err != nil { @@ -189,7 +189,7 @@ func run() error { } defer pprof.StopCPUProfile() - if err := pprof.StartPMUProfile(pprof.WithProfilingCyclePeriod(cycle, 20000000), pprof.WithProfilingInstPeriod(inst, 20000000), pprof.WithProfilingCacheRefPeriod(cacheRef, 1000), pprof.WithProfilingCacheMissPeriod(cacheMiss, 1)); err != nil { + if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycle, 20000000), pprof.WithProfilingInstr(instr, 20000000), pprof.WithProfilingCacheRef(cacheRef, 1000), pprof.WithProfilingCacheMiss(cacheMiss, 1)); err != nil { return err } defer pprof.StopPMUProfile() From 84264fe2bf842b952db6d028e72a55b5881c55fa Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 3 Jul 2019 13:11:28 -0700 Subject: [PATCH 031/126] removal --- src/runtime/pprof/perf_event_linux_amd64.go | 51 --------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/runtime/pprof/perf_event_linux_amd64.go diff --git a/src/runtime/pprof/perf_event_linux_amd64.go b/src/runtime/pprof/perf_event_linux_amd64.go deleted file mode 100644 index 06bccd9fa0..0000000000 --- a/src/runtime/pprof/perf_event_linux_amd64.go +++ /dev/null @@ -1,51 +0,0 @@ -// created by cgo -cdefs and then converted to Go -// cgo -cdefs defs_linux.go defs1_linux.go - -package pprof - -const ( - PERF_TYPE_HARDWARE = 0x0 - PERF_TYPE_SOFTWARE = 0x1 - PERF_TYPE_TRACEPOINT = 0x2 - PERF_TYPE_HW_CACHE = 0x3 - PERF_TYPE_RAW = 0x4 - PERF_TYPE_BREAKPOINT = 0x5 - - PERF_COUNT_HW_CPU_CYCLES = 0x0 - PERF_COUNT_HW_INSTRUCTIONS = 0x1 - PERF_COUNT_HW_CACHE_REFERENCES = 0x2 - PERF_COUNT_HW_CACHE_MISSES = 0x3 - PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 - PERF_COUNT_HW_BRANCH_MISSES = 0x5 - PERF_COUNT_HW_BUS_CYCLES = 0x6 - PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 - PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 - PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - - PERF_COUNT_HW_CACHE_L1D = 0x0 - PERF_COUNT_HW_CACHE_L1I = 0x1 - PERF_COUNT_HW_CACHE_LL = 0x2 - PERF_COUNT_HW_CACHE_DTLB = 0x3 - PERF_COUNT_HW_CACHE_ITLB = 0x4 - PERF_COUNT_HW_CACHE_BPU = 0x5 - PERF_COUNT_HW_CACHE_NODE = 0x6 - - PERF_COUNT_HW_CACHE_OP_READ = 0x0 - PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 - PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - - PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 - PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - - PERF_COUNT_SW_CPU_CLOCK = 0x0 - PERF_COUNT_SW_TASK_CLOCK = 0x1 - PERF_COUNT_SW_PAGE_FAULTS = 0x2 - PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 - PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 - PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 - PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 - PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 - PERF_COUNT_SW_EMULATION_FAULTS = 0x8 - PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa -) From 28ccd61de301e86c14419291b501d78fa90f0332 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 3 Jul 2019 13:11:41 -0700 Subject: [PATCH 032/126] minor --- src/runtime/pprof/pprof.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index e7f0a96e94..03ad427690 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -818,8 +818,6 @@ func getPreciseIP(preciseIP int8) uint8 { return uint8(preciseIP) } -// type PMUEvent runtime.PMUEvent - func WithProfilingCycle(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { return profilingOptionFunc(func() error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { @@ -836,8 +834,8 @@ func WithProfilingCycle(w io.Writer, period int64, preciseIP ...int8) ProfilingO } var cycle runtime.PMUEvent - cycle.Cat = PERF_TYPE_HARDWARE - cycle.Code = PERF_COUNT_HW_CPU_CYCLES + cycle.Cat = runtime.PERF_TYPE_HARDWARE + cycle.Code = runtime.PERF_COUNT_HW_CPU_CYCLES cycle.Period = uint64(period) if len(preciseIP) != 0 { cycle.PreciseIP = getPreciseIP(preciseIP[0]) @@ -865,8 +863,8 @@ func WithProfilingInstr(w io.Writer, period int64, preciseIP ...int8) ProfilingO } var instr runtime.PMUEvent - instr.Cat = PERF_TYPE_HARDWARE - instr.Code = PERF_COUNT_HW_INSTRUCTIONS + instr.Cat = runtime.PERF_TYPE_HARDWARE + instr.Code = runtime.PERF_COUNT_HW_INSTRUCTIONS instr.Period = uint64(period) if len(preciseIP) != 0 { instr.PreciseIP = getPreciseIP(preciseIP[0]) @@ -894,8 +892,8 @@ func WithProfilingCacheRef(w io.Writer, period int64, preciseIP ...int8) Profili } var cacheRef runtime.PMUEvent - cacheRef.Cat = PERF_TYPE_HARDWARE - cacheRef.Code = PERF_COUNT_HW_CACHE_REFERENCES + cacheRef.Cat = runtime.PERF_TYPE_HARDWARE + cacheRef.Code = runtime.PERF_COUNT_HW_CACHE_REFERENCES cacheRef.Period = uint64(period) if len(preciseIP) != 0 { cacheRef.PreciseIP = getPreciseIP(preciseIP[0]) @@ -923,8 +921,8 @@ func WithProfilingCacheMiss(w io.Writer, period int64, preciseIP ...int8) Profil } var cacheMiss runtime.PMUEvent - cacheMiss.Cat = PERF_TYPE_HARDWARE - cacheMiss.Code = PERF_COUNT_HW_CACHE_MISSES + cacheMiss.Cat = runtime.PERF_TYPE_HARDWARE + cacheMiss.Code = runtime.PERF_COUNT_HW_CACHE_MISSES cacheMiss.Period = uint64(period) if len(preciseIP) != 0 { cacheMiss.PreciseIP = getPreciseIP(preciseIP[0]) From 020bcba2991b59020c7e89e1705e989a2ffa83f4 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 3 Jul 2019 13:37:23 -0700 Subject: [PATCH 033/126] minor --- src/runtime/pprof/pprof.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 03ad427690..d656ed3d84 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -798,17 +798,6 @@ func StartPMUProfile(opts ...ProfilingOption) error { return nil } -func WithProfilingRate(w io.Writer, hz int) ProfilingOption { - return profilingOptionFunc(func() error { - if hz != 0 { - cpu.profileHz = hz - runtime.SetCPUProfileRate(cpu.profileHz) - go profileWriter(w) - } - return nil - }) -} - func getPreciseIP(preciseIP int8) uint8 { if preciseIP < 0 { preciseIP = 0 From 697954f9c1c40ce96315651da6f3c980bb5cd5b0 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 7 Jul 2019 21:06:09 -0700 Subject: [PATCH 034/126] refactoring --- src/runtime/defs_linux_amd64.go | 15 +++- src/runtime/defs_pmu.go | 44 ++++++++++ src/runtime/os_linux.go | 2 +- src/runtime/pmuprof.go | 18 ++-- src/runtime/pprof/pprof.go | 142 +++++++++++++------------------ src/runtime/proc.go | 38 ++++----- src/runtime/runtime2.go | 8 +- src/runtime/signal_sighandler.go | 21 +++-- src/runtime/signal_unix.go | 82 +++++++++--------- 9 files changed, 196 insertions(+), 174 deletions(-) create mode 100644 src/runtime/defs_pmu.go diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 1695e38a3d..b7924ee29c 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -57,7 +57,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGRTMIN = 0x22 + _SIGPMU = 0x25 _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 @@ -394,8 +394,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) - -type PerfEventAttr struct { +type perfEventAttr struct { Type uint32 Size uint32 Config uint64 @@ -421,3 +420,13 @@ type fOwnerEx struct { Pid int32 } + +var perfEventOpt = []struct { + Type uint32 + Config uint64 +} { + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, +} diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go new file mode 100644 index 0000000000..6030a5061c --- /dev/null +++ b/src/runtime/defs_pmu.go @@ -0,0 +1,44 @@ +// created by cgo -cdefs and then converted to Go +// cgo -cdefs defs_linux.go defs1_linux.go + +package runtime + +const ( + GO_COUNT_HW_CPU_CYCLES = 0x0 + GO_COUNT_HW_INSTRUCTIONS = 0x1 + GO_COUNT_HW_CACHE_REFERENCES = 0x2 + GO_COUNT_HW_CACHE_MISSES = 0x3 + GO_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + GO_COUNT_HW_BRANCH_MISSES = 0x5 + GO_COUNT_HW_BUS_CYCLES = 0x6 + GO_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + GO_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + GO_COUNT_HW_REF_CPU_CYCLES = 0x9 + + GO_COUNT_HW_CACHE_L1D = 0xa + GO_COUNT_HW_CACHE_L1I = 0xb + GO_COUNT_HW_CACHE_LL = 0xc + GO_COUNT_HW_CACHE_DTLB = 0xd + GO_COUNT_HW_CACHE_ITLB = 0xe + GO_COUNT_HW_CACHE_BPU = 0xf + GO_COUNT_HW_CACHE_NODE = 0x10 + + GO_COUNT_HW_CACHE_OP_READ = 0x11 + GO_COUNT_HW_CACHE_OP_WRITE = 0x12 + GO_COUNT_HW_CACHE_OP_PREFETCH = 0x13 + + GO_COUNT_HW_CACHE_RESULT_ACCESS = 0x14 + GO_COUNT_HW_CACHE_RESULT_MISS = 0x15 + + GO_COUNT_SW_CPU_CLOCK = 0x16 + GO_COUNT_SW_TASK_CLOCK = 0x17 + GO_COUNT_SW_PAGE_FAULTS = 0x18 + GO_COUNT_SW_CONTEXT_SWITCHES = 0x19 +) + +type PMUEventAttr struct { + Period uint64 + PreciseIP uint8 + IsKernelIncluded bool + IsHvIncluded bool +} diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 334a7b4223..8f41e211e3 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -357,7 +357,7 @@ func sigaltstack(new, old *stackt) func setitimer(mode int32, new, old *itimerval) //go:noescape -func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) +func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) func ioctl(fd int32, req, arg int64) int64 diff --git a/src/runtime/pmuprof.go b/src/runtime/pmuprof.go index f8154a32e2..f0e0b9d3bb 100644 --- a/src/runtime/pmuprof.go +++ b/src/runtime/pmuprof.go @@ -44,10 +44,10 @@ type pmuProfile struct { var pmuprof [maxPMUEvents]pmuProfile // event -> cpuProfile -func SetPMUProfile(eventId int, event *PMUEvent) { +func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { lock(&pmuprof[eventId].lock) - if event != nil { + if eventAttr != nil { if pmuprof[eventId].on || pmuprof[eventId].log != nil { print("runtime: cannot set pmu profile rate until previous profile has finished.\n") unlock(&pmuprof[eventId].lock) @@ -56,9 +56,9 @@ func SetPMUProfile(eventId int, event *PMUEvent) { pmuprof[eventId].on = true pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) - hdr := [1]uint64{event.Period} + hdr := [1]uint64{eventAttr.Period} pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) - setpmuprofile(int32(eventId), event) + setpmuprofile(int32(eventId), eventAttr) } else if pmuprof[eventId].on { setpmuprofile(int32(eventId), nil) pmuprof[eventId].on = false @@ -76,11 +76,11 @@ func SetPMUProfile(eventId int, event *PMUEvent) { //go:nowritebarrierrec func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { // Simple cas-lock to coordinate with setpmuprofile. - for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { osyield() } - if profs[eventId].event != nil { // implies pmuprof[eventId].log != nil + if pmuEvent[eventId].eventAttr != nil { // implies pmuprof[eventId].log != nil if p.numExtra > 0 || p.lostExtra > 0 { p.addExtra(eventId) } @@ -92,7 +92,7 @@ func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { pmuprof[eventId].log.write(&gp.labels, nanotime(), hdr[:], stk) } - atomic.Store(&profs[eventId].signalLock, 0) + atomic.Store(&pmuEvent[eventId].signalLock, 0) } // addNonGo adds the non-Go stack trace to the profile. @@ -108,7 +108,7 @@ func (p *pmuProfile) addNonGo(stk []uintptr, eventId int) { // (Other calls to add or addNonGo should be blocked out // by the fact that only one SIGPROF can be handled by the // process at a time. If not, this lock will serialize those too.) - for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { osyield() } @@ -121,7 +121,7 @@ func (p *pmuProfile) addNonGo(stk []uintptr, eventId int) { pmuprof[eventId].lostExtra++ } - atomic.Store(&profs[eventId].signalLock, 0) + atomic.Store(&pmuEvent[eventId].signalLock, 0) } // addExtra adds the "extra" profiling events, diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index d656ed3d84..92c6a9fa46 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -729,12 +729,6 @@ var cpu struct { profileHz int } -var pmu struct { - sync.Mutex - profiling bool - done chan bool -} - // StartCPUProfile enables CPU profiling for the current process. // While profiling, the profile will be buffered and written to w. // StartCPUProfile returns an error if profiling is already enabled. @@ -746,7 +740,7 @@ var pmu struct { // not to the one used by Go. To make it work, call os/signal.Notify // for syscall.SIGPROF, but note that doing so may break any profiling // being done by the main program. -func StartCPUProfile(w io.Writer, hz ...int) error { +func StartCPUProfile(w io.Writer, profileHz ...int) error { // The runtime routines allow a variable profiling rate, // but in practice operating systems cannot trigger signals // at more than about 500 Hz, and our processing of the @@ -756,10 +750,10 @@ func StartCPUProfile(w io.Writer, hz ...int) error { // system, and a nice round number to make it easy to // convert sample counts to seconds. Instead of requiring // each client to specify the frequency, we hard code it. - if len(hz) == 0 { - cpu.profileHz = 100 - } else { - cpu.profileHz = hz[0] + + var hz = 100 + if len(profileHz) != 0 { + hz = profileHz[0] } cpu.Lock() @@ -772,14 +766,23 @@ func StartCPUProfile(w io.Writer, hz ...int) error { return fmt.Errorf("cpu profiling already in use") } cpu.profiling = true - runtime.SetCPUProfileRate(cpu.profileHz) + runtime.SetCPUProfileRate(hz) go profileWriter(w) return nil } +var pmu struct { + sync.Mutex + profiling bool + done chan bool +} func StartPMUProfile(opts ...ProfilingOption) error { - pmu.Lock() + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { + return errors.New("not implemented") + } + + pmu.Lock() defer pmu.Unlock() if pmu.done == nil { pmu.done = make(chan bool, len(opts)) @@ -798,6 +801,13 @@ func StartPMUProfile(opts ...ProfilingOption) error { return nil } +type PMUEventConfig struct { + Period int64 + PreciseIP int8 + IsKernelIncluded bool + IsHvIncluded bool +} + func getPreciseIP(preciseIP int8) uint8 { if preciseIP < 0 { preciseIP = 0 @@ -807,57 +817,43 @@ func getPreciseIP(preciseIP int8) uint8 { return uint8(preciseIP) } -func WithProfilingCycle(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { +func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemented") - } - if period <= 0 { - return errors.New("period should be > 0") + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") } - // Clamp period to something reasonable // Refer to hpctoolkit - if period < 300 { - period = 300 + if eventConfig.Period < 300 { + eventConfig.Period = 300 } - var cycle runtime.PMUEvent - cycle.Cat = runtime.PERF_TYPE_HARDWARE - cycle.Code = runtime.PERF_COUNT_HW_CPU_CYCLES - cycle.Period = uint64(period) - if len(preciseIP) != 0 { - cycle.PreciseIP = getPreciseIP(preciseIP[0]) - } - - runtime.SetPMUProfile(/*event ID*/ 0, &cycle) + cycle := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), + IsKernelIncluded: eventConfig.IsKernelIncluded, + IsHvIncluded: eventConfig.IsHvIncluded} + + runtime.SetPMUProfile(/*event ID*/ 0, &cycle) go pmuProfileWriter(w, /*event ID*/ 0, "cycles") return nil }) } -func WithProfilingInstr(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { +func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemented") - } - if period <= 0 { - return errors.New("period should be > 0") + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") } - // Clamp period to something reasonable // Refer to hpctoolkit - if period < 300 { - period = 300 + if eventConfig.Period < 300 { + eventConfig.Period = 300 } - var instr runtime.PMUEvent - instr.Cat = runtime.PERF_TYPE_HARDWARE - instr.Code = runtime.PERF_COUNT_HW_INSTRUCTIONS - instr.Period = uint64(period) - if len(preciseIP) != 0 { - instr.PreciseIP = getPreciseIP(preciseIP[0]) - } + instr := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), + IsKernelIncluded: eventConfig.IsKernelIncluded, + IsHvIncluded: eventConfig.IsHvIncluded} runtime.SetPMUProfile(/*event ID*/ 1, &instr) go pmuProfileWriter(w, /*event ID*/ 1, "instructions") @@ -865,28 +861,16 @@ func WithProfilingInstr(w io.Writer, period int64, preciseIP ...int8) ProfilingO }) } -func WithProfilingCacheRef(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { +func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemented") - } - if period <= 0 { - return errors.New("period should be > 0") + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") } - // Clamp period to something reasonable - // Refer to hpctoolkit - if period < 300 { - period = 300 - } - - var cacheRef runtime.PMUEvent - cacheRef.Cat = runtime.PERF_TYPE_HARDWARE - cacheRef.Code = runtime.PERF_COUNT_HW_CACHE_REFERENCES - cacheRef.Period = uint64(period) - if len(preciseIP) != 0 { - cacheRef.PreciseIP = getPreciseIP(preciseIP[0]) - } + cacheRef := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), + IsKernelIncluded: eventConfig.IsKernelIncluded, + IsHvIncluded: eventConfig.IsHvIncluded} runtime.SetPMUProfile(/*event ID*/ 2, &cacheRef) go pmuProfileWriter(w, /*event ID*/ 2, "cache references") @@ -894,28 +878,16 @@ func WithProfilingCacheRef(w io.Writer, period int64, preciseIP ...int8) Profili }) } -func WithProfilingCacheMiss(w io.Writer, period int64, preciseIP ...int8) ProfilingOption { +func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemented") - } - if period <= 0 { - return errors.New("period should be > 0") - } - - // Clamp period to something reasonable - // Refer to hpctoolkit - if period < 300 { - period = 300 + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") } - var cacheMiss runtime.PMUEvent - cacheMiss.Cat = runtime.PERF_TYPE_HARDWARE - cacheMiss.Code = runtime.PERF_COUNT_HW_CACHE_MISSES - cacheMiss.Period = uint64(period) - if len(preciseIP) != 0 { - cacheMiss.PreciseIP = getPreciseIP(preciseIP[0]) - } + cacheMiss := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), + IsKernelIncluded: eventConfig.IsKernelIncluded, + IsHvIncluded: eventConfig.IsHvIncluded} runtime.SetPMUProfile(/*event ID*/ 3, &cacheMiss) go pmuProfileWriter(w, /*event ID*/ 3, "cache misses") diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 38b08d8ff7..3881ea8798 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2149,7 +2149,7 @@ func execute(gp *g, inheritTime bool) { // Check whether the profiler needs to be turned on or off. hz := sched.profilehz - events := sched.events + eventAttrs := sched.eventAttrs // if _g_.m.profilehz != hz && _g_.m.profilePeriod != period { // println("should never reach here!") @@ -2160,8 +2160,8 @@ func execute(gp *g, inheritTime bool) { } for eventId := 0; eventId < maxPMUEvents; eventId++ { - if _g_.m.events[eventId] != events[eventId] { - setThreadPMUProfiler(int32(eventId), events[eventId]) + if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { + setThreadPMUProfiler(int32(eventId), eventAttrs[eventId]) } } @@ -3632,9 +3632,9 @@ var prof struct { hz int32 } -var profs [maxPMUEvents]struct { // TODO: come up with a bettter name +var pmuEvent [maxPMUEvents]struct { // TODO: come up with a bettter name signalLock uint32 - event *PMUEvent + eventAttr *PMUEventAttr } func _System() { _System() } @@ -3815,8 +3815,8 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { var lostPMUAtomic64Count[10] uint64 //go:nowritebarrierrec -func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { - if profs[eventId].event == nil { +func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGRTMIN + 3 + if pmuEvent[eventId].eventAttr == nil { return } // On mips{,le}, 64bit atomics are emulated with spinlocks, in @@ -3902,7 +3902,7 @@ func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { } } - if profs[eventId].event != nil { + if pmuEvent[eventId].eventAttr != nil { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostPMUAtomic64Count[eventId] > 0 { pmuprof[eventId].addLostAtomic64(lostPMUAtomic64Count[eventId], eventId) lostPMUAtomic64Count[eventId] = 0 @@ -3939,7 +3939,7 @@ func sigprofNonGo() { //go:nosplit //go:nowritebarrierrec func sigpmuNonGo(eventId int) { - if profs[eventId].event != nil { + if pmuEvent[eventId].eventAttr != nil { n := 0 for n < len(sigprofCallers) && sigprofCallers[n] != 0 { n++ @@ -3968,7 +3968,7 @@ func sigprofNonGoPC(pc uintptr) { //go:nosplit //go:nowritebarrierrec func sigpmuNonGoPC(pc uintptr, eventId int) { - if profs[eventId].event != nil { + if pmuEvent[eventId].eventAttr != nil { stk := []uintptr{ pc, funcPC(_ExternalCode) + sys.PCQuantum, @@ -4039,7 +4039,7 @@ func setcpuprofilerate(hz int32) { _g_.m.locks-- } -func setpmuprofile(eventId int32, event *PMUEvent) { +func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { // Disable preemption, otherwise we can be rescheduled to another thread // that has profiling enabled. @@ -4051,21 +4051,21 @@ func setpmuprofile(eventId int32, event *PMUEvent) { // it would deadlock. setThreadPMUProfiler(eventId, nil) - for !atomic.Cas(&profs[eventId].signalLock, 0, 1) { + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { osyield() } - if profs[eventId].event != event { - setProcessPMUProfiler(event) - profs[eventId].event = event + if pmuEvent[eventId].eventAttr != eventAttr { + setProcessPMUProfiler(eventAttr) + pmuEvent[eventId].eventAttr = eventAttr } - atomic.Store(&profs[eventId].signalLock, 0) + atomic.Store(&pmuEvent[eventId].signalLock, 0) lock(&sched.lock) - sched.events[eventId] = event + sched.eventAttrs[eventId] = eventAttr unlock(&sched.lock) - if event != nil { - setThreadPMUProfiler(eventId, event) + if eventAttr != nil { + setThreadPMUProfiler(eventId, eventAttr) } _g_.m.locks-- diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index cfda44cc3d..bf16320542 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,9 +473,8 @@ type m struct { locks int32 dying int32 profilehz int32 - fds [maxPMUProfStack]int32 - events [maxPMUProfStack]*PMUEvent - fdToEventIdMap map[int32]int32 // fd->event Id + eventFds [maxPMUProfStack]int32 + eventAttrs [maxPMUProfStack]*PMUEventAttr spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack @@ -521,7 +520,6 @@ type m struct { dlogPerM mOS - } type p struct { @@ -678,7 +676,7 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - events [maxPMUProfStack]*PMUEvent + eventAttrs [maxPMUProfStack]*PMUEventAttr procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 0d9ed2ae00..a85885064b 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -34,19 +34,22 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { _g_ := getg() c := &sigctxt{info, ctxt} - if sig == _SIGRTMIN + 3 { + if sig == _SIGPMU { fd := info.si_fd ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) - if _g_.m.fdToEventIdMap == nil { - println("should not reach here") - ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) - return + var eventId int = -1 + for i := 0; i < maxPMUEvents; i++ { + if _g_.m.eventFds[i] == fd { + eventId = i + break + } } - - eventId := _g_.m.fdToEventIdMap[fd] - sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, int(eventId)) - ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + if eventId != -1 { + sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) + } + + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index bb5acc147d..3d78dabb2d 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -149,8 +149,8 @@ func sigenable(sig uint32) { return } - // SIGPROF and _SIGRTMIN + 3 are handled specially for profiling. - if sig == _SIGPROF || sig == _SIGRTMIN + 3 { + // SIGPROF and _SIGPMU are handled specially for profiling. + if sig == _SIGPROF || sig == _SIGPMU { return } @@ -174,8 +174,8 @@ func sigdisable(sig uint32) { return } - // SIGPROF and _SIGRTMIN + 3 are handled specially for profiling. - if sig == _SIGPROF || sig == _SIGRTMIN + 3 { + // SIGPROF and _SIGPMU are handled specially for profiling. + if sig == _SIGPROF || sig == _SIGPMU { return } @@ -203,8 +203,8 @@ func sigignore(sig uint32) { return } - // SIGPROF and _SIGRTMIN + 3 are handled specially for profiling. - if sig == _SIGPROF || sig == _SIGRTMIN + 3 { + // SIGPROF and _SIGPMU are handled specially for profiling. + if sig == _SIGPROF || sig == _SIGPMU { return } @@ -251,19 +251,19 @@ func setProcessCPUProfiler(hz int32) { } } -func setProcessPMUProfiler(event *PMUEvent) { - if event != nil { +func setProcessPMUProfiler(eventAttr *PMUEventAttr) { + if eventAttr != nil { // Enable the Go signal handler if not enabled. - if atomic.Cas(&handlingSig[_SIGRTMIN + 3], 0, 1) { - atomic.Storeuintptr(&fwdSig[_SIGRTMIN + 3], getsig(_SIGRTMIN + 3)) - setsig(_SIGRTMIN + 3, funcPC(sighandler)) + if atomic.Cas(&handlingSig[_SIGPMU], 0, 1) { + atomic.Storeuintptr(&fwdSig[_SIGPMU], getsig(_SIGPMU)) + setsig(_SIGPMU, funcPC(sighandler)) } } else { // If the Go signal handler should be disabled by default, // disable it if it is enabled. - if !sigInstallGoHandler(_SIGRTMIN + 3) { - if atomic.Cas(&handlingSig[_SIGRTMIN + 3], 1, 0) { - setsig(_SIGRTMIN + 3, atomic.Loaduintptr(&fwdSig[_SIGRTMIN + 3])) + if !sigInstallGoHandler(_SIGPMU) { + if atomic.Cas(&handlingSig[_SIGPMU], 1, 0) { + setsig(_SIGPMU, atomic.Loaduintptr(&fwdSig[_SIGPMU])) } } } @@ -285,41 +285,37 @@ func setThreadCPUProfiler(hz int32) { _g_.m.profilehz = hz } -func setThreadPMUProfiler(eventId int32, event *PMUEvent) { +func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _g_ := getg() - if _g_.m.fdToEventIdMap == nil { - _g_.m.fdToEventIdMap = make(map[int32]int32) - } - if event == nil { // Go routine is finished - if _g_.m.events[eventId] != nil { - fd := _g_.m.fds[eventId] - if _, ok := _g_.m.fdToEventIdMap[fd]; ok { - delete(_g_.m.fdToEventIdMap, fd) // delete it from the map - closefd(fd) - } - } + if eventAttr == nil { + if _g_.m.eventAttrs[eventId] != nil { + closefd(_g_.m.eventFds[eventId]) + } } else { - var attr PerfEventAttr - attr.Type = event.Cat - attr.Size = uint32(unsafe.Sizeof(attr)) - attr.Config = event.Code - attr.Sample = event.Period - attr.Bits = uint64(event.PreciseIP) << 15 // precise ip - attr.Bits += 0b100000 // don't count kernel - attr.Bits += 0b1000000 // don't count hypervisor - - fd, _, _ := perfEventOpen(&attr, 0, -1, -1, 0, /* dummy*/ 0) - _g_.m.fds[eventId] = fd - _g_.m.fdToEventIdMap[fd] = eventId + var perfAttr perfEventAttr + perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) + perfAttr.Type = perfEventOpt[eventId].Type + perfAttr.Config = perfEventOpt[eventId].Config + perfAttr.Sample = eventAttr.Period + perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip + if !eventAttr.IsKernelIncluded { // don't count kernel + perfAttr.Bits += 0b100000 + } + if !eventAttr.IsHvIncluded { // don't count hypervisor + perfAttr.Bits += 0b1000000 + } + + fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy*/ 0) + _g_.m.eventFds[eventId] = fd r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) - fcntl(fd, /*F_SETSIG*/ 0xa, _SIGRTMIN + 3) - + fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPMU) fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) } - _g_.m.events[eventId] = event + + _g_.m.eventAttrs[eventId] = eventAttr } func sigpipe() { @@ -350,7 +346,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { if sig == _SIGPROF { sigprofNonGoPC(c.sigpc()) return - } else if sig == _SIGRTMIN + 3 { + } else if sig == _SIGPMU { // sigpmuNonGoPC(c.sigpc()) println("how do I know which pmu event delivers this signal") return @@ -508,7 +504,7 @@ func dieFromSignal(sig uint32) { // thread, and the Go program does not want to handle it (that is, the // program has not called os/signal.Notify for the signal). func raisebadsignal(sig uint32, c *sigctxt) { - if sig == _SIGPROF || sig == _SIGRTMIN + 3 { + if sig == _SIGPROF || sig == _SIGPMU { // Ignore profiling signals that arrive on non-Go threads. return } From 3ca840d596871e4438174d3c2a855f8f7bb05e88 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 7 Jul 2019 21:15:04 -0700 Subject: [PATCH 035/126] test --- test/pmu/test1.go | 11 ++++++++--- test/pmu/test2.go | 43 +++++++++++++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 8b14f0daf2..5fcc42af72 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -154,13 +154,18 @@ func f10() { func run() error { - cycle, err := os.Create("cycle_profile") + cycleFile, err := os.Create("cycle_profile") if err != nil { return err } - defer cycle.Close() + defer cycleFile.Close() - if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycle, 20000000)); err != nil { + var cycle pprof.PMUEventConfig + cycle.Period = 20000000 + cycle.IsKernelIncluded = false + cycle.IsHvIncluded = false + + if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle)); err != nil { return err } defer pprof.StopPMUProfile() diff --git a/test/pmu/test2.go b/test/pmu/test2.go index d8eaa8849b..2a88e173b2 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -152,44 +152,59 @@ func f10() { fmt.Println(sum) } - func run() error { - itimer, err := os.Create("itimer_profile") + itimerFile, err := os.Create("itimer_profile") if err != nil { return err } - defer itimer.Close() + defer itimerFile.Close() - cycle, err := os.Create("cycle_profile") + cycleFile, err := os.Create("cycle_profile") if err != nil { return err } - defer cycle.Close() + defer cycleFile.Close() - instr, err := os.Create("instr_profile") + var cycle pprof.PMUEventConfig + cycle.Period = 20000000 + // cycle.PreciseIP = 2 + + instrFile, err := os.Create("instr_profile") if err != nil { return err } - defer instr.Close() + defer instrFile.Close() - cacheRef, err := os.Create("cacheRef_profile") + var instr pprof.PMUEventConfig + instr.Period = 20000000 + // instr.PreciseIP = 2 + + cacheRefFile, err := os.Create("cacheRef_profile") if err != nil { return err } - defer cacheRef.Close() + defer cacheRefFile.Close() + + var cacheRef pprof.PMUEventConfig + cacheRef.Period = 200 + // cacheRef.PreciseIP = 2 - cacheMiss, err := os.Create("cacheMiss_profile") + cacheMissFile, err := os.Create("cacheMiss_profile") if err != nil { return err } - defer cacheMiss.Close() - - if err := pprof.StartCPUProfile(itimer); err != nil { + defer cacheMissFile.Close() + + var cacheMiss pprof.PMUEventConfig + cacheMiss.Period = 10 + // cacheMiss.PreciseIP = 2 + + if err := pprof.StartCPUProfile(itimerFile); err != nil { return err } defer pprof.StopCPUProfile() - if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycle, 20000000), pprof.WithProfilingInstr(instr, 20000000), pprof.WithProfilingCacheRef(cacheRef, 1000), pprof.WithProfilingCacheMiss(cacheMiss, 1)); err != nil { + if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle), pprof.WithProfilingInstr(instrFile, &instr), pprof.WithProfilingCacheRef(cacheRefFile, &cacheRef), pprof.WithProfilingCacheMiss(cacheMissFile, &cacheMiss)); err != nil { return err } defer pprof.StopPMUProfile() From 797cb5ad6df8a2dad061a088c1e553484fac6b6d Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 7 Jul 2019 21:15:19 -0700 Subject: [PATCH 036/126] minor --- src/runtime/pprof/pprof.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 92c6a9fa46..b1cbfbd0cf 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -806,6 +806,8 @@ type PMUEventConfig struct { PreciseIP int8 IsKernelIncluded bool IsHvIncluded bool + // TODO: IsMmapEnabled bool + // TODO: IsLBREnabled bool } func getPreciseIP(preciseIP int8) uint8 { From d46b988df3f0c9075abf76777f93377c08f81b84 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 8 Jul 2019 11:34:01 -0700 Subject: [PATCH 037/126] refactoring --- src/runtime/cpuprof.go | 125 +++++++++++++++++++++++- src/runtime/pprof/pprof.go | 35 ++++--- src/runtime/proc.go | 162 ++++++++++--------------------- src/runtime/runtime2.go | 6 +- src/runtime/signal_sighandler.go | 2 +- src/runtime/signal_unix.go | 15 ++- 6 files changed, 205 insertions(+), 140 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 31a9409838..11e2848a20 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -19,8 +19,9 @@ import ( ) const maxCPUProfStack = 64 +const maxPMUEvent = 10 -type cpuProfile struct { +type profile struct { lock mutex on bool // profiling is on log *profBuf // profile events written here @@ -41,7 +42,11 @@ type cpuProfile struct { lostExtra uint64 // count of frames lost because extra is full } +type pmuProfile profile +type cpuProfile profile + var cpuprof cpuProfile +var pmuprof [maxPMUEvent]pmuProfile // SetCPUProfileRate sets the CPU profiling rate to hz samples per second. // If hz <= 0, SetCPUProfileRate turns off profiling. @@ -51,7 +56,6 @@ var cpuprof cpuProfile // the testing package's -test.cpuprofile flag instead of calling // SetCPUProfileRate directly. func SetCPUProfileRate(hz int) { -// func SetCPUProfileRate(hz int) { // Clamp hz to something reasonable. if hz < 0 { hz = 0 @@ -60,7 +64,7 @@ func SetCPUProfileRate(hz int) { hz = 1000000 } - lock(&cpuprof.lock) // cpuprof[event].lock + lock(&cpuprof.lock) if hz > 0 { if cpuprof.on || cpuprof.log != nil { print("runtime: cannot set cpu profile rate until previous profile has finished.\n") @@ -71,17 +75,40 @@ func SetCPUProfileRate(hz int) { cpuprof.on = true cpuprof.log = newProfBuf(1, 1<<17, 1<<14) hdr := [1]uint64{uint64(hz)} - cpuprof.log.write(nil, nanotime(), hdr[:], nil) + cpuprof.log.write(nil, nanotime(), hdr[:], nil) setcpuprofilerate(int32(hz)) } else if cpuprof.on { setcpuprofilerate(0) cpuprof.on = false - cpuprof.addExtra() // cpuprof[event].addExtra() + cpuprof.addExtra() cpuprof.log.close() } unlock(&cpuprof.lock) } +func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { + lock(&pmuprof[eventId].lock) + if eventAttr != nil { + if pmuprof[eventId].on || pmuprof[eventId].log != nil { + print("runtime: cannot set pmu profile rate until previous profile has finished.\n") + unlock(&pmuprof[eventId].lock) + return + } + + pmuprof[eventId].on = true + pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) + hdr := [1]uint64{eventAttr.Period} + pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) + setpmuprofile(int32(eventId), eventAttr) + } else if pmuprof[eventId].on { + setpmuprofile(int32(eventId), nil) + pmuprof[eventId].on = false + pmuprof[eventId].addExtra(eventId) + pmuprof[eventId].log.close() + } + unlock(&pmuprof[eventId].lock) +} + // add adds the stack trace to the profile. // It is called from signal handlers and other limited environments // and cannot allocate memory or acquire locks that might be @@ -109,6 +136,28 @@ func (p *cpuProfile) add(gp *g, stk []uintptr) { atomic.Store(&prof.signalLock, 0) } +//go:nowritebarrierrec +func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { + // Simple cas-lock to coordinate with setpmuprofile. + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { + osyield() + } + + if pmuEvent[eventId].eventAttr != nil { // implies pmuprof[eventId].log != nil + if p.numExtra > 0 || p.lostExtra > 0 { + p.addExtra(eventId) + } + hdr := [1]uint64{1} + // Note: write "knows" that the argument is &gp.labels, + // because otherwise its write barrier behavior may not + // be correct. See the long comment there before + // changing the argument here. + pmuprof[eventId].log.write(&gp.labels, nanotime(), hdr[:], stk) + } + + atomic.Store(&pmuEvent[eventId].signalLock, 0) +} + // addNonGo adds the non-Go stack trace to the profile. // It is called from a non-Go thread, so we cannot use much stack at all, // nor do anything that needs a g or an m. @@ -139,6 +188,28 @@ func (p *cpuProfile) addNonGo(stk []uintptr) { atomic.Store(&prof.signalLock, 0) } +//go:nosplit +//go:nowritebarrierrec +func (p *pmuProfile) addNonGo(stk []uintptr, eventId int) { + // (Other calls to add or addNonGo should be blocked out + // by the fact that only one SIGPROF can be handled by the + // process at a time. If not, this lock will serialize those too.) + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { + osyield() + } + + if pmuprof[eventId].numExtra+1+len(stk) < len(pmuprof[eventId].extra) { + i := pmuprof[eventId].numExtra + pmuprof[eventId].extra[i] = uintptr(1 + len(stk)) + copy(pmuprof[eventId].extra[i+1:], stk) + pmuprof[eventId].numExtra += 1 + len(stk) + } else { + pmuprof[eventId].lostExtra++ + } + + atomic.Store(&pmuEvent[eventId].signalLock, 0) +} + // addExtra adds the "extra" profiling events, // queued by addNonGo, to the profile log. // addExtra is called either from a signal handler on a Go thread @@ -165,6 +236,27 @@ func (p *cpuProfile) addExtra() { } } +func (p *pmuProfile) addExtra(eventId int) { + // Copy accumulated non-Go profile events. + hdr := [1]uint64{1} + for i := 0; i < p.numExtra; { + p.log.write(nil, 0, hdr[:], p.extra[i+1:i+int(p.extra[i])]) + i += int(p.extra[i]) + } + p.numExtra = 0 + + // Report any lost events. + if p.lostExtra > 0 { + hdr := [1]uint64{p.lostExtra} + lostStk := [2]uintptr{ + funcPC(_LostExternalCode) + sys.PCQuantum, + funcPC(_ExternalCode) + sys.PCQuantum, + } + pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) + p.lostExtra = 0 + } +} + func (p *cpuProfile) addLostAtomic64(count uint64) { hdr := [1]uint64{count} lostStk := [2]uintptr{ @@ -174,6 +266,15 @@ func (p *cpuProfile) addLostAtomic64(count uint64) { cpuprof.log.write(nil, 0, hdr[:], lostStk[:]) } +func (p *pmuProfile) addLostAtomic64(count uint64, eventId int) { + hdr := [1]uint64{count} + lostStk := [2]uintptr{ + funcPC(_LostSIGPMUDuringAtomic64) + sys.PCQuantum, + funcPC(_System) + sys.PCQuantum, + } + pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) +} + // CPUProfile panics. // It formerly provided raw access to chunks of // a pprof-format profile generated by the runtime. @@ -211,3 +312,17 @@ func runtime_pprof_readProfile() ([]uint64, []unsafe.Pointer, bool) { } return data, tags, eof } + +//go:linkname runtime_pprof_readPMUProfile runtime/pprof.readPMUProfile +func runtime_pprof_readPMUProfile(eventId int) ([]uint64, []unsafe.Pointer, bool) { + lock(&pmuprof[eventId].lock) + log := pmuprof[eventId].log + unlock(&pmuprof[eventId].lock) + data, tags, eof := log.read(profBufBlocking) + if len(data) == 0 && eof { + lock(&pmuprof[eventId].lock) + pmuprof[eventId].log = nil + unlock(&pmuprof[eventId].lock) + } + return data, tags, eof +} diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index b1cbfbd0cf..0a4dab3e8a 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -726,7 +726,6 @@ var cpu struct { sync.Mutex profiling bool done chan bool - profileHz int } // StartCPUProfile enables CPU profiling for the current process. @@ -771,10 +770,12 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { return nil } +const maxPMUEvent = 10 var pmu struct { sync.Mutex profiling bool - done chan bool + eventOn [maxPMUEvent]bool + wg sync.WaitGroup } func StartPMUProfile(opts ...ProfilingOption) error { @@ -784,10 +785,8 @@ func StartPMUProfile(opts ...ProfilingOption) error { pmu.Lock() defer pmu.Unlock() - if pmu.done == nil { - pmu.done = make(chan bool, len(opts)) - } - // Double-check. + pmu.wg.Add(len(opts)) + // Double-check. if pmu.profiling { return fmt.Errorf("pmu profiling already in use") } @@ -829,12 +828,12 @@ func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio if eventConfig.Period < 300 { eventConfig.Period = 300 } - + pmu.eventOn[0] = true + cycle := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 0, &cycle) go pmuProfileWriter(w, /*event ID*/ 0, "cycles") return nil @@ -851,12 +850,12 @@ func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio if eventConfig.Period < 300 { eventConfig.Period = 300 } + pmu.eventOn[1] = true instr := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 1, &instr) go pmuProfileWriter(w, /*event ID*/ 1, "instructions") return nil @@ -868,12 +867,12 @@ func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOp if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } + pmu.eventOn[2] = true cacheRef := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 2, &cacheRef) go pmuProfileWriter(w, /*event ID*/ 2, "cache references") return nil @@ -885,12 +884,12 @@ func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingO if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } + pmu.eventOn[3] = true cacheMiss := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 3, &cacheMiss) go pmuProfileWriter(w, /*event ID*/ 3, "cache misses") return nil @@ -940,7 +939,7 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { b := newProfileBuilder(w) var err error for { - time.Sleep(10 * time.Millisecond) + time.Sleep(100 * time.Millisecond) data, tags, eof := readPMUProfile(eventId) if e := b.addPMUData(data, tags); e != nil && err == nil { err = e @@ -953,7 +952,7 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { panic("runtime/pprof: converting profile: " + err.Error()) } b.pmuBuild(eventName) - pmu.done <- true + pmu.wg.Done() } // StopCPUProfile stops the current CPU profile, if any. @@ -980,12 +979,12 @@ func StopPMUProfile() { } pmu.profiling = false - for i := 0; i < cap(pmu.done); i++ { - runtime.SetPMUProfile(i, nil) + for i := 0; i < maxPMUEvent; i++ { + if pmu.eventOn[i] { + runtime.SetPMUProfile(i, nil) + } } - for i := 0; i < cap(pmu.done); i++ { - <-pmu.done - } + pmu.wg.Wait() } // countBlock returns the number of records in the blocking profile. diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 3881ea8798..38af8647da 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2151,15 +2151,10 @@ func execute(gp *g, inheritTime bool) { hz := sched.profilehz eventAttrs := sched.eventAttrs - // if _g_.m.profilehz != hz && _g_.m.profilePeriod != period { - // println("should never reach here!") - // } - if _g_.m.profilehz != hz { setThreadCPUProfiler(hz) } - - for eventId := 0; eventId < maxPMUEvents; eventId++ { + for eventId := 0; eventId < maxPMUEvent; eventId++ { if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { setThreadPMUProfiler(int32(eventId), eventAttrs[eventId]) } @@ -3632,9 +3627,9 @@ var prof struct { hz int32 } -var pmuEvent [maxPMUEvents]struct { // TODO: come up with a bettter name +var pmuEvent [maxPMUEvent]struct { signalLock uint32 - eventAttr *PMUEventAttr + eventAttr *PMUEventAttr } func _System() { _System() } @@ -3642,41 +3637,10 @@ func _ExternalCode() { _ExternalCode() } func _LostExternalCode() { _LostExternalCode() } func _GC() { _GC() } func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() } +func _LostSIGPMUDuringAtomic64() { _LostSIGPMUDuringAtomic64() } func _VDSO() { _VDSO() } -// Counts SIGPROFs received while in atomic64 critical section, on mips{,le} -var lostAtomic64Count uint64 - -// Called if we receive a SIGPROF signal. -// Called by the signal handler, may run during STW. -//go:nowritebarrierrec -func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { - if prof.hz == 0 { - return - } - // On mips{,le}, 64bit atomics are emulated with spinlocks, in - // runtime/internal/atomic. If SIGPROF arrives while the program is inside - // the critical section, it creates a deadlock (when writing the sample). - // As a workaround, create a counter of SIGPROFs while in critical section - // to store the count, and pass it to sigprof.add() later when SIGPROF is - // received from somewhere else (with _LostSIGPROFDuringAtomic64 as pc). - if GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm" { - if f := findfunc(pc); f.valid() { - if hasPrefix(funcname(f), "runtime/internal/atomic") { - lostAtomic64Count++ // lostAtomic64Count[event]++ - return - } - } - } - - // Profiling runs concurrently with GC, so it must not allocate. - // Set a trap in case the code does allocate. - // Note that on windows, one thread takes profiles of all the - // other threads, so mp is usually not getg().m. - // In fact mp may not even be stopped. - // See golang.org/issue/17165. - getg().m.mallocing++ - +func stackUnwinding(pc, sp, lr uintptr, gp *g, mp *m, stk []uintptr) int { // Define that a "user g" is a user-created goroutine, and a "system g" // is one that is m->g0 or m->gsignal. // @@ -3746,8 +3710,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { if gp == nil || sp < gp.stack.lo || gp.stack.hi < sp || setsSP(pc) || (mp != nil && mp.vdsoSP != 0) { traceback = false } - var stk [maxCPUProfStack]uintptr - n := 0 + n := 0 if mp.ncgo > 0 && mp.curg != nil && mp.curg.syscallpc != 0 && mp.curg.syscallsp != 0 { cgoOff := 0 // Check cgoCallersUse to make sure that we are not @@ -3802,21 +3765,17 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { } } - if prof.hz != 0 { - if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostAtomic64Count > 0 { - cpuprof.addLostAtomic64(lostAtomic64Count) - lostAtomic64Count = 0 // lostAtomic64Count[event] = 0 - } - cpuprof.add(gp, stk[:n]) // cpuprof[event].add(gp, stk[:n]) - } - getg().m.mallocing-- + return n } -var lostPMUAtomic64Count[10] uint64 +// Counts SIGPROFs received while in atomic64 critical section, on mips{,le} +var lostAtomic64Count uint64 +// Called if we receive a SIGPROF signal. +// Called by the signal handler, may run during STW. //go:nowritebarrierrec -func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGRTMIN + 3 - if pmuEvent[eventId].eventAttr == nil { +func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { + if prof.hz == 0 { return } // On mips{,le}, 64bit atomics are emulated with spinlocks, in @@ -3828,7 +3787,7 @@ func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGRTMIN + 3 if GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm" { if f := findfunc(pc); f.valid() { if hasPrefix(funcname(f), "runtime/internal/atomic") { - lostPMUAtomic64Count[eventId]++ + lostAtomic64Count++ // lostAtomic64Count[event]++ return } } @@ -3841,67 +3800,52 @@ func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGRTMIN + 3 // In fact mp may not even be stopped. // See golang.org/issue/17165. getg().m.mallocing++ - - traceback := true - if gp == nil || sp < gp.stack.lo || gp.stack.hi < sp || setsSP(pc) || (mp != nil && mp.vdsoSP != 0) { - traceback = false - } - var stk [maxPMUProfStack]uintptr - n := 0 - if mp.ncgo > 0 && mp.curg != nil && mp.curg.syscallpc != 0 && mp.curg.syscallsp != 0 { - cgoOff := 0 - // Check cgoCallersUse to make sure that we are not - // interrupting other code that is fiddling with - // cgoCallers. We are running in a signal handler - // with all signals blocked, so we don't have to worry - // about any other code interrupting us. - if atomic.Load(&mp.cgoCallersUse) == 0 && mp.cgoCallers != nil && mp.cgoCallers[0] != 0 { - for cgoOff < len(mp.cgoCallers) && mp.cgoCallers[cgoOff] != 0 { - cgoOff++ - } - copy(stk[:], mp.cgoCallers[:cgoOff]) - mp.cgoCallers[0] = 0 - } - - // Collect Go stack that leads to the cgo call. - n = gentraceback(mp.curg.syscallpc, mp.curg.syscallsp, 0, mp.curg, 0, &stk[cgoOff], len(stk)-cgoOff, nil, nil, 0) - if n > 0 { - n += cgoOff + stk := make([]uintptr, maxCPUProfStack) + n := stackUnwinding(pc, sp, lr, gp, mp, stk) + if prof.hz != 0 { + if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostAtomic64Count > 0 { + cpuprof.addLostAtomic64(lostAtomic64Count) + lostAtomic64Count = 0 } - } else if traceback { - n = gentraceback(pc, sp, lr, gp, 0, &stk[0], len(stk), nil, nil, _TraceTrap|_TraceJumpStack) + cpuprof.add(gp, stk[:n]) } + getg().m.mallocing-- +} - if n <= 0 { - // Normal traceback is impossible or has failed. - // See if it falls into several common cases. - n = 0 - if (GOOS == "windows" || GOOS == "solaris" || GOOS == "illumos" || GOOS == "darwin" || GOOS == "aix") && mp.libcallg != 0 && mp.libcallpc != 0 && mp.libcallsp != 0 { - // Libcall, i.e. runtime syscall on windows. - // Collect Go stack that leads to the call. - n = gentraceback(mp.libcallpc, mp.libcallsp, 0, mp.libcallg.ptr(), 0, &stk[0], len(stk), nil, nil, 0) - } - if n == 0 && mp != nil && mp.vdsoSP != 0 { - n = gentraceback(mp.vdsoPC, mp.vdsoSP, 0, gp, 0, &stk[0], len(stk), nil, nil, _TraceTrap|_TraceJumpStack) - } - if n == 0 { - // If all of the above has failed, account it against abstract "System" or "GC". - n = 2 - if inVDSOPage(pc) { - pc = funcPC(_VDSO) + sys.PCQuantum - } else if pc > firstmoduledata.etext { - // "ExternalCode" is better than "etext". - pc = funcPC(_ExternalCode) + sys.PCQuantum - } - stk[0] = pc - if mp.preemptoff != "" { - stk[1] = funcPC(_GC) + sys.PCQuantum - } else { - stk[1] = funcPC(_System) + sys.PCQuantum +// Counts SIGPMUs received while in atomic64 critical section, on mips{,le} +var lostPMUAtomic64Count[maxPMUEvent] uint64 + +// Called if we receive a SIGPMU signal. +// Called by the signal handler, may run during STW. +//go:nowritebarrierrec +func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGPMU = SIGRTMIN + 3 + if pmuEvent[eventId].eventAttr == nil { + return + } + // On mips{,le}, 64bit atomics are emulated with spinlocks, in + // runtime/internal/atomic. If SIGPMU arrives while the program is inside + // the critical section, it creates a deadlock (when writing the sample). + // As a workaround, create a counter of SIGPMUs while in critical section + // to store the count, and pass it to sigprof.add() later when SIGPMU is + // received from somewhere else (with _LostSIGPMUDuringAtomic64 as pc). + if GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm" { + if f := findfunc(pc); f.valid() { + if hasPrefix(funcname(f), "runtime/internal/atomic") { + lostPMUAtomic64Count[eventId]++ + return } } } + // Profiling runs concurrently with GC, so it must not allocate. + // Set a trap in case the code does allocate. + // Note that on windows, one thread takes profiles of all the + // other threads, so mp is usually not getg().m. + // In fact mp may not even be stopped. + // See golang.org/issue/17165. + getg().m.mallocing++ + stk := make([]uintptr, maxCPUProfStack) + n := stackUnwinding(pc, sp, lr, gp, mp, stk) if pmuEvent[eventId].eventAttr != nil { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostPMUAtomic64Count[eventId] > 0 { pmuprof[eventId].addLostAtomic64(lostPMUAtomic64Count[eventId], eventId) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index bf16320542..c72b91eeae 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,8 +473,8 @@ type m struct { locks int32 dying int32 profilehz int32 - eventFds [maxPMUProfStack]int32 - eventAttrs [maxPMUProfStack]*PMUEventAttr + eventFds [maxPMUEvent]int32 + eventAttrs [maxPMUEvent]*PMUEventAttr spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack @@ -676,7 +676,7 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - eventAttrs [maxPMUProfStack]*PMUEventAttr + eventAttrs [maxPMUEvent]*PMUEventAttr procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index a85885064b..0bb8eef5a9 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -39,7 +39,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) var eventId int = -1 - for i := 0; i < maxPMUEvents; i++ { + for i := 0; i < maxPMUEvent; i++ { if _g_.m.eventFds[i] == fd { eventId = i break diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 3d78dabb2d..c8ae3724f8 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -141,6 +141,13 @@ func sigInstallGoHandler(sig uint32) bool { return true } +func isProfilingSignal(sig uint32) bool { + if sig == _SIGPROF || sig == _SIGPMU { + return true + } + return false +} + // sigenable enables the Go signal handler to catch the signal sig. // It is only called while holding the os/signal.handlers lock, // via os/signal.enableSignal and signal_enable. @@ -150,7 +157,7 @@ func sigenable(sig uint32) { } // SIGPROF and _SIGPMU are handled specially for profiling. - if sig == _SIGPROF || sig == _SIGPMU { + if isProfilingSignal(sig) { return } @@ -175,7 +182,7 @@ func sigdisable(sig uint32) { } // SIGPROF and _SIGPMU are handled specially for profiling. - if sig == _SIGPROF || sig == _SIGPMU { + if isProfilingSignal(sig) { return } @@ -204,7 +211,7 @@ func sigignore(sig uint32) { } // SIGPROF and _SIGPMU are handled specially for profiling. - if sig == _SIGPROF || sig == _SIGPMU { + if isProfilingSignal(sig) { return } @@ -504,7 +511,7 @@ func dieFromSignal(sig uint32) { // thread, and the Go program does not want to handle it (that is, the // program has not called os/signal.Notify for the signal). func raisebadsignal(sig uint32, c *sigctxt) { - if sig == _SIGPROF || sig == _SIGPMU { + if isProfilingSignal(sig) { // Ignore profiling signals that arrive on non-Go threads. return } From 1625927142f2ec0ebe49448fc9dba896a40b0fdc Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 8 Jul 2019 11:38:02 -0700 Subject: [PATCH 038/126] remove --- src/runtime/pmuprof.go | 174 ----------------------------------------- 1 file changed, 174 deletions(-) delete mode 100644 src/runtime/pmuprof.go diff --git a/src/runtime/pmuprof.go b/src/runtime/pmuprof.go deleted file mode 100644 index f0e0b9d3bb..0000000000 --- a/src/runtime/pmuprof.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// CPU profiling. -// -// The signal handler for the profiling clock tick adds a new stack trace -// to a log of recent traces. The log is read by a user goroutine that -// turns it into formatted profile data. If the reader does not keep up -// with the log, those writes will be recorded as a count of lost records. -// The actual profile buffer is in profbuf.go. - -package runtime - -import ( - "runtime/internal/atomic" - "runtime/internal/sys" - "unsafe" -) - -const maxPMUProfStack = 64 -const maxPMUEvents = 10 - -type pmuProfile struct { - lock mutex - on bool // profiling is on - log *profBuf // profile events written here - - // extra holds extra stacks accumulated in addNonGo - // corresponding to profiling signals arriving on - // non-Go-created threads. Those stacks are written - // to log the next time a normal Go thread gets the - // signal handler. - // Assuming the stacks are 2 words each (we don't get - // a full traceback from those threads), plus one word - // size for framing, 100 Hz profiling would generate - // 300 words per second. - // Hopefully a normal Go thread will get the profiling - // signal at least once every few seconds. - extra [1000]uintptr - numExtra int - lostExtra uint64 // count of frames lost because extra is full -} - -var pmuprof [maxPMUEvents]pmuProfile // event -> cpuProfile - -func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { - - lock(&pmuprof[eventId].lock) - if eventAttr != nil { - if pmuprof[eventId].on || pmuprof[eventId].log != nil { - print("runtime: cannot set pmu profile rate until previous profile has finished.\n") - unlock(&pmuprof[eventId].lock) - return - } - - pmuprof[eventId].on = true - pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) - hdr := [1]uint64{eventAttr.Period} - pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) - setpmuprofile(int32(eventId), eventAttr) - } else if pmuprof[eventId].on { - setpmuprofile(int32(eventId), nil) - pmuprof[eventId].on = false - pmuprof[eventId].addExtra(eventId) - pmuprof[eventId].log.close() - } - unlock(&pmuprof[eventId].lock) -} - -// add adds the stack trace to the profile. -// It is called from signal handlers and other limited environments -// and cannot allocate memory or acquire locks that might be -// held at the time of the signal, nor can it use substantial amounts -// of stack. -//go:nowritebarrierrec -func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { - // Simple cas-lock to coordinate with setpmuprofile. - for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { - osyield() - } - - if pmuEvent[eventId].eventAttr != nil { // implies pmuprof[eventId].log != nil - if p.numExtra > 0 || p.lostExtra > 0 { - p.addExtra(eventId) - } - hdr := [1]uint64{1} - // Note: write "knows" that the argument is &gp.labels, - // because otherwise its write barrier behavior may not - // be correct. See the long comment there before - // changing the argument here. - pmuprof[eventId].log.write(&gp.labels, nanotime(), hdr[:], stk) - } - - atomic.Store(&pmuEvent[eventId].signalLock, 0) -} - -// addNonGo adds the non-Go stack trace to the profile. -// It is called from a non-Go thread, so we cannot use much stack at all, -// nor do anything that needs a g or an m. -// In particular, we can't call cpuprof.log.write. -// Instead, we copy the stack into cpuprof.extra, -// which will be drained the next time a Go thread -// gets the signal handling event. -//go:nosplit -//go:nowritebarrierrec -func (p *pmuProfile) addNonGo(stk []uintptr, eventId int) { - // (Other calls to add or addNonGo should be blocked out - // by the fact that only one SIGPROF can be handled by the - // process at a time. If not, this lock will serialize those too.) - for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { - osyield() - } - - if pmuprof[eventId].numExtra+1+len(stk) < len(pmuprof[eventId].extra) { - i := pmuprof[eventId].numExtra - pmuprof[eventId].extra[i] = uintptr(1 + len(stk)) - copy(pmuprof[eventId].extra[i+1:], stk) - pmuprof[eventId].numExtra += 1 + len(stk) - } else { - pmuprof[eventId].lostExtra++ - } - - atomic.Store(&pmuEvent[eventId].signalLock, 0) -} - -// addExtra adds the "extra" profiling events, -// queued by addNonGo, to the profile log. -// addExtra is called either from a signal handler on a Go thread -// or from an ordinary goroutine; either way it can use stack -// and has a g. The world may be stopped, though. -func (p *pmuProfile) addExtra(eventId int) { - // Copy accumulated non-Go profile events. - hdr := [1]uint64{1} - for i := 0; i < p.numExtra; { - p.log.write(nil, 0, hdr[:], p.extra[i+1:i+int(p.extra[i])]) - i += int(p.extra[i]) - } - p.numExtra = 0 - - // Report any lost events. - if p.lostExtra > 0 { - hdr := [1]uint64{p.lostExtra} - lostStk := [2]uintptr{ - funcPC(_LostExternalCode) + sys.PCQuantum, - funcPC(_ExternalCode) + sys.PCQuantum, - } - pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) - p.lostExtra = 0 - } -} - -func (p *pmuProfile) addLostAtomic64(count uint64, eventId int) { - hdr := [1]uint64{count} - lostStk := [2]uintptr{ - funcPC(_LostSIGPROFDuringAtomic64) + sys.PCQuantum, - funcPC(_System) + sys.PCQuantum, - } - pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) -} - -//go:linkname runtime_pprof_readPMUProfile runtime/pprof.readPMUProfile -func runtime_pprof_readPMUProfile(eventId int) ([]uint64, []unsafe.Pointer, bool) { - lock(&pmuprof[eventId].lock) - log := pmuprof[eventId].log - unlock(&pmuprof[eventId].lock) - data, tags, eof := log.read(profBufBlocking) - if len(data) == 0 && eof { - lock(&pmuprof[eventId].lock) - pmuprof[eventId].log = nil - unlock(&pmuprof[eventId].lock) - } - return data, tags, eof -} From 953985d6dfe83ac2719c5e0d1efa611637fb17f8 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 8 Jul 2019 13:17:27 -0700 Subject: [PATCH 039/126] refactoring --- src/runtime/pprof/proto.go | 169 ++++++++++++------------------------- 1 file changed, 55 insertions(+), 114 deletions(-) diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index 916c967e7e..14c6ddea6d 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -29,22 +29,22 @@ func funcPC(f interface{}) uintptr { // A profileBuilder writes a profile incrementally from a // stream of profile samples delivered by the runtime. type profileBuilder struct { - start time.Time - end time.Time - havePeriod bool - period int64 + start time.Time + end time.Time + havePeriod bool + period int64 isPMUEnabled bool - m profMap + m profMap // encoding state - w io.Writer - zw *gzip.Writer - pb protobuf - strings []string - stringMap map[string]int - locs map[uintptr]int - funcs map[string]int // Package path-qualified function name to Function.ID - mem []memMap + w io.Writer + zw *gzip.Writer + pb protobuf + strings []string + stringMap map[string]int + locs map[uintptr]int + funcs map[string]int // Package path-qualified function name to Function.ID + mem []memMap } type memMap struct { @@ -313,26 +313,8 @@ func newProfileBuilder(w io.Writer) *profileBuilder { return b } -// addCPUData adds the CPU profiling data to the profile. -// The data must be a whole number of records, -// as delivered by the runtime. -func (b *profileBuilder) addCPUData(data []uint64, tags []unsafe.Pointer) error { - if !b.havePeriod { - // first record is period - if len(data) < 3 { - return fmt.Errorf("truncated profile") - } - if data[0] != 3 || data[2] == 0 { - return fmt.Errorf("malformed profile") - } - // data[2] is sampling rate in Hz. Convert to sampling - // period in nanoseconds. - b.period = 1e9 / int64(data[2]) - b.havePeriod = true - data = data[3:] - } - - // Parse CPU samples from the profile. +func (b *profileBuilder) addData(data []uint64, tags []unsafe.Pointer) error { + // Parse samples from the profile. // Each sample is 3+n uint64s: // data[0] = 3+n // data[1] = time stamp (ignored) @@ -375,8 +357,11 @@ func (b *profileBuilder) addCPUData(data []uint64, tags []unsafe.Pointer) error return nil } -func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error { - if !b.isPMUEnabled { +// addCPUData adds the CPU profiling data to the profile. +// The data must be a whole number of records, +// as delivered by the runtime. +func (b *profileBuilder) addCPUData(data []uint64, tags []unsafe.Pointer) error { + if !b.havePeriod { // first record is period if len(data) < 3 { return fmt.Errorf("truncated profile") @@ -384,52 +369,34 @@ func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error if data[0] != 3 || data[2] == 0 { return fmt.Errorf("malformed profile") } - b.isPMUEnabled = true - b.period = int64(data[2]) + // data[2] is sampling rate in Hz. Convert to sampling + // period in nanoseconds. + b.period = 1e9 / int64(data[2]) + b.havePeriod = true data = data[3:] } - for len(data) > 0 { - if len(data) < 3 || data[0] > uint64(len(data)) { + return b.addData(data, tags) +} + +func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error { + if !b.isPMUEnabled { + // first record is period + if len(data) < 3 { return fmt.Errorf("truncated profile") } - if data[0] < 3 || tags != nil && len(tags) < 1 { + if data[0] != 3 || data[2] == 0 { return fmt.Errorf("malformed profile") } - count := data[2] - stk := data[3:data[0]] - data = data[data[0]:] - var tag unsafe.Pointer - if tags != nil { - tag = tags[0] - tags = tags[1:] - } - - if count == 0 && len(stk) == 1 { - // overflow record - count = uint64(stk[0]) - stk = []uint64{ - uint64(funcPC(lostProfileEvent)), - } - } - b.m.lookup(stk, tag).count += int64(count) + b.isPMUEnabled = true + b.period = int64(data[2]) + data = data[3:] } - return nil -} - -// build completes and returns the constructed profile. -func (b *profileBuilder) build() { - b.end = time.Now() - b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) - if b.havePeriod { // must be CPU profile - b.pbValueType(tagProfile_SampleType, "samples", "count") - b.pbValueType(tagProfile_SampleType, "cpu", "nanoseconds") - b.pb.int64Opt(tagProfile_DurationNanos, b.end.Sub(b.start).Nanoseconds()) - b.pbValueType(tagProfile_PeriodType, "cpu", "nanoseconds") - b.pb.int64Opt(tagProfile_Period, b.period) - } + return b.addData(data, tags) +} +func (b *profileBuilder) profileBuild() { values := []int64{0, 0} var locs []uint64 for e := b.m.all; e != nil; e = e.nextAll { @@ -478,6 +445,22 @@ func (b *profileBuilder) build() { b.zw.Close() } +// build completes and returns the constructed profile. +func (b *profileBuilder) build() { + b.end = time.Now() + + b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) + if b.havePeriod { // must be CPU profile + b.pbValueType(tagProfile_SampleType, "samples", "count") + b.pbValueType(tagProfile_SampleType, "cpu", "nanoseconds") + b.pb.int64Opt(tagProfile_DurationNanos, b.end.Sub(b.start).Nanoseconds()) + b.pbValueType(tagProfile_PeriodType, "cpu", "nanoseconds") + b.pb.int64Opt(tagProfile_Period, b.period) + } + + b.profileBuild() +} + func (b *profileBuilder) pmuBuild(eventName string) { b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) b.pbValueType(tagProfile_SampleType, "samples", "count") @@ -485,49 +468,7 @@ func (b *profileBuilder) pmuBuild(eventName string) { b.pbValueType(tagProfile_PeriodType, eventName, "count") b.pb.int64Opt(tagProfile_Period, b.period) - values := []int64{0, 0} - var locs []uint64 - for e := b.m.all; e != nil; e = e.nextAll { - values[0] = e.count - values[1] = e.count * b.period - - var labels func() - if e.tag != nil { - labels = func() { - for k, v := range *(*labelMap)(e.tag) { - b.pbLabel(tagSample_Label, k, v, 0) - } - } - } - - locs = locs[:0] - for i, addr := range e.stk { - // Addresses from stack traces point to the - // next instruction after each call, except - // for the leaf, which points to where the - // signal occurred. locForPC expects return - // PCs, so increment the leaf address to look - // like a return PC. - if i == 0 { - addr++ - } - l := b.locForPC(addr) - if l == 0 { // runtime.goexit - continue - } - locs = append(locs, l) - } - b.pbSample(values, locs, labels) - } - - for i, m := range b.mem { - hasFunctions := m.funcs == lookupTried // lookupTried but not lookupFailed - b.pbMapping(tagProfile_Mapping, uint64(i+1), uint64(m.start), uint64(m.end), m.offset, m.file, m.buildID, hasFunctions) - } - - b.pb.strings(tagProfile_StringTable, b.strings) - b.zw.Write(b.pb.data) - b.zw.Close() + b.profileBuild() } // readMapping reads /proc/self/maps and writes mappings to b.pb. From 5dd098118469ee5ce86f8800ac45acf3d5c0e657 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 8 Jul 2019 13:18:19 -0700 Subject: [PATCH 040/126] remove --- src/runtime/defs_user_data.go | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 src/runtime/defs_user_data.go diff --git a/src/runtime/defs_user_data.go b/src/runtime/defs_user_data.go deleted file mode 100644 index 988fe53de5..0000000000 --- a/src/runtime/defs_user_data.go +++ /dev/null @@ -1,11 +0,0 @@ -// created by cgo -cdefs and then converted to Go -// cgo -cdefs defs_linux.go defs1_linux.go - -package runtime - -type PMUEvent struct { - Cat uint32 // don't use type, which is a keyword reserved in golang - Code uint64 - Period uint64 - PreciseIP uint8 -} From a1c64d0328deaa3f689ef0eb72eff4ddef70eb2f Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 8 Jul 2019 13:59:39 -0700 Subject: [PATCH 041/126] refactoring --- src/runtime/defs_linux_amd64.go | 9 +++------ src/runtime/defs_pmu.go | 10 +++++----- src/runtime/pprof/pprof.go | 20 ++++++++++---------- src/runtime/proc.go | 4 ++-- src/runtime/signal_sighandler.go | 4 ++-- src/runtime/signal_unix.go | 8 ++++---- src/runtime/sys_linux_amd64.s | 6 +++--- 7 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index b7924ee29c..ccf28f63fa 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -57,7 +57,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0x25 + _SIGPMU = 0x25 _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 @@ -128,11 +128,8 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 - - // psu: an unreliable workaround and need to figure out a better solution - // si_fd int64 - si_fd int32 - + // an unreliable workaround and need to figure out a better solution + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 6030a5061c..d2b890077b 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -5,7 +5,7 @@ package runtime const ( GO_COUNT_HW_CPU_CYCLES = 0x0 - GO_COUNT_HW_INSTRUCTIONS = 0x1 + GO_COUNT_HW_INSTRUCTIONS = 0x1 GO_COUNT_HW_CACHE_REFERENCES = 0x2 GO_COUNT_HW_CACHE_MISSES = 0x3 GO_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 @@ -14,8 +14,8 @@ const ( GO_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 GO_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 GO_COUNT_HW_REF_CPU_CYCLES = 0x9 - - GO_COUNT_HW_CACHE_L1D = 0xa + + GO_COUNT_HW_CACHE_L1D = 0xa GO_COUNT_HW_CACHE_L1I = 0xb GO_COUNT_HW_CACHE_LL = 0xc GO_COUNT_HW_CACHE_DTLB = 0xd @@ -26,8 +26,8 @@ const ( GO_COUNT_HW_CACHE_OP_READ = 0x11 GO_COUNT_HW_CACHE_OP_WRITE = 0x12 GO_COUNT_HW_CACHE_OP_PREFETCH = 0x13 - - GO_COUNT_HW_CACHE_RESULT_ACCESS = 0x14 + + GO_COUNT_HW_CACHE_RESULT_ACCESS = 0x14 GO_COUNT_HW_CACHE_RESULT_MISS = 0x15 GO_COUNT_SW_CPU_CLOCK = 0x16 diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 0a4dab3e8a..256dfb7a53 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -73,10 +73,10 @@ package pprof import ( - "bufio" + "bufio" "bytes" "errors" - "fmt" + "fmt" "io" "runtime" "sort" @@ -774,15 +774,15 @@ const maxPMUEvent = 10 var pmu struct { sync.Mutex profiling bool - eventOn [maxPMUEvent]bool - wg sync.WaitGroup + eventOn [maxPMUEvent]bool + wg sync.WaitGroup } func StartPMUProfile(opts ...ProfilingOption) error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { return errors.New("not implemented") } - + pmu.Lock() defer pmu.Unlock() pmu.wg.Add(len(opts)) @@ -791,7 +791,7 @@ func StartPMUProfile(opts ...ProfilingOption) error { return fmt.Errorf("pmu profiling already in use") } pmu.profiling = true - + for _, opt := range opts { if err := opt.apply(); err != nil { return err @@ -851,7 +851,7 @@ func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio eventConfig.Period = 300 } pmu.eventOn[1] = true - + instr := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, @@ -868,7 +868,7 @@ func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOp return errors.New("Period should be > 0") } pmu.eventOn[2] = true - + cacheRef := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, @@ -885,7 +885,7 @@ func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingO return errors.New("Period should be > 0") } pmu.eventOn[3] = true - + cacheMiss := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, @@ -978,7 +978,7 @@ func StopPMUProfile() { return } pmu.profiling = false - + for i := 0; i < maxPMUEvent; i++ { if pmu.eventOn[i] { runtime.SetPMUProfile(i, nil) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 38af8647da..1586bed3a7 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2134,7 +2134,7 @@ func gcstopm() { // acquiring a P in several places. // //go:yeswritebarrierrec -func execute(gp *g, inheritTime bool) { +func execute(gp *g, inheritTime bool) { _g_ := getg() casgstatus(gp, _Grunnable, _Grunning) @@ -3637,7 +3637,7 @@ func _ExternalCode() { _ExternalCode() } func _LostExternalCode() { _LostExternalCode() } func _GC() { _GC() } func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() } -func _LostSIGPMUDuringAtomic64() { _LostSIGPMUDuringAtomic64() } +func _LostSIGPMUDuringAtomic64() { _LostSIGPMUDuringAtomic64() } func _VDSO() { _VDSO() } func stackUnwinding(pc, sp, lr uintptr, gp *g, mp *m, stk []uintptr) int { diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 0bb8eef5a9..bb7a33d0b9 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -37,7 +37,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { if sig == _SIGPMU { fd := info.si_fd ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) - + var eventId int = -1 for i := 0; i < maxPMUEvent; i++ { if _g_.m.eventFds[i] == fd { @@ -52,7 +52,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) return } - + if sig == _SIGPROF { sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) return diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index c8ae3724f8..fcd3590eef 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -142,7 +142,7 @@ func sigInstallGoHandler(sig uint32) bool { } func isProfilingSignal(sig uint32) bool { - if sig == _SIGPROF || sig == _SIGPMU { + if sig == _SIGPROF || sig == _SIGPMU { return true } return false @@ -160,7 +160,7 @@ func sigenable(sig uint32) { if isProfilingSignal(sig) { return } - + t := &sigtable[sig] if t.flags&_SigNotify != 0 { ensureSigM() @@ -294,7 +294,7 @@ func setThreadCPUProfiler(hz int32) { func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _g_ := getg() - + if eventAttr == nil { if _g_.m.eventAttrs[eventId] != nil { closefd(_g_.m.eventFds[eventId]) @@ -312,7 +312,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { if !eventAttr.IsHvIncluded { // don't count hypervisor perfAttr.Bits += 0b1000000 } - + fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy*/ 0) _g_.m.eventFds[eventId] = fd r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 64dd7160d1..2a9663683a 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -193,7 +193,7 @@ ok: // func ioctl(fd int32, req, arg int64) int64 TEXT runtime·ioctl(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI + MOVL fd+0(FP), DI MOVQ req+8(FP), SI MOVQ arg+16(FP), DX MOVQ $SYS_ioctl, AX @@ -203,7 +203,7 @@ TEXT runtime·ioctl(SB),NOSPLIT,$0 // func fcntl(fd int32, cmd arg int64) (r int64, err int64) TEXT runtime·fcntl(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI + MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX MOVQ $SYS_fcntl, AX @@ -220,7 +220,7 @@ ok: RET TEXT runtime·fcntl2(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI + MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX MOVQ $SYS_fcntl, AX From 8464003b4be4cc3a709d1ee93579cbfc7cb8a2c2 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 8 Jul 2019 14:36:00 -0700 Subject: [PATCH 042/126] refactoring --- src/runtime/pprof/pprof.go | 51 ++++++++++++++------------------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 256dfb7a53..4906136d60 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -818,24 +818,28 @@ func getPreciseIP(preciseIP int8) uint8 { return uint8(preciseIP) } +func helper(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { + pmu.eventOn[eventId] = true + eventAttr := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), + IsKernelIncluded: eventConfig.IsKernelIncluded, + IsHvIncluded: eventConfig.IsHvIncluded} + runtime.SetPMUProfile(eventId, &eventAttr) + go pmuProfileWriter(w, eventId, eventName) + +} + func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } // Clamp period to something reasonable - // Refer to hpctoolkit if eventConfig.Period < 300 { eventConfig.Period = 300 } - pmu.eventOn[0] = true - cycle := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), - PreciseIP: getPreciseIP(eventConfig.PreciseIP), - IsKernelIncluded: eventConfig.IsKernelIncluded, - IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 0, &cycle) - go pmuProfileWriter(w, /*event ID*/ 0, "cycles") + helper(w, eventConfig, /*event ID*/ 0, /*event Name*/ "cycles") return nil }) } @@ -846,18 +850,11 @@ func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio return errors.New("Period should be > 0") } // Clamp period to something reasonable - // Refer to hpctoolkit if eventConfig.Period < 300 { eventConfig.Period = 300 } - pmu.eventOn[1] = true - instr := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), - PreciseIP: getPreciseIP(eventConfig.PreciseIP), - IsKernelIncluded: eventConfig.IsKernelIncluded, - IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 1, &instr) - go pmuProfileWriter(w, /*event ID*/ 1, "instructions") + helper(w, eventConfig, /*event ID*/ 1, /*event Name*/ "instructions") return nil }) } @@ -867,14 +864,9 @@ func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOp if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } - pmu.eventOn[2] = true - - cacheRef := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), - PreciseIP: getPreciseIP(eventConfig.PreciseIP), - IsKernelIncluded: eventConfig.IsKernelIncluded, - IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 2, &cacheRef) - go pmuProfileWriter(w, /*event ID*/ 2, "cache references") + // TODO: Clamp period to something reasonable + + helper(w, eventConfig, /*event ID*/ 2, /*event Name*/ "cache references") return nil }) } @@ -884,14 +876,9 @@ func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingO if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } - pmu.eventOn[3] = true - - cacheMiss := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), - PreciseIP: getPreciseIP(eventConfig.PreciseIP), - IsKernelIncluded: eventConfig.IsKernelIncluded, - IsHvIncluded: eventConfig.IsHvIncluded} - runtime.SetPMUProfile(/*event ID*/ 3, &cacheMiss) - go pmuProfileWriter(w, /*event ID*/ 3, "cache misses") + // TODO: Clamp period to something reasonable + + helper(w, eventConfig, /*event ID*/ 3, /*event Name*/ "cache misses") return nil }) } From 2f7b4b1b1723cd108031e23c399103f0bc5ea6d0 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 9 Jul 2019 12:19:30 -0700 Subject: [PATCH 043/126] http --- src/net/http/pprof/pprof.go | 70 +++++++++++++++++++++++++++++++++---- src/runtime/pprof/pprof.go | 2 +- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index 35b3285a08..d7faed13fe 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -54,6 +54,7 @@ package pprof import ( "bufio" "bytes" + "errors" "fmt" "html/template" "io" @@ -110,6 +111,42 @@ func serveError(w http.ResponseWriter, status int, txt string) { fmt.Fprintln(w, txt) } +func pmuProfile(w http.ResponseWriter, r *http.Request) error { + var eventConfig pprof.PMUEventConfig + + period, err := strconv.ParseInt(r.FormValue("period"), 10, 64) + if err == nil { + eventConfig.Period = period + } + preciseIP, err := strconv.ParseInt(r.FormValue("preciseIP"), 10, 8) + if err == nil { + eventConfig.PreciseIP = int8(preciseIP) + } + isKernelIncluded, err := strconv.ParseBool(r.FormValue("kernel")) + if err == nil { + eventConfig.IsKernelIncluded = isKernelIncluded + } + isHvIncluded, err := strconv.ParseBool(r.FormValue("hv")) + if err == nil { + eventConfig.IsHvIncluded = isHvIncluded + } + + switch eventName := r.FormValue("event"); eventName { + case "cycles": + err = pprof.StartPMUProfile(pprof.WithProfilingCycle(w, &eventConfig)) + case "instructions": + err = pprof.StartPMUProfile(pprof.WithProfilingInstr(w, &eventConfig)) + case "cacheReferences": + err = pprof.StartPMUProfile(pprof.WithProfilingCacheRef(w, &eventConfig)) + case "cacheMisses": + err = pprof.StartPMUProfile(pprof.WithProfilingCacheMiss(w, &eventConfig)) + default: + return errors.New("uknown event") + } + + return err +} + // Profile responds with the pprof-formatted cpu profile. // Profiling lasts for duration specified in seconds GET parameter, or for 30 seconds if not specified. // The package initialization registers it as /debug/pprof/profile. @@ -129,14 +166,33 @@ func Profile(w http.ResponseWriter, r *http.Request) { // because if it does it starts writing. w.Header().Set("Content-Type", "application/octet-stream") w.Header().Set("Content-Disposition", `attachment; filename="profile"`) - if err := pprof.StartCPUProfile(w); err != nil { - // StartCPUProfile failed, so no writes yet. - serveError(w, http.StatusInternalServerError, + + isPMUEnabled, err := strconv.ParseBool(r.FormValue("pmu")) + if err != nil || isPMUEnabled == false { + if err := pprof.StartCPUProfile(w); err != nil { + // StartCPUProfile failed, so no writes yet. + serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable CPU profiling: %s", err)) - return - } - sleep(w, time.Duration(sec)*time.Second) - pprof.StopCPUProfile() + return + } + } else if err == nil && isPMUEnabled == true { + if err = pmuProfile(w, r); err != nil { + serveError(w, http.StatusInternalServerError, + fmt.Sprintf("Could not enable PMU profiling: %s", err)) + return + } + } else { + serveError(w, http.StatusInternalServerError, + fmt.Sprintf("Could not enable CPU or PMU profiling: %s", err)) + return + } + + sleep(w, time.Duration(sec)*time.Second) + if isPMUEnabled == true { + pprof.StopPMUProfile() + } else { + pprof.StopCPUProfile() + } } // Trace responds with the execution trace in binary form. diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 4906136d60..0836bfc59f 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -788,7 +788,7 @@ func StartPMUProfile(opts ...ProfilingOption) error { pmu.wg.Add(len(opts)) // Double-check. if pmu.profiling { - return fmt.Errorf("pmu profiling already in use") + return errors.New("pmu profiling already in use") } pmu.profiling = true From 1ce06b9e4bb0cb27f7fabf028393a536cf2c4142 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 9 Jul 2019 12:26:31 -0700 Subject: [PATCH 044/126] test --- test/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run.go b/test/run.go index ff1fcef9b1..7f6edfc111 100644 --- a/test/run.go +++ b/test/run.go @@ -50,7 +50,7 @@ var ( // dirs are the directories to look for *.go files in. // TODO(bradfitz): just use all directories? - dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "pmu/cycle"} + dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "pmu"} // ratec controls the max number of tests running at a time. ratec chan bool From a6860bf7b239a663be84c65e2d0e26a0368e6235 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 9 Jul 2019 19:48:37 -0700 Subject: [PATCH 045/126] indentation --- src/net/http/pprof/pprof.go | 116 ++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index d7faed13fe..9793cc7d09 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -112,39 +112,39 @@ func serveError(w http.ResponseWriter, status int, txt string) { } func pmuProfile(w http.ResponseWriter, r *http.Request) error { - var eventConfig pprof.PMUEventConfig - - period, err := strconv.ParseInt(r.FormValue("period"), 10, 64) - if err == nil { - eventConfig.Period = period - } - preciseIP, err := strconv.ParseInt(r.FormValue("preciseIP"), 10, 8) - if err == nil { - eventConfig.PreciseIP = int8(preciseIP) - } - isKernelIncluded, err := strconv.ParseBool(r.FormValue("kernel")) - if err == nil { - eventConfig.IsKernelIncluded = isKernelIncluded - } - isHvIncluded, err := strconv.ParseBool(r.FormValue("hv")) - if err == nil { - eventConfig.IsHvIncluded = isHvIncluded - } - - switch eventName := r.FormValue("event"); eventName { - case "cycles": - err = pprof.StartPMUProfile(pprof.WithProfilingCycle(w, &eventConfig)) - case "instructions": - err = pprof.StartPMUProfile(pprof.WithProfilingInstr(w, &eventConfig)) - case "cacheReferences": - err = pprof.StartPMUProfile(pprof.WithProfilingCacheRef(w, &eventConfig)) - case "cacheMisses": - err = pprof.StartPMUProfile(pprof.WithProfilingCacheMiss(w, &eventConfig)) - default: - return errors.New("uknown event") - } - - return err + var eventConfig pprof.PMUEventConfig + + period, err := strconv.ParseInt(r.FormValue("period"), 10, 64) + if err == nil { + eventConfig.Period = period + } + preciseIP, err := strconv.ParseInt(r.FormValue("preciseIP"), 10, 8) + if err == nil { + eventConfig.PreciseIP = int8(preciseIP) + } + isKernelIncluded, err := strconv.ParseBool(r.FormValue("kernel")) + if err == nil { + eventConfig.IsKernelIncluded = isKernelIncluded + } + isHvIncluded, err := strconv.ParseBool(r.FormValue("hv")) + if err == nil { + eventConfig.IsHvIncluded = isHvIncluded + } + + switch eventName := r.FormValue("event"); eventName { + case "cycles": + err = pprof.StartPMUProfile(pprof.WithProfilingCycle(w, &eventConfig)) + case "instructions": + err = pprof.StartPMUProfile(pprof.WithProfilingInstr(w, &eventConfig)) + case "cacheReferences": + err = pprof.StartPMUProfile(pprof.WithProfilingCacheRef(w, &eventConfig)) + case "cacheMisses": + err = pprof.StartPMUProfile(pprof.WithProfilingCacheMiss(w, &eventConfig)) + default: + return errors.New("uknown event") + } + + return err } // Profile responds with the pprof-formatted cpu profile. @@ -167,32 +167,32 @@ func Profile(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/octet-stream") w.Header().Set("Content-Disposition", `attachment; filename="profile"`) - isPMUEnabled, err := strconv.ParseBool(r.FormValue("pmu")) - if err != nil || isPMUEnabled == false { - if err := pprof.StartCPUProfile(w); err != nil { - // StartCPUProfile failed, so no writes yet. - serveError(w, http.StatusInternalServerError, - fmt.Sprintf("Could not enable CPU profiling: %s", err)) - return - } - } else if err == nil && isPMUEnabled == true { - if err = pmuProfile(w, r); err != nil { - serveError(w, http.StatusInternalServerError, - fmt.Sprintf("Could not enable PMU profiling: %s", err)) - return - } - } else { - serveError(w, http.StatusInternalServerError, + isPMUEnabled, err := strconv.ParseBool(r.FormValue("pmu")) + if err != nil || isPMUEnabled == false { + if err := pprof.StartCPUProfile(w); err != nil { + // StartCPUProfile failed, so no writes yet. + serveError(w, http.StatusInternalServerError, + fmt.Sprintf("Could not enable CPU profiling: %s", err)) + return + } + } else if err == nil && isPMUEnabled == true { + if err = pmuProfile(w, r); err != nil { + serveError(w, http.StatusInternalServerError, + fmt.Sprintf("Could not enable PMU profiling: %s", err)) + return + } + } else { + serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable CPU or PMU profiling: %s", err)) - return - } - - sleep(w, time.Duration(sec)*time.Second) - if isPMUEnabled == true { - pprof.StopPMUProfile() - } else { - pprof.StopCPUProfile() - } + return + } + + sleep(w, time.Duration(sec)*time.Second) + if isPMUEnabled == true { + pprof.StopPMUProfile() + } else { + pprof.StopCPUProfile() + } } // Trace responds with the execution trace in binary form. From 449a5b1727a31bb22297160208bf1180dec1926d Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 9 Jul 2019 19:48:54 -0700 Subject: [PATCH 046/126] indentation --- src/runtime/cpuprof.go | 40 +++---- src/runtime/defs_linux_amd64.go | 77 +++++++------- src/runtime/defs_pmu.go | 8 +- src/runtime/pprof/pprof.go | 177 +++++++++++++++---------------- src/runtime/pprof/proto.go | 20 ++-- src/runtime/proc.go | 81 +++++++------- src/runtime/signal_sighandler.go | 44 ++++---- src/runtime/signal_unix.go | 124 +++++++++++----------- src/runtime/sys_linux_amd64.s | 8 +- 9 files changed, 288 insertions(+), 291 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 11e2848a20..e11990e6b9 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -87,26 +87,26 @@ func SetCPUProfileRate(hz int) { } func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { - lock(&pmuprof[eventId].lock) - if eventAttr != nil { - if pmuprof[eventId].on || pmuprof[eventId].log != nil { - print("runtime: cannot set pmu profile rate until previous profile has finished.\n") - unlock(&pmuprof[eventId].lock) - return - } - - pmuprof[eventId].on = true - pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) - hdr := [1]uint64{eventAttr.Period} - pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) - setpmuprofile(int32(eventId), eventAttr) - } else if pmuprof[eventId].on { - setpmuprofile(int32(eventId), nil) - pmuprof[eventId].on = false - pmuprof[eventId].addExtra(eventId) - pmuprof[eventId].log.close() - } - unlock(&pmuprof[eventId].lock) + lock(&pmuprof[eventId].lock) + if eventAttr != nil { + if pmuprof[eventId].on || pmuprof[eventId].log != nil { + print("runtime: cannot set pmu profile rate until previous profile has finished.\n") + unlock(&pmuprof[eventId].lock) + return + } + + pmuprof[eventId].on = true + pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) + hdr := [1]uint64{eventAttr.Period} + pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) + setpmuprofile(int32(eventId), eventAttr) + } else if pmuprof[eventId].on { + setpmuprofile(int32(eventId), nil) + pmuprof[eventId].on = false + pmuprof[eventId].addExtra(eventId) + pmuprof[eventId].log.close() + } + unlock(&pmuprof[eventId].lock) } // add adds the stack trace to the profile. diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index ccf28f63fa..1da683320d 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -377,53 +377,52 @@ const ( PERF_FLAG_PID_CGROUP = 0x4 PERF_FLAG_FD_CLOEXEC = 0x8 - PERF_EVENT_IOC_DISABLE = 0x2401 - PERF_EVENT_IOC_ENABLE = 0x2400 - PERF_EVENT_IOC_ID = 0x80082407 - PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b - PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - PERF_EVENT_IOC_PERIOD = 0x40082404 - PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - PERF_EVENT_IOC_REFRESH = 0x2402 - PERF_EVENT_IOC_RESET = 0x2403 - PERF_EVENT_IOC_SET_BPF = 0x40042408 - PERF_EVENT_IOC_SET_FILTER = 0x40082406 - PERF_EVENT_IOC_SET_OUTPUT = 0x2405 + PERF_EVENT_IOC_DISABLE = 0x2401 + PERF_EVENT_IOC_ENABLE = 0x2400 + PERF_EVENT_IOC_ID = 0x80082407 + PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + PERF_EVENT_IOC_PERIOD = 0x40082404 + PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + PERF_EVENT_IOC_REFRESH = 0x2402 + PERF_EVENT_IOC_RESET = 0x2403 + PERF_EVENT_IOC_SET_BPF = 0x40042408 + PERF_EVENT_IOC_SET_FILTER = 0x40082406 + PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - _ uint32 + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + _ uint32 } type fOwnerEx struct { - Type int32 - Pid int32 - + Type int32 + Pid int32 } var perfEventOpt = []struct { - Type uint32 - Config uint64 + Type uint32 + Config uint64 } { - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, } diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index d2b890077b..32bacc56cf 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -37,8 +37,8 @@ const ( ) type PMUEventAttr struct { - Period uint64 - PreciseIP uint8 - IsKernelIncluded bool - IsHvIncluded bool + Period uint64 + PreciseIP uint8 + IsKernelIncluded bool + IsHvIncluded bool } diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 0836bfc59f..2a0bb4b913 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -740,35 +740,34 @@ var cpu struct { // for syscall.SIGPROF, but note that doing so may break any profiling // being done by the main program. func StartCPUProfile(w io.Writer, profileHz ...int) error { - // The runtime routines allow a variable profiling rate, - // but in practice operating systems cannot trigger signals - // at more than about 500 Hz, and our processing of the - // signal is not cheap (mostly getting the stack trace). - // 100 Hz is a reasonable choice: it is frequent enough to - // produce useful data, rare enough not to bog down the - // system, and a nice round number to make it easy to - // convert sample counts to seconds. Instead of requiring - // each client to specify the frequency, we hard code it. - - var hz = 100 - if len(profileHz) != 0 { - hz = profileHz[0] - } - - cpu.Lock() - defer cpu.Unlock() - if cpu.done == nil { - cpu.done = make(chan bool) - } - // Double-check. - if cpu.profiling { - return fmt.Errorf("cpu profiling already in use") - } - cpu.profiling = true - runtime.SetCPUProfileRate(hz) - go profileWriter(w) - return nil -} + // The runtime routines allow a variable profiling rate, + // but in practice operating systems cannot trigger signals + // at more than about 500 Hz, and our processing of the + // signal is not cheap (mostly getting the stack trace). + // 100 Hz is a reasonable choice: it is frequent enough to + // produce useful data, rare enough not to bog down the + // system, and a nice round number to make it easy to + // convert sample counts to seconds. Instead of requiring + // each client to specify the frequency, we hard code it. + var hz = 100 + if len(profileHz) != 0 { + hz = profileHz[0] + } + + cpu.Lock() + defer cpu.Unlock() + if cpu.done == nil { + cpu.done = make(chan bool) + } + // Double-check. + if cpu.profiling { + return fmt.Errorf("cpu profiling already in use") + } + cpu.profiling = true + runtime.SetCPUProfileRate(hz) + go profileWriter(w) + return nil + } const maxPMUEvent = 10 var pmu struct { @@ -779,21 +778,21 @@ var pmu struct { } func StartPMUProfile(opts ...ProfilingOption) error { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { - return errors.New("not implemented") - } + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { + return errors.New("not implemented") + } - pmu.Lock() + pmu.Lock() defer pmu.Unlock() - pmu.wg.Add(len(opts)) - // Double-check. + pmu.wg.Add(len(opts)) + // Double-check. if pmu.profiling { return errors.New("pmu profiling already in use") } pmu.profiling = true - for _, opt := range opts { - if err := opt.apply(); err != nil { + for _, opt := range opts { + if err := opt.apply(); err != nil { return err } } @@ -801,21 +800,21 @@ func StartPMUProfile(opts ...ProfilingOption) error { } type PMUEventConfig struct { - Period int64 - PreciseIP int8 - IsKernelIncluded bool - IsHvIncluded bool - // TODO: IsMmapEnabled bool - // TODO: IsLBREnabled bool + Period int64 + PreciseIP int8 + IsKernelIncluded bool + IsHvIncluded bool + // TODO: IsMmapEnabled bool + // TODO: IsLBREnabled bool } func getPreciseIP(preciseIP int8) uint8 { - if preciseIP < 0 { - preciseIP = 0 - } else if preciseIP > 3 { - preciseIP = 3 - } - return uint8(preciseIP) + if preciseIP < 0 { + preciseIP = 0 + } else if preciseIP > 3 { + preciseIP = 3 + } + return uint8(preciseIP) } func helper(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { @@ -847,11 +846,11 @@ func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") + return errors.New("Period should be > 0") } // Clamp period to something reasonable if eventConfig.Period < 300 { - eventConfig.Period = 300 + eventConfig.Period = 300 } helper(w, eventConfig, /*event ID*/ 1, /*event Name*/ "instructions") @@ -862,7 +861,7 @@ func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") + return errors.New("Period should be > 0") } // TODO: Clamp period to something reasonable @@ -874,7 +873,7 @@ func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOp func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") + return errors.New("Period should be > 0") } // TODO: Clamp period to something reasonable @@ -902,19 +901,19 @@ func profileWriter(w io.Writer) { b := newProfileBuilder(w) var err error for { - time.Sleep(100 * time.Millisecond) - data, tags, eof := readProfile() - if e := b.addCPUData(data, tags); e != nil && err == nil { - err = e - } - if eof { - break - } + time.Sleep(100 * time.Millisecond) + data, tags, eof := readProfile() + if e := b.addCPUData(data, tags); e != nil && err == nil { + err = e + } + if eof { + break + } } - if err != nil { - // The runtime should never produce an invalid or truncated profile. - // It drops records that can't fit into its log buffers. - panic("runtime/pprof: converting profile: " + err.Error()) + if err != nil { + // The runtime should never produce an invalid or truncated profile. + // It drops records that can't fit into its log buffers. + panic("runtime/pprof: converting profile: " + err.Error()) } b.build() cpu.done <- true @@ -926,16 +925,16 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { b := newProfileBuilder(w) var err error for { - time.Sleep(100 * time.Millisecond) - data, tags, eof := readPMUProfile(eventId) - if e := b.addPMUData(data, tags); e != nil && err == nil { - err = e - } - if eof { - break - } + time.Sleep(100 * time.Millisecond) + data, tags, eof := readPMUProfile(eventId) + if e := b.addPMUData(data, tags); e != nil && err == nil { + err = e + } + if eof { + break + } } - if err != nil { + if err != nil { panic("runtime/pprof: converting profile: " + err.Error()) } b.pmuBuild(eventName) @@ -946,15 +945,15 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { // StopCPUProfile only returns after all the writes for the // profile have completed. func StopCPUProfile() { - cpu.Lock() - defer cpu.Unlock() - - if !cpu.profiling { - return - } - cpu.profiling = false - runtime.SetCPUProfileRate(0) - <-cpu.done + cpu.Lock() + defer cpu.Unlock() + + if !cpu.profiling { + return + } + cpu.profiling = false + runtime.SetCPUProfileRate(0) + <-cpu.done } func StopPMUProfile() { @@ -964,14 +963,14 @@ func StopPMUProfile() { if !pmu.profiling { return } - pmu.profiling = false + pmu.profiling = false - for i := 0; i < maxPMUEvent; i++ { - if pmu.eventOn[i] { - runtime.SetPMUProfile(i, nil) - } + for i := 0; i < maxPMUEvent; i++ { + if pmu.eventOn[i] { + runtime.SetPMUProfile(i, nil) + } } - pmu.wg.Wait() + pmu.wg.Wait() } // countBlock returns the number of records in the blocking profile. diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index 14c6ddea6d..2e83d6ac6e 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -33,7 +33,7 @@ type profileBuilder struct { end time.Time havePeriod bool period int64 - isPMUEnabled bool + isPMUEnabled bool m profMap // encoding state @@ -389,7 +389,7 @@ func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error return fmt.Errorf("malformed profile") } b.isPMUEnabled = true - b.period = int64(data[2]) + b.period = int64(data[2]) data = data[3:] } @@ -452,23 +452,23 @@ func (b *profileBuilder) build() { b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) if b.havePeriod { // must be CPU profile b.pbValueType(tagProfile_SampleType, "samples", "count") - b.pbValueType(tagProfile_SampleType, "cpu", "nanoseconds") + b.pbValueType(tagProfile_SampleType, "cpu", "nanoseconds") b.pb.int64Opt(tagProfile_DurationNanos, b.end.Sub(b.start).Nanoseconds()) b.pbValueType(tagProfile_PeriodType, "cpu", "nanoseconds") b.pb.int64Opt(tagProfile_Period, b.period) } - - b.profileBuild() + + b.profileBuild() } func (b *profileBuilder) pmuBuild(eventName string) { b.pb.int64Opt(tagProfile_TimeNanos, b.start.UnixNano()) - b.pbValueType(tagProfile_SampleType, "samples", "count") - b.pbValueType(tagProfile_SampleType, eventName, "count") - b.pbValueType(tagProfile_PeriodType, eventName, "count") + b.pbValueType(tagProfile_SampleType, "samples", "count") + b.pbValueType(tagProfile_SampleType, eventName, "count") + b.pbValueType(tagProfile_PeriodType, eventName, "count") b.pb.int64Opt(tagProfile_Period, b.period) - - b.profileBuild() + + b.profileBuild() } // readMapping reads /proc/self/maps and writes mappings to b.pb. diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 1586bed3a7..70de478029 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2149,17 +2149,17 @@ func execute(gp *g, inheritTime bool) { // Check whether the profiler needs to be turned on or off. hz := sched.profilehz - eventAttrs := sched.eventAttrs - - if _g_.m.profilehz != hz { - setThreadCPUProfiler(hz) - } - for eventId := 0; eventId < maxPMUEvent; eventId++ { - if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { - setThreadPMUProfiler(int32(eventId), eventAttrs[eventId]) - } - } - + eventAttrs := sched.eventAttrs + + if _g_.m.profilehz != hz { + setThreadCPUProfiler(hz) + } + for eventId := 0; eventId < maxPMUEvent; eventId++ { + if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { + setThreadPMUProfiler(int32(eventId), eventAttrs[eventId]) + } + } + if trace.enabled { // GoSysExit has to happen when we have a P, but before GoStart. // So we emit it here. @@ -3629,7 +3629,7 @@ var prof struct { var pmuEvent [maxPMUEvent]struct { signalLock uint32 - eventAttr *PMUEventAttr + eventAttr *PMUEventAttr } func _System() { _System() } @@ -3845,7 +3845,7 @@ func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGPMU = SIGRTMI // See golang.org/issue/17165. getg().m.mallocing++ stk := make([]uintptr, maxCPUProfStack) - n := stackUnwinding(pc, sp, lr, gp, mp, stk) + n := stackUnwinding(pc, sp, lr, gp, mp, stk) if pmuEvent[eventId].eventAttr != nil { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostPMUAtomic64Count[eventId] > 0 { pmuprof[eventId].addLostAtomic64(lostPMUAtomic64Count[eventId], eventId) @@ -3984,35 +3984,34 @@ func setcpuprofilerate(hz int32) { } func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { + // Disable preemption, otherwise we can be rescheduled to another thread + // that has profiling enabled. + _g_ := getg() + _g_.m.locks++ - // Disable preemption, otherwise we can be rescheduled to another thread - // that has profiling enabled. - _g_ := getg() - _g_.m.locks++ - - // Stop profiler on this thread so that it is safe to lock prof. - // if a profiling signal came in while we had prof locked, - // it would deadlock. - setThreadPMUProfiler(eventId, nil) - - for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { - osyield() - } - if pmuEvent[eventId].eventAttr != eventAttr { - setProcessPMUProfiler(eventAttr) - pmuEvent[eventId].eventAttr = eventAttr - } - atomic.Store(&pmuEvent[eventId].signalLock, 0) - - lock(&sched.lock) - sched.eventAttrs[eventId] = eventAttr - unlock(&sched.lock) - - if eventAttr != nil { - setThreadPMUProfiler(eventId, eventAttr) - } - - _g_.m.locks-- + // Stop profiler on this thread so that it is safe to lock prof. + // if a profiling signal came in while we had prof locked, + // it would deadlock. + setThreadPMUProfiler(eventId, nil) + + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { + osyield() + } + if pmuEvent[eventId].eventAttr != eventAttr { + setProcessPMUProfiler(eventAttr) + pmuEvent[eventId].eventAttr = eventAttr + } + atomic.Store(&pmuEvent[eventId].signalLock, 0) + + lock(&sched.lock) + sched.eventAttrs[eventId] = eventAttr + unlock(&sched.lock) + + if eventAttr != nil { + setThreadPMUProfiler(eventId, eventAttr) + } + + _g_.m.locks-- } // init initializes pp, which may be a freshly allocated p or a diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index bb7a33d0b9..a27c199493 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -34,28 +34,28 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { _g_ := getg() c := &sigctxt{info, ctxt} - if sig == _SIGPMU { - fd := info.si_fd - ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) - - var eventId int = -1 - for i := 0; i < maxPMUEvent; i++ { - if _g_.m.eventFds[i] == fd { - eventId = i - break - } - } - if eventId != -1 { - sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) - } - - ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) - return - } - - if sig == _SIGPROF { - sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) - return + if sig == _SIGPMU { + fd := info.si_fd + ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) + + var eventId int = -1 + for i := 0; i < maxPMUEvent; i++ { + if _g_.m.eventFds[i] == fd { + eventId = i + break + } + } + if eventId != -1 { + sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) + } + + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + return + } + + if sig == _SIGPROF { + sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) + return } if sig == _SIGTRAP && testSigtrap != nil && testSigtrap(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp) { diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index fcd3590eef..c2ea5f607a 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -142,10 +142,10 @@ func sigInstallGoHandler(sig uint32) bool { } func isProfilingSignal(sig uint32) bool { - if sig == _SIGPROF || sig == _SIGPMU { - return true - } - return false + if sig == _SIGPROF || sig == _SIGPMU { + return true + } + return false } // sigenable enables the Go signal handler to catch the signal sig. @@ -182,7 +182,7 @@ func sigdisable(sig uint32) { } // SIGPROF and _SIGPMU are handled specially for profiling. - if isProfilingSignal(sig) { + if isProfilingSignal(sig) { return } @@ -259,70 +259,70 @@ func setProcessCPUProfiler(hz int32) { } func setProcessPMUProfiler(eventAttr *PMUEventAttr) { - if eventAttr != nil { - // Enable the Go signal handler if not enabled. - if atomic.Cas(&handlingSig[_SIGPMU], 0, 1) { - atomic.Storeuintptr(&fwdSig[_SIGPMU], getsig(_SIGPMU)) - setsig(_SIGPMU, funcPC(sighandler)) - } - } else { - // If the Go signal handler should be disabled by default, - // disable it if it is enabled. - if !sigInstallGoHandler(_SIGPMU) { - if atomic.Cas(&handlingSig[_SIGPMU], 1, 0) { - setsig(_SIGPMU, atomic.Loaduintptr(&fwdSig[_SIGPMU])) - } - } - } + if eventAttr != nil { + // Enable the Go signal handler if not enabled. + if atomic.Cas(&handlingSig[_SIGPMU], 0, 1) { + atomic.Storeuintptr(&fwdSig[_SIGPMU], getsig(_SIGPMU)) + setsig(_SIGPMU, funcPC(sighandler)) + } + } else { + // If the Go signal handler should be disabled by default, + // disable it if it is enabled. + if !sigInstallGoHandler(_SIGPMU) { + if atomic.Cas(&handlingSig[_SIGPMU], 1, 0) { + setsig(_SIGPMU, atomic.Loaduintptr(&fwdSig[_SIGPMU])) + } + } + } } // setThreadCPUProfiler makes any thread-specific changes required to // implement profiling at a rate of hz. func setThreadCPUProfiler(hz int32) { - var it itimerval - if hz == 0 { - setitimer(_ITIMER_PROF, &it, nil) - } else { - it.it_interval.tv_sec = 0 - it.it_interval.set_usec(1000000 / hz) - it.it_value = it.it_interval - setitimer(_ITIMER_PROF, &it, nil) - } - _g_ := getg() - _g_.m.profilehz = hz + var it itimerval + if hz == 0 { + setitimer(_ITIMER_PROF, &it, nil) + } else { + it.it_interval.tv_sec = 0 + it.it_interval.set_usec(1000000 / hz) + it.it_value = it.it_interval + setitimer(_ITIMER_PROF, &it, nil) + } + _g_ := getg() + _g_.m.profilehz = hz } func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { - _g_ := getg() - - if eventAttr == nil { - if _g_.m.eventAttrs[eventId] != nil { - closefd(_g_.m.eventFds[eventId]) - } - } else { - var perfAttr perfEventAttr - perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) - perfAttr.Type = perfEventOpt[eventId].Type - perfAttr.Config = perfEventOpt[eventId].Config - perfAttr.Sample = eventAttr.Period - perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip - if !eventAttr.IsKernelIncluded { // don't count kernel - perfAttr.Bits += 0b100000 - } - if !eventAttr.IsHvIncluded { // don't count hypervisor - perfAttr.Bits += 0b1000000 - } - - fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy*/ 0) - _g_.m.eventFds[eventId] = fd - r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) - fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) - fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPMU) - fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} - fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) - } - - _g_.m.eventAttrs[eventId] = eventAttr + _g_ := getg() + + if eventAttr == nil { + if _g_.m.eventAttrs[eventId] != nil { + closefd(_g_.m.eventFds[eventId]) + } + } else { + var perfAttr perfEventAttr + perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) + perfAttr.Type = perfEventOpt[eventId].Type + perfAttr.Config = perfEventOpt[eventId].Config + perfAttr.Sample = eventAttr.Period + perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip + if !eventAttr.IsKernelIncluded { // don't count kernel + perfAttr.Bits += 0b100000 + } + if !eventAttr.IsHvIncluded { // don't count hypervisor + perfAttr.Bits += 0b1000000 + } + + fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy*/ 0) + _g_.m.eventFds[eventId] = fd + r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) + fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) + fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPMU) + fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} + fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) + } + + _g_.m.eventAttrs[eventId] = eventAttr } func sigpipe() { @@ -355,7 +355,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { return } else if sig == _SIGPMU { // sigpmuNonGoPC(c.sigpc()) - println("how do I know which pmu event delivers this signal") + println("how do I know which pmu event delivers this signal") return } c.fixsigcode(sig) diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 2a9663683a..8e3e05429c 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -196,9 +196,9 @@ TEXT runtime·ioctl(SB),NOSPLIT,$0 MOVL fd+0(FP), DI MOVQ req+8(FP), SI MOVQ arg+16(FP), DX - MOVQ $SYS_ioctl, AX + MOVQ $SYS_ioctl, AX SYSCALL - MOVQ AX, ret+24(FP) + MOVQ AX, ret+24(FP) RET // func fcntl(fd int32, cmd arg int64) (r int64, err int64) @@ -206,7 +206,7 @@ TEXT runtime·fcntl(SB),NOSPLIT,$0 MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX - MOVQ $SYS_fcntl, AX + MOVQ $SYS_fcntl, AX SYSCALL CMPQ AX, $0xfffffffffffff001 JLS ok @@ -223,7 +223,7 @@ TEXT runtime·fcntl2(SB),NOSPLIT,$0 MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX - MOVQ $SYS_fcntl, AX + MOVQ $SYS_fcntl, AX SYSCALL CMPQ AX, $0xfffffffffffff001 JLS ok From 23a00c29b24d0da2502444958ccf536b548524ac Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 15:52:36 -0700 Subject: [PATCH 047/126] separate OS-specific functions and data stuctures --- src/runtime/defs1_netbsd_386.go | 1 + src/runtime/defs1_netbsd_amd64.go | 1 + src/runtime/defs1_netbsd_arm.go | 1 + src/runtime/defs1_netbsd_arm64.go | 1 + src/runtime/defs1_solaris_amd64.go | 1 + src/runtime/defs_aix_ppc64.go | 1 + src/runtime/defs_darwin_386.go | 1 + src/runtime/defs_darwin_amd64.go | 1 + src/runtime/defs_darwin_arm.go | 1 + src/runtime/defs_darwin_arm64.go | 1 + src/runtime/defs_dragonfly_amd64.go | 1 + src/runtime/defs_freebsd_386.go | 1 + src/runtime/defs_freebsd_amd64.go | 1 + src/runtime/defs_freebsd_arm.go | 1 + src/runtime/defs_linux_386.go | 1 + src/runtime/defs_linux_amd64.go | 4 +- src/runtime/defs_linux_arm.go | 2 + src/runtime/defs_linux_arm64.go | 1 + src/runtime/defs_linux_mips64x.go | 1 + src/runtime/defs_linux_mipsx.go | 1 + src/runtime/defs_linux_ppc64.go | 1 + src/runtime/defs_linux_ppc64le.go | 1 + src/runtime/defs_linux_s390x.go | 1 + src/runtime/defs_openbsd_386.go | 1 + src/runtime/defs_openbsd_amd64.go | 1 + src/runtime/defs_openbsd_arm.go | 1 + src/runtime/defs_openbsd_arm64.go | 1 + src/runtime/defs_pmu.go | 3 - src/runtime/os2_plan9.go | 1 + src/runtime/os_darwin.go | 6 ++ src/runtime/os_linux.go | 11 ---- src/runtime/os_linux_386.go | 11 ++++ src/runtime/os_linux_amd64.go | 94 +++++++++++++++++++++++++++++ src/runtime/runtime2.go | 10 +-- src/runtime/signal_sighandler.go | 22 ++----- src/runtime/signal_unix.go | 53 +--------------- 36 files changed, 151 insertions(+), 91 deletions(-) create mode 100644 src/runtime/os_linux_386.go create mode 100644 src/runtime/os_linux_amd64.go diff --git a/src/runtime/defs1_netbsd_386.go b/src/runtime/defs1_netbsd_386.go index 3eae12eed0..669030b0af 100644 --- a/src/runtime/defs1_netbsd_386.go +++ b/src/runtime/defs1_netbsd_386.go @@ -53,6 +53,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_netbsd_amd64.go b/src/runtime/defs1_netbsd_amd64.go index 51d55c91f9..87c4315146 100644 --- a/src/runtime/defs1_netbsd_amd64.go +++ b/src/runtime/defs1_netbsd_amd64.go @@ -53,6 +53,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_netbsd_arm.go b/src/runtime/defs1_netbsd_arm.go index fadb3415b3..f8fc98fa58 100644 --- a/src/runtime/defs1_netbsd_arm.go +++ b/src/runtime/defs1_netbsd_arm.go @@ -53,6 +53,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_netbsd_arm64.go b/src/runtime/defs1_netbsd_arm64.go index 41b7aaca6c..e7ea5161fa 100644 --- a/src/runtime/defs1_netbsd_arm64.go +++ b/src/runtime/defs1_netbsd_arm64.go @@ -53,6 +53,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_solaris_amd64.go b/src/runtime/defs1_solaris_amd64.go index 64d51a7bd8..7fb2549e25 100644 --- a/src/runtime/defs1_solaris_amd64.go +++ b/src/runtime/defs1_solaris_amd64.go @@ -57,6 +57,7 @@ const ( _SIGWINCH = 0x14 _SIGUSR1 = 0x10 _SIGUSR2 = 0x11 + _SIGPMU = 0x11 // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_aix_ppc64.go b/src/runtime/defs_aix_ppc64.go index dccc3a5926..0836f82bcb 100644 --- a/src/runtime/defs_aix_ppc64.go +++ b/src/runtime/defs_aix_ppc64.go @@ -59,6 +59,7 @@ const ( _SIGTERM = 0xf _SIGEMT = 0x7 _SIGWAITING = 0x27 + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x14 _FPE_INTOVF = 0x15 diff --git a/src/runtime/defs_darwin_386.go b/src/runtime/defs_darwin_386.go index 43dc08a078..338787e85d 100644 --- a/src/runtime/defs_darwin_386.go +++ b/src/runtime/defs_darwin_386.go @@ -61,6 +61,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_darwin_amd64.go b/src/runtime/defs_darwin_amd64.go index 59b0effa13..eb8f02347a 100644 --- a/src/runtime/defs_darwin_amd64.go +++ b/src/runtime/defs_darwin_amd64.go @@ -61,6 +61,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_darwin_arm.go b/src/runtime/defs_darwin_arm.go index 243f52a5df..08a7dc4e3d 100644 --- a/src/runtime/defs_darwin_arm.go +++ b/src/runtime/defs_darwin_arm.go @@ -63,6 +63,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_darwin_arm64.go b/src/runtime/defs_darwin_arm64.go index 7056074f46..e63fb7f609 100644 --- a/src/runtime/defs_darwin_arm64.go +++ b/src/runtime/defs_darwin_arm64.go @@ -61,6 +61,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_dragonfly_amd64.go b/src/runtime/defs_dragonfly_amd64.go index 30f1b33845..b7a1ca5f5f 100644 --- a/src/runtime/defs_dragonfly_amd64.go +++ b/src/runtime/defs_dragonfly_amd64.go @@ -57,6 +57,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_freebsd_386.go b/src/runtime/defs_freebsd_386.go index c4d5c897d3..2fd586933c 100644 --- a/src/runtime/defs_freebsd_386.go +++ b/src/runtime/defs_freebsd_386.go @@ -71,6 +71,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_freebsd_amd64.go b/src/runtime/defs_freebsd_amd64.go index 89d36c270d..bf2b6d7b71 100644 --- a/src/runtime/defs_freebsd_amd64.go +++ b/src/runtime/defs_freebsd_amd64.go @@ -71,6 +71,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_freebsd_arm.go b/src/runtime/defs_freebsd_arm.go index cc8c924c37..4b3957e478 100644 --- a/src/runtime/defs_freebsd_arm.go +++ b/src/runtime/defs_freebsd_arm.go @@ -71,6 +71,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index e2fcbcac71..a37c38d9c1 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -57,6 +57,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f + _SIGPMU = 0x25 // psu: _SIGPMU = SIGRTMIN + 3 _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 1da683320d..48649d153c 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -57,7 +57,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0x25 + _SIGPMU = 0x25 // psu: _SIGPMU = SIGRTMIN + 3 _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 @@ -128,7 +128,7 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 - // an unreliable workaround and need to figure out a better solution + // psu: an unreliable workaround and need to figure out a better solution si_fd int32 } diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index 9d10d664e1..4716d67477 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -54,6 +54,8 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f + _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead + _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 _FPE_FLTDIV = 0x3 diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index b325a229a1..39eebbc615 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -57,6 +57,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f + _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index a52d0d40cf..e94784391c 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -56,6 +56,7 @@ const ( _SIGPROF = 0x1d _SIGXCPU = 0x1e _SIGXFSZ = 0x1f + _SIGPMU = 0x11 // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index f3a1dd0cf0..5a3cc37fe5 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -60,6 +60,7 @@ const ( _SIGPROF = 0x1d _SIGXCPU = 0x1e _SIGXFSZ = 0x1f + _SIGPMU = 0x11 // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index f438993721..d17f9bb8fa 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -56,6 +56,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f + _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index f438993721..294e121d17 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -56,6 +56,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f + _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index 19b99b5bdf..25af63074d 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -57,6 +57,7 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f + _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_386.go b/src/runtime/defs_openbsd_386.go index 0e59a0591a..1335cf0b55 100644 --- a/src/runtime/defs_openbsd_386.go +++ b/src/runtime/defs_openbsd_386.go @@ -56,6 +56,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_amd64.go b/src/runtime/defs_openbsd_amd64.go index 5cefac5858..e6aa067a9c 100644 --- a/src/runtime/defs_openbsd_amd64.go +++ b/src/runtime/defs_openbsd_amd64.go @@ -56,6 +56,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_arm.go b/src/runtime/defs_openbsd_arm.go index b187e9776f..19e3a054c3 100644 --- a/src/runtime/defs_openbsd_arm.go +++ b/src/runtime/defs_openbsd_arm.go @@ -56,6 +56,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_arm64.go b/src/runtime/defs_openbsd_arm64.go index 6b9d60110a..0209f67267 100644 --- a/src/runtime/defs_openbsd_arm64.go +++ b/src/runtime/defs_openbsd_arm64.go @@ -53,6 +53,7 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 32bacc56cf..ee1c3b72ac 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -1,6 +1,3 @@ -// created by cgo -cdefs and then converted to Go -// cgo -cdefs defs_linux.go defs1_linux.go - package runtime const ( diff --git a/src/runtime/os2_plan9.go b/src/runtime/os2_plan9.go index 58fb2be91f..1778efe447 100644 --- a/src/runtime/os2_plan9.go +++ b/src/runtime/os2_plan9.go @@ -71,4 +71,5 @@ const ( _SIGTRAP = 6 _SIGPROF = 0 // dummy value defined for badsignal _SIGQUIT = 0 // dummy value defined for sighandler + _SIGPMU = 0 // psu: dummy value in order to pass testing ) diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index 18c15ad89e..e11d8f8c6b 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -355,3 +355,9 @@ func sysargs(argc int32, argv **byte) { executablePath = executablePath[len(prefix):] } } + +func setProcessPMUProfiler(arg ...interface{}) {/*TODO: implementation*/} +func setThreadPMUProfiler(arg ...interface{}) {/*TODO: implementation*/} + +//go:nowritebarrierrec +func sigpmuhandler(arg ...interface{}) {/*TODO: implementation*/} diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 8f41e211e3..d4a9bd4ff5 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -356,17 +356,6 @@ func sigaltstack(new, old *stackt) //go:noescape func setitimer(mode int32, new, old *itimerval) -//go:noescape -func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) - -func ioctl(fd int32, req, arg int64) int64 - -// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) -func fcntl(fd int32, cmd, arg int64) (r int64, err int64) - -//go:noescape -func fcntl2(fd int32, cmd int64, arg *fOwnerEx) (r int64, err int64) - //go:noescape func rtsigprocmask(how int32, new, old *sigset, size int32) diff --git a/src/runtime/os_linux_386.go b/src/runtime/os_linux_386.go new file mode 100644 index 0000000000..7f37fbbb61 --- /dev/null +++ b/src/runtime/os_linux_386.go @@ -0,0 +1,11 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +func setProcessPMUProfiler(arg ...interface{}) /*TODO: implementation*/{} +func setThreadPMUProfiler(arg ...interface{}) {/*TODO: implementation*/} + +//go:nowritebarrierrec +func sigpmuhandler(arg ...interface{}) {/*TODO: implementation*/} diff --git a/src/runtime/os_linux_amd64.go b/src/runtime/os_linux_amd64.go new file mode 100644 index 0000000000..f3db7b3297 --- /dev/null +++ b/src/runtime/os_linux_amd64.go @@ -0,0 +1,94 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import ( + "runtime/internal/atomic" + "unsafe" +) + +//go:noescape +func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) + +func ioctl(fd int32, req, arg int64) int64 + +// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) +func fcntl(fd int32, cmd, arg int64) (r int64, err int64) + +//go:noescape +func fcntl2(fd int32, cmd int64, arg *fOwnerEx) (r int64, err int64) + +func setProcessPMUProfiler(eventAttr *PMUEventAttr) { + if eventAttr != nil { + // Enable the Go signal handler if not enabled. + if atomic.Cas(&handlingSig[_SIGPMU], 0, 1) { + atomic.Storeuintptr(&fwdSig[_SIGPMU], getsig(_SIGPMU)) + setsig(_SIGPMU, funcPC(sighandler)) + } + } else { + // If the Go signal handler should be disabled by default, + // disable it if it is enabled. + if !sigInstallGoHandler(_SIGPMU) { + if atomic.Cas(&handlingSig[_SIGPMU], 1, 0) { + setsig(_SIGPMU, atomic.Loaduintptr(&fwdSig[_SIGPMU])) + } + } + } +} + +func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { + _g_ := getg() + + if eventAttr == nil { + if _g_.m.eventAttrs[eventId] != nil { + closefd(_g_.m.eventFds[eventId]) + } + } else { + var perfAttr perfEventAttr + perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) + perfAttr.Type = perfEventOpt[eventId].Type + perfAttr.Config = perfEventOpt[eventId].Config + perfAttr.Sample = eventAttr.Period + perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip + if !eventAttr.IsKernelIncluded { // don't count kernel + perfAttr.Bits += 0b100000 + } + if !eventAttr.IsHvIncluded { // don't count hypervisor + perfAttr.Bits += 0b1000000 + } + + fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy*/ 0) + _g_.m.eventFds[eventId] = fd + r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) + fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) + fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPMU) + fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} + fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) + } + + _g_.m.eventAttrs[eventId] = eventAttr +} + +//go:nowritebarrierrec +func sigpmuhandler(info *siginfo, ctxt unsafe.Pointer, gp *g) { + fd := info.si_fd + ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) + _g_ := getg() + c := &sigctxt{info, ctxt} + + var eventId int = -1 + for i := 0; i < maxPMUEvent; i++ { + if _g_.m.eventFds[i] == fd { + eventId = i + break + } + } + if eventId != -1 { + sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) + } + + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + return +} diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index c72b91eeae..7d6d5b2824 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,9 +473,9 @@ type m struct { locks int32 dying int32 profilehz int32 - eventFds [maxPMUEvent]int32 + eventFds [maxPMUEvent]int32 eventAttrs [maxPMUEvent]*PMUEventAttr - spinning bool // m is out of work and is actively looking for work + spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack printlock int8 @@ -675,9 +675,9 @@ type schedt struct { safePointWait int32 safePointNote note - profilehz int32 // cpu profiling rate - eventAttrs [maxPMUEvent]*PMUEventAttr - procresizetime int64 // nanotime() of last change to gomaxprocs + profilehz int32 // cpu profiling rate + eventAttrs [maxPMUEvent]*PMUEventAttr + procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index a27c199493..3d5c7f6571 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -31,28 +31,14 @@ var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool // //go:nowritebarrierrec func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { - _g_ := getg() - c := &sigctxt{info, ctxt} - if sig == _SIGPMU { - fd := info.si_fd - ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) - - var eventId int = -1 - for i := 0; i < maxPMUEvent; i++ { - if _g_.m.eventFds[i] == fd { - eventId = i - break - } - } - if eventId != -1 { - sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) - } - - ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + sigpmuhandler(info, ctxt, gp) return } + _g_ := getg() + c := &sigctxt{info, ctxt} + if sig == _SIGPROF { sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) return diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index c2ea5f607a..2381e2b89b 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -157,7 +157,7 @@ func sigenable(sig uint32) { } // SIGPROF and _SIGPMU are handled specially for profiling. - if isProfilingSignal(sig) { + if isProfilingSignal(sig) { return } @@ -258,24 +258,6 @@ func setProcessCPUProfiler(hz int32) { } } -func setProcessPMUProfiler(eventAttr *PMUEventAttr) { - if eventAttr != nil { - // Enable the Go signal handler if not enabled. - if atomic.Cas(&handlingSig[_SIGPMU], 0, 1) { - atomic.Storeuintptr(&fwdSig[_SIGPMU], getsig(_SIGPMU)) - setsig(_SIGPMU, funcPC(sighandler)) - } - } else { - // If the Go signal handler should be disabled by default, - // disable it if it is enabled. - if !sigInstallGoHandler(_SIGPMU) { - if atomic.Cas(&handlingSig[_SIGPMU], 1, 0) { - setsig(_SIGPMU, atomic.Loaduintptr(&fwdSig[_SIGPMU])) - } - } - } -} - // setThreadCPUProfiler makes any thread-specific changes required to // implement profiling at a rate of hz. func setThreadCPUProfiler(hz int32) { @@ -292,39 +274,6 @@ func setThreadCPUProfiler(hz int32) { _g_.m.profilehz = hz } -func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { - _g_ := getg() - - if eventAttr == nil { - if _g_.m.eventAttrs[eventId] != nil { - closefd(_g_.m.eventFds[eventId]) - } - } else { - var perfAttr perfEventAttr - perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) - perfAttr.Type = perfEventOpt[eventId].Type - perfAttr.Config = perfEventOpt[eventId].Config - perfAttr.Sample = eventAttr.Period - perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip - if !eventAttr.IsKernelIncluded { // don't count kernel - perfAttr.Bits += 0b100000 - } - if !eventAttr.IsHvIncluded { // don't count hypervisor - perfAttr.Bits += 0b1000000 - } - - fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy*/ 0) - _g_.m.eventFds[eventId] = fd - r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) - fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) - fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPMU) - fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} - fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) - } - - _g_.m.eventAttrs[eventId] = eventAttr -} - func sigpipe() { if sigsend(_SIGPIPE) { return From 7585bd91de9c80013990d4bea577478b2f9056cc Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 15:53:37 -0700 Subject: [PATCH 048/126] API checks --- api/except.txt | 1 + api/next.txt | 518 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 519 insertions(+) diff --git a/api/except.txt b/api/except.txt index 2a1287ce90..6700cab773 100644 --- a/api/except.txt +++ b/api/except.txt @@ -459,3 +459,4 @@ pkg syscall (freebsd-arm-cgo), type Statfs_t struct, Mntfromname [88]int8 pkg syscall (freebsd-arm-cgo), type Statfs_t struct, Mntonname [88]int8 pkg text/scanner, const GoTokens = 1012 pkg unicode, const Version = "10.0.0" +pkg runtime/pprof, func StartCPUProfile(io.Writer) error diff --git a/api/next.txt b/api/next.txt index 24c4daf1ad..fda6fdefed 100644 --- a/api/next.txt +++ b/api/next.txt @@ -8040,3 +8040,521 @@ pkg unicode, var Makasar *RangeTable pkg unicode, var Medefaidrin *RangeTable pkg unicode, var Old_Sogdian *RangeTable pkg unicode, var Sogdian *RangeTable +pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST = -2048 +pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST ideal-int +pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_KERNEL = -2176 +pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_KERNEL ideal-int +pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_USER = -2560 +pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_USER ideal-int +pkg runtime (linux-amd64), const PERF_CONTEXT_HV = -32 +pkg runtime (linux-amd64), const PERF_CONTEXT_HV ideal-int +pkg runtime (linux-amd64), const PERF_CONTEXT_KERNEL = -128 +pkg runtime (linux-amd64), const PERF_CONTEXT_KERNEL ideal-int +pkg runtime (linux-amd64), const PERF_CONTEXT_USER = -512 +pkg runtime (linux-amd64), const PERF_CONTEXT_USER ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4 +pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_MISSES = 5 +pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_MISSES ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_BUS_CYCLES = 6 +pkg runtime (linux-amd64), const PERF_COUNT_HW_BUS_CYCLES ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_BPU = 5 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_BPU ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_DTLB = 3 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_DTLB ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_ITLB = 4 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_ITLB ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1D = 0 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1D ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1I = 1 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1I ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_LL = 2 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_LL ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_MISSES = 3 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_MISSES ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_NODE = 6 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_NODE ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_PREFETCH = 2 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_PREFETCH ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_READ = 0 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_READ ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_WRITE = 1 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_WRITE ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_REFERENCES = 2 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_REFERENCES ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_ACCESS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_MISS = 1 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_MISS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_CPU_CYCLES = 0 +pkg runtime (linux-amd64), const PERF_COUNT_HW_CPU_CYCLES ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_INSTRUCTIONS = 1 +pkg runtime (linux-amd64), const PERF_COUNT_HW_INSTRUCTIONS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_REF_CPU_CYCLES = 9 +pkg runtime (linux-amd64), const PERF_COUNT_HW_REF_CPU_CYCLES ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8 +pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7 +pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_ALIGNMENT_FAULTS = 7 +pkg runtime (linux-amd64), const PERF_COUNT_SW_ALIGNMENT_FAULTS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_BPF_OUTPUT = 10 +pkg runtime (linux-amd64), const PERF_COUNT_SW_BPF_OUTPUT ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_CONTEXT_SWITCHES = 3 +pkg runtime (linux-amd64), const PERF_COUNT_SW_CONTEXT_SWITCHES ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_CLOCK = 0 +pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_CLOCK ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_MIGRATIONS = 4 +pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_MIGRATIONS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_DUMMY = 9 +pkg runtime (linux-amd64), const PERF_COUNT_SW_DUMMY ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_EMULATION_FAULTS = 8 +pkg runtime (linux-amd64), const PERF_COUNT_SW_EMULATION_FAULTS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS = 2 +pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6 +pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MAJ ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MIN = 5 +pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MIN ideal-int +pkg runtime (linux-amd64), const PERF_COUNT_SW_TASK_CLOCK = 1 +pkg runtime (linux-amd64), const PERF_COUNT_SW_TASK_CLOCK ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_DISABLE = 9217 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_DISABLE ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_ENABLE = 9216 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_ENABLE ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_ID = 2148017159 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_ID ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 1074275339 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_PAUSE_OUTPUT = 1074013193 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_PAUSE_OUTPUT ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_PERIOD = 1074275332 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_PERIOD ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_QUERY_BPF = 3221758986 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_QUERY_BPF ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_REFRESH = 9218 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_REFRESH ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_RESET = 9219 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_RESET ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_BPF = 1074013192 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_BPF ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_FILTER = 1074275334 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_FILTER ideal-int +pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_OUTPUT = 9221 +pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_OUTPUT ideal-int +pkg runtime (linux-amd64), const PERF_FLAG_FD_CLOEXEC = 8 +pkg runtime (linux-amd64), const PERF_FLAG_FD_CLOEXEC ideal-int +pkg runtime (linux-amd64), const PERF_FLAG_FD_NO_GROUP = 1 +pkg runtime (linux-amd64), const PERF_FLAG_FD_NO_GROUP ideal-int +pkg runtime (linux-amd64), const PERF_FLAG_FD_OUTPUT = 2 +pkg runtime (linux-amd64), const PERF_FLAG_FD_OUTPUT ideal-int +pkg runtime (linux-amd64), const PERF_FLAG_PID_CGROUP = 4 +pkg runtime (linux-amd64), const PERF_FLAG_PID_CGROUP ideal-int +pkg runtime (linux-amd64), const PERF_FORMAT_GROUP = 8 +pkg runtime (linux-amd64), const PERF_FORMAT_GROUP ideal-int +pkg runtime (linux-amd64), const PERF_FORMAT_ID = 4 +pkg runtime (linux-amd64), const PERF_FORMAT_ID ideal-int +pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_ENABLED = 1 +pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_ENABLED ideal-int +pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_RUNNING = 2 +pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_RUNNING ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_AUX = 11 +pkg runtime (linux-amd64), const PERF_RECORD_AUX ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_COMM = 3 +pkg runtime (linux-amd64), const PERF_RECORD_COMM ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_EXIT = 4 +pkg runtime (linux-amd64), const PERF_RECORD_EXIT ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_FORK = 7 +pkg runtime (linux-amd64), const PERF_RECORD_FORK ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_ITRACE_START = 12 +pkg runtime (linux-amd64), const PERF_RECORD_ITRACE_START ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_LOST = 2 +pkg runtime (linux-amd64), const PERF_RECORD_LOST ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_LOST_SAMPLES = 13 +pkg runtime (linux-amd64), const PERF_RECORD_LOST_SAMPLES ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_MMAP = 1 +pkg runtime (linux-amd64), const PERF_RECORD_MMAP ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_MMAP2 = 10 +pkg runtime (linux-amd64), const PERF_RECORD_MMAP2 ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_NAMESPACES = 16 +pkg runtime (linux-amd64), const PERF_RECORD_NAMESPACES ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_READ = 8 +pkg runtime (linux-amd64), const PERF_RECORD_READ ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_SAMPLE = 9 +pkg runtime (linux-amd64), const PERF_RECORD_SAMPLE ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_SWITCH = 14 +pkg runtime (linux-amd64), const PERF_RECORD_SWITCH ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_SWITCH_CPU_WIDE = 15 +pkg runtime (linux-amd64), const PERF_RECORD_SWITCH_CPU_WIDE ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_THROTTLE = 5 +pkg runtime (linux-amd64), const PERF_RECORD_THROTTLE ideal-int +pkg runtime (linux-amd64), const PERF_RECORD_UNTHROTTLE = 6 +pkg runtime (linux-amd64), const PERF_RECORD_UNTHROTTLE ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_ADDR = 8 +pkg runtime (linux-amd64), const PERF_SAMPLE_ADDR ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ABORT_TX = 128 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ABORT_TX ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY = 8 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_CALL = 16 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_CALL ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_RETURN = 32 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_RETURN ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL = 8192 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL_STACK = 2048 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL_STACK ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_COND = 1024 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_COND ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_HV = 4 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_HV ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_CALL = 64 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_CALL ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_JUMP = 4096 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_JUMP ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IN_TX = 256 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IN_TX ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_KERNEL = 2 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_KERNEL ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_CYCLES = 32768 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_CYCLES ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_FLAGS = 16384 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_FLAGS ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_TX = 512 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_TX ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_STACK = 2048 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_STACK ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_TYPE_SAVE = 65536 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_TYPE_SAVE ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_USER = 1 +pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_USER ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_CALLCHAIN = 32 +pkg runtime (linux-amd64), const PERF_SAMPLE_CALLCHAIN ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_CPU = 128 +pkg runtime (linux-amd64), const PERF_SAMPLE_CPU ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_ID = 64 +pkg runtime (linux-amd64), const PERF_SAMPLE_ID ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_IP = 1 +pkg runtime (linux-amd64), const PERF_SAMPLE_IP ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_PERIOD = 256 +pkg runtime (linux-amd64), const PERF_SAMPLE_PERIOD ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_RAW = 1024 +pkg runtime (linux-amd64), const PERF_SAMPLE_RAW ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_READ = 16 +pkg runtime (linux-amd64), const PERF_SAMPLE_READ ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_STREAM_ID = 512 +pkg runtime (linux-amd64), const PERF_SAMPLE_STREAM_ID ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_TID = 2 +pkg runtime (linux-amd64), const PERF_SAMPLE_TID ideal-int +pkg runtime (linux-amd64), const PERF_SAMPLE_TIME = 4 +pkg runtime (linux-amd64), const PERF_SAMPLE_TIME ideal-int +pkg runtime (linux-amd64), const PERF_TYPE_BREAKPOINT = 5 +pkg runtime (linux-amd64), const PERF_TYPE_BREAKPOINT ideal-int +pkg runtime (linux-amd64), const PERF_TYPE_HARDWARE = 0 +pkg runtime (linux-amd64), const PERF_TYPE_HARDWARE ideal-int +pkg runtime (linux-amd64), const PERF_TYPE_HW_CACHE = 3 +pkg runtime (linux-amd64), const PERF_TYPE_HW_CACHE ideal-int +pkg runtime (linux-amd64), const PERF_TYPE_RAW = 4 +pkg runtime (linux-amd64), const PERF_TYPE_RAW ideal-int +pkg runtime (linux-amd64), const PERF_TYPE_SOFTWARE = 1 +pkg runtime (linux-amd64), const PERF_TYPE_SOFTWARE ideal-int +pkg runtime (linux-amd64), const PERF_TYPE_TRACEPOINT = 2 +pkg runtime (linux-amd64), const PERF_TYPE_TRACEPOINT ideal-int +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST = -2048 +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST ideal-int +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_KERNEL = -2176 +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_KERNEL ideal-int +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_USER = -2560 +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_USER ideal-int +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_HV = -32 +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_HV ideal-int +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_KERNEL = -128 +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_KERNEL ideal-int +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_USER = -512 +pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_USER ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_MISSES = 5 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_MISSES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BUS_CYCLES = 6 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BUS_CYCLES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_BPU = 5 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_BPU ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_DTLB = 3 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_DTLB ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_ITLB = 4 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_ITLB ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1D = 0 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1D ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1I = 1 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1I ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_LL = 2 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_LL ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_MISSES = 3 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_MISSES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_NODE = 6 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_NODE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_PREFETCH = 2 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_PREFETCH ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_READ = 0 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_READ ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_WRITE = 1 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_WRITE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_REFERENCES = 2 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_REFERENCES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_ACCESS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_MISS = 1 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_MISS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CPU_CYCLES = 0 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CPU_CYCLES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_INSTRUCTIONS = 1 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_INSTRUCTIONS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_REF_CPU_CYCLES = 9 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_REF_CPU_CYCLES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_ALIGNMENT_FAULTS = 7 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_ALIGNMENT_FAULTS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_BPF_OUTPUT = 10 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_BPF_OUTPUT ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CONTEXT_SWITCHES = 3 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CONTEXT_SWITCHES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_CLOCK = 0 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_CLOCK ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_MIGRATIONS = 4 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_MIGRATIONS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_DUMMY = 9 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_DUMMY ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_EMULATION_FAULTS = 8 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_EMULATION_FAULTS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS = 2 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MAJ ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MIN = 5 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MIN ideal-int +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_TASK_CLOCK = 1 +pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_TASK_CLOCK ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_DISABLE = 9217 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_DISABLE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ENABLE = 9216 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ENABLE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ID = 2148017159 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ID ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 1074275339 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PAUSE_OUTPUT = 1074013193 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PAUSE_OUTPUT ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PERIOD = 1074275332 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PERIOD ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_QUERY_BPF = 3221758986 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_QUERY_BPF ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_REFRESH = 9218 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_REFRESH ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_RESET = 9219 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_RESET ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_BPF = 1074013192 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_BPF ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_FILTER = 1074275334 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_FILTER ideal-int +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_OUTPUT = 9221 +pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_OUTPUT ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_CLOEXEC = 8 +pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_CLOEXEC ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_NO_GROUP = 1 +pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_NO_GROUP ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_OUTPUT = 2 +pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_OUTPUT ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FLAG_PID_CGROUP = 4 +pkg runtime (linux-amd64-cgo), const PERF_FLAG_PID_CGROUP ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_GROUP = 8 +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_GROUP ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_ID = 4 +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_ID ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_ENABLED = 1 +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_ENABLED ideal-int +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_RUNNING = 2 +pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_RUNNING ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_AUX = 11 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_AUX ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_COMM = 3 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_COMM ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_EXIT = 4 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_EXIT ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_FORK = 7 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_FORK ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_ITRACE_START = 12 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_ITRACE_START ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST = 2 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST_SAMPLES = 13 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST_SAMPLES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP = 1 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP2 = 10 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP2 ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_NAMESPACES = 16 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_NAMESPACES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_READ = 8 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_READ ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_SAMPLE = 9 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_SAMPLE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH = 14 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH_CPU_WIDE = 15 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH_CPU_WIDE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_THROTTLE = 5 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_THROTTLE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_RECORD_UNTHROTTLE = 6 +pkg runtime (linux-amd64-cgo), const PERF_RECORD_UNTHROTTLE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ADDR = 8 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ADDR ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ABORT_TX = 128 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ABORT_TX ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY = 8 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_CALL = 16 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_CALL ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_RETURN = 32 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_RETURN ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL = 8192 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL_STACK = 2048 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL_STACK ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_COND = 1024 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_COND ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_HV = 4 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_HV ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_CALL = 64 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_CALL ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_JUMP = 4096 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_JUMP ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IN_TX = 256 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IN_TX ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_KERNEL = 2 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_KERNEL ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_CYCLES = 32768 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_CYCLES ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_FLAGS = 16384 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_FLAGS ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_TX = 512 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_TX ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_STACK = 2048 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_STACK ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_TYPE_SAVE = 65536 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_TYPE_SAVE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_USER = 1 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_USER ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CALLCHAIN = 32 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CALLCHAIN ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CPU = 128 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CPU ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ID = 64 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ID ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_IP = 1 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_IP ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_PERIOD = 256 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_PERIOD ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_RAW = 1024 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_RAW ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_READ = 16 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_READ ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_STREAM_ID = 512 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_STREAM_ID ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TID = 2 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TID ideal-int +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TIME = 4 +pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TIME ideal-int +pkg runtime (linux-amd64-cgo), const PERF_TYPE_BREAKPOINT = 5 +pkg runtime (linux-amd64-cgo), const PERF_TYPE_BREAKPOINT ideal-int +pkg runtime (linux-amd64-cgo), const PERF_TYPE_HARDWARE = 0 +pkg runtime (linux-amd64-cgo), const PERF_TYPE_HARDWARE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_TYPE_HW_CACHE = 3 +pkg runtime (linux-amd64-cgo), const PERF_TYPE_HW_CACHE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_TYPE_RAW = 4 +pkg runtime (linux-amd64-cgo), const PERF_TYPE_RAW ideal-int +pkg runtime (linux-amd64-cgo), const PERF_TYPE_SOFTWARE = 1 +pkg runtime (linux-amd64-cgo), const PERF_TYPE_SOFTWARE ideal-int +pkg runtime (linux-amd64-cgo), const PERF_TYPE_TRACEPOINT = 2 +pkg runtime (linux-amd64-cgo), const PERF_TYPE_TRACEPOINT ideal-int +pkg runtime, const GO_COUNT_HW_BRANCH_INSTRUCTIONS = 4 +pkg runtime, const GO_COUNT_HW_BRANCH_INSTRUCTIONS ideal-int +pkg runtime, const GO_COUNT_HW_BRANCH_MISSES = 5 +pkg runtime, const GO_COUNT_HW_BRANCH_MISSES ideal-int +pkg runtime, const GO_COUNT_HW_BUS_CYCLES = 6 +pkg runtime, const GO_COUNT_HW_BUS_CYCLES ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_BPU = 15 +pkg runtime, const GO_COUNT_HW_CACHE_BPU ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_DTLB = 13 +pkg runtime, const GO_COUNT_HW_CACHE_DTLB ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_ITLB = 14 +pkg runtime, const GO_COUNT_HW_CACHE_ITLB ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_L1D = 10 +pkg runtime, const GO_COUNT_HW_CACHE_L1D ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_L1I = 11 +pkg runtime, const GO_COUNT_HW_CACHE_L1I ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_LL = 12 +pkg runtime, const GO_COUNT_HW_CACHE_LL ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_MISSES = 3 +pkg runtime, const GO_COUNT_HW_CACHE_MISSES ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_NODE = 16 +pkg runtime, const GO_COUNT_HW_CACHE_NODE ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_OP_PREFETCH = 19 +pkg runtime, const GO_COUNT_HW_CACHE_OP_PREFETCH ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_OP_READ = 17 +pkg runtime, const GO_COUNT_HW_CACHE_OP_READ ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_OP_WRITE = 18 +pkg runtime, const GO_COUNT_HW_CACHE_OP_WRITE ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_REFERENCES = 2 +pkg runtime, const GO_COUNT_HW_CACHE_REFERENCES ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_RESULT_ACCESS = 20 +pkg runtime, const GO_COUNT_HW_CACHE_RESULT_ACCESS ideal-int +pkg runtime, const GO_COUNT_HW_CACHE_RESULT_MISS = 21 +pkg runtime, const GO_COUNT_HW_CACHE_RESULT_MISS ideal-int +pkg runtime, const GO_COUNT_HW_CPU_CYCLES = 0 +pkg runtime, const GO_COUNT_HW_CPU_CYCLES ideal-int +pkg runtime, const GO_COUNT_HW_INSTRUCTIONS = 1 +pkg runtime, const GO_COUNT_HW_INSTRUCTIONS ideal-int +pkg runtime, const GO_COUNT_HW_REF_CPU_CYCLES = 9 +pkg runtime, const GO_COUNT_HW_REF_CPU_CYCLES ideal-int +pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_BACKEND = 8 +pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_BACKEND ideal-int +pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_FRONTEND = 7 +pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_FRONTEND ideal-int +pkg runtime, const GO_COUNT_SW_CONTEXT_SWITCHES = 25 +pkg runtime, const GO_COUNT_SW_CONTEXT_SWITCHES ideal-int +pkg runtime, const GO_COUNT_SW_CPU_CLOCK = 22 +pkg runtime, const GO_COUNT_SW_CPU_CLOCK ideal-int +pkg runtime, const GO_COUNT_SW_PAGE_FAULTS = 24 +pkg runtime, const GO_COUNT_SW_PAGE_FAULTS ideal-int +pkg runtime, const GO_COUNT_SW_TASK_CLOCK = 23 +pkg runtime, const GO_COUNT_SW_TASK_CLOCK ideal-int +pkg runtime, func SetPMUProfile(int, *PMUEventAttr) +pkg runtime, type PMUEventAttr struct +pkg runtime, type PMUEventAttr struct, IsHvIncluded bool +pkg runtime, type PMUEventAttr struct, IsKernelIncluded bool +pkg runtime, type PMUEventAttr struct, Period uint64 +pkg runtime, type PMUEventAttr struct, PreciseIP uint8 +pkg runtime/pprof, func StartCPUProfile(io.Writer, ...int) error +pkg runtime/pprof, func StartPMUProfile(...ProfilingOption) error +pkg runtime/pprof, func StopPMUProfile() +pkg runtime/pprof, func WithProfilingCacheMiss(io.Writer, *PMUEventConfig) ProfilingOption +pkg runtime/pprof, func WithProfilingCacheRef(io.Writer, *PMUEventConfig) ProfilingOption +pkg runtime/pprof, func WithProfilingCycle(io.Writer, *PMUEventConfig) ProfilingOption +pkg runtime/pprof, func WithProfilingInstr(io.Writer, *PMUEventConfig) ProfilingOption +pkg runtime/pprof, type PMUEventConfig struct +pkg runtime/pprof, type PMUEventConfig struct, IsHvIncluded bool +pkg runtime/pprof, type PMUEventConfig struct, IsKernelIncluded bool +pkg runtime/pprof, type PMUEventConfig struct, Period int64 +pkg runtime/pprof, type PMUEventConfig struct, PreciseIP int8 +pkg runtime/pprof, type ProfilingOption interface, unexported methods +pkg crypto/tls, const Ed25519 = 2055 +pkg crypto/tls, const Ed25519 SignatureScheme +pkg crypto/x509, const Ed25519 = 4 +pkg crypto/x509, const Ed25519 PublicKeyAlgorithm +pkg crypto/x509, const PureEd25519 = 16 +pkg crypto/x509, const PureEd25519 SignatureAlgorithm +pkg go/types, func CheckExpr(*token.FileSet, *Package, token.Pos, ast.Expr, *Info) error From 6c5a609523eb3e84ebf9bf5f800fff580f9eaedf Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 15:56:54 -0700 Subject: [PATCH 049/126] API checks --- api/next.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/api/next.txt b/api/next.txt index fda6fdefed..9165e5cf45 100644 --- a/api/next.txt +++ b/api/next.txt @@ -8557,4 +8557,3 @@ pkg crypto/x509, const Ed25519 = 4 pkg crypto/x509, const Ed25519 PublicKeyAlgorithm pkg crypto/x509, const PureEd25519 = 16 pkg crypto/x509, const PureEd25519 SignatureAlgorithm -pkg go/types, func CheckExpr(*token.FileSet, *Package, token.Pos, ast.Expr, *Info) error From 4416dcfe574c6f1b7d75f804feff96e2a4964a23 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 16:03:44 -0700 Subject: [PATCH 050/126] minor --- src/runtime/defs_aix_ppc64.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/defs_aix_ppc64.go b/src/runtime/defs_aix_ppc64.go index 0836f82bcb..d284088d30 100644 --- a/src/runtime/defs_aix_ppc64.go +++ b/src/runtime/defs_aix_ppc64.go @@ -59,7 +59,7 @@ const ( _SIGTERM = 0xf _SIGEMT = 0x7 _SIGWAITING = 0x27 - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead + _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x14 _FPE_INTOVF = 0x15 From 9edf689fae856784134976e01ec49ee345bc86a9 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 16:08:45 -0700 Subject: [PATCH 051/126] API checks --- api/next.txt | 517 --------------------------------------------------- 1 file changed, 517 deletions(-) diff --git a/api/next.txt b/api/next.txt index 9165e5cf45..24c4daf1ad 100644 --- a/api/next.txt +++ b/api/next.txt @@ -8040,520 +8040,3 @@ pkg unicode, var Makasar *RangeTable pkg unicode, var Medefaidrin *RangeTable pkg unicode, var Old_Sogdian *RangeTable pkg unicode, var Sogdian *RangeTable -pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST = -2048 -pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST ideal-int -pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_KERNEL = -2176 -pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_KERNEL ideal-int -pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_USER = -2560 -pkg runtime (linux-amd64), const PERF_CONTEXT_GUEST_USER ideal-int -pkg runtime (linux-amd64), const PERF_CONTEXT_HV = -32 -pkg runtime (linux-amd64), const PERF_CONTEXT_HV ideal-int -pkg runtime (linux-amd64), const PERF_CONTEXT_KERNEL = -128 -pkg runtime (linux-amd64), const PERF_CONTEXT_KERNEL ideal-int -pkg runtime (linux-amd64), const PERF_CONTEXT_USER = -512 -pkg runtime (linux-amd64), const PERF_CONTEXT_USER ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4 -pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_MISSES = 5 -pkg runtime (linux-amd64), const PERF_COUNT_HW_BRANCH_MISSES ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_BUS_CYCLES = 6 -pkg runtime (linux-amd64), const PERF_COUNT_HW_BUS_CYCLES ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_BPU = 5 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_BPU ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_DTLB = 3 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_DTLB ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_ITLB = 4 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_ITLB ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1D = 0 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1D ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1I = 1 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_L1I ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_LL = 2 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_LL ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_MISSES = 3 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_MISSES ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_NODE = 6 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_NODE ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_PREFETCH = 2 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_PREFETCH ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_READ = 0 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_READ ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_WRITE = 1 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_OP_WRITE ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_REFERENCES = 2 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_REFERENCES ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_ACCESS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_MISS = 1 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CACHE_RESULT_MISS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_CPU_CYCLES = 0 -pkg runtime (linux-amd64), const PERF_COUNT_HW_CPU_CYCLES ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_INSTRUCTIONS = 1 -pkg runtime (linux-amd64), const PERF_COUNT_HW_INSTRUCTIONS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_REF_CPU_CYCLES = 9 -pkg runtime (linux-amd64), const PERF_COUNT_HW_REF_CPU_CYCLES ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8 -pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7 -pkg runtime (linux-amd64), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_ALIGNMENT_FAULTS = 7 -pkg runtime (linux-amd64), const PERF_COUNT_SW_ALIGNMENT_FAULTS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_BPF_OUTPUT = 10 -pkg runtime (linux-amd64), const PERF_COUNT_SW_BPF_OUTPUT ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_CONTEXT_SWITCHES = 3 -pkg runtime (linux-amd64), const PERF_COUNT_SW_CONTEXT_SWITCHES ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_CLOCK = 0 -pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_CLOCK ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_MIGRATIONS = 4 -pkg runtime (linux-amd64), const PERF_COUNT_SW_CPU_MIGRATIONS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_DUMMY = 9 -pkg runtime (linux-amd64), const PERF_COUNT_SW_DUMMY ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_EMULATION_FAULTS = 8 -pkg runtime (linux-amd64), const PERF_COUNT_SW_EMULATION_FAULTS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS = 2 -pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6 -pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MAJ ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MIN = 5 -pkg runtime (linux-amd64), const PERF_COUNT_SW_PAGE_FAULTS_MIN ideal-int -pkg runtime (linux-amd64), const PERF_COUNT_SW_TASK_CLOCK = 1 -pkg runtime (linux-amd64), const PERF_COUNT_SW_TASK_CLOCK ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_DISABLE = 9217 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_DISABLE ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_ENABLE = 9216 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_ENABLE ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_ID = 2148017159 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_ID ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 1074275339 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_PAUSE_OUTPUT = 1074013193 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_PAUSE_OUTPUT ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_PERIOD = 1074275332 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_PERIOD ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_QUERY_BPF = 3221758986 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_QUERY_BPF ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_REFRESH = 9218 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_REFRESH ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_RESET = 9219 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_RESET ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_BPF = 1074013192 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_BPF ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_FILTER = 1074275334 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_FILTER ideal-int -pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_OUTPUT = 9221 -pkg runtime (linux-amd64), const PERF_EVENT_IOC_SET_OUTPUT ideal-int -pkg runtime (linux-amd64), const PERF_FLAG_FD_CLOEXEC = 8 -pkg runtime (linux-amd64), const PERF_FLAG_FD_CLOEXEC ideal-int -pkg runtime (linux-amd64), const PERF_FLAG_FD_NO_GROUP = 1 -pkg runtime (linux-amd64), const PERF_FLAG_FD_NO_GROUP ideal-int -pkg runtime (linux-amd64), const PERF_FLAG_FD_OUTPUT = 2 -pkg runtime (linux-amd64), const PERF_FLAG_FD_OUTPUT ideal-int -pkg runtime (linux-amd64), const PERF_FLAG_PID_CGROUP = 4 -pkg runtime (linux-amd64), const PERF_FLAG_PID_CGROUP ideal-int -pkg runtime (linux-amd64), const PERF_FORMAT_GROUP = 8 -pkg runtime (linux-amd64), const PERF_FORMAT_GROUP ideal-int -pkg runtime (linux-amd64), const PERF_FORMAT_ID = 4 -pkg runtime (linux-amd64), const PERF_FORMAT_ID ideal-int -pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_ENABLED = 1 -pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_ENABLED ideal-int -pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_RUNNING = 2 -pkg runtime (linux-amd64), const PERF_FORMAT_TOTAL_TIME_RUNNING ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_AUX = 11 -pkg runtime (linux-amd64), const PERF_RECORD_AUX ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_COMM = 3 -pkg runtime (linux-amd64), const PERF_RECORD_COMM ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_EXIT = 4 -pkg runtime (linux-amd64), const PERF_RECORD_EXIT ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_FORK = 7 -pkg runtime (linux-amd64), const PERF_RECORD_FORK ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_ITRACE_START = 12 -pkg runtime (linux-amd64), const PERF_RECORD_ITRACE_START ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_LOST = 2 -pkg runtime (linux-amd64), const PERF_RECORD_LOST ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_LOST_SAMPLES = 13 -pkg runtime (linux-amd64), const PERF_RECORD_LOST_SAMPLES ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_MMAP = 1 -pkg runtime (linux-amd64), const PERF_RECORD_MMAP ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_MMAP2 = 10 -pkg runtime (linux-amd64), const PERF_RECORD_MMAP2 ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_NAMESPACES = 16 -pkg runtime (linux-amd64), const PERF_RECORD_NAMESPACES ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_READ = 8 -pkg runtime (linux-amd64), const PERF_RECORD_READ ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_SAMPLE = 9 -pkg runtime (linux-amd64), const PERF_RECORD_SAMPLE ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_SWITCH = 14 -pkg runtime (linux-amd64), const PERF_RECORD_SWITCH ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_SWITCH_CPU_WIDE = 15 -pkg runtime (linux-amd64), const PERF_RECORD_SWITCH_CPU_WIDE ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_THROTTLE = 5 -pkg runtime (linux-amd64), const PERF_RECORD_THROTTLE ideal-int -pkg runtime (linux-amd64), const PERF_RECORD_UNTHROTTLE = 6 -pkg runtime (linux-amd64), const PERF_RECORD_UNTHROTTLE ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_ADDR = 8 -pkg runtime (linux-amd64), const PERF_SAMPLE_ADDR ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ABORT_TX = 128 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ABORT_TX ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY = 8 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_CALL = 16 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_CALL ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_RETURN = 32 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_ANY_RETURN ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL = 8192 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL_STACK = 2048 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_CALL_STACK ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_COND = 1024 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_COND ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_HV = 4 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_HV ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_CALL = 64 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_CALL ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_JUMP = 4096 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IND_JUMP ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IN_TX = 256 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_IN_TX ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_KERNEL = 2 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_KERNEL ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_CYCLES = 32768 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_CYCLES ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_FLAGS = 16384 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_FLAGS ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_TX = 512 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_NO_TX ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_STACK = 2048 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_STACK ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_TYPE_SAVE = 65536 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_TYPE_SAVE ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_USER = 1 -pkg runtime (linux-amd64), const PERF_SAMPLE_BRANCH_USER ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_CALLCHAIN = 32 -pkg runtime (linux-amd64), const PERF_SAMPLE_CALLCHAIN ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_CPU = 128 -pkg runtime (linux-amd64), const PERF_SAMPLE_CPU ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_ID = 64 -pkg runtime (linux-amd64), const PERF_SAMPLE_ID ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_IP = 1 -pkg runtime (linux-amd64), const PERF_SAMPLE_IP ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_PERIOD = 256 -pkg runtime (linux-amd64), const PERF_SAMPLE_PERIOD ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_RAW = 1024 -pkg runtime (linux-amd64), const PERF_SAMPLE_RAW ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_READ = 16 -pkg runtime (linux-amd64), const PERF_SAMPLE_READ ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_STREAM_ID = 512 -pkg runtime (linux-amd64), const PERF_SAMPLE_STREAM_ID ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_TID = 2 -pkg runtime (linux-amd64), const PERF_SAMPLE_TID ideal-int -pkg runtime (linux-amd64), const PERF_SAMPLE_TIME = 4 -pkg runtime (linux-amd64), const PERF_SAMPLE_TIME ideal-int -pkg runtime (linux-amd64), const PERF_TYPE_BREAKPOINT = 5 -pkg runtime (linux-amd64), const PERF_TYPE_BREAKPOINT ideal-int -pkg runtime (linux-amd64), const PERF_TYPE_HARDWARE = 0 -pkg runtime (linux-amd64), const PERF_TYPE_HARDWARE ideal-int -pkg runtime (linux-amd64), const PERF_TYPE_HW_CACHE = 3 -pkg runtime (linux-amd64), const PERF_TYPE_HW_CACHE ideal-int -pkg runtime (linux-amd64), const PERF_TYPE_RAW = 4 -pkg runtime (linux-amd64), const PERF_TYPE_RAW ideal-int -pkg runtime (linux-amd64), const PERF_TYPE_SOFTWARE = 1 -pkg runtime (linux-amd64), const PERF_TYPE_SOFTWARE ideal-int -pkg runtime (linux-amd64), const PERF_TYPE_TRACEPOINT = 2 -pkg runtime (linux-amd64), const PERF_TYPE_TRACEPOINT ideal-int -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST = -2048 -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST ideal-int -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_KERNEL = -2176 -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_KERNEL ideal-int -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_USER = -2560 -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_GUEST_USER ideal-int -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_HV = -32 -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_HV ideal-int -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_KERNEL = -128 -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_KERNEL ideal-int -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_USER = -512 -pkg runtime (linux-amd64-cgo), const PERF_CONTEXT_USER ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_INSTRUCTIONS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_MISSES = 5 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BRANCH_MISSES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BUS_CYCLES = 6 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_BUS_CYCLES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_BPU = 5 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_BPU ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_DTLB = 3 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_DTLB ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_ITLB = 4 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_ITLB ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1D = 0 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1D ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1I = 1 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_L1I ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_LL = 2 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_LL ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_MISSES = 3 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_MISSES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_NODE = 6 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_NODE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_PREFETCH = 2 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_PREFETCH ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_READ = 0 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_READ ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_WRITE = 1 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_OP_WRITE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_REFERENCES = 2 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_REFERENCES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_ACCESS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_MISS = 1 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CACHE_RESULT_MISS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CPU_CYCLES = 0 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_CPU_CYCLES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_INSTRUCTIONS = 1 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_INSTRUCTIONS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_REF_CPU_CYCLES = 9 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_REF_CPU_CYCLES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_BACKEND ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_HW_STALLED_CYCLES_FRONTEND ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_ALIGNMENT_FAULTS = 7 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_ALIGNMENT_FAULTS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_BPF_OUTPUT = 10 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_BPF_OUTPUT ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CONTEXT_SWITCHES = 3 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CONTEXT_SWITCHES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_CLOCK = 0 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_CLOCK ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_MIGRATIONS = 4 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_CPU_MIGRATIONS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_DUMMY = 9 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_DUMMY ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_EMULATION_FAULTS = 8 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_EMULATION_FAULTS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS = 2 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MAJ ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MIN = 5 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_PAGE_FAULTS_MIN ideal-int -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_TASK_CLOCK = 1 -pkg runtime (linux-amd64-cgo), const PERF_COUNT_SW_TASK_CLOCK ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_DISABLE = 9217 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_DISABLE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ENABLE = 9216 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ENABLE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ID = 2148017159 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_ID ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 1074275339 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_MODIFY_ATTRIBUTES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PAUSE_OUTPUT = 1074013193 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PAUSE_OUTPUT ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PERIOD = 1074275332 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_PERIOD ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_QUERY_BPF = 3221758986 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_QUERY_BPF ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_REFRESH = 9218 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_REFRESH ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_RESET = 9219 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_RESET ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_BPF = 1074013192 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_BPF ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_FILTER = 1074275334 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_FILTER ideal-int -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_OUTPUT = 9221 -pkg runtime (linux-amd64-cgo), const PERF_EVENT_IOC_SET_OUTPUT ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_CLOEXEC = 8 -pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_CLOEXEC ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_NO_GROUP = 1 -pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_NO_GROUP ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_OUTPUT = 2 -pkg runtime (linux-amd64-cgo), const PERF_FLAG_FD_OUTPUT ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FLAG_PID_CGROUP = 4 -pkg runtime (linux-amd64-cgo), const PERF_FLAG_PID_CGROUP ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_GROUP = 8 -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_GROUP ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_ID = 4 -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_ID ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_ENABLED = 1 -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_ENABLED ideal-int -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_RUNNING = 2 -pkg runtime (linux-amd64-cgo), const PERF_FORMAT_TOTAL_TIME_RUNNING ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_AUX = 11 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_AUX ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_COMM = 3 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_COMM ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_EXIT = 4 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_EXIT ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_FORK = 7 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_FORK ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_ITRACE_START = 12 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_ITRACE_START ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST = 2 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST_SAMPLES = 13 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_LOST_SAMPLES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP = 1 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP2 = 10 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_MMAP2 ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_NAMESPACES = 16 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_NAMESPACES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_READ = 8 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_READ ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_SAMPLE = 9 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_SAMPLE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH = 14 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH_CPU_WIDE = 15 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_SWITCH_CPU_WIDE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_THROTTLE = 5 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_THROTTLE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_RECORD_UNTHROTTLE = 6 -pkg runtime (linux-amd64-cgo), const PERF_RECORD_UNTHROTTLE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ADDR = 8 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ADDR ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ABORT_TX = 128 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ABORT_TX ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY = 8 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_CALL = 16 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_CALL ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_RETURN = 32 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_ANY_RETURN ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL = 8192 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL_STACK = 2048 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_CALL_STACK ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_COND = 1024 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_COND ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_HV = 4 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_HV ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_CALL = 64 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_CALL ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_JUMP = 4096 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IND_JUMP ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IN_TX = 256 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_IN_TX ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_KERNEL = 2 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_KERNEL ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_CYCLES = 32768 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_CYCLES ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_FLAGS = 16384 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_FLAGS ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_TX = 512 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_NO_TX ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_STACK = 2048 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_STACK ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_TYPE_SAVE = 65536 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_TYPE_SAVE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_USER = 1 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_BRANCH_USER ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CALLCHAIN = 32 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CALLCHAIN ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CPU = 128 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_CPU ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ID = 64 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_ID ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_IP = 1 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_IP ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_PERIOD = 256 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_PERIOD ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_RAW = 1024 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_RAW ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_READ = 16 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_READ ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_STREAM_ID = 512 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_STREAM_ID ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TID = 2 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TID ideal-int -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TIME = 4 -pkg runtime (linux-amd64-cgo), const PERF_SAMPLE_TIME ideal-int -pkg runtime (linux-amd64-cgo), const PERF_TYPE_BREAKPOINT = 5 -pkg runtime (linux-amd64-cgo), const PERF_TYPE_BREAKPOINT ideal-int -pkg runtime (linux-amd64-cgo), const PERF_TYPE_HARDWARE = 0 -pkg runtime (linux-amd64-cgo), const PERF_TYPE_HARDWARE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_TYPE_HW_CACHE = 3 -pkg runtime (linux-amd64-cgo), const PERF_TYPE_HW_CACHE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_TYPE_RAW = 4 -pkg runtime (linux-amd64-cgo), const PERF_TYPE_RAW ideal-int -pkg runtime (linux-amd64-cgo), const PERF_TYPE_SOFTWARE = 1 -pkg runtime (linux-amd64-cgo), const PERF_TYPE_SOFTWARE ideal-int -pkg runtime (linux-amd64-cgo), const PERF_TYPE_TRACEPOINT = 2 -pkg runtime (linux-amd64-cgo), const PERF_TYPE_TRACEPOINT ideal-int -pkg runtime, const GO_COUNT_HW_BRANCH_INSTRUCTIONS = 4 -pkg runtime, const GO_COUNT_HW_BRANCH_INSTRUCTIONS ideal-int -pkg runtime, const GO_COUNT_HW_BRANCH_MISSES = 5 -pkg runtime, const GO_COUNT_HW_BRANCH_MISSES ideal-int -pkg runtime, const GO_COUNT_HW_BUS_CYCLES = 6 -pkg runtime, const GO_COUNT_HW_BUS_CYCLES ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_BPU = 15 -pkg runtime, const GO_COUNT_HW_CACHE_BPU ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_DTLB = 13 -pkg runtime, const GO_COUNT_HW_CACHE_DTLB ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_ITLB = 14 -pkg runtime, const GO_COUNT_HW_CACHE_ITLB ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_L1D = 10 -pkg runtime, const GO_COUNT_HW_CACHE_L1D ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_L1I = 11 -pkg runtime, const GO_COUNT_HW_CACHE_L1I ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_LL = 12 -pkg runtime, const GO_COUNT_HW_CACHE_LL ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_MISSES = 3 -pkg runtime, const GO_COUNT_HW_CACHE_MISSES ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_NODE = 16 -pkg runtime, const GO_COUNT_HW_CACHE_NODE ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_OP_PREFETCH = 19 -pkg runtime, const GO_COUNT_HW_CACHE_OP_PREFETCH ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_OP_READ = 17 -pkg runtime, const GO_COUNT_HW_CACHE_OP_READ ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_OP_WRITE = 18 -pkg runtime, const GO_COUNT_HW_CACHE_OP_WRITE ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_REFERENCES = 2 -pkg runtime, const GO_COUNT_HW_CACHE_REFERENCES ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_RESULT_ACCESS = 20 -pkg runtime, const GO_COUNT_HW_CACHE_RESULT_ACCESS ideal-int -pkg runtime, const GO_COUNT_HW_CACHE_RESULT_MISS = 21 -pkg runtime, const GO_COUNT_HW_CACHE_RESULT_MISS ideal-int -pkg runtime, const GO_COUNT_HW_CPU_CYCLES = 0 -pkg runtime, const GO_COUNT_HW_CPU_CYCLES ideal-int -pkg runtime, const GO_COUNT_HW_INSTRUCTIONS = 1 -pkg runtime, const GO_COUNT_HW_INSTRUCTIONS ideal-int -pkg runtime, const GO_COUNT_HW_REF_CPU_CYCLES = 9 -pkg runtime, const GO_COUNT_HW_REF_CPU_CYCLES ideal-int -pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_BACKEND = 8 -pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_BACKEND ideal-int -pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_FRONTEND = 7 -pkg runtime, const GO_COUNT_HW_STALLED_CYCLES_FRONTEND ideal-int -pkg runtime, const GO_COUNT_SW_CONTEXT_SWITCHES = 25 -pkg runtime, const GO_COUNT_SW_CONTEXT_SWITCHES ideal-int -pkg runtime, const GO_COUNT_SW_CPU_CLOCK = 22 -pkg runtime, const GO_COUNT_SW_CPU_CLOCK ideal-int -pkg runtime, const GO_COUNT_SW_PAGE_FAULTS = 24 -pkg runtime, const GO_COUNT_SW_PAGE_FAULTS ideal-int -pkg runtime, const GO_COUNT_SW_TASK_CLOCK = 23 -pkg runtime, const GO_COUNT_SW_TASK_CLOCK ideal-int -pkg runtime, func SetPMUProfile(int, *PMUEventAttr) -pkg runtime, type PMUEventAttr struct -pkg runtime, type PMUEventAttr struct, IsHvIncluded bool -pkg runtime, type PMUEventAttr struct, IsKernelIncluded bool -pkg runtime, type PMUEventAttr struct, Period uint64 -pkg runtime, type PMUEventAttr struct, PreciseIP uint8 -pkg runtime/pprof, func StartCPUProfile(io.Writer, ...int) error -pkg runtime/pprof, func StartPMUProfile(...ProfilingOption) error -pkg runtime/pprof, func StopPMUProfile() -pkg runtime/pprof, func WithProfilingCacheMiss(io.Writer, *PMUEventConfig) ProfilingOption -pkg runtime/pprof, func WithProfilingCacheRef(io.Writer, *PMUEventConfig) ProfilingOption -pkg runtime/pprof, func WithProfilingCycle(io.Writer, *PMUEventConfig) ProfilingOption -pkg runtime/pprof, func WithProfilingInstr(io.Writer, *PMUEventConfig) ProfilingOption -pkg runtime/pprof, type PMUEventConfig struct -pkg runtime/pprof, type PMUEventConfig struct, IsHvIncluded bool -pkg runtime/pprof, type PMUEventConfig struct, IsKernelIncluded bool -pkg runtime/pprof, type PMUEventConfig struct, Period int64 -pkg runtime/pprof, type PMUEventConfig struct, PreciseIP int8 -pkg runtime/pprof, type ProfilingOption interface, unexported methods -pkg crypto/tls, const Ed25519 = 2055 -pkg crypto/tls, const Ed25519 SignatureScheme -pkg crypto/x509, const Ed25519 = 4 -pkg crypto/x509, const Ed25519 PublicKeyAlgorithm -pkg crypto/x509, const PureEd25519 = 16 -pkg crypto/x509, const PureEd25519 SignatureAlgorithm From baa16946ca2ff355f44847005e211b78d059f5b8 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 17:00:19 -0700 Subject: [PATCH 052/126] test cases for http --- test/pmu/http/test1.go | 25 ++++++++++++++++++++ test/pmu/http/test2.go | 52 ++++++++++++++++++++++++++++++++++++++++++ test/pmu/http/test3.go | 49 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 test/pmu/http/test1.go create mode 100644 test/pmu/http/test2.go create mode 100644 test/pmu/http/test3.go diff --git a/test/pmu/http/test1.go b/test/pmu/http/test1.go new file mode 100644 index 0000000000..6cfe39e45d --- /dev/null +++ b/test/pmu/http/test1.go @@ -0,0 +1,25 @@ +// run +// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 + +package main + +import ( + "fmt" + "log" + // "time" + "net/http" + _ "net/http/pprof" +) + +var sum int + +func main() { + go func() { + log.Println(http.ListenAndServe("localhost:6060", nil)) + }() + // time.Sleep(2 * time.Second) + for i := 0; i <= 10000000000; i++ { + sum += i + } + fmt.Println(sum) +} diff --git a/test/pmu/http/test2.go b/test/pmu/http/test2.go new file mode 100644 index 0000000000..47d52e20ba --- /dev/null +++ b/test/pmu/http/test2.go @@ -0,0 +1,52 @@ +// run +// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 + +package main + +import ( + "fmt" + "log" + "sync" + // "time" + "net/http" + _ "net/http/pprof" +) + +var wg sync.WaitGroup +var mux sync.Mutex +var sum int + +func f(i int) { + defer wg.Done() + var local int + for j := i; j < 100000000; j++ { + local -= j / 2 + local *= j + mux.Lock() + sum += local + mux.Unlock() + } +} + +func run() error { + go func() { + log.Println(http.ListenAndServe("localhost:6060", nil)) + }() + + wg.Add(1000) + defer wg.Wait() + + for i := 0; i < 1000; i++ { + go f(i) + } + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } + + fmt.Println(sum) +} diff --git a/test/pmu/http/test3.go b/test/pmu/http/test3.go new file mode 100644 index 0000000000..ed9af94112 --- /dev/null +++ b/test/pmu/http/test3.go @@ -0,0 +1,49 @@ +// run +// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 + +package main + +import ( + "fmt" + "log" + "sync" + "time" + "net/http" + _ "net/http/pprof" +) + +var wg sync.WaitGroup +var mux sync.Mutex +var sum int + +func f(i int) { + defer wg.Done() + for j := i; j < 100000000; j++ { + sum -= j / 2 + sum *= j + time.Sleep(time.Microsecond) + } +} + +func run() error { + go func() { + log.Println(http.ListenAndServe("localhost:6060", nil)) + }() + + wg.Add(1000) + defer wg.Wait() + + for i := 0; i < 1000; i++ { + go f(i) + } + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } + + fmt.Println(sum) +} From d490da697b51bf4e33ba8b42f66ce243aa5c132e Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 17:02:15 -0700 Subject: [PATCH 053/126] indention --- test/pmu/http/test2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pmu/http/test2.go b/test/pmu/http/test2.go index 47d52e20ba..3b09b9ea1e 100644 --- a/test/pmu/http/test2.go +++ b/test/pmu/http/test2.go @@ -48,5 +48,5 @@ func main() { log.Fatal(err) } - fmt.Println(sum) + fmt.Println(sum) } From 0e744a872c503ce10ac6f577a147770e327147b4 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 19:51:43 -0700 Subject: [PATCH 054/126] minor --- src/runtime/defs_linux_amd64.go | 13 +++++++------ src/runtime/pprof/pprof.go | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 48649d153c..90b48d89d1 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -418,11 +418,12 @@ type fOwnerEx struct { } var perfEventOpt = []struct { - Type uint32 - Config uint64 + Type uint32 // type of event + Config uint64 // event } { - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES + // TODO: add more perf events } diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 2a0bb4b913..2d604235ee 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -838,7 +838,7 @@ func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio eventConfig.Period = 300 } - helper(w, eventConfig, /*event ID*/ 0, /*event Name*/ "cycles") + helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_CPU_CYCLES, /*event Name*/ "cycles") return nil }) } @@ -853,7 +853,7 @@ func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio eventConfig.Period = 300 } - helper(w, eventConfig, /*event ID*/ 1, /*event Name*/ "instructions") + helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_INSTRUCTIONS, /*event Name*/ "instructions") return nil }) } @@ -865,7 +865,7 @@ func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOp } // TODO: Clamp period to something reasonable - helper(w, eventConfig, /*event ID*/ 2, /*event Name*/ "cache references") + helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_CACHE_REFERENCES, /*event Name*/ "cache references") return nil }) } @@ -877,7 +877,7 @@ func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingO } // TODO: Clamp period to something reasonable - helper(w, eventConfig, /*event ID*/ 3, /*event Name*/ "cache misses") + helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_CACHE_MISSES, /*event Name*/ "cache misses") return nil }) } From 0758f5690cb41da387619520fd43dd7ab958ce85 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 10 Jul 2019 20:24:37 -0700 Subject: [PATCH 055/126] minor --- src/runtime/os_darwin.go | 6 +++--- src/runtime/os_linux_386.go | 6 +++--- src/runtime/os_linux_amd64.go | 12 ++++++------ src/runtime/pprof/pprof.go | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index e11d8f8c6b..c9b6335f54 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -356,8 +356,8 @@ func sysargs(argc int32, argv **byte) { } } -func setProcessPMUProfiler(arg ...interface{}) {/*TODO: implementation*/} -func setThreadPMUProfiler(arg ...interface{}) {/*TODO: implementation*/} +func setProcessPMUProfiler(arg ...interface{}) {/* TODO: implementation */} +func setThreadPMUProfiler(arg ...interface{}) {/* TODO: implementation */} //go:nowritebarrierrec -func sigpmuhandler(arg ...interface{}) {/*TODO: implementation*/} +func sigpmuhandler(arg ...interface{}) {/* TODO: implementation */} diff --git a/src/runtime/os_linux_386.go b/src/runtime/os_linux_386.go index 7f37fbbb61..35076520c2 100644 --- a/src/runtime/os_linux_386.go +++ b/src/runtime/os_linux_386.go @@ -4,8 +4,8 @@ package runtime -func setProcessPMUProfiler(arg ...interface{}) /*TODO: implementation*/{} -func setThreadPMUProfiler(arg ...interface{}) {/*TODO: implementation*/} +func setProcessPMUProfiler(arg ...interface{}) {/* TODO: implementation */} +func setThreadPMUProfiler(arg ...interface{}) {/* TODO: implementation */} //go:nowritebarrierrec -func sigpmuhandler(arg ...interface{}) {/*TODO: implementation*/} +func sigpmuhandler(arg ...interface{}) {/* TODO: implementation */} diff --git a/src/runtime/os_linux_amd64.go b/src/runtime/os_linux_amd64.go index f3db7b3297..ada25b30fb 100644 --- a/src/runtime/os_linux_amd64.go +++ b/src/runtime/os_linux_amd64.go @@ -59,13 +59,13 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { perfAttr.Bits += 0b1000000 } - fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy*/ 0) + fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) _g_.m.eventFds[eventId] = fd - r, _ := fcntl(fd, /*F_GETFL*/ 0x3, 0) - fcntl(fd, /*F_SETFL*/ 0x4, r | /*O_ASYNC*/ 0x2000) - fcntl(fd, /*F_SETSIG*/ 0xa, _SIGPMU) - fOwnEx := fOwnerEx{/*F_OWNER_TID*/ 0, int32(gettid())} - fcntl2(fd, /*F_SETOWN_EX*/ 0xf, &fOwnEx) + r, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) + fcntl(fd, /* F_SETFL */ 0x4, r | /* O_ASYNC */ 0x2000) + fcntl(fd, /* F_SETSIG */ 0xa, _SIGPMU) + fOwnEx := fOwnerEx{/* F_OWNER_TID */ 0, int32(gettid())} + fcntl2(fd, /* F_SETOWN_EX */ 0xf, &fOwnEx) } _g_.m.eventAttrs[eventId] = eventAttr diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 2d604235ee..10061c9fc9 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -838,7 +838,7 @@ func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio eventConfig.Period = 300 } - helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_CPU_CYCLES, /*event Name*/ "cycles") + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CPU_CYCLES, /* event name */ "cycles") return nil }) } @@ -853,7 +853,7 @@ func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOptio eventConfig.Period = 300 } - helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_INSTRUCTIONS, /*event Name*/ "instructions") + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_INSTRUCTIONS, /* event name */ "instructions") return nil }) } @@ -865,7 +865,7 @@ func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOp } // TODO: Clamp period to something reasonable - helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_CACHE_REFERENCES, /*event Name*/ "cache references") + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_REFERENCES, /* event name */ "cache references") return nil }) } @@ -877,7 +877,7 @@ func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingO } // TODO: Clamp period to something reasonable - helper(w, eventConfig, /*event ID*/ runtime.GO_COUNT_HW_CACHE_MISSES, /*event Name*/ "cache misses") + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_MISSES, /* event name */ "cache misses") return nil }) } From ce755fd7a2bea336d8760669ede67b1a2ffeefb5 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 11 Jul 2019 15:10:58 -0700 Subject: [PATCH 056/126] test cases --- test/pmu/test1.go | 32 +++++++++--------- test/pmu/test2.go | 82 +++++++++++++++++++++++------------------------ 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 5fcc42af72..816b2fbd50 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -4,7 +4,7 @@ package main import ( "fmt" - "log" + "log" "os" "sync" "runtime/pprof" @@ -154,23 +154,23 @@ func f10() { func run() error { - cycleFile, err := os.Create("cycle_profile") - if err != nil { - return err - } - defer cycleFile.Close() - - var cycle pprof.PMUEventConfig - cycle.Period = 20000000 - cycle.IsKernelIncluded = false - cycle.IsHvIncluded = false - - if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle)); err != nil { - return err + cycleFile, err := os.Create("cycle_profile") + if err != nil { + return err + } + defer cycleFile.Close() + + var cycle pprof.PMUEventConfig + cycle.Period = 10000000 + cycle.IsKernelIncluded = false + cycle.IsHvIncluded = false + + if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle)); err != nil { + return err } defer pprof.StopPMUProfile() - wg.Add(10) + wg.Add(10) defer wg.Wait() go f1() @@ -184,7 +184,7 @@ func run() error { go f9() go f10() - return nil + return nil } func main() { diff --git a/test/pmu/test2.go b/test/pmu/test2.go index 2a88e173b2..bbc348edbf 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -155,61 +155,61 @@ func f10() { func run() error { itimerFile, err := os.Create("itimer_profile") if err != nil { - return err + return err } - defer itimerFile.Close() - - cycleFile, err := os.Create("cycle_profile") + defer itimerFile.Close() + + cycleFile, err := os.Create("cycle_profile") if err != nil { - return err + return err } - defer cycleFile.Close() - - var cycle pprof.PMUEventConfig - cycle.Period = 20000000 - // cycle.PreciseIP = 2 + defer cycleFile.Close() + + var cycle pprof.PMUEventConfig + cycle.Period = 15000000 + // cycle.PreciseIP = 2 - instrFile, err := os.Create("instr_profile") + instrFile, err := os.Create("instr_profile") if err != nil { - return err - } - defer instrFile.Close() - - var instr pprof.PMUEventConfig - instr.Period = 20000000 - // instr.PreciseIP = 2 - - cacheRefFile, err := os.Create("cacheRef_profile") + return err + } + defer instrFile.Close() + + var instr pprof.PMUEventConfig + instr.Period = 10000000 + // instr.PreciseIP = 2 + + cacheRefFile, err := os.Create("cacheRef_profile") if err != nil { - return err - } - defer cacheRefFile.Close() - - var cacheRef pprof.PMUEventConfig - cacheRef.Period = 200 - // cacheRef.PreciseIP = 2 - - cacheMissFile, err := os.Create("cacheMiss_profile") + return err + } + defer cacheRefFile.Close() + + var cacheRef pprof.PMUEventConfig + cacheRef.Period = 200 + // cacheRef.PreciseIP = 2 + + cacheMissFile, err := os.Create("cacheMiss_profile") if err != nil { - return err + return err } - defer cacheMissFile.Close() - - var cacheMiss pprof.PMUEventConfig - cacheMiss.Period = 10 - // cacheMiss.PreciseIP = 2 + defer cacheMissFile.Close() + + var cacheMiss pprof.PMUEventConfig + cacheMiss.Period = 1 + // cacheMiss.PreciseIP = 2 - if err := pprof.StartCPUProfile(itimerFile); err != nil { - return err + if err := pprof.StartCPUProfile(itimerFile); err != nil { + return err } defer pprof.StopCPUProfile() - if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle), pprof.WithProfilingInstr(instrFile, &instr), pprof.WithProfilingCacheRef(cacheRefFile, &cacheRef), pprof.WithProfilingCacheMiss(cacheMissFile, &cacheMiss)); err != nil { - return err + if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle), pprof.WithProfilingInstr(instrFile, &instr), pprof.WithProfilingCacheRef(cacheRefFile, &cacheRef), pprof.WithProfilingCacheMiss(cacheMissFile, &cacheMiss)); err != nil { + return err } defer pprof.StopPMUProfile() - wg.Add(10) + wg.Add(10) defer wg.Wait() go f1() @@ -223,7 +223,7 @@ func run() error { go f9() go f10() - return nil + return nil } func main() { From f498eafdf1de15d6a49f123b52760973fea801d5 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sat, 13 Jul 2019 17:06:58 -0700 Subject: [PATCH 057/126] test cases --- test/pmu/test2.go | 17 +--- test/pmu/test3.go | 189 +++++++++++++++++++++++++++++++++++++++++++++ test/pmu/test3.out | 10 +++ 3 files changed, 202 insertions(+), 14 deletions(-) create mode 100644 test/pmu/test3.go create mode 100644 test/pmu/test3.out diff --git a/test/pmu/test2.go b/test/pmu/test2.go index bbc348edbf..50c6149f0d 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -4,7 +4,7 @@ package main import ( "fmt" - "log" + "log" "os" "sync" "runtime/pprof" @@ -153,12 +153,6 @@ func f10() { } func run() error { - itimerFile, err := os.Create("itimer_profile") - if err != nil { - return err - } - defer itimerFile.Close() - cycleFile, err := os.Create("cycle_profile") if err != nil { return err @@ -199,15 +193,10 @@ func run() error { cacheMiss.Period = 1 // cacheMiss.PreciseIP = 2 - if err := pprof.StartCPUProfile(itimerFile); err != nil { - return err - } - defer pprof.StopCPUProfile() - if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle), pprof.WithProfilingInstr(instrFile, &instr), pprof.WithProfilingCacheRef(cacheRefFile, &cacheRef), pprof.WithProfilingCacheMiss(cacheMissFile, &cacheMiss)); err != nil { return err - } - defer pprof.StopPMUProfile() + } + defer pprof.StopPMUProfile() wg.Add(10) defer wg.Wait() diff --git a/test/pmu/test3.go b/test/pmu/test3.go new file mode 100644 index 0000000000..65e6fc0cf0 --- /dev/null +++ b/test/pmu/test3.go @@ -0,0 +1,189 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "sync" + "runtime/pprof" +) + +var wg sync.WaitGroup + +func f1() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f2() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f3() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f4() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f5() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f6() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f7() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f8() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f9() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f10() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func run() error { + itimerFile, err := os.Create("itimer_profile") + if err != nil { + return err + } + defer itimerFile.Close() + + if err := pprof.StartCPUProfile(itimerFile); err != nil { + return err + } + defer pprof.StopCPUProfile() + + + wg.Add(10) + defer wg.Wait() + + go f1() + go f2() + go f3() + go f4() + go f5() + go f6() + go f7() + go f8() + go f9() + go f10() + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/test3.out b/test/pmu/test3.out new file mode 100644 index 0000000000..9546171295 --- /dev/null +++ b/test/pmu/test3.out @@ -0,0 +1,10 @@ +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 From 621479e0b1a832a8678957eab525e2b8d35fbf00 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sat, 13 Jul 2019 17:13:12 -0700 Subject: [PATCH 058/126] remove --- src/runtime/os_linux_amd64.go | 94 ----------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 src/runtime/os_linux_amd64.go diff --git a/src/runtime/os_linux_amd64.go b/src/runtime/os_linux_amd64.go deleted file mode 100644 index ada25b30fb..0000000000 --- a/src/runtime/os_linux_amd64.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -import ( - "runtime/internal/atomic" - "unsafe" -) - -//go:noescape -func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) - -func ioctl(fd int32, req, arg int64) int64 - -// func fcntl(fd, cmd int64, arg interface{}) (r int64, err int64) -func fcntl(fd int32, cmd, arg int64) (r int64, err int64) - -//go:noescape -func fcntl2(fd int32, cmd int64, arg *fOwnerEx) (r int64, err int64) - -func setProcessPMUProfiler(eventAttr *PMUEventAttr) { - if eventAttr != nil { - // Enable the Go signal handler if not enabled. - if atomic.Cas(&handlingSig[_SIGPMU], 0, 1) { - atomic.Storeuintptr(&fwdSig[_SIGPMU], getsig(_SIGPMU)) - setsig(_SIGPMU, funcPC(sighandler)) - } - } else { - // If the Go signal handler should be disabled by default, - // disable it if it is enabled. - if !sigInstallGoHandler(_SIGPMU) { - if atomic.Cas(&handlingSig[_SIGPMU], 1, 0) { - setsig(_SIGPMU, atomic.Loaduintptr(&fwdSig[_SIGPMU])) - } - } - } -} - -func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { - _g_ := getg() - - if eventAttr == nil { - if _g_.m.eventAttrs[eventId] != nil { - closefd(_g_.m.eventFds[eventId]) - } - } else { - var perfAttr perfEventAttr - perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) - perfAttr.Type = perfEventOpt[eventId].Type - perfAttr.Config = perfEventOpt[eventId].Config - perfAttr.Sample = eventAttr.Period - perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip - if !eventAttr.IsKernelIncluded { // don't count kernel - perfAttr.Bits += 0b100000 - } - if !eventAttr.IsHvIncluded { // don't count hypervisor - perfAttr.Bits += 0b1000000 - } - - fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) - _g_.m.eventFds[eventId] = fd - r, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) - fcntl(fd, /* F_SETFL */ 0x4, r | /* O_ASYNC */ 0x2000) - fcntl(fd, /* F_SETSIG */ 0xa, _SIGPMU) - fOwnEx := fOwnerEx{/* F_OWNER_TID */ 0, int32(gettid())} - fcntl2(fd, /* F_SETOWN_EX */ 0xf, &fOwnEx) - } - - _g_.m.eventAttrs[eventId] = eventAttr -} - -//go:nowritebarrierrec -func sigpmuhandler(info *siginfo, ctxt unsafe.Pointer, gp *g) { - fd := info.si_fd - ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) - _g_ := getg() - c := &sigctxt{info, ctxt} - - var eventId int = -1 - for i := 0; i < maxPMUEvent; i++ { - if _g_.m.eventFds[i] == fd { - eventId = i - break - } - } - if eventId != -1 { - sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) - } - - ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) - return -} From 7b64868aceb09272e2ef13c1aebc1d0a44d80c7d Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sat, 13 Jul 2019 17:25:46 -0700 Subject: [PATCH 059/126] remove --- src/runtime/os_linux_386.go | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 src/runtime/os_linux_386.go diff --git a/src/runtime/os_linux_386.go b/src/runtime/os_linux_386.go deleted file mode 100644 index 35076520c2..0000000000 --- a/src/runtime/os_linux_386.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -func setProcessPMUProfiler(arg ...interface{}) {/* TODO: implementation */} -func setThreadPMUProfiler(arg ...interface{}) {/* TODO: implementation */} - -//go:nowritebarrierrec -func sigpmuhandler(arg ...interface{}) {/* TODO: implementation */} From ecca1b30d7bbf8956bbe22f3ef0fbae67372dced Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sat, 13 Jul 2019 20:28:38 -0700 Subject: [PATCH 060/126] refactoring --- src/net/http/pprof/pprof.go | 21 +-- src/runtime/cpuprof.go | 235 +++++++++++----------------- src/runtime/defs1_netbsd_386.go | 1 - src/runtime/defs1_netbsd_amd64.go | 1 - src/runtime/defs1_netbsd_arm.go | 1 - src/runtime/defs1_netbsd_arm64.go | 1 - src/runtime/defs1_solaris_amd64.go | 1 - src/runtime/defs_aix_ppc64.go | 1 - src/runtime/defs_darwin_386.go | 1 - src/runtime/defs_darwin_amd64.go | 1 - src/runtime/defs_darwin_arm.go | 1 - src/runtime/defs_darwin_arm64.go | 1 - src/runtime/defs_dragonfly_amd64.go | 1 - src/runtime/defs_freebsd_386.go | 1 - src/runtime/defs_freebsd_amd64.go | 1 - src/runtime/defs_freebsd_arm.go | 1 - src/runtime/defs_linux_386.go | 1 - src/runtime/defs_linux_amd64.go | 12 -- src/runtime/defs_linux_arm.go | 1 - src/runtime/defs_linux_arm64.go | 1 - src/runtime/defs_linux_mips64x.go | 1 - src/runtime/defs_linux_mipsx.go | 1 - src/runtime/defs_linux_ppc64.go | 1 - src/runtime/defs_linux_ppc64le.go | 1 - src/runtime/defs_linux_s390x.go | 1 - src/runtime/defs_openbsd_386.go | 1 - src/runtime/defs_openbsd_amd64.go | 1 - src/runtime/defs_openbsd_arm.go | 1 - src/runtime/defs_openbsd_arm64.go | 1 - src/runtime/defs_pmu_linux.go | 12 ++ src/runtime/os2_plan9.go | 1 - src/runtime/os_darwin.go | 6 - src/runtime/os_linux.go | 86 ++++++++++ src/runtime/pprof/pprof.go | 83 +++++----- src/runtime/pprof/proto.go | 16 +- src/runtime/proc.go | 69 ++++---- src/runtime/signal_sighandler.go | 15 +- src/runtime/signal_unix.go | 35 ++--- src/runtime/sys_linux_amd64.s | 11 +- 39 files changed, 321 insertions(+), 307 deletions(-) create mode 100644 src/runtime/defs_pmu_linux.go diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index 9793cc7d09..6b74d51344 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -141,7 +141,7 @@ func pmuProfile(w http.ResponseWriter, r *http.Request) error { case "cacheMisses": err = pprof.StartPMUProfile(pprof.WithProfilingCacheMiss(w, &eventConfig)) default: - return errors.New("uknown event") + return errors.New("unknown or not yet implemented event") } return err @@ -168,27 +168,30 @@ func Profile(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Disposition", `attachment; filename="profile"`) isPMUEnabled, err := strconv.ParseBool(r.FormValue("pmu")) - if err != nil || isPMUEnabled == false { - if err := pprof.StartCPUProfile(w); err != nil { - // StartCPUProfile failed, so no writes yet. + + if err != nil { + if err = pprof.StartCPUProfile(w); err != nil { serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable CPU profiling: %s", err)) return } - } else if err == nil && isPMUEnabled == true { + } else if isPMUEnabled { if err = pmuProfile(w, r); err != nil { serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable PMU profiling: %s", err)) return } } else { - serveError(w, http.StatusInternalServerError, - fmt.Sprintf("Could not enable CPU or PMU profiling: %s", err)) - return + if err = pprof.StartCPUProfile(w); err != nil { + serveError(w, http.StatusInternalServerError, + fmt.Sprintf("Could not enable CPU profiling: %s", err)) + return + } } sleep(w, time.Duration(sec)*time.Second) - if isPMUEnabled == true { + + if isPMUEnabled { pprof.StopPMUProfile() } else { pprof.StopCPUProfile() diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index e11990e6b9..86dffdf779 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -42,11 +42,8 @@ type profile struct { lostExtra uint64 // count of frames lost because extra is full } -type pmuProfile profile -type cpuProfile profile - -var cpuprof cpuProfile -var pmuprof [maxPMUEvent]pmuProfile +var cpuprof profile +var pmuprof [maxPMUEvent]profile // SetCPUProfileRate sets the CPU profiling rate to hz samples per second. // If hz <= 0, SetCPUProfileRate turns off profiling. @@ -65,10 +62,10 @@ func SetCPUProfileRate(hz int) { } lock(&cpuprof.lock) + defer unlock(&cpuprof.lock) if hz > 0 { if cpuprof.on || cpuprof.log != nil { print("runtime: cannot set cpu profile rate until previous profile has finished.\n") - unlock(&cpuprof.lock) return } @@ -83,16 +80,15 @@ func SetCPUProfileRate(hz int) { cpuprof.addExtra() cpuprof.log.close() } - unlock(&cpuprof.lock) } func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { lock(&pmuprof[eventId].lock) + defer unlock(&pmuprof[eventId].lock) if eventAttr != nil { if pmuprof[eventId].on || pmuprof[eventId].log != nil { - print("runtime: cannot set pmu profile rate until previous profile has finished.\n") - unlock(&pmuprof[eventId].lock) - return + print("runtime: cannot set pmu profile rate until previous profile has finished.\n") + return } pmuprof[eventId].on = true @@ -106,7 +102,19 @@ func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { pmuprof[eventId].addExtra(eventId) pmuprof[eventId].log.close() } - unlock(&pmuprof[eventId].lock) +} + +//go:nowritebarrierrec +func (p *profile) addImpl(gp *g, stk []uintptr, prof *profile) { + if p.numExtra > 0 || p.lostExtra > 0 { + p.addExtra() + } + hdr := [1]uint64{1} + // Note: write "knows" that the argument is &gp.labels, + // because otherwise its write barrier behavior may not + // be correct. See the long comment there before + // changing the argument here. + prof.log.write(&gp.labels, nanotime(), hdr[:], stk) } // add adds the stack trace to the profile. @@ -115,47 +123,38 @@ func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { // held at the time of the signal, nor can it use substantial amounts // of stack. //go:nowritebarrierrec -func (p *cpuProfile) add(gp *g, stk []uintptr) { - // Simple cas-lock to coordinate with setcpuprofilerate. - for !atomic.Cas(&prof.signalLock, 0, 1) { - osyield() - } - - if prof.hz != 0 { // implies cpuprof.log != nil - if p.numExtra > 0 || p.lostExtra > 0 { - p.addExtra() +func (p *profile) add(gp *g, stk []uintptr, eventIds ...int) { + if len(eventIds) == 0 { + for !atomic.Cas(&itimer.signalLock, 0, 1) { + osyield() + } + if itimer.hz != 0 { // implies cpuprof.log != nil + p.addImpl(gp, stk, &cpuprof) } - hdr := [1]uint64{1} - // Note: write "knows" that the argument is &gp.labels, - // because otherwise its write barrier behavior may not - // be correct. See the long comment there before - // changing the argument here. - cpuprof.log.write(&gp.labels, nanotime(), hdr[:], stk) + atomic.Store(&itimer.signalLock, 0) + } else { + eventId := eventIds[0] + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { + osyield() + } + if pmuEvent[eventId].eventAttr != nil { // implies pmuprof[eventId].log != nil + p.addImpl(gp, stk, &pmuprof[eventId]) + } + atomic.Store(&pmuEvent[eventId].signalLock, 0) } - - atomic.Store(&prof.signalLock, 0) } +//go:nosplit //go:nowritebarrierrec -func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { - // Simple cas-lock to coordinate with setpmuprofile. - for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { - osyield() - } - - if pmuEvent[eventId].eventAttr != nil { // implies pmuprof[eventId].log != nil - if p.numExtra > 0 || p.lostExtra > 0 { - p.addExtra(eventId) - } - hdr := [1]uint64{1} - // Note: write "knows" that the argument is &gp.labels, - // because otherwise its write barrier behavior may not - // be correct. See the long comment there before - // changing the argument here. - pmuprof[eventId].log.write(&gp.labels, nanotime(), hdr[:], stk) +func (p *profile) addNonGoImpl(stk []uintptr, prof *profile) { + if prof.numExtra+1+len(stk) < len(prof.extra) { + i := prof.numExtra + prof.extra[i] = uintptr(1 + len(stk)) + copy(prof.extra[i+1:], stk) + prof.numExtra += 1 + len(stk) + } else { + prof.lostExtra++ } - - atomic.Store(&pmuEvent[eventId].signalLock, 0) } // addNonGo adds the non-Go stack trace to the profile. @@ -167,47 +166,26 @@ func (p *pmuProfile) add(gp *g, stk []uintptr, eventId int) { // gets the signal handling event. //go:nosplit //go:nowritebarrierrec -func (p *cpuProfile) addNonGo(stk []uintptr) { - // Simple cas-lock to coordinate with SetCPUProfileRate. - // (Other calls to add or addNonGo should be blocked out - // by the fact that only one SIGPROF can be handled by the - // process at a time. If not, this lock will serialize those too.) - for !atomic.Cas(&prof.signalLock, 0, 1) { - osyield() - } - - if cpuprof.numExtra+1+len(stk) < len(cpuprof.extra) { - i := cpuprof.numExtra - cpuprof.extra[i] = uintptr(1 + len(stk)) - copy(cpuprof.extra[i+1:], stk) - cpuprof.numExtra += 1 + len(stk) - } else { - cpuprof.lostExtra++ - } - - atomic.Store(&prof.signalLock, 0) -} - -//go:nosplit -//go:nowritebarrierrec -func (p *pmuProfile) addNonGo(stk []uintptr, eventId int) { - // (Other calls to add or addNonGo should be blocked out - // by the fact that only one SIGPROF can be handled by the - // process at a time. If not, this lock will serialize those too.) - for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { - osyield() - } - - if pmuprof[eventId].numExtra+1+len(stk) < len(pmuprof[eventId].extra) { - i := pmuprof[eventId].numExtra - pmuprof[eventId].extra[i] = uintptr(1 + len(stk)) - copy(pmuprof[eventId].extra[i+1:], stk) - pmuprof[eventId].numExtra += 1 + len(stk) +func (p *profile) addNonGo(stk []uintptr, eventIds ...int) { + if len(eventIds) == 0 { + // Simple cas-lock to coordinate with SetCPUProfileRate. + // (Other calls to add or addNonGo should be blocked out + // by the fact that only one SIGPROF can be handled by the + // process at a time. If not, this lock will serialize those too.) + for !atomic.Cas(&itimer.signalLock, 0, 1) { + osyield() + } + p.addNonGoImpl(stk, &cpuprof) + atomic.Store(&itimer.signalLock, 0) } else { - pmuprof[eventId].lostExtra++ + eventId := eventIds[0] + // Only one SIGPROF for each PMU event can be handled by the process at a time. + for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { + osyield() + } + p.addNonGoImpl(stk, &pmuprof[eventId]) + atomic.Store(&pmuEvent[eventId].signalLock, 0) } - - atomic.Store(&pmuEvent[eventId].signalLock, 0) } // addExtra adds the "extra" profiling events, @@ -215,7 +193,7 @@ func (p *pmuProfile) addNonGo(stk []uintptr, eventId int) { // addExtra is called either from a signal handler on a Go thread // or from an ordinary goroutine; either way it can use stack // and has a g. The world may be stopped, though. -func (p *cpuProfile) addExtra() { +func (p *profile) addExtra(eventIds ...int) { // Copy accumulated non-Go profile events. hdr := [1]uint64{1} for i := 0; i < p.numExtra; { @@ -231,48 +209,28 @@ func (p *cpuProfile) addExtra() { funcPC(_LostExternalCode) + sys.PCQuantum, funcPC(_ExternalCode) + sys.PCQuantum, } - cpuprof.log.write(nil, 0, hdr[:], lostStk[:]) - p.lostExtra = 0 - } -} - -func (p *pmuProfile) addExtra(eventId int) { - // Copy accumulated non-Go profile events. - hdr := [1]uint64{1} - for i := 0; i < p.numExtra; { - p.log.write(nil, 0, hdr[:], p.extra[i+1:i+int(p.extra[i])]) - i += int(p.extra[i]) - } - p.numExtra = 0 - - // Report any lost events. - if p.lostExtra > 0 { - hdr := [1]uint64{p.lostExtra} - lostStk := [2]uintptr{ - funcPC(_LostExternalCode) + sys.PCQuantum, - funcPC(_ExternalCode) + sys.PCQuantum, + if len(eventIds) == 0 { + cpuprof.log.write(nil, 0, hdr[:], lostStk[:]) + } else { + eventId := eventIds[0] + pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) } - pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) p.lostExtra = 0 } } -func (p *cpuProfile) addLostAtomic64(count uint64) { +func (p *profile) addLostAtomic64(count uint64, eventIds ...int) { hdr := [1]uint64{count} lostStk := [2]uintptr{ funcPC(_LostSIGPROFDuringAtomic64) + sys.PCQuantum, funcPC(_System) + sys.PCQuantum, } - cpuprof.log.write(nil, 0, hdr[:], lostStk[:]) -} - -func (p *pmuProfile) addLostAtomic64(count uint64, eventId int) { - hdr := [1]uint64{count} - lostStk := [2]uintptr{ - funcPC(_LostSIGPMUDuringAtomic64) + sys.PCQuantum, - funcPC(_System) + sys.PCQuantum, + if len(eventIds) == 0 { + cpuprof.log.write(nil, 0, hdr[:], lostStk[:]) + } else { + eventId := eventIds[0] + pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) } - pmuprof[eventId].log.write(nil, 0, hdr[:], lostStk[:]) } // CPUProfile panics. @@ -293,6 +251,19 @@ func runtime_pprof_runtime_cyclesPerSecond() int64 { return tickspersecond() } +func readProfileImpl(prof *profile) ([]uint64, []unsafe.Pointer, bool) { + lock(&prof.lock) + log := prof.log + unlock(&prof.lock) + data, tags, eof := log.read(profBufBlocking) + if len(data) == 0 && eof { + lock(&prof.lock) + prof.log = nil + unlock(&prof.lock) + } + return data, tags, eof +} + // readProfile, provided to runtime/pprof, returns the next chunk of // binary CPU profiling stack trace data, blocking until data is available. // If profiling is turned off and all the profile data accumulated while it was @@ -300,29 +271,11 @@ func runtime_pprof_runtime_cyclesPerSecond() int64 { // The caller must save the returned data and tags before calling readProfile again. // //go:linkname runtime_pprof_readProfile runtime/pprof.readProfile -func runtime_pprof_readProfile() ([]uint64, []unsafe.Pointer, bool) { - lock(&cpuprof.lock) - log := cpuprof.log - unlock(&cpuprof.lock) - data, tags, eof := log.read(profBufBlocking) - if len(data) == 0 && eof { - lock(&cpuprof.lock) - cpuprof.log = nil - unlock(&cpuprof.lock) - } - return data, tags, eof -} - -//go:linkname runtime_pprof_readPMUProfile runtime/pprof.readPMUProfile -func runtime_pprof_readPMUProfile(eventId int) ([]uint64, []unsafe.Pointer, bool) { - lock(&pmuprof[eventId].lock) - log := pmuprof[eventId].log - unlock(&pmuprof[eventId].lock) - data, tags, eof := log.read(profBufBlocking) - if len(data) == 0 && eof { - lock(&pmuprof[eventId].lock) - pmuprof[eventId].log = nil - unlock(&pmuprof[eventId].lock) +func runtime_pprof_readProfile(eventIds ...int) ([]uint64, []unsafe.Pointer, bool) { + if len(eventIds) == 0 { + return readProfileImpl(&cpuprof) + } else { + eventId := eventIds[0] + return readProfileImpl(&pmuprof[eventId]) } - return data, tags, eof } diff --git a/src/runtime/defs1_netbsd_386.go b/src/runtime/defs1_netbsd_386.go index 669030b0af..3eae12eed0 100644 --- a/src/runtime/defs1_netbsd_386.go +++ b/src/runtime/defs1_netbsd_386.go @@ -53,7 +53,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_netbsd_amd64.go b/src/runtime/defs1_netbsd_amd64.go index 87c4315146..51d55c91f9 100644 --- a/src/runtime/defs1_netbsd_amd64.go +++ b/src/runtime/defs1_netbsd_amd64.go @@ -53,7 +53,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_netbsd_arm.go b/src/runtime/defs1_netbsd_arm.go index f8fc98fa58..fadb3415b3 100644 --- a/src/runtime/defs1_netbsd_arm.go +++ b/src/runtime/defs1_netbsd_arm.go @@ -53,7 +53,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_netbsd_arm64.go b/src/runtime/defs1_netbsd_arm64.go index e7ea5161fa..41b7aaca6c 100644 --- a/src/runtime/defs1_netbsd_arm64.go +++ b/src/runtime/defs1_netbsd_arm64.go @@ -53,7 +53,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs1_solaris_amd64.go b/src/runtime/defs1_solaris_amd64.go index 7fb2549e25..64d51a7bd8 100644 --- a/src/runtime/defs1_solaris_amd64.go +++ b/src/runtime/defs1_solaris_amd64.go @@ -57,7 +57,6 @@ const ( _SIGWINCH = 0x14 _SIGUSR1 = 0x10 _SIGUSR2 = 0x11 - _SIGPMU = 0x11 // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_aix_ppc64.go b/src/runtime/defs_aix_ppc64.go index d284088d30..dccc3a5926 100644 --- a/src/runtime/defs_aix_ppc64.go +++ b/src/runtime/defs_aix_ppc64.go @@ -59,7 +59,6 @@ const ( _SIGTERM = 0xf _SIGEMT = 0x7 _SIGWAITING = 0x27 - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x14 _FPE_INTOVF = 0x15 diff --git a/src/runtime/defs_darwin_386.go b/src/runtime/defs_darwin_386.go index 338787e85d..43dc08a078 100644 --- a/src/runtime/defs_darwin_386.go +++ b/src/runtime/defs_darwin_386.go @@ -61,7 +61,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_darwin_amd64.go b/src/runtime/defs_darwin_amd64.go index eb8f02347a..59b0effa13 100644 --- a/src/runtime/defs_darwin_amd64.go +++ b/src/runtime/defs_darwin_amd64.go @@ -61,7 +61,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_darwin_arm.go b/src/runtime/defs_darwin_arm.go index 08a7dc4e3d..243f52a5df 100644 --- a/src/runtime/defs_darwin_arm.go +++ b/src/runtime/defs_darwin_arm.go @@ -63,7 +63,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_darwin_arm64.go b/src/runtime/defs_darwin_arm64.go index e63fb7f609..7056074f46 100644 --- a/src/runtime/defs_darwin_arm64.go +++ b/src/runtime/defs_darwin_arm64.go @@ -61,7 +61,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x7 _FPE_INTOVF = 0x8 diff --git a/src/runtime/defs_dragonfly_amd64.go b/src/runtime/defs_dragonfly_amd64.go index b7a1ca5f5f..30f1b33845 100644 --- a/src/runtime/defs_dragonfly_amd64.go +++ b/src/runtime/defs_dragonfly_amd64.go @@ -57,7 +57,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_freebsd_386.go b/src/runtime/defs_freebsd_386.go index 2fd586933c..c4d5c897d3 100644 --- a/src/runtime/defs_freebsd_386.go +++ b/src/runtime/defs_freebsd_386.go @@ -71,7 +71,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_freebsd_amd64.go b/src/runtime/defs_freebsd_amd64.go index bf2b6d7b71..89d36c270d 100644 --- a/src/runtime/defs_freebsd_amd64.go +++ b/src/runtime/defs_freebsd_amd64.go @@ -71,7 +71,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_freebsd_arm.go b/src/runtime/defs_freebsd_arm.go index 4b3957e478..cc8c924c37 100644 --- a/src/runtime/defs_freebsd_arm.go +++ b/src/runtime/defs_freebsd_arm.go @@ -71,7 +71,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x2 _FPE_INTOVF = 0x1 diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index a37c38d9c1..e2fcbcac71 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -57,7 +57,6 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0x25 // psu: _SIGPMU = SIGRTMIN + 3 _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 90b48d89d1..7ce944bb83 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -57,7 +57,6 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0x25 // psu: _SIGPMU = SIGRTMIN + 3 _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 @@ -416,14 +415,3 @@ type fOwnerEx struct { Type int32 Pid int32 } - -var perfEventOpt = []struct { - Type uint32 // type of event - Config uint64 // event -} { - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES - // TODO: add more perf events -} diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index 4716d67477..ec0b1e9935 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -54,7 +54,6 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index 39eebbc615..b325a229a1 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -57,7 +57,6 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index e94784391c..a52d0d40cf 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -56,7 +56,6 @@ const ( _SIGPROF = 0x1d _SIGXCPU = 0x1e _SIGXFSZ = 0x1f - _SIGPMU = 0x11 // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index 5a3cc37fe5..f3a1dd0cf0 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -60,7 +60,6 @@ const ( _SIGPROF = 0x1d _SIGXCPU = 0x1e _SIGXFSZ = 0x1f - _SIGPMU = 0x11 // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index d17f9bb8fa..f438993721 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -56,7 +56,6 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index 294e121d17..f438993721 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -56,7 +56,6 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index 25af63074d..19b99b5bdf 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -57,7 +57,6 @@ const ( _SIGIO = 0x1d _SIGPWR = 0x1e _SIGSYS = 0x1f - _SIGPMU = 0xc // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_386.go b/src/runtime/defs_openbsd_386.go index 1335cf0b55..0e59a0591a 100644 --- a/src/runtime/defs_openbsd_386.go +++ b/src/runtime/defs_openbsd_386.go @@ -56,7 +56,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_amd64.go b/src/runtime/defs_openbsd_amd64.go index e6aa067a9c..5cefac5858 100644 --- a/src/runtime/defs_openbsd_amd64.go +++ b/src/runtime/defs_openbsd_amd64.go @@ -56,7 +56,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_arm.go b/src/runtime/defs_openbsd_arm.go index 19e3a054c3..b187e9776f 100644 --- a/src/runtime/defs_openbsd_arm.go +++ b/src/runtime/defs_openbsd_arm.go @@ -56,7 +56,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_openbsd_arm64.go b/src/runtime/defs_openbsd_arm64.go index 0209f67267..6b9d60110a 100644 --- a/src/runtime/defs_openbsd_arm64.go +++ b/src/runtime/defs_openbsd_arm64.go @@ -53,7 +53,6 @@ const ( _SIGINFO = 0x1d _SIGUSR1 = 0x1e _SIGUSR2 = 0x1f - _SIGPMU = 0x1f // psu: SIGRTMIN should not be considered constants from userland; use _SIGUSR2 instead _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 diff --git a/src/runtime/defs_pmu_linux.go b/src/runtime/defs_pmu_linux.go new file mode 100644 index 0000000000..a1c0b5fa82 --- /dev/null +++ b/src/runtime/defs_pmu_linux.go @@ -0,0 +1,12 @@ +package runtime + +var perfEventOpt = []struct { + Type uint32 // type of event + Config uint64 // event +} { + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES + {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES + // TODO: add more perf events +} diff --git a/src/runtime/os2_plan9.go b/src/runtime/os2_plan9.go index 1778efe447..58fb2be91f 100644 --- a/src/runtime/os2_plan9.go +++ b/src/runtime/os2_plan9.go @@ -71,5 +71,4 @@ const ( _SIGTRAP = 6 _SIGPROF = 0 // dummy value defined for badsignal _SIGQUIT = 0 // dummy value defined for sighandler - _SIGPMU = 0 // psu: dummy value in order to pass testing ) diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index c9b6335f54..18c15ad89e 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -355,9 +355,3 @@ func sysargs(argc int32, argv **byte) { executablePath = executablePath[len(prefix):] } } - -func setProcessPMUProfiler(arg ...interface{}) {/* TODO: implementation */} -func setThreadPMUProfiler(arg ...interface{}) {/* TODO: implementation */} - -//go:nowritebarrierrec -func sigpmuhandler(arg ...interface{}) {/* TODO: implementation */} diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index d4a9bd4ff5..40d8c4340e 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -5,6 +5,7 @@ package runtime import ( + "runtime/internal/atomic" "runtime/internal/sys" "unsafe" ) @@ -289,6 +290,10 @@ func getHugePageSize() uintptr { func osinit() { ncpu = getproccount() physHugePageSize = getHugePageSize() + + register_setProcessPMUProfiler = setProcessPMUProfiler + register_setThreadPMUProfiler = setThreadPMUProfiler + register_sigpmuhandler = sigpmuhandler } var urandom_dev = []byte("/dev/urandom\x00") @@ -452,3 +457,84 @@ func sysSigaction(sig uint32, new, old *sigactiont) { // rt_sigaction is implemented in assembly. //go:noescape func rt_sigaction(sig uintptr, new, old *sigactiont, size uintptr) int32 + +func setProcessPMUProfiler(eventAttr *PMUEventAttr) { + if eventAttr != nil { + atomic.Cas(&sigState, _UNINSTALLED, _PMU_INSTALLED) + // Enable the Go signal handler if not enabled. + if atomic.Cas(&handlingSig[_SIGPROF], 0, 1) { + atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) + setsig(_SIGPROF, funcPC(sighandler)) + } + } else { + atomic.Cas(&sigState, _PMU_INSTALLED, _UNINSTALLED) + // If the Go signal handler should be disabled by default, + // disable it if it is enabled. + if !sigInstallGoHandler(_SIGPROF) { + if atomic.Cas(&handlingSig[_SIGPROF], 1, 0) { + setsig(_SIGPROF, atomic.Loaduintptr(&fwdSig[_SIGPROF])) + } + } + } +} + +//go:noescape +func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int) (r int32, r2, err int) +func fcntl(fd int32, cmd, arg int) (r, err int) +//go:noescape +func fcntl2(fd int32, cmd int, arg *fOwnerEx) (r, err int) + +func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { + _g_ := getg() + + if eventAttr == nil { + if _g_.m.eventAttrs[eventId] != nil { + closefd(_g_.m.eventFds[eventId]) + } + } else { + var perfAttr perfEventAttr + perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) + perfAttr.Type = perfEventOpt[eventId].Type + perfAttr.Config = perfEventOpt[eventId].Config + perfAttr.Sample = eventAttr.Period + perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip + if !eventAttr.IsKernelIncluded { // don't count kernel + perfAttr.Bits += 0b100000 + } + if !eventAttr.IsHvIncluded { // don't count hypervisor + perfAttr.Bits += 0b1000000 + } + + fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) + _g_.m.eventFds[eventId] = fd + r, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) + fcntl(fd, /* F_SETFL */ 0x4, r | /* O_ASYNC */ 0x2000) + fcntl(fd, /* F_SETSIG */ 0xa, _SIGPROF) + fOwnEx := fOwnerEx{/* F_OWNER_TID */ 0, int32(gettid())} + fcntl2(fd, /* F_SETOWN_EX */ 0xf, &fOwnEx) + } + + _g_.m.eventAttrs[eventId] = eventAttr +} + +func ioctl(fd int32, req, arg int) int + +//go:nowritebarrierrec +func sigpmuhandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { + fd := info.si_fd + ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) + + var eventId int = -1 + for i := 0; i < maxPMUEvent; i++ { + if _g_.m.eventFds[i] == fd { + eventId = i + break + } + } + if eventId != -1 { + sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) + } + + ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + return +} diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 10061c9fc9..46facfb32f 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -760,6 +760,9 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { cpu.done = make(chan bool) } // Double-check. + if pmu.profiling { + return errors.New("Please enable either cpu or pmu profiling instead of both") + } if cpu.profiling { return fmt.Errorf("cpu profiling already in use") } @@ -786,6 +789,9 @@ func StartPMUProfile(opts ...ProfilingOption) error { defer pmu.Unlock() pmu.wg.Add(len(opts)) // Double-check. + if cpu.profiling { + return errors.New("Please enable either cpu or pmu profiling instead of both") + } if pmu.profiling { return errors.New("pmu profiling already in use") } @@ -819,65 +825,66 @@ func getPreciseIP(preciseIP int8) uint8 { func helper(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { pmu.eventOn[eventId] = true - eventAttr := runtime.PMUEventAttr{Period: uint64(eventConfig.Period), - PreciseIP: getPreciseIP(eventConfig.PreciseIP), - IsKernelIncluded: eventConfig.IsKernelIncluded, - IsHvIncluded: eventConfig.IsHvIncluded} + eventAttr := runtime.PMUEventAttr{ + Period: uint64(eventConfig.Period), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), + IsKernelIncluded: eventConfig.IsKernelIncluded, + IsHvIncluded: eventConfig.IsHvIncluded, + } runtime.SetPMUProfile(eventId, &eventAttr) go pmuProfileWriter(w, eventId, eventName) - } func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") - } - // Clamp period to something reasonable - if eventConfig.Period < 300 { - eventConfig.Period = 300 - } - - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CPU_CYCLES, /* event name */ "cycles") + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") + } + // Clamp period to something reasonable + if eventConfig.Period < 300 { + eventConfig.Period = 300 + } + + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CPU_CYCLES, /* event name */ "cycles") return nil }) } func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") - } - // Clamp period to something reasonable - if eventConfig.Period < 300 { - eventConfig.Period = 300 - } - - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_INSTRUCTIONS, /* event name */ "instructions") - return nil + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") + } + // Clamp period to something reasonable + if eventConfig.Period < 300 { + eventConfig.Period = 300 + } + + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_INSTRUCTIONS, /* event name */ "instructions") + return nil }) } func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") - } - // TODO: Clamp period to something reasonable + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") + } + // TODO: Clamp period to something reasonable - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_REFERENCES, /* event name */ "cache references") + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_REFERENCES, /* event name */ "cache references") return nil }) } func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { - if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") - } - // TODO: Clamp period to something reasonable + if eventConfig.Period <= 0 { + return errors.New("Period should be > 0") + } + // TODO: Clamp period to something reasonable - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_MISSES, /* event name */ "cache misses") + helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_MISSES, /* event name */ "cache misses") return nil }) } @@ -895,7 +902,7 @@ func (pof profilingOptionFunc) apply() error { return pof() } // If profiling is turned off and all the profile data accumulated while it was // on has been returned, readProfile returns eof=true. // The caller must save the returned data and tags before calling readProfile again. -func readProfile() (data []uint64, tags []unsafe.Pointer, eof bool) +func readProfile(eventIds ...int) (data []uint64, tags []unsafe.Pointer, eof bool) func profileWriter(w io.Writer) { b := newProfileBuilder(w) @@ -919,14 +926,12 @@ func profileWriter(w io.Writer) { cpu.done <- true } -func readPMUProfile(eventId int) (data []uint64, tags []unsafe.Pointer, eof bool) - func pmuProfileWriter(w io.Writer, eventId int, eventName string) { b := newProfileBuilder(w) var err error for { time.Sleep(100 * time.Millisecond) - data, tags, eof := readPMUProfile(eventId) + data, tags, eof := readProfile(eventId) if e := b.addPMUData(data, tags); e != nil && err == nil { err = e } @@ -938,7 +943,7 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { panic("runtime/pprof: converting profile: " + err.Error()) } b.pmuBuild(eventName) - pmu.wg.Done() + pmu.wg.Done() } // StopCPUProfile stops the current CPU profile, if any. diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index 2e83d6ac6e..61e87d2846 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -37,14 +37,14 @@ type profileBuilder struct { m profMap // encoding state - w io.Writer - zw *gzip.Writer - pb protobuf - strings []string - stringMap map[string]int - locs map[uintptr]int - funcs map[string]int // Package path-qualified function name to Function.ID - mem []memMap + w io.Writer + zw *gzip.Writer + pb protobuf + strings []string + stringMap map[string]int + locs map[uintptr]int + funcs map[string]int // Package path-qualified function name to Function.ID + mem []memMap } type memMap struct { diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 70de478029..eba7a6cee1 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2125,6 +2125,9 @@ func gcstopm() { stopm() } +var register_setProcessPMUProfiler func(eventAttr *PMUEventAttr) +var register_setThreadPMUProfiler func(eventId int32, eventAttr *PMUEventAttr) + // Schedules gp to run on the current M. // If inheritTime is true, gp inherits the remaining time in the // current time slice. Otherwise, it starts a new time slice. @@ -2149,14 +2152,16 @@ func execute(gp *g, inheritTime bool) { // Check whether the profiler needs to be turned on or off. hz := sched.profilehz - eventAttrs := sched.eventAttrs - if _g_.m.profilehz != hz { setThreadCPUProfiler(hz) } - for eventId := 0; eventId < maxPMUEvent; eventId++ { - if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { - setThreadPMUProfiler(int32(eventId), eventAttrs[eventId]) + + if register_setThreadPMUProfiler != nil { + eventAttrs := sched.eventAttrs + for eventId := 0; eventId < maxPMUEvent; eventId++ { + if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { + register_setThreadPMUProfiler(int32(eventId), eventAttrs[eventId]) + } } } @@ -3622,7 +3627,7 @@ func mcount() int32 { return int32(sched.mnext - sched.nmfreed) } -var prof struct { +var itimer struct { signalLock uint32 hz int32 } @@ -3637,7 +3642,6 @@ func _ExternalCode() { _ExternalCode() } func _LostExternalCode() { _LostExternalCode() } func _GC() { _GC() } func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() } -func _LostSIGPMUDuringAtomic64() { _LostSIGPMUDuringAtomic64() } func _VDSO() { _VDSO() } func stackUnwinding(pc, sp, lr uintptr, gp *g, mp *m, stk []uintptr) int { @@ -3771,11 +3775,11 @@ func stackUnwinding(pc, sp, lr uintptr, gp *g, mp *m, stk []uintptr) int { // Counts SIGPROFs received while in atomic64 critical section, on mips{,le} var lostAtomic64Count uint64 -// Called if we receive a SIGPROF signal. +// Called if we receive a SIGPROF signal and itimer is enabled. // Called by the signal handler, may run during STW. //go:nowritebarrierrec func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { - if prof.hz == 0 { + if itimer.hz == 0 { return } // On mips{,le}, 64bit atomics are emulated with spinlocks, in @@ -3802,7 +3806,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { getg().m.mallocing++ stk := make([]uintptr, maxCPUProfStack) n := stackUnwinding(pc, sp, lr, gp, mp, stk) - if prof.hz != 0 { + if itimer.hz != 0 { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostAtomic64Count > 0 { cpuprof.addLostAtomic64(lostAtomic64Count) lostAtomic64Count = 0 @@ -3812,22 +3816,15 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { getg().m.mallocing-- } -// Counts SIGPMUs received while in atomic64 critical section, on mips{,le} var lostPMUAtomic64Count[maxPMUEvent] uint64 -// Called if we receive a SIGPMU signal. +// Called if we receive a SIGPROF signal and PMU is enabled. // Called by the signal handler, may run during STW. //go:nowritebarrierrec -func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGPMU = SIGRTMIN + 3 +func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { if pmuEvent[eventId].eventAttr == nil { return } - // On mips{,le}, 64bit atomics are emulated with spinlocks, in - // runtime/internal/atomic. If SIGPMU arrives while the program is inside - // the critical section, it creates a deadlock (when writing the sample). - // As a workaround, create a counter of SIGPMUs while in critical section - // to store the count, and pass it to sigprof.add() later when SIGPMU is - // received from somewhere else (with _LostSIGPMUDuringAtomic64 as pc). if GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm" { if f := findfunc(pc); f.valid() { if hasPrefix(funcname(f), "runtime/internal/atomic") { @@ -3837,12 +3834,6 @@ func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { // SIGPMU = SIGRTMI } } - // Profiling runs concurrently with GC, so it must not allocate. - // Set a trap in case the code does allocate. - // Note that on windows, one thread takes profiles of all the - // other threads, so mp is usually not getg().m. - // In fact mp may not even be stopped. - // See golang.org/issue/17165. getg().m.mallocing++ stk := make([]uintptr, maxCPUProfStack) n := stackUnwinding(pc, sp, lr, gp, mp, stk) @@ -3869,7 +3860,7 @@ var sigprofCallersUse uint32 //go:nosplit //go:nowritebarrierrec func sigprofNonGo() { - if prof.hz != 0 { + if itimer.hz != 0 { n := 0 for n < len(sigprofCallers) && sigprofCallers[n] != 0 { n++ @@ -3900,7 +3891,7 @@ func sigpmuNonGo(eventId int) { //go:nosplit //go:nowritebarrierrec func sigprofNonGoPC(pc uintptr) { - if prof.hz != 0 { + if itimer.hz != 0 { stk := []uintptr{ pc, funcPC(_ExternalCode) + sys.PCQuantum, @@ -3958,19 +3949,19 @@ func setcpuprofilerate(hz int32) { _g_ := getg() _g_.m.locks++ - // Stop profiler on this thread so that it is safe to lock prof. + // Stop profiler on this thread so that it is safe to lock itimer. // if a profiling signal came in while we had prof locked, // it would deadlock. setThreadCPUProfiler(0) - for !atomic.Cas(&prof.signalLock, 0, 1) { + for !atomic.Cas(&itimer.signalLock, 0, 1) { osyield() } - if prof.hz != hz { + if itimer.hz != hz { setProcessCPUProfiler(hz) - prof.hz = hz + itimer.hz = hz } - atomic.Store(&prof.signalLock, 0) + atomic.Store(&itimer.signalLock, 0) lock(&sched.lock) sched.profilehz = hz @@ -3984,21 +3975,25 @@ func setcpuprofilerate(hz int32) { } func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { + if register_setProcessPMUProfiler == nil || register_setThreadPMUProfiler == nil { + return + } + // Disable preemption, otherwise we can be rescheduled to another thread // that has profiling enabled. _g_ := getg() _g_.m.locks++ - // Stop profiler on this thread so that it is safe to lock prof. - // if a profiling signal came in while we had prof locked, + // Stop profiler on this thread so that it is safe to lock pmuEvent[eventId]. + // if a profiling signal came in while we had pmuEvent[eventId] locked, // it would deadlock. - setThreadPMUProfiler(eventId, nil) + register_setThreadPMUProfiler(eventId, nil) for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { osyield() } if pmuEvent[eventId].eventAttr != eventAttr { - setProcessPMUProfiler(eventAttr) + register_setProcessPMUProfiler(eventAttr) pmuEvent[eventId].eventAttr = eventAttr } atomic.Store(&pmuEvent[eventId].signalLock, 0) @@ -4008,7 +4003,7 @@ func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { unlock(&sched.lock) if eventAttr != nil { - setThreadPMUProfiler(eventId, eventAttr) + register_setThreadPMUProfiler(eventId, eventAttr) } _g_.m.locks-- diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 3d5c7f6571..7df291b3e8 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -7,6 +7,7 @@ package runtime import ( + "runtime/internal/atomic" "unsafe" ) @@ -19,6 +20,8 @@ var crashing int32 // suppressed. var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool +var register_sigpmuhandler func(info *siginfo, c *sigctxt, gp *g, _g_ *g) + // sighandler is invoked when a signal occurs. The global g will be // set to a gsignal goroutine and we will be running on the alternate // signal stack. The parameter g will be the value of the global g @@ -31,16 +34,16 @@ var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool // //go:nowritebarrierrec func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { - if sig == _SIGPMU { - sigpmuhandler(info, ctxt, gp) - return - } - _g_ := getg() c := &sigctxt{info, ctxt} if sig == _SIGPROF { - sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) + state := atomic.Load(&sigState) + if state == _ITIMER_INSTALLED { + sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) + } else if state == _PMU_INSTALLED && register_sigpmuhandler != nil { + register_sigpmuhandler(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp, _g_) + } return } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 2381e2b89b..f56813ede6 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -38,6 +38,14 @@ const ( _SIG_IGN uintptr = 1 ) +const ( + _UNINSTALLED = 0 + _ITIMER_INSTALLED = 1 + _PMU_INSTALLED = 2 +) + +var sigState uint32 + // Stores the signal handlers registered before Go installed its own. // These signal handlers will be invoked in cases where Go doesn't want to // handle a particular signal (e.g., signal occurred on a non-Go thread). @@ -141,13 +149,6 @@ func sigInstallGoHandler(sig uint32) bool { return true } -func isProfilingSignal(sig uint32) bool { - if sig == _SIGPROF || sig == _SIGPMU { - return true - } - return false -} - // sigenable enables the Go signal handler to catch the signal sig. // It is only called while holding the os/signal.handlers lock, // via os/signal.enableSignal and signal_enable. @@ -156,8 +157,8 @@ func sigenable(sig uint32) { return } - // SIGPROF and _SIGPMU are handled specially for profiling. - if isProfilingSignal(sig) { + // SIGPROF is handled specially for profiling. + if sig == _SIGPROF { return } @@ -181,8 +182,8 @@ func sigdisable(sig uint32) { return } - // SIGPROF and _SIGPMU are handled specially for profiling. - if isProfilingSignal(sig) { + // SIGPROF is handled specially for profiling. + if sig == _SIGPROF { return } @@ -210,8 +211,8 @@ func sigignore(sig uint32) { return } - // SIGPROF and _SIGPMU are handled specially for profiling. - if isProfilingSignal(sig) { + // SIGPROF is handled specially for profiling. + if sig == _SIGPROF { return } @@ -242,12 +243,14 @@ func clearSignalHandlers() { // required for -buildmode=c-archive. func setProcessCPUProfiler(hz int32) { if hz != 0 { + atomic.Cas(&sigState, _UNINSTALLED, _ITIMER_INSTALLED) // Enable the Go signal handler if not enabled. if atomic.Cas(&handlingSig[_SIGPROF], 0, 1) { atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) setsig(_SIGPROF, funcPC(sighandler)) } } else { + atomic.Cas(&sigState, _ITIMER_INSTALLED, _UNINSTALLED) // If the Go signal handler should be disabled by default, // disable it if it is enabled. if !sigInstallGoHandler(_SIGPROF) { @@ -302,10 +305,6 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { if sig == _SIGPROF { sigprofNonGoPC(c.sigpc()) return - } else if sig == _SIGPMU { - // sigpmuNonGoPC(c.sigpc()) - println("how do I know which pmu event delivers this signal") - return } c.fixsigcode(sig) badsignal(uintptr(sig), c) @@ -460,7 +459,7 @@ func dieFromSignal(sig uint32) { // thread, and the Go program does not want to handle it (that is, the // program has not called os/signal.Notify for the signal). func raisebadsignal(sig uint32, c *sigctxt) { - if isProfilingSignal(sig) { + if sig == _SIGPROF { // Ignore profiling signals that arrive on non-Go threads. return } diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 8e3e05429c..d6e876acbd 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -47,7 +47,7 @@ #define SYS_faccessat 269 #define SYS_epoll_pwait 281 #define SYS_epoll_create1 291 -#define SYS_perfEventOpen 298 +#define SYS_perfEventOpen 298 TEXT runtime·exit(SB),NOSPLIT,$0-4 MOVL code+0(FP), DI @@ -168,7 +168,6 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0-24 SYSCALL RET -// func perfEventOpen(attr *PerfEventAttr, pid, cpu, groupFd, flags, dummy int64) (r int32, r2, err int64) TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 MOVQ attr+0(FP), DI MOVQ pid+8(FP), SI @@ -191,21 +190,25 @@ ok: MOVQ $0, err+64(FP) RET -// func ioctl(fd int32, req, arg int64) int64 TEXT runtime·ioctl(SB),NOSPLIT,$0 MOVL fd+0(FP), DI MOVQ req+8(FP), SI MOVQ arg+16(FP), DX + MOVQ $0, R10 + MOVQ $0, R8 + MOVQ $0, R9 MOVQ $SYS_ioctl, AX SYSCALL MOVQ AX, ret+24(FP) RET -// func fcntl(fd int32, cmd arg int64) (r int64, err int64) TEXT runtime·fcntl(SB),NOSPLIT,$0 MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX + MOVQ $0, R10 + MOVQ $0, R8 + MOVQ $0, R9 MOVQ $SYS_fcntl, AX SYSCALL CMPQ AX, $0xfffffffffffff001 From 58fa80db73fb1aba588825ec5aa8fbfdc7ca99dd Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 14 Jul 2019 18:03:48 -0700 Subject: [PATCH 061/126] data race detection --- src/runtime/os_linux.go | 28 ++++++++++++++++++---------- src/runtime/signal_sighandler.go | 4 ++-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 40d8c4340e..c2b8208ec1 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -460,18 +460,26 @@ func rt_sigaction(sig uintptr, new, old *sigactiont, size uintptr) int32 func setProcessPMUProfiler(eventAttr *PMUEventAttr) { if eventAttr != nil { - atomic.Cas(&sigState, _UNINSTALLED, _PMU_INSTALLED) - // Enable the Go signal handler if not enabled. - if atomic.Cas(&handlingSig[_SIGPROF], 0, 1) { - atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) - setsig(_SIGPROF, funcPC(sighandler)) + oldVal := atomic.Load(&handlingSig[_SIGPROF]) + if oldVal != _PMU_INSTALLED { + // Enable the Go signal handler if not enabled. + if atomic.Cas(&handlingSig[_SIGPROF], oldVal, _PMU_INSTALLED) { + atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) + setsig(_SIGPROF, funcPC(sighandler)) + } else { + racyUpdatedVal := atomic.Load(&handlingSig[_SIGPROF]) + if racyUpdatedVal != _UNINSTALLED { + panic("never reach here since pprof should have protected us") + } else { + println("sombody else did the job for us") + } + } } } else { - atomic.Cas(&sigState, _PMU_INSTALLED, _UNINSTALLED) // If the Go signal handler should be disabled by default, // disable it if it is enabled. if !sigInstallGoHandler(_SIGPROF) { - if atomic.Cas(&handlingSig[_SIGPROF], 1, 0) { + if atomic.Cas(&handlingSig[_SIGPROF], _PMU_INSTALLED, _UNINSTALLED) { setsig(_SIGPROF, atomic.Loaduintptr(&fwdSig[_SIGPROF])) } } @@ -517,12 +525,12 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _g_.m.eventAttrs[eventId] = eventAttr } -func ioctl(fd int32, req, arg int) int +func ioctl(fd int32, req, arg int) (r, err int) //go:nowritebarrierrec func sigpmuhandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { fd := info.si_fd - ioctl(fd, PERF_EVENT_IOC_DISABLE, 0) + ioctl(fd, _PERF_EVENT_IOC_DISABLE, 0) var eventId int = -1 for i := 0; i < maxPMUEvent; i++ { @@ -535,6 +543,6 @@ func sigpmuhandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) } - ioctl(fd, PERF_EVENT_IOC_ENABLE, 0) + ioctl(fd, _PERF_EVENT_IOC_ENABLE, 0) return } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 7df291b3e8..7628d4575c 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -38,11 +38,11 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { c := &sigctxt{info, ctxt} if sig == _SIGPROF { - state := atomic.Load(&sigState) + state := atomic.Load(&handlingSig[_SIGPROF]) if state == _ITIMER_INSTALLED { sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) } else if state == _PMU_INSTALLED && register_sigpmuhandler != nil { - register_sigpmuhandler(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp, _g_) + register_sigpmuhandler(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp, _g_) } return } From 617f3f510fdba1a0343b2e79773880807fcbcd8d Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 14 Jul 2019 20:56:50 -0700 Subject: [PATCH 062/126] assembly code of perf_event_open, ioctl, fcntl on different linux vendors --- src/runtime/defs_linux_386.go | 157 ++++++++++++++++++ src/runtime/defs_linux_amd64.go | 257 +++++++++++++++--------------- src/runtime/defs_linux_arm.go | 157 ++++++++++++++++++ src/runtime/defs_linux_arm64.go | 157 ++++++++++++++++++ src/runtime/defs_linux_mips64x.go | 158 ++++++++++++++++++ src/runtime/defs_linux_mipsx.go | 157 ++++++++++++++++++ src/runtime/defs_linux_ppc64.go | 157 ++++++++++++++++++ src/runtime/defs_linux_ppc64le.go | 157 ++++++++++++++++++ src/runtime/defs_linux_s390x.go | 157 ++++++++++++++++++ src/runtime/defs_pmu_linux.go | 8 +- src/runtime/signal_unix.go | 21 ++- src/runtime/sys_linux_386.s | 85 ++++++++++ src/runtime/sys_linux_amd64.s | 157 +++++++++--------- src/runtime/sys_linux_arm.s | 101 ++++++++++++ src/runtime/sys_linux_arm64.s | 92 +++++++++++ src/runtime/sys_linux_mips64x.s | 85 ++++++++++ src/runtime/sys_linux_ppc64x.s | 84 ++++++++++ src/runtime/sys_linux_s390x.s | 88 ++++++++++ 18 files changed, 2023 insertions(+), 212 deletions(-) diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index e2fcbcac71..f03fcb8bce 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -97,6 +97,132 @@ const ( _SOCK_DGRAM = 0x2 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80042407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4004240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40042406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 +) + type fpreg struct { significand [4]uint16 exponent uint16 @@ -164,6 +290,9 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint32 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type stackt struct { @@ -225,3 +354,31 @@ type sockaddr_un struct { family uint16 path [108]byte } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only tested on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 7ce944bb83..888f7363a0 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -94,6 +94,132 @@ const ( _SOCK_DGRAM = 0x2 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 +) + type timespec struct { tv_sec int64 tv_nsec int64 @@ -264,132 +390,6 @@ type sockaddr_un struct { path [108]byte } -const ( - PERF_TYPE_HARDWARE = 0x0 - PERF_TYPE_SOFTWARE = 0x1 - PERF_TYPE_TRACEPOINT = 0x2 - PERF_TYPE_HW_CACHE = 0x3 - PERF_TYPE_RAW = 0x4 - PERF_TYPE_BREAKPOINT = 0x5 - - PERF_COUNT_HW_CPU_CYCLES = 0x0 - PERF_COUNT_HW_INSTRUCTIONS = 0x1 - PERF_COUNT_HW_CACHE_REFERENCES = 0x2 - PERF_COUNT_HW_CACHE_MISSES = 0x3 - PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 - PERF_COUNT_HW_BRANCH_MISSES = 0x5 - PERF_COUNT_HW_BUS_CYCLES = 0x6 - PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 - PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 - PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - - PERF_COUNT_HW_CACHE_L1D = 0x0 - PERF_COUNT_HW_CACHE_L1I = 0x1 - PERF_COUNT_HW_CACHE_LL = 0x2 - PERF_COUNT_HW_CACHE_DTLB = 0x3 - PERF_COUNT_HW_CACHE_ITLB = 0x4 - PERF_COUNT_HW_CACHE_BPU = 0x5 - PERF_COUNT_HW_CACHE_NODE = 0x6 - - PERF_COUNT_HW_CACHE_OP_READ = 0x0 - PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 - PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - - PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 - PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - - PERF_COUNT_SW_CPU_CLOCK = 0x0 - PERF_COUNT_SW_TASK_CLOCK = 0x1 - PERF_COUNT_SW_PAGE_FAULTS = 0x2 - PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 - PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 - PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 - PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 - PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 - PERF_COUNT_SW_EMULATION_FAULTS = 0x8 - PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa - - PERF_SAMPLE_IP = 0x1 - PERF_SAMPLE_TID = 0x2 - PERF_SAMPLE_TIME = 0x4 - PERF_SAMPLE_ADDR = 0x8 - PERF_SAMPLE_READ = 0x10 - PERF_SAMPLE_CALLCHAIN = 0x20 - PERF_SAMPLE_ID = 0x40 - PERF_SAMPLE_CPU = 0x80 - PERF_SAMPLE_PERIOD = 0x100 - PERF_SAMPLE_STREAM_ID = 0x200 - PERF_SAMPLE_RAW = 0x400 - PERF_SAMPLE_BRANCH_STACK = 0x800 - - PERF_SAMPLE_BRANCH_USER = 0x1 - PERF_SAMPLE_BRANCH_KERNEL = 0x2 - PERF_SAMPLE_BRANCH_HV = 0x4 - PERF_SAMPLE_BRANCH_ANY = 0x8 - PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 - PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 - PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - - PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 - PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 - PERF_FORMAT_ID = 0x4 - PERF_FORMAT_GROUP = 0x8 - - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 - - PERF_CONTEXT_HV = -0x20 - PERF_CONTEXT_KERNEL = -0x80 - PERF_CONTEXT_USER = -0x200 - - PERF_CONTEXT_GUEST = -0x800 - PERF_CONTEXT_GUEST_KERNEL = -0x880 - PERF_CONTEXT_GUEST_USER = -0xa00 - - PERF_FLAG_FD_NO_GROUP = 0x1 - PERF_FLAG_FD_OUTPUT = 0x2 - PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 - - PERF_EVENT_IOC_DISABLE = 0x2401 - PERF_EVENT_IOC_ENABLE = 0x2400 - PERF_EVENT_IOC_ID = 0x80082407 - PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b - PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - PERF_EVENT_IOC_PERIOD = 0x40082404 - PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - PERF_EVENT_IOC_REFRESH = 0x2402 - PERF_EVENT_IOC_RESET = 0x2403 - PERF_EVENT_IOC_SET_BPF = 0x40042408 - PERF_EVENT_IOC_SET_FILTER = 0x40082406 - PERF_EVENT_IOC_SET_OUTPUT = 0x2405 -) - type perfEventAttr struct { Type uint32 Size uint32 @@ -408,10 +408,11 @@ type perfEventAttr struct { Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 - _ uint32 + Sample_max_stack uint16 + _ uint16 } type fOwnerEx struct { Type int32 - Pid int32 + Pid int32 } diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index ec0b1e9935..e6e3327cf0 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -90,6 +90,132 @@ const ( _SOCK_DGRAM = 0x2 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80042407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4004240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40042406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 +) + type timespec struct { tv_sec int32 tv_nsec int32 @@ -160,6 +286,9 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint32 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type sigactiont struct { @@ -179,3 +308,31 @@ type sockaddr_un struct { family uint16 path [108]byte } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only tested on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index b325a229a1..a39d5b6699 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -94,6 +94,132 @@ const ( _SOCK_DGRAM = 0x2 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 +) + type timespec struct { tv_sec int64 tv_nsec int64 @@ -127,6 +253,9 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type itimerval struct { @@ -184,3 +313,31 @@ type ucontext struct { _pad2 [8]byte // sigcontext must be aligned to 16-byte uc_mcontext sigcontext } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only test it on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index a52d0d40cf..d2b21cd997 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -89,6 +89,132 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x20002401 + _PERF_EVENT_IOC_ENABLE = 0x20002400 + _PERF_EVENT_IOC_ID = 0x40082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + _PERF_EVENT_IOC_PERIOD = 0x80082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x20002402 + _PERF_EVENT_IOC_RESET = 0x20002403 + _PERF_EVENT_IOC_SET_BPF = 0x80042408 + _PERF_EVENT_IOC_SET_FILTER = 0x80082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 +) + //struct Sigset { // uint64 sig[1]; //}; @@ -130,6 +256,9 @@ type siginfo struct { __pad0 [1]int32 // below here is a union; si_addr is the only field we use si_addr uint64 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type itimerval struct { @@ -180,3 +309,32 @@ type ucontext struct { uc_mcontext sigcontext uc_sigmask uint64 } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only test it on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} + diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index f3a1dd0cf0..2bffac0c9a 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -93,6 +93,132 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x20002401 + _PERF_EVENT_IOC_ENABLE = 0x20002400 + _PERF_EVENT_IOC_ID = 0x40042407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8004240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + _PERF_EVENT_IOC_PERIOD = 0x80082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + _PERF_EVENT_IOC_REFRESH = 0x20002402 + _PERF_EVENT_IOC_RESET = 0x20002403 + _PERF_EVENT_IOC_SET_BPF = 0x80042408 + _PERF_EVENT_IOC_SET_FILTER = 0x80042406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 +) + type timespec struct { tv_sec int32 tv_nsec int32 @@ -128,6 +254,9 @@ type siginfo struct { si_errno int32 // below here is a union; si_addr is the only field we use si_addr uint32 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type itimerval struct { @@ -182,3 +311,31 @@ type ucontext struct { uc_mcontext sigcontext uc_sigmask [4]uint32 } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only test it on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index f438993721..15867d6795 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -89,6 +89,132 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 +) + //struct Sigset { // uint64 sig[1]; //}; @@ -127,6 +253,9 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type itimerval struct { @@ -197,3 +326,31 @@ type ucontext struct { __unused [15]uint64 uc_mcontext sigcontext } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only test it on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index f438993721..5e51f2398d 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -89,6 +89,132 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x20002401 + _PERF_EVENT_IOC_ENABLE = 0x20002400 + _PERF_EVENT_IOC_ID = 0x40082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + _PERF_EVENT_IOC_PERIOD = 0x80082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x20002402 + _PERF_EVENT_IOC_RESET = 0x20002403 + _PERF_EVENT_IOC_SET_BPF = 0x80042408 + _PERF_EVENT_IOC_SET_FILTER = 0x80082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 +) + //struct Sigset { // uint64 sig[1]; //}; @@ -127,6 +253,9 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type itimerval struct { @@ -197,3 +326,31 @@ type ucontext struct { __unused [15]uint64 uc_mcontext sigcontext } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only test it on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index 19b99b5bdf..0f3b134341 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -90,6 +90,132 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +const ( + _PERF_TYPE_HARDWARE = 0x0 + _PERF_TYPE_SOFTWARE = 0x1 + _PERF_TYPE_TRACEPOINT = 0x2 + _PERF_TYPE_HW_CACHE = 0x3 + _PERF_TYPE_RAW = 0x4 + _PERF_TYPE_BREAKPOINT = 0x5 + + _PERF_COUNT_HW_CPU_CYCLES = 0x0 + _PERF_COUNT_HW_INSTRUCTIONS = 0x1 + _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 + _PERF_COUNT_HW_CACHE_MISSES = 0x3 + _PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 + _PERF_COUNT_HW_BRANCH_MISSES = 0x5 + _PERF_COUNT_HW_BUS_CYCLES = 0x6 + _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 + _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 + _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 + + _PERF_COUNT_HW_CACHE_L1D = 0x0 + _PERF_COUNT_HW_CACHE_L1I = 0x1 + _PERF_COUNT_HW_CACHE_LL = 0x2 + _PERF_COUNT_HW_CACHE_DTLB = 0x3 + _PERF_COUNT_HW_CACHE_ITLB = 0x4 + _PERF_COUNT_HW_CACHE_BPU = 0x5 + _PERF_COUNT_HW_CACHE_NODE = 0x6 + + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 + _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + + _PERF_COUNT_SW_CPU_CLOCK = 0x0 + _PERF_COUNT_SW_TASK_CLOCK = 0x1 + _PERF_COUNT_SW_PAGE_FAULTS = 0x2 + _PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + _PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + _PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + _PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + _PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + _PERF_COUNT_SW_DUMMY = 0x9 + _PERF_COUNT_SW_BPF_OUTPUT = 0xa + + _PERF_SAMPLE_IP = 0x1 + _PERF_SAMPLE_TID = 0x2 + _PERF_SAMPLE_TIME = 0x4 + _PERF_SAMPLE_ADDR = 0x8 + _PERF_SAMPLE_READ = 0x10 + _PERF_SAMPLE_CALLCHAIN = 0x20 + _PERF_SAMPLE_ID = 0x40 + _PERF_SAMPLE_CPU = 0x80 + _PERF_SAMPLE_PERIOD = 0x100 + _PERF_SAMPLE_STREAM_ID = 0x200 + _PERF_SAMPLE_RAW = 0x400 + _PERF_SAMPLE_BRANCH_STACK = 0x800 + + _PERF_SAMPLE_BRANCH_USER = 0x1 + _PERF_SAMPLE_BRANCH_KERNEL = 0x2 + _PERF_SAMPLE_BRANCH_HV = 0x4 + _PERF_SAMPLE_BRANCH_ANY = 0x8 + _PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + _PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + _PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + _PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + _PERF_SAMPLE_BRANCH_IN_TX = 0x100 + _PERF_SAMPLE_BRANCH_NO_TX = 0x200 + _PERF_SAMPLE_BRANCH_COND = 0x400 + _PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + _PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + _PERF_SAMPLE_BRANCH_CALL = 0x2000 + _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + _PERF_FORMAT_ID = 0x4 + _PERF_FORMAT_GROUP = 0x8 + + _PERF_RECORD_MMAP = 0x1 + _PERF_RECORD_LOST = 0x2 + _PERF_RECORD_COMM = 0x3 + _PERF_RECORD_EXIT = 0x4 + _PERF_RECORD_THROTTLE = 0x5 + _PERF_RECORD_UNTHROTTLE = 0x6 + _PERF_RECORD_FORK = 0x7 + _PERF_RECORD_READ = 0x8 + _PERF_RECORD_SAMPLE = 0x9 + _PERF_RECORD_MMAP2 = 0xa + _PERF_RECORD_AUX = 0xb + _PERF_RECORD_ITRACE_START = 0xc + _PERF_RECORD_LOST_SAMPLES = 0xd + _PERF_RECORD_SWITCH = 0xe + _PERF_RECORD_SWITCH_CPU_WIDE = 0xf + _PERF_RECORD_NAMESPACES = 0x10 + + _PERF_CONTEXT_HV = -0x20 + _PERF_CONTEXT_KERNEL = -0x80 + _PERF_CONTEXT_USER = -0x200 + + _PERF_CONTEXT_GUEST = -0x800 + _PERF_CONTEXT_GUEST_KERNEL = -0x880 + _PERF_CONTEXT_GUEST_USER = -0xa00 + + _PERF_FLAG_FD_NO_GROUP = 0x1 + _PERF_FLAG_FD_OUTPUT = 0x2 + _PERF_FLAG_PID_CGROUP = 0x4 + _PERF_FLAG_FD_CLOEXEC = 0x8 + + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 +) + type timespec struct { tv_sec int64 tv_nsec int64 @@ -123,6 +249,9 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 + // psu: an unreliable workaround and need to figure out a better solution + // psu: only tested on amd64 + si_fd int32 } type itimerval struct { @@ -164,3 +293,31 @@ type ucontext struct { uc_mcontext sigcontext uc_sigmask uint64 } + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} + +// psu: only test it on amd64 +type fOwnerEx struct { + Type int32 + Pid int32 +} diff --git a/src/runtime/defs_pmu_linux.go b/src/runtime/defs_pmu_linux.go index a1c0b5fa82..53e9de244a 100644 --- a/src/runtime/defs_pmu_linux.go +++ b/src/runtime/defs_pmu_linux.go @@ -4,9 +4,9 @@ var perfEventOpt = []struct { Type uint32 // type of event Config uint64 // event } { - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES - {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES // TODO: add more perf events } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index f56813ede6..5a618483e8 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -243,18 +243,25 @@ func clearSignalHandlers() { // required for -buildmode=c-archive. func setProcessCPUProfiler(hz int32) { if hz != 0 { - atomic.Cas(&sigState, _UNINSTALLED, _ITIMER_INSTALLED) - // Enable the Go signal handler if not enabled. - if atomic.Cas(&handlingSig[_SIGPROF], 0, 1) { - atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) - setsig(_SIGPROF, funcPC(sighandler)) + oldVal := atomic.Load(&handlingSig[_SIGPROF]) + if oldVal != _ITIMER_INSTALLED { + if atomic.Cas(&handlingSig[_SIGPROF], oldVal, _ITIMER_INSTALLED) { + atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) + setsig(_SIGPROF, funcPC(sighandler)) + } else { + racyUpdatedVal := atomic.Load(&handlingSig[_SIGPROF]) + if racyUpdatedVal != _UNINSTALLED { + panic("never reach here since pprof should have protected us") + } else { + println("sombody else did the job for us") + } + } } } else { - atomic.Cas(&sigState, _ITIMER_INSTALLED, _UNINSTALLED) // If the Go signal handler should be disabled by default, // disable it if it is enabled. if !sigInstallGoHandler(_SIGPROF) { - if atomic.Cas(&handlingSig[_SIGPROF], 1, 0) { + if atomic.Cas(&handlingSig[_SIGPROF], _ITIMER_INSTALLED, _UNINSTALLED) { setsig(_SIGPROF, atomic.Loaduintptr(&fwdSig[_SIGPROF])) } } diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s index 72c43bd9da..dc8509c115 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s @@ -33,6 +33,7 @@ #define SYS_access 33 #define SYS_kill 37 #define SYS_brk 45 +#define SYS_ioctl 54 #define SYS_fcntl 55 #define SYS_munmap 91 #define SYS_socketcall 102 @@ -58,6 +59,7 @@ #define SYS_clock_gettime 265 #define SYS_tgkill 270 #define SYS_epoll_create1 329 +#define SYS_perf_event_open 336 TEXT runtime·exit(SB),NOSPLIT,$0 MOVL $SYS_exit_group, AX @@ -734,3 +736,86 @@ TEXT runtime·sbrk0(SB),NOSPLIT,$0-4 INVOKE_SYSCALL MOVL AX, ret+0(FP) RET + +// psu: not tested +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVL attr+0(FP), BX + MOVL pid+4(FP), CX + MOVL cpu+8(FP), DX + MOVL groupFd+12(FP), SI + MOVL flags+16(FP), DI + MOVL dummy+20(FP), BP + MOVL $SYS_perf_event_open, AX + INVOKE_SYSCALL + CMPL AX, $0xfffff001 + JLS ok + MOVL $-1, r+24(FP) + MOVL $0, r2+28(FP) + NEGL AX + MOVL AX, err+32(FP) + RET +ok: + MOVL AX, r+24(FP) + MOVL DX, r2+28(FP) + MOVL $0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·ioctl(SB),NOSPLIT,$0 + MOVL fd+0(FP), BX + MOVL req+4(FP), CX + MOVL arg+8(FP), DX + MOVL $0, SI + MOVL $0, DI + MOVL $SYS_ioctl, AX + INVOKE_SYSCALL + CMPL AX, $0xfffff001 + JLS ok + MOVL $-1, r+12(FP) + NEGL AX + MOVL AX, err+16(FP) + RET +ok: + MOVL AX, r+12(FP) + MOVL $0, err+16(FP) + RET + +// psu: not tested +TEXT runtime·fcntl(SB),NOSPLIT,$0 + MOVL fd+0(FP), BX + MOVL cmd+4(FP), CX + MOVL arg+8(FP), DX + MOVL $0, SI + MOVL $0, DI + MOVL $SYS_fcntl, AX + INVOKE_SYSCALL + CMPL AX, $0xfffff001 + JLS ok + MOVL $-1, r+12(FP) + NEGL AX + MOVL AX, err+16(FP) + RET +ok: + MOVL AX, r+12(FP) + MOVL $0, err+16(FP) + RET + +// psu: not tested +TEXT runtime·fcntl2(SB),NOSPLIT,$0 + MOVL fd+0(FP), BX + MOVL cmd+4(FP), CX + MOVL arg+8(FP), DX + MOVL $0, SI + MOVL $0, DI + MOVL $SYS_fcntl, AX + INVOKE_SYSCALL + CMPL AX, $0xfffff001 + JLS ok + MOVL $-1, r+12(FP) + NEGL AX + MOVL AX, err+16(FP) + RET +ok: + MOVL AX, r+12(FP) + MOVL $0, err+16(FP) + RET diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index d6e876acbd..477f018e2e 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -21,7 +21,7 @@ #define SYS_rt_sigaction 13 #define SYS_rt_sigprocmask 14 #define SYS_rt_sigreturn 15 -#define SYS_ioctl 16 +#define SYS_ioctl 16 #define SYS_sched_yield 24 #define SYS_mincore 27 #define SYS_madvise 28 @@ -47,7 +47,7 @@ #define SYS_faccessat 269 #define SYS_epoll_pwait 281 #define SYS_epoll_create1 291 -#define SYS_perfEventOpen 298 +#define SYS_perf_event_open 298 TEXT runtime·exit(SB),NOSPLIT,$0-4 MOVL code+0(FP), DI @@ -168,77 +168,6 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0-24 SYSCALL RET -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 - MOVQ attr+0(FP), DI - MOVQ pid+8(FP), SI - MOVQ cpu+16(FP), DX - MOVQ groupFd+24(FP), R10 - MOVQ flags+32(FP), R8 - MOVQ dummy+40(FP), R9 - MOVQ $SYS_perfEventOpen, AX // syscall entry - SYSCALL - CMPQ AX, $0xfffffffffffff001 - JLS ok - MOVL $-1, r+48(FP) - MOVQ $0, r2+56(FP) - NEGQ AX - MOVQ AX, err+64(FP) - RET -ok: - MOVL AX, r+48(FP) - MOVQ DX, r2+56(FP) - MOVQ $0, err+64(FP) - RET - -TEXT runtime·ioctl(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI - MOVQ req+8(FP), SI - MOVQ arg+16(FP), DX - MOVQ $0, R10 - MOVQ $0, R8 - MOVQ $0, R9 - MOVQ $SYS_ioctl, AX - SYSCALL - MOVQ AX, ret+24(FP) - RET - -TEXT runtime·fcntl(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI - MOVQ cmd+8(FP), SI - MOVQ arg+16(FP), DX - MOVQ $0, R10 - MOVQ $0, R8 - MOVQ $0, R9 - MOVQ $SYS_fcntl, AX - SYSCALL - CMPQ AX, $0xfffffffffffff001 - JLS ok - MOVQ $-1, r+24(FP) - NEGQ AX - MOVQ AX, err+32(FP) - RET -ok: - MOVQ AX, r+24(FP) - MOVQ $0, err+32(FP) - RET - -TEXT runtime·fcntl2(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI - MOVQ cmd+8(FP), SI - MOVQ arg+16(FP), DX - MOVQ $SYS_fcntl, AX - SYSCALL - CMPQ AX, $0xfffffffffffff001 - JLS ok - MOVQ $-1, r+24(FP) - NEGQ AX - MOVQ AX, err+32(FP) - RET -ok: - MOVQ AX, r+24(FP) - MOVQ $0, err+32(FP) - RET - TEXT runtime·mincore(SB),NOSPLIT,$0-28 MOVQ addr+0(FP), DI MOVQ n+8(FP), SI @@ -796,3 +725,85 @@ TEXT runtime·sbrk0(SB),NOSPLIT,$0-8 SYSCALL MOVQ AX, ret+0(FP) RET + +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVQ attr+0(FP), DI + MOVQ pid+8(FP), SI + MOVQ cpu+16(FP), DX + MOVQ groupFd+24(FP), R10 + MOVQ flags+32(FP), R8 + MOVQ dummy+40(FP), R9 + MOVQ $SYS_perf_event_open, AX + SYSCALL + CMPQ AX, $0xfffffffffffff001 + JLS ok + MOVL $-1, r+48(FP) + MOVQ $0, r2+56(FP) + NEGQ AX + MOVQ AX, err+64(FP) + RET +ok: + MOVL AX, r+48(FP) + MOVQ DX, r2+56(FP) + MOVQ $0, err+64(FP) + RET + +TEXT runtime·ioctl(SB),NOSPLIT,$0 + MOVL fd+0(FP), DI + MOVQ req+8(FP), SI + MOVQ arg+16(FP), DX + MOVQ $0, R10 + MOVQ $0, R8 + MOVQ $0, R9 + MOVQ $SYS_ioctl, AX + SYSCALL + CMPQ AX, $0xfffffffffffff001 + JLS ok + MOVQ $-1, r+24(FP) + NEGQ AX + MOVQ AX, err+32(FP) + RET +ok: + MOVQ AX, r+24(FP) + MOVQ $0, err+32(FP) + RET + +TEXT runtime·fcntl(SB),NOSPLIT,$0 + MOVL fd+0(FP), DI + MOVQ cmd+8(FP), SI + MOVQ arg+16(FP), DX + MOVQ $0, R10 + MOVQ $0, R8 + MOVQ $0, R9 + MOVQ $SYS_fcntl, AX + SYSCALL + CMPQ AX, $0xfffffffffffff001 + JLS ok + MOVQ $-1, r+24(FP) + NEGQ AX + MOVQ AX, err+32(FP) + RET +ok: + MOVQ AX, r+24(FP) + MOVQ $0, err+32(FP) + RET + +TEXT runtime·fcntl2(SB),NOSPLIT,$0 + MOVL fd+0(FP), DI + MOVQ cmd+8(FP), SI + MOVQ arg+16(FP), DX + MOVQ $0, R10 + MOVQ $0, R8 + MOVQ $0, R9 + MOVQ $SYS_fcntl, AX + SYSCALL + CMPQ AX, $0xfffffffffffff001 + JLS ok + MOVQ $-1, r+24(FP) + NEGQ AX + MOVQ AX, err+32(FP) + RET +ok: + MOVQ AX, r+24(FP) + MOVQ $0, err+32(FP) + RET diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s index 9c7398451c..7eb71cd456 100644 --- a/src/runtime/sys_linux_arm.s +++ b/src/runtime/sys_linux_arm.s @@ -45,11 +45,13 @@ #define SYS_epoll_ctl (SYS_BASE + 251) #define SYS_epoll_wait (SYS_BASE + 252) #define SYS_epoll_create1 (SYS_BASE + 357) +#define SYS_ioctl (SYS_BASE + 54) #define SYS_fcntl (SYS_BASE + 55) #define SYS_access (SYS_BASE + 33) #define SYS_connect (SYS_BASE + 283) #define SYS_socket (SYS_BASE + 281) #define SYS_brk (SYS_BASE + 45) +#define SYS_perf_event_open (SYS_BASE + 364) #define ARM_BASE (SYS_BASE + 0x0f0000) @@ -609,3 +611,102 @@ TEXT runtime·sbrk0(SB),NOSPLIT,$0-4 TEXT runtime·sigreturn(SB),NOSPLIT,$0-0 RET + +// psu: not tested +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVW attr+0(FP), R0 + MOVW pid+4((FP), R1 + MOVW cpu+8(FP), R2 + MOVW groupFd+12(FP), R3 + MOVW flags+16(FP), R4 + MOVW dummy+20(FP), R5 + MOVW $SYS_perf_event_open, R7 + SWI $0 + MOVW $0xfffff001, R6 + CMP R6, R0 + BLS ok + MOVW $-1, R1 + MOVW R1, r+24(FP) + MOVW $0, R2 + MOVW R2, r2+28(FP) + RSB $0, R0, R0 + MOVW R0, err+32(FP) + RET +ok: + MOVW R0, r+24(FP) + MOVW R1, r2+28(FP) + MOVW $0, R0 + MOVW R0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·ioctl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R0 + MOVW req+4(FP), R1 + MOVW arg+8(FP), R2 + MOVW $0, R3 + MOVW $0, R4 + MOVW $0, R5 + MOVW $SYS_ioctl, R7 + SWI $0 + MOVW $0xfffff001, R1 + CMP R1, R0 + BLS ok + MOVW $-1, R1 + MOVW R1, r+12(FP) + RSB $0, R0, R0 + MOVW R0, err+16(FP) + RET +ok: + MOVW R0, r+12(FP) + MOVW $0, R0 + MOVW R0, err+16(FP) + RET + +// psu: not tested +TEXT runtime·fcntl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R0 + MOVW cmd+4(FP), R1 + MOVW arg+8(FP), R2 + MOVW $0, R3 + MOVW $0, R4 + MOVW $0, R5 + MOVW $SYS_fcntl, R7 + SWI $0 + MOVW $0xfffff001, R1 + CMP R1, R0 + BLS ok + MOVW $-1, R1 + MOVW R1, r+12(FP) + RSB $0, R0, R0 + MOVW R0, err+16(FP) + RET +ok: + MOVW R0, r+12(FP) + MOVW $0, R0 + MOVW R0, err+16(FP) + RET + +// psu: not tested +TEXT runtime·fcntl2(SB),NOSPLIT,$0 + MOVW fd+0(FP), R0 + MOVW cmd+4(FP), R1 + MOVW arg+8(FP), R2 + MOVW $0, R3 + MOVW $0, R4 + MOVW $0, R5 + MOVW $SYS_fcntl, R7 + SWI $0 + MOVW $0xfffff001, R1 + CMP R1, R0 + BLS ok + MOVW $-1, R1 + MOVW R1, r+12(FP) + RSB $0, R0, R0 + MOVW R0, err+16(FP) + RET +ok: + MOVW R0, r+12(FP) + MOVW $0, R0 + MOVW R0, err+16(FP) + RET diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s index 321d74254c..b136bd6a0a 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -21,6 +21,7 @@ #define SYS_openat 56 #define SYS_close 57 #define SYS_fcntl 25 +#define SYS_ioctl 29 #define SYS_nanosleep 101 #define SYS_mmap 222 #define SYS_munmap 215 @@ -48,6 +49,7 @@ #define SYS_socket 198 #define SYS_connect 203 #define SYS_brk 214 +#define SYS_perf_event_open 241 TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R0 @@ -602,3 +604,93 @@ TEXT runtime·sbrk0(SB),NOSPLIT,$0-8 TEXT runtime·sigreturn(SB),NOSPLIT,$0-0 RET + +// psu: not tested +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVD attr+0(FP), R0 + MOVD pid+8((FP), R1 + MOVD cpu+16(FP), R2 + MOVD groupFd+24(FP), R3 + MOVD flags+32(FP), R4 + MOVD dummy+40(FP), R5 + MOVD $SYS_perf_event_open, R8 + SVC + CMN $4095, R0 + BCC ok + MOVD $-1, R4 + MOVW R4, r+48(FP) + MOVD ZR, r2+56(FP) + NEG R0, R0 + MOVD R0, err+64(FP) + RET +ok: + MOVW R0, r+48(FP) + MOVD R1, r2+56(FP) + MOVD ZR, err+64(FP) + RET + +// psu: not tested +TEXT runtime·ioctl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R0 + MOVD req+8(FP), R1 + MOVD arg+16(FP), R2 + MOVD $0, R3 + MOVD $0, R4 + MOVD $0, R5 + MOVD $SYS_ioctl, R8 + SVC + CMN $4095, R0 + BCC ok + MOVD $-1, R4 + MOVD R4, r+24(FP) + NEG R0, R0 + MOVD R0, err+32(FP) + RET +ok: + MOVD R0, r+24(FP) + MOVD ZR, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R0 + MOVD cmd+8(FP), R1 + MOVD arg+16(FP), R2 + MOVD $0, R3 + MOVD $0, R4 + MOVD $0, R5 + MOVD $SYS_fcntl, R8 + SVC + CMN $4095, R0 + BCC ok + MOVD $-1, R4 + MOVD R4, r+24(FP) + NEG R0, R0 + MOVD R0, err+32(FP) + RET +ok: + MOVD R0, r+24(FP) + MOVD ZR, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl2(SB),NOSPLIT,$0 + MOVW fd+0(FP), R0 + MOVD cmd+8(FP), R1 + MOVD arg+16(FP), R2 + MOVD $0, R3 + MOVD $0, R4 + MOVD $0, R5 + MOVD $SYS_fcntl, R8 + SVC + CMN $4095, R0 + BCC ok + MOVD $-1, R4 + MOVD R4, r+24(FP) + NEG R0, R0 + MOVD R0, err+32(FP) + RET +ok: + MOVD R0, r+24(FP) + MOVD ZR, err+32(FP) + RET diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index 33ed1050c2..1b6c3138a3 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -31,6 +31,7 @@ #define SYS_rt_sigreturn 5211 #define SYS_rt_sigaction 5013 #define SYS_rt_sigprocmask 5014 +#define SYS_ioctl 5015 #define SYS_sigaltstack 5129 #define SYS_madvise 5027 #define SYS_mincore 5026 @@ -46,6 +47,8 @@ #define SYS_clock_gettime 5222 #define SYS_epoll_create1 5285 #define SYS_brk 5012 +#define SYS_perf_event_open 5292 + TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R4 @@ -477,3 +480,85 @@ TEXT runtime·socket(SB),$0-20 MOVV R0, 2(R0) // unimplemented, only needed for android; declared in stubs_linux.go MOVW R0, ret+16(FP) // for vet RET + +// psu: not tested +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVV attr+0(FP), R4 + MOVV pid+8(FP), R5 + MOVV cpu+16(FP), R6 + MOVV groupFd+24(FP), R7 + MOVV flags+32(FP), R8 + MOVV dummp+40(FP), R9 + MOVV $SYS_perf_event_open, R2 + SYSCALL + BEQ R7, ok + MOVV $-1, R1 + MOVV R1, r+48(FP) + MOVV R0, r2+56(FP) + MOVV R2, err+64(FP) + RET +ok: + MOVV R2, r+48(FP) + MOVV R3, r2+56(FP) + MOVV R0, err+64(FP) + RET + +// psu: not tested +TEXT runtime·ioctl,NOSPLIT,$0 + MOVV fd+0(FP), R4 + MOVV req+8(FP), R5 + MOVV arg+16(FP), R6 + MOVV R0, R7 + MOVV R0, R8 + MOVV R0, R9 + MOVV $SYS_ioctl, R2 + SYSCALL + BEQ R7, ok + MOVV $-1, R1 + MOVV R1, r+24(FP) + MOVV R2, err+32(FP) + RET +ok: + MOVV R2, r+24(FP) + MOVV R0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl,NOSPLIT,$0 + MOVV fd+0(FP), R4 + MOVV cmd+8(FP), R5 + MOVV arg+16(FP), R6 + MOVV R0, R7 + MOVV R0, R8 + MOVV R0, R9 + MOVV $SYS_fcntl, R2 + SYSCALL + BEQ R7, ok + MOVV $-1, R1 + MOVV R1, r+24(FP) + MOVV R2, err+32(FP) + RET +ok: + MOVV R2, r+24(FP) + MOVV R0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl2,NOSPLIT,$0 + MOVV fd+0(FP), R4 + MOVV cmd+8(FP), R5 + MOVV arg+16(FP), R6 + MOVV R0, R7 + MOVV R0, R8 + MOVV R0, R9 + MOVV $SYS_fcntl, R2 + SYSCALL + BEQ R7, ok + MOVV $-1, R1 + MOVV R1, r+24(FP) + MOVV R2, err+32(FP) + RET +ok: + MOVV R2, r+24(FP) + MOVV R0, err+32(FP) + RET diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index 13d23156bd..2feefe6f79 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -22,6 +22,7 @@ #define SYS_getpid 20 #define SYS_kill 37 #define SYS_brk 45 +#define SYS_ioctl 54 #define SYS_fcntl 55 #define SYS_mmap 90 #define SYS_munmap 91 @@ -45,6 +46,7 @@ #define SYS_clock_gettime 246 #define SYS_tgkill 250 #define SYS_epoll_create1 315 +#define SYS_perf_event_open 319 TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R3 @@ -634,3 +636,85 @@ TEXT runtime·socket(SB),$0-20 MOVD R0, 0(R0) // unimplemented, only needed for android; declared in stubs_linux.go MOVW R0, ret+16(FP) // for vet RET + +// psu: not tested +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVD attr+0(FP), R3 + MOVD pid+8(FP), R4 + MOVD cpu+16(FP), R5 + MOVD groupFd+24(FP), R6 + MOVD flags+32(FP), R7 + MOVD dummy+40(FP), R8 + MOVD $SYS_perf_event_open, R9 + SYSCALL R9 + BVC ok + MOVD $-1, R4 + MOVW R4, r+48(FP) + MOVD R0, r2+56(FP) + MOVD R3, err+64(FP) + RET +ok: + MOVW R3, r+48(FP) + MOVD R4, r2+56(FP) + MOVD R0, err+64(FP) + RET + +// psu: not tested +TEXT runtime·ioctl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R3 + MOVD req+8(FP), R4 + MOVD arg+16(FP), R5 + MOVD R0, R6 + MOVD R0, R7 + MOVD R0, R8 + MOVD $SYS_ioctl, R9 + SYSCALL R9 + BVC ok + MOVD $-1, R4 + MOVD R4, r+24(FP) + MOVD R3, err+32(FP) + RET +ok: + MOVD R3, r+24(FP) + MOVD R0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R3 + MOVD cmd+8(FP), R4 + MOVD arg+16(FP), R5 + MOVD R0, R6 + MOVD R0, R7 + MOVD R0, R8 + MOVD $SYS_fcntl, R9 + SYSCALL R9 + BVC ok + MOVD $-1, R4 + MOVD R4, r+24(FP) + MOVD R3, err+32(FP) + RET +ok: + MOVD R3, r+24(FP) + MOVD R0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl2(SB),NOSPLIT,$0 + MOVW fd+0(FP), R3 + MOVD cmd+8(FP), R4 + MOVD arg+16(FP), R5 + MOVD R0, R6 + MOVD R0, R7 + MOVD R0, R8 + MOVD $SYS_fcntl, R9 + SYSCALL R9 + BVC ok + MOVD $-1, R4 + MOVD R4, r+24(FP) + MOVD R3, err+32(FP) + RET +ok: + MOVD R3, r+24(FP) + MOVD R0, err+32(FP) + RET diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s index 58b36dff0a..0c8e95da6a 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s @@ -17,6 +17,7 @@ #define SYS_getpid 20 #define SYS_kill 37 #define SYS_brk 45 +#define SYS_ioctl 54 #define SYS_fcntl 55 #define SYS_mmap 90 #define SYS_munmap 91 @@ -40,6 +41,7 @@ #define SYS_epoll_wait 251 #define SYS_clock_gettime 260 #define SYS_epoll_create1 327 +#define SYS_perf_event_open 331 TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R2 @@ -464,3 +466,89 @@ TEXT runtime·socket(SB),$0-20 MOVD $0, 2(R0) // unimplemented, only needed for android; declared in stubs_linux.go MOVW R0, ret+16(FP) RET + +// psu: not tested +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 + MOVD attr+0(FP), R2 + MOVD pid+8(FP), R3 + MOVD cpu+16(FP), R4 + MOVD groupFd+24(FP), R5 + MOVD flags+32(FP), R6 + MOVD dummy+40(FP), R7 + MOVD SYS_perf_event_open, R1 + SYSCALL + MOVD $0xfffffffffffff001, R8 + CMPUBLT R2, R8, ok + MOVW $-1, r+48(FP) + MOVD $0, r2+56(FP) + NEG R2, R2 + MOVD R2, err+64(FP) + RET +ok: + MOVW R2, r+48(FP) + MOVD R3, r2+56(FP) + MOVD $0, err+64(FP) + RET + +// psu: not tested +TEXT runtime·ioctl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R2 + MOVD req+8(FP), R3 + MOVD arg+16(FP), R4 + MOVD $0, R5 + MOVD $0, R6 + MOVD $0, R7 + MOVD $SYS_ioctl, R1 + SYSCALL + MOVD $0xfffffffffffff001, R8 + CMPUBLT R2, R8, ok + MOVD $-1, r+24(FP) + NEG R2, R2 + MOVD R2, err+32(FP) + RET +ok: + MOVD R2, r+24(FP) + MOVD $0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl(SB),NOSPLIT,$0 + MOVW fd+0(FP), R2 + MOVD cmd+8(FP), R3 + MOVD arg+16(FP), R4 + MOVD $0, R5 + MOVD $0, R6 + MOVD $0, R7 + MOVD $SYS_fcntl, R1 + SYSCALL + MOVD $0xfffffffffffff001, R8 + CMPUBLT R2, R8, ok + MOVD $-1, r+24(FP) + NEG R2, R2 + MOVD R2, err+32(FP) + RET +ok: + MOVD R2, r+24(FP) + MOVD $0, err+32(FP) + RET + +// psu: not tested +TEXT runtime·fcntl2(SB),NOSPLIT,$0 + MOVW fd+0(FP), R2 + MOVD cmd+8(FP), R3 + MOVD arg+16(FP), R4 + MOVD $0, R5 + MOVD $0, R6 + MOVD $0, R7 + MOVD $SYS_fcntl, R1 + SYSCALL + MOVD $0xfffffffffffff001, R8 + CMPUBLT R2, R8, ok + MOVD $-1, r+24(FP) + NEG R2, R2 + MOVD R2, err+32(FP) + RET +ok: + MOVD R2, r+24(FP) + MOVD $0, err+32(FP) + RET From 63bab352d9b5f70a8c3e2892f06d2502a5d381ee Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 14 Jul 2019 21:13:31 -0700 Subject: [PATCH 063/126] minor --- src/runtime/sys_linux_386.s | 8 ++++---- src/runtime/sys_linux_amd64.s | 8 ++++---- src/runtime/sys_linux_arm.s | 8 ++++---- src/runtime/sys_linux_arm64.s | 8 ++++---- src/runtime/sys_linux_mips64x.s | 8 ++++---- src/runtime/sys_linux_ppc64x.s | 8 ++++---- src/runtime/sys_linux_s390x.s | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s index dc8509c115..c9d10cdaad 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s @@ -738,7 +738,7 @@ TEXT runtime·sbrk0(SB),NOSPLIT,$0-4 RET // psu: not tested -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-36 MOVL attr+0(FP), BX MOVL pid+4(FP), CX MOVL cpu+8(FP), DX @@ -761,7 +761,7 @@ ok: RET // psu: not tested -TEXT runtime·ioctl(SB),NOSPLIT,$0 +TEXT runtime·ioctl(SB),NOSPLIT,$0-20 MOVL fd+0(FP), BX MOVL req+4(FP), CX MOVL arg+8(FP), DX @@ -781,7 +781,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl(SB),NOSPLIT,$0 +TEXT runtime·fcntl(SB),NOSPLIT,$0-20 MOVL fd+0(FP), BX MOVL cmd+4(FP), CX MOVL arg+8(FP), DX @@ -801,7 +801,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl2(SB),NOSPLIT,$0 +TEXT runtime·fcntl2(SB),NOSPLIT,$0-20 MOVL fd+0(FP), BX MOVL cmd+4(FP), CX MOVL arg+8(FP), DX diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 477f018e2e..6a2aa60867 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -726,7 +726,7 @@ TEXT runtime·sbrk0(SB),NOSPLIT,$0-8 MOVQ AX, ret+0(FP) RET -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-72 MOVQ attr+0(FP), DI MOVQ pid+8(FP), SI MOVQ cpu+16(FP), DX @@ -748,7 +748,7 @@ ok: MOVQ $0, err+64(FP) RET -TEXT runtime·ioctl(SB),NOSPLIT,$0 +TEXT runtime·ioctl(SB),NOSPLIT,$0-40 MOVL fd+0(FP), DI MOVQ req+8(FP), SI MOVQ arg+16(FP), DX @@ -768,7 +768,7 @@ ok: MOVQ $0, err+32(FP) RET -TEXT runtime·fcntl(SB),NOSPLIT,$0 +TEXT runtime·fcntl(SB),NOSPLIT,$0-40 MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX @@ -788,7 +788,7 @@ ok: MOVQ $0, err+32(FP) RET -TEXT runtime·fcntl2(SB),NOSPLIT,$0 +TEXT runtime·fcntl2(SB),NOSPLIT,$0-40 MOVL fd+0(FP), DI MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s index 7eb71cd456..a1fea01cd5 100644 --- a/src/runtime/sys_linux_arm.s +++ b/src/runtime/sys_linux_arm.s @@ -613,7 +613,7 @@ TEXT runtime·sigreturn(SB),NOSPLIT,$0-0 RET // psu: not tested -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-36 MOVW attr+0(FP), R0 MOVW pid+4((FP), R1 MOVW cpu+8(FP), R2 @@ -640,7 +640,7 @@ ok: RET // psu: not tested -TEXT runtime·ioctl(SB),NOSPLIT,$0 +TEXT runtime·ioctl(SB),NOSPLIT,$0-20 MOVW fd+0(FP), R0 MOVW req+4(FP), R1 MOVW arg+8(FP), R2 @@ -664,7 +664,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl(SB),NOSPLIT,$0 +TEXT runtime·fcntl(SB),NOSPLIT,$0-20 MOVW fd+0(FP), R0 MOVW cmd+4(FP), R1 MOVW arg+8(FP), R2 @@ -688,7 +688,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl2(SB),NOSPLIT,$0 +TEXT runtime·fcntl2(SB),NOSPLIT,$0-20 MOVW fd+0(FP), R0 MOVW cmd+4(FP), R1 MOVW arg+8(FP), R2 diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s index b136bd6a0a..7a3672039d 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -606,7 +606,7 @@ TEXT runtime·sigreturn(SB),NOSPLIT,$0-0 RET // psu: not tested -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-72 MOVD attr+0(FP), R0 MOVD pid+8((FP), R1 MOVD cpu+16(FP), R2 @@ -630,7 +630,7 @@ ok: RET // psu: not tested -TEXT runtime·ioctl(SB),NOSPLIT,$0 +TEXT runtime·ioctl(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R0 MOVD req+8(FP), R1 MOVD arg+16(FP), R2 @@ -652,7 +652,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl(SB),NOSPLIT,$0 +TEXT runtime·fcntl(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R0 MOVD cmd+8(FP), R1 MOVD arg+16(FP), R2 @@ -674,7 +674,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl2(SB),NOSPLIT,$0 +TEXT runtime·fcntl2(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R0 MOVD cmd+8(FP), R1 MOVD arg+16(FP), R2 diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index 1b6c3138a3..245982ca9a 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -482,7 +482,7 @@ TEXT runtime·socket(SB),$0-20 RET // psu: not tested -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-72 MOVV attr+0(FP), R4 MOVV pid+8(FP), R5 MOVV cpu+16(FP), R6 @@ -504,7 +504,7 @@ ok: RET // psu: not tested -TEXT runtime·ioctl,NOSPLIT,$0 +TEXT runtime·ioctl,NOSPLIT,$0-40 MOVV fd+0(FP), R4 MOVV req+8(FP), R5 MOVV arg+16(FP), R6 @@ -524,7 +524,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl,NOSPLIT,$0 +TEXT runtime·fcntl,NOSPLIT,$0-40 MOVV fd+0(FP), R4 MOVV cmd+8(FP), R5 MOVV arg+16(FP), R6 @@ -544,7 +544,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl2,NOSPLIT,$0 +TEXT runtime·fcntl2,NOSPLIT,$0-40 MOVV fd+0(FP), R4 MOVV cmd+8(FP), R5 MOVV arg+16(FP), R6 diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index 2feefe6f79..e030320aab 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -638,7 +638,7 @@ TEXT runtime·socket(SB),$0-20 RET // psu: not tested -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-72 MOVD attr+0(FP), R3 MOVD pid+8(FP), R4 MOVD cpu+16(FP), R5 @@ -660,7 +660,7 @@ ok: RET // psu: not tested -TEXT runtime·ioctl(SB),NOSPLIT,$0 +TEXT runtime·ioctl(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R3 MOVD req+8(FP), R4 MOVD arg+16(FP), R5 @@ -680,7 +680,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl(SB),NOSPLIT,$0 +TEXT runtime·fcntl(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R3 MOVD cmd+8(FP), R4 MOVD arg+16(FP), R5 @@ -700,7 +700,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl2(SB),NOSPLIT,$0 +TEXT runtime·fcntl2(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R3 MOVD cmd+8(FP), R4 MOVD arg+16(FP), R5 diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s index 0c8e95da6a..3c85b3cd9e 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s @@ -468,7 +468,7 @@ TEXT runtime·socket(SB),$0-20 RET // psu: not tested -TEXT runtime·perfEventOpen(SB),NOSPLIT,$0 +TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-72 MOVD attr+0(FP), R2 MOVD pid+8(FP), R3 MOVD cpu+16(FP), R4 @@ -491,7 +491,7 @@ ok: RET // psu: not tested -TEXT runtime·ioctl(SB),NOSPLIT,$0 +TEXT runtime·ioctl(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R2 MOVD req+8(FP), R3 MOVD arg+16(FP), R4 @@ -512,7 +512,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl(SB),NOSPLIT,$0 +TEXT runtime·fcntl(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R2 MOVD cmd+8(FP), R3 MOVD arg+16(FP), R4 @@ -533,7 +533,7 @@ ok: RET // psu: not tested -TEXT runtime·fcntl2(SB),NOSPLIT,$0 +TEXT runtime·fcntl2(SB),NOSPLIT,$0-40 MOVW fd+0(FP), R2 MOVD cmd+8(FP), R3 MOVD arg+16(FP), R4 From 82040ab9b2c1f3ef218299959d8ddb60644883bc Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 14 Jul 2019 21:20:21 -0700 Subject: [PATCH 064/126] removal --- src/runtime/defs_pmu_linux.go | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/runtime/defs_pmu_linux.go diff --git a/src/runtime/defs_pmu_linux.go b/src/runtime/defs_pmu_linux.go deleted file mode 100644 index 53e9de244a..0000000000 --- a/src/runtime/defs_pmu_linux.go +++ /dev/null @@ -1,12 +0,0 @@ -package runtime - -var perfEventOpt = []struct { - Type uint32 // type of event - Config uint64 // event -} { - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES - // TODO: add more perf events -} From 87dbdacd1d5c00c3f1de28393c7715855e8483e0 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 14 Jul 2019 21:23:06 -0700 Subject: [PATCH 065/126] delete redundant code --- src/runtime/defs_linux_386.go | 22 -------------------- src/runtime/defs_linux_amd64.go | 22 -------------------- src/runtime/defs_linux_arm.go | 22 -------------------- src/runtime/defs_linux_arm64.go | 22 -------------------- src/runtime/defs_linux_mips64x.go | 22 -------------------- src/runtime/defs_linux_mipsx.go | 22 -------------------- src/runtime/defs_linux_ppc64.go | 22 -------------------- src/runtime/defs_linux_ppc64le.go | 22 -------------------- src/runtime/defs_linux_s390x.go | 22 -------------------- src/runtime/defs_perf_linux.go | 34 +++++++++++++++++++++++++++++++ 10 files changed, 34 insertions(+), 198 deletions(-) create mode 100644 src/runtime/defs_perf_linux.go diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index f03fcb8bce..f9d3808636 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -355,28 +355,6 @@ type sockaddr_un struct { path [108]byte } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only tested on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 888f7363a0..0ba2bf1c01 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -390,28 +390,6 @@ type sockaddr_un struct { path [108]byte } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index e6e3327cf0..dfbf75c3b4 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -309,28 +309,6 @@ type sockaddr_un struct { path [108]byte } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only tested on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index a39d5b6699..2861279eb7 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -314,28 +314,6 @@ type ucontext struct { uc_mcontext sigcontext } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only test it on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index d2b21cd997..15d0a251dc 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -310,28 +310,6 @@ type ucontext struct { uc_sigmask uint64 } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only test it on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index 2bffac0c9a..68bab01e00 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -312,28 +312,6 @@ type ucontext struct { uc_sigmask [4]uint32 } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only test it on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index 15867d6795..ef7f654e22 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -327,28 +327,6 @@ type ucontext struct { uc_mcontext sigcontext } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only test it on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index 5e51f2398d..8cd3624ebc 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -327,28 +327,6 @@ type ucontext struct { uc_mcontext sigcontext } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only test it on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index 0f3b134341..e679758ba9 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -294,28 +294,6 @@ type ucontext struct { uc_sigmask uint64 } -type perfEventAttr struct { - Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 - _ uint16 -} - // psu: only test it on amd64 type fOwnerEx struct { Type int32 diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go new file mode 100644 index 0000000000..5caef3ef10 --- /dev/null +++ b/src/runtime/defs_perf_linux.go @@ -0,0 +1,34 @@ +package runtime + +var perfEventOpt = []struct { + Type uint32 // type of event + Config uint64 // event +} { + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES + // TODO: add more perf events +} + +type perfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 + _ uint16 +} From d6a1b0dcf738306ec2c129e1917d41adfb197d4d Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 15 Jul 2019 13:24:34 -0700 Subject: [PATCH 066/126] tests --- test/pmu/http/test2.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/pmu/http/test2.go b/test/pmu/http/test2.go index 3b09b9ea1e..e2b42d820c 100644 --- a/test/pmu/http/test2.go +++ b/test/pmu/http/test2.go @@ -7,9 +7,8 @@ import ( "fmt" "log" "sync" - // "time" - "net/http" - _ "net/http/pprof" + "net/http" + _ "net/http/pprof" ) var wg sync.WaitGroup From 83ffbb86d3ce0c00595fe95383a33153cbf94278 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 15 Jul 2019 13:25:16 -0700 Subject: [PATCH 067/126] indention --- src/runtime/defs_linux_386.go | 26 +++++++++++++------------- src/runtime/defs_linux_arm.go | 28 ++++++++++++++-------------- src/runtime/defs_linux_arm64.go | 28 ++++++++++++++-------------- src/runtime/defs_linux_mips64x.go | 29 ++++++++++++++--------------- src/runtime/defs_linux_mipsx.go | 28 ++++++++++++++-------------- src/runtime/defs_linux_ppc64.go | 28 ++++++++++++++-------------- src/runtime/defs_linux_ppc64le.go | 28 ++++++++++++++-------------- src/runtime/defs_linux_s390x.go | 28 ++++++++++++++-------------- src/runtime/defs_perf_linux.go | 4 ++-- src/runtime/pprof/pprof.go | 26 +++++++++++++++++--------- src/runtime/proc.go | 7 +++---- src/runtime/signal_unix.go | 2 -- src/runtime/sys_linux_386.s | 6 +++--- src/runtime/sys_linux_amd64.s | 12 ++++++------ src/runtime/sys_linux_arm.s | 4 ++-- src/runtime/sys_linux_arm64.s | 2 +- src/runtime/sys_linux_mips64x.s | 8 ++++---- src/runtime/sys_linux_s390x.s | 2 +- 18 files changed, 150 insertions(+), 146 deletions(-) diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index f9d3808636..5e078b3b26 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -115,7 +115,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -123,14 +123,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -142,7 +142,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -155,7 +155,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -173,12 +173,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -195,20 +195,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x2401 _PERF_EVENT_IOC_ENABLE = 0x2400 _PERF_EVENT_IOC_ID = 0x80042407 @@ -355,7 +355,7 @@ type sockaddr_un struct { path [108]byte } -// psu: only tested on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index dfbf75c3b4..e27ce80c9a 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -97,7 +97,7 @@ const ( _PERF_TYPE_HW_CACHE = 0x3 _PERF_TYPE_RAW = 0x4 _PERF_TYPE_BREAKPOINT = 0x5 - + _PERF_COUNT_HW_CPU_CYCLES = 0x0 _PERF_COUNT_HW_INSTRUCTIONS = 0x1 _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -108,7 +108,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -116,14 +116,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -135,7 +135,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -148,7 +148,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -166,12 +166,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -188,20 +188,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x2401 _PERF_EVENT_IOC_ENABLE = 0x2400 _PERF_EVENT_IOC_ID = 0x80042407 @@ -309,7 +309,7 @@ type sockaddr_un struct { path [108]byte } -// psu: only tested on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index 2861279eb7..ba754fa6a5 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -101,7 +101,7 @@ const ( _PERF_TYPE_HW_CACHE = 0x3 _PERF_TYPE_RAW = 0x4 _PERF_TYPE_BREAKPOINT = 0x5 - + _PERF_COUNT_HW_CPU_CYCLES = 0x0 _PERF_COUNT_HW_INSTRUCTIONS = 0x1 _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -112,7 +112,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -120,14 +120,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -139,7 +139,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -152,7 +152,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -170,12 +170,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -192,20 +192,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x2401 _PERF_EVENT_IOC_ENABLE = 0x2400 _PERF_EVENT_IOC_ID = 0x80082407 @@ -314,7 +314,7 @@ type ucontext struct { uc_mcontext sigcontext } -// psu: only test it on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index 15d0a251dc..da591ad867 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -96,7 +96,7 @@ const ( _PERF_TYPE_HW_CACHE = 0x3 _PERF_TYPE_RAW = 0x4 _PERF_TYPE_BREAKPOINT = 0x5 - + _PERF_COUNT_HW_CPU_CYCLES = 0x0 _PERF_COUNT_HW_INSTRUCTIONS = 0x1 _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -107,7 +107,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -115,14 +115,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -134,7 +134,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -147,7 +147,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -165,12 +165,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -187,20 +187,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x20002401 _PERF_EVENT_IOC_ENABLE = 0x20002400 _PERF_EVENT_IOC_ID = 0x40082407 @@ -310,9 +310,8 @@ type ucontext struct { uc_sigmask uint64 } -// psu: only test it on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 } - diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index 68bab01e00..957d57ba36 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -100,7 +100,7 @@ const ( _PERF_TYPE_HW_CACHE = 0x3 _PERF_TYPE_RAW = 0x4 _PERF_TYPE_BREAKPOINT = 0x5 - + _PERF_COUNT_HW_CPU_CYCLES = 0x0 _PERF_COUNT_HW_INSTRUCTIONS = 0x1 _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -111,7 +111,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -119,14 +119,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -138,7 +138,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -151,7 +151,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -169,12 +169,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -191,20 +191,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x20002401 _PERF_EVENT_IOC_ENABLE = 0x20002400 _PERF_EVENT_IOC_ID = 0x40042407 @@ -312,7 +312,7 @@ type ucontext struct { uc_sigmask [4]uint32 } -// psu: only test it on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index ef7f654e22..3810ccb0b3 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -96,7 +96,7 @@ const ( _PERF_TYPE_HW_CACHE = 0x3 _PERF_TYPE_RAW = 0x4 _PERF_TYPE_BREAKPOINT = 0x5 - + _PERF_COUNT_HW_CPU_CYCLES = 0x0 _PERF_COUNT_HW_INSTRUCTIONS = 0x1 _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -107,7 +107,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -115,14 +115,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -134,7 +134,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -147,7 +147,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -165,12 +165,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -187,20 +187,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x2401 _PERF_EVENT_IOC_ENABLE = 0x2400 _PERF_EVENT_IOC_ID = 0x80082407 @@ -327,7 +327,7 @@ type ucontext struct { uc_mcontext sigcontext } -// psu: only test it on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index 8cd3624ebc..adf6111eae 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -96,7 +96,7 @@ const ( _PERF_TYPE_HW_CACHE = 0x3 _PERF_TYPE_RAW = 0x4 _PERF_TYPE_BREAKPOINT = 0x5 - + _PERF_COUNT_HW_CPU_CYCLES = 0x0 _PERF_COUNT_HW_INSTRUCTIONS = 0x1 _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -107,7 +107,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -115,14 +115,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -134,7 +134,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -147,7 +147,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -165,12 +165,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -187,20 +187,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x20002401 _PERF_EVENT_IOC_ENABLE = 0x20002400 _PERF_EVENT_IOC_ID = 0x40082407 @@ -327,7 +327,7 @@ type ucontext struct { uc_mcontext sigcontext } -// psu: only test it on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index e679758ba9..b93148ff65 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -97,7 +97,7 @@ const ( _PERF_TYPE_HW_CACHE = 0x3 _PERF_TYPE_RAW = 0x4 _PERF_TYPE_BREAKPOINT = 0x5 - + _PERF_COUNT_HW_CPU_CYCLES = 0x0 _PERF_COUNT_HW_INSTRUCTIONS = 0x1 _PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -108,7 +108,7 @@ const ( _PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 _PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 _PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - + _PERF_COUNT_HW_CACHE_L1D = 0x0 _PERF_COUNT_HW_CACHE_L1I = 0x1 _PERF_COUNT_HW_CACHE_LL = 0x2 @@ -116,14 +116,14 @@ const ( _PERF_COUNT_HW_CACHE_ITLB = 0x4 _PERF_COUNT_HW_CACHE_BPU = 0x5 _PERF_COUNT_HW_CACHE_NODE = 0x6 - + _PERF_COUNT_HW_CACHE_OP_READ = 0x0 _PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 _PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - + _PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 _PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - + _PERF_COUNT_SW_CPU_CLOCK = 0x0 _PERF_COUNT_SW_TASK_CLOCK = 0x1 _PERF_COUNT_SW_PAGE_FAULTS = 0x2 @@ -135,7 +135,7 @@ const ( _PERF_COUNT_SW_EMULATION_FAULTS = 0x8 _PERF_COUNT_SW_DUMMY = 0x9 _PERF_COUNT_SW_BPF_OUTPUT = 0xa - + _PERF_SAMPLE_IP = 0x1 _PERF_SAMPLE_TID = 0x2 _PERF_SAMPLE_TIME = 0x4 @@ -148,7 +148,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - + _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 _PERF_SAMPLE_BRANCH_HV = 0x4 @@ -166,12 +166,12 @@ const ( _PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 _PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 _PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - + _PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 _PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 - + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 @@ -188,20 +188,20 @@ const ( _PERF_RECORD_SWITCH = 0xe _PERF_RECORD_SWITCH_CPU_WIDE = 0xf _PERF_RECORD_NAMESPACES = 0x10 - + _PERF_CONTEXT_HV = -0x20 _PERF_CONTEXT_KERNEL = -0x80 _PERF_CONTEXT_USER = -0x200 - + _PERF_CONTEXT_GUEST = -0x800 _PERF_CONTEXT_GUEST_KERNEL = -0x880 _PERF_CONTEXT_GUEST_USER = -0xa00 - + _PERF_FLAG_FD_NO_GROUP = 0x1 _PERF_FLAG_FD_OUTPUT = 0x2 _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - + _PERF_EVENT_IOC_DISABLE = 0x2401 _PERF_EVENT_IOC_ENABLE = 0x2400 _PERF_EVENT_IOC_ID = 0x80082407 @@ -294,7 +294,7 @@ type ucontext struct { uc_sigmask uint64 } -// psu: only test it on amd64 +// psu: only tested on amd64 type fOwnerEx struct { Type int32 Pid int32 diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index 5caef3ef10..b2f3c775e9 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -2,9 +2,9 @@ package runtime var perfEventOpt = []struct { Type uint32 // type of event - Config uint64 // event + Config uint64 // event } { - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES + {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 46facfb32f..033cc3e1a1 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -740,6 +740,13 @@ var cpu struct { // for syscall.SIGPROF, but note that doing so may break any profiling // being done by the main program. func StartCPUProfile(w io.Writer, profileHz ...int) error { + pmu.Lock() + if pmu.profiling { + pmu.Unlock() + return errors.New("Please disable pmu profiling before enabling cpu profiling") + } + pmu.Unlock() + // The runtime routines allow a variable profiling rate, // but in practice operating systems cannot trigger signals // at more than about 500 Hz, and our processing of the @@ -760,9 +767,6 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { cpu.done = make(chan bool) } // Double-check. - if pmu.profiling { - return errors.New("Please enable either cpu or pmu profiling instead of both") - } if cpu.profiling { return fmt.Errorf("cpu profiling already in use") } @@ -781,17 +785,21 @@ var pmu struct { } func StartPMUProfile(opts ...ProfilingOption) error { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" /* TODO GOOS is not linux amd64 */ { + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { return errors.New("not implemented") } + cpu.Lock() + if cpu.profiling { + cpu.Unlock() + return errors.New("Please disable cpu profiling before enabling pmu profiling") + } + cpu.Unlock() + pmu.Lock() defer pmu.Unlock() pmu.wg.Add(len(opts)) // Double-check. - if cpu.profiling { - return errors.New("Please enable either cpu or pmu profiling instead of both") - } if pmu.profiling { return errors.New("pmu profiling already in use") } @@ -920,7 +928,7 @@ func profileWriter(w io.Writer) { if err != nil { // The runtime should never produce an invalid or truncated profile. // It drops records that can't fit into its log buffers. - panic("runtime/pprof: converting profile: " + err.Error()) + panic("runtime/pprof: converting profile: " + err.Error()) } b.build() cpu.done <- true @@ -972,7 +980,7 @@ func StopPMUProfile() { for i := 0; i < maxPMUEvent; i++ { if pmu.eventOn[i] { - runtime.SetPMUProfile(i, nil) + runtime.SetPMUProfile(i, nil) } } pmu.wg.Wait() diff --git a/src/runtime/proc.go b/src/runtime/proc.go index eba7a6cee1..ed7da9fe30 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3714,7 +3714,7 @@ func stackUnwinding(pc, sp, lr uintptr, gp *g, mp *m, stk []uintptr) int { if gp == nil || sp < gp.stack.lo || gp.stack.hi < sp || setsSP(pc) || (mp != nil && mp.vdsoSP != 0) { traceback = false } - n := 0 + n := 0 if mp.ncgo > 0 && mp.curg != nil && mp.curg.syscallpc != 0 && mp.curg.syscallsp != 0 { cgoOff := 0 // Check cgoCallersUse to make sure that we are not @@ -3768,8 +3768,7 @@ func stackUnwinding(pc, sp, lr uintptr, gp *g, mp *m, stk []uintptr) int { } } } - - return n + return n } // Counts SIGPROFs received while in atomic64 critical section, on mips{,le} @@ -3818,7 +3817,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { var lostPMUAtomic64Count[maxPMUEvent] uint64 -// Called if we receive a SIGPROF signal and PMU is enabled. +// Called if we receive a SIGPROF signal and PMU is enabled. // Called by the signal handler, may run during STW. //go:nowritebarrierrec func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 5a618483e8..335b06a185 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -44,8 +44,6 @@ const ( _PMU_INSTALLED = 2 ) -var sigState uint32 - // Stores the signal handlers registered before Go installed its own. // These signal handlers will be invoked in cases where Go doesn't want to // handle a particular signal (e.g., signal occurred on a non-Go thread). diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s index c9d10cdaad..5b5e85c067 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s @@ -766,7 +766,7 @@ TEXT runtime·ioctl(SB),NOSPLIT,$0-20 MOVL req+4(FP), CX MOVL arg+8(FP), DX MOVL $0, SI - MOVL $0, DI + MOVL $0, DI MOVL $SYS_ioctl, AX INVOKE_SYSCALL CMPL AX, $0xfffff001 @@ -786,7 +786,7 @@ TEXT runtime·fcntl(SB),NOSPLIT,$0-20 MOVL cmd+4(FP), CX MOVL arg+8(FP), DX MOVL $0, SI - MOVL $0, DI + MOVL $0, DI MOVL $SYS_fcntl, AX INVOKE_SYSCALL CMPL AX, $0xfffff001 @@ -806,7 +806,7 @@ TEXT runtime·fcntl2(SB),NOSPLIT,$0-20 MOVL cmd+4(FP), CX MOVL arg+8(FP), DX MOVL $0, SI - MOVL $0, DI + MOVL $0, DI MOVL $SYS_fcntl, AX INVOKE_SYSCALL CMPL AX, $0xfffff001 diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 6a2aa60867..40a2bd1f7f 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -753,8 +753,8 @@ TEXT runtime·ioctl(SB),NOSPLIT,$0-40 MOVQ req+8(FP), SI MOVQ arg+16(FP), DX MOVQ $0, R10 - MOVQ $0, R8 - MOVQ $0, R9 + MOVQ $0, R8 + MOVQ $0, R9 MOVQ $SYS_ioctl, AX SYSCALL CMPQ AX, $0xfffffffffffff001 @@ -773,8 +773,8 @@ TEXT runtime·fcntl(SB),NOSPLIT,$0-40 MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX MOVQ $0, R10 - MOVQ $0, R8 - MOVQ $0, R9 + MOVQ $0, R8 + MOVQ $0, R9 MOVQ $SYS_fcntl, AX SYSCALL CMPQ AX, $0xfffffffffffff001 @@ -793,8 +793,8 @@ TEXT runtime·fcntl2(SB),NOSPLIT,$0-40 MOVQ cmd+8(FP), SI MOVQ arg+16(FP), DX MOVQ $0, R10 - MOVQ $0, R8 - MOVQ $0, R9 + MOVQ $0, R8 + MOVQ $0, R9 MOVQ $SYS_fcntl, AX SYSCALL CMPQ AX, $0xfffffffffffff001 diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s index a1fea01cd5..72cbfd2030 100644 --- a/src/runtime/sys_linux_arm.s +++ b/src/runtime/sys_linux_arm.s @@ -622,7 +622,7 @@ TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-36 MOVW dummy+20(FP), R5 MOVW $SYS_perf_event_open, R7 SWI $0 - MOVW $0xfffff001, R6 + MOVW $0xfffff001, R6 CMP R6, R0 BLS ok MOVW $-1, R1 @@ -630,7 +630,7 @@ TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-36 MOVW $0, R2 MOVW R2, r2+28(FP) RSB $0, R0, R0 - MOVW R0, err+32(FP) + MOVW R0, err+32(FP) RET ok: MOVW R0, r+24(FP) diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s index 7a3672039d..2af3c8a0d1 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -49,7 +49,7 @@ #define SYS_socket 198 #define SYS_connect 203 #define SYS_brk 214 -#define SYS_perf_event_open 241 +#define SYS_perf_event_open 241 TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R0 diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index 245982ca9a..5bcf7b5407 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -31,7 +31,7 @@ #define SYS_rt_sigreturn 5211 #define SYS_rt_sigaction 5013 #define SYS_rt_sigprocmask 5014 -#define SYS_ioctl 5015 +#define SYS_ioctl 5015 #define SYS_sigaltstack 5129 #define SYS_madvise 5027 #define SYS_mincore 5026 @@ -515,12 +515,12 @@ TEXT runtime·ioctl,NOSPLIT,$0-40 SYSCALL BEQ R7, ok MOVV $-1, R1 - MOVV R1, r+24(FP) + MOVV R1, r+24(FP) MOVV R2, err+32(FP) RET ok: - MOVV R2, r+24(FP) - MOVV R0, err+32(FP) + MOVV R2, r+24(FP) + MOVV R0, err+32(FP) RET // psu: not tested diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s index 3c85b3cd9e..4f75286ba5 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s @@ -41,7 +41,7 @@ #define SYS_epoll_wait 251 #define SYS_clock_gettime 260 #define SYS_epoll_create1 327 -#define SYS_perf_event_open 331 +#define SYS_perf_event_open 331 TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R2 From 9b86a34af7a88b7832a7cb5dbd4fa830020b9ab8 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 15 Jul 2019 20:05:17 -0700 Subject: [PATCH 068/126] refactoring --- src/net/http/pprof/pprof.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index 6b74d51344..e58f82568c 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -133,13 +133,13 @@ func pmuProfile(w http.ResponseWriter, r *http.Request) error { switch eventName := r.FormValue("event"); eventName { case "cycles": - err = pprof.StartPMUProfile(pprof.WithProfilingCycle(w, &eventConfig)) + err = pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) case "instructions": - err = pprof.StartPMUProfile(pprof.WithProfilingInstr(w, &eventConfig)) + err = pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) case "cacheReferences": - err = pprof.StartPMUProfile(pprof.WithProfilingCacheRef(w, &eventConfig)) + err = pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) case "cacheMisses": - err = pprof.StartPMUProfile(pprof.WithProfilingCacheMiss(w, &eventConfig)) + err = pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) default: return errors.New("unknown or not yet implemented event") } From 5130c9bef482bfbb361ec9bfb6531c24954d6ccf Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 16 Jul 2019 11:26:49 -0700 Subject: [PATCH 069/126] refactoring --- src/runtime/os_linux.go | 63 ++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index c2b8208ec1..a957df0242 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -8,6 +8,7 @@ import ( "runtime/internal/atomic" "runtime/internal/sys" "unsafe" + // "sync/atomic" ) type mOS struct{} @@ -290,10 +291,12 @@ func getHugePageSize() uintptr { func osinit() { ncpu = getproccount() physHugePageSize = getHugePageSize() - - register_setProcessPMUProfiler = setProcessPMUProfiler - register_setThreadPMUProfiler = setThreadPMUProfiler - register_sigpmuhandler = sigpmuhandler + + // following the same convention as other write once variables in this function and + // assuming that there exists a memory fence before anybody reads these values + setProcessPMUProfilerFptr = setProcessPMUProfiler + setThreadPMUProfilerFptr = setThreadPMUProfiler + sigprofPMUHandlerFptr = sigprofPMUHandler } var urandom_dev = []byte("/dev/urandom\x00") @@ -471,7 +474,7 @@ func setProcessPMUProfiler(eventAttr *PMUEventAttr) { if racyUpdatedVal != _UNINSTALLED { panic("never reach here since pprof should have protected us") } else { - println("sombody else did the job for us") + // Sombody else did the job for us } } } @@ -481,6 +484,9 @@ func setProcessPMUProfiler(eventAttr *PMUEventAttr) { if !sigInstallGoHandler(_SIGPROF) { if atomic.Cas(&handlingSig[_SIGPROF], _PMU_INSTALLED, _UNINSTALLED) { setsig(_SIGPROF, atomic.Loaduintptr(&fwdSig[_SIGPROF])) + } else { + // Some other thread already replaced _PMU_INSTALLED with some other value. + // Ideally this should not happen in correctly written user code. } } } @@ -513,13 +519,36 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { perfAttr.Bits += 0b1000000 } - fd, _, _ := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) - _g_.m.eventFds[eventId] = fd - r, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) - fcntl(fd, /* F_SETFL */ 0x4, r | /* O_ASYNC */ 0x2000) - fcntl(fd, /* F_SETSIG */ 0xa, _SIGPROF) + fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) + if err != 0 { + println("Linux perf event open failed") + return + } + + flag, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) + _, err = fcntl(fd, /* F_SETFL */ 0x4, flag | /* O_ASYNC */ 0x2000) + if err != 0 { + println("Failed to set notification for the PMU event") + closefd(fd) + return + } + + _, err = fcntl(fd, /* F_SETSIG */ 0xa, _SIGPROF) + if err != 0 { + println("Failed to set signal for the PMU event") + closefd(fd) + return + } + fOwnEx := fOwnerEx{/* F_OWNER_TID */ 0, int32(gettid())} - fcntl2(fd, /* F_SETOWN_EX */ 0xf, &fOwnEx) + _, err = fcntl2(fd, /* F_SETOWN_EX */ 0xf, &fOwnEx) + if err != 0 { + println("Failed to set the owner of the perf event file") + closefd(fd) + return + } + + _g_.m.eventFds[eventId] = fd } _g_.m.eventAttrs[eventId] = eventAttr @@ -528,21 +557,23 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { func ioctl(fd int32, req, arg int) (r, err int) //go:nowritebarrierrec -func sigpmuhandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { +func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { fd := info.si_fd - ioctl(fd, _PERF_EVENT_IOC_DISABLE, 0) + ioctl(fd, _PERF_EVENT_IOC_DISABLE, 0) // we don't care about failing ioctl var eventId int = -1 - for i := 0; i < maxPMUEvent; i++ { + for i := 0; i < MaxPMUEvent; i++ { if _g_.m.eventFds[i] == fd { eventId = i break } } if eventId != -1 { - sigpmu(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) + sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) + } else { + println("should never reach here") } - ioctl(fd, _PERF_EVENT_IOC_ENABLE, 0) + ioctl(fd, _PERF_EVENT_IOC_ENABLE, 0) // we don't care about failing ioctl return } From 938c5f2f9798179ed1bf1f72192efa3410314572 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 16 Jul 2019 13:40:02 -0700 Subject: [PATCH 070/126] refactoring --- src/runtime/cpuprof.go | 19 ++++---- src/runtime/os_linux.go | 23 +++------- src/runtime/pprof/pprof.go | 77 +++++++++++++++----------------- src/runtime/proc.go | 54 +++++++++++----------- src/runtime/runtime2.go | 6 +-- src/runtime/signal_sighandler.go | 8 ++-- src/runtime/signal_unix.go | 23 ++++------ 7 files changed, 97 insertions(+), 113 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 86dffdf779..dfa8c830a0 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -19,7 +19,8 @@ import ( ) const maxCPUProfStack = 64 -const maxPMUEvent = 10 +// MaxPMUEvent is a small number and cannot be >= 10 because we do a linear search on it +const MaxPMUEvent = 10 type profile struct { lock mutex @@ -43,7 +44,7 @@ type profile struct { } var cpuprof profile -var pmuprof [maxPMUEvent]profile +var pmuprof [MaxPMUEvent]profile // SetCPUProfileRate sets the CPU profiling rate to hz samples per second. // If hz <= 0, SetCPUProfileRate turns off profiling. @@ -105,7 +106,7 @@ func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { } //go:nowritebarrierrec -func (p *profile) addImpl(gp *g, stk []uintptr, prof *profile) { +func (p *profile) addImpl(gp *g, stk []uintptr, cpuorpmuprof *profile) { if p.numExtra > 0 || p.lostExtra > 0 { p.addExtra() } @@ -114,7 +115,7 @@ func (p *profile) addImpl(gp *g, stk []uintptr, prof *profile) { // because otherwise its write barrier behavior may not // be correct. See the long comment there before // changing the argument here. - prof.log.write(&gp.labels, nanotime(), hdr[:], stk) + cpuorpmuprof.log.write(&gp.labels, nanotime(), hdr[:], stk) } // add adds the stack trace to the profile. @@ -125,13 +126,13 @@ func (p *profile) addImpl(gp *g, stk []uintptr, prof *profile) { //go:nowritebarrierrec func (p *profile) add(gp *g, stk []uintptr, eventIds ...int) { if len(eventIds) == 0 { - for !atomic.Cas(&itimer.signalLock, 0, 1) { + for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } - if itimer.hz != 0 { // implies cpuprof.log != nil + if prof.hz != 0 { // implies cpuprof.log != nil p.addImpl(gp, stk, &cpuprof) } - atomic.Store(&itimer.signalLock, 0) + atomic.Store(&prof.signalLock, 0) } else { eventId := eventIds[0] for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { @@ -172,11 +173,11 @@ func (p *profile) addNonGo(stk []uintptr, eventIds ...int) { // (Other calls to add or addNonGo should be blocked out // by the fact that only one SIGPROF can be handled by the // process at a time. If not, this lock will serialize those too.) - for !atomic.Cas(&itimer.signalLock, 0, 1) { + for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } p.addNonGoImpl(stk, &cpuprof) - atomic.Store(&itimer.signalLock, 0) + atomic.Store(&prof.signalLock, 0) } else { eventId := eventIds[0] // Only one SIGPROF for each PMU event can be handled by the process at a time. diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index a957df0242..49dca654c4 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -463,30 +463,19 @@ func rt_sigaction(sig uintptr, new, old *sigactiont, size uintptr) int32 func setProcessPMUProfiler(eventAttr *PMUEventAttr) { if eventAttr != nil { - oldVal := atomic.Load(&handlingSig[_SIGPROF]) - if oldVal != _PMU_INSTALLED { - // Enable the Go signal handler if not enabled. - if atomic.Cas(&handlingSig[_SIGPROF], oldVal, _PMU_INSTALLED) { - atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) - setsig(_SIGPROF, funcPC(sighandler)) - } else { - racyUpdatedVal := atomic.Load(&handlingSig[_SIGPROF]) - if racyUpdatedVal != _UNINSTALLED { - panic("never reach here since pprof should have protected us") - } else { - // Sombody else did the job for us - } - } + atomic.Cas(&cpuorpmuprofiler, _UNINSTALLED, _PMU_INSTALLED) + // Enable the Go signal handler if not enabled. + if atomic.Cas(&handlingSig[_SIGPROF], _UNINSTALLED, _PMU_INSTALLED) { + atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) + setsig(_SIGPROF, funcPC(sighandler)) } } else { + atomic.Cas(&cpuorpmuprofiler, _PMU_INSTALLED, _UNINSTALLED) // If the Go signal handler should be disabled by default, // disable it if it is enabled. if !sigInstallGoHandler(_SIGPROF) { if atomic.Cas(&handlingSig[_SIGPROF], _PMU_INSTALLED, _UNINSTALLED) { setsig(_SIGPROF, atomic.Loaduintptr(&fwdSig[_SIGPROF])) - } else { - // Some other thread already replaced _PMU_INSTALLED with some other value. - // Ideally this should not happen in correctly written user code. } } } diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 033cc3e1a1..5c2f82e1ec 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -722,11 +722,17 @@ type runtimeProfile []runtime.StackRecord func (p runtimeProfile) Len() int { return len(p) } func (p runtimeProfile) Stack(i int) []uintptr { return p[i].Stack() } +var mux sync.Mutex + var cpu struct { - sync.Mutex profiling bool done chan bool } +var pmu struct { + profiling bool + eventOn [runtime.MaxPMUEvent]bool + wg sync.WaitGroup +} // StartCPUProfile enables CPU profiling for the current process. // While profiling, the profile will be buffered and written to w. @@ -740,12 +746,12 @@ var cpu struct { // for syscall.SIGPROF, but note that doing so may break any profiling // being done by the main program. func StartCPUProfile(w io.Writer, profileHz ...int) error { - pmu.Lock() + mux.Lock() + defer mux.Unlock() + if pmu.profiling { - pmu.Unlock() return errors.New("Please disable pmu profiling before enabling cpu profiling") } - pmu.Unlock() // The runtime routines allow a variable profiling rate, // but in practice operating systems cannot trigger signals @@ -761,8 +767,6 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { hz = profileHz[0] } - cpu.Lock() - defer cpu.Unlock() if cpu.done == nil { cpu.done = make(chan bool) } @@ -776,28 +780,17 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { return nil } -const maxPMUEvent = 10 -var pmu struct { - sync.Mutex - profiling bool - eventOn [maxPMUEvent]bool - wg sync.WaitGroup -} - func StartPMUProfile(opts ...ProfilingOption) error { - if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { // enabling only on Linux AMD64 return errors.New("not implemented") } + mux.Lock() + defer mux.Unlock() - cpu.Lock() if cpu.profiling { - cpu.Unlock() return errors.New("Please disable cpu profiling before enabling pmu profiling") } - cpu.Unlock() - pmu.Lock() - defer pmu.Unlock() pmu.wg.Add(len(opts)) // Double-check. if pmu.profiling { @@ -831,7 +824,7 @@ func getPreciseIP(preciseIP int8) uint8 { return uint8(preciseIP) } -func helper(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { +func populatePMUProfiler(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { pmu.eventOn[eventId] = true eventAttr := runtime.PMUEventAttr{ Period: uint64(eventConfig.Period), @@ -843,56 +836,60 @@ func helper(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName str go pmuProfileWriter(w, eventId, eventName) } -func WithProfilingCycle(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { +func WithProfilingPMUCycles(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } + // TODO: create a table of standard clamp values // Clamp period to something reasonable - if eventConfig.Period < 300 { - eventConfig.Period = 300 + if eventConfig.Period < 1000 { + eventConfig.Period = 1000 } - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CPU_CYCLES, /* event name */ "cycles") + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CPU_CYCLES, /* event name */ "cycles") return nil }) } -func WithProfilingInstr(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { +func WithProfilingPMUInstructions(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } + // TODO: create a table of standard clamp values // Clamp period to something reasonable - if eventConfig.Period < 300 { - eventConfig.Period = 300 + if eventConfig.Period < 1000 { + eventConfig.Period = 1000 } - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_INSTRUCTIONS, /* event name */ "instructions") + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_INSTRUCTIONS, /* event name */ "instructions") return nil }) } -func WithProfilingCacheRef(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { +func WithProfilingPMUCacheReferences(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } - // TODO: Clamp period to something reasonable + // TODO: create a table of standard clamp values + // TODO: clamp period to something reasonable - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_REFERENCES, /* event name */ "cache references") + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_REFERENCES, /* event name */ "cache references") return nil }) } -func WithProfilingCacheMiss(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { +func WithProfilingPMUCacheMisses(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { return errors.New("Period should be > 0") } - // TODO: Clamp period to something reasonable + // TODO: create a table of standard clamp values + // TODO: clamp period to something reasonable - helper(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_MISSES, /* event name */ "cache misses") + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_MISSES, /* event name */ "cache misses") return nil }) } @@ -958,8 +955,8 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { // StopCPUProfile only returns after all the writes for the // profile have completed. func StopCPUProfile() { - cpu.Lock() - defer cpu.Unlock() + mux.Lock() + defer mux.Unlock() if !cpu.profiling { return @@ -970,15 +967,15 @@ func StopCPUProfile() { } func StopPMUProfile() { - pmu.Lock() - defer pmu.Unlock() + mux.Lock() + defer mux.Unlock() if !pmu.profiling { return } pmu.profiling = false - for i := 0; i < maxPMUEvent; i++ { + for i := 0; i < runtime.MaxPMUEvent; i++ { if pmu.eventOn[i] { runtime.SetPMUProfile(i, nil) } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index ed7da9fe30..546f55db64 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2125,8 +2125,8 @@ func gcstopm() { stopm() } -var register_setProcessPMUProfiler func(eventAttr *PMUEventAttr) -var register_setThreadPMUProfiler func(eventId int32, eventAttr *PMUEventAttr) +var setProcessPMUProfilerFptr func(eventAttr *PMUEventAttr) +var setThreadPMUProfilerFptr func(eventId int32, eventAttr *PMUEventAttr) // Schedules gp to run on the current M. // If inheritTime is true, gp inherits the remaining time in the @@ -2156,11 +2156,11 @@ func execute(gp *g, inheritTime bool) { setThreadCPUProfiler(hz) } - if register_setThreadPMUProfiler != nil { + if setThreadPMUProfilerFptr != nil { eventAttrs := sched.eventAttrs - for eventId := 0; eventId < maxPMUEvent; eventId++ { + for eventId := 0; eventId < MaxPMUEvent; eventId++ { if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { - register_setThreadPMUProfiler(int32(eventId), eventAttrs[eventId]) + setThreadPMUProfilerFptr(int32(eventId), eventAttrs[eventId]) } } } @@ -3627,12 +3627,12 @@ func mcount() int32 { return int32(sched.mnext - sched.nmfreed) } -var itimer struct { +var prof struct { signalLock uint32 hz int32 } -var pmuEvent [maxPMUEvent]struct { +var pmuEvent [MaxPMUEvent]struct { signalLock uint32 eventAttr *PMUEventAttr } @@ -3774,11 +3774,11 @@ func stackUnwinding(pc, sp, lr uintptr, gp *g, mp *m, stk []uintptr) int { // Counts SIGPROFs received while in atomic64 critical section, on mips{,le} var lostAtomic64Count uint64 -// Called if we receive a SIGPROF signal and itimer is enabled. +// Called if we receive a SIGPROF signal and prof is enabled. // Called by the signal handler, may run during STW. //go:nowritebarrierrec func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { - if itimer.hz == 0 { + if prof.hz == 0 { return } // On mips{,le}, 64bit atomics are emulated with spinlocks, in @@ -3805,7 +3805,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { getg().m.mallocing++ stk := make([]uintptr, maxCPUProfStack) n := stackUnwinding(pc, sp, lr, gp, mp, stk) - if itimer.hz != 0 { + if prof.hz != 0 { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostAtomic64Count > 0 { cpuprof.addLostAtomic64(lostAtomic64Count) lostAtomic64Count = 0 @@ -3815,12 +3815,12 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { getg().m.mallocing-- } -var lostPMUAtomic64Count[maxPMUEvent] uint64 +var lostPMUAtomic64Count[MaxPMUEvent] uint64 // Called if we receive a SIGPROF signal and PMU is enabled. // Called by the signal handler, may run during STW. //go:nowritebarrierrec -func sigpmu(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { +func sigprofPMU(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { if pmuEvent[eventId].eventAttr == nil { return } @@ -3859,7 +3859,7 @@ var sigprofCallersUse uint32 //go:nosplit //go:nowritebarrierrec func sigprofNonGo() { - if itimer.hz != 0 { + if prof.hz != 0 { n := 0 for n < len(sigprofCallers) && sigprofCallers[n] != 0 { n++ @@ -3872,7 +3872,7 @@ func sigprofNonGo() { //go:nosplit //go:nowritebarrierrec -func sigpmuNonGo(eventId int) { +func sigprofPMUNonGo(eventId int) { if pmuEvent[eventId].eventAttr != nil { n := 0 for n < len(sigprofCallers) && sigprofCallers[n] != 0 { @@ -3890,7 +3890,7 @@ func sigpmuNonGo(eventId int) { //go:nosplit //go:nowritebarrierrec func sigprofNonGoPC(pc uintptr) { - if itimer.hz != 0 { + if prof.hz != 0 { stk := []uintptr{ pc, funcPC(_ExternalCode) + sys.PCQuantum, @@ -3901,7 +3901,7 @@ func sigprofNonGoPC(pc uintptr) { //go:nosplit //go:nowritebarrierrec -func sigpmuNonGoPC(pc uintptr, eventId int) { +func sigprofPMUNonGoPC(pc uintptr, eventId int) { if pmuEvent[eventId].eventAttr != nil { stk := []uintptr{ pc, @@ -3948,19 +3948,19 @@ func setcpuprofilerate(hz int32) { _g_ := getg() _g_.m.locks++ - // Stop profiler on this thread so that it is safe to lock itimer. + // Stop profiler on this thread so that it is safe to lock prof. // if a profiling signal came in while we had prof locked, // it would deadlock. setThreadCPUProfiler(0) - for !atomic.Cas(&itimer.signalLock, 0, 1) { + for !atomic.Cas(&prof.signalLock, 0, 1) { osyield() } - if itimer.hz != hz { + if prof.hz != hz { setProcessCPUProfiler(hz) - itimer.hz = hz + prof.hz = hz } - atomic.Store(&itimer.signalLock, 0) + atomic.Store(&prof.signalLock, 0) lock(&sched.lock) sched.profilehz = hz @@ -3974,7 +3974,9 @@ func setcpuprofilerate(hz int32) { } func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { - if register_setProcessPMUProfiler == nil || register_setThreadPMUProfiler == nil { + // setProcessPMUProfilerFptr and setProcessPMUProfilerFptr are write once variables. + // Hence, there cannot be any race from checking non-nil to invoking them. + if setProcessPMUProfilerFptr == nil || setThreadPMUProfilerFptr == nil { return } @@ -3986,23 +3988,23 @@ func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { // Stop profiler on this thread so that it is safe to lock pmuEvent[eventId]. // if a profiling signal came in while we had pmuEvent[eventId] locked, // it would deadlock. - register_setThreadPMUProfiler(eventId, nil) + setThreadPMUProfilerFptr(eventId, nil) for !atomic.Cas(&pmuEvent[eventId].signalLock, 0, 1) { osyield() } if pmuEvent[eventId].eventAttr != eventAttr { - register_setProcessPMUProfiler(eventAttr) + setProcessPMUProfilerFptr(eventAttr) pmuEvent[eventId].eventAttr = eventAttr } atomic.Store(&pmuEvent[eventId].signalLock, 0) - lock(&sched.lock) + lock(&sched.lock) // don't know why we lock scheduler, simply following the code pattern in prof sched.eventAttrs[eventId] = eventAttr unlock(&sched.lock) if eventAttr != nil { - register_setThreadPMUProfiler(eventId, eventAttr) + setThreadPMUProfilerFptr(eventId, eventAttr) } _g_.m.locks-- diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 7d6d5b2824..7670ba8733 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,8 +473,8 @@ type m struct { locks int32 dying int32 profilehz int32 - eventFds [maxPMUEvent]int32 - eventAttrs [maxPMUEvent]*PMUEventAttr + eventFds [MaxPMUEvent]int32 + eventAttrs [MaxPMUEvent]*PMUEventAttr spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack @@ -676,7 +676,7 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - eventAttrs [maxPMUEvent]*PMUEventAttr + eventAttrs [MaxPMUEvent]*PMUEventAttr procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index 7628d4575c..d9456e9ba2 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -20,7 +20,7 @@ var crashing int32 // suppressed. var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool -var register_sigpmuhandler func(info *siginfo, c *sigctxt, gp *g, _g_ *g) +var sigprofPMUHandlerFptr func(info *siginfo, c *sigctxt, gp *g, _g_ *g) // sighandler is invoked when a signal occurs. The global g will be // set to a gsignal goroutine and we will be running on the alternate @@ -38,11 +38,11 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) { c := &sigctxt{info, ctxt} if sig == _SIGPROF { - state := atomic.Load(&handlingSig[_SIGPROF]) + state := atomic.Load(&cpuorpmuprofiler) if state == _ITIMER_INSTALLED { sigprof(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m) - } else if state == _PMU_INSTALLED && register_sigpmuhandler != nil { - register_sigpmuhandler(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp, _g_) + } else if state == _PMU_INSTALLED { + sigprofPMUHandlerFptr(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp, _g_) } return } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 335b06a185..9e3de40954 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -41,7 +41,7 @@ const ( const ( _UNINSTALLED = 0 _ITIMER_INSTALLED = 1 - _PMU_INSTALLED = 2 + _PMU_INSTALLED = 2 ) // Stores the signal handlers registered before Go installed its own. @@ -235,27 +235,22 @@ func clearSignalHandlers() { } } +var cpuorpmuprofiler uint32 + // setProcessCPUProfiler is called when the profiling timer changes. // It is called with prof.lock held. hz is the new timer, and is 0 if // profiling is being disabled. Enable or disable the signal as // required for -buildmode=c-archive. func setProcessCPUProfiler(hz int32) { if hz != 0 { - oldVal := atomic.Load(&handlingSig[_SIGPROF]) - if oldVal != _ITIMER_INSTALLED { - if atomic.Cas(&handlingSig[_SIGPROF], oldVal, _ITIMER_INSTALLED) { - atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) - setsig(_SIGPROF, funcPC(sighandler)) - } else { - racyUpdatedVal := atomic.Load(&handlingSig[_SIGPROF]) - if racyUpdatedVal != _UNINSTALLED { - panic("never reach here since pprof should have protected us") - } else { - println("sombody else did the job for us") - } - } + atomic.Cas(&cpuorpmuprofiler, _UNINSTALLED, _ITIMER_INSTALLED) + // Enable the Go signal handler if not enabled. + if atomic.Cas(&handlingSig[_SIGPROF], _UNINSTALLED, _ITIMER_INSTALLED) { + atomic.Storeuintptr(&fwdSig[_SIGPROF], getsig(_SIGPROF)) + setsig(_SIGPROF, funcPC(sighandler)) } } else { + atomic.Cas(&cpuorpmuprofiler, _ITIMER_INSTALLED, _UNINSTALLED) // If the Go signal handler should be disabled by default, // disable it if it is enabled. if !sigInstallGoHandler(_SIGPROF) { From 11f08769a5b37af089b6a2368cef20f3207cdb8d Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 16 Jul 2019 19:15:15 -0700 Subject: [PATCH 071/126] fix a bug on the file desriptor leaks --- src/runtime/os_linux.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 49dca654c4..7adf83d8dc 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -495,6 +495,9 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { closefd(_g_.m.eventFds[eventId]) } } else { + if _g_.m.eventAttrs[eventId] != nil { + closefd(_g_.m.eventFds[eventId]) + } var perfAttr perfEventAttr perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) perfAttr.Type = perfEventOpt[eventId].Type @@ -536,10 +539,8 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { closefd(fd) return } - _g_.m.eventFds[eventId] = fd } - _g_.m.eventAttrs[eventId] = eventAttr } @@ -559,8 +560,8 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { } if eventId != -1 { sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) - } else { - println("should never reach here") + } else { // should never be taken + println("File descriptor generated by perfEventOpen() not found in _g_.m.eventFds") } ioctl(fd, _PERF_EVENT_IOC_ENABLE, 0) // we don't care about failing ioctl From 5cd77aef167d239a3e128c0c23e5bef4f949aa06 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 16 Jul 2019 22:43:17 -0700 Subject: [PATCH 072/126] output --- src/runtime/pprof/pprof.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 5c2f82e1ec..30441411c0 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -75,7 +75,6 @@ package pprof import ( "bufio" "bytes" - "errors" "fmt" "io" "runtime" @@ -750,7 +749,7 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { defer mux.Unlock() if pmu.profiling { - return errors.New("Please disable pmu profiling before enabling cpu profiling") + return fmt.Errorf("Please disable pmu profiling before enabling cpu profiling") } // The runtime routines allow a variable profiling rate, @@ -782,19 +781,19 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { func StartPMUProfile(opts ...ProfilingOption) error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { // enabling only on Linux AMD64 - return errors.New("not implemented") + return fmt.Errorf("not implemented") } mux.Lock() defer mux.Unlock() if cpu.profiling { - return errors.New("Please disable cpu profiling before enabling pmu profiling") + return fmt.Errorf("Please disable cpu profiling before enabling pmu profiling") } pmu.wg.Add(len(opts)) // Double-check. if pmu.profiling { - return errors.New("pmu profiling already in use") + return fmt.Errorf("pmu profiling already in use") } pmu.profiling = true @@ -839,7 +838,7 @@ func populatePMUProfiler(w io.Writer, eventConfig *PMUEventConfig, eventId int, func WithProfilingPMUCycles(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") + return fmt.Errorf("Period should be > 0") } // TODO: create a table of standard clamp values // Clamp period to something reasonable @@ -855,7 +854,7 @@ func WithProfilingPMUCycles(w io.Writer, eventConfig *PMUEventConfig) ProfilingO func WithProfilingPMUInstructions(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") + return fmt.Errorf("Period should be > 0") } // TODO: create a table of standard clamp values // Clamp period to something reasonable @@ -871,7 +870,7 @@ func WithProfilingPMUInstructions(w io.Writer, eventConfig *PMUEventConfig) Prof func WithProfilingPMUCacheReferences(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") + return fmt.Errorf("Period should be > 0") } // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable @@ -884,7 +883,7 @@ func WithProfilingPMUCacheReferences(w io.Writer, eventConfig *PMUEventConfig) P func WithProfilingPMUCacheMisses(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { - return errors.New("Period should be > 0") + return fmt.Errorf("Period should be > 0") } // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable From 5efcfcbc2daa7df1c987ea514f121c502dc5c07f Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 16 Jul 2019 23:43:58 -0700 Subject: [PATCH 073/126] minor --- src/runtime/os_linux.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 7adf83d8dc..bc77e5e7bc 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -498,6 +498,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { if _g_.m.eventAttrs[eventId] != nil { closefd(_g_.m.eventFds[eventId]) } + var perfAttr perfEventAttr perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) perfAttr.Type = perfEventOpt[eventId].Type @@ -516,6 +517,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { println("Linux perf event open failed") return } + _g_.m.eventFds[eventId] = fd flag, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) _, err = fcntl(fd, /* F_SETFL */ 0x4, flag | /* O_ASYNC */ 0x2000) @@ -539,7 +541,6 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { closefd(fd) return } - _g_.m.eventFds[eventId] = fd } _g_.m.eventAttrs[eventId] = eventAttr } @@ -561,7 +562,7 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { if eventId != -1 { sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) } else { // should never be taken - println("File descriptor generated by perfEventOpen() not found in _g_.m.eventFds") + println("File descriptor ", fd, " not found in _g_.m.eventFds") } ioctl(fd, _PERF_EVENT_IOC_ENABLE, 0) // we don't care about failing ioctl From 9d0af5bba27425b3992d87b67d400717b026c18b Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 16 Jul 2019 23:59:37 -0700 Subject: [PATCH 074/126] minor --- src/runtime/os_linux.go | 1 - 1 file changed, 1 deletion(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index bc77e5e7bc..7889fe0265 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -8,7 +8,6 @@ import ( "runtime/internal/atomic" "runtime/internal/sys" "unsafe" - // "sync/atomic" ) type mOS struct{} From 9bbe0fcb9929ed2d913c4b9553e31577308c2a96 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 17 Jul 2019 16:03:55 -0700 Subject: [PATCH 075/126] minor --- src/net/http/pprof/pprof.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index e58f82568c..48617ec994 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -54,7 +54,6 @@ package pprof import ( "bufio" "bytes" - "errors" "fmt" "html/template" "io" @@ -141,7 +140,7 @@ func pmuProfile(w http.ResponseWriter, r *http.Request) error { case "cacheMisses": err = pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) default: - return errors.New("unknown or not yet implemented event") + return fmt.Errorf("unknown or not yet implemented event") } return err From d330857a1ab219efd8d98c97c36b405d2fde03b3 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 17 Jul 2019 18:06:27 -0700 Subject: [PATCH 076/126] comments --- src/runtime/cpuprof.go | 6 ++++-- src/runtime/profbuf.go | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index dfa8c830a0..cdd72a1247 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -71,7 +71,8 @@ func SetCPUProfileRate(hz int) { } cpuprof.on = true - cpuprof.log = newProfBuf(1, 1<<17, 1<<14) + // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory + cpuprof.log = newProfBuf(/* head size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) hdr := [1]uint64{uint64(hz)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) setcpuprofilerate(int32(hz)) @@ -93,7 +94,8 @@ func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { } pmuprof[eventId].on = true - pmuprof[eventId].log = newProfBuf(1, 1<<17, 1<<14) + // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory + pmuprof[eventId].log = newProfBuf(/* head size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) hdr := [1]uint64{eventAttr.Period} pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) setpmuprofile(int32(eventId), eventAttr) diff --git a/src/runtime/profbuf.go b/src/runtime/profbuf.go index f40881aed5..b68e8444a0 100644 --- a/src/runtime/profbuf.go +++ b/src/runtime/profbuf.go @@ -253,6 +253,9 @@ func (b *profBuf) canWriteRecord(nstk int) bool { // Skip over that and start over at beginning of slice. nd -= len(b.data) - i } + if nd < want { + println("there") + } return nd >= want } From f024a8f4de2a5a7779d4eecc8da0bcafbd79a9cf Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 17 Jul 2019 18:07:29 -0700 Subject: [PATCH 077/126] comments --- src/runtime/cpuprof.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index cdd72a1247..ff9628c5af 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -72,7 +72,7 @@ func SetCPUProfileRate(hz int) { cpuprof.on = true // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory - cpuprof.log = newProfBuf(/* head size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) + cpuprof.log = newProfBuf(/* header size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) hdr := [1]uint64{uint64(hz)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) setcpuprofilerate(int32(hz)) @@ -95,7 +95,7 @@ func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { pmuprof[eventId].on = true // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory - pmuprof[eventId].log = newProfBuf(/* head size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) + pmuprof[eventId].log = newProfBuf(/* header size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) hdr := [1]uint64{eventAttr.Period} pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) setpmuprofile(int32(eventId), eventAttr) From a775e8c3eaa10d3ec59dfc06c06541c99e586dd6 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Wed, 17 Jul 2019 18:08:23 -0700 Subject: [PATCH 078/126] minor --- src/runtime/profbuf.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/runtime/profbuf.go b/src/runtime/profbuf.go index b68e8444a0..f40881aed5 100644 --- a/src/runtime/profbuf.go +++ b/src/runtime/profbuf.go @@ -253,9 +253,6 @@ func (b *profBuf) canWriteRecord(nstk int) bool { // Skip over that and start over at beginning of slice. nd -= len(b.data) - i } - if nd < want { - println("there") - } return nd >= want } From 4d064c142b329390725ffc55eced9e9f40b4e91e Mon Sep 17 00:00:00 2001 From: Milind Chabbi Date: Thu, 18 Jul 2019 10:22:31 -0700 Subject: [PATCH 079/126] Added support for raw events --- src/net/http/pprof/pprof.go | 15 ++++++++++++--- src/runtime/defs_perf_linux.go | 11 ++++++----- src/runtime/defs_pmu.go | 2 ++ src/runtime/os_linux.go | 6 +++++- src/runtime/pprof/pprof.go | 17 +++++++++++++++++ 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index 48617ec994..bfbd91d993 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -140,9 +140,18 @@ func pmuProfile(w http.ResponseWriter, r *http.Request) error { case "cacheMisses": err = pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) default: - return fmt.Errorf("unknown or not yet implemented event") - } - + // is this a Raw event? + if strings.HasPrefix(eventName, "r") { + rawHexEvent, err := strconv.ParseUint(eventName[1:], 16, 64) + if err != nil { + return fmt.Errorf("Incorrect hex format for raw event") + } + eventConfig.RawEvent = rawHexEvent + err = pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) + } else { + return fmt.Errorf("unknown or not yet implemented event") + } + } return err } diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index b2f3c775e9..e66b757d83 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -1,13 +1,14 @@ package runtime -var perfEventOpt = []struct { +var perfEventOpt = map[int32]struct { Type uint32 // type of event Config uint64 // event } { - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES - {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES + GO_COUNT_HW_CPU_CYCLES : {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES + GO_COUNT_HW_INSTRUCTIONS: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS + GO_COUNT_HW_CACHE_REFERENCES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES + GO_COUNT_HW_CACHE_MISSES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES + GO_COUNT_HW_RAW: {_PERF_TYPE_RAW, 0 /* will not be used*/}, // index: GO_COUNT_HW_RAW // TODO: add more perf events } diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index ee1c3b72ac..2b3d7573c4 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -31,10 +31,12 @@ const ( GO_COUNT_SW_TASK_CLOCK = 0x17 GO_COUNT_SW_PAGE_FAULTS = 0x18 GO_COUNT_SW_CONTEXT_SWITCHES = 0x19 + GO_COUNT_HW_RAW= 0x1a ) type PMUEventAttr struct { Period uint64 + RawEvent uint64 PreciseIP uint8 IsKernelIncluded bool IsHvIncluded bool diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 7889fe0265..fb9d1c31b8 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -501,7 +501,11 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { var perfAttr perfEventAttr perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) perfAttr.Type = perfEventOpt[eventId].Type - perfAttr.Config = perfEventOpt[eventId].Config + if (eventId == GO_COUNT_HW_RAW) { + perfAttr.Config = eventAttr.RawEvent + } else { + perfAttr.Config = perfEventOpt[eventId].Config + } perfAttr.Sample = eventAttr.Period perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip if !eventAttr.IsKernelIncluded { // don't count kernel diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 30441411c0..a9b43cce80 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -84,6 +84,7 @@ import ( "text/tabwriter" "time" "unsafe" + "strconv" ) // BUG(rsc): Profiles are only as good as the kernel support used to generate them. @@ -807,6 +808,7 @@ func StartPMUProfile(opts ...ProfilingOption) error { type PMUEventConfig struct { Period int64 + RawEvent uint64 PreciseIP int8 IsKernelIncluded bool IsHvIncluded bool @@ -827,6 +829,7 @@ func populatePMUProfiler(w io.Writer, eventConfig *PMUEventConfig, eventId int, pmu.eventOn[eventId] = true eventAttr := runtime.PMUEventAttr{ Period: uint64(eventConfig.Period), + RawEvent: uint64(eventConfig.RawEvent), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, IsHvIncluded: eventConfig.IsHvIncluded, @@ -893,6 +896,20 @@ func WithProfilingPMUCacheMisses(w io.Writer, eventConfig *PMUEventConfig) Profi }) } +func WithProfilingPMURaw(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { + return profilingOptionFunc(func() error { + if eventConfig.Period <= 0 { + return fmt.Errorf("Period should be > 0") + } + // TODO: create a table of standard clamp values + // TODO: clamp period to something reasonable + + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_RAW, /* event name */ "r" + strconv.FormatUint(eventConfig.RawEvent, 16)) + return nil + }) +} + + type ProfilingOption interface { apply() error } From f0c7da3b6903514a1e68b64c9cf91de07226c834 Mon Sep 17 00:00:00 2001 From: Milind Chabbi Date: Thu, 18 Jul 2019 11:14:02 -0700 Subject: [PATCH 080/126] Replaced MaxPMUEvent with GO_COUNT_PMU_EVENTS_MAX --- src/runtime/cpuprof.go | 4 +--- src/runtime/defs_pmu.go | 29 ++--------------------------- src/runtime/os_linux.go | 2 +- src/runtime/pprof/pprof.go | 4 ++-- src/runtime/proc.go | 6 +++--- src/runtime/runtime2.go | 6 +++--- 6 files changed, 12 insertions(+), 39 deletions(-) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index ff9628c5af..affb650189 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -19,8 +19,6 @@ import ( ) const maxCPUProfStack = 64 -// MaxPMUEvent is a small number and cannot be >= 10 because we do a linear search on it -const MaxPMUEvent = 10 type profile struct { lock mutex @@ -44,7 +42,7 @@ type profile struct { } var cpuprof profile -var pmuprof [MaxPMUEvent]profile +var pmuprof [GO_COUNT_PMU_EVENTS_MAX]profile // SetCPUProfileRate sets the CPU profiling rate to hz samples per second. // If hz <= 0, SetCPUProfileRate turns off profiling. diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 2b3d7573c4..a13804f638 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -5,33 +5,8 @@ const ( GO_COUNT_HW_INSTRUCTIONS = 0x1 GO_COUNT_HW_CACHE_REFERENCES = 0x2 GO_COUNT_HW_CACHE_MISSES = 0x3 - GO_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 - GO_COUNT_HW_BRANCH_MISSES = 0x5 - GO_COUNT_HW_BUS_CYCLES = 0x6 - GO_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 - GO_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 - GO_COUNT_HW_REF_CPU_CYCLES = 0x9 - - GO_COUNT_HW_CACHE_L1D = 0xa - GO_COUNT_HW_CACHE_L1I = 0xb - GO_COUNT_HW_CACHE_LL = 0xc - GO_COUNT_HW_CACHE_DTLB = 0xd - GO_COUNT_HW_CACHE_ITLB = 0xe - GO_COUNT_HW_CACHE_BPU = 0xf - GO_COUNT_HW_CACHE_NODE = 0x10 - - GO_COUNT_HW_CACHE_OP_READ = 0x11 - GO_COUNT_HW_CACHE_OP_WRITE = 0x12 - GO_COUNT_HW_CACHE_OP_PREFETCH = 0x13 - - GO_COUNT_HW_CACHE_RESULT_ACCESS = 0x14 - GO_COUNT_HW_CACHE_RESULT_MISS = 0x15 - - GO_COUNT_SW_CPU_CLOCK = 0x16 - GO_COUNT_SW_TASK_CLOCK = 0x17 - GO_COUNT_SW_PAGE_FAULTS = 0x18 - GO_COUNT_SW_CONTEXT_SWITCHES = 0x19 - GO_COUNT_HW_RAW= 0x1a + GO_COUNT_HW_RAW = 0x4 + GO_COUNT_PMU_EVENTS_MAX = 0x5 ) type PMUEventAttr struct { diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index fb9d1c31b8..fecc9febdb 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -556,7 +556,7 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { ioctl(fd, _PERF_EVENT_IOC_DISABLE, 0) // we don't care about failing ioctl var eventId int = -1 - for i := 0; i < MaxPMUEvent; i++ { + for i := 0; i < GO_COUNT_PMU_EVENTS_MAX; i++ { if _g_.m.eventFds[i] == fd { eventId = i break diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index a9b43cce80..ce6fa83304 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -730,7 +730,7 @@ var cpu struct { } var pmu struct { profiling bool - eventOn [runtime.MaxPMUEvent]bool + eventOn [runtime.GO_COUNT_PMU_EVENTS_MAX]bool wg sync.WaitGroup } @@ -991,7 +991,7 @@ func StopPMUProfile() { } pmu.profiling = false - for i := 0; i < runtime.MaxPMUEvent; i++ { + for i := 0; i < runtime.GO_COUNT_PMU_EVENTS_MAX; i++ { if pmu.eventOn[i] { runtime.SetPMUProfile(i, nil) } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 546f55db64..18c363f19e 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2158,7 +2158,7 @@ func execute(gp *g, inheritTime bool) { if setThreadPMUProfilerFptr != nil { eventAttrs := sched.eventAttrs - for eventId := 0; eventId < MaxPMUEvent; eventId++ { + for eventId := 0; eventId < GO_COUNT_PMU_EVENTS_MAX; eventId++ { if _g_.m.eventAttrs[eventId] != eventAttrs[eventId] { setThreadPMUProfilerFptr(int32(eventId), eventAttrs[eventId]) } @@ -3632,7 +3632,7 @@ var prof struct { hz int32 } -var pmuEvent [MaxPMUEvent]struct { +var pmuEvent [GO_COUNT_PMU_EVENTS_MAX]struct { signalLock uint32 eventAttr *PMUEventAttr } @@ -3815,7 +3815,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { getg().m.mallocing-- } -var lostPMUAtomic64Count[MaxPMUEvent] uint64 +var lostPMUAtomic64Count[GO_COUNT_PMU_EVENTS_MAX] uint64 // Called if we receive a SIGPROF signal and PMU is enabled. // Called by the signal handler, may run during STW. diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 7670ba8733..7dd61dfd60 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -473,8 +473,8 @@ type m struct { locks int32 dying int32 profilehz int32 - eventFds [MaxPMUEvent]int32 - eventAttrs [MaxPMUEvent]*PMUEventAttr + eventFds [GO_COUNT_PMU_EVENTS_MAX]int32 + eventAttrs [GO_COUNT_PMU_EVENTS_MAX]*PMUEventAttr spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack @@ -676,7 +676,7 @@ type schedt struct { safePointNote note profilehz int32 // cpu profiling rate - eventAttrs [MaxPMUEvent]*PMUEventAttr + eventAttrs [GO_COUNT_PMU_EVENTS_MAX]*PMUEventAttr procresizetime int64 // nanotime() of last change to gomaxprocs totaltime int64 // ∫gomaxprocs dt up to procresizetime } From 960c83378707863122aef7665aa3fc0dbaf0436a Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 12:23:18 -0700 Subject: [PATCH 081/126] benchmark profiling with pmu --- src/cmd/go/internal/test/test.go | 20 +++++++++++++++++ src/cmd/go/internal/test/testflag.go | 8 ++++++- src/runtime/cpuprof.go | 2 +- src/runtime/pprof/pprof.go | 2 +- src/testing/internal/testdeps/deps.go | 26 ++++++++++++++++++++++ src/testing/testing.go | 32 +++++++++++++++++++++++++++ 6 files changed, 87 insertions(+), 3 deletions(-) diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 8440a83951..85ba0a1ebb 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -312,6 +312,26 @@ profile the tests during execution: -cpuprofile cpu.out Write a CPU profile to the specified file before exiting. Writes test binary as -c would. + + -pmurofile pmu.out + Write a PMU profile to the specified file before exiting. + Writes test binary as -c would. + + -pmuevent event + Specify which pmu event to sample. + To sample PMU cycles, use -test.memprofilerate=1. + + -pmuperiod n + Set the sampling period for the pmu event specified by -pmuevent. + + -pmupreciseip n + Set the precise ip level for the pmu event specified by -pmuevent. + + -pmukernelincl + Count the kernel or not. + + -pmuhvincl + Count the hypervisor or not. -memprofile mem.out Write an allocation profile to the file after all tests have passed. diff --git a/src/cmd/go/internal/test/testflag.go b/src/cmd/go/internal/test/testflag.go index 138e1f9d2a..7570235d44 100644 --- a/src/cmd/go/internal/test/testflag.go +++ b/src/cmd/go/internal/test/testflag.go @@ -46,6 +46,12 @@ var testFlagDefn = []*cmdflag.Defn{ {Name: "coverprofile", PassToTest: true}, {Name: "cpu", PassToTest: true}, {Name: "cpuprofile", PassToTest: true}, + {Name: "pmuprofile", PassToTest: true}, + {Name: "pmuevent", PassToTest: true}, + {Name: "pmuperiod", PassToTest: true}, + {Name: "pmupreciseip", PassToTest: true}, + {Name: "pmukernelincl", BoolVar: new(bool), PassToTest: true}, + {Name: "pmuhvincl", BoolVar: new(bool),PassToTest: true}, {Name: "failfast", BoolVar: new(bool), PassToTest: true}, {Name: "list", PassToTest: true}, {Name: "memprofile", PassToTest: true}, @@ -157,7 +163,7 @@ func testFlags(usage func(), args []string) (packageNames, passToTest []string) testList = true case "timeout": testTimeout = value - case "blockprofile", "cpuprofile", "memprofile", "mutexprofile": + case "blockprofile", "cpuprofile", "pmuprofile", "memprofile", "mutexprofile": testProfile = "-" + f.Name testNeedBinary = true case "trace": diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index ff9628c5af..69aa4c639c 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -18,9 +18,9 @@ import ( "unsafe" ) -const maxCPUProfStack = 64 // MaxPMUEvent is a small number and cannot be >= 10 because we do a linear search on it const MaxPMUEvent = 10 +const maxCPUProfStack = 64 type profile struct { lock mutex diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 30441411c0..6e35420c28 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -825,7 +825,7 @@ func getPreciseIP(preciseIP int8) uint8 { func populatePMUProfiler(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { pmu.eventOn[eventId] = true - eventAttr := runtime.PMUEventAttr{ + eventAttr := runtime.PMUEventAttr { Period: uint64(eventConfig.Period), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, diff --git a/src/testing/internal/testdeps/deps.go b/src/testing/internal/testdeps/deps.go index 14512e9632..5669d6e65b 100644 --- a/src/testing/internal/testdeps/deps.go +++ b/src/testing/internal/testdeps/deps.go @@ -12,6 +12,7 @@ package testdeps import ( "bufio" + "fmt" "internal/testlog" "io" "regexp" @@ -46,6 +47,31 @@ func (TestDeps) StopCPUProfile() { pprof.StopCPUProfile() } +func (TestDeps) StartPMUProfile(w io.Writer, event string, period int64, preciseIP int8, isKernelIncluded bool, isHvIncluded bool) error { + eventConfig := pprof.PMUEventConfig { + Period: period, + PreciseIP: preciseIP, + IsKernelIncluded: isKernelIncluded, + IsHvIncluded: isHvIncluded, + } + switch event { + case "cycles": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) + case "instructions": + return pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) + case "cacheReferences": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) + case "cacheMisses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) + default: + return fmt.Errorf("unknown or not yet implemented event") + } +} + +func (TestDeps) StopPMUProfile() { + pprof.StopPMUProfile() +} + func (TestDeps) WriteProfileTo(name string, w io.Writer, debug int) error { return pprof.Lookup(name).WriteTo(w, debug) } diff --git a/src/testing/testing.go b/src/testing/testing.go index 339df13f43..027c3ceb98 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -285,6 +285,12 @@ func Init() { memProfile = flag.String("test.memprofile", "", "write an allocation profile to `file`") memProfileRate = flag.Int("test.memprofilerate", 0, "set memory allocation profiling `rate` (see runtime.MemProfileRate)") cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to `file`") + pmuProfile = flag.String("test.pmuprofile", "", "write a pmu profile to `file`") + pmuEvent = flag.String("test.pmuevent", "cycle", "select a pmu event from the events: cycles, instructions, cacheReferences, cacheMisses") + pmuPeriod = flag.Int64("test.pmuperiod", 10000000, "specify the sampling period for a PMU event") + pmuPreciseIP = flag.Int("test.pmupreciseip", 0, "specify the precise IP level (0-3) for a PMU event") + pmuKernelIncluded = flag.Bool("test.pmukernelincl", false, "count the kernel") + pmuHvIncluded = flag.Bool("test.pmuhvincl", false, "count the hypervisor") blockProfile = flag.String("test.blockprofile", "", "write a goroutine blocking profile to `file`") blockProfileRate = flag.Int("test.blockprofilerate", 1, "set blocking profile `rate` (see runtime.SetBlockProfileRate)") mutexProfile = flag.String("test.mutexprofile", "", "write a mutex contention profile to the named file after execution") @@ -311,6 +317,12 @@ var ( memProfile *string memProfileRate *int cpuProfile *string + pmuProfile *string + pmuEvent *string + pmuPeriod *int64 + pmuPreciseIP *int + pmuKernelIncluded *bool + pmuHvIncluded *bool blockProfile *string blockProfileRate *int mutexProfile *string @@ -1029,6 +1041,8 @@ type matchStringOnly func(pat, str string) (bool, error) func (f matchStringOnly) MatchString(pat, str string) (bool, error) { return f(pat, str) } func (f matchStringOnly) StartCPUProfile(w io.Writer) error { return errMain } func (f matchStringOnly) StopCPUProfile() {} +func (f matchStringOnly) StartPMUProfile(w io.Writer, event string, period int64, preciseIP int8, isKernelIncluded bool, isHvIncluded bool) error { return errMain } +func (f matchStringOnly) StopPMUProfile() {} func (f matchStringOnly) WriteProfileTo(string, io.Writer, int) error { return errMain } func (f matchStringOnly) ImportPath() string { return "" } func (f matchStringOnly) StartTestLog(io.Writer) {} @@ -1066,6 +1080,8 @@ type testDeps interface { MatchString(pat, str string) (bool, error) StartCPUProfile(io.Writer) error StopCPUProfile() + StartPMUProfile(io.Writer, string, int64, int8, bool, bool) error + StopPMUProfile() StartTestLog(io.Writer) StopTestLog() error WriteProfileTo(string, io.Writer, int) error @@ -1236,6 +1252,19 @@ func (m *M) before() { } // Could save f so after can call f.Close; not worth the effort. } + if *pmuProfile != "" { + f, err := os.Create(toOutputDir(*pmuProfile)) + if err != nil { + fmt.Fprintf(os.Stderr, "testing: %s\n", err) + return + } + if err := m.deps.StartPMUProfile(f, *pmuEvent, *pmuPeriod, int8(*pmuPreciseIP), *pmuKernelIncluded, *pmuHvIncluded); err != nil { + fmt.Fprintf(os.Stderr, "testing: can't start pmu profile: %s\n", err) + f.Close() + return + } + // Could save f so after can call f.Close; not worth the effort. + } if *traceFile != "" { f, err := os.Create(toOutputDir(*traceFile)) if err != nil { @@ -1302,6 +1331,9 @@ func (m *M) writeProfiles() { if *cpuProfile != "" { m.deps.StopCPUProfile() // flushes profile to disk } + if *pmuProfile != "" { + m.deps.StopPMUProfile() // flushes profile to disk + } if *traceFile != "" { trace.Stop() // flushes trace to disk } From 67d3536a23edddfe4765555c775d124c05a6874b Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:10:08 -0700 Subject: [PATCH 082/126] test cases --- test/pmu/http/test4.go | 25 ++++++ test/pmu/test1.go | 8 +- test/pmu/test2.go | 77 +++++++++++----- test/pmu/test4.go | 195 +++++++++++++++++++++++++++++++++++++++++ test/pmu/test4.out | 10 +++ 5 files changed, 287 insertions(+), 28 deletions(-) create mode 100644 test/pmu/http/test4.go create mode 100644 test/pmu/test4.go create mode 100644 test/pmu/test4.out diff --git a/test/pmu/http/test4.go b/test/pmu/http/test4.go new file mode 100644 index 0000000000..3fca566a7c --- /dev/null +++ b/test/pmu/http/test4.go @@ -0,0 +1,25 @@ +// run +// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=r53010e\&period=1000000 + +package main + +import ( + "fmt" + "log" + // "time" + "net/http" + _ "net/http/pprof" +) + +var sum int + +func main() { + go func() { + log.Println(http.ListenAndServe("localhost:6060", nil)) + }() + // time.Sleep(2 * time.Second) + for i := 0; i <= 10000000000; i++ { + sum += i + } + fmt.Println(sum) +} diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 816b2fbd50..3f35f52f5d 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -155,9 +155,9 @@ func f10() { func run() error { cycleFile, err := os.Create("cycle_profile") - if err != nil { - return err - } + if err != nil { + return err + } defer cycleFile.Close() var cycle pprof.PMUEventConfig @@ -165,7 +165,7 @@ func run() error { cycle.IsKernelIncluded = false cycle.IsHvIncluded = false - if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle)); err != nil { + f err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { return err } defer pprof.StopPMUProfile() diff --git a/test/pmu/test2.go b/test/pmu/test2.go index 50c6149f0d..2faf7ec7de 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -7,20 +7,28 @@ import ( "log" "os" "sync" + "sync/atomic" + _"time" "runtime/pprof" ) var wg sync.WaitGroup +var racy int32 + func f1() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + /*if i % 100 == 0 { + time.Sleep(time.Nanosecond) + }*/ + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -30,11 +38,15 @@ func f2() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + /*if i % 100 == 0 { + time.Sleep(time.Nanosecond) + }*/ + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -44,11 +56,15 @@ func f3() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + /*if i % 100 == 0 { + time.Sleep(time.Nanosecond) + }*/ + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -58,11 +74,15 @@ func f4() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + /*if i % 100 == 0 { + time.Sleep(time.Nanosecond) + }*/ + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -72,11 +92,12 @@ func f5() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -86,11 +107,12 @@ func f6() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -100,11 +122,12 @@ func f7() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -114,11 +137,12 @@ func f8() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -128,11 +152,12 @@ func f9() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -142,11 +167,12 @@ func f10() { defer wg.Done() var sum int - for i := 0; i < 500000000; i++ { + for i := 0; i < 50000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 + atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -160,7 +186,7 @@ func run() error { defer cycleFile.Close() var cycle pprof.PMUEventConfig - cycle.Period = 15000000 + cycle.Period = 1000000 // cycle.PreciseIP = 2 instrFile, err := os.Create("instr_profile") @@ -170,33 +196,36 @@ func run() error { defer instrFile.Close() var instr pprof.PMUEventConfig - instr.Period = 10000000 + instr.Period = 1000000 // instr.PreciseIP = 2 - cacheRefFile, err := os.Create("cacheRef_profile") + cacheMissFile, err := os.Create("cacheMiss_profile") if err != nil { return err } - defer cacheRefFile.Close() + defer cacheMissFile.Close() - var cacheRef pprof.PMUEventConfig - cacheRef.Period = 200 - // cacheRef.PreciseIP = 2 + var cacheMiss pprof.PMUEventConfig + cacheMiss.Period = 10 + // cacheMiss.PreciseIP = 2 - cacheMissFile, err := os.Create("cacheMiss_profile") + + cacheRefFile, err := os.Create("cacheRef_profile") if err != nil { return err } - defer cacheMissFile.Close() + defer cacheRefFile.Close() - var cacheMiss pprof.PMUEventConfig - cacheMiss.Period = 1 - // cacheMiss.PreciseIP = 2 + var cacheRef pprof.PMUEventConfig + cacheRef.Period = 1000000 + // cacheRef.PreciseIP = 2 - if err := pprof.StartPMUProfile(pprof.WithProfilingCycle(cycleFile, &cycle), pprof.WithProfilingInstr(instrFile, &instr), pprof.WithProfilingCacheRef(cacheRefFile, &cacheRef), pprof.WithProfilingCacheMiss(cacheMissFile, &cacheMiss)); err != nil { + + if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle), pprof.WithProfilingPMUInstructions(instrFile, &instr), pprof.WithProfilingPMUCacheReferences(cacheRefFile, &cacheRef), pprof.WithProfilingPMUCacheMisses(cacheMissFile, &cacheMiss)); err != nil { return err } - defer pprof.StopPMUProfile() + + defer pprof.StopPMUProfile() wg.Add(10) defer wg.Wait() diff --git a/test/pmu/test4.go b/test/pmu/test4.go new file mode 100644 index 0000000000..fab30e9736 --- /dev/null +++ b/test/pmu/test4.go @@ -0,0 +1,195 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "sync" + "runtime/pprof" +) + +var wg sync.WaitGroup + +func f1() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f2() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f3() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f4() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f5() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f6() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f7() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f8() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f9() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + +func f10() { + defer wg.Done() + + var sum int + for i := 0; i < 500000000; i++ { + sum -= i / 2 + sum *= i + sum /= i/3 + 1 + sum -= i / 4 + } + + fmt.Println(sum) +} + + +func run() error { + rawFile, err := os.Create("raw_profile") + if err != nil { + return err + } + defer rawFile.Close() + + var raw pprof.PMUEventConfig + raw.RawEvent = /* UOPS_ISSUED */ 0x53010e + raw.Period = 1000000 + raw.IsKernelIncluded = false + raw.IsHvIncluded = false + + if err := pprof.StartPMUProfile(pprof.WithProfilingPMURaw(rawFile, &raw)); err != nil { + return err + } + defer pprof.StopPMUProfile() + + wg.Add(10) + defer wg.Wait() + + go f1() + go f2() + go f3() + go f4() + go f5() + go f6() + go f7() + go f8() + go f9() + go f10() + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/test4.out b/test/pmu/test4.out new file mode 100644 index 0000000000..9546171295 --- /dev/null +++ b/test/pmu/test4.out @@ -0,0 +1,10 @@ +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 +44438869911 From 496e0fff358a5668bc83b9e07b8e039174575162 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:10:52 -0700 Subject: [PATCH 083/126] fix a if-else bug caused by me --- src/net/http/pprof/pprof.go | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index bfbd91d993..115c6c48b5 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -113,46 +113,40 @@ func serveError(w http.ResponseWriter, status int, txt string) { func pmuProfile(w http.ResponseWriter, r *http.Request) error { var eventConfig pprof.PMUEventConfig - period, err := strconv.ParseInt(r.FormValue("period"), 10, 64) - if err == nil { + if period, err := strconv.ParseInt(r.FormValue("period"), 10, 64); err == nil { eventConfig.Period = period } - preciseIP, err := strconv.ParseInt(r.FormValue("preciseIP"), 10, 8) - if err == nil { + if preciseIP, err := strconv.ParseInt(r.FormValue("preciseIP"), 10, 8); err == nil { eventConfig.PreciseIP = int8(preciseIP) } - isKernelIncluded, err := strconv.ParseBool(r.FormValue("kernel")) - if err == nil { + if isKernelIncluded, err := strconv.ParseBool(r.FormValue("kernel")); err == nil { eventConfig.IsKernelIncluded = isKernelIncluded } - isHvIncluded, err := strconv.ParseBool(r.FormValue("hv")) - if err == nil { + if isHvIncluded, err := strconv.ParseBool(r.FormValue("hv")); err == nil { eventConfig.IsHvIncluded = isHvIncluded } switch eventName := r.FormValue("event"); eventName { case "cycles": - err = pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) + return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) case "instructions": - err = pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) + return pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) case "cacheReferences": - err = pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) case "cacheMisses": - err = pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) default: - // is this a Raw event? + // Is this a raw event? if strings.HasPrefix(eventName, "r") { - rawHexEvent, err := strconv.ParseUint(eventName[1:], 16, 64) - if err != nil { - return fmt.Errorf("Incorrect hex format for raw event") + if rawHexEvent, err := strconv.ParseInt(eventName[1:], 16, 64); err == nil { + eventConfig.RawEvent = rawHexEvent + return pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) } - eventConfig.RawEvent = rawHexEvent - err = pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) + return fmt.Errorf("Incorrect hex format for raw event") } else { - return fmt.Errorf("unknown or not yet implemented event") + return fmt.Errorf("Unknown or not yet implemented event") } - } - return err + } } // Profile responds with the pprof-formatted cpu profile. From 689c12292cd11c8b6cc3306e19517a70cacc19d0 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:11:28 -0700 Subject: [PATCH 084/126] minor --- src/runtime/defs_pmu.go | 2 +- src/runtime/pprof/pprof.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index a13804f638..4cf04ca3a6 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -6,7 +6,7 @@ const ( GO_COUNT_HW_CACHE_REFERENCES = 0x2 GO_COUNT_HW_CACHE_MISSES = 0x3 GO_COUNT_HW_RAW = 0x4 - GO_COUNT_PMU_EVENTS_MAX = 0x5 + GO_COUNT_PMU_EVENTS_MAX = 0x5 ) type PMUEventAttr struct { diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index c1da50e4e5..34ac75ca31 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -808,7 +808,7 @@ func StartPMUProfile(opts ...ProfilingOption) error { type PMUEventConfig struct { Period int64 - RawEvent uint64 + RawEvent int64 PreciseIP int8 IsKernelIncluded bool IsHvIncluded bool @@ -904,7 +904,11 @@ func WithProfilingPMURaw(w io.Writer, eventConfig *PMUEventConfig) ProfilingOpti // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_RAW, /* event name */ "r" + strconv.FormatUint(eventConfig.RawEvent, 16)) + if eventConfig.RawEvent < 0 { + return fmt.Errorf("RawEvent should be >= 0") + } + + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_RAW, /* event name */ "r" + strconv.FormatInt(eventConfig.RawEvent, 16)) return nil }) } From 3e2a5bcd414116cf1af50c871f79a5e5e5bef769 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:26:11 -0700 Subject: [PATCH 085/126] test cases --- test/pmu/http/test1.go | 4 +++- test/pmu/http/test2.go | 4 +++- test/pmu/http/test3.go | 4 +++- test/pmu/http/test4.go | 6 +++--- test/pmu/test1.go | 3 ++- test/pmu/test2.go | 3 ++- test/pmu/test3.go | 1 + test/pmu/test4.go | 1 + 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/test/pmu/http/test1.go b/test/pmu/http/test1.go index 6cfe39e45d..cf337ffa9a 100644 --- a/test/pmu/http/test1.go +++ b/test/pmu/http/test1.go @@ -1,5 +1,7 @@ // run -// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 +// Example of usage: +// 1. go run test1.go +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 package main diff --git a/test/pmu/http/test2.go b/test/pmu/http/test2.go index e2b42d820c..cbe16e09fe 100644 --- a/test/pmu/http/test2.go +++ b/test/pmu/http/test2.go @@ -1,5 +1,7 @@ // run -// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 +// Example of usage: +// 1. go run test2.go +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=instructions\&period=10000000 package main diff --git a/test/pmu/http/test3.go b/test/pmu/http/test3.go index ed9af94112..ececca4108 100644 --- a/test/pmu/http/test3.go +++ b/test/pmu/http/test3.go @@ -1,5 +1,7 @@ // run -// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 +// Example of usage: +// 1. go run test3.go +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cacheMisses\&period=10000000 package main diff --git a/test/pmu/http/test4.go b/test/pmu/http/test4.go index 3fca566a7c..b7ab6cfb2f 100644 --- a/test/pmu/http/test4.go +++ b/test/pmu/http/test4.go @@ -1,12 +1,13 @@ // run -// Example of Usage: go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=r53010e\&period=1000000 +// Example of Usage: +// 1. go run test4.go +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=r53010e\&period=1000000 package main import ( "fmt" "log" - // "time" "net/http" _ "net/http/pprof" ) @@ -17,7 +18,6 @@ func main() { go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }() - // time.Sleep(2 * time.Second) for i := 0; i <= 10000000000; i++ { sum += i } diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 3f35f52f5d..3391ac80cb 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -1,4 +1,5 @@ // run +// Example of usage: go run test1.go package main @@ -165,7 +166,7 @@ func run() error { cycle.IsKernelIncluded = false cycle.IsHvIncluded = false - f err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { + if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { return err } defer pprof.StopPMUProfile() diff --git a/test/pmu/test2.go b/test/pmu/test2.go index 2faf7ec7de..f065cec929 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -1,4 +1,5 @@ // run +// Example of usage: go run test2.go package main @@ -217,7 +218,7 @@ func run() error { defer cacheRefFile.Close() var cacheRef pprof.PMUEventConfig - cacheRef.Period = 1000000 + cacheRef.Period = 1000000 // cacheRef.PreciseIP = 2 diff --git a/test/pmu/test3.go b/test/pmu/test3.go index 65e6fc0cf0..44c4754a26 100644 --- a/test/pmu/test3.go +++ b/test/pmu/test3.go @@ -1,4 +1,5 @@ // run +// Example of usage: go run test3.go package main diff --git a/test/pmu/test4.go b/test/pmu/test4.go index fab30e9736..cc55510389 100644 --- a/test/pmu/test4.go +++ b/test/pmu/test4.go @@ -1,4 +1,5 @@ // run +// Example of usage: go run test4.go package main From d4ae34ee36341ac86340e24bad4811cb7cc963b2 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:39:53 -0700 Subject: [PATCH 086/126] more test cases --- test/pmu/leak/cacheMiss_profile | Bin 0 -> 17545 bytes test/pmu/leak/cacheRef_profile | Bin 0 -> 43243 bytes test/pmu/leak/cycle_profile | Bin 0 -> 3561 bytes test/pmu/leak/instr_profile | Bin 0 -> 5731 bytes test/pmu/leak/itimer_profile | 0 test/pmu/leak/test1.go | 39 +++++++++++++++++ test/pmu/leak/test2.go | 43 +++++++++++++++++++ test/pmu/leak/test3.go | 57 +++++++++++++++++++++++++ test/pmu/leak/test4.go | 64 ++++++++++++++++++++++++++++ test/pmu/leak/test5.go | 72 ++++++++++++++++++++++++++++++++ test/pmu/leak/test6.go | 68 ++++++++++++++++++++++++++++++ 11 files changed, 343 insertions(+) create mode 100644 test/pmu/leak/cacheMiss_profile create mode 100644 test/pmu/leak/cacheRef_profile create mode 100644 test/pmu/leak/cycle_profile create mode 100644 test/pmu/leak/instr_profile create mode 100644 test/pmu/leak/itimer_profile create mode 100644 test/pmu/leak/test1.go create mode 100644 test/pmu/leak/test2.go create mode 100644 test/pmu/leak/test3.go create mode 100644 test/pmu/leak/test4.go create mode 100644 test/pmu/leak/test5.go create mode 100644 test/pmu/leak/test6.go diff --git a/test/pmu/leak/cacheMiss_profile b/test/pmu/leak/cacheMiss_profile new file mode 100644 index 0000000000000000000000000000000000000000..79e6d0a243118b848877e6098b93767dbb34045c GIT binary patch literal 17545 zcmV*DKy1GsiwFP!00004|CGIVd>lpcIQqJ07LO&_s$F9!z`(L3TY!WG2ge~NWvtZyANBf?M&~5CAI~7x(97$C}5PSfQbHw0$>3yT`-uo z1K6WT0eBc6<~c78oX&Gz7_Ow^g-7raf3*NuK3v&oG_CVNA2sKLNAXdAwLq#>1^d$+ zDIY-ikW`-JlZNTJuYy%EDLJK5+ z7Ldt2fa~TlK>+InKY0*Oj~+?u?}yHcjQhclekKEP0nM3KRd|rOt_n}!6aGK|tcS40 z(owYR0a$JF+yn3=KIwld0M^5}cqY$12zw2ldk~(+r+MxX+&h5h5T>i`5T3zjc&-}u z-NB?h1hW(?55cqetiQSsSO7`)SAD?yAU^c)BP63oam1;1q>_i>N#5jPsDU;7X@OMh zF&sR908KptKjW!K;5mHG|9l|TdK~92;;CxzE>Bg17w`q1^5XzC^(g#?ryhlLO!sF5 zzmfS=*dc-=F&avIN7 zfu2g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960lsA97m~#ODGE_0H literal 0 HcmV?d00001 diff --git a/test/pmu/leak/cycle_profile b/test/pmu/leak/cycle_profile new file mode 100644 index 0000000000000000000000000000000000000000..87f7cd4af610d650d086e16cbc51e3ee5cdbb188 GIT binary patch literal 3561 zcmVe!Jyxq#)tLb{g+ zMOY*i%fRyS%ny&}$%QN*{#->^J}_ibi43d&A9#zf0{Cq;VFgf%rGypYPv0Y~5XNc< zD}*vEBdiGTfAA#dEP}B-!iu0A%cY7?1q5LH?q#KgdHDr}MRJf80D@E{11rUsUm&amekrgL2w{k@GCcD< zVWsf6;4Fn|td?qIVCDGJyPo8nW$=i=%Agi&r5ZWND)0=)c%bVc5ULbrmKL#+(z5aj z8CWIWJw`51ay2j$XOi4x{N!0m zbS+#L39AJeWoeciWcB#ScaCy1C&4~4a}vzP+0rZ-*c80{7>U)vy+W)G=HMJ@t_*A{ zzWytU4Z@2>B!|#|4HUO&_|~5YtAw|Ufw#wW{LkM%$dyd?+h{U0Vx!a~2iXifJARr& z_0T~)_0WvX(mXlHBpka$&=goh&=i=D^9h=Xrv)?>RuVK7TChb5%fMuO^hZ>I)8Kw# z^)!fJL~50R&BE`G5mo}10}u#J@zYjaQ#+{+C)ZDzI&Jz4X{J0&)ZA?R@kbQX>2R`y z)J%sqY@?XY!Nb2HtO`CX&Ze3@=ZmQ3;_;WLoAcopRS?M3;auLPz#8zckDuacp8?+# zx*W=)_JMJk9vb6~bhA zQ(!W5VHaWZ@Z<-_xVl;JH=q34+mr?E z9d(^Dur7QiW%v_3EWj4x(Yr`(1MvBo5$aMF`a+BF!q4f-JovS!u6fXn-DKHfy#GbQ z=D^c}a0!0v`*boN&WVPb536xC-Cl}MUL-$S;Bq1P(E>f#L)bDr_14#TOvCV+m>FSM zgKMN-8Q5}s_$+Zo;KxEP0&8(C$*sUw-=zv^g+B>>t*{Q)QH89;htHF~Hh4Ec`r2SU zt|z%w_~KFGY=A4g#cKU*S1ek*Wa+ZyD^{-Z-S5U@FVjT@zMD@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vyOaIjo` z%^4gXbiP%6osQ ziY1fM=@*CGL`wdOS1B_m93Fhxpwb~j281dH3@8nmb4~R_Nx1d&IaQ7|Gn_kpj#KYM VjCg$J{|^8F|NlWo?w|`S008<+Fo^&F literal 0 HcmV?d00001 diff --git a/test/pmu/leak/itimer_profile b/test/pmu/leak/itimer_profile new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/pmu/leak/test1.go b/test/pmu/leak/test1.go new file mode 100644 index 0000000000..ee9911e7fb --- /dev/null +++ b/test/pmu/leak/test1.go @@ -0,0 +1,39 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "runtime/pprof" +) + +var sum int + +func run() error { + for /*i := 0; i < 10; i++*/ { + itimerFile, err := os.Create("itimer_profile") + if err != nil { + return err + } + + if err = pprof.StartCPUProfile(itimerFile); err != nil { + return err + } + for j := 0; j < 100; j++ { + sum += j + } + pprof.StopCPUProfile() + itimerFile.Close() + } + fmt.Println(sum) + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/leak/test2.go b/test/pmu/leak/test2.go new file mode 100644 index 0000000000..3b04ecf6c8 --- /dev/null +++ b/test/pmu/leak/test2.go @@ -0,0 +1,43 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "runtime/pprof" +) + +var sum int + +func run() error { + for /*i := 0; i < 100000; i++*/ { + cycleFile, err := os.Create("cycle_profile") + if err != nil { + return err + } + + var cycle pprof.PMUEventConfig + cycle.Period = 100000 + cycle.IsKernelIncluded = false + cycle.IsHvIncluded = false + if err = pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { + return err + } + for j := 0; j < 10000000; j++ { + sum += j + } + pprof.StopPMUProfile() + cycleFile.Close() + } + fmt.Println(sum) + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/leak/test3.go b/test/pmu/leak/test3.go new file mode 100644 index 0000000000..b5e34d911d --- /dev/null +++ b/test/pmu/leak/test3.go @@ -0,0 +1,57 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "runtime/pprof" +) + +var sum int + +func run() error { + for /*i := 0; i < 10; i++*/ { + itimerFile, err := os.Create("itimer_profile") + if err != nil { + return err + } + + if err = pprof.StartCPUProfile(itimerFile); err != nil { + return err + } + for j := 0; j < 10000000; j++ { + sum += j + } + pprof.StopCPUProfile() + itimerFile.Close() + + cycleFile, err := os.Create("cycle_profile") + if err != nil { + return err + } + + var cycle pprof.PMUEventConfig + cycle.Period = 100000 + cycle.IsKernelIncluded = false + cycle.IsHvIncluded = false + if err = pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { + return err + } + for j := 0; j < 10000000; j++ { + sum += j + } + pprof.StopPMUProfile() + cycleFile.Close() + } + fmt.Println(sum) + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/leak/test4.go b/test/pmu/leak/test4.go new file mode 100644 index 0000000000..cb12c65136 --- /dev/null +++ b/test/pmu/leak/test4.go @@ -0,0 +1,64 @@ +// run + +package main + +import ( + "fmt" + "log" + "os" + "runtime/pprof" +) + +var sum int + +func run() error { + for /*i := 0; i < 100; i++*/ { + cycleFile, err := os.Create("cycle_profile") + if err != nil { + return err + } + instrFile, err := os.Create("instr_profile") + if err != nil { + return err + } + cacheRefFile, err := os.Create("cacheRef_profile") + if err != nil { + return err + } + cacheMissFile, err := os.Create("cacheMiss_profile") + if err != nil { + return err + } + + var cycle pprof.PMUEventConfig + cycle.Period = 1000000 + var instr pprof.PMUEventConfig + instr.Period = 1000000 + var cacheRef pprof.PMUEventConfig + cacheRef.Period = 100 + var cacheMiss pprof.PMUEventConfig + cacheMiss.Period = 100 + + if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle), pprof.WithProfilingPMUInstructions(instrFile, &instr), pprof.WithProfilingPMUCacheReferences(cacheRefFile, &cacheRef), pprof.WithProfilingPMUCacheMisses(cacheMissFile, &cacheMiss)); err != nil { + return err + } + for j := 0; j < 10000000; j++ { + sum += j + } + pprof.StopPMUProfile() + + cycleFile.Close() + instrFile.Close() + cacheRefFile.Close() + cacheMissFile.Close() + } + fmt.Println(sum) + + return nil +} + +func main() { + if err := run(); err != nil { + log.Fatal(err) + } +} diff --git a/test/pmu/leak/test5.go b/test/pmu/leak/test5.go new file mode 100644 index 0000000000..7ef22515d7 --- /dev/null +++ b/test/pmu/leak/test5.go @@ -0,0 +1,72 @@ +// run + +package main + +import ( + "fmt" + "os" + "log" + "sync" + "runtime/pprof" +) + +var wg sync.WaitGroup +var sum int + +func run() { + defer wg.Done() + for i := 0; i < 10000000; i++ { + sum += i + } +} + +func main() { + wg.Add(1000) + + cycleFile, err := os.Create("cycle_profile") + if err != nil { + log.Fatal(err) + return + } + instrFile, err := os.Create("instr_profile") + if err != nil { + log.Fatal(err) + return + } + cacheRefFile, err := os.Create("cacheRef_profile") + if err != nil { + log.Fatal(err) + return + } + cacheMissFile, err := os.Create("cacheMiss_profile") + if err != nil { + log.Fatal(err) + return + } + + var cycle pprof.PMUEventConfig + cycle.Period = 1000000 + var instr pprof.PMUEventConfig + instr.Period = 1000000 + var cacheRef pprof.PMUEventConfig + cacheRef.Period = 100 + var cacheMiss pprof.PMUEventConfig + cacheMiss.Period = 1 + + if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle), pprof.WithProfilingPMUInstructions(instrFile, &instr), pprof.WithProfilingPMUCacheReferences(cacheRefFile, &cacheRef), pprof.WithProfilingPMUCacheMisses(cacheMissFile, &cacheMiss)); err != nil { + log.Fatal(err) + } + + for i := 0; i < 1000; i++ { + go run() + } + + wg.Wait() + fmt.Println(sum) + pprof.StopPMUProfile() + + cycleFile.Close() + instrFile.Close() + cacheRefFile.Close() + cacheMissFile.Close() +} diff --git a/test/pmu/leak/test6.go b/test/pmu/leak/test6.go new file mode 100644 index 0000000000..0bd4c341f6 --- /dev/null +++ b/test/pmu/leak/test6.go @@ -0,0 +1,68 @@ +// run + +package main + +import ( + "fmt" + "os" + "time" + "runtime/pprof" +) + +var sum int + +func run() { + for { + cycleFile, err := os.Create("cycle_profile") + if err != nil { + return + } + + instrFile, err := os.Create("instr_profile") + if err != nil { + return + } + + cacheRefFile, err := os.Create("cacheRef_profile") + if err != nil { + return + } + + cacheMissFile, err := os.Create("cacheMiss_profile") + if err != nil { + return + } + + var cycle pprof.PMUEventConfig + cycle.Period = 1000000 + var instr pprof.PMUEventConfig + instr.Period = 1000000 + var cacheRef pprof.PMUEventConfig + cacheRef.Period = 100 + var cacheMiss pprof.PMUEventConfig + cacheMiss.Period = 1 + + if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle), pprof.WithProfilingPMUInstructions(instrFile, &instr), pprof.WithProfilingPMUCacheReferences(cacheRefFile, &cacheRef), pprof.WithProfilingPMUCacheMisses(cacheMissFile, &cacheMiss)); err != nil { + return + } + + for i := 0; i < 100000000; i++ { + sum += i + } + pprof.StopPMUProfile() + + cycleFile.Close() + instrFile.Close() + cacheRefFile.Close() + cacheMissFile.Close() + } +} + +func main() { + for i := 0; i < 100; i++ { + go run() + } + + time.Sleep(time.Hour) + fmt.Println(sum) +} From 1d9c12c11eea38e25d8d8129c123defe9eebbf17 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:41:33 -0700 Subject: [PATCH 087/126] remove --- test/pmu/leak/cacheMiss_profile | Bin 17545 -> 0 bytes test/pmu/leak/cacheRef_profile | Bin 43243 -> 0 bytes test/pmu/leak/cycle_profile | Bin 3561 -> 0 bytes test/pmu/leak/instr_profile | Bin 5731 -> 0 bytes test/pmu/leak/itimer_profile | 0 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/pmu/leak/cacheMiss_profile delete mode 100644 test/pmu/leak/cacheRef_profile delete mode 100644 test/pmu/leak/cycle_profile delete mode 100644 test/pmu/leak/instr_profile delete mode 100644 test/pmu/leak/itimer_profile diff --git a/test/pmu/leak/cacheMiss_profile b/test/pmu/leak/cacheMiss_profile deleted file mode 100644 index 79e6d0a243118b848877e6098b93767dbb34045c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17545 zcmV*DKy1GsiwFP!00004|CGIVd>lpcIQqJ07LO&_s$F9!z`(L3TY!WG2ge~NWvtZyANBf?M&~5CAI~7x(97$C}5PSfQbHw0$>3yT`-uo z1K6WT0eBc6<~c78oX&Gz7_Ow^g-7raf3*NuK3v&oG_CVNA2sKLNAXdAwLq#>1^d$+ zDIY-ikW`-JlZNTJuYy%EDLJK5+ z7Ldt2fa~TlK>+InKY0*Oj~+?u?}yHcjQhclekKEP0nM3KRd|rOt_n}!6aGK|tcS40 z(owYR0a$JF+yn3=KIwld0M^5}cqY$12zw2ldk~(+r+MxX+&h5h5T>i`5T3zjc&-}u z-NB?h1hW(?55cqetiQSsSO7`)SAD?yAU^c)BP63oam1;1q>_i>N#5jPsDU;7X@OMh zF&sR908KptKjW!K;5mHG|9l|TdK~92;;CxzE>Bg17w`q1^5XzC^(g#?ryhlLO!sF5 zzmfS=*dc-=F&avIN7 zfu2gY&*H@+Y`-Zm{XQUVSI2$BS`qF5Y*n}e@Cv@-e>IS5)xgWw+mei)gcx)CB>WtI z?td+iYNg@Oc1>yODX7C!Pr)zn7yj1*U_FN|Xv$+f4J%dXcp83*zx2Nz0PA_&^%L)3 z38q`F)js*u)6YCxsdDuiY0o|HSnUfqrEOcH>=`)yEbs9Q{0e{Ne>DJBIu1~C&%&ao zdG1;GHU66CGO+E+*0ioV4D<3_b$A2c;JFvE&32xv0Y|IwTn+dQ{)Xpj;?jdWmj-L@ z=eaa^6W`>yOzd=&=bnROYVJ9B3*X|om+tZJ_4# z263t*zTLTDP`cP*1Onr0mqp~;8hT|ZM^Hog!gd$ zI^O4Hn6IdM89v63{htKDdLK8;=8%#KLn)-B@ILpw_ddt`RO`2R`dABc(4WD}Y&t)K zT3E~fhX7a~;1ZhhSg$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MzyY5!w;0z$Bi~|G+!0G~^bO_ez<=_X|9Rz&Dy1~S}7eug@ zcY@z}`5VjaE`}b>ji_%5i5ePKx)`zm+T=lWT-#Y)Ipt!(SH5Y8 z%1X5p8e}ZvPi484T+{~Agixslee57RFvMLxi#*yVuOg2IsZza##ha0Eh|0~n1O6%# zCT5H#MqMkZHTk7Pc<(Sak%h(-%!{{#eAJxb`&Wa(hPqIsVHod zz0qLGRbx|NB z<~dMv7*2W777+)(3^$6J11Ie-#j;5wG`Grno0fDbQmG*5ZGoCtwjG(+uC z=(E!EhbpZGVg;8GUx;$>z+ha>7%8&xl^wK8GvC#IrHr-6MAHpGP9YV8aeyJRKA@r@ zlWLe}KweUqIa3`$ku@rcWt9tgalX*b>2%@s<-i--Ic(9@fXug${o4yg2aL*=bicyw z-|$w9>tj^LH!>i4#9-I~)n|)#p_I7_0u4Uu0eoAgYuSRG+XhtI+Z~jk-^PY?b88=L zQg07j)cSjPryywr9!A`O-;BNvtDHO+!V7hF`q{J2;RWb^c6OAX=A{6U;ZB^{ZeT`$ z(HGJoghfg&)Gk9&V(ev|3(m%%yT{qM|`e;Mo#^|N-d_}~9G00960lsA97m~#ODGE_0H diff --git a/test/pmu/leak/cycle_profile b/test/pmu/leak/cycle_profile deleted file mode 100644 index 87f7cd4af610d650d086e16cbc51e3ee5cdbb188..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3561 zcmVe!Jyxq#)tLb{g+ zMOY*i%fRyS%ny&}$%QN*{#->^J}_ibi43d&A9#zf0{Cq;VFgf%rGypYPv0Y~5XNc< zD}*vEBdiGTfAA#dEP}B-!iu0A%cY7?1q5LH?q#KgdHDr}MRJf80D@E{11rUsUm&amekrgL2w{k@GCcD< zVWsf6;4Fn|td?qIVCDGJyPo8nW$=i=%Agi&r5ZWND)0=)c%bVc5ULbrmKL#+(z5aj z8CWIWJw`51ay2j$XOi4x{N!0m zbS+#L39AJeWoeciWcB#ScaCy1C&4~4a}vzP+0rZ-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WD6+{I;LtLeKH;?D)A8Rg|gspup+f)6{}I&gkh3x8mZ!7BJIlI*sQ1|qLH{^ zN4Y|^fA?gQ$CSFPR7Ijmh#DcDl3o5abNC|fJd{e=R&{Vn%&jT2t?F1jmW-B-pFFZY zA{W*0`KqP~gU1uK{JpTKB$|#T-IQw=2P1~lJg<19Vab%uRXd%Wol3jm?j9OUTCV9j zannpyWNJ5D+8kZwIIpNqyC(OC?BeJ|jO2eX>J!mO!mxQ&&K9dYur13SA)oN8I&|f{i2D* z>ZpCjsnQ8i|ACC=tWc?6x)H;PI0eyaH zz(lphXSceP5jDpptIW9*tNn{n+pPE2{p@!UX#;DkRt3_ZSTYUNdgaLJU{?82sjD23 zt{xLlJ2j=v?8$YNmFa3}b9P1ZIoSM0dFCVGUY_4&ONmHjhTCS+C=R-IJ!hPsh}kj4 zBd4)oW~(a>rjxvO$$st^pWj9Q#l;}WTOJCNv%$0aXMz1 zZAHq>c=dQA)l3ByWy-c(OV(9iFJslY{6@z^-DEXQTYfz;s>U0slwAFPp+VBDQ!7B` zcDQF#wp1eRUEtAU``O47mFIEuro83&OL}%B$)T<|vP+9?n)1uJx8VD&s>vyOaIjo` z%^4gXbiP%6osQ ziY1fM=@*CGL`wdOS1B_m93Fhxpwb~j281dH3@8nmb4~R_Nx1d&IaQ7|Gn_kpj#KYM VjCg$J{|^8F|NlWo?w|`S008<+Fo^&F diff --git a/test/pmu/leak/itimer_profile b/test/pmu/leak/itimer_profile deleted file mode 100644 index e69de29bb2..0000000000 From 18a9d26a0b529172f703e0bbd219f11fdf05c38b Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:49:36 -0700 Subject: [PATCH 088/126] minor --- test/pmu/leak/test2.go | 1 + test/pmu/leak/test3.go | 1 + 2 files changed, 2 insertions(+) diff --git a/test/pmu/leak/test2.go b/test/pmu/leak/test2.go index 3b04ecf6c8..44f2d77875 100644 --- a/test/pmu/leak/test2.go +++ b/test/pmu/leak/test2.go @@ -22,6 +22,7 @@ func run() error { cycle.Period = 100000 cycle.IsKernelIncluded = false cycle.IsHvIncluded = false + if err = pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { return err } diff --git a/test/pmu/leak/test3.go b/test/pmu/leak/test3.go index b5e34d911d..89b4bd3477 100644 --- a/test/pmu/leak/test3.go +++ b/test/pmu/leak/test3.go @@ -36,6 +36,7 @@ func run() error { cycle.Period = 100000 cycle.IsKernelIncluded = false cycle.IsHvIncluded = false + if err = pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { return err } From a42f3ce033954df92dfcafb816b449eb7dafed07 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 15:59:49 -0700 Subject: [PATCH 089/126] minor --- src/runtime/defs_perf_linux.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index e66b757d83..2a1bf1eeab 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -4,11 +4,11 @@ var perfEventOpt = map[int32]struct { Type uint32 // type of event Config uint64 // event } { - GO_COUNT_HW_CPU_CYCLES : {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, // index: GO_COUNT_HW_CPU_CYCLES - GO_COUNT_HW_INSTRUCTIONS: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, // index: GO_COUNT_HW_INSTRUCTIONS - GO_COUNT_HW_CACHE_REFERENCES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, // index: GO_COUNT_HW_CACHE_REFERENCES - GO_COUNT_HW_CACHE_MISSES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, // index: GO_COUNT_HW_CACHE_MISSES - GO_COUNT_HW_RAW: {_PERF_TYPE_RAW, 0 /* will not be used*/}, // index: GO_COUNT_HW_RAW + GO_COUNT_HW_CPU_CYCLES : {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, + GO_COUNT_HW_INSTRUCTIONS: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, + GO_COUNT_HW_CACHE_REFERENCES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, + GO_COUNT_HW_CACHE_MISSES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, + GO_COUNT_HW_RAW: {_PERF_TYPE_RAW, 0 /* will not be used */}, // TODO: add more perf events } From 7c0fd97bea2cefd034939f7b698b8ac4bffa8018 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 16:05:31 -0700 Subject: [PATCH 090/126] minor --- src/cmd/go/internal/test/test.go | 2 +- src/testing/testing.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 85ba0a1ebb..84ae49f8ba 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -313,7 +313,7 @@ profile the tests during execution: Write a CPU profile to the specified file before exiting. Writes test binary as -c would. - -pmurofile pmu.out + -pmuprofile pmu.out Write a PMU profile to the specified file before exiting. Writes test binary as -c would. diff --git a/src/testing/testing.go b/src/testing/testing.go index 027c3ceb98..07613d5531 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -321,7 +321,7 @@ var ( pmuEvent *string pmuPeriod *int64 pmuPreciseIP *int - pmuKernelIncluded *bool + pmuKernelIncluded *bool pmuHvIncluded *bool blockProfile *string blockProfileRate *int From f43107436ac75d9b4942ccb8b2f7f202b2496ca1 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 18:17:38 -0700 Subject: [PATCH 091/126] fix a configuration error by regenerating alldocs.go --- src/cmd/go/alldocs.go | 20 ++++++++++++++++++++ src/cmd/go/internal/test/test.go | 16 ++++++++-------- src/runtime/defs_linux_386.go | 6 +++--- src/runtime/defs_linux_amd64.go | 3 ++- src/runtime/defs_linux_arm.go | 6 +++--- src/runtime/defs_linux_arm64.go | 6 +++--- src/runtime/defs_linux_mips64x.go | 6 +++--- src/runtime/defs_linux_mipsx.go | 6 +++--- src/runtime/defs_linux_ppc64.go | 6 +++--- src/runtime/defs_linux_ppc64le.go | 6 +++--- src/runtime/defs_linux_s390x.go | 6 +++--- src/runtime/defs_perf_linux.go | 1 + src/runtime/defs_pmu.go | 2 ++ 13 files changed, 57 insertions(+), 33 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 26fb337f86..fc62ada3ff 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -2958,6 +2958,26 @@ // Write a CPU profile to the specified file before exiting. // Writes test binary as -c would. // +// -pmuprofile pmu.out +// Write a PMU profile to the specified file before exiting. +// Writes test binary as -c would. +// +// -pmuevent event +// Specify which pmu event to sample. +// To sample PMU cycles, use -test.memprofilerate=1. +// +// -pmuperiod n +// Set the sampling period for the pmu event specified by -pmuevent. +// +// -pmupreciseip n +// Set the precise ip level for the pmu event specified by -pmuevent. +// +// -pmukernelincl +// Count the kernel or not. +// +// -pmuhvincl +// Count the hypervisor or not. +// // -memprofile mem.out // Write an allocation profile to the file after all tests have passed. // Writes test binary as -c would. diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 84ae49f8ba..79235ef948 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -312,25 +312,25 @@ profile the tests during execution: -cpuprofile cpu.out Write a CPU profile to the specified file before exiting. Writes test binary as -c would. - + -pmuprofile pmu.out Write a PMU profile to the specified file before exiting. Writes test binary as -c would. - + -pmuevent event Specify which pmu event to sample. - To sample PMU cycles, use -test.memprofilerate=1. - + To sample PMU cycles, use -test.memprofilerate=1. + -pmuperiod n Set the sampling period for the pmu event specified by -pmuevent. - + -pmupreciseip n Set the precise ip level for the pmu event specified by -pmuevent. - - -pmukernelincl + + -pmukernelincl Count the kernel or not. - -pmuhvincl + -pmuhvincl Count the hypervisor or not. -memprofile mem.out diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index 5e078b3b26..d9f49662e7 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -97,6 +97,7 @@ const ( _SOCK_DGRAM = 0x2 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -289,9 +290,8 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint32 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint32 + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 0ba2bf1c01..a64501e9e4 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -94,6 +94,7 @@ const ( _SOCK_DGRAM = 0x2 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -253,7 +254,7 @@ type siginfo struct { si_code int32 // below here is a union; si_addr is the only field we use si_addr uint64 - // psu: an unreliable workaround and need to figure out a better solution + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index e27ce80c9a..e82a2a94cb 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -90,6 +90,7 @@ const ( _SOCK_DGRAM = 0x2 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -285,9 +286,8 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint32 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint32 + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index ba754fa6a5..d9f6c1d343 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -94,6 +94,7 @@ const ( _SOCK_DGRAM = 0x2 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -252,9 +253,8 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint64 + // si_fd is the next field. si_fd int32 } diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index da591ad867..a631d7aaca 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -89,6 +89,7 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -255,9 +256,8 @@ type siginfo struct { si_errno int32 __pad0 [1]int32 // below here is a union; si_addr is the only field we use - si_addr uint64 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint64 + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index 957d57ba36..306a2adf0f 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -93,6 +93,7 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -253,9 +254,8 @@ type siginfo struct { si_code int32 si_errno int32 // below here is a union; si_addr is the only field we use - si_addr uint32 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint32 + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index 3810ccb0b3..620c1b88e7 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -89,6 +89,7 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -252,9 +253,8 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint64 + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index adf6111eae..ffaf6e5713 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -89,6 +89,7 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -252,9 +253,8 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint64 + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index b93148ff65..025d6dbf4d 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -90,6 +90,7 @@ const ( _EPOLL_CTL_MOD = 0x3 ) +// The replication is because constants could be different on different architecture const ( _PERF_TYPE_HARDWARE = 0x0 _PERF_TYPE_SOFTWARE = 0x1 @@ -248,9 +249,8 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 - // psu: an unreliable workaround and need to figure out a better solution - // psu: only tested on amd64 + si_addr uint64 + // si_fd is the field right after the union si_fd int32 } diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index 2a1bf1eeab..34c08e8724 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -1,5 +1,6 @@ package runtime +// Convert platform-agnostic pmu events to Linux perf events var perfEventOpt = map[int32]struct { Type uint32 // type of event Config uint64 // event diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 4cf04ca3a6..033d94848d 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -1,5 +1,7 @@ package runtime +// These Constants are platform agnostic and exposed to pprof. +// We use perfEventOpt to map these to the underlying OS and HW. const ( GO_COUNT_HW_CPU_CYCLES = 0x0 GO_COUNT_HW_INSTRUCTIONS = 0x1 From ca0f3fc49559adbb2b0b251ebde2bc4d190727a6 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 18:22:40 -0700 Subject: [PATCH 092/126] test cases --- test/pmu/test2.go | 25 ++++++++++--------------- test/run.go | 3 ++- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/test/pmu/test2.go b/test/pmu/test2.go index f065cec929..0b53df24d5 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -21,7 +21,7 @@ func f1() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -29,7 +29,6 @@ func f1() { /*if i % 100 == 0 { time.Sleep(time.Nanosecond) }*/ - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -39,7 +38,7 @@ func f2() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -47,7 +46,6 @@ func f2() { /*if i % 100 == 0 { time.Sleep(time.Nanosecond) }*/ - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -57,7 +55,7 @@ func f3() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -65,7 +63,6 @@ func f3() { /*if i % 100 == 0 { time.Sleep(time.Nanosecond) }*/ - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -75,7 +72,7 @@ func f4() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -83,7 +80,6 @@ func f4() { /*if i % 100 == 0 { time.Sleep(time.Nanosecond) }*/ - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -93,12 +89,11 @@ func f5() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 sum -= i / 4 - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -108,7 +103,7 @@ func f6() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -123,7 +118,7 @@ func f7() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -138,7 +133,7 @@ func f8() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -153,7 +148,7 @@ func f9() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 @@ -168,7 +163,7 @@ func f10() { defer wg.Done() var sum int - for i := 0; i < 50000000; i++ { + for i := 0; i < 500000000; i++ { sum -= i / 2 sum *= i sum /= i/3 + 1 diff --git a/test/run.go b/test/run.go index 7f6edfc111..f6c42fe1c0 100644 --- a/test/run.go +++ b/test/run.go @@ -50,7 +50,8 @@ var ( // dirs are the directories to look for *.go files in. // TODO(bradfitz): just use all directories? - dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "pmu"} + // dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "pmu"} + dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime"} // ratec controls the max number of tests running at a time. ratec chan bool From 16feaf6c9d34822a228187f64c2657ff40d1f3d7 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 18 Jul 2019 23:33:37 -0700 Subject: [PATCH 093/126] minor --- src/testing/testing.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testing/testing.go b/src/testing/testing.go index 07613d5531..27ad3beea5 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -286,7 +286,7 @@ func Init() { memProfileRate = flag.Int("test.memprofilerate", 0, "set memory allocation profiling `rate` (see runtime.MemProfileRate)") cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to `file`") pmuProfile = flag.String("test.pmuprofile", "", "write a pmu profile to `file`") - pmuEvent = flag.String("test.pmuevent", "cycle", "select a pmu event from the events: cycles, instructions, cacheReferences, cacheMisses") + pmuEvent = flag.String("test.pmuevent", "cycles", "select a pmu event from the events: cycles, instructions, cacheReferences, cacheMisses") pmuPeriod = flag.Int64("test.pmuperiod", 10000000, "specify the sampling period for a PMU event") pmuPreciseIP = flag.Int("test.pmupreciseip", 0, "specify the precise IP level (0-3) for a PMU event") pmuKernelIncluded = flag.Bool("test.pmukernelincl", false, "count the kernel") From 151680a6327333fa03337e67938c53e07c23853e Mon Sep 17 00:00:00 2001 From: psu-wm Date: Fri, 19 Jul 2019 16:09:22 -0700 Subject: [PATCH 094/126] replace slice with array --- src/runtime/os_linux.go | 1 - src/runtime/proc.go | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index fecc9febdb..73f218470c 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -514,7 +514,6 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { if !eventAttr.IsHvIncluded { // don't count hypervisor perfAttr.Bits += 0b1000000 } - fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) if err != 0 { println("Linux perf event open failed") diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 18c363f19e..5f0c2e6793 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3803,8 +3803,8 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { // In fact mp may not even be stopped. // See golang.org/issue/17165. getg().m.mallocing++ - stk := make([]uintptr, maxCPUProfStack) - n := stackUnwinding(pc, sp, lr, gp, mp, stk) + var stk [maxCPUProfStack]uintptr + n := stackUnwinding(pc, sp, lr, gp, mp, stk[:]) if prof.hz != 0 { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostAtomic64Count > 0 { cpuprof.addLostAtomic64(lostAtomic64Count) @@ -3834,8 +3834,8 @@ func sigprofPMU(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { } getg().m.mallocing++ - stk := make([]uintptr, maxCPUProfStack) - n := stackUnwinding(pc, sp, lr, gp, mp, stk) + var stk [maxCPUProfStack]uintptr + n := stackUnwinding(pc, sp, lr, gp, mp, stk[:]) if pmuEvent[eventId].eventAttr != nil { if (GOARCH == "mips" || GOARCH == "mipsle" || GOARCH == "arm") && lostPMUAtomic64Count[eventId] > 0 { pmuprof[eventId].addLostAtomic64(lostPMUAtomic64Count[eventId], eventId) From eb4565f78ecdd76e50b17a256cfba2e5b9e6c651 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Fri, 19 Jul 2019 16:12:33 -0700 Subject: [PATCH 095/126] minor --- src/runtime/os_linux.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 73f218470c..fecc9febdb 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -514,6 +514,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { if !eventAttr.IsHvIncluded { // don't count hypervisor perfAttr.Bits += 0b1000000 } + fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) if err != 0 { println("Linux perf event open failed") From 9e5ca00a84386c551203e57196384efb52abfd52 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 22 Jul 2019 17:36:32 -0700 Subject: [PATCH 096/126] minor --- src/runtime/os_linux.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index fecc9febdb..5d2612b842 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -400,6 +400,9 @@ func setsig(i uint32, fn uintptr) { } sa.sa_handler = fn sigaction(i, &sa, nil) + if i == _SIGPROF { + unblocksig(i) + } } //go:nosplit @@ -501,7 +504,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { var perfAttr perfEventAttr perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) perfAttr.Type = perfEventOpt[eventId].Type - if (eventId == GO_COUNT_HW_RAW) { + if eventId == GO_COUNT_HW_RAW { perfAttr.Config = eventAttr.RawEvent } else { perfAttr.Config = perfEventOpt[eventId].Config From c7454d5b3c2d251574170141c372af57f5309337 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Mon, 22 Jul 2019 17:37:40 -0700 Subject: [PATCH 097/126] minor --- src/runtime/os_linux.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 5d2612b842..e6d997d98b 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -400,9 +400,6 @@ func setsig(i uint32, fn uintptr) { } sa.sa_handler = fn sigaction(i, &sa, nil) - if i == _SIGPROF { - unblocksig(i) - } } //go:nosplit From 0294127bb7070b941f8d35277a4a3b5843ba6a4a Mon Sep 17 00:00:00 2001 From: psu-wm Date: Fri, 26 Jul 2019 12:10:28 -0700 Subject: [PATCH 098/126] minor --- src/cmd/go/alldocs.go | 4 +++- src/cmd/go/internal/test/test.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index fc62ada3ff..74cf3af0da 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -2964,7 +2964,9 @@ // // -pmuevent event // Specify which pmu event to sample. -// To sample PMU cycles, use -test.memprofilerate=1. +// To sample PMU cycles, use -test.pmuevent=cycles. +// To sample PMU instructions, use -test.pmuevent=instructions. +// To sample PMU cache misses, use -test.pmuevent=cacheMisses. // // -pmuperiod n // Set the sampling period for the pmu event specified by -pmuevent. diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 79235ef948..0d31dcc207 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -319,7 +319,9 @@ profile the tests during execution: -pmuevent event Specify which pmu event to sample. - To sample PMU cycles, use -test.memprofilerate=1. + To sample PMU cycles, use -test.pmuevent=cycles. + To sample PMU instructions, use -test.pmuevent=instructions. + To sample PMU cache misses, use -test.pmuevent=cacheMisses. -pmuperiod n Set the sampling period for the pmu event specified by -pmuevent. From e8e5462decea4ca86cbe1bec8597947afe58b8ff Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 28 Jul 2019 12:51:45 -0700 Subject: [PATCH 099/126] tests --- test/pmu/http/test1.go | 4 ++-- test/pmu/http/test2.go | 2 +- test/pmu/http/test3.go | 2 +- test/pmu/http/test4.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/pmu/http/test1.go b/test/pmu/http/test1.go index cf337ffa9a..cbdec6303b 100644 --- a/test/pmu/http/test1.go +++ b/test/pmu/http/test1.go @@ -1,14 +1,14 @@ // run // Example of usage: // 1. go run test1.go -// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cycles\&period=10000000 +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=cycles\&pmuperiod=10000000 package main import ( "fmt" "log" - // "time" + _"time" "net/http" _ "net/http/pprof" ) diff --git a/test/pmu/http/test2.go b/test/pmu/http/test2.go index cbe16e09fe..4b96c4e381 100644 --- a/test/pmu/http/test2.go +++ b/test/pmu/http/test2.go @@ -1,7 +1,7 @@ // run // Example of usage: // 1. go run test2.go -// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=instructions\&period=10000000 +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=instructions\&pmuperiod=10000000 package main diff --git a/test/pmu/http/test3.go b/test/pmu/http/test3.go index ececca4108..eb1a04dbf8 100644 --- a/test/pmu/http/test3.go +++ b/test/pmu/http/test3.go @@ -1,7 +1,7 @@ // run // Example of usage: // 1. go run test3.go -// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=cacheMisses\&period=10000000 +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=cacheMisses\&pmuperiod=10000000 package main diff --git a/test/pmu/http/test4.go b/test/pmu/http/test4.go index b7ab6cfb2f..07225076e8 100644 --- a/test/pmu/http/test4.go +++ b/test/pmu/http/test4.go @@ -1,7 +1,7 @@ // run // Example of Usage: // 1. go run test4.go -// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&event=r53010e\&period=1000000 +// 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=r53010e\&pmuperiod=1000000 package main From d3daccec11aa1e13385c5321d40dc8e7c9623c30 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Sun, 28 Jul 2019 12:56:21 -0700 Subject: [PATCH 100/126] support raw events for benchmarks --- src/net/http/pprof/pprof.go | 10 +++++----- src/testing/internal/testdeps/deps.go | 12 +++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index 115c6c48b5..afeff9df95 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -113,20 +113,20 @@ func serveError(w http.ResponseWriter, status int, txt string) { func pmuProfile(w http.ResponseWriter, r *http.Request) error { var eventConfig pprof.PMUEventConfig - if period, err := strconv.ParseInt(r.FormValue("period"), 10, 64); err == nil { + if period, err := strconv.ParseInt(r.FormValue("pmuperiod"), 10, 64); err == nil { eventConfig.Period = period } - if preciseIP, err := strconv.ParseInt(r.FormValue("preciseIP"), 10, 8); err == nil { + if preciseIP, err := strconv.ParseInt(r.FormValue("pmupreciseip"), 10, 8); err == nil { eventConfig.PreciseIP = int8(preciseIP) } - if isKernelIncluded, err := strconv.ParseBool(r.FormValue("kernel")); err == nil { + if isKernelIncluded, err := strconv.ParseBool(r.FormValue("pmukernelincl")); err == nil { eventConfig.IsKernelIncluded = isKernelIncluded } - if isHvIncluded, err := strconv.ParseBool(r.FormValue("hv")); err == nil { + if isHvIncluded, err := strconv.ParseBool(r.FormValue("pmuhvincl")); err == nil { eventConfig.IsHvIncluded = isHvIncluded } - switch eventName := r.FormValue("event"); eventName { + switch eventName := r.FormValue("pmuevent"); eventName { case "cycles": return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) case "instructions": diff --git a/src/testing/internal/testdeps/deps.go b/src/testing/internal/testdeps/deps.go index 5669d6e65b..f24342276a 100644 --- a/src/testing/internal/testdeps/deps.go +++ b/src/testing/internal/testdeps/deps.go @@ -17,6 +17,7 @@ import ( "io" "regexp" "runtime/pprof" + "strconv" "strings" "sync" ) @@ -64,7 +65,16 @@ func (TestDeps) StartPMUProfile(w io.Writer, event string, period int64, precise case "cacheMisses": return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) default: - return fmt.Errorf("unknown or not yet implemented event") + // Is this a raw event? + if strings.HasPrefix(event, "r") { + if rawHexEvent, err := strconv.ParseInt(event[1:], 16, 64); err == nil { + eventConfig.RawEvent = rawHexEvent + return pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) + } + return fmt.Errorf("Incorrect hex format for raw event") + } else { + return fmt.Errorf("Unknown or not yet implemented event") + } } } From dc539dada3e5e8e9e579a48e3e9939c206344db5 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Tue, 30 Jul 2019 11:34:04 -0700 Subject: [PATCH 101/126] add two new events: LLC_load_accesses and LLC_load_misses --- src/cmd/go/alldocs.go | 2 ++ src/cmd/go/internal/test/test.go | 2 ++ src/net/http/pprof/pprof.go | 7 +++++++ src/runtime/defs_perf_linux.go | 2 ++ src/runtime/defs_pmu.go | 6 ++++-- src/runtime/pprof/pprof.go | 26 ++++++++++++++++++++++++++ src/testing/internal/testdeps/deps.go | 4 ++++ src/testing/testing.go | 2 +- 8 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 74cf3af0da..079cecc1ff 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -2967,6 +2967,8 @@ // To sample PMU cycles, use -test.pmuevent=cycles. // To sample PMU instructions, use -test.pmuevent=instructions. // To sample PMU cache misses, use -test.pmuevent=cacheMisses. +// To sample PMU last-level cache read accesses, use -test.pmuevent=cacheLLReadAccesses. +// To sample PMU last-level cache read misses, use -test.pmuevent=cacheLLReadMisses. // // -pmuperiod n // Set the sampling period for the pmu event specified by -pmuevent. diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 0d31dcc207..055f5b4d58 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -322,6 +322,8 @@ profile the tests during execution: To sample PMU cycles, use -test.pmuevent=cycles. To sample PMU instructions, use -test.pmuevent=instructions. To sample PMU cache misses, use -test.pmuevent=cacheMisses. + To sample PMU last-level cache read accesses, use -test.pmuevent=cacheLLReadAccesses. + To sample PMU last-level cache read misses, use -test.pmuevent=cacheLLReadMisses. -pmuperiod n Set the sampling period for the pmu event specified by -pmuevent. diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index afeff9df95..8df11d919a 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -112,6 +112,7 @@ func serveError(w http.ResponseWriter, status int, txt string) { func pmuProfile(w http.ResponseWriter, r *http.Request) error { var eventConfig pprof.PMUEventConfig + eventConfig.Period = 1e7 // default value if period, err := strconv.ParseInt(r.FormValue("pmuperiod"), 10, 64); err == nil { eventConfig.Period = period @@ -127,6 +128,8 @@ func pmuProfile(w http.ResponseWriter, r *http.Request) error { } switch eventName := r.FormValue("pmuevent"); eventName { + case "": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) case "cycles": return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) case "instructions": @@ -135,6 +138,10 @@ func pmuProfile(w http.ResponseWriter, r *http.Request) error { return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) case "cacheMisses": return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) + case "cacheLLReadAccesses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadAccesses(w, &eventConfig)) + case "cacheLLReadMisses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadMisses(w, &eventConfig)) default: // Is this a raw event? if strings.HasPrefix(eventName, "r") { diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index 34c08e8724..adfe8a929e 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -9,6 +9,8 @@ var perfEventOpt = map[int32]struct { GO_COUNT_HW_INSTRUCTIONS: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, GO_COUNT_HW_CACHE_REFERENCES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, GO_COUNT_HW_CACHE_MISSES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, + GO_COUNT_HW_CACHE_LL_READ_ACCESSES: {_PERF_TYPE_HW_CACHE, (_PERF_COUNT_HW_CACHE_LL) | (_PERF_COUNT_HW_CACHE_OP_READ << 8) | (_PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, + GO_COUNT_HW_CACHE_LL_READ_MISSES: {_PERF_TYPE_HW_CACHE, (_PERF_COUNT_HW_CACHE_LL) | (_PERF_COUNT_HW_CACHE_OP_READ << 8) | (_PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, GO_COUNT_HW_RAW: {_PERF_TYPE_RAW, 0 /* will not be used */}, // TODO: add more perf events } diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 033d94848d..858605f734 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -7,8 +7,10 @@ const ( GO_COUNT_HW_INSTRUCTIONS = 0x1 GO_COUNT_HW_CACHE_REFERENCES = 0x2 GO_COUNT_HW_CACHE_MISSES = 0x3 - GO_COUNT_HW_RAW = 0x4 - GO_COUNT_PMU_EVENTS_MAX = 0x5 + GO_COUNT_HW_CACHE_LL_READ_ACCESSES = 0x4 + GO_COUNT_HW_CACHE_LL_READ_MISSES = 0x5 + GO_COUNT_HW_RAW = 0x6 + GO_COUNT_PMU_EVENTS_MAX = 0x7 ) type PMUEventAttr struct { diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 34ac75ca31..6505819e8a 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -896,6 +896,32 @@ func WithProfilingPMUCacheMisses(w io.Writer, eventConfig *PMUEventConfig) Profi }) } +func WithProfilingPMUCacheLLReadAccesses(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { + return profilingOptionFunc(func() error { + if eventConfig.Period <= 0 { + return fmt.Errorf("Period should be > 0") + } + // TODO: create a table of standard clamp values + // TODO: clamp period to something reasonable + + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_LL_READ_ACCESSES, /* event name */ "last-level cache read accesses") + return nil + }) +} + +func WithProfilingPMUCacheLLReadMisses(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { + return profilingOptionFunc(func() error { + if eventConfig.Period <= 0 { + return fmt.Errorf("Period should be > 0") + } + // TODO: create a table of standard clamp values + // TODO: clamp period to something reasonable + + populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_LL_READ_MISSES, /* event name */ "last-level cache read misses") + return nil + }) +} + func WithProfilingPMURaw(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { return profilingOptionFunc(func() error { if eventConfig.Period <= 0 { diff --git a/src/testing/internal/testdeps/deps.go b/src/testing/internal/testdeps/deps.go index f24342276a..a379244b1e 100644 --- a/src/testing/internal/testdeps/deps.go +++ b/src/testing/internal/testdeps/deps.go @@ -64,6 +64,10 @@ func (TestDeps) StartPMUProfile(w io.Writer, event string, period int64, precise return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) case "cacheMisses": return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) + case "cacheLLReadAccesses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadAccesses(w, &eventConfig)) + case "cacheLLReadMisses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadMisses(w, &eventConfig)) default: // Is this a raw event? if strings.HasPrefix(event, "r") { diff --git a/src/testing/testing.go b/src/testing/testing.go index 27ad3beea5..3a778c3b7a 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -286,7 +286,7 @@ func Init() { memProfileRate = flag.Int("test.memprofilerate", 0, "set memory allocation profiling `rate` (see runtime.MemProfileRate)") cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to `file`") pmuProfile = flag.String("test.pmuprofile", "", "write a pmu profile to `file`") - pmuEvent = flag.String("test.pmuevent", "cycles", "select a pmu event from the events: cycles, instructions, cacheReferences, cacheMisses") + pmuEvent = flag.String("test.pmuevent", "cycles", "select a pmu event from the events: cycles, instructions, cacheReferences, cacheMisses, cacheLLReadAccesses, cacheLLReadMisses") pmuPeriod = flag.Int64("test.pmuperiod", 10000000, "specify the sampling period for a PMU event") pmuPreciseIP = flag.Int("test.pmupreciseip", 0, "specify the precise IP level (0-3) for a PMU event") pmuKernelIncluded = flag.Bool("test.pmukernelincl", false, "count the kernel") From c56ebe131e35f70982ed17296d4bbdce3ef1997d Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 1 Aug 2019 13:04:02 -0700 Subject: [PATCH 102/126] minor --- test/pmu/test2.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/pmu/test2.go b/test/pmu/test2.go index 0b53df24d5..bc9ffb6f22 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -8,7 +8,6 @@ import ( "log" "os" "sync" - "sync/atomic" _"time" "runtime/pprof" ) @@ -108,7 +107,6 @@ func f6() { sum *= i sum /= i/3 + 1 sum -= i / 4 - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -123,7 +121,6 @@ func f7() { sum *= i sum /= i/3 + 1 sum -= i / 4 - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -138,7 +135,6 @@ func f8() { sum *= i sum /= i/3 + 1 sum -= i / 4 - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -153,7 +149,6 @@ func f9() { sum *= i sum /= i/3 + 1 sum -= i / 4 - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -168,7 +163,6 @@ func f10() { sum *= i sum /= i/3 + 1 sum -= i / 4 - atomic.StoreInt32(&racy, 42) } fmt.Println(sum) @@ -182,7 +176,7 @@ func run() error { defer cycleFile.Close() var cycle pprof.PMUEventConfig - cycle.Period = 1000000 + cycle.Period = 100000000 // cycle.PreciseIP = 2 instrFile, err := os.Create("instr_profile") @@ -192,7 +186,7 @@ func run() error { defer instrFile.Close() var instr pprof.PMUEventConfig - instr.Period = 1000000 + instr.Period = 100000000 // instr.PreciseIP = 2 cacheMissFile, err := os.Create("cacheMiss_profile") @@ -213,7 +207,7 @@ func run() error { defer cacheRefFile.Close() var cacheRef pprof.PMUEventConfig - cacheRef.Period = 1000000 + cacheRef.Period = 10000 // cacheRef.PreciseIP = 2 From 39f49cefc47dc98c01153bb89b3e60df47b70c64 Mon Sep 17 00:00:00 2001 From: psu-wm Date: Thu, 1 Aug 2019 13:22:05 -0700 Subject: [PATCH 103/126] tests --- test/pmu/test1.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 3391ac80cb..4edb27d22e 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -1,6 +1,6 @@ // run // Example of usage: go run test1.go - +// Flamegraph: go tool pprof -relative_percentages -http=":8081" cycle_profile package main import ( From 37f5a20880804898872da0c12c16e03968838d14 Mon Sep 17 00:00:00 2001 From: Milind Chabbi Date: Thu, 1 Aug 2019 13:29:54 -0700 Subject: [PATCH 104/126] Simplified the logic to check whether PMU is enabled and dropped replicated code --- src/net/http/pprof/pprof.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index 8df11d919a..395604e661 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -178,25 +178,20 @@ func Profile(w http.ResponseWriter, r *http.Request) { isPMUEnabled, err := strconv.ParseBool(r.FormValue("pmu")) - if err != nil { + if (err != nil) || (!isPMUEnabled) { if err = pprof.StartCPUProfile(w); err != nil { serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable CPU profiling: %s", err)) return } - } else if isPMUEnabled { + } else { + // err == nil and isPMUEnabled == true if err = pmuProfile(w, r); err != nil { serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable PMU profiling: %s", err)) return } - } else { - if err = pprof.StartCPUProfile(w); err != nil { - serveError(w, http.StatusInternalServerError, - fmt.Sprintf("Could not enable CPU profiling: %s", err)) - return - } - } + } sleep(w, time.Duration(sec)*time.Second) From 0440673be74c2e3129756b204b07827552e912e4 Mon Sep 17 00:00:00 2001 From: Joshua T Corbin Date: Fri, 2 Aug 2019 08:55:28 -0700 Subject: [PATCH 105/126] Fix Go formatting on all modified files --- src/cmd/go/internal/test/testflag.go | 2 +- src/net/http/pprof/pprof.go | 54 +++++++-------- src/runtime/cpuprof.go | 8 +-- src/runtime/defs_linux_386.go | 28 ++++---- src/runtime/defs_linux_amd64.go | 28 ++++---- src/runtime/defs_linux_arm.go | 96 +++++++++++++-------------- src/runtime/defs_linux_arm64.go | 28 ++++---- src/runtime/defs_linux_mips64x.go | 28 ++++---- src/runtime/defs_linux_mipsx.go | 28 ++++---- src/runtime/defs_linux_ppc64.go | 28 ++++---- src/runtime/defs_linux_ppc64le.go | 28 ++++---- src/runtime/defs_linux_s390x.go | 28 ++++---- src/runtime/defs_perf_linux.go | 18 ++--- src/runtime/defs_pmu.go | 16 ++--- src/runtime/pprof/pprof.go | 43 ++++++------ src/runtime/pprof/proto.go | 20 +++--- src/runtime/proc.go | 8 +-- src/testing/internal/testdeps/deps.go | 52 +++++++-------- src/testing/testing.go | 18 ++--- test/pmu/http/test1.go | 6 +- test/pmu/http/test2.go | 18 ++--- test/pmu/http/test3.go | 14 ++-- test/pmu/http/test4.go | 4 +- test/pmu/leak/test2.go | 2 +- test/pmu/leak/test3.go | 2 +- test/pmu/leak/test5.go | 8 +-- test/pmu/leak/test6.go | 2 +- test/pmu/test1.go | 7 +- test/pmu/test2.go | 12 ++-- test/pmu/test3.go | 3 +- test/pmu/test4.go | 5 +- 31 files changed, 319 insertions(+), 323 deletions(-) diff --git a/src/cmd/go/internal/test/testflag.go b/src/cmd/go/internal/test/testflag.go index 7570235d44..02075026f8 100644 --- a/src/cmd/go/internal/test/testflag.go +++ b/src/cmd/go/internal/test/testflag.go @@ -51,7 +51,7 @@ var testFlagDefn = []*cmdflag.Defn{ {Name: "pmuperiod", PassToTest: true}, {Name: "pmupreciseip", PassToTest: true}, {Name: "pmukernelincl", BoolVar: new(bool), PassToTest: true}, - {Name: "pmuhvincl", BoolVar: new(bool),PassToTest: true}, + {Name: "pmuhvincl", BoolVar: new(bool), PassToTest: true}, {Name: "failfast", BoolVar: new(bool), PassToTest: true}, {Name: "list", PassToTest: true}, {Name: "memprofile", PassToTest: true}, diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go index 395604e661..db2f6fa690 100644 --- a/src/net/http/pprof/pprof.go +++ b/src/net/http/pprof/pprof.go @@ -128,31 +128,31 @@ func pmuProfile(w http.ResponseWriter, r *http.Request) error { } switch eventName := r.FormValue("pmuevent"); eventName { - case "": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) - case "cycles": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) - case "instructions": - return pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) - case "cacheReferences": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) - case "cacheMisses": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) - case "cacheLLReadAccesses": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadAccesses(w, &eventConfig)) - case "cacheLLReadMisses": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadMisses(w, &eventConfig)) - default: - // Is this a raw event? - if strings.HasPrefix(eventName, "r") { - if rawHexEvent, err := strconv.ParseInt(eventName[1:], 16, 64); err == nil { - eventConfig.RawEvent = rawHexEvent - return pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) - } - return fmt.Errorf("Incorrect hex format for raw event") - } else { - return fmt.Errorf("Unknown or not yet implemented event") + case "": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) + case "cycles": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) + case "instructions": + return pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) + case "cacheReferences": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) + case "cacheMisses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) + case "cacheLLReadAccesses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadAccesses(w, &eventConfig)) + case "cacheLLReadMisses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadMisses(w, &eventConfig)) + default: + // Is this a raw event? + if strings.HasPrefix(eventName, "r") { + if rawHexEvent, err := strconv.ParseInt(eventName[1:], 16, 64); err == nil { + eventConfig.RawEvent = rawHexEvent + return pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) } + return fmt.Errorf("Incorrect hex format for raw event") + } else { + return fmt.Errorf("Unknown or not yet implemented event") + } } } @@ -178,20 +178,20 @@ func Profile(w http.ResponseWriter, r *http.Request) { isPMUEnabled, err := strconv.ParseBool(r.FormValue("pmu")) - if (err != nil) || (!isPMUEnabled) { + if (err != nil) || (!isPMUEnabled) { if err = pprof.StartCPUProfile(w); err != nil { serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable CPU profiling: %s", err)) return } } else { - // err == nil and isPMUEnabled == true + // err == nil and isPMUEnabled == true if err = pmuProfile(w, r); err != nil { serveError(w, http.StatusInternalServerError, fmt.Sprintf("Could not enable PMU profiling: %s", err)) return } - } + } sleep(w, time.Duration(sec)*time.Second) diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index affb650189..8b7162356b 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -69,8 +69,8 @@ func SetCPUProfileRate(hz int) { } cpuprof.on = true - // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory - cpuprof.log = newProfBuf(/* header size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) + // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory + cpuprof.log = newProfBuf( /* header size */ 1 /* buffer words */, 1<<17 /* tags */, 1<<14) hdr := [1]uint64{uint64(hz)} cpuprof.log.write(nil, nanotime(), hdr[:], nil) setcpuprofilerate(int32(hz)) @@ -92,8 +92,8 @@ func SetPMUProfile(eventId int, eventAttr *PMUEventAttr) { } pmuprof[eventId].on = true - // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory - pmuprof[eventId].log = newProfBuf(/* header size */ 1, /* buffer words */ 1<<17, /* tags */ 1<<14) + // Enlarging the buffer words and tags reduces the number of samples lost at the cost of larger amounts of memory + pmuprof[eventId].log = newProfBuf( /* header size */ 1 /* buffer words */, 1<<17 /* tags */, 1<<14) hdr := [1]uint64{eventAttr.Period} pmuprof[eventId].log.write(nil, nanotime(), hdr[:], nil) setpmuprofile(int32(eventId), eventAttr) diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index d9f49662e7..e2ec4ab39e 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -210,18 +210,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x2401 - _PERF_EVENT_IOC_ENABLE = 0x2400 - _PERF_EVENT_IOC_ID = 0x80042407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4004240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - _PERF_EVENT_IOC_PERIOD = 0x40082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a - _PERF_EVENT_IOC_REFRESH = 0x2402 - _PERF_EVENT_IOC_RESET = 0x2403 - _PERF_EVENT_IOC_SET_BPF = 0x40042408 - _PERF_EVENT_IOC_SET_FILTER = 0x40042406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80042407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4004240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40042406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) type fpreg struct { @@ -290,9 +290,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint32 + si_addr uint32 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type stackt struct { diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index a64501e9e4..9ee04b7224 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -207,18 +207,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x2401 - _PERF_EVENT_IOC_ENABLE = 0x2400 - _PERF_EVENT_IOC_ID = 0x80082407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - _PERF_EVENT_IOC_PERIOD = 0x40082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - _PERF_EVENT_IOC_REFRESH = 0x2402 - _PERF_EVENT_IOC_RESET = 0x2403 - _PERF_EVENT_IOC_SET_BPF = 0x40042408 - _PERF_EVENT_IOC_SET_FILTER = 0x40082406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) type timespec struct { @@ -253,9 +253,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 + si_addr uint64 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index e82a2a94cb..0529299b96 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -20,40 +20,40 @@ const ( _MADV_HUGEPAGE = 0xe _MADV_NOHUGEPAGE = 0xf - _SA_RESTART = 0x10000000 - _SA_ONSTACK = 0x8000000 - _SA_RESTORER = 0 // unused on ARM - _SA_SIGINFO = 0x4 - _SIGHUP = 0x1 - _SIGINT = 0x2 - _SIGQUIT = 0x3 - _SIGILL = 0x4 - _SIGTRAP = 0x5 - _SIGABRT = 0x6 - _SIGBUS = 0x7 - _SIGFPE = 0x8 - _SIGKILL = 0x9 - _SIGUSR1 = 0xa - _SIGSEGV = 0xb - _SIGUSR2 = 0xc - _SIGPIPE = 0xd - _SIGALRM = 0xe - _SIGSTKFLT = 0x10 - _SIGCHLD = 0x11 - _SIGCONT = 0x12 - _SIGSTOP = 0x13 - _SIGTSTP = 0x14 - _SIGTTIN = 0x15 - _SIGTTOU = 0x16 - _SIGURG = 0x17 - _SIGXCPU = 0x18 - _SIGXFSZ = 0x19 - _SIGVTALRM = 0x1a - _SIGPROF = 0x1b - _SIGWINCH = 0x1c - _SIGIO = 0x1d - _SIGPWR = 0x1e - _SIGSYS = 0x1f + _SA_RESTART = 0x10000000 + _SA_ONSTACK = 0x8000000 + _SA_RESTORER = 0 // unused on ARM + _SA_SIGINFO = 0x4 + _SIGHUP = 0x1 + _SIGINT = 0x2 + _SIGQUIT = 0x3 + _SIGILL = 0x4 + _SIGTRAP = 0x5 + _SIGABRT = 0x6 + _SIGBUS = 0x7 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + _SIGUSR1 = 0xa + _SIGSEGV = 0xb + _SIGUSR2 = 0xc + _SIGPIPE = 0xd + _SIGALRM = 0xe + _SIGSTKFLT = 0x10 + _SIGCHLD = 0x11 + _SIGCONT = 0x12 + _SIGSTOP = 0x13 + _SIGTSTP = 0x14 + _SIGTTIN = 0x15 + _SIGTTOU = 0x16 + _SIGURG = 0x17 + _SIGXCPU = 0x18 + _SIGXFSZ = 0x19 + _SIGVTALRM = 0x1a + _SIGPROF = 0x1b + _SIGWINCH = 0x1c + _SIGIO = 0x1d + _SIGPWR = 0x1e + _SIGSYS = 0x1f _FPE_INTDIV = 0x1 _FPE_INTOVF = 0x2 @@ -203,18 +203,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x2401 - _PERF_EVENT_IOC_ENABLE = 0x2400 - _PERF_EVENT_IOC_ID = 0x80042407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4004240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - _PERF_EVENT_IOC_PERIOD = 0x40082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a - _PERF_EVENT_IOC_REFRESH = 0x2402 - _PERF_EVENT_IOC_RESET = 0x2403 - _PERF_EVENT_IOC_SET_BPF = 0x40042408 - _PERF_EVENT_IOC_SET_FILTER = 0x40042406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80042407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4004240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40042406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) type timespec struct { @@ -286,9 +286,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint32 + si_addr uint32 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type sigactiont struct { diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index d9f6c1d343..fd197db902 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -207,18 +207,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x2401 - _PERF_EVENT_IOC_ENABLE = 0x2400 - _PERF_EVENT_IOC_ID = 0x80082407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - _PERF_EVENT_IOC_PERIOD = 0x40082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - _PERF_EVENT_IOC_REFRESH = 0x2402 - _PERF_EVENT_IOC_RESET = 0x2403 - _PERF_EVENT_IOC_SET_BPF = 0x40042408 - _PERF_EVENT_IOC_SET_FILTER = 0x40082406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) type timespec struct { @@ -253,9 +253,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 + si_addr uint64 // si_fd is the next field. - si_fd int32 + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index a631d7aaca..3456be278f 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -202,18 +202,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x20002401 - _PERF_EVENT_IOC_ENABLE = 0x20002400 - _PERF_EVENT_IOC_ID = 0x40082407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 - _PERF_EVENT_IOC_PERIOD = 0x80082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - _PERF_EVENT_IOC_REFRESH = 0x20002402 - _PERF_EVENT_IOC_RESET = 0x20002403 - _PERF_EVENT_IOC_SET_BPF = 0x80042408 - _PERF_EVENT_IOC_SET_FILTER = 0x80082406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 + _PERF_EVENT_IOC_DISABLE = 0x20002401 + _PERF_EVENT_IOC_ENABLE = 0x20002400 + _PERF_EVENT_IOC_ID = 0x40082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + _PERF_EVENT_IOC_PERIOD = 0x80082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x20002402 + _PERF_EVENT_IOC_RESET = 0x20002403 + _PERF_EVENT_IOC_SET_BPF = 0x80042408 + _PERF_EVENT_IOC_SET_FILTER = 0x80082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 ) //struct Sigset { @@ -256,9 +256,9 @@ type siginfo struct { si_errno int32 __pad0 [1]int32 // below here is a union; si_addr is the only field we use - si_addr uint64 + si_addr uint64 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index 306a2adf0f..e994b6aa5a 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -206,18 +206,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x20002401 - _PERF_EVENT_IOC_ENABLE = 0x20002400 - _PERF_EVENT_IOC_ID = 0x40042407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8004240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 - _PERF_EVENT_IOC_PERIOD = 0x80082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a - _PERF_EVENT_IOC_REFRESH = 0x20002402 - _PERF_EVENT_IOC_RESET = 0x20002403 - _PERF_EVENT_IOC_SET_BPF = 0x80042408 - _PERF_EVENT_IOC_SET_FILTER = 0x80042406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 + _PERF_EVENT_IOC_DISABLE = 0x20002401 + _PERF_EVENT_IOC_ENABLE = 0x20002400 + _PERF_EVENT_IOC_ID = 0x40042407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8004240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + _PERF_EVENT_IOC_PERIOD = 0x80082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + _PERF_EVENT_IOC_REFRESH = 0x20002402 + _PERF_EVENT_IOC_RESET = 0x20002403 + _PERF_EVENT_IOC_SET_BPF = 0x80042408 + _PERF_EVENT_IOC_SET_FILTER = 0x80042406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 ) type timespec struct { @@ -254,9 +254,9 @@ type siginfo struct { si_code int32 si_errno int32 // below here is a union; si_addr is the only field we use - si_addr uint32 + si_addr uint32 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index 620c1b88e7..27c7a97c89 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -202,18 +202,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x2401 - _PERF_EVENT_IOC_ENABLE = 0x2400 - _PERF_EVENT_IOC_ID = 0x80082407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - _PERF_EVENT_IOC_PERIOD = 0x40082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - _PERF_EVENT_IOC_REFRESH = 0x2402 - _PERF_EVENT_IOC_RESET = 0x2403 - _PERF_EVENT_IOC_SET_BPF = 0x40042408 - _PERF_EVENT_IOC_SET_FILTER = 0x40082406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) //struct Sigset { @@ -253,9 +253,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 + si_addr uint64 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index ffaf6e5713..429c0a408e 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -202,18 +202,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x20002401 - _PERF_EVENT_IOC_ENABLE = 0x20002400 - _PERF_EVENT_IOC_ID = 0x40082407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 - _PERF_EVENT_IOC_PERIOD = 0x80082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - _PERF_EVENT_IOC_REFRESH = 0x20002402 - _PERF_EVENT_IOC_RESET = 0x20002403 - _PERF_EVENT_IOC_SET_BPF = 0x80042408 - _PERF_EVENT_IOC_SET_FILTER = 0x80082406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 + _PERF_EVENT_IOC_DISABLE = 0x20002401 + _PERF_EVENT_IOC_ENABLE = 0x20002400 + _PERF_EVENT_IOC_ID = 0x40082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + _PERF_EVENT_IOC_PERIOD = 0x80082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x20002402 + _PERF_EVENT_IOC_RESET = 0x20002403 + _PERF_EVENT_IOC_SET_BPF = 0x80042408 + _PERF_EVENT_IOC_SET_FILTER = 0x80082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 ) //struct Sigset { @@ -253,9 +253,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 + si_addr uint64 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index 025d6dbf4d..783d01eb62 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -203,18 +203,18 @@ const ( _PERF_FLAG_PID_CGROUP = 0x4 _PERF_FLAG_FD_CLOEXEC = 0x8 - _PERF_EVENT_IOC_DISABLE = 0x2401 - _PERF_EVENT_IOC_ENABLE = 0x2400 - _PERF_EVENT_IOC_ID = 0x80082407 - _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b - _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 - _PERF_EVENT_IOC_PERIOD = 0x40082404 - _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a - _PERF_EVENT_IOC_REFRESH = 0x2402 - _PERF_EVENT_IOC_RESET = 0x2403 - _PERF_EVENT_IOC_SET_BPF = 0x40042408 - _PERF_EVENT_IOC_SET_FILTER = 0x40082406 - _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 + _PERF_EVENT_IOC_DISABLE = 0x2401 + _PERF_EVENT_IOC_ENABLE = 0x2400 + _PERF_EVENT_IOC_ID = 0x80082407 + _PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b + _PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409 + _PERF_EVENT_IOC_PERIOD = 0x40082404 + _PERF_EVENT_IOC_QUERY_BPF = 0xc008240a + _PERF_EVENT_IOC_REFRESH = 0x2402 + _PERF_EVENT_IOC_RESET = 0x2403 + _PERF_EVENT_IOC_SET_BPF = 0x40042408 + _PERF_EVENT_IOC_SET_FILTER = 0x40082406 + _PERF_EVENT_IOC_SET_OUTPUT = 0x2405 ) type timespec struct { @@ -249,9 +249,9 @@ type siginfo struct { si_errno int32 si_code int32 // below here is a union; si_addr is the only field we use - si_addr uint64 + si_addr uint64 // si_fd is the field right after the union - si_fd int32 + si_fd int32 } type itimerval struct { diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index adfe8a929e..7aecf70465 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -2,16 +2,16 @@ package runtime // Convert platform-agnostic pmu events to Linux perf events var perfEventOpt = map[int32]struct { - Type uint32 // type of event - Config uint64 // event -} { - GO_COUNT_HW_CPU_CYCLES : {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, - GO_COUNT_HW_INSTRUCTIONS: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, - GO_COUNT_HW_CACHE_REFERENCES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, - GO_COUNT_HW_CACHE_MISSES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, + Type uint32 // type of event + Config uint64 // event +}{ + GO_COUNT_HW_CPU_CYCLES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, + GO_COUNT_HW_INSTRUCTIONS: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, + GO_COUNT_HW_CACHE_REFERENCES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_REFERENCES}, + GO_COUNT_HW_CACHE_MISSES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CACHE_MISSES}, GO_COUNT_HW_CACHE_LL_READ_ACCESSES: {_PERF_TYPE_HW_CACHE, (_PERF_COUNT_HW_CACHE_LL) | (_PERF_COUNT_HW_CACHE_OP_READ << 8) | (_PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16)}, - GO_COUNT_HW_CACHE_LL_READ_MISSES: {_PERF_TYPE_HW_CACHE, (_PERF_COUNT_HW_CACHE_LL) | (_PERF_COUNT_HW_CACHE_OP_READ << 8) | (_PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, - GO_COUNT_HW_RAW: {_PERF_TYPE_RAW, 0 /* will not be used */}, + GO_COUNT_HW_CACHE_LL_READ_MISSES: {_PERF_TYPE_HW_CACHE, (_PERF_COUNT_HW_CACHE_LL) | (_PERF_COUNT_HW_CACHE_OP_READ << 8) | (_PERF_COUNT_HW_CACHE_RESULT_MISS << 16)}, + GO_COUNT_HW_RAW: {_PERF_TYPE_RAW, 0 /* will not be used */}, // TODO: add more perf events } diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 858605f734..3c285117c0 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -3,14 +3,14 @@ package runtime // These Constants are platform agnostic and exposed to pprof. // We use perfEventOpt to map these to the underlying OS and HW. const ( - GO_COUNT_HW_CPU_CYCLES = 0x0 - GO_COUNT_HW_INSTRUCTIONS = 0x1 - GO_COUNT_HW_CACHE_REFERENCES = 0x2 - GO_COUNT_HW_CACHE_MISSES = 0x3 - GO_COUNT_HW_CACHE_LL_READ_ACCESSES = 0x4 - GO_COUNT_HW_CACHE_LL_READ_MISSES = 0x5 - GO_COUNT_HW_RAW = 0x6 - GO_COUNT_PMU_EVENTS_MAX = 0x7 + GO_COUNT_HW_CPU_CYCLES = 0x0 + GO_COUNT_HW_INSTRUCTIONS = 0x1 + GO_COUNT_HW_CACHE_REFERENCES = 0x2 + GO_COUNT_HW_CACHE_MISSES = 0x3 + GO_COUNT_HW_CACHE_LL_READ_ACCESSES = 0x4 + GO_COUNT_HW_CACHE_LL_READ_MISSES = 0x5 + GO_COUNT_HW_RAW = 0x6 + GO_COUNT_PMU_EVENTS_MAX = 0x7 ) type PMUEventAttr struct { diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 6505819e8a..ae35a1eb29 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -79,12 +79,12 @@ import ( "io" "runtime" "sort" + "strconv" "strings" "sync" "text/tabwriter" "time" "unsafe" - "strconv" ) // BUG(rsc): Profiles are only as good as the kernel support used to generate them. @@ -778,7 +778,7 @@ func StartCPUProfile(w io.Writer, profileHz ...int) error { runtime.SetCPUProfileRate(hz) go profileWriter(w) return nil - } +} func StartPMUProfile(opts ...ProfilingOption) error { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { // enabling only on Linux AMD64 @@ -808,7 +808,7 @@ func StartPMUProfile(opts ...ProfilingOption) error { type PMUEventConfig struct { Period int64 - RawEvent int64 + RawEvent int64 PreciseIP int8 IsKernelIncluded bool IsHvIncluded bool @@ -826,16 +826,16 @@ func getPreciseIP(preciseIP int8) uint8 { } func populatePMUProfiler(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { - pmu.eventOn[eventId] = true - eventAttr := runtime.PMUEventAttr { - Period: uint64(eventConfig.Period), - RawEvent: uint64(eventConfig.RawEvent), - PreciseIP: getPreciseIP(eventConfig.PreciseIP), + pmu.eventOn[eventId] = true + eventAttr := runtime.PMUEventAttr{ + Period: uint64(eventConfig.Period), + RawEvent: uint64(eventConfig.RawEvent), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsKernelIncluded: eventConfig.IsKernelIncluded, - IsHvIncluded: eventConfig.IsHvIncluded, + IsHvIncluded: eventConfig.IsHvIncluded, } - runtime.SetPMUProfile(eventId, &eventAttr) - go pmuProfileWriter(w, eventId, eventName) + runtime.SetPMUProfile(eventId, &eventAttr) + go pmuProfileWriter(w, eventId, eventName) } func WithProfilingPMUCycles(w io.Writer, eventConfig *PMUEventConfig) ProfilingOption { @@ -849,7 +849,7 @@ func WithProfilingPMUCycles(w io.Writer, eventConfig *PMUEventConfig) ProfilingO eventConfig.Period = 1000 } - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CPU_CYCLES, /* event name */ "cycles") + populatePMUProfiler(w, eventConfig /* event ID */, runtime.GO_COUNT_HW_CPU_CYCLES /* event name */, "cycles") return nil }) } @@ -865,8 +865,8 @@ func WithProfilingPMUInstructions(w io.Writer, eventConfig *PMUEventConfig) Prof eventConfig.Period = 1000 } - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_INSTRUCTIONS, /* event name */ "instructions") - return nil + populatePMUProfiler(w, eventConfig /* event ID */, runtime.GO_COUNT_HW_INSTRUCTIONS /* event name */, "instructions") + return nil }) } @@ -878,7 +878,7 @@ func WithProfilingPMUCacheReferences(w io.Writer, eventConfig *PMUEventConfig) P // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_REFERENCES, /* event name */ "cache references") + populatePMUProfiler(w, eventConfig /* event ID */, runtime.GO_COUNT_HW_CACHE_REFERENCES /* event name */, "cache references") return nil }) } @@ -891,7 +891,7 @@ func WithProfilingPMUCacheMisses(w io.Writer, eventConfig *PMUEventConfig) Profi // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_MISSES, /* event name */ "cache misses") + populatePMUProfiler(w, eventConfig /* event ID */, runtime.GO_COUNT_HW_CACHE_MISSES /* event name */, "cache misses") return nil }) } @@ -904,7 +904,7 @@ func WithProfilingPMUCacheLLReadAccesses(w io.Writer, eventConfig *PMUEventConfi // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_LL_READ_ACCESSES, /* event name */ "last-level cache read accesses") + populatePMUProfiler(w, eventConfig /* event ID */, runtime.GO_COUNT_HW_CACHE_LL_READ_ACCESSES /* event name */, "last-level cache read accesses") return nil }) } @@ -917,7 +917,7 @@ func WithProfilingPMUCacheLLReadMisses(w io.Writer, eventConfig *PMUEventConfig) // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_CACHE_LL_READ_MISSES, /* event name */ "last-level cache read misses") + populatePMUProfiler(w, eventConfig /* event ID */, runtime.GO_COUNT_HW_CACHE_LL_READ_MISSES /* event name */, "last-level cache read misses") return nil }) } @@ -930,16 +930,15 @@ func WithProfilingPMURaw(w io.Writer, eventConfig *PMUEventConfig) ProfilingOpti // TODO: create a table of standard clamp values // TODO: clamp period to something reasonable - if eventConfig.RawEvent < 0 { + if eventConfig.RawEvent < 0 { return fmt.Errorf("RawEvent should be >= 0") } - populatePMUProfiler(w, eventConfig, /* event ID */ runtime.GO_COUNT_HW_RAW, /* event name */ "r" + strconv.FormatInt(eventConfig.RawEvent, 16)) + populatePMUProfiler(w, eventConfig /* event ID */, runtime.GO_COUNT_HW_RAW /* event name */, "r"+strconv.FormatInt(eventConfig.RawEvent, 16)) return nil }) } - type ProfilingOption interface { apply() error } @@ -991,7 +990,7 @@ func pmuProfileWriter(w io.Writer, eventId int, eventName string) { } } if err != nil { - panic("runtime/pprof: converting profile: " + err.Error()) + panic("runtime/pprof: converting profile: " + err.Error()) } b.pmuBuild(eventName) pmu.wg.Done() diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go index 61e87d2846..29b4c2ebe6 100644 --- a/src/runtime/pprof/proto.go +++ b/src/runtime/pprof/proto.go @@ -37,14 +37,14 @@ type profileBuilder struct { m profMap // encoding state - w io.Writer - zw *gzip.Writer - pb protobuf - strings []string - stringMap map[string]int - locs map[uintptr]int - funcs map[string]int // Package path-qualified function name to Function.ID - mem []memMap + w io.Writer + zw *gzip.Writer + pb protobuf + strings []string + stringMap map[string]int + locs map[uintptr]int + funcs map[string]int // Package path-qualified function name to Function.ID + mem []memMap } type memMap struct { @@ -376,7 +376,7 @@ func (b *profileBuilder) addCPUData(data []uint64, tags []unsafe.Pointer) error data = data[3:] } - return b.addData(data, tags) + return b.addData(data, tags) } func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error { @@ -393,7 +393,7 @@ func (b *profileBuilder) addPMUData(data []uint64, tags []unsafe.Pointer) error data = data[3:] } - return b.addData(data, tags) + return b.addData(data, tags) } func (b *profileBuilder) profileBuild() { diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 5f0c2e6793..50d081c85f 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3815,7 +3815,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { getg().m.mallocing-- } -var lostPMUAtomic64Count[GO_COUNT_PMU_EVENTS_MAX] uint64 +var lostPMUAtomic64Count [GO_COUNT_PMU_EVENTS_MAX]uint64 // Called if we receive a SIGPROF signal and PMU is enabled. // Called by the signal handler, may run during STW. @@ -3974,9 +3974,9 @@ func setcpuprofilerate(hz int32) { } func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { - // setProcessPMUProfilerFptr and setProcessPMUProfilerFptr are write once variables. + // setProcessPMUProfilerFptr and setProcessPMUProfilerFptr are write once variables. // Hence, there cannot be any race from checking non-nil to invoking them. - if setProcessPMUProfilerFptr == nil || setThreadPMUProfilerFptr == nil { + if setProcessPMUProfilerFptr == nil || setThreadPMUProfilerFptr == nil { return } @@ -4008,7 +4008,7 @@ func setpmuprofile(eventId int32, eventAttr *PMUEventAttr) { } _g_.m.locks-- - } +} // init initializes pp, which may be a freshly allocated p or a // previously destroyed p, and transitions it to status _Pgcstop. diff --git a/src/testing/internal/testdeps/deps.go b/src/testing/internal/testdeps/deps.go index a379244b1e..546a92fef1 100644 --- a/src/testing/internal/testdeps/deps.go +++ b/src/testing/internal/testdeps/deps.go @@ -49,36 +49,36 @@ func (TestDeps) StopCPUProfile() { } func (TestDeps) StartPMUProfile(w io.Writer, event string, period int64, preciseIP int8, isKernelIncluded bool, isHvIncluded bool) error { - eventConfig := pprof.PMUEventConfig { - Period: period, - PreciseIP: preciseIP, + eventConfig := pprof.PMUEventConfig{ + Period: period, + PreciseIP: preciseIP, IsKernelIncluded: isKernelIncluded, - IsHvIncluded: isHvIncluded, + IsHvIncluded: isHvIncluded, } switch event { - case "cycles": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) - case "instructions": - return pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) - case "cacheReferences": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) - case "cacheMisses": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) - case "cacheLLReadAccesses": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadAccesses(w, &eventConfig)) - case "cacheLLReadMisses": - return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadMisses(w, &eventConfig)) - default: - // Is this a raw event? - if strings.HasPrefix(event, "r") { - if rawHexEvent, err := strconv.ParseInt(event[1:], 16, 64); err == nil { - eventConfig.RawEvent = rawHexEvent - return pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) - } - return fmt.Errorf("Incorrect hex format for raw event") - } else { - return fmt.Errorf("Unknown or not yet implemented event") + case "cycles": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(w, &eventConfig)) + case "instructions": + return pprof.StartPMUProfile(pprof.WithProfilingPMUInstructions(w, &eventConfig)) + case "cacheReferences": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheReferences(w, &eventConfig)) + case "cacheMisses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheMisses(w, &eventConfig)) + case "cacheLLReadAccesses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadAccesses(w, &eventConfig)) + case "cacheLLReadMisses": + return pprof.StartPMUProfile(pprof.WithProfilingPMUCacheLLReadMisses(w, &eventConfig)) + default: + // Is this a raw event? + if strings.HasPrefix(event, "r") { + if rawHexEvent, err := strconv.ParseInt(event[1:], 16, 64); err == nil { + eventConfig.RawEvent = rawHexEvent + return pprof.StartPMUProfile(pprof.WithProfilingPMURaw(w, &eventConfig)) } + return fmt.Errorf("Incorrect hex format for raw event") + } else { + return fmt.Errorf("Unknown or not yet implemented event") + } } } diff --git a/src/testing/testing.go b/src/testing/testing.go index 3a778c3b7a..a5e38fd7a6 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -317,12 +317,12 @@ var ( memProfile *string memProfileRate *int cpuProfile *string - pmuProfile *string - pmuEvent *string + pmuProfile *string + pmuEvent *string pmuPeriod *int64 pmuPreciseIP *int pmuKernelIncluded *bool - pmuHvIncluded *bool + pmuHvIncluded *bool blockProfile *string blockProfileRate *int mutexProfile *string @@ -1038,10 +1038,12 @@ var errMain = errors.New("testing: unexpected use of func Main") type matchStringOnly func(pat, str string) (bool, error) -func (f matchStringOnly) MatchString(pat, str string) (bool, error) { return f(pat, str) } -func (f matchStringOnly) StartCPUProfile(w io.Writer) error { return errMain } -func (f matchStringOnly) StopCPUProfile() {} -func (f matchStringOnly) StartPMUProfile(w io.Writer, event string, period int64, preciseIP int8, isKernelIncluded bool, isHvIncluded bool) error { return errMain } +func (f matchStringOnly) MatchString(pat, str string) (bool, error) { return f(pat, str) } +func (f matchStringOnly) StartCPUProfile(w io.Writer) error { return errMain } +func (f matchStringOnly) StopCPUProfile() {} +func (f matchStringOnly) StartPMUProfile(w io.Writer, event string, period int64, preciseIP int8, isKernelIncluded bool, isHvIncluded bool) error { + return errMain +} func (f matchStringOnly) StopPMUProfile() {} func (f matchStringOnly) WriteProfileTo(string, io.Writer, int) error { return errMain } func (f matchStringOnly) ImportPath() string { return "" } @@ -1333,7 +1335,7 @@ func (m *M) writeProfiles() { } if *pmuProfile != "" { m.deps.StopPMUProfile() // flushes profile to disk - } + } if *traceFile != "" { trace.Stop() // flushes trace to disk } diff --git a/test/pmu/http/test1.go b/test/pmu/http/test1.go index cbdec6303b..7edf4d1641 100644 --- a/test/pmu/http/test1.go +++ b/test/pmu/http/test1.go @@ -1,5 +1,5 @@ // run -// Example of usage: +// Example of usage: // 1. go run test1.go // 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=cycles\&pmuperiod=10000000 @@ -8,16 +8,16 @@ package main import ( "fmt" "log" - _"time" "net/http" _ "net/http/pprof" + _ "time" ) var sum int func main() { go func() { - log.Println(http.ListenAndServe("localhost:6060", nil)) + log.Println(http.ListenAndServe("localhost:6060", nil)) }() // time.Sleep(2 * time.Second) for i := 0; i <= 10000000000; i++ { diff --git a/test/pmu/http/test2.go b/test/pmu/http/test2.go index 4b96c4e381..ce0b62cd38 100644 --- a/test/pmu/http/test2.go +++ b/test/pmu/http/test2.go @@ -1,5 +1,5 @@ // run -// Example of usage: +// Example of usage: // 1. go run test2.go // 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=instructions\&pmuperiod=10000000 @@ -8,9 +8,9 @@ package main import ( "fmt" "log" - "sync" "net/http" _ "net/http/pprof" + "sync" ) var wg sync.WaitGroup @@ -19,14 +19,14 @@ var sum int func f(i int) { defer wg.Done() - var local int + var local int for j := i; j < 100000000; j++ { - local -= j / 2 - local *= j - mux.Lock() - sum += local - mux.Unlock() - } + local -= j / 2 + local *= j + mux.Lock() + sum += local + mux.Unlock() + } } func run() error { diff --git a/test/pmu/http/test3.go b/test/pmu/http/test3.go index eb1a04dbf8..65e37bc07e 100644 --- a/test/pmu/http/test3.go +++ b/test/pmu/http/test3.go @@ -1,5 +1,5 @@ // run -// Example of usage: +// Example of usage: // 1. go run test3.go // 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=cacheMisses\&pmuperiod=10000000 @@ -8,10 +8,10 @@ package main import ( "fmt" "log" - "sync" - "time" "net/http" _ "net/http/pprof" + "sync" + "time" ) var wg sync.WaitGroup @@ -21,10 +21,10 @@ var sum int func f(i int) { defer wg.Done() for j := i; j < 100000000; j++ { - sum -= j / 2 - sum *= j - time.Sleep(time.Microsecond) - } + sum -= j / 2 + sum *= j + time.Sleep(time.Microsecond) + } } func run() error { diff --git a/test/pmu/http/test4.go b/test/pmu/http/test4.go index 07225076e8..dd4c4950c3 100644 --- a/test/pmu/http/test4.go +++ b/test/pmu/http/test4.go @@ -1,5 +1,5 @@ // run -// Example of Usage: +// Example of Usage: // 1. go run test4.go // 2. go tool pprof http://localhost:6060/debug/pprof/profile?seconds=6\&pmu=true\&pmuevent=r53010e\&pmuperiod=1000000 @@ -16,7 +16,7 @@ var sum int func main() { go func() { - log.Println(http.ListenAndServe("localhost:6060", nil)) + log.Println(http.ListenAndServe("localhost:6060", nil)) }() for i := 0; i <= 10000000000; i++ { sum += i diff --git a/test/pmu/leak/test2.go b/test/pmu/leak/test2.go index 44f2d77875..a5dbf84e83 100644 --- a/test/pmu/leak/test2.go +++ b/test/pmu/leak/test2.go @@ -19,7 +19,7 @@ func run() error { } var cycle pprof.PMUEventConfig - cycle.Period = 100000 + cycle.Period = 100000 cycle.IsKernelIncluded = false cycle.IsHvIncluded = false diff --git a/test/pmu/leak/test3.go b/test/pmu/leak/test3.go index 89b4bd3477..bea689905f 100644 --- a/test/pmu/leak/test3.go +++ b/test/pmu/leak/test3.go @@ -33,7 +33,7 @@ func run() error { } var cycle pprof.PMUEventConfig - cycle.Period = 100000 + cycle.Period = 100000 cycle.IsKernelIncluded = false cycle.IsHvIncluded = false diff --git a/test/pmu/leak/test5.go b/test/pmu/leak/test5.go index 7ef22515d7..5fb8a323d7 100644 --- a/test/pmu/leak/test5.go +++ b/test/pmu/leak/test5.go @@ -4,10 +4,10 @@ package main import ( "fmt" - "os" "log" - "sync" + "os" "runtime/pprof" + "sync" ) var wg sync.WaitGroup @@ -54,8 +54,8 @@ func main() { cacheMiss.Period = 1 if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle), pprof.WithProfilingPMUInstructions(instrFile, &instr), pprof.WithProfilingPMUCacheReferences(cacheRefFile, &cacheRef), pprof.WithProfilingPMUCacheMisses(cacheMissFile, &cacheMiss)); err != nil { - log.Fatal(err) - } + log.Fatal(err) + } for i := 0; i < 1000; i++ { go run() diff --git a/test/pmu/leak/test6.go b/test/pmu/leak/test6.go index 0bd4c341f6..cd15c08e49 100644 --- a/test/pmu/leak/test6.go +++ b/test/pmu/leak/test6.go @@ -5,8 +5,8 @@ package main import ( "fmt" "os" - "time" "runtime/pprof" + "time" ) var sum int diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 4edb27d22e..59654d6497 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -1,14 +1,14 @@ // run // Example of usage: go run test1.go -// Flamegraph: go tool pprof -relative_percentages -http=":8081" cycle_profile +// Flamegraph: go tool pprof -relative_percentages -http=":8081" cycle_profile package main import ( "fmt" "log" "os" - "sync" "runtime/pprof" + "sync" ) var wg sync.WaitGroup @@ -153,7 +153,6 @@ func f10() { fmt.Println(sum) } - func run() error { cycleFile, err := os.Create("cycle_profile") if err != nil { @@ -162,7 +161,7 @@ func run() error { defer cycleFile.Close() var cycle pprof.PMUEventConfig - cycle.Period = 10000000 + cycle.Period = 10000000 cycle.IsKernelIncluded = false cycle.IsHvIncluded = false diff --git a/test/pmu/test2.go b/test/pmu/test2.go index bc9ffb6f22..ee7b281bde 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -7,9 +7,9 @@ import ( "fmt" "log" "os" - "sync" - _"time" "runtime/pprof" + "sync" + _ "time" ) var wg sync.WaitGroup @@ -176,7 +176,7 @@ func run() error { defer cycleFile.Close() var cycle pprof.PMUEventConfig - cycle.Period = 100000000 + cycle.Period = 100000000 // cycle.PreciseIP = 2 instrFile, err := os.Create("instr_profile") @@ -186,7 +186,7 @@ func run() error { defer instrFile.Close() var instr pprof.PMUEventConfig - instr.Period = 100000000 + instr.Period = 100000000 // instr.PreciseIP = 2 cacheMissFile, err := os.Create("cacheMiss_profile") @@ -199,7 +199,6 @@ func run() error { cacheMiss.Period = 10 // cacheMiss.PreciseIP = 2 - cacheRefFile, err := os.Create("cacheRef_profile") if err != nil { return err @@ -210,10 +209,9 @@ func run() error { cacheRef.Period = 10000 // cacheRef.PreciseIP = 2 - if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle), pprof.WithProfilingPMUInstructions(instrFile, &instr), pprof.WithProfilingPMUCacheReferences(cacheRefFile, &cacheRef), pprof.WithProfilingPMUCacheMisses(cacheMissFile, &cacheMiss)); err != nil { return err - } + } defer pprof.StopPMUProfile() diff --git a/test/pmu/test3.go b/test/pmu/test3.go index 44c4754a26..2558eb05bc 100644 --- a/test/pmu/test3.go +++ b/test/pmu/test3.go @@ -7,8 +7,8 @@ import ( "fmt" "log" "os" - "sync" "runtime/pprof" + "sync" ) var wg sync.WaitGroup @@ -165,7 +165,6 @@ func run() error { } defer pprof.StopCPUProfile() - wg.Add(10) defer wg.Wait() diff --git a/test/pmu/test4.go b/test/pmu/test4.go index cc55510389..ce9f0b80ee 100644 --- a/test/pmu/test4.go +++ b/test/pmu/test4.go @@ -7,8 +7,8 @@ import ( "fmt" "log" "os" - "sync" "runtime/pprof" + "sync" ) var wg sync.WaitGroup @@ -153,7 +153,6 @@ func f10() { fmt.Println(sum) } - func run() error { rawFile, err := os.Create("raw_profile") if err != nil { @@ -163,7 +162,7 @@ func run() error { var raw pprof.PMUEventConfig raw.RawEvent = /* UOPS_ISSUED */ 0x53010e - raw.Period = 1000000 + raw.Period = 1000000 raw.IsKernelIncluded = false raw.IsHvIncluded = false From 428f949466555761b3bfc025deee96a6ddccc99e Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Sun, 22 Sep 2019 19:12:26 -0400 Subject: [PATCH 106/126] Enable PEBS --- src/runtime/defs_linux_amd64.go | 8 +- src/runtime/defs_perf_linux.go | 79 +++++++++--- src/runtime/defs_pmu.go | 17 ++- src/runtime/os_linux.go | 98 +++++++++++---- src/runtime/perf_linux.go | 216 ++++++++++++++++++++++++++++++++ src/runtime/pprof/pprof.go | 37 ++++-- src/runtime/proc.go | 2 +- src/runtime/runtime2.go | 1 + 8 files changed, 394 insertions(+), 64 deletions(-) create mode 100644 src/runtime/perf_linux.go diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 9ee04b7224..87b3711f05 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -13,9 +13,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x20 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index 7aecf70465..f1c207c774 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -2,8 +2,9 @@ package runtime // Convert platform-agnostic pmu events to Linux perf events var perfEventOpt = map[int32]struct { + // The lower-case type is reserved for Go Type uint32 // type of event - Config uint64 // event + config uint64 // event }{ GO_COUNT_HW_CPU_CYCLES: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_CPU_CYCLES}, GO_COUNT_HW_INSTRUCTIONS: {_PERF_TYPE_HARDWARE, _PERF_COUNT_HW_INSTRUCTIONS}, @@ -16,23 +17,65 @@ var perfEventOpt = map[int32]struct { } type perfEventAttr struct { + // The lower-case type is reserved for Go Type uint32 - Size uint32 - Config uint64 - Sample uint64 - Sample_type uint64 - Read_format uint64 - Bits uint64 - Wakeup uint32 - Bp_type uint32 - Ext1 uint64 - Ext2 uint64 - Branch_sample_type uint64 - Sample_regs_user uint64 - Sample_stack_user uint32 - Clockid int32 - Sample_regs_intr uint64 - Aux_watermark uint32 - Sample_max_stack uint16 + size uint32 + config uint64 + sample uint64 + sample_type uint64 + read_format uint64 + bits uint64 + wakeup uint32 + bp_type uint32 + ext1 uint64 + ext2 uint64 + branch_sample_type uint64 + sample_regs_user uint64 + sample_stack_user uint32 + clockid int32 + sample_regs_intr uint64 + aux_watermark uint32 + sample_max_stack uint16 _ uint16 } + +type perfEventMmapPage struct { + version uint32 + compat_version uint32 + lock uint32 + index uint32 + offset int64 + time_enabled uint64 + Time_running uint64 + capabilities uint64 + pmc_width uint16 + time_shift uint16 + time_mult uint32 + time_offset uint64 + time_zero uint64 + size uint32 + _ [948]uint8 + data_head uint64 + data_tail uint64 + data_offset uint64 + data_size uint64 + aux_head uint64 + aux_tail uint64 + aux_offset uint64 + aux_size uint64 +} + +type perfEventHeader struct { + // The lower-case type is reserved for Go + Type uint32 + misc uint16 + size uint16 +} + +type perfSampleData struct { + ip uint64 // if _PERF_SAMPLE_IP + addr uint64 // if _PERF_SAMPLE_ADDR + pid uint32 // if _PERF_SAMPLE_TID + tid uint32 // if _PERF_SAMPLE_TID + // TODO: More fields can be added if needed +} diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 3c285117c0..38d663337e 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -14,9 +14,16 @@ const ( ) type PMUEventAttr struct { - Period uint64 - RawEvent uint64 - PreciseIP uint8 - IsKernelIncluded bool - IsHvIncluded bool + Period uint64 + RawEvent uint64 + PreciseIP uint8 + IsSampleIPIncluded bool + IsSampleAddrIncluded bool + IsSampleCallchainIncluded bool + IsSampleThreadIDIncluded bool + IsKernelIncluded bool + IsHvIncluded bool + IsIdleIncluded bool + IsCallchainKernelIncluded bool + IsCallchainUserIncluded bool } diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index e6d997d98b..fcab4db43e 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -480,8 +480,6 @@ func setProcessPMUProfiler(eventAttr *PMUEventAttr) { } } -//go:noescape -func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int) (r int32, r2, err int) func fcntl(fd int32, cmd, arg int) (r, err int) //go:noescape func fcntl2(fd int32, cmd int, arg *fOwnerEx) (r, err int) @@ -492,40 +490,44 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { if eventAttr == nil { if _g_.m.eventAttrs[eventId] != nil { closefd(_g_.m.eventFds[eventId]) + _g_.m.eventAttrs[eventId] = nil + } + if _g_.m.eventMmapBufs[eventId] != nil { + perfUnsetMmap(_g_.m.eventMmapBufs[eventId]) + _g_.m.eventMmapBufs[eventId] = nil } } else { if _g_.m.eventAttrs[eventId] != nil { closefd(_g_.m.eventFds[eventId]) + _g_.m.eventAttrs[eventId] = nil + } + if _g_.m.eventMmapBufs[eventId] != nil { + perfUnsetMmap(_g_.m.eventMmapBufs[eventId]) + _g_.m.eventMmapBufs[eventId] = nil } var perfAttr perfEventAttr - perfAttr.Size = uint32(unsafe.Sizeof(perfAttr)) - perfAttr.Type = perfEventOpt[eventId].Type - if eventId == GO_COUNT_HW_RAW { - perfAttr.Config = eventAttr.RawEvent - } else { - perfAttr.Config = perfEventOpt[eventId].Config - } - perfAttr.Sample = eventAttr.Period - perfAttr.Bits = uint64(eventAttr.PreciseIP) << 15 // precise ip - if !eventAttr.IsKernelIncluded { // don't count kernel - perfAttr.Bits += 0b100000 - } - if !eventAttr.IsHvIncluded { // don't count hypervisor - perfAttr.Bits += 0b1000000 - } + perfAttrInit(eventId, eventAttr, &perfAttr) fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) if err != 0 { println("Linux perf event open failed") return } - _g_.m.eventFds[eventId] = fd + + // create mmap buffer for this file + perfMmap := perfSetMmap(fd) + if perfMmap == nil { + println("Fail to set perf mmap") + closefd(fd) + return + } flag, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) _, err = fcntl(fd, /* F_SETFL */ 0x4, flag | /* O_ASYNC */ 0x2000) if err != 0 { println("Failed to set notification for the PMU event") + perfUnsetMmap(perfMmap) closefd(fd) return } @@ -533,6 +535,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _, err = fcntl(fd, /* F_SETSIG */ 0xa, _SIGPROF) if err != 0 { println("Failed to set signal for the PMU event") + perfUnsetMmap(perfMmap) closefd(fd) return } @@ -541,19 +544,39 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _, err = fcntl2(fd, /* F_SETOWN_EX */ 0xf, &fOwnEx) if err != 0 { println("Failed to set the owner of the perf event file") + perfUnsetMmap(perfMmap) + closefd(fd) + return + } + + _g_.m.eventAttrs[eventId] = eventAttr + _g_.m.eventMmapBufs[eventId] = perfMmap + _g_.m.eventFds[eventId] = fd + + if !perfResetCounter(fd) { + _g_.m.eventAttrs[eventId] = nil + perfUnsetMmap(perfMmap) + _g_.m.eventMmapBufs[eventId] = nil + closefd(fd) + return + } + if !perfStartCounter(fd) { + _g_.m.eventAttrs[eventId] = nil + perfUnsetMmap(perfMmap) + _g_.m.eventMmapBufs[eventId] = nil closefd(fd) return } } - _g_.m.eventAttrs[eventId] = eventAttr } -func ioctl(fd int32, req, arg int) (r, err int) - //go:nowritebarrierrec func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { fd := info.si_fd - ioctl(fd, _PERF_EVENT_IOC_DISABLE, 0) // we don't care about failing ioctl + + if !perfStopCounter(fd) { + return + } var eventId int = -1 for i := 0; i < GO_COUNT_PMU_EVENTS_MAX; i++ { @@ -563,11 +586,36 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { } } if eventId != -1 { - sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId) + mmapBuf := _g_.m.eventMmapBufs[eventId] + remains := mmapBuf.data_head - mmapBuf.data_tail + for remains > 0 { + var hdr perfEventHeader + if remains < uint64(unsafe.Sizeof(hdr)) { + perfSkipAll(mmapBuf) + break + } + if !perfReadHeader(mmapBuf, &hdr) { + println("Failed to read the mmap header") + break + } + if hdr.Type == _PERF_RECORD_SAMPLE { + var sampleData perfSampleData + // sampleData.isPrecise = (hdr.misc & _PERF_RECORD_MISC_EXACT_IP) ? true : false + perfRecordSample(mmapBuf, _g_.m.eventAttrs[eventId], &sampleData) + sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId, &sampleData) + } else if hdr.size == 0 { + perfSkipAll(mmapBuf) + } else { + perfSkipRecord(mmapBuf, &hdr) + } + remains = mmapBuf.data_head - mmapBuf.data_tail + } + } else { // should never be taken println("File descriptor ", fd, " not found in _g_.m.eventFds") } - ioctl(fd, _PERF_EVENT_IOC_ENABLE, 0) // we don't care about failing ioctl - return + if !perfStartCounter(fd) { + return + } } diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go new file mode 100644 index 0000000000..6e7db7c9fb --- /dev/null +++ b/src/runtime/perf_linux.go @@ -0,0 +1,216 @@ +package runtime + +import ( + "unsafe" +) + +func ioctl(fd int32, req, arg int) (r, err int) +//go:noescape +func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int) (r int32, r2, err int) + +const perfDataPages = 2 +var perfPageSize uint64 +var perfPageMask uint64 + +func perfAttrInit(eventId int32, eventAttr *PMUEventAttr, perfAttr *perfEventAttr) { + perfAttr.Type = perfEventOpt[eventId].Type + perfAttr.size = uint32(unsafe.Sizeof(*perfAttr)) + + if eventId == GO_COUNT_HW_RAW { + perfAttr.config = eventAttr.RawEvent + } else { + perfAttr.config = perfEventOpt[eventId].config + } + + perfAttr.sample = eventAttr.Period + if perfAttr.sample == 0 { + perfAttr.read_format = _PERF_FORMAT_TOTAL_TIME_ENABLED | _PERF_FORMAT_TOTAL_TIME_RUNNING + } + + if eventAttr.IsSampleIPIncluded { + perfAttr.sample_type = _PERF_SAMPLE_IP + } + if eventAttr.IsSampleAddrIncluded { + perfAttr.sample_type |= _PERF_SAMPLE_ADDR + } + if eventAttr.IsSampleCallchainIncluded { + perfAttr.sample_type |= _PERF_SAMPLE_CALLCHAIN + } + if eventAttr.IsSampleThreadIDIncluded { + perfAttr.sample_type |= _PERF_SAMPLE_TID + } + + perfAttr.bits = 1 // the counter is disabled and will be enabled later + perfAttr.bits |= uint64(eventAttr.PreciseIP) << 15 // precise ip + if !eventAttr.IsKernelIncluded { // don't count kernel + perfAttr.bits |= 1 << 5 + } + if !eventAttr.IsHvIncluded { // don't count hypervisor + perfAttr.bits |= 1 << 6 + } + if !eventAttr.IsIdleIncluded { // don't count when idle + perfAttr.bits |= 1 << 7 + } + if !eventAttr.IsCallchainKernelIncluded { + perfAttr.bits |= 1 << 21 + } + if !eventAttr.IsCallchainUserIncluded { + perfAttr.bits |= 1 << 22 + } + +} + +func perfMmapInit() { + perfPageSize = uint64(physPageSize) + perfPageMask = perfPageSize * perfDataPages - 1 +} + +func perfMmapSize() uintptr { + if perfPageSize == 0 { + println("The perf page size has been unknown!") + } + return uintptr(perfPageSize * (perfDataPages + /* metadata page */ 1)) +} + +func perfSetMmap(fd int32) *perfEventMmapPage { + if perfPageSize == 0 { + perfMmapInit() + } + + size := perfMmapSize() + r, err := mmap(nil, size, _PROT_WRITE | _PROT_READ, _MAP_SHARED, fd, /* page offset */ 0) + if err != 0 { + return nil + } + + perfMmap := (*perfEventMmapPage)(r) + // There is no memset available in Go runime + // We instead employ the following approach to initialize all bytes in perfMmap to zeros + var temp perfEventMmapPage + memmove(unsafe.Pointer(perfMmap), unsafe.Pointer(&temp), unsafe.Sizeof(temp)) + + return perfMmap +} + +func perfUnsetMmap(mmapBuf *perfEventMmapPage) { + size := perfMmapSize() + munmap(unsafe.Pointer(mmapBuf), size) +} + +func perfSkipNBytes(mmapBuf *perfEventMmapPage, n uint64 ) { + head := mmapBuf.data_head + tail := mmapBuf.data_tail + if tail + n > head { + n = head - tail + } + mmapBuf.data_tail += n +} + +func perfSkipRecord(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) { + if mmapBuf == nil { + return + } + remains := uint64(hdr.size) - uint64(unsafe.Sizeof(hdr)) + if remains > 0 { + perfSkipNBytes(mmapBuf, remains) + } +} + +func perfSkipAll(mmapBuf *perfEventMmapPage) { + if mmapBuf == nil { + return + } + remains := mmapBuf.data_head - mmapBuf.data_tail + if remains > 0 { + perfSkipNBytes(mmapBuf, remains) + } +} + +func perfReadNbytes(mmapBuf *perfEventMmapPage, buf unsafe.Pointer, n uint64) bool { + if mmapBuf == nil { + return false + } + + // front of the circular data buffer + data := unsafe.Pointer(uintptr(unsafe.Pointer(mmapBuf)) + uintptr(perfPageSize)) + + tail := mmapBuf.data_tail + head := mmapBuf.data_head + + // compute bytes available in the circular buffer + byteAvailable := head - tail + if n > byteAvailable { + return false + } + + // compute offset of tail in the circular buffer + tail &= perfPageMask + + bytesAtRight := (perfPageMask + 1) - tail + + // bytes to copy to the right of tail + var right uint64 + if bytesAtRight < n { + right = bytesAtRight + } else { + right = n + } + + // copy bytes from tail position + memmove(buf, unsafe.Pointer(uintptr(data) + uintptr(tail)), uintptr(right)) + + // if necessary, wrap and continue copy from left edge of buf + if n > right { + left := n - right + memmove(unsafe.Pointer(uintptr(buf) + uintptr(right)) , data, uintptr(left)) + } + + // update tail after consuming n bytes + mmapBuf.data_tail += n + + return true +} + +func perfReadHeader(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) bool { + return perfReadNbytes(mmapBuf, unsafe.Pointer(hdr), uint64(unsafe.Sizeof(hdr))) +} + +func perfRecordSample(mmapBuf *perfEventMmapPage, eventAttr *PMUEventAttr, sampleData *perfSampleData) { + if eventAttr.IsSampleIPIncluded { + perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.ip)), uint64(unsafe.Sizeof(sampleData.ip))) + } + if eventAttr.IsSampleAddrIncluded { + perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.addr)), uint64(unsafe.Sizeof(sampleData.addr))) + } + if eventAttr.IsSampleThreadIDIncluded { + perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.pid)), uint64(unsafe.Sizeof(sampleData.pid))) + perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.tid)), uint64(unsafe.Sizeof(sampleData.tid))) + } +} + +func perfStartCounter(fd int32) bool { + _, err := ioctl(fd, _PERF_EVENT_IOC_ENABLE, 0) + if err != 0 { + println("Failed to enable the event count") + return false + } + return true +} + +func perfStopCounter(fd int32) bool { + _, err := ioctl(fd, _PERF_EVENT_IOC_DISABLE, 0) + if err != 0 { + println("Failed to disable the event count") + return false + } + return true +} + +func perfResetCounter(fd int32) bool { + _, err := ioctl(fd, _PERF_EVENT_IOC_RESET, 0) + if err != 0 { + println("Failed to reset the event count") + return false + } + return true +} diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index ae35a1eb29..2a05a7dfa3 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -807,13 +807,19 @@ func StartPMUProfile(opts ...ProfilingOption) error { } type PMUEventConfig struct { - Period int64 - RawEvent int64 - PreciseIP int8 - IsKernelIncluded bool - IsHvIncluded bool - // TODO: IsMmapEnabled bool - // TODO: IsLBREnabled bool + Period int64 + RawEvent int64 + PreciseIP int8 + IsSampleIPIncluded bool + IsSampleAddrIncluded bool + IsSampleCallchainIncluded bool + IsSampleThreadIDIncluded bool + IsKernelIncluded bool + IsHvIncluded bool + IsIdleIncluded bool + IsCallchainKernelIncluded bool + IsCallchainUserIncluded bool + // TODO: IsLBREnabled bool } func getPreciseIP(preciseIP int8) uint8 { @@ -828,11 +834,18 @@ func getPreciseIP(preciseIP int8) uint8 { func populatePMUProfiler(w io.Writer, eventConfig *PMUEventConfig, eventId int, eventName string) { pmu.eventOn[eventId] = true eventAttr := runtime.PMUEventAttr{ - Period: uint64(eventConfig.Period), - RawEvent: uint64(eventConfig.RawEvent), - PreciseIP: getPreciseIP(eventConfig.PreciseIP), - IsKernelIncluded: eventConfig.IsKernelIncluded, - IsHvIncluded: eventConfig.IsHvIncluded, + Period: uint64(eventConfig.Period), + RawEvent: uint64(eventConfig.RawEvent), + PreciseIP: getPreciseIP(eventConfig.PreciseIP), + IsSampleIPIncluded: eventConfig.IsSampleIPIncluded, + IsSampleAddrIncluded: eventConfig.IsSampleAddrIncluded, + IsSampleCallchainIncluded: eventConfig.IsSampleCallchainIncluded, + IsSampleThreadIDIncluded: eventConfig.IsSampleThreadIDIncluded, + IsKernelIncluded: eventConfig.IsKernelIncluded, + IsHvIncluded: eventConfig.IsHvIncluded, + IsIdleIncluded: eventConfig.IsIdleIncluded, + IsCallchainKernelIncluded: eventConfig.IsCallchainKernelIncluded, + IsCallchainUserIncluded: eventConfig.IsCallchainUserIncluded, } runtime.SetPMUProfile(eventId, &eventAttr) go pmuProfileWriter(w, eventId, eventName) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 50d081c85f..65afb6d5b0 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3820,7 +3820,7 @@ var lostPMUAtomic64Count [GO_COUNT_PMU_EVENTS_MAX]uint64 // Called if we receive a SIGPROF signal and PMU is enabled. // Called by the signal handler, may run during STW. //go:nowritebarrierrec -func sigprofPMU(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { +func sigprofPMU(pc, sp, lr uintptr, gp *g, mp *m, eventId int, sampleData *perfSampleData) { if pmuEvent[eventId].eventAttr == nil { return } diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 7dd61dfd60..e5b5dc4932 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -475,6 +475,7 @@ type m struct { profilehz int32 eventFds [GO_COUNT_PMU_EVENTS_MAX]int32 eventAttrs [GO_COUNT_PMU_EVENTS_MAX]*PMUEventAttr + eventMmapBufs [GO_COUNT_PMU_EVENTS_MAX]*perfEventMmapPage spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack From 61f6d7aa1e02bc8948a0a7c6b6dec92c165f6161 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Sun, 22 Sep 2019 19:43:29 -0400 Subject: [PATCH 107/126] Remove the extra blank line --- src/runtime/perf_linux.go | 1 - 1 file changed, 1 deletion(-) diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index 6e7db7c9fb..d7e3c2f948 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -57,7 +57,6 @@ func perfAttrInit(eventId int32, eventAttr *PMUEventAttr, perfAttr *perfEventAtt if !eventAttr.IsCallchainUserIncluded { perfAttr.bits |= 1 << 22 } - } func perfMmapInit() { From 6950c9d2d2c821aaab9c82adb084da9567a2d437 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Sun, 22 Sep 2019 21:30:38 -0400 Subject: [PATCH 108/126] Read PMU counters --- src/runtime/perf_linux.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index d7e3c2f948..dfe1bcaa56 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -109,7 +109,7 @@ func perfSkipRecord(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) { if mmapBuf == nil { return } - remains := uint64(hdr.size) - uint64(unsafe.Sizeof(hdr)) + remains := uint64(hdr.size) - uint64(unsafe.Sizeof(*hdr)) if remains > 0 { perfSkipNBytes(mmapBuf, remains) } @@ -171,7 +171,7 @@ func perfReadNbytes(mmapBuf *perfEventMmapPage, buf unsafe.Pointer, n uint64) bo } func perfReadHeader(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) bool { - return perfReadNbytes(mmapBuf, unsafe.Pointer(hdr), uint64(unsafe.Sizeof(hdr))) + return perfReadNbytes(mmapBuf, unsafe.Pointer(hdr), uint64(unsafe.Sizeof(*hdr))) } func perfRecordSample(mmapBuf *perfEventMmapPage, eventAttr *PMUEventAttr, sampleData *perfSampleData) { @@ -213,3 +213,7 @@ func perfResetCounter(fd int32) bool { } return true } + +func perfReadCounter(fd int32, val *uint64) bool { + return read(fd, unsafe.Pointer(val), int32(unsafe.Sizeof(*val))) != -1 +} From 9b22f725ae0bca9c4e54841192c6df10c93d6ba3 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Mon, 23 Sep 2019 13:35:57 -0400 Subject: [PATCH 109/126] change the order where values are accessed in the ring buffer --- src/runtime/defs_pmu.go | 2 +- src/runtime/perf_linux.go | 9 +++++---- src/runtime/pprof/pprof.go | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 38d663337e..9fbd12c72e 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -18,9 +18,9 @@ type PMUEventAttr struct { RawEvent uint64 PreciseIP uint8 IsSampleIPIncluded bool + IsSampleThreadIDIncluded bool IsSampleAddrIncluded bool IsSampleCallchainIncluded bool - IsSampleThreadIDIncluded bool IsKernelIncluded bool IsHvIncluded bool IsIdleIncluded bool diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index dfe1bcaa56..04f26613be 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -8,7 +8,7 @@ func ioctl(fd int32, req, arg int) (r, err int) //go:noescape func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int) (r int32, r2, err int) -const perfDataPages = 2 +const perfDataPages = 2 // use 2^n data pages var perfPageSize uint64 var perfPageMask uint64 @@ -174,17 +174,18 @@ func perfReadHeader(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) bool { return perfReadNbytes(mmapBuf, unsafe.Pointer(hdr), uint64(unsafe.Sizeof(*hdr))) } +// The order where values are read has to match the ring-buffer mmap layout func perfRecordSample(mmapBuf *perfEventMmapPage, eventAttr *PMUEventAttr, sampleData *perfSampleData) { if eventAttr.IsSampleIPIncluded { perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.ip)), uint64(unsafe.Sizeof(sampleData.ip))) } - if eventAttr.IsSampleAddrIncluded { - perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.addr)), uint64(unsafe.Sizeof(sampleData.addr))) - } if eventAttr.IsSampleThreadIDIncluded { perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.pid)), uint64(unsafe.Sizeof(sampleData.pid))) perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.tid)), uint64(unsafe.Sizeof(sampleData.tid))) } + if eventAttr.IsSampleAddrIncluded { + perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.addr)), uint64(unsafe.Sizeof(sampleData.addr))) + } } func perfStartCounter(fd int32) bool { diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 2a05a7dfa3..650b3ef0ab 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -811,9 +811,9 @@ type PMUEventConfig struct { RawEvent int64 PreciseIP int8 IsSampleIPIncluded bool + IsSampleThreadIDIncluded bool IsSampleAddrIncluded bool IsSampleCallchainIncluded bool - IsSampleThreadIDIncluded bool IsKernelIncluded bool IsHvIncluded bool IsIdleIncluded bool @@ -838,9 +838,9 @@ func populatePMUProfiler(w io.Writer, eventConfig *PMUEventConfig, eventId int, RawEvent: uint64(eventConfig.RawEvent), PreciseIP: getPreciseIP(eventConfig.PreciseIP), IsSampleIPIncluded: eventConfig.IsSampleIPIncluded, + IsSampleThreadIDIncluded: eventConfig.IsSampleThreadIDIncluded, IsSampleAddrIncluded: eventConfig.IsSampleAddrIncluded, IsSampleCallchainIncluded: eventConfig.IsSampleCallchainIncluded, - IsSampleThreadIDIncluded: eventConfig.IsSampleThreadIDIncluded, IsKernelIncluded: eventConfig.IsKernelIncluded, IsHvIncluded: eventConfig.IsHvIncluded, IsIdleIncluded: eventConfig.IsIdleIncluded, From 602c0e362af0a15a4b58b490959e4056dda23a18 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Mon, 23 Sep 2019 13:42:34 -0400 Subject: [PATCH 110/126] fixed error about data type --- src/runtime/defs_perf_linux.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index f1c207c774..0a2b0c5d6a 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -72,10 +72,14 @@ type perfEventHeader struct { size uint16 } +// The order where values are saved in a sample has to match the ring-buffer mmap layout type perfSampleData struct { ip uint64 // if _PERF_SAMPLE_IP - addr uint64 // if _PERF_SAMPLE_ADDR pid uint32 // if _PERF_SAMPLE_TID tid uint32 // if _PERF_SAMPLE_TID - // TODO: More fields can be added if needed + addr uint64 // if _PERF_SAMPLE_ADDR + // TODO: More fields can be added in order if needed + + /*********** auxiliary fields ***********/ + isPrecise bool // whether the obtained ip is precise or not } From a55e11de1e34f351cceaf2c8d5819dc5bc096fe1 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Mon, 23 Sep 2019 16:27:32 -0400 Subject: [PATCH 111/126] Guarantee per-sample overflow notifications --- src/runtime/defs_linux_amd64.go | 1 + src/runtime/defs_perf_linux.go | 2 +- src/runtime/perf_linux.go | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 87b3711f05..336862a62e 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -155,6 +155,7 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 + _PERF_SAMPLE_IDENTIFIER = 0x10000 _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index 0a2b0c5d6a..27ec826805 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -72,7 +72,7 @@ type perfEventHeader struct { size uint16 } -// The order where values are saved in a sample has to match the ring-buffer mmap layout +// The order where values are saved in a sample has to match the mmap ring buffer layout type perfSampleData struct { ip uint64 // if _PERF_SAMPLE_IP pid uint32 // if _PERF_SAMPLE_TID diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index 04f26613be..17b2410e8c 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -57,6 +57,8 @@ func perfAttrInit(eventId int32, eventAttr *PMUEventAttr, perfAttr *perfEventAtt if !eventAttr.IsCallchainUserIncluded { perfAttr.bits |= 1 << 22 } + + perfAttr.wakeup = 1 // counter overflow notifications happen after wakeup_events samples } func perfMmapInit() { @@ -174,7 +176,7 @@ func perfReadHeader(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) bool { return perfReadNbytes(mmapBuf, unsafe.Pointer(hdr), uint64(unsafe.Sizeof(*hdr))) } -// The order where values are read has to match the ring-buffer mmap layout +// The order where values are read has to match the mmap ring buffer layout func perfRecordSample(mmapBuf *perfEventMmapPage, eventAttr *PMUEventAttr, sampleData *perfSampleData) { if eventAttr.IsSampleIPIncluded { perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.ip)), uint64(unsafe.Sizeof(sampleData.ip))) From 89fdba21ae53fa857ac43b270da39b7f515511f8 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Mon, 23 Sep 2019 20:26:43 -0400 Subject: [PATCH 112/126] Check whether the obtained sample ip is precise --- src/runtime/defs_linux_386.go | 2 ++ src/runtime/defs_linux_amd64.go | 3 ++- src/runtime/defs_linux_arm.go | 2 ++ src/runtime/defs_linux_arm64.go | 2 ++ src/runtime/defs_linux_mips64x.go | 2 ++ src/runtime/defs_linux_mipsx.go | 2 ++ src/runtime/defs_linux_ppc64.go | 2 ++ src/runtime/defs_linux_ppc64le.go | 2 ++ src/runtime/defs_linux_s390x.go | 2 ++ src/runtime/defs_perf_linux.go | 2 +- src/runtime/os_linux.go | 10 ++++++++-- 11 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index e2ec4ab39e..21758918fe 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -180,6 +180,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 336862a62e..1e9977a392 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -155,7 +155,6 @@ const ( _PERF_SAMPLE_STREAM_ID = 0x200 _PERF_SAMPLE_RAW = 0x400 _PERF_SAMPLE_BRANCH_STACK = 0x800 - _PERF_SAMPLE_IDENTIFIER = 0x10000 _PERF_SAMPLE_BRANCH_USER = 0x1 _PERF_SAMPLE_BRANCH_KERNEL = 0x2 @@ -180,6 +179,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index 0529299b96..944aeac4f4 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -173,6 +173,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index fd197db902..b1f788aa83 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -177,6 +177,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index 3456be278f..96499ad219 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -172,6 +172,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index e994b6aa5a..bb63a95ce8 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -176,6 +176,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index 27c7a97c89..4388b24f73 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -172,6 +172,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index 429c0a408e..90aaacecf2 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -172,6 +172,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index 783d01eb62..bd411f3726 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -173,6 +173,8 @@ const ( _PERF_FORMAT_ID = 0x4 _PERF_FORMAT_GROUP = 0x8 + _PERF_RECORD_MISC_EXACT_IP = 0x4000 + _PERF_RECORD_MMAP = 0x1 _PERF_RECORD_LOST = 0x2 _PERF_RECORD_COMM = 0x3 diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index 27ec826805..8b00ae845b 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -81,5 +81,5 @@ type perfSampleData struct { // TODO: More fields can be added in order if needed /*********** auxiliary fields ***********/ - isPrecise bool // whether the obtained ip is precise or not + isPreciseIP bool // whether the obtained ip is precise or not } diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index fcab4db43e..0211b0d235 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -590,27 +590,33 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { remains := mmapBuf.data_head - mmapBuf.data_tail for remains > 0 { var hdr perfEventHeader + if remains < uint64(unsafe.Sizeof(hdr)) { perfSkipAll(mmapBuf) break } + if !perfReadHeader(mmapBuf, &hdr) { println("Failed to read the mmap header") break } + if hdr.Type == _PERF_RECORD_SAMPLE { var sampleData perfSampleData - // sampleData.isPrecise = (hdr.misc & _PERF_RECORD_MISC_EXACT_IP) ? true : false + + sampleData.isPreciseIP = (hdr.misc & _PERF_RECORD_MISC_EXACT_IP) != 0 + perfRecordSample(mmapBuf, _g_.m.eventAttrs[eventId], &sampleData) + sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId, &sampleData) } else if hdr.size == 0 { perfSkipAll(mmapBuf) } else { perfSkipRecord(mmapBuf, &hdr) } + remains = mmapBuf.data_head - mmapBuf.data_tail } - } else { // should never be taken println("File descriptor ", fd, " not found in _g_.m.eventFds") } From e7dde74bf86a33253332dc4576ddcb7ecf7f723f Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Mon, 23 Sep 2019 23:46:38 -0400 Subject: [PATCH 113/126] Update test cases --- test/pmu/test1.go | 2 -- test/pmu/test2.go | 6 +----- test/pmu/test4.go | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 59654d6497..2cde966075 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -162,8 +162,6 @@ func run() error { var cycle pprof.PMUEventConfig cycle.Period = 10000000 - cycle.IsKernelIncluded = false - cycle.IsHvIncluded = false if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { return err diff --git a/test/pmu/test2.go b/test/pmu/test2.go index ee7b281bde..660e16313e 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -177,7 +177,6 @@ func run() error { var cycle pprof.PMUEventConfig cycle.Period = 100000000 - // cycle.PreciseIP = 2 instrFile, err := os.Create("instr_profile") if err != nil { @@ -187,7 +186,6 @@ func run() error { var instr pprof.PMUEventConfig instr.Period = 100000000 - // instr.PreciseIP = 2 cacheMissFile, err := os.Create("cacheMiss_profile") if err != nil { @@ -197,7 +195,6 @@ func run() error { var cacheMiss pprof.PMUEventConfig cacheMiss.Period = 10 - // cacheMiss.PreciseIP = 2 cacheRefFile, err := os.Create("cacheRef_profile") if err != nil { @@ -206,8 +203,7 @@ func run() error { defer cacheRefFile.Close() var cacheRef pprof.PMUEventConfig - cacheRef.Period = 10000 - // cacheRef.PreciseIP = 2 + cacheRef.Period = 1000 if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle), pprof.WithProfilingPMUInstructions(instrFile, &instr), pprof.WithProfilingPMUCacheReferences(cacheRefFile, &cacheRef), pprof.WithProfilingPMUCacheMisses(cacheMissFile, &cacheMiss)); err != nil { return err diff --git a/test/pmu/test4.go b/test/pmu/test4.go index ce9f0b80ee..21b72160bc 100644 --- a/test/pmu/test4.go +++ b/test/pmu/test4.go @@ -163,8 +163,6 @@ func run() error { var raw pprof.PMUEventConfig raw.RawEvent = /* UOPS_ISSUED */ 0x53010e raw.Period = 1000000 - raw.IsKernelIncluded = false - raw.IsHvIncluded = false if err := pprof.StartPMUProfile(pprof.WithProfilingPMURaw(rawFile, &raw)); err != nil { return err From 42e020407c591c31368ecc33e51408c5b9fa5009 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 24 Sep 2019 13:26:54 -0400 Subject: [PATCH 114/126] implement mb(), rmb() and wmb() in Go-style ASM --- src/runtime/asm_386.s | 12 ++++++++++++ src/runtime/asm_amd64.s | 12 ++++++++++++ src/runtime/mem_barrier.go | 13 +++++++++++++ src/runtime/os_linux.go | 28 ++++++++++++++++++--------- src/runtime/perf_linux.go | 39 ++++++++++++++++++++------------------ 5 files changed, 77 insertions(+), 27 deletions(-) create mode 100644 src/runtime/mem_barrier.go diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index b98843e73e..d94cdf1fb4 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -1566,6 +1566,18 @@ TEXT runtime·panicExtendSlice3CU(SB),NOSPLIT,$0-12 MOVL CX, y+8(FP) JMP runtime·goPanicExtendSlice3CU(SB) +TEXT runtime·mb(SB),NOSPLIT,$0-0 + MFENCE + RET + +TEXT runtime·rmb(SB),NOSPLIT,$0-0 + LFENCE + RET + +TEXT runtime·wmb(SB),NOSPLIT,$0-0 + SFENCE + RET + #ifdef GOOS_android // Use the free TLS_SLOT_APP slot #2 on Android Q. // Earlier androids are set up in gcc_android.c. diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index fd3a9c3127..160223d6e2 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -1721,6 +1721,18 @@ TEXT runtime·panicSlice3CU(SB),NOSPLIT,$0-16 MOVQ CX, y+8(FP) JMP runtime·goPanicSlice3CU(SB) +TEXT runtime·mb(SB),NOSPLIT,$0-0 + MFENCE + RET + +TEXT runtime·rmb(SB),NOSPLIT,$0-0 + LFENCE + RET + +TEXT runtime·wmb(SB),NOSPLIT,$0-0 + SFENCE + RET + #ifdef GOOS_android // Use the free TLS_SLOT_APP slot #2 on Android Q. // Earlier androids are set up in gcc_android.c. diff --git a/src/runtime/mem_barrier.go b/src/runtime/mem_barrier.go new file mode 100644 index 0000000000..44f3bf3883 --- /dev/null +++ b/src/runtime/mem_barrier.go @@ -0,0 +1,13 @@ +package runtime + +// a hardware memory barrier that prevents any memory write access from +// being moved and executed on the other side of the barrier +func mb() + +// a hardware memory barrier that prevents any memory read access from +// being moved and executed on the other side of the barrier +func rmb() + +// A hardware memory barrier that prevents any memory write access from +// being moved and executed on the other side of the barrier +func wmb() diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 0211b0d235..62933c3475 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -587,16 +587,28 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { } if eventId != -1 { mmapBuf := _g_.m.eventMmapBufs[eventId] - remains := mmapBuf.data_head - mmapBuf.data_tail - for remains > 0 { + head := mmapBuf.data_head + + rmb() // on SMP-capable platforms, after reading the data_head value, user space should issue a memory barrier + + for { + tail := mmapBuf.data_tail + remains := head - tail + if remains <= 0 { + break; + } + var hdr perfEventHeader + // the causes of passing 'mmapBuf.data_head' by value to functions perfSkipAll, perfReadHeader, perfRecordSample, perfSkipAll and perfSkipRecord: + // 1. it remains unchanged across these function calls + // 2. more importantly, avoid frequenly reading it from the mmap ring buffer => avoid frequenly calling rmb() if remains < uint64(unsafe.Sizeof(hdr)) { - perfSkipAll(mmapBuf) + perfSkipAll(head, mmapBuf) break } - if !perfReadHeader(mmapBuf, &hdr) { + if !perfReadHeader(head, mmapBuf, &hdr) { println("Failed to read the mmap header") break } @@ -606,16 +618,14 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { sampleData.isPreciseIP = (hdr.misc & _PERF_RECORD_MISC_EXACT_IP) != 0 - perfRecordSample(mmapBuf, _g_.m.eventAttrs[eventId], &sampleData) + perfRecordSample(head, mmapBuf, _g_.m.eventAttrs[eventId], &sampleData) sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId, &sampleData) } else if hdr.size == 0 { - perfSkipAll(mmapBuf) + perfSkipAll(head, mmapBuf) } else { - perfSkipRecord(mmapBuf, &hdr) + perfSkipRecord(head, mmapBuf, &hdr) } - - remains = mmapBuf.data_head - mmapBuf.data_tail } } else { // should never be taken println("File descriptor ", fd, " not found in _g_.m.eventFds") diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index 17b2410e8c..1d9ce69caf 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -98,36 +98,40 @@ func perfUnsetMmap(mmapBuf *perfEventMmapPage) { munmap(unsafe.Pointer(mmapBuf), size) } -func perfSkipNBytes(mmapBuf *perfEventMmapPage, n uint64 ) { - head := mmapBuf.data_head +func perfSkipNBytes(head uint64, mmapBuf *perfEventMmapPage, n uint64 ) { tail := mmapBuf.data_tail - if tail + n > head { - n = head - tail + + remains := head - tail + if n > remains { + n = remains } mmapBuf.data_tail += n } -func perfSkipRecord(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) { +func perfSkipRecord(head uint64, mmapBuf *perfEventMmapPage, hdr *perfEventHeader) { if mmapBuf == nil { return } remains := uint64(hdr.size) - uint64(unsafe.Sizeof(*hdr)) if remains > 0 { - perfSkipNBytes(mmapBuf, remains) + perfSkipNBytes(head, mmapBuf, remains) } } -func perfSkipAll(mmapBuf *perfEventMmapPage) { +func perfSkipAll(head uint64, mmapBuf *perfEventMmapPage) { if mmapBuf == nil { return } - remains := mmapBuf.data_head - mmapBuf.data_tail + + tail := mmapBuf.data_tail + + remains := head - tail if remains > 0 { - perfSkipNBytes(mmapBuf, remains) + perfSkipNBytes(head, mmapBuf, remains) } } -func perfReadNbytes(mmapBuf *perfEventMmapPage, buf unsafe.Pointer, n uint64) bool { +func perfReadNbytes(head uint64, mmapBuf *perfEventMmapPage, buf unsafe.Pointer, n uint64) bool { if mmapBuf == nil { return false } @@ -136,7 +140,6 @@ func perfReadNbytes(mmapBuf *perfEventMmapPage, buf unsafe.Pointer, n uint64) bo data := unsafe.Pointer(uintptr(unsafe.Pointer(mmapBuf)) + uintptr(perfPageSize)) tail := mmapBuf.data_tail - head := mmapBuf.data_head // compute bytes available in the circular buffer byteAvailable := head - tail @@ -172,21 +175,21 @@ func perfReadNbytes(mmapBuf *perfEventMmapPage, buf unsafe.Pointer, n uint64) bo return true } -func perfReadHeader(mmapBuf *perfEventMmapPage, hdr *perfEventHeader) bool { - return perfReadNbytes(mmapBuf, unsafe.Pointer(hdr), uint64(unsafe.Sizeof(*hdr))) +func perfReadHeader(head uint64, mmapBuf *perfEventMmapPage, hdr *perfEventHeader) bool { + return perfReadNbytes(head, mmapBuf, unsafe.Pointer(hdr), uint64(unsafe.Sizeof(*hdr))) } // The order where values are read has to match the mmap ring buffer layout -func perfRecordSample(mmapBuf *perfEventMmapPage, eventAttr *PMUEventAttr, sampleData *perfSampleData) { +func perfRecordSample(head uint64, mmapBuf *perfEventMmapPage, eventAttr *PMUEventAttr, sampleData *perfSampleData) { if eventAttr.IsSampleIPIncluded { - perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.ip)), uint64(unsafe.Sizeof(sampleData.ip))) + perfReadNbytes(head, mmapBuf, unsafe.Pointer(&(sampleData.ip)), uint64(unsafe.Sizeof(sampleData.ip))) } if eventAttr.IsSampleThreadIDIncluded { - perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.pid)), uint64(unsafe.Sizeof(sampleData.pid))) - perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.tid)), uint64(unsafe.Sizeof(sampleData.tid))) + perfReadNbytes(head, mmapBuf, unsafe.Pointer(&(sampleData.pid)), uint64(unsafe.Sizeof(sampleData.pid))) + perfReadNbytes(head, mmapBuf, unsafe.Pointer(&(sampleData.tid)), uint64(unsafe.Sizeof(sampleData.tid))) } if eventAttr.IsSampleAddrIncluded { - perfReadNbytes(mmapBuf, unsafe.Pointer(&(sampleData.addr)), uint64(unsafe.Sizeof(sampleData.addr))) + perfReadNbytes(head, mmapBuf, unsafe.Pointer(&(sampleData.addr)), uint64(unsafe.Sizeof(sampleData.addr))) } } From 2cce77b768abe2714ec14f6842e85541ff3df222 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 24 Sep 2019 13:35:24 -0400 Subject: [PATCH 115/126] comments --- src/runtime/os_linux.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 62933c3475..b67f21c25c 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -587,12 +587,13 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { } if eventId != -1 { mmapBuf := _g_.m.eventMmapBufs[eventId] - head := mmapBuf.data_head + head := mmapBuf.data_head rmb() // on SMP-capable platforms, after reading the data_head value, user space should issue a memory barrier for { tail := mmapBuf.data_tail + remains := head - tail if remains <= 0 { break; @@ -600,7 +601,8 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { var hdr perfEventHeader - // the causes of passing 'mmapBuf.data_head' by value to functions perfSkipAll, perfReadHeader, perfRecordSample, perfSkipAll and perfSkipRecord: + // the causes of passing 'mmapBuf.data_head' by value to functions + // perfSkipAll, perfReadHeader, perfRecordSample, perfSkipAll and perfSkipRecord: // 1. it remains unchanged across these function calls // 2. more importantly, avoid frequenly reading it from the mmap ring buffer => avoid frequenly calling rmb() if remains < uint64(unsafe.Sizeof(hdr)) { From 2a1b55884a3faf86b1e463dcfa6eb5f04695621e Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 24 Sep 2019 14:53:02 -0400 Subject: [PATCH 116/126] Format code using gofmt --- src/math/cmplx/cmath_test.go | 2 +- src/runtime/defs_linux_amd64.go | 8 ++++---- src/runtime/defs_perf_linux.go | 2 +- src/runtime/defs_pmu.go | 2 +- src/runtime/mem_barrier.go | 6 +++--- src/runtime/os_linux.go | 23 ++++++++++++----------- src/runtime/perf_linux.go | 21 +++++++++++---------- src/runtime/pprof/pprof.go | 4 ++-- 8 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/math/cmplx/cmath_test.go b/src/math/cmplx/cmath_test.go index fbb49fdd5b..57ba76a767 100644 --- a/src/math/cmplx/cmath_test.go +++ b/src/math/cmplx/cmath_test.go @@ -222,7 +222,7 @@ var pow = []complex128{ (-2.499956739197529585028819e+00 + 1.759751724335650228957144e+00i), (7.357094338218116311191939e+04 - 5.089973412479151648145882e+04i), (1.320777296067768517259592e+01 - 3.165621914333901498921986e+01i), - (-3.123287828297300934072149e-07 - 1.9849567521490553032502223E-7i), + (-3.123287828297300934072149e-07 - 1.9849567521490553032502223e-7i), (8.0622651468477229614813e+04 - 7.80028727944573092944363e+04i), (-1.0268824572103165858577141e+00 - 4.716844738244989776610672e-01i), (-4.35953819012244175753187e+01 + 2.2036445974645306917648585e+02i), diff --git a/src/runtime/defs_linux_amd64.go b/src/runtime/defs_linux_amd64.go index 1e9977a392..d49d9c8bdf 100644 --- a/src/runtime/defs_linux_amd64.go +++ b/src/runtime/defs_linux_amd64.go @@ -13,11 +13,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_SHARED = 0x1 - _MAP_PRIVATE = 0x2 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 _MAP_SHARED_VALIDATE = 0x3 - _MAP_FIXED = 0x10 - _MAP_ANON = 0x20 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index 8b00ae845b..f4735d4fc4 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -75,7 +75,7 @@ type perfEventHeader struct { // The order where values are saved in a sample has to match the mmap ring buffer layout type perfSampleData struct { ip uint64 // if _PERF_SAMPLE_IP - pid uint32 // if _PERF_SAMPLE_TID + pid uint32 // if _PERF_SAMPLE_TID tid uint32 // if _PERF_SAMPLE_TID addr uint64 // if _PERF_SAMPLE_ADDR // TODO: More fields can be added in order if needed diff --git a/src/runtime/defs_pmu.go b/src/runtime/defs_pmu.go index 9fbd12c72e..450852c250 100644 --- a/src/runtime/defs_pmu.go +++ b/src/runtime/defs_pmu.go @@ -19,7 +19,7 @@ type PMUEventAttr struct { PreciseIP uint8 IsSampleIPIncluded bool IsSampleThreadIDIncluded bool - IsSampleAddrIncluded bool + IsSampleAddrIncluded bool IsSampleCallchainIncluded bool IsKernelIncluded bool IsHvIncluded bool diff --git a/src/runtime/mem_barrier.go b/src/runtime/mem_barrier.go index 44f3bf3883..39035b3529 100644 --- a/src/runtime/mem_barrier.go +++ b/src/runtime/mem_barrier.go @@ -1,13 +1,13 @@ package runtime -// a hardware memory barrier that prevents any memory write access from +// a hardware memory barrier that prevents any memory write access from // being moved and executed on the other side of the barrier func mb() -// a hardware memory barrier that prevents any memory read access from +// a hardware memory barrier that prevents any memory read access from // being moved and executed on the other side of the barrier func rmb() -// A hardware memory barrier that prevents any memory write access from +// A hardware memory barrier that prevents any memory write access from // being moved and executed on the other side of the barrier func wmb() diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index b67f21c25c..83d3899b61 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -290,8 +290,8 @@ func getHugePageSize() uintptr { func osinit() { ncpu = getproccount() physHugePageSize = getHugePageSize() - - // following the same convention as other write once variables in this function and + + // following the same convention as other write once variables in this function and // assuming that there exists a memory fence before anybody reads these values setProcessPMUProfilerFptr = setProcessPMUProfiler setThreadPMUProfilerFptr = setThreadPMUProfiler @@ -481,6 +481,7 @@ func setProcessPMUProfiler(eventAttr *PMUEventAttr) { } func fcntl(fd int32, cmd, arg int) (r, err int) + //go:noescape func fcntl2(fd int32, cmd int, arg *fOwnerEx) (r, err int) @@ -509,13 +510,13 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { var perfAttr perfEventAttr perfAttrInit(eventId, eventAttr, &perfAttr) - fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0, /* dummy */ 0) + fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0 /* dummy */, 0) if err != 0 { println("Linux perf event open failed") return } - // create mmap buffer for this file + // create mmap buffer for this file perfMmap := perfSetMmap(fd) if perfMmap == nil { println("Fail to set perf mmap") @@ -523,8 +524,8 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { return } - flag, _ := fcntl(fd, /* F_GETFL */ 0x3, 0) - _, err = fcntl(fd, /* F_SETFL */ 0x4, flag | /* O_ASYNC */ 0x2000) + flag, _ := fcntl(fd /* F_GETFL */, 0x3, 0) + _, err = fcntl(fd /* F_SETFL */, 0x4, flag| /* O_ASYNC */ 0x2000) if err != 0 { println("Failed to set notification for the PMU event") perfUnsetMmap(perfMmap) @@ -532,7 +533,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { return } - _, err = fcntl(fd, /* F_SETSIG */ 0xa, _SIGPROF) + _, err = fcntl(fd /* F_SETSIG */, 0xa, _SIGPROF) if err != 0 { println("Failed to set signal for the PMU event") perfUnsetMmap(perfMmap) @@ -540,8 +541,8 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { return } - fOwnEx := fOwnerEx{/* F_OWNER_TID */ 0, int32(gettid())} - _, err = fcntl2(fd, /* F_SETOWN_EX */ 0xf, &fOwnEx) + fOwnEx := fOwnerEx{ /* F_OWNER_TID */ 0, int32(gettid())} + _, err = fcntl2(fd /* F_SETOWN_EX */, 0xf, &fOwnEx) if err != 0 { println("Failed to set the owner of the perf event file") perfUnsetMmap(perfMmap) @@ -596,12 +597,12 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { remains := head - tail if remains <= 0 { - break; + break } var hdr perfEventHeader - // the causes of passing 'mmapBuf.data_head' by value to functions + // the causes of passing 'mmapBuf.data_head' by value to functions // perfSkipAll, perfReadHeader, perfRecordSample, perfSkipAll and perfSkipRecord: // 1. it remains unchanged across these function calls // 2. more importantly, avoid frequenly reading it from the mmap ring buffer => avoid frequenly calling rmb() diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index 1d9ce69caf..68136ae55e 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -5,6 +5,7 @@ import ( ) func ioctl(fd int32, req, arg int) (r, err int) + //go:noescape func perfEventOpen(attr *perfEventAttr, pid, cpu, groupFd, flags, dummy int) (r int32, r2, err int) @@ -40,9 +41,9 @@ func perfAttrInit(eventId int32, eventAttr *PMUEventAttr, perfAttr *perfEventAtt perfAttr.sample_type |= _PERF_SAMPLE_TID } - perfAttr.bits = 1 // the counter is disabled and will be enabled later + perfAttr.bits = 1 // the counter is disabled and will be enabled later perfAttr.bits |= uint64(eventAttr.PreciseIP) << 15 // precise ip - if !eventAttr.IsKernelIncluded { // don't count kernel + if !eventAttr.IsKernelIncluded { // don't count kernel perfAttr.bits |= 1 << 5 } if !eventAttr.IsHvIncluded { // don't count hypervisor @@ -63,7 +64,7 @@ func perfAttrInit(eventId int32, eventAttr *PMUEventAttr, perfAttr *perfEventAtt func perfMmapInit() { perfPageSize = uint64(physPageSize) - perfPageMask = perfPageSize * perfDataPages - 1 + perfPageMask = perfPageSize*perfDataPages - 1 } func perfMmapSize() uintptr { @@ -79,10 +80,10 @@ func perfSetMmap(fd int32) *perfEventMmapPage { } size := perfMmapSize() - r, err := mmap(nil, size, _PROT_WRITE | _PROT_READ, _MAP_SHARED, fd, /* page offset */ 0) + r, err := mmap(nil, size, _PROT_WRITE|_PROT_READ, _MAP_SHARED, fd /* page offset */, 0) if err != 0 { return nil - } + } perfMmap := (*perfEventMmapPage)(r) // There is no memset available in Go runime @@ -98,7 +99,7 @@ func perfUnsetMmap(mmapBuf *perfEventMmapPage) { munmap(unsafe.Pointer(mmapBuf), size) } -func perfSkipNBytes(head uint64, mmapBuf *perfEventMmapPage, n uint64 ) { +func perfSkipNBytes(head uint64, mmapBuf *perfEventMmapPage, n uint64) { tail := mmapBuf.data_tail remains := head - tail @@ -136,7 +137,7 @@ func perfReadNbytes(head uint64, mmapBuf *perfEventMmapPage, buf unsafe.Pointer, return false } - // front of the circular data buffer + // front of the circular data buffer data := unsafe.Pointer(uintptr(unsafe.Pointer(mmapBuf)) + uintptr(perfPageSize)) tail := mmapBuf.data_tail @@ -160,13 +161,13 @@ func perfReadNbytes(head uint64, mmapBuf *perfEventMmapPage, buf unsafe.Pointer, right = n } - // copy bytes from tail position - memmove(buf, unsafe.Pointer(uintptr(data) + uintptr(tail)), uintptr(right)) + // copy bytes from tail position + memmove(buf, unsafe.Pointer(uintptr(data)+uintptr(tail)), uintptr(right)) // if necessary, wrap and continue copy from left edge of buf if n > right { left := n - right - memmove(unsafe.Pointer(uintptr(buf) + uintptr(right)) , data, uintptr(left)) + memmove(unsafe.Pointer(uintptr(buf)+uintptr(right)), data, uintptr(left)) } // update tail after consuming n bytes diff --git a/src/runtime/pprof/pprof.go b/src/runtime/pprof/pprof.go index 650b3ef0ab..2a78ca525e 100644 --- a/src/runtime/pprof/pprof.go +++ b/src/runtime/pprof/pprof.go @@ -809,10 +809,10 @@ func StartPMUProfile(opts ...ProfilingOption) error { type PMUEventConfig struct { Period int64 RawEvent int64 - PreciseIP int8 + PreciseIP int8 IsSampleIPIncluded bool IsSampleThreadIDIncluded bool - IsSampleAddrIncluded bool + IsSampleAddrIncluded bool IsSampleCallchainIncluded bool IsKernelIncluded bool IsHvIncluded bool From 98957d8623c8f447feb670a1d25744702c662c0c Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 24 Sep 2019 15:07:21 -0400 Subject: [PATCH 117/126] Format code using gofmt --- src/runtime/os_linux.go | 12 ++++++------ src/runtime/perf_linux.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 83d3899b61..e9a00bdfbb 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -510,7 +510,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { var perfAttr perfEventAttr perfAttrInit(eventId, eventAttr, &perfAttr) - fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0 /* dummy */, 0) + fd, _, err := perfEventOpen(&perfAttr, 0, -1, -1, 0, 0 /* dummy */) if err != 0 { println("Linux perf event open failed") return @@ -524,8 +524,8 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { return } - flag, _ := fcntl(fd /* F_GETFL */, 0x3, 0) - _, err = fcntl(fd /* F_SETFL */, 0x4, flag| /* O_ASYNC */ 0x2000) + flag, _ := fcntl(fd, 0x3 /* F_GETFL */, 0) + _, err = fcntl(fd, 0x4 /* F_SETFL */, flag|0x2000 /* O_ASYNC */) if err != 0 { println("Failed to set notification for the PMU event") perfUnsetMmap(perfMmap) @@ -533,7 +533,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { return } - _, err = fcntl(fd /* F_SETSIG */, 0xa, _SIGPROF) + _, err = fcntl(fd, 0xa /* F_SETSIG */, _SIGPROF) if err != 0 { println("Failed to set signal for the PMU event") perfUnsetMmap(perfMmap) @@ -541,8 +541,8 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { return } - fOwnEx := fOwnerEx{ /* F_OWNER_TID */ 0, int32(gettid())} - _, err = fcntl2(fd /* F_SETOWN_EX */, 0xf, &fOwnEx) + fOwnEx := fOwnerEx{0 /* F_OWNER_TID */, int32(gettid())} + _, err = fcntl2(fd, 0xf /* F_SETOWN_EX */, &fOwnEx) if err != 0 { println("Failed to set the owner of the perf event file") perfUnsetMmap(perfMmap) diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index 68136ae55e..3b3a9293ee 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -71,7 +71,7 @@ func perfMmapSize() uintptr { if perfPageSize == 0 { println("The perf page size has been unknown!") } - return uintptr(perfPageSize * (perfDataPages + /* metadata page */ 1)) + return uintptr(perfPageSize * (perfDataPages + 1 /* metadata page */)) } func perfSetMmap(fd int32) *perfEventMmapPage { @@ -80,7 +80,7 @@ func perfSetMmap(fd int32) *perfEventMmapPage { } size := perfMmapSize() - r, err := mmap(nil, size, _PROT_WRITE|_PROT_READ, _MAP_SHARED, fd /* page offset */, 0) + r, err := mmap(nil, size, _PROT_WRITE|_PROT_READ, _MAP_SHARED, fd, 0 /* page offset */) if err != 0 { return nil } From 30d740e953417faa94cf8bacf0f96d2a8fb05c09 Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 24 Sep 2019 15:16:21 -0400 Subject: [PATCH 118/126] Format test cases using gofmt --- test/235.go | 4 +- test/64bit.go | 48 +- test/align.go | 2 +- test/assign1.go | 5 +- test/bigmap.go | 7 +- test/blank1.go | 12 +- test/char_lit.go | 3 +- test/closedchan.go | 15 +- test/closure1.go | 2 +- test/closure2.go | 4 +- test/cmplxdivide1.go | 6 +- test/complit1.go | 12 +- test/const1.go | 8 +- test/const3.go | 2 +- test/const5.go | 12 +- test/const6.go | 30 +- test/convT2X.go | 4 +- test/convlit1.go | 8 +- test/ddd2.dir/ddd2.go | 1 - test/deferfin.go | 1 - test/deferprint.go | 2 +- test/divmod.go | 45 +- test/dwarf/dwarf.dir/main.go | 41 +- test/dwarf/dwarf.dir/z1.go | 3 +- test/dwarf/dwarf.dir/z10.go | 4 +- test/dwarf/dwarf.dir/z11.go | 2 +- test/dwarf/dwarf.dir/z12.go | 2 +- test/dwarf/dwarf.dir/z13.go | 2 +- test/dwarf/dwarf.dir/z14.go | 2 +- test/dwarf/dwarf.dir/z15.go | 2 +- test/dwarf/dwarf.dir/z16.go | 2 +- test/dwarf/dwarf.dir/z17.go | 2 +- test/dwarf/dwarf.dir/z18.go | 3 +- test/dwarf/dwarf.dir/z19.go | 2 +- test/dwarf/dwarf.dir/z2.go | 2 +- test/dwarf/dwarf.dir/z20.go | 2 +- test/dwarf/dwarf.dir/z3.go | 2 +- test/dwarf/dwarf.dir/z4.go | 2 +- test/dwarf/dwarf.dir/z5.go | 2 +- test/dwarf/dwarf.dir/z6.go | 2 +- test/dwarf/dwarf.dir/z7.go | 2 +- test/dwarf/dwarf.dir/z8.go | 2 +- test/dwarf/dwarf.dir/z9.go | 2 +- test/dwarf/linedirectives.go | 6 +- test/empty.go | 11 +- test/eof.go | 2 +- test/eof1.go | 2 +- test/escape2.go | 42 +- test/escape2n.go | 42 +- test/escape4.go | 4 +- test/escape_closure.go | 4 +- test/escape_field.go | 8 +- test/escape_iface.go | 32 +- test/escape_indir.go | 12 +- test/escape_level.go | 20 +- test/escape_map.go | 22 +- test/escape_param.go | 52 +- test/escape_slice.go | 14 +- test/escape_struct_param1.go | 98 +- test/escape_struct_param2.go | 98 +- test/finprofiled.go | 2 +- test/fixedbugs/bug000.go | 8 +- test/fixedbugs/bug002.go | 3 +- test/fixedbugs/bug003.go | 8 +- test/fixedbugs/bug004.go | 5 +- test/fixedbugs/bug005.go | 8 +- test/fixedbugs/bug008.go | 17 +- test/fixedbugs/bug009.go | 5 +- test/fixedbugs/bug010.go | 1 - test/fixedbugs/bug011.go | 2 +- test/fixedbugs/bug012.go | 26 +- test/fixedbugs/bug013.go | 7 +- test/fixedbugs/bug015.go | 4 +- test/fixedbugs/bug017.go | 5 +- test/fixedbugs/bug020.go | 4 +- test/fixedbugs/bug021.go | 6 +- test/fixedbugs/bug022.go | 12 +- test/fixedbugs/bug023.go | 11 +- test/fixedbugs/bug024.go | 13 +- test/fixedbugs/bug026.go | 8 +- test/fixedbugs/bug028.go | 13 +- test/fixedbugs/bug030.go | 6 +- test/fixedbugs/bug031.go | 34 +- test/fixedbugs/bug037.go | 2 +- test/fixedbugs/bug039.go | 4 +- test/fixedbugs/bug040.go | 4 +- test/fixedbugs/bug045.go | 7 +- test/fixedbugs/bug046.go | 4 +- test/fixedbugs/bug048.go | 6 +- test/fixedbugs/bug049.go | 4 +- test/fixedbugs/bug051.go | 4 +- test/fixedbugs/bug052.go | 10 +- test/fixedbugs/bug053.go | 4 +- test/fixedbugs/bug054.go | 26 +- test/fixedbugs/bug056.go | 4 +- test/fixedbugs/bug057.go | 13 +- test/fixedbugs/bug058.go | 13 +- test/fixedbugs/bug059.go | 26 +- test/fixedbugs/bug060.go | 8 +- test/fixedbugs/bug061.go | 6 +- test/fixedbugs/bug062.go | 2 +- test/fixedbugs/bug063.go | 1 + test/fixedbugs/bug064.go | 14 +- test/fixedbugs/bug065.go | 4 +- test/fixedbugs/bug066.go | 11 +- test/fixedbugs/bug067.go | 4 +- test/fixedbugs/bug069.go | 20 +- test/fixedbugs/bug071.go | 12 +- test/fixedbugs/bug072.go | 2 +- test/fixedbugs/bug074.go | 4 +- test/fixedbugs/bug075.go | 15 +- test/fixedbugs/bug076.go | 3 +- test/fixedbugs/bug078.go | 2 +- test/fixedbugs/bug083.dir/bug1.go | 3 +- test/fixedbugs/bug085.go | 2 +- test/fixedbugs/bug086.go | 4 +- test/fixedbugs/bug087.go | 6 +- test/fixedbugs/bug088.dir/bug0.go | 6 +- test/fixedbugs/bug088.dir/bug1.go | 8 +- test/fixedbugs/bug089.go | 15 +- test/fixedbugs/bug090.go | 40 +- test/fixedbugs/bug092.go | 6 +- test/fixedbugs/bug093.go | 9 +- test/fixedbugs/bug094.go | 12 +- test/fixedbugs/bug096.go | 8 +- test/fixedbugs/bug098.go | 10 +- test/fixedbugs/bug099.go | 12 +- test/fixedbugs/bug101.go | 10 +- test/fixedbugs/bug103.go | 5 +- test/fixedbugs/bug104.go | 3 +- test/fixedbugs/bug106.dir/bug1.go | 1 - test/fixedbugs/bug107.go | 11 +- test/fixedbugs/bug108.go | 3 +- test/fixedbugs/bug111.go | 12 +- test/fixedbugs/bug112.go | 3 +- test/fixedbugs/bug113.go | 2 +- test/fixedbugs/bug115.go | 6 +- test/fixedbugs/bug118.go | 4 +- test/fixedbugs/bug122.go | 2 +- test/fixedbugs/bug123.go | 8 +- test/fixedbugs/bug126.go | 4 +- test/fixedbugs/bug127.go | 7 +- test/fixedbugs/bug128.go | 11 +- test/fixedbugs/bug129.go | 7 +- test/fixedbugs/bug130.go | 17 +- test/fixedbugs/bug131.go | 4 +- test/fixedbugs/bug132.go | 2 +- test/fixedbugs/bug133.dir/bug0.go | 2 +- test/fixedbugs/bug133.dir/bug1.go | 2 +- test/fixedbugs/bug133.dir/bug2.go | 4 +- test/fixedbugs/bug135.go | 13 +- test/fixedbugs/bug136.go | 14 +- test/fixedbugs/bug139.go | 14 +- test/fixedbugs/bug141.go | 16 +- test/fixedbugs/bug142.go | 8 +- test/fixedbugs/bug143.go | 28 +- test/fixedbugs/bug144.go | 6 +- test/fixedbugs/bug145.go | 4 +- test/fixedbugs/bug146.go | 10 +- test/fixedbugs/bug148.go | 22 +- test/fixedbugs/bug149.go | 16 +- test/fixedbugs/bug150.go | 7 +- test/fixedbugs/bug151.go | 4 +- test/fixedbugs/bug152.go | 6 +- test/fixedbugs/bug154.go | 24 +- test/fixedbugs/bug155.go | 2 +- test/fixedbugs/bug156.go | 6 +- test/fixedbugs/bug157.go | 15 +- test/fixedbugs/bug158.go | 3 +- test/fixedbugs/bug159.go | 20 +- test/fixedbugs/bug160.dir/y.go | 8 +- test/fixedbugs/bug161.go | 4 +- test/fixedbugs/bug165.go | 4 +- test/fixedbugs/bug170.go | 11 +- test/fixedbugs/bug171.go | 4 +- test/fixedbugs/bug172.go | 4 +- test/fixedbugs/bug173.go | 5 +- test/fixedbugs/bug174.go | 4 +- test/fixedbugs/bug175.go | 2 +- test/fixedbugs/bug176.go | 5 +- test/fixedbugs/bug181.go | 2 +- test/fixedbugs/bug182.go | 4 +- test/fixedbugs/bug183.go | 21 +- test/fixedbugs/bug186.go | 8 +- test/fixedbugs/bug187.go | 10 +- test/fixedbugs/bug188.go | 6 +- test/fixedbugs/bug189.go | 8 +- test/fixedbugs/bug190.go | 26 +- test/fixedbugs/bug191.dir/a.go | 3 +- test/fixedbugs/bug191.dir/b.go | 2 +- test/fixedbugs/bug192.go | 4 +- test/fixedbugs/bug195.go | 12 +- test/fixedbugs/bug197.go | 14 +- test/fixedbugs/bug198.go | 7 +- test/fixedbugs/bug200.go | 4 +- test/fixedbugs/bug202.go | 9 +- test/fixedbugs/bug203.go | 8 +- test/fixedbugs/bug205.go | 11 +- test/fixedbugs/bug206.go | 17 +- test/fixedbugs/bug207.go | 4 +- test/fixedbugs/bug208.go | 8 +- test/fixedbugs/bug209.go | 4 +- test/fixedbugs/bug211.go | 9 +- test/fixedbugs/bug212.go | 10 +- test/fixedbugs/bug213.go | 7 +- test/fixedbugs/bug214.go | 4 +- test/fixedbugs/bug215.go | 6 +- test/fixedbugs/bug216.go | 2 +- test/fixedbugs/bug217.go | 5 +- test/fixedbugs/bug218.go | 4 +- test/fixedbugs/bug219.go | 14 +- test/fixedbugs/bug222.dir/chanbug.go | 3 +- test/fixedbugs/bug222.dir/chanbug2.go | 1 + test/fixedbugs/bug224.go | 3 +- test/fixedbugs/bug225.go | 10 +- test/fixedbugs/bug229.go | 8 +- test/fixedbugs/bug231.go | 11 +- test/fixedbugs/bug232.go | 3 +- test/fixedbugs/bug233.go | 2 + test/fixedbugs/bug235.go | 1 - test/fixedbugs/bug237.go | 1 + test/fixedbugs/bug238.go | 1 - test/fixedbugs/bug240.go | 2 +- test/fixedbugs/bug241.go | 2 +- test/fixedbugs/bug245.go | 1 + test/fixedbugs/bug249.go | 62 +- test/fixedbugs/bug251.go | 1 - test/fixedbugs/bug252.go | 2 +- test/fixedbugs/bug256.go | 6 +- test/fixedbugs/bug258.go | 2 +- test/fixedbugs/bug259.go | 2 +- test/fixedbugs/bug261.go | 2 +- test/fixedbugs/bug266.go | 4 +- test/fixedbugs/bug269.go | 4 +- test/fixedbugs/bug271.go | 2 +- test/fixedbugs/bug272.go | 6 +- test/fixedbugs/bug276.go | 6 +- test/fixedbugs/bug277.go | 2 +- test/fixedbugs/bug278.go | 8 +- test/fixedbugs/bug279.go | 3 +- test/fixedbugs/bug280.go | 4 +- test/fixedbugs/bug281.go | 8 +- test/fixedbugs/bug282.dir/p1.go | 1 - test/fixedbugs/bug282.dir/p2.go | 1 - test/fixedbugs/bug284.go | 2 +- test/fixedbugs/bug285.go | 4 +- test/fixedbugs/bug287.go | 2 +- test/fixedbugs/bug289.go | 6 +- test/fixedbugs/bug290.go | 4 +- test/fixedbugs/bug293.go | 4 +- test/fixedbugs/bug294.go | 1 - test/fixedbugs/bug295.go | 4 +- test/fixedbugs/bug297.go | 5 +- test/fixedbugs/bug302.dir/main.go | 1 - test/fixedbugs/bug302.dir/p.go | 1998 ++++++++++++------------ test/fixedbugs/bug304.go | 4 +- test/fixedbugs/bug306.dir/p1.go | 2 +- test/fixedbugs/bug306.dir/p2.go | 1 - test/fixedbugs/bug311.go | 4 +- test/fixedbugs/bug314.go | 5 +- test/fixedbugs/bug317.go | 2 +- test/fixedbugs/bug319.go | 2 +- test/fixedbugs/bug320.go | 1 - test/fixedbugs/bug322.dir/lib.go | 2 +- test/fixedbugs/bug322.dir/main.go | 2 +- test/fixedbugs/bug324.dir/prog.go | 9 +- test/fixedbugs/bug325.go | 4 +- test/fixedbugs/bug330.go | 4 +- test/fixedbugs/bug332.go | 2 +- test/fixedbugs/bug333.go | 6 +- test/fixedbugs/bug337.go | 5 +- test/fixedbugs/bug341.go | 1 + test/fixedbugs/bug343.go | 18 +- test/fixedbugs/bug344.go | 4 +- test/fixedbugs/bug347.go | 4 +- test/fixedbugs/bug348.go | 6 +- test/fixedbugs/bug356.go | 13 +- test/fixedbugs/bug357.go | 2 +- test/fixedbugs/bug361.go | 2 +- test/fixedbugs/bug362.go | 6 +- test/fixedbugs/bug363.go | 8 +- test/fixedbugs/bug364.go | 2 +- test/fixedbugs/bug366.go | 40 +- test/fixedbugs/bug368.go | 2 +- test/fixedbugs/bug369.dir/pkg.go | 1 - test/fixedbugs/bug372.go | 4 +- test/fixedbugs/bug373.go | 2 +- test/fixedbugs/bug374.go | 4 +- test/fixedbugs/bug376.go | 4 +- test/fixedbugs/bug377.dir/one.go | 1 - test/fixedbugs/bug377.dir/two.go | 1 - test/fixedbugs/bug378.go | 5 +- test/fixedbugs/bug379.go | 2 +- test/fixedbugs/bug380.go | 2 + test/fixedbugs/bug381.go | 2 +- test/fixedbugs/bug382.dir/pkg.go | 4 +- test/fixedbugs/bug383.go | 7 +- test/fixedbugs/bug384.go | 2 +- test/fixedbugs/bug385_32.go | 3 +- test/fixedbugs/bug385_64.go | 620 +++++--- test/fixedbugs/bug386.go | 4 +- test/fixedbugs/bug387.go | 15 +- test/fixedbugs/bug389.go | 2 +- test/fixedbugs/bug391.go | 7 +- test/fixedbugs/bug392.dir/one.go | 13 +- test/fixedbugs/bug396.dir/one.go | 2 +- test/fixedbugs/bug396.dir/two.go | 2 +- test/fixedbugs/bug397.go | 6 +- test/fixedbugs/bug398.go | 12 +- test/fixedbugs/bug399.go | 2 +- test/fixedbugs/bug405.go | 2 +- test/fixedbugs/bug407.dir/one.go | 5 +- test/fixedbugs/bug410.go | 18 +- test/fixedbugs/bug411.go | 3 +- test/fixedbugs/bug412.go | 6 +- test/fixedbugs/bug413.go | 2 +- test/fixedbugs/bug415.dir/p.go | 5 +- test/fixedbugs/bug415.dir/prog.go | 4 +- test/fixedbugs/bug417.go | 16 +- test/fixedbugs/bug420.go | 2 +- test/fixedbugs/bug421.go | 4 +- test/fixedbugs/bug424.dir/main.go | 6 +- test/fixedbugs/bug424.go | 1 - test/fixedbugs/bug425.go | 2 +- test/fixedbugs/bug427.go | 4 +- test/fixedbugs/bug439.go | 2 +- test/fixedbugs/bug441.go | 6 +- test/fixedbugs/bug442.go | 2 +- test/fixedbugs/bug443.go | 4 +- test/fixedbugs/bug444.go | 8 +- test/fixedbugs/bug446.go | 1 - test/fixedbugs/bug447.go | 10 +- test/fixedbugs/bug448.dir/pkg2.go | 1 - test/fixedbugs/bug460.go | 1 - test/fixedbugs/bug462.go | 2 +- test/fixedbugs/bug466.dir/a.go | 2 +- test/fixedbugs/bug466.go | 1 - test/fixedbugs/bug468.dir/p1.go | 2 +- test/fixedbugs/bug468.dir/p2.go | 2 +- test/fixedbugs/bug470.go | 4 +- test/fixedbugs/bug479.dir/a.go | 2 +- test/fixedbugs/bug480.dir/a.go | 2 +- test/fixedbugs/bug486.go | 2 +- test/fixedbugs/bug487.go | 6 +- test/fixedbugs/bug488.dir/a.go | 2 +- test/fixedbugs/bug490.go | 2 +- test/fixedbugs/bug491.go | 2 +- test/fixedbugs/bug500.go | 2 +- test/fixedbugs/gcc61264.go | 2 +- test/fixedbugs/gcc67968.dir/b.go | 6 +- test/fixedbugs/issue10607a.go | 2 +- test/fixedbugs/issue11326.go | 16 +- test/fixedbugs/issue11361.go | 2 +- test/fixedbugs/issue11362.go | 1 - test/fixedbugs/issue12677.dir/p.go | 3 +- test/fixedbugs/issue12677.dir/q.go | 2 + test/fixedbugs/issue13261.go | 24 +- test/fixedbugs/issue13265.go | 6 +- test/fixedbugs/issue13337.go | 1 + test/fixedbugs/issue13415.go | 12 +- test/fixedbugs/issue13485.go | 2 +- test/fixedbugs/issue14136.go | 2 +- test/fixedbugs/issue14321.go | 4 +- test/fixedbugs/issue14540.go | 5 +- test/fixedbugs/issue14651.go | 6 +- test/fixedbugs/issue14729.go | 4 +- test/fixedbugs/issue15039.go | 2 +- test/fixedbugs/issue15042.go | 2 +- test/fixedbugs/issue15311.go | 8 +- test/fixedbugs/issue15439.go | 4 +- test/fixedbugs/issue15470.dir/a.go | 6 +- test/fixedbugs/issue15548.dir/c.go | 2 +- test/fixedbugs/issue15646.go | 2 +- test/fixedbugs/issue15926.go | 2 +- test/fixedbugs/issue16515.go | 5 +- test/fixedbugs/issue16948.go | 1 + test/fixedbugs/issue17449.go | 16 +- test/fixedbugs/issue17588.go | 8 +- test/fixedbugs/issue17645.go | 3 +- test/fixedbugs/issue18231.go | 2 +- test/fixedbugs/issue18808.go | 8 +- test/fixedbugs/issue19028.dir/main.go | 16 +- test/fixedbugs/issue19515.go | 1 - test/fixedbugs/issue19764.dir/a.go | 3 +- test/fixedbugs/issue20602.go | 4 +- test/fixedbugs/issue20811.go | 1 - test/fixedbugs/issue22429.go | 4 +- test/fixedbugs/issue22458.go | 12 +- test/fixedbugs/issue22662.go | 20 +- test/fixedbugs/issue24339.go | 10 +- test/fixedbugs/issue24799.go | 42 +- test/fixedbugs/issue25727.go | 8 +- test/fixedbugs/issue26335.go | 2 +- test/fixedbugs/issue26340.go | 6 +- test/fixedbugs/issue26407.go | 2 +- test/fixedbugs/issue27278.go | 2 +- test/fixedbugs/issue27356.go | 5 +- test/fixedbugs/issue29215.go | 16 +- test/fixedbugs/issue29402.go | 2 +- test/fixedbugs/issue31747.go | 8 +- test/fixedbugs/issue3552.dir/one.go | 11 +- test/fixedbugs/issue3783.go | 1 - test/fixedbugs/issue3925.go | 3 +- test/fixedbugs/issue4097.go | 2 +- test/fixedbugs/issue4099.go | 2 +- test/fixedbugs/issue4162.go | 8 +- test/fixedbugs/issue4251.go | 6 +- test/fixedbugs/issue4264.go | 8 +- test/fixedbugs/issue4283.go | 4 +- test/fixedbugs/issue4313.go | 5 +- test/fixedbugs/issue4326.dir/q1.go | 8 +- test/fixedbugs/issue4326.dir/q2.go | 10 +- test/fixedbugs/issue4365.go | 8 +- test/fixedbugs/issue4396a.go | 2 +- test/fixedbugs/issue4396b.go | 2 +- test/fixedbugs/issue4429.go | 6 +- test/fixedbugs/issue4463.go | 66 +- test/fixedbugs/issue4470.go | 2 +- test/fixedbugs/issue4495.go | 1 - test/fixedbugs/issue4562.go | 2 +- test/fixedbugs/issue4610.go | 1 - test/fixedbugs/issue4618.go | 2 +- test/fixedbugs/issue4620.go | 2 +- test/fixedbugs/issue4654.go | 82 +- test/fixedbugs/issue4663.go | 4 +- test/fixedbugs/issue4748.go | 8 +- test/fixedbugs/issue4879.dir/a.go | 1 - test/fixedbugs/issue4879.dir/b.go | 6 +- test/fixedbugs/issue5056.go | 4 +- test/fixedbugs/issue5172.go | 4 +- test/fixedbugs/issue5493.go | 2 +- test/fixedbugs/issue5515.go | 18 +- test/fixedbugs/issue5614.dir/x.go | 2 - test/fixedbugs/issue5753.go | 2 +- test/fixedbugs/issue5809.go | 6 +- test/fixedbugs/issue5957.dir/b.go | 1 - test/fixedbugs/issue5957.dir/c.go | 10 +- test/fixedbugs/issue6004.go | 7 +- test/fixedbugs/issue6406.go | 2 +- test/fixedbugs/issue6703g.go | 2 +- test/fixedbugs/issue6703h.go | 2 +- test/fixedbugs/issue6703i.go | 2 +- test/fixedbugs/issue6703o.go | 2 +- test/fixedbugs/issue6703p.go | 2 +- test/fixedbugs/issue6703q.go | 2 +- test/fixedbugs/issue6703r.go | 2 +- test/fixedbugs/issue6703y.go | 2 +- test/fixedbugs/issue6703z.go | 2 +- test/fixedbugs/issue6789.dir/a.go | 6 +- test/fixedbugs/issue6847.go | 2 +- test/fixedbugs/issue7223.go | 7 +- test/fixedbugs/issue7310.go | 2 +- test/fixedbugs/issue7550.go | 20 +- test/fixedbugs/issue7590.go | 2 +- test/fixedbugs/issue7648.dir/a.go | 3 +- test/fixedbugs/issue7760.go | 6 +- test/fixedbugs/issue7921.go | 2 +- test/fixedbugs/issue8155.go | 2 +- test/fixedbugs/issue8961.go | 3 +- test/fixedbugs/issue9076.go | 3 +- test/fixedbugs/issue9083.go | 10 +- test/fixedbugs/issue9537.dir/b.go | 4 +- test/fixedbugs/issue9634.go | 2 +- test/float_lit.go | 48 +- test/for.go | 4 +- test/func.go | 3 - test/func1.go | 1 - test/func4.go | 4 +- test/func5.go | 4 +- test/func6.go | 10 +- test/funcdup.go | 20 +- test/funcdup2.go | 8 +- test/gcstring.go | 9 +- test/goprint.go | 2 +- test/import1.go | 10 +- test/import2.dir/import2.go | 61 +- test/import2.dir/import3.go | 25 +- test/import4.dir/empty.go | 11 +- test/import4.dir/import4.go | 13 +- test/indirect1.go | 52 +- test/initcomma.go | 8 +- test/initialize.go | 38 +- test/initializerr.go | 22 +- test/inline_sync.go | 13 +- test/int_lit.go | 6 +- test/intcvt.go | 2 +- test/interface/bigdata.go | 34 +- test/interface/convert1.go | 9 +- test/interface/convert2.go | 9 +- test/interface/embed.go | 9 +- test/interface/embed1.dir/embed0.go | 5 +- test/interface/embed1.dir/embed1.go | 9 +- test/interface/pointer.go | 3 +- test/interface/private.dir/private1.go | 1 - test/interface/private.dir/prog.go | 6 +- test/interface/recursive.go | 1 + test/interface/returntype.go | 10 +- test/interface/struct.go | 36 +- test/iota.go | 6 +- test/ken/complit.go | 181 ++- test/ken/convert.go | 689 +++++--- test/ken/cplx2.go | 4 +- test/ken/cplx3.go | 4 +- test/ken/embed.go | 1 - test/ken/for.go | 13 +- test/ken/interfun.go | 67 +- test/ken/intervar.go | 53 +- test/ken/litfun.go | 25 +- test/ken/mfunc.go | 16 +- test/ken/ptrfun.go | 51 +- test/ken/ptrvar.go | 79 +- test/ken/robfor.go | 44 +- test/ken/robfunc.go | 3 - test/ken/shift.go | 168 +- test/ken/simparray.go | 51 +- test/ken/simpbool.go | 257 ++- test/ken/simpfun.go | 24 +- test/ken/simpvar.go | 24 +- test/ken/strvar.go | 124 +- test/literal2.go | 4 +- test/live1.go | 1 - test/live_syscall.go | 2 +- test/map1.go | 18 +- test/method5.go | 44 +- test/named.go | 1 - test/nilptr2.go | 10 +- test/oldescape2.go | 42 +- test/oldescape2n.go | 42 +- test/oldescape5.go | 6 +- test/oldescape_field.go | 8 +- test/oldescape_iface.go | 32 +- test/oldescape_param.go | 52 +- test/parentype.go | 10 +- test/pmu/test1.go | 1 + test/pmu/test2.go | 12 - test/pmu/test4.go | 2 +- test/printbig.go | 2 +- test/recover1.go | 14 +- test/return.go | 284 ++-- test/rune.go | 20 +- test/runtime.go | 2 +- test/shift1.go | 12 +- test/stack.go | 2 +- test/switch5.go | 2 +- test/switch7.go | 1 - test/tinyfin.go | 2 +- test/typecheck.go | 8 +- test/typeswitch2.go | 2 +- test/undef.go | 14 +- test/varerr.go | 5 +- 550 files changed, 4888 insertions(+), 4200 deletions(-) diff --git a/test/235.go b/test/235.go index 6745dde41a..a62d384a65 100644 --- a/test/235.go +++ b/test/235.go @@ -16,13 +16,12 @@ func M(f uint64) (in, out T) { out = make(T, 100) go func(in, out T, f uint64) { for { - out <- f*<-in + out <- f * <-in } }(in, out, f) return in, out } - func min(xs []uint64) uint64 { m := xs[0] for i := 1; i < len(xs); i++ { @@ -33,7 +32,6 @@ func min(xs []uint64) uint64 { return m } - func main() { F := []uint64{2, 3, 5} var n = len(F) diff --git a/test/64bit.go b/test/64bit.go index d99d8e83f0..9eaac1409a 100644 --- a/test/64bit.go +++ b/test/64bit.go @@ -25,13 +25,13 @@ var bout *bufio.Writer // if the compiler has buggy or missing 64-bit support. type Uint64 struct { - hi uint32 - lo uint32 + hi uint32 + lo uint32 } type Int64 struct { - hi int32 - lo uint32 + hi int32 + lo uint32 } func (a Uint64) Int64() (c Int64) { @@ -170,7 +170,7 @@ func (a Uint64) DivMod(b Uint64) (quo, rem Uint64) { b = b.LeftShift(uint(n)) for i := 0; i <= n; i++ { quo = quo.LeftShift(1) - if b.Cmp(a) <= 0 { // b <= a + if b.Cmp(a) <= 0 { // b <= a quo.lo |= 1 a = a.Minus(b) } @@ -205,7 +205,7 @@ func (a Uint64) Xor(b Uint64) (c Uint64) { return } -func (a Uint64) String() string { return fmt.Sprintf("%#x%08x", a.hi, a.lo) } +func (a Uint64) String() string { return fmt.Sprintf("%#x%08x", a.hi, a.lo) } func (a Int64) Uint64() (c Uint64) { c.hi = uint32(a.hi) @@ -230,15 +230,15 @@ func (a Int64) Cmp(b Int64) int { return 0 } -func (a Int64) LeftShift(b uint) (c Int64) { return a.Uint64().LeftShift(b).Int64() } +func (a Int64) LeftShift(b uint) (c Int64) { return a.Uint64().LeftShift(b).Int64() } func (a Int64) RightShift(b uint) (c Int64) { switch { case b >= 64: - c.hi = a.hi >> 31 // sign extend + c.hi = a.hi >> 31 // sign extend c.lo = uint32(c.hi) case b >= 32: - c.hi = a.hi >> 31 // sign extend + c.hi = a.hi >> 31 // sign extend c.lo = uint32(a.hi >> (b - 32)) default: c.hi = a.hi >> b @@ -261,15 +261,15 @@ func (a Int64) RightShift64(b Uint64) (c Int64) { return a.RightShift(uint(b.lo)) } -func (a Int64) Plus(b Int64) (c Int64) { return a.Uint64().Plus(b.Uint64()).Int64() } +func (a Int64) Plus(b Int64) (c Int64) { return a.Uint64().Plus(b.Uint64()).Int64() } -func (a Int64) Minus(b Int64) (c Int64) { return a.Uint64().Minus(b.Uint64()).Int64() } +func (a Int64) Minus(b Int64) (c Int64) { return a.Uint64().Minus(b.Uint64()).Int64() } -func (a Int64) Neg() (c Int64) { return a.Uint64().Neg().Int64() } +func (a Int64) Neg() (c Int64) { return a.Uint64().Neg().Int64() } -func (a Int64) Com() (c Int64) { return a.Uint64().Com().Int64() } +func (a Int64) Com() (c Int64) { return a.Uint64().Com().Int64() } -func (a Int64) Times(b Int64) (c Int64) { return a.Uint64().Times(b.Uint64()).Int64() } +func (a Int64) Times(b Int64) (c Int64) { return a.Uint64().Times(b.Uint64()).Int64() } func (a Int64) DivMod(b Int64) (quo Int64, rem Int64) { var zero Int64 @@ -299,13 +299,13 @@ func (a Int64) DivMod(b Int64) (quo Int64, rem Int64) { return } -func (a Int64) And(b Int64) (c Int64) { return a.Uint64().And(b.Uint64()).Int64() } +func (a Int64) And(b Int64) (c Int64) { return a.Uint64().And(b.Uint64()).Int64() } -func (a Int64) AndNot(b Int64) (c Int64) { return a.Uint64().AndNot(b.Uint64()).Int64() } +func (a Int64) AndNot(b Int64) (c Int64) { return a.Uint64().AndNot(b.Uint64()).Int64() } -func (a Int64) Or(b Int64) (c Int64) { return a.Uint64().Or(b.Uint64()).Int64() } +func (a Int64) Or(b Int64) (c Int64) { return a.Uint64().Or(b.Uint64()).Int64() } -func (a Int64) Xor(b Int64) (c Int64) { return a.Uint64().Xor(b.Uint64()).Int64() } +func (a Int64) Xor(b Int64) (c Int64) { return a.Uint64().Xor(b.Uint64()).Int64() } func (a Int64) String() string { if a.hi < 0 { @@ -514,11 +514,11 @@ func varTests() { var div, mod Int64 dodiv := false var zero Int64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 // Can't divide by zero but also can't divide -0x8000...000 by -1. var bigneg = Int64{-0x80000000, 0} var minus1 = Int64{-1, ^uint32(0)} - if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 + if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 div, mod = a.DivMod(b) dodiv = true } @@ -542,7 +542,7 @@ func varTests() { var div, mod Uint64 dodiv := false var zero Uint64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 div, mod = a.DivMod(b) dodiv = true } @@ -661,11 +661,11 @@ func constTests() { var div, mod Int64 dodiv := false var zero Int64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 // Can't divide by zero but also can't divide -0x8000...000 by -1. var bigneg = Int64{-0x80000000, 0} var minus1 = Int64{-1, ^uint32(0)} - if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 + if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 div, mod = a.DivMod(b) dodiv = true } @@ -692,7 +692,7 @@ func constTests() { var div, mod Uint64 dodiv := false var zero Uint64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 div, mod = a.DivMod(b) dodiv = true } diff --git a/test/align.go b/test/align.go index 61d07c49b8..6e33983275 100644 --- a/test/align.go +++ b/test/align.go @@ -13,7 +13,7 @@ package main // introduced by CL 102036. type T struct { pad uint32 - f float64 + f float64 } //go:noinline diff --git a/test/assign1.go b/test/assign1.go index b9e0325ce8..eabf10062d 100644 --- a/test/assign1.go +++ b/test/assign1.go @@ -214,7 +214,6 @@ func main() { ps1 = ps0 // ERROR "cannot use|incompatible" ps1 = ps // ERROR "cannot use|incompatible" - a0 = [10]int(a) a0 = [10]int(a1) a = A(a0) @@ -236,8 +235,8 @@ func main() { c1 = C1(c0) c1 = C1(c) - f0 = func() int(f) - f0 = func() int(f1) + f0 = (func() int)(f) + f0 = (func() int)(f1) f = F(f0) f = F(f1) f1 = F1(f0) diff --git a/test/bigmap.go b/test/bigmap.go index c5e4f91e11..77ff8243c5 100644 --- a/test/bigmap.go +++ b/test/bigmap.go @@ -35,7 +35,6 @@ func main() { cmp(m[1], seq(11, 13)) cmp(m[2], seq(2, 9)) cmp(m[3], seq(3, 17)) - { type T [1]byte @@ -47,7 +46,7 @@ func main() { println(x, y) panic("bad map") } - } + } { type T [100]byte type V [1]byte @@ -134,6 +133,6 @@ func main() { if x, y := m[T{}][0], m[T{1}][0]; x != 1 || y != 2 { println(x, y) panic("bad map") - } - } + } + } } diff --git a/test/blank1.go b/test/blank1.go index bf94d1a0fb..a29992c367 100644 --- a/test/blank1.go +++ b/test/blank1.go @@ -7,7 +7,7 @@ // Test that incorrect uses of the blank identifer are caught. // Does not compile. -package _ // ERROR "invalid package name _" +package _ // ERROR "invalid package name _" var t struct { _ int @@ -18,15 +18,15 @@ func (x int) _() { // ERROR "cannot define new methods on non-local type" } type T struct { - _ []int + _ []int } func main() { - _() // ERROR "cannot use _ as value" - x := _+1 // ERROR "cannot use _ as value" + _() // ERROR "cannot use _ as value" + x := _ + 1 // ERROR "cannot use _ as value" _ = x _ = t._ // ERROR "cannot refer to blank field|invalid use of" - var v1, v2 T - _ = v1 == v2 // ERROR "cannot be compared|non-comparable" + var v1, v2 T + _ = v1 == v2 // ERROR "cannot be compared|non-comparable" } diff --git a/test/char_lit.go b/test/char_lit.go index 836c3c1a2d..e452db952e 100644 --- a/test/char_lit.go +++ b/test/char_lit.go @@ -11,8 +11,7 @@ package main import "os" func main() { - var i uint64 = - ' ' + + var i uint64 = ' ' + 'a' + 'ä' + '本' + diff --git a/test/closedchan.go b/test/closedchan.go index 043a92d388..5221d257b4 100644 --- a/test/closedchan.go +++ b/test/closedchan.go @@ -18,7 +18,7 @@ var failed bool type Chan interface { Send(int) Nbsend(int) bool - Recv() (int) + Recv() int Nbrecv() (int, bool) Recv2() (int, bool) Nbrecv2() (int, bool, bool) @@ -214,7 +214,6 @@ func (c SSChan) Impl() string { return "(select)" } - func shouldPanic(f func()) { defer func() { if recover() == nil { @@ -318,13 +317,13 @@ func closedasync() chan int { return c } -var mks = []func(chan int) Chan { +var mks = []func(chan int) Chan{ func(c chan int) Chan { return XChan(c) }, func(c chan int) Chan { return SChan(c) }, func(c chan int) Chan { return SSChan(c) }, } -var testcloseds = []func(Chan) { +var testcloseds = []func(Chan){ testasync1, testasync2, testasync3, @@ -335,18 +334,18 @@ func main() { for _, mk := range mks { test1(mk(closedsync())) } - + for _, testclosed := range testcloseds { for _, mk := range mks { testclosed(mk(closedasync())) } } - - var ch chan int + + var ch chan int shouldPanic(func() { close(ch) }) - + ch = make(chan int) close(ch) shouldPanic(func() { diff --git a/test/closure1.go b/test/closure1.go index 586998203a..ff78f8af8f 100644 --- a/test/closure1.go +++ b/test/closure1.go @@ -16,4 +16,4 @@ func main() { panic("x != 1") } }() -} \ No newline at end of file +} diff --git a/test/closure2.go b/test/closure2.go index 4d61b45d3f..3254775fcc 100644 --- a/test/closure2.go +++ b/test/closure2.go @@ -90,7 +90,7 @@ func main() { q++ g = func() int { return q // test that we capture by ref here - // q++ must on a different decldepth than q declaration + // q++ must on a different decldepth than q declaration } } if g() != 2 { @@ -108,7 +108,7 @@ func main() { }()] = range [2]int{} { g = func() int { return q // test that we capture by ref here - // q++ must on a different decldepth than q declaration + // q++ must on a different decldepth than q declaration } } if g() != 2 { diff --git a/test/cmplxdivide1.go b/test/cmplxdivide1.go index a52fb6fbcf..eac84d763d 100644 --- a/test/cmplxdivide1.go +++ b/test/cmplxdivide1.go @@ -6,9 +6,9 @@ package main import "math" var ( - nan = math.NaN() - inf = math.Inf(1) - zero = 0.0 + nan = math.NaN() + inf = math.Inf(1) + zero = 0.0 ) var tests = []struct { diff --git a/test/complit1.go b/test/complit1.go index 83695a9e88..3c01fe95cb 100644 --- a/test/complit1.go +++ b/test/complit1.go @@ -53,13 +53,13 @@ var ( type M map[T]T var ( - _ = M{{i:1}: {i:2}} - _ = M{T{i:1}: {i:2}} - _ = M{{i:1}: T{i:2}} - _ = M{T{i:1}: T{i:2}} + _ = M{{i: 1}: {i: 2}} + _ = M{T{i: 1}: {i: 2}} + _ = M{{i: 1}: T{i: 2}} + _ = M{T{i: 1}: T{i: 2}} ) -type S struct { s [1]*M1 } +type S struct{ s [1]*M1 } type M1 map[S]int -var _ = M1{{s:[1]*M1{&M1{{}:1}}}:2} +var _ = M1{{s: [1]*M1{&M1{{}: 1}}}: 2} diff --git a/test/const1.go b/test/const1.go index 3fd5b55522..f393026a2a 100644 --- a/test/const1.go +++ b/test/const1.go @@ -87,8 +87,8 @@ func main() { f(Bool) // ERROR "convert|wrong type|cannot|incompatible" } -const ptr = nil // ERROR "const.*nil" -const _ = string([]byte(nil)) // ERROR "is not a? ?constant" +const ptr = nil // ERROR "const.*nil" +const _ = string([]byte(nil)) // ERROR "is not a? ?constant" const _ = uintptr(unsafe.Pointer((*int)(nil))) // ERROR "is not a? ?constant" -const _ = unsafe.Pointer((*int)(nil)) // ERROR "cannot be nil|invalid constant type|is not a constant" -const _ = (*int)(nil) // ERROR "cannot be nil|invalid constant type|is not a constant" +const _ = unsafe.Pointer((*int)(nil)) // ERROR "cannot be nil|invalid constant type|is not a constant" +const _ = (*int)(nil) // ERROR "cannot be nil|invalid constant type|is not a constant" diff --git a/test/const3.go b/test/const3.go index 3f4e3d1ae6..28cce0e6d6 100644 --- a/test/const3.go +++ b/test/const3.go @@ -29,7 +29,7 @@ func main() { panic("fail") } x := uint(5) - y := float64(uint64(1)<>= 1 } - return q, x + return q, x } // signed divide and mod: do unsigned and adjust signs. diff --git a/test/dwarf/dwarf.dir/main.go b/test/dwarf/dwarf.dir/main.go index 175a09c779..732be1c180 100644 --- a/test/dwarf/dwarf.dir/main.go +++ b/test/dwarf/dwarf.dir/main.go @@ -8,25 +8,26 @@ // license that can be found in the LICENSE file. package main + func main() { -F1() -F2() -F3() -F4() -F5() -F6() -F7() -F8() -F9() -F10() -F11() -F12() -F13() -F14() -F15() -F16() -F17() -F18() -F19() -F20() + F1() + F2() + F3() + F4() + F5() + F6() + F7() + F8() + F9() + F10() + F11() + F12() + F13() + F14() + F15() + F16() + F17() + F18() + F19() + F20() } diff --git a/test/dwarf/dwarf.dir/z1.go b/test/dwarf/dwarf.dir/z1.go index 7f163e9a1d..1cda10aa65 100644 --- a/test/dwarf/dwarf.dir/z1.go +++ b/test/dwarf/dwarf.dir/z1.go @@ -1,5 +1,4 @@ - - //line x1.go:4 package main + func F1() {} diff --git a/test/dwarf/dwarf.dir/z10.go b/test/dwarf/dwarf.dir/z10.go index 19c70020e0..1217cbffd8 100644 --- a/test/dwarf/dwarf.dir/z10.go +++ b/test/dwarf/dwarf.dir/z10.go @@ -1,6 +1,4 @@ - - - //line x10.go:4 package main + func F10() {} diff --git a/test/dwarf/dwarf.dir/z11.go b/test/dwarf/dwarf.dir/z11.go index c1d2f9180f..c0350e2e9d 100644 --- a/test/dwarf/dwarf.dir/z11.go +++ b/test/dwarf/dwarf.dir/z11.go @@ -1,4 +1,4 @@ - //line x11.go:4 package main + func F11() {} diff --git a/test/dwarf/dwarf.dir/z12.go b/test/dwarf/dwarf.dir/z12.go index 7455f18946..07d8fde60f 100644 --- a/test/dwarf/dwarf.dir/z12.go +++ b/test/dwarf/dwarf.dir/z12.go @@ -1,4 +1,4 @@ - //line x12.go:4 package main + func F12() {} diff --git a/test/dwarf/dwarf.dir/z13.go b/test/dwarf/dwarf.dir/z13.go index ecb3c4c8c7..2986c6ba1a 100644 --- a/test/dwarf/dwarf.dir/z13.go +++ b/test/dwarf/dwarf.dir/z13.go @@ -1,4 +1,4 @@ - //line x13.go:4 package main + func F13() {} diff --git a/test/dwarf/dwarf.dir/z14.go b/test/dwarf/dwarf.dir/z14.go index 134b39b64e..742e1eecf1 100644 --- a/test/dwarf/dwarf.dir/z14.go +++ b/test/dwarf/dwarf.dir/z14.go @@ -1,4 +1,4 @@ - //line x14.go:4 package main + func F14() {} diff --git a/test/dwarf/dwarf.dir/z15.go b/test/dwarf/dwarf.dir/z15.go index d73819b443..971ad7e8bf 100644 --- a/test/dwarf/dwarf.dir/z15.go +++ b/test/dwarf/dwarf.dir/z15.go @@ -1,4 +1,4 @@ - //line x15.go:4 package main + func F15() {} diff --git a/test/dwarf/dwarf.dir/z16.go b/test/dwarf/dwarf.dir/z16.go index 6c31651baa..3a00057740 100644 --- a/test/dwarf/dwarf.dir/z16.go +++ b/test/dwarf/dwarf.dir/z16.go @@ -1,4 +1,4 @@ - //line x16.go:4 package main + func F16() {} diff --git a/test/dwarf/dwarf.dir/z17.go b/test/dwarf/dwarf.dir/z17.go index b742d16726..d5fbd62531 100644 --- a/test/dwarf/dwarf.dir/z17.go +++ b/test/dwarf/dwarf.dir/z17.go @@ -1,4 +1,4 @@ - //line x17.go:4 package main + func F17() {} diff --git a/test/dwarf/dwarf.dir/z18.go b/test/dwarf/dwarf.dir/z18.go index 84150ff0a3..16750d9f37 100644 --- a/test/dwarf/dwarf.dir/z18.go +++ b/test/dwarf/dwarf.dir/z18.go @@ -1,5 +1,4 @@ - - //line x18.go:4 package main + func F18() {} diff --git a/test/dwarf/dwarf.dir/z19.go b/test/dwarf/dwarf.dir/z19.go index bb2e296841..ae57364790 100644 --- a/test/dwarf/dwarf.dir/z19.go +++ b/test/dwarf/dwarf.dir/z19.go @@ -1,4 +1,4 @@ - //line x19.go:4 package main + func F19() {} diff --git a/test/dwarf/dwarf.dir/z2.go b/test/dwarf/dwarf.dir/z2.go index 68bd58257d..daba026c10 100644 --- a/test/dwarf/dwarf.dir/z2.go +++ b/test/dwarf/dwarf.dir/z2.go @@ -1,4 +1,4 @@ - //line x2.go:4 package main + func F2() {} diff --git a/test/dwarf/dwarf.dir/z20.go b/test/dwarf/dwarf.dir/z20.go index 03111e1845..15ad35c3e7 100644 --- a/test/dwarf/dwarf.dir/z20.go +++ b/test/dwarf/dwarf.dir/z20.go @@ -1,4 +1,4 @@ - //line x20.go:4 package main + func F20() {} diff --git a/test/dwarf/dwarf.dir/z3.go b/test/dwarf/dwarf.dir/z3.go index 5e4ad3ae25..46f05b92ff 100644 --- a/test/dwarf/dwarf.dir/z3.go +++ b/test/dwarf/dwarf.dir/z3.go @@ -1,4 +1,4 @@ - //line x3.go:4 package main + func F3() {} diff --git a/test/dwarf/dwarf.dir/z4.go b/test/dwarf/dwarf.dir/z4.go index 1f28465c57..c3fd6e37b8 100644 --- a/test/dwarf/dwarf.dir/z4.go +++ b/test/dwarf/dwarf.dir/z4.go @@ -1,4 +1,4 @@ - //line x4.go:4 package main + func F4() {} diff --git a/test/dwarf/dwarf.dir/z5.go b/test/dwarf/dwarf.dir/z5.go index 7f4eeb419a..3b6f8b7a63 100644 --- a/test/dwarf/dwarf.dir/z5.go +++ b/test/dwarf/dwarf.dir/z5.go @@ -1,4 +1,4 @@ - //line x5.go:4 package main + func F5() {} diff --git a/test/dwarf/dwarf.dir/z6.go b/test/dwarf/dwarf.dir/z6.go index 241791dff2..d18a067aae 100644 --- a/test/dwarf/dwarf.dir/z6.go +++ b/test/dwarf/dwarf.dir/z6.go @@ -1,4 +1,4 @@ - //line x6.go:4 package main + func F6() {} diff --git a/test/dwarf/dwarf.dir/z7.go b/test/dwarf/dwarf.dir/z7.go index 68c1ad0c24..10bc1a9e56 100644 --- a/test/dwarf/dwarf.dir/z7.go +++ b/test/dwarf/dwarf.dir/z7.go @@ -1,4 +1,4 @@ - //line x7.go:4 package main + func F7() {} diff --git a/test/dwarf/dwarf.dir/z8.go b/test/dwarf/dwarf.dir/z8.go index 16eed32a28..3b17a9d88b 100644 --- a/test/dwarf/dwarf.dir/z8.go +++ b/test/dwarf/dwarf.dir/z8.go @@ -1,4 +1,4 @@ - //line x8.go:4 package main + func F8() {} diff --git a/test/dwarf/dwarf.dir/z9.go b/test/dwarf/dwarf.dir/z9.go index cbb94b4d2b..3af6b317b5 100644 --- a/test/dwarf/dwarf.dir/z9.go +++ b/test/dwarf/dwarf.dir/z9.go @@ -1,4 +1,4 @@ - //line x9.go:4 package main + func F9() {} diff --git a/test/dwarf/linedirectives.go b/test/dwarf/linedirectives.go index cc4ffb000f..3fae427ac4 100644 --- a/test/dwarf/linedirectives.go +++ b/test/dwarf/linedirectives.go @@ -6,8 +6,9 @@ //line foo/bar.y:4 package main + //line foo/bar.y:60 -func main() { +func main() { //line foo/bar.y:297 f, l := 0, 0 //line yacctab:1 @@ -71,7 +72,7 @@ func main() { //line foo/bar.y:272 if l == f { //line foo/bar.y:277 - panic("aie!") + panic("aie!") //line foo/bar.y:281 } //line foo/bar.y:285 @@ -79,5 +80,6 @@ func main() { //line foo/bar.y:288 //line foo/bar.y:290 } + //line foo/bar.y:293 //line foo/bar.y:295 diff --git a/test/empty.go b/test/empty.go index 92a79a4e0d..8ac3907106 100644 --- a/test/empty.go +++ b/test/empty.go @@ -9,7 +9,10 @@ package P -import ( ) -const ( ) -var ( ) -type ( ) +import () + +const () + +var () + +type () diff --git a/test/eof.go b/test/eof.go index d051f33bf7..b142dd83c9 100644 --- a/test/eof.go +++ b/test/eof.go @@ -9,4 +9,4 @@ // No newline at the end of this file. -package main \ No newline at end of file +package main diff --git a/test/eof1.go b/test/eof1.go index 90792ca76e..192f207bfc 100644 --- a/test/eof1.go +++ b/test/eof1.go @@ -9,4 +9,4 @@ package eof1 -// No newline at the end of this comment. \ No newline at end of file +// No newline at the end of this comment. diff --git a/test/escape2.go b/test/escape2.go index f682621c25..758da81a6d 100644 --- a/test/escape2.go +++ b/test/escape2.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1534,7 +1534,7 @@ func NewV(u U) *V { // ERROR "leaking param: u$" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1642,7 +1642,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/escape2n.go b/test/escape2n.go index 2fd26f7c5c..c6cf4b4e15 100644 --- a/test/escape2n.go +++ b/test/escape2n.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1534,7 +1534,7 @@ func NewV(u U) *V { // ERROR "leaking param: u$" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1642,7 +1642,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/escape4.go b/test/escape4.go index a4a9c14a3e..0c95426915 100644 --- a/test/escape4.go +++ b/test/escape4.go @@ -42,7 +42,7 @@ func f5() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new.T. escapes to heap" + t := new(T) // ERROR "new.T. escapes to heap" return &t.x[0] } @@ -52,6 +52,6 @@ func f6() *byte { y byte } } - t := new(T) // ERROR "new.T. escapes to heap" + t := new(T) // ERROR "new.T. escapes to heap" return &t.x.y } diff --git a/test/escape_closure.go b/test/escape_closure.go index cf055d3b34..d0406c4268 100644 --- a/test/escape_closure.go +++ b/test/escape_closure.go @@ -50,7 +50,7 @@ func ClosureCallArgs4() { } func ClosureCallArgs5() { - x := 0 // ERROR "moved to heap: x" + x := 0 // ERROR "moved to heap: x" // TODO(mdempsky): We get "leaking param: p" here because the new escape analysis pass // can tell that p flows directly to sink, but it's a little weird. Re-evaluate. sink = func(p *int) *int { // ERROR "leaking param: p" "func literal does not escape" "\(func literal\)\(&x\) escapes to heap" @@ -132,7 +132,7 @@ func ClosureCallArgs14() { } func ClosureCallArgs15() { - x := 0 // ERROR "moved to heap: x" + x := 0 // ERROR "moved to heap: x" p := &x sink = func(p **int) *int { // ERROR "leaking param content: p" "func literal does not escape" "\(func literal\)\(&p\) escapes to heap" return *p diff --git a/test/escape_field.go b/test/escape_field.go index 5d5a6f36b4..7eefeebe71 100644 --- a/test/escape_field.go +++ b/test/escape_field.go @@ -39,7 +39,7 @@ func field3() { i := 0 // ERROR "moved to heap: i$" var x X x.p1 = &i - sink = x // ERROR "x escapes to heap" + sink = x // ERROR "x escapes to heap" } func field4() { @@ -113,16 +113,16 @@ func field10() { } func field11() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x := X{p1: &i} - sink = x.p1 // ERROR "x\.p1 escapes to heap" + sink = x.p1 // ERROR "x\.p1 escapes to heap" } func field12() { i := 0 // ERROR "moved to heap: i$" // BAD: &i should not escape x := X{p1: &i} - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 // ERROR "x\.p2 escapes to heap" } func field13() { diff --git a/test/escape_iface.go b/test/escape_iface.go index 50c69cd5c1..772e7e23e6 100644 --- a/test/escape_iface.go +++ b/test/escape_iface.go @@ -37,7 +37,7 @@ func efaceEscape0() { _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" sink = x // ERROR "x escapes to heap" @@ -50,7 +50,7 @@ func efaceEscape0() { _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" @@ -58,14 +58,14 @@ func efaceEscape0() { sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" mescapes(x) @@ -91,46 +91,46 @@ func efaceEscape1() { { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" - sink = x // ERROR "x escapes to heap" + var x M = v // ERROR "v escapes to heap" + sink = x // ERROR "x escapes to heap" } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" v1 := x.(M1) _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} var x M = v // ERROR "efaceEscape1 v does not escape" v1 := x.(M1) sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" + var x M = v // ERROR "v escapes to heap" mescapes(x) } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" mdoesnotescape(x) } } @@ -244,7 +244,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = i // ERROR "i does not escape" var y interface{} = j // ERROR "j does not escape" - sink = x.(int) // ERROR "x.\(int\) escapes to heap" + sink = x.(int) // ERROR "x.\(int\) escapes to heap" sink, *(&ok) = y.(int) } { @@ -254,7 +254,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = &i // ERROR "&i escapes to heap" var y interface{} = &j // ERROR "&j escapes to heap" - sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" + sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" sink, *(&ok) = y.(*int) } } diff --git a/test/escape_indir.go b/test/escape_indir.go index ce21ea821f..cb6a2205c7 100644 --- a/test/escape_indir.go +++ b/test/escape_indir.go @@ -54,14 +54,14 @@ func constptr1() { i := 0 // ERROR "moved to heap: i" x := &ConstPtr{} // ERROR "&ConstPtr literal escapes to heap" x.p = &i - sink = x // ERROR "x escapes to heap" + sink = x // ERROR "x escapes to heap" } func constptr2() { i := 0 // ERROR "moved to heap: i" x := &ConstPtr{} // ERROR "&ConstPtr literal does not escape" x.p = &i - sink = *x // ERROR "\*x escapes to heap" + sink = *x // ERROR "\*x escapes to heap" } func constptr4() *ConstPtr { @@ -102,7 +102,7 @@ func constptr8() *ConstPtr { func constptr9() ConstPtr { p := new(ConstPtr) // ERROR "new\(ConstPtr\) does not escape" var p1 ConstPtr2 - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p1.p = &i p.c = p1 return *p @@ -134,7 +134,7 @@ func foo(p **int) { // ERROR "foo p does not escape" } func foo1(p *int) { // ERROR "p does not escape" - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" y := &p *y = &i } @@ -148,13 +148,13 @@ func foo2() { var z Z z.f = &x p := z.f - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" *p = &i } var global *byte func f() { - var x byte // ERROR "moved to heap: x" + var x byte // ERROR "moved to heap: x" global = &*&x } diff --git a/test/escape_level.go b/test/escape_level.go index 44a23e5a4d..e5a0f50273 100644 --- a/test/escape_level.go +++ b/test/escape_level.go @@ -27,15 +27,15 @@ func level1() { } func level2() { - i := 0 // ERROR "moved to heap: i" - p0 := &i // ERROR "moved to heap: p0" + i := 0 // ERROR "moved to heap: i" + p0 := &i // ERROR "moved to heap: p0" p1 := &p0 p2 := &p1 sink = *p2 // ERROR "\*p2 escapes to heap" } func level3() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 p2 := &p1 @@ -43,23 +43,23 @@ func level3() { } func level4() { - i := 0 // ERROR "moved to heap: i" - p0 := &i // ERROR "moved to heap: p0" + i := 0 // ERROR "moved to heap: i" + p0 := &i // ERROR "moved to heap: p0" p1 := &p0 p2 := p1 // ERROR "moved to heap: p2" sink = &p2 // ERROR "&p2 escapes to heap" } func level5() { - i := 0 // ERROR "moved to heap: i" - p0 := &i // ERROR "moved to heap: p0" + i := 0 // ERROR "moved to heap: i" + p0 := &i // ERROR "moved to heap: p0" p1 := &p0 p2 := p1 sink = p2 // ERROR "p2 escapes to heap" } func level6() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 p2 := p1 @@ -67,7 +67,7 @@ func level6() { } func level7() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 // note *p1 == &i @@ -76,7 +76,7 @@ func level7() { } func level8() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 p2 := *p1 diff --git a/test/escape_map.go b/test/escape_map.go index 9912b55a35..d17c457ec7 100644 --- a/test/escape_map.go +++ b/test/escape_map.go @@ -15,7 +15,7 @@ func map0() { // BAD: i should not escape i := 0 // ERROR "moved to heap: i" // BAD: j should not escape - j := 0 // ERROR "moved to heap: j" + j := 0 // ERROR "moved to heap: j" m[&i] = &j _ = m } @@ -23,8 +23,8 @@ func map0() { func map1() *int { m := make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j return m[&i] } @@ -41,7 +41,7 @@ func map3() []*int { m := make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" i := 0 // ERROR "moved to heap: i" // BAD: j should not escape - j := 0 // ERROR "moved to heap: j" + j := 0 // ERROR "moved to heap: j" m[&i] = &j var r []*int for k := range m { @@ -53,8 +53,8 @@ func map3() []*int { func map4() []*int { m := make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j var r []*int for k, v := range m { @@ -68,8 +68,8 @@ func map4() []*int { } func map5(m map[*int]*int) { // ERROR "m does not escape" - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j } @@ -77,8 +77,8 @@ func map6(m map[*int]*int) { // ERROR "m does not escape" if m != nil { m = make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" } - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j } @@ -95,7 +95,7 @@ func map8() { i := 0 // ERROR "moved to heap: i" j := 0 // ERROR "moved to heap: j" m := map[*int]*int{&i: &j} // ERROR "literal escapes to heap" - sink = m // ERROR "m escapes to heap" + sink = m // ERROR "m escapes to heap" } func map9() *int { diff --git a/test/escape_param.go b/test/escape_param.go index 2097556744..b063d9c3d3 100644 --- a/test/escape_param.go +++ b/test/escape_param.go @@ -57,7 +57,7 @@ func caller2b() { i := 0 // ERROR "moved to heap: i$" var p *int param2(&i, &p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } func paramArraySelfAssign(p *PairOfPairs) { // ERROR "p does not escape" @@ -150,11 +150,11 @@ func caller3a() { } func caller3b() { - i := 0 // ERROR "moved to heap: i$" - j := 0 // ERROR "moved to heap: j$" + i := 0 // ERROR "moved to heap: i$" + j := 0 // ERROR "moved to heap: j$" p := Pair{&i, &j} param3(&p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> rcvr @@ -173,7 +173,7 @@ func caller4b() { i := 0 // ERROR "moved to heap: i$" p := Pair{} p.param4(&i) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> heap @@ -182,7 +182,7 @@ func param5(i *int) { // ERROR "leaking param: i$" } func caller5() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" param5(&i) } @@ -192,8 +192,8 @@ func param6(i ***int) { // ERROR "leaking param content: i$" } func caller6a() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param6(&p2) } @@ -204,8 +204,8 @@ func param7(i ***int) { // ERROR "leaking param content: i$" } func caller7() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param7(&p2) } @@ -234,8 +234,8 @@ func caller9a() { } func caller9b() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p sink = param9(&p2) // ERROR "param9\(&p2\) escapes to heap" } @@ -253,7 +253,7 @@ func caller10a() { } func caller10b() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" p := &i p2 := &p sink = param10(&p2) // ERROR "param10\(&p2\) escapes to heap" @@ -265,8 +265,8 @@ func param11(i **int) ***int { // ERROR "moved to heap: i$" } func caller11a() { - i := 0 // ERROR "moved to heap: i" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i" + p := &i // ERROR "moved to heap: p" _ = param11(&p) } @@ -283,8 +283,8 @@ func caller11c() { // GOOD } func caller11d() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p" p2 := &p sink = param11(p2) // ERROR "param11\(p2\) escapes to heap" } @@ -319,7 +319,7 @@ func caller12c() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = r // ERROR "r escapes to heap$" + sink = r // ERROR "r escapes to heap$" } func caller12d() { @@ -327,7 +327,7 @@ func caller12d() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" + sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" } // in -> value rcvr @@ -370,15 +370,15 @@ func caller13d() { var v Val v.p = &p v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13e() { - i := 0 // ERROR "moved to heap: i$" - var p *int // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + var p *int // ERROR "moved to heap: p$" v := Val{&p} v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13f() { @@ -386,7 +386,7 @@ func caller13f() { var p *int // ERROR "moved to heap: p$" v := &Val{&p} // ERROR "&Val literal escapes to heap$" v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13g() { @@ -394,7 +394,7 @@ func caller13g() { var p *int v := Val{&p} v.param13(&i) - sink = *v.p // ERROR "\*v\.p escapes to heap" + sink = *v.p // ERROR "\*v\.p escapes to heap" } func caller13h() { @@ -402,7 +402,7 @@ func caller13h() { var p *int v := &Val{&p} // ERROR "caller13h &Val literal does not escape$" v.param13(&i) - sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" + sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" } type Node struct { diff --git a/test/escape_slice.go b/test/escape_slice.go index 03053cf326..40a5ad372c 100644 --- a/test/escape_slice.go +++ b/test/escape_slice.go @@ -18,28 +18,28 @@ var sink interface{} func slice0() { var s []*int // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) _ = s } func slice1() *int { var s []*int - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) return s[0] } func slice2() []*int { var s []*int - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) return s } func slice3() *int { var s []*int - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) for _, p := range s { return p @@ -48,7 +48,7 @@ func slice3() *int { } func slice4(s []*int) { // ERROR "s does not escape" - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s[0] = &i } @@ -56,14 +56,14 @@ func slice5(s []*int) { // ERROR "s does not escape" if s != nil { s = make([]*int, 10) // ERROR "make\(\[\]\*int, 10\) does not escape" } - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s[0] = &i } func slice6() { s := make([]*int, 10) // ERROR "make\(\[\]\*int, 10\) does not escape" // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s[0] = &i _ = s } diff --git a/test/escape_struct_param1.go b/test/escape_struct_param1.go index 7004946e2f..5242a507c7 100644 --- a/test/escape_struct_param1.go +++ b/test/escape_struct_param1.go @@ -35,7 +35,7 @@ func (u *U) SPPi() *string { // ERROR "leaking param: u to result ~r0 level=2$" } func tSPPi() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tSPPi &U literal does not escape$" @@ -43,7 +43,7 @@ func tSPPi() { } func tiSPP() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tiSPP &U literal does not escape$" @@ -52,8 +52,8 @@ func tiSPP() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of ps func tSP() { - s := "cat" // ERROR "moved to heap: s$" - ps := &s // ERROR "moved to heap: ps$" + s := "cat" // ERROR "moved to heap: s$" + ps := &s // ERROR "moved to heap: ps$" pps := &ps pu := &U{ps, pps} // ERROR "tSP &U literal does not escape$" Ssink = pu.SP() @@ -114,14 +114,14 @@ func (v *V) UPiSPd() *string { // ERROR "leaking param: v to result ~r0 level=2$ // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPa() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPa &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -132,14 +132,14 @@ func tUPiSPa() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPb() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPb &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -150,14 +150,14 @@ func tUPiSPb() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPc() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPc &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -168,14 +168,14 @@ func tUPiSPc() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPd() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPd &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -204,12 +204,12 @@ func tUPiSPPia() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPia &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPia &U literal does not escape$" @@ -222,12 +222,12 @@ func tUPiSPPib() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPib &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPib &U literal does not escape$" @@ -240,12 +240,12 @@ func tUPiSPPic() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPic &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPic &U literal does not escape$" @@ -258,12 +258,12 @@ func tUPiSPPid() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPid &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPid &U literal does not escape$" @@ -286,7 +286,7 @@ func tUPPiSPPia() { s3 := "cat" s4 := "dog" s5 := "emu" - s6 := "fox" // ERROR "moved to heap: s6$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 ps6 := &s6 diff --git a/test/escape_struct_param2.go b/test/escape_struct_param2.go index 5a9b271958..76dc35ccf0 100644 --- a/test/escape_struct_param2.go +++ b/test/escape_struct_param2.go @@ -35,7 +35,7 @@ func (u U) SPPi() *string { // ERROR "leaking param: u to result ~r0 level=1$" } func tSPPi() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tSPPi &U literal does not escape$" @@ -43,7 +43,7 @@ func tSPPi() { } func tiSPP() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tiSPP &U literal does not escape$" @@ -52,8 +52,8 @@ func tiSPP() { // BAD: need fine-grained analysis to avoid spurious escape of ps func tSP() { - s := "cat" // ERROR "moved to heap: s$" - ps := &s // ERROR "moved to heap: ps$" + s := "cat" // ERROR "moved to heap: s$" + ps := &s // ERROR "moved to heap: ps$" pps := &ps pu := &U{ps, pps} // ERROR "tSP &U literal does not escape$" Ssink = pu.SP() @@ -114,14 +114,14 @@ func (v V) UPiSPd() *string { // ERROR "leaking param: v to result ~r0 level=1$" // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPa() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPa &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -132,14 +132,14 @@ func tUPiSPa() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPb() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPb &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -150,14 +150,14 @@ func tUPiSPb() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPc() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPc &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -168,14 +168,14 @@ func tUPiSPc() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPd() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPd &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -204,12 +204,12 @@ func tUPiSPPia() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPia &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPia &U literal does not escape$" @@ -222,12 +222,12 @@ func tUPiSPPib() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPib &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPib &U literal does not escape$" @@ -240,12 +240,12 @@ func tUPiSPPic() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPic &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPic &U literal does not escape$" @@ -258,12 +258,12 @@ func tUPiSPPid() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPid &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPid &U literal does not escape$" @@ -286,7 +286,7 @@ func tUPPiSPPia() { // This test is sensitive to the level cap in function summa s3 := "cat" s4 := "dog" s5 := "emu" - s6 := "fox" // ERROR "moved to heap: s6$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 ps6 := &s6 diff --git a/test/finprofiled.go b/test/finprofiled.go index 0eb801a4bd..267e15b9af 100644 --- a/test/finprofiled.go +++ b/test/finprofiled.go @@ -23,7 +23,7 @@ func main() { // only for middle bytes. The finalizer resurrects that object. // As the result, all allocated memory must stay alive. const ( - N = 1 << 20 + N = 1 << 20 tinyBlockSize = 16 // runtime._TinySize ) hold := make([]*int32, 0, N) diff --git a/test/fixedbugs/bug000.go b/test/fixedbugs/bug000.go index 9104a57aaf..a0a9a654ad 100644 --- a/test/fixedbugs/bug000.go +++ b/test/fixedbugs/bug000.go @@ -7,14 +7,16 @@ package main func main() { - var x int; + var x int switch x { case 0: - {} + { + } case 1: - x = 0; + x = 0 } } + /* bug0.go:8: case statement out of place */ diff --git a/test/fixedbugs/bug002.go b/test/fixedbugs/bug002.go index 3493426d37..89b989cb85 100644 --- a/test/fixedbugs/bug002.go +++ b/test/fixedbugs/bug002.go @@ -7,5 +7,6 @@ package main func main() { - if ; false {} // compiles; should be an error (should be simplevardecl before ;) + if false { + } // compiles; should be an error (should be simplevardecl before ;) } diff --git a/test/fixedbugs/bug003.go b/test/fixedbugs/bug003.go index 7165d9d209..1602630c39 100644 --- a/test/fixedbugs/bug003.go +++ b/test/fixedbugs/bug003.go @@ -7,8 +7,14 @@ package main func main() { - switch ; { case true: return; default: return } + switch { + case true: + return + default: + return + } } + /* bug003.go:6: fatal error: walkswitch: not case EMPTY */ diff --git a/test/fixedbugs/bug004.go b/test/fixedbugs/bug004.go index fb207e9bc8..4864afacb6 100644 --- a/test/fixedbugs/bug004.go +++ b/test/fixedbugs/bug004.go @@ -7,5 +7,8 @@ package main func main() { - switch ; { case false: return; } // compiles; should be an error (should be simplevardecl before ;) + switch { + case false: + return + } // compiles; should be an error (should be simplevardecl before ;) } diff --git a/test/fixedbugs/bug005.go b/test/fixedbugs/bug005.go index 3798f8321a..d57ef6ac2d 100644 --- a/test/fixedbugs/bug005.go +++ b/test/fixedbugs/bug005.go @@ -7,11 +7,13 @@ package main func main() { - Foo: { - return; +Foo: + { + return } - goto Foo; + goto Foo } + /* bug5.go:4: Foo undefined bug5.go:4: fatal error: walktype: switch 1 unknown op GOTO l(4) diff --git a/test/fixedbugs/bug008.go b/test/fixedbugs/bug008.go index 48f74a52d9..4468d74a20 100644 --- a/test/fixedbugs/bug008.go +++ b/test/fixedbugs/bug008.go @@ -7,14 +7,21 @@ package main func main() { - i5 := 5; + i5 := 5 - switch { // compiler crash fixable with 'switch true' - case i5 < 5: dummy := 0; _ = dummy; - case i5 == 5: dummy := 0; _ = dummy; - case i5 > 5: dummy := 0; _ = dummy; + switch { // compiler crash fixable with 'switch true' + case i5 < 5: + dummy := 0 + _ = dummy + case i5 == 5: + dummy := 0 + _ = dummy + case i5 > 5: + dummy := 0 + _ = dummy } } + /* Segmentation fault */ diff --git a/test/fixedbugs/bug009.go b/test/fixedbugs/bug009.go index 0467b297a2..3db245e64e 100644 --- a/test/fixedbugs/bug009.go +++ b/test/fixedbugs/bug009.go @@ -6,10 +6,11 @@ package main - func main() { - fired := false; _ = fired; + fired := false + _ = fired } + /* bug9.go:5: defaultlit: unknown literal: LITERAL-B0 a(1) bug9.go:5: fatal error: addvar: n=NAME-fired G0 a(1) l(5) t= nil diff --git a/test/fixedbugs/bug010.go b/test/fixedbugs/bug010.go index f54b1d54a8..a8d3ed4cbb 100644 --- a/test/fixedbugs/bug010.go +++ b/test/fixedbugs/bug010.go @@ -6,7 +6,6 @@ package main - func f(i int, f float64) { i = 8 f = 8.0 diff --git a/test/fixedbugs/bug011.go b/test/fixedbugs/bug011.go index 519c3585f0..95c91a1ff9 100644 --- a/test/fixedbugs/bug011.go +++ b/test/fixedbugs/bug011.go @@ -6,7 +6,6 @@ package main - type T struct { x, y int } @@ -22,6 +21,7 @@ func main() { r10 := t.m(1, 3.0) _ = r10 } + /* bug11.go:16: fatal error: walktype: switch 1 unknown op CALLMETH l(16) INT32 */ diff --git a/test/fixedbugs/bug012.go b/test/fixedbugs/bug012.go index 38efb6d979..d4ccc973a5 100644 --- a/test/fixedbugs/bug012.go +++ b/test/fixedbugs/bug012.go @@ -6,18 +6,24 @@ package main - func main() { - var u30 uint64 = 0; - var u31 uint64 = 1; - _, _ = u30, u31; - var u32 uint64 = 18446744073709551615; - var u33 uint64 = +18446744073709551615; - if u32 != (1<<64)-1 { panic("u32\n"); } - if u33 != (1<<64)-1 { panic("u33\n"); } - var i34 int64 = ^0; // note: 2's complement means ^0 == -1 - if i34 != -1 { panic("i34") } + var u30 uint64 = 0 + var u31 uint64 = 1 + _, _ = u30, u31 + var u32 uint64 = 18446744073709551615 + var u33 uint64 = +18446744073709551615 + if u32 != (1<<64)-1 { + panic("u32\n") + } + if u33 != (1<<64)-1 { + panic("u33\n") + } + var i34 int64 = ^0 // note: 2's complement means ^0 == -1 + if i34 != -1 { + panic("i34") + } } + /* bug12.go:5: overflow converting constant to UINT64 bug12.go:6: overflow converting constant to UINT64 diff --git a/test/fixedbugs/bug013.go b/test/fixedbugs/bug013.go index 045786bf7a..c80fe67c5a 100644 --- a/test/fixedbugs/bug013.go +++ b/test/fixedbugs/bug013.go @@ -7,10 +7,11 @@ package main func main() { - var cu0 uint16 = '\u1234'; - var cU1 uint32 = '\U00101234'; - _, _ = cu0, cU1; + var cu0 uint16 = '\u1234' + var cU1 uint32 = '\U00101234' + _, _ = cu0, cU1 } + /* bug13.go:4: missing ' bug13.go:4: syntax error diff --git a/test/fixedbugs/bug015.go b/test/fixedbugs/bug015.go index d3a9f22ed0..b00071e590 100644 --- a/test/fixedbugs/bug015.go +++ b/test/fixedbugs/bug015.go @@ -7,7 +7,7 @@ package main func main() { - var i33 int64; - if i33 == (1<<64) -1 { // ERROR "overflow" + var i33 int64 + if i33 == (1<<64)-1 { // ERROR "overflow" } } diff --git a/test/fixedbugs/bug017.go b/test/fixedbugs/bug017.go index 2f5960d104..6201124932 100644 --- a/test/fixedbugs/bug017.go +++ b/test/fixedbugs/bug017.go @@ -7,9 +7,10 @@ package main func main() { - var s2 string = "\a\b\f\n\r\t\v"; // \r is miscompiled - _ = s2; + var s2 string = "\a\b\f\n\r\t\v" // \r is miscompiled + _ = s2 } + /* main.go.c: In function ‘main_main’: main.go.c:20: error: missing terminating " character diff --git a/test/fixedbugs/bug020.go b/test/fixedbugs/bug020.go index cde3f8679b..1dd2106b24 100644 --- a/test/fixedbugs/bug020.go +++ b/test/fixedbugs/bug020.go @@ -6,10 +6,10 @@ package main -var digits string; +var digits string func putint(buf []byte, i, base, val int, digits string) { - buf[i] = digits[val]; + buf[i] = digits[val] } func main() { diff --git a/test/fixedbugs/bug021.go b/test/fixedbugs/bug021.go index bf936e875c..fcbebc7397 100644 --- a/test/fixedbugs/bug021.go +++ b/test/fixedbugs/bug021.go @@ -7,7 +7,7 @@ package main func main() { - s1 := "hi"; - s2 := "ho"; - s1 += s2; + s1 := "hi" + s2 := "ho" + s1 += s2 } diff --git a/test/fixedbugs/bug022.go b/test/fixedbugs/bug022.go index 65a8bfe9a1..8395ab36a1 100644 --- a/test/fixedbugs/bug022.go +++ b/test/fixedbugs/bug022.go @@ -7,15 +7,15 @@ package main func putint(digits *string) { - var i byte; - i = (*digits)[7]; // compiles - i = digits[7]; // ERROR "illegal|is not|invalid" - _ = i; + var i byte + i = (*digits)[7] // compiles + i = digits[7] // ERROR "illegal|is not|invalid" + _ = i } func main() { - s := "asdfasdfasdfasdf"; - putint(&s); + s := "asdfasdfasdfasdf" + putint(&s) } /* diff --git a/test/fixedbugs/bug023.go b/test/fixedbugs/bug023.go index 9b211cd54f..c3c77f7243 100644 --- a/test/fixedbugs/bug023.go +++ b/test/fixedbugs/bug023.go @@ -7,7 +7,7 @@ package main type Type interface { - TypeName() string; + TypeName() string } type TInt struct { @@ -15,14 +15,13 @@ type TInt struct { // TInt func (i *TInt) TypeName() string { - return "int"; + return "int" } - func main() { - var t Type; - t = nil; - _ = t; + var t Type + t = nil + _ = t } /* diff --git a/test/fixedbugs/bug024.go b/test/fixedbugs/bug024.go index 2e235b7b46..6e3af02f2c 100644 --- a/test/fixedbugs/bug024.go +++ b/test/fixedbugs/bug024.go @@ -7,13 +7,14 @@ package main func main() { - var i int; - i = '\''; - i = '\\'; - var s string; - s = "\""; - _, _ = i, s; + var i int + i = '\'' + i = '\\' + var s string + s = "\"" + _, _ = i, s } + /* bug.go:5: unknown escape sequence: ' bug.go:6: unknown escape sequence: \ diff --git a/test/fixedbugs/bug026.go b/test/fixedbugs/bug026.go index bfd03cc955..edb2b5685e 100644 --- a/test/fixedbugs/bug026.go +++ b/test/fixedbugs/bug026.go @@ -15,12 +15,12 @@ type Vector struct { func (v *Vector) Insert(i int, e Element) { } - func main() { - type I struct { val int; }; // BUG: can't be local; works if global - v := new(Vector); - v.Insert(0, new(I)); + type I struct{ val int } // BUG: can't be local; works if global + v := new(Vector) + v.Insert(0, new(I)) } + /* check: main_sigs_I: not defined */ diff --git a/test/fixedbugs/bug028.go b/test/fixedbugs/bug028.go index 2edf5a9106..cd41b09de3 100644 --- a/test/fixedbugs/bug028.go +++ b/test/fixedbugs/bug028.go @@ -6,22 +6,23 @@ package main - func Alloc(i int) int { switch i { default: - return 5; + return 5 case 1: - return 1; + return 1 case 10: - return 10; + return 10 } return 0 } func main() { - s := Alloc(7); - if s != 5 { panic("bad") } + s := Alloc(7) + if s != 5 { + panic("bad") + } } /* diff --git a/test/fixedbugs/bug030.go b/test/fixedbugs/bug030.go index ffd29e057a..93bb2e9e3b 100644 --- a/test/fixedbugs/bug030.go +++ b/test/fixedbugs/bug030.go @@ -7,7 +7,7 @@ package main func main() { - var x int; - x := 0; // ERROR "declar|:=" - _ = x; + var x int + x := 0 // ERROR "declar|:=" + _ = x } diff --git a/test/fixedbugs/bug031.go b/test/fixedbugs/bug031.go index 529e5ce84c..10028c5d1d 100644 --- a/test/fixedbugs/bug031.go +++ b/test/fixedbugs/bug031.go @@ -7,23 +7,23 @@ package main func main() { -prog := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ -"xxxxxxxxxx"+ -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xxxxxxxxxxxxxxxxxxxx" + + "xxxxxxxx" + + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + _ = prog } /* Segmentation fault */ diff --git a/test/fixedbugs/bug037.go b/test/fixedbugs/bug037.go index f17fb3fd74..e66349a2b7 100644 --- a/test/fixedbugs/bug037.go +++ b/test/fixedbugs/bug037.go @@ -7,5 +7,5 @@ package main func main() { - s := vlong(0); // ERROR "undef" + s := vlong(0) // ERROR "undef" } diff --git a/test/fixedbugs/bug039.go b/test/fixedbugs/bug039.go index d34f5e62e4..847ac241db 100644 --- a/test/fixedbugs/bug039.go +++ b/test/fixedbugs/bug039.go @@ -6,6 +6,6 @@ package main -func f (x int) { // GCCGO_ERROR "previous" - var x int; // ERROR "redecl|redefinition" +func f(x int) { // GCCGO_ERROR "previous" + var x int // ERROR "redecl|redefinition" } diff --git a/test/fixedbugs/bug040.go b/test/fixedbugs/bug040.go index d2cf88afcb..cb1e35f3e3 100644 --- a/test/fixedbugs/bug040.go +++ b/test/fixedbugs/bug040.go @@ -6,6 +6,6 @@ package main -func f (x, // GCCGO_ERROR "previous" - x int) { // ERROR "duplicate argument|redefinition" +func f(x, // GCCGO_ERROR "previous" + x int) { // ERROR "duplicate argument|redefinition" } diff --git a/test/fixedbugs/bug045.go b/test/fixedbugs/bug045.go index c66a2411a8..a15e16343e 100644 --- a/test/fixedbugs/bug045.go +++ b/test/fixedbugs/bug045.go @@ -11,11 +11,12 @@ type T struct { } func main() { - var ta []*T; + var ta []*T - ta = new([1]*T)[0:]; - ta[0] = nil; + ta = new([1]*T)[0:] + ta[0] = nil } + /* bug045.go:13: fatal error: goc: exit 1 */ diff --git a/test/fixedbugs/bug046.go b/test/fixedbugs/bug046.go index 219e91d537..2ef98177de 100644 --- a/test/fixedbugs/bug046.go +++ b/test/fixedbugs/bug046.go @@ -6,9 +6,9 @@ package main -type T *struct {} +type T *struct{} -func (x T) M () {} // ERROR "pointer|receiver" +func (x T) M() {} // ERROR "pointer|receiver" /* bug046.go:7: illegal pointer diff --git a/test/fixedbugs/bug048.go b/test/fixedbugs/bug048.go index 48ad751e2c..112343c77f 100644 --- a/test/fixedbugs/bug048.go +++ b/test/fixedbugs/bug048.go @@ -7,7 +7,7 @@ package main func main() { - type M map[int] int; - m1 := M{7 : 8}; - _ = m1; + type M map[int]int + m1 := M{7: 8} + _ = m1 } diff --git a/test/fixedbugs/bug049.go b/test/fixedbugs/bug049.go index 51990f2dfb..7de429c80c 100644 --- a/test/fixedbugs/bug049.go +++ b/test/fixedbugs/bug049.go @@ -7,8 +7,8 @@ package main func atom(s string) { - if s == nil { // ERROR "nil|incompatible" - return; + if s == nil { // ERROR "nil|incompatible" + return } } diff --git a/test/fixedbugs/bug051.go b/test/fixedbugs/bug051.go index c4ba2eff67..e337f960d7 100644 --- a/test/fixedbugs/bug051.go +++ b/test/fixedbugs/bug051.go @@ -7,9 +7,9 @@ package main func f() int { - return 0; + return 0 } func main() { - const n = f(); // ERROR "const" + const n = f() // ERROR "const" } diff --git a/test/fixedbugs/bug052.go b/test/fixedbugs/bug052.go index 440a00ebeb..ec372b33cc 100644 --- a/test/fixedbugs/bug052.go +++ b/test/fixedbugs/bug052.go @@ -7,14 +7,14 @@ package main func main() { - c := 10; - d := 7; - var x [10]int; - i := 0; + c := 10 + d := 7 + var x [10]int + i := 0 /* this works: q := c/d; x[i] = q; */ // this doesn't: - x[i] = c/d; // BUG segmentation fault + x[i] = c / d // BUG segmentation fault } diff --git a/test/fixedbugs/bug053.go b/test/fixedbugs/bug053.go index 00625fd7c3..8a8b4be5cf 100644 --- a/test/fixedbugs/bug053.go +++ b/test/fixedbugs/bug053.go @@ -7,6 +7,6 @@ package main func main() { - var len int; // len should not be a keyword - this doesn't compile - _ = len; + var len int // len should not be a keyword - this doesn't compile + _ = len } diff --git a/test/fixedbugs/bug054.go b/test/fixedbugs/bug054.go index 01590585c5..064696bd5c 100644 --- a/test/fixedbugs/bug054.go +++ b/test/fixedbugs/bug054.go @@ -10,31 +10,31 @@ type Element interface { } type Vector struct { - elem []Element; + elem []Element } func (v *Vector) At(i int) Element { - return v.elem[i]; + return v.elem[i] } type TStruct struct { - name string; - fields *Vector; + name string + fields *Vector } func (s *TStruct) field(i int) *TStruct { - return s.fields.At(i).(*TStruct); + return s.fields.At(i).(*TStruct) } func main() { - v := new(Vector); - v.elem = make([]Element, 10); - t := new(TStruct); - t.name = "hi"; - v.elem[0] = t; - s := new(TStruct); - s.name = "foo"; - s.fields = v; + v := new(Vector) + v.elem = make([]Element, 10) + t := new(TStruct) + t.name = "hi" + v.elem[0] = t + s := new(TStruct) + s.name = "foo" + s.fields = v if s.field(0).name != "hi" { panic("bad name") } diff --git a/test/fixedbugs/bug056.go b/test/fixedbugs/bug056.go index 13eac29204..dfee21b8bf 100644 --- a/test/fixedbugs/bug056.go +++ b/test/fixedbugs/bug056.go @@ -11,8 +11,8 @@ func frexp() (a int, b float64) { } func main() { - a, b := frexp(); - _, _ = a, b; + a, b := frexp() + _, _ = a, b } /* diff --git a/test/fixedbugs/bug057.go b/test/fixedbugs/bug057.go index 19b8651a54..9df1acd077 100644 --- a/test/fixedbugs/bug057.go +++ b/test/fixedbugs/bug057.go @@ -7,16 +7,15 @@ package main type T struct { - s string; + s string } - func main() { - s := ""; - l1 := len(s); - var t T; - l2 := len(t.s); // BUG: cannot take len() of a string field - _, _ = l1, l2; + s := "" + l1 := len(s) + var t T + l2 := len(t.s) // BUG: cannot take len() of a string field + _, _ = l1, l2 } /* diff --git a/test/fixedbugs/bug058.go b/test/fixedbugs/bug058.go index 2b97dbf7c0..ec58317ff5 100644 --- a/test/fixedbugs/bug058.go +++ b/test/fixedbugs/bug058.go @@ -6,14 +6,15 @@ package main -type Box struct {}; -var m map[string] *Box; +type Box struct{} + +var m map[string]*Box func main() { - m := make(map[string] *Box); - s := "foo"; - var x *Box = nil; - m[s] = x; + m := make(map[string]*Box) + s := "foo" + var x *Box = nil + m[s] = x } /* diff --git a/test/fixedbugs/bug059.go b/test/fixedbugs/bug059.go index 6f64b9e0b1..4dbd297bc7 100644 --- a/test/fixedbugs/bug059.go +++ b/test/fixedbugs/bug059.go @@ -9,28 +9,28 @@ package main import "os" func P(a []string) string { - s := "{"; + s := "{" for i := 0; i < 2; i++ { if i > 0 { s += "," } - s += `"` + a[i] + `"`; + s += `"` + a[i] + `"` } - s +="}"; - return s; + s += "}" + return s } func main() { - m := make(map[string] []string); - as := new([2]string); - as[0] = "0"; - as[1] = "1"; - m["0"] = as[0:]; + m := make(map[string][]string) + as := new([2]string) + as[0] = "0" + as[1] = "1" + m["0"] = as[0:] - a := m["0"]; - a[0] = "x"; - m["0"][0] = "deleted"; + a := m["0"] + a[0] = "x" + m["0"][0] = "deleted" if m["0"][0] != "deleted" { - os.Exit(1); + os.Exit(1) } } diff --git a/test/fixedbugs/bug060.go b/test/fixedbugs/bug060.go index 8260729056..a97c1cd2fd 100644 --- a/test/fixedbugs/bug060.go +++ b/test/fixedbugs/bug060.go @@ -9,11 +9,11 @@ package main import "os" func main() { - m := make(map[int]int); - m[0] = 0; - m[0]++; + m := make(map[int]int) + m[0] = 0 + m[0]++ if m[0] != 1 { - print("map does not increment\n"); + print("map does not increment\n") os.Exit(1) } } diff --git a/test/fixedbugs/bug061.go b/test/fixedbugs/bug061.go index ae99b186d8..295d6f3b45 100644 --- a/test/fixedbugs/bug061.go +++ b/test/fixedbugs/bug061.go @@ -7,9 +7,9 @@ package main func main() { - var s string; - s = "0000000000000000000000000000000000000000000000000000000000"[0:7]; - _ = s; + var s string + s = "0000000000000000000000000000000000000000000000000000000000"[0:7] + _ = s } /* diff --git a/test/fixedbugs/bug062.go b/test/fixedbugs/bug062.go index 1cc5003655..1008f1af9c 100644 --- a/test/fixedbugs/bug062.go +++ b/test/fixedbugs/bug062.go @@ -7,5 +7,5 @@ package main func main() { - var s string = nil; // ERROR "illegal|invalid|incompatible|cannot" + var s string = nil // ERROR "illegal|invalid|incompatible|cannot" } diff --git a/test/fixedbugs/bug063.go b/test/fixedbugs/bug063.go index a3ae3f0962..8e586ac781 100644 --- a/test/fixedbugs/bug063.go +++ b/test/fixedbugs/bug063.go @@ -5,4 +5,5 @@ // license that can be found in the LICENSE file. package bug063 + const c = 0 ^ 0 diff --git a/test/fixedbugs/bug064.go b/test/fixedbugs/bug064.go index d8b3bea9a6..b186bfe6b5 100644 --- a/test/fixedbugs/bug064.go +++ b/test/fixedbugs/bug064.go @@ -6,17 +6,15 @@ package main -func -swap(x, y int) (u, v int) { +func swap(x, y int) (u, v int) { return y, x } -func -main() { - a := 1; - b := 2; - a, b = swap(swap(a, b)); +func main() { + a := 1 + b := 2 + a, b = swap(swap(a, b)) if a != 2 || b != 1 { - panic("bad swap"); + panic("bad swap") } } diff --git a/test/fixedbugs/bug065.go b/test/fixedbugs/bug065.go index a1e3b08bba..78b98d9621 100644 --- a/test/fixedbugs/bug065.go +++ b/test/fixedbugs/bug065.go @@ -7,6 +7,6 @@ package main func main() { - k, l, m := 0,0,0; - _, _, _ = k, l, m; + k, l, m := 0, 0, 0 + _, _, _ = k, l, m } diff --git a/test/fixedbugs/bug066.go b/test/fixedbugs/bug066.go index db3d7f8602..0d43d4c910 100644 --- a/test/fixedbugs/bug066.go +++ b/test/fixedbugs/bug066.go @@ -7,20 +7,17 @@ package bug066 type Scope struct { - entries map[string] *Object; + entries map[string]*Object } - type Type struct { - scope *Scope; + scope *Scope } - type Object struct { - typ *Type; + typ *Type } - func Lookup(scope *Scope) *Object { - return scope.entries["foo"]; + return scope.entries["foo"] } diff --git a/test/fixedbugs/bug067.go b/test/fixedbugs/bug067.go index aaeefb0ba1..f1aadb7c64 100644 --- a/test/fixedbugs/bug067.go +++ b/test/fixedbugs/bug067.go @@ -9,7 +9,7 @@ package main var c chan int func main() { - c = make(chan int); - go func() { c <- 0 } (); + c = make(chan int) + go func() { c <- 0 }() <-c } diff --git a/test/fixedbugs/bug069.go b/test/fixedbugs/bug069.go index 7b07b773d4..4dff02f474 100644 --- a/test/fixedbugs/bug069.go +++ b/test/fixedbugs/bug069.go @@ -7,14 +7,14 @@ package main func main() { - c := make(chan int); - ok := false; - var i int; - - i, ok = <-c; // works - _, _ = i, ok; - - ca := new([2]chan int); - i, ok = <-(ca[0]); // fails: c.go:11: bad shape across assignment - cr=1 cl=2 - _, _ = i, ok; + c := make(chan int) + ok := false + var i int + + i, ok = <-c // works + _, _ = i, ok + + ca := new([2]chan int) + i, ok = <-(ca[0]) // fails: c.go:11: bad shape across assignment - cr=1 cl=2 + _, _ = i, ok } diff --git a/test/fixedbugs/bug071.go b/test/fixedbugs/bug071.go index ec38f7a979..caae01c6ec 100644 --- a/test/fixedbugs/bug071.go +++ b/test/fixedbugs/bug071.go @@ -6,18 +6,18 @@ package bug071 -type rat struct { - den int; +type rat struct { + den int } func (u *rat) pr() { } type dch struct { - dat chan *rat; + dat chan *rat } -func dosplit(in *dch){ - dat := <-in.dat; - _ = dat; +func dosplit(in *dch) { + dat := <-in.dat + _ = dat } diff --git a/test/fixedbugs/bug072.go b/test/fixedbugs/bug072.go index 05ad93dac2..b6f46045b2 100644 --- a/test/fixedbugs/bug072.go +++ b/test/fixedbugs/bug072.go @@ -7,5 +7,5 @@ package main func main() { - s := string(bug); // ERROR "undef" + s := string(bug) // ERROR "undef" } diff --git a/test/fixedbugs/bug074.go b/test/fixedbugs/bug074.go index fb789cb4c1..e632e9bf4e 100644 --- a/test/fixedbugs/bug074.go +++ b/test/fixedbugs/bug074.go @@ -7,6 +7,6 @@ package main func main() { - x := string{'a', 'b', '\n'}; // ERROR "composite" - print(x); + x := string{'a', 'b', '\n'} // ERROR "composite" + print(x) } diff --git a/test/fixedbugs/bug075.go b/test/fixedbugs/bug075.go index d0b7d14e71..a568b5fa70 100644 --- a/test/fixedbugs/bug075.go +++ b/test/fixedbugs/bug075.go @@ -6,12 +6,13 @@ package main -type T struct { m map[int]int } +type T struct{ m map[int]int } + func main() { - t := new(T); - t.m = make(map[int]int); - var x int; - var ok bool; - x, ok = t.m[0]; //bug075.go:11: bad shape across assignment - cr=1 cl=2 - _, _ = x, ok; + t := new(T) + t.m = make(map[int]int) + var x int + var ok bool + x, ok = t.m[0] //bug075.go:11: bad shape across assignment - cr=1 cl=2 + _, _ = x, ok } diff --git a/test/fixedbugs/bug076.go b/test/fixedbugs/bug076.go index 60aaa97608..57401318c0 100644 --- a/test/fixedbugs/bug076.go +++ b/test/fixedbugs/bug076.go @@ -12,7 +12,6 @@ exit: goto exit } - func main() { exit: ; // this should be legal (labels not properly scoped?) @@ -20,6 +19,6 @@ exit: } /* -uetli:~/Source/go/test/bugs gri$ 6g bug076.go +uetli:~/Source/go/test/bugs gri$ 6g bug076.go bug076.go:11: label redeclared: exit */ diff --git a/test/fixedbugs/bug078.go b/test/fixedbugs/bug078.go index 1041b858c8..2a191dc24e 100644 --- a/test/fixedbugs/bug078.go +++ b/test/fixedbugs/bug078.go @@ -6,7 +6,7 @@ package main -func dosplit(wait chan int ){ +func dosplit(wait chan int) { select { case <-wait: } diff --git a/test/fixedbugs/bug083.dir/bug1.go b/test/fixedbugs/bug083.dir/bug1.go index ea5bcfe205..778688e072 100644 --- a/test/fixedbugs/bug083.dir/bug1.go +++ b/test/fixedbugs/bug083.dir/bug1.go @@ -10,5 +10,4 @@ import "./bug0" // visible here in package bug1. The test for failure is in // ../bug083.go. -var v1 bug0.t0; // ERROR "bug0" - +var v1 bug0.t0 // ERROR "bug0" diff --git a/test/fixedbugs/bug085.go b/test/fixedbugs/bug085.go index dae83f8a49..6182c6a645 100644 --- a/test/fixedbugs/bug085.go +++ b/test/fixedbugs/bug085.go @@ -9,7 +9,7 @@ package P var x int func foo() { - print(P.x); // ERROR "undefined" + print(P.x) // ERROR "undefined" } /* diff --git a/test/fixedbugs/bug086.go b/test/fixedbugs/bug086.go index 40d2362066..97aaa60f91 100644 --- a/test/fixedbugs/bug086.go +++ b/test/fixedbugs/bug086.go @@ -8,13 +8,13 @@ package main func f() int { if false { - return 0; + return 0 } // we should not be able to return successfully w/o a return statement } // ERROR "return" func main() { - print(f(), "\n"); + print(f(), "\n") } /* diff --git a/test/fixedbugs/bug087.go b/test/fixedbugs/bug087.go index 67e7210cdb..a973f8b348 100644 --- a/test/fixedbugs/bug087.go +++ b/test/fixedbugs/bug087.go @@ -6,11 +6,11 @@ package main -const s string = "foo"; +const s string = "foo" func main() { - i := len(s); // should be legal to take len() of a constant - _ = i; + i := len(s) // should be legal to take len() of a constant + _ = i } /* diff --git a/test/fixedbugs/bug088.dir/bug0.go b/test/fixedbugs/bug088.dir/bug0.go index 7a6e34747f..8bfda6a279 100644 --- a/test/fixedbugs/bug088.dir/bug0.go +++ b/test/fixedbugs/bug088.dir/bug0.go @@ -4,6 +4,6 @@ package bug0 -var V0 func() int; -var V1 func() (a int); -var V2 func() (a, b int); +var V0 func() int +var V1 func() (a int) +var V2 func() (a, b int) diff --git a/test/fixedbugs/bug088.dir/bug1.go b/test/fixedbugs/bug088.dir/bug1.go index 2568e37d02..98a4e7cfe4 100644 --- a/test/fixedbugs/bug088.dir/bug1.go +++ b/test/fixedbugs/bug088.dir/bug1.go @@ -7,10 +7,10 @@ package main import P "./bug0" func main() { - a0 := P.V0(); // works - a1 := P.V1(); // works - a2, b2 := P.V2(); // doesn't work - _, _, _, _ = a0, a1, a2, b2; + a0 := P.V0() // works + a1 := P.V1() // works + a2, b2 := P.V2() // doesn't work + _, _, _, _ = a0, a1, a2, b2 } /* diff --git a/test/fixedbugs/bug089.go b/test/fixedbugs/bug089.go index e88f17babb..e1a87801f0 100644 --- a/test/fixedbugs/bug089.go +++ b/test/fixedbugs/bug089.go @@ -6,16 +6,15 @@ package main -type I1 interface {} -type I2 interface { pr() } +type I1 interface{} +type I2 interface{ pr() } -func e() I1; +func e() I1 -var i1 I1; -var i2 I2; +var i1 I1 +var i2 I2 -func -main() { +func main() { - i2 = e().(I2); // bug089.go:16: fatal error: agen_inter i2i + i2 = e().(I2) // bug089.go:16: fatal error: agen_inter i2i } diff --git a/test/fixedbugs/bug090.go b/test/fixedbugs/bug090.go index 320bd57f5c..d074b30880 100644 --- a/test/fixedbugs/bug090.go +++ b/test/fixedbugs/bug090.go @@ -7,8 +7,8 @@ package main const ( - c3div2 = 3/2; - f3div2 = 3./2.; + c3div2 = 3 / 2 + f3div2 = 3. / 2. ) func assert(t bool, s string) { @@ -18,29 +18,29 @@ func assert(t bool, s string) { } func main() { - var i int; - var f float64; + var i int + var f float64 - assert(c3div2 == 1, "3/2"); - assert(f3div2 == 1.5, "3/2"); + assert(c3div2 == 1, "3/2") + assert(f3div2 == 1.5, "3/2") - i = c3div2; - assert(i == c3div2, "i == c3div2"); + i = c3div2 + assert(i == c3div2, "i == c3div2") - f = c3div2; - assert(f == c3div2, "f == c3div2"); + f = c3div2 + assert(f == c3div2, "f == c3div2") - f = f3div2; - assert(f == f3div2, "f == f3div2"); + f = f3div2 + assert(f == f3div2, "f == f3div2") - i = f3div2; // ERROR "truncate" - assert(i == c3div2, "i == c3div2 from f3div2"); - assert(i != f3div2, "i != f3div2"); // ERROR "truncate" + i = f3div2 // ERROR "truncate" + assert(i == c3div2, "i == c3div2 from f3div2") + assert(i != f3div2, "i != f3div2") // ERROR "truncate" - const g float64 = 1.0; - i = g; // ERROR "convert|incompatible|cannot" + const g float64 = 1.0 + i = g // ERROR "convert|incompatible|cannot" - const h float64 = 3.14; - i = h; // ERROR "convert|incompatible|cannot" - i = int(h); // ERROR "truncate" + const h float64 = 3.14 + i = h // ERROR "convert|incompatible|cannot" + i = int(h) // ERROR "truncate" } diff --git a/test/fixedbugs/bug092.go b/test/fixedbugs/bug092.go index 8027d941ea..b34969afd3 100644 --- a/test/fixedbugs/bug092.go +++ b/test/fixedbugs/bug092.go @@ -7,9 +7,9 @@ package main func main() { - var a [1000] int64; // this alone works - var b [10000] int64; // this causes a runtime crash - _, _ = a, b; + var a [1000]int64 // this alone works + var b [10000]int64 // this causes a runtime crash + _, _ = a, b } /* diff --git a/test/fixedbugs/bug093.go b/test/fixedbugs/bug093.go index acd94466f5..a3a626a1b0 100644 --- a/test/fixedbugs/bug093.go +++ b/test/fixedbugs/bug093.go @@ -13,16 +13,15 @@ func (p *S) M() { } type I interface { - M(); + M() } func main() { - var p *S = nil; - var i I = p; // this should be possible even though p is nil: we still know the type - i.M(); // should be possible since we know the type, and don't ever use the receiver + var p *S = nil + var i I = p // this should be possible even though p is nil: we still know the type + i.M() // should be possible since we know the type, and don't ever use the receiver } - /* throw: ifaces2i: nil pointer SIGSEGV: segmentation violation diff --git a/test/fixedbugs/bug094.go b/test/fixedbugs/bug094.go index 3ef11da3d3..4456237302 100644 --- a/test/fixedbugs/bug094.go +++ b/test/fixedbugs/bug094.go @@ -7,19 +7,17 @@ package main func f0() { - const x = 0; + const x = 0 } - func f1() { - x := 0; - _ = x; + x := 0 + _ = x } - func main() { - f0(); - f1(); + f0() + f1() } /* diff --git a/test/fixedbugs/bug096.go b/test/fixedbugs/bug096.go index 411ba74e0c..39ce017bb7 100644 --- a/test/fixedbugs/bug096.go +++ b/test/fixedbugs/bug096.go @@ -6,12 +6,12 @@ package main -type A []int; +type A []int func main() { - a := &A{0}; - b := &A{0, 1}; - _, _ = a, b; + a := &A{0} + b := &A{0, 1} + _, _ = a, b } /* diff --git a/test/fixedbugs/bug098.go b/test/fixedbugs/bug098.go index eb4ee4de03..b872b50fa7 100644 --- a/test/fixedbugs/bug098.go +++ b/test/fixedbugs/bug098.go @@ -6,13 +6,13 @@ package main -type A []int; -type M map[int] int; +type A []int +type M map[int]int func main() { - var a *A = &A{0}; - var m *M = &M{0 : 0}; // should be legal to use & here for consistency with other composite constructors (prev. line) - _, _ = a, m; + var a *A = &A{0} + var m *M = &M{0: 0} // should be legal to use & here for consistency with other composite constructors (prev. line) + _, _ = a, m } /* diff --git a/test/fixedbugs/bug099.go b/test/fixedbugs/bug099.go index 03a5c454b0..51b667bca8 100644 --- a/test/fixedbugs/bug099.go +++ b/test/fixedbugs/bug099.go @@ -7,10 +7,11 @@ package main // Interface -type I interface { F() int } +type I interface{ F() int } // Implements interface -type S struct { } +type S struct{} + func (s *S) F() int { return 1 } // Allocates S but returns I @@ -27,11 +28,10 @@ func Use(x I) { } func main() { - i := NewI(0); - Use(i); + i := NewI(0) + Use(i) // Again, without temporary // Crashes because x.F is 0. - Use(NewI(0)); + Use(NewI(0)) } - diff --git a/test/fixedbugs/bug101.go b/test/fixedbugs/bug101.go index 82e496a8a6..5afc4b6dda 100644 --- a/test/fixedbugs/bug101.go +++ b/test/fixedbugs/bug101.go @@ -6,10 +6,14 @@ package main -var a = []int { 1, 2, 3 } +var a = []int{1, 2, 3} func main() { - if len(a) != 3 { panic("array len") } + if len(a) != 3 { + panic("array len") + } // print(a[0], " ", a[1], " ", a[2], "\n") - if a[0] != 1 || a[1] != 2 || a[2] != 3 { panic("array contents") } + if a[0] != 1 || a[1] != 2 || a[2] != 3 { + panic("array contents") + } } diff --git a/test/fixedbugs/bug103.go b/test/fixedbugs/bug103.go index 1cb710e368..c79ebf25cb 100644 --- a/test/fixedbugs/bug103.go +++ b/test/fixedbugs/bug103.go @@ -6,9 +6,8 @@ package main -func f() /* no return type */ {} +func f()/* no return type */ {} func main() { - x := f(); // ERROR "mismatch|as value|no type" + x := f() // ERROR "mismatch|as value|no type" } - diff --git a/test/fixedbugs/bug104.go b/test/fixedbugs/bug104.go index f0c19a8aa7..0e32d94262 100644 --- a/test/fixedbugs/bug104.go +++ b/test/fixedbugs/bug104.go @@ -5,6 +5,7 @@ // license that can be found in the LICENSE file. package main + func f() string { - return 0 // ERROR "conversion|type" + return 0 // ERROR "conversion|type" } diff --git a/test/fixedbugs/bug106.dir/bug1.go b/test/fixedbugs/bug106.dir/bug1.go index eff0d36ed2..eae2abbbaa 100644 --- a/test/fixedbugs/bug106.dir/bug1.go +++ b/test/fixedbugs/bug106.dir/bug1.go @@ -5,4 +5,3 @@ package bug1 import _ "./bug0" - diff --git a/test/fixedbugs/bug107.go b/test/fixedbugs/bug107.go index dcd8e9d113..198a1f40f3 100644 --- a/test/fixedbugs/bug107.go +++ b/test/fixedbugs/bug107.go @@ -5,11 +5,14 @@ // license that can be found in the LICENSE file. package main + import os "os" + type _ os.FileInfo + func f() (os int) { - // In the next line "os" should refer to the result variable, not - // to the package. - v := os.Open("", 0, 0); // ERROR "undefined" - return 0 + // In the next line "os" should refer to the result variable, not + // to the package. + v := os.Open("", 0, 0) // ERROR "undefined" + return 0 } diff --git a/test/fixedbugs/bug108.go b/test/fixedbugs/bug108.go index cfec4c9f1f..a0f979c3ea 100644 --- a/test/fixedbugs/bug108.go +++ b/test/fixedbugs/bug108.go @@ -5,7 +5,8 @@ // license that can be found in the LICENSE file. package main + func f() { - v := 1 << 1025; // ERROR "overflow|shift count too large" + v := 1 << 1025 // ERROR "overflow|shift count too large" _ = v } diff --git a/test/fixedbugs/bug111.go b/test/fixedbugs/bug111.go index d977bd54fb..c30afbb6d2 100644 --- a/test/fixedbugs/bug111.go +++ b/test/fixedbugs/bug111.go @@ -6,7 +6,7 @@ package main -var ncall int; +var ncall int type Iffy interface { Me() Iffy @@ -17,15 +17,15 @@ type Stucky struct { } func (s *Stucky) Me() Iffy { - ncall++; + ncall++ return s } func main() { - s := new(Stucky); - i := s.Me(); - j := i.Me(); - j.Me(); + s := new(Stucky) + i := s.Me() + j := i.Me() + j.Me() if ncall != 3 { panic("bug111") } diff --git a/test/fixedbugs/bug112.go b/test/fixedbugs/bug112.go index e2ed5c0d41..2928bc15b5 100644 --- a/test/fixedbugs/bug112.go +++ b/test/fixedbugs/bug112.go @@ -6,7 +6,8 @@ package main -type T struct { s string } +type T struct{ s string } + var t = T{"hi"} func main() {} diff --git a/test/fixedbugs/bug113.go b/test/fixedbugs/bug113.go index a1e61cb36f..03e22c0558 100644 --- a/test/fixedbugs/bug113.go +++ b/test/fixedbugs/bug113.go @@ -21,7 +21,7 @@ func main() { if foo2(v2) != 1 { panic(2) } - + shouldPanic(p1) } diff --git a/test/fixedbugs/bug115.go b/test/fixedbugs/bug115.go index 7cc3dc40a6..726d33c124 100644 --- a/test/fixedbugs/bug115.go +++ b/test/fixedbugs/bug115.go @@ -6,9 +6,9 @@ package main -func isuint(i uint) { } +func isuint(i uint) {} func main() { - i := ^uint(0); - isuint(i); + i := ^uint(0) + isuint(i) } diff --git a/test/fixedbugs/bug118.go b/test/fixedbugs/bug118.go index 198b8ff280..ca7fdbba5d 100644 --- a/test/fixedbugs/bug118.go +++ b/test/fixedbugs/bug118.go @@ -9,7 +9,7 @@ package bug118 func Send(c chan int) int { select { default: - return 1; + return 1 } - return 2; + return 2 } diff --git a/test/fixedbugs/bug122.go b/test/fixedbugs/bug122.go index fb4eb9f3ad..9ae597462d 100644 --- a/test/fixedbugs/bug122.go +++ b/test/fixedbugs/bug122.go @@ -8,5 +8,5 @@ package main func main() { // should allow at most 2 sizes - a := make([]int, 10, 20, 30, 40); // ERROR "too many" + a := make([]int, 10, 20, 30, 40) // ERROR "too many" } diff --git a/test/fixedbugs/bug123.go b/test/fixedbugs/bug123.go index f38551a914..8c4f323761 100644 --- a/test/fixedbugs/bug123.go +++ b/test/fixedbugs/bug123.go @@ -5,9 +5,13 @@ // license that can be found in the LICENSE file. package main -const ( F = 1 ) + +const ( + F = 1 +) + func fn(i int) int { - if i == F() { // ERROR "func" + if i == F() { // ERROR "func" return 0 } return 1 diff --git a/test/fixedbugs/bug126.go b/test/fixedbugs/bug126.go index f5d9763412..8274c1e931 100644 --- a/test/fixedbugs/bug126.go +++ b/test/fixedbugs/bug126.go @@ -7,5 +7,5 @@ package main // same const identifier declared twice should not be accepted -const none = 0 // GCCGO_ERROR "previous" -const none = 1; // ERROR "redeclared|redef" +const none = 0 // GCCGO_ERROR "previous" +const none = 1 // ERROR "redeclared|redef" diff --git a/test/fixedbugs/bug127.go b/test/fixedbugs/bug127.go index f8ea99470c..573c40c681 100644 --- a/test/fixedbugs/bug127.go +++ b/test/fixedbugs/bug127.go @@ -5,8 +5,9 @@ // license that can be found in the LICENSE file. package main + func main() { - var x int64 = 0; - println(x != nil); // ERROR "illegal|incompatible|nil" - println(0 != nil); // ERROR "illegal|incompatible|nil" + var x int64 = 0 + println(x != nil) // ERROR "illegal|incompatible|nil" + println(0 != nil) // ERROR "illegal|incompatible|nil" } diff --git a/test/fixedbugs/bug128.go b/test/fixedbugs/bug128.go index e8cbea079f..7389426c57 100644 --- a/test/fixedbugs/bug128.go +++ b/test/fixedbugs/bug128.go @@ -5,19 +5,20 @@ // license that can be found in the LICENSE file. package main + func main() { switch { - // empty switch is allowed according to syntax - // unclear why it shouldn't be allowed + // empty switch is allowed according to syntax + // unclear why it shouldn't be allowed } switch tag := 0; tag { - // empty switch is allowed according to syntax - // unclear why it shouldn't be allowed + // empty switch is allowed according to syntax + // unclear why it shouldn't be allowed } } /* -uetli:~/Source/go1/test/bugs gri$ 6g bug127.go +uetli:~/Source/go1/test/bugs gri$ 6g bug127.go bug127.go:5: switch statement must have case labels bug127.go:9: switch statement must have case labels */ diff --git a/test/fixedbugs/bug129.go b/test/fixedbugs/bug129.go index 157ce78ff7..64666e9377 100644 --- a/test/fixedbugs/bug129.go +++ b/test/fixedbugs/bug129.go @@ -5,10 +5,11 @@ // license that can be found in the LICENSE file. package foo + import "fmt" func f() { - fmt.Println(); - fmt := 1; - _ = fmt; + fmt.Println() + fmt := 1 + _ = fmt } diff --git a/test/fixedbugs/bug130.go b/test/fixedbugs/bug130.go index 16b029af34..ba38bb5551 100644 --- a/test/fixedbugs/bug130.go +++ b/test/fixedbugs/bug130.go @@ -8,15 +8,16 @@ package main import "os" -type I interface { send(chan <- int) } +type I interface{ send(chan<- int) } -type S struct { v int } -func (p *S) send(c chan <- int) { c <- p.v } +type S struct{ v int } + +func (p *S) send(c chan<- int) { c <- p.v } func main() { - s := S{0}; - var i I = &s; - c := make(chan int); - go i.send(c); - os.Exit(<-c); + s := S{0} + var i I = &s + c := make(chan int) + go i.send(c) + os.Exit(<-c) } diff --git a/test/fixedbugs/bug131.go b/test/fixedbugs/bug131.go index 0ebbd26069..de606da167 100644 --- a/test/fixedbugs/bug131.go +++ b/test/fixedbugs/bug131.go @@ -7,6 +7,6 @@ package main func main() { - const a uint64 = 10; - var b int64 = a; // ERROR "convert|cannot|incompatible" + const a uint64 = 10 + var b int64 = a // ERROR "convert|cannot|incompatible" } diff --git a/test/fixedbugs/bug132.go b/test/fixedbugs/bug132.go index e334566c79..b9b9e6712b 100644 --- a/test/fixedbugs/bug132.go +++ b/test/fixedbugs/bug132.go @@ -7,5 +7,5 @@ package main type T struct { - x, x int // ERROR "duplicate" + x, x int // ERROR "duplicate" } diff --git a/test/fixedbugs/bug133.dir/bug0.go b/test/fixedbugs/bug133.dir/bug0.go index 19a2bfbd4b..052de3d7ac 100644 --- a/test/fixedbugs/bug133.dir/bug0.go +++ b/test/fixedbugs/bug133.dir/bug0.go @@ -4,4 +4,4 @@ package bug0 -type T struct { i int } +type T struct{ i int } diff --git a/test/fixedbugs/bug133.dir/bug1.go b/test/fixedbugs/bug133.dir/bug1.go index dd59b2f2ec..d47746e4b5 100644 --- a/test/fixedbugs/bug133.dir/bug1.go +++ b/test/fixedbugs/bug133.dir/bug1.go @@ -6,4 +6,4 @@ package bug1 import "./bug0" -type T struct { t bug0.T } +type T struct{ t bug0.T } diff --git a/test/fixedbugs/bug133.dir/bug2.go b/test/fixedbugs/bug133.dir/bug2.go index b6184c2e75..4449ded991 100644 --- a/test/fixedbugs/bug133.dir/bug2.go +++ b/test/fixedbugs/bug133.dir/bug2.go @@ -7,10 +7,10 @@ package bug2 import _ "./bug1" import "./bug0" -type T2 struct { t bug0.T } +type T2 struct{ t bug0.T } func fn(p *T2) int { // This reference should be invalid, because bug0.T.i is local // to package bug0 and should not be visible in package bug1. - return p.t.i; // ERROR "field|undef" + return p.t.i // ERROR "field|undef" } diff --git a/test/fixedbugs/bug135.go b/test/fixedbugs/bug135.go index 34d234e224..5cca2b252d 100644 --- a/test/fixedbugs/bug135.go +++ b/test/fixedbugs/bug135.go @@ -6,14 +6,15 @@ package main -type Foo interface { } +type Foo interface{} + +type T struct{} -type T struct {} func (t *T) foo() {} func main() { - t := new(T); - var i interface {}; - f, ok := i.(Foo); - _, _, _ = t, f, ok; + t := new(T) + var i interface{} + f, ok := i.(Foo) + _, _, _ = t, f, ok } diff --git a/test/fixedbugs/bug136.go b/test/fixedbugs/bug136.go index bea9bac083..2964176afd 100644 --- a/test/fixedbugs/bug136.go +++ b/test/fixedbugs/bug136.go @@ -7,16 +7,18 @@ package main func main() { - L: ; // ';' terminates empty statement => L does not apply to for loop +L: + ; // ';' terminates empty statement => L does not apply to for loop for i := 0; i < 10; i++ { - println(i); - break L; // ERROR "L" + println(i) + break L // ERROR "L" } - L1: { // L1 labels block => L1 does not apply to for loop +L1: + { // L1 labels block => L1 does not apply to for loop for i := 0; i < 10; i++ { - println(i); - break L1; // ERROR "L1" + println(i) + break L1 // ERROR "L1" } } } diff --git a/test/fixedbugs/bug139.go b/test/fixedbugs/bug139.go index 095e5c93cc..610a2b87a2 100644 --- a/test/fixedbugs/bug139.go +++ b/test/fixedbugs/bug139.go @@ -7,9 +7,17 @@ package main func main() { - x := false; - func () { if x { println(1); } }(); // this does not compile - func () { if x == false { println(2); } }(); // this works as expected + x := false + func() { + if x { + println(1) + } + }() // this does not compile + func() { + if x == false { + println(2) + } + }() // this works as expected } /* diff --git a/test/fixedbugs/bug141.go b/test/fixedbugs/bug141.go index 81ba6f1b56..f905681b6a 100644 --- a/test/fixedbugs/bug141.go +++ b/test/fixedbugs/bug141.go @@ -8,25 +8,29 @@ package main import "os" -type S struct { i int } +type S struct{ i int } + func (p *S) Get() int { return p.i } type Empty interface { } type Getter interface { - Get() int; + Get() int } func f1(p Empty) { switch x := p.(type) { - default: println("failed to match interface", x); os.Exit(1); - case Getter: break; + default: + println("failed to match interface", x) + os.Exit(1) + case Getter: + break } } func main() { - var s S; - f1(&s); + var s S + f1(&s) } diff --git a/test/fixedbugs/bug142.go b/test/fixedbugs/bug142.go index e28d889a93..083b6ac8ac 100644 --- a/test/fixedbugs/bug142.go +++ b/test/fixedbugs/bug142.go @@ -7,12 +7,12 @@ package main func panic1(s string) bool { - panic(s); + panic(s) } func main() { - x := false && panic1("first") && panic1("second"); - x = x == true && panic1("first") && panic1("second"); + x := false && panic1("first") && panic1("second") + x = x == true && panic1("first") && panic1("second") } /* @@ -27,5 +27,5 @@ mainstart+0xf /Users/rsc/goX/src/runtime/amd64/asm.s:53 mainstart() sys·Goexit /Users/rsc/goX/src/runtime/proc.c:124 sys·Goexit() -; +; */ diff --git a/test/fixedbugs/bug143.go b/test/fixedbugs/bug143.go index a43e406676..c4378f27ad 100644 --- a/test/fixedbugs/bug143.go +++ b/test/fixedbugs/bug143.go @@ -6,34 +6,34 @@ package main -type myMap map[string] int; +type myMap map[string]int func f() myMap { - m := make(map[string] int); + m := make(map[string]int) return m } func main() { - m := make(myMap); - mp := &m; + m := make(myMap) + mp := &m { - x, ok := m["key"]; - _, _ = x, ok; + x, ok := m["key"] + _, _ = x, ok } { - x, ok := (*mp)["key"]; - _, _ = x, ok; + x, ok := (*mp)["key"] + _, _ = x, ok } { - x, ok := f()["key"]; - _, _ = x, ok; + x, ok := f()["key"] + _, _ = x, ok } { - var x int; - var ok bool; - x, ok = f()["key"]; - _, _ = x, ok; + var x int + var ok bool + x, ok = f()["key"] + _, _ = x, ok } } diff --git a/test/fixedbugs/bug144.go b/test/fixedbugs/bug144.go index 9f8ec7667c..f42e64ee98 100644 --- a/test/fixedbugs/bug144.go +++ b/test/fixedbugs/bug144.go @@ -6,11 +6,11 @@ package main -const c = 1; +const c = 1 func main() { - c := 0; - _ = c; + c := 0 + _ = c } /* diff --git a/test/fixedbugs/bug145.go b/test/fixedbugs/bug145.go index 602fe7426d..44bce2a610 100644 --- a/test/fixedbugs/bug145.go +++ b/test/fixedbugs/bug145.go @@ -9,8 +9,8 @@ package main type t int func main() { - t := 0; - _ = t; + t := 0 + _ = t } /* diff --git a/test/fixedbugs/bug146.go b/test/fixedbugs/bug146.go index e29f910ba5..fcdeb4ce42 100644 --- a/test/fixedbugs/bug146.go +++ b/test/fixedbugs/bug146.go @@ -7,9 +7,9 @@ package main func main() { - type Slice []byte; - a := [...]byte{ 0 }; - b := Slice(a[0:]); // This should be OK. - c := Slice(a); // ERROR "invalid|illegal|cannot" - _, _ = b, c; + type Slice []byte + a := [...]byte{0} + b := Slice(a[0:]) // This should be OK. + c := Slice(a) // ERROR "invalid|illegal|cannot" + _, _ = b, c } diff --git a/test/fixedbugs/bug148.go b/test/fixedbugs/bug148.go index b67870b12a..e7b544439e 100644 --- a/test/fixedbugs/bug148.go +++ b/test/fixedbugs/bug148.go @@ -6,32 +6,32 @@ package main -type T struct {a, b int}; +type T struct{ a, b int } -func println(x, y int) { } +func println(x, y int) {} func f(x interface{}) interface{} { - type T struct {a, b int}; + type T struct{ a, b int } if x == nil { - return T{2, 3}; + return T{2, 3} } - t := x.(T); - println(t.a, t.b); - return x; + t := x.(T) + println(t.a, t.b) + return x } func main() { - inner_T := f(nil); - f(inner_T); + inner_T := f(nil) + f(inner_T) shouldPanic(p1) } func p1() { - outer_T := T{5, 7}; - f(outer_T); + outer_T := T{5, 7} + f(outer_T) } func shouldPanic(f func()) { diff --git a/test/fixedbugs/bug149.go b/test/fixedbugs/bug149.go index 78b687e971..d18c7479ba 100644 --- a/test/fixedbugs/bug149.go +++ b/test/fixedbugs/bug149.go @@ -7,16 +7,16 @@ package main func main() { - var b1 []byte; - s1 := string(b1); - println(len(s1)); // prints 0 + var b1 []byte + s1 := string(b1) + println(len(s1)) // prints 0 - b2 := ([]byte)(nil); - s2 := string(b2); - println(len(s2)); // prints 0 + b2 := ([]byte)(nil) + s2 := string(b2) + println(len(s2)) // prints 0 - s3 := string(([]byte)(nil)); // does not compile (literal substitution of b2) - println(len(s3)); + s3 := string(([]byte)(nil)) // does not compile (literal substitution of b2) + println(len(s3)) } /* diff --git a/test/fixedbugs/bug150.go b/test/fixedbugs/bug150.go index b565ef73dd..b2c4f15dc4 100644 --- a/test/fixedbugs/bug150.go +++ b/test/fixedbugs/bug150.go @@ -7,15 +7,16 @@ package bug150 type T int + func (t T) M() -type M interface { M() } +type M interface{ M() } func g() (T, T) func f() (a, b M) { - a, b = g(); - return; + a, b = g() + return } /* diff --git a/test/fixedbugs/bug151.go b/test/fixedbugs/bug151.go index d9f5e021c9..87a9c0201d 100644 --- a/test/fixedbugs/bug151.go +++ b/test/fixedbugs/bug151.go @@ -8,10 +8,10 @@ package bug151 type S string -type Empty interface {} +type Empty interface{} func (v S) Less(e Empty) bool { - return v < e.(S); + return v < e.(S) } /* diff --git a/test/fixedbugs/bug152.go b/test/fixedbugs/bug152.go index 45b9b3d530..2f297656e4 100644 --- a/test/fixedbugs/bug152.go +++ b/test/fixedbugs/bug152.go @@ -7,11 +7,11 @@ package main func main() { - s := 0; + s := 0 for _, v := range []int{1} { - s += v; + s += v } if s != 1 { - println("BUG: s =", s); + println("BUG: s =", s) } } diff --git a/test/fixedbugs/bug154.go b/test/fixedbugs/bug154.go index a2cfd4accd..3162e80a4f 100644 --- a/test/fixedbugs/bug154.go +++ b/test/fixedbugs/bug154.go @@ -9,25 +9,23 @@ package main import "fmt" func f0() string { - const f = 3.141592; - return fmt.Sprintf("%v", float64(f)); + const f = 3.141592 + return fmt.Sprintf("%v", float64(f)) } - func f1() string { - const f = 3.141592; - x := float64(float32(f)); // appears to change the precision of f - _ = x; - return fmt.Sprintf("%v", float64(f)); + const f = 3.141592 + x := float64(float32(f)) // appears to change the precision of f + _ = x + return fmt.Sprintf("%v", float64(f)) } - func main() { - r0 := f0(); - r1 := f1(); + r0 := f0() + r1 := f1() if r0 != r1 { - println("r0 =", r0); - println("r1 =", r1); - panic("r0 and r1 should be the same"); + println("r0 =", r0) + println("r1 =", r1) + panic("r0 and r1 should be the same") } } diff --git a/test/fixedbugs/bug155.go b/test/fixedbugs/bug155.go index 8872e978da..ba2f1c04ca 100644 --- a/test/fixedbugs/bug155.go +++ b/test/fixedbugs/bug155.go @@ -6,7 +6,7 @@ package main -const big uint64 = 1<<63 +const big uint64 = 1 << 63 func f(a uint64) uint64 { return a << big diff --git a/test/fixedbugs/bug156.go b/test/fixedbugs/bug156.go index f26658729f..7b6825fe83 100644 --- a/test/fixedbugs/bug156.go +++ b/test/fixedbugs/bug156.go @@ -7,9 +7,9 @@ package main func f(a int64) int64 { - const b int64 = 0; - n := a &^ b; - return n; + const b int64 = 0 + n := a &^ b + return n } func main() { diff --git a/test/fixedbugs/bug157.go b/test/fixedbugs/bug157.go index 1072d7df49..160762c1cc 100644 --- a/test/fixedbugs/bug157.go +++ b/test/fixedbugs/bug157.go @@ -9,23 +9,26 @@ package main func f() {} func main() { - x := 0; + x := 0 // this compiles switch x { - case 0: f(); - default: f(); + case 0: + f() + default: + f() } // this doesn't but it should // (semicolons are not needed at the end of a statement list) switch x { - case 0: f() - default: f() + case 0: + f() + default: + f() } } - /* bug157.go:20: syntax error near default bug157.go:20: first switch statement must be a case diff --git a/test/fixedbugs/bug158.go b/test/fixedbugs/bug158.go index 496d7e0db0..3e5c0eab29 100644 --- a/test/fixedbugs/bug158.go +++ b/test/fixedbugs/bug158.go @@ -7,7 +7,7 @@ package main func main() { - x := 0; + x := 0 // this compiles switch x { @@ -20,7 +20,6 @@ func main() { } } - /* bug158.go:14: fatal error: dowidth: unknown type: E-33 */ diff --git a/test/fixedbugs/bug159.go b/test/fixedbugs/bug159.go index 92d5345635..7dd0497135 100644 --- a/test/fixedbugs/bug159.go +++ b/test/fixedbugs/bug159.go @@ -9,9 +9,9 @@ package main import "os" func main() { - ok := true; - var a, b, c, x, y, z int; - f := func() int { b--; return -b }; + ok := true + var a, b, c, x, y, z int + f := func() int { b--; return -b } // this fails on 6g: apparently it rewrites // the list into @@ -19,21 +19,21 @@ func main() { // y = f(); // x = f(); // so that the values come out backward. - x, y, z = f(), f(), f(); + x, y, z = f(), f(), f() if x != 1 || y != 2 || z != 3 { - println("xyz: expected 1 2 3 got", x, y, z); - ok = false; + println("xyz: expected 1 2 3 got", x, y, z) + ok = false } // this fails on 6g too. one of the function calls // happens after assigning to b. - a, b, c = f(), f(), f(); + a, b, c = f(), f(), f() if a != 4 || b != 5 || c != 6 { - println("abc: expected 4 5 6 got", a, b, c); - ok = false; + println("abc: expected 4 5 6 got", a, b, c) + ok = false } if !ok { - os.Exit(1); + os.Exit(1) } } diff --git a/test/fixedbugs/bug160.dir/y.go b/test/fixedbugs/bug160.dir/y.go index 428808dd19..87039c98bc 100644 --- a/test/fixedbugs/bug160.dir/y.go +++ b/test/fixedbugs/bug160.dir/y.go @@ -9,11 +9,11 @@ import "./x" func main() { if x.Zero != 0 { - println("x.Zero = ", x.Zero); - os.Exit(1); + println("x.Zero = ", x.Zero) + os.Exit(1) } if x.Ten != 10 { - println("x.Ten = ", x.Ten); - os.Exit(1); + println("x.Ten = ", x.Ten) + os.Exit(1) } } diff --git a/test/fixedbugs/bug161.go b/test/fixedbugs/bug161.go index aab58ee895..bf3c91eb82 100644 --- a/test/fixedbugs/bug161.go +++ b/test/fixedbugs/bug161.go @@ -6,10 +6,10 @@ package P -const a = 0; +const a = 0 func f(a int) { - a = 0; + a = 0 } /* diff --git a/test/fixedbugs/bug165.go b/test/fixedbugs/bug165.go index f8d50af13f..487ee992b9 100644 --- a/test/fixedbugs/bug165.go +++ b/test/fixedbugs/bug165.go @@ -7,9 +7,9 @@ package main type I interface { - m(map[I] bool); // ok + m(map[I]bool) // ok } type S struct { - m map[S] bool; // ERROR "map key type" + m map[S]bool // ERROR "map key type" } diff --git a/test/fixedbugs/bug170.go b/test/fixedbugs/bug170.go index 11ff5ff3c7..3255a04b85 100644 --- a/test/fixedbugs/bug170.go +++ b/test/fixedbugs/bug170.go @@ -5,10 +5,11 @@ // license that can be found in the LICENSE file. package main -var v1 = ([10]int)(nil); // ERROR "illegal|nil|invalid" -var v2 [10]int = nil; // ERROR "illegal|nil|incompatible" -var v3 [10]int; -var v4 = nil; // ERROR "nil" + +var v1 = ([10]int)(nil) // ERROR "illegal|nil|invalid" +var v2 [10]int = nil // ERROR "illegal|nil|incompatible" +var v3 [10]int +var v4 = nil // ERROR "nil" func main() { - v3 = nil; // ERROR "illegal|nil|incompatible" + v3 = nil // ERROR "illegal|nil|incompatible" } diff --git a/test/fixedbugs/bug171.go b/test/fixedbugs/bug171.go index 49bbb3b892..9284b686f4 100644 --- a/test/fixedbugs/bug171.go +++ b/test/fixedbugs/bug171.go @@ -6,5 +6,5 @@ package main -func f() int { } // ERROR "return|control" -func g() (foo int) { } // ERROR "return|control" +func f() int {} // ERROR "return|control" +func g() (foo int) {} // ERROR "return|control" diff --git a/test/fixedbugs/bug172.go b/test/fixedbugs/bug172.go index 4dbe7930f9..a4ee045ba5 100644 --- a/test/fixedbugs/bug172.go +++ b/test/fixedbugs/bug172.go @@ -7,6 +7,6 @@ package main func f() { - a := true; - a |= a; // ERROR "illegal.*OR|bool|expected" + a := true + a |= a // ERROR "illegal.*OR|bool|expected" } diff --git a/test/fixedbugs/bug173.go b/test/fixedbugs/bug173.go index 3515c649bb..20813cec99 100644 --- a/test/fixedbugs/bug173.go +++ b/test/fixedbugs/bug173.go @@ -11,9 +11,10 @@ package main type T string + func main() { - var t T = "hello"; - println(t[0:4], t[4]); + var t T = "hello" + println(t[0:4], t[4]) for _, _ = range t { } for _ = range t { diff --git a/test/fixedbugs/bug174.go b/test/fixedbugs/bug174.go index 448f630867..c06670859d 100644 --- a/test/fixedbugs/bug174.go +++ b/test/fixedbugs/bug174.go @@ -7,6 +7,6 @@ package main func main() { - var x uint; - println(1<: fatal error: dowidth: unknown type: blank */ diff --git a/test/fixedbugs/bug219.go b/test/fixedbugs/bug219.go index 290c691eab..0d5afd70f5 100644 --- a/test/fixedbugs/bug219.go +++ b/test/fixedbugs/bug219.go @@ -12,9 +12,10 @@ func f(func()) int { return 0 } // bug219.go:16: syntax error near if func g1() { if x := f(func() { - if true {} + if true { + } }); true { - _ = x; + _ = x } } @@ -23,16 +24,17 @@ func g2() { if x := f(func() { //if true {} }); true { - _ = x; + _ = x } } // this works func g3() { x := f(func() { - if true {} - }); + if true { + } + }) if true { - _ = x; + _ = x } } diff --git a/test/fixedbugs/bug222.dir/chanbug.go b/test/fixedbugs/bug222.dir/chanbug.go index 16920246e0..75332d86c4 100644 --- a/test/fixedbugs/bug222.dir/chanbug.go +++ b/test/fixedbugs/bug222.dir/chanbug.go @@ -3,7 +3,8 @@ // license that can be found in the LICENSE file package chanbug + var C chan<- (chan int) var D chan<- func() var E func() chan int -var F func() (func()) +var F func() func() diff --git a/test/fixedbugs/bug222.dir/chanbug2.go b/test/fixedbugs/bug222.dir/chanbug2.go index 109581dc30..f481082ede 100644 --- a/test/fixedbugs/bug222.dir/chanbug2.go +++ b/test/fixedbugs/bug222.dir/chanbug2.go @@ -3,4 +3,5 @@ // license that can be found in the LICENSE file package Bar + import _ "chanbug" diff --git a/test/fixedbugs/bug224.go b/test/fixedbugs/bug224.go index d2fd67cf32..107924a6ae 100644 --- a/test/fixedbugs/bug224.go +++ b/test/fixedbugs/bug224.go @@ -6,5 +6,4 @@ package main -type T T // ERROR "recursive" - +type T T // ERROR "recursive" diff --git a/test/fixedbugs/bug225.go b/test/fixedbugs/bug225.go index 1bda9ab4b6..42c432c845 100644 --- a/test/fixedbugs/bug225.go +++ b/test/fixedbugs/bug225.go @@ -6,17 +6,17 @@ package main -func main() { - c := make(chan bool, 1); +func main() { + c := make(chan bool, 1) select { case _ = <-c: - panic("BUG: recv should not"); + panic("BUG: recv should not") default: } - c <- true; + c <- true select { case _ = <-c: default: - panic("BUG: recv should"); + panic("BUG: recv should") } } diff --git a/test/fixedbugs/bug229.go b/test/fixedbugs/bug229.go index 4baf65e48b..2dd10c2dac 100644 --- a/test/fixedbugs/bug229.go +++ b/test/fixedbugs/bug229.go @@ -10,11 +10,11 @@ import "testing" func main() { var t testing.T - + // make sure error mentions that // name is unexported, not just "name not found". - t.common.name = nil // ERROR "unexported" - - println(testing.anyLowercaseName("asdf")) // ERROR "unexported" "undefined: testing.anyLowercaseName" + t.common.name = nil // ERROR "unexported" + + println(testing.anyLowercaseName("asdf")) // ERROR "unexported" "undefined: testing.anyLowercaseName" } diff --git a/test/fixedbugs/bug231.go b/test/fixedbugs/bug231.go index f64ddc3e75..8b054edebd 100644 --- a/test/fixedbugs/bug231.go +++ b/test/fixedbugs/bug231.go @@ -6,17 +6,18 @@ package main -type I interface { m() } -type T struct { m func() } -type M struct {} +type I interface{ m() } +type T struct{ m func() } +type M struct{} + func (M) m() {} func main() { var t T var m M var i I - + i = m - i = t // ERROR "not a method|has no methods" "does not implement I" + i = t // ERROR "not a method|has no methods" "does not implement I" _ = i } diff --git a/test/fixedbugs/bug232.go b/test/fixedbugs/bug232.go index 10b0c521a4..d7a33a24e5 100644 --- a/test/fixedbugs/bug232.go +++ b/test/fixedbugs/bug232.go @@ -5,4 +5,5 @@ // license that can be found in the LICENSE file. package bug232 -type I interface { X(...int) } + +type I interface{ X(...int) } diff --git a/test/fixedbugs/bug233.go b/test/fixedbugs/bug233.go index d4e1e07816..9f2d8d1e3d 100644 --- a/test/fixedbugs/bug233.go +++ b/test/fixedbugs/bug233.go @@ -5,6 +5,8 @@ // license that can be found in the LICENSE file. package bug233 + import p "fmt" + var _ = p.Print var fmt = 10 diff --git a/test/fixedbugs/bug235.go b/test/fixedbugs/bug235.go index a33092bdb6..8dcebca66e 100644 --- a/test/fixedbugs/bug235.go +++ b/test/fixedbugs/bug235.go @@ -14,4 +14,3 @@ type T struct { var p *T var v = *p - diff --git a/test/fixedbugs/bug237.go b/test/fixedbugs/bug237.go index 75d6132df9..f736b9a93d 100644 --- a/test/fixedbugs/bug237.go +++ b/test/fixedbugs/bug237.go @@ -9,6 +9,7 @@ package main import "fmt" var indent uint = 10 + func main() { const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " + ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " diff --git a/test/fixedbugs/bug238.go b/test/fixedbugs/bug238.go index cc47189e16..3b5995dd77 100644 --- a/test/fixedbugs/bug238.go +++ b/test/fixedbugs/bug238.go @@ -18,4 +18,3 @@ const g interface{} = 7 // ERROR "constant|wrong|invalid" const h bool = false const i int = 2 const j float64 = 5 - diff --git a/test/fixedbugs/bug240.go b/test/fixedbugs/bug240.go index 478b5b2eaf..ae9dc35062 100644 --- a/test/fixedbugs/bug240.go +++ b/test/fixedbugs/bug240.go @@ -6,7 +6,7 @@ package main -import . "unsafe" // ERROR "not used" +import . "unsafe" // ERROR "not used" func main() { var x int diff --git a/test/fixedbugs/bug241.go b/test/fixedbugs/bug241.go index 1f4440147b..ab7d0ce643 100644 --- a/test/fixedbugs/bug241.go +++ b/test/fixedbugs/bug241.go @@ -7,5 +7,5 @@ package main const c = 3 -var x = c.String() // ERROR "String" +var x = c.String() // ERROR "String" diff --git a/test/fixedbugs/bug245.go b/test/fixedbugs/bug245.go index adf62f98b5..9763349e25 100644 --- a/test/fixedbugs/bug245.go +++ b/test/fixedbugs/bug245.go @@ -7,6 +7,7 @@ package main type T []int + func (t T) m() func main() { diff --git a/test/fixedbugs/bug249.go b/test/fixedbugs/bug249.go index ec9699a894..1de59536bd 100644 --- a/test/fixedbugs/bug249.go +++ b/test/fixedbugs/bug249.go @@ -6,34 +6,34 @@ package main -var c1 chan <- chan int = (chan<- (chan int))(nil) -var c2 chan <- chan int = (chan (<-chan int))(nil) // ERROR "chan|incompatible" -var c3 <- chan chan int = (<-chan (chan int))(nil) -var c4 chan chan <- int = (chan (chan<- int))(nil) - -var c5 <- chan <- chan int = (<-chan (<-chan int))(nil) -var c6 chan <- <- chan int = (chan<- (<-chan int))(nil) -var c7 chan <- chan <- int = (chan<- (chan<- int))(nil) - -var c8 <- chan <- chan chan int = (<-chan (<-chan (chan int)))(nil) -var c9 <- chan chan <- chan int = (<-chan (chan<- (chan int)))(nil) -var c10 chan <- <- chan chan int = (chan<- (<-chan (chan int)))(nil) -var c11 chan <- chan <- chan int = (chan<- (chan<- (chan int)))(nil) -var c12 chan chan <- <- chan int = (chan (chan<- (<-chan int)))(nil) -var c13 chan chan <- chan <- int = (chan (chan<- (chan<- int)))(nil) - -var r1 chan<- (chan int) = (chan <- chan int)(nil) -var r2 chan (<-chan int) = (chan <- chan int)(nil) // ERROR "chan|incompatible" -var r3 <-chan (chan int) = (<- chan chan int)(nil) -var r4 chan (chan<- int) = (chan chan <- int)(nil) - -var r5 <-chan (<-chan int) = (<- chan <- chan int)(nil) -var r6 chan<- (<-chan int) = (chan <- <- chan int)(nil) -var r7 chan<- (chan<- int) = (chan <- chan <- int)(nil) - -var r8 <-chan (<-chan (chan int)) = (<- chan <- chan chan int)(nil) -var r9 <-chan (chan<- (chan int)) = (<- chan chan <- chan int)(nil) -var r10 chan<- (<-chan (chan int)) = (chan <- <- chan chan int)(nil) -var r11 chan<- (chan<- (chan int)) = (chan <- chan <- chan int)(nil) -var r12 chan (chan<- (<-chan int)) = (chan chan <- <- chan int)(nil) -var r13 chan (chan<- (chan<- int)) = (chan chan <- chan <- int)(nil) +var c1 chan<- chan int = (chan<- (chan int))(nil) +var c2 chan<- chan int = (chan (<-chan int))(nil) // ERROR "chan|incompatible" +var c3 <-chan chan int = (<-chan (chan int))(nil) +var c4 chan chan<- int = (chan (chan<- int))(nil) + +var c5 <-chan <-chan int = (<-chan (<-chan int))(nil) +var c6 chan<- <-chan int = (chan<- (<-chan int))(nil) +var c7 chan<- chan<- int = (chan<- (chan<- int))(nil) + +var c8 <-chan <-chan chan int = (<-chan (<-chan (chan int)))(nil) +var c9 <-chan chan<- chan int = (<-chan (chan<- (chan int)))(nil) +var c10 chan<- <-chan chan int = (chan<- (<-chan (chan int)))(nil) +var c11 chan<- chan<- chan int = (chan<- (chan<- (chan int)))(nil) +var c12 chan chan<- <-chan int = (chan (chan<- (<-chan int)))(nil) +var c13 chan chan<- chan<- int = (chan (chan<- (chan<- int)))(nil) + +var r1 chan<- (chan int) = (chan<- chan int)(nil) +var r2 chan (<-chan int) = (chan<- chan int)(nil) // ERROR "chan|incompatible" +var r3 <-chan (chan int) = (<-chan chan int)(nil) +var r4 chan (chan<- int) = (chan chan<- int)(nil) + +var r5 <-chan (<-chan int) = (<-chan <-chan int)(nil) +var r6 chan<- (<-chan int) = (chan<- <-chan int)(nil) +var r7 chan<- (chan<- int) = (chan<- chan<- int)(nil) + +var r8 <-chan (<-chan (chan int)) = (<-chan <-chan chan int)(nil) +var r9 <-chan (chan<- (chan int)) = (<-chan chan<- chan int)(nil) +var r10 chan<- (<-chan (chan int)) = (chan<- <-chan chan int)(nil) +var r11 chan<- (chan<- (chan int)) = (chan<- chan<- chan int)(nil) +var r12 chan (chan<- (<-chan int)) = (chan chan<- <-chan int)(nil) +var r13 chan (chan<- (chan<- int)) = (chan chan<- chan<- int)(nil) diff --git a/test/fixedbugs/bug251.go b/test/fixedbugs/bug251.go index 05e111a61f..a0c04319b3 100644 --- a/test/fixedbugs/bug251.go +++ b/test/fixedbugs/bug251.go @@ -19,7 +19,6 @@ type I2 interface { I1 // GCCGO_ERROR "loop|interface" } - var i1 I1 = i2 var i2 I2 var i2a I2 = i1 diff --git a/test/fixedbugs/bug252.go b/test/fixedbugs/bug252.go index f678925fbb..19b37b00d0 100644 --- a/test/fixedbugs/bug252.go +++ b/test/fixedbugs/bug252.go @@ -11,5 +11,5 @@ func f(args ...int) { } func g(args ...interface{}) { - f(args) // ERROR "cannot use|incompatible" + f(args) // ERROR "cannot use|incompatible" } diff --git a/test/fixedbugs/bug256.go b/test/fixedbugs/bug256.go index 705a0321b4..3a6df90969 100644 --- a/test/fixedbugs/bug256.go +++ b/test/fixedbugs/bug256.go @@ -6,11 +6,9 @@ package main -type T U // bogus "invalid recursive type T" from 6g +type T U // bogus "invalid recursive type T" from 6g type U int const x T = 123 -type V V // ERROR "invalid recursive type" - - +type V V // ERROR "invalid recursive type" diff --git a/test/fixedbugs/bug258.go b/test/fixedbugs/bug258.go index 075da87577..d4b993ab00 100644 --- a/test/fixedbugs/bug258.go +++ b/test/fixedbugs/bug258.go @@ -25,7 +25,7 @@ func main() { } else { println("BUG 2") } - + if math.Pow(2, 3) != 8 { println("BUG 3") } diff --git a/test/fixedbugs/bug259.go b/test/fixedbugs/bug259.go index 857b442010..4946a3d4dc 100644 --- a/test/fixedbugs/bug259.go +++ b/test/fixedbugs/bug259.go @@ -9,7 +9,7 @@ package main import "fmt" var x = uint32(0x01020304) -var y = [...]uint32{1,2,3,4,5} +var y = [...]uint32{1, 2, 3, 4, 5} func main() { fmt.Sprint(y[byte(x)]) diff --git a/test/fixedbugs/bug261.go b/test/fixedbugs/bug261.go index abe6431b51..3645d27d05 100644 --- a/test/fixedbugs/bug261.go +++ b/test/fixedbugs/bug261.go @@ -14,7 +14,7 @@ func f() int { } func main() { - x := []int{0,1,2,3,4,5,6,7,8,9,10} + x := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} n = 5 y := x[f():f()] if len(y) != 1 || y[0] != 6 { diff --git a/test/fixedbugs/bug266.go b/test/fixedbugs/bug266.go index 5d2334c05a..b51c5acdad 100644 --- a/test/fixedbugs/bug266.go +++ b/test/fixedbugs/bug266.go @@ -13,12 +13,12 @@ func f() int { panic("oops") } -func g() int { +func g() int { return 12345 } func main() { - g() // leave 12345 on stack + g() // leave 12345 on stack x := f() if x != 0 { panic(x) diff --git a/test/fixedbugs/bug269.go b/test/fixedbugs/bug269.go index ec0dbc6c34..4241faf9b5 100644 --- a/test/fixedbugs/bug269.go +++ b/test/fixedbugs/bug269.go @@ -13,6 +13,6 @@ func f() (ok bool) { return false } func main() { var i interface{} i = f - _ = i.(func()bool) - _ = i.(func()(bool)) + _ = i.(func() bool) + _ = i.(func() bool) } diff --git a/test/fixedbugs/bug271.go b/test/fixedbugs/bug271.go index a6abbfef7e..d285f29be0 100644 --- a/test/fixedbugs/bug271.go +++ b/test/fixedbugs/bug271.go @@ -14,7 +14,7 @@ func f() (int, int) { return 1, 2 } func main() { s := fmt.Sprint(f()) - if s != "1 2" { // with bug, was "{1 2}" + if s != "1 2" { // with bug, was "{1 2}" println("BUG") } } diff --git a/test/fixedbugs/bug272.go b/test/fixedbugs/bug272.go index 6b8862f697..ca39cbb4ce 100644 --- a/test/fixedbugs/bug272.go +++ b/test/fixedbugs/bug272.go @@ -8,15 +8,15 @@ package main -func main() { +func main() { n := int64(100) x := make([]int, n) - x[99] = 234; + x[99] = 234 z := x[n-1] if z != 234 { println("BUG") } - n |= 1<<32 + n |= 1 << 32 defer func() { recover() }() diff --git a/test/fixedbugs/bug276.go b/test/fixedbugs/bug276.go index dc2308ea6b..a9af72cf63 100644 --- a/test/fixedbugs/bug276.go +++ b/test/fixedbugs/bug276.go @@ -13,10 +13,10 @@ func main() { x := 0 a := (x & 1) << uint(1-i) - - s := uint(1-i) + + s := uint(1 - i) b := (x & 1) << s - + if a != b { panic(0) } diff --git a/test/fixedbugs/bug277.go b/test/fixedbugs/bug277.go index 207556493e..fe87a07006 100644 --- a/test/fixedbugs/bug277.go +++ b/test/fixedbugs/bug277.go @@ -43,7 +43,7 @@ func main() { x int }(s) p = (*S)(p) - f = func(x int) int(f) + f = (func(x int) int)(f) i = (interface { m(x int) int })(s) // this is accepted by 6g diff --git a/test/fixedbugs/bug278.go b/test/fixedbugs/bug278.go index 4817ebfee4..592aac9190 100644 --- a/test/fixedbugs/bug278.go +++ b/test/fixedbugs/bug278.go @@ -15,9 +15,9 @@ func f() [10]int { var m map[int][10]int func main() { - f()[1] = 2 // ERROR "cannot|invalid" - f()[2:3][0] = 4 // ERROR "cannot|addressable" + f()[1] = 2 // ERROR "cannot|invalid" + f()[2:3][0] = 4 // ERROR "cannot|addressable" var x = "abc" - x[2] = 3 // ERROR "cannot|invalid" - m[0][5] = 6 // ERROR "cannot|invalid" + x[2] = 3 // ERROR "cannot|invalid" + m[0][5] = 6 // ERROR "cannot|invalid" } diff --git a/test/fixedbugs/bug279.go b/test/fixedbugs/bug279.go index 3b1df3b8fe..c2a9a533d6 100644 --- a/test/fixedbugs/bug279.go +++ b/test/fixedbugs/bug279.go @@ -21,7 +21,7 @@ func main() { println("BUG alignof 0", n) return } - + n = unsafe.Sizeof("") if n != 8 && n != 16 { println("BUG sizeof \"\"", n) @@ -33,4 +33,3 @@ func main() { return } } - diff --git a/test/fixedbugs/bug280.go b/test/fixedbugs/bug280.go index afec57f037..c23642ea20 100644 --- a/test/fixedbugs/bug280.go +++ b/test/fixedbugs/bug280.go @@ -8,6 +8,4 @@ package main -type A [...]int // ERROR "outside of array literal" - - +type A [...]int // ERROR "outside of array literal" diff --git a/test/fixedbugs/bug281.go b/test/fixedbugs/bug281.go index c65530f7dd..d52d932e32 100644 --- a/test/fixedbugs/bug281.go +++ b/test/fixedbugs/bug281.go @@ -17,7 +17,7 @@ type Rect struct { } func (p Point) Sub(q Point) Point { - return Point{p.X-q.X, p.Y-q.Y} + return Point{p.X - q.X, p.Y - q.Y} } type Obj struct { @@ -28,7 +28,7 @@ func (o *Obj) Bbox() Rect { return o.bbox } -func (o *Obj) Points() [2]Point{ +func (o *Obj) Points() [2]Point { return [2]Point{o.bbox.Min, o.bbox.Max} } @@ -42,12 +42,12 @@ func main() { println("BUG dot: ", q.X, q.Y) return } - + q = p.Sub(o.Points()[0]) if q.X != 0 || q.Y != 300 { println("BUG index const: ", q.X, q.Y) } - + q = p.Sub(o.Points()[x]) if q.X != 0 || q.Y != 300 { println("BUG index var: ", q.X, q.Y) diff --git a/test/fixedbugs/bug282.dir/p1.go b/test/fixedbugs/bug282.dir/p1.go index 0f7422c0ba..1fbfa3aa74 100644 --- a/test/fixedbugs/bug282.dir/p1.go +++ b/test/fixedbugs/bug282.dir/p1.go @@ -7,4 +7,3 @@ package p1 type T struct { f func() "x" } - diff --git a/test/fixedbugs/bug282.dir/p2.go b/test/fixedbugs/bug282.dir/p2.go index f614507946..6e72020dcf 100644 --- a/test/fixedbugs/bug282.dir/p2.go +++ b/test/fixedbugs/bug282.dir/p2.go @@ -5,4 +5,3 @@ package p2 import _ "./p1" - diff --git a/test/fixedbugs/bug284.go b/test/fixedbugs/bug284.go index 68208085fa..589eec15eb 100644 --- a/test/fixedbugs/bug284.go +++ b/test/fixedbugs/bug284.go @@ -108,7 +108,7 @@ func main() { var f2 F2 f0 = f0 f0 = f1 - f0 = func(x NewInt) int(f2) // ERROR "cannot|invalid" + f0 = (func(x NewInt) int)(f2) // ERROR "cannot|invalid" f1 = f0 f1 = f1 f1 = F1(f2) // ERROR "cannot|invalid" diff --git a/test/fixedbugs/bug285.go b/test/fixedbugs/bug285.go index 0632ab4ba7..5b33ab7d42 100644 --- a/test/fixedbugs/bug285.go +++ b/test/fixedbugs/bug285.go @@ -66,7 +66,7 @@ func main() { m0[z] = 42 // this should work: z is assignment-compatible with interface{} m0[new(struct { x int - })] = 42 // this should work: *struct{x int} is assignment-compatible with interface{} + })] = 42 // this should work: *struct{x int} is assignment-compatible with interface{} m0[p] = 42 // this should work: p is assignment-compatible with interface{} m0[false] = 42 // this should work: false is assignment-compatible with interface{} m0[17] = 42 // this should work: 17 is assignment-compatible with interface{} @@ -76,7 +76,7 @@ func main() { m1[i1] = 42 m1[new(struct { x int - })] = 42 // this should work: *struct{x int} is assignment-compatible with I1 + })] = 42 // this should work: *struct{x int} is assignment-compatible with I1 m1[false] = 42 // this should work: false is assignment-compatible with I1 m1[17] = 42 // this should work: 17 is assignment-compatible with I1 m1["foo"] = 42 // this should work: "foo" is assignment-compatible with I1 diff --git a/test/fixedbugs/bug287.go b/test/fixedbugs/bug287.go index 94582a8695..5ca280f6fa 100644 --- a/test/fixedbugs/bug287.go +++ b/test/fixedbugs/bug287.go @@ -8,4 +8,4 @@ package main -var mult [3][...]byte = [3][5]byte{} // ERROR "\.\.\." +var mult [3][...]byte = [3][5]byte{} // ERROR "\.\.\." diff --git a/test/fixedbugs/bug289.go b/test/fixedbugs/bug289.go index 3fc7fb2eef..8334b8f5ed 100644 --- a/test/fixedbugs/bug289.go +++ b/test/fixedbugs/bug289.go @@ -9,18 +9,18 @@ package main func f1() { - a, b := f() // ERROR "assignment mismatch|does not match" + a, b := f() // ERROR "assignment mismatch|does not match" _ = a _ = b } func f2() { var a, b int - a, b = f() // ERROR "assignment mismatch|does not match" + a, b = f() // ERROR "assignment mismatch|does not match" _ = a _ = b } func f() int { - return 1; + return 1 } diff --git a/test/fixedbugs/bug290.go b/test/fixedbugs/bug290.go index 4eee285a35..ae648d2531 100644 --- a/test/fixedbugs/bug290.go +++ b/test/fixedbugs/bug290.go @@ -8,8 +8,8 @@ package main -type X struct { x []X } +type X struct{ x []X } func main() { - type Y struct { x []Y } // used to get invalid recursive type + type Y struct{ x []Y } // used to get invalid recursive type } diff --git a/test/fixedbugs/bug293.go b/test/fixedbugs/bug293.go index ae7cc1fd1c..e834a4bc85 100644 --- a/test/fixedbugs/bug293.go +++ b/test/fixedbugs/bug293.go @@ -9,7 +9,7 @@ package main func x() (a int, b bool) { - defer func(){ + defer func() { a++ }() a, b = y() @@ -17,7 +17,7 @@ func x() (a int, b bool) { } func x2() (a int, b bool) { - defer func(){ + defer func() { a++ }() return y() diff --git a/test/fixedbugs/bug294.go b/test/fixedbugs/bug294.go index b35b771916..26e922df6b 100644 --- a/test/fixedbugs/bug294.go +++ b/test/fixedbugs/bug294.go @@ -76,4 +76,3 @@ func main() { bad() } } - diff --git a/test/fixedbugs/bug295.go b/test/fixedbugs/bug295.go index d1c961ce1d..691aa92c7f 100644 --- a/test/fixedbugs/bug295.go +++ b/test/fixedbugs/bug295.go @@ -6,7 +6,7 @@ package main -import . "testing" // defines file-level T +import . "testing" // defines file-level T type _ B // make use of package "testing" (but don't refer to T) @@ -15,5 +15,5 @@ type S struct { } func main() { - _ = &S{T: 1} // should work + _ = &S{T: 1} // should work } diff --git a/test/fixedbugs/bug297.go b/test/fixedbugs/bug297.go index c2bd253d05..4d14ad2475 100644 --- a/test/fixedbugs/bug297.go +++ b/test/fixedbugs/bug297.go @@ -9,7 +9,8 @@ package main type ByteSize float64 + const ( - _ = iota; // ignore first value by assigning to blank identifier - KB ByteSize = 1<<(10*X) // ERROR "undefined" + _ = iota // ignore first value by assigning to blank identifier + KB ByteSize = 1 << (10 * X) // ERROR "undefined" ) diff --git a/test/fixedbugs/bug302.dir/main.go b/test/fixedbugs/bug302.dir/main.go index 52c054fb4c..9d3356f387 100644 --- a/test/fixedbugs/bug302.dir/main.go +++ b/test/fixedbugs/bug302.dir/main.go @@ -9,4 +9,3 @@ import _ "p" // Check that it's still correct in pp.a (which contains p.6). import _ "pp" - diff --git a/test/fixedbugs/bug302.dir/p.go b/test/fixedbugs/bug302.dir/p.go index 0be521b4f8..1f3cfcbb3c 100644 --- a/test/fixedbugs/bug302.dir/p.go +++ b/test/fixedbugs/bug302.dir/p.go @@ -5,1005 +5,1005 @@ package p type T struct { - x1 int - x2 int - x3 int - x4 int - x5 int - x6 int - x7 int - x8 int - x9 int - x10 int - x11 int - x12 int - x13 int - x14 int - x15 int - x16 int - x17 int - x18 int - x19 int - x20 int - x21 int - x22 int - x23 int - x24 int - x25 int - x26 int - x27 int - x28 int - x29 int - x30 int - x31 int - x32 int - x33 int - x34 int - x35 int - x36 int - x37 int - x38 int - x39 int - x40 int - x41 int - x42 int - x43 int - x44 int - x45 int - x46 int - x47 int - x48 int - x49 int - x50 int - x51 int - x52 int - x53 int - x54 int - x55 int - x56 int - x57 int - x58 int - x59 int - x60 int - x61 int - x62 int - x63 int - x64 int - x65 int - x66 int - x67 int - x68 int - x69 int - x70 int - x71 int - x72 int - x73 int - x74 int - x75 int - x76 int - x77 int - x78 int - x79 int - x80 int - x81 int - x82 int - x83 int - x84 int - x85 int - x86 int - x87 int - x88 int - x89 int - x90 int - x91 int - x92 int - x93 int - x94 int - x95 int - x96 int - x97 int - x98 int - x99 int - x100 int - x101 int - x102 int - x103 int - x104 int - x105 int - x106 int - x107 int - x108 int - x109 int - x110 int - x111 int - x112 int - x113 int - x114 int - x115 int - x116 int - x117 int - x118 int - x119 int - x120 int - x121 int - x122 int - x123 int - x124 int - x125 int - x126 int - x127 int - x128 int - x129 int - x130 int - x131 int - x132 int - x133 int - x134 int - x135 int - x136 int - x137 int - x138 int - x139 int - x140 int - x141 int - x142 int - x143 int - x144 int - x145 int - x146 int - x147 int - x148 int - x149 int - x150 int - x151 int - x152 int - x153 int - x154 int - x155 int - x156 int - x157 int - x158 int - x159 int - x160 int - x161 int - x162 int - x163 int - x164 int - x165 int - x166 int - x167 int - x168 int - x169 int - x170 int - x171 int - x172 int - x173 int - x174 int - x175 int - x176 int - x177 int - x178 int - x179 int - x180 int - x181 int - x182 int - x183 int - x184 int - x185 int - x186 int - x187 int - x188 int - x189 int - x190 int - x191 int - x192 int - x193 int - x194 int - x195 int - x196 int - x197 int - x198 int - x199 int - x200 int - x201 int - x202 int - x203 int - x204 int - x205 int - x206 int - x207 int - x208 int - x209 int - x210 int - x211 int - x212 int - x213 int - x214 int - x215 int - x216 int - x217 int - x218 int - x219 int - x220 int - x221 int - x222 int - x223 int - x224 int - x225 int - x226 int - x227 int - x228 int - x229 int - x230 int - x231 int - x232 int - x233 int - x234 int - x235 int - x236 int - x237 int - x238 int - x239 int - x240 int - x241 int - x242 int - x243 int - x244 int - x245 int - x246 int - x247 int - x248 int - x249 int - x250 int - x251 int - x252 int - x253 int - x254 int - x255 int - x256 int - x257 int - x258 int - x259 int - x260 int - x261 int - x262 int - x263 int - x264 int - x265 int - x266 int - x267 int - x268 int - x269 int - x270 int - x271 int - x272 int - x273 int - x274 int - x275 int - x276 int - x277 int - x278 int - x279 int - x280 int - x281 int - x282 int - x283 int - x284 int - x285 int - x286 int - x287 int - x288 int - x289 int - x290 int - x291 int - x292 int - x293 int - x294 int - x295 int - x296 int - x297 int - x298 int - x299 int - x300 int - x301 int - x302 int - x303 int - x304 int - x305 int - x306 int - x307 int - x308 int - x309 int - x310 int - x311 int - x312 int - x313 int - x314 int - x315 int - x316 int - x317 int - x318 int - x319 int - x320 int - x321 int - x322 int - x323 int - x324 int - x325 int - x326 int - x327 int - x328 int - x329 int - x330 int - x331 int - x332 int - x333 int - x334 int - x335 int - x336 int - x337 int - x338 int - x339 int - x340 int - x341 int - x342 int - x343 int - x344 int - x345 int - x346 int - x347 int - x348 int - x349 int - x350 int - x351 int - x352 int - x353 int - x354 int - x355 int - x356 int - x357 int - x358 int - x359 int - x360 int - x361 int - x362 int - x363 int - x364 int - x365 int - x366 int - x367 int - x368 int - x369 int - x370 int - x371 int - x372 int - x373 int - x374 int - x375 int - x376 int - x377 int - x378 int - x379 int - x380 int - x381 int - x382 int - x383 int - x384 int - x385 int - x386 int - x387 int - x388 int - x389 int - x390 int - x391 int - x392 int - x393 int - x394 int - x395 int - x396 int - x397 int - x398 int - x399 int - x400 int - x401 int - x402 int - x403 int - x404 int - x405 int - x406 int - x407 int - x408 int - x409 int - x410 int - x411 int - x412 int - x413 int - x414 int - x415 int - x416 int - x417 int - x418 int - x419 int - x420 int - x421 int - x422 int - x423 int - x424 int - x425 int - x426 int - x427 int - x428 int - x429 int - x430 int - x431 int - x432 int - x433 int - x434 int - x435 int - x436 int - x437 int - x438 int - x439 int - x440 int - x441 int - x442 int - x443 int - x444 int - x445 int - x446 int - x447 int - x448 int - x449 int - x450 int - x451 int - x452 int - x453 int - x454 int - x455 int - x456 int - x457 int - x458 int - x459 int - x460 int - x461 int - x462 int - x463 int - x464 int - x465 int - x466 int - x467 int - x468 int - x469 int - x470 int - x471 int - x472 int - x473 int - x474 int - x475 int - x476 int - x477 int - x478 int - x479 int - x480 int - x481 int - x482 int - x483 int - x484 int - x485 int - x486 int - x487 int - x488 int - x489 int - x490 int - x491 int - x492 int - x493 int - x494 int - x495 int - x496 int - x497 int - x498 int - x499 int - x500 int - x501 int - x502 int - x503 int - x504 int - x505 int - x506 int - x507 int - x508 int - x509 int - x510 int - x511 int - x512 int - x513 int - x514 int - x515 int - x516 int - x517 int - x518 int - x519 int - x520 int - x521 int - x522 int - x523 int - x524 int - x525 int - x526 int - x527 int - x528 int - x529 int - x530 int - x531 int - x532 int - x533 int - x534 int - x535 int - x536 int - x537 int - x538 int - x539 int - x540 int - x541 int - x542 int - x543 int - x544 int - x545 int - x546 int - x547 int - x548 int - x549 int - x550 int - x551 int - x552 int - x553 int - x554 int - x555 int - x556 int - x557 int - x558 int - x559 int - x560 int - x561 int - x562 int - x563 int - x564 int - x565 int - x566 int - x567 int - x568 int - x569 int - x570 int - x571 int - x572 int - x573 int - x574 int - x575 int - x576 int - x577 int - x578 int - x579 int - x580 int - x581 int - x582 int - x583 int - x584 int - x585 int - x586 int - x587 int - x588 int - x589 int - x590 int - x591 int - x592 int - x593 int - x594 int - x595 int - x596 int - x597 int - x598 int - x599 int - x600 int - x601 int - x602 int - x603 int - x604 int - x605 int - x606 int - x607 int - x608 int - x609 int - x610 int - x611 int - x612 int - x613 int - x614 int - x615 int - x616 int - x617 int - x618 int - x619 int - x620 int - x621 int - x622 int - x623 int - x624 int - x625 int - x626 int - x627 int - x628 int - x629 int - x630 int - x631 int - x632 int - x633 int - x634 int - x635 int - x636 int - x637 int - x638 int - x639 int - x640 int - x641 int - x642 int - x643 int - x644 int - x645 int - x646 int - x647 int - x648 int - x649 int - x650 int - x651 int - x652 int - x653 int - x654 int - x655 int - x656 int - x657 int - x658 int - x659 int - x660 int - x661 int - x662 int - x663 int - x664 int - x665 int - x666 int - x667 int - x668 int - x669 int - x670 int - x671 int - x672 int - x673 int - x674 int - x675 int - x676 int - x677 int - x678 int - x679 int - x680 int - x681 int - x682 int - x683 int - x684 int - x685 int - x686 int - x687 int - x688 int - x689 int - x690 int - x691 int - x692 int - x693 int - x694 int - x695 int - x696 int - x697 int - x698 int - x699 int - x700 int - x701 int - x702 int - x703 int - x704 int - x705 int - x706 int - x707 int - x708 int - x709 int - x710 int - x711 int - x712 int - x713 int - x714 int - x715 int - x716 int - x717 int - x718 int - x719 int - x720 int - x721 int - x722 int - x723 int - x724 int - x725 int - x726 int - x727 int - x728 int - x729 int - x730 int - x731 int - x732 int - x733 int - x734 int - x735 int - x736 int - x737 int - x738 int - x739 int - x740 int - x741 int - x742 int - x743 int - x744 int - x745 int - x746 int - x747 int - x748 int - x749 int - x750 int - x751 int - x752 int - x753 int - x754 int - x755 int - x756 int - x757 int - x758 int - x759 int - x760 int - x761 int - x762 int - x763 int - x764 int - x765 int - x766 int - x767 int - x768 int - x769 int - x770 int - x771 int - x772 int - x773 int - x774 int - x775 int - x776 int - x777 int - x778 int - x779 int - x780 int - x781 int - x782 int - x783 int - x784 int - x785 int - x786 int - x787 int - x788 int - x789 int - x790 int - x791 int - x792 int - x793 int - x794 int - x795 int - x796 int - x797 int - x798 int - x799 int - x800 int - x801 int - x802 int - x803 int - x804 int - x805 int - x806 int - x807 int - x808 int - x809 int - x810 int - x811 int - x812 int - x813 int - x814 int - x815 int - x816 int - x817 int - x818 int - x819 int - x820 int - x821 int - x822 int - x823 int - x824 int - x825 int - x826 int - x827 int - x828 int - x829 int - x830 int - x831 int - x832 int - x833 int - x834 int - x835 int - x836 int - x837 int - x838 int - x839 int - x840 int - x841 int - x842 int - x843 int - x844 int - x845 int - x846 int - x847 int - x848 int - x849 int - x850 int - x851 int - x852 int - x853 int - x854 int - x855 int - x856 int - x857 int - x858 int - x859 int - x860 int - x861 int - x862 int - x863 int - x864 int - x865 int - x866 int - x867 int - x868 int - x869 int - x870 int - x871 int - x872 int - x873 int - x874 int - x875 int - x876 int - x877 int - x878 int - x879 int - x880 int - x881 int - x882 int - x883 int - x884 int - x885 int - x886 int - x887 int - x888 int - x889 int - x890 int - x891 int - x892 int - x893 int - x894 int - x895 int - x896 int - x897 int - x898 int - x899 int - x900 int - x901 int - x902 int - x903 int - x904 int - x905 int - x906 int - x907 int - x908 int - x909 int - x910 int - x911 int - x912 int - x913 int - x914 int - x915 int - x916 int - x917 int - x918 int - x919 int - x920 int - x921 int - x922 int - x923 int - x924 int - x925 int - x926 int - x927 int - x928 int - x929 int - x930 int - x931 int - x932 int - x933 int - x934 int - x935 int - x936 int - x937 int - x938 int - x939 int - x940 int - x941 int - x942 int - x943 int - x944 int - x945 int - x946 int - x947 int - x948 int - x949 int - x950 int - x951 int - x952 int - x953 int - x954 int - x955 int - x956 int - x957 int - x958 int - x959 int - x960 int - x961 int - x962 int - x963 int - x964 int - x965 int - x966 int - x967 int - x968 int - x969 int - x970 int - x971 int - x972 int - x973 int - x974 int - x975 int - x976 int - x977 int - x978 int - x979 int - x980 int - x981 int - x982 int - x983 int - x984 int - x985 int - x986 int - x987 int - x988 int - x989 int - x990 int - x991 int - x992 int - x993 int - x994 int - x995 int - x996 int - x997 int - x998 int - x999 int + x1 int + x2 int + x3 int + x4 int + x5 int + x6 int + x7 int + x8 int + x9 int + x10 int + x11 int + x12 int + x13 int + x14 int + x15 int + x16 int + x17 int + x18 int + x19 int + x20 int + x21 int + x22 int + x23 int + x24 int + x25 int + x26 int + x27 int + x28 int + x29 int + x30 int + x31 int + x32 int + x33 int + x34 int + x35 int + x36 int + x37 int + x38 int + x39 int + x40 int + x41 int + x42 int + x43 int + x44 int + x45 int + x46 int + x47 int + x48 int + x49 int + x50 int + x51 int + x52 int + x53 int + x54 int + x55 int + x56 int + x57 int + x58 int + x59 int + x60 int + x61 int + x62 int + x63 int + x64 int + x65 int + x66 int + x67 int + x68 int + x69 int + x70 int + x71 int + x72 int + x73 int + x74 int + x75 int + x76 int + x77 int + x78 int + x79 int + x80 int + x81 int + x82 int + x83 int + x84 int + x85 int + x86 int + x87 int + x88 int + x89 int + x90 int + x91 int + x92 int + x93 int + x94 int + x95 int + x96 int + x97 int + x98 int + x99 int + x100 int + x101 int + x102 int + x103 int + x104 int + x105 int + x106 int + x107 int + x108 int + x109 int + x110 int + x111 int + x112 int + x113 int + x114 int + x115 int + x116 int + x117 int + x118 int + x119 int + x120 int + x121 int + x122 int + x123 int + x124 int + x125 int + x126 int + x127 int + x128 int + x129 int + x130 int + x131 int + x132 int + x133 int + x134 int + x135 int + x136 int + x137 int + x138 int + x139 int + x140 int + x141 int + x142 int + x143 int + x144 int + x145 int + x146 int + x147 int + x148 int + x149 int + x150 int + x151 int + x152 int + x153 int + x154 int + x155 int + x156 int + x157 int + x158 int + x159 int + x160 int + x161 int + x162 int + x163 int + x164 int + x165 int + x166 int + x167 int + x168 int + x169 int + x170 int + x171 int + x172 int + x173 int + x174 int + x175 int + x176 int + x177 int + x178 int + x179 int + x180 int + x181 int + x182 int + x183 int + x184 int + x185 int + x186 int + x187 int + x188 int + x189 int + x190 int + x191 int + x192 int + x193 int + x194 int + x195 int + x196 int + x197 int + x198 int + x199 int + x200 int + x201 int + x202 int + x203 int + x204 int + x205 int + x206 int + x207 int + x208 int + x209 int + x210 int + x211 int + x212 int + x213 int + x214 int + x215 int + x216 int + x217 int + x218 int + x219 int + x220 int + x221 int + x222 int + x223 int + x224 int + x225 int + x226 int + x227 int + x228 int + x229 int + x230 int + x231 int + x232 int + x233 int + x234 int + x235 int + x236 int + x237 int + x238 int + x239 int + x240 int + x241 int + x242 int + x243 int + x244 int + x245 int + x246 int + x247 int + x248 int + x249 int + x250 int + x251 int + x252 int + x253 int + x254 int + x255 int + x256 int + x257 int + x258 int + x259 int + x260 int + x261 int + x262 int + x263 int + x264 int + x265 int + x266 int + x267 int + x268 int + x269 int + x270 int + x271 int + x272 int + x273 int + x274 int + x275 int + x276 int + x277 int + x278 int + x279 int + x280 int + x281 int + x282 int + x283 int + x284 int + x285 int + x286 int + x287 int + x288 int + x289 int + x290 int + x291 int + x292 int + x293 int + x294 int + x295 int + x296 int + x297 int + x298 int + x299 int + x300 int + x301 int + x302 int + x303 int + x304 int + x305 int + x306 int + x307 int + x308 int + x309 int + x310 int + x311 int + x312 int + x313 int + x314 int + x315 int + x316 int + x317 int + x318 int + x319 int + x320 int + x321 int + x322 int + x323 int + x324 int + x325 int + x326 int + x327 int + x328 int + x329 int + x330 int + x331 int + x332 int + x333 int + x334 int + x335 int + x336 int + x337 int + x338 int + x339 int + x340 int + x341 int + x342 int + x343 int + x344 int + x345 int + x346 int + x347 int + x348 int + x349 int + x350 int + x351 int + x352 int + x353 int + x354 int + x355 int + x356 int + x357 int + x358 int + x359 int + x360 int + x361 int + x362 int + x363 int + x364 int + x365 int + x366 int + x367 int + x368 int + x369 int + x370 int + x371 int + x372 int + x373 int + x374 int + x375 int + x376 int + x377 int + x378 int + x379 int + x380 int + x381 int + x382 int + x383 int + x384 int + x385 int + x386 int + x387 int + x388 int + x389 int + x390 int + x391 int + x392 int + x393 int + x394 int + x395 int + x396 int + x397 int + x398 int + x399 int + x400 int + x401 int + x402 int + x403 int + x404 int + x405 int + x406 int + x407 int + x408 int + x409 int + x410 int + x411 int + x412 int + x413 int + x414 int + x415 int + x416 int + x417 int + x418 int + x419 int + x420 int + x421 int + x422 int + x423 int + x424 int + x425 int + x426 int + x427 int + x428 int + x429 int + x430 int + x431 int + x432 int + x433 int + x434 int + x435 int + x436 int + x437 int + x438 int + x439 int + x440 int + x441 int + x442 int + x443 int + x444 int + x445 int + x446 int + x447 int + x448 int + x449 int + x450 int + x451 int + x452 int + x453 int + x454 int + x455 int + x456 int + x457 int + x458 int + x459 int + x460 int + x461 int + x462 int + x463 int + x464 int + x465 int + x466 int + x467 int + x468 int + x469 int + x470 int + x471 int + x472 int + x473 int + x474 int + x475 int + x476 int + x477 int + x478 int + x479 int + x480 int + x481 int + x482 int + x483 int + x484 int + x485 int + x486 int + x487 int + x488 int + x489 int + x490 int + x491 int + x492 int + x493 int + x494 int + x495 int + x496 int + x497 int + x498 int + x499 int + x500 int + x501 int + x502 int + x503 int + x504 int + x505 int + x506 int + x507 int + x508 int + x509 int + x510 int + x511 int + x512 int + x513 int + x514 int + x515 int + x516 int + x517 int + x518 int + x519 int + x520 int + x521 int + x522 int + x523 int + x524 int + x525 int + x526 int + x527 int + x528 int + x529 int + x530 int + x531 int + x532 int + x533 int + x534 int + x535 int + x536 int + x537 int + x538 int + x539 int + x540 int + x541 int + x542 int + x543 int + x544 int + x545 int + x546 int + x547 int + x548 int + x549 int + x550 int + x551 int + x552 int + x553 int + x554 int + x555 int + x556 int + x557 int + x558 int + x559 int + x560 int + x561 int + x562 int + x563 int + x564 int + x565 int + x566 int + x567 int + x568 int + x569 int + x570 int + x571 int + x572 int + x573 int + x574 int + x575 int + x576 int + x577 int + x578 int + x579 int + x580 int + x581 int + x582 int + x583 int + x584 int + x585 int + x586 int + x587 int + x588 int + x589 int + x590 int + x591 int + x592 int + x593 int + x594 int + x595 int + x596 int + x597 int + x598 int + x599 int + x600 int + x601 int + x602 int + x603 int + x604 int + x605 int + x606 int + x607 int + x608 int + x609 int + x610 int + x611 int + x612 int + x613 int + x614 int + x615 int + x616 int + x617 int + x618 int + x619 int + x620 int + x621 int + x622 int + x623 int + x624 int + x625 int + x626 int + x627 int + x628 int + x629 int + x630 int + x631 int + x632 int + x633 int + x634 int + x635 int + x636 int + x637 int + x638 int + x639 int + x640 int + x641 int + x642 int + x643 int + x644 int + x645 int + x646 int + x647 int + x648 int + x649 int + x650 int + x651 int + x652 int + x653 int + x654 int + x655 int + x656 int + x657 int + x658 int + x659 int + x660 int + x661 int + x662 int + x663 int + x664 int + x665 int + x666 int + x667 int + x668 int + x669 int + x670 int + x671 int + x672 int + x673 int + x674 int + x675 int + x676 int + x677 int + x678 int + x679 int + x680 int + x681 int + x682 int + x683 int + x684 int + x685 int + x686 int + x687 int + x688 int + x689 int + x690 int + x691 int + x692 int + x693 int + x694 int + x695 int + x696 int + x697 int + x698 int + x699 int + x700 int + x701 int + x702 int + x703 int + x704 int + x705 int + x706 int + x707 int + x708 int + x709 int + x710 int + x711 int + x712 int + x713 int + x714 int + x715 int + x716 int + x717 int + x718 int + x719 int + x720 int + x721 int + x722 int + x723 int + x724 int + x725 int + x726 int + x727 int + x728 int + x729 int + x730 int + x731 int + x732 int + x733 int + x734 int + x735 int + x736 int + x737 int + x738 int + x739 int + x740 int + x741 int + x742 int + x743 int + x744 int + x745 int + x746 int + x747 int + x748 int + x749 int + x750 int + x751 int + x752 int + x753 int + x754 int + x755 int + x756 int + x757 int + x758 int + x759 int + x760 int + x761 int + x762 int + x763 int + x764 int + x765 int + x766 int + x767 int + x768 int + x769 int + x770 int + x771 int + x772 int + x773 int + x774 int + x775 int + x776 int + x777 int + x778 int + x779 int + x780 int + x781 int + x782 int + x783 int + x784 int + x785 int + x786 int + x787 int + x788 int + x789 int + x790 int + x791 int + x792 int + x793 int + x794 int + x795 int + x796 int + x797 int + x798 int + x799 int + x800 int + x801 int + x802 int + x803 int + x804 int + x805 int + x806 int + x807 int + x808 int + x809 int + x810 int + x811 int + x812 int + x813 int + x814 int + x815 int + x816 int + x817 int + x818 int + x819 int + x820 int + x821 int + x822 int + x823 int + x824 int + x825 int + x826 int + x827 int + x828 int + x829 int + x830 int + x831 int + x832 int + x833 int + x834 int + x835 int + x836 int + x837 int + x838 int + x839 int + x840 int + x841 int + x842 int + x843 int + x844 int + x845 int + x846 int + x847 int + x848 int + x849 int + x850 int + x851 int + x852 int + x853 int + x854 int + x855 int + x856 int + x857 int + x858 int + x859 int + x860 int + x861 int + x862 int + x863 int + x864 int + x865 int + x866 int + x867 int + x868 int + x869 int + x870 int + x871 int + x872 int + x873 int + x874 int + x875 int + x876 int + x877 int + x878 int + x879 int + x880 int + x881 int + x882 int + x883 int + x884 int + x885 int + x886 int + x887 int + x888 int + x889 int + x890 int + x891 int + x892 int + x893 int + x894 int + x895 int + x896 int + x897 int + x898 int + x899 int + x900 int + x901 int + x902 int + x903 int + x904 int + x905 int + x906 int + x907 int + x908 int + x909 int + x910 int + x911 int + x912 int + x913 int + x914 int + x915 int + x916 int + x917 int + x918 int + x919 int + x920 int + x921 int + x922 int + x923 int + x924 int + x925 int + x926 int + x927 int + x928 int + x929 int + x930 int + x931 int + x932 int + x933 int + x934 int + x935 int + x936 int + x937 int + x938 int + x939 int + x940 int + x941 int + x942 int + x943 int + x944 int + x945 int + x946 int + x947 int + x948 int + x949 int + x950 int + x951 int + x952 int + x953 int + x954 int + x955 int + x956 int + x957 int + x958 int + x959 int + x960 int + x961 int + x962 int + x963 int + x964 int + x965 int + x966 int + x967 int + x968 int + x969 int + x970 int + x971 int + x972 int + x973 int + x974 int + x975 int + x976 int + x977 int + x978 int + x979 int + x980 int + x981 int + x982 int + x983 int + x984 int + x985 int + x986 int + x987 int + x988 int + x989 int + x990 int + x991 int + x992 int + x993 int + x994 int + x995 int + x996 int + x997 int + x998 int + x999 int x1000 int } diff --git a/test/fixedbugs/bug304.go b/test/fixedbugs/bug304.go index 4073073eec..69cb9e4d38 100644 --- a/test/fixedbugs/bug304.go +++ b/test/fixedbugs/bug304.go @@ -9,10 +9,12 @@ // bug304.go:15:2: internal compiler error: in copy_tree_r, at tree-inline.c:4114 package p + type S struct { v interface{} } -func g(e interface{}) { } + +func g(e interface{}) {} func f(s S) { g(s.v.(*int)) } diff --git a/test/fixedbugs/bug306.dir/p1.go b/test/fixedbugs/bug306.dir/p1.go index b28551807d..b7a3579d04 100644 --- a/test/fixedbugs/bug306.dir/p1.go +++ b/test/fixedbugs/bug306.dir/p1.go @@ -5,5 +5,5 @@ package p1 type T <-chan int -var x = make(chan T) +var x = make(chan T) diff --git a/test/fixedbugs/bug306.dir/p2.go b/test/fixedbugs/bug306.dir/p2.go index f614507946..6e72020dcf 100644 --- a/test/fixedbugs/bug306.dir/p2.go +++ b/test/fixedbugs/bug306.dir/p2.go @@ -5,4 +5,3 @@ package p2 import _ "./p1" - diff --git a/test/fixedbugs/bug311.go b/test/fixedbugs/bug311.go index f5cab44c7e..3bf8426af0 100644 --- a/test/fixedbugs/bug311.go +++ b/test/fixedbugs/bug311.go @@ -9,9 +9,9 @@ package main func main() { m := make(map[string][1000]byte) m["hi"] = [1000]byte{1} - + v := m["hi"] - + for k, vv := range m { if k != "hi" || string(v[:]) != string(vv[:]) { panic("bad iter") diff --git a/test/fixedbugs/bug314.go b/test/fixedbugs/bug314.go index 6e26d14e1f..ad8b364765 100644 --- a/test/fixedbugs/bug314.go +++ b/test/fixedbugs/bug314.go @@ -10,10 +10,11 @@ package main type S struct { } -func (S) a() int{ + +func (S) a() int { return 0 } -func (S) b() int{ +func (S) b() int { return 1 } diff --git a/test/fixedbugs/bug317.go b/test/fixedbugs/bug317.go index 4cd9ec2813..226b7fe9ad 100644 --- a/test/fixedbugs/bug317.go +++ b/test/fixedbugs/bug317.go @@ -12,5 +12,5 @@ func main() { } func f() uint { - return 1<<31 // doesn't panic with 1<<31 - 1 + return 1 << 31 // doesn't panic with 1<<31 - 1 } diff --git a/test/fixedbugs/bug319.go b/test/fixedbugs/bug319.go index b93106d4bd..d837af9a06 100644 --- a/test/fixedbugs/bug319.go +++ b/test/fixedbugs/bug319.go @@ -10,7 +10,7 @@ import "unsafe" func main() { var x int - + a := uint64(uintptr(unsafe.Pointer(&x))) b := uint32(uintptr(unsafe.Pointer(&x))) c := uint16(uintptr(unsafe.Pointer(&x))) diff --git a/test/fixedbugs/bug320.go b/test/fixedbugs/bug320.go index 0406b96561..c6bcc0f5c0 100644 --- a/test/fixedbugs/bug320.go +++ b/test/fixedbugs/bug320.go @@ -42,4 +42,3 @@ func escape(*int) { func f(int) { } - diff --git a/test/fixedbugs/bug322.dir/lib.go b/test/fixedbugs/bug322.dir/lib.go index 0de56d3d64..c338781925 100644 --- a/test/fixedbugs/bug322.dir/lib.go +++ b/test/fixedbugs/bug322.dir/lib.go @@ -5,7 +5,7 @@ package lib type T struct { - x int // non-exported field + x int // non-exported field } func (t T) M() { diff --git a/test/fixedbugs/bug322.dir/main.go b/test/fixedbugs/bug322.dir/main.go index f403c7d32e..0b6984c6d2 100644 --- a/test/fixedbugs/bug322.dir/main.go +++ b/test/fixedbugs/bug322.dir/main.go @@ -22,7 +22,7 @@ func main() { // This is still an error. // var i1 I = t // i1.M() - + // This combination is illegal because // PM requires a pointer receiver. // var pi1 PI = t diff --git a/test/fixedbugs/bug324.dir/prog.go b/test/fixedbugs/bug324.dir/prog.go index 3ab61f3eb5..4e415758cb 100644 --- a/test/fixedbugs/bug324.dir/prog.go +++ b/test/fixedbugs/bug324.dir/prog.go @@ -16,17 +16,16 @@ type Implementation struct{} func (p *Implementation) private() {} - func main() { // nothing unusual here var x Exported x = new(Implementation) - x.private() // main.Implementation.private() + x.private() // main.Implementation.private() // same here - should be and is legal var px p.Exported px = p.X - + // this assignment is correctly illegal: // px.private undefined (cannot refer to unexported field or method private) // px.private() @@ -44,10 +43,10 @@ func main() { recover() }() x = px.(Exported) - + println("should not get this far") // this is a legitimate call, but because of the previous assignment, // it invokes the method private in p! - x.private() // p.Implementation.private() + x.private() // p.Implementation.private() } diff --git a/test/fixedbugs/bug325.go b/test/fixedbugs/bug325.go index e6528ae46a..50d79d521d 100644 --- a/test/fixedbugs/bug325.go +++ b/test/fixedbugs/bug325.go @@ -10,6 +10,6 @@ import "unsafe" func main() { var x unsafe.Pointer - println(*x) // ERROR "invalid indirect.*unsafe.Pointer" - var _ = (unsafe.Pointer)(nil).foo // ERROR "foo" + println(*x) // ERROR "invalid indirect.*unsafe.Pointer" + var _ = (unsafe.Pointer)(nil).foo // ERROR "foo" } diff --git a/test/fixedbugs/bug330.go b/test/fixedbugs/bug330.go index 2f33feb4b6..6c1cb1394b 100644 --- a/test/fixedbugs/bug330.go +++ b/test/fixedbugs/bug330.go @@ -8,6 +8,6 @@ package main func main() { x := "" - x = +"hello" // ERROR "invalid operation.*string|expected numeric" - x = +x // ERROR "invalid operation.*string|expected numeric" + x = +"hello" // ERROR "invalid operation.*string|expected numeric" + x = +x // ERROR "invalid operation.*string|expected numeric" } diff --git a/test/fixedbugs/bug332.go b/test/fixedbugs/bug332.go index d43c2ddcff..faa445fb5a 100644 --- a/test/fixedbugs/bug332.go +++ b/test/fixedbugs/bug332.go @@ -14,4 +14,4 @@ func main() {} // important: no newline on end of next line. // 6g used to print instead of bug332.go:111 -func (t *T) F() {} // ERROR "undefined: T" \ No newline at end of file +func (t *T) F() {} // ERROR "undefined: T" diff --git a/test/fixedbugs/bug333.go b/test/fixedbugs/bug333.go index 149843a3b0..86927b26ed 100644 --- a/test/fixedbugs/bug333.go +++ b/test/fixedbugs/bug333.go @@ -9,9 +9,9 @@ package main func main() { - type Ts string - var ts Ts - _ = []byte(ts) + type Ts string + var ts Ts + _ = []byte(ts) } /* diff --git a/test/fixedbugs/bug337.go b/test/fixedbugs/bug337.go index 1a0616f70a..8021c8b910 100644 --- a/test/fixedbugs/bug337.go +++ b/test/fixedbugs/bug337.go @@ -6,7 +6,7 @@ // Issue 1722. -// Check that the error messages says +// Check that the error messages says // bug337.go:16: len("foo") not used // and not // bug337.go:16: 3 not used @@ -14,6 +14,5 @@ package main func main() { - len("foo") // ERROR "len|value computed is not used" + len("foo") // ERROR "len|value computed is not used" } - diff --git a/test/fixedbugs/bug341.go b/test/fixedbugs/bug341.go index baab28216f..7e478f3742 100644 --- a/test/fixedbugs/bug341.go +++ b/test/fixedbugs/bug341.go @@ -15,6 +15,7 @@ func main() { _ = uint64(x) _ = float32(0) } + /* panic: runtime error: floating point error diff --git a/test/fixedbugs/bug343.go b/test/fixedbugs/bug343.go index fd8bd76bbf..e63347cd44 100644 --- a/test/fixedbugs/bug343.go +++ b/test/fixedbugs/bug343.go @@ -9,22 +9,22 @@ package main func getArgs(data map[string]interface{}, keys ...string) map[string]string { - ret := map[string]string{} - var ok bool - for _, k := range keys { - ret[k], ok = data[k].(string) - if !ok {} - } - return ret + ret := map[string]string{} + var ok bool + for _, k := range keys { + ret[k], ok = data[k].(string) + if !ok { + } + } + return ret } func main() { - x := getArgs(map[string]interface{}{"x":"y"}, "x") + x := getArgs(map[string]interface{}{"x": "y"}, "x") if x["x"] != "y" { println("BUG bug343", x) } } - /* typecheck [1008592b0] diff --git a/test/fixedbugs/bug344.go b/test/fixedbugs/bug344.go index b53abd26e3..42aace6ab6 100644 --- a/test/fixedbugs/bug344.go +++ b/test/fixedbugs/bug344.go @@ -14,10 +14,10 @@ func main() { i := 42 a := []*int{&i, &i, &i, &i} x := a[0] - goto start // ERROR "jumps into block" + goto start // ERROR "jumps into block" z := 1 _ = z - for _, x = range a { // GCCGO_ERROR "block" + for _, x = range a { // GCCGO_ERROR "block" start: fmt.Sprint(*x) } diff --git a/test/fixedbugs/bug347.go b/test/fixedbugs/bug347.go index 92afb2e704..6ea0419c39 100644 --- a/test/fixedbugs/bug347.go +++ b/test/fixedbugs/bug347.go @@ -19,7 +19,7 @@ var c chan int func f() { select { - case <-t.c: // THIS IS LINE 22 + case <-t.c: // THIS IS LINE 22 break case <-c: break @@ -29,7 +29,7 @@ func f() { func main() { defer func() { recover() - for i := 0;; i++ { + for i := 0; ; i++ { pc, file, line, ok := runtime.Caller(i) if !ok { print("BUG: bug347: cannot find caller\n") diff --git a/test/fixedbugs/bug348.go b/test/fixedbugs/bug348.go index c7f1346159..8d7dc0a3bd 100644 --- a/test/fixedbugs/bug348.go +++ b/test/fixedbugs/bug348.go @@ -13,8 +13,8 @@ import ( func f() { var x *string - - for _, i := range *x { // THIS IS LINE 17 + + for _, i := range *x { // THIS IS LINE 17 println(i) } } @@ -24,7 +24,7 @@ func g() { func main() { defer func() { - for i := 0;; i++ { + for i := 0; ; i++ { pc, file, line, ok := runtime.Caller(i) if !ok { print("BUG: bug348: cannot find caller\n") diff --git a/test/fixedbugs/bug356.go b/test/fixedbugs/bug356.go index 6d93860be9..2dcd8675d0 100644 --- a/test/fixedbugs/bug356.go +++ b/test/fixedbugs/bug356.go @@ -12,27 +12,26 @@ func main() { var i uint64 var x int = 12345 - if y := x << (i&5); y != 12345<<0 { + if y := x << (i & 5); y != 12345<<0 { println("BUG bug344", y) return } - + i++ - if y := x << (i&5); y != 12345<<1 { + if y := x << (i & 5); y != 12345<<1 { println("BUG bug344a", y) } - + i = 70 if y := x << i; y != 0 { println("BUG bug344b", y) } - - i = 1<<32 + + i = 1 << 32 if y := x << i; y != 0 { println("BUG bug344c", y) } } - /* typecheck [1008592b0] diff --git a/test/fixedbugs/bug357.go b/test/fixedbugs/bug357.go index e9db50e88e..16f3abb002 100644 --- a/test/fixedbugs/bug357.go +++ b/test/fixedbugs/bug357.go @@ -15,7 +15,7 @@ func bla1() bool { func bla5() bool { _ = 1 - false // ERROR "false evaluated but not used|value computed is not used" + false // ERROR "false evaluated but not used|value computed is not used" _ = 2 return false } diff --git a/test/fixedbugs/bug361.go b/test/fixedbugs/bug361.go index 8e282431eb..57e933658d 100644 --- a/test/fixedbugs/bug361.go +++ b/test/fixedbugs/bug361.go @@ -10,6 +10,6 @@ package test func main() { - buf := [1<<30]byte{} + buf := [1 << 30]byte{} _ = buf[:] } diff --git a/test/fixedbugs/bug362.go b/test/fixedbugs/bug362.go index 771d13d435..cc73c947a3 100644 --- a/test/fixedbugs/bug362.go +++ b/test/fixedbugs/bug362.go @@ -10,7 +10,7 @@ package main var ( - a = iota // ERROR "undefined: iota|iota is only defined in const" - b = iota // ERROR "undefined: iota|iota is only defined in const" - c = iota // ERROR "undefined: iota|iota is only defined in const" + a = iota // ERROR "undefined: iota|iota is only defined in const" + b = iota // ERROR "undefined: iota|iota is only defined in const" + c = iota // ERROR "undefined: iota|iota is only defined in const" ) diff --git a/test/fixedbugs/bug363.go b/test/fixedbugs/bug363.go index 1bd1400987..4c10a3a334 100644 --- a/test/fixedbugs/bug363.go +++ b/test/fixedbugs/bug363.go @@ -10,12 +10,12 @@ package main func main() { var i uint = 33 - var a = (1<>1 + s += i >> 1 } return s } diff --git a/test/fixedbugs/bug369.dir/pkg.go b/test/fixedbugs/bug369.dir/pkg.go index 9964347250..c46acff79b 100644 --- a/test/fixedbugs/bug369.dir/pkg.go +++ b/test/fixedbugs/bug369.dir/pkg.go @@ -12,4 +12,3 @@ func NonASCII(b []byte, i int) int { } return i } - diff --git a/test/fixedbugs/bug372.go b/test/fixedbugs/bug372.go index 5fba131d7a..caf5b54447 100644 --- a/test/fixedbugs/bug372.go +++ b/test/fixedbugs/bug372.go @@ -7,7 +7,8 @@ // Issue 2355 package main -type T struct {} +type T struct{} + func (T) m() string { return "T" } type TT struct { @@ -15,7 +16,6 @@ type TT struct { m func() string } - func ff() string { return "ff" } func main() { diff --git a/test/fixedbugs/bug373.go b/test/fixedbugs/bug373.go index aa0f5d1efa..6efdfad58b 100644 --- a/test/fixedbugs/bug373.go +++ b/test/fixedbugs/bug373.go @@ -9,7 +9,7 @@ package foo func f(x interface{}) { - switch t := x.(type) { // ERROR "declared and not used" + switch t := x.(type) { // ERROR "declared and not used" case int: } } diff --git a/test/fixedbugs/bug374.go b/test/fixedbugs/bug374.go index 2d604cbd3c..b659b46e39 100644 --- a/test/fixedbugs/bug374.go +++ b/test/fixedbugs/bug374.go @@ -13,8 +13,8 @@ type I interface { type T int -var _ I = T(0) // GCCGO_ERROR "incompatible" +var _ I = T(0) // GCCGO_ERROR "incompatible" -func (T) m(buf []byte) (a int, b xxxx) { // ERROR "xxxx" +func (T) m(buf []byte) (a int, b xxxx) { // ERROR "xxxx" return 0, nil } diff --git a/test/fixedbugs/bug376.go b/test/fixedbugs/bug376.go index cd700124fe..d4f28c33ce 100644 --- a/test/fixedbugs/bug376.go +++ b/test/fixedbugs/bug376.go @@ -6,5 +6,7 @@ // issue 1951 package foo + import "unsafe" -var v = unsafe.Sizeof // ERROR "not in function call|must be called" + +var v = unsafe.Sizeof // ERROR "not in function call|must be called" diff --git a/test/fixedbugs/bug377.dir/one.go b/test/fixedbugs/bug377.dir/one.go index e29b813a48..d0829473d6 100644 --- a/test/fixedbugs/bug377.dir/one.go +++ b/test/fixedbugs/bug377.dir/one.go @@ -7,4 +7,3 @@ package one func Foo() (n int64, _ *int) { return 42, nil } - diff --git a/test/fixedbugs/bug377.dir/two.go b/test/fixedbugs/bug377.dir/two.go index 2a10812d56..9e016462c2 100644 --- a/test/fixedbugs/bug377.dir/two.go +++ b/test/fixedbugs/bug377.dir/two.go @@ -5,4 +5,3 @@ package two import _ "./one" - diff --git a/test/fixedbugs/bug378.go b/test/fixedbugs/bug378.go index c7b0dac313..d382e198b0 100644 --- a/test/fixedbugs/bug378.go +++ b/test/fixedbugs/bug378.go @@ -9,11 +9,12 @@ package main type Header struct{} + func (h Header) Method() {} var _ interface{} = Header{} func main() { - type X Header - var _ interface{} = X{} + type X Header + var _ interface{} = X{} } diff --git a/test/fixedbugs/bug379.go b/test/fixedbugs/bug379.go index 5638123d50..bef19ddbed 100644 --- a/test/fixedbugs/bug379.go +++ b/test/fixedbugs/bug379.go @@ -6,7 +6,7 @@ // Issue 2452. -// Check that the error messages says +// Check that the error messages says // bug378.go:17: 1 + 2 not used // and not // bug378.go:17: 1 not used diff --git a/test/fixedbugs/bug380.go b/test/fixedbugs/bug380.go index 0cb3487327..cacaec6d09 100644 --- a/test/fixedbugs/bug380.go +++ b/test/fixedbugs/bug380.go @@ -7,5 +7,7 @@ // Used to cause a typechecking loop error. package pkg + type T map[int]string + var q = &T{} diff --git a/test/fixedbugs/bug381.go b/test/fixedbugs/bug381.go index a0a1c8aaa4..b04617cd8b 100644 --- a/test/fixedbugs/bug381.go +++ b/test/fixedbugs/bug381.go @@ -6,7 +6,7 @@ // Issue 2276. -// Check that the error messages says +// Check that the error messages says // bug381.go:29: unsafe.Alignof(0) not used // and not // bug381.go:29: 4 not used diff --git a/test/fixedbugs/bug382.dir/pkg.go b/test/fixedbugs/bug382.dir/pkg.go index 92fe4e335a..d66ba8a3c6 100644 --- a/test/fixedbugs/bug382.dir/pkg.go +++ b/test/fixedbugs/bug382.dir/pkg.go @@ -3,5 +3,7 @@ // license that can be found in the LICENSE file. package pkg -type T struct {} + +type T struct{} + var E T diff --git a/test/fixedbugs/bug383.go b/test/fixedbugs/bug383.go index dc2ecd61fb..2520736745 100644 --- a/test/fixedbugs/bug383.go +++ b/test/fixedbugs/bug383.go @@ -7,7 +7,10 @@ // Issue 2520 package main + func main() { - if 2e9 { } // ERROR "2e.09|expected bool" - if 3.14+1i { } // ERROR "3.14 . 1i|expected bool" + if 2e9 { + } // ERROR "2e.09|expected bool" + if 3.14 + 1i { + } // ERROR "3.14 . 1i|expected bool" } diff --git a/test/fixedbugs/bug384.go b/test/fixedbugs/bug384.go index d02352b478..a84dcf488a 100644 --- a/test/fixedbugs/bug384.go +++ b/test/fixedbugs/bug384.go @@ -9,4 +9,4 @@ package foo // Check that we only get root cause message, no further complaints about r undefined -func (r *indexWriter) foo() {} // ERROR "undefined.*indexWriter" +func (r *indexWriter) foo() {} // ERROR "undefined.*indexWriter" diff --git a/test/fixedbugs/bug385_32.go b/test/fixedbugs/bug385_32.go index 73a1311f32..3747141de1 100644 --- a/test/fixedbugs/bug385_32.go +++ b/test/fixedbugs/bug385_32.go @@ -8,8 +8,9 @@ // Issue 2444 package main + func main() { - var arr [1000200030]int // GC_ERROR "type .* too large" + var arr [1000200030]int // GC_ERROR "type .* too large" arr_bkup := arr _ = arr_bkup } diff --git a/test/fixedbugs/bug385_64.go b/test/fixedbugs/bug385_64.go index 0f941ca2f4..3c3790145b 100644 --- a/test/fixedbugs/bug385_64.go +++ b/test/fixedbugs/bug385_64.go @@ -10,214 +10,420 @@ package main -var z [10<<20]byte +var z [10 << 20]byte func main() { // GC_ERROR "stack frame too large" // seq 1 206 | sed 's/.*/ var x& [10<<20]byte; z = x&/' - var x1 [10<<20]byte; z = x1 - var x2 [10<<20]byte; z = x2 - var x3 [10<<20]byte; z = x3 - var x4 [10<<20]byte; z = x4 - var x5 [10<<20]byte; z = x5 - var x6 [10<<20]byte; z = x6 - var x7 [10<<20]byte; z = x7 - var x8 [10<<20]byte; z = x8 - var x9 [10<<20]byte; z = x9 - var x10 [10<<20]byte; z = x10 - var x11 [10<<20]byte; z = x11 - var x12 [10<<20]byte; z = x12 - var x13 [10<<20]byte; z = x13 - var x14 [10<<20]byte; z = x14 - var x15 [10<<20]byte; z = x15 - var x16 [10<<20]byte; z = x16 - var x17 [10<<20]byte; z = x17 - var x18 [10<<20]byte; z = x18 - var x19 [10<<20]byte; z = x19 - var x20 [10<<20]byte; z = x20 - var x21 [10<<20]byte; z = x21 - var x22 [10<<20]byte; z = x22 - var x23 [10<<20]byte; z = x23 - var x24 [10<<20]byte; z = x24 - var x25 [10<<20]byte; z = x25 - var x26 [10<<20]byte; z = x26 - var x27 [10<<20]byte; z = x27 - var x28 [10<<20]byte; z = x28 - var x29 [10<<20]byte; z = x29 - var x30 [10<<20]byte; z = x30 - var x31 [10<<20]byte; z = x31 - var x32 [10<<20]byte; z = x32 - var x33 [10<<20]byte; z = x33 - var x34 [10<<20]byte; z = x34 - var x35 [10<<20]byte; z = x35 - var x36 [10<<20]byte; z = x36 - var x37 [10<<20]byte; z = x37 - var x38 [10<<20]byte; z = x38 - var x39 [10<<20]byte; z = x39 - var x40 [10<<20]byte; z = x40 - var x41 [10<<20]byte; z = x41 - var x42 [10<<20]byte; z = x42 - var x43 [10<<20]byte; z = x43 - var x44 [10<<20]byte; z = x44 - var x45 [10<<20]byte; z = x45 - var x46 [10<<20]byte; z = x46 - var x47 [10<<20]byte; z = x47 - var x48 [10<<20]byte; z = x48 - var x49 [10<<20]byte; z = x49 - var x50 [10<<20]byte; z = x50 - var x51 [10<<20]byte; z = x51 - var x52 [10<<20]byte; z = x52 - var x53 [10<<20]byte; z = x53 - var x54 [10<<20]byte; z = x54 - var x55 [10<<20]byte; z = x55 - var x56 [10<<20]byte; z = x56 - var x57 [10<<20]byte; z = x57 - var x58 [10<<20]byte; z = x58 - var x59 [10<<20]byte; z = x59 - var x60 [10<<20]byte; z = x60 - var x61 [10<<20]byte; z = x61 - var x62 [10<<20]byte; z = x62 - var x63 [10<<20]byte; z = x63 - var x64 [10<<20]byte; z = x64 - var x65 [10<<20]byte; z = x65 - var x66 [10<<20]byte; z = x66 - var x67 [10<<20]byte; z = x67 - var x68 [10<<20]byte; z = x68 - var x69 [10<<20]byte; z = x69 - var x70 [10<<20]byte; z = x70 - var x71 [10<<20]byte; z = x71 - var x72 [10<<20]byte; z = x72 - var x73 [10<<20]byte; z = x73 - var x74 [10<<20]byte; z = x74 - var x75 [10<<20]byte; z = x75 - var x76 [10<<20]byte; z = x76 - var x77 [10<<20]byte; z = x77 - var x78 [10<<20]byte; z = x78 - var x79 [10<<20]byte; z = x79 - var x80 [10<<20]byte; z = x80 - var x81 [10<<20]byte; z = x81 - var x82 [10<<20]byte; z = x82 - var x83 [10<<20]byte; z = x83 - var x84 [10<<20]byte; z = x84 - var x85 [10<<20]byte; z = x85 - var x86 [10<<20]byte; z = x86 - var x87 [10<<20]byte; z = x87 - var x88 [10<<20]byte; z = x88 - var x89 [10<<20]byte; z = x89 - var x90 [10<<20]byte; z = x90 - var x91 [10<<20]byte; z = x91 - var x92 [10<<20]byte; z = x92 - var x93 [10<<20]byte; z = x93 - var x94 [10<<20]byte; z = x94 - var x95 [10<<20]byte; z = x95 - var x96 [10<<20]byte; z = x96 - var x97 [10<<20]byte; z = x97 - var x98 [10<<20]byte; z = x98 - var x99 [10<<20]byte; z = x99 - var x100 [10<<20]byte; z = x100 - var x101 [10<<20]byte; z = x101 - var x102 [10<<20]byte; z = x102 - var x103 [10<<20]byte; z = x103 - var x104 [10<<20]byte; z = x104 - var x105 [10<<20]byte; z = x105 - var x106 [10<<20]byte; z = x106 - var x107 [10<<20]byte; z = x107 - var x108 [10<<20]byte; z = x108 - var x109 [10<<20]byte; z = x109 - var x110 [10<<20]byte; z = x110 - var x111 [10<<20]byte; z = x111 - var x112 [10<<20]byte; z = x112 - var x113 [10<<20]byte; z = x113 - var x114 [10<<20]byte; z = x114 - var x115 [10<<20]byte; z = x115 - var x116 [10<<20]byte; z = x116 - var x117 [10<<20]byte; z = x117 - var x118 [10<<20]byte; z = x118 - var x119 [10<<20]byte; z = x119 - var x120 [10<<20]byte; z = x120 - var x121 [10<<20]byte; z = x121 - var x122 [10<<20]byte; z = x122 - var x123 [10<<20]byte; z = x123 - var x124 [10<<20]byte; z = x124 - var x125 [10<<20]byte; z = x125 - var x126 [10<<20]byte; z = x126 - var x127 [10<<20]byte; z = x127 - var x128 [10<<20]byte; z = x128 - var x129 [10<<20]byte; z = x129 - var x130 [10<<20]byte; z = x130 - var x131 [10<<20]byte; z = x131 - var x132 [10<<20]byte; z = x132 - var x133 [10<<20]byte; z = x133 - var x134 [10<<20]byte; z = x134 - var x135 [10<<20]byte; z = x135 - var x136 [10<<20]byte; z = x136 - var x137 [10<<20]byte; z = x137 - var x138 [10<<20]byte; z = x138 - var x139 [10<<20]byte; z = x139 - var x140 [10<<20]byte; z = x140 - var x141 [10<<20]byte; z = x141 - var x142 [10<<20]byte; z = x142 - var x143 [10<<20]byte; z = x143 - var x144 [10<<20]byte; z = x144 - var x145 [10<<20]byte; z = x145 - var x146 [10<<20]byte; z = x146 - var x147 [10<<20]byte; z = x147 - var x148 [10<<20]byte; z = x148 - var x149 [10<<20]byte; z = x149 - var x150 [10<<20]byte; z = x150 - var x151 [10<<20]byte; z = x151 - var x152 [10<<20]byte; z = x152 - var x153 [10<<20]byte; z = x153 - var x154 [10<<20]byte; z = x154 - var x155 [10<<20]byte; z = x155 - var x156 [10<<20]byte; z = x156 - var x157 [10<<20]byte; z = x157 - var x158 [10<<20]byte; z = x158 - var x159 [10<<20]byte; z = x159 - var x160 [10<<20]byte; z = x160 - var x161 [10<<20]byte; z = x161 - var x162 [10<<20]byte; z = x162 - var x163 [10<<20]byte; z = x163 - var x164 [10<<20]byte; z = x164 - var x165 [10<<20]byte; z = x165 - var x166 [10<<20]byte; z = x166 - var x167 [10<<20]byte; z = x167 - var x168 [10<<20]byte; z = x168 - var x169 [10<<20]byte; z = x169 - var x170 [10<<20]byte; z = x170 - var x171 [10<<20]byte; z = x171 - var x172 [10<<20]byte; z = x172 - var x173 [10<<20]byte; z = x173 - var x174 [10<<20]byte; z = x174 - var x175 [10<<20]byte; z = x175 - var x176 [10<<20]byte; z = x176 - var x177 [10<<20]byte; z = x177 - var x178 [10<<20]byte; z = x178 - var x179 [10<<20]byte; z = x179 - var x180 [10<<20]byte; z = x180 - var x181 [10<<20]byte; z = x181 - var x182 [10<<20]byte; z = x182 - var x183 [10<<20]byte; z = x183 - var x184 [10<<20]byte; z = x184 - var x185 [10<<20]byte; z = x185 - var x186 [10<<20]byte; z = x186 - var x187 [10<<20]byte; z = x187 - var x188 [10<<20]byte; z = x188 - var x189 [10<<20]byte; z = x189 - var x190 [10<<20]byte; z = x190 - var x191 [10<<20]byte; z = x191 - var x192 [10<<20]byte; z = x192 - var x193 [10<<20]byte; z = x193 - var x194 [10<<20]byte; z = x194 - var x195 [10<<20]byte; z = x195 - var x196 [10<<20]byte; z = x196 - var x197 [10<<20]byte; z = x197 - var x198 [10<<20]byte; z = x198 - var x199 [10<<20]byte; z = x199 - var x200 [10<<20]byte; z = x200 - var x201 [10<<20]byte; z = x201 - var x202 [10<<20]byte; z = x202 - var x203 [10<<20]byte; z = x203 - var x204 [10<<20]byte; z = x204 - var x205 [10<<20]byte; z = x205 - var x206 [10<<20]byte; z = x206 + var x1 [10 << 20]byte + z = x1 + var x2 [10 << 20]byte + z = x2 + var x3 [10 << 20]byte + z = x3 + var x4 [10 << 20]byte + z = x4 + var x5 [10 << 20]byte + z = x5 + var x6 [10 << 20]byte + z = x6 + var x7 [10 << 20]byte + z = x7 + var x8 [10 << 20]byte + z = x8 + var x9 [10 << 20]byte + z = x9 + var x10 [10 << 20]byte + z = x10 + var x11 [10 << 20]byte + z = x11 + var x12 [10 << 20]byte + z = x12 + var x13 [10 << 20]byte + z = x13 + var x14 [10 << 20]byte + z = x14 + var x15 [10 << 20]byte + z = x15 + var x16 [10 << 20]byte + z = x16 + var x17 [10 << 20]byte + z = x17 + var x18 [10 << 20]byte + z = x18 + var x19 [10 << 20]byte + z = x19 + var x20 [10 << 20]byte + z = x20 + var x21 [10 << 20]byte + z = x21 + var x22 [10 << 20]byte + z = x22 + var x23 [10 << 20]byte + z = x23 + var x24 [10 << 20]byte + z = x24 + var x25 [10 << 20]byte + z = x25 + var x26 [10 << 20]byte + z = x26 + var x27 [10 << 20]byte + z = x27 + var x28 [10 << 20]byte + z = x28 + var x29 [10 << 20]byte + z = x29 + var x30 [10 << 20]byte + z = x30 + var x31 [10 << 20]byte + z = x31 + var x32 [10 << 20]byte + z = x32 + var x33 [10 << 20]byte + z = x33 + var x34 [10 << 20]byte + z = x34 + var x35 [10 << 20]byte + z = x35 + var x36 [10 << 20]byte + z = x36 + var x37 [10 << 20]byte + z = x37 + var x38 [10 << 20]byte + z = x38 + var x39 [10 << 20]byte + z = x39 + var x40 [10 << 20]byte + z = x40 + var x41 [10 << 20]byte + z = x41 + var x42 [10 << 20]byte + z = x42 + var x43 [10 << 20]byte + z = x43 + var x44 [10 << 20]byte + z = x44 + var x45 [10 << 20]byte + z = x45 + var x46 [10 << 20]byte + z = x46 + var x47 [10 << 20]byte + z = x47 + var x48 [10 << 20]byte + z = x48 + var x49 [10 << 20]byte + z = x49 + var x50 [10 << 20]byte + z = x50 + var x51 [10 << 20]byte + z = x51 + var x52 [10 << 20]byte + z = x52 + var x53 [10 << 20]byte + z = x53 + var x54 [10 << 20]byte + z = x54 + var x55 [10 << 20]byte + z = x55 + var x56 [10 << 20]byte + z = x56 + var x57 [10 << 20]byte + z = x57 + var x58 [10 << 20]byte + z = x58 + var x59 [10 << 20]byte + z = x59 + var x60 [10 << 20]byte + z = x60 + var x61 [10 << 20]byte + z = x61 + var x62 [10 << 20]byte + z = x62 + var x63 [10 << 20]byte + z = x63 + var x64 [10 << 20]byte + z = x64 + var x65 [10 << 20]byte + z = x65 + var x66 [10 << 20]byte + z = x66 + var x67 [10 << 20]byte + z = x67 + var x68 [10 << 20]byte + z = x68 + var x69 [10 << 20]byte + z = x69 + var x70 [10 << 20]byte + z = x70 + var x71 [10 << 20]byte + z = x71 + var x72 [10 << 20]byte + z = x72 + var x73 [10 << 20]byte + z = x73 + var x74 [10 << 20]byte + z = x74 + var x75 [10 << 20]byte + z = x75 + var x76 [10 << 20]byte + z = x76 + var x77 [10 << 20]byte + z = x77 + var x78 [10 << 20]byte + z = x78 + var x79 [10 << 20]byte + z = x79 + var x80 [10 << 20]byte + z = x80 + var x81 [10 << 20]byte + z = x81 + var x82 [10 << 20]byte + z = x82 + var x83 [10 << 20]byte + z = x83 + var x84 [10 << 20]byte + z = x84 + var x85 [10 << 20]byte + z = x85 + var x86 [10 << 20]byte + z = x86 + var x87 [10 << 20]byte + z = x87 + var x88 [10 << 20]byte + z = x88 + var x89 [10 << 20]byte + z = x89 + var x90 [10 << 20]byte + z = x90 + var x91 [10 << 20]byte + z = x91 + var x92 [10 << 20]byte + z = x92 + var x93 [10 << 20]byte + z = x93 + var x94 [10 << 20]byte + z = x94 + var x95 [10 << 20]byte + z = x95 + var x96 [10 << 20]byte + z = x96 + var x97 [10 << 20]byte + z = x97 + var x98 [10 << 20]byte + z = x98 + var x99 [10 << 20]byte + z = x99 + var x100 [10 << 20]byte + z = x100 + var x101 [10 << 20]byte + z = x101 + var x102 [10 << 20]byte + z = x102 + var x103 [10 << 20]byte + z = x103 + var x104 [10 << 20]byte + z = x104 + var x105 [10 << 20]byte + z = x105 + var x106 [10 << 20]byte + z = x106 + var x107 [10 << 20]byte + z = x107 + var x108 [10 << 20]byte + z = x108 + var x109 [10 << 20]byte + z = x109 + var x110 [10 << 20]byte + z = x110 + var x111 [10 << 20]byte + z = x111 + var x112 [10 << 20]byte + z = x112 + var x113 [10 << 20]byte + z = x113 + var x114 [10 << 20]byte + z = x114 + var x115 [10 << 20]byte + z = x115 + var x116 [10 << 20]byte + z = x116 + var x117 [10 << 20]byte + z = x117 + var x118 [10 << 20]byte + z = x118 + var x119 [10 << 20]byte + z = x119 + var x120 [10 << 20]byte + z = x120 + var x121 [10 << 20]byte + z = x121 + var x122 [10 << 20]byte + z = x122 + var x123 [10 << 20]byte + z = x123 + var x124 [10 << 20]byte + z = x124 + var x125 [10 << 20]byte + z = x125 + var x126 [10 << 20]byte + z = x126 + var x127 [10 << 20]byte + z = x127 + var x128 [10 << 20]byte + z = x128 + var x129 [10 << 20]byte + z = x129 + var x130 [10 << 20]byte + z = x130 + var x131 [10 << 20]byte + z = x131 + var x132 [10 << 20]byte + z = x132 + var x133 [10 << 20]byte + z = x133 + var x134 [10 << 20]byte + z = x134 + var x135 [10 << 20]byte + z = x135 + var x136 [10 << 20]byte + z = x136 + var x137 [10 << 20]byte + z = x137 + var x138 [10 << 20]byte + z = x138 + var x139 [10 << 20]byte + z = x139 + var x140 [10 << 20]byte + z = x140 + var x141 [10 << 20]byte + z = x141 + var x142 [10 << 20]byte + z = x142 + var x143 [10 << 20]byte + z = x143 + var x144 [10 << 20]byte + z = x144 + var x145 [10 << 20]byte + z = x145 + var x146 [10 << 20]byte + z = x146 + var x147 [10 << 20]byte + z = x147 + var x148 [10 << 20]byte + z = x148 + var x149 [10 << 20]byte + z = x149 + var x150 [10 << 20]byte + z = x150 + var x151 [10 << 20]byte + z = x151 + var x152 [10 << 20]byte + z = x152 + var x153 [10 << 20]byte + z = x153 + var x154 [10 << 20]byte + z = x154 + var x155 [10 << 20]byte + z = x155 + var x156 [10 << 20]byte + z = x156 + var x157 [10 << 20]byte + z = x157 + var x158 [10 << 20]byte + z = x158 + var x159 [10 << 20]byte + z = x159 + var x160 [10 << 20]byte + z = x160 + var x161 [10 << 20]byte + z = x161 + var x162 [10 << 20]byte + z = x162 + var x163 [10 << 20]byte + z = x163 + var x164 [10 << 20]byte + z = x164 + var x165 [10 << 20]byte + z = x165 + var x166 [10 << 20]byte + z = x166 + var x167 [10 << 20]byte + z = x167 + var x168 [10 << 20]byte + z = x168 + var x169 [10 << 20]byte + z = x169 + var x170 [10 << 20]byte + z = x170 + var x171 [10 << 20]byte + z = x171 + var x172 [10 << 20]byte + z = x172 + var x173 [10 << 20]byte + z = x173 + var x174 [10 << 20]byte + z = x174 + var x175 [10 << 20]byte + z = x175 + var x176 [10 << 20]byte + z = x176 + var x177 [10 << 20]byte + z = x177 + var x178 [10 << 20]byte + z = x178 + var x179 [10 << 20]byte + z = x179 + var x180 [10 << 20]byte + z = x180 + var x181 [10 << 20]byte + z = x181 + var x182 [10 << 20]byte + z = x182 + var x183 [10 << 20]byte + z = x183 + var x184 [10 << 20]byte + z = x184 + var x185 [10 << 20]byte + z = x185 + var x186 [10 << 20]byte + z = x186 + var x187 [10 << 20]byte + z = x187 + var x188 [10 << 20]byte + z = x188 + var x189 [10 << 20]byte + z = x189 + var x190 [10 << 20]byte + z = x190 + var x191 [10 << 20]byte + z = x191 + var x192 [10 << 20]byte + z = x192 + var x193 [10 << 20]byte + z = x193 + var x194 [10 << 20]byte + z = x194 + var x195 [10 << 20]byte + z = x195 + var x196 [10 << 20]byte + z = x196 + var x197 [10 << 20]byte + z = x197 + var x198 [10 << 20]byte + z = x198 + var x199 [10 << 20]byte + z = x199 + var x200 [10 << 20]byte + z = x200 + var x201 [10 << 20]byte + z = x201 + var x202 [10 << 20]byte + z = x202 + var x203 [10 << 20]byte + z = x203 + var x204 [10 << 20]byte + z = x204 + var x205 [10 << 20]byte + z = x205 + var x206 [10 << 20]byte + z = x206 } diff --git a/test/fixedbugs/bug386.go b/test/fixedbugs/bug386.go index 889c8b0c12..92fc33bb36 100644 --- a/test/fixedbugs/bug386.go +++ b/test/fixedbugs/bug386.go @@ -4,9 +4,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Issue 2451, 2452 +// Issue 2451, 2452 package foo func f() error { return 0 } // ERROR "cannot use 0 .type int.|has no methods" -func g() error { return -1 } // ERROR "cannot use -1 .type int.|has no methods" +func g() error { return -1 } // ERROR "cannot use -1 .type int.|has no methods" diff --git a/test/fixedbugs/bug387.go b/test/fixedbugs/bug387.go index d885445744..2e30bc42a3 100644 --- a/test/fixedbugs/bug387.go +++ b/test/fixedbugs/bug387.go @@ -12,19 +12,18 @@ missing typecheck: [7f5bf07b4438] . AS l(45) . . NAME-main.autotmp_0017 u(1) a(1) l(45) x(0+0) class(PAUTO) esc(N) tc(1) used(1) ARRAY-[2]string -internal compiler error: missing typecheck +internal compiler error: missing typecheck */ package main import ( - "fmt" - "path/filepath" + "fmt" + "path/filepath" ) func main() { - switch _, err := filepath.Glob(filepath.Join(".", "vnc")); { - case err != nil: - fmt.Println(err) - } + switch _, err := filepath.Glob(filepath.Join(".", "vnc")); { + case err != nil: + fmt.Println(err) + } } - diff --git a/test/fixedbugs/bug389.go b/test/fixedbugs/bug389.go index 14804c8471..8f40c0e215 100644 --- a/test/fixedbugs/bug389.go +++ b/test/fixedbugs/bug389.go @@ -9,4 +9,4 @@ package foo func fn(a float32) {} -var f func(arg int) = fn // ERROR "cannot use fn .type func.float32.. as type func.int. in assignment|different parameter types" +var f func(arg int) = fn // ERROR "cannot use fn .type func.float32.. as type func.int. in assignment|different parameter types" diff --git a/test/fixedbugs/bug391.go b/test/fixedbugs/bug391.go index 9211b1c2cf..00b84103bc 100644 --- a/test/fixedbugs/bug391.go +++ b/test/fixedbugs/bug391.go @@ -7,8 +7,9 @@ // Issue 2576 package bug -type T struct { a int } +type T struct{ a int } func f(t T) { - switch _, _ = t.a, t.a; {} -} \ No newline at end of file + switch _, _ = t.a, t.a; { + } +} diff --git a/test/fixedbugs/bug392.dir/one.go b/test/fixedbugs/bug392.dir/one.go index aba8649b5b..081e25c532 100644 --- a/test/fixedbugs/bug392.dir/one.go +++ b/test/fixedbugs/bug392.dir/one.go @@ -18,26 +18,25 @@ func F2(c chan int) bool { return c == (<-chan int)(nil) } func F3() (ret []int) { return append(ret, 1) } // Call of inlined method with blank receiver. -func (_ *T) M() int { return 1 } +func (_ *T) M() int { return 1 } func (t *T) MM() int { return t.M() } - // One more like issue 2678 -type S struct { x, y int } +type S struct{ x, y int } type U []S -func F4(S int) U { return U{{S,S}} } +func F4(S int) U { return U{{S, S}} } func F5() []*S { - return []*S{ {1,2}, { 3, 4} } + return []*S{{1, 2}, {3, 4}} } func F6(S int) *U { - return &U{{S,S}} + return &U{{S, S}} } // Bug in the fix. -type PB struct { x int } +type PB struct{ x int } func (t *PB) Reset() { *t = PB{} } diff --git a/test/fixedbugs/bug396.dir/one.go b/test/fixedbugs/bug396.dir/one.go index 66eba63f5c..f599959e10 100644 --- a/test/fixedbugs/bug396.dir/one.go +++ b/test/fixedbugs/bug396.dir/one.go @@ -5,6 +5,6 @@ package one // Issue 2687 -type T struct { int } +type T struct{ int } func New(i int) T { return T{i} } diff --git a/test/fixedbugs/bug396.dir/two.go b/test/fixedbugs/bug396.dir/two.go index 9152bec254..4e30bfab9c 100644 --- a/test/fixedbugs/bug396.dir/two.go +++ b/test/fixedbugs/bug396.dir/two.go @@ -11,4 +11,4 @@ import "./one" func use() { _ = one.New(1) -} \ No newline at end of file +} diff --git a/test/fixedbugs/bug397.go b/test/fixedbugs/bug397.go index 6188e3ee0c..339da2eb4b 100644 --- a/test/fixedbugs/bug397.go +++ b/test/fixedbugs/bug397.go @@ -7,7 +7,7 @@ package main // Issue 2623 -var m = map[string]int { - "abc":1, - 1:2, // ERROR "cannot use 1.*as type string in map key|incompatible type" +var m = map[string]int{ + "abc": 1, + 1: 2, // ERROR "cannot use 1.*as type string in map key|incompatible type" } diff --git a/test/fixedbugs/bug398.go b/test/fixedbugs/bug398.go index a1583bd774..3848cd4061 100644 --- a/test/fixedbugs/bug398.go +++ b/test/fixedbugs/bug398.go @@ -12,33 +12,33 @@ package p // exported interfaces type I1 interface { - F() interface{I1} + F() interface{ I1 } } type I2 interface { - F() interface{I2} + F() interface{ I2 } } var V1 I1 var V2 I2 func F() bool { - return V1 == V2 + return V1 == V2 } // non-exported interfaces type i1 interface { - F() interface{i1} + F() interface{ i1 } } type i2 interface { - F() interface{i2} + F() interface{ i2 } } var v1 i1 var v2 i2 func f() bool { - return v1 == v2 + return v1 == v2 } diff --git a/test/fixedbugs/bug399.go b/test/fixedbugs/bug399.go index e460d81227..343add59da 100644 --- a/test/fixedbugs/bug399.go +++ b/test/fixedbugs/bug399.go @@ -7,9 +7,9 @@ // Issue 2674 package main + const dow = "\000\003" func main() { println(int(dow[1])) } - diff --git a/test/fixedbugs/bug405.go b/test/fixedbugs/bug405.go index e8ecc4d034..f0c3081976 100644 --- a/test/fixedbugs/bug405.go +++ b/test/fixedbugs/bug405.go @@ -8,7 +8,7 @@ package main -type S struct {} +type S struct{} func (_ S) F(i int) int { return i diff --git a/test/fixedbugs/bug407.dir/one.go b/test/fixedbugs/bug407.dir/one.go index c85b077b66..fd900ef4ad 100644 --- a/test/fixedbugs/bug407.dir/one.go +++ b/test/fixedbugs/bug407.dir/one.go @@ -11,10 +11,7 @@ type T struct { } func (t *T) foo(arg int) {} -func (t T) goo(arg int) {} +func (t T) goo(arg int) {} func (t *T) F() { t.f = (*T).foo } func (t *T) G() { t.g = T.goo } - - - diff --git a/test/fixedbugs/bug410.go b/test/fixedbugs/bug410.go index a4eef64d8e..f0761febfa 100644 --- a/test/fixedbugs/bug410.go +++ b/test/fixedbugs/bug410.go @@ -12,13 +12,13 @@ type y struct { num int } -func zzz () { - k := make([]byte, 10) - arr := make ([]*y, 0) - for s := range arr { - x := make([]byte, 10) - for i := 0; i < 100 ; i++ { - x[i] ^= k[i-arr[s].num%3] - } - } +func zzz() { + k := make([]byte, 10) + arr := make([]*y, 0) + for s := range arr { + x := make([]byte, 10) + for i := 0; i < 100; i++ { + x[i] ^= k[i-arr[s].num%3] + } + } } diff --git a/test/fixedbugs/bug411.go b/test/fixedbugs/bug411.go index a1c36f617c..7f90ae0e93 100644 --- a/test/fixedbugs/bug411.go +++ b/test/fixedbugs/bug411.go @@ -14,6 +14,5 @@ func f1(a int64) { f2(float64(a), float64(a)) } -func f2(a,b float64) { +func f2(a, b float64) { } - diff --git a/test/fixedbugs/bug412.go b/test/fixedbugs/bug412.go index 183fb7e4af..a39abf17e1 100644 --- a/test/fixedbugs/bug412.go +++ b/test/fixedbugs/bug412.go @@ -7,10 +7,10 @@ package p type t struct { - x int // GCCGO_ERROR "duplicate field name .x." - x int // GC_ERROR "duplicate field x" + x int // GCCGO_ERROR "duplicate field name .x." + x int // GC_ERROR "duplicate field x" } func f(t *t) int { - return t.x // GC_ERROR "ambiguous selector t.x" + return t.x // GC_ERROR "ambiguous selector t.x" } diff --git a/test/fixedbugs/bug413.go b/test/fixedbugs/bug413.go index 819bd1a984..12e1e5e58b 100644 --- a/test/fixedbugs/bug413.go +++ b/test/fixedbugs/bug413.go @@ -8,4 +8,4 @@ package p func f(i int) int { return i } -var i = func() int {a := f(i); return a}() // ERROR "initialization loop|depends upon itself" +var i = func() int { a := f(i); return a }() // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/bug415.dir/p.go b/test/fixedbugs/bug415.dir/p.go index e86a697643..fca0124014 100644 --- a/test/fixedbugs/bug415.dir/p.go +++ b/test/fixedbugs/bug415.dir/p.go @@ -5,10 +5,9 @@ package p type A struct { - s struct{int} + s struct{ int } } func (a *A) f() { - a.s = struct{int}{0} + a.s = struct{ int }{0} } - diff --git a/test/fixedbugs/bug415.dir/prog.go b/test/fixedbugs/bug415.dir/prog.go index 1ffde188b7..f2a4e6dd0d 100644 --- a/test/fixedbugs/bug415.dir/prog.go +++ b/test/fixedbugs/bug415.dir/prog.go @@ -3,7 +3,9 @@ // license that can be found in the LICENSE file. package main + import "./p" + func main() {} -var _ p.A +var _ p.A diff --git a/test/fixedbugs/bug417.go b/test/fixedbugs/bug417.go index a9acb42386..1b44aa927c 100644 --- a/test/fixedbugs/bug417.go +++ b/test/fixedbugs/bug417.go @@ -14,17 +14,19 @@ type S1 struct { s [][1]S3 m map[int][1]S3 c chan [1]S3 - i interface { f([1]S3) [1]S3 } + i interface{ f([1]S3) [1]S3 } f func([1]S3) [1]S3 } type S2 struct { - p *struct { F S3 } - s []struct { F S3 } - m map[int]struct { F S3 } - c chan struct { F S3 } - i interface { f(struct { F S3 }) struct { F S3 } } - f func(struct { F S3 } ) struct { F S3 } + p *struct{ F S3 } + s []struct{ F S3 } + m map[int]struct{ F S3 } + c chan struct{ F S3 } + i interface { + f(struct{ F S3 }) struct{ F S3 } + } + f func(struct{ F S3 }) struct{ F S3 } } type S3 struct { diff --git a/test/fixedbugs/bug420.go b/test/fixedbugs/bug420.go index 02b4349d80..6601597cad 100644 --- a/test/fixedbugs/bug420.go +++ b/test/fixedbugs/bug420.go @@ -10,5 +10,5 @@ package main func main() { - (_) = 0 + (_) = 0 } diff --git a/test/fixedbugs/bug421.go b/test/fixedbugs/bug421.go index 1fe02375ab..b1f1c56275 100644 --- a/test/fixedbugs/bug421.go +++ b/test/fixedbugs/bug421.go @@ -10,8 +10,8 @@ package main func main() { - println(int(1) == uint(1)) // ERROR "types" + println(int(1) == uint(1)) // ERROR "types" var x int = 1 var y uint = 1 - println(x == y) // ERROR "types" + println(x == y) // ERROR "types" } diff --git a/test/fixedbugs/bug424.dir/main.go b/test/fixedbugs/bug424.dir/main.go index 28b41e68a7..adf01fc112 100644 --- a/test/fixedbugs/bug424.dir/main.go +++ b/test/fixedbugs/bug424.dir/main.go @@ -59,7 +59,7 @@ func main() { if t3.m() != "main.localT.m" { println("BUG: t3:", t3.m(), "called") } - + i = new(myT3) if i.m() != "main.localT.m" { t := reflect.TypeOf(i) @@ -70,7 +70,7 @@ func main() { } println("BUG: myT3:", i.m(), "called") } - + var t4 struct { localT lib.T @@ -82,7 +82,7 @@ func main() { if i.m() != "main.localT.m" { println("BUG: myT4:", i.m(), "called") } - + var t5 struct { lib.T localT diff --git a/test/fixedbugs/bug424.go b/test/fixedbugs/bug424.go index 9c59abe802..6423961fe0 100644 --- a/test/fixedbugs/bug424.go +++ b/test/fixedbugs/bug424.go @@ -10,4 +10,3 @@ // embedding is done. package ignored - diff --git a/test/fixedbugs/bug425.go b/test/fixedbugs/bug425.go index c3035f6a91..a13a82c0f8 100644 --- a/test/fixedbugs/bug425.go +++ b/test/fixedbugs/bug425.go @@ -13,5 +13,5 @@ import "fmt" func main() { s := "hello" fmt.Println(s == "") - fmt.Println(s + "world" == "world") + fmt.Println(s+"world" == "world") } diff --git a/test/fixedbugs/bug427.go b/test/fixedbugs/bug427.go index c13bb815ca..a1b3f5b7fa 100644 --- a/test/fixedbugs/bug427.go +++ b/test/fixedbugs/bug427.go @@ -9,10 +9,10 @@ package main // struct with four fields of basic type -type S struct {a, b, c, d int} +type S struct{ a, b, c, d int } // struct with five fields of basic type -type T struct {a, b, c, d, e int} +type T struct{ a, b, c, d, e int } // array with four elements type A [4]int diff --git a/test/fixedbugs/bug439.go b/test/fixedbugs/bug439.go index 87d4ae0373..1ad7b7f443 100644 --- a/test/fixedbugs/bug439.go +++ b/test/fixedbugs/bug439.go @@ -14,7 +14,7 @@ func (e E) P() *E { return &e } const ( C1 E = 0 - C2 = C1 + C2 = C1 ) func F() *E { diff --git a/test/fixedbugs/bug441.go b/test/fixedbugs/bug441.go index b67125b1e8..a0b051e62f 100644 --- a/test/fixedbugs/bug441.go +++ b/test/fixedbugs/bug441.go @@ -23,11 +23,13 @@ func main() { } } -func foo(_ int) {} +func foo(_ int) {} func foo2(_, _ int) {} func foo3(int, int) {} + type T int -func (_ T) m1() {} + +func (_ T) m1() {} func (t T) m2(_ int) {} func side() int { diff --git a/test/fixedbugs/bug442.go b/test/fixedbugs/bug442.go index 684d54ffbb..c3e1d5b20f 100644 --- a/test/fixedbugs/bug442.go +++ b/test/fixedbugs/bug442.go @@ -20,7 +20,7 @@ func main() { m := map[T]int{} m[T{X: 1, Y: 2}] = 1 m[T{X: 2, Y: 3}] = 2 - m[T{X: 1, Y: 2}] = 3 // overwrites first entry + m[T{X: 1, Y: 2}] = 3 // overwrites first entry if len(m) != 2 { println("BUG") } diff --git a/test/fixedbugs/bug443.go b/test/fixedbugs/bug443.go index 9abd2548a5..eaa3d55823 100644 --- a/test/fixedbugs/bug443.go +++ b/test/fixedbugs/bug443.go @@ -9,9 +9,9 @@ package p -type T1 struct { F *T2 } +type T1 struct{ F *T2 } type T2 T1 type T3 T2 -func (*T3) M() // was invalid receiver +func (*T3) M() // was invalid receiver diff --git a/test/fixedbugs/bug444.go b/test/fixedbugs/bug444.go index 29a60f590f..69c5bd8e59 100644 --- a/test/fixedbugs/bug444.go +++ b/test/fixedbugs/bug444.go @@ -12,14 +12,14 @@ package main import "reflect" -type T interface {} +type T interface{} var x bool func main() { - reflect.TypeOf(nil) - reflect.TypeOf(T(nil)) // used to miscompile - shouldPanic() + reflect.TypeOf(nil) + reflect.TypeOf(T(nil)) // used to miscompile + shouldPanic() } func f() byte { diff --git a/test/fixedbugs/bug446.go b/test/fixedbugs/bug446.go index 1e435e1109..580415c181 100644 --- a/test/fixedbugs/bug446.go +++ b/test/fixedbugs/bug446.go @@ -33,4 +33,3 @@ func main() { panic("dummy2 != 2") } } - diff --git a/test/fixedbugs/bug447.go b/test/fixedbugs/bug447.go index 8358f0034f..db3b8404ec 100644 --- a/test/fixedbugs/bug447.go +++ b/test/fixedbugs/bug447.go @@ -16,8 +16,8 @@ import ( ) var ( - intWidths = []int{8, 16, 32, 64} // int%d and uint%d - floatWidths = []int{32, 64} // float%d + intWidths = []int{8, 16, 32, 64} // int%d and uint%d + floatWidths = []int{32, 64} // float%d ) func main() { @@ -59,8 +59,7 @@ const testSegment = ` } }` -const testFunc = -`func test$I(f float64, i int64) { +const testFunc = `func test$I(f float64, i int64) { if i != int64($I(i))$TEST { return } @@ -68,8 +67,7 @@ $TESTSEGMENTS } ` -var program = -`package main +var program = `package main import ( "fmt" diff --git a/test/fixedbugs/bug448.dir/pkg2.go b/test/fixedbugs/bug448.dir/pkg2.go index 20d850915d..8eee8e88dd 100644 --- a/test/fixedbugs/bug448.dir/pkg2.go +++ b/test/fixedbugs/bug448.dir/pkg2.go @@ -11,4 +11,3 @@ import "./pkg1" func F() { pkg1.Do() } - diff --git a/test/fixedbugs/bug460.go b/test/fixedbugs/bug460.go index a1b6f477ff..130d190cb3 100644 --- a/test/fixedbugs/bug460.go +++ b/test/fixedbugs/bug460.go @@ -7,4 +7,3 @@ // part one of issue 4124. Make sure that the compiler rejects access attempts. package ignored - diff --git a/test/fixedbugs/bug462.go b/test/fixedbugs/bug462.go index 3df63b091d..4765e18afd 100644 --- a/test/fixedbugs/bug462.go +++ b/test/fixedbugs/bug462.go @@ -13,7 +13,7 @@ type T struct { } func main() { - _ = T { + _ = T{ os.File: 1, // ERROR "unknown T? ?field" } } diff --git a/test/fixedbugs/bug466.dir/a.go b/test/fixedbugs/bug466.dir/a.go index e27699c2ef..21fe0a6062 100644 --- a/test/fixedbugs/bug466.dir/a.go +++ b/test/fixedbugs/bug466.dir/a.go @@ -4,7 +4,7 @@ package a -const N = 2+3i +const N = 2 + 3i func Func() []complex128 { return []complex128{1, complex(2, 3), complex(4, 5)} diff --git a/test/fixedbugs/bug466.go b/test/fixedbugs/bug466.go index dc909d483c..c2a15ef707 100644 --- a/test/fixedbugs/bug466.go +++ b/test/fixedbugs/bug466.go @@ -8,4 +8,3 @@ // complex literals "a+bi" to "a+b". package ignored - diff --git a/test/fixedbugs/bug468.dir/p1.go b/test/fixedbugs/bug468.dir/p1.go index cdda735e96..b35e08acb4 100644 --- a/test/fixedbugs/bug468.dir/p1.go +++ b/test/fixedbugs/bug468.dir/p1.go @@ -4,4 +4,4 @@ package p1 -type S struct { X, Y int } +type S struct{ X, Y int } diff --git a/test/fixedbugs/bug468.dir/p2.go b/test/fixedbugs/bug468.dir/p2.go index dbb46931b8..42deea8bd5 100644 --- a/test/fixedbugs/bug468.dir/p2.go +++ b/test/fixedbugs/bug468.dir/p2.go @@ -12,7 +12,7 @@ import ( func main() { var v1 = p1.S{1, 2} - var v2 = struct { X, Y int }{1, 2} + var v2 = struct{ X, Y int }{1, 2} v1 = v2 t1 := reflect.TypeOf(v1) t2 := reflect.TypeOf(v2) diff --git a/test/fixedbugs/bug470.go b/test/fixedbugs/bug470.go index c21663f3f3..72326b6e85 100644 --- a/test/fixedbugs/bug470.go +++ b/test/fixedbugs/bug470.go @@ -11,8 +11,8 @@ package main import "fmt" const ( - F32 = 0.00999999977648258209228515625 - F64 = 0.01000000000000000020816681711721685132943093776702880859375 + F32 = 0.00999999977648258209228515625 + F64 = 0.01000000000000000020816681711721685132943093776702880859375 ) var F = float64(float32(0.01)) diff --git a/test/fixedbugs/bug479.dir/a.go b/test/fixedbugs/bug479.dir/a.go index eddb4cf078..424fc45d30 100644 --- a/test/fixedbugs/bug479.dir/a.go +++ b/test/fixedbugs/bug479.dir/a.go @@ -6,7 +6,7 @@ package p import "unsafe" -type S2 struct {} +type S2 struct{} const C = unsafe.Sizeof(S2{}) diff --git a/test/fixedbugs/bug480.dir/a.go b/test/fixedbugs/bug480.dir/a.go index 26a8d11669..cd87d87f2d 100644 --- a/test/fixedbugs/bug480.dir/a.go +++ b/test/fixedbugs/bug480.dir/a.go @@ -4,7 +4,7 @@ package a -type S interface{ +type S interface { F() T } diff --git a/test/fixedbugs/bug486.go b/test/fixedbugs/bug486.go index 9ad23b3cfc..dce43f4b0e 100644 --- a/test/fixedbugs/bug486.go +++ b/test/fixedbugs/bug486.go @@ -11,4 +11,4 @@ package main /*// comment -*/ + */ diff --git a/test/fixedbugs/bug487.go b/test/fixedbugs/bug487.go index ab61a19a94..c61dcb0f31 100644 --- a/test/fixedbugs/bug487.go +++ b/test/fixedbugs/bug487.go @@ -14,11 +14,11 @@ func G() (int, int, int) { } func F() { - a, b := G() // ERROR "assignment mismatch" - a, b = G() // ERROR "assignment mismatch" + a, b := G() // ERROR "assignment mismatch" + a, b = G() // ERROR "assignment mismatch" _, _ = a, b } func H() (int, int) { - return G() // ERROR "too many|mismatch" + return G() // ERROR "too many|mismatch" } diff --git a/test/fixedbugs/bug488.dir/a.go b/test/fixedbugs/bug488.dir/a.go index fc494207a1..798011414e 100644 --- a/test/fixedbugs/bug488.dir/a.go +++ b/test/fixedbugs/bug488.dir/a.go @@ -4,4 +4,4 @@ package a -var p2 = Printf // ERROR "undefined" +var p2 = Printf // ERROR "undefined" diff --git a/test/fixedbugs/bug490.go b/test/fixedbugs/bug490.go index 387a680aee..1d8b29d037 100644 --- a/test/fixedbugs/bug490.go +++ b/test/fixedbugs/bug490.go @@ -8,7 +8,7 @@ // interface and an empty struct literal. package p - + type S struct{} func F(v interface{}) bool { diff --git a/test/fixedbugs/bug491.go b/test/fixedbugs/bug491.go index 39a3509c69..6bc7b470f0 100644 --- a/test/fixedbugs/bug491.go +++ b/test/fixedbugs/bug491.go @@ -107,4 +107,4 @@ func bug() { println("BUG") bugged = true } -} \ No newline at end of file +} diff --git a/test/fixedbugs/bug500.go b/test/fixedbugs/bug500.go index 2dd5df13b0..e57de98b60 100644 --- a/test/fixedbugs/bug500.go +++ b/test/fixedbugs/bug500.go @@ -35,7 +35,7 @@ func init() { func main() { runtime.GC() - if a[0].str != b + c { + if a[0].str != b+c { panic(a[0].str) } } diff --git a/test/fixedbugs/gcc61264.go b/test/fixedbugs/gcc61264.go index a4092f5bec..569f601bc8 100644 --- a/test/fixedbugs/gcc61264.go +++ b/test/fixedbugs/gcc61264.go @@ -9,5 +9,5 @@ package main func main() { - map[int]int{}[0]++ + map[int]int{}[0]++ } diff --git a/test/fixedbugs/gcc67968.dir/b.go b/test/fixedbugs/gcc67968.dir/b.go index 41b62d2088..dd9eddae31 100644 --- a/test/fixedbugs/gcc67968.dir/b.go +++ b/test/fixedbugs/gcc67968.dir/b.go @@ -6,7 +6,7 @@ package b import "./a" -func F() (interface{}) { - var v *a.T - return v.Foo() +func F() interface{} { + var v *a.T + return v.Foo() } diff --git a/test/fixedbugs/issue10607a.go b/test/fixedbugs/issue10607a.go index 51399e4ecf..92a7474fa1 100644 --- a/test/fixedbugs/issue10607a.go +++ b/test/fixedbugs/issue10607a.go @@ -54,7 +54,7 @@ func main() { // 3 == NT_GNU_BUILD_ID if typ == 3 && namesz == 4 && bytes.Equal(d[12:16], []byte("GNU\000")) { - id := string(d[12+an:12+an+descsz]) + id := string(d[12+an : 12+an+descsz]) if id == "\x12\x34\x56\x78" { c++ } else { diff --git a/test/fixedbugs/issue11326.go b/test/fixedbugs/issue11326.go index 82754c73fb..178f1335b6 100644 --- a/test/fixedbugs/issue11326.go +++ b/test/fixedbugs/issue11326.go @@ -18,14 +18,14 @@ func main() { // Any implementation must be able to handle these constants at // compile time (even though they cannot be assigned to a float64). - var _ = 1e646456992 // ERROR "1e\+646456992 overflows float64" - var _ = 1e64645699 // ERROR "1e\+64645699 overflows float64" - var _ = 1e6464569 // ERROR "1e\+6464569 overflows float64" - var _ = 1e646456 // ERROR "1e\+646456 overflows float64" - var _ = 1e64645 // ERROR "1e\+64645 overflows float64" - var _ = 1e6464 // ERROR "1e\+6464 overflows float64" - var _ = 1e646 // ERROR "1e\+646 overflows float64" - var _ = 1e309 // ERROR "1e\+309 overflows float64" + var _ = 1e646456992 // ERROR "1e\+646456992 overflows float64" + var _ = 1e64645699 // ERROR "1e\+64645699 overflows float64" + var _ = 1e6464569 // ERROR "1e\+6464569 overflows float64" + var _ = 1e646456 // ERROR "1e\+646456 overflows float64" + var _ = 1e64645 // ERROR "1e\+64645 overflows float64" + var _ = 1e6464 // ERROR "1e\+6464 overflows float64" + var _ = 1e646 // ERROR "1e\+646 overflows float64" + var _ = 1e309 // ERROR "1e\+309 overflows float64" var _ = 1e308 } diff --git a/test/fixedbugs/issue11361.go b/test/fixedbugs/issue11361.go index 1260ea89c9..f9fa6a4ea3 100644 --- a/test/fixedbugs/issue11361.go +++ b/test/fixedbugs/issue11361.go @@ -6,6 +6,6 @@ package a -import "fmt" // ERROR "imported and not used" +import "fmt" // ERROR "imported and not used" const n = fmt // ERROR "fmt without selector" diff --git a/test/fixedbugs/issue11362.go b/test/fixedbugs/issue11362.go index 9e9e599595..2c14e9e318 100644 --- a/test/fixedbugs/issue11362.go +++ b/test/fixedbugs/issue11362.go @@ -12,4 +12,3 @@ import _ "unicode//utf8" // ERROR "non-canonical import path .unicode//utf8. \(s func main() { } - diff --git a/test/fixedbugs/issue12677.dir/p.go b/test/fixedbugs/issue12677.dir/p.go index e395071f8d..40cd872158 100644 --- a/test/fixedbugs/issue12677.dir/p.go +++ b/test/fixedbugs/issue12677.dir/p.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. package p + func Baz(f int) float64 { - return 1 / float64(int(1)<<(uint(f))) + return 1 / float64(int(1)<<(uint(f))) } diff --git a/test/fixedbugs/issue12677.dir/q.go b/test/fixedbugs/issue12677.dir/q.go index fd39c8a9ca..ae4fb8aa84 100644 --- a/test/fixedbugs/issue12677.dir/q.go +++ b/test/fixedbugs/issue12677.dir/q.go @@ -3,5 +3,7 @@ // license that can be found in the LICENSE file. package q + import "./p" + func f() { println(p.Baz(2)) } diff --git a/test/fixedbugs/issue13261.go b/test/fixedbugs/issue13261.go index a944f3a9b5..1b39f08ce8 100644 --- a/test/fixedbugs/issue13261.go +++ b/test/fixedbugs/issue13261.go @@ -13,17 +13,23 @@ type T struct{} func main() { _ = &T{} _ = &(T{}) - _ = &((T{})) + _ = &(T{}) _ = &struct{}{} _ = &(struct{}{}) - _ = &((struct{}{})) - - switch (&T{}) {} - switch &(T{}) {} - switch &((T{})) {} + _ = &(struct{}{}) - switch &struct{}{} {} - switch &(struct{}{}) {} - switch &((struct{}{})) {} + switch (&T{}) { + } + switch &(T{}) { + } + switch &(T{}) { + } + + switch &struct{}{} { + } + switch &(struct{}{}) { + } + switch &(struct{}{}) { + } } diff --git a/test/fixedbugs/issue13265.go b/test/fixedbugs/issue13265.go index 3e16cee6e7..9086ccda63 100644 --- a/test/fixedbugs/issue13265.go +++ b/test/fixedbugs/issue13265.go @@ -10,7 +10,7 @@ package p func f() { - var c chan chan chan int - for ; ; <-<-<-c { - } + var c chan chan chan int + for ; ; <-<-<-c { + } } diff --git a/test/fixedbugs/issue13337.go b/test/fixedbugs/issue13337.go index 81f984b732..4138eaf583 100644 --- a/test/fixedbugs/issue13337.go +++ b/test/fixedbugs/issue13337.go @@ -10,6 +10,7 @@ package s type S0 struct{ f int } + func (S0) m() {} type S1 struct{ S0 } diff --git a/test/fixedbugs/issue13415.go b/test/fixedbugs/issue13415.go index 989a1ed50f..20085a3f49 100644 --- a/test/fixedbugs/issue13415.go +++ b/test/fixedbugs/issue13415.go @@ -10,10 +10,10 @@ package p func f() { - select { - case x, x := <-func() chan int { // ERROR "x repeated on left side of :=" - c := make(chan int) - return c - }(): - } + select { + case x, x := <-func() chan int { // ERROR "x repeated on left side of :=" + c := make(chan int) + return c + }(): + } } diff --git a/test/fixedbugs/issue13485.go b/test/fixedbugs/issue13485.go index a9beea1f7d..982dba494c 100644 --- a/test/fixedbugs/issue13485.go +++ b/test/fixedbugs/issue13485.go @@ -9,7 +9,7 @@ package p var ( _ [10]int _ [10.0]int - _ [float64(10)]int // ERROR "invalid array bound" + _ [float64(10)]int // ERROR "invalid array bound" _ [10 + 0i]int _ [complex(10, 0)]int _ [complex128(complex(10, 0))]int // ERROR "invalid array bound" diff --git a/test/fixedbugs/issue14136.go b/test/fixedbugs/issue14136.go index f9efd05f96..12d18c37b1 100644 --- a/test/fixedbugs/issue14136.go +++ b/test/fixedbugs/issue14136.go @@ -15,5 +15,5 @@ type T struct{} func main() { t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1} // ERROR "unknown field 'X' in struct literal of type T" - var s string = 1 // ERROR "cannot use 1" + var s string = 1 // ERROR "cannot use 1" } diff --git a/test/fixedbugs/issue14321.go b/test/fixedbugs/issue14321.go index 058008c386..dbef63179b 100644 --- a/test/fixedbugs/issue14321.go +++ b/test/fixedbugs/issue14321.go @@ -8,14 +8,14 @@ package p -type A struct{ +type A struct { H int } func (A) F() {} func (A) G() {} -type B struct{ +type B struct { G int H int } diff --git a/test/fixedbugs/issue14540.go b/test/fixedbugs/issue14540.go index 62b17a04c4..cc55c7f522 100644 --- a/test/fixedbugs/issue14540.go +++ b/test/fixedbugs/issue14540.go @@ -10,10 +10,11 @@ func f(x int) { switch x { case 0: fallthrough - ; // ok + // ok case 1: fallthrough // ERROR "fallthrough statement out of place" - {} + { + } case 2: fallthrough // ERROR "cannot fallthrough" } diff --git a/test/fixedbugs/issue14651.go b/test/fixedbugs/issue14651.go index 4c756e502e..49eb816554 100644 --- a/test/fixedbugs/issue14651.go +++ b/test/fixedbugs/issue14651.go @@ -18,9 +18,9 @@ import ( ) const ( - p149 = 1.0 / (1 << 149) // 1p-149 - p500 = 1.0 / (1 << 500) // 1p-500 - p1074 = p500 * p500 / (1<<74) // 1p-1074 + p149 = 1.0 / (1 << 149) // 1p-149 + p500 = 1.0 / (1 << 500) // 1p-500 + p1074 = p500 * p500 / (1 << 74) // 1p-1074 ) const ( diff --git a/test/fixedbugs/issue14729.go b/test/fixedbugs/issue14729.go index 88e01f9e16..50b615e2cf 100644 --- a/test/fixedbugs/issue14729.go +++ b/test/fixedbugs/issue14729.go @@ -10,5 +10,5 @@ package main import "unsafe" -type s struct { unsafe.Pointer } // ERROR "embedded type cannot be a pointer" -type s1 struct { p unsafe.Pointer } +type s struct{ unsafe.Pointer } // ERROR "embedded type cannot be a pointer" +type s1 struct{ p unsafe.Pointer } diff --git a/test/fixedbugs/issue15039.go b/test/fixedbugs/issue15039.go index 85d9e8340a..243653e3f0 100644 --- a/test/fixedbugs/issue15039.go +++ b/test/fixedbugs/issue15039.go @@ -18,7 +18,7 @@ func main() { } // cmd/compile used to require integer constants to fit into an "int". - const huge = string(1<<100) + const huge = string(1 << 100) if huge != fffd { panic("huge != bad") } diff --git a/test/fixedbugs/issue15042.go b/test/fixedbugs/issue15042.go index 85d5d6c361..7941bd7157 100644 --- a/test/fixedbugs/issue15042.go +++ b/test/fixedbugs/issue15042.go @@ -22,6 +22,6 @@ func F(c bool, s1, s2 S) (int, int) { func main() { i, j := F(true, S{1}, S{20}) if i != 20 || j != 1 { - panic(i+j) + panic(i + j) } } diff --git a/test/fixedbugs/issue15311.go b/test/fixedbugs/issue15311.go index 81fa541325..6f4ad85feb 100644 --- a/test/fixedbugs/issue15311.go +++ b/test/fixedbugs/issue15311.go @@ -10,11 +10,11 @@ package p type T struct { - toInt map[string]int - toString map[int]string + toInt map[string]int + toString map[int]string } var t = T{ - foo.toInt: make(map[string]int), // ERROR "field name" - bar.toString: make(map[int]string), // ERROR "field name" + foo.toInt: make(map[string]int), // ERROR "field name" + bar.toString: make(map[int]string), // ERROR "field name" } diff --git a/test/fixedbugs/issue15439.go b/test/fixedbugs/issue15439.go index 840a3c02a8..d53077d11a 100644 --- a/test/fixedbugs/issue15439.go +++ b/test/fixedbugs/issue15439.go @@ -10,7 +10,9 @@ import "reflect" func main() { a := &struct{ x int }{} - b := &struct{ x int "" }{} + b := &struct { + x int "" + }{} ta := reflect.TypeOf(a) tb := reflect.TypeOf(b) diff --git a/test/fixedbugs/issue15470.dir/a.go b/test/fixedbugs/issue15470.dir/a.go index 1fcf3ea6e0..69b63530ba 100644 --- a/test/fixedbugs/issue15470.dir/a.go +++ b/test/fixedbugs/issue15470.dir/a.go @@ -10,10 +10,10 @@ type T interface { type S struct{} -func (S) M0(_ int) {} -func (S) M1(x, _ int) {} +func (S) M0(_ int) {} +func (S) M1(x, _ int) {} func (S) M2() (x, _ int) { return } -func (_ S) M3() {} +func (_ S) M3() {} // Snippet from x/tools/godoc/analysis/analysis.go. // Offending code from #5470. diff --git a/test/fixedbugs/issue15548.dir/c.go b/test/fixedbugs/issue15548.dir/c.go index 6d3f3be53e..ce6e3204b3 100644 --- a/test/fixedbugs/issue15548.dir/c.go +++ b/test/fixedbugs/issue15548.dir/c.go @@ -5,6 +5,6 @@ package c import ( - _ "./b" _ "./a" + _ "./b" ) diff --git a/test/fixedbugs/issue15646.go b/test/fixedbugs/issue15646.go index cd4ba9d4e5..53ccd4096e 100644 --- a/test/fixedbugs/issue15646.go +++ b/test/fixedbugs/issue15646.go @@ -6,4 +6,4 @@ // Test that method expressions are correctly encoded // in binary export data and can be imported again. -package ignore \ No newline at end of file +package ignore diff --git a/test/fixedbugs/issue15926.go b/test/fixedbugs/issue15926.go index 76e25eb640..8004545e14 100644 --- a/test/fixedbugs/issue15926.go +++ b/test/fixedbugs/issue15926.go @@ -16,5 +16,5 @@ func (s S) def() {} var I = S.def func main() { - I(S{}) + I(S{}) } diff --git a/test/fixedbugs/issue16515.go b/test/fixedbugs/issue16515.go index 6b67436383..cacff54bfa 100644 --- a/test/fixedbugs/issue16515.go +++ b/test/fixedbugs/issue16515.go @@ -34,7 +34,10 @@ func g() { } func main() { - var s struct { a T; b [8192-62]int } // allocate 64K, hopefully it's in a new span and a few bytes before it is garbage + var s struct { + a T + b [8192 - 62]int + } // allocate 64K, hopefully it's in a new span and a few bytes before it is garbage sink = &s // force heap allocation s.a[0] = 2 zero(&s.a) diff --git a/test/fixedbugs/issue16948.go b/test/fixedbugs/issue16948.go index c986024896..65c87c3f05 100644 --- a/test/fixedbugs/issue16948.go +++ b/test/fixedbugs/issue16948.go @@ -18,6 +18,7 @@ func main() { var x int32 type T [10]int + var sink *T func f() (t T) { diff --git a/test/fixedbugs/issue17449.go b/test/fixedbugs/issue17449.go index 51cc8eaa06..8c8bd4844f 100644 --- a/test/fixedbugs/issue17449.go +++ b/test/fixedbugs/issue17449.go @@ -11,25 +11,25 @@ package master type PriorityList struct { - elems []interface{} + elems []interface{} } func (x *PriorityList) Len() int { return len(x.elems) } func (l *PriorityList) remove(i int) interface{} { - elem := l.elems[i] - l.elems = append(l.elems[:i], l.elems[i+1:]...) - return elem + elem := l.elems[i] + l.elems = append(l.elems[:i], l.elems[i+1:]...) + return elem } func (l *PriorityList) Next() interface{} { - return l.remove(l.Len() - 1) + return l.remove(l.Len() - 1) } var l *PriorityList func Foo() { - // It would fail here if instrumented code (including inline-label) was copied. - for elem := l.Next(); elem != nil; elem = l.Next() { - } + // It would fail here if instrumented code (including inline-label) was copied. + for elem := l.Next(); elem != nil; elem = l.Next() { + } } diff --git a/test/fixedbugs/issue17588.go b/test/fixedbugs/issue17588.go index 1be57c6292..23af6f613b 100644 --- a/test/fixedbugs/issue17588.go +++ b/test/fixedbugs/issue17588.go @@ -11,10 +11,10 @@ package p -type F func(b T) // ERROR "T is not a type" +type F func(b T) // ERROR "T is not a type" func T(fn F) { - func() { - fn(nil) // If Decldepth is not initialized properly, typecheckclosure() Fatals here. - }() + func() { + fn(nil) // If Decldepth is not initialized properly, typecheckclosure() Fatals here. + }() } diff --git a/test/fixedbugs/issue17645.go b/test/fixedbugs/issue17645.go index ed92c54cfa..0fc495c851 100644 --- a/test/fixedbugs/issue17645.go +++ b/test/fixedbugs/issue17645.go @@ -12,6 +12,5 @@ type Foo struct { func main() { var s []int - var _ string = append(s, Foo{""}) // ERROR "cannot use .. \(type string\) as type int in field value" "cannot use Foo literal \(type Foo\) as type int in append" "cannot use append\(s\, Foo literal\) \(type \[\]int\) as type string in assignment" + var _ string = append(s, Foo{""}) // ERROR "cannot use .. \(type string\) as type int in field value" "cannot use Foo literal \(type Foo\) as type int in append" "cannot use append\(s\, Foo literal\) \(type \[\]int\) as type string in assignment" } - diff --git a/test/fixedbugs/issue18231.go b/test/fixedbugs/issue18231.go index adfd2277ff..972c0f28a7 100644 --- a/test/fixedbugs/issue18231.go +++ b/test/fixedbugs/issue18231.go @@ -14,7 +14,7 @@ type T struct { } var _ = T{ - f: { // ERROR "missing type in composite literal" + f: { // ERROR "missing type in composite literal" "a": "b", }, } diff --git a/test/fixedbugs/issue18808.go b/test/fixedbugs/issue18808.go index c98386ee78..8e1a55471d 100644 --- a/test/fixedbugs/issue18808.go +++ b/test/fixedbugs/issue18808.go @@ -56,8 +56,8 @@ func lte(x uint32) { func main() { eq(lim) neq(lim) - gt(lim+1) - gte(lim+1) - lt(lim+1) - lte(lim+1) + gt(lim + 1) + gte(lim + 1) + lt(lim + 1) + lte(lim + 1) } diff --git a/test/fixedbugs/issue19028.dir/main.go b/test/fixedbugs/issue19028.dir/main.go index 627e926f93..ca2cf8c694 100644 --- a/test/fixedbugs/issue19028.dir/main.go +++ b/test/fixedbugs/issue19028.dir/main.go @@ -5,12 +5,12 @@ package main import ( - "reflect" - fake "./reflect" // 2nd package with name "reflect" + fake "./reflect" // 2nd package with name "reflect" + "reflect" ) type T struct { - _ fake.Type + _ fake.Type } func (T) f() {} @@ -18,9 +18,9 @@ func (T) G() (_ int) { return } func (T) H() (_, _ int) { return } func main() { - var x T - typ := reflect.TypeOf(x) - for i := 0; i < typ.NumMethod(); i++ { - _ = typ.Method(i) // must not crash - } + var x T + typ := reflect.TypeOf(x) + for i := 0; i < typ.NumMethod(); i++ { + _ = typ.Method(i) // must not crash + } } diff --git a/test/fixedbugs/issue19515.go b/test/fixedbugs/issue19515.go index a1605bec96..8a230485f5 100644 --- a/test/fixedbugs/issue19515.go +++ b/test/fixedbugs/issue19515.go @@ -48,4 +48,3 @@ func (v *VScrollPanel) Draw() { BoxGradient(x+x-2, y-1, 0, 0, 0, Color{}, Color{}) BoxGradient(x+y-2, y-1, 0, 0, 0, Color{}, Color{}) } - diff --git a/test/fixedbugs/issue19764.dir/a.go b/test/fixedbugs/issue19764.dir/a.go index 64538e5bdf..7467d03a40 100644 --- a/test/fixedbugs/issue19764.dir/a.go +++ b/test/fixedbugs/issue19764.dir/a.go @@ -5,9 +5,10 @@ package a type T struct{ _ int } + func (t T) M() {} -type I interface { M() } +type I interface{ M() } func F() { var t I = &T{} diff --git a/test/fixedbugs/issue20602.go b/test/fixedbugs/issue20602.go index ca4ce095aa..c938ca3006 100644 --- a/test/fixedbugs/issue20602.go +++ b/test/fixedbugs/issue20602.go @@ -10,5 +10,5 @@ package p var p = &[1]complex128{0} -var _ = real(p) // ERROR "type \*\[1\]complex128" -var _ = imag(p) // ERROR "type \*\[1\]complex128" +var _ = real(p) // ERROR "type \*\[1\]complex128" +var _ = imag(p) // ERROR "type \*\[1\]complex128" diff --git a/test/fixedbugs/issue20811.go b/test/fixedbugs/issue20811.go index 96b61ec728..2ccf453a14 100644 --- a/test/fixedbugs/issue20811.go +++ b/test/fixedbugs/issue20811.go @@ -20,4 +20,3 @@ func main() { func g() int64 { return 4398046511104 } - diff --git a/test/fixedbugs/issue22429.go b/test/fixedbugs/issue22429.go index 289b434a74..03c007f2aa 100644 --- a/test/fixedbugs/issue22429.go +++ b/test/fixedbugs/issue22429.go @@ -9,10 +9,10 @@ package p type T struct { - a,b,c,d float32 + a, b, c, d float32 } -func f(a *[8]T, i,j,k int) float32 { +func f(a *[8]T, i, j, k int) float32 { b := *a return b[i].a + b[j].b + b[k].c } diff --git a/test/fixedbugs/issue22458.go b/test/fixedbugs/issue22458.go index 5c89929577..9317bcfdbd 100644 --- a/test/fixedbugs/issue22458.go +++ b/test/fixedbugs/issue22458.go @@ -11,16 +11,16 @@ package main import "runtime" type node struct { - next *node + next *node } var x bool func main() { - var head *node - for x { - head = &node{head} - } + var head *node + for x { + head = &node{head} + } - runtime.KeepAlive(head) + runtime.KeepAlive(head) } diff --git a/test/fixedbugs/issue22662.go b/test/fixedbugs/issue22662.go index a1f00bfac3..03830de862 100644 --- a/test/fixedbugs/issue22662.go +++ b/test/fixedbugs/issue22662.go @@ -25,7 +25,7 @@ func check(file string, line int) { } func main() { -//-style line directives + //-style line directives //line :1 check("??", 1) // no file specified //line foo.go:1 @@ -35,12 +35,16 @@ func main() { //line :11:22 check("bar.go", 11) // no file, but column specified => keep old filename -/*-style line directives */ -/*line :1*/ check("??", 1) // no file specified -/*line foo.go:1*/ check("foo.go", 1) -/*line bar.go:10:20*/ check("bar.go", 10) -/*line :11:22*/ check("bar.go", 11) // no file, but column specified => keep old filename - - /*line :10*/ check("??", 10); /*line foo.go:20*/ check("foo.go", 20); /*line :30:1*/ check("foo.go", 30) + /*-style line directives */ + /*line :1*/ + check("??", 1) // no file specified + /*line foo.go:1*/ check("foo.go", 1) + /*line bar.go:10:20*/ check("bar.go", 10) + /*line :11:22*/ check("bar.go", 11) // no file, but column specified => keep old filename + + /*line :10*/ + check("??", 10) /*line foo.go:20*/ + check("foo.go", 20) /*line :30:1*/ + check("foo.go", 30) check("foo.go", 31) } diff --git a/test/fixedbugs/issue24339.go b/test/fixedbugs/issue24339.go index 0670becdfe..308fa75825 100644 --- a/test/fixedbugs/issue24339.go +++ b/test/fixedbugs/issue24339.go @@ -9,12 +9,6 @@ package p // Use a diffent line number for each token so we can // check that the error message appears at the correct // position. -var _ = struct{}{ /*line :20:1*/foo /*line :21:1*/: /*line :22:1*/0 } +var _ = struct{}{ /*line :20:1*/ foo /*line :21:1*/ : /*line :22:1*/ 0} - - - - - - -// ERROR "unknown field 'foo'" \ No newline at end of file +// ERROR "unknown field 'foo'" diff --git a/test/fixedbugs/issue24799.go b/test/fixedbugs/issue24799.go index c805c86dda..70f8def24d 100644 --- a/test/fixedbugs/issue24799.go +++ b/test/fixedbugs/issue24799.go @@ -10,7 +10,7 @@ package main import ( - "fmt" + "fmt" ) type Level string @@ -20,39 +20,39 @@ type Level string // not aligned to 4 bytes due to the type of relocation that // is generated for the instruction. A fix was made to avoid // generating an instruction with DS relocation for go.strings -// since their alignment is not known until link time. +// since their alignment is not known until link time. // This problem only affects go.string since other types have // correct alignment. const ( - LevelBad Level = "badvals" - LevelNone Level = "No" - LevelMetadata Level = "Metadata" - LevelRequest Level = "Request" - LevelRequestResponse Level = "RequestResponse" + LevelBad Level = "badvals" + LevelNone Level = "No" + LevelMetadata Level = "Metadata" + LevelRequest Level = "Request" + LevelRequestResponse Level = "RequestResponse" ) func ordLevel(l Level) int { - switch l { - case LevelMetadata: - return 1 - case LevelRequest: - return 2 - case LevelRequestResponse: - return 3 - default: - return 0 - } + switch l { + case LevelMetadata: + return 1 + case LevelRequest: + return 2 + case LevelRequestResponse: + return 3 + default: + return 0 + } } //go:noinline func test(l Level) { - if ordLevel(l) < ordLevel(LevelMetadata) { - fmt.Printf("OK\n") - } + if ordLevel(l) < ordLevel(LevelMetadata) { + fmt.Printf("OK\n") + } } func main() { - test(LevelMetadata) + test(LevelMetadata) } diff --git a/test/fixedbugs/issue25727.go b/test/fixedbugs/issue25727.go index 9b7c804a0e..da7c94cc12 100644 --- a/test/fixedbugs/issue25727.go +++ b/test/fixedbugs/issue25727.go @@ -9,13 +9,13 @@ package main import "net/http" var s = http.Server{} -var _ = s.doneChan // ERROR "s.doneChan undefined .cannot refer to unexported field or method doneChan.$" -var _ = s.DoneChan // ERROR "s.DoneChan undefined .type http.Server has no field or method DoneChan.$" +var _ = s.doneChan // ERROR "s.doneChan undefined .cannot refer to unexported field or method doneChan.$" +var _ = s.DoneChan // ERROR "s.DoneChan undefined .type http.Server has no field or method DoneChan.$" var _ = http.Server{tlsConfig: nil} // ERROR "unknown field 'tlsConfig' in struct literal.+ .but does have TLSConfig.$" -var _ = http.Server{DoneChan: nil} // ERROR "unknown field 'DoneChan' in struct literal of type http.Server$" +var _ = http.Server{DoneChan: nil} // ERROR "unknown field 'DoneChan' in struct literal of type http.Server$" type foo struct { - bar int + bar int } var _ = &foo{bAr: 10} // ERROR "unknown field 'bAr' in struct literal.+ .but does have bar.$" diff --git a/test/fixedbugs/issue26335.go b/test/fixedbugs/issue26335.go index a97b4b6c72..97174ea11d 100644 --- a/test/fixedbugs/issue26335.go +++ b/test/fixedbugs/issue26335.go @@ -15,7 +15,7 @@ import ( type Empty struct { f1, f2 *byte - empty struct{} + empty struct{} } func F(e Empty, s []string) { diff --git a/test/fixedbugs/issue26340.go b/test/fixedbugs/issue26340.go index f973ce2237..afa32c8881 100644 --- a/test/fixedbugs/issue26340.go +++ b/test/fixedbugs/issue26340.go @@ -10,12 +10,12 @@ package p type S []T -type T struct { x int } +type T struct{ x int } var _ = map[string]*S{ "a": { - { 1 }, + {1}, }, } -var _ = [1]*S{ { {1}, } } +var _ = [1]*S{{{1}}} diff --git a/test/fixedbugs/issue26407.go b/test/fixedbugs/issue26407.go index aa8e79c1e6..02c1c19334 100644 --- a/test/fixedbugs/issue26407.go +++ b/test/fixedbugs/issue26407.go @@ -55,4 +55,4 @@ func grow() { } //go:noinline -func use(_ []uintptr) { } +func use(_ []uintptr) {} diff --git a/test/fixedbugs/issue27278.go b/test/fixedbugs/issue27278.go index 73f7c755e1..321b85cb63 100644 --- a/test/fixedbugs/issue27278.go +++ b/test/fixedbugs/issue27278.go @@ -50,7 +50,7 @@ func grow(n int) { if n == 0 { return } - grow(n-1) + grow(n - 1) } // put some junk on stack, which cannot be valid address diff --git a/test/fixedbugs/issue27356.go b/test/fixedbugs/issue27356.go index 42784876a5..18530bf6a9 100644 --- a/test/fixedbugs/issue27356.go +++ b/test/fixedbugs/issue27356.go @@ -8,12 +8,11 @@ package p -var a = []int{1,2,3} +var a = []int{1, 2, 3} func _(len int) { - _ = len(a) // ERROR "cannot call non-function" + _ = len(a) // ERROR "cannot call non-function" } var cap = false var _ = cap(a) // ERROR "cannot call non-function" - diff --git a/test/fixedbugs/issue29215.go b/test/fixedbugs/issue29215.go index 4e8f107aee..69bbdc3be4 100644 --- a/test/fixedbugs/issue29215.go +++ b/test/fixedbugs/issue29215.go @@ -7,14 +7,14 @@ package main func f() { - var s string - var p, q bool - s = "a" - for p { - p = false == (true != q) - s = "" - } - _ = s == "bbb" + var s string + var p, q bool + s = "a" + for p { + p = false == (true != q) + s = "" + } + _ = s == "bbb" } // Another case: load from negative offset of a symbol diff --git a/test/fixedbugs/issue29402.go b/test/fixedbugs/issue29402.go index 8a1f959d84..fed779bc5f 100644 --- a/test/fixedbugs/issue29402.go +++ b/test/fixedbugs/issue29402.go @@ -1,5 +1,5 @@ // run - + // Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/test/fixedbugs/issue31747.go b/test/fixedbugs/issue31747.go index dfb585c613..81bd111d44 100644 --- a/test/fixedbugs/issue31747.go +++ b/test/fixedbugs/issue31747.go @@ -14,10 +14,10 @@ const ( _ = 0xabc // ok _ = 0x0p1 // ERROR "hexadecimal floating-point literals only supported as of -lang=go1.13" - _ = 0B111 // ERROR "binary" - _ = 0O567 // ERROR "octal" - _ = 0Xabc // ok - _ = 0X0P1 // ERROR "hexadecimal floating-point" + _ = 0b111 // ERROR "binary" + _ = 0o567 // ERROR "octal" + _ = 0xabc // ok + _ = 0x0p1 // ERROR "hexadecimal floating-point" _ = 1_000i // ERROR "underscores" _ = 0b111i // ERROR "binary" diff --git a/test/fixedbugs/issue3552.dir/one.go b/test/fixedbugs/issue3552.dir/one.go index e594db7478..dacd2565da 100644 --- a/test/fixedbugs/issue3552.dir/one.go +++ b/test/fixedbugs/issue3552.dir/one.go @@ -6,23 +6,20 @@ package one // Issue 3552 -type T struct { int } +type T struct{ int } func (t T) F() int { return t.int } -type U struct { int int } +type U struct{ int int } func (u U) F() int { return u.int } type lint int -type V struct { lint } +type V struct{ lint } func (v V) F() int { return int(v.lint) } -type W struct { lint lint } +type W struct{ lint lint } func (w W) F() int { return int(w.lint) } - - - diff --git a/test/fixedbugs/issue3783.go b/test/fixedbugs/issue3783.go index 7db06d1881..b60b4b3ee0 100644 --- a/test/fixedbugs/issue3783.go +++ b/test/fixedbugs/issue3783.go @@ -9,4 +9,3 @@ package foo var i int func (*i) bar() // ERROR "not a type|expected type" - diff --git a/test/fixedbugs/issue3925.go b/test/fixedbugs/issue3925.go index 628c222685..a8c73a3d65 100644 --- a/test/fixedbugs/issue3925.go +++ b/test/fixedbugs/issue3925.go @@ -11,7 +11,7 @@ package foo var _ = map[string]string{ - "1": "2", + "1": "2", "3", "4", // ERROR "missing key|must have keys" } @@ -20,4 +20,3 @@ var _ = []string{ "bar", 20, // ERROR "cannot use|incompatible type" } - diff --git a/test/fixedbugs/issue4097.go b/test/fixedbugs/issue4097.go index 30b65bce83..a3c9fea8cb 100644 --- a/test/fixedbugs/issue4097.go +++ b/test/fixedbugs/issue4097.go @@ -7,5 +7,5 @@ package foo var s [][10]int -const m = len(s[len(s)-1]) // ERROR "is not a constant|is not constant" +const m = len(s[len(s)-1]) // ERROR "is not a constant|is not constant" diff --git a/test/fixedbugs/issue4099.go b/test/fixedbugs/issue4099.go index 5a4ea7c998..c02e337f37 100644 --- a/test/fixedbugs/issue4099.go +++ b/test/fixedbugs/issue4099.go @@ -20,7 +20,7 @@ func F2([]byte) func G() { var buf1 [10]byte F1(buf1[:]) - + var buf2 [10]byte // ERROR "moved to heap: buf2" F2(buf2[:]) } diff --git a/test/fixedbugs/issue4162.go b/test/fixedbugs/issue4162.go index f236bd0f6a..23b93e5841 100644 --- a/test/fixedbugs/issue4162.go +++ b/test/fixedbugs/issue4162.go @@ -10,8 +10,8 @@ package p // All these are valid now. var ( - _ = int(1.0,) // comma was always permitted (like function call) - _ = []byte("foo",) // was syntax error: unexpected comma - _ = chan int(nil,) // was syntax error: unexpected comma - _ = (func())(nil,) // was syntax error: unexpected comma + _ = int(1.0) // comma was always permitted (like function call) + _ = []byte("foo") // was syntax error: unexpected comma + _ = chan int(nil) // was syntax error: unexpected comma + _ = (func())(nil) // was syntax error: unexpected comma ) diff --git a/test/fixedbugs/issue4251.go b/test/fixedbugs/issue4251.go index d11ce51b97..b3434d7ff6 100644 --- a/test/fixedbugs/issue4251.go +++ b/test/fixedbugs/issue4251.go @@ -9,13 +9,13 @@ package p func F1(s []byte) []byte { - return s[2:1] // ERROR "invalid slice index|inverted slice range" + return s[2:1] // ERROR "invalid slice index|inverted slice range" } func F2(a [10]byte) []byte { - return a[2:1] // ERROR "invalid slice index|inverted slice range" + return a[2:1] // ERROR "invalid slice index|inverted slice range" } func F3(s string) string { - return s[2:1] // ERROR "invalid slice index|inverted slice range" + return s[2:1] // ERROR "invalid slice index|inverted slice range" } diff --git a/test/fixedbugs/issue4264.go b/test/fixedbugs/issue4264.go index 627393211e..f550c95e71 100644 --- a/test/fixedbugs/issue4264.go +++ b/test/fixedbugs/issue4264.go @@ -13,7 +13,7 @@ func main() { var y float64 var z complex128 - println(x/0) // ERROR "division by zero" - println(y/0) - println(z/0) -} \ No newline at end of file + println(x / 0) // ERROR "division by zero" + println(y / 0) + println(z / 0) +} diff --git a/test/fixedbugs/issue4283.go b/test/fixedbugs/issue4283.go index fa5629b20a..5d69538843 100644 --- a/test/fixedbugs/issue4283.go +++ b/test/fixedbugs/issue4283.go @@ -9,9 +9,9 @@ package p func F1() bool { - return nil == nil // ERROR "invalid" + return nil == nil // ERROR "invalid" } func F2() bool { - return nil != nil // ERROR "invalid" + return nil != nil // ERROR "invalid" } diff --git a/test/fixedbugs/issue4313.go b/test/fixedbugs/issue4313.go index 2494b83b03..ad45f60a5b 100644 --- a/test/fixedbugs/issue4313.go +++ b/test/fixedbugs/issue4313.go @@ -22,7 +22,10 @@ func main() { } func makec(px *int) chan bool { - if false { for {} } + if false { + for { + } + } *px = 42 return make(chan bool, 0) } diff --git a/test/fixedbugs/issue4326.dir/q1.go b/test/fixedbugs/issue4326.dir/q1.go index f118eb0925..f1a0d18ea8 100644 --- a/test/fixedbugs/issue4326.dir/q1.go +++ b/test/fixedbugs/issue4326.dir/q1.go @@ -1,8 +1,8 @@ package q1 func Deref(typ interface{}) interface{} { - if typ, ok := typ.(*int); ok { - return *typ - } - return typ + if typ, ok := typ.(*int); ok { + return *typ + } + return typ } diff --git a/test/fixedbugs/issue4326.dir/q2.go b/test/fixedbugs/issue4326.dir/q2.go index 075e2b21e7..2bcc0e224d 100644 --- a/test/fixedbugs/issue4326.dir/q2.go +++ b/test/fixedbugs/issue4326.dir/q2.go @@ -3,9 +3,9 @@ package main import "./q1" func main() { - x := 1 - y := q1.Deref(&x) - if y != 1 { - panic("y != 1") - } + x := 1 + y := q1.Deref(&x) + if y != 1 { + panic("y != 1") + } } diff --git a/test/fixedbugs/issue4365.go b/test/fixedbugs/issue4365.go index 09ff1bf8f7..9b4a7641b1 100644 --- a/test/fixedbugs/issue4365.go +++ b/test/fixedbugs/issue4365.go @@ -10,7 +10,7 @@ package main type T interface { - M() + M() } type M struct{} @@ -18,10 +18,10 @@ type M struct{} func (M) M() {} type Foo struct { - M + M } func main() { - var v T = Foo{} // ERROR "has no methods|not a method|cannot use" - _ = v + var v T = Foo{} // ERROR "has no methods|not a method|cannot use" + _ = v } diff --git a/test/fixedbugs/issue4396a.go b/test/fixedbugs/issue4396a.go index 38dd4b8cfb..12f4212d76 100644 --- a/test/fixedbugs/issue4396a.go +++ b/test/fixedbugs/issue4396a.go @@ -8,7 +8,7 @@ // word aligned. 5g should use MOVB to load the address // of s.g[0] for its nil check. // -// This test _may_ fail on arm, but requires the host to +// This test _may_ fail on arm, but requires the host to // trap unaligned loads. This is generally done with // // echo "4" > /proc/cpu/alignment diff --git a/test/fixedbugs/issue4396b.go b/test/fixedbugs/issue4396b.go index 1284870ece..1281284d17 100644 --- a/test/fixedbugs/issue4396b.go +++ b/test/fixedbugs/issue4396b.go @@ -17,7 +17,7 @@ type T struct { } type T2 struct { - pad [4096]byte + pad [4096]byte A, B byte } diff --git a/test/fixedbugs/issue4429.go b/test/fixedbugs/issue4429.go index 9eb2e0f9c2..7b2c92a7bc 100644 --- a/test/fixedbugs/issue4429.go +++ b/test/fixedbugs/issue4429.go @@ -7,10 +7,10 @@ package p type a struct { - a int + a int } func main() { - av := a{}; - _ = *a(av); // ERROR "invalid indirect|expected pointer" + av := a{} + _ = *a(av) // ERROR "invalid indirect|expected pointer" } diff --git a/test/fixedbugs/issue4463.go b/test/fixedbugs/issue4463.go index 6ad1952d67..500b4975e6 100644 --- a/test/fixedbugs/issue4463.go +++ b/test/fixedbugs/issue4463.go @@ -17,17 +17,17 @@ func F() { var m map[int]int var s struct{ f int } - append(a, 0) // ERROR "not used" - cap(a) // ERROR "not used" - complex(1, 2) // ERROR "not used" - imag(1i) // ERROR "not used" - len(a) // ERROR "not used" - make([]int, 10) // ERROR "not used" - new(int) // ERROR "not used" - real(1i) // ERROR "not used" - unsafe.Alignof(a) // ERROR "not used" - unsafe.Offsetof(s.f) // ERROR "not used" - unsafe.Sizeof(a) // ERROR "not used" + append(a, 0) // ERROR "not used" + cap(a) // ERROR "not used" + complex(1, 2) // ERROR "not used" + imag(1i) // ERROR "not used" + len(a) // ERROR "not used" + make([]int, 10) // ERROR "not used" + new(int) // ERROR "not used" + real(1i) // ERROR "not used" + unsafe.Alignof(a) // ERROR "not used" + unsafe.Offsetof(s.f) // ERROR "not used" + unsafe.Sizeof(a) // ERROR "not used" close(c) copy(a, a) @@ -45,17 +45,17 @@ func F() { (println("bar")) (recover()) - go append(a, 0) // ERROR "not used|discards result" - go cap(a) // ERROR "not used|discards result" - go complex(1, 2) // ERROR "not used|discards result" - go imag(1i) // ERROR "not used|discards result" - go len(a) // ERROR "not used|discards result" - go make([]int, 10) // ERROR "not used|discards result" - go new(int) // ERROR "not used|discards result" - go real(1i) // ERROR "not used|discards result" - go unsafe.Alignof(a) // ERROR "not used|discards result" - go unsafe.Offsetof(s.f) // ERROR "not used|discards result" - go unsafe.Sizeof(a) // ERROR "not used|discards result" + go append(a, 0) // ERROR "not used|discards result" + go cap(a) // ERROR "not used|discards result" + go complex(1, 2) // ERROR "not used|discards result" + go imag(1i) // ERROR "not used|discards result" + go len(a) // ERROR "not used|discards result" + go make([]int, 10) // ERROR "not used|discards result" + go new(int) // ERROR "not used|discards result" + go real(1i) // ERROR "not used|discards result" + go unsafe.Alignof(a) // ERROR "not used|discards result" + go unsafe.Offsetof(s.f) // ERROR "not used|discards result" + go unsafe.Sizeof(a) // ERROR "not used|discards result" go close(c) go copy(a, a) @@ -65,17 +65,17 @@ func F() { go println("bar") go recover() - defer append(a, 0) // ERROR "not used|discards result" - defer cap(a) // ERROR "not used|discards result" - defer complex(1, 2) // ERROR "not used|discards result" - defer imag(1i) // ERROR "not used|discards result" - defer len(a) // ERROR "not used|discards result" - defer make([]int, 10) // ERROR "not used|discards result" - defer new(int) // ERROR "not used|discards result" - defer real(1i) // ERROR "not used|discards result" - defer unsafe.Alignof(a) // ERROR "not used|discards result" - defer unsafe.Offsetof(s.f) // ERROR "not used|discards result" - defer unsafe.Sizeof(a) // ERROR "not used|discards result" + defer append(a, 0) // ERROR "not used|discards result" + defer cap(a) // ERROR "not used|discards result" + defer complex(1, 2) // ERROR "not used|discards result" + defer imag(1i) // ERROR "not used|discards result" + defer len(a) // ERROR "not used|discards result" + defer make([]int, 10) // ERROR "not used|discards result" + defer new(int) // ERROR "not used|discards result" + defer real(1i) // ERROR "not used|discards result" + defer unsafe.Alignof(a) // ERROR "not used|discards result" + defer unsafe.Offsetof(s.f) // ERROR "not used|discards result" + defer unsafe.Sizeof(a) // ERROR "not used|discards result" defer close(c) defer copy(a, a) diff --git a/test/fixedbugs/issue4470.go b/test/fixedbugs/issue4470.go index d922478455..f84a5409b7 100644 --- a/test/fixedbugs/issue4470.go +++ b/test/fixedbugs/issue4470.go @@ -10,7 +10,7 @@ package main func main() { var i interface{} - switch (i.(type)) { // ERROR "outside type switch" + switch i.(type) { // ERROR "outside type switch" default: } } diff --git a/test/fixedbugs/issue4495.go b/test/fixedbugs/issue4495.go index 308acc2280..8f90809501 100644 --- a/test/fixedbugs/issue4495.go +++ b/test/fixedbugs/issue4495.go @@ -26,4 +26,3 @@ func main() { panic("ret != 3") } } - diff --git a/test/fixedbugs/issue4562.go b/test/fixedbugs/issue4562.go index 8c958f5725..94280359b0 100644 --- a/test/fixedbugs/issue4562.go +++ b/test/fixedbugs/issue4562.go @@ -34,7 +34,7 @@ func expectError(expectLine int) { if recover() == nil { panic("did not crash") } - for i := 1;; i++ { + for i := 1; ; i++ { _, file, line, ok := runtime.Caller(i) if !ok { panic("cannot find issue4562.go on stack") diff --git a/test/fixedbugs/issue4610.go b/test/fixedbugs/issue4610.go index d56c6d3e8c..8993f9882b 100644 --- a/test/fixedbugs/issue4610.go +++ b/test/fixedbugs/issue4610.go @@ -14,4 +14,3 @@ func main() { var foo bar _ = &foo{} // ERROR "is not a type|expected .;." } // GCCGO_ERROR "expected declaration" - diff --git a/test/fixedbugs/issue4618.go b/test/fixedbugs/issue4618.go index 0ba95230cf..fe43aa828d 100644 --- a/test/fixedbugs/issue4618.go +++ b/test/fixedbugs/issue4618.go @@ -13,7 +13,7 @@ import ( "testing" ) -type T struct { int } +type T struct{ int } var globl *T diff --git a/test/fixedbugs/issue4620.go b/test/fixedbugs/issue4620.go index 5aa29086f7..20d641d3f4 100644 --- a/test/fixedbugs/issue4620.go +++ b/test/fixedbugs/issue4620.go @@ -11,7 +11,7 @@ package main import "fmt" func main() { - m := map[int]int{0:1} + m := map[int]int{0: 1} i := 0 i, m[i] = 1, 2 if m[0] != 2 { diff --git a/test/fixedbugs/issue4654.go b/test/fixedbugs/issue4654.go index 76aff76a67..595782f953 100644 --- a/test/fixedbugs/issue4654.go +++ b/test/fixedbugs/issue4654.go @@ -12,60 +12,60 @@ package p import "unsafe" func f() { - defer int(0) // ERROR "defer requires function call, not conversion|is not used" + defer int(0) // ERROR "defer requires function call, not conversion|is not used" go string([]byte("abc")) // ERROR "go requires function call, not conversion|is not used" - + var c complex128 var f float64 - var t struct {X int} + var t struct{ X int } var x []int - defer append(x, 1) // ERROR "defer discards result of append|is not used" - defer cap(x) // ERROR "defer discards result of cap|is not used" - defer complex(1, 2) // ERROR "defer discards result of complex|is not used" - defer complex(f, 1) // ERROR "defer discards result of complex|is not used" - defer imag(1i) // ERROR "defer discards result of imag|is not used" - defer imag(c) // ERROR "defer discards result of imag|is not used" - defer len(x) // ERROR "defer discards result of len|is not used" - defer make([]int, 1) // ERROR "defer discards result of make|is not used" - defer make(chan bool) // ERROR "defer discards result of make|is not used" + defer append(x, 1) // ERROR "defer discards result of append|is not used" + defer cap(x) // ERROR "defer discards result of cap|is not used" + defer complex(1, 2) // ERROR "defer discards result of complex|is not used" + defer complex(f, 1) // ERROR "defer discards result of complex|is not used" + defer imag(1i) // ERROR "defer discards result of imag|is not used" + defer imag(c) // ERROR "defer discards result of imag|is not used" + defer len(x) // ERROR "defer discards result of len|is not used" + defer make([]int, 1) // ERROR "defer discards result of make|is not used" + defer make(chan bool) // ERROR "defer discards result of make|is not used" defer make(map[string]int) // ERROR "defer discards result of make|is not used" - defer new(int) // ERROR "defer discards result of new|is not used" - defer real(1i) // ERROR "defer discards result of real|is not used" - defer real(c) // ERROR "defer discards result of real|is not used" - defer append(x, 1) // ERROR "defer discards result of append|is not used" - defer append(x, 1) // ERROR "defer discards result of append|is not used" - defer unsafe.Alignof(t.X) // ERROR "defer discards result of unsafe.Alignof|is not used" + defer new(int) // ERROR "defer discards result of new|is not used" + defer real(1i) // ERROR "defer discards result of real|is not used" + defer real(c) // ERROR "defer discards result of real|is not used" + defer append(x, 1) // ERROR "defer discards result of append|is not used" + defer append(x, 1) // ERROR "defer discards result of append|is not used" + defer unsafe.Alignof(t.X) // ERROR "defer discards result of unsafe.Alignof|is not used" defer unsafe.Offsetof(t.X) // ERROR "defer discards result of unsafe.Offsetof|is not used" - defer unsafe.Sizeof(t) // ERROR "defer discards result of unsafe.Sizeof|is not used" - + defer unsafe.Sizeof(t) // ERROR "defer discards result of unsafe.Sizeof|is not used" + defer copy(x, x) // ok m := make(map[int]int) defer delete(m, 1) // ok - defer panic(1) // ok - defer print(1) // ok - defer println(1) // ok - defer recover() // ok + defer panic(1) // ok + defer print(1) // ok + defer println(1) // ok + defer recover() // ok - int(0) // ERROR "int\(0\) evaluated but not used|is not used" + int(0) // ERROR "int\(0\) evaluated but not used|is not used" string([]byte("abc")) // ERROR "string\(.*\) evaluated but not used|is not used" - append(x, 1) // ERROR "not used" - cap(x) // ERROR "not used" - complex(1, 2) // ERROR "not used" - complex(f, 1) // ERROR "not used" - imag(1i) // ERROR "not used" - imag(c) // ERROR "not used" - len(x) // ERROR "not used" - make([]int, 1) // ERROR "not used" - make(chan bool) // ERROR "not used" + append(x, 1) // ERROR "not used" + cap(x) // ERROR "not used" + complex(1, 2) // ERROR "not used" + complex(f, 1) // ERROR "not used" + imag(1i) // ERROR "not used" + imag(c) // ERROR "not used" + len(x) // ERROR "not used" + make([]int, 1) // ERROR "not used" + make(chan bool) // ERROR "not used" make(map[string]int) // ERROR "not used" - new(int) // ERROR "not used" - real(1i) // ERROR "not used" - real(c) // ERROR "not used" - append(x, 1) // ERROR "not used" - append(x, 1) // ERROR "not used" - unsafe.Alignof(t.X) // ERROR "not used" + new(int) // ERROR "not used" + real(1i) // ERROR "not used" + real(c) // ERROR "not used" + append(x, 1) // ERROR "not used" + append(x, 1) // ERROR "not used" + unsafe.Alignof(t.X) // ERROR "not used" unsafe.Offsetof(t.X) // ERROR "not used" - unsafe.Sizeof(t) // ERROR "not used" + unsafe.Sizeof(t) // ERROR "not used" } diff --git a/test/fixedbugs/issue4663.go b/test/fixedbugs/issue4663.go index 971290d8dd..2533f0f269 100644 --- a/test/fixedbugs/issue4663.go +++ b/test/fixedbugs/issue4663.go @@ -10,6 +10,6 @@ package main func a(b int) int64 { - b // ERROR "not used" - return 0 + b // ERROR "not used" + return 0 } diff --git a/test/fixedbugs/issue4748.go b/test/fixedbugs/issue4748.go index f7c77cf882..7a9deca039 100644 --- a/test/fixedbugs/issue4748.go +++ b/test/fixedbugs/issue4748.go @@ -10,11 +10,11 @@ package main func jump() { - goto exit + goto exit exit: - return + return } func main() { - jump() - jump() + jump() + jump() } diff --git a/test/fixedbugs/issue4879.dir/a.go b/test/fixedbugs/issue4879.dir/a.go index 7ee7c48604..9bfb0c7d4f 100644 --- a/test/fixedbugs/issue4879.dir/a.go +++ b/test/fixedbugs/issue4879.dir/a.go @@ -30,4 +30,3 @@ func MakePrivateCollection3() *Collection { root: unsafe.Pointer(&maptype{}), } } - diff --git a/test/fixedbugs/issue4879.dir/b.go b/test/fixedbugs/issue4879.dir/b.go index d8fb5693db..62dcb36e21 100644 --- a/test/fixedbugs/issue4879.dir/b.go +++ b/test/fixedbugs/issue4879.dir/b.go @@ -3,7 +3,7 @@ package b import "./a" func F() { - a.MakePrivateCollection() - a.MakePrivateCollection2() - a.MakePrivateCollection3() + a.MakePrivateCollection() + a.MakePrivateCollection2() + a.MakePrivateCollection3() } diff --git a/test/fixedbugs/issue5056.go b/test/fixedbugs/issue5056.go index 6fb444aa67..d43bbbee1f 100644 --- a/test/fixedbugs/issue5056.go +++ b/test/fixedbugs/issue5056.go @@ -10,7 +10,7 @@ package main type Foo int16 -func (f Foo) Esc() *int{ +func (f Foo) Esc() *int { x := int(f) return &x } @@ -24,7 +24,7 @@ var bar, foobar *int func main() { var quux iface var x Foo - + quux = x bar = quux.Esc() foobar = quux.Esc() diff --git a/test/fixedbugs/issue5172.go b/test/fixedbugs/issue5172.go index a6acbd3db7..4a29dd1812 100644 --- a/test/fixedbugs/issue5172.go +++ b/test/fixedbugs/issue5172.go @@ -14,6 +14,6 @@ type foo struct { func main() { var f foo - go f.bar() // GCCGO_ERROR "undefined" - defer f.bar() // GCCGO_ERROR "undefined" + go f.bar() // GCCGO_ERROR "undefined" + defer f.bar() // GCCGO_ERROR "undefined" } diff --git a/test/fixedbugs/issue5493.go b/test/fixedbugs/issue5493.go index 2ee0398af2..ee7a0dc071 100644 --- a/test/fixedbugs/issue5493.go +++ b/test/fixedbugs/issue5493.go @@ -14,6 +14,7 @@ import ( ) const N = 10 + var count int64 func run() error { @@ -56,4 +57,3 @@ func main() { panic("not all finalizers are called") } } - diff --git a/test/fixedbugs/issue5515.go b/test/fixedbugs/issue5515.go index 053abf6f7c..2dab1eaab3 100644 --- a/test/fixedbugs/issue5515.go +++ b/test/fixedbugs/issue5515.go @@ -11,24 +11,24 @@ package main type T uint32 func main() { - b := make([]T, 8) - b[0] = 0xdeadbeef - rs := Slice(b) - sort(rs) + b := make([]T, 8) + b[0] = 0xdeadbeef + rs := Slice(b) + sort(rs) } type Slice []T func (s Slice) Swap(i, j int) { - tmp := s[i] - s[i] = s[j] - s[j] = tmp + tmp := s[i] + s[i] = s[j] + s[j] = tmp } type Interface interface { - Swap(i, j int) + Swap(i, j int) } func sort(data Interface) { - data.Swap(0, 4) + data.Swap(0, 4) } diff --git a/test/fixedbugs/issue5614.dir/x.go b/test/fixedbugs/issue5614.dir/x.go index 7e4f3a7e6b..6cd0969db8 100644 --- a/test/fixedbugs/issue5614.dir/x.go +++ b/test/fixedbugs/issue5614.dir/x.go @@ -3,5 +3,3 @@ package x import "./rethinkgo" var S *rethinkgo.Session - - diff --git a/test/fixedbugs/issue5753.go b/test/fixedbugs/issue5753.go index 230a1e8c3b..597fd2f58c 100644 --- a/test/fixedbugs/issue5753.go +++ b/test/fixedbugs/issue5753.go @@ -25,5 +25,5 @@ func main() { if s[0] != "foo" { panic(`s[0] != "foo"`) } - + } diff --git a/test/fixedbugs/issue5809.go b/test/fixedbugs/issue5809.go index fc8eeef82f..e63515f678 100644 --- a/test/fixedbugs/issue5809.go +++ b/test/fixedbugs/issue5809.go @@ -14,13 +14,13 @@ func main() { const d16 = "0123456789ABCDEF" k := 0x1234 var x [4]byte - + x[0] = d16[k>>12&0xf] x[1] = d16[k>>8&0xf] x[2] = d16[k>>4&0xf] x[3] = d16[k&0xf] - - if x != [4]byte{'1','2','3','4'} { + + if x != [4]byte{'1', '2', '3', '4'} { fmt.Println(x) panic("x != [4]byte{'1','2','3','4'}") } diff --git a/test/fixedbugs/issue5957.dir/b.go b/test/fixedbugs/issue5957.dir/b.go index 9bc561b9ce..674bcbc006 100644 --- a/test/fixedbugs/issue5957.dir/b.go +++ b/test/fixedbugs/issue5957.dir/b.go @@ -1,2 +1 @@ package surprise2 - diff --git a/test/fixedbugs/issue5957.dir/c.go b/test/fixedbugs/issue5957.dir/c.go index d115eacdd5..28f6e84a59 100644 --- a/test/fixedbugs/issue5957.dir/c.go +++ b/test/fixedbugs/issue5957.dir/c.go @@ -1,12 +1,12 @@ package p import ( - "./a" // ERROR "imported and not used: \x22a\x22 as surprise|imported and not used: surprise" - "./b" // ERROR "imported and not used: \x22b\x22 as surprise2|imported and not used: surprise2" - b "./b" // ERROR "imported and not used: \x22b\x22$|imported and not used: surprise2" + "./a" // ERROR "imported and not used: \x22a\x22 as surprise|imported and not used: surprise" + "./b" // ERROR "imported and not used: \x22b\x22 as surprise2|imported and not used: surprise2" + b "./b" // ERROR "imported and not used: \x22b\x22$|imported and not used: surprise2" + "fmt" // actually used foo "math" // ERROR "imported and not used: \x22math\x22 as foo|imported and not used: math" - "fmt" // actually used - "strings" // ERROR "imported and not used: \x22strings\x22|imported and not used: strings" + "strings" // ERROR "imported and not used: \x22strings\x22|imported and not used: strings" ) var _ = fmt.Printf diff --git a/test/fixedbugs/issue6004.go b/test/fixedbugs/issue6004.go index 2b3dcd923d..4a4a43cf94 100644 --- a/test/fixedbugs/issue6004.go +++ b/test/fixedbugs/issue6004.go @@ -7,9 +7,8 @@ package main func main() { - _ = nil // ERROR "use of untyped nil" - _, _ = nil, 1 // ERROR "use of untyped nil" - _, _ = 1, nil // ERROR "use of untyped nil" + _ = nil // ERROR "use of untyped nil" + _, _ = nil, 1 // ERROR "use of untyped nil" + _, _ = 1, nil // ERROR "use of untyped nil" _ = append(nil, 1, 2, 3) // ERROR "untyped nil" } - diff --git a/test/fixedbugs/issue6406.go b/test/fixedbugs/issue6406.go index 5491193ef3..429aa7f5f3 100644 --- a/test/fixedbugs/issue6406.go +++ b/test/fixedbugs/issue6406.go @@ -8,5 +8,5 @@ package main func main() { s = "bob" // ERROR "undefined.*s" - _ = s // ERROR "undefined.*s" + _ = s // ERROR "undefined.*s" } diff --git a/test/fixedbugs/issue6703g.go b/test/fixedbugs/issue6703g.go index 05ec7405f3..1762d0bc42 100644 --- a/test/fixedbugs/issue6703g.go +++ b/test/fixedbugs/issue6703g.go @@ -17,4 +17,4 @@ func (T) m() int { type E struct{ T } -var x = E.m // ERROR "initialization loop|depends upon itself" +var x = E.m // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703h.go b/test/fixedbugs/issue6703h.go index f6b69e1b70..af0cdfbbdd 100644 --- a/test/fixedbugs/issue6703h.go +++ b/test/fixedbugs/issue6703h.go @@ -17,4 +17,4 @@ func (T) m() int { type E struct{ T } -var x = E.m(E{0}) // ERROR "initialization loop|depends upon itself" +var x = E.m(E{0}) // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703i.go b/test/fixedbugs/issue6703i.go index fb580a2461..c412268d7e 100644 --- a/test/fixedbugs/issue6703i.go +++ b/test/fixedbugs/issue6703i.go @@ -17,4 +17,4 @@ func (T) m() int { type E struct{ T } -var x = E{}.m // ERROR "initialization loop|depends upon itself" +var x = E{}.m // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703o.go b/test/fixedbugs/issue6703o.go index a11fdfd858..e87e5ecec4 100644 --- a/test/fixedbugs/issue6703o.go +++ b/test/fixedbugs/issue6703o.go @@ -19,5 +19,5 @@ type E struct{ T } var ( e E - x = e.m // ERROR "initialization loop|depends upon itself" + x = e.m // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703p.go b/test/fixedbugs/issue6703p.go index 3ac7a63de8..79c6a5f41c 100644 --- a/test/fixedbugs/issue6703p.go +++ b/test/fixedbugs/issue6703p.go @@ -19,5 +19,5 @@ type E struct{ T } var ( e E - x = e.m() // ERROR "initialization loop|depends upon itself" + x = e.m() // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703q.go b/test/fixedbugs/issue6703q.go index b087c15d37..743a6ae3df 100644 --- a/test/fixedbugs/issue6703q.go +++ b/test/fixedbugs/issue6703q.go @@ -24,5 +24,5 @@ type E struct{ T } var ( e E - x = g().m // ERROR "initialization loop|depends upon itself" + x = g().m // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703r.go b/test/fixedbugs/issue6703r.go index de514f1802..a22f9a2122 100644 --- a/test/fixedbugs/issue6703r.go +++ b/test/fixedbugs/issue6703r.go @@ -24,5 +24,5 @@ type E struct{ T } var ( e E - x = g().m() // ERROR "initialization loop|depends upon itself" + x = g().m() // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703y.go b/test/fixedbugs/issue6703y.go index 278dfcdb5e..f679933f8e 100644 --- a/test/fixedbugs/issue6703y.go +++ b/test/fixedbugs/issue6703y.go @@ -20,4 +20,4 @@ func pf() *T { return nil } -var x = pf().pm // ERROR "initialization loop|depends upon itself" +var x = pf().pm // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703z.go b/test/fixedbugs/issue6703z.go index f81a3a8c34..658d05a2af 100644 --- a/test/fixedbugs/issue6703z.go +++ b/test/fixedbugs/issue6703z.go @@ -20,4 +20,4 @@ func pf() *T { return nil } -var x = pf().pm() // ERROR "initialization loop|depends upon itself" +var x = pf().pm() // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6789.dir/a.go b/test/fixedbugs/issue6789.dir/a.go index 9c90e0740c..9e076fec71 100644 --- a/test/fixedbugs/issue6789.dir/a.go +++ b/test/fixedbugs/issue6789.dir/a.go @@ -5,10 +5,10 @@ package a type unexported struct { - a int - b bool + a int + b bool } type Struct struct { - unexported + unexported } diff --git a/test/fixedbugs/issue6847.go b/test/fixedbugs/issue6847.go index da300bcd01..58ebb636f4 100644 --- a/test/fixedbugs/issue6847.go +++ b/test/fixedbugs/issue6847.go @@ -56,7 +56,7 @@ func F() { case cs, ok = <-cc: case c = <-cc: } - // Interfaces. + // Interfaces. var ( c1 chan I1 c2 chan I2 diff --git a/test/fixedbugs/issue7223.go b/test/fixedbugs/issue7223.go index 0ec3476403..e03d6f703d 100644 --- a/test/fixedbugs/issue7223.go +++ b/test/fixedbugs/issue7223.go @@ -7,14 +7,15 @@ package main var bits1 uint = 10 + const bits2 uint = 10 func main() { _ = make([]byte, 1<> 1) - a := make([]struct{}, length) - b := make([]struct{}, length) - _ = append(a, b...) + length := int(^uint(0) >> 1) + a := make([]struct{}, length) + b := make([]struct{}, length) + _ = append(a, b...) } func main() { diff --git a/test/fixedbugs/issue7590.go b/test/fixedbugs/issue7590.go index 607a3ae606..e67e393dfb 100644 --- a/test/fixedbugs/issue7590.go +++ b/test/fixedbugs/issue7590.go @@ -13,7 +13,7 @@ type S struct { } var M = map[string]S{ - "a": { F: 1 }, + "a": {F: 1}, } var P = M["a"] diff --git a/test/fixedbugs/issue7648.dir/a.go b/test/fixedbugs/issue7648.dir/a.go index c76aaa675f..9139dc279f 100644 --- a/test/fixedbugs/issue7648.dir/a.go +++ b/test/fixedbugs/issue7648.dir/a.go @@ -6,6 +6,5 @@ package a const ( sinPi4 = 0.70710678118654752440084436210484903928483593768847 - A = complex(sinPi4, -sinPi4) + A = complex(sinPi4, -sinPi4) ) - diff --git a/test/fixedbugs/issue7760.go b/test/fixedbugs/issue7760.go index cccae48910..cf99ac1cc9 100644 --- a/test/fixedbugs/issue7760.go +++ b/test/fixedbugs/issue7760.go @@ -13,13 +13,13 @@ import "unsafe" type myPointer unsafe.Pointer const _ = unsafe.Pointer(uintptr(1)) // ERROR "is not (a )?constant" -const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant" +const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant" const _ = (*int)(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant" -const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant" +const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant" const _ = uintptr(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant" -const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant" +const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant" const _ = []byte("") // ERROR "is not (a )?constant" const _ = []rune("") // ERROR "is not (a )?constant" diff --git a/test/fixedbugs/issue7921.go b/test/fixedbugs/issue7921.go index e19b113062..2eb6d4ecd0 100644 --- a/test/fixedbugs/issue7921.go +++ b/test/fixedbugs/issue7921.go @@ -41,7 +41,7 @@ func bufferNoEscape3(xs []string) string { // ERROR "bufferNoEscape3 xs does not func bufferNoEscape4() []byte { var b bytes.Buffer - b.Grow(64) // ERROR "bufferNoEscape4 ignoring self-assignment in bytes.b.buf = bytes.b.buf\[:bytes.m·3\]$" "inlining call to bytes.\(\*Buffer\).Grow$" + b.Grow(64) // ERROR "bufferNoEscape4 ignoring self-assignment in bytes.b.buf = bytes.b.buf\[:bytes.m·3\]$" "inlining call to bytes.\(\*Buffer\).Grow$" useBuffer(&b) return b.Bytes() // ERROR "inlining call to bytes.\(\*Buffer\).Bytes$" } diff --git a/test/fixedbugs/issue8155.go b/test/fixedbugs/issue8155.go index 56a6738920..5450d04bc8 100644 --- a/test/fixedbugs/issue8155.go +++ b/test/fixedbugs/issue8155.go @@ -36,7 +36,7 @@ func poison() uintptr { var x [20]uintptr var s uintptr for i := range x { - x[i] = uintptr(i+1) + x[i] = uintptr(i + 1) s += x[i] } return s diff --git a/test/fixedbugs/issue8961.go b/test/fixedbugs/issue8961.go index 22b0f0410a..144bbb2cf7 100644 --- a/test/fixedbugs/issue8961.go +++ b/test/fixedbugs/issue8961.go @@ -7,7 +7,8 @@ // Issue 8961. Empty composite literals to small globals were not filled in package main -type small struct { a int } +type small struct{ a int } + var foo small func main() { diff --git a/test/fixedbugs/issue9076.go b/test/fixedbugs/issue9076.go index 8daf12fee8..dd2a474148 100644 --- a/test/fixedbugs/issue9076.go +++ b/test/fixedbugs/issue9076.go @@ -11,5 +11,6 @@ package main import "unsafe" const Hundred = 100 -var _ int32 = 100/unsafe.Sizeof(int(0)) + 1 // GC_ERROR "100 \/ unsafe.Sizeof\(int\(0\)\) \+ 1" + +var _ int32 = 100/unsafe.Sizeof(int(0)) + 1 // GC_ERROR "100 \/ unsafe.Sizeof\(int\(0\)\) \+ 1" var _ int32 = Hundred/unsafe.Sizeof(int(0)) + 1 // GC_ERROR "Hundred \/ unsafe.Sizeof\(int\(0\)\) \+ 1" diff --git a/test/fixedbugs/issue9083.go b/test/fixedbugs/issue9083.go index 8fbd78be7a..ea53e7a69a 100644 --- a/test/fixedbugs/issue9083.go +++ b/test/fixedbugs/issue9083.go @@ -13,10 +13,10 @@ const zero = 0 func main() { var x int - x = make(map[int]int) // ERROR "cannot use make\(map\[int\]int\)|incompatible" - x = make(map[int]int, 0) // ERROR "cannot use make\(map\[int\]int, 0\)|incompatible" + x = make(map[int]int) // ERROR "cannot use make\(map\[int\]int\)|incompatible" + x = make(map[int]int, 0) // ERROR "cannot use make\(map\[int\]int, 0\)|incompatible" x = make(map[int]int, zero) // ERROR "cannot use make\(map\[int\]int, zero\)|incompatible" - x = make(chan int) // ERROR "cannot use make\(chan int\)|incompatible" - x = make(chan int, 0) // ERROR "cannot use make\(chan int, 0\)|incompatible" - x = make(chan int, zero) // ERROR "cannot use make\(chan int, zero\)|incompatible" + x = make(chan int) // ERROR "cannot use make\(chan int\)|incompatible" + x = make(chan int, 0) // ERROR "cannot use make\(chan int, 0\)|incompatible" + x = make(chan int, zero) // ERROR "cannot use make\(chan int, zero\)|incompatible" } diff --git a/test/fixedbugs/issue9537.dir/b.go b/test/fixedbugs/issue9537.dir/b.go index 52e64c81f1..c8dce22c14 100644 --- a/test/fixedbugs/issue9537.dir/b.go +++ b/test/fixedbugs/issue9537.dir/b.go @@ -15,8 +15,8 @@ type X struct { } type Intf interface { - Get() []byte - RetPtr(int) *int + Get() []byte + RetPtr(int) *int RetRPtr(int) (int, *int) } diff --git a/test/fixedbugs/issue9634.go b/test/fixedbugs/issue9634.go index 2d5aae4a30..cc3e7484eb 100644 --- a/test/fixedbugs/issue9634.go +++ b/test/fixedbugs/issue9634.go @@ -10,7 +10,7 @@ package main func main() { - s := struct{ + s := struct { t []int u int }{} diff --git a/test/float_lit.go b/test/float_lit.go index 4efae2362d..f78c933f99 100644 --- a/test/float_lit.go +++ b/test/float_lit.go @@ -77,8 +77,8 @@ func main() { print("-210.012 is ", -210.012, "\n") } - if !close(0E+1, 0, 1, 0) { - print("0E+1 is ", 0E+1, "\n") + if !close(0e+1, 0, 1, 0) { + print("0E+1 is ", 0e+1, "\n") } if !close(+10e2, 10, 1, 2) { print("+10e2 is ", +10e2, "\n") @@ -87,8 +87,8 @@ func main() { print("-210e3 is ", -210e3, "\n") } - if !close(0E-1, 0, 1, 0) { - print("0E-1 is ", 0E-1, "\n") + if !close(0e-1, 0, 1, 0) { + print("0E-1 is ", 0e-1, "\n") } if !close(+0e23, 0, 1, 1) { print("+0e23 is ", +0e23, "\n") @@ -97,8 +97,8 @@ func main() { print("-0e345 is ", -0e345, "\n") } - if !close(0E1, 0, 1, 1) { - print("0E1 is ", 0E1, "\n") + if !close(0e1, 0, 1, 1) { + print("0E1 is ", 0e1, "\n") } if !close(+10e23, 10, 1, 23) { print("+10e23 is ", +10e23, "\n") @@ -107,8 +107,8 @@ func main() { print("-210e34 is ", -210e34, "\n") } - if !close(0.E1, 0, 1, 1) { - print("0.E1 is ", 0.E1, "\n") + if !close(0.e1, 0, 1, 1) { + print("0.E1 is ", 0.e1, "\n") } if !close(+10.e+2, 10, 1, 2) { print("+10.e+2 is ", +10.e+2, "\n") @@ -117,8 +117,8 @@ func main() { print("-210.e-3 is ", -210.e-3, "\n") } - if !close(.0E1, 0, 1, 1) { - print(".0E1 is ", .0E1, "\n") + if !close(.0e1, 0, 1, 1) { + print(".0E1 is ", .0e1, "\n") } if !close(+.01e2, 1, 100, 2) { print("+.01e2 is ", +.01e2, "\n") @@ -127,8 +127,8 @@ func main() { print("-.012e3 is ", -.012e3, "\n") } - if !close(0.0E1, 0, 1, 0) { - print("0.0E1 is ", 0.0E1, "\n") + if !close(0.0e1, 0, 1, 0) { + print("0.0E1 is ", 0.0e1, "\n") } if !close(+10.01e2, 1001, 100, 2) { print("+10.01e2 is ", +10.01e2, "\n") @@ -137,8 +137,8 @@ func main() { print("-210.012e3 is ", -210.012e3, "\n") } - if !close(0.E+12, 0, 1, 0) { - print("0.E+12 is ", 0.E+12, "\n") + if !close(0.e+12, 0, 1, 0) { + print("0.E+12 is ", 0.e+12, "\n") } if !close(+10.e23, 10, 1, 23) { print("+10.e23 is ", +10.e23, "\n") @@ -147,8 +147,8 @@ func main() { print("-210.e33 is ", -210.e33, "\n") } - if !close(.0E-12, 0, 1, 0) { - print(".0E-12 is ", .0E-12, "\n") + if !close(.0e-12, 0, 1, 0) { + print(".0E-12 is ", .0e-12, "\n") } if !close(+.01e23, 1, 100, 23) { print("+.01e23 is ", +.01e23, "\n") @@ -157,8 +157,8 @@ func main() { print("-.012e34 is ", -.012e34, "\n") } - if !close(0.0E12, 0, 1, 12) { - print("0.0E12 is ", 0.0E12, "\n") + if !close(0.0e12, 0, 1, 12) { + print("0.0E12 is ", 0.0e12, "\n") } if !close(+10.01e23, 1001, 100, 23) { print("+10.01e23 is ", +10.01e23, "\n") @@ -167,8 +167,8 @@ func main() { print("-210.012e33 is ", -210.012e33, "\n") } - if !close(0.E123, 0, 1, 123) { - print("0.E123 is ", 0.E123, "\n") + if !close(0.e123, 0, 1, 123) { + print("0.E123 is ", 0.e123, "\n") } if !close(+10.e+23, 10, 1, 23) { print("+10.e+234 is ", +10.e+234, "\n") @@ -177,8 +177,8 @@ func main() { print("-210.e-35 is ", -210.e-35, "\n") } - if !close(.0E123, 0, 1, 123) { - print(".0E123 is ", .0E123, "\n") + if !close(.0e123, 0, 1, 123) { + print(".0E123 is ", .0e123, "\n") } if !close(+.01e29, 1, 100, 29) { print("+.01e29 is ", +.01e29, "\n") @@ -187,8 +187,8 @@ func main() { print("-.012e29 is ", -.012e29, "\n") } - if !close(0.0E123, 0, 1, 123) { - print("0.0E123 is ", 0.0E123, "\n") + if !close(0.0e123, 0, 1, 123) { + print("0.0E123 is ", 0.0e123, "\n") } if !close(+10.01e31, 1001, 100, 31) { print("+10.01e31 is ", +10.01e31, "\n") diff --git a/test/for.go b/test/for.go index 8a50090657..14d516bf71 100644 --- a/test/for.go +++ b/test/for.go @@ -44,11 +44,11 @@ func main() { for sum < 100 { sum = sum + 9 } - assertequal(sum, 99 + 9, "only one") + assertequal(sum, 99+9, "only one") sum = 0 for i := 0; i <= 10; i++ { - if i % 2 == 0 { + if i%2 == 0 { continue } sum = sum + i diff --git a/test/func.go b/test/func.go index 246cb56fd9..9a31b4f300 100644 --- a/test/func.go +++ b/test/func.go @@ -41,7 +41,6 @@ func f7(a int) (x int, y float32) { return 7, 7.0 } - func f8(a int) (x int, y float32) { return 8, 8.0 } @@ -54,14 +53,12 @@ func (t *T) m10(a int, b float32) int { return (t.x + a) * (t.y + int(b)) } - func f9(a int) (i int, f float32) { i = 9 f = 9.0 return } - func main() { f1() f2(1) diff --git a/test/func1.go b/test/func1.go index fb6f56184f..8ab4b70989 100644 --- a/test/func1.go +++ b/test/func1.go @@ -13,7 +13,6 @@ func f1(a int) (int, float32) { return 7, 7.0 } - func f2(a int) (a int, b float32) { // ERROR "duplicate argument a|definition" return 8, 8.0 } diff --git a/test/func4.go b/test/func4.go index 85f1e4b81e..53e69cf0a9 100644 --- a/test/func4.go +++ b/test/func4.go @@ -12,7 +12,7 @@ package main var notmain func() func main() { - var x = &main // ERROR "address of|invalid" - main = notmain // ERROR "assign to|invalid" + var x = &main // ERROR "address of|invalid" + main = notmain // ERROR "assign to|invalid" _ = x } diff --git a/test/func5.go b/test/func5.go index 2e058be7e6..367b683e30 100644 --- a/test/func5.go +++ b/test/func5.go @@ -39,7 +39,7 @@ func fn() func(int, int) int { var fc func(int, int, chan int) func addc(x, y int, c chan int) { - c <- x+y + c <- x + y } func fnc() func(int, int, chan int) { @@ -79,7 +79,7 @@ func main() { three(<-c) go fnc()(1, 2, c) three(<-c) - go func(a, b int, c chan int) { c <- a+b }(1, 2, c) + go func(a, b int, c chan int) { c <- a + b }(1, 2, c) three(<-c) emptyresults() diff --git a/test/func6.go b/test/func6.go index 5b2f9f273e..9b2a10846a 100644 --- a/test/func6.go +++ b/test/func6.go @@ -9,8 +9,10 @@ package main func main() { - if func() bool { return true }() {} // gc used to say this was a syntax error - if (func() bool { return true })() {} - if (func() bool { return true }()) {} + if func() bool { return true }() { + } // gc used to say this was a syntax error + if (func() bool { return true })() { + } + if func() bool { return true }() { + } } - diff --git a/test/funcdup.go b/test/funcdup.go index 7b05d12606..468f255b86 100644 --- a/test/funcdup.go +++ b/test/funcdup.go @@ -8,20 +8,20 @@ package p type T interface { F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" - F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" - F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" + F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" + F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" } -type T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" +type T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" type T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" -type T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" +type T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" type R struct{} -func (i *R) F1(i int) {} // ERROR "duplicate argument i|redefinition|previous" -func (i *R) F2() (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous" -func (i *R) F3(j int) (j int) {return 0} // ERROR "duplicate argument j|redefinition|previous" +func (i *R) F1(i int) {} // ERROR "duplicate argument i|redefinition|previous" +func (i *R) F2() (i int) { return 0 } // ERROR "duplicate argument i|redefinition|previous" +func (i *R) F3(j int) (j int) { return 0 } // ERROR "duplicate argument j|redefinition|previous" -func F1(i, i int) {} // ERROR "duplicate argument i|redefinition|previous" -func F2(i int) (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous" -func F3() (i, i int) {return 0, 0} // ERROR "duplicate argument i|redefinition|previous" +func F1(i, i int) {} // ERROR "duplicate argument i|redefinition|previous" +func F2(i int) (i int) { return 0 } // ERROR "duplicate argument i|redefinition|previous" +func F3() (i, i int) { return 0, 0 } // ERROR "duplicate argument i|redefinition|previous" diff --git a/test/funcdup2.go b/test/funcdup2.go index 9513ef46bd..fde2c9604f 100644 --- a/test/funcdup2.go +++ b/test/funcdup2.go @@ -8,10 +8,10 @@ package p var T interface { F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" - F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" - F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" + F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" + F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" } -var T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" +var T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" var T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" -var T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" +var T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" diff --git a/test/gcstring.go b/test/gcstring.go index 7633d5da55..4b2499a604 100644 --- a/test/gcstring.go +++ b/test/gcstring.go @@ -25,16 +25,16 @@ func main() { setup() runtime.GC() runtime.GC() - time.Sleep(10*time.Millisecond) + time.Sleep(10 * time.Millisecond) runtime.GC() runtime.GC() - time.Sleep(10*time.Millisecond) + time.Sleep(10 * time.Millisecond) } func setup() { var Ts []interface{} buf := make([]byte, 128) - + for i := 0; i < 10000; i++ { s := string(buf) t := &T{ptr: new(*int)} @@ -42,7 +42,6 @@ func setup() { Ts = append(Ts, t) things = append(things, s[len(s):]) } - + things = append(things, Ts...) } - diff --git a/test/goprint.go b/test/goprint.go index 57eeac53a8..84dc28e51c 100644 --- a/test/goprint.go +++ b/test/goprint.go @@ -16,6 +16,6 @@ import ( func main() { go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255)) for runtime.NumGoroutine() > 1 { - time.Sleep(10*time.Millisecond) + time.Sleep(10 * time.Millisecond) } } diff --git a/test/import1.go b/test/import1.go index 2433b5f2ad..19e766fd6f 100644 --- a/test/import1.go +++ b/test/import1.go @@ -9,11 +9,11 @@ package main -import "bufio" // GCCGO_ERROR "previous|not used" -import bufio "os" // ERROR "redeclared|redefinition|incompatible" "imported and not used" +import "bufio" // GCCGO_ERROR "previous|not used" +import bufio "os" // ERROR "redeclared|redefinition|incompatible" "imported and not used" import ( - "fmt" // GCCGO_ERROR "previous|not used" - fmt "math" // ERROR "redeclared|redefinition|incompatible" "imported and not used: \x22math\x22 as fmt" - . "math" // GC_ERROR "imported and not used: \x22math\x22$" + "fmt" // GCCGO_ERROR "previous|not used" + . "math" // GC_ERROR "imported and not used: \x22math\x22$" + fmt "math" // ERROR "redeclared|redefinition|incompatible" "imported and not used: \x22math\x22 as fmt" ) diff --git a/test/import2.dir/import2.go b/test/import2.dir/import2.go index 9c54a1b87e..aaaa7336e1 100644 --- a/test/import2.dir/import2.go +++ b/test/import2.dir/import2.go @@ -6,37 +6,38 @@ package p -var C1 chan <- chan int = (chan<- (chan int))(nil) -var C2 chan (<- chan int) = (chan (<-chan int))(nil) -var C3 <- chan chan int = (<-chan (chan int))(nil) -var C4 chan chan <- int = (chan (chan<- int))(nil) - -var C5 <- chan <- chan int = (<-chan (<-chan int))(nil) -var C6 chan <- <- chan int = (chan<- (<-chan int))(nil) -var C7 chan <- chan <- int = (chan<- (chan<- int))(nil) - -var C8 <- chan <- chan chan int = (<-chan (<-chan (chan int)))(nil) -var C9 <- chan chan <- chan int = (<-chan (chan<- (chan int)))(nil) -var C10 chan <- <- chan chan int = (chan<- (<-chan (chan int)))(nil) -var C11 chan <- chan <- chan int = (chan<- (chan<- (chan int)))(nil) -var C12 chan chan <- <- chan int = (chan (chan<- (<-chan int)))(nil) -var C13 chan chan <- chan <- int = (chan (chan<- (chan<- int)))(nil) - -var R1 chan<- (chan int) = (chan <- chan int)(nil) -var R3 <-chan (chan int) = (<- chan chan int)(nil) -var R4 chan (chan<- int) = (chan chan <- int)(nil) - -var R5 <-chan (<-chan int) = (<- chan <- chan int)(nil) -var R6 chan<- (<-chan int) = (chan <- <- chan int)(nil) -var R7 chan<- (chan<- int) = (chan <- chan <- int)(nil) - -var R8 <-chan (<-chan (chan int)) = (<- chan <- chan chan int)(nil) -var R9 <-chan (chan<- (chan int)) = (<- chan chan <- chan int)(nil) -var R10 chan<- (<-chan (chan int)) = (chan <- <- chan chan int)(nil) -var R11 chan<- (chan<- (chan int)) = (chan <- chan <- chan int)(nil) -var R12 chan (chan<- (<-chan int)) = (chan chan <- <- chan int)(nil) -var R13 chan (chan<- (chan<- int)) = (chan chan <- chan <- int)(nil) +var C1 chan<- chan int = (chan<- (chan int))(nil) +var C2 chan (<-chan int) = (chan (<-chan int))(nil) +var C3 <-chan chan int = (<-chan (chan int))(nil) +var C4 chan chan<- int = (chan (chan<- int))(nil) + +var C5 <-chan <-chan int = (<-chan (<-chan int))(nil) +var C6 chan<- <-chan int = (chan<- (<-chan int))(nil) +var C7 chan<- chan<- int = (chan<- (chan<- int))(nil) + +var C8 <-chan <-chan chan int = (<-chan (<-chan (chan int)))(nil) +var C9 <-chan chan<- chan int = (<-chan (chan<- (chan int)))(nil) +var C10 chan<- <-chan chan int = (chan<- (<-chan (chan int)))(nil) +var C11 chan<- chan<- chan int = (chan<- (chan<- (chan int)))(nil) +var C12 chan chan<- <-chan int = (chan (chan<- (<-chan int)))(nil) +var C13 chan chan<- chan<- int = (chan (chan<- (chan<- int)))(nil) + +var R1 chan<- (chan int) = (chan<- chan int)(nil) +var R3 <-chan (chan int) = (<-chan chan int)(nil) +var R4 chan (chan<- int) = (chan chan<- int)(nil) + +var R5 <-chan (<-chan int) = (<-chan <-chan int)(nil) +var R6 chan<- (<-chan int) = (chan<- <-chan int)(nil) +var R7 chan<- (chan<- int) = (chan<- chan<- int)(nil) + +var R8 <-chan (<-chan (chan int)) = (<-chan <-chan chan int)(nil) +var R9 <-chan (chan<- (chan int)) = (<-chan chan<- chan int)(nil) +var R10 chan<- (<-chan (chan int)) = (chan<- <-chan chan int)(nil) +var R11 chan<- (chan<- (chan int)) = (chan<- chan<- chan int)(nil) +var R12 chan (chan<- (<-chan int)) = (chan chan<- <-chan int)(nil) +var R13 chan (chan<- (chan<- int)) = (chan chan<- chan<- int)(nil) var F1 func() func() int + func F2() func() func() int func F3(func() func() int) diff --git a/test/import2.dir/import3.go b/test/import2.dir/import3.go index 3bf9cb0c3c..461251d489 100644 --- a/test/import2.dir/import3.go +++ b/test/import2.dir/import3.go @@ -33,20 +33,19 @@ func main() { p.C12 = (chan (chan<- (<-chan int)))(nil) p.C13 = (chan (chan<- (chan<- int)))(nil) - p.R1 = (chan <- chan int)(nil) - p.R3 = (<- chan chan int)(nil) - p.R4 = (chan chan <- int)(nil) + p.R1 = (chan<- chan int)(nil) + p.R3 = (<-chan chan int)(nil) + p.R4 = (chan chan<- int)(nil) - p.R5 = (<- chan <- chan int)(nil) - p.R6 = (chan <- <- chan int)(nil) - p.R7 = (chan <- chan <- int)(nil) + p.R5 = (<-chan <-chan int)(nil) + p.R6 = (chan<- <-chan int)(nil) + p.R7 = (chan<- chan<- int)(nil) - p.R8 = (<- chan <- chan chan int)(nil) - p.R9 = (<- chan chan <- chan int)(nil) - p.R10 = (chan <- <- chan chan int)(nil) - p.R11 = (chan <- chan <- chan int)(nil) - p.R12 = (chan chan <- <- chan int)(nil) - p.R13 = (chan chan <- chan <- int)(nil) + p.R8 = (<-chan <-chan chan int)(nil) + p.R9 = (<-chan chan<- chan int)(nil) + p.R10 = (chan<- <-chan chan int)(nil) + p.R11 = (chan<- chan<- chan int)(nil) + p.R12 = (chan chan<- <-chan int)(nil) + p.R13 = (chan chan<- chan<- int)(nil) } - diff --git a/test/import4.dir/empty.go b/test/import4.dir/empty.go index 1dffa170df..398c260d0f 100644 --- a/test/import4.dir/empty.go +++ b/test/import4.dir/empty.go @@ -4,7 +4,10 @@ package empty -import ( ) -const ( ) -var ( ) -type ( ) +import () + +const () + +var () + +type () diff --git a/test/import4.dir/import4.go b/test/import4.dir/import4.go index b9f973f172..f174b70be4 100644 --- a/test/import4.dir/import4.go +++ b/test/import4.dir/import4.go @@ -9,16 +9,15 @@ package main // standard -import "fmt" // ERROR "imported and not used.*fmt" +import "fmt" // ERROR "imported and not used.*fmt" // renamed -import X "math" // ERROR "imported and not used.*math" +import X "math" // ERROR "imported and not used.*math" // import dot -import . "bufio" // ERROR "imported and not used.*bufio" +import . "bufio" // ERROR "imported and not used.*bufio" // again, package without anything in it -import "./empty" // ERROR "imported and not used.*empty" -import Z "./empty" // ERROR "imported and not used.*empty" -import . "./empty" // ERROR "imported and not used.*empty" - +import "./empty" // ERROR "imported and not used.*empty" +import Z "./empty" // ERROR "imported and not used.*empty" +import . "./empty" // ERROR "imported and not used.*empty" diff --git a/test/indirect1.go b/test/indirect1.go index 51da4cc7c4..1395eacaf8 100644 --- a/test/indirect1.go +++ b/test/indirect1.go @@ -37,36 +37,36 @@ func f() { // line number for each len call when // it decides there are type errors. x := - len(m0)+ - len(m1)+ // ERROR "illegal|invalid|must be" - len(m2)+ // ERROR "illegal|invalid|must be" - len(m3)+ - len(m4)+ // ERROR "illegal|invalid|must be" + len(m0) + + len(m1) + // ERROR "illegal|invalid|must be" + len(m2) + // ERROR "illegal|invalid|must be" + len(m3) + + len(m4) + // ERROR "illegal|invalid|must be" - len(s0)+ - len(s1)+ // ERROR "illegal|invalid|must be" - len(s2)+ // ERROR "illegal|invalid|must be" - len(s3)+ - len(s4)+ // ERROR "illegal|invalid|must be" + len(s0) + + len(s1) + // ERROR "illegal|invalid|must be" + len(s2) + // ERROR "illegal|invalid|must be" + len(s3) + + len(s4) + // ERROR "illegal|invalid|must be" - len(a0)+ - len(a1)+ - len(a2)+ + len(a0) + + len(a1) + + len(a2) + - cap(a0)+ - cap(a1)+ - cap(a2)+ + cap(a0) + + cap(a1) + + cap(a2) + - len(b0)+ - len(b1)+ // ERROR "illegal|invalid|must be" - len(b2)+ // ERROR "illegal|invalid|must be" - len(b3)+ - len(b4)+ // ERROR "illegal|invalid|must be" + len(b0) + + len(b1) + // ERROR "illegal|invalid|must be" + len(b2) + // ERROR "illegal|invalid|must be" + len(b3) + + len(b4) + // ERROR "illegal|invalid|must be" - cap(b0)+ - cap(b1)+ // ERROR "illegal|invalid|must be" - cap(b2)+ // ERROR "illegal|invalid|must be" - cap(b3)+ - cap(b4) // ERROR "illegal|invalid|must be" + cap(b0) + + cap(b1) + // ERROR "illegal|invalid|must be" + cap(b2) + // ERROR "illegal|invalid|must be" + cap(b3) + + cap(b4) // ERROR "illegal|invalid|must be" _ = x } diff --git a/test/initcomma.go b/test/initcomma.go index a54fce4280..e6cfffda3a 100644 --- a/test/initcomma.go +++ b/test/initcomma.go @@ -8,10 +8,10 @@ package main -var a = []int{1, 2, } -var b = [5]int{1, 2, 3, } -var c = []int{1, } -var d = [...]int{1, 2, 3, } +var a = []int{1, 2} +var b = [5]int{1, 2, 3} +var c = []int{1} +var d = [...]int{1, 2, 3} func main() { if len(a) != 2 { diff --git a/test/initialize.go b/test/initialize.go index 1307e02096..0cf7fe2f5c 100644 --- a/test/initialize.go +++ b/test/initialize.go @@ -19,35 +19,35 @@ type T struct { S } -var a1 = S { 0, 0, 0, 1, 2, 3 } -var b1 = S { X: 1, Z: 3, Y: 2 } +var a1 = S{0, 0, 0, 1, 2, 3} +var b1 = S{X: 1, Z: 3, Y: 2} -var a2 = S { 0, 0, 0, 0, 0, 0, } -var b2 = S { } +var a2 = S{0, 0, 0, 0, 0, 0} +var b2 = S{} -var a3 = T { S { 1, 2, 3, 0, 0, 0, } } -var b3 = T { S: S{ A: 1, B: 2, C: 3 } } +var a3 = T{S{1, 2, 3, 0, 0, 0}} +var b3 = T{S: S{A: 1, B: 2, C: 3}} -var a4 = &[16]byte { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, } -var b4 = &[16]byte { 4: 1, 1, 1, 1, 12: 1, 1, } +var a4 = &[16]byte{0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0} +var b4 = &[16]byte{4: 1, 1, 1, 1, 12: 1, 1} -var a5 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, } -var b5 = &[16]byte { 1, 4: 1, 1, 1, 1, 12: 1, 1, } +var a5 = &[16]byte{1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0} +var b5 = &[16]byte{1, 4: 1, 1, 1, 1, 12: 1, 1} -var a6 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, } -var b6 = &[...]byte { 1, 4: 1, 1, 1, 1, 12: 1, 1, 0, 0,} +var a6 = &[16]byte{1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0} +var b6 = &[...]byte{1, 4: 1, 1, 1, 1, 12: 1, 1, 0, 0} type Same struct { a, b interface{} } -var same = []Same { - Same{ a1, b1 }, - Same{ a2, b2 }, - Same{ a3, b3 }, - Same{ a4, b4 }, - Same{ a5, b5 }, - Same{ a6, b6 }, +var same = []Same{ + Same{a1, b1}, + Same{a2, b2}, + Same{a3, b3}, + Same{a4, b4}, + Same{a5, b5}, + Same{a6, b6}, } func main() { diff --git a/test/initializerr.go b/test/initializerr.go index 990ab60f96..11f1941629 100644 --- a/test/initializerr.go +++ b/test/initializerr.go @@ -18,24 +18,24 @@ type T struct { } var x = 1 -var a1 = S { 0, X: 1 } // ERROR "mixture|undefined" -var a2 = S { Y: 3, Z: 2, Y: 3 } // ERROR "duplicate" -var a3 = T { S{}, 2, 3, 4, 5, 6 } // ERROR "convert|too many" -var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } // ERROR "index|too many" -var a5 = []byte { x: 2 } // ERROR "index" -var a6 = []byte{1: 1, 2: 2, 1: 3} // ERROR "duplicate index" +var a1 = S{0, X: 1} // ERROR "mixture|undefined" +var a2 = S{Y: 3, Z: 2, Y: 3} // ERROR "duplicate" +var a3 = T{S{}, 2, 3, 4, 5, 6} // ERROR "convert|too many" +var a4 = [5]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} // ERROR "index|too many" +var a5 = []byte{x: 2} // ERROR "index" +var a6 = []byte{1: 1, 2: 2, 1: 3} // ERROR "duplicate index" -var ok1 = S { } // should be ok -var ok2 = T { S: ok1 } // should be ok +var ok1 = S{} // should be ok +var ok2 = T{S: ok1} // should be ok // These keys can be computed at compile time but they are // not constants as defined by the spec, so they do not trigger // compile-time errors about duplicate key values. // See issue 4555. -type Key struct {X, Y int} +type Key struct{ X, Y int } var _ = map[Key]string{ - Key{1,2}: "hello", - Key{1,2}: "world", + Key{1, 2}: "hello", + Key{1, 2}: "world", } diff --git a/test/inline_sync.go b/test/inline_sync.go index 30b436af41..27913c1ccc 100644 --- a/test/inline_sync.go +++ b/test/inline_sync.go @@ -35,19 +35,18 @@ func small6() { // ERROR "can inline small6" var once *sync.Once func small7() { // ERROR "can inline small7" - // the Do fast path should be inlined - once.Do(small5) // ERROR "inlining call to sync\.\(\*Once\)\.Do" + // the Do fast path should be inlined + once.Do(small5) // ERROR "inlining call to sync\.\(\*Once\)\.Do" } var rwmutex *sync.RWMutex func small8() { // ERROR "can inline small8" - // the RUnlock fast path should be inlined - rwmutex.RUnlock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RUnlock" + // the RUnlock fast path should be inlined + rwmutex.RUnlock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RUnlock" } func small9() { // ERROR "can inline small9" - // the RLock fast path should be inlined - rwmutex.RLock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RLock" + // the RLock fast path should be inlined + rwmutex.RLock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RLock" } - diff --git a/test/int_lit.go b/test/int_lit.go index 78deaea130..cb24c6cb16 100644 --- a/test/int_lit.go +++ b/test/int_lit.go @@ -11,14 +11,14 @@ package main import "os" func main() { - s := 0 + + s := 0 + 123 + 0123 + 0000 + 0x0 + 0x123 + - 0X0 + - 0X123 + 0x0 + + 0x123 if s != 788 { print("s is ", s, "; should be 788\n") os.Exit(1) diff --git a/test/intcvt.go b/test/intcvt.go index 3920528a40..d9477617ae 100644 --- a/test/intcvt.go +++ b/test/intcvt.go @@ -86,6 +86,7 @@ func chku64(i, v uint64) { panic("fail") } } + //func chkf32(f, v float32) { if f != v { println(f, "!=", v); panic("fail") } } //func chkf64(f, v float64) { if f != v { println(f, "!=", v); panic("fail") } } @@ -134,7 +135,6 @@ func main() { // chki64(int64(f32), 0) // chki64(int64(f64), 0) - chku8(uint8(i8), ci8&0xff) chku8(uint8(i16), ci16&0xff) chku8(uint8(i32), ci32&0xff) diff --git a/test/interface/bigdata.go b/test/interface/bigdata.go index 0f2e9a990e..f194f75b08 100644 --- a/test/interface/bigdata.go +++ b/test/interface/bigdata.go @@ -8,15 +8,18 @@ package main -type I interface { M() int64 } +type I interface{ M() int64 } -type BigPtr struct { a, b, c, d int64 } -func (z *BigPtr) M() int64 { return z.a+z.b+z.c+z.d } +type BigPtr struct{ a, b, c, d int64 } + +func (z *BigPtr) M() int64 { return z.a + z.b + z.c + z.d } + +type SmallPtr struct{ a int32 } -type SmallPtr struct { a int32 } func (z *SmallPtr) M() int64 { return int64(z.a) } type IntPtr int32 + func (z *IntPtr) M() int64 { return int64(*z) } var bad bool @@ -30,30 +33,33 @@ func test(name string, i I) { } func ptrs() { - var bigptr BigPtr = BigPtr{ 10000, 2000, 300, 45 } - var smallptr SmallPtr = SmallPtr{ 12345 } + var bigptr BigPtr = BigPtr{10000, 2000, 300, 45} + var smallptr SmallPtr = SmallPtr{12345} var intptr IntPtr = 12345 -// test("bigptr", bigptr) + // test("bigptr", bigptr) test("&bigptr", &bigptr) -// test("smallptr", smallptr) + // test("smallptr", smallptr) test("&smallptr", &smallptr) -// test("intptr", intptr) + // test("intptr", intptr) test("&intptr", &intptr) } -type Big struct { a, b, c, d int64 } -func (z Big) M() int64 { return z.a+z.b+z.c+z.d } +type Big struct{ a, b, c, d int64 } + +func (z Big) M() int64 { return z.a + z.b + z.c + z.d } + +type Small struct{ a int32 } -type Small struct { a int32 } func (z Small) M() int64 { return int64(z.a) } type Int int32 + func (z Int) M() int64 { return int64(z) } func nonptrs() { - var big Big = Big{ 10000, 2000, 300, 45 } - var small Small = Small{ 12345 } + var big Big = Big{10000, 2000, 300, 45} + var small Small = Small{12345} var int Int = 12345 test("big", big) diff --git a/test/interface/convert1.go b/test/interface/convert1.go index 4a3ec8a375..98261edf9b 100644 --- a/test/interface/convert1.go +++ b/test/interface/convert1.go @@ -8,10 +8,13 @@ package main -type R interface { R() } -type RW interface { R(); W() } +type R interface{ R() } +type RW interface { + R() + W() +} -var e interface {} +var e interface{} var r R var rw RW diff --git a/test/interface/convert2.go b/test/interface/convert2.go index 4a3ec8a375..98261edf9b 100644 --- a/test/interface/convert2.go +++ b/test/interface/convert2.go @@ -8,10 +8,13 @@ package main -type R interface { R() } -type RW interface { R(); W() } +type R interface{ R() } +type RW interface { + R() + W() +} -var e interface {} +var e interface{} var r R var rw RW diff --git a/test/interface/embed.go b/test/interface/embed.go index 5c52ac0232..993c532b2a 100644 --- a/test/interface/embed.go +++ b/test/interface/embed.go @@ -12,16 +12,19 @@ import "os" const Value = 1e12 -type Inter interface { M() int64 } +type Inter interface{ M() int64 } type T int64 + func (t T) M() int64 { return int64(t) } + var t = T(Value) var pt = &t var ti Inter = t -type S struct { Inter } -var s = S{ ti } +type S struct{ Inter } + +var s = S{ti} var ps = &s var i Inter diff --git a/test/interface/embed1.dir/embed0.go b/test/interface/embed1.dir/embed0.go index 728bec74e8..4aed391b63 100644 --- a/test/interface/embed1.dir/embed0.go +++ b/test/interface/embed1.dir/embed0.go @@ -7,10 +7,11 @@ package p type T int + func (t T) m() {} -type I interface { m() } -type J interface { I } +type I interface{ m() } +type J interface{ I } func main() { var i I diff --git a/test/interface/embed1.dir/embed1.go b/test/interface/embed1.dir/embed1.go index 7dfb1dbc0a..54754f3069 100644 --- a/test/interface/embed1.dir/embed1.go +++ b/test/interface/embed1.dir/embed1.go @@ -9,13 +9,14 @@ package main import "./embed0" type T int + func (t T) m() {} -type I interface { m() } -type J interface { I } +type I interface{ m() } +type J interface{ I } -type PI interface { p.I } -type PJ interface { p.J } +type PI interface{ p.I } +type PJ interface{ p.J } func main() { var i I diff --git a/test/interface/pointer.go b/test/interface/pointer.go index 2927050669..23e8ec285c 100644 --- a/test/interface/pointer.go +++ b/test/interface/pointer.go @@ -24,7 +24,6 @@ type Start struct { func (start *Start) Next() *Inst { return nil } - func AddInst(Inst) *Inst { print("ok in addinst\n") return nil @@ -34,5 +33,5 @@ func main() { print("call addinst\n") var x Inst = AddInst(new(Start)) // ERROR "pointer to interface" print("return from addinst\n") - var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type" + var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type" } diff --git a/test/interface/private.dir/private1.go b/test/interface/private.dir/private1.go index 75eee51f5a..8743ddb352 100644 --- a/test/interface/private.dir/private1.go +++ b/test/interface/private.dir/private1.go @@ -15,4 +15,3 @@ type Implementation struct{} func (p *Implementation) private() {} var X = new(Implementation) - diff --git a/test/interface/private.dir/prog.go b/test/interface/private.dir/prog.go index abea7d625c..e20c188eda 100644 --- a/test/interface/private.dir/prog.go +++ b/test/interface/private.dir/prog.go @@ -25,9 +25,9 @@ func main() { var px p.Exported px = p.X - px.private() // ERROR "private" + px.private() // ERROR "private" - px = new(Implementation) // ERROR "private" + px = new(Implementation) // ERROR "private" - x = px // ERROR "private" + x = px // ERROR "private" } diff --git a/test/interface/recursive.go b/test/interface/recursive.go index fcc88331e0..bfb517bdcc 100644 --- a/test/interface/recursive.go +++ b/test/interface/recursive.go @@ -17,5 +17,6 @@ type I2 interface { } type T int + func (t T) foo() I2 { return t } func (t T) bar() I1 { return t } diff --git a/test/interface/returntype.go b/test/interface/returntype.go index 4d86f39184..d94b2ed68b 100644 --- a/test/interface/returntype.go +++ b/test/interface/returntype.go @@ -8,14 +8,14 @@ package main -type S struct { a int } -type T struct { b string } +type S struct{ a int } +type T struct{ b string } -func (s *S) Name() int8 { return 1 } +func (s *S) Name() int8 { return 1 } func (t *T) Name() int64 { return 64 } -type I1 interface { Name() int8 } -type I2 interface { Name() int64 } +type I1 interface{ Name() int8 } +type I2 interface{ Name() int64 } func main() { shouldPanic(p1) diff --git a/test/interface/struct.go b/test/interface/struct.go index f60819ca81..628e5de5e3 100644 --- a/test/interface/struct.go +++ b/test/interface/struct.go @@ -13,16 +13,20 @@ import "os" var fail int func check(b bool, msg string) { - if (!b) { + if !b { println("failure in", msg) fail++ } } -type I1 interface { Get() int; Put(int) } +type I1 interface { + Get() int + Put(int) +} + +type S1 struct{ i int } -type S1 struct { i int } -func (p S1) Get() int { return p.i } +func (p S1) Get() int { return p.i } func (p S1) Put(i int) { p.i = i } func f1() { @@ -49,8 +53,9 @@ func f3() { check(s.i == 1, "f3 s") } -type S2 struct { i int } -func (p *S2) Get() int { return p.i } +type S2 struct{ i int } + +func (p *S2) Get() int { return p.i } func (p *S2) Put(i int) { p.i = i } // Disallowed by restriction of values going to pointer receivers @@ -78,10 +83,14 @@ func f6() { check(s.i == 2, "f6 s") } -type I2 interface { Get() int64; Put(int64) } +type I2 interface { + Get() int64 + Put(int64) +} + +type S3 struct{ i, j, k, l int64 } -type S3 struct { i, j, k, l int64 } -func (p S3) Get() int64 { return p.l } +func (p S3) Get() int64 { return p.l } func (p S3) Put(i int64) { p.l = i } func f7() { @@ -108,8 +117,9 @@ func f9() { check(s.l == 4, "f9 s") } -type S4 struct { i, j, k, l int64 } -func (p *S4) Get() int64 { return p.l } +type S4 struct{ i, j, k, l int64 } + +func (p *S4) Get() int64 { return p.l } func (p *S4) Put(i int64) { p.l = i } // Disallowed by restriction of values going to pointer receivers @@ -141,13 +151,13 @@ func main() { f1() f2() f3() -// f4() + // f4() f5() f6() f7() f8() f9() -// f10() + // f10() f11() f12() if fail > 0 { diff --git a/test/iota.go b/test/iota.go index 7187dbe335..490b27d238 100644 --- a/test/iota.go +++ b/test/iota.go @@ -16,9 +16,9 @@ func assert(cond bool, msg string) { } const ( - x int = iota - y = iota - z = 1 << iota + x int = iota + y = iota + z = 1 << iota f float32 = 2 * iota g float32 = 4.5 * float32(iota) ) diff --git a/test/ken/complit.go b/test/ken/complit.go index bc50bbe224..99d9d7713f 100644 --- a/test/ken/complit.go +++ b/test/ken/complit.go @@ -8,118 +8,115 @@ package main -type M map[int]int -type S struct{ a,b,c int }; -type SS struct{ aa,bb,cc S }; -type SA struct{ a,b,c [3]int }; -type SC struct{ a,b,c []int }; -type SM struct{ a,b,c M }; - -func -main() { - test("s.a", s.a); - test("s.b", s.b); - test("s.c", s.c); - - test("ss.aa.a", ss.aa.a); - test("ss.aa.b", ss.aa.b); - test("ss.aa.c", ss.aa.c); - - test("ss.bb.a", ss.bb.a); - test("ss.bb.b", ss.bb.b); - test("ss.bb.c", ss.bb.c); - - test("ss.cc.a", ss.cc.a); - test("ss.cc.b", ss.cc.b); - test("ss.cc.c", ss.cc.c); - - for i:=0; i<3; i++ { - test("a[i]", a[i]); - test("c[i]", c[i]); - test("m[i]", m[i]); - - test("as[i].a", as[i].a); - test("as[i].b", as[i].b); - test("as[i].c", as[i].c); - - test("cs[i].a", cs[i].a); - test("cs[i].b", cs[i].b); - test("cs[i].c", cs[i].c); - - test("ms[i].a", ms[i].a); - test("ms[i].b", ms[i].b); - test("ms[i].c", ms[i].c); - - test("sa.a[i]", sa.a[i]); - test("sa.b[i]", sa.b[i]); - test("sa.c[i]", sa.c[i]); - - test("sc.a[i]", sc.a[i]); - test("sc.b[i]", sc.b[i]); - test("sc.c[i]", sc.c[i]); - - test("sm.a[i]", sm.a[i]); - test("sm.b[i]", sm.b[i]); - test("sm.c[i]", sm.c[i]); - - for j:=0; j<3; j++ { - test("aa[i][j]", aa[i][j]); - test("ac[i][j]", ac[i][j]); - test("am[i][j]", am[i][j]); - test("ca[i][j]", ca[i][j]); - test("cc[i][j]", cc[i][j]); - test("cm[i][j]", cm[i][j]); - test("ma[i][j]", ma[i][j]); - test("mc[i][j]", mc[i][j]); - test("mm[i][j]", mm[i][j]); +type M map[int]int +type S struct{ a, b, c int } +type SS struct{ aa, bb, cc S } +type SA struct{ a, b, c [3]int } +type SC struct{ a, b, c []int } +type SM struct{ a, b, c M } + +func main() { + test("s.a", s.a) + test("s.b", s.b) + test("s.c", s.c) + + test("ss.aa.a", ss.aa.a) + test("ss.aa.b", ss.aa.b) + test("ss.aa.c", ss.aa.c) + + test("ss.bb.a", ss.bb.a) + test("ss.bb.b", ss.bb.b) + test("ss.bb.c", ss.bb.c) + + test("ss.cc.a", ss.cc.a) + test("ss.cc.b", ss.cc.b) + test("ss.cc.c", ss.cc.c) + + for i := 0; i < 3; i++ { + test("a[i]", a[i]) + test("c[i]", c[i]) + test("m[i]", m[i]) + + test("as[i].a", as[i].a) + test("as[i].b", as[i].b) + test("as[i].c", as[i].c) + + test("cs[i].a", cs[i].a) + test("cs[i].b", cs[i].b) + test("cs[i].c", cs[i].c) + + test("ms[i].a", ms[i].a) + test("ms[i].b", ms[i].b) + test("ms[i].c", ms[i].c) + + test("sa.a[i]", sa.a[i]) + test("sa.b[i]", sa.b[i]) + test("sa.c[i]", sa.c[i]) + + test("sc.a[i]", sc.a[i]) + test("sc.b[i]", sc.b[i]) + test("sc.c[i]", sc.c[i]) + + test("sm.a[i]", sm.a[i]) + test("sm.b[i]", sm.b[i]) + test("sm.c[i]", sm.c[i]) + + for j := 0; j < 3; j++ { + test("aa[i][j]", aa[i][j]) + test("ac[i][j]", ac[i][j]) + test("am[i][j]", am[i][j]) + test("ca[i][j]", ca[i][j]) + test("cc[i][j]", cc[i][j]) + test("cm[i][j]", cm[i][j]) + test("ma[i][j]", ma[i][j]) + test("mc[i][j]", mc[i][j]) + test("mm[i][j]", mm[i][j]) } } } -var ref = 0; +var ref = 0 -func -test(xs string, x int) { +func test(xs string, x int) { if ref >= len(answers) { - println(xs, x); - return; + println(xs, x) + return } if x != answers[ref] { println(xs, "is", x, "should be", answers[ref]) } - ref++; + ref++ } +var a = [3]int{1001, 1002, 1003} +var s = S{1101, 1102, 1103} +var c = []int{1201, 1202, 1203} +var m = M{0: 1301, 1: 1302, 2: 1303} -var a = [3]int{1001, 1002, 1003} -var s = S{1101, 1102, 1103} -var c = []int{1201, 1202, 1203} -var m = M{0:1301, 1:1302, 2:1303} +var aa = [3][3]int{[3]int{2001, 2002, 2003}, [3]int{2004, 2005, 2006}, [3]int{2007, 2008, 2009}} +var as = [3]S{S{2101, 2102, 2103}, S{2104, 2105, 2106}, S{2107, 2108, 2109}} +var ac = [3][]int{[]int{2201, 2202, 2203}, []int{2204, 2205, 2206}, []int{2207, 2208, 2209}} +var am = [3]M{M{0: 2301, 1: 2302, 2: 2303}, M{0: 2304, 1: 2305, 2: 2306}, M{0: 2307, 1: 2308, 2: 2309}} -var aa = [3][3]int{[3]int{2001,2002,2003}, [3]int{2004,2005,2006}, [3]int{2007,2008,2009}} -var as = [3]S{S{2101,2102,2103},S{2104,2105,2106},S{2107,2108,2109}} -var ac = [3][]int{[]int{2201,2202,2203}, []int{2204,2205,2206}, []int{2207,2208,2209}} -var am = [3]M{M{0:2301,1:2302,2:2303}, M{0:2304,1:2305,2:2306}, M{0:2307,1:2308,2:2309}} +var sa = SA{[3]int{3001, 3002, 3003}, [3]int{3004, 3005, 3006}, [3]int{3007, 3008, 3009}} +var ss = SS{S{3101, 3102, 3103}, S{3104, 3105, 3106}, S{3107, 3108, 3109}} +var sc = SC{[]int{3201, 3202, 3203}, []int{3204, 3205, 3206}, []int{3207, 3208, 3209}} +var sm = SM{M{0: 3301, 1: 3302, 2: 3303}, M{0: 3304, 1: 3305, 2: 3306}, M{0: 3307, 1: 3308, 2: 3309}} -var sa = SA{[3]int{3001,3002,3003},[3]int{3004,3005,3006},[3]int{3007,3008,3009}} -var ss = SS{S{3101,3102,3103},S{3104,3105,3106},S{3107,3108,3109}} -var sc = SC{[]int{3201,3202,3203},[]int{3204,3205,3206},[]int{3207,3208,3209}} -var sm = SM{M{0:3301,1:3302,2:3303}, M{0:3304,1:3305,2:3306}, M{0:3307,1:3308,2:3309}} +var ca = [][3]int{[3]int{4001, 4002, 4003}, [3]int{4004, 4005, 4006}, [3]int{4007, 4008, 4009}} +var cs = []S{S{4101, 4102, 4103}, S{4104, 4105, 4106}, S{4107, 4108, 4109}} +var cc = [][]int{[]int{4201, 4202, 4203}, []int{4204, 4205, 4206}, []int{4207, 4208, 4209}} +var cm = []M{M{0: 4301, 1: 4302, 2: 4303}, M{0: 4304, 1: 4305, 2: 4306}, M{0: 4307, 1: 4308, 2: 4309}} -var ca = [][3]int{[3]int{4001,4002,4003}, [3]int{4004,4005,4006}, [3]int{4007,4008,4009}} -var cs = []S{S{4101,4102,4103},S{4104,4105,4106},S{4107,4108,4109}} -var cc = [][]int{[]int{4201,4202,4203}, []int{4204,4205,4206}, []int{4207,4208,4209}} -var cm = []M{M{0:4301,1:4302,2:4303}, M{0:4304,1:4305,2:4306}, M{0:4307,1:4308,2:4309}} +var ma = map[int][3]int{0: [3]int{5001, 5002, 5003}, 1: [3]int{5004, 5005, 5006}, 2: [3]int{5007, 5008, 5009}} +var ms = map[int]S{0: S{5101, 5102, 5103}, 1: S{5104, 5105, 5106}, 2: S{5107, 5108, 5109}} +var mc = map[int][]int{0: []int{5201, 5202, 5203}, 1: []int{5204, 5205, 5206}, 2: []int{5207, 5208, 5209}} +var mm = map[int]M{0: M{0: 5301, 1: 5302, 2: 5303}, 1: M{0: 5304, 1: 5305, 2: 5306}, 2: M{0: 5307, 1: 5308, 2: 5309}} -var ma = map[int][3]int{0:[3]int{5001,5002,5003}, 1:[3]int{5004,5005,5006}, 2:[3]int{5007,5008,5009}} -var ms = map[int]S{0:S{5101,5102,5103},1:S{5104,5105,5106},2:S{5107,5108,5109}} -var mc = map[int][]int{0:[]int{5201,5202,5203}, 1:[]int{5204,5205,5206}, 2:[]int{5207,5208,5209}} -var mm = map[int]M{0:M{0:5301,1:5302,2:5303}, 1:M{0:5304,1:5305,2:5306}, 2:M{0:5307,1:5308,2:5309}} - -var answers = [...]int { +var answers = [...]int{ // s 1101, 1102, 1103, diff --git a/test/ken/convert.go b/test/ken/convert.go index 33acbd8cd2..f3b08edbc2 100644 --- a/test/ken/convert.go +++ b/test/ken/convert.go @@ -9,26 +9,26 @@ package main -var i8 int8; -var u8 uint8; -var i16 int16; -var u16 uint16; -var i32 int32; -var u32 uint32; -var i64 int64; -var u64 uint64; -var f32 float32; -var f64 float64; - -type big float64 - -type t struct { - from, to int - val big +var i8 int8 +var u8 uint8 +var i16 int16 +var u16 uint16 +var i32 int32 +var u32 uint32 +var i64 int64 +var u64 uint64 +var f32 float32 +var f64 float64 + +type big float64 + +type t struct { + from, to int + val big } const ( - ti8 = iota+1 + ti8 = iota + 1 tu8 ti16 tu16 @@ -40,177 +40,184 @@ const ( tf64 ) -var x = []t{ +var x = []t{ /* value good in all types (10) */ - { ti8, ti8, 10 }, { ti8, tu8, 10 }, { ti8, ti16, 10 }, { ti8, tu16, 10 }, - { ti8, ti32, 10 }, { ti8, tu32, 10 }, { ti8, ti64, 10 }, { ti8, tu64, 10 }, - { ti8, tf32, 10 }, { ti8, tf64, 10 }, + {ti8, ti8, 10}, {ti8, tu8, 10}, {ti8, ti16, 10}, {ti8, tu16, 10}, + {ti8, ti32, 10}, {ti8, tu32, 10}, {ti8, ti64, 10}, {ti8, tu64, 10}, + {ti8, tf32, 10}, {ti8, tf64, 10}, - { tu8, ti8, 10 }, { tu8, tu8, 10 }, { tu8, ti16, 10 }, { tu8, tu16, 10 }, - { tu8, ti32, 10 }, { tu8, tu32, 10 }, { tu8, ti64, 10 }, { tu8, tu64, 10 }, - { tu8, tf32, 10 }, { tu8, tf64, 10 }, + {tu8, ti8, 10}, {tu8, tu8, 10}, {tu8, ti16, 10}, {tu8, tu16, 10}, + {tu8, ti32, 10}, {tu8, tu32, 10}, {tu8, ti64, 10}, {tu8, tu64, 10}, + {tu8, tf32, 10}, {tu8, tf64, 10}, - { ti16, ti8, 10 }, { ti16, tu8, 10 }, { ti16, ti16, 10 }, { ti16, tu16, 10 }, - { ti16, ti32, 10 }, { ti16, tu32, 10 }, { ti16, ti64, 10 }, { ti16, tu64, 10 }, - { ti16, tf32, 10 }, { ti16, tf64, 10 }, + {ti16, ti8, 10}, {ti16, tu8, 10}, {ti16, ti16, 10}, {ti16, tu16, 10}, + {ti16, ti32, 10}, {ti16, tu32, 10}, {ti16, ti64, 10}, {ti16, tu64, 10}, + {ti16, tf32, 10}, {ti16, tf64, 10}, - { tu16, ti8, 10 }, { tu16, tu8, 10 }, { tu16, ti16, 10 }, { tu16, tu16, 10 }, - { tu16, ti32, 10 }, { tu16, tu32, 10 }, { tu16, ti64, 10 }, { tu16, tu64, 10 }, - { tu16, tf32, 10 }, { tu16, tf64, 10 }, + {tu16, ti8, 10}, {tu16, tu8, 10}, {tu16, ti16, 10}, {tu16, tu16, 10}, + {tu16, ti32, 10}, {tu16, tu32, 10}, {tu16, ti64, 10}, {tu16, tu64, 10}, + {tu16, tf32, 10}, {tu16, tf64, 10}, - { ti32, ti8, 10 }, { ti32, tu8, 10 }, { ti32, ti16, 10 }, { ti32, tu16, 10 }, - { ti32, ti32, 10 }, { ti32, tu32, 10 }, { ti32, ti64, 10 }, { ti32, tu64, 10 }, - { ti32, tf32, 10 }, { ti32, tf64, 10 }, + {ti32, ti8, 10}, {ti32, tu8, 10}, {ti32, ti16, 10}, {ti32, tu16, 10}, + {ti32, ti32, 10}, {ti32, tu32, 10}, {ti32, ti64, 10}, {ti32, tu64, 10}, + {ti32, tf32, 10}, {ti32, tf64, 10}, - { tu32, ti8, 10 }, { tu32, tu8, 10 }, { tu32, ti16, 10 }, { tu32, tu16, 10 }, - { tu32, ti32, 10 }, { tu32, tu32, 10 }, { tu32, ti64, 10 }, { tu32, tu64, 10 }, - { tu32, tf32, 10 }, { tu32, tf64, 10 }, + {tu32, ti8, 10}, {tu32, tu8, 10}, {tu32, ti16, 10}, {tu32, tu16, 10}, + {tu32, ti32, 10}, {tu32, tu32, 10}, {tu32, ti64, 10}, {tu32, tu64, 10}, + {tu32, tf32, 10}, {tu32, tf64, 10}, - { ti64, ti8, 10 }, { ti64, tu8, 10 }, { ti64, ti16, 10 }, { ti64, tu16, 10 }, - { ti64, ti32, 10 }, { ti64, tu32, 10 }, { ti64, ti64, 10 }, { ti64, tu64, 10 }, - { ti64, tf32, 10 }, { ti64, tf64, 10 }, + {ti64, ti8, 10}, {ti64, tu8, 10}, {ti64, ti16, 10}, {ti64, tu16, 10}, + {ti64, ti32, 10}, {ti64, tu32, 10}, {ti64, ti64, 10}, {ti64, tu64, 10}, + {ti64, tf32, 10}, {ti64, tf64, 10}, - { tu64, ti8, 10 }, { tu64, tu8, 10 }, { tu64, ti16, 10 }, { tu64, tu16, 10 }, - { tu64, ti32, 10 }, { tu64, tu32, 10 }, { tu64, ti64, 10 }, { tu64, tu64, 10 }, - { tu64, tf32, 10 }, { tu64, tf64, 10 }, + {tu64, ti8, 10}, {tu64, tu8, 10}, {tu64, ti16, 10}, {tu64, tu16, 10}, + {tu64, ti32, 10}, {tu64, tu32, 10}, {tu64, ti64, 10}, {tu64, tu64, 10}, + {tu64, tf32, 10}, {tu64, tf64, 10}, - { tf32, ti8, 10 }, { tf32, tu8, 10 }, { tf32, ti16, 10 }, { tf32, tu16, 10 }, - { tf32, ti32, 10 }, { tf32, tu32, 10 }, { tf32, ti64, 10 }, { tf32, tu64, 10 }, - { tf32, tf32, 10 }, { tf32, tf64, 10 }, + {tf32, ti8, 10}, {tf32, tu8, 10}, {tf32, ti16, 10}, {tf32, tu16, 10}, + {tf32, ti32, 10}, {tf32, tu32, 10}, {tf32, ti64, 10}, {tf32, tu64, 10}, + {tf32, tf32, 10}, {tf32, tf64, 10}, - { tf64, ti8, 10 }, { tf64, tu8, 10 }, { tf64, ti16, 10 }, { tf64, tu16, 10 }, - { tf64, ti32, 10 }, { tf64, tu32, 10 }, { tf64, ti64, 10 }, { tf64, tu64, 10 }, - { tf64, tf32, 10 }, { tf64, tf64, 10 }, + {tf64, ti8, 10}, {tf64, tu8, 10}, {tf64, ti16, 10}, {tf64, tu16, 10}, + {tf64, ti32, 10}, {tf64, tu32, 10}, {tf64, ti64, 10}, {tf64, tu64, 10}, + {tf64, tf32, 10}, {tf64, tf64, 10}, /* value good in all signed types (-4) */ - { ti8, ti8, -4 }, { ti8, ti16, -4 }, - { ti8, ti32, -4 }, { ti8, ti64, -4 }, - { ti8, tf32, -4 }, { ti8, tf64, -4 }, + {ti8, ti8, -4}, {ti8, ti16, -4}, + {ti8, ti32, -4}, {ti8, ti64, -4}, + {ti8, tf32, -4}, {ti8, tf64, -4}, - { ti16, ti8, -4 }, { ti16, ti16, -4 }, - { ti16, ti32, -4 }, { ti16, ti64, -4 }, - { ti16, tf32, -4 }, + {ti16, ti8, -4}, {ti16, ti16, -4}, + {ti16, ti32, -4}, {ti16, ti64, -4}, + {ti16, tf32, -4}, - { ti32, ti8, -4 }, { ti32, ti16, -4 }, - { ti32, ti32, -4 }, { ti32, ti64, -4 }, - { ti32, tf32, -4 }, { ti32, tf64, -4 }, + {ti32, ti8, -4}, {ti32, ti16, -4}, + {ti32, ti32, -4}, {ti32, ti64, -4}, + {ti32, tf32, -4}, {ti32, tf64, -4}, - { ti64, ti8, -4 }, { ti64, ti16, -4 }, - { ti64, ti32, -4 }, { ti64, ti64, -4 }, - { ti64, tf32, -4 }, + {ti64, ti8, -4}, {ti64, ti16, -4}, + {ti64, ti32, -4}, {ti64, ti64, -4}, + {ti64, tf32, -4}, - { tf32, ti8, -4 }, { tf32, ti16, -4 }, - { tf32, ti32, -4 }, { tf32, ti64, -4 }, - { tf32, tf32, -4 }, + {tf32, ti8, -4}, {tf32, ti16, -4}, + {tf32, ti32, -4}, {tf32, ti64, -4}, + {tf32, tf32, -4}, - { tf64, ti8, -4 }, { tf64, ti16, -4 }, - { tf64, ti32, -4 }, { tf64, ti64, -4 }, - { tf64, tf32, -4 }, { tf64, tf64, -4 }, + {tf64, ti8, -4}, {tf64, ti16, -4}, + {tf64, ti32, -4}, {tf64, ti64, -4}, + {tf64, tf32, -4}, {tf64, tf64, -4}, /* value good in u8 and up (175) */ - { tu8, tu8, 175 }, { tu8, ti16, 175 }, { tu8, tu16, 175 }, - { tu8, ti32, 175 }, { tu8, tu32, 175 }, { tu8, ti64, 175 }, { tu8, tu64, 175 }, - { tu8, tf32, 175 }, { tu8, tf64, 175 }, + {tu8, tu8, 175}, {tu8, ti16, 175}, {tu8, tu16, 175}, + {tu8, ti32, 175}, {tu8, tu32, 175}, {tu8, ti64, 175}, {tu8, tu64, 175}, + {tu8, tf32, 175}, {tu8, tf64, 175}, - { ti16, tu8, 175 }, { ti16, ti16, 175 }, { ti16, tu16, 175 }, - { ti16, ti32, 175 }, { ti16, tu32, 175 }, { ti16, ti64, 175 }, { ti16, tu64, 175 }, - { ti16, tf32, 175 }, { ti16, tf64, 175 }, + {ti16, tu8, 175}, {ti16, ti16, 175}, {ti16, tu16, 175}, + {ti16, ti32, 175}, {ti16, tu32, 175}, {ti16, ti64, 175}, {ti16, tu64, 175}, + {ti16, tf32, 175}, {ti16, tf64, 175}, - { tu16, tu8, 175 }, { tu16, ti16, 175 }, { tu16, tu16, 175 }, - { tu16, ti32, 175 }, { tu16, tu32, 175 }, { tu16, ti64, 175 }, { tu16, tu64, 175 }, - { tu16, tf32, 175 }, { tu16, tf64, 175 }, + {tu16, tu8, 175}, {tu16, ti16, 175}, {tu16, tu16, 175}, + {tu16, ti32, 175}, {tu16, tu32, 175}, {tu16, ti64, 175}, {tu16, tu64, 175}, + {tu16, tf32, 175}, {tu16, tf64, 175}, - { ti32, tu8, 175 }, { ti32, ti16, 175 }, { ti32, tu16, 175 }, - { ti32, ti32, 175 }, { ti32, tu32, 175 }, { ti32, ti64, 175 }, { ti32, tu64, 175 }, - { ti32, tf32, 175 }, { ti32, tf64, 175 }, + {ti32, tu8, 175}, {ti32, ti16, 175}, {ti32, tu16, 175}, + {ti32, ti32, 175}, {ti32, tu32, 175}, {ti32, ti64, 175}, {ti32, tu64, 175}, + {ti32, tf32, 175}, {ti32, tf64, 175}, - { tu32, tu8, 175 }, { tu32, ti16, 175 }, { tu32, tu16, 175 }, - { tu32, ti32, 175 }, { tu32, tu32, 175 }, { tu32, ti64, 175 }, { tu32, tu64, 175 }, - { tu32, tf32, 175 }, { tu32, tf64, 175 }, + {tu32, tu8, 175}, {tu32, ti16, 175}, {tu32, tu16, 175}, + {tu32, ti32, 175}, {tu32, tu32, 175}, {tu32, ti64, 175}, {tu32, tu64, 175}, + {tu32, tf32, 175}, {tu32, tf64, 175}, - { ti64, tu8, 175 }, { ti64, ti16, 175 }, { ti64, tu16, 175 }, - { ti64, ti32, 175 }, { ti64, tu32, 175 }, { ti64, ti64, 175 }, { ti64, tu64, 175 }, - { ti64, tf32, 175 }, { ti64, tf64, 175 }, + {ti64, tu8, 175}, {ti64, ti16, 175}, {ti64, tu16, 175}, + {ti64, ti32, 175}, {ti64, tu32, 175}, {ti64, ti64, 175}, {ti64, tu64, 175}, + {ti64, tf32, 175}, {ti64, tf64, 175}, - { tu64, tu8, 175 }, { tu64, ti16, 175 }, { tu64, tu16, 175 }, - { tu64, ti32, 175 }, { tu64, tu32, 175 }, { tu64, ti64, 175 }, { tu64, tu64, 175 }, - { tu64, tf32, 175 }, { tu64, tf64, 175 }, + {tu64, tu8, 175}, {tu64, ti16, 175}, {tu64, tu16, 175}, + {tu64, ti32, 175}, {tu64, tu32, 175}, {tu64, ti64, 175}, {tu64, tu64, 175}, + {tu64, tf32, 175}, {tu64, tf64, 175}, - { tf32, tu8, 175 }, { tf32, ti16, 175 }, { tf32, tu16, 175 }, - { tf32, ti32, 175 }, { tf32, tu32, 175 }, { tf32, ti64, 175 }, { tf32, tu64, 175 }, - { tf32, tf32, 175 }, { tf32, tf64, 175 }, + {tf32, tu8, 175}, {tf32, ti16, 175}, {tf32, tu16, 175}, + {tf32, ti32, 175}, {tf32, tu32, 175}, {tf32, ti64, 175}, {tf32, tu64, 175}, + {tf32, tf32, 175}, {tf32, tf64, 175}, - { tf64, tu8, 175 }, { tf64, ti16, 175 }, { tf64, tu16, 175 }, - { tf64, ti32, 175 }, { tf64, tu32, 175 }, { tf64, ti64, 175 }, { tf64, tu64, 175 }, - { tf64, tf32, 175 }, { tf64, tf64, 175 }, + {tf64, tu8, 175}, {tf64, ti16, 175}, {tf64, tu16, 175}, + {tf64, ti32, 175}, {tf64, tu32, 175}, {tf64, ti64, 175}, {tf64, tu64, 175}, + {tf64, tf32, 175}, {tf64, tf64, 175}, /* value good in u16 and up (41259) */ - { tu16, tu16, 41259 }, - { tu16, ti32, 41259 }, { tu16, ti64, 41259 }, { tu16, tu64, 41259 }, - { tu16, tf32, 41259 }, { tu16, tf64, 41259 }, + {tu16, tu16, 41259}, + {tu16, ti32, 41259}, {tu16, ti64, 41259}, {tu16, tu64, 41259}, + {tu16, tf32, 41259}, {tu16, tf64, 41259}, - { ti32, tu16, 41259 }, - { ti32, ti32, 41259 }, { ti32, tu32, 41259 }, { ti32, ti64, 41259 }, { ti32, tu64, 41259 }, - { ti32, tf32, 41259 }, { ti32, tf64, 41259 }, + {ti32, tu16, 41259}, + {ti32, ti32, 41259}, {ti32, tu32, 41259}, {ti32, ti64, 41259}, {ti32, tu64, 41259}, + {ti32, tf32, 41259}, {ti32, tf64, 41259}, - { tu32, tu16, 41259 }, - { tu32, ti32, 41259 }, { tu32, tu32, 41259 }, { tu32, ti64, 41259 }, { tu32, tu64, 41259 }, - { tu32, tf32, 41259 }, { tu32, tf64, 41259 }, + {tu32, tu16, 41259}, + {tu32, ti32, 41259}, {tu32, tu32, 41259}, {tu32, ti64, 41259}, {tu32, tu64, 41259}, + {tu32, tf32, 41259}, {tu32, tf64, 41259}, - { ti64, tu16, 41259 }, - { ti64, ti32, 41259 }, { ti64, tu32, 41259 }, { ti64, ti64, 41259 }, { ti64, tu64, 41259 }, - { ti64, tf32, 41259 }, { ti64, tf64, 41259 }, + {ti64, tu16, 41259}, + {ti64, ti32, 41259}, {ti64, tu32, 41259}, {ti64, ti64, 41259}, {ti64, tu64, 41259}, + {ti64, tf32, 41259}, {ti64, tf64, 41259}, - { tu64, tu16, 41259 }, - { tu64, ti32, 41259 }, { tu64, tu32, 41259 }, { tu64, ti64, 41259 }, { tu64, tu64, 41259 }, - { tu64, tf32, 41259 }, { tu64, tf64, 41259 }, + {tu64, tu16, 41259}, + {tu64, ti32, 41259}, {tu64, tu32, 41259}, {tu64, ti64, 41259}, {tu64, tu64, 41259}, + {tu64, tf32, 41259}, {tu64, tf64, 41259}, - { tf32, tu16, 41259 }, - { tf32, ti32, 41259 }, { tf32, tu32, 41259 }, { tf32, ti64, 41259 }, { tf32, tu64, 41259 }, - { tf32, tf32, 41259 }, { tf32, tf64, 41259 }, + {tf32, tu16, 41259}, + {tf32, ti32, 41259}, {tf32, tu32, 41259}, {tf32, ti64, 41259}, {tf32, tu64, 41259}, + {tf32, tf32, 41259}, {tf32, tf64, 41259}, - { tf64, tu16, 41259 }, - { tf64, ti32, 41259 }, { tf64, tu32, 41259 }, { tf64, ti64, 41259 }, { tf64, tu64, 41259 }, - { tf64, tf32, 41259 }, { tf64, tf64, 41259 }, + {tf64, tu16, 41259}, + {tf64, ti32, 41259}, {tf64, tu32, 41259}, {tf64, ti64, 41259}, {tf64, tu64, 41259}, + {tf64, tf32, 41259}, {tf64, tf64, 41259}, /* value good in u32 and up (3758096384) */ - { tu32, tu32, 3758096384 }, { tu32, ti64, 3758096384 }, { tu32, tu64, 3758096384 }, - { tu32, tf32, 3758096384 }, { tu32, tf64, 3758096384 }, + {tu32, tu32, 3758096384}, {tu32, ti64, 3758096384}, {tu32, tu64, 3758096384}, + {tu32, tf32, 3758096384}, {tu32, tf64, 3758096384}, - { ti64, tu32, 3758096384 }, { ti64, ti64, 3758096384 }, { ti64, tu64, 3758096384 }, - { ti64, tf32, 3758096384 }, { ti64, tf64, 3758096384 }, + {ti64, tu32, 3758096384}, {ti64, ti64, 3758096384}, {ti64, tu64, 3758096384}, + {ti64, tf32, 3758096384}, {ti64, tf64, 3758096384}, - { tu64, tu32, 3758096384 }, { tu64, ti64, 3758096384 }, { tu64, tu64, 3758096384 }, - { tu64, tf32, 3758096384 }, { tu64, tf64, 3758096384 }, + {tu64, tu32, 3758096384}, {tu64, ti64, 3758096384}, {tu64, tu64, 3758096384}, + {tu64, tf32, 3758096384}, {tu64, tf64, 3758096384}, - { tf32, tu32, 3758096384 }, { tf32, ti64, 3758096384 }, { tf32, tu64, 3758096384 }, - { tf32, tf32, 3758096384 }, { tf32, tf64, 3758096384 }, + {tf32, tu32, 3758096384}, {tf32, ti64, 3758096384}, {tf32, tu64, 3758096384}, + {tf32, tf32, 3758096384}, {tf32, tf64, 3758096384}, - { tf64, tu32, 3758096384 }, { tf64, ti64, 3758096384 }, { tf64, tu64, 3758096384 }, - { tf64, tf32, 3758096384 }, { tf64, tf64, 3758096384 }, + {tf64, tu32, 3758096384}, {tf64, ti64, 3758096384}, {tf64, tu64, 3758096384}, + {tf64, tf32, 3758096384}, {tf64, tf64, 3758096384}, /* value good in u64 and up (16717361816799281152) */ - { tu64, tu64, 16717361816799281152 }, - { tu64, tf32, 16717361816799281152 }, { tu64, tf64, 16717361816799281152 }, + {tu64, tu64, 16717361816799281152}, + {tu64, tf32, 16717361816799281152}, {tu64, tf64, 16717361816799281152}, - { tf32, tu64, 16717361816799281152 }, - { tf32, tf32, 16717361816799281152 }, { tf32, tf64, 16717361816799281152 }, + {tf32, tu64, 16717361816799281152}, + {tf32, tf32, 16717361816799281152}, {tf32, tf64, 16717361816799281152}, - { tf64, tu64, 16717361816799281152 }, - { tf64, tf32, 16717361816799281152 }, { tf64, tf64, 16717361816799281152 }, + {tf64, tu64, 16717361816799281152}, + {tf64, tf32, 16717361816799281152}, {tf64, tf64, 16717361816799281152}, } func main() { - for i:=0; i 1e-6 { println(r, "!= 1.292308") @@ -32,7 +32,7 @@ func main() { } d = i + 0.1384615 if d < 0 { - d = - d + d = -d } if d > 1e-6 { println(i, "!= -0.1384615") diff --git a/test/ken/embed.go b/test/ken/embed.go index f7ca0665e2..2e46c34590 100644 --- a/test/ken/embed.go +++ b/test/ken/embed.go @@ -8,7 +8,6 @@ package main - type I interface { test1() int test2() int diff --git a/test/ken/for.go b/test/ken/for.go index db35548db8..4c257ffcc9 100644 --- a/test/ken/for.go +++ b/test/ken/for.go @@ -8,12 +8,13 @@ package main -func -main() { - var t,i int; +func main() { + var t, i int - for i=0; i<100; i=i+1 { - t = t+i; + for i = 0; i < 100; i = i + 1 { + t = t + i + } + if t != 50*99 { + panic(t) } - if t != 50*99 { panic(t); } } diff --git a/test/ken/interfun.go b/test/ken/interfun.go index 9432181df2..47955c610f 100644 --- a/test/ken/interfun.go +++ b/test/ken/interfun.go @@ -9,51 +9,64 @@ package main type S struct { - a,b int; + a, b int } type I1 interface { - f ()int; + f() int } type I2 interface { - g() int; - f() int; + g() int + f() int } -func (this *S) f()int { - return this.a; +func (this *S) f() int { + return this.a } -func (this *S) g()int { - return this.b; +func (this *S) g() int { + return this.b } -func -main() { - var i1 I1; - var i2 I2; - var g *S; +func main() { + var i1 I1 + var i2 I2 + var g *S - s := new(S); - s.a = 5; - s.b = 6; + s := new(S) + s.a = 5 + s.b = 6 // call structure - if s.f() != 5 { panic(11); } - if s.g() != 6 { panic(12); } + if s.f() != 5 { + panic(11) + } + if s.g() != 6 { + panic(12) + } - i1 = s; // convert S to I1 - i2 = i1.(I2); // convert I1 to I2 + i1 = s // convert S to I1 + i2 = i1.(I2) // convert I1 to I2 // call interface - if i1.f() != 5 { panic(21); } - if i2.f() != 5 { panic(22); } - if i2.g() != 6 { panic(23); } + if i1.f() != 5 { + panic(21) + } + if i2.f() != 5 { + panic(22) + } + if i2.g() != 6 { + panic(23) + } - g = i1.(*S); // convert I1 to S - if g != s { panic(31); } + g = i1.(*S) // convert I1 to S + if g != s { + panic(31) + } - g = i2.(*S); // convert I2 to S - if g != s { panic(32); } + g = i2.(*S) // convert I2 to S + if g != s { + panic(32) + } } diff --git a/test/ken/intervar.go b/test/ken/intervar.go index 8a2fca0d4b..9ae98d92d8 100644 --- a/test/ken/intervar.go +++ b/test/ken/intervar.go @@ -8,60 +8,59 @@ package main -type Iputs interface { - puts (s string) string; +type Iputs interface { + puts(s string) string } // --------- -type Print struct { - whoami int; - put Iputs; +type Print struct { + whoami int + put Iputs } func (p *Print) dop() string { - r := " print " + string(p.whoami + '0') - return r + p.put.puts("abc"); + r := " print " + string(p.whoami+'0') + return r + p.put.puts("abc") } // --------- -type Bio struct { - whoami int; - put Iputs; +type Bio struct { + whoami int + put Iputs } func (b *Bio) puts(s string) string { - r := " bio " + string(b.whoami + '0') - return r + b.put.puts(s); + r := " bio " + string(b.whoami+'0') + return r + b.put.puts(s) } // --------- -type File struct { - whoami int; - put Iputs; +type File struct { + whoami int + put Iputs } func (f *File) puts(s string) string { - return " file " + string(f.whoami + '0') + " -- " + s + return " file " + string(f.whoami+'0') + " -- " + s } -func -main() { - p := new(Print); - b := new(Bio); - f := new(File); +func main() { + p := new(Print) + b := new(Bio) + f := new(File) - p.whoami = 1; - p.put = b; + p.whoami = 1 + p.put = b - b.whoami = 2; - b.put = f; + b.whoami = 2 + b.put = f - f.whoami = 3; + f.whoami = 3 - r := p.dop(); + r := p.dop() expected := " print 1 bio 2 file 3 -- abc" if r != expected { panic(r + " != " + expected) diff --git a/test/ken/litfun.go b/test/ken/litfun.go index e241d4edb7..ba19ccf305 100644 --- a/test/ken/litfun.go +++ b/test/ken/litfun.go @@ -8,16 +8,17 @@ package main -func -main() { - x := func(a int)int { - x := func(a int)int { - x := func(a int)int { - return a+5; - }; - return x(a)+7; - }; - return x(a)+11; - }; - if x(3) != 3+5+7+11 { panic(x(3)); } +func main() { + x := func(a int) int { + x := func(a int) int { + x := func(a int) int { + return a + 5 + } + return x(a) + 7 + } + return x(a) + 11 + } + if x(3) != 3+5+7+11 { + panic(x(3)) + } } diff --git a/test/ken/mfunc.go b/test/ken/mfunc.go index ef2499194f..3754bbf6a2 100644 --- a/test/ken/mfunc.go +++ b/test/ken/mfunc.go @@ -8,15 +8,15 @@ package main -func -main() { - var x,y int; +func main() { + var x, y int - x,y = simple(10,20,30); - if x+y != 65 { panic(x+y); } + x, y = simple(10, 20, 30) + if x+y != 65 { + panic(x + y) + } } -func -simple(ia,ib,ic int) (oa,ob int) { - return ia+5, ib+ic; +func simple(ia, ib, ic int) (oa, ob int) { + return ia + 5, ib + ic } diff --git a/test/ken/ptrfun.go b/test/ken/ptrfun.go index af806cfd92..2fc13a7ebb 100644 --- a/test/ken/ptrfun.go +++ b/test/ken/ptrfun.go @@ -9,37 +9,44 @@ package main type C struct { - a int; - x func(p *C)int; + a int + x func(p *C) int } -func (this *C) f()int { - return this.a; +func (this *C) f() int { + return this.a } -func -main() { - var v int; - var c *C; +func main() { + var v int + var c *C - c = new(C); - c.a = 6; - c.x = g; + c = new(C) + c.a = 6 + c.x = g - v = g(c); - if v != 6 { panic(v); } + v = g(c) + if v != 6 { + panic(v) + } - v = c.x(c); - if v != 6 { panic(v); } + v = c.x(c) + if v != 6 { + panic(v) + } - v = c.f(); - if v != 6 { panic(v); } + v = c.f() + if v != 6 { + panic(v) + } } -func g(p *C)int { - var v int; +func g(p *C) int { + var v int - v = p.a; - if v != 6 { panic(v); } - return p.a; + v = p.a + if v != 6 { + panic(v) + } + return p.a } diff --git a/test/ken/ptrvar.go b/test/ken/ptrvar.go index d78170c9d2..4d1b9eb794 100644 --- a/test/ken/ptrvar.go +++ b/test/ken/ptrvar.go @@ -8,36 +8,49 @@ package main -type x2 struct { a,b,c int; d int; }; -var g1 x2; -var g2 struct { a,b,c int; d x2; }; - -func -main() { - var x int; - var s1 *x2; - var s2 *struct { a,b,c int; d x2; }; - - s1 = &g1; - s2 = &g2; - - s1.a = 1; - s1.b = 2; - s1.c = 3; - s1.d = 5; - - s2.a = 7; - s2.b = 11; - s2.c = 13; - s2.d.a = 17; - s2.d.b = 19; - s2.d.c = 23; - s2.d.d = 20; - - if(s2.d.c != 23) { panic(1); } - if(g2.d.c != 23) { panic(2); } - - x = s1.a + +type x2 struct { + a, b, c int + d int +} + +var g1 x2 +var g2 struct { + a, b, c int + d x2 +} + +func main() { + var x int + var s1 *x2 + var s2 *struct { + a, b, c int + d x2 + } + + s1 = &g1 + s2 = &g2 + + s1.a = 1 + s1.b = 2 + s1.c = 3 + s1.d = 5 + + s2.a = 7 + s2.b = 11 + s2.c = 13 + s2.d.a = 17 + s2.d.b = 19 + s2.d.c = 23 + s2.d.d = 20 + + if s2.d.c != 23 { + panic(1) + } + if g2.d.c != 23 { + panic(2) + } + + x = s1.a + s1.b + s1.c + s1.d + @@ -48,7 +61,9 @@ main() { s2.d.a + s2.d.b + s2.d.c + - s2.d.d; + s2.d.d - if(x != 121) { panic(x); } + if x != 121 { + panic(x) + } } diff --git a/test/ken/robfor.go b/test/ken/robfor.go index c6a420b39d..3269c0714b 100644 --- a/test/ken/robfor.go +++ b/test/ken/robfor.go @@ -10,49 +10,49 @@ package main func assertequal(is, shouldbe int, msg string) { if is != shouldbe { - print("assertion fail" + msg + "\n"); - panic(1); + print("assertion fail" + msg + "\n") + panic(1) } } func main() { - var i, sum int; + var i, sum int - i = 0; + i = 0 for { - i = i + 1; + i = i + 1 if i > 5 { - break; + break } } - assertequal(i, 6, "break"); + assertequal(i, 6, "break") - sum = 0; + sum = 0 for i := 0; i <= 10; i++ { - sum = sum + i; + sum = sum + i } - assertequal(sum, 55, "all three"); + assertequal(sum, 55, "all three") - sum = 0; + sum = 0 for i := 0; i <= 10; { - sum = sum + i; - i++; + sum = sum + i + i++ } - assertequal(sum, 55, "only two"); + assertequal(sum, 55, "only two") - sum = 0; + sum = 0 for sum < 100 { - sum = sum + 9; + sum = sum + 9 } - assertequal(sum, 99 + 9, "only one"); + assertequal(sum, 99+9, "only one") - sum = 0; + sum = 0 for i := 0; i <= 10; i++ { - if i % 2 == 0 { - continue; + if i%2 == 0 { + continue } - sum = sum + i; + sum = sum + i } - assertequal(sum, 1+3+5+7+9, "continue"); + assertequal(sum, 1+3+5+7+9, "continue") } diff --git a/test/ken/robfunc.go b/test/ken/robfunc.go index 885267e30c..6a417c073f 100644 --- a/test/ken/robfunc.go +++ b/test/ken/robfunc.go @@ -41,7 +41,6 @@ func f7(a int) (x int, y float64) { return 7, 7.0 } - func f8(a int) (x int, y float64) { return 8, 8.0 } @@ -54,14 +53,12 @@ func (t *T) m10(a int, b float64) int { return (t.x + a) * (t.y + int(b)) } - func f9(a int) (in int, fl float64) { i := 9 f := float64(9) return i, f } - func main() { f1() f2(1) diff --git a/test/ken/shift.go b/test/ken/shift.go index af8789615e..895e7e90aa 100644 --- a/test/ken/shift.go +++ b/test/ken/shift.go @@ -8,114 +8,122 @@ package main -var ians [18]int; -var uans [18]uint; -var pass string; +var ians [18]int +var uans [18]uint +var pass string -func -testi(i int, t1,t2,t3 int) { - n := ((t1*3) + t2)*2 + t3; +func testi(i int, t1, t2, t3 int) { + n := ((t1*3)+t2)*2 + t3 if i != ians[n] { - print("itest ", t1,t2,t3,pass, - " is ", i, " sb ", ians[n], "\n"); + print("itest ", t1, t2, t3, pass, + " is ", i, " sb ", ians[n], "\n") } } -func -index(t1,t2,t3 int) int { - return ((t1*3) + t2)*2 + t3; +func index(t1, t2, t3 int) int { + return ((t1*3)+t2)*2 + t3 } -func -testu(u uint, t1,t2,t3 int) { - n := index(t1,t2,t3); +func testu(u uint, t1, t2, t3 int) { + n := index(t1, t2, t3) if u != uans[n] { - print("utest ", t1,t2,t3,pass, - " is ", u, " sb ", uans[n], "\n"); + print("utest ", t1, t2, t3, pass, + " is ", u, " sb ", uans[n], "\n") } } -func -main() { - var i int; - var u,c uint; +func main() { + var i int + var u, c uint /* * test constant evaluations */ - pass = "con"; // constant part + pass = "con" // constant part - testi( int(1234) << 0, 0,0,0); - testi( int(1234) >> 0, 0,0,1); - testi( int(1234) << 5, 0,1,0); - testi( int(1234) >> 5, 0,1,1); + testi(int(1234)<<0, 0, 0, 0) + testi(int(1234)>>0, 0, 0, 1) + testi(int(1234)<<5, 0, 1, 0) + testi(int(1234)>>5, 0, 1, 1) - testi(int(-1234) << 0, 1,0,0); - testi(int(-1234) >> 0, 1,0,1); - testi(int(-1234) << 5, 1,1,0); - testi(int(-1234) >> 5, 1,1,1); + testi(int(-1234)<<0, 1, 0, 0) + testi(int(-1234)>>0, 1, 0, 1) + testi(int(-1234)<<5, 1, 1, 0) + testi(int(-1234)>>5, 1, 1, 1) - testu(uint(5678) << 0, 2,0,0); - testu(uint(5678) >> 0, 2,0,1); - testu(uint(5678) << 5, 2,1,0); - testu(uint(5678) >> 5, 2,1,1); + testu(uint(5678)<<0, 2, 0, 0) + testu(uint(5678)>>0, 2, 0, 1) + testu(uint(5678)<<5, 2, 1, 0) + testu(uint(5678)>>5, 2, 1, 1) /* * test variable evaluations */ - pass = "var"; // variable part - - for t1:=0; t1<3; t1++ { // +int, -int, uint - for t2:=0; t2<3; t2++ { // 0, +small, +large - for t3:=0; t3<2; t3++ { // <<, >> - switch t1 { - case 0: i = 1234; - case 1: i = -1234; - case 2: u = 5678; + pass = "var" // variable part + + for t1 := 0; t1 < 3; t1++ { // +int, -int, uint + for t2 := 0; t2 < 3; t2++ { // 0, +small, +large + for t3 := 0; t3 < 2; t3++ { // <<, >> + switch t1 { + case 0: + i = 1234 + case 1: + i = -1234 + case 2: + u = 5678 + } + switch t2 { + case 0: + c = 0 + case 1: + c = 5 + case 2: + c = 1025 + } + switch t3 { + case 0: + i <<= c + u <<= c + case 1: + i >>= c + u >>= c + } + switch t1 { + case 0: + testi(i, t1, t2, t3) + case 1: + testi(i, t1, t2, t3) + case 2: + testu(u, t1, t2, t3) + } + } } - switch t2 { - case 0: c = 0; - case 1: c = 5; - case 2: c = 1025; - } - switch t3 { - case 0: i <<= c; u <<= c; - case 1: i >>= c; u >>= c; - } - switch t1 { - case 0: testi(i,t1,t2,t3); - case 1: testi(i,t1,t2,t3); - case 2: testu(u,t1,t2,t3); - } - } - } } } -func -init() { +func init() { /* * set the 'correct' answer */ - ians[index(0,0,0)] = 1234; - ians[index(0,0,1)] = 1234; - ians[index(0,1,0)] = 39488; - ians[index(0,1,1)] = 38; - ians[index(0,2,0)] = 0; - ians[index(0,2,1)] = 0; - - ians[index(1,0,0)] = -1234; - ians[index(1,0,1)] = -1234; - ians[index(1,1,0)] = -39488; - ians[index(1,1,1)] = -39; - ians[index(1,2,0)] = 0; - ians[index(1,2,1)] = -1; - - uans[index(2,0,0)] = 5678; - uans[index(2,0,1)] = 5678; - uans[index(2,1,0)] = 181696; - uans[index(2,1,1)] = 177; - uans[index(2,2,0)] = 0; - uans[index(2,2,1)] = 0; + ians[index(0, 0, 0)] = 1234 + ians[index(0, 0, 1)] = 1234 + ians[index(0, 1, 0)] = 39488 + ians[index(0, 1, 1)] = 38 + ians[index(0, 2, 0)] = 0 + ians[index(0, 2, 1)] = 0 + + ians[index(1, 0, 0)] = -1234 + ians[index(1, 0, 1)] = -1234 + ians[index(1, 1, 0)] = -39488 + ians[index(1, 1, 1)] = -39 + ians[index(1, 2, 0)] = 0 + ians[index(1, 2, 1)] = -1 + + uans[index(2, 0, 0)] = 5678 + uans[index(2, 0, 1)] = 5678 + uans[index(2, 1, 0)] = 181696 + uans[index(2, 1, 1)] = 177 + uans[index(2, 2, 0)] = 0 + uans[index(2, 2, 1)] = 0 } diff --git a/test/ken/simparray.go b/test/ken/simparray.go index 0e81a341b8..51bbeaae83 100644 --- a/test/ken/simparray.go +++ b/test/ken/simparray.go @@ -8,43 +8,48 @@ package main -var b[10] float32; +var b [10]float32 -func -main() { - var a[10] float32; +func main() { + var a [10]float32 - for i:=int16(5); i<10; i=i+1 { - a[i] = float32(i); + for i := int16(5); i < 10; i = i + 1 { + a[i] = float32(i) } - s1 := float32(0); - for i:=5; i<10; i=i+1 { - s1 = s1 + a[i]; + s1 := float32(0) + for i := 5; i < 10; i = i + 1 { + s1 = s1 + a[i] } - if s1 != 35 { panic(s1); } + if s1 != 35 { + panic(s1) + } - for i:=int16(5); i<10; i=i+1 { - b[i] = float32(i); + for i := int16(5); i < 10; i = i + 1 { + b[i] = float32(i) } - s2 := float32(0); - for i:=5; i<10; i=i+1 { - s2 = s2 + b[i]; + s2 := float32(0) + for i := 5; i < 10; i = i + 1 { + s2 = s2 + b[i] } - if s2 != 35 { panic(s2); } + if s2 != 35 { + panic(s2) + } - b := new([100]int); - for i:=0; i<100; i=i+1 { - b[i] = i; + b := new([100]int) + for i := 0; i < 100; i = i + 1 { + b[i] = i } - s3 := 0; - for i:=0; i<100; i=i+1 { - s3 = s3+b[i]; + s3 := 0 + for i := 0; i < 100; i = i + 1 { + s3 = s3 + b[i] } - if s3 != 4950 { panic(s3); } + if s3 != 4950 { + panic(s3) + } } diff --git a/test/ken/simpbool.go b/test/ken/simpbool.go index ab2ecc21aa..25c10cfcfe 100644 --- a/test/ken/simpbool.go +++ b/test/ken/simpbool.go @@ -9,99 +9,186 @@ package main type s struct { - a bool; - b bool; + a bool + b bool } -func -main() { - var a,b bool; - - a = true; - b = false; - - if !a { panic(1); } - if b { panic(2); } - if !!!a { panic(3); } - if !!b { panic(4); } - - a = !b; - if !a { panic(5); } - if !!!a { panic(6); } - - var x *s; - x = new(s); - x.a = true; - x.b = false; - - if !x.a { panic(7); } - if x.b { panic(8); } - if !!!x.a { panic(9); } - if !!x.b { panic(10); } - - x.a = !x.b; - if !x.a { panic(11); } - if !!!x.a { panic(12); } +func main() { + var a, b bool + + a = true + b = false + + if !a { + panic(1) + } + if b { + panic(2) + } + if !!!a { + panic(3) + } + if !!b { + panic(4) + } + + a = !b + if !a { + panic(5) + } + if !!!a { + panic(6) + } + + var x *s + x = new(s) + x.a = true + x.b = false + + if !x.a { + panic(7) + } + if x.b { + panic(8) + } + if !!!x.a { + panic(9) + } + if !!x.b { + panic(10) + } + + x.a = !x.b + if !x.a { + panic(11) + } + if !!!x.a { + panic(12) + } /* * test && */ - a = true; - b = true; - if !(a && b) { panic(21); } - if a && !b { panic(22); } - if !a && b { panic(23); } - if !a && !b { panic(24); } - - a = false; - b = true; - if !(!a && b) { panic(31); } - if !a && !b { panic(32); } - if a && b { panic(33); } - if a && !b { panic(34); } - - a = true; - b = false; - if !(a && !b) { panic(41); } - if a && b { panic(41); } - if !a && !b { panic(41); } - if !a && b { panic(44); } - - a = false; - b = false; - if !(!a && !b) { panic(51); } - if !a && b { panic(52); } - if a && !b { panic(53); } - if a && b { panic(54); } + a = true + b = true + if !(a && b) { + panic(21) + } + if a && !b { + panic(22) + } + if !a && b { + panic(23) + } + if !a && !b { + panic(24) + } + + a = false + b = true + if !(!a && b) { + panic(31) + } + if !a && !b { + panic(32) + } + if a && b { + panic(33) + } + if a && !b { + panic(34) + } + + a = true + b = false + if !(a && !b) { + panic(41) + } + if a && b { + panic(41) + } + if !a && !b { + panic(41) + } + if !a && b { + panic(44) + } + + a = false + b = false + if !(!a && !b) { + panic(51) + } + if !a && b { + panic(52) + } + if a && !b { + panic(53) + } + if a && b { + panic(54) + } /* * test || */ - a = true; - b = true; - if !(a || b) { panic(61); } - if !(a || !b) { panic(62); } - if !(!a || b) { panic(63); } - if !a || !b { panic(64); } - - a = false; - b = true; - if !(!a || b) { panic(71); } - if !(!a || !b) { panic(72); } - if !(a || b) { panic(73); } - if a || !b { panic(74); } - - a = true; - b = false; - if !(a || !b) { panic(81); } - if !(a || b) { panic(82); } - if !(!a || !b) { panic(83); } - if !a || b { panic(84); } - - a = false; - b = false; - if !(!a || !b) { panic(91); } - if !(!a || b) { panic(92); } - if !(a || !b) { panic(93); } - if a || b { panic(94); } + a = true + b = true + if !(a || b) { + panic(61) + } + if !(a || !b) { + panic(62) + } + if !(!a || b) { + panic(63) + } + if !a || !b { + panic(64) + } + + a = false + b = true + if !(!a || b) { + panic(71) + } + if !(!a || !b) { + panic(72) + } + if !(a || b) { + panic(73) + } + if a || !b { + panic(74) + } + + a = true + b = false + if !(a || !b) { + panic(81) + } + if !(a || b) { + panic(82) + } + if !(!a || !b) { + panic(83) + } + if !a || b { + panic(84) + } + + a = false + b = false + if !(!a || !b) { + panic(91) + } + if !(!a || b) { + panic(92) + } + if !(a || !b) { + panic(93) + } + if a || b { + panic(94) + } } diff --git a/test/ken/simpfun.go b/test/ken/simpfun.go index e5dc2b2495..1d5534b9fa 100644 --- a/test/ken/simpfun.go +++ b/test/ken/simpfun.go @@ -8,19 +8,21 @@ package main -func -main() { - var x int; +func main() { + var x int - x = fun(10,20,30); - if x != 60 { panic(x); } + x = fun(10, 20, 30) + if x != 60 { + panic(x) + } } -func -fun(ia,ib,ic int)int { - var o int; +func fun(ia, ib, ic int) int { + var o int - o = ia+ib+ic; - if o != 60 { panic(o); } - return o; + o = ia + ib + ic + if o != 60 { + panic(o) + } + return o } diff --git a/test/ken/simpvar.go b/test/ken/simpvar.go index c6eefbb5ad..039d32c94e 100644 --- a/test/ken/simpvar.go +++ b/test/ken/simpvar.go @@ -6,22 +6,22 @@ // Test scoping of variables. - package main -var x,y int; +var x, y int -func -main() { +func main() { - x = 15; - y = 20; + x = 15 + y = 20 { - var x int; - x = 25; - y = 25; - _ = x; + var x int + x = 25 + y = 25 + _ = x + } + x = x + y + if x != 40 { + panic(x) } - x = x+y; - if(x != 40) { panic(x); } } diff --git a/test/ken/strvar.go b/test/ken/strvar.go index 4d511fe673..826d796e01 100644 --- a/test/ken/strvar.go +++ b/test/ken/strvar.go @@ -8,40 +8,60 @@ package main -type x2 struct { a,b,c int; d int; }; -var g1 x2; -var g2 struct { a,b,c int; d x2; }; - -func -main() { - var x int; - var s1 *x2; - var s2 *struct { a,b,c int; d x2; }; - var s3 struct { a,b,c int; d x2; }; - - s1 = &g1; - s2 = &g2; - - s1.a = 1; - s1.b = 2; - s1.c = 3; - s1.d = 5; - - if(s1.c != 3) { panic(s1.c); } - if(g1.c != 3) { panic(g1.c); } - - s2.a = 7; - s2.b = 11; - s2.c = 13; - s2.d.a = 17; - s2.d.b = 19; - s2.d.c = 23; - s2.d.d = 29; - - if(s2.d.c != 23) { panic(s2.d.c); } - if(g2.d.c != 23) { panic(g2.d.c); } - - x = s1.a + +type x2 struct { + a, b, c int + d int +} + +var g1 x2 +var g2 struct { + a, b, c int + d x2 +} + +func main() { + var x int + var s1 *x2 + var s2 *struct { + a, b, c int + d x2 + } + var s3 struct { + a, b, c int + d x2 + } + + s1 = &g1 + s2 = &g2 + + s1.a = 1 + s1.b = 2 + s1.c = 3 + s1.d = 5 + + if s1.c != 3 { + panic(s1.c) + } + if g1.c != 3 { + panic(g1.c) + } + + s2.a = 7 + s2.b = 11 + s2.c = 13 + s2.d.a = 17 + s2.d.b = 19 + s2.d.c = 23 + s2.d.d = 29 + + if s2.d.c != 23 { + panic(s2.d.c) + } + if g2.d.c != 23 { + panic(g2.d.c) + } + + x = s1.a + s1.b + s1.c + s1.d + @@ -52,28 +72,34 @@ main() { s2.d.a + s2.d.b + s2.d.c + - s2.d.d; + s2.d.d - if(x != 130) { panic(x); } + if x != 130 { + panic(x) + } // test an automatic struct - s3.a = 7; - s3.b = 11; - s3.c = 13; - s3.d.a = 17; - s3.d.b = 19; - s3.d.c = 23; - s3.d.d = 29; - - if(s3.d.c != 23) { panic(s3.d.c); } - - x = s3.a + + s3.a = 7 + s3.b = 11 + s3.c = 13 + s3.d.a = 17 + s3.d.b = 19 + s3.d.c = 23 + s3.d.d = 29 + + if s3.d.c != 23 { + panic(s3.d.c) + } + + x = s3.a + s3.b + s3.c + s3.d.a + s3.d.b + s3.d.c + - s3.d.d; + s3.d.d - if(x != 119) { panic(x); } + if x != 119 { + panic(x) + } } diff --git a/test/literal2.go b/test/literal2.go index f552e33ada..064d47f726 100644 --- a/test/literal2.go +++ b/test/literal2.go @@ -31,8 +31,8 @@ func main() { assert(0_1 == 01) assert(012 == 012) assert(0_1_2 == 012) - assert(0_1_2i == complex(0, 12)) // decimal digits despite leading 0 for backward-compatibility - assert(00089i == complex(0, 89)) // decimal digits despite leading 0 for backward-compatibility + assert(1_2i == complex(0, 12)) // decimal digits despite leading 0 for backward-compatibility + assert(89i == complex(0, 89)) // decimal digits despite leading 0 for backward-compatibility // decimals assert(1_000_000 == 1000000) diff --git a/test/live1.go b/test/live1.go index 87c8c97c41..3d37b9ec53 100644 --- a/test/live1.go +++ b/test/live1.go @@ -43,4 +43,3 @@ func f1(pkg, typ, meth string) { func f2() interface{} { return new(int) } - diff --git a/test/live_syscall.go b/test/live_syscall.go index 2d1ef14de7..1f9a2c2668 100644 --- a/test/live_syscall.go +++ b/test/live_syscall.go @@ -30,7 +30,7 @@ func h() { // ERROR "can inline h" func i() { // ERROR "can inline i" var t int p := unsafe.Pointer(&t) - f(uintptr(p)) // ERROR "live at call to f: .?autotmp" "stack object .autotmp_[0-9]+ unsafe.Pointer$" + f(uintptr(p)) // ERROR "live at call to f: .?autotmp" "stack object .autotmp_[0-9]+ unsafe.Pointer$" } func j() { // ERROR "can inline j" diff --git a/test/map1.go b/test/map1.go index 498c2ec45b..91589a7c48 100644 --- a/test/map1.go +++ b/test/map1.go @@ -39,10 +39,10 @@ var ( _ map[[]int]v // ERROR "invalid map key" _ map[func()]v // ERROR "invalid map key" _ map[map[int]int]v // ERROR "invalid map key" - _ map[T1]v // ERROR "invalid map key" - _ map[T2]v // ERROR "invalid map key" - _ map[T3]v // ERROR "invalid map key" - _ map[T4]v // ERROR "invalid map key" + _ map[T1]v // ERROR "invalid map key" + _ map[T2]v // ERROR "invalid map key" + _ map[T3]v // ERROR "invalid map key" + _ map[T4]v // ERROR "invalid map key" _ map[T5]v _ map[T6]v _ map[T7]v @@ -50,14 +50,14 @@ var ( ) type T1 []int -type T2 struct { F T1 } +type T2 struct{ F T1 } type T3 []T4 -type T4 struct { F T3 } +type T4 struct{ F T3 } type T5 *int -type T6 struct { F T5 } +type T6 struct{ F T5 } type T7 *T4 -type T8 struct { F *T7 } +type T8 struct{ F *T7 } func main() { m := make(map[int]int) @@ -65,4 +65,4 @@ func main() { delete(m) // ERROR "missing second \(key\) argument" delete(m, 2, 3) // ERROR "too many arguments" delete(1, m) // ERROR "first argument to delete must be map" -} \ No newline at end of file +} diff --git a/test/method5.go b/test/method5.go index d87bb6f5b2..e48baf4ccc 100644 --- a/test/method5.go +++ b/test/method5.go @@ -16,53 +16,53 @@ type Tinter interface { type Tsmallv byte -func (v Tsmallv) M(x int, b byte) (byte, int) { return b, x+int(v) } +func (v Tsmallv) M(x int, b byte) (byte, int) { return b, x + int(v) } type Tsmallp byte -func (p *Tsmallp) M(x int, b byte) (byte, int) { return b, x+int(*p) } +func (p *Tsmallp) M(x int, b byte) (byte, int) { return b, x + int(*p) } type Twordv uintptr -func (v Twordv) M(x int, b byte) (byte, int) { return b, x+int(v) } +func (v Twordv) M(x int, b byte) (byte, int) { return b, x + int(v) } type Twordp uintptr -func (p *Twordp) M(x int, b byte) (byte, int) { return b, x+int(*p) } +func (p *Twordp) M(x int, b byte) (byte, int) { return b, x + int(*p) } type Tbigv [2]uintptr -func (v Tbigv) M(x int, b byte) (byte, int) { return b, x+int(v[0])+int(v[1]) } +func (v Tbigv) M(x int, b byte) (byte, int) { return b, x + int(v[0]) + int(v[1]) } type Tbigp [2]uintptr -func (p *Tbigp) M(x int, b byte) (byte, int) { return b, x+int(p[0])+int(p[1]) } +func (p *Tbigp) M(x int, b byte) (byte, int) { return b, x + int(p[0]) + int(p[1]) } // Again, with an unexported method. type tsmallv byte -func (v tsmallv) m(x int, b byte) (byte, int) { return b, x+int(v) } +func (v tsmallv) m(x int, b byte) (byte, int) { return b, x + int(v) } type tsmallp byte -func (p *tsmallp) m(x int, b byte) (byte, int) { return b, x+int(*p) } +func (p *tsmallp) m(x int, b byte) (byte, int) { return b, x + int(*p) } type twordv uintptr -func (v twordv) m(x int, b byte) (byte, int) { return b, x+int(v) } +func (v twordv) m(x int, b byte) (byte, int) { return b, x + int(v) } type twordp uintptr -func (p *twordp) m(x int, b byte) (byte, int) { return b, x+int(*p) } +func (p *twordp) m(x int, b byte) (byte, int) { return b, x + int(*p) } type tbigv [2]uintptr -func (v tbigv) m(x int, b byte) (byte, int) { return b, x+int(v[0])+int(v[1]) } +func (v tbigv) m(x int, b byte) (byte, int) { return b, x + int(v[0]) + int(v[1]) } type tbigp [2]uintptr -func (p *tbigp) m(x int, b byte) (byte, int) { return b, x+int(p[0])+int(p[1]) } +func (p *tbigp) m(x int, b byte) (byte, int) { return b, x + int(p[0]) + int(p[1]) } type tinter interface { m(int, byte) (byte, int) @@ -85,7 +85,7 @@ type T3 struct { type T4 struct { } -func (t4 T4) M(x int, b byte) (byte, int) { return b, x+40 } +func (t4 T4) M(x int, b byte) (byte, int) { return b, x + 40 } var failed = false @@ -95,7 +95,7 @@ func CheckI(name string, i Tinter, inc int) { failed = true print(name, ".M(1000, 99) = ", b, ", ", x, " want 99, ", 1000+inc, "\n") } - + CheckF("(i="+name+")", i.M, inc) } @@ -113,7 +113,7 @@ func checkI(name string, i tinter, inc int) { failed = true print(name, ".m(1000, 99) = ", b, ", ", x, " want 99, ", 1000+inc, "\n") } - + checkF("(i="+name+")", i.m, inc) } @@ -183,8 +183,8 @@ func main() { CheckI("pbv", pbv, 11) CheckF("pbv.M", pbv.M, 11) CheckF("(*pbv).M", (*pbv).M, 11) - - bp := Tbigp([2]uintptr{7,8}) + + bp := Tbigp([2]uintptr{7, 8}) CheckI("&bp", &bp, 15) CheckF("bp.M", bp.M, 15) CheckF("(&bp).M", (&bp).M, 15) @@ -237,8 +237,8 @@ func main() { checkI("_pbv", _pbv, 11) checkF("_pbv.m", _pbv.m, 11) checkF("(*_pbv).m", (*_pbv).m, 11) - - _bp := tbigp([2]uintptr{7,8}) + + _bp := tbigp([2]uintptr{7, 8}) checkI("&_bp", &_bp, 15) checkF("_bp.m", _bp.m, 15) checkF("(&_bp).m", (&_bp).m, 15) @@ -246,7 +246,7 @@ func main() { checkI("_pbp", _pbp, 15) checkF("_pbp.m", _pbp.m, 15) checkF("(*_pbp).m", (*_pbp).m, 15) - + t4 := T4{} t3 := T3{&t4} t2 := T2{&t3} @@ -259,7 +259,7 @@ func main() { CheckI("&t2", &t2, 40) CheckI("t1", t1, 40) CheckI("&t1", &t1, 40) - + // x.M panics if x is an interface type and is nil, // or if x.M expands to (*x).M where x is nil, // or if x.M expands to x.y.z.w.M where something @@ -281,7 +281,7 @@ func main() { if f != nil { panic("something set f") } - + // x.M does not panic if x is a nil pointer and // M is a method with a pointer receiver. shouldNotPanic(func() { psp = nil; f = psp.M }) diff --git a/test/named.go b/test/named.go index 9763c76bfd..60a88c542b 100644 --- a/test/named.go +++ b/test/named.go @@ -31,7 +31,6 @@ func asString(String) {} func (Map) M() {} - // These functions check at run time that the default type // (in the absence of any implicit conversion hints) // is the given type. diff --git a/test/nilptr2.go b/test/nilptr2.go index 8a85b6dbcb..8e3be659bb 100644 --- a/test/nilptr2.go +++ b/test/nilptr2.go @@ -27,7 +27,7 @@ func main() { var intp *int var slicep *[]byte var a10p *[10]int -var a10Mp *[1<<20]int +var a10Mp *[1 << 20]int var structp *Struct var bigstructp *BigStruct var i int @@ -41,9 +41,9 @@ func use(x interface{}) { V = x } -var tests = []struct{ +var tests = []struct { name string - fn func() + fn func() }{ // Edit .+1,/^}/s/^[^ ].+/ {"&", func() { println(&) }},\n {"\&&", func() { println(\&&) }},/g {"*intp", func() { println(*intp) }}, @@ -112,14 +112,14 @@ type BigStruct struct { i int j float64 k string - x [128<<20]byte + x [128 << 20]byte l []byte } type M struct { } -func (m *M) F() int {return 0} +func (m *M) F() int { return 0 } type M1 struct { M diff --git a/test/oldescape2.go b/test/oldescape2.go index 864a956164..fc686cb921 100644 --- a/test/oldescape2.go +++ b/test/oldescape2.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1535,7 +1535,7 @@ func NewV(u U) *V { // ERROR "leaking param: u to result ~r1 level=-1" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1643,7 +1643,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/oldescape2n.go b/test/oldescape2n.go index fb2a956618..a9edec5f92 100644 --- a/test/oldescape2n.go +++ b/test/oldescape2n.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1535,7 +1535,7 @@ func NewV(u U) *V { // ERROR "leaking param: u to result ~r1 level=-1" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1643,7 +1643,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/oldescape5.go b/test/oldescape5.go index 53d0ff801d..972b9ed8a8 100644 --- a/test/oldescape5.go +++ b/test/oldescape5.go @@ -71,13 +71,13 @@ func f2() { } func f3() { - var x int // ERROR "moved to heap: x" + var x int // ERROR "moved to heap: x" p := leaktoret(&x) gp = p } func f4() { - var x int // ERROR "moved to heap: x" + var x int // ERROR "moved to heap: x" p, q := leaktoret2(&x) gp = p gp = q @@ -89,7 +89,7 @@ func f5() { } func f6() { - var x int // ERROR "moved to heap: x" + var x int // ERROR "moved to heap: x" px1, px2 := leaktoret22(leaktoret2(&x)) gp = px1 _ = px2 diff --git a/test/oldescape_field.go b/test/oldescape_field.go index e4213aaf59..09f1ea7758 100644 --- a/test/oldescape_field.go +++ b/test/oldescape_field.go @@ -39,7 +39,7 @@ func field3() { i := 0 // ERROR "moved to heap: i$" var x X x.p1 = &i - sink = x // ERROR "x escapes to heap" + sink = x // ERROR "x escapes to heap" } func field4() { @@ -113,16 +113,16 @@ func field10() { } func field11() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x := X{p1: &i} - sink = x.p1 // ERROR "x\.p1 escapes to heap" + sink = x.p1 // ERROR "x\.p1 escapes to heap" } func field12() { i := 0 // ERROR "moved to heap: i$" // BAD: &i should not escape x := X{p1: &i} - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 // ERROR "x\.p2 escapes to heap" } func field13() { diff --git a/test/oldescape_iface.go b/test/oldescape_iface.go index 88502df99b..ca5aa1187f 100644 --- a/test/oldescape_iface.go +++ b/test/oldescape_iface.go @@ -37,7 +37,7 @@ func efaceEscape0() { _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" sink = x // ERROR "x escapes to heap" @@ -50,7 +50,7 @@ func efaceEscape0() { _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" @@ -58,14 +58,14 @@ func efaceEscape0() { sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" mescapes(x) @@ -91,24 +91,24 @@ func efaceEscape1() { { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" - sink = x // ERROR "x escapes to heap" + var x M = v // ERROR "v escapes to heap" + sink = x // ERROR "x escapes to heap" } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" v1 := x.(M1) _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" @@ -116,22 +116,22 @@ func efaceEscape1() { sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" + var x M = v // ERROR "v escapes to heap" mescapes(x) } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" mdoesnotescape(x) } } @@ -245,7 +245,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = i // ERROR "i does not escape" var y interface{} = j // ERROR "j does not escape" - sink = x.(int) // ERROR "x.\(int\) escapes to heap" + sink = x.(int) // ERROR "x.\(int\) escapes to heap" sink, *(&ok) = y.(int) } { @@ -255,7 +255,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = &i // ERROR "&i escapes to heap" var y interface{} = &j // ERROR "&j escapes to heap" - sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" + sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" sink, *(&ok) = y.(*int) } } diff --git a/test/oldescape_param.go b/test/oldescape_param.go index 3a3eee2a5b..cf85d745cb 100644 --- a/test/oldescape_param.go +++ b/test/oldescape_param.go @@ -57,7 +57,7 @@ func caller2b() { i := 0 // ERROR "moved to heap: i$" var p *int param2(&i, &p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } func paramArraySelfAssign(p *PairOfPairs) { // ERROR "p does not escape" @@ -150,11 +150,11 @@ func caller3a() { } func caller3b() { - i := 0 // ERROR "moved to heap: i$" - j := 0 // ERROR "moved to heap: j$" + i := 0 // ERROR "moved to heap: i$" + j := 0 // ERROR "moved to heap: j$" p := Pair{&i, &j} param3(&p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> rcvr @@ -173,7 +173,7 @@ func caller4b() { i := 0 // ERROR "moved to heap: i$" p := Pair{} p.param4(&i) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> heap @@ -182,7 +182,7 @@ func param5(i *int) { // ERROR "leaking param: i$" } func caller5() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" param5(&i) } @@ -192,8 +192,8 @@ func param6(i ***int) { // ERROR "leaking param content: i$" } func caller6a() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param6(&p2) } @@ -204,8 +204,8 @@ func param7(i ***int) { // ERROR "leaking param content: i$" } func caller7() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param7(&p2) } @@ -234,8 +234,8 @@ func caller9a() { } func caller9b() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p sink = param9(&p2) // ERROR "param9\(&p2\) escapes to heap" } @@ -253,7 +253,7 @@ func caller10a() { } func caller10b() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" p := &i p2 := &p sink = param10(&p2) // ERROR "param10\(&p2\) escapes to heap" @@ -265,8 +265,8 @@ func param11(i **int) ***int { // ERROR "moved to heap: i$" } func caller11a() { - i := 0 // ERROR "moved to heap: i" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i" + p := &i // ERROR "moved to heap: p" _ = param11(&p) } @@ -283,8 +283,8 @@ func caller11c() { // GOOD } func caller11d() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p" p2 := &p sink = param11(p2) // ERROR "param11\(p2\) escapes to heap" } @@ -319,7 +319,7 @@ func caller12c() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = r // ERROR "r escapes to heap$" + sink = r // ERROR "r escapes to heap$" } func caller12d() { @@ -327,7 +327,7 @@ func caller12d() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" + sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" } // in -> value rcvr @@ -370,15 +370,15 @@ func caller13d() { var v Val v.p = &p v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13e() { - i := 0 // ERROR "moved to heap: i$" - var p *int // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + var p *int // ERROR "moved to heap: p$" v := Val{&p} v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13f() { @@ -386,7 +386,7 @@ func caller13f() { var p *int // ERROR "moved to heap: p$" v := &Val{&p} // ERROR "&Val literal escapes to heap$" v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13g() { @@ -394,7 +394,7 @@ func caller13g() { var p *int v := Val{&p} v.param13(&i) - sink = *v.p // ERROR "\*v\.p escapes to heap" + sink = *v.p // ERROR "\*v\.p escapes to heap" } func caller13h() { @@ -402,7 +402,7 @@ func caller13h() { var p *int v := &Val{&p} // ERROR "caller13h &Val literal does not escape$" v.param13(&i) - sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" + sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" } type Node struct { diff --git a/test/parentype.go b/test/parentype.go index eafa076481..d7881129c5 100644 --- a/test/parentype.go +++ b/test/parentype.go @@ -11,9 +11,9 @@ package main func f(interface{}) func g() {} func main() { - f(map[string]string{"a":"b","c":"d"}) - f([...]int{1,2,3}) - f(map[string]func(){"a":g,"c":g}) - f(make(chan(<-chan int))) - f(make(chan<-(chan int))) + f(map[string]string{"a": "b", "c": "d"}) + f([...]int{1, 2, 3}) + f(map[string]func(){"a": g, "c": g}) + f(make(chan (<-chan int))) + f(make(chan<- (chan int))) } diff --git a/test/pmu/test1.go b/test/pmu/test1.go index 2cde966075..c28c4cbd7d 100644 --- a/test/pmu/test1.go +++ b/test/pmu/test1.go @@ -162,6 +162,7 @@ func run() error { var cycle pprof.PMUEventConfig cycle.Period = 10000000 + cycle.PreciseIP = 2 if err := pprof.StartPMUProfile(pprof.WithProfilingPMUCycles(cycleFile, &cycle)); err != nil { return err diff --git a/test/pmu/test2.go b/test/pmu/test2.go index 660e16313e..3d138bbeff 100644 --- a/test/pmu/test2.go +++ b/test/pmu/test2.go @@ -25,9 +25,6 @@ func f1() { sum *= i sum /= i/3 + 1 sum -= i / 4 - /*if i % 100 == 0 { - time.Sleep(time.Nanosecond) - }*/ } fmt.Println(sum) @@ -42,9 +39,6 @@ func f2() { sum *= i sum /= i/3 + 1 sum -= i / 4 - /*if i % 100 == 0 { - time.Sleep(time.Nanosecond) - }*/ } fmt.Println(sum) @@ -59,9 +53,6 @@ func f3() { sum *= i sum /= i/3 + 1 sum -= i / 4 - /*if i % 100 == 0 { - time.Sleep(time.Nanosecond) - }*/ } fmt.Println(sum) @@ -76,9 +67,6 @@ func f4() { sum *= i sum /= i/3 + 1 sum -= i / 4 - /*if i % 100 == 0 { - time.Sleep(time.Nanosecond) - }*/ } fmt.Println(sum) diff --git a/test/pmu/test4.go b/test/pmu/test4.go index 21b72160bc..b2d33b0eab 100644 --- a/test/pmu/test4.go +++ b/test/pmu/test4.go @@ -161,7 +161,7 @@ func run() error { defer rawFile.Close() var raw pprof.PMUEventConfig - raw.RawEvent = /* UOPS_ISSUED */ 0x53010e + raw.RawEvent = 0x53010e /* UOPS_ISSUED */ raw.Period = 1000000 if err := pprof.StartPMUProfile(pprof.WithProfilingPMURaw(rawFile, &raw)); err != nil { diff --git a/test/printbig.go b/test/printbig.go index 9e08c39adc..a4af1fc9e1 100644 --- a/test/printbig.go +++ b/test/printbig.go @@ -9,6 +9,6 @@ package main func main() { - print(-(1<<63), "\n") + print(-(1 << 63), "\n") print((1<<63)-1, "\n") } diff --git a/test/recover1.go b/test/recover1.go index c14a607c6b..7e7c2c5968 100644 --- a/test/recover1.go +++ b/test/recover1.go @@ -22,21 +22,21 @@ func main() { } func die() { - runtime.Breakpoint() // can't depend on panic + runtime.Breakpoint() // can't depend on panic } func mustRecover(x interface{}) { - mustNotRecover() // because it's not a defer call + mustNotRecover() // because it's not a defer call v := recover() if v == nil { println("missing recover") - die() // panic is useless here + die() // panic is useless here } if v != x { println("wrong value", v, x) die() } - + // the value should be gone now regardless v = recover() if v != nil { @@ -54,7 +54,7 @@ func mustNotRecover() { } func withoutRecover() { - mustNotRecover() // because it's a sub-call + mustNotRecover() // because it's a sub-call } func test1() { @@ -116,7 +116,7 @@ func test6() { // Like test3, but changed recover to defer (same change as test4 → test5). defer mustNotRecover() defer func() { - defer recover() // like a normal call from this func; runs because mustRecover stops the panic + defer recover() // like a normal call from this func; runs because mustRecover stops the panic defer mustRecover(3) panic(3) }() @@ -134,7 +134,7 @@ func test7() { defer mustRecover(2) defer func() { defer mustRecover(3) - defer recover() // now a no-op, unlike in test6. + defer recover() // now a no-op, unlike in test6. panic(3) }() panic(2) diff --git a/test/return.go b/test/return.go index 95f94b9276..20f648cf46 100644 --- a/test/return.go +++ b/test/return.go @@ -151,27 +151,31 @@ func _() int { func _() int { print(1) return 2 - {} + { + } } // ERROR "missing return" func _() int { L: print(1) goto L - {} + { + } } // ERROR "missing return" func _() int { print(1) panic(2) - {} + { + } } // ERROR "missing return" func _() int { { print(1) return 2 - {} + { + } } } // ERROR "missing return" @@ -180,7 +184,8 @@ L: { print(1) goto L - {} + { + } } } // ERROR "missing return" @@ -188,7 +193,8 @@ func _() int { print(1) { panic(2) - {} + { + } } } // ERROR "missing return" @@ -197,7 +203,8 @@ func _() int { print(1) return 2 } - {} + { + } } // ERROR "missing return" func _() int { @@ -206,7 +213,8 @@ L: print(1) goto L } - {} + { + } } // ERROR "missing return" func _() int { @@ -214,7 +222,8 @@ func _() int { { panic(2) } - {} + { + } } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -282,12 +291,12 @@ func _() int { } } // ERROR "missing return" - // for { loops that never break are okay. func _() int { print(1) - for {} + for { + } } func _() int { @@ -300,7 +309,7 @@ func _() int { func _() int { for { - L: + L: for { break L } @@ -311,7 +320,9 @@ func _() int { func _() int { print(1) - for { break } + for { + break + } } // ERROR "missing return" func _() int { @@ -335,7 +346,8 @@ L: func _() int { print(1) - for x == nil {} + for x == nil { + } } // ERROR "missing return" func _() int { @@ -348,16 +360,17 @@ func _() int { func _() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" func _() int { print(1) - for true {} + for true { + } } // ERROR "missing return" func _() int { @@ -370,7 +383,7 @@ func _() int { func _() int { for true { - L: + L: for { break L } @@ -381,7 +394,7 @@ func _() int { func _() int { print(1) - select{} + select {} } func _() int { @@ -398,7 +411,8 @@ func _() int { select { case <-c: print(2) - for{} + for { + } } } @@ -422,7 +436,7 @@ func _() int { print(2) panic("abc") default: - select{} + select {} } } @@ -449,7 +463,6 @@ L: } } // ERROR "missing return" - func _() int { print(1) select { @@ -461,12 +474,14 @@ func _() int { } } // ERROR "missing return" - // if any breaks refer to the select, the select isn't okay anymore, even if they're dead func _() int { print(1) - select{ default: break } + select { + default: + break + } } // ERROR "missing return" func _() int { @@ -485,7 +500,9 @@ L: select { case <-c: print(2) - for{ break L } + for { + break L + } } } // ERROR "missing return" @@ -509,7 +526,7 @@ func _() int { print(1) panic("abc") default: - select{} + select {} break } } // ERROR "missing return" @@ -557,7 +574,6 @@ func _() int { } } // ERROR "missing return" - func _() int { print(1) switch x { @@ -673,7 +689,6 @@ func _() int { } } // ERROR "missing return" - func _() int { print(1) switch x.(type) { @@ -863,24 +878,28 @@ func _() int { func _() int { return 2 - {} + { + } } // ERROR "missing return" func _() int { L: goto L - {} + { + } } // ERROR "missing return" func _() int { panic(2) - {} + { + } } // ERROR "missing return" func _() int { { return 2 - {} + { + } } } // ERROR "missing return" @@ -888,14 +907,16 @@ func _() int { L: { goto L - {} + { + } } } // ERROR "missing return" func _() int { { panic(2) - {} + { + } } } // ERROR "missing return" @@ -903,7 +924,8 @@ func _() int { { return 2 } - {} + { + } } // ERROR "missing return" func _() int { @@ -911,14 +933,16 @@ L: { goto L } - {} + { + } } // ERROR "missing return" func _() int { { panic(2) } - {} + { + } } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -980,11 +1004,11 @@ func _() int { } } // ERROR "missing return" - // for { loops that never break are okay. func _() int { - for {} + for { + } } func _() int { @@ -997,7 +1021,7 @@ func _() int { func _() int { for { - L: + L: for { break L } @@ -1007,7 +1031,9 @@ func _() int { // for { loops that break are not okay. func _() int { - for { break } + for { + break + } } // ERROR "missing return" func _() int { @@ -1030,7 +1056,8 @@ L: // if there's a condition - even "true" - the loops are no longer syntactically terminating func _() int { - for x == nil {} + for x == nil { + } } // ERROR "missing return" func _() int { @@ -1043,15 +1070,16 @@ func _() int { func _() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" func _() int { - for true {} + for true { + } } // ERROR "missing return" func _() int { @@ -1064,7 +1092,7 @@ func _() int { func _() int { for true { - L: + L: for { break L } @@ -1074,7 +1102,7 @@ func _() int { // select in which all cases terminate and none break are okay. func _() int { - select{} + select {} } func _() int { @@ -1089,7 +1117,8 @@ func _() int { select { case <-c: print(2) - for{} + for { + } } } @@ -1111,7 +1140,7 @@ func _() int { print(2) panic("abc") default: - select{} + select {} } } @@ -1136,7 +1165,6 @@ L: } } // ERROR "missing return" - func _() int { select { case <-c: @@ -1147,11 +1175,13 @@ func _() int { } } // ERROR "missing return" - // if any breaks refer to the select, the select isn't okay anymore, even if they're dead func _() int { - select{ default: break } + select { + default: + break + } } // ERROR "missing return" func _() int { @@ -1168,7 +1198,9 @@ L: select { case <-c: print(2) - for{ break L } + for { + break L + } } } // ERROR "missing return" @@ -1189,7 +1221,7 @@ func _() int { case <-c: panic("abc") default: - select{} + select {} break } } // ERROR "missing return" @@ -1233,7 +1265,6 @@ func _() int { } } // ERROR "missing return" - func _() int { switch x { case 1: @@ -1339,7 +1370,6 @@ func _() int { } } // ERROR "missing return" - func _() int { switch x.(type) { case int: @@ -1553,27 +1583,31 @@ var _ = func() int { var _ = func() int { print(1) return 2 - {} + { + } } // ERROR "missing return" var _ = func() int { L: print(1) goto L - {} + { + } } // ERROR "missing return" var _ = func() int { print(1) panic(2) - {} + { + } } // ERROR "missing return" var _ = func() int { { print(1) return 2 - {} + { + } } } // ERROR "missing return" @@ -1582,7 +1616,8 @@ L: { print(1) goto L - {} + { + } } } // ERROR "missing return" @@ -1590,7 +1625,8 @@ var _ = func() int { print(1) { panic(2) - {} + { + } } } // ERROR "missing return" @@ -1599,7 +1635,8 @@ var _ = func() int { print(1) return 2 } - {} + { + } } // ERROR "missing return" var _ = func() int { @@ -1608,7 +1645,8 @@ L: print(1) goto L } - {} + { + } } // ERROR "missing return" var _ = func() int { @@ -1616,7 +1654,8 @@ var _ = func() int { { panic(2) } - {} + { + } } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -1684,12 +1723,12 @@ var _ = func() int { } } // ERROR "missing return" - // for { loops that never break are okay. var _ = func() int { print(1) - for {} + for { + } } var _ = func() int { @@ -1702,7 +1741,7 @@ var _ = func() int { var _ = func() int { for { - L: + L: for { break L } @@ -1713,7 +1752,9 @@ var _ = func() int { var _ = func() int { print(1) - for { break } + for { + break + } } // ERROR "missing return" var _ = func() int { @@ -1737,7 +1778,8 @@ L: var _ = func() int { print(1) - for x == nil {} + for x == nil { + } } // ERROR "missing return" var _ = func() int { @@ -1750,16 +1792,17 @@ var _ = func() int { var _ = func() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" var _ = func() int { print(1) - for true {} + for true { + } } // ERROR "missing return" var _ = func() int { @@ -1772,7 +1815,7 @@ var _ = func() int { var _ = func() int { for true { - L: + L: for { break L } @@ -1783,7 +1826,7 @@ var _ = func() int { var _ = func() int { print(1) - select{} + select {} } var _ = func() int { @@ -1800,7 +1843,8 @@ var _ = func() int { select { case <-c: print(2) - for{} + for { + } } } @@ -1824,7 +1868,7 @@ var _ = func() int { print(2) panic("abc") default: - select{} + select {} } } @@ -1851,7 +1895,6 @@ L: } } // ERROR "missing return" - var _ = func() int { print(1) select { @@ -1863,12 +1906,14 @@ var _ = func() int { } } // ERROR "missing return" - // if any breaks refer to the select, the select isn't okay anymore, even if they're dead var _ = func() int { print(1) - select{ default: break } + select { + default: + break + } } // ERROR "missing return" var _ = func() int { @@ -1887,7 +1932,9 @@ L: select { case <-c: print(2) - for{ break L } + for { + break L + } } } // ERROR "missing return" @@ -1911,7 +1958,7 @@ var _ = func() int { print(1) panic("abc") default: - select{} + select {} break } } // ERROR "missing return" @@ -1959,7 +2006,6 @@ var _ = func() int { } } // ERROR "missing return" - var _ = func() int { print(1) switch x { @@ -2075,7 +2121,6 @@ var _ = func() int { } } // ERROR "missing return" - var _ = func() int { print(1) switch x.(type) { @@ -2265,24 +2310,28 @@ var _ = func() int { var _ = func() int { return 2 - {} + { + } } // ERROR "missing return" var _ = func() int { L: goto L - {} + { + } } // ERROR "missing return" var _ = func() int { panic(2) - {} + { + } } // ERROR "missing return" var _ = func() int { { return 2 - {} + { + } } } // ERROR "missing return" @@ -2290,14 +2339,16 @@ var _ = func() int { L: { goto L - {} + { + } } } // ERROR "missing return" var _ = func() int { { panic(2) - {} + { + } } } // ERROR "missing return" @@ -2305,7 +2356,8 @@ var _ = func() int { { return 2 } - {} + { + } } // ERROR "missing return" var _ = func() int { @@ -2313,14 +2365,16 @@ L: { goto L } - {} + { + } } // ERROR "missing return" var _ = func() int { { panic(2) } - {} + { + } } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -2382,11 +2436,11 @@ var _ = func() int { } } // ERROR "missing return" - // for { loops that never break are okay. var _ = func() int { - for {} + for { + } } var _ = func() int { @@ -2399,7 +2453,7 @@ var _ = func() int { var _ = func() int { for { - L: + L: for { break L } @@ -2409,7 +2463,9 @@ var _ = func() int { // for { loops that break are not okay. var _ = func() int { - for { break } + for { + break + } } // ERROR "missing return" var _ = func() int { @@ -2432,7 +2488,8 @@ L: // if there's a condition - even "true" - the loops are no longer syntactically terminating var _ = func() int { - for x == nil {} + for x == nil { + } } // ERROR "missing return" var _ = func() int { @@ -2445,15 +2502,16 @@ var _ = func() int { var _ = func() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" var _ = func() int { - for true {} + for true { + } } // ERROR "missing return" var _ = func() int { @@ -2466,7 +2524,7 @@ var _ = func() int { var _ = func() int { for true { - L: + L: for { break L } @@ -2476,7 +2534,7 @@ var _ = func() int { // select in which all cases terminate and none break are okay. var _ = func() int { - select{} + select {} } var _ = func() int { @@ -2491,7 +2549,8 @@ var _ = func() int { select { case <-c: print(2) - for{} + for { + } } } @@ -2513,7 +2572,7 @@ var _ = func() int { print(2) panic("abc") default: - select{} + select {} } } @@ -2538,7 +2597,6 @@ L: } } // ERROR "missing return" - var _ = func() int { select { case <-c: @@ -2549,11 +2607,13 @@ var _ = func() int { } } // ERROR "missing return" - // if any breaks refer to the select, the select isn't okay anymore, even if they're dead var _ = func() int { - select{ default: break } + select { + default: + break + } } // ERROR "missing return" var _ = func() int { @@ -2570,7 +2630,9 @@ L: select { case <-c: print(2) - for{ break L } + for { + break L + } } } // ERROR "missing return" @@ -2591,7 +2653,7 @@ var _ = func() int { case <-c: panic("abc") default: - select{} + select {} break } } // ERROR "missing return" @@ -2635,7 +2697,6 @@ var _ = func() int { } } // ERROR "missing return" - var _ = func() int { switch x { case 1: @@ -2741,7 +2802,6 @@ var _ = func() int { } } // ERROR "missing return" - var _ = func() int { switch x.(type) { case int: diff --git a/test/rune.go b/test/rune.go index 73a5aa23f8..3509876910 100644 --- a/test/rune.go +++ b/test/rune.go @@ -11,12 +11,12 @@ package rune var ( r0 = 'a' - r1 = 'a'+1 - r2 = 1+'a' - r3 = 'a'*2 - r4 = 'a'/2 - r5 = 'a'<<1 - r6 = 'b'<<2 + r1 = 'a' + 1 + r2 = 1 + 'a' + r3 = 'a' * 2 + r4 = 'a' / 2 + r5 = 'a' << 1 + r6 = 'b' << 2 r7 int32 r = []rune{r0, r1, r2, r3, r4, r5, r6, r7} @@ -24,15 +24,15 @@ var ( var ( f0 = 1.2 - f1 = 1.2/'a' + f1 = 1.2 / 'a' f = []float64{f0, f1} ) var ( i0 = 1 - i1 = 1<<'\x01' - + i1 = 1 << '\x01' + i = []int{i0, i1} ) @@ -42,6 +42,6 @@ const ( var ( b0 = maxRune < r0 - + b = []bool{b0} ) diff --git a/test/runtime.go b/test/runtime.go index 0cf781b814..09862acf50 100644 --- a/test/runtime.go +++ b/test/runtime.go @@ -17,5 +17,5 @@ package main import "runtime" func main() { - runtime.printbool(true) // ERROR "unexported" "undefined" + runtime.printbool(true) // ERROR "unexported" "undefined" } diff --git a/test/shift1.go b/test/shift1.go index 01ecbed53a..dd990fa929 100644 --- a/test/shift1.go +++ b/test/shift1.go @@ -61,12 +61,12 @@ func _() { o = 1< Date: Tue, 24 Sep 2019 21:05:19 -0400 Subject: [PATCH 119/126] Update test cases --- test/235.go | 4 +- test/64bit.go | 48 +- test/align.go | 2 +- test/assign1.go | 5 +- test/bigmap.go | 7 +- test/blank1.go | 12 +- test/char_lit.go | 3 +- test/closedchan.go | 15 +- test/closure1.go | 2 +- test/closure2.go | 4 +- test/cmplxdivide1.go | 6 +- test/complit1.go | 12 +- test/const1.go | 8 +- test/const3.go | 2 +- test/const5.go | 12 +- test/const6.go | 30 +- test/convT2X.go | 4 +- test/convlit1.go | 8 +- test/ddd2.dir/ddd2.go | 1 + test/deferfin.go | 1 + test/deferprint.go | 2 +- test/divmod.go | 45 +- test/dwarf/dwarf.dir/main.go | 41 +- test/dwarf/dwarf.dir/z1.go | 3 +- test/dwarf/dwarf.dir/z10.go | 4 +- test/dwarf/dwarf.dir/z11.go | 2 +- test/dwarf/dwarf.dir/z12.go | 2 +- test/dwarf/dwarf.dir/z13.go | 2 +- test/dwarf/dwarf.dir/z14.go | 2 +- test/dwarf/dwarf.dir/z15.go | 2 +- test/dwarf/dwarf.dir/z16.go | 2 +- test/dwarf/dwarf.dir/z17.go | 2 +- test/dwarf/dwarf.dir/z18.go | 3 +- test/dwarf/dwarf.dir/z19.go | 2 +- test/dwarf/dwarf.dir/z2.go | 2 +- test/dwarf/dwarf.dir/z20.go | 2 +- test/dwarf/dwarf.dir/z3.go | 2 +- test/dwarf/dwarf.dir/z4.go | 2 +- test/dwarf/dwarf.dir/z5.go | 2 +- test/dwarf/dwarf.dir/z6.go | 2 +- test/dwarf/dwarf.dir/z7.go | 2 +- test/dwarf/dwarf.dir/z8.go | 2 +- test/dwarf/dwarf.dir/z9.go | 2 +- test/dwarf/linedirectives.go | 6 +- test/empty.go | 11 +- test/eof.go | 2 +- test/eof1.go | 2 +- test/escape2.go | 42 +- test/escape2n.go | 42 +- test/escape4.go | 4 +- test/escape_closure.go | 4 +- test/escape_field.go | 8 +- test/escape_iface.go | 32 +- test/escape_indir.go | 12 +- test/escape_level.go | 20 +- test/escape_map.go | 22 +- test/escape_param.go | 52 +- test/escape_slice.go | 14 +- test/escape_struct_param1.go | 98 +- test/escape_struct_param2.go | 98 +- test/finprofiled.go | 2 +- test/fixedbugs/bug000.go | 8 +- test/fixedbugs/bug002.go | 3 +- test/fixedbugs/bug003.go | 8 +- test/fixedbugs/bug004.go | 5 +- test/fixedbugs/bug005.go | 8 +- test/fixedbugs/bug008.go | 17 +- test/fixedbugs/bug009.go | 5 +- test/fixedbugs/bug010.go | 1 + test/fixedbugs/bug011.go | 2 +- test/fixedbugs/bug012.go | 26 +- test/fixedbugs/bug013.go | 7 +- test/fixedbugs/bug015.go | 4 +- test/fixedbugs/bug017.go | 5 +- test/fixedbugs/bug020.go | 4 +- test/fixedbugs/bug021.go | 6 +- test/fixedbugs/bug022.go | 12 +- test/fixedbugs/bug023.go | 11 +- test/fixedbugs/bug024.go | 13 +- test/fixedbugs/bug026.go | 8 +- test/fixedbugs/bug028.go | 13 +- test/fixedbugs/bug030.go | 6 +- test/fixedbugs/bug031.go | 34 +- test/fixedbugs/bug037.go | 2 +- test/fixedbugs/bug039.go | 4 +- test/fixedbugs/bug040.go | 4 +- test/fixedbugs/bug045.go | 7 +- test/fixedbugs/bug046.go | 4 +- test/fixedbugs/bug048.go | 6 +- test/fixedbugs/bug049.go | 4 +- test/fixedbugs/bug051.go | 4 +- test/fixedbugs/bug052.go | 10 +- test/fixedbugs/bug053.go | 4 +- test/fixedbugs/bug054.go | 26 +- test/fixedbugs/bug056.go | 4 +- test/fixedbugs/bug057.go | 13 +- test/fixedbugs/bug058.go | 13 +- test/fixedbugs/bug059.go | 26 +- test/fixedbugs/bug060.go | 8 +- test/fixedbugs/bug061.go | 6 +- test/fixedbugs/bug062.go | 2 +- test/fixedbugs/bug063.go | 1 - test/fixedbugs/bug064.go | 14 +- test/fixedbugs/bug065.go | 4 +- test/fixedbugs/bug066.go | 11 +- test/fixedbugs/bug067.go | 4 +- test/fixedbugs/bug069.go | 20 +- test/fixedbugs/bug071.go | 12 +- test/fixedbugs/bug072.go | 2 +- test/fixedbugs/bug074.go | 4 +- test/fixedbugs/bug075.go | 15 +- test/fixedbugs/bug076.go | 3 +- test/fixedbugs/bug078.go | 2 +- test/fixedbugs/bug083.dir/bug1.go | 3 +- test/fixedbugs/bug085.go | 2 +- test/fixedbugs/bug086.go | 4 +- test/fixedbugs/bug087.go | 6 +- test/fixedbugs/bug088.dir/bug0.go | 6 +- test/fixedbugs/bug088.dir/bug1.go | 8 +- test/fixedbugs/bug089.go | 15 +- test/fixedbugs/bug090.go | 40 +- test/fixedbugs/bug092.go | 6 +- test/fixedbugs/bug093.go | 9 +- test/fixedbugs/bug094.go | 12 +- test/fixedbugs/bug096.go | 8 +- test/fixedbugs/bug098.go | 10 +- test/fixedbugs/bug099.go | 12 +- test/fixedbugs/bug101.go | 10 +- test/fixedbugs/bug103.go | 5 +- test/fixedbugs/bug104.go | 3 +- test/fixedbugs/bug106.dir/bug1.go | 1 + test/fixedbugs/bug107.go | 11 +- test/fixedbugs/bug108.go | 3 +- test/fixedbugs/bug111.go | 12 +- test/fixedbugs/bug112.go | 3 +- test/fixedbugs/bug113.go | 2 +- test/fixedbugs/bug115.go | 6 +- test/fixedbugs/bug118.go | 4 +- test/fixedbugs/bug122.go | 2 +- test/fixedbugs/bug123.go | 8 +- test/fixedbugs/bug126.go | 4 +- test/fixedbugs/bug127.go | 7 +- test/fixedbugs/bug128.go | 11 +- test/fixedbugs/bug129.go | 7 +- test/fixedbugs/bug130.go | 17 +- test/fixedbugs/bug131.go | 4 +- test/fixedbugs/bug132.go | 2 +- test/fixedbugs/bug133.dir/bug0.go | 2 +- test/fixedbugs/bug133.dir/bug1.go | 2 +- test/fixedbugs/bug133.dir/bug2.go | 4 +- test/fixedbugs/bug135.go | 13 +- test/fixedbugs/bug136.go | 14 +- test/fixedbugs/bug139.go | 14 +- test/fixedbugs/bug141.go | 16 +- test/fixedbugs/bug142.go | 8 +- test/fixedbugs/bug143.go | 28 +- test/fixedbugs/bug144.go | 6 +- test/fixedbugs/bug145.go | 4 +- test/fixedbugs/bug146.go | 10 +- test/fixedbugs/bug148.go | 22 +- test/fixedbugs/bug149.go | 16 +- test/fixedbugs/bug150.go | 7 +- test/fixedbugs/bug151.go | 4 +- test/fixedbugs/bug152.go | 6 +- test/fixedbugs/bug154.go | 24 +- test/fixedbugs/bug155.go | 2 +- test/fixedbugs/bug156.go | 6 +- test/fixedbugs/bug157.go | 15 +- test/fixedbugs/bug158.go | 3 +- test/fixedbugs/bug159.go | 20 +- test/fixedbugs/bug160.dir/y.go | 8 +- test/fixedbugs/bug161.go | 4 +- test/fixedbugs/bug165.go | 4 +- test/fixedbugs/bug170.go | 11 +- test/fixedbugs/bug171.go | 4 +- test/fixedbugs/bug172.go | 4 +- test/fixedbugs/bug173.go | 5 +- test/fixedbugs/bug174.go | 4 +- test/fixedbugs/bug175.go | 2 +- test/fixedbugs/bug176.go | 5 +- test/fixedbugs/bug181.go | 2 +- test/fixedbugs/bug182.go | 4 +- test/fixedbugs/bug183.go | 21 +- test/fixedbugs/bug186.go | 8 +- test/fixedbugs/bug187.go | 10 +- test/fixedbugs/bug188.go | 6 +- test/fixedbugs/bug189.go | 8 +- test/fixedbugs/bug190.go | 26 +- test/fixedbugs/bug191.dir/a.go | 3 +- test/fixedbugs/bug191.dir/b.go | 2 +- test/fixedbugs/bug192.go | 4 +- test/fixedbugs/bug195.go | 12 +- test/fixedbugs/bug197.go | 14 +- test/fixedbugs/bug198.go | 7 +- test/fixedbugs/bug200.go | 4 +- test/fixedbugs/bug202.go | 9 +- test/fixedbugs/bug203.go | 8 +- test/fixedbugs/bug205.go | 11 +- test/fixedbugs/bug206.go | 17 +- test/fixedbugs/bug207.go | 4 +- test/fixedbugs/bug208.go | 8 +- test/fixedbugs/bug209.go | 4 +- test/fixedbugs/bug211.go | 9 +- test/fixedbugs/bug212.go | 10 +- test/fixedbugs/bug213.go | 7 +- test/fixedbugs/bug214.go | 4 +- test/fixedbugs/bug215.go | 6 +- test/fixedbugs/bug216.go | 2 +- test/fixedbugs/bug217.go | 5 +- test/fixedbugs/bug218.go | 4 +- test/fixedbugs/bug219.go | 14 +- test/fixedbugs/bug222.dir/chanbug.go | 3 +- test/fixedbugs/bug222.dir/chanbug2.go | 1 - test/fixedbugs/bug224.go | 3 +- test/fixedbugs/bug225.go | 10 +- test/fixedbugs/bug229.go | 8 +- test/fixedbugs/bug231.go | 11 +- test/fixedbugs/bug232.go | 3 +- test/fixedbugs/bug233.go | 2 - test/fixedbugs/bug235.go | 1 + test/fixedbugs/bug237.go | 1 - test/fixedbugs/bug238.go | 1 + test/fixedbugs/bug240.go | 2 +- test/fixedbugs/bug241.go | 2 +- test/fixedbugs/bug245.go | 1 - test/fixedbugs/bug249.go | 62 +- test/fixedbugs/bug251.go | 1 + test/fixedbugs/bug252.go | 2 +- test/fixedbugs/bug256.go | 6 +- test/fixedbugs/bug258.go | 2 +- test/fixedbugs/bug259.go | 2 +- test/fixedbugs/bug261.go | 2 +- test/fixedbugs/bug266.go | 4 +- test/fixedbugs/bug269.go | 4 +- test/fixedbugs/bug271.go | 2 +- test/fixedbugs/bug272.go | 6 +- test/fixedbugs/bug276.go | 6 +- test/fixedbugs/bug277.go | 2 +- test/fixedbugs/bug278.go | 8 +- test/fixedbugs/bug279.go | 3 +- test/fixedbugs/bug280.go | 4 +- test/fixedbugs/bug281.go | 8 +- test/fixedbugs/bug282.dir/p1.go | 1 + test/fixedbugs/bug282.dir/p2.go | 1 + test/fixedbugs/bug284.go | 2 +- test/fixedbugs/bug285.go | 4 +- test/fixedbugs/bug287.go | 2 +- test/fixedbugs/bug289.go | 6 +- test/fixedbugs/bug290.go | 4 +- test/fixedbugs/bug293.go | 4 +- test/fixedbugs/bug294.go | 1 + test/fixedbugs/bug295.go | 4 +- test/fixedbugs/bug297.go | 5 +- test/fixedbugs/bug302.dir/main.go | 1 + test/fixedbugs/bug302.dir/p.go | 1998 ++++++++++++------------ test/fixedbugs/bug304.go | 4 +- test/fixedbugs/bug306.dir/p1.go | 2 +- test/fixedbugs/bug306.dir/p2.go | 1 + test/fixedbugs/bug311.go | 4 +- test/fixedbugs/bug314.go | 5 +- test/fixedbugs/bug317.go | 2 +- test/fixedbugs/bug319.go | 2 +- test/fixedbugs/bug320.go | 1 + test/fixedbugs/bug322.dir/lib.go | 2 +- test/fixedbugs/bug322.dir/main.go | 2 +- test/fixedbugs/bug324.dir/prog.go | 9 +- test/fixedbugs/bug325.go | 4 +- test/fixedbugs/bug330.go | 4 +- test/fixedbugs/bug332.go | 2 +- test/fixedbugs/bug333.go | 6 +- test/fixedbugs/bug337.go | 5 +- test/fixedbugs/bug341.go | 1 - test/fixedbugs/bug343.go | 18 +- test/fixedbugs/bug344.go | 4 +- test/fixedbugs/bug347.go | 4 +- test/fixedbugs/bug348.go | 6 +- test/fixedbugs/bug356.go | 13 +- test/fixedbugs/bug357.go | 2 +- test/fixedbugs/bug361.go | 2 +- test/fixedbugs/bug362.go | 6 +- test/fixedbugs/bug363.go | 8 +- test/fixedbugs/bug364.go | 2 +- test/fixedbugs/bug366.go | 40 +- test/fixedbugs/bug368.go | 2 +- test/fixedbugs/bug369.dir/pkg.go | 1 + test/fixedbugs/bug372.go | 4 +- test/fixedbugs/bug373.go | 2 +- test/fixedbugs/bug374.go | 4 +- test/fixedbugs/bug376.go | 4 +- test/fixedbugs/bug377.dir/one.go | 1 + test/fixedbugs/bug377.dir/two.go | 1 + test/fixedbugs/bug378.go | 5 +- test/fixedbugs/bug379.go | 2 +- test/fixedbugs/bug380.go | 2 - test/fixedbugs/bug381.go | 2 +- test/fixedbugs/bug382.dir/pkg.go | 4 +- test/fixedbugs/bug383.go | 7 +- test/fixedbugs/bug384.go | 2 +- test/fixedbugs/bug385_32.go | 3 +- test/fixedbugs/bug385_64.go | 620 +++----- test/fixedbugs/bug386.go | 4 +- test/fixedbugs/bug387.go | 15 +- test/fixedbugs/bug389.go | 2 +- test/fixedbugs/bug391.go | 7 +- test/fixedbugs/bug392.dir/one.go | 13 +- test/fixedbugs/bug396.dir/one.go | 2 +- test/fixedbugs/bug396.dir/two.go | 2 +- test/fixedbugs/bug397.go | 6 +- test/fixedbugs/bug398.go | 12 +- test/fixedbugs/bug399.go | 2 +- test/fixedbugs/bug405.go | 2 +- test/fixedbugs/bug407.dir/one.go | 5 +- test/fixedbugs/bug410.go | 18 +- test/fixedbugs/bug411.go | 3 +- test/fixedbugs/bug412.go | 6 +- test/fixedbugs/bug413.go | 2 +- test/fixedbugs/bug415.dir/p.go | 5 +- test/fixedbugs/bug415.dir/prog.go | 4 +- test/fixedbugs/bug417.go | 16 +- test/fixedbugs/bug420.go | 2 +- test/fixedbugs/bug421.go | 4 +- test/fixedbugs/bug424.dir/main.go | 6 +- test/fixedbugs/bug424.go | 1 + test/fixedbugs/bug425.go | 2 +- test/fixedbugs/bug427.go | 4 +- test/fixedbugs/bug439.go | 2 +- test/fixedbugs/bug441.go | 6 +- test/fixedbugs/bug442.go | 2 +- test/fixedbugs/bug443.go | 4 +- test/fixedbugs/bug444.go | 8 +- test/fixedbugs/bug446.go | 1 + test/fixedbugs/bug447.go | 10 +- test/fixedbugs/bug448.dir/pkg2.go | 1 + test/fixedbugs/bug460.go | 1 + test/fixedbugs/bug462.go | 2 +- test/fixedbugs/bug466.dir/a.go | 2 +- test/fixedbugs/bug466.go | 1 + test/fixedbugs/bug468.dir/p1.go | 2 +- test/fixedbugs/bug468.dir/p2.go | 2 +- test/fixedbugs/bug470.go | 4 +- test/fixedbugs/bug479.dir/a.go | 2 +- test/fixedbugs/bug480.dir/a.go | 2 +- test/fixedbugs/bug486.go | 2 +- test/fixedbugs/bug487.go | 6 +- test/fixedbugs/bug488.dir/a.go | 2 +- test/fixedbugs/bug490.go | 2 +- test/fixedbugs/bug491.go | 2 +- test/fixedbugs/bug500.go | 2 +- test/fixedbugs/gcc61264.go | 2 +- test/fixedbugs/gcc67968.dir/b.go | 6 +- test/fixedbugs/issue10607a.go | 2 +- test/fixedbugs/issue11326.go | 16 +- test/fixedbugs/issue11361.go | 2 +- test/fixedbugs/issue11362.go | 1 + test/fixedbugs/issue12677.dir/p.go | 3 +- test/fixedbugs/issue12677.dir/q.go | 2 - test/fixedbugs/issue13261.go | 24 +- test/fixedbugs/issue13265.go | 6 +- test/fixedbugs/issue13337.go | 1 - test/fixedbugs/issue13415.go | 12 +- test/fixedbugs/issue13485.go | 2 +- test/fixedbugs/issue14136.go | 2 +- test/fixedbugs/issue14321.go | 4 +- test/fixedbugs/issue14540.go | 5 +- test/fixedbugs/issue14651.go | 6 +- test/fixedbugs/issue14729.go | 4 +- test/fixedbugs/issue15039.go | 2 +- test/fixedbugs/issue15042.go | 2 +- test/fixedbugs/issue15311.go | 8 +- test/fixedbugs/issue15439.go | 4 +- test/fixedbugs/issue15470.dir/a.go | 6 +- test/fixedbugs/issue15548.dir/c.go | 2 +- test/fixedbugs/issue15646.go | 2 +- test/fixedbugs/issue15926.go | 2 +- test/fixedbugs/issue16515.go | 5 +- test/fixedbugs/issue16948.go | 1 - test/fixedbugs/issue17449.go | 16 +- test/fixedbugs/issue17588.go | 8 +- test/fixedbugs/issue17645.go | 3 +- test/fixedbugs/issue18231.go | 2 +- test/fixedbugs/issue18808.go | 8 +- test/fixedbugs/issue19028.dir/main.go | 16 +- test/fixedbugs/issue19515.go | 1 + test/fixedbugs/issue19764.dir/a.go | 3 +- test/fixedbugs/issue20602.go | 4 +- test/fixedbugs/issue20811.go | 1 + test/fixedbugs/issue22429.go | 4 +- test/fixedbugs/issue22458.go | 12 +- test/fixedbugs/issue22662.go | 20 +- test/fixedbugs/issue24339.go | 10 +- test/fixedbugs/issue24799.go | 42 +- test/fixedbugs/issue25727.go | 8 +- test/fixedbugs/issue26335.go | 2 +- test/fixedbugs/issue26340.go | 6 +- test/fixedbugs/issue26407.go | 2 +- test/fixedbugs/issue27278.go | 2 +- test/fixedbugs/issue27356.go | 5 +- test/fixedbugs/issue29215.go | 16 +- test/fixedbugs/issue29402.go | 2 +- test/fixedbugs/issue31747.go | 8 +- test/fixedbugs/issue3552.dir/one.go | 11 +- test/fixedbugs/issue3783.go | 1 + test/fixedbugs/issue3925.go | 3 +- test/fixedbugs/issue4097.go | 2 +- test/fixedbugs/issue4099.go | 2 +- test/fixedbugs/issue4162.go | 8 +- test/fixedbugs/issue4251.go | 6 +- test/fixedbugs/issue4264.go | 8 +- test/fixedbugs/issue4283.go | 4 +- test/fixedbugs/issue4313.go | 5 +- test/fixedbugs/issue4326.dir/q1.go | 8 +- test/fixedbugs/issue4326.dir/q2.go | 10 +- test/fixedbugs/issue4365.go | 8 +- test/fixedbugs/issue4396a.go | 2 +- test/fixedbugs/issue4396b.go | 2 +- test/fixedbugs/issue4429.go | 6 +- test/fixedbugs/issue4463.go | 66 +- test/fixedbugs/issue4470.go | 2 +- test/fixedbugs/issue4495.go | 1 + test/fixedbugs/issue4562.go | 2 +- test/fixedbugs/issue4610.go | 1 + test/fixedbugs/issue4618.go | 2 +- test/fixedbugs/issue4620.go | 2 +- test/fixedbugs/issue4654.go | 82 +- test/fixedbugs/issue4663.go | 4 +- test/fixedbugs/issue4748.go | 8 +- test/fixedbugs/issue4879.dir/a.go | 1 + test/fixedbugs/issue4879.dir/b.go | 6 +- test/fixedbugs/issue5056.go | 4 +- test/fixedbugs/issue5172.go | 4 +- test/fixedbugs/issue5493.go | 2 +- test/fixedbugs/issue5515.go | 18 +- test/fixedbugs/issue5614.dir/x.go | 2 + test/fixedbugs/issue5753.go | 2 +- test/fixedbugs/issue5809.go | 6 +- test/fixedbugs/issue5957.dir/b.go | 1 + test/fixedbugs/issue5957.dir/c.go | 10 +- test/fixedbugs/issue6004.go | 7 +- test/fixedbugs/issue6406.go | 2 +- test/fixedbugs/issue6703g.go | 2 +- test/fixedbugs/issue6703h.go | 2 +- test/fixedbugs/issue6703i.go | 2 +- test/fixedbugs/issue6703o.go | 2 +- test/fixedbugs/issue6703p.go | 2 +- test/fixedbugs/issue6703q.go | 2 +- test/fixedbugs/issue6703r.go | 2 +- test/fixedbugs/issue6703y.go | 2 +- test/fixedbugs/issue6703z.go | 2 +- test/fixedbugs/issue6789.dir/a.go | 6 +- test/fixedbugs/issue6847.go | 2 +- test/fixedbugs/issue7223.go | 7 +- test/fixedbugs/issue7310.go | 2 +- test/fixedbugs/issue7550.go | 20 +- test/fixedbugs/issue7590.go | 2 +- test/fixedbugs/issue7648.dir/a.go | 3 +- test/fixedbugs/issue7760.go | 6 +- test/fixedbugs/issue7921.go | 2 +- test/fixedbugs/issue8155.go | 2 +- test/fixedbugs/issue8961.go | 3 +- test/fixedbugs/issue9076.go | 3 +- test/fixedbugs/issue9083.go | 10 +- test/fixedbugs/issue9537.dir/b.go | 4 +- test/fixedbugs/issue9634.go | 2 +- test/float_lit.go | 48 +- test/for.go | 4 +- test/func.go | 3 + test/func1.go | 1 + test/func4.go | 4 +- test/func5.go | 4 +- test/func6.go | 10 +- test/funcdup.go | 20 +- test/funcdup2.go | 8 +- test/gcstring.go | 9 +- test/goprint.go | 2 +- test/import1.go | 10 +- test/import2.dir/import2.go | 61 +- test/import2.dir/import3.go | 25 +- test/import4.dir/empty.go | 11 +- test/import4.dir/import4.go | 13 +- test/indirect1.go | 52 +- test/initcomma.go | 8 +- test/initialize.go | 38 +- test/initializerr.go | 22 +- test/inline_sync.go | 13 +- test/int_lit.go | 6 +- test/intcvt.go | 2 +- test/interface/bigdata.go | 34 +- test/interface/convert1.go | 9 +- test/interface/convert2.go | 9 +- test/interface/embed.go | 9 +- test/interface/embed1.dir/embed0.go | 5 +- test/interface/embed1.dir/embed1.go | 9 +- test/interface/pointer.go | 3 +- test/interface/private.dir/private1.go | 1 + test/interface/private.dir/prog.go | 6 +- test/interface/recursive.go | 1 - test/interface/returntype.go | 10 +- test/interface/struct.go | 36 +- test/iota.go | 6 +- test/ken/complit.go | 181 +-- test/ken/convert.go | 689 +++----- test/ken/cplx2.go | 4 +- test/ken/cplx3.go | 4 +- test/ken/embed.go | 1 + test/ken/for.go | 13 +- test/ken/interfun.go | 67 +- test/ken/intervar.go | 53 +- test/ken/litfun.go | 25 +- test/ken/mfunc.go | 16 +- test/ken/ptrfun.go | 51 +- test/ken/ptrvar.go | 79 +- test/ken/robfor.go | 44 +- test/ken/robfunc.go | 3 + test/ken/shift.go | 168 +- test/ken/simparray.go | 51 +- test/ken/simpbool.go | 257 +-- test/ken/simpfun.go | 24 +- test/ken/simpvar.go | 24 +- test/ken/strvar.go | 124 +- test/literal2.go | 4 +- test/live1.go | 1 + test/live_syscall.go | 2 +- test/map1.go | 18 +- test/method5.go | 44 +- test/named.go | 1 + test/nilptr2.go | 10 +- test/oldescape2.go | 42 +- test/oldescape2n.go | 42 +- test/oldescape5.go | 6 +- test/oldescape_field.go | 8 +- test/oldescape_iface.go | 32 +- test/oldescape_param.go | 52 +- test/parentype.go | 10 +- test/printbig.go | 2 +- test/recover1.go | 14 +- test/return.go | 284 ++-- test/rune.go | 20 +- test/runtime.go | 2 +- test/shift1.go | 12 +- test/stack.go | 2 +- test/switch5.go | 2 +- test/switch7.go | 1 + test/tinyfin.go | 2 +- test/typecheck.go | 8 +- test/typeswitch2.go | 2 +- test/undef.go | 14 +- test/varerr.go | 5 +- 547 files changed, 4187 insertions(+), 4886 deletions(-) diff --git a/test/235.go b/test/235.go index a62d384a65..6745dde41a 100644 --- a/test/235.go +++ b/test/235.go @@ -16,12 +16,13 @@ func M(f uint64) (in, out T) { out = make(T, 100) go func(in, out T, f uint64) { for { - out <- f * <-in + out <- f*<-in } }(in, out, f) return in, out } + func min(xs []uint64) uint64 { m := xs[0] for i := 1; i < len(xs); i++ { @@ -32,6 +33,7 @@ func min(xs []uint64) uint64 { return m } + func main() { F := []uint64{2, 3, 5} var n = len(F) diff --git a/test/64bit.go b/test/64bit.go index 9eaac1409a..d99d8e83f0 100644 --- a/test/64bit.go +++ b/test/64bit.go @@ -25,13 +25,13 @@ var bout *bufio.Writer // if the compiler has buggy or missing 64-bit support. type Uint64 struct { - hi uint32 - lo uint32 + hi uint32 + lo uint32 } type Int64 struct { - hi int32 - lo uint32 + hi int32 + lo uint32 } func (a Uint64) Int64() (c Int64) { @@ -170,7 +170,7 @@ func (a Uint64) DivMod(b Uint64) (quo, rem Uint64) { b = b.LeftShift(uint(n)) for i := 0; i <= n; i++ { quo = quo.LeftShift(1) - if b.Cmp(a) <= 0 { // b <= a + if b.Cmp(a) <= 0 { // b <= a quo.lo |= 1 a = a.Minus(b) } @@ -205,7 +205,7 @@ func (a Uint64) Xor(b Uint64) (c Uint64) { return } -func (a Uint64) String() string { return fmt.Sprintf("%#x%08x", a.hi, a.lo) } +func (a Uint64) String() string { return fmt.Sprintf("%#x%08x", a.hi, a.lo) } func (a Int64) Uint64() (c Uint64) { c.hi = uint32(a.hi) @@ -230,15 +230,15 @@ func (a Int64) Cmp(b Int64) int { return 0 } -func (a Int64) LeftShift(b uint) (c Int64) { return a.Uint64().LeftShift(b).Int64() } +func (a Int64) LeftShift(b uint) (c Int64) { return a.Uint64().LeftShift(b).Int64() } func (a Int64) RightShift(b uint) (c Int64) { switch { case b >= 64: - c.hi = a.hi >> 31 // sign extend + c.hi = a.hi >> 31 // sign extend c.lo = uint32(c.hi) case b >= 32: - c.hi = a.hi >> 31 // sign extend + c.hi = a.hi >> 31 // sign extend c.lo = uint32(a.hi >> (b - 32)) default: c.hi = a.hi >> b @@ -261,15 +261,15 @@ func (a Int64) RightShift64(b Uint64) (c Int64) { return a.RightShift(uint(b.lo)) } -func (a Int64) Plus(b Int64) (c Int64) { return a.Uint64().Plus(b.Uint64()).Int64() } +func (a Int64) Plus(b Int64) (c Int64) { return a.Uint64().Plus(b.Uint64()).Int64() } -func (a Int64) Minus(b Int64) (c Int64) { return a.Uint64().Minus(b.Uint64()).Int64() } +func (a Int64) Minus(b Int64) (c Int64) { return a.Uint64().Minus(b.Uint64()).Int64() } -func (a Int64) Neg() (c Int64) { return a.Uint64().Neg().Int64() } +func (a Int64) Neg() (c Int64) { return a.Uint64().Neg().Int64() } -func (a Int64) Com() (c Int64) { return a.Uint64().Com().Int64() } +func (a Int64) Com() (c Int64) { return a.Uint64().Com().Int64() } -func (a Int64) Times(b Int64) (c Int64) { return a.Uint64().Times(b.Uint64()).Int64() } +func (a Int64) Times(b Int64) (c Int64) { return a.Uint64().Times(b.Uint64()).Int64() } func (a Int64) DivMod(b Int64) (quo Int64, rem Int64) { var zero Int64 @@ -299,13 +299,13 @@ func (a Int64) DivMod(b Int64) (quo Int64, rem Int64) { return } -func (a Int64) And(b Int64) (c Int64) { return a.Uint64().And(b.Uint64()).Int64() } +func (a Int64) And(b Int64) (c Int64) { return a.Uint64().And(b.Uint64()).Int64() } -func (a Int64) AndNot(b Int64) (c Int64) { return a.Uint64().AndNot(b.Uint64()).Int64() } +func (a Int64) AndNot(b Int64) (c Int64) { return a.Uint64().AndNot(b.Uint64()).Int64() } -func (a Int64) Or(b Int64) (c Int64) { return a.Uint64().Or(b.Uint64()).Int64() } +func (a Int64) Or(b Int64) (c Int64) { return a.Uint64().Or(b.Uint64()).Int64() } -func (a Int64) Xor(b Int64) (c Int64) { return a.Uint64().Xor(b.Uint64()).Int64() } +func (a Int64) Xor(b Int64) (c Int64) { return a.Uint64().Xor(b.Uint64()).Int64() } func (a Int64) String() string { if a.hi < 0 { @@ -514,11 +514,11 @@ func varTests() { var div, mod Int64 dodiv := false var zero Int64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 // Can't divide by zero but also can't divide -0x8000...000 by -1. var bigneg = Int64{-0x80000000, 0} var minus1 = Int64{-1, ^uint32(0)} - if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 + if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 div, mod = a.DivMod(b) dodiv = true } @@ -542,7 +542,7 @@ func varTests() { var div, mod Uint64 dodiv := false var zero Uint64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 div, mod = a.DivMod(b) dodiv = true } @@ -661,11 +661,11 @@ func constTests() { var div, mod Int64 dodiv := false var zero Int64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 // Can't divide by zero but also can't divide -0x8000...000 by -1. var bigneg = Int64{-0x80000000, 0} var minus1 = Int64{-1, ^uint32(0)} - if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 + if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1 div, mod = a.DivMod(b) dodiv = true } @@ -692,7 +692,7 @@ func constTests() { var div, mod Uint64 dodiv := false var zero Uint64 - if b.Cmp(zero) != 0 { // b != 0 + if b.Cmp(zero) != 0 { // b != 0 div, mod = a.DivMod(b) dodiv = true } diff --git a/test/align.go b/test/align.go index 6e33983275..61d07c49b8 100644 --- a/test/align.go +++ b/test/align.go @@ -13,7 +13,7 @@ package main // introduced by CL 102036. type T struct { pad uint32 - f float64 + f float64 } //go:noinline diff --git a/test/assign1.go b/test/assign1.go index eabf10062d..b9e0325ce8 100644 --- a/test/assign1.go +++ b/test/assign1.go @@ -214,6 +214,7 @@ func main() { ps1 = ps0 // ERROR "cannot use|incompatible" ps1 = ps // ERROR "cannot use|incompatible" + a0 = [10]int(a) a0 = [10]int(a1) a = A(a0) @@ -235,8 +236,8 @@ func main() { c1 = C1(c0) c1 = C1(c) - f0 = (func() int)(f) - f0 = (func() int)(f1) + f0 = func() int(f) + f0 = func() int(f1) f = F(f0) f = F(f1) f1 = F1(f0) diff --git a/test/bigmap.go b/test/bigmap.go index 77ff8243c5..c5e4f91e11 100644 --- a/test/bigmap.go +++ b/test/bigmap.go @@ -35,6 +35,7 @@ func main() { cmp(m[1], seq(11, 13)) cmp(m[2], seq(2, 9)) cmp(m[3], seq(3, 17)) + { type T [1]byte @@ -46,7 +47,7 @@ func main() { println(x, y) panic("bad map") } - } + } { type T [100]byte type V [1]byte @@ -133,6 +134,6 @@ func main() { if x, y := m[T{}][0], m[T{1}][0]; x != 1 || y != 2 { println(x, y) panic("bad map") - } - } + } + } } diff --git a/test/blank1.go b/test/blank1.go index a29992c367..bf94d1a0fb 100644 --- a/test/blank1.go +++ b/test/blank1.go @@ -7,7 +7,7 @@ // Test that incorrect uses of the blank identifer are caught. // Does not compile. -package _ // ERROR "invalid package name _" +package _ // ERROR "invalid package name _" var t struct { _ int @@ -18,15 +18,15 @@ func (x int) _() { // ERROR "cannot define new methods on non-local type" } type T struct { - _ []int + _ []int } func main() { - _() // ERROR "cannot use _ as value" - x := _ + 1 // ERROR "cannot use _ as value" + _() // ERROR "cannot use _ as value" + x := _+1 // ERROR "cannot use _ as value" _ = x _ = t._ // ERROR "cannot refer to blank field|invalid use of" - var v1, v2 T - _ = v1 == v2 // ERROR "cannot be compared|non-comparable" + var v1, v2 T + _ = v1 == v2 // ERROR "cannot be compared|non-comparable" } diff --git a/test/char_lit.go b/test/char_lit.go index e452db952e..836c3c1a2d 100644 --- a/test/char_lit.go +++ b/test/char_lit.go @@ -11,7 +11,8 @@ package main import "os" func main() { - var i uint64 = ' ' + + var i uint64 = + ' ' + 'a' + 'ä' + '本' + diff --git a/test/closedchan.go b/test/closedchan.go index 5221d257b4..043a92d388 100644 --- a/test/closedchan.go +++ b/test/closedchan.go @@ -18,7 +18,7 @@ var failed bool type Chan interface { Send(int) Nbsend(int) bool - Recv() int + Recv() (int) Nbrecv() (int, bool) Recv2() (int, bool) Nbrecv2() (int, bool, bool) @@ -214,6 +214,7 @@ func (c SSChan) Impl() string { return "(select)" } + func shouldPanic(f func()) { defer func() { if recover() == nil { @@ -317,13 +318,13 @@ func closedasync() chan int { return c } -var mks = []func(chan int) Chan{ +var mks = []func(chan int) Chan { func(c chan int) Chan { return XChan(c) }, func(c chan int) Chan { return SChan(c) }, func(c chan int) Chan { return SSChan(c) }, } -var testcloseds = []func(Chan){ +var testcloseds = []func(Chan) { testasync1, testasync2, testasync3, @@ -334,18 +335,18 @@ func main() { for _, mk := range mks { test1(mk(closedsync())) } - + for _, testclosed := range testcloseds { for _, mk := range mks { testclosed(mk(closedasync())) } } - - var ch chan int + + var ch chan int shouldPanic(func() { close(ch) }) - + ch = make(chan int) close(ch) shouldPanic(func() { diff --git a/test/closure1.go b/test/closure1.go index ff78f8af8f..586998203a 100644 --- a/test/closure1.go +++ b/test/closure1.go @@ -16,4 +16,4 @@ func main() { panic("x != 1") } }() -} +} \ No newline at end of file diff --git a/test/closure2.go b/test/closure2.go index 3254775fcc..4d61b45d3f 100644 --- a/test/closure2.go +++ b/test/closure2.go @@ -90,7 +90,7 @@ func main() { q++ g = func() int { return q // test that we capture by ref here - // q++ must on a different decldepth than q declaration + // q++ must on a different decldepth than q declaration } } if g() != 2 { @@ -108,7 +108,7 @@ func main() { }()] = range [2]int{} { g = func() int { return q // test that we capture by ref here - // q++ must on a different decldepth than q declaration + // q++ must on a different decldepth than q declaration } } if g() != 2 { diff --git a/test/cmplxdivide1.go b/test/cmplxdivide1.go index eac84d763d..a52fb6fbcf 100644 --- a/test/cmplxdivide1.go +++ b/test/cmplxdivide1.go @@ -6,9 +6,9 @@ package main import "math" var ( - nan = math.NaN() - inf = math.Inf(1) - zero = 0.0 + nan = math.NaN() + inf = math.Inf(1) + zero = 0.0 ) var tests = []struct { diff --git a/test/complit1.go b/test/complit1.go index 3c01fe95cb..83695a9e88 100644 --- a/test/complit1.go +++ b/test/complit1.go @@ -53,13 +53,13 @@ var ( type M map[T]T var ( - _ = M{{i: 1}: {i: 2}} - _ = M{T{i: 1}: {i: 2}} - _ = M{{i: 1}: T{i: 2}} - _ = M{T{i: 1}: T{i: 2}} + _ = M{{i:1}: {i:2}} + _ = M{T{i:1}: {i:2}} + _ = M{{i:1}: T{i:2}} + _ = M{T{i:1}: T{i:2}} ) -type S struct{ s [1]*M1 } +type S struct { s [1]*M1 } type M1 map[S]int +var _ = M1{{s:[1]*M1{&M1{{}:1}}}:2} -var _ = M1{{s: [1]*M1{&M1{{}: 1}}}: 2} diff --git a/test/const1.go b/test/const1.go index f393026a2a..3fd5b55522 100644 --- a/test/const1.go +++ b/test/const1.go @@ -87,8 +87,8 @@ func main() { f(Bool) // ERROR "convert|wrong type|cannot|incompatible" } -const ptr = nil // ERROR "const.*nil" -const _ = string([]byte(nil)) // ERROR "is not a? ?constant" +const ptr = nil // ERROR "const.*nil" +const _ = string([]byte(nil)) // ERROR "is not a? ?constant" const _ = uintptr(unsafe.Pointer((*int)(nil))) // ERROR "is not a? ?constant" -const _ = unsafe.Pointer((*int)(nil)) // ERROR "cannot be nil|invalid constant type|is not a constant" -const _ = (*int)(nil) // ERROR "cannot be nil|invalid constant type|is not a constant" +const _ = unsafe.Pointer((*int)(nil)) // ERROR "cannot be nil|invalid constant type|is not a constant" +const _ = (*int)(nil) // ERROR "cannot be nil|invalid constant type|is not a constant" diff --git a/test/const3.go b/test/const3.go index 28cce0e6d6..3f4e3d1ae6 100644 --- a/test/const3.go +++ b/test/const3.go @@ -29,7 +29,7 @@ func main() { panic("fail") } x := uint(5) - y := float64(uint64(1) << x) // used to fail to compile + y := float64(uint64(1)<>= 1 } - return q, x + return q, x } // signed divide and mod: do unsigned and adjust signs. diff --git a/test/dwarf/dwarf.dir/main.go b/test/dwarf/dwarf.dir/main.go index 732be1c180..175a09c779 100644 --- a/test/dwarf/dwarf.dir/main.go +++ b/test/dwarf/dwarf.dir/main.go @@ -8,26 +8,25 @@ // license that can be found in the LICENSE file. package main - func main() { - F1() - F2() - F3() - F4() - F5() - F6() - F7() - F8() - F9() - F10() - F11() - F12() - F13() - F14() - F15() - F16() - F17() - F18() - F19() - F20() +F1() +F2() +F3() +F4() +F5() +F6() +F7() +F8() +F9() +F10() +F11() +F12() +F13() +F14() +F15() +F16() +F17() +F18() +F19() +F20() } diff --git a/test/dwarf/dwarf.dir/z1.go b/test/dwarf/dwarf.dir/z1.go index 1cda10aa65..7f163e9a1d 100644 --- a/test/dwarf/dwarf.dir/z1.go +++ b/test/dwarf/dwarf.dir/z1.go @@ -1,4 +1,5 @@ + + //line x1.go:4 package main - func F1() {} diff --git a/test/dwarf/dwarf.dir/z10.go b/test/dwarf/dwarf.dir/z10.go index 1217cbffd8..19c70020e0 100644 --- a/test/dwarf/dwarf.dir/z10.go +++ b/test/dwarf/dwarf.dir/z10.go @@ -1,4 +1,6 @@ + + + //line x10.go:4 package main - func F10() {} diff --git a/test/dwarf/dwarf.dir/z11.go b/test/dwarf/dwarf.dir/z11.go index c0350e2e9d..c1d2f9180f 100644 --- a/test/dwarf/dwarf.dir/z11.go +++ b/test/dwarf/dwarf.dir/z11.go @@ -1,4 +1,4 @@ + //line x11.go:4 package main - func F11() {} diff --git a/test/dwarf/dwarf.dir/z12.go b/test/dwarf/dwarf.dir/z12.go index 07d8fde60f..7455f18946 100644 --- a/test/dwarf/dwarf.dir/z12.go +++ b/test/dwarf/dwarf.dir/z12.go @@ -1,4 +1,4 @@ + //line x12.go:4 package main - func F12() {} diff --git a/test/dwarf/dwarf.dir/z13.go b/test/dwarf/dwarf.dir/z13.go index 2986c6ba1a..ecb3c4c8c7 100644 --- a/test/dwarf/dwarf.dir/z13.go +++ b/test/dwarf/dwarf.dir/z13.go @@ -1,4 +1,4 @@ + //line x13.go:4 package main - func F13() {} diff --git a/test/dwarf/dwarf.dir/z14.go b/test/dwarf/dwarf.dir/z14.go index 742e1eecf1..134b39b64e 100644 --- a/test/dwarf/dwarf.dir/z14.go +++ b/test/dwarf/dwarf.dir/z14.go @@ -1,4 +1,4 @@ + //line x14.go:4 package main - func F14() {} diff --git a/test/dwarf/dwarf.dir/z15.go b/test/dwarf/dwarf.dir/z15.go index 971ad7e8bf..d73819b443 100644 --- a/test/dwarf/dwarf.dir/z15.go +++ b/test/dwarf/dwarf.dir/z15.go @@ -1,4 +1,4 @@ + //line x15.go:4 package main - func F15() {} diff --git a/test/dwarf/dwarf.dir/z16.go b/test/dwarf/dwarf.dir/z16.go index 3a00057740..6c31651baa 100644 --- a/test/dwarf/dwarf.dir/z16.go +++ b/test/dwarf/dwarf.dir/z16.go @@ -1,4 +1,4 @@ + //line x16.go:4 package main - func F16() {} diff --git a/test/dwarf/dwarf.dir/z17.go b/test/dwarf/dwarf.dir/z17.go index d5fbd62531..b742d16726 100644 --- a/test/dwarf/dwarf.dir/z17.go +++ b/test/dwarf/dwarf.dir/z17.go @@ -1,4 +1,4 @@ + //line x17.go:4 package main - func F17() {} diff --git a/test/dwarf/dwarf.dir/z18.go b/test/dwarf/dwarf.dir/z18.go index 16750d9f37..84150ff0a3 100644 --- a/test/dwarf/dwarf.dir/z18.go +++ b/test/dwarf/dwarf.dir/z18.go @@ -1,4 +1,5 @@ + + //line x18.go:4 package main - func F18() {} diff --git a/test/dwarf/dwarf.dir/z19.go b/test/dwarf/dwarf.dir/z19.go index ae57364790..bb2e296841 100644 --- a/test/dwarf/dwarf.dir/z19.go +++ b/test/dwarf/dwarf.dir/z19.go @@ -1,4 +1,4 @@ + //line x19.go:4 package main - func F19() {} diff --git a/test/dwarf/dwarf.dir/z2.go b/test/dwarf/dwarf.dir/z2.go index daba026c10..68bd58257d 100644 --- a/test/dwarf/dwarf.dir/z2.go +++ b/test/dwarf/dwarf.dir/z2.go @@ -1,4 +1,4 @@ + //line x2.go:4 package main - func F2() {} diff --git a/test/dwarf/dwarf.dir/z20.go b/test/dwarf/dwarf.dir/z20.go index 15ad35c3e7..03111e1845 100644 --- a/test/dwarf/dwarf.dir/z20.go +++ b/test/dwarf/dwarf.dir/z20.go @@ -1,4 +1,4 @@ + //line x20.go:4 package main - func F20() {} diff --git a/test/dwarf/dwarf.dir/z3.go b/test/dwarf/dwarf.dir/z3.go index 46f05b92ff..5e4ad3ae25 100644 --- a/test/dwarf/dwarf.dir/z3.go +++ b/test/dwarf/dwarf.dir/z3.go @@ -1,4 +1,4 @@ + //line x3.go:4 package main - func F3() {} diff --git a/test/dwarf/dwarf.dir/z4.go b/test/dwarf/dwarf.dir/z4.go index c3fd6e37b8..1f28465c57 100644 --- a/test/dwarf/dwarf.dir/z4.go +++ b/test/dwarf/dwarf.dir/z4.go @@ -1,4 +1,4 @@ + //line x4.go:4 package main - func F4() {} diff --git a/test/dwarf/dwarf.dir/z5.go b/test/dwarf/dwarf.dir/z5.go index 3b6f8b7a63..7f4eeb419a 100644 --- a/test/dwarf/dwarf.dir/z5.go +++ b/test/dwarf/dwarf.dir/z5.go @@ -1,4 +1,4 @@ + //line x5.go:4 package main - func F5() {} diff --git a/test/dwarf/dwarf.dir/z6.go b/test/dwarf/dwarf.dir/z6.go index d18a067aae..241791dff2 100644 --- a/test/dwarf/dwarf.dir/z6.go +++ b/test/dwarf/dwarf.dir/z6.go @@ -1,4 +1,4 @@ + //line x6.go:4 package main - func F6() {} diff --git a/test/dwarf/dwarf.dir/z7.go b/test/dwarf/dwarf.dir/z7.go index 10bc1a9e56..68c1ad0c24 100644 --- a/test/dwarf/dwarf.dir/z7.go +++ b/test/dwarf/dwarf.dir/z7.go @@ -1,4 +1,4 @@ + //line x7.go:4 package main - func F7() {} diff --git a/test/dwarf/dwarf.dir/z8.go b/test/dwarf/dwarf.dir/z8.go index 3b17a9d88b..16eed32a28 100644 --- a/test/dwarf/dwarf.dir/z8.go +++ b/test/dwarf/dwarf.dir/z8.go @@ -1,4 +1,4 @@ + //line x8.go:4 package main - func F8() {} diff --git a/test/dwarf/dwarf.dir/z9.go b/test/dwarf/dwarf.dir/z9.go index 3af6b317b5..cbb94b4d2b 100644 --- a/test/dwarf/dwarf.dir/z9.go +++ b/test/dwarf/dwarf.dir/z9.go @@ -1,4 +1,4 @@ + //line x9.go:4 package main - func F9() {} diff --git a/test/dwarf/linedirectives.go b/test/dwarf/linedirectives.go index 3fae427ac4..cc4ffb000f 100644 --- a/test/dwarf/linedirectives.go +++ b/test/dwarf/linedirectives.go @@ -6,9 +6,8 @@ //line foo/bar.y:4 package main - //line foo/bar.y:60 -func main() { +func main() { //line foo/bar.y:297 f, l := 0, 0 //line yacctab:1 @@ -72,7 +71,7 @@ func main() { //line foo/bar.y:272 if l == f { //line foo/bar.y:277 - panic("aie!") + panic("aie!") //line foo/bar.y:281 } //line foo/bar.y:285 @@ -80,6 +79,5 @@ func main() { //line foo/bar.y:288 //line foo/bar.y:290 } - //line foo/bar.y:293 //line foo/bar.y:295 diff --git a/test/empty.go b/test/empty.go index 8ac3907106..92a79a4e0d 100644 --- a/test/empty.go +++ b/test/empty.go @@ -9,10 +9,7 @@ package P -import () - -const () - -var () - -type () +import ( ) +const ( ) +var ( ) +type ( ) diff --git a/test/eof.go b/test/eof.go index b142dd83c9..d051f33bf7 100644 --- a/test/eof.go +++ b/test/eof.go @@ -9,4 +9,4 @@ // No newline at the end of this file. -package main +package main \ No newline at end of file diff --git a/test/eof1.go b/test/eof1.go index 192f207bfc..90792ca76e 100644 --- a/test/eof1.go +++ b/test/eof1.go @@ -9,4 +9,4 @@ package eof1 -// No newline at the end of this comment. +// No newline at the end of this comment. \ No newline at end of file diff --git a/test/escape2.go b/test/escape2.go index 758da81a6d..f682621c25 100644 --- a/test/escape2.go +++ b/test/escape2.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1534,7 +1534,7 @@ func NewV(u U) *V { // ERROR "leaking param: u$" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1642,7 +1642,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/escape2n.go b/test/escape2n.go index c6cf4b4e15..2fd26f7c5c 100644 --- a/test/escape2n.go +++ b/test/escape2n.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1534,7 +1534,7 @@ func NewV(u U) *V { // ERROR "leaking param: u$" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1642,7 +1642,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/escape4.go b/test/escape4.go index 0c95426915..a4a9c14a3e 100644 --- a/test/escape4.go +++ b/test/escape4.go @@ -42,7 +42,7 @@ func f5() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new.T. escapes to heap" + t := new(T) // ERROR "new.T. escapes to heap" return &t.x[0] } @@ -52,6 +52,6 @@ func f6() *byte { y byte } } - t := new(T) // ERROR "new.T. escapes to heap" + t := new(T) // ERROR "new.T. escapes to heap" return &t.x.y } diff --git a/test/escape_closure.go b/test/escape_closure.go index d0406c4268..cf055d3b34 100644 --- a/test/escape_closure.go +++ b/test/escape_closure.go @@ -50,7 +50,7 @@ func ClosureCallArgs4() { } func ClosureCallArgs5() { - x := 0 // ERROR "moved to heap: x" + x := 0 // ERROR "moved to heap: x" // TODO(mdempsky): We get "leaking param: p" here because the new escape analysis pass // can tell that p flows directly to sink, but it's a little weird. Re-evaluate. sink = func(p *int) *int { // ERROR "leaking param: p" "func literal does not escape" "\(func literal\)\(&x\) escapes to heap" @@ -132,7 +132,7 @@ func ClosureCallArgs14() { } func ClosureCallArgs15() { - x := 0 // ERROR "moved to heap: x" + x := 0 // ERROR "moved to heap: x" p := &x sink = func(p **int) *int { // ERROR "leaking param content: p" "func literal does not escape" "\(func literal\)\(&p\) escapes to heap" return *p diff --git a/test/escape_field.go b/test/escape_field.go index 7eefeebe71..5d5a6f36b4 100644 --- a/test/escape_field.go +++ b/test/escape_field.go @@ -39,7 +39,7 @@ func field3() { i := 0 // ERROR "moved to heap: i$" var x X x.p1 = &i - sink = x // ERROR "x escapes to heap" + sink = x // ERROR "x escapes to heap" } func field4() { @@ -113,16 +113,16 @@ func field10() { } func field11() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x := X{p1: &i} - sink = x.p1 // ERROR "x\.p1 escapes to heap" + sink = x.p1 // ERROR "x\.p1 escapes to heap" } func field12() { i := 0 // ERROR "moved to heap: i$" // BAD: &i should not escape x := X{p1: &i} - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 // ERROR "x\.p2 escapes to heap" } func field13() { diff --git a/test/escape_iface.go b/test/escape_iface.go index 772e7e23e6..50c69cd5c1 100644 --- a/test/escape_iface.go +++ b/test/escape_iface.go @@ -37,7 +37,7 @@ func efaceEscape0() { _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" sink = x // ERROR "x escapes to heap" @@ -50,7 +50,7 @@ func efaceEscape0() { _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" @@ -58,14 +58,14 @@ func efaceEscape0() { sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" mescapes(x) @@ -91,46 +91,46 @@ func efaceEscape1() { { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" - sink = x // ERROR "x escapes to heap" + var x M = v // ERROR "v escapes to heap" + sink = x // ERROR "x escapes to heap" } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" v1 := x.(M1) _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} var x M = v // ERROR "efaceEscape1 v does not escape" v1 := x.(M1) sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" + var x M = v // ERROR "v escapes to heap" mescapes(x) } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" mdoesnotescape(x) } } @@ -244,7 +244,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = i // ERROR "i does not escape" var y interface{} = j // ERROR "j does not escape" - sink = x.(int) // ERROR "x.\(int\) escapes to heap" + sink = x.(int) // ERROR "x.\(int\) escapes to heap" sink, *(&ok) = y.(int) } { @@ -254,7 +254,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = &i // ERROR "&i escapes to heap" var y interface{} = &j // ERROR "&j escapes to heap" - sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" + sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" sink, *(&ok) = y.(*int) } } diff --git a/test/escape_indir.go b/test/escape_indir.go index cb6a2205c7..ce21ea821f 100644 --- a/test/escape_indir.go +++ b/test/escape_indir.go @@ -54,14 +54,14 @@ func constptr1() { i := 0 // ERROR "moved to heap: i" x := &ConstPtr{} // ERROR "&ConstPtr literal escapes to heap" x.p = &i - sink = x // ERROR "x escapes to heap" + sink = x // ERROR "x escapes to heap" } func constptr2() { i := 0 // ERROR "moved to heap: i" x := &ConstPtr{} // ERROR "&ConstPtr literal does not escape" x.p = &i - sink = *x // ERROR "\*x escapes to heap" + sink = *x // ERROR "\*x escapes to heap" } func constptr4() *ConstPtr { @@ -102,7 +102,7 @@ func constptr8() *ConstPtr { func constptr9() ConstPtr { p := new(ConstPtr) // ERROR "new\(ConstPtr\) does not escape" var p1 ConstPtr2 - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p1.p = &i p.c = p1 return *p @@ -134,7 +134,7 @@ func foo(p **int) { // ERROR "foo p does not escape" } func foo1(p *int) { // ERROR "p does not escape" - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" y := &p *y = &i } @@ -148,13 +148,13 @@ func foo2() { var z Z z.f = &x p := z.f - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" *p = &i } var global *byte func f() { - var x byte // ERROR "moved to heap: x" + var x byte // ERROR "moved to heap: x" global = &*&x } diff --git a/test/escape_level.go b/test/escape_level.go index e5a0f50273..44a23e5a4d 100644 --- a/test/escape_level.go +++ b/test/escape_level.go @@ -27,15 +27,15 @@ func level1() { } func level2() { - i := 0 // ERROR "moved to heap: i" - p0 := &i // ERROR "moved to heap: p0" + i := 0 // ERROR "moved to heap: i" + p0 := &i // ERROR "moved to heap: p0" p1 := &p0 p2 := &p1 sink = *p2 // ERROR "\*p2 escapes to heap" } func level3() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 p2 := &p1 @@ -43,23 +43,23 @@ func level3() { } func level4() { - i := 0 // ERROR "moved to heap: i" - p0 := &i // ERROR "moved to heap: p0" + i := 0 // ERROR "moved to heap: i" + p0 := &i // ERROR "moved to heap: p0" p1 := &p0 p2 := p1 // ERROR "moved to heap: p2" sink = &p2 // ERROR "&p2 escapes to heap" } func level5() { - i := 0 // ERROR "moved to heap: i" - p0 := &i // ERROR "moved to heap: p0" + i := 0 // ERROR "moved to heap: i" + p0 := &i // ERROR "moved to heap: p0" p1 := &p0 p2 := p1 sink = p2 // ERROR "p2 escapes to heap" } func level6() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 p2 := p1 @@ -67,7 +67,7 @@ func level6() { } func level7() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 // note *p1 == &i @@ -76,7 +76,7 @@ func level7() { } func level8() { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" p0 := &i p1 := &p0 p2 := *p1 diff --git a/test/escape_map.go b/test/escape_map.go index d17c457ec7..9912b55a35 100644 --- a/test/escape_map.go +++ b/test/escape_map.go @@ -15,7 +15,7 @@ func map0() { // BAD: i should not escape i := 0 // ERROR "moved to heap: i" // BAD: j should not escape - j := 0 // ERROR "moved to heap: j" + j := 0 // ERROR "moved to heap: j" m[&i] = &j _ = m } @@ -23,8 +23,8 @@ func map0() { func map1() *int { m := make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j return m[&i] } @@ -41,7 +41,7 @@ func map3() []*int { m := make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" i := 0 // ERROR "moved to heap: i" // BAD: j should not escape - j := 0 // ERROR "moved to heap: j" + j := 0 // ERROR "moved to heap: j" m[&i] = &j var r []*int for k := range m { @@ -53,8 +53,8 @@ func map3() []*int { func map4() []*int { m := make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j var r []*int for k, v := range m { @@ -68,8 +68,8 @@ func map4() []*int { } func map5(m map[*int]*int) { // ERROR "m does not escape" - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j } @@ -77,8 +77,8 @@ func map6(m map[*int]*int) { // ERROR "m does not escape" if m != nil { m = make(map[*int]*int) // ERROR "make\(map\[\*int\]\*int\) does not escape" } - i := 0 // ERROR "moved to heap: i" - j := 0 // ERROR "moved to heap: j" + i := 0 // ERROR "moved to heap: i" + j := 0 // ERROR "moved to heap: j" m[&i] = &j } @@ -95,7 +95,7 @@ func map8() { i := 0 // ERROR "moved to heap: i" j := 0 // ERROR "moved to heap: j" m := map[*int]*int{&i: &j} // ERROR "literal escapes to heap" - sink = m // ERROR "m escapes to heap" + sink = m // ERROR "m escapes to heap" } func map9() *int { diff --git a/test/escape_param.go b/test/escape_param.go index b063d9c3d3..2097556744 100644 --- a/test/escape_param.go +++ b/test/escape_param.go @@ -57,7 +57,7 @@ func caller2b() { i := 0 // ERROR "moved to heap: i$" var p *int param2(&i, &p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } func paramArraySelfAssign(p *PairOfPairs) { // ERROR "p does not escape" @@ -150,11 +150,11 @@ func caller3a() { } func caller3b() { - i := 0 // ERROR "moved to heap: i$" - j := 0 // ERROR "moved to heap: j$" + i := 0 // ERROR "moved to heap: i$" + j := 0 // ERROR "moved to heap: j$" p := Pair{&i, &j} param3(&p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> rcvr @@ -173,7 +173,7 @@ func caller4b() { i := 0 // ERROR "moved to heap: i$" p := Pair{} p.param4(&i) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> heap @@ -182,7 +182,7 @@ func param5(i *int) { // ERROR "leaking param: i$" } func caller5() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" param5(&i) } @@ -192,8 +192,8 @@ func param6(i ***int) { // ERROR "leaking param content: i$" } func caller6a() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param6(&p2) } @@ -204,8 +204,8 @@ func param7(i ***int) { // ERROR "leaking param content: i$" } func caller7() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param7(&p2) } @@ -234,8 +234,8 @@ func caller9a() { } func caller9b() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p sink = param9(&p2) // ERROR "param9\(&p2\) escapes to heap" } @@ -253,7 +253,7 @@ func caller10a() { } func caller10b() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" p := &i p2 := &p sink = param10(&p2) // ERROR "param10\(&p2\) escapes to heap" @@ -265,8 +265,8 @@ func param11(i **int) ***int { // ERROR "moved to heap: i$" } func caller11a() { - i := 0 // ERROR "moved to heap: i" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i" + p := &i // ERROR "moved to heap: p" _ = param11(&p) } @@ -283,8 +283,8 @@ func caller11c() { // GOOD } func caller11d() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p" p2 := &p sink = param11(p2) // ERROR "param11\(p2\) escapes to heap" } @@ -319,7 +319,7 @@ func caller12c() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = r // ERROR "r escapes to heap$" + sink = r // ERROR "r escapes to heap$" } func caller12d() { @@ -327,7 +327,7 @@ func caller12d() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" + sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" } // in -> value rcvr @@ -370,15 +370,15 @@ func caller13d() { var v Val v.p = &p v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13e() { - i := 0 // ERROR "moved to heap: i$" - var p *int // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + var p *int // ERROR "moved to heap: p$" v := Val{&p} v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13f() { @@ -386,7 +386,7 @@ func caller13f() { var p *int // ERROR "moved to heap: p$" v := &Val{&p} // ERROR "&Val literal escapes to heap$" v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13g() { @@ -394,7 +394,7 @@ func caller13g() { var p *int v := Val{&p} v.param13(&i) - sink = *v.p // ERROR "\*v\.p escapes to heap" + sink = *v.p // ERROR "\*v\.p escapes to heap" } func caller13h() { @@ -402,7 +402,7 @@ func caller13h() { var p *int v := &Val{&p} // ERROR "caller13h &Val literal does not escape$" v.param13(&i) - sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" + sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" } type Node struct { diff --git a/test/escape_slice.go b/test/escape_slice.go index 40a5ad372c..03053cf326 100644 --- a/test/escape_slice.go +++ b/test/escape_slice.go @@ -18,28 +18,28 @@ var sink interface{} func slice0() { var s []*int // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) _ = s } func slice1() *int { var s []*int - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) return s[0] } func slice2() []*int { var s []*int - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) return s } func slice3() *int { var s []*int - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s = append(s, &i) for _, p := range s { return p @@ -48,7 +48,7 @@ func slice3() *int { } func slice4(s []*int) { // ERROR "s does not escape" - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s[0] = &i } @@ -56,14 +56,14 @@ func slice5(s []*int) { // ERROR "s does not escape" if s != nil { s = make([]*int, 10) // ERROR "make\(\[\]\*int, 10\) does not escape" } - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s[0] = &i } func slice6() { s := make([]*int, 10) // ERROR "make\(\[\]\*int, 10\) does not escape" // BAD: i should not escape - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" s[0] = &i _ = s } diff --git a/test/escape_struct_param1.go b/test/escape_struct_param1.go index 5242a507c7..7004946e2f 100644 --- a/test/escape_struct_param1.go +++ b/test/escape_struct_param1.go @@ -35,7 +35,7 @@ func (u *U) SPPi() *string { // ERROR "leaking param: u to result ~r0 level=2$" } func tSPPi() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tSPPi &U literal does not escape$" @@ -43,7 +43,7 @@ func tSPPi() { } func tiSPP() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tiSPP &U literal does not escape$" @@ -52,8 +52,8 @@ func tiSPP() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of ps func tSP() { - s := "cat" // ERROR "moved to heap: s$" - ps := &s // ERROR "moved to heap: ps$" + s := "cat" // ERROR "moved to heap: s$" + ps := &s // ERROR "moved to heap: ps$" pps := &ps pu := &U{ps, pps} // ERROR "tSP &U literal does not escape$" Ssink = pu.SP() @@ -114,14 +114,14 @@ func (v *V) UPiSPd() *string { // ERROR "leaking param: v to result ~r0 level=2$ // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPa() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPa &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -132,14 +132,14 @@ func tUPiSPa() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPb() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPb &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -150,14 +150,14 @@ func tUPiSPb() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPc() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPc &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -168,14 +168,14 @@ func tUPiSPc() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPd() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPd &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -204,12 +204,12 @@ func tUPiSPPia() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPia &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPia &U literal does not escape$" @@ -222,12 +222,12 @@ func tUPiSPPib() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPib &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPib &U literal does not escape$" @@ -240,12 +240,12 @@ func tUPiSPPic() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPic &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPic &U literal does not escape$" @@ -258,12 +258,12 @@ func tUPiSPPid() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPid &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPid &U literal does not escape$" @@ -286,7 +286,7 @@ func tUPPiSPPia() { s3 := "cat" s4 := "dog" s5 := "emu" - s6 := "fox" // ERROR "moved to heap: s6$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 ps6 := &s6 diff --git a/test/escape_struct_param2.go b/test/escape_struct_param2.go index 76dc35ccf0..5a9b271958 100644 --- a/test/escape_struct_param2.go +++ b/test/escape_struct_param2.go @@ -35,7 +35,7 @@ func (u U) SPPi() *string { // ERROR "leaking param: u to result ~r0 level=1$" } func tSPPi() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tSPPi &U literal does not escape$" @@ -43,7 +43,7 @@ func tSPPi() { } func tiSPP() { - s := "cat" // ERROR "moved to heap: s$" + s := "cat" // ERROR "moved to heap: s$" ps := &s pps := &ps pu := &U{ps, pps} // ERROR "tiSPP &U literal does not escape$" @@ -52,8 +52,8 @@ func tiSPP() { // BAD: need fine-grained analysis to avoid spurious escape of ps func tSP() { - s := "cat" // ERROR "moved to heap: s$" - ps := &s // ERROR "moved to heap: ps$" + s := "cat" // ERROR "moved to heap: s$" + ps := &s // ERROR "moved to heap: ps$" pps := &ps pu := &U{ps, pps} // ERROR "tSP &U literal does not escape$" Ssink = pu.SP() @@ -114,14 +114,14 @@ func (v V) UPiSPd() *string { // ERROR "leaking param: v to result ~r0 level=1$" // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPa() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPa &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -132,14 +132,14 @@ func tUPiSPa() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPb() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPb &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -150,14 +150,14 @@ func tUPiSPb() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPc() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPc &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -168,14 +168,14 @@ func tUPiSPc() { // BAD: need fine-grained (field-sensitive) analysis to avoid spurious escape of all but &s3 func tUPiSPd() { s1 := "ant" - s2 := "bat" // ERROR "moved to heap: s2$" - s3 := "cat" // ERROR "moved to heap: s3$" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s2 := "bat" // ERROR "moved to heap: s2$" + s3 := "cat" // ERROR "moved to heap: s3$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 - ps4 := &s4 // ERROR "moved to heap: ps4$" - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps4 := &s4 // ERROR "moved to heap: ps4$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPd &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "&U literal escapes to heap$" @@ -204,12 +204,12 @@ func tUPiSPPia() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPia &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPia &U literal does not escape$" @@ -222,12 +222,12 @@ func tUPiSPPib() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPib &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPib &U literal does not escape$" @@ -240,12 +240,12 @@ func tUPiSPPic() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPic &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPic &U literal does not escape$" @@ -258,12 +258,12 @@ func tUPiSPPid() { s1 := "ant" s2 := "bat" s3 := "cat" - s4 := "dog" // ERROR "moved to heap: s4$" - s5 := "emu" // ERROR "moved to heap: s5$" - s6 := "fox" // ERROR "moved to heap: s6$" + s4 := "dog" // ERROR "moved to heap: s4$" + s5 := "emu" // ERROR "moved to heap: s5$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 - ps6 := &s6 // ERROR "moved to heap: ps6$" + ps6 := &s6 // ERROR "moved to heap: ps6$" u1 := U{&s1, &ps2} u2 := &U{&s3, &ps4} // ERROR "tUPiSPPid &U literal does not escape$" u3 := &U{&s5, &ps6} // ERROR "tUPiSPPid &U literal does not escape$" @@ -286,7 +286,7 @@ func tUPPiSPPia() { // This test is sensitive to the level cap in function summa s3 := "cat" s4 := "dog" s5 := "emu" - s6 := "fox" // ERROR "moved to heap: s6$" + s6 := "fox" // ERROR "moved to heap: s6$" ps2 := &s2 ps4 := &s4 ps6 := &s6 diff --git a/test/finprofiled.go b/test/finprofiled.go index 267e15b9af..0eb801a4bd 100644 --- a/test/finprofiled.go +++ b/test/finprofiled.go @@ -23,7 +23,7 @@ func main() { // only for middle bytes. The finalizer resurrects that object. // As the result, all allocated memory must stay alive. const ( - N = 1 << 20 + N = 1 << 20 tinyBlockSize = 16 // runtime._TinySize ) hold := make([]*int32, 0, N) diff --git a/test/fixedbugs/bug000.go b/test/fixedbugs/bug000.go index a0a9a654ad..9104a57aaf 100644 --- a/test/fixedbugs/bug000.go +++ b/test/fixedbugs/bug000.go @@ -7,16 +7,14 @@ package main func main() { - var x int + var x int; switch x { case 0: - { - } + {} case 1: - x = 0 + x = 0; } } - /* bug0.go:8: case statement out of place */ diff --git a/test/fixedbugs/bug002.go b/test/fixedbugs/bug002.go index 89b989cb85..3493426d37 100644 --- a/test/fixedbugs/bug002.go +++ b/test/fixedbugs/bug002.go @@ -7,6 +7,5 @@ package main func main() { - if false { - } // compiles; should be an error (should be simplevardecl before ;) + if ; false {} // compiles; should be an error (should be simplevardecl before ;) } diff --git a/test/fixedbugs/bug003.go b/test/fixedbugs/bug003.go index 1602630c39..7165d9d209 100644 --- a/test/fixedbugs/bug003.go +++ b/test/fixedbugs/bug003.go @@ -7,14 +7,8 @@ package main func main() { - switch { - case true: - return - default: - return - } + switch ; { case true: return; default: return } } - /* bug003.go:6: fatal error: walkswitch: not case EMPTY */ diff --git a/test/fixedbugs/bug004.go b/test/fixedbugs/bug004.go index 4864afacb6..fb207e9bc8 100644 --- a/test/fixedbugs/bug004.go +++ b/test/fixedbugs/bug004.go @@ -7,8 +7,5 @@ package main func main() { - switch { - case false: - return - } // compiles; should be an error (should be simplevardecl before ;) + switch ; { case false: return; } // compiles; should be an error (should be simplevardecl before ;) } diff --git a/test/fixedbugs/bug005.go b/test/fixedbugs/bug005.go index d57ef6ac2d..3798f8321a 100644 --- a/test/fixedbugs/bug005.go +++ b/test/fixedbugs/bug005.go @@ -7,13 +7,11 @@ package main func main() { -Foo: - { - return + Foo: { + return; } - goto Foo + goto Foo; } - /* bug5.go:4: Foo undefined bug5.go:4: fatal error: walktype: switch 1 unknown op GOTO l(4) diff --git a/test/fixedbugs/bug008.go b/test/fixedbugs/bug008.go index 4468d74a20..48f74a52d9 100644 --- a/test/fixedbugs/bug008.go +++ b/test/fixedbugs/bug008.go @@ -7,21 +7,14 @@ package main func main() { - i5 := 5 + i5 := 5; - switch { // compiler crash fixable with 'switch true' - case i5 < 5: - dummy := 0 - _ = dummy - case i5 == 5: - dummy := 0 - _ = dummy - case i5 > 5: - dummy := 0 - _ = dummy + switch { // compiler crash fixable with 'switch true' + case i5 < 5: dummy := 0; _ = dummy; + case i5 == 5: dummy := 0; _ = dummy; + case i5 > 5: dummy := 0; _ = dummy; } } - /* Segmentation fault */ diff --git a/test/fixedbugs/bug009.go b/test/fixedbugs/bug009.go index 3db245e64e..0467b297a2 100644 --- a/test/fixedbugs/bug009.go +++ b/test/fixedbugs/bug009.go @@ -6,11 +6,10 @@ package main + func main() { - fired := false - _ = fired + fired := false; _ = fired; } - /* bug9.go:5: defaultlit: unknown literal: LITERAL-B0 a(1) bug9.go:5: fatal error: addvar: n=NAME-fired G0 a(1) l(5) t= nil diff --git a/test/fixedbugs/bug010.go b/test/fixedbugs/bug010.go index a8d3ed4cbb..f54b1d54a8 100644 --- a/test/fixedbugs/bug010.go +++ b/test/fixedbugs/bug010.go @@ -6,6 +6,7 @@ package main + func f(i int, f float64) { i = 8 f = 8.0 diff --git a/test/fixedbugs/bug011.go b/test/fixedbugs/bug011.go index 95c91a1ff9..519c3585f0 100644 --- a/test/fixedbugs/bug011.go +++ b/test/fixedbugs/bug011.go @@ -6,6 +6,7 @@ package main + type T struct { x, y int } @@ -21,7 +22,6 @@ func main() { r10 := t.m(1, 3.0) _ = r10 } - /* bug11.go:16: fatal error: walktype: switch 1 unknown op CALLMETH l(16) INT32 */ diff --git a/test/fixedbugs/bug012.go b/test/fixedbugs/bug012.go index d4ccc973a5..38efb6d979 100644 --- a/test/fixedbugs/bug012.go +++ b/test/fixedbugs/bug012.go @@ -6,24 +6,18 @@ package main + func main() { - var u30 uint64 = 0 - var u31 uint64 = 1 - _, _ = u30, u31 - var u32 uint64 = 18446744073709551615 - var u33 uint64 = +18446744073709551615 - if u32 != (1<<64)-1 { - panic("u32\n") - } - if u33 != (1<<64)-1 { - panic("u33\n") - } - var i34 int64 = ^0 // note: 2's complement means ^0 == -1 - if i34 != -1 { - panic("i34") - } + var u30 uint64 = 0; + var u31 uint64 = 1; + _, _ = u30, u31; + var u32 uint64 = 18446744073709551615; + var u33 uint64 = +18446744073709551615; + if u32 != (1<<64)-1 { panic("u32\n"); } + if u33 != (1<<64)-1 { panic("u33\n"); } + var i34 int64 = ^0; // note: 2's complement means ^0 == -1 + if i34 != -1 { panic("i34") } } - /* bug12.go:5: overflow converting constant to UINT64 bug12.go:6: overflow converting constant to UINT64 diff --git a/test/fixedbugs/bug013.go b/test/fixedbugs/bug013.go index c80fe67c5a..045786bf7a 100644 --- a/test/fixedbugs/bug013.go +++ b/test/fixedbugs/bug013.go @@ -7,11 +7,10 @@ package main func main() { - var cu0 uint16 = '\u1234' - var cU1 uint32 = '\U00101234' - _, _ = cu0, cU1 + var cu0 uint16 = '\u1234'; + var cU1 uint32 = '\U00101234'; + _, _ = cu0, cU1; } - /* bug13.go:4: missing ' bug13.go:4: syntax error diff --git a/test/fixedbugs/bug015.go b/test/fixedbugs/bug015.go index b00071e590..d3a9f22ed0 100644 --- a/test/fixedbugs/bug015.go +++ b/test/fixedbugs/bug015.go @@ -7,7 +7,7 @@ package main func main() { - var i33 int64 - if i33 == (1<<64)-1 { // ERROR "overflow" + var i33 int64; + if i33 == (1<<64) -1 { // ERROR "overflow" } } diff --git a/test/fixedbugs/bug017.go b/test/fixedbugs/bug017.go index 6201124932..2f5960d104 100644 --- a/test/fixedbugs/bug017.go +++ b/test/fixedbugs/bug017.go @@ -7,10 +7,9 @@ package main func main() { - var s2 string = "\a\b\f\n\r\t\v" // \r is miscompiled - _ = s2 + var s2 string = "\a\b\f\n\r\t\v"; // \r is miscompiled + _ = s2; } - /* main.go.c: In function ‘main_main’: main.go.c:20: error: missing terminating " character diff --git a/test/fixedbugs/bug020.go b/test/fixedbugs/bug020.go index 1dd2106b24..cde3f8679b 100644 --- a/test/fixedbugs/bug020.go +++ b/test/fixedbugs/bug020.go @@ -6,10 +6,10 @@ package main -var digits string +var digits string; func putint(buf []byte, i, base, val int, digits string) { - buf[i] = digits[val] + buf[i] = digits[val]; } func main() { diff --git a/test/fixedbugs/bug021.go b/test/fixedbugs/bug021.go index fcbebc7397..bf936e875c 100644 --- a/test/fixedbugs/bug021.go +++ b/test/fixedbugs/bug021.go @@ -7,7 +7,7 @@ package main func main() { - s1 := "hi" - s2 := "ho" - s1 += s2 + s1 := "hi"; + s2 := "ho"; + s1 += s2; } diff --git a/test/fixedbugs/bug022.go b/test/fixedbugs/bug022.go index 8395ab36a1..65a8bfe9a1 100644 --- a/test/fixedbugs/bug022.go +++ b/test/fixedbugs/bug022.go @@ -7,15 +7,15 @@ package main func putint(digits *string) { - var i byte - i = (*digits)[7] // compiles - i = digits[7] // ERROR "illegal|is not|invalid" - _ = i + var i byte; + i = (*digits)[7]; // compiles + i = digits[7]; // ERROR "illegal|is not|invalid" + _ = i; } func main() { - s := "asdfasdfasdfasdf" - putint(&s) + s := "asdfasdfasdfasdf"; + putint(&s); } /* diff --git a/test/fixedbugs/bug023.go b/test/fixedbugs/bug023.go index c3c77f7243..9b211cd54f 100644 --- a/test/fixedbugs/bug023.go +++ b/test/fixedbugs/bug023.go @@ -7,7 +7,7 @@ package main type Type interface { - TypeName() string + TypeName() string; } type TInt struct { @@ -15,13 +15,14 @@ type TInt struct { // TInt func (i *TInt) TypeName() string { - return "int" + return "int"; } + func main() { - var t Type - t = nil - _ = t + var t Type; + t = nil; + _ = t; } /* diff --git a/test/fixedbugs/bug024.go b/test/fixedbugs/bug024.go index 6e3af02f2c..2e235b7b46 100644 --- a/test/fixedbugs/bug024.go +++ b/test/fixedbugs/bug024.go @@ -7,14 +7,13 @@ package main func main() { - var i int - i = '\'' - i = '\\' - var s string - s = "\"" - _, _ = i, s + var i int; + i = '\''; + i = '\\'; + var s string; + s = "\""; + _, _ = i, s; } - /* bug.go:5: unknown escape sequence: ' bug.go:6: unknown escape sequence: \ diff --git a/test/fixedbugs/bug026.go b/test/fixedbugs/bug026.go index edb2b5685e..bfd03cc955 100644 --- a/test/fixedbugs/bug026.go +++ b/test/fixedbugs/bug026.go @@ -15,12 +15,12 @@ type Vector struct { func (v *Vector) Insert(i int, e Element) { } + func main() { - type I struct{ val int } // BUG: can't be local; works if global - v := new(Vector) - v.Insert(0, new(I)) + type I struct { val int; }; // BUG: can't be local; works if global + v := new(Vector); + v.Insert(0, new(I)); } - /* check: main_sigs_I: not defined */ diff --git a/test/fixedbugs/bug028.go b/test/fixedbugs/bug028.go index cd41b09de3..2edf5a9106 100644 --- a/test/fixedbugs/bug028.go +++ b/test/fixedbugs/bug028.go @@ -6,23 +6,22 @@ package main + func Alloc(i int) int { switch i { default: - return 5 + return 5; case 1: - return 1 + return 1; case 10: - return 10 + return 10; } return 0 } func main() { - s := Alloc(7) - if s != 5 { - panic("bad") - } + s := Alloc(7); + if s != 5 { panic("bad") } } /* diff --git a/test/fixedbugs/bug030.go b/test/fixedbugs/bug030.go index 93bb2e9e3b..ffd29e057a 100644 --- a/test/fixedbugs/bug030.go +++ b/test/fixedbugs/bug030.go @@ -7,7 +7,7 @@ package main func main() { - var x int - x := 0 // ERROR "declar|:=" - _ = x + var x int; + x := 0; // ERROR "declar|:=" + _ = x; } diff --git a/test/fixedbugs/bug031.go b/test/fixedbugs/bug031.go index 10028c5d1d..529e5ce84c 100644 --- a/test/fixedbugs/bug031.go +++ b/test/fixedbugs/bug031.go @@ -7,23 +7,23 @@ package main func main() { - prog := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxx" + - "xxxxxx" + - "xxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - - _ = prog +prog := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxx"+ +"xxxxxx"+ +"xxxxxxxxxxxxxxxxxxxx"+ +"xxxxxxxx"+ +"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +; +_ = prog; } /* Segmentation fault */ diff --git a/test/fixedbugs/bug037.go b/test/fixedbugs/bug037.go index e66349a2b7..f17fb3fd74 100644 --- a/test/fixedbugs/bug037.go +++ b/test/fixedbugs/bug037.go @@ -7,5 +7,5 @@ package main func main() { - s := vlong(0) // ERROR "undef" + s := vlong(0); // ERROR "undef" } diff --git a/test/fixedbugs/bug039.go b/test/fixedbugs/bug039.go index 847ac241db..d34f5e62e4 100644 --- a/test/fixedbugs/bug039.go +++ b/test/fixedbugs/bug039.go @@ -6,6 +6,6 @@ package main -func f(x int) { // GCCGO_ERROR "previous" - var x int // ERROR "redecl|redefinition" +func f (x int) { // GCCGO_ERROR "previous" + var x int; // ERROR "redecl|redefinition" } diff --git a/test/fixedbugs/bug040.go b/test/fixedbugs/bug040.go index cb1e35f3e3..d2cf88afcb 100644 --- a/test/fixedbugs/bug040.go +++ b/test/fixedbugs/bug040.go @@ -6,6 +6,6 @@ package main -func f(x, // GCCGO_ERROR "previous" - x int) { // ERROR "duplicate argument|redefinition" +func f (x, // GCCGO_ERROR "previous" + x int) { // ERROR "duplicate argument|redefinition" } diff --git a/test/fixedbugs/bug045.go b/test/fixedbugs/bug045.go index a15e16343e..c66a2411a8 100644 --- a/test/fixedbugs/bug045.go +++ b/test/fixedbugs/bug045.go @@ -11,12 +11,11 @@ type T struct { } func main() { - var ta []*T + var ta []*T; - ta = new([1]*T)[0:] - ta[0] = nil + ta = new([1]*T)[0:]; + ta[0] = nil; } - /* bug045.go:13: fatal error: goc: exit 1 */ diff --git a/test/fixedbugs/bug046.go b/test/fixedbugs/bug046.go index 2ef98177de..219e91d537 100644 --- a/test/fixedbugs/bug046.go +++ b/test/fixedbugs/bug046.go @@ -6,9 +6,9 @@ package main -type T *struct{} +type T *struct {} -func (x T) M() {} // ERROR "pointer|receiver" +func (x T) M () {} // ERROR "pointer|receiver" /* bug046.go:7: illegal pointer diff --git a/test/fixedbugs/bug048.go b/test/fixedbugs/bug048.go index 112343c77f..48ad751e2c 100644 --- a/test/fixedbugs/bug048.go +++ b/test/fixedbugs/bug048.go @@ -7,7 +7,7 @@ package main func main() { - type M map[int]int - m1 := M{7: 8} - _ = m1 + type M map[int] int; + m1 := M{7 : 8}; + _ = m1; } diff --git a/test/fixedbugs/bug049.go b/test/fixedbugs/bug049.go index 7de429c80c..51990f2dfb 100644 --- a/test/fixedbugs/bug049.go +++ b/test/fixedbugs/bug049.go @@ -7,8 +7,8 @@ package main func atom(s string) { - if s == nil { // ERROR "nil|incompatible" - return + if s == nil { // ERROR "nil|incompatible" + return; } } diff --git a/test/fixedbugs/bug051.go b/test/fixedbugs/bug051.go index e337f960d7..c4ba2eff67 100644 --- a/test/fixedbugs/bug051.go +++ b/test/fixedbugs/bug051.go @@ -7,9 +7,9 @@ package main func f() int { - return 0 + return 0; } func main() { - const n = f() // ERROR "const" + const n = f(); // ERROR "const" } diff --git a/test/fixedbugs/bug052.go b/test/fixedbugs/bug052.go index ec372b33cc..440a00ebeb 100644 --- a/test/fixedbugs/bug052.go +++ b/test/fixedbugs/bug052.go @@ -7,14 +7,14 @@ package main func main() { - c := 10 - d := 7 - var x [10]int - i := 0 + c := 10; + d := 7; + var x [10]int; + i := 0; /* this works: q := c/d; x[i] = q; */ // this doesn't: - x[i] = c / d // BUG segmentation fault + x[i] = c/d; // BUG segmentation fault } diff --git a/test/fixedbugs/bug053.go b/test/fixedbugs/bug053.go index 8a8b4be5cf..00625fd7c3 100644 --- a/test/fixedbugs/bug053.go +++ b/test/fixedbugs/bug053.go @@ -7,6 +7,6 @@ package main func main() { - var len int // len should not be a keyword - this doesn't compile - _ = len + var len int; // len should not be a keyword - this doesn't compile + _ = len; } diff --git a/test/fixedbugs/bug054.go b/test/fixedbugs/bug054.go index 064696bd5c..01590585c5 100644 --- a/test/fixedbugs/bug054.go +++ b/test/fixedbugs/bug054.go @@ -10,31 +10,31 @@ type Element interface { } type Vector struct { - elem []Element + elem []Element; } func (v *Vector) At(i int) Element { - return v.elem[i] + return v.elem[i]; } type TStruct struct { - name string - fields *Vector + name string; + fields *Vector; } func (s *TStruct) field(i int) *TStruct { - return s.fields.At(i).(*TStruct) + return s.fields.At(i).(*TStruct); } func main() { - v := new(Vector) - v.elem = make([]Element, 10) - t := new(TStruct) - t.name = "hi" - v.elem[0] = t - s := new(TStruct) - s.name = "foo" - s.fields = v + v := new(Vector); + v.elem = make([]Element, 10); + t := new(TStruct); + t.name = "hi"; + v.elem[0] = t; + s := new(TStruct); + s.name = "foo"; + s.fields = v; if s.field(0).name != "hi" { panic("bad name") } diff --git a/test/fixedbugs/bug056.go b/test/fixedbugs/bug056.go index dfee21b8bf..13eac29204 100644 --- a/test/fixedbugs/bug056.go +++ b/test/fixedbugs/bug056.go @@ -11,8 +11,8 @@ func frexp() (a int, b float64) { } func main() { - a, b := frexp() - _, _ = a, b + a, b := frexp(); + _, _ = a, b; } /* diff --git a/test/fixedbugs/bug057.go b/test/fixedbugs/bug057.go index 9df1acd077..19b8651a54 100644 --- a/test/fixedbugs/bug057.go +++ b/test/fixedbugs/bug057.go @@ -7,15 +7,16 @@ package main type T struct { - s string + s string; } + func main() { - s := "" - l1 := len(s) - var t T - l2 := len(t.s) // BUG: cannot take len() of a string field - _, _ = l1, l2 + s := ""; + l1 := len(s); + var t T; + l2 := len(t.s); // BUG: cannot take len() of a string field + _, _ = l1, l2; } /* diff --git a/test/fixedbugs/bug058.go b/test/fixedbugs/bug058.go index ec58317ff5..2b97dbf7c0 100644 --- a/test/fixedbugs/bug058.go +++ b/test/fixedbugs/bug058.go @@ -6,15 +6,14 @@ package main -type Box struct{} - -var m map[string]*Box +type Box struct {}; +var m map[string] *Box; func main() { - m := make(map[string]*Box) - s := "foo" - var x *Box = nil - m[s] = x + m := make(map[string] *Box); + s := "foo"; + var x *Box = nil; + m[s] = x; } /* diff --git a/test/fixedbugs/bug059.go b/test/fixedbugs/bug059.go index 4dbd297bc7..6f64b9e0b1 100644 --- a/test/fixedbugs/bug059.go +++ b/test/fixedbugs/bug059.go @@ -9,28 +9,28 @@ package main import "os" func P(a []string) string { - s := "{" + s := "{"; for i := 0; i < 2; i++ { if i > 0 { s += "," } - s += `"` + a[i] + `"` + s += `"` + a[i] + `"`; } - s += "}" - return s + s +="}"; + return s; } func main() { - m := make(map[string][]string) - as := new([2]string) - as[0] = "0" - as[1] = "1" - m["0"] = as[0:] + m := make(map[string] []string); + as := new([2]string); + as[0] = "0"; + as[1] = "1"; + m["0"] = as[0:]; - a := m["0"] - a[0] = "x" - m["0"][0] = "deleted" + a := m["0"]; + a[0] = "x"; + m["0"][0] = "deleted"; if m["0"][0] != "deleted" { - os.Exit(1) + os.Exit(1); } } diff --git a/test/fixedbugs/bug060.go b/test/fixedbugs/bug060.go index a97c1cd2fd..8260729056 100644 --- a/test/fixedbugs/bug060.go +++ b/test/fixedbugs/bug060.go @@ -9,11 +9,11 @@ package main import "os" func main() { - m := make(map[int]int) - m[0] = 0 - m[0]++ + m := make(map[int]int); + m[0] = 0; + m[0]++; if m[0] != 1 { - print("map does not increment\n") + print("map does not increment\n"); os.Exit(1) } } diff --git a/test/fixedbugs/bug061.go b/test/fixedbugs/bug061.go index 295d6f3b45..ae99b186d8 100644 --- a/test/fixedbugs/bug061.go +++ b/test/fixedbugs/bug061.go @@ -7,9 +7,9 @@ package main func main() { - var s string - s = "0000000000000000000000000000000000000000000000000000000000"[0:7] - _ = s + var s string; + s = "0000000000000000000000000000000000000000000000000000000000"[0:7]; + _ = s; } /* diff --git a/test/fixedbugs/bug062.go b/test/fixedbugs/bug062.go index 1008f1af9c..1cc5003655 100644 --- a/test/fixedbugs/bug062.go +++ b/test/fixedbugs/bug062.go @@ -7,5 +7,5 @@ package main func main() { - var s string = nil // ERROR "illegal|invalid|incompatible|cannot" + var s string = nil; // ERROR "illegal|invalid|incompatible|cannot" } diff --git a/test/fixedbugs/bug063.go b/test/fixedbugs/bug063.go index 8e586ac781..a3ae3f0962 100644 --- a/test/fixedbugs/bug063.go +++ b/test/fixedbugs/bug063.go @@ -5,5 +5,4 @@ // license that can be found in the LICENSE file. package bug063 - const c = 0 ^ 0 diff --git a/test/fixedbugs/bug064.go b/test/fixedbugs/bug064.go index b186bfe6b5..d8b3bea9a6 100644 --- a/test/fixedbugs/bug064.go +++ b/test/fixedbugs/bug064.go @@ -6,15 +6,17 @@ package main -func swap(x, y int) (u, v int) { +func +swap(x, y int) (u, v int) { return y, x } -func main() { - a := 1 - b := 2 - a, b = swap(swap(a, b)) +func +main() { + a := 1; + b := 2; + a, b = swap(swap(a, b)); if a != 2 || b != 1 { - panic("bad swap") + panic("bad swap"); } } diff --git a/test/fixedbugs/bug065.go b/test/fixedbugs/bug065.go index 78b98d9621..a1e3b08bba 100644 --- a/test/fixedbugs/bug065.go +++ b/test/fixedbugs/bug065.go @@ -7,6 +7,6 @@ package main func main() { - k, l, m := 0, 0, 0 - _, _, _ = k, l, m + k, l, m := 0,0,0; + _, _, _ = k, l, m; } diff --git a/test/fixedbugs/bug066.go b/test/fixedbugs/bug066.go index 0d43d4c910..db3d7f8602 100644 --- a/test/fixedbugs/bug066.go +++ b/test/fixedbugs/bug066.go @@ -7,17 +7,20 @@ package bug066 type Scope struct { - entries map[string]*Object + entries map[string] *Object; } + type Type struct { - scope *Scope + scope *Scope; } + type Object struct { - typ *Type + typ *Type; } + func Lookup(scope *Scope) *Object { - return scope.entries["foo"] + return scope.entries["foo"]; } diff --git a/test/fixedbugs/bug067.go b/test/fixedbugs/bug067.go index f1aadb7c64..aaeefb0ba1 100644 --- a/test/fixedbugs/bug067.go +++ b/test/fixedbugs/bug067.go @@ -9,7 +9,7 @@ package main var c chan int func main() { - c = make(chan int) - go func() { c <- 0 }() + c = make(chan int); + go func() { c <- 0 } (); <-c } diff --git a/test/fixedbugs/bug069.go b/test/fixedbugs/bug069.go index 4dff02f474..7b07b773d4 100644 --- a/test/fixedbugs/bug069.go +++ b/test/fixedbugs/bug069.go @@ -7,14 +7,14 @@ package main func main() { - c := make(chan int) - ok := false - var i int - - i, ok = <-c // works - _, _ = i, ok - - ca := new([2]chan int) - i, ok = <-(ca[0]) // fails: c.go:11: bad shape across assignment - cr=1 cl=2 - _, _ = i, ok + c := make(chan int); + ok := false; + var i int; + + i, ok = <-c; // works + _, _ = i, ok; + + ca := new([2]chan int); + i, ok = <-(ca[0]); // fails: c.go:11: bad shape across assignment - cr=1 cl=2 + _, _ = i, ok; } diff --git a/test/fixedbugs/bug071.go b/test/fixedbugs/bug071.go index caae01c6ec..ec38f7a979 100644 --- a/test/fixedbugs/bug071.go +++ b/test/fixedbugs/bug071.go @@ -6,18 +6,18 @@ package bug071 -type rat struct { - den int +type rat struct { + den int; } func (u *rat) pr() { } type dch struct { - dat chan *rat + dat chan *rat; } -func dosplit(in *dch) { - dat := <-in.dat - _ = dat +func dosplit(in *dch){ + dat := <-in.dat; + _ = dat; } diff --git a/test/fixedbugs/bug072.go b/test/fixedbugs/bug072.go index b6f46045b2..05ad93dac2 100644 --- a/test/fixedbugs/bug072.go +++ b/test/fixedbugs/bug072.go @@ -7,5 +7,5 @@ package main func main() { - s := string(bug) // ERROR "undef" + s := string(bug); // ERROR "undef" } diff --git a/test/fixedbugs/bug074.go b/test/fixedbugs/bug074.go index e632e9bf4e..fb789cb4c1 100644 --- a/test/fixedbugs/bug074.go +++ b/test/fixedbugs/bug074.go @@ -7,6 +7,6 @@ package main func main() { - x := string{'a', 'b', '\n'} // ERROR "composite" - print(x) + x := string{'a', 'b', '\n'}; // ERROR "composite" + print(x); } diff --git a/test/fixedbugs/bug075.go b/test/fixedbugs/bug075.go index a568b5fa70..d0b7d14e71 100644 --- a/test/fixedbugs/bug075.go +++ b/test/fixedbugs/bug075.go @@ -6,13 +6,12 @@ package main -type T struct{ m map[int]int } - +type T struct { m map[int]int } func main() { - t := new(T) - t.m = make(map[int]int) - var x int - var ok bool - x, ok = t.m[0] //bug075.go:11: bad shape across assignment - cr=1 cl=2 - _, _ = x, ok + t := new(T); + t.m = make(map[int]int); + var x int; + var ok bool; + x, ok = t.m[0]; //bug075.go:11: bad shape across assignment - cr=1 cl=2 + _, _ = x, ok; } diff --git a/test/fixedbugs/bug076.go b/test/fixedbugs/bug076.go index 57401318c0..60aaa97608 100644 --- a/test/fixedbugs/bug076.go +++ b/test/fixedbugs/bug076.go @@ -12,6 +12,7 @@ exit: goto exit } + func main() { exit: ; // this should be legal (labels not properly scoped?) @@ -19,6 +20,6 @@ exit: } /* -uetli:~/Source/go/test/bugs gri$ 6g bug076.go +uetli:~/Source/go/test/bugs gri$ 6g bug076.go bug076.go:11: label redeclared: exit */ diff --git a/test/fixedbugs/bug078.go b/test/fixedbugs/bug078.go index 2a191dc24e..1041b858c8 100644 --- a/test/fixedbugs/bug078.go +++ b/test/fixedbugs/bug078.go @@ -6,7 +6,7 @@ package main -func dosplit(wait chan int) { +func dosplit(wait chan int ){ select { case <-wait: } diff --git a/test/fixedbugs/bug083.dir/bug1.go b/test/fixedbugs/bug083.dir/bug1.go index 778688e072..ea5bcfe205 100644 --- a/test/fixedbugs/bug083.dir/bug1.go +++ b/test/fixedbugs/bug083.dir/bug1.go @@ -10,4 +10,5 @@ import "./bug0" // visible here in package bug1. The test for failure is in // ../bug083.go. -var v1 bug0.t0 // ERROR "bug0" +var v1 bug0.t0; // ERROR "bug0" + diff --git a/test/fixedbugs/bug085.go b/test/fixedbugs/bug085.go index 6182c6a645..dae83f8a49 100644 --- a/test/fixedbugs/bug085.go +++ b/test/fixedbugs/bug085.go @@ -9,7 +9,7 @@ package P var x int func foo() { - print(P.x) // ERROR "undefined" + print(P.x); // ERROR "undefined" } /* diff --git a/test/fixedbugs/bug086.go b/test/fixedbugs/bug086.go index 97aaa60f91..40d2362066 100644 --- a/test/fixedbugs/bug086.go +++ b/test/fixedbugs/bug086.go @@ -8,13 +8,13 @@ package main func f() int { if false { - return 0 + return 0; } // we should not be able to return successfully w/o a return statement } // ERROR "return" func main() { - print(f(), "\n") + print(f(), "\n"); } /* diff --git a/test/fixedbugs/bug087.go b/test/fixedbugs/bug087.go index a973f8b348..67e7210cdb 100644 --- a/test/fixedbugs/bug087.go +++ b/test/fixedbugs/bug087.go @@ -6,11 +6,11 @@ package main -const s string = "foo" +const s string = "foo"; func main() { - i := len(s) // should be legal to take len() of a constant - _ = i + i := len(s); // should be legal to take len() of a constant + _ = i; } /* diff --git a/test/fixedbugs/bug088.dir/bug0.go b/test/fixedbugs/bug088.dir/bug0.go index 8bfda6a279..7a6e34747f 100644 --- a/test/fixedbugs/bug088.dir/bug0.go +++ b/test/fixedbugs/bug088.dir/bug0.go @@ -4,6 +4,6 @@ package bug0 -var V0 func() int -var V1 func() (a int) -var V2 func() (a, b int) +var V0 func() int; +var V1 func() (a int); +var V2 func() (a, b int); diff --git a/test/fixedbugs/bug088.dir/bug1.go b/test/fixedbugs/bug088.dir/bug1.go index 98a4e7cfe4..2568e37d02 100644 --- a/test/fixedbugs/bug088.dir/bug1.go +++ b/test/fixedbugs/bug088.dir/bug1.go @@ -7,10 +7,10 @@ package main import P "./bug0" func main() { - a0 := P.V0() // works - a1 := P.V1() // works - a2, b2 := P.V2() // doesn't work - _, _, _, _ = a0, a1, a2, b2 + a0 := P.V0(); // works + a1 := P.V1(); // works + a2, b2 := P.V2(); // doesn't work + _, _, _, _ = a0, a1, a2, b2; } /* diff --git a/test/fixedbugs/bug089.go b/test/fixedbugs/bug089.go index e1a87801f0..e88f17babb 100644 --- a/test/fixedbugs/bug089.go +++ b/test/fixedbugs/bug089.go @@ -6,15 +6,16 @@ package main -type I1 interface{} -type I2 interface{ pr() } +type I1 interface {} +type I2 interface { pr() } -func e() I1 +func e() I1; -var i1 I1 -var i2 I2 +var i1 I1; +var i2 I2; -func main() { +func +main() { - i2 = e().(I2) // bug089.go:16: fatal error: agen_inter i2i + i2 = e().(I2); // bug089.go:16: fatal error: agen_inter i2i } diff --git a/test/fixedbugs/bug090.go b/test/fixedbugs/bug090.go index d074b30880..320bd57f5c 100644 --- a/test/fixedbugs/bug090.go +++ b/test/fixedbugs/bug090.go @@ -7,8 +7,8 @@ package main const ( - c3div2 = 3 / 2 - f3div2 = 3. / 2. + c3div2 = 3/2; + f3div2 = 3./2.; ) func assert(t bool, s string) { @@ -18,29 +18,29 @@ func assert(t bool, s string) { } func main() { - var i int - var f float64 + var i int; + var f float64; - assert(c3div2 == 1, "3/2") - assert(f3div2 == 1.5, "3/2") + assert(c3div2 == 1, "3/2"); + assert(f3div2 == 1.5, "3/2"); - i = c3div2 - assert(i == c3div2, "i == c3div2") + i = c3div2; + assert(i == c3div2, "i == c3div2"); - f = c3div2 - assert(f == c3div2, "f == c3div2") + f = c3div2; + assert(f == c3div2, "f == c3div2"); - f = f3div2 - assert(f == f3div2, "f == f3div2") + f = f3div2; + assert(f == f3div2, "f == f3div2"); - i = f3div2 // ERROR "truncate" - assert(i == c3div2, "i == c3div2 from f3div2") - assert(i != f3div2, "i != f3div2") // ERROR "truncate" + i = f3div2; // ERROR "truncate" + assert(i == c3div2, "i == c3div2 from f3div2"); + assert(i != f3div2, "i != f3div2"); // ERROR "truncate" - const g float64 = 1.0 - i = g // ERROR "convert|incompatible|cannot" + const g float64 = 1.0; + i = g; // ERROR "convert|incompatible|cannot" - const h float64 = 3.14 - i = h // ERROR "convert|incompatible|cannot" - i = int(h) // ERROR "truncate" + const h float64 = 3.14; + i = h; // ERROR "convert|incompatible|cannot" + i = int(h); // ERROR "truncate" } diff --git a/test/fixedbugs/bug092.go b/test/fixedbugs/bug092.go index b34969afd3..8027d941ea 100644 --- a/test/fixedbugs/bug092.go +++ b/test/fixedbugs/bug092.go @@ -7,9 +7,9 @@ package main func main() { - var a [1000]int64 // this alone works - var b [10000]int64 // this causes a runtime crash - _, _ = a, b + var a [1000] int64; // this alone works + var b [10000] int64; // this causes a runtime crash + _, _ = a, b; } /* diff --git a/test/fixedbugs/bug093.go b/test/fixedbugs/bug093.go index a3a626a1b0..acd94466f5 100644 --- a/test/fixedbugs/bug093.go +++ b/test/fixedbugs/bug093.go @@ -13,15 +13,16 @@ func (p *S) M() { } type I interface { - M() + M(); } func main() { - var p *S = nil - var i I = p // this should be possible even though p is nil: we still know the type - i.M() // should be possible since we know the type, and don't ever use the receiver + var p *S = nil; + var i I = p; // this should be possible even though p is nil: we still know the type + i.M(); // should be possible since we know the type, and don't ever use the receiver } + /* throw: ifaces2i: nil pointer SIGSEGV: segmentation violation diff --git a/test/fixedbugs/bug094.go b/test/fixedbugs/bug094.go index 4456237302..3ef11da3d3 100644 --- a/test/fixedbugs/bug094.go +++ b/test/fixedbugs/bug094.go @@ -7,17 +7,19 @@ package main func f0() { - const x = 0 + const x = 0; } + func f1() { - x := 0 - _ = x + x := 0; + _ = x; } + func main() { - f0() - f1() + f0(); + f1(); } /* diff --git a/test/fixedbugs/bug096.go b/test/fixedbugs/bug096.go index 39ce017bb7..411ba74e0c 100644 --- a/test/fixedbugs/bug096.go +++ b/test/fixedbugs/bug096.go @@ -6,12 +6,12 @@ package main -type A []int +type A []int; func main() { - a := &A{0} - b := &A{0, 1} - _, _ = a, b + a := &A{0}; + b := &A{0, 1}; + _, _ = a, b; } /* diff --git a/test/fixedbugs/bug098.go b/test/fixedbugs/bug098.go index b872b50fa7..eb4ee4de03 100644 --- a/test/fixedbugs/bug098.go +++ b/test/fixedbugs/bug098.go @@ -6,13 +6,13 @@ package main -type A []int -type M map[int]int +type A []int; +type M map[int] int; func main() { - var a *A = &A{0} - var m *M = &M{0: 0} // should be legal to use & here for consistency with other composite constructors (prev. line) - _, _ = a, m + var a *A = &A{0}; + var m *M = &M{0 : 0}; // should be legal to use & here for consistency with other composite constructors (prev. line) + _, _ = a, m; } /* diff --git a/test/fixedbugs/bug099.go b/test/fixedbugs/bug099.go index 51b667bca8..03a5c454b0 100644 --- a/test/fixedbugs/bug099.go +++ b/test/fixedbugs/bug099.go @@ -7,11 +7,10 @@ package main // Interface -type I interface{ F() int } +type I interface { F() int } // Implements interface -type S struct{} - +type S struct { } func (s *S) F() int { return 1 } // Allocates S but returns I @@ -28,10 +27,11 @@ func Use(x I) { } func main() { - i := NewI(0) - Use(i) + i := NewI(0); + Use(i); // Again, without temporary // Crashes because x.F is 0. - Use(NewI(0)) + Use(NewI(0)); } + diff --git a/test/fixedbugs/bug101.go b/test/fixedbugs/bug101.go index 5afc4b6dda..82e496a8a6 100644 --- a/test/fixedbugs/bug101.go +++ b/test/fixedbugs/bug101.go @@ -6,14 +6,10 @@ package main -var a = []int{1, 2, 3} +var a = []int { 1, 2, 3 } func main() { - if len(a) != 3 { - panic("array len") - } + if len(a) != 3 { panic("array len") } // print(a[0], " ", a[1], " ", a[2], "\n") - if a[0] != 1 || a[1] != 2 || a[2] != 3 { - panic("array contents") - } + if a[0] != 1 || a[1] != 2 || a[2] != 3 { panic("array contents") } } diff --git a/test/fixedbugs/bug103.go b/test/fixedbugs/bug103.go index c79ebf25cb..1cb710e368 100644 --- a/test/fixedbugs/bug103.go +++ b/test/fixedbugs/bug103.go @@ -6,8 +6,9 @@ package main -func f()/* no return type */ {} +func f() /* no return type */ {} func main() { - x := f() // ERROR "mismatch|as value|no type" + x := f(); // ERROR "mismatch|as value|no type" } + diff --git a/test/fixedbugs/bug104.go b/test/fixedbugs/bug104.go index 0e32d94262..f0c19a8aa7 100644 --- a/test/fixedbugs/bug104.go +++ b/test/fixedbugs/bug104.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. package main - func f() string { - return 0 // ERROR "conversion|type" + return 0 // ERROR "conversion|type" } diff --git a/test/fixedbugs/bug106.dir/bug1.go b/test/fixedbugs/bug106.dir/bug1.go index eae2abbbaa..eff0d36ed2 100644 --- a/test/fixedbugs/bug106.dir/bug1.go +++ b/test/fixedbugs/bug106.dir/bug1.go @@ -5,3 +5,4 @@ package bug1 import _ "./bug0" + diff --git a/test/fixedbugs/bug107.go b/test/fixedbugs/bug107.go index 198a1f40f3..dcd8e9d113 100644 --- a/test/fixedbugs/bug107.go +++ b/test/fixedbugs/bug107.go @@ -5,14 +5,11 @@ // license that can be found in the LICENSE file. package main - import os "os" - type _ os.FileInfo - func f() (os int) { - // In the next line "os" should refer to the result variable, not - // to the package. - v := os.Open("", 0, 0) // ERROR "undefined" - return 0 + // In the next line "os" should refer to the result variable, not + // to the package. + v := os.Open("", 0, 0); // ERROR "undefined" + return 0 } diff --git a/test/fixedbugs/bug108.go b/test/fixedbugs/bug108.go index a0f979c3ea..cfec4c9f1f 100644 --- a/test/fixedbugs/bug108.go +++ b/test/fixedbugs/bug108.go @@ -5,8 +5,7 @@ // license that can be found in the LICENSE file. package main - func f() { - v := 1 << 1025 // ERROR "overflow|shift count too large" + v := 1 << 1025; // ERROR "overflow|shift count too large" _ = v } diff --git a/test/fixedbugs/bug111.go b/test/fixedbugs/bug111.go index c30afbb6d2..d977bd54fb 100644 --- a/test/fixedbugs/bug111.go +++ b/test/fixedbugs/bug111.go @@ -6,7 +6,7 @@ package main -var ncall int +var ncall int; type Iffy interface { Me() Iffy @@ -17,15 +17,15 @@ type Stucky struct { } func (s *Stucky) Me() Iffy { - ncall++ + ncall++; return s } func main() { - s := new(Stucky) - i := s.Me() - j := i.Me() - j.Me() + s := new(Stucky); + i := s.Me(); + j := i.Me(); + j.Me(); if ncall != 3 { panic("bug111") } diff --git a/test/fixedbugs/bug112.go b/test/fixedbugs/bug112.go index 2928bc15b5..e2ed5c0d41 100644 --- a/test/fixedbugs/bug112.go +++ b/test/fixedbugs/bug112.go @@ -6,8 +6,7 @@ package main -type T struct{ s string } - +type T struct { s string } var t = T{"hi"} func main() {} diff --git a/test/fixedbugs/bug113.go b/test/fixedbugs/bug113.go index 03e22c0558..a1e61cb36f 100644 --- a/test/fixedbugs/bug113.go +++ b/test/fixedbugs/bug113.go @@ -21,7 +21,7 @@ func main() { if foo2(v2) != 1 { panic(2) } - + shouldPanic(p1) } diff --git a/test/fixedbugs/bug115.go b/test/fixedbugs/bug115.go index 726d33c124..7cc3dc40a6 100644 --- a/test/fixedbugs/bug115.go +++ b/test/fixedbugs/bug115.go @@ -6,9 +6,9 @@ package main -func isuint(i uint) {} +func isuint(i uint) { } func main() { - i := ^uint(0) - isuint(i) + i := ^uint(0); + isuint(i); } diff --git a/test/fixedbugs/bug118.go b/test/fixedbugs/bug118.go index ca7fdbba5d..198b8ff280 100644 --- a/test/fixedbugs/bug118.go +++ b/test/fixedbugs/bug118.go @@ -9,7 +9,7 @@ package bug118 func Send(c chan int) int { select { default: - return 1 + return 1; } - return 2 + return 2; } diff --git a/test/fixedbugs/bug122.go b/test/fixedbugs/bug122.go index 9ae597462d..fb4eb9f3ad 100644 --- a/test/fixedbugs/bug122.go +++ b/test/fixedbugs/bug122.go @@ -8,5 +8,5 @@ package main func main() { // should allow at most 2 sizes - a := make([]int, 10, 20, 30, 40) // ERROR "too many" + a := make([]int, 10, 20, 30, 40); // ERROR "too many" } diff --git a/test/fixedbugs/bug123.go b/test/fixedbugs/bug123.go index 8c4f323761..f38551a914 100644 --- a/test/fixedbugs/bug123.go +++ b/test/fixedbugs/bug123.go @@ -5,13 +5,9 @@ // license that can be found in the LICENSE file. package main - -const ( - F = 1 -) - +const ( F = 1 ) func fn(i int) int { - if i == F() { // ERROR "func" + if i == F() { // ERROR "func" return 0 } return 1 diff --git a/test/fixedbugs/bug126.go b/test/fixedbugs/bug126.go index 8274c1e931..f5d9763412 100644 --- a/test/fixedbugs/bug126.go +++ b/test/fixedbugs/bug126.go @@ -7,5 +7,5 @@ package main // same const identifier declared twice should not be accepted -const none = 0 // GCCGO_ERROR "previous" -const none = 1 // ERROR "redeclared|redef" +const none = 0 // GCCGO_ERROR "previous" +const none = 1; // ERROR "redeclared|redef" diff --git a/test/fixedbugs/bug127.go b/test/fixedbugs/bug127.go index 573c40c681..f8ea99470c 100644 --- a/test/fixedbugs/bug127.go +++ b/test/fixedbugs/bug127.go @@ -5,9 +5,8 @@ // license that can be found in the LICENSE file. package main - func main() { - var x int64 = 0 - println(x != nil) // ERROR "illegal|incompatible|nil" - println(0 != nil) // ERROR "illegal|incompatible|nil" + var x int64 = 0; + println(x != nil); // ERROR "illegal|incompatible|nil" + println(0 != nil); // ERROR "illegal|incompatible|nil" } diff --git a/test/fixedbugs/bug128.go b/test/fixedbugs/bug128.go index 7389426c57..e8cbea079f 100644 --- a/test/fixedbugs/bug128.go +++ b/test/fixedbugs/bug128.go @@ -5,20 +5,19 @@ // license that can be found in the LICENSE file. package main - func main() { switch { - // empty switch is allowed according to syntax - // unclear why it shouldn't be allowed + // empty switch is allowed according to syntax + // unclear why it shouldn't be allowed } switch tag := 0; tag { - // empty switch is allowed according to syntax - // unclear why it shouldn't be allowed + // empty switch is allowed according to syntax + // unclear why it shouldn't be allowed } } /* -uetli:~/Source/go1/test/bugs gri$ 6g bug127.go +uetli:~/Source/go1/test/bugs gri$ 6g bug127.go bug127.go:5: switch statement must have case labels bug127.go:9: switch statement must have case labels */ diff --git a/test/fixedbugs/bug129.go b/test/fixedbugs/bug129.go index 64666e9377..157ce78ff7 100644 --- a/test/fixedbugs/bug129.go +++ b/test/fixedbugs/bug129.go @@ -5,11 +5,10 @@ // license that can be found in the LICENSE file. package foo - import "fmt" func f() { - fmt.Println() - fmt := 1 - _ = fmt + fmt.Println(); + fmt := 1; + _ = fmt; } diff --git a/test/fixedbugs/bug130.go b/test/fixedbugs/bug130.go index ba38bb5551..16b029af34 100644 --- a/test/fixedbugs/bug130.go +++ b/test/fixedbugs/bug130.go @@ -8,16 +8,15 @@ package main import "os" -type I interface{ send(chan<- int) } +type I interface { send(chan <- int) } -type S struct{ v int } - -func (p *S) send(c chan<- int) { c <- p.v } +type S struct { v int } +func (p *S) send(c chan <- int) { c <- p.v } func main() { - s := S{0} - var i I = &s - c := make(chan int) - go i.send(c) - os.Exit(<-c) + s := S{0}; + var i I = &s; + c := make(chan int); + go i.send(c); + os.Exit(<-c); } diff --git a/test/fixedbugs/bug131.go b/test/fixedbugs/bug131.go index de606da167..0ebbd26069 100644 --- a/test/fixedbugs/bug131.go +++ b/test/fixedbugs/bug131.go @@ -7,6 +7,6 @@ package main func main() { - const a uint64 = 10 - var b int64 = a // ERROR "convert|cannot|incompatible" + const a uint64 = 10; + var b int64 = a; // ERROR "convert|cannot|incompatible" } diff --git a/test/fixedbugs/bug132.go b/test/fixedbugs/bug132.go index b9b9e6712b..e334566c79 100644 --- a/test/fixedbugs/bug132.go +++ b/test/fixedbugs/bug132.go @@ -7,5 +7,5 @@ package main type T struct { - x, x int // ERROR "duplicate" + x, x int // ERROR "duplicate" } diff --git a/test/fixedbugs/bug133.dir/bug0.go b/test/fixedbugs/bug133.dir/bug0.go index 052de3d7ac..19a2bfbd4b 100644 --- a/test/fixedbugs/bug133.dir/bug0.go +++ b/test/fixedbugs/bug133.dir/bug0.go @@ -4,4 +4,4 @@ package bug0 -type T struct{ i int } +type T struct { i int } diff --git a/test/fixedbugs/bug133.dir/bug1.go b/test/fixedbugs/bug133.dir/bug1.go index d47746e4b5..dd59b2f2ec 100644 --- a/test/fixedbugs/bug133.dir/bug1.go +++ b/test/fixedbugs/bug133.dir/bug1.go @@ -6,4 +6,4 @@ package bug1 import "./bug0" -type T struct{ t bug0.T } +type T struct { t bug0.T } diff --git a/test/fixedbugs/bug133.dir/bug2.go b/test/fixedbugs/bug133.dir/bug2.go index 4449ded991..b6184c2e75 100644 --- a/test/fixedbugs/bug133.dir/bug2.go +++ b/test/fixedbugs/bug133.dir/bug2.go @@ -7,10 +7,10 @@ package bug2 import _ "./bug1" import "./bug0" -type T2 struct{ t bug0.T } +type T2 struct { t bug0.T } func fn(p *T2) int { // This reference should be invalid, because bug0.T.i is local // to package bug0 and should not be visible in package bug1. - return p.t.i // ERROR "field|undef" + return p.t.i; // ERROR "field|undef" } diff --git a/test/fixedbugs/bug135.go b/test/fixedbugs/bug135.go index 5cca2b252d..34d234e224 100644 --- a/test/fixedbugs/bug135.go +++ b/test/fixedbugs/bug135.go @@ -6,15 +6,14 @@ package main -type Foo interface{} - -type T struct{} +type Foo interface { } +type T struct {} func (t *T) foo() {} func main() { - t := new(T) - var i interface{} - f, ok := i.(Foo) - _, _, _ = t, f, ok + t := new(T); + var i interface {}; + f, ok := i.(Foo); + _, _, _ = t, f, ok; } diff --git a/test/fixedbugs/bug136.go b/test/fixedbugs/bug136.go index 2964176afd..bea9bac083 100644 --- a/test/fixedbugs/bug136.go +++ b/test/fixedbugs/bug136.go @@ -7,18 +7,16 @@ package main func main() { -L: - ; // ';' terminates empty statement => L does not apply to for loop + L: ; // ';' terminates empty statement => L does not apply to for loop for i := 0; i < 10; i++ { - println(i) - break L // ERROR "L" + println(i); + break L; // ERROR "L" } -L1: - { // L1 labels block => L1 does not apply to for loop + L1: { // L1 labels block => L1 does not apply to for loop for i := 0; i < 10; i++ { - println(i) - break L1 // ERROR "L1" + println(i); + break L1; // ERROR "L1" } } } diff --git a/test/fixedbugs/bug139.go b/test/fixedbugs/bug139.go index 610a2b87a2..095e5c93cc 100644 --- a/test/fixedbugs/bug139.go +++ b/test/fixedbugs/bug139.go @@ -7,17 +7,9 @@ package main func main() { - x := false - func() { - if x { - println(1) - } - }() // this does not compile - func() { - if x == false { - println(2) - } - }() // this works as expected + x := false; + func () { if x { println(1); } }(); // this does not compile + func () { if x == false { println(2); } }(); // this works as expected } /* diff --git a/test/fixedbugs/bug141.go b/test/fixedbugs/bug141.go index f905681b6a..81ba6f1b56 100644 --- a/test/fixedbugs/bug141.go +++ b/test/fixedbugs/bug141.go @@ -8,29 +8,25 @@ package main import "os" -type S struct{ i int } - +type S struct { i int } func (p *S) Get() int { return p.i } type Empty interface { } type Getter interface { - Get() int + Get() int; } func f1(p Empty) { switch x := p.(type) { - default: - println("failed to match interface", x) - os.Exit(1) - case Getter: - break + default: println("failed to match interface", x); os.Exit(1); + case Getter: break; } } func main() { - var s S - f1(&s) + var s S; + f1(&s); } diff --git a/test/fixedbugs/bug142.go b/test/fixedbugs/bug142.go index 083b6ac8ac..e28d889a93 100644 --- a/test/fixedbugs/bug142.go +++ b/test/fixedbugs/bug142.go @@ -7,12 +7,12 @@ package main func panic1(s string) bool { - panic(s) + panic(s); } func main() { - x := false && panic1("first") && panic1("second") - x = x == true && panic1("first") && panic1("second") + x := false && panic1("first") && panic1("second"); + x = x == true && panic1("first") && panic1("second"); } /* @@ -27,5 +27,5 @@ mainstart+0xf /Users/rsc/goX/src/runtime/amd64/asm.s:53 mainstart() sys·Goexit /Users/rsc/goX/src/runtime/proc.c:124 sys·Goexit() -; +; */ diff --git a/test/fixedbugs/bug143.go b/test/fixedbugs/bug143.go index c4378f27ad..a43e406676 100644 --- a/test/fixedbugs/bug143.go +++ b/test/fixedbugs/bug143.go @@ -6,34 +6,34 @@ package main -type myMap map[string]int +type myMap map[string] int; func f() myMap { - m := make(map[string]int) + m := make(map[string] int); return m } func main() { - m := make(myMap) - mp := &m + m := make(myMap); + mp := &m; { - x, ok := m["key"] - _, _ = x, ok + x, ok := m["key"]; + _, _ = x, ok; } { - x, ok := (*mp)["key"] - _, _ = x, ok + x, ok := (*mp)["key"]; + _, _ = x, ok; } { - x, ok := f()["key"] - _, _ = x, ok + x, ok := f()["key"]; + _, _ = x, ok; } { - var x int - var ok bool - x, ok = f()["key"] - _, _ = x, ok + var x int; + var ok bool; + x, ok = f()["key"]; + _, _ = x, ok; } } diff --git a/test/fixedbugs/bug144.go b/test/fixedbugs/bug144.go index f42e64ee98..9f8ec7667c 100644 --- a/test/fixedbugs/bug144.go +++ b/test/fixedbugs/bug144.go @@ -6,11 +6,11 @@ package main -const c = 1 +const c = 1; func main() { - c := 0 - _ = c + c := 0; + _ = c; } /* diff --git a/test/fixedbugs/bug145.go b/test/fixedbugs/bug145.go index 44bce2a610..602fe7426d 100644 --- a/test/fixedbugs/bug145.go +++ b/test/fixedbugs/bug145.go @@ -9,8 +9,8 @@ package main type t int func main() { - t := 0 - _ = t + t := 0; + _ = t; } /* diff --git a/test/fixedbugs/bug146.go b/test/fixedbugs/bug146.go index fcdeb4ce42..e29f910ba5 100644 --- a/test/fixedbugs/bug146.go +++ b/test/fixedbugs/bug146.go @@ -7,9 +7,9 @@ package main func main() { - type Slice []byte - a := [...]byte{0} - b := Slice(a[0:]) // This should be OK. - c := Slice(a) // ERROR "invalid|illegal|cannot" - _, _ = b, c + type Slice []byte; + a := [...]byte{ 0 }; + b := Slice(a[0:]); // This should be OK. + c := Slice(a); // ERROR "invalid|illegal|cannot" + _, _ = b, c; } diff --git a/test/fixedbugs/bug148.go b/test/fixedbugs/bug148.go index e7b544439e..b67870b12a 100644 --- a/test/fixedbugs/bug148.go +++ b/test/fixedbugs/bug148.go @@ -6,32 +6,32 @@ package main -type T struct{ a, b int } +type T struct {a, b int}; -func println(x, y int) {} +func println(x, y int) { } func f(x interface{}) interface{} { - type T struct{ a, b int } + type T struct {a, b int}; if x == nil { - return T{2, 3} + return T{2, 3}; } - t := x.(T) - println(t.a, t.b) - return x + t := x.(T); + println(t.a, t.b); + return x; } func main() { - inner_T := f(nil) - f(inner_T) + inner_T := f(nil); + f(inner_T); shouldPanic(p1) } func p1() { - outer_T := T{5, 7} - f(outer_T) + outer_T := T{5, 7}; + f(outer_T); } func shouldPanic(f func()) { diff --git a/test/fixedbugs/bug149.go b/test/fixedbugs/bug149.go index d18c7479ba..78b687e971 100644 --- a/test/fixedbugs/bug149.go +++ b/test/fixedbugs/bug149.go @@ -7,16 +7,16 @@ package main func main() { - var b1 []byte - s1 := string(b1) - println(len(s1)) // prints 0 + var b1 []byte; + s1 := string(b1); + println(len(s1)); // prints 0 - b2 := ([]byte)(nil) - s2 := string(b2) - println(len(s2)) // prints 0 + b2 := ([]byte)(nil); + s2 := string(b2); + println(len(s2)); // prints 0 - s3 := string(([]byte)(nil)) // does not compile (literal substitution of b2) - println(len(s3)) + s3 := string(([]byte)(nil)); // does not compile (literal substitution of b2) + println(len(s3)); } /* diff --git a/test/fixedbugs/bug150.go b/test/fixedbugs/bug150.go index b2c4f15dc4..b565ef73dd 100644 --- a/test/fixedbugs/bug150.go +++ b/test/fixedbugs/bug150.go @@ -7,16 +7,15 @@ package bug150 type T int - func (t T) M() -type M interface{ M() } +type M interface { M() } func g() (T, T) func f() (a, b M) { - a, b = g() - return + a, b = g(); + return; } /* diff --git a/test/fixedbugs/bug151.go b/test/fixedbugs/bug151.go index 87a9c0201d..d9f5e021c9 100644 --- a/test/fixedbugs/bug151.go +++ b/test/fixedbugs/bug151.go @@ -8,10 +8,10 @@ package bug151 type S string -type Empty interface{} +type Empty interface {} func (v S) Less(e Empty) bool { - return v < e.(S) + return v < e.(S); } /* diff --git a/test/fixedbugs/bug152.go b/test/fixedbugs/bug152.go index 2f297656e4..45b9b3d530 100644 --- a/test/fixedbugs/bug152.go +++ b/test/fixedbugs/bug152.go @@ -7,11 +7,11 @@ package main func main() { - s := 0 + s := 0; for _, v := range []int{1} { - s += v + s += v; } if s != 1 { - println("BUG: s =", s) + println("BUG: s =", s); } } diff --git a/test/fixedbugs/bug154.go b/test/fixedbugs/bug154.go index 3162e80a4f..a2cfd4accd 100644 --- a/test/fixedbugs/bug154.go +++ b/test/fixedbugs/bug154.go @@ -9,23 +9,25 @@ package main import "fmt" func f0() string { - const f = 3.141592 - return fmt.Sprintf("%v", float64(f)) + const f = 3.141592; + return fmt.Sprintf("%v", float64(f)); } + func f1() string { - const f = 3.141592 - x := float64(float32(f)) // appears to change the precision of f - _ = x - return fmt.Sprintf("%v", float64(f)) + const f = 3.141592; + x := float64(float32(f)); // appears to change the precision of f + _ = x; + return fmt.Sprintf("%v", float64(f)); } + func main() { - r0 := f0() - r1 := f1() + r0 := f0(); + r1 := f1(); if r0 != r1 { - println("r0 =", r0) - println("r1 =", r1) - panic("r0 and r1 should be the same") + println("r0 =", r0); + println("r1 =", r1); + panic("r0 and r1 should be the same"); } } diff --git a/test/fixedbugs/bug155.go b/test/fixedbugs/bug155.go index ba2f1c04ca..8872e978da 100644 --- a/test/fixedbugs/bug155.go +++ b/test/fixedbugs/bug155.go @@ -6,7 +6,7 @@ package main -const big uint64 = 1 << 63 +const big uint64 = 1<<63 func f(a uint64) uint64 { return a << big diff --git a/test/fixedbugs/bug156.go b/test/fixedbugs/bug156.go index 7b6825fe83..f26658729f 100644 --- a/test/fixedbugs/bug156.go +++ b/test/fixedbugs/bug156.go @@ -7,9 +7,9 @@ package main func f(a int64) int64 { - const b int64 = 0 - n := a &^ b - return n + const b int64 = 0; + n := a &^ b; + return n; } func main() { diff --git a/test/fixedbugs/bug157.go b/test/fixedbugs/bug157.go index 160762c1cc..1072d7df49 100644 --- a/test/fixedbugs/bug157.go +++ b/test/fixedbugs/bug157.go @@ -9,26 +9,23 @@ package main func f() {} func main() { - x := 0 + x := 0; // this compiles switch x { - case 0: - f() - default: - f() + case 0: f(); + default: f(); } // this doesn't but it should // (semicolons are not needed at the end of a statement list) switch x { - case 0: - f() - default: - f() + case 0: f() + default: f() } } + /* bug157.go:20: syntax error near default bug157.go:20: first switch statement must be a case diff --git a/test/fixedbugs/bug158.go b/test/fixedbugs/bug158.go index 3e5c0eab29..496d7e0db0 100644 --- a/test/fixedbugs/bug158.go +++ b/test/fixedbugs/bug158.go @@ -7,7 +7,7 @@ package main func main() { - x := 0 + x := 0; // this compiles switch x { @@ -20,6 +20,7 @@ func main() { } } + /* bug158.go:14: fatal error: dowidth: unknown type: E-33 */ diff --git a/test/fixedbugs/bug159.go b/test/fixedbugs/bug159.go index 7dd0497135..92d5345635 100644 --- a/test/fixedbugs/bug159.go +++ b/test/fixedbugs/bug159.go @@ -9,9 +9,9 @@ package main import "os" func main() { - ok := true - var a, b, c, x, y, z int - f := func() int { b--; return -b } + ok := true; + var a, b, c, x, y, z int; + f := func() int { b--; return -b }; // this fails on 6g: apparently it rewrites // the list into @@ -19,21 +19,21 @@ func main() { // y = f(); // x = f(); // so that the values come out backward. - x, y, z = f(), f(), f() + x, y, z = f(), f(), f(); if x != 1 || y != 2 || z != 3 { - println("xyz: expected 1 2 3 got", x, y, z) - ok = false + println("xyz: expected 1 2 3 got", x, y, z); + ok = false; } // this fails on 6g too. one of the function calls // happens after assigning to b. - a, b, c = f(), f(), f() + a, b, c = f(), f(), f(); if a != 4 || b != 5 || c != 6 { - println("abc: expected 4 5 6 got", a, b, c) - ok = false + println("abc: expected 4 5 6 got", a, b, c); + ok = false; } if !ok { - os.Exit(1) + os.Exit(1); } } diff --git a/test/fixedbugs/bug160.dir/y.go b/test/fixedbugs/bug160.dir/y.go index 87039c98bc..428808dd19 100644 --- a/test/fixedbugs/bug160.dir/y.go +++ b/test/fixedbugs/bug160.dir/y.go @@ -9,11 +9,11 @@ import "./x" func main() { if x.Zero != 0 { - println("x.Zero = ", x.Zero) - os.Exit(1) + println("x.Zero = ", x.Zero); + os.Exit(1); } if x.Ten != 10 { - println("x.Ten = ", x.Ten) - os.Exit(1) + println("x.Ten = ", x.Ten); + os.Exit(1); } } diff --git a/test/fixedbugs/bug161.go b/test/fixedbugs/bug161.go index bf3c91eb82..aab58ee895 100644 --- a/test/fixedbugs/bug161.go +++ b/test/fixedbugs/bug161.go @@ -6,10 +6,10 @@ package P -const a = 0 +const a = 0; func f(a int) { - a = 0 + a = 0; } /* diff --git a/test/fixedbugs/bug165.go b/test/fixedbugs/bug165.go index 487ee992b9..f8d50af13f 100644 --- a/test/fixedbugs/bug165.go +++ b/test/fixedbugs/bug165.go @@ -7,9 +7,9 @@ package main type I interface { - m(map[I]bool) // ok + m(map[I] bool); // ok } type S struct { - m map[S]bool // ERROR "map key type" + m map[S] bool; // ERROR "map key type" } diff --git a/test/fixedbugs/bug170.go b/test/fixedbugs/bug170.go index 3255a04b85..11ff5ff3c7 100644 --- a/test/fixedbugs/bug170.go +++ b/test/fixedbugs/bug170.go @@ -5,11 +5,10 @@ // license that can be found in the LICENSE file. package main - -var v1 = ([10]int)(nil) // ERROR "illegal|nil|invalid" -var v2 [10]int = nil // ERROR "illegal|nil|incompatible" -var v3 [10]int -var v4 = nil // ERROR "nil" +var v1 = ([10]int)(nil); // ERROR "illegal|nil|invalid" +var v2 [10]int = nil; // ERROR "illegal|nil|incompatible" +var v3 [10]int; +var v4 = nil; // ERROR "nil" func main() { - v3 = nil // ERROR "illegal|nil|incompatible" + v3 = nil; // ERROR "illegal|nil|incompatible" } diff --git a/test/fixedbugs/bug171.go b/test/fixedbugs/bug171.go index 9284b686f4..49bbb3b892 100644 --- a/test/fixedbugs/bug171.go +++ b/test/fixedbugs/bug171.go @@ -6,5 +6,5 @@ package main -func f() int {} // ERROR "return|control" -func g() (foo int) {} // ERROR "return|control" +func f() int { } // ERROR "return|control" +func g() (foo int) { } // ERROR "return|control" diff --git a/test/fixedbugs/bug172.go b/test/fixedbugs/bug172.go index a4ee045ba5..4dbe7930f9 100644 --- a/test/fixedbugs/bug172.go +++ b/test/fixedbugs/bug172.go @@ -7,6 +7,6 @@ package main func f() { - a := true - a |= a // ERROR "illegal.*OR|bool|expected" + a := true; + a |= a; // ERROR "illegal.*OR|bool|expected" } diff --git a/test/fixedbugs/bug173.go b/test/fixedbugs/bug173.go index 20813cec99..3515c649bb 100644 --- a/test/fixedbugs/bug173.go +++ b/test/fixedbugs/bug173.go @@ -11,10 +11,9 @@ package main type T string - func main() { - var t T = "hello" - println(t[0:4], t[4]) + var t T = "hello"; + println(t[0:4], t[4]); for _, _ = range t { } for _ = range t { diff --git a/test/fixedbugs/bug174.go b/test/fixedbugs/bug174.go index c06670859d..448f630867 100644 --- a/test/fixedbugs/bug174.go +++ b/test/fixedbugs/bug174.go @@ -7,6 +7,6 @@ package main func main() { - var x uint - println(1 << x) + var x uint; + println(1<: fatal error: dowidth: unknown type: blank */ diff --git a/test/fixedbugs/bug219.go b/test/fixedbugs/bug219.go index 0d5afd70f5..290c691eab 100644 --- a/test/fixedbugs/bug219.go +++ b/test/fixedbugs/bug219.go @@ -12,10 +12,9 @@ func f(func()) int { return 0 } // bug219.go:16: syntax error near if func g1() { if x := f(func() { - if true { - } + if true {} }); true { - _ = x + _ = x; } } @@ -24,17 +23,16 @@ func g2() { if x := f(func() { //if true {} }); true { - _ = x + _ = x; } } // this works func g3() { x := f(func() { - if true { - } - }) + if true {} + }); if true { - _ = x + _ = x; } } diff --git a/test/fixedbugs/bug222.dir/chanbug.go b/test/fixedbugs/bug222.dir/chanbug.go index 75332d86c4..16920246e0 100644 --- a/test/fixedbugs/bug222.dir/chanbug.go +++ b/test/fixedbugs/bug222.dir/chanbug.go @@ -3,8 +3,7 @@ // license that can be found in the LICENSE file package chanbug - var C chan<- (chan int) var D chan<- func() var E func() chan int -var F func() func() +var F func() (func()) diff --git a/test/fixedbugs/bug222.dir/chanbug2.go b/test/fixedbugs/bug222.dir/chanbug2.go index f481082ede..109581dc30 100644 --- a/test/fixedbugs/bug222.dir/chanbug2.go +++ b/test/fixedbugs/bug222.dir/chanbug2.go @@ -3,5 +3,4 @@ // license that can be found in the LICENSE file package Bar - import _ "chanbug" diff --git a/test/fixedbugs/bug224.go b/test/fixedbugs/bug224.go index 107924a6ae..d2fd67cf32 100644 --- a/test/fixedbugs/bug224.go +++ b/test/fixedbugs/bug224.go @@ -6,4 +6,5 @@ package main -type T T // ERROR "recursive" +type T T // ERROR "recursive" + diff --git a/test/fixedbugs/bug225.go b/test/fixedbugs/bug225.go index 42c432c845..1bda9ab4b6 100644 --- a/test/fixedbugs/bug225.go +++ b/test/fixedbugs/bug225.go @@ -6,17 +6,17 @@ package main -func main() { - c := make(chan bool, 1) +func main() { + c := make(chan bool, 1); select { case _ = <-c: - panic("BUG: recv should not") + panic("BUG: recv should not"); default: } - c <- true + c <- true; select { case _ = <-c: default: - panic("BUG: recv should") + panic("BUG: recv should"); } } diff --git a/test/fixedbugs/bug229.go b/test/fixedbugs/bug229.go index 2dd10c2dac..4baf65e48b 100644 --- a/test/fixedbugs/bug229.go +++ b/test/fixedbugs/bug229.go @@ -10,11 +10,11 @@ import "testing" func main() { var t testing.T - + // make sure error mentions that // name is unexported, not just "name not found". - t.common.name = nil // ERROR "unexported" - - println(testing.anyLowercaseName("asdf")) // ERROR "unexported" "undefined: testing.anyLowercaseName" + t.common.name = nil // ERROR "unexported" + + println(testing.anyLowercaseName("asdf")) // ERROR "unexported" "undefined: testing.anyLowercaseName" } diff --git a/test/fixedbugs/bug231.go b/test/fixedbugs/bug231.go index 8b054edebd..f64ddc3e75 100644 --- a/test/fixedbugs/bug231.go +++ b/test/fixedbugs/bug231.go @@ -6,18 +6,17 @@ package main -type I interface{ m() } -type T struct{ m func() } -type M struct{} - +type I interface { m() } +type T struct { m func() } +type M struct {} func (M) m() {} func main() { var t T var m M var i I - + i = m - i = t // ERROR "not a method|has no methods" "does not implement I" + i = t // ERROR "not a method|has no methods" "does not implement I" _ = i } diff --git a/test/fixedbugs/bug232.go b/test/fixedbugs/bug232.go index d7a33a24e5..10b0c521a4 100644 --- a/test/fixedbugs/bug232.go +++ b/test/fixedbugs/bug232.go @@ -5,5 +5,4 @@ // license that can be found in the LICENSE file. package bug232 - -type I interface{ X(...int) } +type I interface { X(...int) } diff --git a/test/fixedbugs/bug233.go b/test/fixedbugs/bug233.go index 9f2d8d1e3d..d4e1e07816 100644 --- a/test/fixedbugs/bug233.go +++ b/test/fixedbugs/bug233.go @@ -5,8 +5,6 @@ // license that can be found in the LICENSE file. package bug233 - import p "fmt" - var _ = p.Print var fmt = 10 diff --git a/test/fixedbugs/bug235.go b/test/fixedbugs/bug235.go index 8dcebca66e..a33092bdb6 100644 --- a/test/fixedbugs/bug235.go +++ b/test/fixedbugs/bug235.go @@ -14,3 +14,4 @@ type T struct { var p *T var v = *p + diff --git a/test/fixedbugs/bug237.go b/test/fixedbugs/bug237.go index f736b9a93d..75d6132df9 100644 --- a/test/fixedbugs/bug237.go +++ b/test/fixedbugs/bug237.go @@ -9,7 +9,6 @@ package main import "fmt" var indent uint = 10 - func main() { const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " + ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " diff --git a/test/fixedbugs/bug238.go b/test/fixedbugs/bug238.go index 3b5995dd77..cc47189e16 100644 --- a/test/fixedbugs/bug238.go +++ b/test/fixedbugs/bug238.go @@ -18,3 +18,4 @@ const g interface{} = 7 // ERROR "constant|wrong|invalid" const h bool = false const i int = 2 const j float64 = 5 + diff --git a/test/fixedbugs/bug240.go b/test/fixedbugs/bug240.go index ae9dc35062..478b5b2eaf 100644 --- a/test/fixedbugs/bug240.go +++ b/test/fixedbugs/bug240.go @@ -6,7 +6,7 @@ package main -import . "unsafe" // ERROR "not used" +import . "unsafe" // ERROR "not used" func main() { var x int diff --git a/test/fixedbugs/bug241.go b/test/fixedbugs/bug241.go index ab7d0ce643..1f4440147b 100644 --- a/test/fixedbugs/bug241.go +++ b/test/fixedbugs/bug241.go @@ -7,5 +7,5 @@ package main const c = 3 +var x = c.String() // ERROR "String" -var x = c.String() // ERROR "String" diff --git a/test/fixedbugs/bug245.go b/test/fixedbugs/bug245.go index 9763349e25..adf62f98b5 100644 --- a/test/fixedbugs/bug245.go +++ b/test/fixedbugs/bug245.go @@ -7,7 +7,6 @@ package main type T []int - func (t T) m() func main() { diff --git a/test/fixedbugs/bug249.go b/test/fixedbugs/bug249.go index 1de59536bd..ec9699a894 100644 --- a/test/fixedbugs/bug249.go +++ b/test/fixedbugs/bug249.go @@ -6,34 +6,34 @@ package main -var c1 chan<- chan int = (chan<- (chan int))(nil) -var c2 chan<- chan int = (chan (<-chan int))(nil) // ERROR "chan|incompatible" -var c3 <-chan chan int = (<-chan (chan int))(nil) -var c4 chan chan<- int = (chan (chan<- int))(nil) - -var c5 <-chan <-chan int = (<-chan (<-chan int))(nil) -var c6 chan<- <-chan int = (chan<- (<-chan int))(nil) -var c7 chan<- chan<- int = (chan<- (chan<- int))(nil) - -var c8 <-chan <-chan chan int = (<-chan (<-chan (chan int)))(nil) -var c9 <-chan chan<- chan int = (<-chan (chan<- (chan int)))(nil) -var c10 chan<- <-chan chan int = (chan<- (<-chan (chan int)))(nil) -var c11 chan<- chan<- chan int = (chan<- (chan<- (chan int)))(nil) -var c12 chan chan<- <-chan int = (chan (chan<- (<-chan int)))(nil) -var c13 chan chan<- chan<- int = (chan (chan<- (chan<- int)))(nil) - -var r1 chan<- (chan int) = (chan<- chan int)(nil) -var r2 chan (<-chan int) = (chan<- chan int)(nil) // ERROR "chan|incompatible" -var r3 <-chan (chan int) = (<-chan chan int)(nil) -var r4 chan (chan<- int) = (chan chan<- int)(nil) - -var r5 <-chan (<-chan int) = (<-chan <-chan int)(nil) -var r6 chan<- (<-chan int) = (chan<- <-chan int)(nil) -var r7 chan<- (chan<- int) = (chan<- chan<- int)(nil) - -var r8 <-chan (<-chan (chan int)) = (<-chan <-chan chan int)(nil) -var r9 <-chan (chan<- (chan int)) = (<-chan chan<- chan int)(nil) -var r10 chan<- (<-chan (chan int)) = (chan<- <-chan chan int)(nil) -var r11 chan<- (chan<- (chan int)) = (chan<- chan<- chan int)(nil) -var r12 chan (chan<- (<-chan int)) = (chan chan<- <-chan int)(nil) -var r13 chan (chan<- (chan<- int)) = (chan chan<- chan<- int)(nil) +var c1 chan <- chan int = (chan<- (chan int))(nil) +var c2 chan <- chan int = (chan (<-chan int))(nil) // ERROR "chan|incompatible" +var c3 <- chan chan int = (<-chan (chan int))(nil) +var c4 chan chan <- int = (chan (chan<- int))(nil) + +var c5 <- chan <- chan int = (<-chan (<-chan int))(nil) +var c6 chan <- <- chan int = (chan<- (<-chan int))(nil) +var c7 chan <- chan <- int = (chan<- (chan<- int))(nil) + +var c8 <- chan <- chan chan int = (<-chan (<-chan (chan int)))(nil) +var c9 <- chan chan <- chan int = (<-chan (chan<- (chan int)))(nil) +var c10 chan <- <- chan chan int = (chan<- (<-chan (chan int)))(nil) +var c11 chan <- chan <- chan int = (chan<- (chan<- (chan int)))(nil) +var c12 chan chan <- <- chan int = (chan (chan<- (<-chan int)))(nil) +var c13 chan chan <- chan <- int = (chan (chan<- (chan<- int)))(nil) + +var r1 chan<- (chan int) = (chan <- chan int)(nil) +var r2 chan (<-chan int) = (chan <- chan int)(nil) // ERROR "chan|incompatible" +var r3 <-chan (chan int) = (<- chan chan int)(nil) +var r4 chan (chan<- int) = (chan chan <- int)(nil) + +var r5 <-chan (<-chan int) = (<- chan <- chan int)(nil) +var r6 chan<- (<-chan int) = (chan <- <- chan int)(nil) +var r7 chan<- (chan<- int) = (chan <- chan <- int)(nil) + +var r8 <-chan (<-chan (chan int)) = (<- chan <- chan chan int)(nil) +var r9 <-chan (chan<- (chan int)) = (<- chan chan <- chan int)(nil) +var r10 chan<- (<-chan (chan int)) = (chan <- <- chan chan int)(nil) +var r11 chan<- (chan<- (chan int)) = (chan <- chan <- chan int)(nil) +var r12 chan (chan<- (<-chan int)) = (chan chan <- <- chan int)(nil) +var r13 chan (chan<- (chan<- int)) = (chan chan <- chan <- int)(nil) diff --git a/test/fixedbugs/bug251.go b/test/fixedbugs/bug251.go index a0c04319b3..05e111a61f 100644 --- a/test/fixedbugs/bug251.go +++ b/test/fixedbugs/bug251.go @@ -19,6 +19,7 @@ type I2 interface { I1 // GCCGO_ERROR "loop|interface" } + var i1 I1 = i2 var i2 I2 var i2a I2 = i1 diff --git a/test/fixedbugs/bug252.go b/test/fixedbugs/bug252.go index 19b37b00d0..f678925fbb 100644 --- a/test/fixedbugs/bug252.go +++ b/test/fixedbugs/bug252.go @@ -11,5 +11,5 @@ func f(args ...int) { } func g(args ...interface{}) { - f(args) // ERROR "cannot use|incompatible" + f(args) // ERROR "cannot use|incompatible" } diff --git a/test/fixedbugs/bug256.go b/test/fixedbugs/bug256.go index 3a6df90969..705a0321b4 100644 --- a/test/fixedbugs/bug256.go +++ b/test/fixedbugs/bug256.go @@ -6,9 +6,11 @@ package main -type T U // bogus "invalid recursive type T" from 6g +type T U // bogus "invalid recursive type T" from 6g type U int const x T = 123 -type V V // ERROR "invalid recursive type" +type V V // ERROR "invalid recursive type" + + diff --git a/test/fixedbugs/bug258.go b/test/fixedbugs/bug258.go index d4b993ab00..075da87577 100644 --- a/test/fixedbugs/bug258.go +++ b/test/fixedbugs/bug258.go @@ -25,7 +25,7 @@ func main() { } else { println("BUG 2") } - + if math.Pow(2, 3) != 8 { println("BUG 3") } diff --git a/test/fixedbugs/bug259.go b/test/fixedbugs/bug259.go index 4946a3d4dc..857b442010 100644 --- a/test/fixedbugs/bug259.go +++ b/test/fixedbugs/bug259.go @@ -9,7 +9,7 @@ package main import "fmt" var x = uint32(0x01020304) -var y = [...]uint32{1, 2, 3, 4, 5} +var y = [...]uint32{1,2,3,4,5} func main() { fmt.Sprint(y[byte(x)]) diff --git a/test/fixedbugs/bug261.go b/test/fixedbugs/bug261.go index 3645d27d05..abe6431b51 100644 --- a/test/fixedbugs/bug261.go +++ b/test/fixedbugs/bug261.go @@ -14,7 +14,7 @@ func f() int { } func main() { - x := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} + x := []int{0,1,2,3,4,5,6,7,8,9,10} n = 5 y := x[f():f()] if len(y) != 1 || y[0] != 6 { diff --git a/test/fixedbugs/bug266.go b/test/fixedbugs/bug266.go index b51c5acdad..5d2334c05a 100644 --- a/test/fixedbugs/bug266.go +++ b/test/fixedbugs/bug266.go @@ -13,12 +13,12 @@ func f() int { panic("oops") } -func g() int { +func g() int { return 12345 } func main() { - g() // leave 12345 on stack + g() // leave 12345 on stack x := f() if x != 0 { panic(x) diff --git a/test/fixedbugs/bug269.go b/test/fixedbugs/bug269.go index 4241faf9b5..ec0dbc6c34 100644 --- a/test/fixedbugs/bug269.go +++ b/test/fixedbugs/bug269.go @@ -13,6 +13,6 @@ func f() (ok bool) { return false } func main() { var i interface{} i = f - _ = i.(func() bool) - _ = i.(func() bool) + _ = i.(func()bool) + _ = i.(func()(bool)) } diff --git a/test/fixedbugs/bug271.go b/test/fixedbugs/bug271.go index d285f29be0..a6abbfef7e 100644 --- a/test/fixedbugs/bug271.go +++ b/test/fixedbugs/bug271.go @@ -14,7 +14,7 @@ func f() (int, int) { return 1, 2 } func main() { s := fmt.Sprint(f()) - if s != "1 2" { // with bug, was "{1 2}" + if s != "1 2" { // with bug, was "{1 2}" println("BUG") } } diff --git a/test/fixedbugs/bug272.go b/test/fixedbugs/bug272.go index ca39cbb4ce..6b8862f697 100644 --- a/test/fixedbugs/bug272.go +++ b/test/fixedbugs/bug272.go @@ -8,15 +8,15 @@ package main -func main() { +func main() { n := int64(100) x := make([]int, n) - x[99] = 234 + x[99] = 234; z := x[n-1] if z != 234 { println("BUG") } - n |= 1 << 32 + n |= 1<<32 defer func() { recover() }() diff --git a/test/fixedbugs/bug276.go b/test/fixedbugs/bug276.go index a9af72cf63..dc2308ea6b 100644 --- a/test/fixedbugs/bug276.go +++ b/test/fixedbugs/bug276.go @@ -13,10 +13,10 @@ func main() { x := 0 a := (x & 1) << uint(1-i) - - s := uint(1 - i) + + s := uint(1-i) b := (x & 1) << s - + if a != b { panic(0) } diff --git a/test/fixedbugs/bug277.go b/test/fixedbugs/bug277.go index fe87a07006..207556493e 100644 --- a/test/fixedbugs/bug277.go +++ b/test/fixedbugs/bug277.go @@ -43,7 +43,7 @@ func main() { x int }(s) p = (*S)(p) - f = (func(x int) int)(f) + f = func(x int) int(f) i = (interface { m(x int) int })(s) // this is accepted by 6g diff --git a/test/fixedbugs/bug278.go b/test/fixedbugs/bug278.go index 592aac9190..4817ebfee4 100644 --- a/test/fixedbugs/bug278.go +++ b/test/fixedbugs/bug278.go @@ -15,9 +15,9 @@ func f() [10]int { var m map[int][10]int func main() { - f()[1] = 2 // ERROR "cannot|invalid" - f()[2:3][0] = 4 // ERROR "cannot|addressable" + f()[1] = 2 // ERROR "cannot|invalid" + f()[2:3][0] = 4 // ERROR "cannot|addressable" var x = "abc" - x[2] = 3 // ERROR "cannot|invalid" - m[0][5] = 6 // ERROR "cannot|invalid" + x[2] = 3 // ERROR "cannot|invalid" + m[0][5] = 6 // ERROR "cannot|invalid" } diff --git a/test/fixedbugs/bug279.go b/test/fixedbugs/bug279.go index c2a9a533d6..3b1df3b8fe 100644 --- a/test/fixedbugs/bug279.go +++ b/test/fixedbugs/bug279.go @@ -21,7 +21,7 @@ func main() { println("BUG alignof 0", n) return } - + n = unsafe.Sizeof("") if n != 8 && n != 16 { println("BUG sizeof \"\"", n) @@ -33,3 +33,4 @@ func main() { return } } + diff --git a/test/fixedbugs/bug280.go b/test/fixedbugs/bug280.go index c23642ea20..afec57f037 100644 --- a/test/fixedbugs/bug280.go +++ b/test/fixedbugs/bug280.go @@ -8,4 +8,6 @@ package main -type A [...]int // ERROR "outside of array literal" +type A [...]int // ERROR "outside of array literal" + + diff --git a/test/fixedbugs/bug281.go b/test/fixedbugs/bug281.go index d52d932e32..c65530f7dd 100644 --- a/test/fixedbugs/bug281.go +++ b/test/fixedbugs/bug281.go @@ -17,7 +17,7 @@ type Rect struct { } func (p Point) Sub(q Point) Point { - return Point{p.X - q.X, p.Y - q.Y} + return Point{p.X-q.X, p.Y-q.Y} } type Obj struct { @@ -28,7 +28,7 @@ func (o *Obj) Bbox() Rect { return o.bbox } -func (o *Obj) Points() [2]Point { +func (o *Obj) Points() [2]Point{ return [2]Point{o.bbox.Min, o.bbox.Max} } @@ -42,12 +42,12 @@ func main() { println("BUG dot: ", q.X, q.Y) return } - + q = p.Sub(o.Points()[0]) if q.X != 0 || q.Y != 300 { println("BUG index const: ", q.X, q.Y) } - + q = p.Sub(o.Points()[x]) if q.X != 0 || q.Y != 300 { println("BUG index var: ", q.X, q.Y) diff --git a/test/fixedbugs/bug282.dir/p1.go b/test/fixedbugs/bug282.dir/p1.go index 1fbfa3aa74..0f7422c0ba 100644 --- a/test/fixedbugs/bug282.dir/p1.go +++ b/test/fixedbugs/bug282.dir/p1.go @@ -7,3 +7,4 @@ package p1 type T struct { f func() "x" } + diff --git a/test/fixedbugs/bug282.dir/p2.go b/test/fixedbugs/bug282.dir/p2.go index 6e72020dcf..f614507946 100644 --- a/test/fixedbugs/bug282.dir/p2.go +++ b/test/fixedbugs/bug282.dir/p2.go @@ -5,3 +5,4 @@ package p2 import _ "./p1" + diff --git a/test/fixedbugs/bug284.go b/test/fixedbugs/bug284.go index 589eec15eb..68208085fa 100644 --- a/test/fixedbugs/bug284.go +++ b/test/fixedbugs/bug284.go @@ -108,7 +108,7 @@ func main() { var f2 F2 f0 = f0 f0 = f1 - f0 = (func(x NewInt) int)(f2) // ERROR "cannot|invalid" + f0 = func(x NewInt) int(f2) // ERROR "cannot|invalid" f1 = f0 f1 = f1 f1 = F1(f2) // ERROR "cannot|invalid" diff --git a/test/fixedbugs/bug285.go b/test/fixedbugs/bug285.go index 5b33ab7d42..0632ab4ba7 100644 --- a/test/fixedbugs/bug285.go +++ b/test/fixedbugs/bug285.go @@ -66,7 +66,7 @@ func main() { m0[z] = 42 // this should work: z is assignment-compatible with interface{} m0[new(struct { x int - })] = 42 // this should work: *struct{x int} is assignment-compatible with interface{} + })] = 42 // this should work: *struct{x int} is assignment-compatible with interface{} m0[p] = 42 // this should work: p is assignment-compatible with interface{} m0[false] = 42 // this should work: false is assignment-compatible with interface{} m0[17] = 42 // this should work: 17 is assignment-compatible with interface{} @@ -76,7 +76,7 @@ func main() { m1[i1] = 42 m1[new(struct { x int - })] = 42 // this should work: *struct{x int} is assignment-compatible with I1 + })] = 42 // this should work: *struct{x int} is assignment-compatible with I1 m1[false] = 42 // this should work: false is assignment-compatible with I1 m1[17] = 42 // this should work: 17 is assignment-compatible with I1 m1["foo"] = 42 // this should work: "foo" is assignment-compatible with I1 diff --git a/test/fixedbugs/bug287.go b/test/fixedbugs/bug287.go index 5ca280f6fa..94582a8695 100644 --- a/test/fixedbugs/bug287.go +++ b/test/fixedbugs/bug287.go @@ -8,4 +8,4 @@ package main -var mult [3][...]byte = [3][5]byte{} // ERROR "\.\.\." +var mult [3][...]byte = [3][5]byte{} // ERROR "\.\.\." diff --git a/test/fixedbugs/bug289.go b/test/fixedbugs/bug289.go index 8334b8f5ed..3fc7fb2eef 100644 --- a/test/fixedbugs/bug289.go +++ b/test/fixedbugs/bug289.go @@ -9,18 +9,18 @@ package main func f1() { - a, b := f() // ERROR "assignment mismatch|does not match" + a, b := f() // ERROR "assignment mismatch|does not match" _ = a _ = b } func f2() { var a, b int - a, b = f() // ERROR "assignment mismatch|does not match" + a, b = f() // ERROR "assignment mismatch|does not match" _ = a _ = b } func f() int { - return 1 + return 1; } diff --git a/test/fixedbugs/bug290.go b/test/fixedbugs/bug290.go index ae648d2531..4eee285a35 100644 --- a/test/fixedbugs/bug290.go +++ b/test/fixedbugs/bug290.go @@ -8,8 +8,8 @@ package main -type X struct{ x []X } +type X struct { x []X } func main() { - type Y struct{ x []Y } // used to get invalid recursive type + type Y struct { x []Y } // used to get invalid recursive type } diff --git a/test/fixedbugs/bug293.go b/test/fixedbugs/bug293.go index e834a4bc85..ae7cc1fd1c 100644 --- a/test/fixedbugs/bug293.go +++ b/test/fixedbugs/bug293.go @@ -9,7 +9,7 @@ package main func x() (a int, b bool) { - defer func() { + defer func(){ a++ }() a, b = y() @@ -17,7 +17,7 @@ func x() (a int, b bool) { } func x2() (a int, b bool) { - defer func() { + defer func(){ a++ }() return y() diff --git a/test/fixedbugs/bug294.go b/test/fixedbugs/bug294.go index 26e922df6b..b35b771916 100644 --- a/test/fixedbugs/bug294.go +++ b/test/fixedbugs/bug294.go @@ -76,3 +76,4 @@ func main() { bad() } } + diff --git a/test/fixedbugs/bug295.go b/test/fixedbugs/bug295.go index 691aa92c7f..d1c961ce1d 100644 --- a/test/fixedbugs/bug295.go +++ b/test/fixedbugs/bug295.go @@ -6,7 +6,7 @@ package main -import . "testing" // defines file-level T +import . "testing" // defines file-level T type _ B // make use of package "testing" (but don't refer to T) @@ -15,5 +15,5 @@ type S struct { } func main() { - _ = &S{T: 1} // should work + _ = &S{T: 1} // should work } diff --git a/test/fixedbugs/bug297.go b/test/fixedbugs/bug297.go index 4d14ad2475..c2bd253d05 100644 --- a/test/fixedbugs/bug297.go +++ b/test/fixedbugs/bug297.go @@ -9,8 +9,7 @@ package main type ByteSize float64 - const ( - _ = iota // ignore first value by assigning to blank identifier - KB ByteSize = 1 << (10 * X) // ERROR "undefined" + _ = iota; // ignore first value by assigning to blank identifier + KB ByteSize = 1<<(10*X) // ERROR "undefined" ) diff --git a/test/fixedbugs/bug302.dir/main.go b/test/fixedbugs/bug302.dir/main.go index 9d3356f387..52c054fb4c 100644 --- a/test/fixedbugs/bug302.dir/main.go +++ b/test/fixedbugs/bug302.dir/main.go @@ -9,3 +9,4 @@ import _ "p" // Check that it's still correct in pp.a (which contains p.6). import _ "pp" + diff --git a/test/fixedbugs/bug302.dir/p.go b/test/fixedbugs/bug302.dir/p.go index 1f3cfcbb3c..0be521b4f8 100644 --- a/test/fixedbugs/bug302.dir/p.go +++ b/test/fixedbugs/bug302.dir/p.go @@ -5,1005 +5,1005 @@ package p type T struct { - x1 int - x2 int - x3 int - x4 int - x5 int - x6 int - x7 int - x8 int - x9 int - x10 int - x11 int - x12 int - x13 int - x14 int - x15 int - x16 int - x17 int - x18 int - x19 int - x20 int - x21 int - x22 int - x23 int - x24 int - x25 int - x26 int - x27 int - x28 int - x29 int - x30 int - x31 int - x32 int - x33 int - x34 int - x35 int - x36 int - x37 int - x38 int - x39 int - x40 int - x41 int - x42 int - x43 int - x44 int - x45 int - x46 int - x47 int - x48 int - x49 int - x50 int - x51 int - x52 int - x53 int - x54 int - x55 int - x56 int - x57 int - x58 int - x59 int - x60 int - x61 int - x62 int - x63 int - x64 int - x65 int - x66 int - x67 int - x68 int - x69 int - x70 int - x71 int - x72 int - x73 int - x74 int - x75 int - x76 int - x77 int - x78 int - x79 int - x80 int - x81 int - x82 int - x83 int - x84 int - x85 int - x86 int - x87 int - x88 int - x89 int - x90 int - x91 int - x92 int - x93 int - x94 int - x95 int - x96 int - x97 int - x98 int - x99 int - x100 int - x101 int - x102 int - x103 int - x104 int - x105 int - x106 int - x107 int - x108 int - x109 int - x110 int - x111 int - x112 int - x113 int - x114 int - x115 int - x116 int - x117 int - x118 int - x119 int - x120 int - x121 int - x122 int - x123 int - x124 int - x125 int - x126 int - x127 int - x128 int - x129 int - x130 int - x131 int - x132 int - x133 int - x134 int - x135 int - x136 int - x137 int - x138 int - x139 int - x140 int - x141 int - x142 int - x143 int - x144 int - x145 int - x146 int - x147 int - x148 int - x149 int - x150 int - x151 int - x152 int - x153 int - x154 int - x155 int - x156 int - x157 int - x158 int - x159 int - x160 int - x161 int - x162 int - x163 int - x164 int - x165 int - x166 int - x167 int - x168 int - x169 int - x170 int - x171 int - x172 int - x173 int - x174 int - x175 int - x176 int - x177 int - x178 int - x179 int - x180 int - x181 int - x182 int - x183 int - x184 int - x185 int - x186 int - x187 int - x188 int - x189 int - x190 int - x191 int - x192 int - x193 int - x194 int - x195 int - x196 int - x197 int - x198 int - x199 int - x200 int - x201 int - x202 int - x203 int - x204 int - x205 int - x206 int - x207 int - x208 int - x209 int - x210 int - x211 int - x212 int - x213 int - x214 int - x215 int - x216 int - x217 int - x218 int - x219 int - x220 int - x221 int - x222 int - x223 int - x224 int - x225 int - x226 int - x227 int - x228 int - x229 int - x230 int - x231 int - x232 int - x233 int - x234 int - x235 int - x236 int - x237 int - x238 int - x239 int - x240 int - x241 int - x242 int - x243 int - x244 int - x245 int - x246 int - x247 int - x248 int - x249 int - x250 int - x251 int - x252 int - x253 int - x254 int - x255 int - x256 int - x257 int - x258 int - x259 int - x260 int - x261 int - x262 int - x263 int - x264 int - x265 int - x266 int - x267 int - x268 int - x269 int - x270 int - x271 int - x272 int - x273 int - x274 int - x275 int - x276 int - x277 int - x278 int - x279 int - x280 int - x281 int - x282 int - x283 int - x284 int - x285 int - x286 int - x287 int - x288 int - x289 int - x290 int - x291 int - x292 int - x293 int - x294 int - x295 int - x296 int - x297 int - x298 int - x299 int - x300 int - x301 int - x302 int - x303 int - x304 int - x305 int - x306 int - x307 int - x308 int - x309 int - x310 int - x311 int - x312 int - x313 int - x314 int - x315 int - x316 int - x317 int - x318 int - x319 int - x320 int - x321 int - x322 int - x323 int - x324 int - x325 int - x326 int - x327 int - x328 int - x329 int - x330 int - x331 int - x332 int - x333 int - x334 int - x335 int - x336 int - x337 int - x338 int - x339 int - x340 int - x341 int - x342 int - x343 int - x344 int - x345 int - x346 int - x347 int - x348 int - x349 int - x350 int - x351 int - x352 int - x353 int - x354 int - x355 int - x356 int - x357 int - x358 int - x359 int - x360 int - x361 int - x362 int - x363 int - x364 int - x365 int - x366 int - x367 int - x368 int - x369 int - x370 int - x371 int - x372 int - x373 int - x374 int - x375 int - x376 int - x377 int - x378 int - x379 int - x380 int - x381 int - x382 int - x383 int - x384 int - x385 int - x386 int - x387 int - x388 int - x389 int - x390 int - x391 int - x392 int - x393 int - x394 int - x395 int - x396 int - x397 int - x398 int - x399 int - x400 int - x401 int - x402 int - x403 int - x404 int - x405 int - x406 int - x407 int - x408 int - x409 int - x410 int - x411 int - x412 int - x413 int - x414 int - x415 int - x416 int - x417 int - x418 int - x419 int - x420 int - x421 int - x422 int - x423 int - x424 int - x425 int - x426 int - x427 int - x428 int - x429 int - x430 int - x431 int - x432 int - x433 int - x434 int - x435 int - x436 int - x437 int - x438 int - x439 int - x440 int - x441 int - x442 int - x443 int - x444 int - x445 int - x446 int - x447 int - x448 int - x449 int - x450 int - x451 int - x452 int - x453 int - x454 int - x455 int - x456 int - x457 int - x458 int - x459 int - x460 int - x461 int - x462 int - x463 int - x464 int - x465 int - x466 int - x467 int - x468 int - x469 int - x470 int - x471 int - x472 int - x473 int - x474 int - x475 int - x476 int - x477 int - x478 int - x479 int - x480 int - x481 int - x482 int - x483 int - x484 int - x485 int - x486 int - x487 int - x488 int - x489 int - x490 int - x491 int - x492 int - x493 int - x494 int - x495 int - x496 int - x497 int - x498 int - x499 int - x500 int - x501 int - x502 int - x503 int - x504 int - x505 int - x506 int - x507 int - x508 int - x509 int - x510 int - x511 int - x512 int - x513 int - x514 int - x515 int - x516 int - x517 int - x518 int - x519 int - x520 int - x521 int - x522 int - x523 int - x524 int - x525 int - x526 int - x527 int - x528 int - x529 int - x530 int - x531 int - x532 int - x533 int - x534 int - x535 int - x536 int - x537 int - x538 int - x539 int - x540 int - x541 int - x542 int - x543 int - x544 int - x545 int - x546 int - x547 int - x548 int - x549 int - x550 int - x551 int - x552 int - x553 int - x554 int - x555 int - x556 int - x557 int - x558 int - x559 int - x560 int - x561 int - x562 int - x563 int - x564 int - x565 int - x566 int - x567 int - x568 int - x569 int - x570 int - x571 int - x572 int - x573 int - x574 int - x575 int - x576 int - x577 int - x578 int - x579 int - x580 int - x581 int - x582 int - x583 int - x584 int - x585 int - x586 int - x587 int - x588 int - x589 int - x590 int - x591 int - x592 int - x593 int - x594 int - x595 int - x596 int - x597 int - x598 int - x599 int - x600 int - x601 int - x602 int - x603 int - x604 int - x605 int - x606 int - x607 int - x608 int - x609 int - x610 int - x611 int - x612 int - x613 int - x614 int - x615 int - x616 int - x617 int - x618 int - x619 int - x620 int - x621 int - x622 int - x623 int - x624 int - x625 int - x626 int - x627 int - x628 int - x629 int - x630 int - x631 int - x632 int - x633 int - x634 int - x635 int - x636 int - x637 int - x638 int - x639 int - x640 int - x641 int - x642 int - x643 int - x644 int - x645 int - x646 int - x647 int - x648 int - x649 int - x650 int - x651 int - x652 int - x653 int - x654 int - x655 int - x656 int - x657 int - x658 int - x659 int - x660 int - x661 int - x662 int - x663 int - x664 int - x665 int - x666 int - x667 int - x668 int - x669 int - x670 int - x671 int - x672 int - x673 int - x674 int - x675 int - x676 int - x677 int - x678 int - x679 int - x680 int - x681 int - x682 int - x683 int - x684 int - x685 int - x686 int - x687 int - x688 int - x689 int - x690 int - x691 int - x692 int - x693 int - x694 int - x695 int - x696 int - x697 int - x698 int - x699 int - x700 int - x701 int - x702 int - x703 int - x704 int - x705 int - x706 int - x707 int - x708 int - x709 int - x710 int - x711 int - x712 int - x713 int - x714 int - x715 int - x716 int - x717 int - x718 int - x719 int - x720 int - x721 int - x722 int - x723 int - x724 int - x725 int - x726 int - x727 int - x728 int - x729 int - x730 int - x731 int - x732 int - x733 int - x734 int - x735 int - x736 int - x737 int - x738 int - x739 int - x740 int - x741 int - x742 int - x743 int - x744 int - x745 int - x746 int - x747 int - x748 int - x749 int - x750 int - x751 int - x752 int - x753 int - x754 int - x755 int - x756 int - x757 int - x758 int - x759 int - x760 int - x761 int - x762 int - x763 int - x764 int - x765 int - x766 int - x767 int - x768 int - x769 int - x770 int - x771 int - x772 int - x773 int - x774 int - x775 int - x776 int - x777 int - x778 int - x779 int - x780 int - x781 int - x782 int - x783 int - x784 int - x785 int - x786 int - x787 int - x788 int - x789 int - x790 int - x791 int - x792 int - x793 int - x794 int - x795 int - x796 int - x797 int - x798 int - x799 int - x800 int - x801 int - x802 int - x803 int - x804 int - x805 int - x806 int - x807 int - x808 int - x809 int - x810 int - x811 int - x812 int - x813 int - x814 int - x815 int - x816 int - x817 int - x818 int - x819 int - x820 int - x821 int - x822 int - x823 int - x824 int - x825 int - x826 int - x827 int - x828 int - x829 int - x830 int - x831 int - x832 int - x833 int - x834 int - x835 int - x836 int - x837 int - x838 int - x839 int - x840 int - x841 int - x842 int - x843 int - x844 int - x845 int - x846 int - x847 int - x848 int - x849 int - x850 int - x851 int - x852 int - x853 int - x854 int - x855 int - x856 int - x857 int - x858 int - x859 int - x860 int - x861 int - x862 int - x863 int - x864 int - x865 int - x866 int - x867 int - x868 int - x869 int - x870 int - x871 int - x872 int - x873 int - x874 int - x875 int - x876 int - x877 int - x878 int - x879 int - x880 int - x881 int - x882 int - x883 int - x884 int - x885 int - x886 int - x887 int - x888 int - x889 int - x890 int - x891 int - x892 int - x893 int - x894 int - x895 int - x896 int - x897 int - x898 int - x899 int - x900 int - x901 int - x902 int - x903 int - x904 int - x905 int - x906 int - x907 int - x908 int - x909 int - x910 int - x911 int - x912 int - x913 int - x914 int - x915 int - x916 int - x917 int - x918 int - x919 int - x920 int - x921 int - x922 int - x923 int - x924 int - x925 int - x926 int - x927 int - x928 int - x929 int - x930 int - x931 int - x932 int - x933 int - x934 int - x935 int - x936 int - x937 int - x938 int - x939 int - x940 int - x941 int - x942 int - x943 int - x944 int - x945 int - x946 int - x947 int - x948 int - x949 int - x950 int - x951 int - x952 int - x953 int - x954 int - x955 int - x956 int - x957 int - x958 int - x959 int - x960 int - x961 int - x962 int - x963 int - x964 int - x965 int - x966 int - x967 int - x968 int - x969 int - x970 int - x971 int - x972 int - x973 int - x974 int - x975 int - x976 int - x977 int - x978 int - x979 int - x980 int - x981 int - x982 int - x983 int - x984 int - x985 int - x986 int - x987 int - x988 int - x989 int - x990 int - x991 int - x992 int - x993 int - x994 int - x995 int - x996 int - x997 int - x998 int - x999 int + x1 int + x2 int + x3 int + x4 int + x5 int + x6 int + x7 int + x8 int + x9 int + x10 int + x11 int + x12 int + x13 int + x14 int + x15 int + x16 int + x17 int + x18 int + x19 int + x20 int + x21 int + x22 int + x23 int + x24 int + x25 int + x26 int + x27 int + x28 int + x29 int + x30 int + x31 int + x32 int + x33 int + x34 int + x35 int + x36 int + x37 int + x38 int + x39 int + x40 int + x41 int + x42 int + x43 int + x44 int + x45 int + x46 int + x47 int + x48 int + x49 int + x50 int + x51 int + x52 int + x53 int + x54 int + x55 int + x56 int + x57 int + x58 int + x59 int + x60 int + x61 int + x62 int + x63 int + x64 int + x65 int + x66 int + x67 int + x68 int + x69 int + x70 int + x71 int + x72 int + x73 int + x74 int + x75 int + x76 int + x77 int + x78 int + x79 int + x80 int + x81 int + x82 int + x83 int + x84 int + x85 int + x86 int + x87 int + x88 int + x89 int + x90 int + x91 int + x92 int + x93 int + x94 int + x95 int + x96 int + x97 int + x98 int + x99 int + x100 int + x101 int + x102 int + x103 int + x104 int + x105 int + x106 int + x107 int + x108 int + x109 int + x110 int + x111 int + x112 int + x113 int + x114 int + x115 int + x116 int + x117 int + x118 int + x119 int + x120 int + x121 int + x122 int + x123 int + x124 int + x125 int + x126 int + x127 int + x128 int + x129 int + x130 int + x131 int + x132 int + x133 int + x134 int + x135 int + x136 int + x137 int + x138 int + x139 int + x140 int + x141 int + x142 int + x143 int + x144 int + x145 int + x146 int + x147 int + x148 int + x149 int + x150 int + x151 int + x152 int + x153 int + x154 int + x155 int + x156 int + x157 int + x158 int + x159 int + x160 int + x161 int + x162 int + x163 int + x164 int + x165 int + x166 int + x167 int + x168 int + x169 int + x170 int + x171 int + x172 int + x173 int + x174 int + x175 int + x176 int + x177 int + x178 int + x179 int + x180 int + x181 int + x182 int + x183 int + x184 int + x185 int + x186 int + x187 int + x188 int + x189 int + x190 int + x191 int + x192 int + x193 int + x194 int + x195 int + x196 int + x197 int + x198 int + x199 int + x200 int + x201 int + x202 int + x203 int + x204 int + x205 int + x206 int + x207 int + x208 int + x209 int + x210 int + x211 int + x212 int + x213 int + x214 int + x215 int + x216 int + x217 int + x218 int + x219 int + x220 int + x221 int + x222 int + x223 int + x224 int + x225 int + x226 int + x227 int + x228 int + x229 int + x230 int + x231 int + x232 int + x233 int + x234 int + x235 int + x236 int + x237 int + x238 int + x239 int + x240 int + x241 int + x242 int + x243 int + x244 int + x245 int + x246 int + x247 int + x248 int + x249 int + x250 int + x251 int + x252 int + x253 int + x254 int + x255 int + x256 int + x257 int + x258 int + x259 int + x260 int + x261 int + x262 int + x263 int + x264 int + x265 int + x266 int + x267 int + x268 int + x269 int + x270 int + x271 int + x272 int + x273 int + x274 int + x275 int + x276 int + x277 int + x278 int + x279 int + x280 int + x281 int + x282 int + x283 int + x284 int + x285 int + x286 int + x287 int + x288 int + x289 int + x290 int + x291 int + x292 int + x293 int + x294 int + x295 int + x296 int + x297 int + x298 int + x299 int + x300 int + x301 int + x302 int + x303 int + x304 int + x305 int + x306 int + x307 int + x308 int + x309 int + x310 int + x311 int + x312 int + x313 int + x314 int + x315 int + x316 int + x317 int + x318 int + x319 int + x320 int + x321 int + x322 int + x323 int + x324 int + x325 int + x326 int + x327 int + x328 int + x329 int + x330 int + x331 int + x332 int + x333 int + x334 int + x335 int + x336 int + x337 int + x338 int + x339 int + x340 int + x341 int + x342 int + x343 int + x344 int + x345 int + x346 int + x347 int + x348 int + x349 int + x350 int + x351 int + x352 int + x353 int + x354 int + x355 int + x356 int + x357 int + x358 int + x359 int + x360 int + x361 int + x362 int + x363 int + x364 int + x365 int + x366 int + x367 int + x368 int + x369 int + x370 int + x371 int + x372 int + x373 int + x374 int + x375 int + x376 int + x377 int + x378 int + x379 int + x380 int + x381 int + x382 int + x383 int + x384 int + x385 int + x386 int + x387 int + x388 int + x389 int + x390 int + x391 int + x392 int + x393 int + x394 int + x395 int + x396 int + x397 int + x398 int + x399 int + x400 int + x401 int + x402 int + x403 int + x404 int + x405 int + x406 int + x407 int + x408 int + x409 int + x410 int + x411 int + x412 int + x413 int + x414 int + x415 int + x416 int + x417 int + x418 int + x419 int + x420 int + x421 int + x422 int + x423 int + x424 int + x425 int + x426 int + x427 int + x428 int + x429 int + x430 int + x431 int + x432 int + x433 int + x434 int + x435 int + x436 int + x437 int + x438 int + x439 int + x440 int + x441 int + x442 int + x443 int + x444 int + x445 int + x446 int + x447 int + x448 int + x449 int + x450 int + x451 int + x452 int + x453 int + x454 int + x455 int + x456 int + x457 int + x458 int + x459 int + x460 int + x461 int + x462 int + x463 int + x464 int + x465 int + x466 int + x467 int + x468 int + x469 int + x470 int + x471 int + x472 int + x473 int + x474 int + x475 int + x476 int + x477 int + x478 int + x479 int + x480 int + x481 int + x482 int + x483 int + x484 int + x485 int + x486 int + x487 int + x488 int + x489 int + x490 int + x491 int + x492 int + x493 int + x494 int + x495 int + x496 int + x497 int + x498 int + x499 int + x500 int + x501 int + x502 int + x503 int + x504 int + x505 int + x506 int + x507 int + x508 int + x509 int + x510 int + x511 int + x512 int + x513 int + x514 int + x515 int + x516 int + x517 int + x518 int + x519 int + x520 int + x521 int + x522 int + x523 int + x524 int + x525 int + x526 int + x527 int + x528 int + x529 int + x530 int + x531 int + x532 int + x533 int + x534 int + x535 int + x536 int + x537 int + x538 int + x539 int + x540 int + x541 int + x542 int + x543 int + x544 int + x545 int + x546 int + x547 int + x548 int + x549 int + x550 int + x551 int + x552 int + x553 int + x554 int + x555 int + x556 int + x557 int + x558 int + x559 int + x560 int + x561 int + x562 int + x563 int + x564 int + x565 int + x566 int + x567 int + x568 int + x569 int + x570 int + x571 int + x572 int + x573 int + x574 int + x575 int + x576 int + x577 int + x578 int + x579 int + x580 int + x581 int + x582 int + x583 int + x584 int + x585 int + x586 int + x587 int + x588 int + x589 int + x590 int + x591 int + x592 int + x593 int + x594 int + x595 int + x596 int + x597 int + x598 int + x599 int + x600 int + x601 int + x602 int + x603 int + x604 int + x605 int + x606 int + x607 int + x608 int + x609 int + x610 int + x611 int + x612 int + x613 int + x614 int + x615 int + x616 int + x617 int + x618 int + x619 int + x620 int + x621 int + x622 int + x623 int + x624 int + x625 int + x626 int + x627 int + x628 int + x629 int + x630 int + x631 int + x632 int + x633 int + x634 int + x635 int + x636 int + x637 int + x638 int + x639 int + x640 int + x641 int + x642 int + x643 int + x644 int + x645 int + x646 int + x647 int + x648 int + x649 int + x650 int + x651 int + x652 int + x653 int + x654 int + x655 int + x656 int + x657 int + x658 int + x659 int + x660 int + x661 int + x662 int + x663 int + x664 int + x665 int + x666 int + x667 int + x668 int + x669 int + x670 int + x671 int + x672 int + x673 int + x674 int + x675 int + x676 int + x677 int + x678 int + x679 int + x680 int + x681 int + x682 int + x683 int + x684 int + x685 int + x686 int + x687 int + x688 int + x689 int + x690 int + x691 int + x692 int + x693 int + x694 int + x695 int + x696 int + x697 int + x698 int + x699 int + x700 int + x701 int + x702 int + x703 int + x704 int + x705 int + x706 int + x707 int + x708 int + x709 int + x710 int + x711 int + x712 int + x713 int + x714 int + x715 int + x716 int + x717 int + x718 int + x719 int + x720 int + x721 int + x722 int + x723 int + x724 int + x725 int + x726 int + x727 int + x728 int + x729 int + x730 int + x731 int + x732 int + x733 int + x734 int + x735 int + x736 int + x737 int + x738 int + x739 int + x740 int + x741 int + x742 int + x743 int + x744 int + x745 int + x746 int + x747 int + x748 int + x749 int + x750 int + x751 int + x752 int + x753 int + x754 int + x755 int + x756 int + x757 int + x758 int + x759 int + x760 int + x761 int + x762 int + x763 int + x764 int + x765 int + x766 int + x767 int + x768 int + x769 int + x770 int + x771 int + x772 int + x773 int + x774 int + x775 int + x776 int + x777 int + x778 int + x779 int + x780 int + x781 int + x782 int + x783 int + x784 int + x785 int + x786 int + x787 int + x788 int + x789 int + x790 int + x791 int + x792 int + x793 int + x794 int + x795 int + x796 int + x797 int + x798 int + x799 int + x800 int + x801 int + x802 int + x803 int + x804 int + x805 int + x806 int + x807 int + x808 int + x809 int + x810 int + x811 int + x812 int + x813 int + x814 int + x815 int + x816 int + x817 int + x818 int + x819 int + x820 int + x821 int + x822 int + x823 int + x824 int + x825 int + x826 int + x827 int + x828 int + x829 int + x830 int + x831 int + x832 int + x833 int + x834 int + x835 int + x836 int + x837 int + x838 int + x839 int + x840 int + x841 int + x842 int + x843 int + x844 int + x845 int + x846 int + x847 int + x848 int + x849 int + x850 int + x851 int + x852 int + x853 int + x854 int + x855 int + x856 int + x857 int + x858 int + x859 int + x860 int + x861 int + x862 int + x863 int + x864 int + x865 int + x866 int + x867 int + x868 int + x869 int + x870 int + x871 int + x872 int + x873 int + x874 int + x875 int + x876 int + x877 int + x878 int + x879 int + x880 int + x881 int + x882 int + x883 int + x884 int + x885 int + x886 int + x887 int + x888 int + x889 int + x890 int + x891 int + x892 int + x893 int + x894 int + x895 int + x896 int + x897 int + x898 int + x899 int + x900 int + x901 int + x902 int + x903 int + x904 int + x905 int + x906 int + x907 int + x908 int + x909 int + x910 int + x911 int + x912 int + x913 int + x914 int + x915 int + x916 int + x917 int + x918 int + x919 int + x920 int + x921 int + x922 int + x923 int + x924 int + x925 int + x926 int + x927 int + x928 int + x929 int + x930 int + x931 int + x932 int + x933 int + x934 int + x935 int + x936 int + x937 int + x938 int + x939 int + x940 int + x941 int + x942 int + x943 int + x944 int + x945 int + x946 int + x947 int + x948 int + x949 int + x950 int + x951 int + x952 int + x953 int + x954 int + x955 int + x956 int + x957 int + x958 int + x959 int + x960 int + x961 int + x962 int + x963 int + x964 int + x965 int + x966 int + x967 int + x968 int + x969 int + x970 int + x971 int + x972 int + x973 int + x974 int + x975 int + x976 int + x977 int + x978 int + x979 int + x980 int + x981 int + x982 int + x983 int + x984 int + x985 int + x986 int + x987 int + x988 int + x989 int + x990 int + x991 int + x992 int + x993 int + x994 int + x995 int + x996 int + x997 int + x998 int + x999 int x1000 int } diff --git a/test/fixedbugs/bug304.go b/test/fixedbugs/bug304.go index 69cb9e4d38..4073073eec 100644 --- a/test/fixedbugs/bug304.go +++ b/test/fixedbugs/bug304.go @@ -9,12 +9,10 @@ // bug304.go:15:2: internal compiler error: in copy_tree_r, at tree-inline.c:4114 package p - type S struct { v interface{} } - -func g(e interface{}) {} +func g(e interface{}) { } func f(s S) { g(s.v.(*int)) } diff --git a/test/fixedbugs/bug306.dir/p1.go b/test/fixedbugs/bug306.dir/p1.go index b7a3579d04..b28551807d 100644 --- a/test/fixedbugs/bug306.dir/p1.go +++ b/test/fixedbugs/bug306.dir/p1.go @@ -5,5 +5,5 @@ package p1 type T <-chan int - var x = make(chan T) + diff --git a/test/fixedbugs/bug306.dir/p2.go b/test/fixedbugs/bug306.dir/p2.go index 6e72020dcf..f614507946 100644 --- a/test/fixedbugs/bug306.dir/p2.go +++ b/test/fixedbugs/bug306.dir/p2.go @@ -5,3 +5,4 @@ package p2 import _ "./p1" + diff --git a/test/fixedbugs/bug311.go b/test/fixedbugs/bug311.go index 3bf8426af0..f5cab44c7e 100644 --- a/test/fixedbugs/bug311.go +++ b/test/fixedbugs/bug311.go @@ -9,9 +9,9 @@ package main func main() { m := make(map[string][1000]byte) m["hi"] = [1000]byte{1} - + v := m["hi"] - + for k, vv := range m { if k != "hi" || string(v[:]) != string(vv[:]) { panic("bad iter") diff --git a/test/fixedbugs/bug314.go b/test/fixedbugs/bug314.go index ad8b364765..6e26d14e1f 100644 --- a/test/fixedbugs/bug314.go +++ b/test/fixedbugs/bug314.go @@ -10,11 +10,10 @@ package main type S struct { } - -func (S) a() int { +func (S) a() int{ return 0 } -func (S) b() int { +func (S) b() int{ return 1 } diff --git a/test/fixedbugs/bug317.go b/test/fixedbugs/bug317.go index 226b7fe9ad..4cd9ec2813 100644 --- a/test/fixedbugs/bug317.go +++ b/test/fixedbugs/bug317.go @@ -12,5 +12,5 @@ func main() { } func f() uint { - return 1 << 31 // doesn't panic with 1<<31 - 1 + return 1<<31 // doesn't panic with 1<<31 - 1 } diff --git a/test/fixedbugs/bug319.go b/test/fixedbugs/bug319.go index d837af9a06..b93106d4bd 100644 --- a/test/fixedbugs/bug319.go +++ b/test/fixedbugs/bug319.go @@ -10,7 +10,7 @@ import "unsafe" func main() { var x int - + a := uint64(uintptr(unsafe.Pointer(&x))) b := uint32(uintptr(unsafe.Pointer(&x))) c := uint16(uintptr(unsafe.Pointer(&x))) diff --git a/test/fixedbugs/bug320.go b/test/fixedbugs/bug320.go index c6bcc0f5c0..0406b96561 100644 --- a/test/fixedbugs/bug320.go +++ b/test/fixedbugs/bug320.go @@ -42,3 +42,4 @@ func escape(*int) { func f(int) { } + diff --git a/test/fixedbugs/bug322.dir/lib.go b/test/fixedbugs/bug322.dir/lib.go index c338781925..0de56d3d64 100644 --- a/test/fixedbugs/bug322.dir/lib.go +++ b/test/fixedbugs/bug322.dir/lib.go @@ -5,7 +5,7 @@ package lib type T struct { - x int // non-exported field + x int // non-exported field } func (t T) M() { diff --git a/test/fixedbugs/bug322.dir/main.go b/test/fixedbugs/bug322.dir/main.go index 0b6984c6d2..f403c7d32e 100644 --- a/test/fixedbugs/bug322.dir/main.go +++ b/test/fixedbugs/bug322.dir/main.go @@ -22,7 +22,7 @@ func main() { // This is still an error. // var i1 I = t // i1.M() - + // This combination is illegal because // PM requires a pointer receiver. // var pi1 PI = t diff --git a/test/fixedbugs/bug324.dir/prog.go b/test/fixedbugs/bug324.dir/prog.go index 4e415758cb..3ab61f3eb5 100644 --- a/test/fixedbugs/bug324.dir/prog.go +++ b/test/fixedbugs/bug324.dir/prog.go @@ -16,16 +16,17 @@ type Implementation struct{} func (p *Implementation) private() {} + func main() { // nothing unusual here var x Exported x = new(Implementation) - x.private() // main.Implementation.private() + x.private() // main.Implementation.private() // same here - should be and is legal var px p.Exported px = p.X - + // this assignment is correctly illegal: // px.private undefined (cannot refer to unexported field or method private) // px.private() @@ -43,10 +44,10 @@ func main() { recover() }() x = px.(Exported) - + println("should not get this far") // this is a legitimate call, but because of the previous assignment, // it invokes the method private in p! - x.private() // p.Implementation.private() + x.private() // p.Implementation.private() } diff --git a/test/fixedbugs/bug325.go b/test/fixedbugs/bug325.go index 50d79d521d..e6528ae46a 100644 --- a/test/fixedbugs/bug325.go +++ b/test/fixedbugs/bug325.go @@ -10,6 +10,6 @@ import "unsafe" func main() { var x unsafe.Pointer - println(*x) // ERROR "invalid indirect.*unsafe.Pointer" - var _ = (unsafe.Pointer)(nil).foo // ERROR "foo" + println(*x) // ERROR "invalid indirect.*unsafe.Pointer" + var _ = (unsafe.Pointer)(nil).foo // ERROR "foo" } diff --git a/test/fixedbugs/bug330.go b/test/fixedbugs/bug330.go index 6c1cb1394b..2f33feb4b6 100644 --- a/test/fixedbugs/bug330.go +++ b/test/fixedbugs/bug330.go @@ -8,6 +8,6 @@ package main func main() { x := "" - x = +"hello" // ERROR "invalid operation.*string|expected numeric" - x = +x // ERROR "invalid operation.*string|expected numeric" + x = +"hello" // ERROR "invalid operation.*string|expected numeric" + x = +x // ERROR "invalid operation.*string|expected numeric" } diff --git a/test/fixedbugs/bug332.go b/test/fixedbugs/bug332.go index faa445fb5a..d43c2ddcff 100644 --- a/test/fixedbugs/bug332.go +++ b/test/fixedbugs/bug332.go @@ -14,4 +14,4 @@ func main() {} // important: no newline on end of next line. // 6g used to print instead of bug332.go:111 -func (t *T) F() {} // ERROR "undefined: T" +func (t *T) F() {} // ERROR "undefined: T" \ No newline at end of file diff --git a/test/fixedbugs/bug333.go b/test/fixedbugs/bug333.go index 86927b26ed..149843a3b0 100644 --- a/test/fixedbugs/bug333.go +++ b/test/fixedbugs/bug333.go @@ -9,9 +9,9 @@ package main func main() { - type Ts string - var ts Ts - _ = []byte(ts) + type Ts string + var ts Ts + _ = []byte(ts) } /* diff --git a/test/fixedbugs/bug337.go b/test/fixedbugs/bug337.go index 8021c8b910..1a0616f70a 100644 --- a/test/fixedbugs/bug337.go +++ b/test/fixedbugs/bug337.go @@ -6,7 +6,7 @@ // Issue 1722. -// Check that the error messages says +// Check that the error messages says // bug337.go:16: len("foo") not used // and not // bug337.go:16: 3 not used @@ -14,5 +14,6 @@ package main func main() { - len("foo") // ERROR "len|value computed is not used" + len("foo") // ERROR "len|value computed is not used" } + diff --git a/test/fixedbugs/bug341.go b/test/fixedbugs/bug341.go index 7e478f3742..baab28216f 100644 --- a/test/fixedbugs/bug341.go +++ b/test/fixedbugs/bug341.go @@ -15,7 +15,6 @@ func main() { _ = uint64(x) _ = float32(0) } - /* panic: runtime error: floating point error diff --git a/test/fixedbugs/bug343.go b/test/fixedbugs/bug343.go index e63347cd44..fd8bd76bbf 100644 --- a/test/fixedbugs/bug343.go +++ b/test/fixedbugs/bug343.go @@ -9,22 +9,22 @@ package main func getArgs(data map[string]interface{}, keys ...string) map[string]string { - ret := map[string]string{} - var ok bool - for _, k := range keys { - ret[k], ok = data[k].(string) - if !ok { - } - } - return ret + ret := map[string]string{} + var ok bool + for _, k := range keys { + ret[k], ok = data[k].(string) + if !ok {} + } + return ret } func main() { - x := getArgs(map[string]interface{}{"x": "y"}, "x") + x := getArgs(map[string]interface{}{"x":"y"}, "x") if x["x"] != "y" { println("BUG bug343", x) } } + /* typecheck [1008592b0] diff --git a/test/fixedbugs/bug344.go b/test/fixedbugs/bug344.go index 42aace6ab6..b53abd26e3 100644 --- a/test/fixedbugs/bug344.go +++ b/test/fixedbugs/bug344.go @@ -14,10 +14,10 @@ func main() { i := 42 a := []*int{&i, &i, &i, &i} x := a[0] - goto start // ERROR "jumps into block" + goto start // ERROR "jumps into block" z := 1 _ = z - for _, x = range a { // GCCGO_ERROR "block" + for _, x = range a { // GCCGO_ERROR "block" start: fmt.Sprint(*x) } diff --git a/test/fixedbugs/bug347.go b/test/fixedbugs/bug347.go index 6ea0419c39..92afb2e704 100644 --- a/test/fixedbugs/bug347.go +++ b/test/fixedbugs/bug347.go @@ -19,7 +19,7 @@ var c chan int func f() { select { - case <-t.c: // THIS IS LINE 22 + case <-t.c: // THIS IS LINE 22 break case <-c: break @@ -29,7 +29,7 @@ func f() { func main() { defer func() { recover() - for i := 0; ; i++ { + for i := 0;; i++ { pc, file, line, ok := runtime.Caller(i) if !ok { print("BUG: bug347: cannot find caller\n") diff --git a/test/fixedbugs/bug348.go b/test/fixedbugs/bug348.go index 8d7dc0a3bd..c7f1346159 100644 --- a/test/fixedbugs/bug348.go +++ b/test/fixedbugs/bug348.go @@ -13,8 +13,8 @@ import ( func f() { var x *string - - for _, i := range *x { // THIS IS LINE 17 + + for _, i := range *x { // THIS IS LINE 17 println(i) } } @@ -24,7 +24,7 @@ func g() { func main() { defer func() { - for i := 0; ; i++ { + for i := 0;; i++ { pc, file, line, ok := runtime.Caller(i) if !ok { print("BUG: bug348: cannot find caller\n") diff --git a/test/fixedbugs/bug356.go b/test/fixedbugs/bug356.go index 2dcd8675d0..6d93860be9 100644 --- a/test/fixedbugs/bug356.go +++ b/test/fixedbugs/bug356.go @@ -12,26 +12,27 @@ func main() { var i uint64 var x int = 12345 - if y := x << (i & 5); y != 12345<<0 { + if y := x << (i&5); y != 12345<<0 { println("BUG bug344", y) return } - + i++ - if y := x << (i & 5); y != 12345<<1 { + if y := x << (i&5); y != 12345<<1 { println("BUG bug344a", y) } - + i = 70 if y := x << i; y != 0 { println("BUG bug344b", y) } - - i = 1 << 32 + + i = 1<<32 if y := x << i; y != 0 { println("BUG bug344c", y) } } + /* typecheck [1008592b0] diff --git a/test/fixedbugs/bug357.go b/test/fixedbugs/bug357.go index 16f3abb002..e9db50e88e 100644 --- a/test/fixedbugs/bug357.go +++ b/test/fixedbugs/bug357.go @@ -15,7 +15,7 @@ func bla1() bool { func bla5() bool { _ = 1 - false // ERROR "false evaluated but not used|value computed is not used" + false // ERROR "false evaluated but not used|value computed is not used" _ = 2 return false } diff --git a/test/fixedbugs/bug361.go b/test/fixedbugs/bug361.go index 57e933658d..8e282431eb 100644 --- a/test/fixedbugs/bug361.go +++ b/test/fixedbugs/bug361.go @@ -10,6 +10,6 @@ package test func main() { - buf := [1 << 30]byte{} + buf := [1<<30]byte{} _ = buf[:] } diff --git a/test/fixedbugs/bug362.go b/test/fixedbugs/bug362.go index cc73c947a3..771d13d435 100644 --- a/test/fixedbugs/bug362.go +++ b/test/fixedbugs/bug362.go @@ -10,7 +10,7 @@ package main var ( - a = iota // ERROR "undefined: iota|iota is only defined in const" - b = iota // ERROR "undefined: iota|iota is only defined in const" - c = iota // ERROR "undefined: iota|iota is only defined in const" + a = iota // ERROR "undefined: iota|iota is only defined in const" + b = iota // ERROR "undefined: iota|iota is only defined in const" + c = iota // ERROR "undefined: iota|iota is only defined in const" ) diff --git a/test/fixedbugs/bug363.go b/test/fixedbugs/bug363.go index 4c10a3a334..1bd1400987 100644 --- a/test/fixedbugs/bug363.go +++ b/test/fixedbugs/bug363.go @@ -10,12 +10,12 @@ package main func main() { var i uint = 33 - var a = (1 << i) + 4.5 // ERROR "shift of type float64|invalid.*shift" + var a = (1<> 1 + s += i>>1 } return s } diff --git a/test/fixedbugs/bug369.dir/pkg.go b/test/fixedbugs/bug369.dir/pkg.go index c46acff79b..9964347250 100644 --- a/test/fixedbugs/bug369.dir/pkg.go +++ b/test/fixedbugs/bug369.dir/pkg.go @@ -12,3 +12,4 @@ func NonASCII(b []byte, i int) int { } return i } + diff --git a/test/fixedbugs/bug372.go b/test/fixedbugs/bug372.go index caf5b54447..5fba131d7a 100644 --- a/test/fixedbugs/bug372.go +++ b/test/fixedbugs/bug372.go @@ -7,8 +7,7 @@ // Issue 2355 package main -type T struct{} - +type T struct {} func (T) m() string { return "T" } type TT struct { @@ -16,6 +15,7 @@ type TT struct { m func() string } + func ff() string { return "ff" } func main() { diff --git a/test/fixedbugs/bug373.go b/test/fixedbugs/bug373.go index 6efdfad58b..aa0f5d1efa 100644 --- a/test/fixedbugs/bug373.go +++ b/test/fixedbugs/bug373.go @@ -9,7 +9,7 @@ package foo func f(x interface{}) { - switch t := x.(type) { // ERROR "declared and not used" + switch t := x.(type) { // ERROR "declared and not used" case int: } } diff --git a/test/fixedbugs/bug374.go b/test/fixedbugs/bug374.go index b659b46e39..2d604cbd3c 100644 --- a/test/fixedbugs/bug374.go +++ b/test/fixedbugs/bug374.go @@ -13,8 +13,8 @@ type I interface { type T int -var _ I = T(0) // GCCGO_ERROR "incompatible" +var _ I = T(0) // GCCGO_ERROR "incompatible" -func (T) m(buf []byte) (a int, b xxxx) { // ERROR "xxxx" +func (T) m(buf []byte) (a int, b xxxx) { // ERROR "xxxx" return 0, nil } diff --git a/test/fixedbugs/bug376.go b/test/fixedbugs/bug376.go index d4f28c33ce..cd700124fe 100644 --- a/test/fixedbugs/bug376.go +++ b/test/fixedbugs/bug376.go @@ -6,7 +6,5 @@ // issue 1951 package foo - import "unsafe" - -var v = unsafe.Sizeof // ERROR "not in function call|must be called" +var v = unsafe.Sizeof // ERROR "not in function call|must be called" diff --git a/test/fixedbugs/bug377.dir/one.go b/test/fixedbugs/bug377.dir/one.go index d0829473d6..e29b813a48 100644 --- a/test/fixedbugs/bug377.dir/one.go +++ b/test/fixedbugs/bug377.dir/one.go @@ -7,3 +7,4 @@ package one func Foo() (n int64, _ *int) { return 42, nil } + diff --git a/test/fixedbugs/bug377.dir/two.go b/test/fixedbugs/bug377.dir/two.go index 9e016462c2..2a10812d56 100644 --- a/test/fixedbugs/bug377.dir/two.go +++ b/test/fixedbugs/bug377.dir/two.go @@ -5,3 +5,4 @@ package two import _ "./one" + diff --git a/test/fixedbugs/bug378.go b/test/fixedbugs/bug378.go index d382e198b0..c7b0dac313 100644 --- a/test/fixedbugs/bug378.go +++ b/test/fixedbugs/bug378.go @@ -9,12 +9,11 @@ package main type Header struct{} - func (h Header) Method() {} var _ interface{} = Header{} func main() { - type X Header - var _ interface{} = X{} + type X Header + var _ interface{} = X{} } diff --git a/test/fixedbugs/bug379.go b/test/fixedbugs/bug379.go index bef19ddbed..5638123d50 100644 --- a/test/fixedbugs/bug379.go +++ b/test/fixedbugs/bug379.go @@ -6,7 +6,7 @@ // Issue 2452. -// Check that the error messages says +// Check that the error messages says // bug378.go:17: 1 + 2 not used // and not // bug378.go:17: 1 not used diff --git a/test/fixedbugs/bug380.go b/test/fixedbugs/bug380.go index cacaec6d09..0cb3487327 100644 --- a/test/fixedbugs/bug380.go +++ b/test/fixedbugs/bug380.go @@ -7,7 +7,5 @@ // Used to cause a typechecking loop error. package pkg - type T map[int]string - var q = &T{} diff --git a/test/fixedbugs/bug381.go b/test/fixedbugs/bug381.go index b04617cd8b..a0a1c8aaa4 100644 --- a/test/fixedbugs/bug381.go +++ b/test/fixedbugs/bug381.go @@ -6,7 +6,7 @@ // Issue 2276. -// Check that the error messages says +// Check that the error messages says // bug381.go:29: unsafe.Alignof(0) not used // and not // bug381.go:29: 4 not used diff --git a/test/fixedbugs/bug382.dir/pkg.go b/test/fixedbugs/bug382.dir/pkg.go index d66ba8a3c6..92fe4e335a 100644 --- a/test/fixedbugs/bug382.dir/pkg.go +++ b/test/fixedbugs/bug382.dir/pkg.go @@ -3,7 +3,5 @@ // license that can be found in the LICENSE file. package pkg - -type T struct{} - +type T struct {} var E T diff --git a/test/fixedbugs/bug383.go b/test/fixedbugs/bug383.go index 2520736745..dc2ecd61fb 100644 --- a/test/fixedbugs/bug383.go +++ b/test/fixedbugs/bug383.go @@ -7,10 +7,7 @@ // Issue 2520 package main - func main() { - if 2e9 { - } // ERROR "2e.09|expected bool" - if 3.14 + 1i { - } // ERROR "3.14 . 1i|expected bool" + if 2e9 { } // ERROR "2e.09|expected bool" + if 3.14+1i { } // ERROR "3.14 . 1i|expected bool" } diff --git a/test/fixedbugs/bug384.go b/test/fixedbugs/bug384.go index a84dcf488a..d02352b478 100644 --- a/test/fixedbugs/bug384.go +++ b/test/fixedbugs/bug384.go @@ -9,4 +9,4 @@ package foo // Check that we only get root cause message, no further complaints about r undefined -func (r *indexWriter) foo() {} // ERROR "undefined.*indexWriter" +func (r *indexWriter) foo() {} // ERROR "undefined.*indexWriter" diff --git a/test/fixedbugs/bug385_32.go b/test/fixedbugs/bug385_32.go index 3747141de1..73a1311f32 100644 --- a/test/fixedbugs/bug385_32.go +++ b/test/fixedbugs/bug385_32.go @@ -8,9 +8,8 @@ // Issue 2444 package main - func main() { - var arr [1000200030]int // GC_ERROR "type .* too large" + var arr [1000200030]int // GC_ERROR "type .* too large" arr_bkup := arr _ = arr_bkup } diff --git a/test/fixedbugs/bug385_64.go b/test/fixedbugs/bug385_64.go index 3c3790145b..0f941ca2f4 100644 --- a/test/fixedbugs/bug385_64.go +++ b/test/fixedbugs/bug385_64.go @@ -10,420 +10,214 @@ package main -var z [10 << 20]byte +var z [10<<20]byte func main() { // GC_ERROR "stack frame too large" // seq 1 206 | sed 's/.*/ var x& [10<<20]byte; z = x&/' - var x1 [10 << 20]byte - z = x1 - var x2 [10 << 20]byte - z = x2 - var x3 [10 << 20]byte - z = x3 - var x4 [10 << 20]byte - z = x4 - var x5 [10 << 20]byte - z = x5 - var x6 [10 << 20]byte - z = x6 - var x7 [10 << 20]byte - z = x7 - var x8 [10 << 20]byte - z = x8 - var x9 [10 << 20]byte - z = x9 - var x10 [10 << 20]byte - z = x10 - var x11 [10 << 20]byte - z = x11 - var x12 [10 << 20]byte - z = x12 - var x13 [10 << 20]byte - z = x13 - var x14 [10 << 20]byte - z = x14 - var x15 [10 << 20]byte - z = x15 - var x16 [10 << 20]byte - z = x16 - var x17 [10 << 20]byte - z = x17 - var x18 [10 << 20]byte - z = x18 - var x19 [10 << 20]byte - z = x19 - var x20 [10 << 20]byte - z = x20 - var x21 [10 << 20]byte - z = x21 - var x22 [10 << 20]byte - z = x22 - var x23 [10 << 20]byte - z = x23 - var x24 [10 << 20]byte - z = x24 - var x25 [10 << 20]byte - z = x25 - var x26 [10 << 20]byte - z = x26 - var x27 [10 << 20]byte - z = x27 - var x28 [10 << 20]byte - z = x28 - var x29 [10 << 20]byte - z = x29 - var x30 [10 << 20]byte - z = x30 - var x31 [10 << 20]byte - z = x31 - var x32 [10 << 20]byte - z = x32 - var x33 [10 << 20]byte - z = x33 - var x34 [10 << 20]byte - z = x34 - var x35 [10 << 20]byte - z = x35 - var x36 [10 << 20]byte - z = x36 - var x37 [10 << 20]byte - z = x37 - var x38 [10 << 20]byte - z = x38 - var x39 [10 << 20]byte - z = x39 - var x40 [10 << 20]byte - z = x40 - var x41 [10 << 20]byte - z = x41 - var x42 [10 << 20]byte - z = x42 - var x43 [10 << 20]byte - z = x43 - var x44 [10 << 20]byte - z = x44 - var x45 [10 << 20]byte - z = x45 - var x46 [10 << 20]byte - z = x46 - var x47 [10 << 20]byte - z = x47 - var x48 [10 << 20]byte - z = x48 - var x49 [10 << 20]byte - z = x49 - var x50 [10 << 20]byte - z = x50 - var x51 [10 << 20]byte - z = x51 - var x52 [10 << 20]byte - z = x52 - var x53 [10 << 20]byte - z = x53 - var x54 [10 << 20]byte - z = x54 - var x55 [10 << 20]byte - z = x55 - var x56 [10 << 20]byte - z = x56 - var x57 [10 << 20]byte - z = x57 - var x58 [10 << 20]byte - z = x58 - var x59 [10 << 20]byte - z = x59 - var x60 [10 << 20]byte - z = x60 - var x61 [10 << 20]byte - z = x61 - var x62 [10 << 20]byte - z = x62 - var x63 [10 << 20]byte - z = x63 - var x64 [10 << 20]byte - z = x64 - var x65 [10 << 20]byte - z = x65 - var x66 [10 << 20]byte - z = x66 - var x67 [10 << 20]byte - z = x67 - var x68 [10 << 20]byte - z = x68 - var x69 [10 << 20]byte - z = x69 - var x70 [10 << 20]byte - z = x70 - var x71 [10 << 20]byte - z = x71 - var x72 [10 << 20]byte - z = x72 - var x73 [10 << 20]byte - z = x73 - var x74 [10 << 20]byte - z = x74 - var x75 [10 << 20]byte - z = x75 - var x76 [10 << 20]byte - z = x76 - var x77 [10 << 20]byte - z = x77 - var x78 [10 << 20]byte - z = x78 - var x79 [10 << 20]byte - z = x79 - var x80 [10 << 20]byte - z = x80 - var x81 [10 << 20]byte - z = x81 - var x82 [10 << 20]byte - z = x82 - var x83 [10 << 20]byte - z = x83 - var x84 [10 << 20]byte - z = x84 - var x85 [10 << 20]byte - z = x85 - var x86 [10 << 20]byte - z = x86 - var x87 [10 << 20]byte - z = x87 - var x88 [10 << 20]byte - z = x88 - var x89 [10 << 20]byte - z = x89 - var x90 [10 << 20]byte - z = x90 - var x91 [10 << 20]byte - z = x91 - var x92 [10 << 20]byte - z = x92 - var x93 [10 << 20]byte - z = x93 - var x94 [10 << 20]byte - z = x94 - var x95 [10 << 20]byte - z = x95 - var x96 [10 << 20]byte - z = x96 - var x97 [10 << 20]byte - z = x97 - var x98 [10 << 20]byte - z = x98 - var x99 [10 << 20]byte - z = x99 - var x100 [10 << 20]byte - z = x100 - var x101 [10 << 20]byte - z = x101 - var x102 [10 << 20]byte - z = x102 - var x103 [10 << 20]byte - z = x103 - var x104 [10 << 20]byte - z = x104 - var x105 [10 << 20]byte - z = x105 - var x106 [10 << 20]byte - z = x106 - var x107 [10 << 20]byte - z = x107 - var x108 [10 << 20]byte - z = x108 - var x109 [10 << 20]byte - z = x109 - var x110 [10 << 20]byte - z = x110 - var x111 [10 << 20]byte - z = x111 - var x112 [10 << 20]byte - z = x112 - var x113 [10 << 20]byte - z = x113 - var x114 [10 << 20]byte - z = x114 - var x115 [10 << 20]byte - z = x115 - var x116 [10 << 20]byte - z = x116 - var x117 [10 << 20]byte - z = x117 - var x118 [10 << 20]byte - z = x118 - var x119 [10 << 20]byte - z = x119 - var x120 [10 << 20]byte - z = x120 - var x121 [10 << 20]byte - z = x121 - var x122 [10 << 20]byte - z = x122 - var x123 [10 << 20]byte - z = x123 - var x124 [10 << 20]byte - z = x124 - var x125 [10 << 20]byte - z = x125 - var x126 [10 << 20]byte - z = x126 - var x127 [10 << 20]byte - z = x127 - var x128 [10 << 20]byte - z = x128 - var x129 [10 << 20]byte - z = x129 - var x130 [10 << 20]byte - z = x130 - var x131 [10 << 20]byte - z = x131 - var x132 [10 << 20]byte - z = x132 - var x133 [10 << 20]byte - z = x133 - var x134 [10 << 20]byte - z = x134 - var x135 [10 << 20]byte - z = x135 - var x136 [10 << 20]byte - z = x136 - var x137 [10 << 20]byte - z = x137 - var x138 [10 << 20]byte - z = x138 - var x139 [10 << 20]byte - z = x139 - var x140 [10 << 20]byte - z = x140 - var x141 [10 << 20]byte - z = x141 - var x142 [10 << 20]byte - z = x142 - var x143 [10 << 20]byte - z = x143 - var x144 [10 << 20]byte - z = x144 - var x145 [10 << 20]byte - z = x145 - var x146 [10 << 20]byte - z = x146 - var x147 [10 << 20]byte - z = x147 - var x148 [10 << 20]byte - z = x148 - var x149 [10 << 20]byte - z = x149 - var x150 [10 << 20]byte - z = x150 - var x151 [10 << 20]byte - z = x151 - var x152 [10 << 20]byte - z = x152 - var x153 [10 << 20]byte - z = x153 - var x154 [10 << 20]byte - z = x154 - var x155 [10 << 20]byte - z = x155 - var x156 [10 << 20]byte - z = x156 - var x157 [10 << 20]byte - z = x157 - var x158 [10 << 20]byte - z = x158 - var x159 [10 << 20]byte - z = x159 - var x160 [10 << 20]byte - z = x160 - var x161 [10 << 20]byte - z = x161 - var x162 [10 << 20]byte - z = x162 - var x163 [10 << 20]byte - z = x163 - var x164 [10 << 20]byte - z = x164 - var x165 [10 << 20]byte - z = x165 - var x166 [10 << 20]byte - z = x166 - var x167 [10 << 20]byte - z = x167 - var x168 [10 << 20]byte - z = x168 - var x169 [10 << 20]byte - z = x169 - var x170 [10 << 20]byte - z = x170 - var x171 [10 << 20]byte - z = x171 - var x172 [10 << 20]byte - z = x172 - var x173 [10 << 20]byte - z = x173 - var x174 [10 << 20]byte - z = x174 - var x175 [10 << 20]byte - z = x175 - var x176 [10 << 20]byte - z = x176 - var x177 [10 << 20]byte - z = x177 - var x178 [10 << 20]byte - z = x178 - var x179 [10 << 20]byte - z = x179 - var x180 [10 << 20]byte - z = x180 - var x181 [10 << 20]byte - z = x181 - var x182 [10 << 20]byte - z = x182 - var x183 [10 << 20]byte - z = x183 - var x184 [10 << 20]byte - z = x184 - var x185 [10 << 20]byte - z = x185 - var x186 [10 << 20]byte - z = x186 - var x187 [10 << 20]byte - z = x187 - var x188 [10 << 20]byte - z = x188 - var x189 [10 << 20]byte - z = x189 - var x190 [10 << 20]byte - z = x190 - var x191 [10 << 20]byte - z = x191 - var x192 [10 << 20]byte - z = x192 - var x193 [10 << 20]byte - z = x193 - var x194 [10 << 20]byte - z = x194 - var x195 [10 << 20]byte - z = x195 - var x196 [10 << 20]byte - z = x196 - var x197 [10 << 20]byte - z = x197 - var x198 [10 << 20]byte - z = x198 - var x199 [10 << 20]byte - z = x199 - var x200 [10 << 20]byte - z = x200 - var x201 [10 << 20]byte - z = x201 - var x202 [10 << 20]byte - z = x202 - var x203 [10 << 20]byte - z = x203 - var x204 [10 << 20]byte - z = x204 - var x205 [10 << 20]byte - z = x205 - var x206 [10 << 20]byte - z = x206 + var x1 [10<<20]byte; z = x1 + var x2 [10<<20]byte; z = x2 + var x3 [10<<20]byte; z = x3 + var x4 [10<<20]byte; z = x4 + var x5 [10<<20]byte; z = x5 + var x6 [10<<20]byte; z = x6 + var x7 [10<<20]byte; z = x7 + var x8 [10<<20]byte; z = x8 + var x9 [10<<20]byte; z = x9 + var x10 [10<<20]byte; z = x10 + var x11 [10<<20]byte; z = x11 + var x12 [10<<20]byte; z = x12 + var x13 [10<<20]byte; z = x13 + var x14 [10<<20]byte; z = x14 + var x15 [10<<20]byte; z = x15 + var x16 [10<<20]byte; z = x16 + var x17 [10<<20]byte; z = x17 + var x18 [10<<20]byte; z = x18 + var x19 [10<<20]byte; z = x19 + var x20 [10<<20]byte; z = x20 + var x21 [10<<20]byte; z = x21 + var x22 [10<<20]byte; z = x22 + var x23 [10<<20]byte; z = x23 + var x24 [10<<20]byte; z = x24 + var x25 [10<<20]byte; z = x25 + var x26 [10<<20]byte; z = x26 + var x27 [10<<20]byte; z = x27 + var x28 [10<<20]byte; z = x28 + var x29 [10<<20]byte; z = x29 + var x30 [10<<20]byte; z = x30 + var x31 [10<<20]byte; z = x31 + var x32 [10<<20]byte; z = x32 + var x33 [10<<20]byte; z = x33 + var x34 [10<<20]byte; z = x34 + var x35 [10<<20]byte; z = x35 + var x36 [10<<20]byte; z = x36 + var x37 [10<<20]byte; z = x37 + var x38 [10<<20]byte; z = x38 + var x39 [10<<20]byte; z = x39 + var x40 [10<<20]byte; z = x40 + var x41 [10<<20]byte; z = x41 + var x42 [10<<20]byte; z = x42 + var x43 [10<<20]byte; z = x43 + var x44 [10<<20]byte; z = x44 + var x45 [10<<20]byte; z = x45 + var x46 [10<<20]byte; z = x46 + var x47 [10<<20]byte; z = x47 + var x48 [10<<20]byte; z = x48 + var x49 [10<<20]byte; z = x49 + var x50 [10<<20]byte; z = x50 + var x51 [10<<20]byte; z = x51 + var x52 [10<<20]byte; z = x52 + var x53 [10<<20]byte; z = x53 + var x54 [10<<20]byte; z = x54 + var x55 [10<<20]byte; z = x55 + var x56 [10<<20]byte; z = x56 + var x57 [10<<20]byte; z = x57 + var x58 [10<<20]byte; z = x58 + var x59 [10<<20]byte; z = x59 + var x60 [10<<20]byte; z = x60 + var x61 [10<<20]byte; z = x61 + var x62 [10<<20]byte; z = x62 + var x63 [10<<20]byte; z = x63 + var x64 [10<<20]byte; z = x64 + var x65 [10<<20]byte; z = x65 + var x66 [10<<20]byte; z = x66 + var x67 [10<<20]byte; z = x67 + var x68 [10<<20]byte; z = x68 + var x69 [10<<20]byte; z = x69 + var x70 [10<<20]byte; z = x70 + var x71 [10<<20]byte; z = x71 + var x72 [10<<20]byte; z = x72 + var x73 [10<<20]byte; z = x73 + var x74 [10<<20]byte; z = x74 + var x75 [10<<20]byte; z = x75 + var x76 [10<<20]byte; z = x76 + var x77 [10<<20]byte; z = x77 + var x78 [10<<20]byte; z = x78 + var x79 [10<<20]byte; z = x79 + var x80 [10<<20]byte; z = x80 + var x81 [10<<20]byte; z = x81 + var x82 [10<<20]byte; z = x82 + var x83 [10<<20]byte; z = x83 + var x84 [10<<20]byte; z = x84 + var x85 [10<<20]byte; z = x85 + var x86 [10<<20]byte; z = x86 + var x87 [10<<20]byte; z = x87 + var x88 [10<<20]byte; z = x88 + var x89 [10<<20]byte; z = x89 + var x90 [10<<20]byte; z = x90 + var x91 [10<<20]byte; z = x91 + var x92 [10<<20]byte; z = x92 + var x93 [10<<20]byte; z = x93 + var x94 [10<<20]byte; z = x94 + var x95 [10<<20]byte; z = x95 + var x96 [10<<20]byte; z = x96 + var x97 [10<<20]byte; z = x97 + var x98 [10<<20]byte; z = x98 + var x99 [10<<20]byte; z = x99 + var x100 [10<<20]byte; z = x100 + var x101 [10<<20]byte; z = x101 + var x102 [10<<20]byte; z = x102 + var x103 [10<<20]byte; z = x103 + var x104 [10<<20]byte; z = x104 + var x105 [10<<20]byte; z = x105 + var x106 [10<<20]byte; z = x106 + var x107 [10<<20]byte; z = x107 + var x108 [10<<20]byte; z = x108 + var x109 [10<<20]byte; z = x109 + var x110 [10<<20]byte; z = x110 + var x111 [10<<20]byte; z = x111 + var x112 [10<<20]byte; z = x112 + var x113 [10<<20]byte; z = x113 + var x114 [10<<20]byte; z = x114 + var x115 [10<<20]byte; z = x115 + var x116 [10<<20]byte; z = x116 + var x117 [10<<20]byte; z = x117 + var x118 [10<<20]byte; z = x118 + var x119 [10<<20]byte; z = x119 + var x120 [10<<20]byte; z = x120 + var x121 [10<<20]byte; z = x121 + var x122 [10<<20]byte; z = x122 + var x123 [10<<20]byte; z = x123 + var x124 [10<<20]byte; z = x124 + var x125 [10<<20]byte; z = x125 + var x126 [10<<20]byte; z = x126 + var x127 [10<<20]byte; z = x127 + var x128 [10<<20]byte; z = x128 + var x129 [10<<20]byte; z = x129 + var x130 [10<<20]byte; z = x130 + var x131 [10<<20]byte; z = x131 + var x132 [10<<20]byte; z = x132 + var x133 [10<<20]byte; z = x133 + var x134 [10<<20]byte; z = x134 + var x135 [10<<20]byte; z = x135 + var x136 [10<<20]byte; z = x136 + var x137 [10<<20]byte; z = x137 + var x138 [10<<20]byte; z = x138 + var x139 [10<<20]byte; z = x139 + var x140 [10<<20]byte; z = x140 + var x141 [10<<20]byte; z = x141 + var x142 [10<<20]byte; z = x142 + var x143 [10<<20]byte; z = x143 + var x144 [10<<20]byte; z = x144 + var x145 [10<<20]byte; z = x145 + var x146 [10<<20]byte; z = x146 + var x147 [10<<20]byte; z = x147 + var x148 [10<<20]byte; z = x148 + var x149 [10<<20]byte; z = x149 + var x150 [10<<20]byte; z = x150 + var x151 [10<<20]byte; z = x151 + var x152 [10<<20]byte; z = x152 + var x153 [10<<20]byte; z = x153 + var x154 [10<<20]byte; z = x154 + var x155 [10<<20]byte; z = x155 + var x156 [10<<20]byte; z = x156 + var x157 [10<<20]byte; z = x157 + var x158 [10<<20]byte; z = x158 + var x159 [10<<20]byte; z = x159 + var x160 [10<<20]byte; z = x160 + var x161 [10<<20]byte; z = x161 + var x162 [10<<20]byte; z = x162 + var x163 [10<<20]byte; z = x163 + var x164 [10<<20]byte; z = x164 + var x165 [10<<20]byte; z = x165 + var x166 [10<<20]byte; z = x166 + var x167 [10<<20]byte; z = x167 + var x168 [10<<20]byte; z = x168 + var x169 [10<<20]byte; z = x169 + var x170 [10<<20]byte; z = x170 + var x171 [10<<20]byte; z = x171 + var x172 [10<<20]byte; z = x172 + var x173 [10<<20]byte; z = x173 + var x174 [10<<20]byte; z = x174 + var x175 [10<<20]byte; z = x175 + var x176 [10<<20]byte; z = x176 + var x177 [10<<20]byte; z = x177 + var x178 [10<<20]byte; z = x178 + var x179 [10<<20]byte; z = x179 + var x180 [10<<20]byte; z = x180 + var x181 [10<<20]byte; z = x181 + var x182 [10<<20]byte; z = x182 + var x183 [10<<20]byte; z = x183 + var x184 [10<<20]byte; z = x184 + var x185 [10<<20]byte; z = x185 + var x186 [10<<20]byte; z = x186 + var x187 [10<<20]byte; z = x187 + var x188 [10<<20]byte; z = x188 + var x189 [10<<20]byte; z = x189 + var x190 [10<<20]byte; z = x190 + var x191 [10<<20]byte; z = x191 + var x192 [10<<20]byte; z = x192 + var x193 [10<<20]byte; z = x193 + var x194 [10<<20]byte; z = x194 + var x195 [10<<20]byte; z = x195 + var x196 [10<<20]byte; z = x196 + var x197 [10<<20]byte; z = x197 + var x198 [10<<20]byte; z = x198 + var x199 [10<<20]byte; z = x199 + var x200 [10<<20]byte; z = x200 + var x201 [10<<20]byte; z = x201 + var x202 [10<<20]byte; z = x202 + var x203 [10<<20]byte; z = x203 + var x204 [10<<20]byte; z = x204 + var x205 [10<<20]byte; z = x205 + var x206 [10<<20]byte; z = x206 } diff --git a/test/fixedbugs/bug386.go b/test/fixedbugs/bug386.go index 92fc33bb36..889c8b0c12 100644 --- a/test/fixedbugs/bug386.go +++ b/test/fixedbugs/bug386.go @@ -4,9 +4,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Issue 2451, 2452 +// Issue 2451, 2452 package foo func f() error { return 0 } // ERROR "cannot use 0 .type int.|has no methods" -func g() error { return -1 } // ERROR "cannot use -1 .type int.|has no methods" +func g() error { return -1 } // ERROR "cannot use -1 .type int.|has no methods" diff --git a/test/fixedbugs/bug387.go b/test/fixedbugs/bug387.go index 2e30bc42a3..d885445744 100644 --- a/test/fixedbugs/bug387.go +++ b/test/fixedbugs/bug387.go @@ -12,18 +12,19 @@ missing typecheck: [7f5bf07b4438] . AS l(45) . . NAME-main.autotmp_0017 u(1) a(1) l(45) x(0+0) class(PAUTO) esc(N) tc(1) used(1) ARRAY-[2]string -internal compiler error: missing typecheck +internal compiler error: missing typecheck */ package main import ( - "fmt" - "path/filepath" + "fmt" + "path/filepath" ) func main() { - switch _, err := filepath.Glob(filepath.Join(".", "vnc")); { - case err != nil: - fmt.Println(err) - } + switch _, err := filepath.Glob(filepath.Join(".", "vnc")); { + case err != nil: + fmt.Println(err) + } } + diff --git a/test/fixedbugs/bug389.go b/test/fixedbugs/bug389.go index 8f40c0e215..14804c8471 100644 --- a/test/fixedbugs/bug389.go +++ b/test/fixedbugs/bug389.go @@ -9,4 +9,4 @@ package foo func fn(a float32) {} -var f func(arg int) = fn // ERROR "cannot use fn .type func.float32.. as type func.int. in assignment|different parameter types" +var f func(arg int) = fn // ERROR "cannot use fn .type func.float32.. as type func.int. in assignment|different parameter types" diff --git a/test/fixedbugs/bug391.go b/test/fixedbugs/bug391.go index 00b84103bc..9211b1c2cf 100644 --- a/test/fixedbugs/bug391.go +++ b/test/fixedbugs/bug391.go @@ -7,9 +7,8 @@ // Issue 2576 package bug -type T struct{ a int } +type T struct { a int } func f(t T) { - switch _, _ = t.a, t.a; { - } -} + switch _, _ = t.a, t.a; {} +} \ No newline at end of file diff --git a/test/fixedbugs/bug392.dir/one.go b/test/fixedbugs/bug392.dir/one.go index 081e25c532..aba8649b5b 100644 --- a/test/fixedbugs/bug392.dir/one.go +++ b/test/fixedbugs/bug392.dir/one.go @@ -18,25 +18,26 @@ func F2(c chan int) bool { return c == (<-chan int)(nil) } func F3() (ret []int) { return append(ret, 1) } // Call of inlined method with blank receiver. -func (_ *T) M() int { return 1 } +func (_ *T) M() int { return 1 } func (t *T) MM() int { return t.M() } + // One more like issue 2678 -type S struct{ x, y int } +type S struct { x, y int } type U []S -func F4(S int) U { return U{{S, S}} } +func F4(S int) U { return U{{S,S}} } func F5() []*S { - return []*S{{1, 2}, {3, 4}} + return []*S{ {1,2}, { 3, 4} } } func F6(S int) *U { - return &U{{S, S}} + return &U{{S,S}} } // Bug in the fix. -type PB struct{ x int } +type PB struct { x int } func (t *PB) Reset() { *t = PB{} } diff --git a/test/fixedbugs/bug396.dir/one.go b/test/fixedbugs/bug396.dir/one.go index f599959e10..66eba63f5c 100644 --- a/test/fixedbugs/bug396.dir/one.go +++ b/test/fixedbugs/bug396.dir/one.go @@ -5,6 +5,6 @@ package one // Issue 2687 -type T struct{ int } +type T struct { int } func New(i int) T { return T{i} } diff --git a/test/fixedbugs/bug396.dir/two.go b/test/fixedbugs/bug396.dir/two.go index 4e30bfab9c..9152bec254 100644 --- a/test/fixedbugs/bug396.dir/two.go +++ b/test/fixedbugs/bug396.dir/two.go @@ -11,4 +11,4 @@ import "./one" func use() { _ = one.New(1) -} +} \ No newline at end of file diff --git a/test/fixedbugs/bug397.go b/test/fixedbugs/bug397.go index 339da2eb4b..6188e3ee0c 100644 --- a/test/fixedbugs/bug397.go +++ b/test/fixedbugs/bug397.go @@ -7,7 +7,7 @@ package main // Issue 2623 -var m = map[string]int{ - "abc": 1, - 1: 2, // ERROR "cannot use 1.*as type string in map key|incompatible type" +var m = map[string]int { + "abc":1, + 1:2, // ERROR "cannot use 1.*as type string in map key|incompatible type" } diff --git a/test/fixedbugs/bug398.go b/test/fixedbugs/bug398.go index 3848cd4061..a1583bd774 100644 --- a/test/fixedbugs/bug398.go +++ b/test/fixedbugs/bug398.go @@ -12,33 +12,33 @@ package p // exported interfaces type I1 interface { - F() interface{ I1 } + F() interface{I1} } type I2 interface { - F() interface{ I2 } + F() interface{I2} } var V1 I1 var V2 I2 func F() bool { - return V1 == V2 + return V1 == V2 } // non-exported interfaces type i1 interface { - F() interface{ i1 } + F() interface{i1} } type i2 interface { - F() interface{ i2 } + F() interface{i2} } var v1 i1 var v2 i2 func f() bool { - return v1 == v2 + return v1 == v2 } diff --git a/test/fixedbugs/bug399.go b/test/fixedbugs/bug399.go index 343add59da..e460d81227 100644 --- a/test/fixedbugs/bug399.go +++ b/test/fixedbugs/bug399.go @@ -7,9 +7,9 @@ // Issue 2674 package main - const dow = "\000\003" func main() { println(int(dow[1])) } + diff --git a/test/fixedbugs/bug405.go b/test/fixedbugs/bug405.go index f0c3081976..e8ecc4d034 100644 --- a/test/fixedbugs/bug405.go +++ b/test/fixedbugs/bug405.go @@ -8,7 +8,7 @@ package main -type S struct{} +type S struct {} func (_ S) F(i int) int { return i diff --git a/test/fixedbugs/bug407.dir/one.go b/test/fixedbugs/bug407.dir/one.go index fd900ef4ad..c85b077b66 100644 --- a/test/fixedbugs/bug407.dir/one.go +++ b/test/fixedbugs/bug407.dir/one.go @@ -11,7 +11,10 @@ type T struct { } func (t *T) foo(arg int) {} -func (t T) goo(arg int) {} +func (t T) goo(arg int) {} func (t *T) F() { t.f = (*T).foo } func (t *T) G() { t.g = T.goo } + + + diff --git a/test/fixedbugs/bug410.go b/test/fixedbugs/bug410.go index f0761febfa..a4eef64d8e 100644 --- a/test/fixedbugs/bug410.go +++ b/test/fixedbugs/bug410.go @@ -12,13 +12,13 @@ type y struct { num int } -func zzz() { - k := make([]byte, 10) - arr := make([]*y, 0) - for s := range arr { - x := make([]byte, 10) - for i := 0; i < 100; i++ { - x[i] ^= k[i-arr[s].num%3] - } - } +func zzz () { + k := make([]byte, 10) + arr := make ([]*y, 0) + for s := range arr { + x := make([]byte, 10) + for i := 0; i < 100 ; i++ { + x[i] ^= k[i-arr[s].num%3] + } + } } diff --git a/test/fixedbugs/bug411.go b/test/fixedbugs/bug411.go index 7f90ae0e93..a1c36f617c 100644 --- a/test/fixedbugs/bug411.go +++ b/test/fixedbugs/bug411.go @@ -14,5 +14,6 @@ func f1(a int64) { f2(float64(a), float64(a)) } -func f2(a, b float64) { +func f2(a,b float64) { } + diff --git a/test/fixedbugs/bug412.go b/test/fixedbugs/bug412.go index a39abf17e1..183fb7e4af 100644 --- a/test/fixedbugs/bug412.go +++ b/test/fixedbugs/bug412.go @@ -7,10 +7,10 @@ package p type t struct { - x int // GCCGO_ERROR "duplicate field name .x." - x int // GC_ERROR "duplicate field x" + x int // GCCGO_ERROR "duplicate field name .x." + x int // GC_ERROR "duplicate field x" } func f(t *t) int { - return t.x // GC_ERROR "ambiguous selector t.x" + return t.x // GC_ERROR "ambiguous selector t.x" } diff --git a/test/fixedbugs/bug413.go b/test/fixedbugs/bug413.go index 12e1e5e58b..819bd1a984 100644 --- a/test/fixedbugs/bug413.go +++ b/test/fixedbugs/bug413.go @@ -8,4 +8,4 @@ package p func f(i int) int { return i } -var i = func() int { a := f(i); return a }() // ERROR "initialization loop|depends upon itself" +var i = func() int {a := f(i); return a}() // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/bug415.dir/p.go b/test/fixedbugs/bug415.dir/p.go index fca0124014..e86a697643 100644 --- a/test/fixedbugs/bug415.dir/p.go +++ b/test/fixedbugs/bug415.dir/p.go @@ -5,9 +5,10 @@ package p type A struct { - s struct{ int } + s struct{int} } func (a *A) f() { - a.s = struct{ int }{0} + a.s = struct{int}{0} } + diff --git a/test/fixedbugs/bug415.dir/prog.go b/test/fixedbugs/bug415.dir/prog.go index f2a4e6dd0d..1ffde188b7 100644 --- a/test/fixedbugs/bug415.dir/prog.go +++ b/test/fixedbugs/bug415.dir/prog.go @@ -3,9 +3,7 @@ // license that can be found in the LICENSE file. package main - import "./p" - func main() {} - var _ p.A + diff --git a/test/fixedbugs/bug417.go b/test/fixedbugs/bug417.go index 1b44aa927c..a9acb42386 100644 --- a/test/fixedbugs/bug417.go +++ b/test/fixedbugs/bug417.go @@ -14,19 +14,17 @@ type S1 struct { s [][1]S3 m map[int][1]S3 c chan [1]S3 - i interface{ f([1]S3) [1]S3 } + i interface { f([1]S3) [1]S3 } f func([1]S3) [1]S3 } type S2 struct { - p *struct{ F S3 } - s []struct{ F S3 } - m map[int]struct{ F S3 } - c chan struct{ F S3 } - i interface { - f(struct{ F S3 }) struct{ F S3 } - } - f func(struct{ F S3 }) struct{ F S3 } + p *struct { F S3 } + s []struct { F S3 } + m map[int]struct { F S3 } + c chan struct { F S3 } + i interface { f(struct { F S3 }) struct { F S3 } } + f func(struct { F S3 } ) struct { F S3 } } type S3 struct { diff --git a/test/fixedbugs/bug420.go b/test/fixedbugs/bug420.go index 6601597cad..02b4349d80 100644 --- a/test/fixedbugs/bug420.go +++ b/test/fixedbugs/bug420.go @@ -10,5 +10,5 @@ package main func main() { - (_) = 0 + (_) = 0 } diff --git a/test/fixedbugs/bug421.go b/test/fixedbugs/bug421.go index b1f1c56275..1fe02375ab 100644 --- a/test/fixedbugs/bug421.go +++ b/test/fixedbugs/bug421.go @@ -10,8 +10,8 @@ package main func main() { - println(int(1) == uint(1)) // ERROR "types" + println(int(1) == uint(1)) // ERROR "types" var x int = 1 var y uint = 1 - println(x == y) // ERROR "types" + println(x == y) // ERROR "types" } diff --git a/test/fixedbugs/bug424.dir/main.go b/test/fixedbugs/bug424.dir/main.go index adf01fc112..28b41e68a7 100644 --- a/test/fixedbugs/bug424.dir/main.go +++ b/test/fixedbugs/bug424.dir/main.go @@ -59,7 +59,7 @@ func main() { if t3.m() != "main.localT.m" { println("BUG: t3:", t3.m(), "called") } - + i = new(myT3) if i.m() != "main.localT.m" { t := reflect.TypeOf(i) @@ -70,7 +70,7 @@ func main() { } println("BUG: myT3:", i.m(), "called") } - + var t4 struct { localT lib.T @@ -82,7 +82,7 @@ func main() { if i.m() != "main.localT.m" { println("BUG: myT4:", i.m(), "called") } - + var t5 struct { lib.T localT diff --git a/test/fixedbugs/bug424.go b/test/fixedbugs/bug424.go index 6423961fe0..9c59abe802 100644 --- a/test/fixedbugs/bug424.go +++ b/test/fixedbugs/bug424.go @@ -10,3 +10,4 @@ // embedding is done. package ignored + diff --git a/test/fixedbugs/bug425.go b/test/fixedbugs/bug425.go index a13a82c0f8..c3035f6a91 100644 --- a/test/fixedbugs/bug425.go +++ b/test/fixedbugs/bug425.go @@ -13,5 +13,5 @@ import "fmt" func main() { s := "hello" fmt.Println(s == "") - fmt.Println(s+"world" == "world") + fmt.Println(s + "world" == "world") } diff --git a/test/fixedbugs/bug427.go b/test/fixedbugs/bug427.go index a1b3f5b7fa..c13bb815ca 100644 --- a/test/fixedbugs/bug427.go +++ b/test/fixedbugs/bug427.go @@ -9,10 +9,10 @@ package main // struct with four fields of basic type -type S struct{ a, b, c, d int } +type S struct {a, b, c, d int} // struct with five fields of basic type -type T struct{ a, b, c, d, e int } +type T struct {a, b, c, d, e int} // array with four elements type A [4]int diff --git a/test/fixedbugs/bug439.go b/test/fixedbugs/bug439.go index 1ad7b7f443..87d4ae0373 100644 --- a/test/fixedbugs/bug439.go +++ b/test/fixedbugs/bug439.go @@ -14,7 +14,7 @@ func (e E) P() *E { return &e } const ( C1 E = 0 - C2 = C1 + C2 = C1 ) func F() *E { diff --git a/test/fixedbugs/bug441.go b/test/fixedbugs/bug441.go index a0b051e62f..b67125b1e8 100644 --- a/test/fixedbugs/bug441.go +++ b/test/fixedbugs/bug441.go @@ -23,13 +23,11 @@ func main() { } } -func foo(_ int) {} +func foo(_ int) {} func foo2(_, _ int) {} func foo3(int, int) {} - type T int - -func (_ T) m1() {} +func (_ T) m1() {} func (t T) m2(_ int) {} func side() int { diff --git a/test/fixedbugs/bug442.go b/test/fixedbugs/bug442.go index c3e1d5b20f..684d54ffbb 100644 --- a/test/fixedbugs/bug442.go +++ b/test/fixedbugs/bug442.go @@ -20,7 +20,7 @@ func main() { m := map[T]int{} m[T{X: 1, Y: 2}] = 1 m[T{X: 2, Y: 3}] = 2 - m[T{X: 1, Y: 2}] = 3 // overwrites first entry + m[T{X: 1, Y: 2}] = 3 // overwrites first entry if len(m) != 2 { println("BUG") } diff --git a/test/fixedbugs/bug443.go b/test/fixedbugs/bug443.go index eaa3d55823..9abd2548a5 100644 --- a/test/fixedbugs/bug443.go +++ b/test/fixedbugs/bug443.go @@ -9,9 +9,9 @@ package p -type T1 struct{ F *T2 } +type T1 struct { F *T2 } type T2 T1 type T3 T2 +func (*T3) M() // was invalid receiver -func (*T3) M() // was invalid receiver diff --git a/test/fixedbugs/bug444.go b/test/fixedbugs/bug444.go index 69c5bd8e59..29a60f590f 100644 --- a/test/fixedbugs/bug444.go +++ b/test/fixedbugs/bug444.go @@ -12,14 +12,14 @@ package main import "reflect" -type T interface{} +type T interface {} var x bool func main() { - reflect.TypeOf(nil) - reflect.TypeOf(T(nil)) // used to miscompile - shouldPanic() + reflect.TypeOf(nil) + reflect.TypeOf(T(nil)) // used to miscompile + shouldPanic() } func f() byte { diff --git a/test/fixedbugs/bug446.go b/test/fixedbugs/bug446.go index 580415c181..1e435e1109 100644 --- a/test/fixedbugs/bug446.go +++ b/test/fixedbugs/bug446.go @@ -33,3 +33,4 @@ func main() { panic("dummy2 != 2") } } + diff --git a/test/fixedbugs/bug447.go b/test/fixedbugs/bug447.go index db3b8404ec..8358f0034f 100644 --- a/test/fixedbugs/bug447.go +++ b/test/fixedbugs/bug447.go @@ -16,8 +16,8 @@ import ( ) var ( - intWidths = []int{8, 16, 32, 64} // int%d and uint%d - floatWidths = []int{32, 64} // float%d + intWidths = []int{8, 16, 32, 64} // int%d and uint%d + floatWidths = []int{32, 64} // float%d ) func main() { @@ -59,7 +59,8 @@ const testSegment = ` } }` -const testFunc = `func test$I(f float64, i int64) { +const testFunc = +`func test$I(f float64, i int64) { if i != int64($I(i))$TEST { return } @@ -67,7 +68,8 @@ $TESTSEGMENTS } ` -var program = `package main +var program = +`package main import ( "fmt" diff --git a/test/fixedbugs/bug448.dir/pkg2.go b/test/fixedbugs/bug448.dir/pkg2.go index 8eee8e88dd..20d850915d 100644 --- a/test/fixedbugs/bug448.dir/pkg2.go +++ b/test/fixedbugs/bug448.dir/pkg2.go @@ -11,3 +11,4 @@ import "./pkg1" func F() { pkg1.Do() } + diff --git a/test/fixedbugs/bug460.go b/test/fixedbugs/bug460.go index 130d190cb3..a1b6f477ff 100644 --- a/test/fixedbugs/bug460.go +++ b/test/fixedbugs/bug460.go @@ -7,3 +7,4 @@ // part one of issue 4124. Make sure that the compiler rejects access attempts. package ignored + diff --git a/test/fixedbugs/bug462.go b/test/fixedbugs/bug462.go index 4765e18afd..3df63b091d 100644 --- a/test/fixedbugs/bug462.go +++ b/test/fixedbugs/bug462.go @@ -13,7 +13,7 @@ type T struct { } func main() { - _ = T{ + _ = T { os.File: 1, // ERROR "unknown T? ?field" } } diff --git a/test/fixedbugs/bug466.dir/a.go b/test/fixedbugs/bug466.dir/a.go index 21fe0a6062..e27699c2ef 100644 --- a/test/fixedbugs/bug466.dir/a.go +++ b/test/fixedbugs/bug466.dir/a.go @@ -4,7 +4,7 @@ package a -const N = 2 + 3i +const N = 2+3i func Func() []complex128 { return []complex128{1, complex(2, 3), complex(4, 5)} diff --git a/test/fixedbugs/bug466.go b/test/fixedbugs/bug466.go index c2a15ef707..dc909d483c 100644 --- a/test/fixedbugs/bug466.go +++ b/test/fixedbugs/bug466.go @@ -8,3 +8,4 @@ // complex literals "a+bi" to "a+b". package ignored + diff --git a/test/fixedbugs/bug468.dir/p1.go b/test/fixedbugs/bug468.dir/p1.go index b35e08acb4..cdda735e96 100644 --- a/test/fixedbugs/bug468.dir/p1.go +++ b/test/fixedbugs/bug468.dir/p1.go @@ -4,4 +4,4 @@ package p1 -type S struct{ X, Y int } +type S struct { X, Y int } diff --git a/test/fixedbugs/bug468.dir/p2.go b/test/fixedbugs/bug468.dir/p2.go index 42deea8bd5..dbb46931b8 100644 --- a/test/fixedbugs/bug468.dir/p2.go +++ b/test/fixedbugs/bug468.dir/p2.go @@ -12,7 +12,7 @@ import ( func main() { var v1 = p1.S{1, 2} - var v2 = struct{ X, Y int }{1, 2} + var v2 = struct { X, Y int }{1, 2} v1 = v2 t1 := reflect.TypeOf(v1) t2 := reflect.TypeOf(v2) diff --git a/test/fixedbugs/bug470.go b/test/fixedbugs/bug470.go index 72326b6e85..c21663f3f3 100644 --- a/test/fixedbugs/bug470.go +++ b/test/fixedbugs/bug470.go @@ -11,8 +11,8 @@ package main import "fmt" const ( - F32 = 0.00999999977648258209228515625 - F64 = 0.01000000000000000020816681711721685132943093776702880859375 + F32 = 0.00999999977648258209228515625 + F64 = 0.01000000000000000020816681711721685132943093776702880859375 ) var F = float64(float32(0.01)) diff --git a/test/fixedbugs/bug479.dir/a.go b/test/fixedbugs/bug479.dir/a.go index 424fc45d30..eddb4cf078 100644 --- a/test/fixedbugs/bug479.dir/a.go +++ b/test/fixedbugs/bug479.dir/a.go @@ -6,7 +6,7 @@ package p import "unsafe" -type S2 struct{} +type S2 struct {} const C = unsafe.Sizeof(S2{}) diff --git a/test/fixedbugs/bug480.dir/a.go b/test/fixedbugs/bug480.dir/a.go index cd87d87f2d..26a8d11669 100644 --- a/test/fixedbugs/bug480.dir/a.go +++ b/test/fixedbugs/bug480.dir/a.go @@ -4,7 +4,7 @@ package a -type S interface { +type S interface{ F() T } diff --git a/test/fixedbugs/bug486.go b/test/fixedbugs/bug486.go index dce43f4b0e..9ad23b3cfc 100644 --- a/test/fixedbugs/bug486.go +++ b/test/fixedbugs/bug486.go @@ -11,4 +11,4 @@ package main /*// comment - */ +*/ diff --git a/test/fixedbugs/bug487.go b/test/fixedbugs/bug487.go index c61dcb0f31..ab61a19a94 100644 --- a/test/fixedbugs/bug487.go +++ b/test/fixedbugs/bug487.go @@ -14,11 +14,11 @@ func G() (int, int, int) { } func F() { - a, b := G() // ERROR "assignment mismatch" - a, b = G() // ERROR "assignment mismatch" + a, b := G() // ERROR "assignment mismatch" + a, b = G() // ERROR "assignment mismatch" _, _ = a, b } func H() (int, int) { - return G() // ERROR "too many|mismatch" + return G() // ERROR "too many|mismatch" } diff --git a/test/fixedbugs/bug488.dir/a.go b/test/fixedbugs/bug488.dir/a.go index 798011414e..fc494207a1 100644 --- a/test/fixedbugs/bug488.dir/a.go +++ b/test/fixedbugs/bug488.dir/a.go @@ -4,4 +4,4 @@ package a -var p2 = Printf // ERROR "undefined" +var p2 = Printf // ERROR "undefined" diff --git a/test/fixedbugs/bug490.go b/test/fixedbugs/bug490.go index 1d8b29d037..387a680aee 100644 --- a/test/fixedbugs/bug490.go +++ b/test/fixedbugs/bug490.go @@ -8,7 +8,7 @@ // interface and an empty struct literal. package p - + type S struct{} func F(v interface{}) bool { diff --git a/test/fixedbugs/bug491.go b/test/fixedbugs/bug491.go index 6bc7b470f0..39a3509c69 100644 --- a/test/fixedbugs/bug491.go +++ b/test/fixedbugs/bug491.go @@ -107,4 +107,4 @@ func bug() { println("BUG") bugged = true } -} +} \ No newline at end of file diff --git a/test/fixedbugs/bug500.go b/test/fixedbugs/bug500.go index e57de98b60..2dd5df13b0 100644 --- a/test/fixedbugs/bug500.go +++ b/test/fixedbugs/bug500.go @@ -35,7 +35,7 @@ func init() { func main() { runtime.GC() - if a[0].str != b+c { + if a[0].str != b + c { panic(a[0].str) } } diff --git a/test/fixedbugs/gcc61264.go b/test/fixedbugs/gcc61264.go index 569f601bc8..a4092f5bec 100644 --- a/test/fixedbugs/gcc61264.go +++ b/test/fixedbugs/gcc61264.go @@ -9,5 +9,5 @@ package main func main() { - map[int]int{}[0]++ + map[int]int{}[0]++ } diff --git a/test/fixedbugs/gcc67968.dir/b.go b/test/fixedbugs/gcc67968.dir/b.go index dd9eddae31..41b62d2088 100644 --- a/test/fixedbugs/gcc67968.dir/b.go +++ b/test/fixedbugs/gcc67968.dir/b.go @@ -6,7 +6,7 @@ package b import "./a" -func F() interface{} { - var v *a.T - return v.Foo() +func F() (interface{}) { + var v *a.T + return v.Foo() } diff --git a/test/fixedbugs/issue10607a.go b/test/fixedbugs/issue10607a.go index 92a7474fa1..51399e4ecf 100644 --- a/test/fixedbugs/issue10607a.go +++ b/test/fixedbugs/issue10607a.go @@ -54,7 +54,7 @@ func main() { // 3 == NT_GNU_BUILD_ID if typ == 3 && namesz == 4 && bytes.Equal(d[12:16], []byte("GNU\000")) { - id := string(d[12+an : 12+an+descsz]) + id := string(d[12+an:12+an+descsz]) if id == "\x12\x34\x56\x78" { c++ } else { diff --git a/test/fixedbugs/issue11326.go b/test/fixedbugs/issue11326.go index 178f1335b6..82754c73fb 100644 --- a/test/fixedbugs/issue11326.go +++ b/test/fixedbugs/issue11326.go @@ -18,14 +18,14 @@ func main() { // Any implementation must be able to handle these constants at // compile time (even though they cannot be assigned to a float64). - var _ = 1e646456992 // ERROR "1e\+646456992 overflows float64" - var _ = 1e64645699 // ERROR "1e\+64645699 overflows float64" - var _ = 1e6464569 // ERROR "1e\+6464569 overflows float64" - var _ = 1e646456 // ERROR "1e\+646456 overflows float64" - var _ = 1e64645 // ERROR "1e\+64645 overflows float64" - var _ = 1e6464 // ERROR "1e\+6464 overflows float64" - var _ = 1e646 // ERROR "1e\+646 overflows float64" - var _ = 1e309 // ERROR "1e\+309 overflows float64" + var _ = 1e646456992 // ERROR "1e\+646456992 overflows float64" + var _ = 1e64645699 // ERROR "1e\+64645699 overflows float64" + var _ = 1e6464569 // ERROR "1e\+6464569 overflows float64" + var _ = 1e646456 // ERROR "1e\+646456 overflows float64" + var _ = 1e64645 // ERROR "1e\+64645 overflows float64" + var _ = 1e6464 // ERROR "1e\+6464 overflows float64" + var _ = 1e646 // ERROR "1e\+646 overflows float64" + var _ = 1e309 // ERROR "1e\+309 overflows float64" var _ = 1e308 } diff --git a/test/fixedbugs/issue11361.go b/test/fixedbugs/issue11361.go index f9fa6a4ea3..1260ea89c9 100644 --- a/test/fixedbugs/issue11361.go +++ b/test/fixedbugs/issue11361.go @@ -6,6 +6,6 @@ package a -import "fmt" // ERROR "imported and not used" +import "fmt" // ERROR "imported and not used" const n = fmt // ERROR "fmt without selector" diff --git a/test/fixedbugs/issue11362.go b/test/fixedbugs/issue11362.go index 2c14e9e318..9e9e599595 100644 --- a/test/fixedbugs/issue11362.go +++ b/test/fixedbugs/issue11362.go @@ -12,3 +12,4 @@ import _ "unicode//utf8" // ERROR "non-canonical import path .unicode//utf8. \(s func main() { } + diff --git a/test/fixedbugs/issue12677.dir/p.go b/test/fixedbugs/issue12677.dir/p.go index 40cd872158..e395071f8d 100644 --- a/test/fixedbugs/issue12677.dir/p.go +++ b/test/fixedbugs/issue12677.dir/p.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. package p - func Baz(f int) float64 { - return 1 / float64(int(1)<<(uint(f))) + return 1 / float64(int(1)<<(uint(f))) } diff --git a/test/fixedbugs/issue12677.dir/q.go b/test/fixedbugs/issue12677.dir/q.go index ae4fb8aa84..fd39c8a9ca 100644 --- a/test/fixedbugs/issue12677.dir/q.go +++ b/test/fixedbugs/issue12677.dir/q.go @@ -3,7 +3,5 @@ // license that can be found in the LICENSE file. package q - import "./p" - func f() { println(p.Baz(2)) } diff --git a/test/fixedbugs/issue13261.go b/test/fixedbugs/issue13261.go index 1b39f08ce8..a944f3a9b5 100644 --- a/test/fixedbugs/issue13261.go +++ b/test/fixedbugs/issue13261.go @@ -13,23 +13,17 @@ type T struct{} func main() { _ = &T{} _ = &(T{}) - _ = &(T{}) + _ = &((T{})) _ = &struct{}{} _ = &(struct{}{}) - _ = &(struct{}{}) + _ = &((struct{}{})) + + switch (&T{}) {} + switch &(T{}) {} + switch &((T{})) {} - switch (&T{}) { - } - switch &(T{}) { - } - switch &(T{}) { - } - - switch &struct{}{} { - } - switch &(struct{}{}) { - } - switch &(struct{}{}) { - } + switch &struct{}{} {} + switch &(struct{}{}) {} + switch &((struct{}{})) {} } diff --git a/test/fixedbugs/issue13265.go b/test/fixedbugs/issue13265.go index 9086ccda63..3e16cee6e7 100644 --- a/test/fixedbugs/issue13265.go +++ b/test/fixedbugs/issue13265.go @@ -10,7 +10,7 @@ package p func f() { - var c chan chan chan int - for ; ; <-<-<-c { - } + var c chan chan chan int + for ; ; <-<-<-c { + } } diff --git a/test/fixedbugs/issue13337.go b/test/fixedbugs/issue13337.go index 4138eaf583..81f984b732 100644 --- a/test/fixedbugs/issue13337.go +++ b/test/fixedbugs/issue13337.go @@ -10,7 +10,6 @@ package s type S0 struct{ f int } - func (S0) m() {} type S1 struct{ S0 } diff --git a/test/fixedbugs/issue13415.go b/test/fixedbugs/issue13415.go index 20085a3f49..989a1ed50f 100644 --- a/test/fixedbugs/issue13415.go +++ b/test/fixedbugs/issue13415.go @@ -10,10 +10,10 @@ package p func f() { - select { - case x, x := <-func() chan int { // ERROR "x repeated on left side of :=" - c := make(chan int) - return c - }(): - } + select { + case x, x := <-func() chan int { // ERROR "x repeated on left side of :=" + c := make(chan int) + return c + }(): + } } diff --git a/test/fixedbugs/issue13485.go b/test/fixedbugs/issue13485.go index 982dba494c..a9beea1f7d 100644 --- a/test/fixedbugs/issue13485.go +++ b/test/fixedbugs/issue13485.go @@ -9,7 +9,7 @@ package p var ( _ [10]int _ [10.0]int - _ [float64(10)]int // ERROR "invalid array bound" + _ [float64(10)]int // ERROR "invalid array bound" _ [10 + 0i]int _ [complex(10, 0)]int _ [complex128(complex(10, 0))]int // ERROR "invalid array bound" diff --git a/test/fixedbugs/issue14136.go b/test/fixedbugs/issue14136.go index 12d18c37b1..f9efd05f96 100644 --- a/test/fixedbugs/issue14136.go +++ b/test/fixedbugs/issue14136.go @@ -15,5 +15,5 @@ type T struct{} func main() { t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1} // ERROR "unknown field 'X' in struct literal of type T" - var s string = 1 // ERROR "cannot use 1" + var s string = 1 // ERROR "cannot use 1" } diff --git a/test/fixedbugs/issue14321.go b/test/fixedbugs/issue14321.go index dbef63179b..058008c386 100644 --- a/test/fixedbugs/issue14321.go +++ b/test/fixedbugs/issue14321.go @@ -8,14 +8,14 @@ package p -type A struct { +type A struct{ H int } func (A) F() {} func (A) G() {} -type B struct { +type B struct{ G int H int } diff --git a/test/fixedbugs/issue14540.go b/test/fixedbugs/issue14540.go index cc55c7f522..62b17a04c4 100644 --- a/test/fixedbugs/issue14540.go +++ b/test/fixedbugs/issue14540.go @@ -10,11 +10,10 @@ func f(x int) { switch x { case 0: fallthrough - // ok + ; // ok case 1: fallthrough // ERROR "fallthrough statement out of place" - { - } + {} case 2: fallthrough // ERROR "cannot fallthrough" } diff --git a/test/fixedbugs/issue14651.go b/test/fixedbugs/issue14651.go index 49eb816554..4c756e502e 100644 --- a/test/fixedbugs/issue14651.go +++ b/test/fixedbugs/issue14651.go @@ -18,9 +18,9 @@ import ( ) const ( - p149 = 1.0 / (1 << 149) // 1p-149 - p500 = 1.0 / (1 << 500) // 1p-500 - p1074 = p500 * p500 / (1 << 74) // 1p-1074 + p149 = 1.0 / (1 << 149) // 1p-149 + p500 = 1.0 / (1 << 500) // 1p-500 + p1074 = p500 * p500 / (1<<74) // 1p-1074 ) const ( diff --git a/test/fixedbugs/issue14729.go b/test/fixedbugs/issue14729.go index 50b615e2cf..88e01f9e16 100644 --- a/test/fixedbugs/issue14729.go +++ b/test/fixedbugs/issue14729.go @@ -10,5 +10,5 @@ package main import "unsafe" -type s struct{ unsafe.Pointer } // ERROR "embedded type cannot be a pointer" -type s1 struct{ p unsafe.Pointer } +type s struct { unsafe.Pointer } // ERROR "embedded type cannot be a pointer" +type s1 struct { p unsafe.Pointer } diff --git a/test/fixedbugs/issue15039.go b/test/fixedbugs/issue15039.go index 243653e3f0..85d9e8340a 100644 --- a/test/fixedbugs/issue15039.go +++ b/test/fixedbugs/issue15039.go @@ -18,7 +18,7 @@ func main() { } // cmd/compile used to require integer constants to fit into an "int". - const huge = string(1 << 100) + const huge = string(1<<100) if huge != fffd { panic("huge != bad") } diff --git a/test/fixedbugs/issue15042.go b/test/fixedbugs/issue15042.go index 7941bd7157..85d5d6c361 100644 --- a/test/fixedbugs/issue15042.go +++ b/test/fixedbugs/issue15042.go @@ -22,6 +22,6 @@ func F(c bool, s1, s2 S) (int, int) { func main() { i, j := F(true, S{1}, S{20}) if i != 20 || j != 1 { - panic(i + j) + panic(i+j) } } diff --git a/test/fixedbugs/issue15311.go b/test/fixedbugs/issue15311.go index 6f4ad85feb..81fa541325 100644 --- a/test/fixedbugs/issue15311.go +++ b/test/fixedbugs/issue15311.go @@ -10,11 +10,11 @@ package p type T struct { - toInt map[string]int - toString map[int]string + toInt map[string]int + toString map[int]string } var t = T{ - foo.toInt: make(map[string]int), // ERROR "field name" - bar.toString: make(map[int]string), // ERROR "field name" + foo.toInt: make(map[string]int), // ERROR "field name" + bar.toString: make(map[int]string), // ERROR "field name" } diff --git a/test/fixedbugs/issue15439.go b/test/fixedbugs/issue15439.go index d53077d11a..840a3c02a8 100644 --- a/test/fixedbugs/issue15439.go +++ b/test/fixedbugs/issue15439.go @@ -10,9 +10,7 @@ import "reflect" func main() { a := &struct{ x int }{} - b := &struct { - x int "" - }{} + b := &struct{ x int "" }{} ta := reflect.TypeOf(a) tb := reflect.TypeOf(b) diff --git a/test/fixedbugs/issue15470.dir/a.go b/test/fixedbugs/issue15470.dir/a.go index 69b63530ba..1fcf3ea6e0 100644 --- a/test/fixedbugs/issue15470.dir/a.go +++ b/test/fixedbugs/issue15470.dir/a.go @@ -10,10 +10,10 @@ type T interface { type S struct{} -func (S) M0(_ int) {} -func (S) M1(x, _ int) {} +func (S) M0(_ int) {} +func (S) M1(x, _ int) {} func (S) M2() (x, _ int) { return } -func (_ S) M3() {} +func (_ S) M3() {} // Snippet from x/tools/godoc/analysis/analysis.go. // Offending code from #5470. diff --git a/test/fixedbugs/issue15548.dir/c.go b/test/fixedbugs/issue15548.dir/c.go index ce6e3204b3..6d3f3be53e 100644 --- a/test/fixedbugs/issue15548.dir/c.go +++ b/test/fixedbugs/issue15548.dir/c.go @@ -5,6 +5,6 @@ package c import ( - _ "./a" _ "./b" + _ "./a" ) diff --git a/test/fixedbugs/issue15646.go b/test/fixedbugs/issue15646.go index 53ccd4096e..cd4ba9d4e5 100644 --- a/test/fixedbugs/issue15646.go +++ b/test/fixedbugs/issue15646.go @@ -6,4 +6,4 @@ // Test that method expressions are correctly encoded // in binary export data and can be imported again. -package ignore +package ignore \ No newline at end of file diff --git a/test/fixedbugs/issue15926.go b/test/fixedbugs/issue15926.go index 8004545e14..76e25eb640 100644 --- a/test/fixedbugs/issue15926.go +++ b/test/fixedbugs/issue15926.go @@ -16,5 +16,5 @@ func (s S) def() {} var I = S.def func main() { - I(S{}) + I(S{}) } diff --git a/test/fixedbugs/issue16515.go b/test/fixedbugs/issue16515.go index cacff54bfa..6b67436383 100644 --- a/test/fixedbugs/issue16515.go +++ b/test/fixedbugs/issue16515.go @@ -34,10 +34,7 @@ func g() { } func main() { - var s struct { - a T - b [8192 - 62]int - } // allocate 64K, hopefully it's in a new span and a few bytes before it is garbage + var s struct { a T; b [8192-62]int } // allocate 64K, hopefully it's in a new span and a few bytes before it is garbage sink = &s // force heap allocation s.a[0] = 2 zero(&s.a) diff --git a/test/fixedbugs/issue16948.go b/test/fixedbugs/issue16948.go index 65c87c3f05..c986024896 100644 --- a/test/fixedbugs/issue16948.go +++ b/test/fixedbugs/issue16948.go @@ -18,7 +18,6 @@ func main() { var x int32 type T [10]int - var sink *T func f() (t T) { diff --git a/test/fixedbugs/issue17449.go b/test/fixedbugs/issue17449.go index 8c8bd4844f..51cc8eaa06 100644 --- a/test/fixedbugs/issue17449.go +++ b/test/fixedbugs/issue17449.go @@ -11,25 +11,25 @@ package master type PriorityList struct { - elems []interface{} + elems []interface{} } func (x *PriorityList) Len() int { return len(x.elems) } func (l *PriorityList) remove(i int) interface{} { - elem := l.elems[i] - l.elems = append(l.elems[:i], l.elems[i+1:]...) - return elem + elem := l.elems[i] + l.elems = append(l.elems[:i], l.elems[i+1:]...) + return elem } func (l *PriorityList) Next() interface{} { - return l.remove(l.Len() - 1) + return l.remove(l.Len() - 1) } var l *PriorityList func Foo() { - // It would fail here if instrumented code (including inline-label) was copied. - for elem := l.Next(); elem != nil; elem = l.Next() { - } + // It would fail here if instrumented code (including inline-label) was copied. + for elem := l.Next(); elem != nil; elem = l.Next() { + } } diff --git a/test/fixedbugs/issue17588.go b/test/fixedbugs/issue17588.go index 23af6f613b..1be57c6292 100644 --- a/test/fixedbugs/issue17588.go +++ b/test/fixedbugs/issue17588.go @@ -11,10 +11,10 @@ package p -type F func(b T) // ERROR "T is not a type" +type F func(b T) // ERROR "T is not a type" func T(fn F) { - func() { - fn(nil) // If Decldepth is not initialized properly, typecheckclosure() Fatals here. - }() + func() { + fn(nil) // If Decldepth is not initialized properly, typecheckclosure() Fatals here. + }() } diff --git a/test/fixedbugs/issue17645.go b/test/fixedbugs/issue17645.go index 0fc495c851..ed92c54cfa 100644 --- a/test/fixedbugs/issue17645.go +++ b/test/fixedbugs/issue17645.go @@ -12,5 +12,6 @@ type Foo struct { func main() { var s []int - var _ string = append(s, Foo{""}) // ERROR "cannot use .. \(type string\) as type int in field value" "cannot use Foo literal \(type Foo\) as type int in append" "cannot use append\(s\, Foo literal\) \(type \[\]int\) as type string in assignment" + var _ string = append(s, Foo{""}) // ERROR "cannot use .. \(type string\) as type int in field value" "cannot use Foo literal \(type Foo\) as type int in append" "cannot use append\(s\, Foo literal\) \(type \[\]int\) as type string in assignment" } + diff --git a/test/fixedbugs/issue18231.go b/test/fixedbugs/issue18231.go index 972c0f28a7..adfd2277ff 100644 --- a/test/fixedbugs/issue18231.go +++ b/test/fixedbugs/issue18231.go @@ -14,7 +14,7 @@ type T struct { } var _ = T{ - f: { // ERROR "missing type in composite literal" + f: { // ERROR "missing type in composite literal" "a": "b", }, } diff --git a/test/fixedbugs/issue18808.go b/test/fixedbugs/issue18808.go index 8e1a55471d..c98386ee78 100644 --- a/test/fixedbugs/issue18808.go +++ b/test/fixedbugs/issue18808.go @@ -56,8 +56,8 @@ func lte(x uint32) { func main() { eq(lim) neq(lim) - gt(lim + 1) - gte(lim + 1) - lt(lim + 1) - lte(lim + 1) + gt(lim+1) + gte(lim+1) + lt(lim+1) + lte(lim+1) } diff --git a/test/fixedbugs/issue19028.dir/main.go b/test/fixedbugs/issue19028.dir/main.go index ca2cf8c694..627e926f93 100644 --- a/test/fixedbugs/issue19028.dir/main.go +++ b/test/fixedbugs/issue19028.dir/main.go @@ -5,12 +5,12 @@ package main import ( - fake "./reflect" // 2nd package with name "reflect" - "reflect" + "reflect" + fake "./reflect" // 2nd package with name "reflect" ) type T struct { - _ fake.Type + _ fake.Type } func (T) f() {} @@ -18,9 +18,9 @@ func (T) G() (_ int) { return } func (T) H() (_, _ int) { return } func main() { - var x T - typ := reflect.TypeOf(x) - for i := 0; i < typ.NumMethod(); i++ { - _ = typ.Method(i) // must not crash - } + var x T + typ := reflect.TypeOf(x) + for i := 0; i < typ.NumMethod(); i++ { + _ = typ.Method(i) // must not crash + } } diff --git a/test/fixedbugs/issue19515.go b/test/fixedbugs/issue19515.go index 8a230485f5..a1605bec96 100644 --- a/test/fixedbugs/issue19515.go +++ b/test/fixedbugs/issue19515.go @@ -48,3 +48,4 @@ func (v *VScrollPanel) Draw() { BoxGradient(x+x-2, y-1, 0, 0, 0, Color{}, Color{}) BoxGradient(x+y-2, y-1, 0, 0, 0, Color{}, Color{}) } + diff --git a/test/fixedbugs/issue19764.dir/a.go b/test/fixedbugs/issue19764.dir/a.go index 7467d03a40..64538e5bdf 100644 --- a/test/fixedbugs/issue19764.dir/a.go +++ b/test/fixedbugs/issue19764.dir/a.go @@ -5,10 +5,9 @@ package a type T struct{ _ int } - func (t T) M() {} -type I interface{ M() } +type I interface { M() } func F() { var t I = &T{} diff --git a/test/fixedbugs/issue20602.go b/test/fixedbugs/issue20602.go index c938ca3006..ca4ce095aa 100644 --- a/test/fixedbugs/issue20602.go +++ b/test/fixedbugs/issue20602.go @@ -10,5 +10,5 @@ package p var p = &[1]complex128{0} -var _ = real(p) // ERROR "type \*\[1\]complex128" -var _ = imag(p) // ERROR "type \*\[1\]complex128" +var _ = real(p) // ERROR "type \*\[1\]complex128" +var _ = imag(p) // ERROR "type \*\[1\]complex128" diff --git a/test/fixedbugs/issue20811.go b/test/fixedbugs/issue20811.go index 2ccf453a14..96b61ec728 100644 --- a/test/fixedbugs/issue20811.go +++ b/test/fixedbugs/issue20811.go @@ -20,3 +20,4 @@ func main() { func g() int64 { return 4398046511104 } + diff --git a/test/fixedbugs/issue22429.go b/test/fixedbugs/issue22429.go index 03c007f2aa..289b434a74 100644 --- a/test/fixedbugs/issue22429.go +++ b/test/fixedbugs/issue22429.go @@ -9,10 +9,10 @@ package p type T struct { - a, b, c, d float32 + a,b,c,d float32 } -func f(a *[8]T, i, j, k int) float32 { +func f(a *[8]T, i,j,k int) float32 { b := *a return b[i].a + b[j].b + b[k].c } diff --git a/test/fixedbugs/issue22458.go b/test/fixedbugs/issue22458.go index 9317bcfdbd..5c89929577 100644 --- a/test/fixedbugs/issue22458.go +++ b/test/fixedbugs/issue22458.go @@ -11,16 +11,16 @@ package main import "runtime" type node struct { - next *node + next *node } var x bool func main() { - var head *node - for x { - head = &node{head} - } + var head *node + for x { + head = &node{head} + } - runtime.KeepAlive(head) + runtime.KeepAlive(head) } diff --git a/test/fixedbugs/issue22662.go b/test/fixedbugs/issue22662.go index 03830de862..a1f00bfac3 100644 --- a/test/fixedbugs/issue22662.go +++ b/test/fixedbugs/issue22662.go @@ -25,7 +25,7 @@ func check(file string, line int) { } func main() { - //-style line directives +//-style line directives //line :1 check("??", 1) // no file specified //line foo.go:1 @@ -35,16 +35,12 @@ func main() { //line :11:22 check("bar.go", 11) // no file, but column specified => keep old filename - /*-style line directives */ - /*line :1*/ - check("??", 1) // no file specified - /*line foo.go:1*/ check("foo.go", 1) - /*line bar.go:10:20*/ check("bar.go", 10) - /*line :11:22*/ check("bar.go", 11) // no file, but column specified => keep old filename - - /*line :10*/ - check("??", 10) /*line foo.go:20*/ - check("foo.go", 20) /*line :30:1*/ - check("foo.go", 30) +/*-style line directives */ +/*line :1*/ check("??", 1) // no file specified +/*line foo.go:1*/ check("foo.go", 1) +/*line bar.go:10:20*/ check("bar.go", 10) +/*line :11:22*/ check("bar.go", 11) // no file, but column specified => keep old filename + + /*line :10*/ check("??", 10); /*line foo.go:20*/ check("foo.go", 20); /*line :30:1*/ check("foo.go", 30) check("foo.go", 31) } diff --git a/test/fixedbugs/issue24339.go b/test/fixedbugs/issue24339.go index 308fa75825..0670becdfe 100644 --- a/test/fixedbugs/issue24339.go +++ b/test/fixedbugs/issue24339.go @@ -9,6 +9,12 @@ package p // Use a diffent line number for each token so we can // check that the error message appears at the correct // position. -var _ = struct{}{ /*line :20:1*/ foo /*line :21:1*/ : /*line :22:1*/ 0} +var _ = struct{}{ /*line :20:1*/foo /*line :21:1*/: /*line :22:1*/0 } -// ERROR "unknown field 'foo'" + + + + + + +// ERROR "unknown field 'foo'" \ No newline at end of file diff --git a/test/fixedbugs/issue24799.go b/test/fixedbugs/issue24799.go index 70f8def24d..c805c86dda 100644 --- a/test/fixedbugs/issue24799.go +++ b/test/fixedbugs/issue24799.go @@ -10,7 +10,7 @@ package main import ( - "fmt" + "fmt" ) type Level string @@ -20,39 +20,39 @@ type Level string // not aligned to 4 bytes due to the type of relocation that // is generated for the instruction. A fix was made to avoid // generating an instruction with DS relocation for go.strings -// since their alignment is not known until link time. +// since their alignment is not known until link time. // This problem only affects go.string since other types have // correct alignment. const ( - LevelBad Level = "badvals" - LevelNone Level = "No" - LevelMetadata Level = "Metadata" - LevelRequest Level = "Request" - LevelRequestResponse Level = "RequestResponse" + LevelBad Level = "badvals" + LevelNone Level = "No" + LevelMetadata Level = "Metadata" + LevelRequest Level = "Request" + LevelRequestResponse Level = "RequestResponse" ) func ordLevel(l Level) int { - switch l { - case LevelMetadata: - return 1 - case LevelRequest: - return 2 - case LevelRequestResponse: - return 3 - default: - return 0 - } + switch l { + case LevelMetadata: + return 1 + case LevelRequest: + return 2 + case LevelRequestResponse: + return 3 + default: + return 0 + } } //go:noinline func test(l Level) { - if ordLevel(l) < ordLevel(LevelMetadata) { - fmt.Printf("OK\n") - } + if ordLevel(l) < ordLevel(LevelMetadata) { + fmt.Printf("OK\n") + } } func main() { - test(LevelMetadata) + test(LevelMetadata) } diff --git a/test/fixedbugs/issue25727.go b/test/fixedbugs/issue25727.go index da7c94cc12..9b7c804a0e 100644 --- a/test/fixedbugs/issue25727.go +++ b/test/fixedbugs/issue25727.go @@ -9,13 +9,13 @@ package main import "net/http" var s = http.Server{} -var _ = s.doneChan // ERROR "s.doneChan undefined .cannot refer to unexported field or method doneChan.$" -var _ = s.DoneChan // ERROR "s.DoneChan undefined .type http.Server has no field or method DoneChan.$" +var _ = s.doneChan // ERROR "s.doneChan undefined .cannot refer to unexported field or method doneChan.$" +var _ = s.DoneChan // ERROR "s.DoneChan undefined .type http.Server has no field or method DoneChan.$" var _ = http.Server{tlsConfig: nil} // ERROR "unknown field 'tlsConfig' in struct literal.+ .but does have TLSConfig.$" -var _ = http.Server{DoneChan: nil} // ERROR "unknown field 'DoneChan' in struct literal of type http.Server$" +var _ = http.Server{DoneChan: nil} // ERROR "unknown field 'DoneChan' in struct literal of type http.Server$" type foo struct { - bar int + bar int } var _ = &foo{bAr: 10} // ERROR "unknown field 'bAr' in struct literal.+ .but does have bar.$" diff --git a/test/fixedbugs/issue26335.go b/test/fixedbugs/issue26335.go index 97174ea11d..a97b4b6c72 100644 --- a/test/fixedbugs/issue26335.go +++ b/test/fixedbugs/issue26335.go @@ -15,7 +15,7 @@ import ( type Empty struct { f1, f2 *byte - empty struct{} + empty struct{} } func F(e Empty, s []string) { diff --git a/test/fixedbugs/issue26340.go b/test/fixedbugs/issue26340.go index afa32c8881..f973ce2237 100644 --- a/test/fixedbugs/issue26340.go +++ b/test/fixedbugs/issue26340.go @@ -10,12 +10,12 @@ package p type S []T -type T struct{ x int } +type T struct { x int } var _ = map[string]*S{ "a": { - {1}, + { 1 }, }, } -var _ = [1]*S{{{1}}} +var _ = [1]*S{ { {1}, } } diff --git a/test/fixedbugs/issue26407.go b/test/fixedbugs/issue26407.go index 02c1c19334..aa8e79c1e6 100644 --- a/test/fixedbugs/issue26407.go +++ b/test/fixedbugs/issue26407.go @@ -55,4 +55,4 @@ func grow() { } //go:noinline -func use(_ []uintptr) {} +func use(_ []uintptr) { } diff --git a/test/fixedbugs/issue27278.go b/test/fixedbugs/issue27278.go index 321b85cb63..73f7c755e1 100644 --- a/test/fixedbugs/issue27278.go +++ b/test/fixedbugs/issue27278.go @@ -50,7 +50,7 @@ func grow(n int) { if n == 0 { return } - grow(n - 1) + grow(n-1) } // put some junk on stack, which cannot be valid address diff --git a/test/fixedbugs/issue27356.go b/test/fixedbugs/issue27356.go index 18530bf6a9..42784876a5 100644 --- a/test/fixedbugs/issue27356.go +++ b/test/fixedbugs/issue27356.go @@ -8,11 +8,12 @@ package p -var a = []int{1, 2, 3} +var a = []int{1,2,3} func _(len int) { - _ = len(a) // ERROR "cannot call non-function" + _ = len(a) // ERROR "cannot call non-function" } var cap = false var _ = cap(a) // ERROR "cannot call non-function" + diff --git a/test/fixedbugs/issue29215.go b/test/fixedbugs/issue29215.go index 69bbdc3be4..4e8f107aee 100644 --- a/test/fixedbugs/issue29215.go +++ b/test/fixedbugs/issue29215.go @@ -7,14 +7,14 @@ package main func f() { - var s string - var p, q bool - s = "a" - for p { - p = false == (true != q) - s = "" - } - _ = s == "bbb" + var s string + var p, q bool + s = "a" + for p { + p = false == (true != q) + s = "" + } + _ = s == "bbb" } // Another case: load from negative offset of a symbol diff --git a/test/fixedbugs/issue29402.go b/test/fixedbugs/issue29402.go index fed779bc5f..8a1f959d84 100644 --- a/test/fixedbugs/issue29402.go +++ b/test/fixedbugs/issue29402.go @@ -1,5 +1,5 @@ // run - + // Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/test/fixedbugs/issue31747.go b/test/fixedbugs/issue31747.go index 81bd111d44..dfb585c613 100644 --- a/test/fixedbugs/issue31747.go +++ b/test/fixedbugs/issue31747.go @@ -14,10 +14,10 @@ const ( _ = 0xabc // ok _ = 0x0p1 // ERROR "hexadecimal floating-point literals only supported as of -lang=go1.13" - _ = 0b111 // ERROR "binary" - _ = 0o567 // ERROR "octal" - _ = 0xabc // ok - _ = 0x0p1 // ERROR "hexadecimal floating-point" + _ = 0B111 // ERROR "binary" + _ = 0O567 // ERROR "octal" + _ = 0Xabc // ok + _ = 0X0P1 // ERROR "hexadecimal floating-point" _ = 1_000i // ERROR "underscores" _ = 0b111i // ERROR "binary" diff --git a/test/fixedbugs/issue3552.dir/one.go b/test/fixedbugs/issue3552.dir/one.go index dacd2565da..e594db7478 100644 --- a/test/fixedbugs/issue3552.dir/one.go +++ b/test/fixedbugs/issue3552.dir/one.go @@ -6,20 +6,23 @@ package one // Issue 3552 -type T struct{ int } +type T struct { int } func (t T) F() int { return t.int } -type U struct{ int int } +type U struct { int int } func (u U) F() int { return u.int } type lint int -type V struct{ lint } +type V struct { lint } func (v V) F() int { return int(v.lint) } -type W struct{ lint lint } +type W struct { lint lint } func (w W) F() int { return int(w.lint) } + + + diff --git a/test/fixedbugs/issue3783.go b/test/fixedbugs/issue3783.go index b60b4b3ee0..7db06d1881 100644 --- a/test/fixedbugs/issue3783.go +++ b/test/fixedbugs/issue3783.go @@ -9,3 +9,4 @@ package foo var i int func (*i) bar() // ERROR "not a type|expected type" + diff --git a/test/fixedbugs/issue3925.go b/test/fixedbugs/issue3925.go index a8c73a3d65..628c222685 100644 --- a/test/fixedbugs/issue3925.go +++ b/test/fixedbugs/issue3925.go @@ -11,7 +11,7 @@ package foo var _ = map[string]string{ - "1": "2", + "1": "2", "3", "4", // ERROR "missing key|must have keys" } @@ -20,3 +20,4 @@ var _ = []string{ "bar", 20, // ERROR "cannot use|incompatible type" } + diff --git a/test/fixedbugs/issue4097.go b/test/fixedbugs/issue4097.go index a3c9fea8cb..30b65bce83 100644 --- a/test/fixedbugs/issue4097.go +++ b/test/fixedbugs/issue4097.go @@ -7,5 +7,5 @@ package foo var s [][10]int +const m = len(s[len(s)-1]) // ERROR "is not a constant|is not constant" -const m = len(s[len(s)-1]) // ERROR "is not a constant|is not constant" diff --git a/test/fixedbugs/issue4099.go b/test/fixedbugs/issue4099.go index c02e337f37..5a4ea7c998 100644 --- a/test/fixedbugs/issue4099.go +++ b/test/fixedbugs/issue4099.go @@ -20,7 +20,7 @@ func F2([]byte) func G() { var buf1 [10]byte F1(buf1[:]) - + var buf2 [10]byte // ERROR "moved to heap: buf2" F2(buf2[:]) } diff --git a/test/fixedbugs/issue4162.go b/test/fixedbugs/issue4162.go index 23b93e5841..f236bd0f6a 100644 --- a/test/fixedbugs/issue4162.go +++ b/test/fixedbugs/issue4162.go @@ -10,8 +10,8 @@ package p // All these are valid now. var ( - _ = int(1.0) // comma was always permitted (like function call) - _ = []byte("foo") // was syntax error: unexpected comma - _ = chan int(nil) // was syntax error: unexpected comma - _ = (func())(nil) // was syntax error: unexpected comma + _ = int(1.0,) // comma was always permitted (like function call) + _ = []byte("foo",) // was syntax error: unexpected comma + _ = chan int(nil,) // was syntax error: unexpected comma + _ = (func())(nil,) // was syntax error: unexpected comma ) diff --git a/test/fixedbugs/issue4251.go b/test/fixedbugs/issue4251.go index b3434d7ff6..d11ce51b97 100644 --- a/test/fixedbugs/issue4251.go +++ b/test/fixedbugs/issue4251.go @@ -9,13 +9,13 @@ package p func F1(s []byte) []byte { - return s[2:1] // ERROR "invalid slice index|inverted slice range" + return s[2:1] // ERROR "invalid slice index|inverted slice range" } func F2(a [10]byte) []byte { - return a[2:1] // ERROR "invalid slice index|inverted slice range" + return a[2:1] // ERROR "invalid slice index|inverted slice range" } func F3(s string) string { - return s[2:1] // ERROR "invalid slice index|inverted slice range" + return s[2:1] // ERROR "invalid slice index|inverted slice range" } diff --git a/test/fixedbugs/issue4264.go b/test/fixedbugs/issue4264.go index f550c95e71..627393211e 100644 --- a/test/fixedbugs/issue4264.go +++ b/test/fixedbugs/issue4264.go @@ -13,7 +13,7 @@ func main() { var y float64 var z complex128 - println(x / 0) // ERROR "division by zero" - println(y / 0) - println(z / 0) -} + println(x/0) // ERROR "division by zero" + println(y/0) + println(z/0) +} \ No newline at end of file diff --git a/test/fixedbugs/issue4283.go b/test/fixedbugs/issue4283.go index 5d69538843..fa5629b20a 100644 --- a/test/fixedbugs/issue4283.go +++ b/test/fixedbugs/issue4283.go @@ -9,9 +9,9 @@ package p func F1() bool { - return nil == nil // ERROR "invalid" + return nil == nil // ERROR "invalid" } func F2() bool { - return nil != nil // ERROR "invalid" + return nil != nil // ERROR "invalid" } diff --git a/test/fixedbugs/issue4313.go b/test/fixedbugs/issue4313.go index ad45f60a5b..2494b83b03 100644 --- a/test/fixedbugs/issue4313.go +++ b/test/fixedbugs/issue4313.go @@ -22,10 +22,7 @@ func main() { } func makec(px *int) chan bool { - if false { - for { - } - } + if false { for {} } *px = 42 return make(chan bool, 0) } diff --git a/test/fixedbugs/issue4326.dir/q1.go b/test/fixedbugs/issue4326.dir/q1.go index f1a0d18ea8..f118eb0925 100644 --- a/test/fixedbugs/issue4326.dir/q1.go +++ b/test/fixedbugs/issue4326.dir/q1.go @@ -1,8 +1,8 @@ package q1 func Deref(typ interface{}) interface{} { - if typ, ok := typ.(*int); ok { - return *typ - } - return typ + if typ, ok := typ.(*int); ok { + return *typ + } + return typ } diff --git a/test/fixedbugs/issue4326.dir/q2.go b/test/fixedbugs/issue4326.dir/q2.go index 2bcc0e224d..075e2b21e7 100644 --- a/test/fixedbugs/issue4326.dir/q2.go +++ b/test/fixedbugs/issue4326.dir/q2.go @@ -3,9 +3,9 @@ package main import "./q1" func main() { - x := 1 - y := q1.Deref(&x) - if y != 1 { - panic("y != 1") - } + x := 1 + y := q1.Deref(&x) + if y != 1 { + panic("y != 1") + } } diff --git a/test/fixedbugs/issue4365.go b/test/fixedbugs/issue4365.go index 9b4a7641b1..09ff1bf8f7 100644 --- a/test/fixedbugs/issue4365.go +++ b/test/fixedbugs/issue4365.go @@ -10,7 +10,7 @@ package main type T interface { - M() + M() } type M struct{} @@ -18,10 +18,10 @@ type M struct{} func (M) M() {} type Foo struct { - M + M } func main() { - var v T = Foo{} // ERROR "has no methods|not a method|cannot use" - _ = v + var v T = Foo{} // ERROR "has no methods|not a method|cannot use" + _ = v } diff --git a/test/fixedbugs/issue4396a.go b/test/fixedbugs/issue4396a.go index 12f4212d76..38dd4b8cfb 100644 --- a/test/fixedbugs/issue4396a.go +++ b/test/fixedbugs/issue4396a.go @@ -8,7 +8,7 @@ // word aligned. 5g should use MOVB to load the address // of s.g[0] for its nil check. // -// This test _may_ fail on arm, but requires the host to +// This test _may_ fail on arm, but requires the host to // trap unaligned loads. This is generally done with // // echo "4" > /proc/cpu/alignment diff --git a/test/fixedbugs/issue4396b.go b/test/fixedbugs/issue4396b.go index 1281284d17..1284870ece 100644 --- a/test/fixedbugs/issue4396b.go +++ b/test/fixedbugs/issue4396b.go @@ -17,7 +17,7 @@ type T struct { } type T2 struct { - pad [4096]byte + pad [4096]byte A, B byte } diff --git a/test/fixedbugs/issue4429.go b/test/fixedbugs/issue4429.go index 7b2c92a7bc..9eb2e0f9c2 100644 --- a/test/fixedbugs/issue4429.go +++ b/test/fixedbugs/issue4429.go @@ -7,10 +7,10 @@ package p type a struct { - a int + a int } func main() { - av := a{} - _ = *a(av) // ERROR "invalid indirect|expected pointer" + av := a{}; + _ = *a(av); // ERROR "invalid indirect|expected pointer" } diff --git a/test/fixedbugs/issue4463.go b/test/fixedbugs/issue4463.go index 500b4975e6..6ad1952d67 100644 --- a/test/fixedbugs/issue4463.go +++ b/test/fixedbugs/issue4463.go @@ -17,17 +17,17 @@ func F() { var m map[int]int var s struct{ f int } - append(a, 0) // ERROR "not used" - cap(a) // ERROR "not used" - complex(1, 2) // ERROR "not used" - imag(1i) // ERROR "not used" - len(a) // ERROR "not used" - make([]int, 10) // ERROR "not used" - new(int) // ERROR "not used" - real(1i) // ERROR "not used" - unsafe.Alignof(a) // ERROR "not used" - unsafe.Offsetof(s.f) // ERROR "not used" - unsafe.Sizeof(a) // ERROR "not used" + append(a, 0) // ERROR "not used" + cap(a) // ERROR "not used" + complex(1, 2) // ERROR "not used" + imag(1i) // ERROR "not used" + len(a) // ERROR "not used" + make([]int, 10) // ERROR "not used" + new(int) // ERROR "not used" + real(1i) // ERROR "not used" + unsafe.Alignof(a) // ERROR "not used" + unsafe.Offsetof(s.f) // ERROR "not used" + unsafe.Sizeof(a) // ERROR "not used" close(c) copy(a, a) @@ -45,17 +45,17 @@ func F() { (println("bar")) (recover()) - go append(a, 0) // ERROR "not used|discards result" - go cap(a) // ERROR "not used|discards result" - go complex(1, 2) // ERROR "not used|discards result" - go imag(1i) // ERROR "not used|discards result" - go len(a) // ERROR "not used|discards result" - go make([]int, 10) // ERROR "not used|discards result" - go new(int) // ERROR "not used|discards result" - go real(1i) // ERROR "not used|discards result" - go unsafe.Alignof(a) // ERROR "not used|discards result" - go unsafe.Offsetof(s.f) // ERROR "not used|discards result" - go unsafe.Sizeof(a) // ERROR "not used|discards result" + go append(a, 0) // ERROR "not used|discards result" + go cap(a) // ERROR "not used|discards result" + go complex(1, 2) // ERROR "not used|discards result" + go imag(1i) // ERROR "not used|discards result" + go len(a) // ERROR "not used|discards result" + go make([]int, 10) // ERROR "not used|discards result" + go new(int) // ERROR "not used|discards result" + go real(1i) // ERROR "not used|discards result" + go unsafe.Alignof(a) // ERROR "not used|discards result" + go unsafe.Offsetof(s.f) // ERROR "not used|discards result" + go unsafe.Sizeof(a) // ERROR "not used|discards result" go close(c) go copy(a, a) @@ -65,17 +65,17 @@ func F() { go println("bar") go recover() - defer append(a, 0) // ERROR "not used|discards result" - defer cap(a) // ERROR "not used|discards result" - defer complex(1, 2) // ERROR "not used|discards result" - defer imag(1i) // ERROR "not used|discards result" - defer len(a) // ERROR "not used|discards result" - defer make([]int, 10) // ERROR "not used|discards result" - defer new(int) // ERROR "not used|discards result" - defer real(1i) // ERROR "not used|discards result" - defer unsafe.Alignof(a) // ERROR "not used|discards result" - defer unsafe.Offsetof(s.f) // ERROR "not used|discards result" - defer unsafe.Sizeof(a) // ERROR "not used|discards result" + defer append(a, 0) // ERROR "not used|discards result" + defer cap(a) // ERROR "not used|discards result" + defer complex(1, 2) // ERROR "not used|discards result" + defer imag(1i) // ERROR "not used|discards result" + defer len(a) // ERROR "not used|discards result" + defer make([]int, 10) // ERROR "not used|discards result" + defer new(int) // ERROR "not used|discards result" + defer real(1i) // ERROR "not used|discards result" + defer unsafe.Alignof(a) // ERROR "not used|discards result" + defer unsafe.Offsetof(s.f) // ERROR "not used|discards result" + defer unsafe.Sizeof(a) // ERROR "not used|discards result" defer close(c) defer copy(a, a) diff --git a/test/fixedbugs/issue4470.go b/test/fixedbugs/issue4470.go index f84a5409b7..d922478455 100644 --- a/test/fixedbugs/issue4470.go +++ b/test/fixedbugs/issue4470.go @@ -10,7 +10,7 @@ package main func main() { var i interface{} - switch i.(type) { // ERROR "outside type switch" + switch (i.(type)) { // ERROR "outside type switch" default: } } diff --git a/test/fixedbugs/issue4495.go b/test/fixedbugs/issue4495.go index 8f90809501..308acc2280 100644 --- a/test/fixedbugs/issue4495.go +++ b/test/fixedbugs/issue4495.go @@ -26,3 +26,4 @@ func main() { panic("ret != 3") } } + diff --git a/test/fixedbugs/issue4562.go b/test/fixedbugs/issue4562.go index 94280359b0..8c958f5725 100644 --- a/test/fixedbugs/issue4562.go +++ b/test/fixedbugs/issue4562.go @@ -34,7 +34,7 @@ func expectError(expectLine int) { if recover() == nil { panic("did not crash") } - for i := 1; ; i++ { + for i := 1;; i++ { _, file, line, ok := runtime.Caller(i) if !ok { panic("cannot find issue4562.go on stack") diff --git a/test/fixedbugs/issue4610.go b/test/fixedbugs/issue4610.go index 8993f9882b..d56c6d3e8c 100644 --- a/test/fixedbugs/issue4610.go +++ b/test/fixedbugs/issue4610.go @@ -14,3 +14,4 @@ func main() { var foo bar _ = &foo{} // ERROR "is not a type|expected .;." } // GCCGO_ERROR "expected declaration" + diff --git a/test/fixedbugs/issue4618.go b/test/fixedbugs/issue4618.go index fe43aa828d..0ba95230cf 100644 --- a/test/fixedbugs/issue4618.go +++ b/test/fixedbugs/issue4618.go @@ -13,7 +13,7 @@ import ( "testing" ) -type T struct{ int } +type T struct { int } var globl *T diff --git a/test/fixedbugs/issue4620.go b/test/fixedbugs/issue4620.go index 20d641d3f4..5aa29086f7 100644 --- a/test/fixedbugs/issue4620.go +++ b/test/fixedbugs/issue4620.go @@ -11,7 +11,7 @@ package main import "fmt" func main() { - m := map[int]int{0: 1} + m := map[int]int{0:1} i := 0 i, m[i] = 1, 2 if m[0] != 2 { diff --git a/test/fixedbugs/issue4654.go b/test/fixedbugs/issue4654.go index 595782f953..76aff76a67 100644 --- a/test/fixedbugs/issue4654.go +++ b/test/fixedbugs/issue4654.go @@ -12,60 +12,60 @@ package p import "unsafe" func f() { - defer int(0) // ERROR "defer requires function call, not conversion|is not used" + defer int(0) // ERROR "defer requires function call, not conversion|is not used" go string([]byte("abc")) // ERROR "go requires function call, not conversion|is not used" - + var c complex128 var f float64 - var t struct{ X int } + var t struct {X int} var x []int - defer append(x, 1) // ERROR "defer discards result of append|is not used" - defer cap(x) // ERROR "defer discards result of cap|is not used" - defer complex(1, 2) // ERROR "defer discards result of complex|is not used" - defer complex(f, 1) // ERROR "defer discards result of complex|is not used" - defer imag(1i) // ERROR "defer discards result of imag|is not used" - defer imag(c) // ERROR "defer discards result of imag|is not used" - defer len(x) // ERROR "defer discards result of len|is not used" - defer make([]int, 1) // ERROR "defer discards result of make|is not used" - defer make(chan bool) // ERROR "defer discards result of make|is not used" + defer append(x, 1) // ERROR "defer discards result of append|is not used" + defer cap(x) // ERROR "defer discards result of cap|is not used" + defer complex(1, 2) // ERROR "defer discards result of complex|is not used" + defer complex(f, 1) // ERROR "defer discards result of complex|is not used" + defer imag(1i) // ERROR "defer discards result of imag|is not used" + defer imag(c) // ERROR "defer discards result of imag|is not used" + defer len(x) // ERROR "defer discards result of len|is not used" + defer make([]int, 1) // ERROR "defer discards result of make|is not used" + defer make(chan bool) // ERROR "defer discards result of make|is not used" defer make(map[string]int) // ERROR "defer discards result of make|is not used" - defer new(int) // ERROR "defer discards result of new|is not used" - defer real(1i) // ERROR "defer discards result of real|is not used" - defer real(c) // ERROR "defer discards result of real|is not used" - defer append(x, 1) // ERROR "defer discards result of append|is not used" - defer append(x, 1) // ERROR "defer discards result of append|is not used" - defer unsafe.Alignof(t.X) // ERROR "defer discards result of unsafe.Alignof|is not used" + defer new(int) // ERROR "defer discards result of new|is not used" + defer real(1i) // ERROR "defer discards result of real|is not used" + defer real(c) // ERROR "defer discards result of real|is not used" + defer append(x, 1) // ERROR "defer discards result of append|is not used" + defer append(x, 1) // ERROR "defer discards result of append|is not used" + defer unsafe.Alignof(t.X) // ERROR "defer discards result of unsafe.Alignof|is not used" defer unsafe.Offsetof(t.X) // ERROR "defer discards result of unsafe.Offsetof|is not used" - defer unsafe.Sizeof(t) // ERROR "defer discards result of unsafe.Sizeof|is not used" - + defer unsafe.Sizeof(t) // ERROR "defer discards result of unsafe.Sizeof|is not used" + defer copy(x, x) // ok m := make(map[int]int) defer delete(m, 1) // ok - defer panic(1) // ok - defer print(1) // ok - defer println(1) // ok - defer recover() // ok + defer panic(1) // ok + defer print(1) // ok + defer println(1) // ok + defer recover() // ok - int(0) // ERROR "int\(0\) evaluated but not used|is not used" + int(0) // ERROR "int\(0\) evaluated but not used|is not used" string([]byte("abc")) // ERROR "string\(.*\) evaluated but not used|is not used" - append(x, 1) // ERROR "not used" - cap(x) // ERROR "not used" - complex(1, 2) // ERROR "not used" - complex(f, 1) // ERROR "not used" - imag(1i) // ERROR "not used" - imag(c) // ERROR "not used" - len(x) // ERROR "not used" - make([]int, 1) // ERROR "not used" - make(chan bool) // ERROR "not used" + append(x, 1) // ERROR "not used" + cap(x) // ERROR "not used" + complex(1, 2) // ERROR "not used" + complex(f, 1) // ERROR "not used" + imag(1i) // ERROR "not used" + imag(c) // ERROR "not used" + len(x) // ERROR "not used" + make([]int, 1) // ERROR "not used" + make(chan bool) // ERROR "not used" make(map[string]int) // ERROR "not used" - new(int) // ERROR "not used" - real(1i) // ERROR "not used" - real(c) // ERROR "not used" - append(x, 1) // ERROR "not used" - append(x, 1) // ERROR "not used" - unsafe.Alignof(t.X) // ERROR "not used" + new(int) // ERROR "not used" + real(1i) // ERROR "not used" + real(c) // ERROR "not used" + append(x, 1) // ERROR "not used" + append(x, 1) // ERROR "not used" + unsafe.Alignof(t.X) // ERROR "not used" unsafe.Offsetof(t.X) // ERROR "not used" - unsafe.Sizeof(t) // ERROR "not used" + unsafe.Sizeof(t) // ERROR "not used" } diff --git a/test/fixedbugs/issue4663.go b/test/fixedbugs/issue4663.go index 2533f0f269..971290d8dd 100644 --- a/test/fixedbugs/issue4663.go +++ b/test/fixedbugs/issue4663.go @@ -10,6 +10,6 @@ package main func a(b int) int64 { - b // ERROR "not used" - return 0 + b // ERROR "not used" + return 0 } diff --git a/test/fixedbugs/issue4748.go b/test/fixedbugs/issue4748.go index 7a9deca039..f7c77cf882 100644 --- a/test/fixedbugs/issue4748.go +++ b/test/fixedbugs/issue4748.go @@ -10,11 +10,11 @@ package main func jump() { - goto exit + goto exit exit: - return + return } func main() { - jump() - jump() + jump() + jump() } diff --git a/test/fixedbugs/issue4879.dir/a.go b/test/fixedbugs/issue4879.dir/a.go index 9bfb0c7d4f..7ee7c48604 100644 --- a/test/fixedbugs/issue4879.dir/a.go +++ b/test/fixedbugs/issue4879.dir/a.go @@ -30,3 +30,4 @@ func MakePrivateCollection3() *Collection { root: unsafe.Pointer(&maptype{}), } } + diff --git a/test/fixedbugs/issue4879.dir/b.go b/test/fixedbugs/issue4879.dir/b.go index 62dcb36e21..d8fb5693db 100644 --- a/test/fixedbugs/issue4879.dir/b.go +++ b/test/fixedbugs/issue4879.dir/b.go @@ -3,7 +3,7 @@ package b import "./a" func F() { - a.MakePrivateCollection() - a.MakePrivateCollection2() - a.MakePrivateCollection3() + a.MakePrivateCollection() + a.MakePrivateCollection2() + a.MakePrivateCollection3() } diff --git a/test/fixedbugs/issue5056.go b/test/fixedbugs/issue5056.go index d43bbbee1f..6fb444aa67 100644 --- a/test/fixedbugs/issue5056.go +++ b/test/fixedbugs/issue5056.go @@ -10,7 +10,7 @@ package main type Foo int16 -func (f Foo) Esc() *int { +func (f Foo) Esc() *int{ x := int(f) return &x } @@ -24,7 +24,7 @@ var bar, foobar *int func main() { var quux iface var x Foo - + quux = x bar = quux.Esc() foobar = quux.Esc() diff --git a/test/fixedbugs/issue5172.go b/test/fixedbugs/issue5172.go index 4a29dd1812..a6acbd3db7 100644 --- a/test/fixedbugs/issue5172.go +++ b/test/fixedbugs/issue5172.go @@ -14,6 +14,6 @@ type foo struct { func main() { var f foo - go f.bar() // GCCGO_ERROR "undefined" - defer f.bar() // GCCGO_ERROR "undefined" + go f.bar() // GCCGO_ERROR "undefined" + defer f.bar() // GCCGO_ERROR "undefined" } diff --git a/test/fixedbugs/issue5493.go b/test/fixedbugs/issue5493.go index ee7a0dc071..2ee0398af2 100644 --- a/test/fixedbugs/issue5493.go +++ b/test/fixedbugs/issue5493.go @@ -14,7 +14,6 @@ import ( ) const N = 10 - var count int64 func run() error { @@ -57,3 +56,4 @@ func main() { panic("not all finalizers are called") } } + diff --git a/test/fixedbugs/issue5515.go b/test/fixedbugs/issue5515.go index 2dab1eaab3..053abf6f7c 100644 --- a/test/fixedbugs/issue5515.go +++ b/test/fixedbugs/issue5515.go @@ -11,24 +11,24 @@ package main type T uint32 func main() { - b := make([]T, 8) - b[0] = 0xdeadbeef - rs := Slice(b) - sort(rs) + b := make([]T, 8) + b[0] = 0xdeadbeef + rs := Slice(b) + sort(rs) } type Slice []T func (s Slice) Swap(i, j int) { - tmp := s[i] - s[i] = s[j] - s[j] = tmp + tmp := s[i] + s[i] = s[j] + s[j] = tmp } type Interface interface { - Swap(i, j int) + Swap(i, j int) } func sort(data Interface) { - data.Swap(0, 4) + data.Swap(0, 4) } diff --git a/test/fixedbugs/issue5614.dir/x.go b/test/fixedbugs/issue5614.dir/x.go index 6cd0969db8..7e4f3a7e6b 100644 --- a/test/fixedbugs/issue5614.dir/x.go +++ b/test/fixedbugs/issue5614.dir/x.go @@ -3,3 +3,5 @@ package x import "./rethinkgo" var S *rethinkgo.Session + + diff --git a/test/fixedbugs/issue5753.go b/test/fixedbugs/issue5753.go index 597fd2f58c..230a1e8c3b 100644 --- a/test/fixedbugs/issue5753.go +++ b/test/fixedbugs/issue5753.go @@ -25,5 +25,5 @@ func main() { if s[0] != "foo" { panic(`s[0] != "foo"`) } - + } diff --git a/test/fixedbugs/issue5809.go b/test/fixedbugs/issue5809.go index e63515f678..fc8eeef82f 100644 --- a/test/fixedbugs/issue5809.go +++ b/test/fixedbugs/issue5809.go @@ -14,13 +14,13 @@ func main() { const d16 = "0123456789ABCDEF" k := 0x1234 var x [4]byte - + x[0] = d16[k>>12&0xf] x[1] = d16[k>>8&0xf] x[2] = d16[k>>4&0xf] x[3] = d16[k&0xf] - - if x != [4]byte{'1', '2', '3', '4'} { + + if x != [4]byte{'1','2','3','4'} { fmt.Println(x) panic("x != [4]byte{'1','2','3','4'}") } diff --git a/test/fixedbugs/issue5957.dir/b.go b/test/fixedbugs/issue5957.dir/b.go index 674bcbc006..9bc561b9ce 100644 --- a/test/fixedbugs/issue5957.dir/b.go +++ b/test/fixedbugs/issue5957.dir/b.go @@ -1 +1,2 @@ package surprise2 + diff --git a/test/fixedbugs/issue5957.dir/c.go b/test/fixedbugs/issue5957.dir/c.go index 28f6e84a59..d115eacdd5 100644 --- a/test/fixedbugs/issue5957.dir/c.go +++ b/test/fixedbugs/issue5957.dir/c.go @@ -1,12 +1,12 @@ package p import ( - "./a" // ERROR "imported and not used: \x22a\x22 as surprise|imported and not used: surprise" - "./b" // ERROR "imported and not used: \x22b\x22 as surprise2|imported and not used: surprise2" - b "./b" // ERROR "imported and not used: \x22b\x22$|imported and not used: surprise2" - "fmt" // actually used + "./a" // ERROR "imported and not used: \x22a\x22 as surprise|imported and not used: surprise" + "./b" // ERROR "imported and not used: \x22b\x22 as surprise2|imported and not used: surprise2" + b "./b" // ERROR "imported and not used: \x22b\x22$|imported and not used: surprise2" foo "math" // ERROR "imported and not used: \x22math\x22 as foo|imported and not used: math" - "strings" // ERROR "imported and not used: \x22strings\x22|imported and not used: strings" + "fmt" // actually used + "strings" // ERROR "imported and not used: \x22strings\x22|imported and not used: strings" ) var _ = fmt.Printf diff --git a/test/fixedbugs/issue6004.go b/test/fixedbugs/issue6004.go index 4a4a43cf94..2b3dcd923d 100644 --- a/test/fixedbugs/issue6004.go +++ b/test/fixedbugs/issue6004.go @@ -7,8 +7,9 @@ package main func main() { - _ = nil // ERROR "use of untyped nil" - _, _ = nil, 1 // ERROR "use of untyped nil" - _, _ = 1, nil // ERROR "use of untyped nil" + _ = nil // ERROR "use of untyped nil" + _, _ = nil, 1 // ERROR "use of untyped nil" + _, _ = 1, nil // ERROR "use of untyped nil" _ = append(nil, 1, 2, 3) // ERROR "untyped nil" } + diff --git a/test/fixedbugs/issue6406.go b/test/fixedbugs/issue6406.go index 429aa7f5f3..5491193ef3 100644 --- a/test/fixedbugs/issue6406.go +++ b/test/fixedbugs/issue6406.go @@ -8,5 +8,5 @@ package main func main() { s = "bob" // ERROR "undefined.*s" - _ = s // ERROR "undefined.*s" + _ = s // ERROR "undefined.*s" } diff --git a/test/fixedbugs/issue6703g.go b/test/fixedbugs/issue6703g.go index 1762d0bc42..05ec7405f3 100644 --- a/test/fixedbugs/issue6703g.go +++ b/test/fixedbugs/issue6703g.go @@ -17,4 +17,4 @@ func (T) m() int { type E struct{ T } -var x = E.m // ERROR "initialization loop|depends upon itself" +var x = E.m // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703h.go b/test/fixedbugs/issue6703h.go index af0cdfbbdd..f6b69e1b70 100644 --- a/test/fixedbugs/issue6703h.go +++ b/test/fixedbugs/issue6703h.go @@ -17,4 +17,4 @@ func (T) m() int { type E struct{ T } -var x = E.m(E{0}) // ERROR "initialization loop|depends upon itself" +var x = E.m(E{0}) // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703i.go b/test/fixedbugs/issue6703i.go index c412268d7e..fb580a2461 100644 --- a/test/fixedbugs/issue6703i.go +++ b/test/fixedbugs/issue6703i.go @@ -17,4 +17,4 @@ func (T) m() int { type E struct{ T } -var x = E{}.m // ERROR "initialization loop|depends upon itself" +var x = E{}.m // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703o.go b/test/fixedbugs/issue6703o.go index e87e5ecec4..a11fdfd858 100644 --- a/test/fixedbugs/issue6703o.go +++ b/test/fixedbugs/issue6703o.go @@ -19,5 +19,5 @@ type E struct{ T } var ( e E - x = e.m // ERROR "initialization loop|depends upon itself" + x = e.m // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703p.go b/test/fixedbugs/issue6703p.go index 79c6a5f41c..3ac7a63de8 100644 --- a/test/fixedbugs/issue6703p.go +++ b/test/fixedbugs/issue6703p.go @@ -19,5 +19,5 @@ type E struct{ T } var ( e E - x = e.m() // ERROR "initialization loop|depends upon itself" + x = e.m() // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703q.go b/test/fixedbugs/issue6703q.go index 743a6ae3df..b087c15d37 100644 --- a/test/fixedbugs/issue6703q.go +++ b/test/fixedbugs/issue6703q.go @@ -24,5 +24,5 @@ type E struct{ T } var ( e E - x = g().m // ERROR "initialization loop|depends upon itself" + x = g().m // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703r.go b/test/fixedbugs/issue6703r.go index a22f9a2122..de514f1802 100644 --- a/test/fixedbugs/issue6703r.go +++ b/test/fixedbugs/issue6703r.go @@ -24,5 +24,5 @@ type E struct{ T } var ( e E - x = g().m() // ERROR "initialization loop|depends upon itself" + x = g().m() // ERROR "initialization loop|depends upon itself" ) diff --git a/test/fixedbugs/issue6703y.go b/test/fixedbugs/issue6703y.go index f679933f8e..278dfcdb5e 100644 --- a/test/fixedbugs/issue6703y.go +++ b/test/fixedbugs/issue6703y.go @@ -20,4 +20,4 @@ func pf() *T { return nil } -var x = pf().pm // ERROR "initialization loop|depends upon itself" +var x = pf().pm // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6703z.go b/test/fixedbugs/issue6703z.go index 658d05a2af..f81a3a8c34 100644 --- a/test/fixedbugs/issue6703z.go +++ b/test/fixedbugs/issue6703z.go @@ -20,4 +20,4 @@ func pf() *T { return nil } -var x = pf().pm() // ERROR "initialization loop|depends upon itself" +var x = pf().pm() // ERROR "initialization loop|depends upon itself" diff --git a/test/fixedbugs/issue6789.dir/a.go b/test/fixedbugs/issue6789.dir/a.go index 9e076fec71..9c90e0740c 100644 --- a/test/fixedbugs/issue6789.dir/a.go +++ b/test/fixedbugs/issue6789.dir/a.go @@ -5,10 +5,10 @@ package a type unexported struct { - a int - b bool + a int + b bool } type Struct struct { - unexported + unexported } diff --git a/test/fixedbugs/issue6847.go b/test/fixedbugs/issue6847.go index 58ebb636f4..da300bcd01 100644 --- a/test/fixedbugs/issue6847.go +++ b/test/fixedbugs/issue6847.go @@ -56,7 +56,7 @@ func F() { case cs, ok = <-cc: case c = <-cc: } - // Interfaces. + // Interfaces. var ( c1 chan I1 c2 chan I2 diff --git a/test/fixedbugs/issue7223.go b/test/fixedbugs/issue7223.go index e03d6f703d..0ec3476403 100644 --- a/test/fixedbugs/issue7223.go +++ b/test/fixedbugs/issue7223.go @@ -7,15 +7,14 @@ package main var bits1 uint = 10 - const bits2 uint = 10 func main() { _ = make([]byte, 1<> 1) - a := make([]struct{}, length) - b := make([]struct{}, length) - _ = append(a, b...) + length := int(^uint(0) >> 1) + a := make([]struct{}, length) + b := make([]struct{}, length) + _ = append(a, b...) } func main() { diff --git a/test/fixedbugs/issue7590.go b/test/fixedbugs/issue7590.go index e67e393dfb..607a3ae606 100644 --- a/test/fixedbugs/issue7590.go +++ b/test/fixedbugs/issue7590.go @@ -13,7 +13,7 @@ type S struct { } var M = map[string]S{ - "a": {F: 1}, + "a": { F: 1 }, } var P = M["a"] diff --git a/test/fixedbugs/issue7648.dir/a.go b/test/fixedbugs/issue7648.dir/a.go index 9139dc279f..c76aaa675f 100644 --- a/test/fixedbugs/issue7648.dir/a.go +++ b/test/fixedbugs/issue7648.dir/a.go @@ -6,5 +6,6 @@ package a const ( sinPi4 = 0.70710678118654752440084436210484903928483593768847 - A = complex(sinPi4, -sinPi4) + A = complex(sinPi4, -sinPi4) ) + diff --git a/test/fixedbugs/issue7760.go b/test/fixedbugs/issue7760.go index cf99ac1cc9..cccae48910 100644 --- a/test/fixedbugs/issue7760.go +++ b/test/fixedbugs/issue7760.go @@ -13,13 +13,13 @@ import "unsafe" type myPointer unsafe.Pointer const _ = unsafe.Pointer(uintptr(1)) // ERROR "is not (a )?constant" -const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant" +const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant" const _ = (*int)(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant" -const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant" +const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant" const _ = uintptr(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant" -const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant" +const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant" const _ = []byte("") // ERROR "is not (a )?constant" const _ = []rune("") // ERROR "is not (a )?constant" diff --git a/test/fixedbugs/issue7921.go b/test/fixedbugs/issue7921.go index 2eb6d4ecd0..e19b113062 100644 --- a/test/fixedbugs/issue7921.go +++ b/test/fixedbugs/issue7921.go @@ -41,7 +41,7 @@ func bufferNoEscape3(xs []string) string { // ERROR "bufferNoEscape3 xs does not func bufferNoEscape4() []byte { var b bytes.Buffer - b.Grow(64) // ERROR "bufferNoEscape4 ignoring self-assignment in bytes.b.buf = bytes.b.buf\[:bytes.m·3\]$" "inlining call to bytes.\(\*Buffer\).Grow$" + b.Grow(64) // ERROR "bufferNoEscape4 ignoring self-assignment in bytes.b.buf = bytes.b.buf\[:bytes.m·3\]$" "inlining call to bytes.\(\*Buffer\).Grow$" useBuffer(&b) return b.Bytes() // ERROR "inlining call to bytes.\(\*Buffer\).Bytes$" } diff --git a/test/fixedbugs/issue8155.go b/test/fixedbugs/issue8155.go index 5450d04bc8..56a6738920 100644 --- a/test/fixedbugs/issue8155.go +++ b/test/fixedbugs/issue8155.go @@ -36,7 +36,7 @@ func poison() uintptr { var x [20]uintptr var s uintptr for i := range x { - x[i] = uintptr(i + 1) + x[i] = uintptr(i+1) s += x[i] } return s diff --git a/test/fixedbugs/issue8961.go b/test/fixedbugs/issue8961.go index 144bbb2cf7..22b0f0410a 100644 --- a/test/fixedbugs/issue8961.go +++ b/test/fixedbugs/issue8961.go @@ -7,8 +7,7 @@ // Issue 8961. Empty composite literals to small globals were not filled in package main -type small struct{ a int } - +type small struct { a int } var foo small func main() { diff --git a/test/fixedbugs/issue9076.go b/test/fixedbugs/issue9076.go index dd2a474148..8daf12fee8 100644 --- a/test/fixedbugs/issue9076.go +++ b/test/fixedbugs/issue9076.go @@ -11,6 +11,5 @@ package main import "unsafe" const Hundred = 100 - -var _ int32 = 100/unsafe.Sizeof(int(0)) + 1 // GC_ERROR "100 \/ unsafe.Sizeof\(int\(0\)\) \+ 1" +var _ int32 = 100/unsafe.Sizeof(int(0)) + 1 // GC_ERROR "100 \/ unsafe.Sizeof\(int\(0\)\) \+ 1" var _ int32 = Hundred/unsafe.Sizeof(int(0)) + 1 // GC_ERROR "Hundred \/ unsafe.Sizeof\(int\(0\)\) \+ 1" diff --git a/test/fixedbugs/issue9083.go b/test/fixedbugs/issue9083.go index ea53e7a69a..8fbd78be7a 100644 --- a/test/fixedbugs/issue9083.go +++ b/test/fixedbugs/issue9083.go @@ -13,10 +13,10 @@ const zero = 0 func main() { var x int - x = make(map[int]int) // ERROR "cannot use make\(map\[int\]int\)|incompatible" - x = make(map[int]int, 0) // ERROR "cannot use make\(map\[int\]int, 0\)|incompatible" + x = make(map[int]int) // ERROR "cannot use make\(map\[int\]int\)|incompatible" + x = make(map[int]int, 0) // ERROR "cannot use make\(map\[int\]int, 0\)|incompatible" x = make(map[int]int, zero) // ERROR "cannot use make\(map\[int\]int, zero\)|incompatible" - x = make(chan int) // ERROR "cannot use make\(chan int\)|incompatible" - x = make(chan int, 0) // ERROR "cannot use make\(chan int, 0\)|incompatible" - x = make(chan int, zero) // ERROR "cannot use make\(chan int, zero\)|incompatible" + x = make(chan int) // ERROR "cannot use make\(chan int\)|incompatible" + x = make(chan int, 0) // ERROR "cannot use make\(chan int, 0\)|incompatible" + x = make(chan int, zero) // ERROR "cannot use make\(chan int, zero\)|incompatible" } diff --git a/test/fixedbugs/issue9537.dir/b.go b/test/fixedbugs/issue9537.dir/b.go index c8dce22c14..52e64c81f1 100644 --- a/test/fixedbugs/issue9537.dir/b.go +++ b/test/fixedbugs/issue9537.dir/b.go @@ -15,8 +15,8 @@ type X struct { } type Intf interface { - Get() []byte - RetPtr(int) *int + Get() []byte + RetPtr(int) *int RetRPtr(int) (int, *int) } diff --git a/test/fixedbugs/issue9634.go b/test/fixedbugs/issue9634.go index cc3e7484eb..2d5aae4a30 100644 --- a/test/fixedbugs/issue9634.go +++ b/test/fixedbugs/issue9634.go @@ -10,7 +10,7 @@ package main func main() { - s := struct { + s := struct{ t []int u int }{} diff --git a/test/float_lit.go b/test/float_lit.go index f78c933f99..4efae2362d 100644 --- a/test/float_lit.go +++ b/test/float_lit.go @@ -77,8 +77,8 @@ func main() { print("-210.012 is ", -210.012, "\n") } - if !close(0e+1, 0, 1, 0) { - print("0E+1 is ", 0e+1, "\n") + if !close(0E+1, 0, 1, 0) { + print("0E+1 is ", 0E+1, "\n") } if !close(+10e2, 10, 1, 2) { print("+10e2 is ", +10e2, "\n") @@ -87,8 +87,8 @@ func main() { print("-210e3 is ", -210e3, "\n") } - if !close(0e-1, 0, 1, 0) { - print("0E-1 is ", 0e-1, "\n") + if !close(0E-1, 0, 1, 0) { + print("0E-1 is ", 0E-1, "\n") } if !close(+0e23, 0, 1, 1) { print("+0e23 is ", +0e23, "\n") @@ -97,8 +97,8 @@ func main() { print("-0e345 is ", -0e345, "\n") } - if !close(0e1, 0, 1, 1) { - print("0E1 is ", 0e1, "\n") + if !close(0E1, 0, 1, 1) { + print("0E1 is ", 0E1, "\n") } if !close(+10e23, 10, 1, 23) { print("+10e23 is ", +10e23, "\n") @@ -107,8 +107,8 @@ func main() { print("-210e34 is ", -210e34, "\n") } - if !close(0.e1, 0, 1, 1) { - print("0.E1 is ", 0.e1, "\n") + if !close(0.E1, 0, 1, 1) { + print("0.E1 is ", 0.E1, "\n") } if !close(+10.e+2, 10, 1, 2) { print("+10.e+2 is ", +10.e+2, "\n") @@ -117,8 +117,8 @@ func main() { print("-210.e-3 is ", -210.e-3, "\n") } - if !close(.0e1, 0, 1, 1) { - print(".0E1 is ", .0e1, "\n") + if !close(.0E1, 0, 1, 1) { + print(".0E1 is ", .0E1, "\n") } if !close(+.01e2, 1, 100, 2) { print("+.01e2 is ", +.01e2, "\n") @@ -127,8 +127,8 @@ func main() { print("-.012e3 is ", -.012e3, "\n") } - if !close(0.0e1, 0, 1, 0) { - print("0.0E1 is ", 0.0e1, "\n") + if !close(0.0E1, 0, 1, 0) { + print("0.0E1 is ", 0.0E1, "\n") } if !close(+10.01e2, 1001, 100, 2) { print("+10.01e2 is ", +10.01e2, "\n") @@ -137,8 +137,8 @@ func main() { print("-210.012e3 is ", -210.012e3, "\n") } - if !close(0.e+12, 0, 1, 0) { - print("0.E+12 is ", 0.e+12, "\n") + if !close(0.E+12, 0, 1, 0) { + print("0.E+12 is ", 0.E+12, "\n") } if !close(+10.e23, 10, 1, 23) { print("+10.e23 is ", +10.e23, "\n") @@ -147,8 +147,8 @@ func main() { print("-210.e33 is ", -210.e33, "\n") } - if !close(.0e-12, 0, 1, 0) { - print(".0E-12 is ", .0e-12, "\n") + if !close(.0E-12, 0, 1, 0) { + print(".0E-12 is ", .0E-12, "\n") } if !close(+.01e23, 1, 100, 23) { print("+.01e23 is ", +.01e23, "\n") @@ -157,8 +157,8 @@ func main() { print("-.012e34 is ", -.012e34, "\n") } - if !close(0.0e12, 0, 1, 12) { - print("0.0E12 is ", 0.0e12, "\n") + if !close(0.0E12, 0, 1, 12) { + print("0.0E12 is ", 0.0E12, "\n") } if !close(+10.01e23, 1001, 100, 23) { print("+10.01e23 is ", +10.01e23, "\n") @@ -167,8 +167,8 @@ func main() { print("-210.012e33 is ", -210.012e33, "\n") } - if !close(0.e123, 0, 1, 123) { - print("0.E123 is ", 0.e123, "\n") + if !close(0.E123, 0, 1, 123) { + print("0.E123 is ", 0.E123, "\n") } if !close(+10.e+23, 10, 1, 23) { print("+10.e+234 is ", +10.e+234, "\n") @@ -177,8 +177,8 @@ func main() { print("-210.e-35 is ", -210.e-35, "\n") } - if !close(.0e123, 0, 1, 123) { - print(".0E123 is ", .0e123, "\n") + if !close(.0E123, 0, 1, 123) { + print(".0E123 is ", .0E123, "\n") } if !close(+.01e29, 1, 100, 29) { print("+.01e29 is ", +.01e29, "\n") @@ -187,8 +187,8 @@ func main() { print("-.012e29 is ", -.012e29, "\n") } - if !close(0.0e123, 0, 1, 123) { - print("0.0E123 is ", 0.0e123, "\n") + if !close(0.0E123, 0, 1, 123) { + print("0.0E123 is ", 0.0E123, "\n") } if !close(+10.01e31, 1001, 100, 31) { print("+10.01e31 is ", +10.01e31, "\n") diff --git a/test/for.go b/test/for.go index 14d516bf71..8a50090657 100644 --- a/test/for.go +++ b/test/for.go @@ -44,11 +44,11 @@ func main() { for sum < 100 { sum = sum + 9 } - assertequal(sum, 99+9, "only one") + assertequal(sum, 99 + 9, "only one") sum = 0 for i := 0; i <= 10; i++ { - if i%2 == 0 { + if i % 2 == 0 { continue } sum = sum + i diff --git a/test/func.go b/test/func.go index 9a31b4f300..246cb56fd9 100644 --- a/test/func.go +++ b/test/func.go @@ -41,6 +41,7 @@ func f7(a int) (x int, y float32) { return 7, 7.0 } + func f8(a int) (x int, y float32) { return 8, 8.0 } @@ -53,12 +54,14 @@ func (t *T) m10(a int, b float32) int { return (t.x + a) * (t.y + int(b)) } + func f9(a int) (i int, f float32) { i = 9 f = 9.0 return } + func main() { f1() f2(1) diff --git a/test/func1.go b/test/func1.go index 8ab4b70989..fb6f56184f 100644 --- a/test/func1.go +++ b/test/func1.go @@ -13,6 +13,7 @@ func f1(a int) (int, float32) { return 7, 7.0 } + func f2(a int) (a int, b float32) { // ERROR "duplicate argument a|definition" return 8, 8.0 } diff --git a/test/func4.go b/test/func4.go index 53e69cf0a9..85f1e4b81e 100644 --- a/test/func4.go +++ b/test/func4.go @@ -12,7 +12,7 @@ package main var notmain func() func main() { - var x = &main // ERROR "address of|invalid" - main = notmain // ERROR "assign to|invalid" + var x = &main // ERROR "address of|invalid" + main = notmain // ERROR "assign to|invalid" _ = x } diff --git a/test/func5.go b/test/func5.go index 367b683e30..2e058be7e6 100644 --- a/test/func5.go +++ b/test/func5.go @@ -39,7 +39,7 @@ func fn() func(int, int) int { var fc func(int, int, chan int) func addc(x, y int, c chan int) { - c <- x + y + c <- x+y } func fnc() func(int, int, chan int) { @@ -79,7 +79,7 @@ func main() { three(<-c) go fnc()(1, 2, c) three(<-c) - go func(a, b int, c chan int) { c <- a + b }(1, 2, c) + go func(a, b int, c chan int) { c <- a+b }(1, 2, c) three(<-c) emptyresults() diff --git a/test/func6.go b/test/func6.go index 9b2a10846a..5b2f9f273e 100644 --- a/test/func6.go +++ b/test/func6.go @@ -9,10 +9,8 @@ package main func main() { - if func() bool { return true }() { - } // gc used to say this was a syntax error - if (func() bool { return true })() { - } - if func() bool { return true }() { - } + if func() bool { return true }() {} // gc used to say this was a syntax error + if (func() bool { return true })() {} + if (func() bool { return true }()) {} } + diff --git a/test/funcdup.go b/test/funcdup.go index 468f255b86..7b05d12606 100644 --- a/test/funcdup.go +++ b/test/funcdup.go @@ -8,20 +8,20 @@ package p type T interface { F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" - F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" - F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" + F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" + F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" } -type T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" +type T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" type T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" -type T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" +type T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" type R struct{} -func (i *R) F1(i int) {} // ERROR "duplicate argument i|redefinition|previous" -func (i *R) F2() (i int) { return 0 } // ERROR "duplicate argument i|redefinition|previous" -func (i *R) F3(j int) (j int) { return 0 } // ERROR "duplicate argument j|redefinition|previous" +func (i *R) F1(i int) {} // ERROR "duplicate argument i|redefinition|previous" +func (i *R) F2() (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous" +func (i *R) F3(j int) (j int) {return 0} // ERROR "duplicate argument j|redefinition|previous" -func F1(i, i int) {} // ERROR "duplicate argument i|redefinition|previous" -func F2(i int) (i int) { return 0 } // ERROR "duplicate argument i|redefinition|previous" -func F3() (i, i int) { return 0, 0 } // ERROR "duplicate argument i|redefinition|previous" +func F1(i, i int) {} // ERROR "duplicate argument i|redefinition|previous" +func F2(i int) (i int) {return 0} // ERROR "duplicate argument i|redefinition|previous" +func F3() (i, i int) {return 0, 0} // ERROR "duplicate argument i|redefinition|previous" diff --git a/test/funcdup2.go b/test/funcdup2.go index fde2c9604f..9513ef46bd 100644 --- a/test/funcdup2.go +++ b/test/funcdup2.go @@ -8,10 +8,10 @@ package p var T interface { F1(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" - F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" - F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" + F2(i, i int) // ERROR "duplicate argument i|redefinition|previous" + F3() (i, i int) // ERROR "duplicate argument i|redefinition|previous" } -var T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" +var T1 func(i, i int) // ERROR "duplicate argument i|redefinition|previous" var T2 func(i int) (i int) // ERROR "duplicate argument i|redefinition|previous" -var T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" +var T3 func() (i, i int) // ERROR "duplicate argument i|redefinition|previous" diff --git a/test/gcstring.go b/test/gcstring.go index 4b2499a604..7633d5da55 100644 --- a/test/gcstring.go +++ b/test/gcstring.go @@ -25,16 +25,16 @@ func main() { setup() runtime.GC() runtime.GC() - time.Sleep(10 * time.Millisecond) + time.Sleep(10*time.Millisecond) runtime.GC() runtime.GC() - time.Sleep(10 * time.Millisecond) + time.Sleep(10*time.Millisecond) } func setup() { var Ts []interface{} buf := make([]byte, 128) - + for i := 0; i < 10000; i++ { s := string(buf) t := &T{ptr: new(*int)} @@ -42,6 +42,7 @@ func setup() { Ts = append(Ts, t) things = append(things, s[len(s):]) } - + things = append(things, Ts...) } + diff --git a/test/goprint.go b/test/goprint.go index 84dc28e51c..57eeac53a8 100644 --- a/test/goprint.go +++ b/test/goprint.go @@ -16,6 +16,6 @@ import ( func main() { go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255)) for runtime.NumGoroutine() > 1 { - time.Sleep(10 * time.Millisecond) + time.Sleep(10*time.Millisecond) } } diff --git a/test/import1.go b/test/import1.go index 19e766fd6f..2433b5f2ad 100644 --- a/test/import1.go +++ b/test/import1.go @@ -9,11 +9,11 @@ package main -import "bufio" // GCCGO_ERROR "previous|not used" -import bufio "os" // ERROR "redeclared|redefinition|incompatible" "imported and not used" +import "bufio" // GCCGO_ERROR "previous|not used" +import bufio "os" // ERROR "redeclared|redefinition|incompatible" "imported and not used" import ( - "fmt" // GCCGO_ERROR "previous|not used" - . "math" // GC_ERROR "imported and not used: \x22math\x22$" - fmt "math" // ERROR "redeclared|redefinition|incompatible" "imported and not used: \x22math\x22 as fmt" + "fmt" // GCCGO_ERROR "previous|not used" + fmt "math" // ERROR "redeclared|redefinition|incompatible" "imported and not used: \x22math\x22 as fmt" + . "math" // GC_ERROR "imported and not used: \x22math\x22$" ) diff --git a/test/import2.dir/import2.go b/test/import2.dir/import2.go index aaaa7336e1..9c54a1b87e 100644 --- a/test/import2.dir/import2.go +++ b/test/import2.dir/import2.go @@ -6,38 +6,37 @@ package p -var C1 chan<- chan int = (chan<- (chan int))(nil) -var C2 chan (<-chan int) = (chan (<-chan int))(nil) -var C3 <-chan chan int = (<-chan (chan int))(nil) -var C4 chan chan<- int = (chan (chan<- int))(nil) - -var C5 <-chan <-chan int = (<-chan (<-chan int))(nil) -var C6 chan<- <-chan int = (chan<- (<-chan int))(nil) -var C7 chan<- chan<- int = (chan<- (chan<- int))(nil) - -var C8 <-chan <-chan chan int = (<-chan (<-chan (chan int)))(nil) -var C9 <-chan chan<- chan int = (<-chan (chan<- (chan int)))(nil) -var C10 chan<- <-chan chan int = (chan<- (<-chan (chan int)))(nil) -var C11 chan<- chan<- chan int = (chan<- (chan<- (chan int)))(nil) -var C12 chan chan<- <-chan int = (chan (chan<- (<-chan int)))(nil) -var C13 chan chan<- chan<- int = (chan (chan<- (chan<- int)))(nil) - -var R1 chan<- (chan int) = (chan<- chan int)(nil) -var R3 <-chan (chan int) = (<-chan chan int)(nil) -var R4 chan (chan<- int) = (chan chan<- int)(nil) - -var R5 <-chan (<-chan int) = (<-chan <-chan int)(nil) -var R6 chan<- (<-chan int) = (chan<- <-chan int)(nil) -var R7 chan<- (chan<- int) = (chan<- chan<- int)(nil) - -var R8 <-chan (<-chan (chan int)) = (<-chan <-chan chan int)(nil) -var R9 <-chan (chan<- (chan int)) = (<-chan chan<- chan int)(nil) -var R10 chan<- (<-chan (chan int)) = (chan<- <-chan chan int)(nil) -var R11 chan<- (chan<- (chan int)) = (chan<- chan<- chan int)(nil) -var R12 chan (chan<- (<-chan int)) = (chan chan<- <-chan int)(nil) -var R13 chan (chan<- (chan<- int)) = (chan chan<- chan<- int)(nil) +var C1 chan <- chan int = (chan<- (chan int))(nil) +var C2 chan (<- chan int) = (chan (<-chan int))(nil) +var C3 <- chan chan int = (<-chan (chan int))(nil) +var C4 chan chan <- int = (chan (chan<- int))(nil) + +var C5 <- chan <- chan int = (<-chan (<-chan int))(nil) +var C6 chan <- <- chan int = (chan<- (<-chan int))(nil) +var C7 chan <- chan <- int = (chan<- (chan<- int))(nil) + +var C8 <- chan <- chan chan int = (<-chan (<-chan (chan int)))(nil) +var C9 <- chan chan <- chan int = (<-chan (chan<- (chan int)))(nil) +var C10 chan <- <- chan chan int = (chan<- (<-chan (chan int)))(nil) +var C11 chan <- chan <- chan int = (chan<- (chan<- (chan int)))(nil) +var C12 chan chan <- <- chan int = (chan (chan<- (<-chan int)))(nil) +var C13 chan chan <- chan <- int = (chan (chan<- (chan<- int)))(nil) + +var R1 chan<- (chan int) = (chan <- chan int)(nil) +var R3 <-chan (chan int) = (<- chan chan int)(nil) +var R4 chan (chan<- int) = (chan chan <- int)(nil) + +var R5 <-chan (<-chan int) = (<- chan <- chan int)(nil) +var R6 chan<- (<-chan int) = (chan <- <- chan int)(nil) +var R7 chan<- (chan<- int) = (chan <- chan <- int)(nil) + +var R8 <-chan (<-chan (chan int)) = (<- chan <- chan chan int)(nil) +var R9 <-chan (chan<- (chan int)) = (<- chan chan <- chan int)(nil) +var R10 chan<- (<-chan (chan int)) = (chan <- <- chan chan int)(nil) +var R11 chan<- (chan<- (chan int)) = (chan <- chan <- chan int)(nil) +var R12 chan (chan<- (<-chan int)) = (chan chan <- <- chan int)(nil) +var R13 chan (chan<- (chan<- int)) = (chan chan <- chan <- int)(nil) var F1 func() func() int - func F2() func() func() int func F3(func() func() int) diff --git a/test/import2.dir/import3.go b/test/import2.dir/import3.go index 461251d489..3bf9cb0c3c 100644 --- a/test/import2.dir/import3.go +++ b/test/import2.dir/import3.go @@ -33,19 +33,20 @@ func main() { p.C12 = (chan (chan<- (<-chan int)))(nil) p.C13 = (chan (chan<- (chan<- int)))(nil) - p.R1 = (chan<- chan int)(nil) - p.R3 = (<-chan chan int)(nil) - p.R4 = (chan chan<- int)(nil) + p.R1 = (chan <- chan int)(nil) + p.R3 = (<- chan chan int)(nil) + p.R4 = (chan chan <- int)(nil) - p.R5 = (<-chan <-chan int)(nil) - p.R6 = (chan<- <-chan int)(nil) - p.R7 = (chan<- chan<- int)(nil) + p.R5 = (<- chan <- chan int)(nil) + p.R6 = (chan <- <- chan int)(nil) + p.R7 = (chan <- chan <- int)(nil) - p.R8 = (<-chan <-chan chan int)(nil) - p.R9 = (<-chan chan<- chan int)(nil) - p.R10 = (chan<- <-chan chan int)(nil) - p.R11 = (chan<- chan<- chan int)(nil) - p.R12 = (chan chan<- <-chan int)(nil) - p.R13 = (chan chan<- chan<- int)(nil) + p.R8 = (<- chan <- chan chan int)(nil) + p.R9 = (<- chan chan <- chan int)(nil) + p.R10 = (chan <- <- chan chan int)(nil) + p.R11 = (chan <- chan <- chan int)(nil) + p.R12 = (chan chan <- <- chan int)(nil) + p.R13 = (chan chan <- chan <- int)(nil) } + diff --git a/test/import4.dir/empty.go b/test/import4.dir/empty.go index 398c260d0f..1dffa170df 100644 --- a/test/import4.dir/empty.go +++ b/test/import4.dir/empty.go @@ -4,10 +4,7 @@ package empty -import () - -const () - -var () - -type () +import ( ) +const ( ) +var ( ) +type ( ) diff --git a/test/import4.dir/import4.go b/test/import4.dir/import4.go index f174b70be4..b9f973f172 100644 --- a/test/import4.dir/import4.go +++ b/test/import4.dir/import4.go @@ -9,15 +9,16 @@ package main // standard -import "fmt" // ERROR "imported and not used.*fmt" +import "fmt" // ERROR "imported and not used.*fmt" // renamed -import X "math" // ERROR "imported and not used.*math" +import X "math" // ERROR "imported and not used.*math" // import dot -import . "bufio" // ERROR "imported and not used.*bufio" +import . "bufio" // ERROR "imported and not used.*bufio" // again, package without anything in it -import "./empty" // ERROR "imported and not used.*empty" -import Z "./empty" // ERROR "imported and not used.*empty" -import . "./empty" // ERROR "imported and not used.*empty" +import "./empty" // ERROR "imported and not used.*empty" +import Z "./empty" // ERROR "imported and not used.*empty" +import . "./empty" // ERROR "imported and not used.*empty" + diff --git a/test/indirect1.go b/test/indirect1.go index 1395eacaf8..51da4cc7c4 100644 --- a/test/indirect1.go +++ b/test/indirect1.go @@ -37,36 +37,36 @@ func f() { // line number for each len call when // it decides there are type errors. x := - len(m0) + - len(m1) + // ERROR "illegal|invalid|must be" - len(m2) + // ERROR "illegal|invalid|must be" - len(m3) + - len(m4) + // ERROR "illegal|invalid|must be" + len(m0)+ + len(m1)+ // ERROR "illegal|invalid|must be" + len(m2)+ // ERROR "illegal|invalid|must be" + len(m3)+ + len(m4)+ // ERROR "illegal|invalid|must be" - len(s0) + - len(s1) + // ERROR "illegal|invalid|must be" - len(s2) + // ERROR "illegal|invalid|must be" - len(s3) + - len(s4) + // ERROR "illegal|invalid|must be" + len(s0)+ + len(s1)+ // ERROR "illegal|invalid|must be" + len(s2)+ // ERROR "illegal|invalid|must be" + len(s3)+ + len(s4)+ // ERROR "illegal|invalid|must be" - len(a0) + - len(a1) + - len(a2) + + len(a0)+ + len(a1)+ + len(a2)+ - cap(a0) + - cap(a1) + - cap(a2) + + cap(a0)+ + cap(a1)+ + cap(a2)+ - len(b0) + - len(b1) + // ERROR "illegal|invalid|must be" - len(b2) + // ERROR "illegal|invalid|must be" - len(b3) + - len(b4) + // ERROR "illegal|invalid|must be" + len(b0)+ + len(b1)+ // ERROR "illegal|invalid|must be" + len(b2)+ // ERROR "illegal|invalid|must be" + len(b3)+ + len(b4)+ // ERROR "illegal|invalid|must be" - cap(b0) + - cap(b1) + // ERROR "illegal|invalid|must be" - cap(b2) + // ERROR "illegal|invalid|must be" - cap(b3) + - cap(b4) // ERROR "illegal|invalid|must be" + cap(b0)+ + cap(b1)+ // ERROR "illegal|invalid|must be" + cap(b2)+ // ERROR "illegal|invalid|must be" + cap(b3)+ + cap(b4) // ERROR "illegal|invalid|must be" _ = x } diff --git a/test/initcomma.go b/test/initcomma.go index e6cfffda3a..a54fce4280 100644 --- a/test/initcomma.go +++ b/test/initcomma.go @@ -8,10 +8,10 @@ package main -var a = []int{1, 2} -var b = [5]int{1, 2, 3} -var c = []int{1} -var d = [...]int{1, 2, 3} +var a = []int{1, 2, } +var b = [5]int{1, 2, 3, } +var c = []int{1, } +var d = [...]int{1, 2, 3, } func main() { if len(a) != 2 { diff --git a/test/initialize.go b/test/initialize.go index 0cf7fe2f5c..1307e02096 100644 --- a/test/initialize.go +++ b/test/initialize.go @@ -19,35 +19,35 @@ type T struct { S } -var a1 = S{0, 0, 0, 1, 2, 3} -var b1 = S{X: 1, Z: 3, Y: 2} +var a1 = S { 0, 0, 0, 1, 2, 3 } +var b1 = S { X: 1, Z: 3, Y: 2 } -var a2 = S{0, 0, 0, 0, 0, 0} -var b2 = S{} +var a2 = S { 0, 0, 0, 0, 0, 0, } +var b2 = S { } -var a3 = T{S{1, 2, 3, 0, 0, 0}} -var b3 = T{S: S{A: 1, B: 2, C: 3}} +var a3 = T { S { 1, 2, 3, 0, 0, 0, } } +var b3 = T { S: S{ A: 1, B: 2, C: 3 } } -var a4 = &[16]byte{0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0} -var b4 = &[16]byte{4: 1, 1, 1, 1, 12: 1, 1} +var a4 = &[16]byte { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, } +var b4 = &[16]byte { 4: 1, 1, 1, 1, 12: 1, 1, } -var a5 = &[16]byte{1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0} -var b5 = &[16]byte{1, 4: 1, 1, 1, 1, 12: 1, 1} +var a5 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, } +var b5 = &[16]byte { 1, 4: 1, 1, 1, 1, 12: 1, 1, } -var a6 = &[16]byte{1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0} -var b6 = &[...]byte{1, 4: 1, 1, 1, 1, 12: 1, 1, 0, 0} +var a6 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, } +var b6 = &[...]byte { 1, 4: 1, 1, 1, 1, 12: 1, 1, 0, 0,} type Same struct { a, b interface{} } -var same = []Same{ - Same{a1, b1}, - Same{a2, b2}, - Same{a3, b3}, - Same{a4, b4}, - Same{a5, b5}, - Same{a6, b6}, +var same = []Same { + Same{ a1, b1 }, + Same{ a2, b2 }, + Same{ a3, b3 }, + Same{ a4, b4 }, + Same{ a5, b5 }, + Same{ a6, b6 }, } func main() { diff --git a/test/initializerr.go b/test/initializerr.go index 11f1941629..990ab60f96 100644 --- a/test/initializerr.go +++ b/test/initializerr.go @@ -18,24 +18,24 @@ type T struct { } var x = 1 -var a1 = S{0, X: 1} // ERROR "mixture|undefined" -var a2 = S{Y: 3, Z: 2, Y: 3} // ERROR "duplicate" -var a3 = T{S{}, 2, 3, 4, 5, 6} // ERROR "convert|too many" -var a4 = [5]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} // ERROR "index|too many" -var a5 = []byte{x: 2} // ERROR "index" -var a6 = []byte{1: 1, 2: 2, 1: 3} // ERROR "duplicate index" +var a1 = S { 0, X: 1 } // ERROR "mixture|undefined" +var a2 = S { Y: 3, Z: 2, Y: 3 } // ERROR "duplicate" +var a3 = T { S{}, 2, 3, 4, 5, 6 } // ERROR "convert|too many" +var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } // ERROR "index|too many" +var a5 = []byte { x: 2 } // ERROR "index" +var a6 = []byte{1: 1, 2: 2, 1: 3} // ERROR "duplicate index" -var ok1 = S{} // should be ok -var ok2 = T{S: ok1} // should be ok +var ok1 = S { } // should be ok +var ok2 = T { S: ok1 } // should be ok // These keys can be computed at compile time but they are // not constants as defined by the spec, so they do not trigger // compile-time errors about duplicate key values. // See issue 4555. -type Key struct{ X, Y int } +type Key struct {X, Y int} var _ = map[Key]string{ - Key{1, 2}: "hello", - Key{1, 2}: "world", + Key{1,2}: "hello", + Key{1,2}: "world", } diff --git a/test/inline_sync.go b/test/inline_sync.go index 27913c1ccc..30b436af41 100644 --- a/test/inline_sync.go +++ b/test/inline_sync.go @@ -35,18 +35,19 @@ func small6() { // ERROR "can inline small6" var once *sync.Once func small7() { // ERROR "can inline small7" - // the Do fast path should be inlined - once.Do(small5) // ERROR "inlining call to sync\.\(\*Once\)\.Do" + // the Do fast path should be inlined + once.Do(small5) // ERROR "inlining call to sync\.\(\*Once\)\.Do" } var rwmutex *sync.RWMutex func small8() { // ERROR "can inline small8" - // the RUnlock fast path should be inlined - rwmutex.RUnlock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RUnlock" + // the RUnlock fast path should be inlined + rwmutex.RUnlock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RUnlock" } func small9() { // ERROR "can inline small9" - // the RLock fast path should be inlined - rwmutex.RLock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RLock" + // the RLock fast path should be inlined + rwmutex.RLock() // ERROR "inlining call to sync\.\(\*RWMutex\)\.RLock" } + diff --git a/test/int_lit.go b/test/int_lit.go index cb24c6cb16..78deaea130 100644 --- a/test/int_lit.go +++ b/test/int_lit.go @@ -11,14 +11,14 @@ package main import "os" func main() { - s := 0 + + s := 0 + 123 + 0123 + 0000 + 0x0 + 0x123 + - 0x0 + - 0x123 + 0X0 + + 0X123 if s != 788 { print("s is ", s, "; should be 788\n") os.Exit(1) diff --git a/test/intcvt.go b/test/intcvt.go index d9477617ae..3920528a40 100644 --- a/test/intcvt.go +++ b/test/intcvt.go @@ -86,7 +86,6 @@ func chku64(i, v uint64) { panic("fail") } } - //func chkf32(f, v float32) { if f != v { println(f, "!=", v); panic("fail") } } //func chkf64(f, v float64) { if f != v { println(f, "!=", v); panic("fail") } } @@ -135,6 +134,7 @@ func main() { // chki64(int64(f32), 0) // chki64(int64(f64), 0) + chku8(uint8(i8), ci8&0xff) chku8(uint8(i16), ci16&0xff) chku8(uint8(i32), ci32&0xff) diff --git a/test/interface/bigdata.go b/test/interface/bigdata.go index f194f75b08..0f2e9a990e 100644 --- a/test/interface/bigdata.go +++ b/test/interface/bigdata.go @@ -8,18 +8,15 @@ package main -type I interface{ M() int64 } +type I interface { M() int64 } -type BigPtr struct{ a, b, c, d int64 } - -func (z *BigPtr) M() int64 { return z.a + z.b + z.c + z.d } - -type SmallPtr struct{ a int32 } +type BigPtr struct { a, b, c, d int64 } +func (z *BigPtr) M() int64 { return z.a+z.b+z.c+z.d } +type SmallPtr struct { a int32 } func (z *SmallPtr) M() int64 { return int64(z.a) } type IntPtr int32 - func (z *IntPtr) M() int64 { return int64(*z) } var bad bool @@ -33,33 +30,30 @@ func test(name string, i I) { } func ptrs() { - var bigptr BigPtr = BigPtr{10000, 2000, 300, 45} - var smallptr SmallPtr = SmallPtr{12345} + var bigptr BigPtr = BigPtr{ 10000, 2000, 300, 45 } + var smallptr SmallPtr = SmallPtr{ 12345 } var intptr IntPtr = 12345 - // test("bigptr", bigptr) +// test("bigptr", bigptr) test("&bigptr", &bigptr) - // test("smallptr", smallptr) +// test("smallptr", smallptr) test("&smallptr", &smallptr) - // test("intptr", intptr) +// test("intptr", intptr) test("&intptr", &intptr) } -type Big struct{ a, b, c, d int64 } - -func (z Big) M() int64 { return z.a + z.b + z.c + z.d } - -type Small struct{ a int32 } +type Big struct { a, b, c, d int64 } +func (z Big) M() int64 { return z.a+z.b+z.c+z.d } +type Small struct { a int32 } func (z Small) M() int64 { return int64(z.a) } type Int int32 - func (z Int) M() int64 { return int64(z) } func nonptrs() { - var big Big = Big{10000, 2000, 300, 45} - var small Small = Small{12345} + var big Big = Big{ 10000, 2000, 300, 45 } + var small Small = Small{ 12345 } var int Int = 12345 test("big", big) diff --git a/test/interface/convert1.go b/test/interface/convert1.go index 98261edf9b..4a3ec8a375 100644 --- a/test/interface/convert1.go +++ b/test/interface/convert1.go @@ -8,13 +8,10 @@ package main -type R interface{ R() } -type RW interface { - R() - W() -} +type R interface { R() } +type RW interface { R(); W() } -var e interface{} +var e interface {} var r R var rw RW diff --git a/test/interface/convert2.go b/test/interface/convert2.go index 98261edf9b..4a3ec8a375 100644 --- a/test/interface/convert2.go +++ b/test/interface/convert2.go @@ -8,13 +8,10 @@ package main -type R interface{ R() } -type RW interface { - R() - W() -} +type R interface { R() } +type RW interface { R(); W() } -var e interface{} +var e interface {} var r R var rw RW diff --git a/test/interface/embed.go b/test/interface/embed.go index 993c532b2a..5c52ac0232 100644 --- a/test/interface/embed.go +++ b/test/interface/embed.go @@ -12,19 +12,16 @@ import "os" const Value = 1e12 -type Inter interface{ M() int64 } +type Inter interface { M() int64 } type T int64 - func (t T) M() int64 { return int64(t) } - var t = T(Value) var pt = &t var ti Inter = t -type S struct{ Inter } - -var s = S{ti} +type S struct { Inter } +var s = S{ ti } var ps = &s var i Inter diff --git a/test/interface/embed1.dir/embed0.go b/test/interface/embed1.dir/embed0.go index 4aed391b63..728bec74e8 100644 --- a/test/interface/embed1.dir/embed0.go +++ b/test/interface/embed1.dir/embed0.go @@ -7,11 +7,10 @@ package p type T int - func (t T) m() {} -type I interface{ m() } -type J interface{ I } +type I interface { m() } +type J interface { I } func main() { var i I diff --git a/test/interface/embed1.dir/embed1.go b/test/interface/embed1.dir/embed1.go index 54754f3069..7dfb1dbc0a 100644 --- a/test/interface/embed1.dir/embed1.go +++ b/test/interface/embed1.dir/embed1.go @@ -9,14 +9,13 @@ package main import "./embed0" type T int - func (t T) m() {} -type I interface{ m() } -type J interface{ I } +type I interface { m() } +type J interface { I } -type PI interface{ p.I } -type PJ interface{ p.J } +type PI interface { p.I } +type PJ interface { p.J } func main() { var i I diff --git a/test/interface/pointer.go b/test/interface/pointer.go index 23e8ec285c..2927050669 100644 --- a/test/interface/pointer.go +++ b/test/interface/pointer.go @@ -24,6 +24,7 @@ type Start struct { func (start *Start) Next() *Inst { return nil } + func AddInst(Inst) *Inst { print("ok in addinst\n") return nil @@ -33,5 +34,5 @@ func main() { print("call addinst\n") var x Inst = AddInst(new(Start)) // ERROR "pointer to interface" print("return from addinst\n") - var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type" + var y *Inst = new(Start) // ERROR "pointer to interface|incompatible type" } diff --git a/test/interface/private.dir/private1.go b/test/interface/private.dir/private1.go index 8743ddb352..75eee51f5a 100644 --- a/test/interface/private.dir/private1.go +++ b/test/interface/private.dir/private1.go @@ -15,3 +15,4 @@ type Implementation struct{} func (p *Implementation) private() {} var X = new(Implementation) + diff --git a/test/interface/private.dir/prog.go b/test/interface/private.dir/prog.go index e20c188eda..abea7d625c 100644 --- a/test/interface/private.dir/prog.go +++ b/test/interface/private.dir/prog.go @@ -25,9 +25,9 @@ func main() { var px p.Exported px = p.X - px.private() // ERROR "private" + px.private() // ERROR "private" - px = new(Implementation) // ERROR "private" + px = new(Implementation) // ERROR "private" - x = px // ERROR "private" + x = px // ERROR "private" } diff --git a/test/interface/recursive.go b/test/interface/recursive.go index bfb517bdcc..fcc88331e0 100644 --- a/test/interface/recursive.go +++ b/test/interface/recursive.go @@ -17,6 +17,5 @@ type I2 interface { } type T int - func (t T) foo() I2 { return t } func (t T) bar() I1 { return t } diff --git a/test/interface/returntype.go b/test/interface/returntype.go index d94b2ed68b..4d86f39184 100644 --- a/test/interface/returntype.go +++ b/test/interface/returntype.go @@ -8,14 +8,14 @@ package main -type S struct{ a int } -type T struct{ b string } +type S struct { a int } +type T struct { b string } -func (s *S) Name() int8 { return 1 } +func (s *S) Name() int8 { return 1 } func (t *T) Name() int64 { return 64 } -type I1 interface{ Name() int8 } -type I2 interface{ Name() int64 } +type I1 interface { Name() int8 } +type I2 interface { Name() int64 } func main() { shouldPanic(p1) diff --git a/test/interface/struct.go b/test/interface/struct.go index 628e5de5e3..f60819ca81 100644 --- a/test/interface/struct.go +++ b/test/interface/struct.go @@ -13,20 +13,16 @@ import "os" var fail int func check(b bool, msg string) { - if !b { + if (!b) { println("failure in", msg) fail++ } } -type I1 interface { - Get() int - Put(int) -} - -type S1 struct{ i int } +type I1 interface { Get() int; Put(int) } -func (p S1) Get() int { return p.i } +type S1 struct { i int } +func (p S1) Get() int { return p.i } func (p S1) Put(i int) { p.i = i } func f1() { @@ -53,9 +49,8 @@ func f3() { check(s.i == 1, "f3 s") } -type S2 struct{ i int } - -func (p *S2) Get() int { return p.i } +type S2 struct { i int } +func (p *S2) Get() int { return p.i } func (p *S2) Put(i int) { p.i = i } // Disallowed by restriction of values going to pointer receivers @@ -83,14 +78,10 @@ func f6() { check(s.i == 2, "f6 s") } -type I2 interface { - Get() int64 - Put(int64) -} - -type S3 struct{ i, j, k, l int64 } +type I2 interface { Get() int64; Put(int64) } -func (p S3) Get() int64 { return p.l } +type S3 struct { i, j, k, l int64 } +func (p S3) Get() int64 { return p.l } func (p S3) Put(i int64) { p.l = i } func f7() { @@ -117,9 +108,8 @@ func f9() { check(s.l == 4, "f9 s") } -type S4 struct{ i, j, k, l int64 } - -func (p *S4) Get() int64 { return p.l } +type S4 struct { i, j, k, l int64 } +func (p *S4) Get() int64 { return p.l } func (p *S4) Put(i int64) { p.l = i } // Disallowed by restriction of values going to pointer receivers @@ -151,13 +141,13 @@ func main() { f1() f2() f3() - // f4() +// f4() f5() f6() f7() f8() f9() - // f10() +// f10() f11() f12() if fail > 0 { diff --git a/test/iota.go b/test/iota.go index 490b27d238..7187dbe335 100644 --- a/test/iota.go +++ b/test/iota.go @@ -16,9 +16,9 @@ func assert(cond bool, msg string) { } const ( - x int = iota - y = iota - z = 1 << iota + x int = iota + y = iota + z = 1 << iota f float32 = 2 * iota g float32 = 4.5 * float32(iota) ) diff --git a/test/ken/complit.go b/test/ken/complit.go index 99d9d7713f..bc50bbe224 100644 --- a/test/ken/complit.go +++ b/test/ken/complit.go @@ -8,115 +8,118 @@ package main -type M map[int]int -type S struct{ a, b, c int } -type SS struct{ aa, bb, cc S } -type SA struct{ a, b, c [3]int } -type SC struct{ a, b, c []int } -type SM struct{ a, b, c M } - -func main() { - test("s.a", s.a) - test("s.b", s.b) - test("s.c", s.c) - - test("ss.aa.a", ss.aa.a) - test("ss.aa.b", ss.aa.b) - test("ss.aa.c", ss.aa.c) - - test("ss.bb.a", ss.bb.a) - test("ss.bb.b", ss.bb.b) - test("ss.bb.c", ss.bb.c) - - test("ss.cc.a", ss.cc.a) - test("ss.cc.b", ss.cc.b) - test("ss.cc.c", ss.cc.c) - - for i := 0; i < 3; i++ { - test("a[i]", a[i]) - test("c[i]", c[i]) - test("m[i]", m[i]) - - test("as[i].a", as[i].a) - test("as[i].b", as[i].b) - test("as[i].c", as[i].c) - - test("cs[i].a", cs[i].a) - test("cs[i].b", cs[i].b) - test("cs[i].c", cs[i].c) - - test("ms[i].a", ms[i].a) - test("ms[i].b", ms[i].b) - test("ms[i].c", ms[i].c) - - test("sa.a[i]", sa.a[i]) - test("sa.b[i]", sa.b[i]) - test("sa.c[i]", sa.c[i]) - - test("sc.a[i]", sc.a[i]) - test("sc.b[i]", sc.b[i]) - test("sc.c[i]", sc.c[i]) - - test("sm.a[i]", sm.a[i]) - test("sm.b[i]", sm.b[i]) - test("sm.c[i]", sm.c[i]) - - for j := 0; j < 3; j++ { - test("aa[i][j]", aa[i][j]) - test("ac[i][j]", ac[i][j]) - test("am[i][j]", am[i][j]) - test("ca[i][j]", ca[i][j]) - test("cc[i][j]", cc[i][j]) - test("cm[i][j]", cm[i][j]) - test("ma[i][j]", ma[i][j]) - test("mc[i][j]", mc[i][j]) - test("mm[i][j]", mm[i][j]) +type M map[int]int +type S struct{ a,b,c int }; +type SS struct{ aa,bb,cc S }; +type SA struct{ a,b,c [3]int }; +type SC struct{ a,b,c []int }; +type SM struct{ a,b,c M }; + +func +main() { + test("s.a", s.a); + test("s.b", s.b); + test("s.c", s.c); + + test("ss.aa.a", ss.aa.a); + test("ss.aa.b", ss.aa.b); + test("ss.aa.c", ss.aa.c); + + test("ss.bb.a", ss.bb.a); + test("ss.bb.b", ss.bb.b); + test("ss.bb.c", ss.bb.c); + + test("ss.cc.a", ss.cc.a); + test("ss.cc.b", ss.cc.b); + test("ss.cc.c", ss.cc.c); + + for i:=0; i<3; i++ { + test("a[i]", a[i]); + test("c[i]", c[i]); + test("m[i]", m[i]); + + test("as[i].a", as[i].a); + test("as[i].b", as[i].b); + test("as[i].c", as[i].c); + + test("cs[i].a", cs[i].a); + test("cs[i].b", cs[i].b); + test("cs[i].c", cs[i].c); + + test("ms[i].a", ms[i].a); + test("ms[i].b", ms[i].b); + test("ms[i].c", ms[i].c); + + test("sa.a[i]", sa.a[i]); + test("sa.b[i]", sa.b[i]); + test("sa.c[i]", sa.c[i]); + + test("sc.a[i]", sc.a[i]); + test("sc.b[i]", sc.b[i]); + test("sc.c[i]", sc.c[i]); + + test("sm.a[i]", sm.a[i]); + test("sm.b[i]", sm.b[i]); + test("sm.c[i]", sm.c[i]); + + for j:=0; j<3; j++ { + test("aa[i][j]", aa[i][j]); + test("ac[i][j]", ac[i][j]); + test("am[i][j]", am[i][j]); + test("ca[i][j]", ca[i][j]); + test("cc[i][j]", cc[i][j]); + test("cm[i][j]", cm[i][j]); + test("ma[i][j]", ma[i][j]); + test("mc[i][j]", mc[i][j]); + test("mm[i][j]", mm[i][j]); } } } -var ref = 0 +var ref = 0; -func test(xs string, x int) { +func +test(xs string, x int) { if ref >= len(answers) { - println(xs, x) - return + println(xs, x); + return; } if x != answers[ref] { println(xs, "is", x, "should be", answers[ref]) } - ref++ + ref++; } -var a = [3]int{1001, 1002, 1003} -var s = S{1101, 1102, 1103} -var c = []int{1201, 1202, 1203} -var m = M{0: 1301, 1: 1302, 2: 1303} -var aa = [3][3]int{[3]int{2001, 2002, 2003}, [3]int{2004, 2005, 2006}, [3]int{2007, 2008, 2009}} -var as = [3]S{S{2101, 2102, 2103}, S{2104, 2105, 2106}, S{2107, 2108, 2109}} -var ac = [3][]int{[]int{2201, 2202, 2203}, []int{2204, 2205, 2206}, []int{2207, 2208, 2209}} -var am = [3]M{M{0: 2301, 1: 2302, 2: 2303}, M{0: 2304, 1: 2305, 2: 2306}, M{0: 2307, 1: 2308, 2: 2309}} +var a = [3]int{1001, 1002, 1003} +var s = S{1101, 1102, 1103} +var c = []int{1201, 1202, 1203} +var m = M{0:1301, 1:1302, 2:1303} -var sa = SA{[3]int{3001, 3002, 3003}, [3]int{3004, 3005, 3006}, [3]int{3007, 3008, 3009}} -var ss = SS{S{3101, 3102, 3103}, S{3104, 3105, 3106}, S{3107, 3108, 3109}} -var sc = SC{[]int{3201, 3202, 3203}, []int{3204, 3205, 3206}, []int{3207, 3208, 3209}} -var sm = SM{M{0: 3301, 1: 3302, 2: 3303}, M{0: 3304, 1: 3305, 2: 3306}, M{0: 3307, 1: 3308, 2: 3309}} +var aa = [3][3]int{[3]int{2001,2002,2003}, [3]int{2004,2005,2006}, [3]int{2007,2008,2009}} +var as = [3]S{S{2101,2102,2103},S{2104,2105,2106},S{2107,2108,2109}} +var ac = [3][]int{[]int{2201,2202,2203}, []int{2204,2205,2206}, []int{2207,2208,2209}} +var am = [3]M{M{0:2301,1:2302,2:2303}, M{0:2304,1:2305,2:2306}, M{0:2307,1:2308,2:2309}} -var ca = [][3]int{[3]int{4001, 4002, 4003}, [3]int{4004, 4005, 4006}, [3]int{4007, 4008, 4009}} -var cs = []S{S{4101, 4102, 4103}, S{4104, 4105, 4106}, S{4107, 4108, 4109}} -var cc = [][]int{[]int{4201, 4202, 4203}, []int{4204, 4205, 4206}, []int{4207, 4208, 4209}} -var cm = []M{M{0: 4301, 1: 4302, 2: 4303}, M{0: 4304, 1: 4305, 2: 4306}, M{0: 4307, 1: 4308, 2: 4309}} +var sa = SA{[3]int{3001,3002,3003},[3]int{3004,3005,3006},[3]int{3007,3008,3009}} +var ss = SS{S{3101,3102,3103},S{3104,3105,3106},S{3107,3108,3109}} +var sc = SC{[]int{3201,3202,3203},[]int{3204,3205,3206},[]int{3207,3208,3209}} +var sm = SM{M{0:3301,1:3302,2:3303}, M{0:3304,1:3305,2:3306}, M{0:3307,1:3308,2:3309}} -var ma = map[int][3]int{0: [3]int{5001, 5002, 5003}, 1: [3]int{5004, 5005, 5006}, 2: [3]int{5007, 5008, 5009}} -var ms = map[int]S{0: S{5101, 5102, 5103}, 1: S{5104, 5105, 5106}, 2: S{5107, 5108, 5109}} -var mc = map[int][]int{0: []int{5201, 5202, 5203}, 1: []int{5204, 5205, 5206}, 2: []int{5207, 5208, 5209}} -var mm = map[int]M{0: M{0: 5301, 1: 5302, 2: 5303}, 1: M{0: 5304, 1: 5305, 2: 5306}, 2: M{0: 5307, 1: 5308, 2: 5309}} +var ca = [][3]int{[3]int{4001,4002,4003}, [3]int{4004,4005,4006}, [3]int{4007,4008,4009}} +var cs = []S{S{4101,4102,4103},S{4104,4105,4106},S{4107,4108,4109}} +var cc = [][]int{[]int{4201,4202,4203}, []int{4204,4205,4206}, []int{4207,4208,4209}} +var cm = []M{M{0:4301,1:4302,2:4303}, M{0:4304,1:4305,2:4306}, M{0:4307,1:4308,2:4309}} -var answers = [...]int{ +var ma = map[int][3]int{0:[3]int{5001,5002,5003}, 1:[3]int{5004,5005,5006}, 2:[3]int{5007,5008,5009}} +var ms = map[int]S{0:S{5101,5102,5103},1:S{5104,5105,5106},2:S{5107,5108,5109}} +var mc = map[int][]int{0:[]int{5201,5202,5203}, 1:[]int{5204,5205,5206}, 2:[]int{5207,5208,5209}} +var mm = map[int]M{0:M{0:5301,1:5302,2:5303}, 1:M{0:5304,1:5305,2:5306}, 2:M{0:5307,1:5308,2:5309}} + +var answers = [...]int { // s 1101, 1102, 1103, diff --git a/test/ken/convert.go b/test/ken/convert.go index f3b08edbc2..33acbd8cd2 100644 --- a/test/ken/convert.go +++ b/test/ken/convert.go @@ -9,26 +9,26 @@ package main -var i8 int8 -var u8 uint8 -var i16 int16 -var u16 uint16 -var i32 int32 -var u32 uint32 -var i64 int64 -var u64 uint64 -var f32 float32 -var f64 float64 - -type big float64 - -type t struct { - from, to int - val big +var i8 int8; +var u8 uint8; +var i16 int16; +var u16 uint16; +var i32 int32; +var u32 uint32; +var i64 int64; +var u64 uint64; +var f32 float32; +var f64 float64; + +type big float64 + +type t struct { + from, to int + val big } const ( - ti8 = iota + 1 + ti8 = iota+1 tu8 ti16 tu16 @@ -40,184 +40,177 @@ const ( tf64 ) -var x = []t{ +var x = []t{ /* value good in all types (10) */ - {ti8, ti8, 10}, {ti8, tu8, 10}, {ti8, ti16, 10}, {ti8, tu16, 10}, - {ti8, ti32, 10}, {ti8, tu32, 10}, {ti8, ti64, 10}, {ti8, tu64, 10}, - {ti8, tf32, 10}, {ti8, tf64, 10}, + { ti8, ti8, 10 }, { ti8, tu8, 10 }, { ti8, ti16, 10 }, { ti8, tu16, 10 }, + { ti8, ti32, 10 }, { ti8, tu32, 10 }, { ti8, ti64, 10 }, { ti8, tu64, 10 }, + { ti8, tf32, 10 }, { ti8, tf64, 10 }, - {tu8, ti8, 10}, {tu8, tu8, 10}, {tu8, ti16, 10}, {tu8, tu16, 10}, - {tu8, ti32, 10}, {tu8, tu32, 10}, {tu8, ti64, 10}, {tu8, tu64, 10}, - {tu8, tf32, 10}, {tu8, tf64, 10}, + { tu8, ti8, 10 }, { tu8, tu8, 10 }, { tu8, ti16, 10 }, { tu8, tu16, 10 }, + { tu8, ti32, 10 }, { tu8, tu32, 10 }, { tu8, ti64, 10 }, { tu8, tu64, 10 }, + { tu8, tf32, 10 }, { tu8, tf64, 10 }, - {ti16, ti8, 10}, {ti16, tu8, 10}, {ti16, ti16, 10}, {ti16, tu16, 10}, - {ti16, ti32, 10}, {ti16, tu32, 10}, {ti16, ti64, 10}, {ti16, tu64, 10}, - {ti16, tf32, 10}, {ti16, tf64, 10}, + { ti16, ti8, 10 }, { ti16, tu8, 10 }, { ti16, ti16, 10 }, { ti16, tu16, 10 }, + { ti16, ti32, 10 }, { ti16, tu32, 10 }, { ti16, ti64, 10 }, { ti16, tu64, 10 }, + { ti16, tf32, 10 }, { ti16, tf64, 10 }, - {tu16, ti8, 10}, {tu16, tu8, 10}, {tu16, ti16, 10}, {tu16, tu16, 10}, - {tu16, ti32, 10}, {tu16, tu32, 10}, {tu16, ti64, 10}, {tu16, tu64, 10}, - {tu16, tf32, 10}, {tu16, tf64, 10}, + { tu16, ti8, 10 }, { tu16, tu8, 10 }, { tu16, ti16, 10 }, { tu16, tu16, 10 }, + { tu16, ti32, 10 }, { tu16, tu32, 10 }, { tu16, ti64, 10 }, { tu16, tu64, 10 }, + { tu16, tf32, 10 }, { tu16, tf64, 10 }, - {ti32, ti8, 10}, {ti32, tu8, 10}, {ti32, ti16, 10}, {ti32, tu16, 10}, - {ti32, ti32, 10}, {ti32, tu32, 10}, {ti32, ti64, 10}, {ti32, tu64, 10}, - {ti32, tf32, 10}, {ti32, tf64, 10}, + { ti32, ti8, 10 }, { ti32, tu8, 10 }, { ti32, ti16, 10 }, { ti32, tu16, 10 }, + { ti32, ti32, 10 }, { ti32, tu32, 10 }, { ti32, ti64, 10 }, { ti32, tu64, 10 }, + { ti32, tf32, 10 }, { ti32, tf64, 10 }, - {tu32, ti8, 10}, {tu32, tu8, 10}, {tu32, ti16, 10}, {tu32, tu16, 10}, - {tu32, ti32, 10}, {tu32, tu32, 10}, {tu32, ti64, 10}, {tu32, tu64, 10}, - {tu32, tf32, 10}, {tu32, tf64, 10}, + { tu32, ti8, 10 }, { tu32, tu8, 10 }, { tu32, ti16, 10 }, { tu32, tu16, 10 }, + { tu32, ti32, 10 }, { tu32, tu32, 10 }, { tu32, ti64, 10 }, { tu32, tu64, 10 }, + { tu32, tf32, 10 }, { tu32, tf64, 10 }, - {ti64, ti8, 10}, {ti64, tu8, 10}, {ti64, ti16, 10}, {ti64, tu16, 10}, - {ti64, ti32, 10}, {ti64, tu32, 10}, {ti64, ti64, 10}, {ti64, tu64, 10}, - {ti64, tf32, 10}, {ti64, tf64, 10}, + { ti64, ti8, 10 }, { ti64, tu8, 10 }, { ti64, ti16, 10 }, { ti64, tu16, 10 }, + { ti64, ti32, 10 }, { ti64, tu32, 10 }, { ti64, ti64, 10 }, { ti64, tu64, 10 }, + { ti64, tf32, 10 }, { ti64, tf64, 10 }, - {tu64, ti8, 10}, {tu64, tu8, 10}, {tu64, ti16, 10}, {tu64, tu16, 10}, - {tu64, ti32, 10}, {tu64, tu32, 10}, {tu64, ti64, 10}, {tu64, tu64, 10}, - {tu64, tf32, 10}, {tu64, tf64, 10}, + { tu64, ti8, 10 }, { tu64, tu8, 10 }, { tu64, ti16, 10 }, { tu64, tu16, 10 }, + { tu64, ti32, 10 }, { tu64, tu32, 10 }, { tu64, ti64, 10 }, { tu64, tu64, 10 }, + { tu64, tf32, 10 }, { tu64, tf64, 10 }, - {tf32, ti8, 10}, {tf32, tu8, 10}, {tf32, ti16, 10}, {tf32, tu16, 10}, - {tf32, ti32, 10}, {tf32, tu32, 10}, {tf32, ti64, 10}, {tf32, tu64, 10}, - {tf32, tf32, 10}, {tf32, tf64, 10}, + { tf32, ti8, 10 }, { tf32, tu8, 10 }, { tf32, ti16, 10 }, { tf32, tu16, 10 }, + { tf32, ti32, 10 }, { tf32, tu32, 10 }, { tf32, ti64, 10 }, { tf32, tu64, 10 }, + { tf32, tf32, 10 }, { tf32, tf64, 10 }, - {tf64, ti8, 10}, {tf64, tu8, 10}, {tf64, ti16, 10}, {tf64, tu16, 10}, - {tf64, ti32, 10}, {tf64, tu32, 10}, {tf64, ti64, 10}, {tf64, tu64, 10}, - {tf64, tf32, 10}, {tf64, tf64, 10}, + { tf64, ti8, 10 }, { tf64, tu8, 10 }, { tf64, ti16, 10 }, { tf64, tu16, 10 }, + { tf64, ti32, 10 }, { tf64, tu32, 10 }, { tf64, ti64, 10 }, { tf64, tu64, 10 }, + { tf64, tf32, 10 }, { tf64, tf64, 10 }, /* value good in all signed types (-4) */ - {ti8, ti8, -4}, {ti8, ti16, -4}, - {ti8, ti32, -4}, {ti8, ti64, -4}, - {ti8, tf32, -4}, {ti8, tf64, -4}, + { ti8, ti8, -4 }, { ti8, ti16, -4 }, + { ti8, ti32, -4 }, { ti8, ti64, -4 }, + { ti8, tf32, -4 }, { ti8, tf64, -4 }, - {ti16, ti8, -4}, {ti16, ti16, -4}, - {ti16, ti32, -4}, {ti16, ti64, -4}, - {ti16, tf32, -4}, + { ti16, ti8, -4 }, { ti16, ti16, -4 }, + { ti16, ti32, -4 }, { ti16, ti64, -4 }, + { ti16, tf32, -4 }, - {ti32, ti8, -4}, {ti32, ti16, -4}, - {ti32, ti32, -4}, {ti32, ti64, -4}, - {ti32, tf32, -4}, {ti32, tf64, -4}, + { ti32, ti8, -4 }, { ti32, ti16, -4 }, + { ti32, ti32, -4 }, { ti32, ti64, -4 }, + { ti32, tf32, -4 }, { ti32, tf64, -4 }, - {ti64, ti8, -4}, {ti64, ti16, -4}, - {ti64, ti32, -4}, {ti64, ti64, -4}, - {ti64, tf32, -4}, + { ti64, ti8, -4 }, { ti64, ti16, -4 }, + { ti64, ti32, -4 }, { ti64, ti64, -4 }, + { ti64, tf32, -4 }, - {tf32, ti8, -4}, {tf32, ti16, -4}, - {tf32, ti32, -4}, {tf32, ti64, -4}, - {tf32, tf32, -4}, + { tf32, ti8, -4 }, { tf32, ti16, -4 }, + { tf32, ti32, -4 }, { tf32, ti64, -4 }, + { tf32, tf32, -4 }, - {tf64, ti8, -4}, {tf64, ti16, -4}, - {tf64, ti32, -4}, {tf64, ti64, -4}, - {tf64, tf32, -4}, {tf64, tf64, -4}, + { tf64, ti8, -4 }, { tf64, ti16, -4 }, + { tf64, ti32, -4 }, { tf64, ti64, -4 }, + { tf64, tf32, -4 }, { tf64, tf64, -4 }, /* value good in u8 and up (175) */ - {tu8, tu8, 175}, {tu8, ti16, 175}, {tu8, tu16, 175}, - {tu8, ti32, 175}, {tu8, tu32, 175}, {tu8, ti64, 175}, {tu8, tu64, 175}, - {tu8, tf32, 175}, {tu8, tf64, 175}, + { tu8, tu8, 175 }, { tu8, ti16, 175 }, { tu8, tu16, 175 }, + { tu8, ti32, 175 }, { tu8, tu32, 175 }, { tu8, ti64, 175 }, { tu8, tu64, 175 }, + { tu8, tf32, 175 }, { tu8, tf64, 175 }, - {ti16, tu8, 175}, {ti16, ti16, 175}, {ti16, tu16, 175}, - {ti16, ti32, 175}, {ti16, tu32, 175}, {ti16, ti64, 175}, {ti16, tu64, 175}, - {ti16, tf32, 175}, {ti16, tf64, 175}, + { ti16, tu8, 175 }, { ti16, ti16, 175 }, { ti16, tu16, 175 }, + { ti16, ti32, 175 }, { ti16, tu32, 175 }, { ti16, ti64, 175 }, { ti16, tu64, 175 }, + { ti16, tf32, 175 }, { ti16, tf64, 175 }, - {tu16, tu8, 175}, {tu16, ti16, 175}, {tu16, tu16, 175}, - {tu16, ti32, 175}, {tu16, tu32, 175}, {tu16, ti64, 175}, {tu16, tu64, 175}, - {tu16, tf32, 175}, {tu16, tf64, 175}, + { tu16, tu8, 175 }, { tu16, ti16, 175 }, { tu16, tu16, 175 }, + { tu16, ti32, 175 }, { tu16, tu32, 175 }, { tu16, ti64, 175 }, { tu16, tu64, 175 }, + { tu16, tf32, 175 }, { tu16, tf64, 175 }, - {ti32, tu8, 175}, {ti32, ti16, 175}, {ti32, tu16, 175}, - {ti32, ti32, 175}, {ti32, tu32, 175}, {ti32, ti64, 175}, {ti32, tu64, 175}, - {ti32, tf32, 175}, {ti32, tf64, 175}, + { ti32, tu8, 175 }, { ti32, ti16, 175 }, { ti32, tu16, 175 }, + { ti32, ti32, 175 }, { ti32, tu32, 175 }, { ti32, ti64, 175 }, { ti32, tu64, 175 }, + { ti32, tf32, 175 }, { ti32, tf64, 175 }, - {tu32, tu8, 175}, {tu32, ti16, 175}, {tu32, tu16, 175}, - {tu32, ti32, 175}, {tu32, tu32, 175}, {tu32, ti64, 175}, {tu32, tu64, 175}, - {tu32, tf32, 175}, {tu32, tf64, 175}, + { tu32, tu8, 175 }, { tu32, ti16, 175 }, { tu32, tu16, 175 }, + { tu32, ti32, 175 }, { tu32, tu32, 175 }, { tu32, ti64, 175 }, { tu32, tu64, 175 }, + { tu32, tf32, 175 }, { tu32, tf64, 175 }, - {ti64, tu8, 175}, {ti64, ti16, 175}, {ti64, tu16, 175}, - {ti64, ti32, 175}, {ti64, tu32, 175}, {ti64, ti64, 175}, {ti64, tu64, 175}, - {ti64, tf32, 175}, {ti64, tf64, 175}, + { ti64, tu8, 175 }, { ti64, ti16, 175 }, { ti64, tu16, 175 }, + { ti64, ti32, 175 }, { ti64, tu32, 175 }, { ti64, ti64, 175 }, { ti64, tu64, 175 }, + { ti64, tf32, 175 }, { ti64, tf64, 175 }, - {tu64, tu8, 175}, {tu64, ti16, 175}, {tu64, tu16, 175}, - {tu64, ti32, 175}, {tu64, tu32, 175}, {tu64, ti64, 175}, {tu64, tu64, 175}, - {tu64, tf32, 175}, {tu64, tf64, 175}, + { tu64, tu8, 175 }, { tu64, ti16, 175 }, { tu64, tu16, 175 }, + { tu64, ti32, 175 }, { tu64, tu32, 175 }, { tu64, ti64, 175 }, { tu64, tu64, 175 }, + { tu64, tf32, 175 }, { tu64, tf64, 175 }, - {tf32, tu8, 175}, {tf32, ti16, 175}, {tf32, tu16, 175}, - {tf32, ti32, 175}, {tf32, tu32, 175}, {tf32, ti64, 175}, {tf32, tu64, 175}, - {tf32, tf32, 175}, {tf32, tf64, 175}, + { tf32, tu8, 175 }, { tf32, ti16, 175 }, { tf32, tu16, 175 }, + { tf32, ti32, 175 }, { tf32, tu32, 175 }, { tf32, ti64, 175 }, { tf32, tu64, 175 }, + { tf32, tf32, 175 }, { tf32, tf64, 175 }, - {tf64, tu8, 175}, {tf64, ti16, 175}, {tf64, tu16, 175}, - {tf64, ti32, 175}, {tf64, tu32, 175}, {tf64, ti64, 175}, {tf64, tu64, 175}, - {tf64, tf32, 175}, {tf64, tf64, 175}, + { tf64, tu8, 175 }, { tf64, ti16, 175 }, { tf64, tu16, 175 }, + { tf64, ti32, 175 }, { tf64, tu32, 175 }, { tf64, ti64, 175 }, { tf64, tu64, 175 }, + { tf64, tf32, 175 }, { tf64, tf64, 175 }, /* value good in u16 and up (41259) */ - {tu16, tu16, 41259}, - {tu16, ti32, 41259}, {tu16, ti64, 41259}, {tu16, tu64, 41259}, - {tu16, tf32, 41259}, {tu16, tf64, 41259}, + { tu16, tu16, 41259 }, + { tu16, ti32, 41259 }, { tu16, ti64, 41259 }, { tu16, tu64, 41259 }, + { tu16, tf32, 41259 }, { tu16, tf64, 41259 }, - {ti32, tu16, 41259}, - {ti32, ti32, 41259}, {ti32, tu32, 41259}, {ti32, ti64, 41259}, {ti32, tu64, 41259}, - {ti32, tf32, 41259}, {ti32, tf64, 41259}, + { ti32, tu16, 41259 }, + { ti32, ti32, 41259 }, { ti32, tu32, 41259 }, { ti32, ti64, 41259 }, { ti32, tu64, 41259 }, + { ti32, tf32, 41259 }, { ti32, tf64, 41259 }, - {tu32, tu16, 41259}, - {tu32, ti32, 41259}, {tu32, tu32, 41259}, {tu32, ti64, 41259}, {tu32, tu64, 41259}, - {tu32, tf32, 41259}, {tu32, tf64, 41259}, + { tu32, tu16, 41259 }, + { tu32, ti32, 41259 }, { tu32, tu32, 41259 }, { tu32, ti64, 41259 }, { tu32, tu64, 41259 }, + { tu32, tf32, 41259 }, { tu32, tf64, 41259 }, - {ti64, tu16, 41259}, - {ti64, ti32, 41259}, {ti64, tu32, 41259}, {ti64, ti64, 41259}, {ti64, tu64, 41259}, - {ti64, tf32, 41259}, {ti64, tf64, 41259}, + { ti64, tu16, 41259 }, + { ti64, ti32, 41259 }, { ti64, tu32, 41259 }, { ti64, ti64, 41259 }, { ti64, tu64, 41259 }, + { ti64, tf32, 41259 }, { ti64, tf64, 41259 }, - {tu64, tu16, 41259}, - {tu64, ti32, 41259}, {tu64, tu32, 41259}, {tu64, ti64, 41259}, {tu64, tu64, 41259}, - {tu64, tf32, 41259}, {tu64, tf64, 41259}, + { tu64, tu16, 41259 }, + { tu64, ti32, 41259 }, { tu64, tu32, 41259 }, { tu64, ti64, 41259 }, { tu64, tu64, 41259 }, + { tu64, tf32, 41259 }, { tu64, tf64, 41259 }, - {tf32, tu16, 41259}, - {tf32, ti32, 41259}, {tf32, tu32, 41259}, {tf32, ti64, 41259}, {tf32, tu64, 41259}, - {tf32, tf32, 41259}, {tf32, tf64, 41259}, + { tf32, tu16, 41259 }, + { tf32, ti32, 41259 }, { tf32, tu32, 41259 }, { tf32, ti64, 41259 }, { tf32, tu64, 41259 }, + { tf32, tf32, 41259 }, { tf32, tf64, 41259 }, - {tf64, tu16, 41259}, - {tf64, ti32, 41259}, {tf64, tu32, 41259}, {tf64, ti64, 41259}, {tf64, tu64, 41259}, - {tf64, tf32, 41259}, {tf64, tf64, 41259}, + { tf64, tu16, 41259 }, + { tf64, ti32, 41259 }, { tf64, tu32, 41259 }, { tf64, ti64, 41259 }, { tf64, tu64, 41259 }, + { tf64, tf32, 41259 }, { tf64, tf64, 41259 }, /* value good in u32 and up (3758096384) */ - {tu32, tu32, 3758096384}, {tu32, ti64, 3758096384}, {tu32, tu64, 3758096384}, - {tu32, tf32, 3758096384}, {tu32, tf64, 3758096384}, + { tu32, tu32, 3758096384 }, { tu32, ti64, 3758096384 }, { tu32, tu64, 3758096384 }, + { tu32, tf32, 3758096384 }, { tu32, tf64, 3758096384 }, - {ti64, tu32, 3758096384}, {ti64, ti64, 3758096384}, {ti64, tu64, 3758096384}, - {ti64, tf32, 3758096384}, {ti64, tf64, 3758096384}, + { ti64, tu32, 3758096384 }, { ti64, ti64, 3758096384 }, { ti64, tu64, 3758096384 }, + { ti64, tf32, 3758096384 }, { ti64, tf64, 3758096384 }, - {tu64, tu32, 3758096384}, {tu64, ti64, 3758096384}, {tu64, tu64, 3758096384}, - {tu64, tf32, 3758096384}, {tu64, tf64, 3758096384}, + { tu64, tu32, 3758096384 }, { tu64, ti64, 3758096384 }, { tu64, tu64, 3758096384 }, + { tu64, tf32, 3758096384 }, { tu64, tf64, 3758096384 }, - {tf32, tu32, 3758096384}, {tf32, ti64, 3758096384}, {tf32, tu64, 3758096384}, - {tf32, tf32, 3758096384}, {tf32, tf64, 3758096384}, + { tf32, tu32, 3758096384 }, { tf32, ti64, 3758096384 }, { tf32, tu64, 3758096384 }, + { tf32, tf32, 3758096384 }, { tf32, tf64, 3758096384 }, - {tf64, tu32, 3758096384}, {tf64, ti64, 3758096384}, {tf64, tu64, 3758096384}, - {tf64, tf32, 3758096384}, {tf64, tf64, 3758096384}, + { tf64, tu32, 3758096384 }, { tf64, ti64, 3758096384 }, { tf64, tu64, 3758096384 }, + { tf64, tf32, 3758096384 }, { tf64, tf64, 3758096384 }, /* value good in u64 and up (16717361816799281152) */ - {tu64, tu64, 16717361816799281152}, - {tu64, tf32, 16717361816799281152}, {tu64, tf64, 16717361816799281152}, + { tu64, tu64, 16717361816799281152 }, + { tu64, tf32, 16717361816799281152 }, { tu64, tf64, 16717361816799281152 }, - {tf32, tu64, 16717361816799281152}, - {tf32, tf32, 16717361816799281152}, {tf32, tf64, 16717361816799281152}, + { tf32, tu64, 16717361816799281152 }, + { tf32, tf32, 16717361816799281152 }, { tf32, tf64, 16717361816799281152 }, - {tf64, tu64, 16717361816799281152}, - {tf64, tf32, 16717361816799281152}, {tf64, tf64, 16717361816799281152}, + { tf64, tu64, 16717361816799281152 }, + { tf64, tf32, 16717361816799281152 }, { tf64, tf64, 16717361816799281152 }, } func main() { - for i := 0; i < len(x); i++ { - v := x[i].val // input value - w := big(0) // output value - f := x[i].from // input type - t := x[i].to // output type - - i8 = 0 - u8 = 0 - i16 = 0 - u16 = 0 - i32 = 0 - u32 = 0 - i64 = 0 - u64 = 0 - f32 = 0 - f64 = 0 + for i:=0; i 1e-6 { println(r, "!= 1.292308") @@ -32,7 +32,7 @@ func main() { } d = i + 0.1384615 if d < 0 { - d = -d + d = - d } if d > 1e-6 { println(i, "!= -0.1384615") diff --git a/test/ken/embed.go b/test/ken/embed.go index 2e46c34590..f7ca0665e2 100644 --- a/test/ken/embed.go +++ b/test/ken/embed.go @@ -8,6 +8,7 @@ package main + type I interface { test1() int test2() int diff --git a/test/ken/for.go b/test/ken/for.go index 4c257ffcc9..db35548db8 100644 --- a/test/ken/for.go +++ b/test/ken/for.go @@ -8,13 +8,12 @@ package main -func main() { - var t, i int +func +main() { + var t,i int; - for i = 0; i < 100; i = i + 1 { - t = t + i - } - if t != 50*99 { - panic(t) + for i=0; i<100; i=i+1 { + t = t+i; } + if t != 50*99 { panic(t); } } diff --git a/test/ken/interfun.go b/test/ken/interfun.go index 47955c610f..9432181df2 100644 --- a/test/ken/interfun.go +++ b/test/ken/interfun.go @@ -9,64 +9,51 @@ package main type S struct { - a, b int + a,b int; } type I1 interface { - f() int + f ()int; } type I2 interface { - g() int - f() int + g() int; + f() int; } -func (this *S) f() int { - return this.a +func (this *S) f()int { + return this.a; } -func (this *S) g() int { - return this.b +func (this *S) g()int { + return this.b; } -func main() { - var i1 I1 - var i2 I2 - var g *S +func +main() { + var i1 I1; + var i2 I2; + var g *S; - s := new(S) - s.a = 5 - s.b = 6 + s := new(S); + s.a = 5; + s.b = 6; // call structure - if s.f() != 5 { - panic(11) - } - if s.g() != 6 { - panic(12) - } + if s.f() != 5 { panic(11); } + if s.g() != 6 { panic(12); } - i1 = s // convert S to I1 - i2 = i1.(I2) // convert I1 to I2 + i1 = s; // convert S to I1 + i2 = i1.(I2); // convert I1 to I2 // call interface - if i1.f() != 5 { - panic(21) - } - if i2.f() != 5 { - panic(22) - } - if i2.g() != 6 { - panic(23) - } + if i1.f() != 5 { panic(21); } + if i2.f() != 5 { panic(22); } + if i2.g() != 6 { panic(23); } - g = i1.(*S) // convert I1 to S - if g != s { - panic(31) - } + g = i1.(*S); // convert I1 to S + if g != s { panic(31); } - g = i2.(*S) // convert I2 to S - if g != s { - panic(32) - } + g = i2.(*S); // convert I2 to S + if g != s { panic(32); } } diff --git a/test/ken/intervar.go b/test/ken/intervar.go index 9ae98d92d8..8a2fca0d4b 100644 --- a/test/ken/intervar.go +++ b/test/ken/intervar.go @@ -8,59 +8,60 @@ package main -type Iputs interface { - puts(s string) string +type Iputs interface { + puts (s string) string; } // --------- -type Print struct { - whoami int - put Iputs +type Print struct { + whoami int; + put Iputs; } func (p *Print) dop() string { - r := " print " + string(p.whoami+'0') - return r + p.put.puts("abc") + r := " print " + string(p.whoami + '0') + return r + p.put.puts("abc"); } // --------- -type Bio struct { - whoami int - put Iputs +type Bio struct { + whoami int; + put Iputs; } func (b *Bio) puts(s string) string { - r := " bio " + string(b.whoami+'0') - return r + b.put.puts(s) + r := " bio " + string(b.whoami + '0') + return r + b.put.puts(s); } // --------- -type File struct { - whoami int - put Iputs +type File struct { + whoami int; + put Iputs; } func (f *File) puts(s string) string { - return " file " + string(f.whoami+'0') + " -- " + s + return " file " + string(f.whoami + '0') + " -- " + s } -func main() { - p := new(Print) - b := new(Bio) - f := new(File) +func +main() { + p := new(Print); + b := new(Bio); + f := new(File); - p.whoami = 1 - p.put = b + p.whoami = 1; + p.put = b; - b.whoami = 2 - b.put = f + b.whoami = 2; + b.put = f; - f.whoami = 3 + f.whoami = 3; - r := p.dop() + r := p.dop(); expected := " print 1 bio 2 file 3 -- abc" if r != expected { panic(r + " != " + expected) diff --git a/test/ken/litfun.go b/test/ken/litfun.go index ba19ccf305..e241d4edb7 100644 --- a/test/ken/litfun.go +++ b/test/ken/litfun.go @@ -8,17 +8,16 @@ package main -func main() { - x := func(a int) int { - x := func(a int) int { - x := func(a int) int { - return a + 5 - } - return x(a) + 7 - } - return x(a) + 11 - } - if x(3) != 3+5+7+11 { - panic(x(3)) - } +func +main() { + x := func(a int)int { + x := func(a int)int { + x := func(a int)int { + return a+5; + }; + return x(a)+7; + }; + return x(a)+11; + }; + if x(3) != 3+5+7+11 { panic(x(3)); } } diff --git a/test/ken/mfunc.go b/test/ken/mfunc.go index 3754bbf6a2..ef2499194f 100644 --- a/test/ken/mfunc.go +++ b/test/ken/mfunc.go @@ -8,15 +8,15 @@ package main -func main() { - var x, y int +func +main() { + var x,y int; - x, y = simple(10, 20, 30) - if x+y != 65 { - panic(x + y) - } + x,y = simple(10,20,30); + if x+y != 65 { panic(x+y); } } -func simple(ia, ib, ic int) (oa, ob int) { - return ia + 5, ib + ic +func +simple(ia,ib,ic int) (oa,ob int) { + return ia+5, ib+ic; } diff --git a/test/ken/ptrfun.go b/test/ken/ptrfun.go index 2fc13a7ebb..af806cfd92 100644 --- a/test/ken/ptrfun.go +++ b/test/ken/ptrfun.go @@ -9,44 +9,37 @@ package main type C struct { - a int - x func(p *C) int + a int; + x func(p *C)int; } -func (this *C) f() int { - return this.a +func (this *C) f()int { + return this.a; } -func main() { - var v int - var c *C +func +main() { + var v int; + var c *C; - c = new(C) - c.a = 6 - c.x = g + c = new(C); + c.a = 6; + c.x = g; - v = g(c) - if v != 6 { - panic(v) - } + v = g(c); + if v != 6 { panic(v); } - v = c.x(c) - if v != 6 { - panic(v) - } + v = c.x(c); + if v != 6 { panic(v); } - v = c.f() - if v != 6 { - panic(v) - } + v = c.f(); + if v != 6 { panic(v); } } -func g(p *C) int { - var v int +func g(p *C)int { + var v int; - v = p.a - if v != 6 { - panic(v) - } - return p.a + v = p.a; + if v != 6 { panic(v); } + return p.a; } diff --git a/test/ken/ptrvar.go b/test/ken/ptrvar.go index 4d1b9eb794..d78170c9d2 100644 --- a/test/ken/ptrvar.go +++ b/test/ken/ptrvar.go @@ -8,49 +8,36 @@ package main -type x2 struct { - a, b, c int - d int -} - -var g1 x2 -var g2 struct { - a, b, c int - d x2 -} - -func main() { - var x int - var s1 *x2 - var s2 *struct { - a, b, c int - d x2 - } - - s1 = &g1 - s2 = &g2 - - s1.a = 1 - s1.b = 2 - s1.c = 3 - s1.d = 5 - - s2.a = 7 - s2.b = 11 - s2.c = 13 - s2.d.a = 17 - s2.d.b = 19 - s2.d.c = 23 - s2.d.d = 20 - - if s2.d.c != 23 { - panic(1) - } - if g2.d.c != 23 { - panic(2) - } - - x = s1.a + +type x2 struct { a,b,c int; d int; }; +var g1 x2; +var g2 struct { a,b,c int; d x2; }; + +func +main() { + var x int; + var s1 *x2; + var s2 *struct { a,b,c int; d x2; }; + + s1 = &g1; + s2 = &g2; + + s1.a = 1; + s1.b = 2; + s1.c = 3; + s1.d = 5; + + s2.a = 7; + s2.b = 11; + s2.c = 13; + s2.d.a = 17; + s2.d.b = 19; + s2.d.c = 23; + s2.d.d = 20; + + if(s2.d.c != 23) { panic(1); } + if(g2.d.c != 23) { panic(2); } + + x = s1.a + s1.b + s1.c + s1.d + @@ -61,9 +48,7 @@ func main() { s2.d.a + s2.d.b + s2.d.c + - s2.d.d + s2.d.d; - if x != 121 { - panic(x) - } + if(x != 121) { panic(x); } } diff --git a/test/ken/robfor.go b/test/ken/robfor.go index 3269c0714b..c6a420b39d 100644 --- a/test/ken/robfor.go +++ b/test/ken/robfor.go @@ -10,49 +10,49 @@ package main func assertequal(is, shouldbe int, msg string) { if is != shouldbe { - print("assertion fail" + msg + "\n") - panic(1) + print("assertion fail" + msg + "\n"); + panic(1); } } func main() { - var i, sum int + var i, sum int; - i = 0 + i = 0; for { - i = i + 1 + i = i + 1; if i > 5 { - break + break; } } - assertequal(i, 6, "break") + assertequal(i, 6, "break"); - sum = 0 + sum = 0; for i := 0; i <= 10; i++ { - sum = sum + i + sum = sum + i; } - assertequal(sum, 55, "all three") + assertequal(sum, 55, "all three"); - sum = 0 + sum = 0; for i := 0; i <= 10; { - sum = sum + i - i++ + sum = sum + i; + i++; } - assertequal(sum, 55, "only two") + assertequal(sum, 55, "only two"); - sum = 0 + sum = 0; for sum < 100 { - sum = sum + 9 + sum = sum + 9; } - assertequal(sum, 99+9, "only one") + assertequal(sum, 99 + 9, "only one"); - sum = 0 + sum = 0; for i := 0; i <= 10; i++ { - if i%2 == 0 { - continue + if i % 2 == 0 { + continue; } - sum = sum + i + sum = sum + i; } - assertequal(sum, 1+3+5+7+9, "continue") + assertequal(sum, 1+3+5+7+9, "continue"); } diff --git a/test/ken/robfunc.go b/test/ken/robfunc.go index 6a417c073f..885267e30c 100644 --- a/test/ken/robfunc.go +++ b/test/ken/robfunc.go @@ -41,6 +41,7 @@ func f7(a int) (x int, y float64) { return 7, 7.0 } + func f8(a int) (x int, y float64) { return 8, 8.0 } @@ -53,12 +54,14 @@ func (t *T) m10(a int, b float64) int { return (t.x + a) * (t.y + int(b)) } + func f9(a int) (in int, fl float64) { i := 9 f := float64(9) return i, f } + func main() { f1() f2(1) diff --git a/test/ken/shift.go b/test/ken/shift.go index 895e7e90aa..af8789615e 100644 --- a/test/ken/shift.go +++ b/test/ken/shift.go @@ -8,122 +8,114 @@ package main -var ians [18]int -var uans [18]uint -var pass string +var ians [18]int; +var uans [18]uint; +var pass string; -func testi(i int, t1, t2, t3 int) { - n := ((t1*3)+t2)*2 + t3 +func +testi(i int, t1,t2,t3 int) { + n := ((t1*3) + t2)*2 + t3; if i != ians[n] { - print("itest ", t1, t2, t3, pass, - " is ", i, " sb ", ians[n], "\n") + print("itest ", t1,t2,t3,pass, + " is ", i, " sb ", ians[n], "\n"); } } -func index(t1, t2, t3 int) int { - return ((t1*3)+t2)*2 + t3 +func +index(t1,t2,t3 int) int { + return ((t1*3) + t2)*2 + t3; } -func testu(u uint, t1, t2, t3 int) { - n := index(t1, t2, t3) +func +testu(u uint, t1,t2,t3 int) { + n := index(t1,t2,t3); if u != uans[n] { - print("utest ", t1, t2, t3, pass, - " is ", u, " sb ", uans[n], "\n") + print("utest ", t1,t2,t3,pass, + " is ", u, " sb ", uans[n], "\n"); } } -func main() { - var i int - var u, c uint +func +main() { + var i int; + var u,c uint; /* * test constant evaluations */ - pass = "con" // constant part + pass = "con"; // constant part - testi(int(1234)<<0, 0, 0, 0) - testi(int(1234)>>0, 0, 0, 1) - testi(int(1234)<<5, 0, 1, 0) - testi(int(1234)>>5, 0, 1, 1) + testi( int(1234) << 0, 0,0,0); + testi( int(1234) >> 0, 0,0,1); + testi( int(1234) << 5, 0,1,0); + testi( int(1234) >> 5, 0,1,1); - testi(int(-1234)<<0, 1, 0, 0) - testi(int(-1234)>>0, 1, 0, 1) - testi(int(-1234)<<5, 1, 1, 0) - testi(int(-1234)>>5, 1, 1, 1) + testi(int(-1234) << 0, 1,0,0); + testi(int(-1234) >> 0, 1,0,1); + testi(int(-1234) << 5, 1,1,0); + testi(int(-1234) >> 5, 1,1,1); - testu(uint(5678)<<0, 2, 0, 0) - testu(uint(5678)>>0, 2, 0, 1) - testu(uint(5678)<<5, 2, 1, 0) - testu(uint(5678)>>5, 2, 1, 1) + testu(uint(5678) << 0, 2,0,0); + testu(uint(5678) >> 0, 2,0,1); + testu(uint(5678) << 5, 2,1,0); + testu(uint(5678) >> 5, 2,1,1); /* * test variable evaluations */ - pass = "var" // variable part - - for t1 := 0; t1 < 3; t1++ { // +int, -int, uint - for t2 := 0; t2 < 3; t2++ { // 0, +small, +large - for t3 := 0; t3 < 2; t3++ { // <<, >> - switch t1 { - case 0: - i = 1234 - case 1: - i = -1234 - case 2: - u = 5678 - } - switch t2 { - case 0: - c = 0 - case 1: - c = 5 - case 2: - c = 1025 - } - switch t3 { - case 0: - i <<= c - u <<= c - case 1: - i >>= c - u >>= c - } - switch t1 { - case 0: - testi(i, t1, t2, t3) - case 1: - testi(i, t1, t2, t3) - case 2: - testu(u, t1, t2, t3) - } - } + pass = "var"; // variable part + + for t1:=0; t1<3; t1++ { // +int, -int, uint + for t2:=0; t2<3; t2++ { // 0, +small, +large + for t3:=0; t3<2; t3++ { // <<, >> + switch t1 { + case 0: i = 1234; + case 1: i = -1234; + case 2: u = 5678; } + switch t2 { + case 0: c = 0; + case 1: c = 5; + case 2: c = 1025; + } + switch t3 { + case 0: i <<= c; u <<= c; + case 1: i >>= c; u >>= c; + } + switch t1 { + case 0: testi(i,t1,t2,t3); + case 1: testi(i,t1,t2,t3); + case 2: testu(u,t1,t2,t3); + } + } + } } } -func init() { +func +init() { /* * set the 'correct' answer */ - ians[index(0, 0, 0)] = 1234 - ians[index(0, 0, 1)] = 1234 - ians[index(0, 1, 0)] = 39488 - ians[index(0, 1, 1)] = 38 - ians[index(0, 2, 0)] = 0 - ians[index(0, 2, 1)] = 0 - - ians[index(1, 0, 0)] = -1234 - ians[index(1, 0, 1)] = -1234 - ians[index(1, 1, 0)] = -39488 - ians[index(1, 1, 1)] = -39 - ians[index(1, 2, 0)] = 0 - ians[index(1, 2, 1)] = -1 - - uans[index(2, 0, 0)] = 5678 - uans[index(2, 0, 1)] = 5678 - uans[index(2, 1, 0)] = 181696 - uans[index(2, 1, 1)] = 177 - uans[index(2, 2, 0)] = 0 - uans[index(2, 2, 1)] = 0 + ians[index(0,0,0)] = 1234; + ians[index(0,0,1)] = 1234; + ians[index(0,1,0)] = 39488; + ians[index(0,1,1)] = 38; + ians[index(0,2,0)] = 0; + ians[index(0,2,1)] = 0; + + ians[index(1,0,0)] = -1234; + ians[index(1,0,1)] = -1234; + ians[index(1,1,0)] = -39488; + ians[index(1,1,1)] = -39; + ians[index(1,2,0)] = 0; + ians[index(1,2,1)] = -1; + + uans[index(2,0,0)] = 5678; + uans[index(2,0,1)] = 5678; + uans[index(2,1,0)] = 181696; + uans[index(2,1,1)] = 177; + uans[index(2,2,0)] = 0; + uans[index(2,2,1)] = 0; } diff --git a/test/ken/simparray.go b/test/ken/simparray.go index 51bbeaae83..0e81a341b8 100644 --- a/test/ken/simparray.go +++ b/test/ken/simparray.go @@ -8,48 +8,43 @@ package main -var b [10]float32 +var b[10] float32; -func main() { - var a [10]float32 +func +main() { + var a[10] float32; - for i := int16(5); i < 10; i = i + 1 { - a[i] = float32(i) + for i:=int16(5); i<10; i=i+1 { + a[i] = float32(i); } - s1 := float32(0) - for i := 5; i < 10; i = i + 1 { - s1 = s1 + a[i] + s1 := float32(0); + for i:=5; i<10; i=i+1 { + s1 = s1 + a[i]; } - if s1 != 35 { - panic(s1) - } + if s1 != 35 { panic(s1); } - for i := int16(5); i < 10; i = i + 1 { - b[i] = float32(i) + for i:=int16(5); i<10; i=i+1 { + b[i] = float32(i); } - s2 := float32(0) - for i := 5; i < 10; i = i + 1 { - s2 = s2 + b[i] + s2 := float32(0); + for i:=5; i<10; i=i+1 { + s2 = s2 + b[i]; } - if s2 != 35 { - panic(s2) - } + if s2 != 35 { panic(s2); } - b := new([100]int) - for i := 0; i < 100; i = i + 1 { - b[i] = i + b := new([100]int); + for i:=0; i<100; i=i+1 { + b[i] = i; } - s3 := 0 - for i := 0; i < 100; i = i + 1 { - s3 = s3 + b[i] + s3 := 0; + for i:=0; i<100; i=i+1 { + s3 = s3+b[i]; } - if s3 != 4950 { - panic(s3) - } + if s3 != 4950 { panic(s3); } } diff --git a/test/ken/simpbool.go b/test/ken/simpbool.go index 25c10cfcfe..ab2ecc21aa 100644 --- a/test/ken/simpbool.go +++ b/test/ken/simpbool.go @@ -9,186 +9,99 @@ package main type s struct { - a bool - b bool + a bool; + b bool; } -func main() { - var a, b bool - - a = true - b = false - - if !a { - panic(1) - } - if b { - panic(2) - } - if !!!a { - panic(3) - } - if !!b { - panic(4) - } - - a = !b - if !a { - panic(5) - } - if !!!a { - panic(6) - } - - var x *s - x = new(s) - x.a = true - x.b = false - - if !x.a { - panic(7) - } - if x.b { - panic(8) - } - if !!!x.a { - panic(9) - } - if !!x.b { - panic(10) - } - - x.a = !x.b - if !x.a { - panic(11) - } - if !!!x.a { - panic(12) - } +func +main() { + var a,b bool; + + a = true; + b = false; + + if !a { panic(1); } + if b { panic(2); } + if !!!a { panic(3); } + if !!b { panic(4); } + + a = !b; + if !a { panic(5); } + if !!!a { panic(6); } + + var x *s; + x = new(s); + x.a = true; + x.b = false; + + if !x.a { panic(7); } + if x.b { panic(8); } + if !!!x.a { panic(9); } + if !!x.b { panic(10); } + + x.a = !x.b; + if !x.a { panic(11); } + if !!!x.a { panic(12); } /* * test && */ - a = true - b = true - if !(a && b) { - panic(21) - } - if a && !b { - panic(22) - } - if !a && b { - panic(23) - } - if !a && !b { - panic(24) - } - - a = false - b = true - if !(!a && b) { - panic(31) - } - if !a && !b { - panic(32) - } - if a && b { - panic(33) - } - if a && !b { - panic(34) - } - - a = true - b = false - if !(a && !b) { - panic(41) - } - if a && b { - panic(41) - } - if !a && !b { - panic(41) - } - if !a && b { - panic(44) - } - - a = false - b = false - if !(!a && !b) { - panic(51) - } - if !a && b { - panic(52) - } - if a && !b { - panic(53) - } - if a && b { - panic(54) - } + a = true; + b = true; + if !(a && b) { panic(21); } + if a && !b { panic(22); } + if !a && b { panic(23); } + if !a && !b { panic(24); } + + a = false; + b = true; + if !(!a && b) { panic(31); } + if !a && !b { panic(32); } + if a && b { panic(33); } + if a && !b { panic(34); } + + a = true; + b = false; + if !(a && !b) { panic(41); } + if a && b { panic(41); } + if !a && !b { panic(41); } + if !a && b { panic(44); } + + a = false; + b = false; + if !(!a && !b) { panic(51); } + if !a && b { panic(52); } + if a && !b { panic(53); } + if a && b { panic(54); } /* * test || */ - a = true - b = true - if !(a || b) { - panic(61) - } - if !(a || !b) { - panic(62) - } - if !(!a || b) { - panic(63) - } - if !a || !b { - panic(64) - } - - a = false - b = true - if !(!a || b) { - panic(71) - } - if !(!a || !b) { - panic(72) - } - if !(a || b) { - panic(73) - } - if a || !b { - panic(74) - } - - a = true - b = false - if !(a || !b) { - panic(81) - } - if !(a || b) { - panic(82) - } - if !(!a || !b) { - panic(83) - } - if !a || b { - panic(84) - } - - a = false - b = false - if !(!a || !b) { - panic(91) - } - if !(!a || b) { - panic(92) - } - if !(a || !b) { - panic(93) - } - if a || b { - panic(94) - } + a = true; + b = true; + if !(a || b) { panic(61); } + if !(a || !b) { panic(62); } + if !(!a || b) { panic(63); } + if !a || !b { panic(64); } + + a = false; + b = true; + if !(!a || b) { panic(71); } + if !(!a || !b) { panic(72); } + if !(a || b) { panic(73); } + if a || !b { panic(74); } + + a = true; + b = false; + if !(a || !b) { panic(81); } + if !(a || b) { panic(82); } + if !(!a || !b) { panic(83); } + if !a || b { panic(84); } + + a = false; + b = false; + if !(!a || !b) { panic(91); } + if !(!a || b) { panic(92); } + if !(a || !b) { panic(93); } + if a || b { panic(94); } } diff --git a/test/ken/simpfun.go b/test/ken/simpfun.go index 1d5534b9fa..e5dc2b2495 100644 --- a/test/ken/simpfun.go +++ b/test/ken/simpfun.go @@ -8,21 +8,19 @@ package main -func main() { - var x int +func +main() { + var x int; - x = fun(10, 20, 30) - if x != 60 { - panic(x) - } + x = fun(10,20,30); + if x != 60 { panic(x); } } -func fun(ia, ib, ic int) int { - var o int +func +fun(ia,ib,ic int)int { + var o int; - o = ia + ib + ic - if o != 60 { - panic(o) - } - return o + o = ia+ib+ic; + if o != 60 { panic(o); } + return o; } diff --git a/test/ken/simpvar.go b/test/ken/simpvar.go index 039d32c94e..c6eefbb5ad 100644 --- a/test/ken/simpvar.go +++ b/test/ken/simpvar.go @@ -6,22 +6,22 @@ // Test scoping of variables. + package main -var x, y int +var x,y int; -func main() { +func +main() { - x = 15 - y = 20 + x = 15; + y = 20; { - var x int - x = 25 - y = 25 - _ = x - } - x = x + y - if x != 40 { - panic(x) + var x int; + x = 25; + y = 25; + _ = x; } + x = x+y; + if(x != 40) { panic(x); } } diff --git a/test/ken/strvar.go b/test/ken/strvar.go index 826d796e01..4d511fe673 100644 --- a/test/ken/strvar.go +++ b/test/ken/strvar.go @@ -8,60 +8,40 @@ package main -type x2 struct { - a, b, c int - d int -} - -var g1 x2 -var g2 struct { - a, b, c int - d x2 -} - -func main() { - var x int - var s1 *x2 - var s2 *struct { - a, b, c int - d x2 - } - var s3 struct { - a, b, c int - d x2 - } - - s1 = &g1 - s2 = &g2 - - s1.a = 1 - s1.b = 2 - s1.c = 3 - s1.d = 5 - - if s1.c != 3 { - panic(s1.c) - } - if g1.c != 3 { - panic(g1.c) - } - - s2.a = 7 - s2.b = 11 - s2.c = 13 - s2.d.a = 17 - s2.d.b = 19 - s2.d.c = 23 - s2.d.d = 29 - - if s2.d.c != 23 { - panic(s2.d.c) - } - if g2.d.c != 23 { - panic(g2.d.c) - } - - x = s1.a + +type x2 struct { a,b,c int; d int; }; +var g1 x2; +var g2 struct { a,b,c int; d x2; }; + +func +main() { + var x int; + var s1 *x2; + var s2 *struct { a,b,c int; d x2; }; + var s3 struct { a,b,c int; d x2; }; + + s1 = &g1; + s2 = &g2; + + s1.a = 1; + s1.b = 2; + s1.c = 3; + s1.d = 5; + + if(s1.c != 3) { panic(s1.c); } + if(g1.c != 3) { panic(g1.c); } + + s2.a = 7; + s2.b = 11; + s2.c = 13; + s2.d.a = 17; + s2.d.b = 19; + s2.d.c = 23; + s2.d.d = 29; + + if(s2.d.c != 23) { panic(s2.d.c); } + if(g2.d.c != 23) { panic(g2.d.c); } + + x = s1.a + s1.b + s1.c + s1.d + @@ -72,34 +52,28 @@ func main() { s2.d.a + s2.d.b + s2.d.c + - s2.d.d + s2.d.d; - if x != 130 { - panic(x) - } + if(x != 130) { panic(x); } // test an automatic struct - s3.a = 7 - s3.b = 11 - s3.c = 13 - s3.d.a = 17 - s3.d.b = 19 - s3.d.c = 23 - s3.d.d = 29 - - if s3.d.c != 23 { - panic(s3.d.c) - } - - x = s3.a + + s3.a = 7; + s3.b = 11; + s3.c = 13; + s3.d.a = 17; + s3.d.b = 19; + s3.d.c = 23; + s3.d.d = 29; + + if(s3.d.c != 23) { panic(s3.d.c); } + + x = s3.a + s3.b + s3.c + s3.d.a + s3.d.b + s3.d.c + - s3.d.d + s3.d.d; - if x != 119 { - panic(x) - } + if(x != 119) { panic(x); } } diff --git a/test/literal2.go b/test/literal2.go index 064d47f726..f552e33ada 100644 --- a/test/literal2.go +++ b/test/literal2.go @@ -31,8 +31,8 @@ func main() { assert(0_1 == 01) assert(012 == 012) assert(0_1_2 == 012) - assert(1_2i == complex(0, 12)) // decimal digits despite leading 0 for backward-compatibility - assert(89i == complex(0, 89)) // decimal digits despite leading 0 for backward-compatibility + assert(0_1_2i == complex(0, 12)) // decimal digits despite leading 0 for backward-compatibility + assert(00089i == complex(0, 89)) // decimal digits despite leading 0 for backward-compatibility // decimals assert(1_000_000 == 1000000) diff --git a/test/live1.go b/test/live1.go index 3d37b9ec53..87c8c97c41 100644 --- a/test/live1.go +++ b/test/live1.go @@ -43,3 +43,4 @@ func f1(pkg, typ, meth string) { func f2() interface{} { return new(int) } + diff --git a/test/live_syscall.go b/test/live_syscall.go index 1f9a2c2668..2d1ef14de7 100644 --- a/test/live_syscall.go +++ b/test/live_syscall.go @@ -30,7 +30,7 @@ func h() { // ERROR "can inline h" func i() { // ERROR "can inline i" var t int p := unsafe.Pointer(&t) - f(uintptr(p)) // ERROR "live at call to f: .?autotmp" "stack object .autotmp_[0-9]+ unsafe.Pointer$" + f(uintptr(p)) // ERROR "live at call to f: .?autotmp" "stack object .autotmp_[0-9]+ unsafe.Pointer$" } func j() { // ERROR "can inline j" diff --git a/test/map1.go b/test/map1.go index 91589a7c48..498c2ec45b 100644 --- a/test/map1.go +++ b/test/map1.go @@ -39,10 +39,10 @@ var ( _ map[[]int]v // ERROR "invalid map key" _ map[func()]v // ERROR "invalid map key" _ map[map[int]int]v // ERROR "invalid map key" - _ map[T1]v // ERROR "invalid map key" - _ map[T2]v // ERROR "invalid map key" - _ map[T3]v // ERROR "invalid map key" - _ map[T4]v // ERROR "invalid map key" + _ map[T1]v // ERROR "invalid map key" + _ map[T2]v // ERROR "invalid map key" + _ map[T3]v // ERROR "invalid map key" + _ map[T4]v // ERROR "invalid map key" _ map[T5]v _ map[T6]v _ map[T7]v @@ -50,14 +50,14 @@ var ( ) type T1 []int -type T2 struct{ F T1 } +type T2 struct { F T1 } type T3 []T4 -type T4 struct{ F T3 } +type T4 struct { F T3 } type T5 *int -type T6 struct{ F T5 } +type T6 struct { F T5 } type T7 *T4 -type T8 struct{ F *T7 } +type T8 struct { F *T7 } func main() { m := make(map[int]int) @@ -65,4 +65,4 @@ func main() { delete(m) // ERROR "missing second \(key\) argument" delete(m, 2, 3) // ERROR "too many arguments" delete(1, m) // ERROR "first argument to delete must be map" -} +} \ No newline at end of file diff --git a/test/method5.go b/test/method5.go index e48baf4ccc..d87bb6f5b2 100644 --- a/test/method5.go +++ b/test/method5.go @@ -16,53 +16,53 @@ type Tinter interface { type Tsmallv byte -func (v Tsmallv) M(x int, b byte) (byte, int) { return b, x + int(v) } +func (v Tsmallv) M(x int, b byte) (byte, int) { return b, x+int(v) } type Tsmallp byte -func (p *Tsmallp) M(x int, b byte) (byte, int) { return b, x + int(*p) } +func (p *Tsmallp) M(x int, b byte) (byte, int) { return b, x+int(*p) } type Twordv uintptr -func (v Twordv) M(x int, b byte) (byte, int) { return b, x + int(v) } +func (v Twordv) M(x int, b byte) (byte, int) { return b, x+int(v) } type Twordp uintptr -func (p *Twordp) M(x int, b byte) (byte, int) { return b, x + int(*p) } +func (p *Twordp) M(x int, b byte) (byte, int) { return b, x+int(*p) } type Tbigv [2]uintptr -func (v Tbigv) M(x int, b byte) (byte, int) { return b, x + int(v[0]) + int(v[1]) } +func (v Tbigv) M(x int, b byte) (byte, int) { return b, x+int(v[0])+int(v[1]) } type Tbigp [2]uintptr -func (p *Tbigp) M(x int, b byte) (byte, int) { return b, x + int(p[0]) + int(p[1]) } +func (p *Tbigp) M(x int, b byte) (byte, int) { return b, x+int(p[0])+int(p[1]) } // Again, with an unexported method. type tsmallv byte -func (v tsmallv) m(x int, b byte) (byte, int) { return b, x + int(v) } +func (v tsmallv) m(x int, b byte) (byte, int) { return b, x+int(v) } type tsmallp byte -func (p *tsmallp) m(x int, b byte) (byte, int) { return b, x + int(*p) } +func (p *tsmallp) m(x int, b byte) (byte, int) { return b, x+int(*p) } type twordv uintptr -func (v twordv) m(x int, b byte) (byte, int) { return b, x + int(v) } +func (v twordv) m(x int, b byte) (byte, int) { return b, x+int(v) } type twordp uintptr -func (p *twordp) m(x int, b byte) (byte, int) { return b, x + int(*p) } +func (p *twordp) m(x int, b byte) (byte, int) { return b, x+int(*p) } type tbigv [2]uintptr -func (v tbigv) m(x int, b byte) (byte, int) { return b, x + int(v[0]) + int(v[1]) } +func (v tbigv) m(x int, b byte) (byte, int) { return b, x+int(v[0])+int(v[1]) } type tbigp [2]uintptr -func (p *tbigp) m(x int, b byte) (byte, int) { return b, x + int(p[0]) + int(p[1]) } +func (p *tbigp) m(x int, b byte) (byte, int) { return b, x+int(p[0])+int(p[1]) } type tinter interface { m(int, byte) (byte, int) @@ -85,7 +85,7 @@ type T3 struct { type T4 struct { } -func (t4 T4) M(x int, b byte) (byte, int) { return b, x + 40 } +func (t4 T4) M(x int, b byte) (byte, int) { return b, x+40 } var failed = false @@ -95,7 +95,7 @@ func CheckI(name string, i Tinter, inc int) { failed = true print(name, ".M(1000, 99) = ", b, ", ", x, " want 99, ", 1000+inc, "\n") } - + CheckF("(i="+name+")", i.M, inc) } @@ -113,7 +113,7 @@ func checkI(name string, i tinter, inc int) { failed = true print(name, ".m(1000, 99) = ", b, ", ", x, " want 99, ", 1000+inc, "\n") } - + checkF("(i="+name+")", i.m, inc) } @@ -183,8 +183,8 @@ func main() { CheckI("pbv", pbv, 11) CheckF("pbv.M", pbv.M, 11) CheckF("(*pbv).M", (*pbv).M, 11) - - bp := Tbigp([2]uintptr{7, 8}) + + bp := Tbigp([2]uintptr{7,8}) CheckI("&bp", &bp, 15) CheckF("bp.M", bp.M, 15) CheckF("(&bp).M", (&bp).M, 15) @@ -237,8 +237,8 @@ func main() { checkI("_pbv", _pbv, 11) checkF("_pbv.m", _pbv.m, 11) checkF("(*_pbv).m", (*_pbv).m, 11) - - _bp := tbigp([2]uintptr{7, 8}) + + _bp := tbigp([2]uintptr{7,8}) checkI("&_bp", &_bp, 15) checkF("_bp.m", _bp.m, 15) checkF("(&_bp).m", (&_bp).m, 15) @@ -246,7 +246,7 @@ func main() { checkI("_pbp", _pbp, 15) checkF("_pbp.m", _pbp.m, 15) checkF("(*_pbp).m", (*_pbp).m, 15) - + t4 := T4{} t3 := T3{&t4} t2 := T2{&t3} @@ -259,7 +259,7 @@ func main() { CheckI("&t2", &t2, 40) CheckI("t1", t1, 40) CheckI("&t1", &t1, 40) - + // x.M panics if x is an interface type and is nil, // or if x.M expands to (*x).M where x is nil, // or if x.M expands to x.y.z.w.M where something @@ -281,7 +281,7 @@ func main() { if f != nil { panic("something set f") } - + // x.M does not panic if x is a nil pointer and // M is a method with a pointer receiver. shouldNotPanic(func() { psp = nil; f = psp.M }) diff --git a/test/named.go b/test/named.go index 60a88c542b..9763c76bfd 100644 --- a/test/named.go +++ b/test/named.go @@ -31,6 +31,7 @@ func asString(String) {} func (Map) M() {} + // These functions check at run time that the default type // (in the absence of any implicit conversion hints) // is the given type. diff --git a/test/nilptr2.go b/test/nilptr2.go index 8e3be659bb..8a85b6dbcb 100644 --- a/test/nilptr2.go +++ b/test/nilptr2.go @@ -27,7 +27,7 @@ func main() { var intp *int var slicep *[]byte var a10p *[10]int -var a10Mp *[1 << 20]int +var a10Mp *[1<<20]int var structp *Struct var bigstructp *BigStruct var i int @@ -41,9 +41,9 @@ func use(x interface{}) { V = x } -var tests = []struct { +var tests = []struct{ name string - fn func() + fn func() }{ // Edit .+1,/^}/s/^[^ ].+/ {"&", func() { println(&) }},\n {"\&&", func() { println(\&&) }},/g {"*intp", func() { println(*intp) }}, @@ -112,14 +112,14 @@ type BigStruct struct { i int j float64 k string - x [128 << 20]byte + x [128<<20]byte l []byte } type M struct { } -func (m *M) F() int { return 0 } +func (m *M) F() int {return 0} type M1 struct { M diff --git a/test/oldescape2.go b/test/oldescape2.go index fc686cb921..864a956164 100644 --- a/test/oldescape2.go +++ b/test/oldescape2.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1535,7 +1535,7 @@ func NewV(u U) *V { // ERROR "leaking param: u to result ~r1 level=-1" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1643,7 +1643,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/oldescape2n.go b/test/oldescape2n.go index a9edec5f92..fb2a956618 100644 --- a/test/oldescape2n.go +++ b/test/oldescape2n.go @@ -146,13 +146,13 @@ func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b to result ~r0 level=0$ } func (b Bar) LeaksToo() *int { // ERROR "leaking param: b to result ~r0 level=0$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } func (b *Bar) LeaksABit() *int { // ERROR "leaking param: b to result ~r0 level=1$" - v := 0 // ERROR "moved to heap: v$" + v := 0 // ERROR "moved to heap: v$" b.ii = &v return b.ii } @@ -522,7 +522,7 @@ func foo72a() { var y [10]*int for i := 0; i < 10; i++ { // escapes its scope - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return @@ -531,7 +531,7 @@ func foo72a() { func foo72b() [10]*int { var y [10]*int for i := 0; i < 10; i++ { - x := i // ERROR "moved to heap: x$" + x := i // ERROR "moved to heap: x$" y[i] = &x } return y @@ -739,11 +739,11 @@ func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param: p to resul func noop(x, y *int) {} // ERROR "noop x does not escape$" "noop y does not escape$" func foo82() { - var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" + var x, y, z int // ERROR "moved to heap: x$" "moved to heap: y$" "moved to heap: z$" go noop(tee(&z)) go noop(&x, &y) for { - var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" + var u, v, w int // ERROR "moved to heap: u$" "moved to heap: v$" "moved to heap: w$" defer noop(tee(&u)) defer noop(&v, &w) } @@ -916,10 +916,10 @@ func foo115(x *int) *int { // ERROR "leaking param: x to result ~r1 level=0$" func foo116(b bool) *int { if b { - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" return &x } else { - y := 1 // ERROR "moved to heap: y$" + y := 1 // ERROR "moved to heap: y$" return &y } return nil @@ -931,7 +931,7 @@ func foo117(unknown func(interface{})) { // ERROR "foo117 unknown does not escap } func foo118(unknown func(*int)) { // ERROR "foo118 unknown does not escape$" - x := 1 // ERROR "moved to heap: x$" + x := 1 // ERROR "moved to heap: x$" unknown(&x) } @@ -1185,7 +1185,7 @@ L1: func foo124(x **int) { // ERROR "foo124 x does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo124 func literal does not escape$" + func() { // ERROR "foo124 func literal does not escape$" *x = p }() } @@ -1193,7 +1193,7 @@ func foo124(x **int) { // ERROR "foo124 x does not escape$" func foo125(ch chan *int) { // ERROR "foo125 ch does not escape$" var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo125 func literal does not escape$" + func() { // ERROR "foo125 func literal does not escape$" ch <- p }() } @@ -1229,7 +1229,7 @@ func foo128() { func foo129() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo129 func literal does not escape$" + func() { // ERROR "foo129 func literal does not escape$" q := p func() { // ERROR "foo129.func1 func literal does not escape$" r := q @@ -1281,7 +1281,7 @@ func foo134() { } func foo135() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1293,7 +1293,7 @@ func foo135() { } func foo136() { - var i int // ERROR "moved to heap: i$" + var i int // ERROR "moved to heap: i$" p := &i go func() { // ERROR "func literal escapes to heap$" q := p @@ -1307,7 +1307,7 @@ func foo136() { func foo137() { var i int // ERROR "moved to heap: i$" p := &i - func() { // ERROR "foo137 func literal does not escape$" + func() { // ERROR "foo137 func literal does not escape$" q := p go func() { // ERROR "func literal escapes to heap$" r := q @@ -1320,7 +1320,7 @@ func foo138() *byte { type T struct { x [1]byte } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x[0] } @@ -1330,7 +1330,7 @@ func foo139() *byte { y byte } } - t := new(T) // ERROR "new\(T\) escapes to heap$" + t := new(T) // ERROR "new\(T\) escapes to heap$" return &t.x.y } @@ -1498,7 +1498,7 @@ func bar151() { } func bar151b() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8][0]) } @@ -1510,7 +1510,7 @@ func bar151c() { } func bar151d() { - var a [10]int // ERROR "moved to heap: a$" + var a [10]int // ERROR "moved to heap: a$" b := a[:] foo151(&b[4:8:8][0]) } @@ -1535,7 +1535,7 @@ func NewV(u U) *V { // ERROR "leaking param: u to result ~r1 level=-1" } func foo152() { - a := "a" // ERROR "moved to heap: a$" + a := "a" // ERROR "moved to heap: a$" u := U{&a} v := NewV(u) println(v) @@ -1643,7 +1643,7 @@ type StructWithString struct { // to just x, and thus &i looks escaping. func fieldFlowTracking() { var x StructWithString - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x.p = &i sink = x.s // ERROR "x.s escapes to heap$" } diff --git a/test/oldescape5.go b/test/oldescape5.go index 972b9ed8a8..53d0ff801d 100644 --- a/test/oldescape5.go +++ b/test/oldescape5.go @@ -71,13 +71,13 @@ func f2() { } func f3() { - var x int // ERROR "moved to heap: x" + var x int // ERROR "moved to heap: x" p := leaktoret(&x) gp = p } func f4() { - var x int // ERROR "moved to heap: x" + var x int // ERROR "moved to heap: x" p, q := leaktoret2(&x) gp = p gp = q @@ -89,7 +89,7 @@ func f5() { } func f6() { - var x int // ERROR "moved to heap: x" + var x int // ERROR "moved to heap: x" px1, px2 := leaktoret22(leaktoret2(&x)) gp = px1 _ = px2 diff --git a/test/oldescape_field.go b/test/oldescape_field.go index 09f1ea7758..e4213aaf59 100644 --- a/test/oldescape_field.go +++ b/test/oldescape_field.go @@ -39,7 +39,7 @@ func field3() { i := 0 // ERROR "moved to heap: i$" var x X x.p1 = &i - sink = x // ERROR "x escapes to heap" + sink = x // ERROR "x escapes to heap" } func field4() { @@ -113,16 +113,16 @@ func field10() { } func field11() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" x := X{p1: &i} - sink = x.p1 // ERROR "x\.p1 escapes to heap" + sink = x.p1 // ERROR "x\.p1 escapes to heap" } func field12() { i := 0 // ERROR "moved to heap: i$" // BAD: &i should not escape x := X{p1: &i} - sink = x.p2 // ERROR "x\.p2 escapes to heap" + sink = x.p2 // ERROR "x\.p2 escapes to heap" } func field13() { diff --git a/test/oldescape_iface.go b/test/oldescape_iface.go index ca5aa1187f..88502df99b 100644 --- a/test/oldescape_iface.go +++ b/test/oldescape_iface.go @@ -37,7 +37,7 @@ func efaceEscape0() { _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" sink = x // ERROR "x escapes to heap" @@ -50,7 +50,7 @@ func efaceEscape0() { _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" @@ -58,14 +58,14 @@ func efaceEscape0() { sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M0{&i} var x M = v // ERROR "v escapes to heap" mescapes(x) @@ -91,24 +91,24 @@ func efaceEscape1() { { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" _ = x } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" - sink = x // ERROR "x escapes to heap" + var x M = v // ERROR "v escapes to heap" + sink = x // ERROR "x escapes to heap" } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" v1 := x.(M1) _ = v1 } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" @@ -116,22 +116,22 @@ func efaceEscape1() { sink = v1 // ERROR "v1 escapes to heap" } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} // BAD: v does not escape to heap here var x M = v // ERROR "v escapes to heap" x.M() } { - i := 0 // ERROR "moved to heap: i" + i := 0 // ERROR "moved to heap: i" v := M1{&i, 0} - var x M = v // ERROR "v escapes to heap" + var x M = v // ERROR "v escapes to heap" mescapes(x) } { i := 0 v := M1{&i, 0} - var x M = v // ERROR "v does not escape" + var x M = v // ERROR "v does not escape" mdoesnotescape(x) } } @@ -245,7 +245,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = i // ERROR "i does not escape" var y interface{} = j // ERROR "j does not escape" - sink = x.(int) // ERROR "x.\(int\) escapes to heap" + sink = x.(int) // ERROR "x.\(int\) escapes to heap" sink, *(&ok) = y.(int) } { @@ -255,7 +255,7 @@ func dotTypeEscape2() { // #13805, #15796 var x interface{} = &i // ERROR "&i escapes to heap" var y interface{} = &j // ERROR "&j escapes to heap" - sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" + sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap" sink, *(&ok) = y.(*int) } } diff --git a/test/oldescape_param.go b/test/oldescape_param.go index cf85d745cb..3a3eee2a5b 100644 --- a/test/oldescape_param.go +++ b/test/oldescape_param.go @@ -57,7 +57,7 @@ func caller2b() { i := 0 // ERROR "moved to heap: i$" var p *int param2(&i, &p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } func paramArraySelfAssign(p *PairOfPairs) { // ERROR "p does not escape" @@ -150,11 +150,11 @@ func caller3a() { } func caller3b() { - i := 0 // ERROR "moved to heap: i$" - j := 0 // ERROR "moved to heap: j$" + i := 0 // ERROR "moved to heap: i$" + j := 0 // ERROR "moved to heap: j$" p := Pair{&i, &j} param3(&p) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> rcvr @@ -173,7 +173,7 @@ func caller4b() { i := 0 // ERROR "moved to heap: i$" p := Pair{} p.param4(&i) - sink = p // ERROR "p escapes to heap$" + sink = p // ERROR "p escapes to heap$" } // in -> heap @@ -182,7 +182,7 @@ func param5(i *int) { // ERROR "leaking param: i$" } func caller5() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" param5(&i) } @@ -192,8 +192,8 @@ func param6(i ***int) { // ERROR "leaking param content: i$" } func caller6a() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param6(&p2) } @@ -204,8 +204,8 @@ func param7(i ***int) { // ERROR "leaking param content: i$" } func caller7() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p param7(&p2) } @@ -234,8 +234,8 @@ func caller9a() { } func caller9b() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p$" p2 := &p sink = param9(&p2) // ERROR "param9\(&p2\) escapes to heap" } @@ -253,7 +253,7 @@ func caller10a() { } func caller10b() { - i := 0 // ERROR "moved to heap: i$" + i := 0 // ERROR "moved to heap: i$" p := &i p2 := &p sink = param10(&p2) // ERROR "param10\(&p2\) escapes to heap" @@ -265,8 +265,8 @@ func param11(i **int) ***int { // ERROR "moved to heap: i$" } func caller11a() { - i := 0 // ERROR "moved to heap: i" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i" + p := &i // ERROR "moved to heap: p" _ = param11(&p) } @@ -283,8 +283,8 @@ func caller11c() { // GOOD } func caller11d() { - i := 0 // ERROR "moved to heap: i$" - p := &i // ERROR "moved to heap: p" + i := 0 // ERROR "moved to heap: i$" + p := &i // ERROR "moved to heap: p" p2 := &p sink = param11(p2) // ERROR "param11\(p2\) escapes to heap" } @@ -319,7 +319,7 @@ func caller12c() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = r // ERROR "r escapes to heap$" + sink = r // ERROR "r escapes to heap$" } func caller12d() { @@ -327,7 +327,7 @@ func caller12d() { p := &i // ERROR "moved to heap: p$" r := Indir{} r.param12(&p) - sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" + sink = **r.p // ERROR "\* \(\*r\.p\) escapes to heap" } // in -> value rcvr @@ -370,15 +370,15 @@ func caller13d() { var v Val v.p = &p v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13e() { - i := 0 // ERROR "moved to heap: i$" - var p *int // ERROR "moved to heap: p$" + i := 0 // ERROR "moved to heap: i$" + var p *int // ERROR "moved to heap: p$" v := Val{&p} v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13f() { @@ -386,7 +386,7 @@ func caller13f() { var p *int // ERROR "moved to heap: p$" v := &Val{&p} // ERROR "&Val literal escapes to heap$" v.param13(&i) - sink = v // ERROR "v escapes to heap$" + sink = v // ERROR "v escapes to heap$" } func caller13g() { @@ -394,7 +394,7 @@ func caller13g() { var p *int v := Val{&p} v.param13(&i) - sink = *v.p // ERROR "\*v\.p escapes to heap" + sink = *v.p // ERROR "\*v\.p escapes to heap" } func caller13h() { @@ -402,7 +402,7 @@ func caller13h() { var p *int v := &Val{&p} // ERROR "caller13h &Val literal does not escape$" v.param13(&i) - sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" + sink = **v.p // ERROR "\* \(\*v\.p\) escapes to heap" } type Node struct { diff --git a/test/parentype.go b/test/parentype.go index d7881129c5..eafa076481 100644 --- a/test/parentype.go +++ b/test/parentype.go @@ -11,9 +11,9 @@ package main func f(interface{}) func g() {} func main() { - f(map[string]string{"a": "b", "c": "d"}) - f([...]int{1, 2, 3}) - f(map[string]func(){"a": g, "c": g}) - f(make(chan (<-chan int))) - f(make(chan<- (chan int))) + f(map[string]string{"a":"b","c":"d"}) + f([...]int{1,2,3}) + f(map[string]func(){"a":g,"c":g}) + f(make(chan(<-chan int))) + f(make(chan<-(chan int))) } diff --git a/test/printbig.go b/test/printbig.go index a4af1fc9e1..9e08c39adc 100644 --- a/test/printbig.go +++ b/test/printbig.go @@ -9,6 +9,6 @@ package main func main() { - print(-(1 << 63), "\n") + print(-(1<<63), "\n") print((1<<63)-1, "\n") } diff --git a/test/recover1.go b/test/recover1.go index 7e7c2c5968..c14a607c6b 100644 --- a/test/recover1.go +++ b/test/recover1.go @@ -22,21 +22,21 @@ func main() { } func die() { - runtime.Breakpoint() // can't depend on panic + runtime.Breakpoint() // can't depend on panic } func mustRecover(x interface{}) { - mustNotRecover() // because it's not a defer call + mustNotRecover() // because it's not a defer call v := recover() if v == nil { println("missing recover") - die() // panic is useless here + die() // panic is useless here } if v != x { println("wrong value", v, x) die() } - + // the value should be gone now regardless v = recover() if v != nil { @@ -54,7 +54,7 @@ func mustNotRecover() { } func withoutRecover() { - mustNotRecover() // because it's a sub-call + mustNotRecover() // because it's a sub-call } func test1() { @@ -116,7 +116,7 @@ func test6() { // Like test3, but changed recover to defer (same change as test4 → test5). defer mustNotRecover() defer func() { - defer recover() // like a normal call from this func; runs because mustRecover stops the panic + defer recover() // like a normal call from this func; runs because mustRecover stops the panic defer mustRecover(3) panic(3) }() @@ -134,7 +134,7 @@ func test7() { defer mustRecover(2) defer func() { defer mustRecover(3) - defer recover() // now a no-op, unlike in test6. + defer recover() // now a no-op, unlike in test6. panic(3) }() panic(2) diff --git a/test/return.go b/test/return.go index 20f648cf46..95f94b9276 100644 --- a/test/return.go +++ b/test/return.go @@ -151,31 +151,27 @@ func _() int { func _() int { print(1) return 2 - { - } + {} } // ERROR "missing return" func _() int { L: print(1) goto L - { - } + {} } // ERROR "missing return" func _() int { print(1) panic(2) - { - } + {} } // ERROR "missing return" func _() int { { print(1) return 2 - { - } + {} } } // ERROR "missing return" @@ -184,8 +180,7 @@ L: { print(1) goto L - { - } + {} } } // ERROR "missing return" @@ -193,8 +188,7 @@ func _() int { print(1) { panic(2) - { - } + {} } } // ERROR "missing return" @@ -203,8 +197,7 @@ func _() int { print(1) return 2 } - { - } + {} } // ERROR "missing return" func _() int { @@ -213,8 +206,7 @@ L: print(1) goto L } - { - } + {} } // ERROR "missing return" func _() int { @@ -222,8 +214,7 @@ func _() int { { panic(2) } - { - } + {} } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -291,12 +282,12 @@ func _() int { } } // ERROR "missing return" + // for { loops that never break are okay. func _() int { print(1) - for { - } + for {} } func _() int { @@ -309,7 +300,7 @@ func _() int { func _() int { for { - L: + L: for { break L } @@ -320,9 +311,7 @@ func _() int { func _() int { print(1) - for { - break - } + for { break } } // ERROR "missing return" func _() int { @@ -346,8 +335,7 @@ L: func _() int { print(1) - for x == nil { - } + for x == nil {} } // ERROR "missing return" func _() int { @@ -360,17 +348,16 @@ func _() int { func _() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" func _() int { print(1) - for true { - } + for true {} } // ERROR "missing return" func _() int { @@ -383,7 +370,7 @@ func _() int { func _() int { for true { - L: + L: for { break L } @@ -394,7 +381,7 @@ func _() int { func _() int { print(1) - select {} + select{} } func _() int { @@ -411,8 +398,7 @@ func _() int { select { case <-c: print(2) - for { - } + for{} } } @@ -436,7 +422,7 @@ func _() int { print(2) panic("abc") default: - select {} + select{} } } @@ -463,6 +449,7 @@ L: } } // ERROR "missing return" + func _() int { print(1) select { @@ -474,14 +461,12 @@ func _() int { } } // ERROR "missing return" + // if any breaks refer to the select, the select isn't okay anymore, even if they're dead func _() int { print(1) - select { - default: - break - } + select{ default: break } } // ERROR "missing return" func _() int { @@ -500,9 +485,7 @@ L: select { case <-c: print(2) - for { - break L - } + for{ break L } } } // ERROR "missing return" @@ -526,7 +509,7 @@ func _() int { print(1) panic("abc") default: - select {} + select{} break } } // ERROR "missing return" @@ -574,6 +557,7 @@ func _() int { } } // ERROR "missing return" + func _() int { print(1) switch x { @@ -689,6 +673,7 @@ func _() int { } } // ERROR "missing return" + func _() int { print(1) switch x.(type) { @@ -878,28 +863,24 @@ func _() int { func _() int { return 2 - { - } + {} } // ERROR "missing return" func _() int { L: goto L - { - } + {} } // ERROR "missing return" func _() int { panic(2) - { - } + {} } // ERROR "missing return" func _() int { { return 2 - { - } + {} } } // ERROR "missing return" @@ -907,16 +888,14 @@ func _() int { L: { goto L - { - } + {} } } // ERROR "missing return" func _() int { { panic(2) - { - } + {} } } // ERROR "missing return" @@ -924,8 +903,7 @@ func _() int { { return 2 } - { - } + {} } // ERROR "missing return" func _() int { @@ -933,16 +911,14 @@ L: { goto L } - { - } + {} } // ERROR "missing return" func _() int { { panic(2) } - { - } + {} } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -1004,11 +980,11 @@ func _() int { } } // ERROR "missing return" + // for { loops that never break are okay. func _() int { - for { - } + for {} } func _() int { @@ -1021,7 +997,7 @@ func _() int { func _() int { for { - L: + L: for { break L } @@ -1031,9 +1007,7 @@ func _() int { // for { loops that break are not okay. func _() int { - for { - break - } + for { break } } // ERROR "missing return" func _() int { @@ -1056,8 +1030,7 @@ L: // if there's a condition - even "true" - the loops are no longer syntactically terminating func _() int { - for x == nil { - } + for x == nil {} } // ERROR "missing return" func _() int { @@ -1070,16 +1043,15 @@ func _() int { func _() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" func _() int { - for true { - } + for true {} } // ERROR "missing return" func _() int { @@ -1092,7 +1064,7 @@ func _() int { func _() int { for true { - L: + L: for { break L } @@ -1102,7 +1074,7 @@ func _() int { // select in which all cases terminate and none break are okay. func _() int { - select {} + select{} } func _() int { @@ -1117,8 +1089,7 @@ func _() int { select { case <-c: print(2) - for { - } + for{} } } @@ -1140,7 +1111,7 @@ func _() int { print(2) panic("abc") default: - select {} + select{} } } @@ -1165,6 +1136,7 @@ L: } } // ERROR "missing return" + func _() int { select { case <-c: @@ -1175,13 +1147,11 @@ func _() int { } } // ERROR "missing return" + // if any breaks refer to the select, the select isn't okay anymore, even if they're dead func _() int { - select { - default: - break - } + select{ default: break } } // ERROR "missing return" func _() int { @@ -1198,9 +1168,7 @@ L: select { case <-c: print(2) - for { - break L - } + for{ break L } } } // ERROR "missing return" @@ -1221,7 +1189,7 @@ func _() int { case <-c: panic("abc") default: - select {} + select{} break } } // ERROR "missing return" @@ -1265,6 +1233,7 @@ func _() int { } } // ERROR "missing return" + func _() int { switch x { case 1: @@ -1370,6 +1339,7 @@ func _() int { } } // ERROR "missing return" + func _() int { switch x.(type) { case int: @@ -1583,31 +1553,27 @@ var _ = func() int { var _ = func() int { print(1) return 2 - { - } + {} } // ERROR "missing return" var _ = func() int { L: print(1) goto L - { - } + {} } // ERROR "missing return" var _ = func() int { print(1) panic(2) - { - } + {} } // ERROR "missing return" var _ = func() int { { print(1) return 2 - { - } + {} } } // ERROR "missing return" @@ -1616,8 +1582,7 @@ L: { print(1) goto L - { - } + {} } } // ERROR "missing return" @@ -1625,8 +1590,7 @@ var _ = func() int { print(1) { panic(2) - { - } + {} } } // ERROR "missing return" @@ -1635,8 +1599,7 @@ var _ = func() int { print(1) return 2 } - { - } + {} } // ERROR "missing return" var _ = func() int { @@ -1645,8 +1608,7 @@ L: print(1) goto L } - { - } + {} } // ERROR "missing return" var _ = func() int { @@ -1654,8 +1616,7 @@ var _ = func() int { { panic(2) } - { - } + {} } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -1723,12 +1684,12 @@ var _ = func() int { } } // ERROR "missing return" + // for { loops that never break are okay. var _ = func() int { print(1) - for { - } + for {} } var _ = func() int { @@ -1741,7 +1702,7 @@ var _ = func() int { var _ = func() int { for { - L: + L: for { break L } @@ -1752,9 +1713,7 @@ var _ = func() int { var _ = func() int { print(1) - for { - break - } + for { break } } // ERROR "missing return" var _ = func() int { @@ -1778,8 +1737,7 @@ L: var _ = func() int { print(1) - for x == nil { - } + for x == nil {} } // ERROR "missing return" var _ = func() int { @@ -1792,17 +1750,16 @@ var _ = func() int { var _ = func() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" var _ = func() int { print(1) - for true { - } + for true {} } // ERROR "missing return" var _ = func() int { @@ -1815,7 +1772,7 @@ var _ = func() int { var _ = func() int { for true { - L: + L: for { break L } @@ -1826,7 +1783,7 @@ var _ = func() int { var _ = func() int { print(1) - select {} + select{} } var _ = func() int { @@ -1843,8 +1800,7 @@ var _ = func() int { select { case <-c: print(2) - for { - } + for{} } } @@ -1868,7 +1824,7 @@ var _ = func() int { print(2) panic("abc") default: - select {} + select{} } } @@ -1895,6 +1851,7 @@ L: } } // ERROR "missing return" + var _ = func() int { print(1) select { @@ -1906,14 +1863,12 @@ var _ = func() int { } } // ERROR "missing return" + // if any breaks refer to the select, the select isn't okay anymore, even if they're dead var _ = func() int { print(1) - select { - default: - break - } + select{ default: break } } // ERROR "missing return" var _ = func() int { @@ -1932,9 +1887,7 @@ L: select { case <-c: print(2) - for { - break L - } + for{ break L } } } // ERROR "missing return" @@ -1958,7 +1911,7 @@ var _ = func() int { print(1) panic("abc") default: - select {} + select{} break } } // ERROR "missing return" @@ -2006,6 +1959,7 @@ var _ = func() int { } } // ERROR "missing return" + var _ = func() int { print(1) switch x { @@ -2121,6 +2075,7 @@ var _ = func() int { } } // ERROR "missing return" + var _ = func() int { print(1) switch x.(type) { @@ -2310,28 +2265,24 @@ var _ = func() int { var _ = func() int { return 2 - { - } + {} } // ERROR "missing return" var _ = func() int { L: goto L - { - } + {} } // ERROR "missing return" var _ = func() int { panic(2) - { - } + {} } // ERROR "missing return" var _ = func() int { { return 2 - { - } + {} } } // ERROR "missing return" @@ -2339,16 +2290,14 @@ var _ = func() int { L: { goto L - { - } + {} } } // ERROR "missing return" var _ = func() int { { panic(2) - { - } + {} } } // ERROR "missing return" @@ -2356,8 +2305,7 @@ var _ = func() int { { return 2 } - { - } + {} } // ERROR "missing return" var _ = func() int { @@ -2365,16 +2313,14 @@ L: { goto L } - { - } + {} } // ERROR "missing return" var _ = func() int { { panic(2) } - { - } + {} } // ERROR "missing return" // if-else chain with final else and all terminating is okay @@ -2436,11 +2382,11 @@ var _ = func() int { } } // ERROR "missing return" + // for { loops that never break are okay. var _ = func() int { - for { - } + for {} } var _ = func() int { @@ -2453,7 +2399,7 @@ var _ = func() int { var _ = func() int { for { - L: + L: for { break L } @@ -2463,9 +2409,7 @@ var _ = func() int { // for { loops that break are not okay. var _ = func() int { - for { - break - } + for { break } } // ERROR "missing return" var _ = func() int { @@ -2488,8 +2432,7 @@ L: // if there's a condition - even "true" - the loops are no longer syntactically terminating var _ = func() int { - for x == nil { - } + for x == nil {} } // ERROR "missing return" var _ = func() int { @@ -2502,16 +2445,15 @@ var _ = func() int { var _ = func() int { for x == nil { - L: + L: for { break L } - } + } } // ERROR "missing return" var _ = func() int { - for true { - } + for true {} } // ERROR "missing return" var _ = func() int { @@ -2524,7 +2466,7 @@ var _ = func() int { var _ = func() int { for true { - L: + L: for { break L } @@ -2534,7 +2476,7 @@ var _ = func() int { // select in which all cases terminate and none break are okay. var _ = func() int { - select {} + select{} } var _ = func() int { @@ -2549,8 +2491,7 @@ var _ = func() int { select { case <-c: print(2) - for { - } + for{} } } @@ -2572,7 +2513,7 @@ var _ = func() int { print(2) panic("abc") default: - select {} + select{} } } @@ -2597,6 +2538,7 @@ L: } } // ERROR "missing return" + var _ = func() int { select { case <-c: @@ -2607,13 +2549,11 @@ var _ = func() int { } } // ERROR "missing return" + // if any breaks refer to the select, the select isn't okay anymore, even if they're dead var _ = func() int { - select { - default: - break - } + select{ default: break } } // ERROR "missing return" var _ = func() int { @@ -2630,9 +2570,7 @@ L: select { case <-c: print(2) - for { - break L - } + for{ break L } } } // ERROR "missing return" @@ -2653,7 +2591,7 @@ var _ = func() int { case <-c: panic("abc") default: - select {} + select{} break } } // ERROR "missing return" @@ -2697,6 +2635,7 @@ var _ = func() int { } } // ERROR "missing return" + var _ = func() int { switch x { case 1: @@ -2802,6 +2741,7 @@ var _ = func() int { } } // ERROR "missing return" + var _ = func() int { switch x.(type) { case int: diff --git a/test/rune.go b/test/rune.go index 3509876910..73a5aa23f8 100644 --- a/test/rune.go +++ b/test/rune.go @@ -11,12 +11,12 @@ package rune var ( r0 = 'a' - r1 = 'a' + 1 - r2 = 1 + 'a' - r3 = 'a' * 2 - r4 = 'a' / 2 - r5 = 'a' << 1 - r6 = 'b' << 2 + r1 = 'a'+1 + r2 = 1+'a' + r3 = 'a'*2 + r4 = 'a'/2 + r5 = 'a'<<1 + r6 = 'b'<<2 r7 int32 r = []rune{r0, r1, r2, r3, r4, r5, r6, r7} @@ -24,15 +24,15 @@ var ( var ( f0 = 1.2 - f1 = 1.2 / 'a' + f1 = 1.2/'a' f = []float64{f0, f1} ) var ( i0 = 1 - i1 = 1 << '\x01' - + i1 = 1<<'\x01' + i = []int{i0, i1} ) @@ -42,6 +42,6 @@ const ( var ( b0 = maxRune < r0 - + b = []bool{b0} ) diff --git a/test/runtime.go b/test/runtime.go index 09862acf50..0cf781b814 100644 --- a/test/runtime.go +++ b/test/runtime.go @@ -17,5 +17,5 @@ package main import "runtime" func main() { - runtime.printbool(true) // ERROR "unexported" "undefined" + runtime.printbool(true) // ERROR "unexported" "undefined" } diff --git a/test/shift1.go b/test/shift1.go index dd990fa929..01ecbed53a 100644 --- a/test/shift1.go +++ b/test/shift1.go @@ -61,12 +61,12 @@ func _() { o = 1< Date: Tue, 24 Sep 2019 21:18:02 -0400 Subject: [PATCH 120/126] Fix cross-platform compilation errors --- src/runtime/defs_linux_386.go | 8 +++--- src/runtime/defs_linux_arm.go | 8 +++--- src/runtime/defs_linux_arm64.go | 8 +++--- src/runtime/defs_linux_mips64x.go | 8 +++--- src/runtime/defs_linux_mipsx.go | 8 +++--- src/runtime/defs_linux_ppc64.go | 8 +++--- src/runtime/defs_linux_ppc64le.go | 8 +++--- src/runtime/defs_linux_s390x.go | 8 +++--- src/runtime/defs_perf_linux.go | 6 ++--- src/runtime/os_linux.go | 21 ++++++++------- src/runtime/perf_linux.go | 18 ++++++------- src/runtime/proc.go | 2 +- src/runtime/runtime2.go | 43 ++++++++++++++++--------------- 13 files changed, 86 insertions(+), 68 deletions(-) diff --git a/src/runtime/defs_linux_386.go b/src/runtime/defs_linux_386.go index 21758918fe..0ade3f80de 100644 --- a/src/runtime/defs_linux_386.go +++ b/src/runtime/defs_linux_386.go @@ -13,9 +13,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x20 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_linux_arm.go b/src/runtime/defs_linux_arm.go index 944aeac4f4..01fa2fffe0 100644 --- a/src/runtime/defs_linux_arm.go +++ b/src/runtime/defs_linux_arm.go @@ -11,9 +11,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x20 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_linux_arm64.go b/src/runtime/defs_linux_arm64.go index b1f788aa83..d19bc77da8 100644 --- a/src/runtime/defs_linux_arm64.go +++ b/src/runtime/defs_linux_arm64.go @@ -13,9 +13,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x20 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go index 96499ad219..e751798d57 100644 --- a/src/runtime/defs_linux_mips64x.go +++ b/src/runtime/defs_linux_mips64x.go @@ -13,9 +13,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x800 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x800 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go index bb63a95ce8..e79b110856 100644 --- a/src/runtime/defs_linux_mipsx.go +++ b/src/runtime/defs_linux_mipsx.go @@ -17,9 +17,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x800 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x800 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_linux_ppc64.go b/src/runtime/defs_linux_ppc64.go index 4388b24f73..e298833c95 100644 --- a/src/runtime/defs_linux_ppc64.go +++ b/src/runtime/defs_linux_ppc64.go @@ -13,9 +13,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x20 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_linux_ppc64le.go b/src/runtime/defs_linux_ppc64le.go index 90aaacecf2..0f5b5771d6 100644 --- a/src/runtime/defs_linux_ppc64le.go +++ b/src/runtime/defs_linux_ppc64le.go @@ -13,9 +13,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x20 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_linux_s390x.go b/src/runtime/defs_linux_s390x.go index bd411f3726..165bb5a788 100644 --- a/src/runtime/defs_linux_s390x.go +++ b/src/runtime/defs_linux_s390x.go @@ -14,9 +14,11 @@ const ( _PROT_WRITE = 0x2 _PROT_EXEC = 0x4 - _MAP_ANON = 0x20 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 + _MAP_SHARED = 0x1 + _MAP_PRIVATE = 0x2 + _MAP_SHARED_VALIDATE = 0x3 + _MAP_FIXED = 0x10 + _MAP_ANON = 0x20 _MADV_DONTNEED = 0x4 _MADV_FREE = 0x8 diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index f4735d4fc4..ddea650499 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -2,7 +2,7 @@ package runtime // Convert platform-agnostic pmu events to Linux perf events var perfEventOpt = map[int32]struct { - // The lower-case type is reserved for Go + // The lower-case "type" is the key word in Go Type uint32 // type of event config uint64 // event }{ @@ -17,7 +17,7 @@ var perfEventOpt = map[int32]struct { } type perfEventAttr struct { - // The lower-case type is reserved for Go + // The lower-case "type" is the key word in Go Type uint32 size uint32 config uint64 @@ -66,7 +66,7 @@ type perfEventMmapPage struct { } type perfEventHeader struct { - // The lower-case type is reserved for Go + // The lower-case "type" is the key word in Go Type uint32 misc uint16 size uint16 diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index e9a00bdfbb..0ee12242dc 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -517,8 +517,8 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { } // create mmap buffer for this file - perfMmap := perfSetMmap(fd) - if perfMmap == nil { + mmapBuf := perfSetMmap(fd) + if mmapBuf == nil { println("Fail to set perf mmap") closefd(fd) return @@ -528,7 +528,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _, err = fcntl(fd, 0x4 /* F_SETFL */, flag|0x2000 /* O_ASYNC */) if err != 0 { println("Failed to set notification for the PMU event") - perfUnsetMmap(perfMmap) + perfUnsetMmap(mmapBuf) closefd(fd) return } @@ -536,7 +536,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _, err = fcntl(fd, 0xa /* F_SETSIG */, _SIGPROF) if err != 0 { println("Failed to set signal for the PMU event") - perfUnsetMmap(perfMmap) + perfUnsetMmap(mmapBuf) closefd(fd) return } @@ -545,25 +545,25 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _, err = fcntl2(fd, 0xf /* F_SETOWN_EX */, &fOwnEx) if err != 0 { println("Failed to set the owner of the perf event file") - perfUnsetMmap(perfMmap) + perfUnsetMmap(mmapBuf) closefd(fd) return } _g_.m.eventAttrs[eventId] = eventAttr - _g_.m.eventMmapBufs[eventId] = perfMmap + _g_.m.eventMmapBufs[eventId] = mmapBuf _g_.m.eventFds[eventId] = fd if !perfResetCounter(fd) { _g_.m.eventAttrs[eventId] = nil - perfUnsetMmap(perfMmap) + perfUnsetMmap(mmapBuf) _g_.m.eventMmapBufs[eventId] = nil closefd(fd) return } if !perfStartCounter(fd) { _g_.m.eventAttrs[eventId] = nil - perfUnsetMmap(perfMmap) + perfUnsetMmap(mmapBuf) _g_.m.eventMmapBufs[eventId] = nil closefd(fd) return @@ -586,8 +586,9 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { break } } + if eventId != -1 { - mmapBuf := _g_.m.eventMmapBufs[eventId] + mmapBuf := (*perfEventMmapPage)(_g_.m.eventMmapBufs[eventId]) head := mmapBuf.data_head rmb() // on SMP-capable platforms, after reading the data_head value, user space should issue a memory barrier @@ -623,7 +624,7 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { perfRecordSample(head, mmapBuf, _g_.m.eventAttrs[eventId], &sampleData) - sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId, &sampleData) + sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId /* &sampleData */) } else if hdr.size == 0 { perfSkipAll(head, mmapBuf) } else { diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index 3b3a9293ee..d2245eb369 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -74,29 +74,28 @@ func perfMmapSize() uintptr { return uintptr(perfPageSize * (perfDataPages + 1 /* metadata page */)) } -func perfSetMmap(fd int32) *perfEventMmapPage { +func perfSetMmap(fd int32) unsafe.Pointer { if perfPageSize == 0 { perfMmapInit() } size := perfMmapSize() - r, err := mmap(nil, size, _PROT_WRITE|_PROT_READ, _MAP_SHARED, fd, 0 /* page offset */) + mmapBuf, err := mmap(nil, size, _PROT_WRITE|_PROT_READ, _MAP_SHARED, fd, 0 /* page offset */) if err != 0 { return nil } - perfMmap := (*perfEventMmapPage)(r) // There is no memset available in Go runime - // We instead employ the following approach to initialize all bytes in perfMmap to zeros + // We instead employ the following approach to initialize all bytes in mmapBuf to zeros var temp perfEventMmapPage - memmove(unsafe.Pointer(perfMmap), unsafe.Pointer(&temp), unsafe.Sizeof(temp)) + memmove(mmapBuf, unsafe.Pointer(&temp), unsafe.Sizeof(temp)) - return perfMmap + return mmapBuf } -func perfUnsetMmap(mmapBuf *perfEventMmapPage) { +func perfUnsetMmap(mmapBuf unsafe.Pointer) { size := perfMmapSize() - munmap(unsafe.Pointer(mmapBuf), size) + munmap(mmapBuf, size) } func perfSkipNBytes(head uint64, mmapBuf *perfEventMmapPage, n uint64) { @@ -113,6 +112,7 @@ func perfSkipRecord(head uint64, mmapBuf *perfEventMmapPage, hdr *perfEventHeade if mmapBuf == nil { return } + remains := uint64(hdr.size) - uint64(unsafe.Sizeof(*hdr)) if remains > 0 { perfSkipNBytes(head, mmapBuf, remains) @@ -128,7 +128,7 @@ func perfSkipAll(head uint64, mmapBuf *perfEventMmapPage) { remains := head - tail if remains > 0 { - perfSkipNBytes(head, mmapBuf, remains) + mmapBuf.data_tail += remains } } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 65afb6d5b0..50d081c85f 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3820,7 +3820,7 @@ var lostPMUAtomic64Count [GO_COUNT_PMU_EVENTS_MAX]uint64 // Called if we receive a SIGPROF signal and PMU is enabled. // Called by the signal handler, may run during STW. //go:nowritebarrierrec -func sigprofPMU(pc, sp, lr uintptr, gp *g, mp *m, eventId int, sampleData *perfSampleData) { +func sigprofPMU(pc, sp, lr uintptr, gp *g, mp *m, eventId int) { if pmuEvent[eventId].eventAttr == nil { return } diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index e5b5dc4932..d86ff7c498 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -455,27 +455,28 @@ type m struct { divmod uint32 // div/mod denominator for arm - known to liblink // Fields not known to debuggers. - procid uint64 // for debuggers, but offset not hard-coded - gsignal *g // signal-handling g - goSigStack gsignalStack // Go-allocated signal handling stack - sigmask sigset // storage for saved signal mask - tls [6]uintptr // thread-local storage (for x86 extern register) - mstartfn func() - curg *g // current running goroutine - caughtsig guintptr // goroutine running during fatal signal - p puintptr // attached p for executing go code (nil if not executing go code) - nextp puintptr - oldp puintptr // the p that was attached before executing a syscall - id int64 - mallocing int32 - throwing int32 - preemptoff string // if != "", keep curg running on this m - locks int32 - dying int32 - profilehz int32 - eventFds [GO_COUNT_PMU_EVENTS_MAX]int32 - eventAttrs [GO_COUNT_PMU_EVENTS_MAX]*PMUEventAttr - eventMmapBufs [GO_COUNT_PMU_EVENTS_MAX]*perfEventMmapPage + procid uint64 // for debuggers, but offset not hard-coded + gsignal *g // signal-handling g + goSigStack gsignalStack // Go-allocated signal handling stack + sigmask sigset // storage for saved signal mask + tls [6]uintptr // thread-local storage (for x86 extern register) + mstartfn func() + curg *g // current running goroutine + caughtsig guintptr // goroutine running during fatal signal + p puintptr // attached p for executing go code (nil if not executing go code) + nextp puintptr + oldp puintptr // the p that was attached before executing a syscall + id int64 + mallocing int32 + throwing int32 + preemptoff string // if != "", keep curg running on this m + locks int32 + dying int32 + profilehz int32 + eventFds [GO_COUNT_PMU_EVENTS_MAX]int32 + eventAttrs [GO_COUNT_PMU_EVENTS_MAX]*PMUEventAttr + // eventMmapBufs [GO_COUNT_PMU_EVENTS_MAX]*perfEventMmapPage + eventMmapBufs [GO_COUNT_PMU_EVENTS_MAX]unsafe.Pointer spinning bool // m is out of work and is actively looking for work blocked bool // m is blocked on a note newSigstack bool // minit on C thread called sigaltstack From 99c2b0ef7ae9006888908266fe691d10ae03351e Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 24 Sep 2019 21:34:20 -0400 Subject: [PATCH 121/126] Change the comments --- src/runtime/defs_perf_linux.go | 6 +++--- src/runtime/os_linux.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/defs_perf_linux.go b/src/runtime/defs_perf_linux.go index ddea650499..fce76ccf16 100644 --- a/src/runtime/defs_perf_linux.go +++ b/src/runtime/defs_perf_linux.go @@ -2,7 +2,7 @@ package runtime // Convert platform-agnostic pmu events to Linux perf events var perfEventOpt = map[int32]struct { - // The lower-case "type" is the key word in Go + // The lower-case "type" is the keyword in Go Type uint32 // type of event config uint64 // event }{ @@ -17,7 +17,7 @@ var perfEventOpt = map[int32]struct { } type perfEventAttr struct { - // The lower-case "type" is the key word in Go + // The lower-case "type" is the keyword in Go Type uint32 size uint32 config uint64 @@ -66,7 +66,7 @@ type perfEventMmapPage struct { } type perfEventHeader struct { - // The lower-case "type" is the key word in Go + // The lower-case "type" is the keyword in Go Type uint32 misc uint16 size uint16 diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 0ee12242dc..95673d5ffc 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -624,7 +624,7 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { perfRecordSample(head, mmapBuf, _g_.m.eventAttrs[eventId], &sampleData) - sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId /* &sampleData */) + sigprofPMU(c.sigpc(), c.sigsp(), c.siglr(), gp, _g_.m, eventId /* , &sampleData */) } else if hdr.size == 0 { perfSkipAll(head, mmapBuf) } else { From 9e43ce5074e8b30cdece7e5770a132dc5b6890df Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 15 Oct 2019 00:08:17 -0400 Subject: [PATCH 122/126] delete excess space --- src/cmd/go/alldocs.go | 2 +- src/cmd/go/internal/test/test.go | 2 +- src/math/cmplx/cmath_test.go | 2 +- src/runtime/sys_linux_amd64.s | 2 +- src/runtime/sys_linux_mips64x.s | 18 ++++++------- src/runtime/sys_linux_ppc64x.s | 44 ++++++++++++++++---------------- src/runtime/sys_linux_s390x.s | 8 +++--- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 079cecc1ff..8b3afdbb29 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -2962,7 +2962,7 @@ // Write a PMU profile to the specified file before exiting. // Writes test binary as -c would. // -// -pmuevent event +// -pmuevent event // Specify which pmu event to sample. // To sample PMU cycles, use -test.pmuevent=cycles. // To sample PMU instructions, use -test.pmuevent=instructions. diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 055f5b4d58..0be5a351a6 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -317,7 +317,7 @@ profile the tests during execution: Write a PMU profile to the specified file before exiting. Writes test binary as -c would. - -pmuevent event + -pmuevent event Specify which pmu event to sample. To sample PMU cycles, use -test.pmuevent=cycles. To sample PMU instructions, use -test.pmuevent=instructions. diff --git a/src/math/cmplx/cmath_test.go b/src/math/cmplx/cmath_test.go index 57ba76a767..fbb49fdd5b 100644 --- a/src/math/cmplx/cmath_test.go +++ b/src/math/cmplx/cmath_test.go @@ -222,7 +222,7 @@ var pow = []complex128{ (-2.499956739197529585028819e+00 + 1.759751724335650228957144e+00i), (7.357094338218116311191939e+04 - 5.089973412479151648145882e+04i), (1.320777296067768517259592e+01 - 3.165621914333901498921986e+01i), - (-3.123287828297300934072149e-07 - 1.9849567521490553032502223e-7i), + (-3.123287828297300934072149e-07 - 1.9849567521490553032502223E-7i), (8.0622651468477229614813e+04 - 7.80028727944573092944363e+04i), (-1.0268824572103165858577141e+00 - 4.716844738244989776610672e-01i), (-4.35953819012244175753187e+01 + 2.2036445974645306917648585e+02i), diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 40a2bd1f7f..ba3da27077 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -39,7 +39,7 @@ #define SYS_gettid 186 #define SYS_futex 202 #define SYS_sched_getaffinity 204 -#define SYS_epoll_create 213 +#define SYS_epoll_create 213 #define SYS_exit_group 231 #define SYS_epoll_ctl 233 #define SYS_tgkill 234 diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index 5bcf7b5407..9580812277 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -516,7 +516,7 @@ TEXT runtime·ioctl,NOSPLIT,$0-40 BEQ R7, ok MOVV $-1, R1 MOVV R1, r+24(FP) - MOVV R2, err+32(FP) + MOVV R2, err+32(FP) RET ok: MOVV R2, r+24(FP) @@ -535,12 +535,12 @@ TEXT runtime·fcntl,NOSPLIT,$0-40 SYSCALL BEQ R7, ok MOVV $-1, R1 - MOVV R1, r+24(FP) - MOVV R2, err+32(FP) + MOVV R1, r+24(FP) + MOVV R2, err+32(FP) RET ok: - MOVV R2, r+24(FP) - MOVV R0, err+32(FP) + MOVV R2, r+24(FP) + MOVV R0, err+32(FP) RET // psu: not tested @@ -555,10 +555,10 @@ TEXT runtime·fcntl2,NOSPLIT,$0-40 SYSCALL BEQ R7, ok MOVV $-1, R1 - MOVV R1, r+24(FP) - MOVV R2, err+32(FP) + MOVV R1, r+24(FP) + MOVV R2, err+32(FP) RET ok: - MOVV R2, r+24(FP) - MOVV R0, err+32(FP) + MOVV R2, r+24(FP) + MOVV R0, err+32(FP) RET diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index e030320aab..8cb7fa91ce 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -645,18 +645,18 @@ TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-72 MOVD groupFd+24(FP), R6 MOVD flags+32(FP), R7 MOVD dummy+40(FP), R8 - MOVD $SYS_perf_event_open, R9 + MOVD $SYS_perf_event_open, R9 SYSCALL R9 BVC ok MOVD $-1, R4 - MOVW R4, r+48(FP) - MOVD R0, r2+56(FP) - MOVD R3, err+64(FP) + MOVW R4, r+48(FP) + MOVD R0, r2+56(FP) + MOVD R3, err+64(FP) RET ok: - MOVW R3, r+48(FP) - MOVD R4, r2+56(FP) - MOVD R0, err+64(FP) + MOVW R3, r+48(FP) + MOVD R4, r2+56(FP) + MOVD R0, err+64(FP) RET // psu: not tested @@ -667,16 +667,16 @@ TEXT runtime·ioctl(SB),NOSPLIT,$0-40 MOVD R0, R6 MOVD R0, R7 MOVD R0, R8 - MOVD $SYS_ioctl, R9 + MOVD $SYS_ioctl, R9 SYSCALL R9 BVC ok MOVD $-1, R4 - MOVD R4, r+24(FP) - MOVD R3, err+32(FP) + MOVD R4, r+24(FP) + MOVD R3, err+32(FP) RET ok: - MOVD R3, r+24(FP) - MOVD R0, err+32(FP) + MOVD R3, r+24(FP) + MOVD R0, err+32(FP) RET // psu: not tested @@ -687,16 +687,16 @@ TEXT runtime·fcntl(SB),NOSPLIT,$0-40 MOVD R0, R6 MOVD R0, R7 MOVD R0, R8 - MOVD $SYS_fcntl, R9 + MOVD $SYS_fcntl, R9 SYSCALL R9 BVC ok MOVD $-1, R4 - MOVD R4, r+24(FP) - MOVD R3, err+32(FP) + MOVD R4, r+24(FP) + MOVD R3, err+32(FP) RET ok: - MOVD R3, r+24(FP) - MOVD R0, err+32(FP) + MOVD R3, r+24(FP) + MOVD R0, err+32(FP) RET // psu: not tested @@ -707,14 +707,14 @@ TEXT runtime·fcntl2(SB),NOSPLIT,$0-40 MOVD R0, R6 MOVD R0, R7 MOVD R0, R8 - MOVD $SYS_fcntl, R9 + MOVD $SYS_fcntl, R9 SYSCALL R9 BVC ok MOVD $-1, R4 - MOVD R4, r+24(FP) - MOVD R3, err+32(FP) + MOVD R4, r+24(FP) + MOVD R3, err+32(FP) RET ok: - MOVD R3, r+24(FP) - MOVD R0, err+32(FP) + MOVD R3, r+24(FP) + MOVD R0, err+32(FP) RET diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s index 4f75286ba5..9d785d856c 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s @@ -16,8 +16,8 @@ #define SYS_close 6 #define SYS_getpid 20 #define SYS_kill 37 -#define SYS_brk 45 -#define SYS_ioctl 54 +#define SYS_brk 45 +#define SYS_ioctl 54 #define SYS_fcntl 55 #define SYS_mmap 90 #define SYS_munmap 91 @@ -41,7 +41,7 @@ #define SYS_epoll_wait 251 #define SYS_clock_gettime 260 #define SYS_epoll_create1 327 -#define SYS_perf_event_open 331 +#define SYS_perf_event_open 331 TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R2 @@ -475,7 +475,7 @@ TEXT runtime·perfEventOpen(SB),NOSPLIT,$0-72 MOVD groupFd+24(FP), R5 MOVD flags+32(FP), R6 MOVD dummy+40(FP), R7 - MOVD SYS_perf_event_open, R1 + MOVD SYS_perf_event_open, R1 SYSCALL MOVD $0xfffffffffffff001, R8 CMPUBLT R2, R8, ok From ed87648809f11d12321b330c169366a81791f61d Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 15 Oct 2019 11:41:48 -0400 Subject: [PATCH 123/126] delete excess space --- src/runtime/sys_linux_amd64.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index ba3da27077..40a2bd1f7f 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -39,7 +39,7 @@ #define SYS_gettid 186 #define SYS_futex 202 #define SYS_sched_getaffinity 204 -#define SYS_epoll_create 213 +#define SYS_epoll_create 213 #define SYS_exit_group 231 #define SYS_epoll_ctl 233 #define SYS_tgkill 234 From ab79a0a6a2cc8e2cf14fe2c36168c64c5fb4bb8f Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 15 Oct 2019 11:41:48 -0400 Subject: [PATCH 124/126] delete excess space --- src/runtime/perf_linux.go | 5 ----- src/runtime/sys_linux_amd64.s | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/runtime/perf_linux.go b/src/runtime/perf_linux.go index d2245eb369..1e9779c674 100644 --- a/src/runtime/perf_linux.go +++ b/src/runtime/perf_linux.go @@ -85,11 +85,6 @@ func perfSetMmap(fd int32) unsafe.Pointer { return nil } - // There is no memset available in Go runime - // We instead employ the following approach to initialize all bytes in mmapBuf to zeros - var temp perfEventMmapPage - memmove(mmapBuf, unsafe.Pointer(&temp), unsafe.Sizeof(temp)) - return mmapBuf } diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index ba3da27077..40a2bd1f7f 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -39,7 +39,7 @@ #define SYS_gettid 186 #define SYS_futex 202 #define SYS_sched_getaffinity 204 -#define SYS_epoll_create 213 +#define SYS_epoll_create 213 #define SYS_exit_group 231 #define SYS_epoll_ctl 233 #define SYS_tgkill 234 From b67770af5f804792df66d0e7cc32ceb4754a1cc4 Mon Sep 17 00:00:00 2001 From: Milind Chabbi Date: Mon, 21 Oct 2019 22:18:35 -0700 Subject: [PATCH 125/126] Pprof+PMU: Set the file descriptor to 0 after closing --- src/runtime/os_linux.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 95673d5ffc..ede6b45e5e 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -491,6 +491,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { if eventAttr == nil { if _g_.m.eventAttrs[eventId] != nil { closefd(_g_.m.eventFds[eventId]) + _g_.m.eventFds[eventId] = 0 _g_.m.eventAttrs[eventId] = nil } if _g_.m.eventMmapBufs[eventId] != nil { @@ -500,6 +501,7 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { } else { if _g_.m.eventAttrs[eventId] != nil { closefd(_g_.m.eventFds[eventId]) + _g_.m.eventFds[eventId] = 0 _g_.m.eventAttrs[eventId] = nil } if _g_.m.eventMmapBufs[eventId] != nil { From 9465bad596948142f5f1489d81700d1123c2160a Mon Sep 17 00:00:00 2001 From: Pengfei Su Date: Tue, 22 Oct 2019 15:07:41 -0400 Subject: [PATCH 126/126] Two patches: 1) disable the PMU counter before closing the associated file descriptor and 2) in the signal handler, find out the PMU counter that triggers the overflow interrupt --- src/runtime/os_linux.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index ede6b45e5e..a55ad2a6c5 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -490,8 +490,9 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { if eventAttr == nil { if _g_.m.eventAttrs[eventId] != nil { + // We need to disable the counter prior to closing the file descriptor + perfStopCounter(_g_.m.eventFds[eventId]) closefd(_g_.m.eventFds[eventId]) - _g_.m.eventFds[eventId] = 0 _g_.m.eventAttrs[eventId] = nil } if _g_.m.eventMmapBufs[eventId] != nil { @@ -500,8 +501,9 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { } } else { if _g_.m.eventAttrs[eventId] != nil { + // We need to disable the counter prior to closing the file descriptor + perfStopCounter(_g_.m.eventFds[eventId]) closefd(_g_.m.eventFds[eventId]) - _g_.m.eventFds[eventId] = 0 _g_.m.eventAttrs[eventId] = nil } if _g_.m.eventMmapBufs[eventId] != nil { @@ -521,34 +523,34 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { // create mmap buffer for this file mmapBuf := perfSetMmap(fd) if mmapBuf == nil { - println("Fail to set perf mmap") closefd(fd) + println("Fail to set perf mmap") return } flag, _ := fcntl(fd, 0x3 /* F_GETFL */, 0) _, err = fcntl(fd, 0x4 /* F_SETFL */, flag|0x2000 /* O_ASYNC */) if err != 0 { - println("Failed to set notification for the PMU event") - perfUnsetMmap(mmapBuf) closefd(fd) + perfUnsetMmap(mmapBuf) + println("Failed to set notification for the PMU event") return } _, err = fcntl(fd, 0xa /* F_SETSIG */, _SIGPROF) if err != 0 { - println("Failed to set signal for the PMU event") - perfUnsetMmap(mmapBuf) closefd(fd) + perfUnsetMmap(mmapBuf) + println("Failed to set signal for the PMU event") return } fOwnEx := fOwnerEx{0 /* F_OWNER_TID */, int32(gettid())} _, err = fcntl2(fd, 0xf /* F_SETOWN_EX */, &fOwnEx) if err != 0 { - println("Failed to set the owner of the perf event file") - perfUnsetMmap(mmapBuf) closefd(fd) + perfUnsetMmap(mmapBuf) + println("Failed to set the owner of the perf event file") return } @@ -557,17 +559,17 @@ func setThreadPMUProfiler(eventId int32, eventAttr *PMUEventAttr) { _g_.m.eventFds[eventId] = fd if !perfResetCounter(fd) { - _g_.m.eventAttrs[eventId] = nil + closefd(fd) perfUnsetMmap(mmapBuf) + _g_.m.eventAttrs[eventId] = nil _g_.m.eventMmapBufs[eventId] = nil - closefd(fd) return } if !perfStartCounter(fd) { - _g_.m.eventAttrs[eventId] = nil + closefd(fd) perfUnsetMmap(mmapBuf) + _g_.m.eventAttrs[eventId] = nil _g_.m.eventMmapBufs[eventId] = nil - closefd(fd) return } } @@ -583,7 +585,7 @@ func sigprofPMUHandler(info *siginfo, c *sigctxt, gp *g, _g_ *g) { var eventId int = -1 for i := 0; i < GO_COUNT_PMU_EVENTS_MAX; i++ { - if _g_.m.eventFds[i] == fd { + if _g_.m.eventFds[i] == fd && _g_.m.eventAttrs[i] != nil { eventId = i break }