diff --git a/doc/go1.14.html b/doc/go1.14.html index 7afda4c07e6..d836d086834 100644 --- a/doc/go1.14.html +++ b/doc/go1.14.html @@ -51,6 +51,38 @@ TODO

Go command

+ +

+ When the main module contains a top-level vendor directory and + its go.mod file specifies go 1.14 or + higher, the go command now defaults to -mod=vendor + for operations that accept that flag. A new value for that flag, + -mod=mod, causes the go command to instead load + modules from the module cache (as when no vendor directory is + present). +

+ +

+ When -mod=vendor is set (explicitly or by default), the + go command now verifies that the main module's + vendor/modules.txt file is consistent with its + go.mod file. +

+ +

+ go list -m no longer silently omits + transitive dependencies that do not provide packages in + the vendor directory. It now fails explicitly if + -mod=vendor is set. +

+ +

+ The go get command no longer accepts + the -mod flag. Previously, the flag's setting either + was ignored or + caused the build to fail. +

+

The go command now includes snippets of plain-text error messages from module proxies and other HTTP servers. @@ -58,13 +90,6 @@ TODO graphic characters and spaces.

-

- The go get subcommand no longer accepts - the -mod flag. Previously, the flag's setting either - was ignored or - caused the build to fail. -

-

Runtime

diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go index 85f00a36533..b745a4417f1 100644 --- a/misc/cgo/test/cgo_test.go +++ b/misc/cgo/test/cgo_test.go @@ -58,6 +58,7 @@ func Test27660(t *testing.T) { test27660(t) } func Test28896(t *testing.T) { test28896(t) } func Test30065(t *testing.T) { test30065(t) } func Test32579(t *testing.T) { test32579(t) } +func Test31891(t *testing.T) { test31891(t) } func TestAlign(t *testing.T) { testAlign(t) } func TestAtol(t *testing.T) { testAtol(t) } func TestBlocking(t *testing.T) { testBlocking(t) } diff --git a/misc/cgo/test/issue31891.c b/misc/cgo/test/issue31891.c new file mode 100644 index 00000000000..67a0dda2d68 --- /dev/null +++ b/misc/cgo/test/issue31891.c @@ -0,0 +1,13 @@ +// Copyright 2019 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. + +#include "_cgo_export.h" + +void callIssue31891() { + Issue31891A a; + useIssue31891A(&a); + + Issue31891B b; + useIssue31891B(&b); +} diff --git a/misc/cgo/test/testdata/issue9026/issue9026.go b/misc/cgo/test/testdata/issue9026/issue9026.go index 149c26562ad..0af86e64da4 100644 --- a/misc/cgo/test/testdata/issue9026/issue9026.go +++ b/misc/cgo/test/testdata/issue9026/issue9026.go @@ -29,7 +29,7 @@ func Test(t *testing.T) { // Brittle: the assertion may fail spuriously when the algorithm // changes, but should remain stable otherwise. got := fmt.Sprintf("%T %T", in, opts) - want := "issue9026._Ctype_struct___0 *issue9026._Ctype_struct___0" + want := "issue9026._Ctype_struct___0 *issue9026._Ctype_struct___1" if got != want { t.Errorf("Non-deterministic type names: got %s, want %s", got, want) } diff --git a/misc/cgo/test/testx.go b/misc/cgo/test/testx.go index 67def903aba..bb1b50802b6 100644 --- a/misc/cgo/test/testx.go +++ b/misc/cgo/test/testx.go @@ -108,6 +108,17 @@ void callMulti(void); // issue 28772 part 2 - part 1 in issuex.go #define issue28772Constant2 2 + +// issue 31891 +typedef struct { + long obj; +} Issue31891A; + +typedef struct { + long obj; +} Issue31891B; + +void callIssue31891(void); */ import "C" @@ -517,3 +528,15 @@ func test20910(t *testing.T) { // issue 28772 part 2 const issue28772Constant2 = C.issue28772Constant2 + +// issue 31891 + +//export useIssue31891A +func useIssue31891A(c *C.Issue31891A) {} + +//export useIssue31891B +func useIssue31891B(c *C.Issue31891B) {} + +func test31891(t *testing.T) { + C.callIssue31891() +} diff --git a/misc/nacl/README b/misc/nacl/README deleted file mode 100644 index 179e526d89a..00000000000 --- a/misc/nacl/README +++ /dev/null @@ -1,121 +0,0 @@ -Native Client -============= - -This document outlines the basics of building and developing the Go runtime and -programs in the Native Client (NaCl) environment. - -Go 1.3 supports three architectures - - * nacl/386 which is standard 386. - * nacl/amd64p32 which is a 64 bit architecture, where the address space is - limited to a 4gb window. - * nacl/arm which is 32-bit ARMv7A architecture with 1GB address space. - -For background it is recommended that you read https://golang.org/s/go13nacl. - -Prerequisites -------------- - -Native Client programs are executed inside a sandbox, the NaCl runtime. This -runtime must be installed before you can use NaCl programs. - -The NaCl distribution comes with an installer which ensures you have access to -the latest version of the runtime. The version tracks the Chrome numbering -scheme. - -# Download NaCl - -Download nacl_sdk.zip file from - https://developer.chrome.com/native-client/sdk/download -and unpack it. I chose /opt/nacl_sdk. - -# Update - -The zip file contains a small skeleton that can be used to download the correct -sdk. These are released every 6-8 weeks, in line with Chrome releases. - - % cd /opt/nacl_sdk - % ./naclsdk update - -At this time pepper_49 is the stable version. The NaCl port needs at least pepper_39 -to work. If naclsdk downloads a later version, please adjust accordingly. - -The cmd/go helper scripts expect that the loaders sel_ldr_{x86_{32,64},arm} and -nacl_helper_bootstrap_arm are in your path. I find it easiest to make a symlink -from the NaCl distribution to my $GOPATH/bin directory. - - % ln -nfs /opt/nacl_sdk/pepper_39/tools/sel_ldr_x86_32 $GOPATH/bin/sel_ldr_x86_32 - % ln -nfs /opt/nacl_sdk/pepper_39/tools/sel_ldr_x86_64 $GOPATH/bin/sel_ldr_x86_64 - % ln -nfs /opt/nacl_sdk/pepper_39/tools/sel_ldr_arm $GOPATH/bin/sel_ldr_arm - -Additionally, for NaCl/ARM only: - - % ln -nfs /opt/nacl_sdk/pepper_39/tools/nacl_helper_bootstrap_arm $GOPATH/bin/nacl_helper_bootstrap_arm - -Support scripts ---------------- - -Symlink the two scripts in this directory into your $PATH, just as you did with -NaCl sdk above. - - % ln -nfs $GOROOT/misc/nacl/go_nacl_amd64p32_exec $GOPATH/bin/go_nacl_amd64p32_exec - % ln -nfs $GOROOT/misc/nacl/go_nacl_386_exec $GOPATH/bin/go_nacl_386_exec - % ln -nfs $GOROOT/misc/nacl/go_nacl_arm_exec $GOPATH/bin/go_nacl_arm_exec - -Building and testing --------------------- - -Building for NaCl is similar to cross compiling for other platforms. However, -as it is not possible to ever build in a `native` NaCl environment, the cmd/go -tool has been enhanced to allow the full build, all.bash, to be executed, -rather than just the compile stage, make.bash. - -The cmd/go tool knows that if GOOS is set to `nacl` it should not try to -execute any binaries itself. Instead it passes their execution to a support -script which sets up a Native Client environment and invokes the NaCl sandbox. - -The script's name has a special format, go_$GOOS_$GOARCH_exec, so cmd/go can -find it. - -In short, if the support scripts are in place, the cmd/go tool can be used as -per normal. - -# Build and test Go for NaCl - -NaCl does not permit direct file system access. Instead, package syscall -provides a simulated file system served by in-memory data. The script -nacltest.bash is the NaCl equivalent of all.bash. It builds NaCl with an -in-memory file system containing files needed for tests, and then it runs the -tests. - - % cd go/src - % env GOARCH=amd64p32 ./nacltest.bash - -Debugging ---------- - -Assuming that you have built nacl/amd64p32 binary ./mybin and can run as: - - % sel_ldr_x86_64 -l /dev/null -S -e ./mybin - -Create the nacl manifest file mybin.manifest with the following contents: - - { "program": { "x86-64": { "url": "mybin" } } } - -url is the path to the binary relative to the manifest file. -Then, run the program as: - - % sel_ldr_x86_64 -g -l /dev/null -S -e ./mybin - -The -g flag instructs the loader to stop at startup. Then, in another console: - - % /opt/nacl_sdk/pepper_39/toolchain/linux_x86_glibc/bin/x86_64-nacl-gdb - % nacl-manifest mybin.manifest - % target remote :4014 - -If you see that the program is stopped in _rt0_amd64p32_nacl, then symbols are -loaded successfully and you can type 'c' to start the program. -Next time you can automate it as: - - % /opt/nacl_sdk/pepper_39/toolchain/linux_x86_glibc/bin/x86_64-nacl-gdb \ - -ex 'nacl-manifest mybin.manifest' -ex 'target remote :4014' diff --git a/misc/nacl/go_nacl_386_exec b/misc/nacl/go_nacl_386_exec deleted file mode 100755 index 9cff6355657..00000000000 --- a/misc/nacl/go_nacl_386_exec +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -eval $(go env) - -export NACLENV_GOARCH=$GOARCH -export NACLENV_GOOS=$GOOS -export NACLENV_GOROOT=/go -export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;") - -exec sel_ldr_x86_32 -l /dev/null -S -e "$@" diff --git a/misc/nacl/go_nacl_amd64p32_exec b/misc/nacl/go_nacl_amd64p32_exec deleted file mode 100755 index 0a5ed651f14..00000000000 --- a/misc/nacl/go_nacl_amd64p32_exec +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -eval $(go env) - -export NACLENV_GOARCH=$GOARCH -export NACLENV_GOOS=$GOOS -export NACLENV_GOROOT=/go -export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;") - -exec sel_ldr_x86_64 -l /dev/null -S -e "$@" diff --git a/misc/nacl/go_nacl_arm_exec b/misc/nacl/go_nacl_arm_exec deleted file mode 100755 index 4275cb1111c..00000000000 --- a/misc/nacl/go_nacl_arm_exec +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -eval $(go env) - -export NACLENV_GOARCH=$GOARCH -export NACLENV_GOOS=$GOOS -export NACLENV_GOROOT=/go -export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;") - -exec nacl_helper_bootstrap_arm $(which sel_ldr_arm) --reserved_at_zero=0xXXXXXXXXXXXXXXXX -l /dev/null -S -e "$@" diff --git a/misc/nacl/mkzip.go b/misc/nacl/mkzip.go deleted file mode 100644 index 5ec241e35a3..00000000000 --- a/misc/nacl/mkzip.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2014 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. - -// Mkzip creates a zip file from a 'proto' file describing the contents. -// -// The proto file is inspired by the Plan 9 mkfs prototype file format. -// It describes a file tree, one directory per line, with leading tab -// indentation marking the tree structure. Each line contains a leading -// name field giving the name of the file to copy into the zip file, -// and then a sequence of optional key=value attributes to control -// the copy. The only known attribute is src=foo, meaning copy the -// actual data for the file (or directory) from an alternate location. -package main - -import ( - "archive/zip" - "bufio" - "flag" - "fmt" - "io" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "strings" -) - -func usage() { - fmt.Fprintf(os.Stderr, "usage: mkzip [-r root] src.proto out.zip\n") - os.Exit(2) -} - -func sysfatal(format string, args ...interface{}) { - fmt.Fprintf(os.Stderr, "mkzip: %s\n", fmt.Sprintf(format, args...)) - os.Exit(2) -} - -var ( - root = flag.String("r", ".", "interpret source paths relative to this directory") - gopackage = flag.String("p", "", "write Go source file in this package") -) - -type stack struct { - name string - src string - depth int -} - -func main() { - log.SetFlags(0) - flag.Usage = usage - flag.Parse() - - args := flag.Args() - if len(args) != 2 { - usage() - } - - rf, err := os.Open(args[0]) - if err != nil { - sysfatal("%v", err) - } - r := bufio.NewScanner(rf) - - zf, err := os.Create(args[1]) - if err != nil { - sysfatal("%v", err) - } - - var w io.Writer = zf - if *gopackage != "" { - fmt.Fprintf(zf, `package %s -import "sync" -func init() { - var once sync.Once - fsinit = func() { - once.Do(func() { - unzip("`, *gopackage) - gw := &goWriter{b: bufio.NewWriter(w)} - defer func() { - if err := gw.Close(); err != nil { - sysfatal("finishing Go output: %v", err) - } - }() - w = gw - } - z := zip.NewWriter(w) - - lineno := 0 - - addfile := func(info os.FileInfo, dst string, src string) { - zh, err := zip.FileInfoHeader(info) - if err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - zh.Name = dst - zh.Method = zip.Deflate - if info.IsDir() && !strings.HasSuffix(dst, "/") { - zh.Name += "/" - } - w, err := z.CreateHeader(zh) - if err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - if info.IsDir() { - return - } - r, err := os.Open(src) - if err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - defer r.Close() - if _, err := io.Copy(w, r); err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - } - - var stk []stack - - for r.Scan() { - line := r.Text() - lineno++ - s := strings.TrimLeft(line, "\t") - prefix, line := line[:len(line)-len(s)], s - if i := strings.Index(line, "#"); i >= 0 { - line = line[:i] - } - f := strings.Fields(line) - if len(f) == 0 { - continue - } - if strings.HasPrefix(line, " ") { - sysfatal("%s:%d: must use tabs for indentation", args[0], lineno) - } - depth := len(prefix) - for len(stk) > 0 && depth <= stk[len(stk)-1].depth { - stk = stk[:len(stk)-1] - } - parent := "" - psrc := *root - if len(stk) > 0 { - parent = stk[len(stk)-1].name - psrc = stk[len(stk)-1].src - } - if strings.Contains(f[0], "/") { - sysfatal("%s:%d: destination name cannot contain slash", args[0], lineno) - } - name := path.Join(parent, f[0]) - src := filepath.Join(psrc, f[0]) - for _, attr := range f[1:] { - i := strings.Index(attr, "=") - if i < 0 { - sysfatal("%s:%d: malformed attribute %q", args[0], lineno, attr) - } - key, val := attr[:i], attr[i+1:] - switch key { - case "src": - src = val - default: - sysfatal("%s:%d: unknown attribute %q", args[0], lineno, attr) - } - } - - stk = append(stk, stack{name: name, src: src, depth: depth}) - - if f[0] == "*" || f[0] == "+" { - if f[0] == "*" { - dir, err := ioutil.ReadDir(psrc) - if err != nil { - sysfatal("%s:%d: %v", args[0], lineno, err) - } - for _, d := range dir { - addfile(d, path.Join(parent, d.Name()), filepath.Join(psrc, d.Name())) - } - } else { - err := filepath.Walk(psrc, func(src string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if src == psrc { - return nil - } - if psrc == "." { - psrc = "" - } - name := path.Join(parent, filepath.ToSlash(src[len(psrc):])) - addfile(info, name, src) - return nil - }) - if err != nil { - sysfatal("%s:%d: %v", args[0], lineno, err) - } - } - continue - } - - fi, err := os.Stat(src) - if err != nil { - sysfatal("%s:%d: %v", args[0], lineno, err) - } - addfile(fi, name, src) - } - - if err := z.Close(); err != nil { - sysfatal("finishing zip file: %v", err) - } -} - -type goWriter struct { - b *bufio.Writer -} - -func (w *goWriter) Write(b []byte) (int, error) { - for _, c := range b { - fmt.Fprintf(w.b, "\\x%02x", c) - } - return len(b), nil -} - -func (w *goWriter) Close() error { - fmt.Fprintf(w.b, "\")\n\t\t})\n\t}\n}") - w.b.Flush() - return nil -} diff --git a/misc/nacl/testdata/bin/placeholder b/misc/nacl/testdata/bin/placeholder deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/misc/nacl/testdata/empty b/misc/nacl/testdata/empty deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/misc/nacl/testdata/group b/misc/nacl/testdata/group deleted file mode 100644 index eb7f9a3072f..00000000000 --- a/misc/nacl/testdata/group +++ /dev/null @@ -1,8 +0,0 @@ -nobody:*:-2: -nogroup:*:-1: -wheel:*:0:root -daemon:*:1:root -kmem:*:2:root -sys:*:3:root -tty:*:4:root -operator:*:5:root diff --git a/misc/nacl/testdata/hosts b/misc/nacl/testdata/hosts deleted file mode 100644 index 75721cd5afd..00000000000 --- a/misc/nacl/testdata/hosts +++ /dev/null @@ -1 +0,0 @@ -127.0.0.1 localhost diff --git a/misc/nacl/testdata/mime.types b/misc/nacl/testdata/mime.types deleted file mode 100644 index ba678d5a4ec..00000000000 --- a/misc/nacl/testdata/mime.types +++ /dev/null @@ -1,1596 +0,0 @@ -# This file maps Internet media types to unique file extension(s). -# Although created for httpd, this file is used by many software systems -# and has been placed in the public domain for unlimited redistribution. -# -# The table below contains both registered and (common) unregistered types. -# A type that has no unique extension can be ignored -- they are listed -# here to guide configurations toward known types and to make it easier to -# identify "new" types. File extensions are also commonly used to indicate -# content languages and encodings, so choose them carefully. -# -# Internet media types should be registered as described in RFC 4288. -# The registry is at . -# -# MIME type (lowercased) Extensions -# ============================================ ========== -# application/1d-interleaved-parityfec -# application/3gpp-ims+xml -# application/activemessage -application/andrew-inset ez -# application/applefile -application/applixware aw -application/atom+xml atom -application/atomcat+xml atomcat -# application/atomicmail -application/atomsvc+xml atomsvc -# application/auth-policy+xml -# application/batch-smtp -# application/beep+xml -# application/calendar+xml -# application/cals-1840 -# application/ccmp+xml -application/ccxml+xml ccxml -application/cdmi-capability cdmia -application/cdmi-container cdmic -application/cdmi-domain cdmid -application/cdmi-object cdmio -application/cdmi-queue cdmiq -# application/cea-2018+xml -# application/cellml+xml -# application/cfw -# application/cnrp+xml -# application/commonground -# application/conference-info+xml -# application/cpl+xml -# application/csta+xml -# application/cstadata+xml -application/cu-seeme cu -# application/cybercash -application/davmount+xml davmount -# application/dca-rft -# application/dec-dx -# application/dialog-info+xml -# application/dicom -# application/dns -application/docbook+xml dbk -# application/dskpp+xml -application/dssc+der dssc -application/dssc+xml xdssc -# application/dvcs -application/ecmascript ecma -# application/edi-consent -# application/edi-x12 -# application/edifact -application/emma+xml emma -# application/epp+xml -application/epub+zip epub -# application/eshop -# application/example -application/exi exi -# application/fastinfoset -# application/fastsoap -# application/fits -application/font-tdpfr pfr -# application/framework-attributes+xml -application/gml+xml gml -application/gpx+xml gpx -application/gxf gxf -# application/h224 -# application/held+xml -# application/http -application/hyperstudio stk -# application/ibe-key-request+xml -# application/ibe-pkg-reply+xml -# application/ibe-pp-data -# application/iges -# application/im-iscomposing+xml -# application/index -# application/index.cmd -# application/index.obj -# application/index.response -# application/index.vnd -application/inkml+xml ink inkml -# application/iotp -application/ipfix ipfix -# application/ipp -# application/isup -application/java-archive jar -application/java-serialized-object ser -application/java-vm class -application/javascript js -application/json json -application/jsonml+json jsonml -# application/kpml-request+xml -# application/kpml-response+xml -application/lost+xml lostxml -application/mac-binhex40 hqx -application/mac-compactpro cpt -# application/macwriteii -application/mads+xml mads -application/marc mrc -application/marcxml+xml mrcx -application/mathematica ma nb mb -# application/mathml-content+xml -# application/mathml-presentation+xml -application/mathml+xml mathml -# application/mbms-associated-procedure-description+xml -# application/mbms-deregister+xml -# application/mbms-envelope+xml -# application/mbms-msk+xml -# application/mbms-msk-response+xml -# application/mbms-protection-description+xml -# application/mbms-reception-report+xml -# application/mbms-register+xml -# application/mbms-register-response+xml -# application/mbms-user-service-description+xml -application/mbox mbox -# application/media_control+xml -application/mediaservercontrol+xml mscml -application/metalink+xml metalink -application/metalink4+xml meta4 -application/mets+xml mets -# application/mikey -application/mods+xml mods -# application/moss-keys -# application/moss-signature -# application/mosskey-data -# application/mosskey-request -application/mp21 m21 mp21 -application/mp4 mp4s -# application/mpeg4-generic -# application/mpeg4-iod -# application/mpeg4-iod-xmt -# application/msc-ivr+xml -# application/msc-mixer+xml -application/msword doc dot -application/mxf mxf -# application/nasdata -# application/news-checkgroups -# application/news-groupinfo -# application/news-transmission -# application/nss -# application/ocsp-request -# application/ocsp-response -application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy mobipocket-ebook -application/oda oda -application/oebps-package+xml opf -application/ogg ogx -application/omdoc+xml omdoc -application/onenote onetoc onetoc2 onetmp onepkg -application/oxps oxps -# application/parityfec -application/patch-ops-error+xml xer -application/pdf pdf -application/pgp-encrypted pgp -# application/pgp-keys -application/pgp-signature asc sig -application/pics-rules prf -# application/pidf+xml -# application/pidf-diff+xml -application/pkcs10 p10 -application/pkcs7-mime p7m p7c -application/pkcs7-signature p7s -application/pkcs8 p8 -application/pkix-attr-cert ac -application/pkix-cert cer -application/pkix-crl crl -application/pkix-pkipath pkipath -application/pkixcmp pki -application/pls+xml pls -# application/poc-settings+xml -application/postscript ai eps ps -# application/prs.alvestrand.titrax-sheet -application/prs.cww cww -# application/prs.nprend -# application/prs.plucker -# application/prs.rdf-xml-crypt -# application/prs.xsf+xml -application/pskc+xml pskcxml -# application/qsig -application/rdf+xml rdf -application/reginfo+xml rif -application/relax-ng-compact-syntax rnc -# application/remote-printing -application/resource-lists+xml rl -application/resource-lists-diff+xml rld -# application/riscos -# application/rlmi+xml -application/rls-services+xml rs -application/rpki-ghostbusters gbr -application/rpki-manifest mft -application/rpki-roa roa -# application/rpki-updown -application/rsd+xml rsd -application/rss+xml rss -application/rtf rtf -# application/rtx -# application/samlassertion+xml -# application/samlmetadata+xml -application/sbml+xml sbml -application/scvp-cv-request scq -application/scvp-cv-response scs -application/scvp-vp-request spq -application/scvp-vp-response spp -application/sdp sdp -# application/set-payment -application/set-payment-initiation setpay -# application/set-registration -application/set-registration-initiation setreg -# application/sgml -# application/sgml-open-catalog -application/shf+xml shf -# application/sieve -# application/simple-filter+xml -# application/simple-message-summary -# application/simplesymbolcontainer -# application/slate -# application/smil -application/smil+xml smi smil -# application/soap+fastinfoset -# application/soap+xml -application/sparql-query rq -application/sparql-results+xml srx -# application/spirits-event+xml -application/srgs gram -application/srgs+xml grxml -application/sru+xml sru -application/ssdl+xml ssdl -application/ssml+xml ssml -# application/tamp-apex-update -# application/tamp-apex-update-confirm -# application/tamp-community-update -# application/tamp-community-update-confirm -# application/tamp-error -# application/tamp-sequence-adjust -# application/tamp-sequence-adjust-confirm -# application/tamp-status-query -# application/tamp-status-response -# application/tamp-update -# application/tamp-update-confirm -application/tei+xml tei teicorpus -application/thraud+xml tfi -# application/timestamp-query -# application/timestamp-reply -application/timestamped-data tsd -# application/tve-trigger -# application/ulpfec -# application/vcard+xml -# application/vemmi -# application/vividence.scriptfile -# application/vnd.3gpp.bsf+xml -application/vnd.3gpp.pic-bw-large plb -application/vnd.3gpp.pic-bw-small psb -application/vnd.3gpp.pic-bw-var pvb -# application/vnd.3gpp.sms -# application/vnd.3gpp2.bcmcsinfo+xml -# application/vnd.3gpp2.sms -application/vnd.3gpp2.tcap tcap -application/vnd.3m.post-it-notes pwn -application/vnd.accpac.simply.aso aso -application/vnd.accpac.simply.imp imp -application/vnd.acucobol acu -application/vnd.acucorp atc acutc -application/vnd.adobe.air-application-installer-package+zip air -application/vnd.adobe.formscentral.fcdt fcdt -application/vnd.adobe.fxp fxp fxpl -# application/vnd.adobe.partial-upload -application/vnd.adobe.xdp+xml xdp -application/vnd.adobe.xfdf xfdf -# application/vnd.aether.imp -# application/vnd.ah-barcode -application/vnd.ahead.space ahead -application/vnd.airzip.filesecure.azf azf -application/vnd.airzip.filesecure.azs azs -application/vnd.amazon.ebook azw -application/vnd.americandynamics.acc acc -application/vnd.amiga.ami ami -# application/vnd.amundsen.maze+xml -application/vnd.android.package-archive apk -application/vnd.anser-web-certificate-issue-initiation cii -application/vnd.anser-web-funds-transfer-initiation fti -application/vnd.antix.game-component atx -application/vnd.apple.installer+xml mpkg -application/vnd.apple.mpegurl m3u8 -# application/vnd.arastra.swi -application/vnd.aristanetworks.swi swi -application/vnd.astraea-software.iota iota -application/vnd.audiograph aep -# application/vnd.autopackage -# application/vnd.avistar+xml -application/vnd.blueice.multipass mpm -# application/vnd.bluetooth.ep.oob -application/vnd.bmi bmi -application/vnd.businessobjects rep -# application/vnd.cab-jscript -# application/vnd.canon-cpdl -# application/vnd.canon-lips -# application/vnd.cendio.thinlinc.clientconf -application/vnd.chemdraw+xml cdxml -application/vnd.chipnuts.karaoke-mmd mmd -application/vnd.cinderella cdy -# application/vnd.cirpack.isdn-ext -application/vnd.claymore cla -application/vnd.cloanto.rp9 rp9 -application/vnd.clonk.c4group c4g c4d c4f c4p c4u -application/vnd.cluetrust.cartomobile-config c11amc -application/vnd.cluetrust.cartomobile-config-pkg c11amz -# application/vnd.collection+json -# application/vnd.commerce-battelle -application/vnd.commonspace csp -application/vnd.contact.cmsg cdbcmsg -application/vnd.cosmocaller cmc -application/vnd.crick.clicker clkx -application/vnd.crick.clicker.keyboard clkk -application/vnd.crick.clicker.palette clkp -application/vnd.crick.clicker.template clkt -application/vnd.crick.clicker.wordbank clkw -application/vnd.criticaltools.wbs+xml wbs -application/vnd.ctc-posml pml -# application/vnd.ctct.ws+xml -# application/vnd.cups-pdf -# application/vnd.cups-postscript -application/vnd.cups-ppd ppd -# application/vnd.cups-raster -# application/vnd.cups-raw -# application/vnd.curl -application/vnd.curl.car car -application/vnd.curl.pcurl pcurl -# application/vnd.cybank -application/vnd.dart dart -application/vnd.data-vision.rdz rdz -application/vnd.dece.data uvf uvvf uvd uvvd -application/vnd.dece.ttml+xml uvt uvvt -application/vnd.dece.unspecified uvx uvvx -application/vnd.dece.zip uvz uvvz -application/vnd.denovo.fcselayout-link fe_launch -# application/vnd.dir-bi.plate-dl-nosuffix -application/vnd.dna dna -application/vnd.dolby.mlp mlp -# application/vnd.dolby.mobile.1 -# application/vnd.dolby.mobile.2 -application/vnd.dpgraph dpg -application/vnd.dreamfactory dfac -application/vnd.ds-keypoint kpxx -application/vnd.dvb.ait ait -# application/vnd.dvb.dvbj -# application/vnd.dvb.esgcontainer -# application/vnd.dvb.ipdcdftnotifaccess -# application/vnd.dvb.ipdcesgaccess -# application/vnd.dvb.ipdcesgaccess2 -# application/vnd.dvb.ipdcesgpdd -# application/vnd.dvb.ipdcroaming -# application/vnd.dvb.iptv.alfec-base -# application/vnd.dvb.iptv.alfec-enhancement -# application/vnd.dvb.notif-aggregate-root+xml -# application/vnd.dvb.notif-container+xml -# application/vnd.dvb.notif-generic+xml -# application/vnd.dvb.notif-ia-msglist+xml -# application/vnd.dvb.notif-ia-registration-request+xml -# application/vnd.dvb.notif-ia-registration-response+xml -# application/vnd.dvb.notif-init+xml -# application/vnd.dvb.pfr -application/vnd.dvb.service svc -# application/vnd.dxr -application/vnd.dynageo geo -# application/vnd.easykaraoke.cdgdownload -# application/vnd.ecdis-update -application/vnd.ecowin.chart mag -# application/vnd.ecowin.filerequest -# application/vnd.ecowin.fileupdate -# application/vnd.ecowin.series -# application/vnd.ecowin.seriesrequest -# application/vnd.ecowin.seriesupdate -# application/vnd.emclient.accessrequest+xml -application/vnd.enliven nml -# application/vnd.eprints.data+xml -application/vnd.epson.esf esf -application/vnd.epson.msf msf -application/vnd.epson.quickanime qam -application/vnd.epson.salt slt -application/vnd.epson.ssf ssf -# application/vnd.ericsson.quickcall -application/vnd.eszigno3+xml es3 et3 -# application/vnd.etsi.aoc+xml -# application/vnd.etsi.cug+xml -# application/vnd.etsi.iptvcommand+xml -# application/vnd.etsi.iptvdiscovery+xml -# application/vnd.etsi.iptvprofile+xml -# application/vnd.etsi.iptvsad-bc+xml -# application/vnd.etsi.iptvsad-cod+xml -# application/vnd.etsi.iptvsad-npvr+xml -# application/vnd.etsi.iptvservice+xml -# application/vnd.etsi.iptvsync+xml -# application/vnd.etsi.iptvueprofile+xml -# application/vnd.etsi.mcid+xml -# application/vnd.etsi.overload-control-policy-dataset+xml -# application/vnd.etsi.sci+xml -# application/vnd.etsi.simservs+xml -# application/vnd.etsi.tsl+xml -# application/vnd.etsi.tsl.der -# application/vnd.eudora.data -application/vnd.ezpix-album ez2 -application/vnd.ezpix-package ez3 -# application/vnd.f-secure.mobile -application/vnd.fdf fdf -application/vnd.fdsn.mseed mseed -application/vnd.fdsn.seed seed dataless -# application/vnd.ffsns -# application/vnd.fints -application/vnd.flographit gph -application/vnd.fluxtime.clip ftc -# application/vnd.font-fontforge-sfd -application/vnd.framemaker fm frame maker book -application/vnd.frogans.fnc fnc -application/vnd.frogans.ltf ltf -application/vnd.fsc.weblaunch fsc -application/vnd.fujitsu.oasys oas -application/vnd.fujitsu.oasys2 oa2 -application/vnd.fujitsu.oasys3 oa3 -application/vnd.fujitsu.oasysgp fg5 -application/vnd.fujitsu.oasysprs bh2 -# application/vnd.fujixerox.art-ex -# application/vnd.fujixerox.art4 -# application/vnd.fujixerox.hbpl -application/vnd.fujixerox.ddd ddd -application/vnd.fujixerox.docuworks xdw -application/vnd.fujixerox.docuworks.binder xbd -# application/vnd.fut-misnet -application/vnd.fuzzysheet fzs -application/vnd.genomatix.tuxedo txd -# application/vnd.geocube+xml -application/vnd.geogebra.file ggb -application/vnd.geogebra.tool ggt -application/vnd.geometry-explorer gex gre -application/vnd.geonext gxt -application/vnd.geoplan g2w -application/vnd.geospace g3w -# application/vnd.globalplatform.card-content-mgt -# application/vnd.globalplatform.card-content-mgt-response -application/vnd.gmx gmx -application/vnd.google-earth.kml+xml kml -application/vnd.google-earth.kmz kmz -application/vnd.grafeq gqf gqs -# application/vnd.gridmp -application/vnd.groove-account gac -application/vnd.groove-help ghf -application/vnd.groove-identity-message gim -application/vnd.groove-injector grv -application/vnd.groove-tool-message gtm -application/vnd.groove-tool-template tpl -application/vnd.groove-vcard vcg -# application/vnd.hal+json -application/vnd.hal+xml hal -application/vnd.handheld-entertainment+xml zmm -application/vnd.hbci hbci -# application/vnd.hcl-bireports -application/vnd.hhe.lesson-player les -application/vnd.hp-hpgl hpgl -application/vnd.hp-hpid hpid -application/vnd.hp-hps hps -application/vnd.hp-jlyt jlt -application/vnd.hp-pcl pcl -application/vnd.hp-pclxl pclxl -# application/vnd.httphone -application/vnd.hydrostatix.sof-data sfd-hdstx -# application/vnd.hzn-3d-crossword -# application/vnd.ibm.afplinedata -# application/vnd.ibm.electronic-media -application/vnd.ibm.minipay mpy -application/vnd.ibm.modcap afp listafp list3820 -application/vnd.ibm.rights-management irm -application/vnd.ibm.secure-container sc -application/vnd.iccprofile icc icm -application/vnd.igloader igl -application/vnd.immervision-ivp ivp -application/vnd.immervision-ivu ivu -# application/vnd.informedcontrol.rms+xml -# application/vnd.informix-visionary -# application/vnd.infotech.project -# application/vnd.infotech.project+xml -# application/vnd.innopath.wamp.notification -application/vnd.insors.igm igm -application/vnd.intercon.formnet xpw xpx -application/vnd.intergeo i2g -# application/vnd.intertrust.digibox -# application/vnd.intertrust.nncp -application/vnd.intu.qbo qbo -application/vnd.intu.qfx qfx -# application/vnd.iptc.g2.conceptitem+xml -# application/vnd.iptc.g2.knowledgeitem+xml -# application/vnd.iptc.g2.newsitem+xml -# application/vnd.iptc.g2.newsmessage+xml -# application/vnd.iptc.g2.packageitem+xml -# application/vnd.iptc.g2.planningitem+xml -application/vnd.ipunplugged.rcprofile rcprofile -application/vnd.irepository.package+xml irp -application/vnd.is-xpr xpr -application/vnd.isac.fcs fcs -application/vnd.jam jam -# application/vnd.japannet-directory-service -# application/vnd.japannet-jpnstore-wakeup -# application/vnd.japannet-payment-wakeup -# application/vnd.japannet-registration -# application/vnd.japannet-registration-wakeup -# application/vnd.japannet-setstore-wakeup -# application/vnd.japannet-verification -# application/vnd.japannet-verification-wakeup -application/vnd.jcp.javame.midlet-rms rms -application/vnd.jisp jisp -application/vnd.joost.joda-archive joda -application/vnd.kahootz ktz ktr -application/vnd.kde.karbon karbon -application/vnd.kde.kchart chrt -application/vnd.kde.kformula kfo -application/vnd.kde.kivio flw -application/vnd.kde.kontour kon -application/vnd.kde.kpresenter kpr kpt -application/vnd.kde.kspread ksp -application/vnd.kde.kword kwd kwt -application/vnd.kenameaapp htke -application/vnd.kidspiration kia -application/vnd.kinar kne knp -application/vnd.koan skp skd skt skm -application/vnd.kodak-descriptor sse -application/vnd.las.las+xml lasxml -# application/vnd.liberty-request+xml -application/vnd.llamagraphics.life-balance.desktop lbd -application/vnd.llamagraphics.life-balance.exchange+xml lbe -application/vnd.lotus-1-2-3 123 -application/vnd.lotus-approach apr -application/vnd.lotus-freelance pre -application/vnd.lotus-notes nsf -application/vnd.lotus-organizer org -application/vnd.lotus-screencam scm -application/vnd.lotus-wordpro lwp -application/vnd.macports.portpkg portpkg -# application/vnd.marlin.drm.actiontoken+xml -# application/vnd.marlin.drm.conftoken+xml -# application/vnd.marlin.drm.license+xml -# application/vnd.marlin.drm.mdcf -application/vnd.mcd mcd -application/vnd.medcalcdata mc1 -application/vnd.mediastation.cdkey cdkey -# application/vnd.meridian-slingshot -application/vnd.mfer mwf -application/vnd.mfmp mfm -application/vnd.micrografx.flo flo -application/vnd.micrografx.igx igx -application/vnd.mif mif -# application/vnd.minisoft-hp3000-save -# application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf daf -application/vnd.mobius.dis dis -application/vnd.mobius.mbk mbk -application/vnd.mobius.mqy mqy -application/vnd.mobius.msl msl -application/vnd.mobius.plc plc -application/vnd.mobius.txf txf -application/vnd.mophun.application mpn -application/vnd.mophun.certificate mpc -# application/vnd.motorola.flexsuite -# application/vnd.motorola.flexsuite.adsi -# application/vnd.motorola.flexsuite.fis -# application/vnd.motorola.flexsuite.gotap -# application/vnd.motorola.flexsuite.kmr -# application/vnd.motorola.flexsuite.ttc -# application/vnd.motorola.flexsuite.wem -# application/vnd.motorola.iprm -application/vnd.mozilla.xul+xml xul -application/vnd.ms-artgalry cil -# application/vnd.ms-asf -application/vnd.ms-cab-compressed cab -# application/vnd.ms-color.iccprofile -application/vnd.ms-excel xls xlm xla xlc xlt xlw -application/vnd.ms-excel.addin.macroenabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb -application/vnd.ms-excel.sheet.macroenabled.12 xlsm -application/vnd.ms-excel.template.macroenabled.12 xltm -application/vnd.ms-fontobject eot -application/vnd.ms-htmlhelp chm -application/vnd.ms-ims ims -application/vnd.ms-lrm lrm -# application/vnd.ms-office.activex+xml -application/vnd.ms-officetheme thmx -# application/vnd.ms-opentype -# application/vnd.ms-package.obfuscated-opentype -application/vnd.ms-pki.seccat cat -application/vnd.ms-pki.stl stl -# application/vnd.ms-playready.initiator+xml -application/vnd.ms-powerpoint ppt pps pot -application/vnd.ms-powerpoint.addin.macroenabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm -application/vnd.ms-powerpoint.slide.macroenabled.12 sldm -application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm -application/vnd.ms-powerpoint.template.macroenabled.12 potm -# application/vnd.ms-printing.printticket+xml -application/vnd.ms-project mpp mpt -# application/vnd.ms-tnef -# application/vnd.ms-wmdrm.lic-chlg-req -# application/vnd.ms-wmdrm.lic-resp -# application/vnd.ms-wmdrm.meter-chlg-req -# application/vnd.ms-wmdrm.meter-resp -application/vnd.ms-word.document.macroenabled.12 docm -application/vnd.ms-word.template.macroenabled.12 dotm -application/vnd.ms-works wps wks wcm wdb -application/vnd.ms-wpl wpl -application/vnd.ms-xpsdocument xps -application/vnd.mseq mseq -# application/vnd.msign -# application/vnd.multiad.creator -# application/vnd.multiad.creator.cif -# application/vnd.music-niff -application/vnd.musician mus -application/vnd.muvee.style msty -application/vnd.mynfc taglet -# application/vnd.ncd.control -# application/vnd.ncd.reference -# application/vnd.nervana -# application/vnd.netfpx -application/vnd.neurolanguage.nlu nlu -application/vnd.nitf ntf nitf -application/vnd.noblenet-directory nnd -application/vnd.noblenet-sealer nns -application/vnd.noblenet-web nnw -# application/vnd.nokia.catalogs -# application/vnd.nokia.conml+wbxml -# application/vnd.nokia.conml+xml -# application/vnd.nokia.isds-radio-presets -# application/vnd.nokia.iptv.config+xml -# application/vnd.nokia.landmark+wbxml -# application/vnd.nokia.landmark+xml -# application/vnd.nokia.landmarkcollection+xml -# application/vnd.nokia.n-gage.ac+xml -application/vnd.nokia.n-gage.data ngdat -application/vnd.nokia.n-gage.symbian.install n-gage -# application/vnd.nokia.ncd -# application/vnd.nokia.pcd+wbxml -# application/vnd.nokia.pcd+xml -application/vnd.nokia.radio-preset rpst -application/vnd.nokia.radio-presets rpss -application/vnd.novadigm.edm edm -application/vnd.novadigm.edx edx -application/vnd.novadigm.ext ext -# application/vnd.ntt-local.file-transfer -# application/vnd.ntt-local.sip-ta_remote -# application/vnd.ntt-local.sip-ta_tcp_stream -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template odft -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -# application/vnd.obn -# application/vnd.oftn.l10n+json -# application/vnd.oipf.contentaccessdownload+xml -# application/vnd.oipf.contentaccessstreaming+xml -# application/vnd.oipf.cspg-hexbinary -# application/vnd.oipf.dae.svg+xml -# application/vnd.oipf.dae.xhtml+xml -# application/vnd.oipf.mippvcontrolmessage+xml -# application/vnd.oipf.pae.gem -# application/vnd.oipf.spdiscovery+xml -# application/vnd.oipf.spdlist+xml -# application/vnd.oipf.ueprofile+xml -# application/vnd.oipf.userprofile+xml -application/vnd.olpc-sugar xo -# application/vnd.oma-scws-config -# application/vnd.oma-scws-http-request -# application/vnd.oma-scws-http-response -# application/vnd.oma.bcast.associated-procedure-parameter+xml -# application/vnd.oma.bcast.drm-trigger+xml -# application/vnd.oma.bcast.imd+xml -# application/vnd.oma.bcast.ltkm -# application/vnd.oma.bcast.notification+xml -# application/vnd.oma.bcast.provisioningtrigger -# application/vnd.oma.bcast.sgboot -# application/vnd.oma.bcast.sgdd+xml -# application/vnd.oma.bcast.sgdu -# application/vnd.oma.bcast.simple-symbol-container -# application/vnd.oma.bcast.smartcard-trigger+xml -# application/vnd.oma.bcast.sprov+xml -# application/vnd.oma.bcast.stkm -# application/vnd.oma.cab-address-book+xml -# application/vnd.oma.cab-feature-handler+xml -# application/vnd.oma.cab-pcc+xml -# application/vnd.oma.cab-user-prefs+xml -# application/vnd.oma.dcd -# application/vnd.oma.dcdc -application/vnd.oma.dd2+xml dd2 -# application/vnd.oma.drm.risd+xml -# application/vnd.oma.group-usage-list+xml -# application/vnd.oma.pal+xml -# application/vnd.oma.poc.detailed-progress-report+xml -# application/vnd.oma.poc.final-report+xml -# application/vnd.oma.poc.groups+xml -# application/vnd.oma.poc.invocation-descriptor+xml -# application/vnd.oma.poc.optimized-progress-report+xml -# application/vnd.oma.push -# application/vnd.oma.scidm.messages+xml -# application/vnd.oma.xcap-directory+xml -# application/vnd.omads-email+xml -# application/vnd.omads-file+xml -# application/vnd.omads-folder+xml -# application/vnd.omaloc-supl-init -application/vnd.openofficeorg.extension oxt -# application/vnd.openxmlformats-officedocument.custom-properties+xml -# application/vnd.openxmlformats-officedocument.customxmlproperties+xml -# application/vnd.openxmlformats-officedocument.drawing+xml -# application/vnd.openxmlformats-officedocument.drawingml.chart+xml -# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml -# application/vnd.openxmlformats-officedocument.extended-properties+xml -# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml -# application/vnd.openxmlformats-officedocument.presentationml.comments+xml -# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml -application/vnd.openxmlformats-officedocument.presentationml.slide sldx -# application/vnd.openxmlformats-officedocument.presentationml.slide+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml -# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml -# application/vnd.openxmlformats-officedocument.presentationml.tags+xml -application/vnd.openxmlformats-officedocument.presentationml.template potx -# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml -# application/vnd.openxmlformats-officedocument.theme+xml -# application/vnd.openxmlformats-officedocument.themeoverride+xml -# application/vnd.openxmlformats-officedocument.vmldrawing -# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml -# application/vnd.openxmlformats-package.core-properties+xml -# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml -# application/vnd.openxmlformats-package.relationships+xml -# application/vnd.quobject-quoxdocument -# application/vnd.osa.netdeploy -application/vnd.osgeo.mapguide.package mgp -# application/vnd.osgi.bundle -application/vnd.osgi.dp dp -application/vnd.osgi.subsystem esa -# application/vnd.otps.ct-kip+xml -application/vnd.palm pdb pqa oprc -# application/vnd.paos.xml -application/vnd.pawaafile paw -application/vnd.pg.format str -application/vnd.pg.osasli ei6 -# application/vnd.piaccess.application-licence -application/vnd.picsel efif -application/vnd.pmi.widget wg -# application/vnd.poc.group-advertisement+xml -application/vnd.pocketlearn plf -application/vnd.powerbuilder6 pbd -# application/vnd.powerbuilder6-s -# application/vnd.powerbuilder7 -# application/vnd.powerbuilder7-s -# application/vnd.powerbuilder75 -# application/vnd.powerbuilder75-s -# application/vnd.preminet -application/vnd.previewsystems.box box -application/vnd.proteus.magazine mgz -application/vnd.publishare-delta-tree qps -application/vnd.pvi.ptid1 ptid -# application/vnd.pwg-multiplexed -# application/vnd.pwg-xhtml-print+xml -# application/vnd.qualcomm.brew-app-res -application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb -# application/vnd.radisys.moml+xml -# application/vnd.radisys.msml+xml -# application/vnd.radisys.msml-audit+xml -# application/vnd.radisys.msml-audit-conf+xml -# application/vnd.radisys.msml-audit-conn+xml -# application/vnd.radisys.msml-audit-dialog+xml -# application/vnd.radisys.msml-audit-stream+xml -# application/vnd.radisys.msml-conf+xml -# application/vnd.radisys.msml-dialog+xml -# application/vnd.radisys.msml-dialog-base+xml -# application/vnd.radisys.msml-dialog-fax-detect+xml -# application/vnd.radisys.msml-dialog-fax-sendrecv+xml -# application/vnd.radisys.msml-dialog-group+xml -# application/vnd.radisys.msml-dialog-speech+xml -# application/vnd.radisys.msml-dialog-transform+xml -# application/vnd.rainstor.data -# application/vnd.rapid -application/vnd.realvnc.bed bed -application/vnd.recordare.musicxml mxl -application/vnd.recordare.musicxml+xml musicxml -# application/vnd.renlearn.rlprint -application/vnd.rig.cryptonote cryptonote -application/vnd.rim.cod cod -application/vnd.rn-realmedia rm -application/vnd.rn-realmedia-vbr rmvb -application/vnd.route66.link66+xml link66 -# application/vnd.rs-274x -# application/vnd.ruckus.download -# application/vnd.s3sms -application/vnd.sailingtracker.track st -# application/vnd.sbm.cid -# application/vnd.sbm.mid2 -# application/vnd.scribus -# application/vnd.sealed.3df -# application/vnd.sealed.csf -# application/vnd.sealed.doc -# application/vnd.sealed.eml -# application/vnd.sealed.mht -# application/vnd.sealed.net -# application/vnd.sealed.ppt -# application/vnd.sealed.tiff -# application/vnd.sealed.xls -# application/vnd.sealedmedia.softseal.html -# application/vnd.sealedmedia.softseal.pdf -application/vnd.seemail see -application/vnd.sema sema -application/vnd.semd semd -application/vnd.semf semf -application/vnd.shana.informed.formdata ifm -application/vnd.shana.informed.formtemplate itp -application/vnd.shana.informed.interchange iif -application/vnd.shana.informed.package ipk -application/vnd.simtech-mindmapper twd twds -application/vnd.smaf mmf -# application/vnd.smart.notebook -application/vnd.smart.teacher teacher -# application/vnd.software602.filler.form+xml -# application/vnd.software602.filler.form-xml-zip -application/vnd.solent.sdkm+xml sdkm sdkd -application/vnd.spotfire.dxp dxp -application/vnd.spotfire.sfs sfs -# application/vnd.sss-cod -# application/vnd.sss-dtf -# application/vnd.sss-ntf -application/vnd.stardivision.calc sdc -application/vnd.stardivision.draw sda -application/vnd.stardivision.impress sdd -application/vnd.stardivision.math smf -application/vnd.stardivision.writer sdw vor -application/vnd.stardivision.writer-global sgl -application/vnd.stepmania.package smzip -application/vnd.stepmania.stepchart sm -# application/vnd.street-stream -application/vnd.sun.xml.calc sxc -application/vnd.sun.xml.calc.template stc -application/vnd.sun.xml.draw sxd -application/vnd.sun.xml.draw.template std -application/vnd.sun.xml.impress sxi -application/vnd.sun.xml.impress.template sti -application/vnd.sun.xml.math sxm -application/vnd.sun.xml.writer sxw -application/vnd.sun.xml.writer.global sxg -application/vnd.sun.xml.writer.template stw -# application/vnd.sun.wadl+xml -application/vnd.sus-calendar sus susp -application/vnd.svd svd -# application/vnd.swiftview-ics -application/vnd.symbian.install sis sisx -application/vnd.syncml+xml xsm -application/vnd.syncml.dm+wbxml bdm -application/vnd.syncml.dm+xml xdm -# application/vnd.syncml.dm.notification -# application/vnd.syncml.ds.notification -application/vnd.tao.intent-module-archive tao -application/vnd.tcpdump.pcap pcap cap dmp -application/vnd.tmobile-livetv tmo -application/vnd.trid.tpt tpt -application/vnd.triscape.mxs mxs -application/vnd.trueapp tra -# application/vnd.truedoc -# application/vnd.ubisoft.webplayer -application/vnd.ufdl ufd ufdl -application/vnd.uiq.theme utz -application/vnd.umajin umj -application/vnd.unity unityweb -application/vnd.uoml+xml uoml -# application/vnd.uplanet.alert -# application/vnd.uplanet.alert-wbxml -# application/vnd.uplanet.bearer-choice -# application/vnd.uplanet.bearer-choice-wbxml -# application/vnd.uplanet.cacheop -# application/vnd.uplanet.cacheop-wbxml -# application/vnd.uplanet.channel -# application/vnd.uplanet.channel-wbxml -# application/vnd.uplanet.list -# application/vnd.uplanet.list-wbxml -# application/vnd.uplanet.listcmd -# application/vnd.uplanet.listcmd-wbxml -# application/vnd.uplanet.signal -application/vnd.vcx vcx -# application/vnd.vd-study -# application/vnd.vectorworks -# application/vnd.verimatrix.vcas -# application/vnd.vidsoft.vidconference -application/vnd.visio vsd vst vss vsw -application/vnd.visionary vis -# application/vnd.vividence.scriptfile -application/vnd.vsf vsf -# application/vnd.wap.sic -# application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo wtb -# application/vnd.wfa.wsc -# application/vnd.wmc -# application/vnd.wmf.bootstrap -# application/vnd.wolfram.mathematica -# application/vnd.wolfram.mathematica.package -application/vnd.wolfram.player nbp -application/vnd.wordperfect wpd -application/vnd.wqd wqd -# application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf stf -# application/vnd.wv.csp+wbxml -# application/vnd.wv.csp+xml -# application/vnd.wv.ssp+xml -application/vnd.xara xar -application/vnd.xfdl xfdl -# application/vnd.xfdl.webform -# application/vnd.xmi+xml -# application/vnd.xmpie.cpkg -# application/vnd.xmpie.dpkg -# application/vnd.xmpie.plan -# application/vnd.xmpie.ppkg -# application/vnd.xmpie.xlim -application/vnd.yamaha.hv-dic hvd -application/vnd.yamaha.hv-script hvs -application/vnd.yamaha.hv-voice hvp -application/vnd.yamaha.openscoreformat osf -application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg -# application/vnd.yamaha.remote-setup -application/vnd.yamaha.smaf-audio saf -application/vnd.yamaha.smaf-phrase spf -# application/vnd.yamaha.through-ngn -# application/vnd.yamaha.tunnel-udpencap -application/vnd.yellowriver-custom-menu cmp -application/vnd.zul zir zirz -application/vnd.zzazz.deck+xml zaz -application/voicexml+xml vxml -# application/vq-rtcpxr -# application/watcherinfo+xml -# application/whoispp-query -# application/whoispp-response -application/widget wgt -application/winhlp hlp -# application/wita -# application/wordperfect5.1 -application/wsdl+xml wsdl -application/wspolicy+xml wspolicy -application/x-7z-compressed 7z -application/x-abiword abw -application/x-ace-compressed ace -# application/x-amf -application/x-apple-diskimage dmg -application/x-authorware-bin aab x32 u32 vox -application/x-authorware-map aam -application/x-authorware-seg aas -application/x-bcpio bcpio -application/x-bittorrent torrent -application/x-blorb blb blorb -application/x-bzip bz -application/x-bzip2 bz2 boz -application/x-cbr cbr cba cbt cbz cb7 -application/x-cdlink vcd -application/x-cfs-compressed cfs -application/x-chat chat -application/x-chess-pgn pgn -application/x-conference nsc -# application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-debian-package deb udeb -application/x-dgc-compressed dgc -application/x-director dir dcr dxr cst cct cxt w3d fgd swa -application/x-doom wad -application/x-dtbncx+xml ncx -application/x-dtbook+xml dtb -application/x-dtbresource+xml res -application/x-dvi dvi -application/x-envoy evy -application/x-eva eva -application/x-font-bdf bdf -# application/x-font-dos -# application/x-font-framemaker -application/x-font-ghostscript gsf -# application/x-font-libgrx -application/x-font-linux-psf psf -application/x-font-otf otf -application/x-font-pcf pcf -application/x-font-snf snf -# application/x-font-speedo -# application/x-font-sunos-news -application/x-font-ttf ttf ttc -application/x-font-type1 pfa pfb pfm afm -application/x-font-woff woff -# application/x-font-vfont -application/x-freearc arc -application/x-futuresplash spl -application/x-gca-compressed gca -application/x-glulx ulx -application/x-gnumeric gnumeric -application/x-gramps-xml gramps -application/x-gtar gtar -# application/x-gzip -application/x-hdf hdf -application/x-install-instructions install -application/x-iso9660-image iso -application/x-java-jnlp-file jnlp -application/x-latex latex -application/x-lzh-compressed lzh lha -application/x-mie mie -application/x-mobipocket-ebook prc mobi -application/x-mpegurl m3u8 -application/x-ms-application application -application/x-ms-shortcut lnk -application/x-ms-wmd wmd -application/x-ms-wmz wmz -application/x-ms-xbap xbap -application/x-msaccess mdb -application/x-msbinder obd -application/x-mscardfile crd -application/x-msclip clp -application/x-msdownload exe dll com bat msi -application/x-msmediaview mvb m13 m14 -application/x-msmetafile wmf wmz emf emz -application/x-msmoney mny -application/x-mspublisher pub -application/x-msschedule scd -application/x-msterminal trm -application/x-mswrite wri -application/x-netcdf nc cdf -application/x-nzb nzb -application/x-pkcs12 p12 pfx -application/x-pkcs7-certificates p7b spc -application/x-pkcs7-certreqresp p7r -application/x-rar-compressed rar -application/x-research-info-systems ris -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-silverlight-app xap -application/x-sql sql -application/x-stuffit sit -application/x-stuffitx sitx -application/x-subrip srt -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-t3vm-image t3 -application/x-tads gam -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-tex-tfm tfm -application/x-texinfo texinfo texi -application/x-tgif obj -application/x-ustar ustar -application/x-wais-source src -application/x-x509-ca-cert der crt -application/x-xfig fig -application/x-xliff+xml xlf -application/x-xpinstall xpi -application/x-xz xz -application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 -# application/x400-bp -application/xaml+xml xaml -# application/xcap-att+xml -# application/xcap-caps+xml -application/xcap-diff+xml xdf -# application/xcap-el+xml -# application/xcap-error+xml -# application/xcap-ns+xml -# application/xcon-conference-info-diff+xml -# application/xcon-conference-info+xml -application/xenc+xml xenc -application/xhtml+xml xhtml xht -# application/xhtml-voice+xml -application/xml xml xsl -application/xml-dtd dtd -# application/xml-external-parsed-entity -# application/xmpp+xml -application/xop+xml xop -application/xproc+xml xpl -application/xslt+xml xslt -application/xspf+xml xspf -application/xv+xml mxml xhvml xvml xvm -application/yang yang -application/yin+xml yin -application/zip zip -# audio/1d-interleaved-parityfec -# audio/32kadpcm -# audio/3gpp -# audio/3gpp2 -# audio/ac3 -audio/adpcm adp -# audio/amr -# audio/amr-wb -# audio/amr-wb+ -# audio/asc -# audio/atrac-advanced-lossless -# audio/atrac-x -# audio/atrac3 -audio/basic au snd -# audio/bv16 -# audio/bv32 -# audio/clearmode -# audio/cn -# audio/dat12 -# audio/dls -# audio/dsr-es201108 -# audio/dsr-es202050 -# audio/dsr-es202211 -# audio/dsr-es202212 -# audio/dv -# audio/dvi4 -# audio/eac3 -# audio/evrc -# audio/evrc-qcp -# audio/evrc0 -# audio/evrc1 -# audio/evrcb -# audio/evrcb0 -# audio/evrcb1 -# audio/evrcwb -# audio/evrcwb0 -# audio/evrcwb1 -# audio/example -# audio/fwdred -# audio/g719 -# audio/g722 -# audio/g7221 -# audio/g723 -# audio/g726-16 -# audio/g726-24 -# audio/g726-32 -# audio/g726-40 -# audio/g728 -# audio/g729 -# audio/g7291 -# audio/g729d -# audio/g729e -# audio/gsm -# audio/gsm-efr -# audio/gsm-hr-08 -# audio/ilbc -# audio/ip-mr_v2.5 -# audio/isac -# audio/l16 -# audio/l20 -# audio/l24 -# audio/l8 -# audio/lpc -audio/midi mid midi kar rmi -# audio/mobile-xmf -audio/mp4 mp4a -# audio/mp4a-latm -audio/mp4a-latm m4a m4p -# audio/mpa -# audio/mpa-robust -audio/mpeg mpga mp2 mp2a mp3 m2a m3a -# audio/mpeg4-generic -# audio/musepack -audio/ogg oga ogg spx -# audio/opus -# audio/parityfec -# audio/pcma -# audio/pcma-wb -# audio/pcmu-wb -# audio/pcmu -# audio/prs.sid -# audio/qcelp -# audio/red -# audio/rtp-enc-aescm128 -# audio/rtp-midi -# audio/rtx -audio/s3m s3m -audio/silk sil -# audio/smv -# audio/smv0 -# audio/smv-qcp -# audio/sp-midi -# audio/speex -# audio/t140c -# audio/t38 -# audio/telephone-event -# audio/tone -# audio/uemclip -# audio/ulpfec -# audio/vdvi -# audio/vmr-wb -# audio/vnd.3gpp.iufp -# audio/vnd.4sb -# audio/vnd.audiokoz -# audio/vnd.celp -# audio/vnd.cisco.nse -# audio/vnd.cmles.radio-events -# audio/vnd.cns.anp1 -# audio/vnd.cns.inf1 -audio/vnd.dece.audio uva uvva -audio/vnd.digital-winds eol -# audio/vnd.dlna.adts -# audio/vnd.dolby.heaac.1 -# audio/vnd.dolby.heaac.2 -# audio/vnd.dolby.mlp -# audio/vnd.dolby.mps -# audio/vnd.dolby.pl2 -# audio/vnd.dolby.pl2x -# audio/vnd.dolby.pl2z -# audio/vnd.dolby.pulse.1 -audio/vnd.dra dra -audio/vnd.dts dts -audio/vnd.dts.hd dtshd -# audio/vnd.dvb.file -# audio/vnd.everad.plj -# audio/vnd.hns.audio -audio/vnd.lucent.voice lvp -audio/vnd.ms-playready.media.pya pya -# audio/vnd.nokia.mobile-xmf -# audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 ecelp4800 -audio/vnd.nuera.ecelp7470 ecelp7470 -audio/vnd.nuera.ecelp9600 ecelp9600 -# audio/vnd.octel.sbc -# audio/vnd.qcelp -# audio/vnd.rhetorex.32kadpcm -audio/vnd.rip rip -# audio/vnd.sealedmedia.softseal.mpeg -# audio/vnd.vmx.cvsd -# audio/vorbis -# audio/vorbis-config -audio/webm weba -audio/x-aac aac -audio/x-aiff aif aiff aifc -audio/x-caf caf -audio/x-flac flac -audio/x-matroska mka -audio/x-mpegurl m3u -audio/x-ms-wax wax -audio/x-ms-wma wma -audio/x-pn-realaudio ram ra -audio/x-pn-realaudio-plugin rmp -# audio/x-tta -audio/x-wav wav -audio/xm xm -chemical/x-cdx cdx -chemical/x-cif cif -chemical/x-cmdf cmdf -chemical/x-cml cml -chemical/x-csml csml -# chemical/x-pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -# image/example -# image/fits -image/g3fax g3 -image/gif gif -image/ief ief -# image/jp2 -image/jp2 jp2 -image/jpeg jpeg jpg jpe -# image/jpm -# image/jpx -image/ktx ktx -# image/naplps -image/pict pict pic pct -image/png png -image/prs.btif btif -# image/prs.pti -image/sgi sgi -image/svg+xml svg svgz -# image/t38 -image/tiff tiff tif -# image/tiff-fx -image/vnd.adobe.photoshop psd -# image/vnd.cns.inf2 -image/vnd.dece.graphic uvi uvvi uvg uvvg -image/vnd.dvb.subtitle sub -image/vnd.djvu djvu djv -image/vnd.dwg dwg -image/vnd.dxf dxf -image/vnd.fastbidsheet fbs -image/vnd.fpx fpx -image/vnd.fst fst -image/vnd.fujixerox.edmics-mmr mmr -image/vnd.fujixerox.edmics-rlc rlc -# image/vnd.globalgraphics.pgb -# image/vnd.microsoft.icon -# image/vnd.mix -image/vnd.ms-modi mdi -image/vnd.ms-photo wdp -image/vnd.net-fpx npx -# image/vnd.radiance -# image/vnd.sealed.png -# image/vnd.sealedmedia.softseal.gif -# image/vnd.sealedmedia.softseal.jpg -# image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff xif -image/webp webp -image/x-3ds 3ds -image/x-cmu-raster ras -image/x-cmx cmx -image/x-freehand fh fhc fh4 fh5 fh7 -image/x-icon ico -image/x-macpaint pntg pnt mac -image/x-mrsid-image sid -image/x-pcx pcx -image/x-pict pic pct -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-quicktime qtif qti -image/x-rgb rgb -image/x-tga tga -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -# message/cpim -# message/delivery-status -# message/disposition-notification -# message/example -# message/external-body -# message/feedback-report -# message/global -# message/global-delivery-status -# message/global-disposition-notification -# message/global-headers -# message/http -# message/imdn+xml -# message/news -# message/partial -message/rfc822 eml mime -# message/s-http -# message/sip -# message/sipfrag -# message/tracking-status -# message/vnd.si.simp -# model/example -model/iges igs iges -model/mesh msh mesh silo -model/vnd.collada+xml dae -model/vnd.dwf dwf -# model/vnd.flatland.3dml -model/vnd.gdl gdl -# model/vnd.gs-gdl -# model/vnd.gs.gdl -model/vnd.gtw gtw -# model/vnd.moml+xml -model/vnd.mts mts -# model/vnd.parasolid.transmit.binary -# model/vnd.parasolid.transmit.text -model/vnd.vtu vtu -model/vrml wrl vrml -model/x3d+binary x3db x3dbz -model/x3d+vrml x3dv x3dvz -model/x3d+xml x3d x3dz -# multipart/alternative -# multipart/appledouble -# multipart/byteranges -# multipart/digest -# multipart/encrypted -# multipart/example -# multipart/form-data -# multipart/header-set -# multipart/mixed -# multipart/parallel -# multipart/related -# multipart/report -# multipart/signed -# multipart/voice-message -text/cache-manifest manifest -# text/1d-interleaved-parityfec -text/cache-manifest appcache -text/calendar ics ifb -text/css css -text/csv csv -# text/directory -# text/dns -# text/ecmascript -# text/enriched -# text/example -# text/fwdred -text/html html htm -# text/javascript -text/n3 n3 -# text/parityfec -text/plain txt text conf def list log in -# text/prs.fallenstein.rst -text/prs.lines.tag dsc -# text/vnd.radisys.msml-basic-layout -# text/red -# text/rfc822-headers -text/richtext rtx -# text/rtf -# text/rtp-enc-aescm128 -# text/rtx -text/sgml sgml sgm -# text/t140 -text/tab-separated-values tsv -text/troff t tr roff man me ms -text/turtle ttl -# text/ulpfec -text/uri-list uri uris urls -text/vcard vcard -# text/vnd.abc -text/vnd.curl curl -text/vnd.curl.dcurl dcurl -text/vnd.curl.scurl scurl -text/vnd.curl.mcurl mcurl -# text/vnd.dmclientscript -text/vnd.dvb.subtitle sub -# text/vnd.esmertec.theme-descriptor -text/vnd.fly fly -text/vnd.fmi.flexstor flx -text/vnd.graphviz gv -text/vnd.in3d.3dml 3dml -text/vnd.in3d.spot spot -# text/vnd.iptc.newsml -# text/vnd.iptc.nitf -# text/vnd.latex-z -# text/vnd.motorola.reflex -# text/vnd.ms-mediapackage -# text/vnd.net2phone.commcenter.command -# text/vnd.si.uricatalogue -text/vnd.sun.j2me.app-descriptor jad -# text/vnd.trolltech.linguist -# text/vnd.wap.si -# text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-asm s asm -text/x-c c cc cxx cpp h hh dic -text/x-fortran f for f77 f90 -text/x-java-source java -text/x-opml opml -text/x-pascal p pas -text/x-nfo nfo -text/x-setext etx -text/x-sfv sfv -text/x-uuencode uu -text/x-vcalendar vcs -text/x-vcard vcf -# text/xml -# text/xml-external-parsed-entity -# video/1d-interleaved-parityfec -video/3gpp 3gp -# video/3gpp-tt -video/3gpp2 3g2 -# video/bmpeg -# video/bt656 -# video/celb -# video/dv -# video/example -video/h261 h261 -video/h263 h263 -# video/h263-1998 -# video/h263-2000 -video/h264 h264 -# video/h264-rcdo -# video/h264-svc -video/jpeg jpgv -# video/jpeg2000 -video/jpm jpm jpgm -video/mj2 mj2 mjp2 -# video/mp1s -# video/mp2p -# video/mp4v-es -video/mp2t ts -video/mp4 mp4 mp4v mpg4 m4v -video/mpeg mpeg mpg mpe m1v m2v -# video/mpeg4-generic -# video/mpv -# video/nv -video/ogg ogv -# video/parityfec -# video/pointer -video/quicktime qt mov -# video/raw -# video/rtp-enc-aescm128 -# video/rtx -# video/smpte292m -# video/ulpfec -# video/vc1 -# video/vnd.cctv -video/vnd.dece.hd uvh uvvh -video/vnd.dece.mobile uvm uvvm -# video/vnd.dece.mp4 -video/vnd.dece.pd uvp uvvp -video/vnd.dece.sd uvs uvvs -video/vnd.dece.video uvv uvvv -# video/vnd.directv.mpeg -# video/vnd.directv.mpeg-tts -# video/vnd.dlna.mpeg-tts -video/vnd.dvb.file dvb -video/vnd.fvt fvt -# video/vnd.hns.video -# video/vnd.iptvforum.1dparityfec-1010 -# video/vnd.iptvforum.1dparityfec-2005 -# video/vnd.iptvforum.2dparityfec-1010 -# video/vnd.iptvforum.2dparityfec-2005 -# video/vnd.iptvforum.ttsavc -# video/vnd.iptvforum.ttsmpeg2 -# video/vnd.motorola.video -# video/vnd.motorola.videop -video/vnd.mpegurl mxu m4u -video/vnd.ms-playready.media.pyv pyv -# video/vnd.nokia.interleaved-multimedia -# video/vnd.nokia.videovoip -# video/vnd.objectvideo -# video/vnd.sealed.mpeg1 -# video/vnd.sealed.mpeg4 -# video/vnd.sealed.swf -# video/vnd.sealedmedia.softseal.mov -video/vnd.uvvu.mp4 uvu uvvu -video/vnd.vivo viv -video/x-dv dv dif -video/webm webm -video/x-f4v f4v -video/x-fli fli -video/x-flv flv -video/x-m4v m4v -video/x-matroska mkv mk3d mks -video/x-mng mng -video/x-ms-asf asf asx -video/x-ms-vob vob -video/x-ms-wm wm -video/x-ms-wmv wmv -video/x-ms-wmx wmx -video/x-ms-wvx wvx -video/x-msvideo avi -video/x-sgi-movie movie -video/x-smv smv -x-conference/x-cooltalk ice diff --git a/misc/nacl/testzip.proto b/misc/nacl/testzip.proto deleted file mode 100644 index 5a9804b36d9..00000000000 --- a/misc/nacl/testzip.proto +++ /dev/null @@ -1,190 +0,0 @@ -etc src=/etc - mime.types src=../misc/nacl/testdata/mime.types - resolv.conf src=../misc/nacl/testdata/empty - group src=../misc/nacl/testdata/group - passwd src=../misc/nacl/testdata/empty - hosts src=../misc/nacl/testdata/hosts - services -usr src=../misc/nacl/testdata - bin -go src=.. - src - cmd - api - testdata - + - asm - internal - asm - testdata - + - compile - internal - syntax - parser.go - cover - testdata - + - doc - main.go - pkg.go - doc_test.go - testdata - + - internal - objfile - objfile.go - buildid - testdata - + - gofmt - gofmt.go - gofmt_test.go - testdata - + - vendor - github.com - google - pprof - internal - binutils - + - driver - + - graph - + - report - + - profile - + - ianlancetaylor - demangle - + - golang.org - x - arch - arm - armasm - + - arm64 - arm64asm - + - x86 - x86asm - + - ppc64 - ppc64asm - + - archive - tar - testdata - + - zip - testdata - + - compress - bzip2 - testdata - + - flate - testdata - + - gzip - testdata - + - lzw - testdata - + - zlib - crypto - ed25519 - testdata - + - rsa - testdata - + - tls - testdata - + - debug - dwarf - testdata - + - elf - testdata - + - macho - testdata - + - pe - testdata - + - plan9obj - testdata - + - go - build - + - doc - testdata - + - format - + - parser - + - printer - + - image - testdata - + - draw - gif - jpeg - png - testdata - + - internal - trace - testdata - + - xcoff - testdata - + - io - + - mime - testdata - + - multipart - testdata - + - net - http - + - testdata - + - os - + - path - filepath - + - regexp - testdata - + - runtime - textflag.h - strconv - testdata - + - testdata - + - text - template - testdata - + - lib - time - zoneinfo.zip - - test - + diff --git a/misc/wasm/wasm_exec.js b/misc/wasm/wasm_exec.js index 9ffa9201e87..3c2c1868679 100644 --- a/misc/wasm/wasm_exec.js +++ b/misc/wasm/wasm_exec.js @@ -30,6 +30,12 @@ global.fs = require("fs"); } + const enosys = () => { + const err = new Error("not implemented"); + err.code = "ENOSYS"; + return err; + }; + if (!global.fs) { let outputBuf = ""; global.fs = { @@ -45,27 +51,53 @@ }, write(fd, buf, offset, length, position, callback) { if (offset !== 0 || length !== buf.length || position !== null) { - throw new Error("not implemented"); + callback(enosys()); + return; } const n = this.writeSync(fd, buf); callback(null, n); }, - open(path, flags, mode, callback) { - const err = new Error("not implemented"); - err.code = "ENOSYS"; - callback(err); - }, - read(fd, buffer, offset, length, position, callback) { - const err = new Error("not implemented"); - err.code = "ENOSYS"; - callback(err); - }, - fsync(fd, callback) { - callback(null); - }, + chmod(path, mode, callback) { callback(enosys()); }, + chown(path, uid, gid, callback) { callback(enosys()); }, + close(fd, callback) { callback(enosys()); }, + fchmod(fd, mode, callback) { callback(enosys()); }, + fchown(fd, uid, gid, callback) { callback(enosys()); }, + fstat(fd, callback) { callback(enosys()); }, + fsync(fd, callback) { callback(null); }, + ftruncate(fd, length, callback) { callback(enosys()); }, + lchown(path, uid, gid, callback) { callback(enosys()); }, + link(path, link, callback) { callback(enosys()); }, + lstat(path, callback) { callback(enosys()); }, + mkdir(path, perm, callback) { callback(enosys()); }, + open(path, flags, mode, callback) { callback(enosys()); }, + read(fd, buffer, offset, length, position, callback) { callback(enosys()); }, + readdir(path, callback) { callback(enosys()); }, + readlink(path, callback) { callback(enosys()); }, + rename(from, to, callback) { callback(enosys()); }, + rmdir(path, callback) { callback(enosys()); }, + stat(path, callback) { callback(enosys()); }, + symlink(path, link, callback) { callback(enosys()); }, + truncate(path, length, callback) { callback(enosys()); }, + unlink(path, callback) { callback(enosys()); }, + utimes(path, atime, mtime, callback) { callback(enosys()); }, }; } + if (!global.process) { + global.process = { + getuid() { return -1; }, + getgid() { return -1; }, + geteuid() { return -1; }, + getegid() { return -1; }, + getgroups() { throw enosys(); }, + pid: -1, + ppid: -1, + umask() { throw enosys(); }, + cwd() { throw enosys(); }, + chdir() { throw enosys(); }, + } + } + if (!global.crypto) { const nodeCrypto = require("crypto"); global.crypto = { diff --git a/src/bufio/bufio.go b/src/bufio/bufio.go index 0f05d3b3221..c29f233f08a 100644 --- a/src/bufio/bufio.go +++ b/src/bufio/bufio.go @@ -432,6 +432,7 @@ func (b *Reader) ReadBytes(delim byte) ([]byte, error) { var frag []byte var full [][]byte var err error + n := 0 for { var e error frag, e = b.ReadSlice(delim) @@ -447,18 +448,15 @@ func (b *Reader) ReadBytes(delim byte) ([]byte, error) { buf := make([]byte, len(frag)) copy(buf, frag) full = append(full, buf) + n += len(buf) } - // Allocate new buffer to hold the full pieces and the fragment. - n := 0 - for i := range full { - n += len(full[i]) - } n += len(frag) - // Copy full pieces and fragment in. + // Allocate new buffer to hold the full pieces and the fragment. buf := make([]byte, n) n = 0 + // Copy full pieces and fragment in. for i := range full { n += copy(buf[n:], full[i]) } diff --git a/src/buildall.bash b/src/buildall.bash index 5762a332de7..18d0b0db198 100755 --- a/src/buildall.bash +++ b/src/buildall.bash @@ -45,17 +45,17 @@ selectedtargets() { gettargets | egrep -v 'android-arm|darwin-arm' | egrep "$pattern" } -# put linux, nacl first in the target list to get all the architectures up front. -linux_nacl_targets() { - selectedtargets | egrep 'linux|nacl' | sort +# put linux first in the target list to get all the architectures up front. +linux_targets() { + selectedtargets | grep 'linux' | sort } -non_linux_nacl_targets() { - selectedtargets | egrep -v 'linux|nacl' | sort +non_linux_targets() { + selectedtargets | grep -v 'linux' | sort } # Note words in $targets are separated by both newlines and spaces. -targets="$(linux_nacl_targets) $(non_linux_nacl_targets)" +targets="$(linux_targets) $(non_linux_targets)" failed=false for target in $targets diff --git a/src/bytes/compare_test.go b/src/bytes/compare_test.go index a321f2e0861..a595d575d07 100644 --- a/src/bytes/compare_test.go +++ b/src/bytes/compare_test.go @@ -120,6 +120,39 @@ func TestCompareBytes(t *testing.T) { } } +func TestEndianBaseCompare(t *testing.T) { + // This test compares byte slices that are almost identical, except one + // difference that for some j, a[j]>b[j] and a[j+1] " + dtype.String() if checkCache { if t, ok := c.m[key]; ok { @@ -2236,7 +2243,7 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { // Translate to zero-length array instead. count = 0 } - sub := c.Type(dt.Type, pos) + sub := c.loadType(dt.Type, pos, key) t.Align = sub.Align t.Go = &ast.ArrayType{ Len: c.intExpr(count), @@ -2381,7 +2388,7 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { c.ptrs[key] = append(c.ptrs[key], t) case *dwarf.QualType: - t1 := c.Type(dt.Type, pos) + t1 := c.loadType(dt.Type, pos, key) t.Size = t1.Size t.Align = t1.Align t.Go = t1.Go @@ -2465,7 +2472,7 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { } name := c.Ident("_Ctype_" + dt.Name) goIdent[name.Name] = name - sub := c.Type(dt.Type, pos) + sub := c.loadType(dt.Type, pos, key) if c.badPointerTypedef(dt) { // Treat this typedef as a uintptr. s := *sub diff --git a/src/cmd/compile/fmtmap_test.go b/src/cmd/compile/fmtmap_test.go index 67c074ea70d..7c44ec11ed2 100644 --- a/src/cmd/compile/fmtmap_test.go +++ b/src/cmd/compile/fmtmap_test.go @@ -160,6 +160,7 @@ var knownFormats = map[string]string{ "int64 %v": "", "int64 %x": "", "int8 %d": "", + "int8 %v": "", "int8 %x": "", "interface{} %#v": "", "interface{} %T": "", @@ -195,6 +196,7 @@ var knownFormats = map[string]string{ "uint32 %v": "", "uint32 %x": "", "uint64 %08x": "", + "uint64 %b": "", "uint64 %d": "", "uint64 %x": "", "uint8 %d": "", diff --git a/src/cmd/compile/internal/amd64/galign.go b/src/cmd/compile/internal/amd64/galign.go index f6bb961c29e..4e7e762d7d1 100644 --- a/src/cmd/compile/internal/amd64/galign.go +++ b/src/cmd/compile/internal/amd64/galign.go @@ -7,17 +7,12 @@ package amd64 import ( "cmd/compile/internal/gc" "cmd/internal/obj/x86" - "cmd/internal/objabi" ) var leaptr = x86.ALEAQ func Init(arch *gc.Arch) { arch.LinkArch = &x86.Linkamd64 - if objabi.GOARCH == "amd64p32" { - arch.LinkArch = &x86.Linkamd64p32 - leaptr = x86.ALEAL - } arch.REGSP = x86.REGSP arch.MAXWIDTH = 1 << 50 diff --git a/src/cmd/compile/internal/amd64/ggen.go b/src/cmd/compile/internal/amd64/ggen.go index bd2c6720d30..f43800efe79 100644 --- a/src/cmd/compile/internal/amd64/ggen.go +++ b/src/cmd/compile/internal/amd64/ggen.go @@ -94,7 +94,7 @@ func zerorange(pp *gc.Progs, p *obj.Prog, off, cnt int64, state *uint32) *obj.Pr if cnt%16 != 0 { p = pp.Appendpp(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_MEM, x86.REG_SP, off+cnt-int64(16)) } - } else if !gc.Nacl && !isPlan9 && (cnt <= int64(128*gc.Widthreg)) { + } else if !isPlan9 && (cnt <= int64(128*gc.Widthreg)) { if *state&x0 == 0 { p = pp.Appendpp(p, x86.AXORPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_REG, x86.REG_X0, 0) *state |= x0 diff --git a/src/cmd/compile/internal/arm/ggen.go b/src/cmd/compile/internal/arm/ggen.go index f525517c49a..e9a92af1087 100644 --- a/src/cmd/compile/internal/arm/ggen.go +++ b/src/cmd/compile/internal/arm/ggen.go @@ -23,7 +23,7 @@ func zerorange(pp *gc.Progs, p *obj.Prog, off, cnt int64, r0 *uint32) *obj.Prog for i := int64(0); i < cnt; i += int64(gc.Widthptr) { p = pp.Appendpp(p, arm.AMOVW, obj.TYPE_REG, arm.REG_R0, 0, obj.TYPE_MEM, arm.REGSP, 4+off+i) } - } else if !gc.Nacl && (cnt <= int64(128*gc.Widthptr)) { + } else if cnt <= int64(128*gc.Widthptr) { p = pp.Appendpp(p, arm.AADD, obj.TYPE_CONST, 0, 4+off, obj.TYPE_REG, arm.REG_R1, 0) p.Reg = arm.REGSP p = pp.Appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0) diff --git a/src/cmd/compile/internal/gc/esc.go b/src/cmd/compile/internal/gc/esc.go index 301fa7a8fcf..0bb666dfaf1 100644 --- a/src/cmd/compile/internal/gc/esc.go +++ b/src/cmd/compile/internal/gc/esc.go @@ -7,8 +7,6 @@ package gc import ( "cmd/compile/internal/types" "fmt" - "strconv" - "strings" ) func escapes(all []*Node) { @@ -36,32 +34,11 @@ func max8(a, b int8) int8 { return b } -// Escape constants are numbered in order of increasing "escapiness" -// to help make inferences be monotonic. With the exception of -// EscNever which is sticky, eX < eY means that eY is more exposed -// than eX, and hence replaces it in a conservative analysis. const ( - EscUnknown = iota - EscNone // Does not escape to heap, result, or parameters. - EscReturn // Is returned or reachable from returned. - EscHeap // Reachable from the heap - EscNever // By construction will not escape. - EscBits = 3 - EscMask = (1 << EscBits) - 1 - EscContentEscapes = 1 << EscBits // value obtained by indirect of parameter escapes to heap - EscReturnBits = EscBits + 1 - // Node.esc encoding = | escapeReturnEncoding:(width-4) | contentEscapes:1 | escEnum:3 -) - -// For each input parameter to a function, the escapeReturnEncoding describes -// how the parameter may leak to the function's outputs. This is currently the -// "level" of the leak where level is 0 or larger (negative level means stored into -// something whose address is returned -- but that implies stored into the heap, -// hence EscHeap, which means that the details are not currently relevant. ) -const ( - bitsPerOutputInTag = 3 // For each output, the number of bits for a tag - bitsMaskForTag = uint16(1<= 0 { + if x == 0 { + Warnl(f.Pos, "leaking param: %v", name()) + } else { + // TODO(mdempsky): Mention level=x like below? Warnl(f.Pos, "leaking param content: %v", name()) } - for i := 0; i < numEscReturns; i++ { - if x := getEscReturn(esc, i); x >= 0 { - res := fn.Type.Results().Field(i).Sym - Warnl(f.Pos, "leaking param: %v to result %v level=%d", name(), res, x) - } + } + for i := 0; i < numEscResults; i++ { + if x := esc.Result(i); x >= 0 { + res := fn.Type.Results().Field(i).Sym + Warnl(f.Pos, "leaking param: %v to result %v level=%d", name(), res, x) } } } - return mktag(int(esc)) + return esc.Encode() } diff --git a/src/cmd/compile/internal/gc/escape.go b/src/cmd/compile/internal/gc/escape.go index ebe54031866..3d41c836278 100644 --- a/src/cmd/compile/internal/gc/escape.go +++ b/src/cmd/compile/internal/gc/escape.go @@ -7,6 +7,8 @@ package gc import ( "cmd/compile/internal/types" "fmt" + "math" + "strings" ) // Escape analysis. @@ -119,9 +121,8 @@ type EscLocation struct { // its storage can be immediately reused. transient bool - // paramEsc records the represented parameter's escape tags. - // See "Parameter tags" below for details. - paramEsc uint16 + // paramEsc records the represented parameter's leak set. + paramEsc EscLeaks } // An EscEdge represents an assignment edge between two Go variables. @@ -170,11 +171,7 @@ func (e *Escape) initFunc(fn *Node) { // Allocate locations for local variables. for _, dcl := range fn.Func.Dcl { if dcl.Op == ONAME { - loc := e.newLoc(dcl, false) - - if dcl.Class() == PPARAM && fn.Nbody.Len() == 0 && !fn.Noescape() { - loc.paramEsc = EscHeap - } + e.newLoc(dcl, false) } } } @@ -892,20 +889,16 @@ func (e *Escape) tagHole(ks []EscHole, param *types.Field, static bool) EscHole return e.heapHole() } - esc := parsetag(param.Note) - switch esc { - case EscHeap, EscUnknown: - return e.heapHole() - } - var tagKs []EscHole - if esc&EscContentEscapes != 0 { - tagKs = append(tagKs, e.heapHole().shift(1)) + + esc := ParseLeaks(param.Note) + if x := esc.Heap(); x >= 0 { + tagKs = append(tagKs, e.heapHole().shift(x)) } if ks != nil { - for i := 0; i < numEscReturns; i++ { - if x := getEscReturn(esc, i); x >= 0 { + for i := 0; i < numEscResults; i++ { + if x := esc.Result(i); x >= 0 { tagKs = append(tagKs, ks[i].shift(x)) } } @@ -1247,31 +1240,20 @@ func containsClosure(f, c *Node) bool { // leak records that parameter l leaks to sink. func (l *EscLocation) leakTo(sink *EscLocation, derefs int) { - // Short circuit if l already leaks to heap. - if l.paramEsc == EscHeap { - return - } - // If sink is a result parameter and we can fit return bits // into the escape analysis tag, then record a return leak. if sink.isName(PPARAMOUT) && sink.curfn == l.curfn { // TODO(mdempsky): Eliminate dependency on Vargen here. ri := int(sink.n.Name.Vargen) - 1 - if ri < numEscReturns { + if ri < numEscResults { // Leak to result parameter. - if old := getEscReturn(l.paramEsc, ri); old < 0 || derefs < old { - l.paramEsc = setEscReturn(l.paramEsc, ri, derefs) - } + l.paramEsc.AddResult(ri, derefs) return } } // Otherwise, record as heap leak. - if derefs > 0 { - l.paramEsc |= EscContentEscapes - } else { - l.paramEsc = EscHeap - } + l.paramEsc.AddHeap(derefs) } func (e *Escape) finish(fns []*Node) { @@ -1311,7 +1293,7 @@ func (e *Escape) finish(fns []*Node) { } n.Esc = EscNone if loc.transient { - n.SetNoescape(true) + n.SetTransient(true) } } } @@ -1321,73 +1303,97 @@ func (l *EscLocation) isName(c Class) bool { return l.n != nil && l.n.Op == ONAME && l.n.Class() == c } -func finalizeEsc(esc uint16) uint16 { - esc = optimizeReturns(esc) +const numEscResults = 7 - if esc>>EscReturnBits != 0 { - esc |= EscReturn - } else if esc&EscMask == 0 { - esc |= EscNone +// An EscLeaks represents a set of assignment flows from a parameter +// to the heap or to any of its function's (first numEscResults) +// result parameters. +type EscLeaks [1 + numEscResults]uint8 + +// Empty reports whether l is an empty set (i.e., no assignment flows). +func (l EscLeaks) Empty() bool { return l == EscLeaks{} } + +// Heap returns the minimum deref count of any assignment flow from l +// to the heap. If no such flows exist, Heap returns -1. +func (l EscLeaks) Heap() int { return l.get(0) } + +// Result returns the minimum deref count of any assignment flow from +// l to its function's i'th result parameter. If no such flows exist, +// Result returns -1. +func (l EscLeaks) Result(i int) int { return l.get(1 + i) } + +// AddHeap adds an assignment flow from l to the heap. +func (l *EscLeaks) AddHeap(derefs int) { l.add(0, derefs) } + +// AddResult adds an assignment flow from l to its function's i'th +// result parameter. +func (l *EscLeaks) AddResult(i, derefs int) { l.add(1+i, derefs) } + +func (l *EscLeaks) setResult(i, derefs int) { l.set(1+i, derefs) } + +func (l EscLeaks) get(i int) int { return int(l[i]) - 1 } + +func (l *EscLeaks) add(i, derefs int) { + if old := l.get(i); old < 0 || derefs < old { + l.set(i, derefs) } - - return esc } -func optimizeReturns(esc uint16) uint16 { - if esc&EscContentEscapes != 0 { - // EscContentEscapes represents a path of length 1 - // from the heap. No point in keeping paths of equal - // or longer length to result parameters. - for i := 0; i < numEscReturns; i++ { - if x := getEscReturn(esc, i); x >= 1 { - esc = setEscReturn(esc, i, -1) +func (l *EscLeaks) set(i, derefs int) { + v := derefs + 1 + if v < 0 { + Fatalf("invalid derefs count: %v", derefs) + } + if v > math.MaxUint8 { + v = math.MaxUint8 + } + + l[i] = uint8(v) +} + +// Optimize removes result flow paths that are equal in length or +// longer than the shortest heap flow path. +func (l *EscLeaks) Optimize() { + // If we have a path to the heap, then there's no use in + // keeping equal or longer paths elsewhere. + if x := l.Heap(); x >= 0 { + for i := 0; i < numEscResults; i++ { + if l.Result(i) >= x { + l.setResult(i, -1) } } } - return esc } -// Parameter tags. -// -// The escape bits saved for each analyzed parameter record the -// minimal derefs (if any) from that parameter to the heap, or to any -// of its function's (first numEscReturns) result parameters. -// -// Paths to the heap are encoded via EscHeap (length 0) or -// EscContentEscapes (length 1); if neither of these are set, then -// there's no path to the heap. -// -// Paths to the result parameters are encoded in the upper -// bits. -// -// There are other values stored in the escape bits by esc.go for -// vestigial reasons, and other special tag values used (e.g., -// uintptrEscapesTag and unsafeUintptrTag). These could be simplified -// once compatibility with esc.go is no longer a concern. +var leakTagCache = map[EscLeaks]string{} -const numEscReturns = (16 - EscReturnBits) / bitsPerOutputInTag - -func getEscReturn(esc uint16, i int) int { - return int((esc>>escReturnShift(i))&bitsMaskForTag) - 1 -} - -func setEscReturn(esc uint16, i, v int) uint16 { - if v < -1 { - Fatalf("invalid esc return value: %v", v) +// Encode converts l into a binary string for export data. +func (l EscLeaks) Encode() string { + if l.Heap() == 0 { + // Space optimization: empty string encodes more + // efficiently in export data. + return "" } - if v > maxEncodedLevel { - v = maxEncodedLevel + if s, ok := leakTagCache[l]; ok { + return s } - shift := escReturnShift(i) - esc &^= bitsMaskForTag << shift - esc |= uint16(v+1) << shift - return esc + n := len(l) + for n > 0 && l[n-1] == 0 { + n-- + } + s := "esc:" + string(l[:n]) + leakTagCache[l] = s + return s } -func escReturnShift(i int) uint { - if uint(i) >= numEscReturns { - Fatalf("esc return index out of bounds: %v", i) +// ParseLeaks parses a binary string representing an EscLeaks. +func ParseLeaks(s string) EscLeaks { + var l EscLeaks + if !strings.HasPrefix(s, "esc:") { + l.AddHeap(0) + return l } - return uint(EscReturnBits + i*bitsPerOutputInTag) + copy(l[:], s[4:]) + return l } diff --git a/src/cmd/compile/internal/gc/fmt.go b/src/cmd/compile/internal/gc/fmt.go index 3bb2df99174..87e0e40dca1 100644 --- a/src/cmd/compile/internal/gc/fmt.go +++ b/src/cmd/compile/internal/gc/fmt.go @@ -6,6 +6,7 @@ package gc import ( "cmd/compile/internal/types" + "cmd/internal/src" "fmt" "io" "strconv" @@ -425,7 +426,14 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) { } if n.Pos.IsKnown() { - fmt.Fprintf(s, " l(%d)", n.Pos.Line()) + pfx := "" + switch n.Pos.IsStmt() { + case src.PosNotStmt: + pfx = "_" // "-" would be confusing + case src.PosIsStmt: + pfx = "+" + } + fmt.Fprintf(s, " l(%s%d)", pfx, n.Pos.Line()) } if c == 0 && n.Xoffset != BADWIDTH { diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go index f36e2716d66..37b86523cc0 100644 --- a/src/cmd/compile/internal/gc/go.go +++ b/src/cmd/compile/internal/gc/go.go @@ -29,6 +29,12 @@ var ( // s := []byte("...") allocating [n]byte on the stack // Note: the flag smallframes can update this value. maxImplicitStackVarSize = int64(64 * 1024) + + // smallArrayBytes is the maximum size of an array which is considered small. + // Small arrays will be initialized directly with a sequence of constant stores. + // Large arrays will be initialized by copying from a static temp. + // 256 bytes was chosen to minimize generated code + statictmp size. + smallArrayBytes = int64(256) ) // isRuntimePkg reports whether p is package runtime. @@ -241,8 +247,6 @@ var Ctxt *obj.Link var writearchive bool -var Nacl bool - var nodfp *Node var disable_checknil int diff --git a/src/cmd/compile/internal/gc/inl_test.go b/src/cmd/compile/internal/gc/inl_test.go index 77c398af826..5446b13b8b7 100644 --- a/src/cmd/compile/internal/gc/inl_test.go +++ b/src/cmd/compile/internal/gc/inl_test.go @@ -174,7 +174,7 @@ func TestIntendedInlining(t *testing.T) { } switch runtime.GOARCH { - case "nacl", "386", "wasm", "arm": + case "386", "wasm", "arm": default: // TODO(mvdan): As explained in /test/inline_sync.go, some // architectures don't have atomic intrinsics, so these go over diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 78d702d868e..9e8abbcdeb6 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -187,7 +187,6 @@ func Main(archInit func(*Arch)) { // pseudo-package used for methods with anonymous receivers gopkg = types.NewPkg("go", "") - Nacl = objabi.GOOS == "nacl" Wasm := objabi.GOARCH == "wasm" // Whether the limit for stack-allocated objects is much smaller than normal. diff --git a/src/cmd/compile/internal/gc/noder.go b/src/cmd/compile/internal/gc/noder.go index a4f834b5ab0..e3d6a6866f0 100644 --- a/src/cmd/compile/internal/gc/noder.go +++ b/src/cmd/compile/internal/gc/noder.go @@ -495,7 +495,6 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node { pragma := fun.Pragma f.Func.Pragma = fun.Pragma - f.SetNoescape(pragma&Noescape != 0) if pragma&Systemstack != 0 && pragma&Nosplit != 0 { yyerrorl(f.Pos, "go:nosplit and go:systemstack cannot be combined") } @@ -507,7 +506,7 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node { p.funcBody(f, fun.Body) if fun.Body != nil { - if f.Noescape() { + if f.Func.Pragma&Noescape != 0 { yyerrorl(f.Pos, "can only use //go:noescape with external func implementations") } } else { diff --git a/src/cmd/compile/internal/gc/order.go b/src/cmd/compile/internal/gc/order.go index 2ab87a2f7b0..ec07dcc15fe 100644 --- a/src/cmd/compile/internal/gc/order.go +++ b/src/cmd/compile/internal/gc/order.go @@ -1174,7 +1174,7 @@ func (o *Order) expr(n, lhs *Node) *Node { } case OCLOSURE: - if n.Noescape() && n.Func.Closure.Func.Cvars.Len() > 0 { + if n.Transient() && n.Func.Closure.Func.Cvars.Len() > 0 { prealloc[n] = o.newTemp(closureType(n), false) } @@ -1183,7 +1183,7 @@ func (o *Order) expr(n, lhs *Node) *Node { n.Right = o.expr(n.Right, nil) o.exprList(n.List) o.exprList(n.Rlist) - if n.Noescape() { + if n.Transient() { var t *types.Type switch n.Op { case OSLICELIT: @@ -1195,7 +1195,7 @@ func (o *Order) expr(n, lhs *Node) *Node { } case ODDDARG: - if n.Noescape() { + if n.Transient() { // The ddd argument does not live beyond the call it is created for. // Allocate a temporary that will be cleaned up when this statement // completes. We could be more aggressive and try to arrange for it diff --git a/src/cmd/compile/internal/gc/sinit.go b/src/cmd/compile/internal/gc/sinit.go index a6d13d1ac5f..96b343081a6 100644 --- a/src/cmd/compile/internal/gc/sinit.go +++ b/src/cmd/compile/internal/gc/sinit.go @@ -582,6 +582,16 @@ func fixedlit(ctxt initContext, kind initKind, n *Node, var_ *Node, init *Nodes) } } +func isSmallSliceLit(n *Node) bool { + if n.Op != OSLICELIT { + return false + } + + r := n.Right + + return smallintconst(r) && (n.Type.Elem().Width == 0 || r.Int64() <= smallArrayBytes/n.Type.Elem().Width) +} + func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) { // make an array type corresponding the number of elements we have t := types.NewArray(n.Type.Elem(), n.Right.Int64()) @@ -639,7 +649,7 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) { var vstat *Node mode := getdyn(n, true) - if mode&initConst != 0 { + if mode&initConst != 0 && !isSmallSliceLit(n) { vstat = staticname(t) if ctxt == inInitFunction { vstat.Name.SetReadonly(true) diff --git a/src/cmd/compile/internal/gc/sizeof_test.go b/src/cmd/compile/internal/gc/sizeof_test.go index b1184ffbb9d..f4725c0eb29 100644 --- a/src/cmd/compile/internal/gc/sizeof_test.go +++ b/src/cmd/compile/internal/gc/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package gc import ( diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go index 1381cdacba9..29709930569 100644 --- a/src/cmd/compile/internal/gc/swt.go +++ b/src/cmd/compile/internal/gc/swt.go @@ -513,6 +513,7 @@ func walkTypeSwitch(sw *Node) { // Use a similar strategy for non-empty interfaces. ifNil := nod(OIF, nil, nil) ifNil.Left = nod(OEQ, itab, nodnil()) + lineno = lineno.WithNotStmt() // disable statement marks after the first check. ifNil.Left = typecheck(ifNil.Left, ctxExpr) ifNil.Left = defaultlit(ifNil.Left, nil) // ifNil.Nbody assigned at end. @@ -587,20 +588,10 @@ func walkTypeSwitch(sw *Node) { if defaultGoto == nil { defaultGoto = br } - - if nilGoto != nil { - ifNil.Nbody.Set1(nilGoto) - } else { - // TODO(mdempsky): Just use defaultGoto directly. - - // Jump to default case. - label := autolabel(".s") - ifNil.Nbody.Set1(nodSym(OGOTO, nil, label)) - // Wrap default case with label. - blk := nod(OBLOCK, nil, nil) - blk.List.Set2(nodSym(OLABEL, nil, label), defaultGoto) - defaultGoto = blk + if nilGoto == nil { + nilGoto = defaultGoto } + ifNil.Nbody.Set1(nilGoto) s.Emit(&sw.Nbody) sw.Nbody.Append(defaultGoto) @@ -725,6 +716,7 @@ func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, ni for i := lo; i < hi; i++ { nif := nod(OIF, nil, nil) base(i, nif) + lineno = lineno.WithNotStmt() nif.Left = typecheck(nif.Left, ctxExpr) nif.Left = defaultlit(nif.Left, nil) out.Append(nif) @@ -736,6 +728,7 @@ func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, ni half := lo + n/2 nif := nod(OIF, nil, nil) nif.Left = less(half) + lineno = lineno.WithNotStmt() nif.Left = typecheck(nif.Left, ctxExpr) nif.Left = defaultlit(nif.Left, nil) do(lo, half, &nif.Nbody) diff --git a/src/cmd/compile/internal/gc/syntax.go b/src/cmd/compile/internal/gc/syntax.go index c1df046654f..08edef9496a 100644 --- a/src/cmd/compile/internal/gc/syntax.go +++ b/src/cmd/compile/internal/gc/syntax.go @@ -151,7 +151,7 @@ const ( _, nodeDiag // already printed error about this _, nodeColas // OAS resulting from := _, nodeNonNil // guaranteed to be non-nil - _, nodeNoescape // func arguments do not escape; TODO(rsc): move Noescape to Func struct (see CL 7360) + _, nodeTransient // storage can be reused immediately after this statement _, nodeBounded // bounds check unnecessary _, nodeAddable // addressable _, nodeHasCall // expression contains a function call @@ -179,7 +179,7 @@ func (n *Node) IsDDD() bool { return n.flags&nodeIsDDD != 0 } func (n *Node) Diag() bool { return n.flags&nodeDiag != 0 } func (n *Node) Colas() bool { return n.flags&nodeColas != 0 } func (n *Node) NonNil() bool { return n.flags&nodeNonNil != 0 } -func (n *Node) Noescape() bool { return n.flags&nodeNoescape != 0 } +func (n *Node) Transient() bool { return n.flags&nodeTransient != 0 } func (n *Node) Bounded() bool { return n.flags&nodeBounded != 0 } func (n *Node) Addable() bool { return n.flags&nodeAddable != 0 } func (n *Node) HasCall() bool { return n.flags&nodeHasCall != 0 } @@ -206,7 +206,7 @@ func (n *Node) SetIsDDD(b bool) { n.flags.set(nodeIsDDD, b) } func (n *Node) SetDiag(b bool) { n.flags.set(nodeDiag, b) } func (n *Node) SetColas(b bool) { n.flags.set(nodeColas, b) } func (n *Node) SetNonNil(b bool) { n.flags.set(nodeNonNil, b) } -func (n *Node) SetNoescape(b bool) { n.flags.set(nodeNoescape, b) } +func (n *Node) SetTransient(b bool) { n.flags.set(nodeTransient, b) } func (n *Node) SetBounded(b bool) { n.flags.set(nodeBounded, b) } func (n *Node) SetAddable(b bool) { n.flags.set(nodeAddable, b) } func (n *Node) SetHasCall(b bool) { n.flags.set(nodeHasCall, b) } diff --git a/src/cmd/compile/internal/ppc64/ssa.go b/src/cmd/compile/internal/ppc64/ssa.go index 69847c38d20..4f852b883a6 100644 --- a/src/cmd/compile/internal/ppc64/ssa.go +++ b/src/cmd/compile/internal/ppc64/ssa.go @@ -855,13 +855,13 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { // for sizes >= 64 generate a loop as follows: // set up loop counter in CTR, used by BC + // XXLXOR VS32,VS32,VS32 // MOVD len/32,REG_TMP // MOVD REG_TMP,CTR + // MOVD $16,REG_TMP // loop: - // MOVD R0,(R3) - // MOVD R0,8(R3) - // MOVD R0,16(R3) - // MOVD R0,24(R3) + // STXVD2X VS32,(R0)(R3) + // STXVD2X VS32,(R31)(R3) // ADD $32,R3 // BC 16, 0, loop // @@ -895,8 +895,16 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { // only generate a loop if there is more // than 1 iteration. if ctr > 1 { + // Set up VS32 (V0) to hold 0s + p := s.Prog(ppc64.AXXLXOR) + p.From.Type = obj.TYPE_REG + p.From.Reg = ppc64.REG_VS32 + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REG_VS32 + p.Reg = ppc64.REG_VS32 + // Set up CTR loop counter - p := s.Prog(ppc64.AMOVD) + p = s.Prog(ppc64.AMOVD) p.From.Type = obj.TYPE_CONST p.From.Offset = ctr p.To.Type = obj.TYPE_REG @@ -908,23 +916,35 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { p.To.Type = obj.TYPE_REG p.To.Reg = ppc64.REG_CTR - // generate 4 MOVDs + // Set up R31 to hold index value 16 + p = s.Prog(ppc64.AMOVD) + p.From.Type = obj.TYPE_CONST + p.From.Offset = 16 + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REGTMP + + // generate 2 STXVD2Xs to store 16 bytes // when this is a loop then the top must be saved var top *obj.Prog - for offset := int64(0); offset < 32; offset += 8 { - // This is the top of loop - p := s.Prog(ppc64.AMOVD) - p.From.Type = obj.TYPE_REG - p.From.Reg = ppc64.REG_R0 - p.To.Type = obj.TYPE_MEM - p.To.Reg = v.Args[0].Reg() - p.To.Offset = offset - // Save the top of loop - if top == nil { - top = p - } + // This is the top of loop + p = s.Prog(ppc64.ASTXVD2X) + p.From.Type = obj.TYPE_REG + p.From.Reg = ppc64.REG_VS32 + p.To.Type = obj.TYPE_MEM + p.To.Reg = v.Args[0].Reg() + p.To.Index = ppc64.REGZERO + // Save the top of loop + if top == nil { + top = p } + p = s.Prog(ppc64.ASTXVD2X) + p.From.Type = obj.TYPE_REG + p.From.Reg = ppc64.REG_VS32 + p.To.Type = obj.TYPE_MEM + p.To.Reg = v.Args[0].Reg() + p.To.Index = ppc64.REGTMP + // Increment address for the // 4 doublewords just zeroed. p = s.Prog(ppc64.AADD) @@ -994,30 +1014,27 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { // When moving >= 64 bytes a loop is used // MOVD len/32,REG_TMP // MOVD REG_TMP,CTR + // MOVD $16,REG_TMP // top: - // MOVD (R4),R7 - // MOVD 8(R4),R8 - // MOVD 16(R4),R9 - // MOVD 24(R4),R10 - // ADD R4,$32 - // MOVD R7,(R3) - // MOVD R8,8(R3) - // MOVD R9,16(R3) - // MOVD R10,24(R3) - // ADD R3,$32 + // LXVD2X (R0)(R4),VS32 + // LXVD2X (R31)(R4),VS33 + // ADD $32,R4 + // STXVD2X VS32,(R0)(R3) + // STXVD2X VS33,(R31)(R4) + // ADD $32,R3 // BC 16,0,top // Bytes not moved by this loop are moved // with a combination of the following instructions, // starting with the largest sizes and generating as // many as needed, using the appropriate offset value. - // MOVD n(R4),R7 - // MOVD R7,n(R3) - // MOVW n1(R4),R7 - // MOVW R7,n1(R3) - // MOVH n2(R4),R7 - // MOVH R7,n2(R3) - // MOVB n3(R4),R7 - // MOVB R7,n3(R3) + // MOVD n(R4),R14 + // MOVD R14,n(R3) + // MOVW n1(R4),R14 + // MOVW R14,n1(R3) + // MOVH n2(R4),R14 + // MOVH R14,n2(R3) + // MOVB n3(R4),R14 + // MOVB R14,n3(R3) // Each loop iteration moves 32 bytes ctr := v.AuxInt / 32 @@ -1030,7 +1047,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { // The set of registers used here, must match the clobbered reg list // in PPC64Ops.go. - useregs := []int16{ppc64.REG_R7, ppc64.REG_R8, ppc64.REG_R9, ppc64.REG_R10} offset := int64(0) // top of the loop @@ -1050,22 +1066,35 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { p.To.Type = obj.TYPE_REG p.To.Reg = ppc64.REG_CTR - // Generate all the MOVDs for loads - // based off the same register, increasing - // the offset by 8 for each instruction - for _, rg := range useregs { - p := s.Prog(ppc64.AMOVD) - p.From.Type = obj.TYPE_MEM - p.From.Reg = src_reg - p.From.Offset = offset - p.To.Type = obj.TYPE_REG - p.To.Reg = rg - if top == nil { - top = p - } - offset += 8 + // Use REGTMP as index reg + p = s.Prog(ppc64.AMOVD) + p.From.Type = obj.TYPE_CONST + p.From.Offset = 16 + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REGTMP + + // Generate 16 byte loads and stores. + // Use temp register for index (16) + // on the second one. + p = s.Prog(ppc64.ALXVD2X) + p.From.Type = obj.TYPE_MEM + p.From.Reg = src_reg + p.From.Index = ppc64.REGZERO + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REG_VS32 + + if top == nil { + top = p } - // increment the src_reg for next iteration + + p = s.Prog(ppc64.ALXVD2X) + p.From.Type = obj.TYPE_MEM + p.From.Reg = src_reg + p.From.Index = ppc64.REGTMP + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REG_VS33 + + // increment the src reg for next iteration p = s.Prog(ppc64.AADD) p.Reg = src_reg p.From.Type = obj.TYPE_CONST @@ -1073,20 +1102,22 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { p.To.Type = obj.TYPE_REG p.To.Reg = src_reg - // generate the MOVDs for stores, based - // off the same register, using the same - // offsets as in the loads. - offset = int64(0) - for _, rg := range useregs { - p := s.Prog(ppc64.AMOVD) - p.From.Type = obj.TYPE_REG - p.From.Reg = rg - p.To.Type = obj.TYPE_MEM - p.To.Reg = dst_reg - p.To.Offset = offset - offset += 8 - } - // increment the dst_reg for next iteration + // generate 16 byte stores + p = s.Prog(ppc64.ASTXVD2X) + p.From.Type = obj.TYPE_REG + p.From.Reg = ppc64.REG_VS32 + p.To.Type = obj.TYPE_MEM + p.To.Reg = dst_reg + p.To.Index = ppc64.REGZERO + + p = s.Prog(ppc64.ASTXVD2X) + p.From.Type = obj.TYPE_REG + p.From.Reg = ppc64.REG_VS33 + p.To.Type = obj.TYPE_MEM + p.To.Reg = dst_reg + p.To.Index = ppc64.REGTMP + + // increment the dst reg for next iteration p = s.Prog(ppc64.AADD) p.Reg = dst_reg p.From.Type = obj.TYPE_CONST @@ -1114,6 +1145,57 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { rem += 32 } + if rem >= 16 { + // Generate 16 byte loads and stores. + // Use temp register for index (value 16) + // on the second one. + p := s.Prog(ppc64.ALXVD2X) + p.From.Type = obj.TYPE_MEM + p.From.Reg = src_reg + p.From.Index = ppc64.REGZERO + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REG_VS32 + + p = s.Prog(ppc64.ASTXVD2X) + p.From.Type = obj.TYPE_REG + p.From.Reg = ppc64.REG_VS32 + p.To.Type = obj.TYPE_MEM + p.To.Reg = dst_reg + p.To.Index = ppc64.REGZERO + + offset = 16 + rem -= 16 + + if rem >= 16 { + // Use REGTMP as index reg + p = s.Prog(ppc64.AMOVD) + p.From.Type = obj.TYPE_CONST + p.From.Offset = 16 + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REGTMP + + // Generate 16 byte loads and stores. + // Use temp register for index (16) + // on the second one. + p = s.Prog(ppc64.ALXVD2X) + p.From.Type = obj.TYPE_MEM + p.From.Reg = src_reg + p.From.Index = ppc64.REGTMP + p.To.Type = obj.TYPE_REG + p.To.Reg = ppc64.REG_VS32 + + p = s.Prog(ppc64.ASTXVD2X) + p.From.Type = obj.TYPE_REG + p.From.Reg = ppc64.REG_VS32 + p.To.Type = obj.TYPE_MEM + p.To.Reg = dst_reg + p.To.Index = ppc64.REGTMP + + offset = 32 + rem -= 16 + } + } + // Generate all the remaining load and store pairs, starting with // as many 8 byte moves as possible, then 4, 2, 1. for rem > 0 { @@ -1129,7 +1211,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { // Load p := s.Prog(op) p.To.Type = obj.TYPE_REG - p.To.Reg = ppc64.REG_R7 + p.To.Reg = ppc64.REG_R14 p.From.Type = obj.TYPE_MEM p.From.Reg = src_reg p.From.Offset = offset @@ -1137,7 +1219,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { // Store p = s.Prog(op) p.From.Type = obj.TYPE_REG - p.From.Reg = ppc64.REG_R7 + p.From.Reg = ppc64.REG_R14 p.To.Type = obj.TYPE_MEM p.To.Reg = dst_reg p.To.Offset = offset diff --git a/src/cmd/compile/internal/s390x/ggen.go b/src/cmd/compile/internal/s390x/ggen.go index ae9965c378c..16af190b2f4 100644 --- a/src/cmd/compile/internal/s390x/ggen.go +++ b/src/cmd/compile/internal/s390x/ggen.go @@ -38,18 +38,14 @@ func zerorange(pp *gc.Progs, p *obj.Prog, off, cnt int64, _ *uint32) *obj.Prog { // Generate a loop of large clears. if cnt > clearLoopCutoff { - n := cnt - (cnt % 256) - end := int16(s390x.REGRT2) - p = pp.Appendpp(p, s390x.AADD, obj.TYPE_CONST, 0, off+n, obj.TYPE_REG, end, 0) - p.Reg = reg + ireg := int16(s390x.REGRT2) // register holds number of remaining loop iterations + p = pp.Appendpp(p, s390x.AMOVD, obj.TYPE_CONST, 0, cnt/256, obj.TYPE_REG, ireg, 0) p = pp.Appendpp(p, s390x.ACLEAR, obj.TYPE_CONST, 0, 256, obj.TYPE_MEM, reg, off) pl := p p = pp.Appendpp(p, s390x.AADD, obj.TYPE_CONST, 0, 256, obj.TYPE_REG, reg, 0) - p = pp.Appendpp(p, s390x.ACMP, obj.TYPE_REG, reg, 0, obj.TYPE_REG, end, 0) - p = pp.Appendpp(p, s390x.ABNE, obj.TYPE_NONE, 0, 0, obj.TYPE_BRANCH, 0, 0) + p = pp.Appendpp(p, s390x.ABRCTG, obj.TYPE_REG, ireg, 0, obj.TYPE_BRANCH, 0, 0) gc.Patch(p, pl) - - cnt -= n + cnt = cnt % 256 } // Generate remaining clear instructions without a loop. diff --git a/src/cmd/compile/internal/s390x/ssa.go b/src/cmd/compile/internal/s390x/ssa.go index 15cb553eff4..2be6c1ab946 100644 --- a/src/cmd/compile/internal/s390x/ssa.go +++ b/src/cmd/compile/internal/s390x/ssa.go @@ -814,7 +814,33 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { } } +func blockAsm(b *ssa.Block) obj.As { + switch b.Kind { + case ssa.BlockS390XBRC: + return s390x.ABRC + case ssa.BlockS390XCRJ: + return s390x.ACRJ + case ssa.BlockS390XCGRJ: + return s390x.ACGRJ + case ssa.BlockS390XCLRJ: + return s390x.ACLRJ + case ssa.BlockS390XCLGRJ: + return s390x.ACLGRJ + case ssa.BlockS390XCIJ: + return s390x.ACIJ + case ssa.BlockS390XCGIJ: + return s390x.ACGIJ + case ssa.BlockS390XCLIJ: + return s390x.ACLIJ + case ssa.BlockS390XCLGIJ: + return s390x.ACLGIJ + } + b.Fatalf("blockAsm not implemented: %s", b.LongString()) + panic("unreachable") +} + func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { + // Handle generic blocks first. switch b.Kind { case ssa.BlockPlain: if b.Succs[0].Block() != next { @@ -822,47 +848,73 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { p.To.Type = obj.TYPE_BRANCH s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[0].Block()}) } + return case ssa.BlockDefer: // defer returns in R3: // 0 if we should continue executing // 1 if we should jump to deferreturn call - p := s.Prog(s390x.ACMPW) - p.From.Type = obj.TYPE_REG - p.From.Reg = s390x.REG_R3 - p.To.Type = obj.TYPE_CONST - p.To.Offset = 0 - p = s.Prog(s390x.ABNE) - p.To.Type = obj.TYPE_BRANCH - s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[1].Block()}) + p := s.Br(s390x.ACIJ, b.Succs[1].Block()) + p.From.Type = obj.TYPE_CONST + p.From.Offset = int64(s390x.NotEqual & s390x.NotUnordered) // unordered is not possible + p.Reg = s390x.REG_R3 + p.RestArgs = []obj.Addr{{Type: obj.TYPE_CONST, Offset: 0}} if b.Succs[0].Block() != next { - p := s.Prog(s390x.ABR) - p.To.Type = obj.TYPE_BRANCH - s.Branches = append(s.Branches, gc.Branch{P: p, B: b.Succs[0].Block()}) + s.Br(s390x.ABR, b.Succs[0].Block()) } + return case ssa.BlockExit: + return case ssa.BlockRet: s.Prog(obj.ARET) + return case ssa.BlockRetJmp: p := s.Prog(s390x.ABR) p.To.Type = obj.TYPE_MEM p.To.Name = obj.NAME_EXTERN p.To.Sym = b.Aux.(*obj.LSym) + return + } + + // Handle s390x-specific blocks. These blocks all have a + // condition code mask in the Aux value and 2 successors. + succs := [...]*ssa.Block{b.Succs[0].Block(), b.Succs[1].Block()} + mask := b.Aux.(s390x.CCMask) + + // TODO: take into account Likely property for forward/backward + // branches. We currently can't do this because we don't know + // whether a block has already been emitted. In general forward + // branches are assumed 'not taken' and backward branches are + // assumed 'taken'. + if next == succs[0] { + succs[0], succs[1] = succs[1], succs[0] + mask = mask.Inverse() + } + + p := s.Br(blockAsm(b), succs[0]) + switch b.Kind { case ssa.BlockS390XBRC: - succs := [...]*ssa.Block{b.Succs[0].Block(), b.Succs[1].Block()} - mask := b.Aux.(s390x.CCMask) - if next == succs[0] { - succs[0], succs[1] = succs[1], succs[0] - mask = mask.Inverse() - } - // TODO: take into account Likely property for forward/backward - // branches. - p := s.Br(s390x.ABRC, succs[0]) p.From.Type = obj.TYPE_CONST p.From.Offset = int64(mask) - if next != succs[1] { - s.Br(s390x.ABR, succs[1]) - } + case ssa.BlockS390XCGRJ, ssa.BlockS390XCRJ, + ssa.BlockS390XCLGRJ, ssa.BlockS390XCLRJ: + p.From.Type = obj.TYPE_CONST + p.From.Offset = int64(mask & s390x.NotUnordered) // unordered is not possible + p.Reg = b.Controls[0].Reg() + p.RestArgs = []obj.Addr{{Type: obj.TYPE_REG, Reg: b.Controls[1].Reg()}} + case ssa.BlockS390XCGIJ, ssa.BlockS390XCIJ: + p.From.Type = obj.TYPE_CONST + p.From.Offset = int64(mask & s390x.NotUnordered) // unordered is not possible + p.Reg = b.Controls[0].Reg() + p.RestArgs = []obj.Addr{{Type: obj.TYPE_CONST, Offset: int64(int8(b.AuxInt))}} + case ssa.BlockS390XCLGIJ, ssa.BlockS390XCLIJ: + p.From.Type = obj.TYPE_CONST + p.From.Offset = int64(mask & s390x.NotUnordered) // unordered is not possible + p.Reg = b.Controls[0].Reg() + p.RestArgs = []obj.Addr{{Type: obj.TYPE_CONST, Offset: int64(uint8(b.AuxInt))}} default: b.Fatalf("branch not implemented: %s", b.LongString()) } + if next != succs[1] { + s.Br(s390x.ABR, succs[1]) + } } diff --git a/src/cmd/compile/internal/ssa/block.go b/src/cmd/compile/internal/ssa/block.go index 1ccea778c29..73ab7e3b1c2 100644 --- a/src/cmd/compile/internal/ssa/block.go +++ b/src/cmd/compile/internal/ssa/block.go @@ -52,7 +52,8 @@ type Block struct { Controls [2]*Value // Auxiliary info for the block. Its value depends on the Kind. - Aux interface{} + Aux interface{} + AuxInt int64 // The unordered set of Values that define the operation of this block. // After the scheduling pass, this list is ordered. @@ -118,7 +119,17 @@ func (b *Block) String() string { func (b *Block) LongString() string { s := b.Kind.String() if b.Aux != nil { - s += fmt.Sprintf(" %s", b.Aux) + s += fmt.Sprintf(" {%s}", b.Aux) + } + if t := b.Kind.AuxIntType(); t != "" { + switch t { + case "Int8": + s += fmt.Sprintf(" [%v]", int8(b.AuxInt)) + case "UInt8": + s += fmt.Sprintf(" [%v]", uint8(b.AuxInt)) + default: + s += fmt.Sprintf(" [%v]", b.AuxInt) + } } for _, c := range b.ControlValues() { s += fmt.Sprintf(" %s", c) @@ -211,6 +222,16 @@ func (b *Block) CopyControls(from *Block) { } } +// Reset sets the block to the provided kind and clears all the blocks control +// and auxilliary values. Other properties of the block, such as its successors, +// predecessors and values are left unmodified. +func (b *Block) Reset(kind BlockKind) { + b.Kind = kind + b.ResetControls() + b.Aux = nil + b.AuxInt = 0 +} + // AddEdgeTo adds an edge from block b to block c. Used during building of the // SSA graph; do not use on an already-completed SSA graph. func (b *Block) AddEdgeTo(c *Block) { diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index 4e035dd2481..4041a480b31 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -38,7 +38,6 @@ type Config struct { useSSE bool // Use SSE for non-float operations useAvg bool // Use optimizations that need Avg* operations useHmul bool // Use optimizations that need Hmul* operations - nacl bool // GOOS=nacl use387 bool // GO386=387 SoftFloat bool // Race bool // race detector enabled @@ -211,19 +210,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.FPReg = framepointerRegAMD64 c.LinkReg = linkRegAMD64 c.hasGReg = false - case "amd64p32": - c.PtrSize = 4 - c.RegSize = 8 - c.lowerBlock = rewriteBlockAMD64 - c.lowerValue = rewriteValueAMD64 - c.splitLoad = rewriteValueAMD64splitload - c.registers = registersAMD64[:] - c.gpRegMask = gpRegMaskAMD64 - c.fpRegMask = fpRegMaskAMD64 - c.FPReg = framepointerRegAMD64 - c.LinkReg = linkRegAMD64 - c.hasGReg = false - c.noDuffDevice = true case "386": c.PtrSize = 4 c.RegSize = 4 @@ -339,7 +325,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config } c.ctxt = ctxt c.optimize = optimize - c.nacl = objabi.GOOS == "nacl" c.useSSE = true // Don't use Duff's device nor SSE on Plan 9 AMD64, because @@ -349,17 +334,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.useSSE = false } - if c.nacl { - c.noDuffDevice = true // Don't use Duff's device on NaCl - - // Returns clobber BP on nacl/386, so the write - // barrier does. - opcodeTable[Op386LoweredWB].reg.clobbers |= 1 << 5 // BP - - // ... and SI on nacl/amd64. - opcodeTable[OpAMD64LoweredWB].reg.clobbers |= 1 << 6 // SI - } - if ctxt.Flag_shared { // LoweredWB is secretly a CALL and CALLs on 386 in // shared mode get rewritten by obj6.go to go through diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules index e4b97a87633..03ba064a697 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules @@ -596,32 +596,32 @@ // into tests for carry flags. // ULT and SETB check the carry flag; they are identical to CS and SETCS. Same, mutatis // mutandis, for UGE and SETAE, and CC and SETCC. -((NE|EQ) (TESTL (SHLL (MOVLconst [1]) x) y)) && !config.nacl -> ((ULT|UGE) (BTL x y)) -((NE|EQ) (TESTQ (SHLQ (MOVQconst [1]) x) y)) && !config.nacl -> ((ULT|UGE) (BTQ x y)) -((NE|EQ) (TESTLconst [c] x)) && isUint32PowerOfTwo(c) && !config.nacl +((NE|EQ) (TESTL (SHLL (MOVLconst [1]) x) y)) -> ((ULT|UGE) (BTL x y)) +((NE|EQ) (TESTQ (SHLQ (MOVQconst [1]) x) y)) -> ((ULT|UGE) (BTQ x y)) +((NE|EQ) (TESTLconst [c] x)) && isUint32PowerOfTwo(c) -> ((ULT|UGE) (BTLconst [log2uint32(c)] x)) -((NE|EQ) (TESTQconst [c] x)) && isUint64PowerOfTwo(c) && !config.nacl +((NE|EQ) (TESTQconst [c] x)) && isUint64PowerOfTwo(c) -> ((ULT|UGE) (BTQconst [log2(c)] x)) -((NE|EQ) (TESTQ (MOVQconst [c]) x)) && isUint64PowerOfTwo(c) && !config.nacl +((NE|EQ) (TESTQ (MOVQconst [c]) x)) && isUint64PowerOfTwo(c) -> ((ULT|UGE) (BTQconst [log2(c)] x)) -(SET(NE|EQ) (TESTL (SHLL (MOVLconst [1]) x) y)) && !config.nacl -> (SET(B|AE) (BTL x y)) -(SET(NE|EQ) (TESTQ (SHLQ (MOVQconst [1]) x) y)) && !config.nacl -> (SET(B|AE) (BTQ x y)) -(SET(NE|EQ) (TESTLconst [c] x)) && isUint32PowerOfTwo(c) && !config.nacl +(SET(NE|EQ) (TESTL (SHLL (MOVLconst [1]) x) y)) -> (SET(B|AE) (BTL x y)) +(SET(NE|EQ) (TESTQ (SHLQ (MOVQconst [1]) x) y)) -> (SET(B|AE) (BTQ x y)) +(SET(NE|EQ) (TESTLconst [c] x)) && isUint32PowerOfTwo(c) -> (SET(B|AE) (BTLconst [log2uint32(c)] x)) -(SET(NE|EQ) (TESTQconst [c] x)) && isUint64PowerOfTwo(c) && !config.nacl +(SET(NE|EQ) (TESTQconst [c] x)) && isUint64PowerOfTwo(c) -> (SET(B|AE) (BTQconst [log2(c)] x)) -(SET(NE|EQ) (TESTQ (MOVQconst [c]) x)) && isUint64PowerOfTwo(c) && !config.nacl +(SET(NE|EQ) (TESTQ (MOVQconst [c]) x)) && isUint64PowerOfTwo(c) -> (SET(B|AE) (BTQconst [log2(c)] x)) // SET..store variant -(SET(NE|EQ)store [off] {sym} ptr (TESTL (SHLL (MOVLconst [1]) x) y) mem) && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTL (SHLL (MOVLconst [1]) x) y) mem) -> (SET(B|AE)store [off] {sym} ptr (BTL x y) mem) -(SET(NE|EQ)store [off] {sym} ptr (TESTQ (SHLQ (MOVQconst [1]) x) y) mem) && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTQ (SHLQ (MOVQconst [1]) x) y) mem) -> (SET(B|AE)store [off] {sym} ptr (BTQ x y) mem) -(SET(NE|EQ)store [off] {sym} ptr (TESTLconst [c] x) mem) && isUint32PowerOfTwo(c) && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTLconst [c] x) mem) && isUint32PowerOfTwo(c) -> (SET(B|AE)store [off] {sym} ptr (BTLconst [log2uint32(c)] x) mem) -(SET(NE|EQ)store [off] {sym} ptr (TESTQconst [c] x) mem) && isUint64PowerOfTwo(c) && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTQconst [c] x) mem) && isUint64PowerOfTwo(c) -> (SET(B|AE)store [off] {sym} ptr (BTQconst [log2(c)] x) mem) -(SET(NE|EQ)store [off] {sym} ptr (TESTQ (MOVQconst [c]) x) mem) && isUint64PowerOfTwo(c) && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTQ (MOVQconst [c]) x) mem) && isUint64PowerOfTwo(c) -> (SET(B|AE)store [off] {sym} ptr (BTQconst [log2(c)] x) mem) // Handle bit-testing in the form (a>>b)&1 != 0 by building the above rules @@ -641,29 +641,29 @@ (SET(NE|EQ)store [off] {sym} ptr (CMPQconst [1] s:(ANDQconst [1] _)) mem) -> (SET(EQ|NE)store [off] {sym} ptr (CMPQconst [0] s) mem) // Recognize bit setting (a |= 1< (BTS(Q|L) x y) -(XOR(Q|L) (SHL(Q|L) (MOV(Q|L)const [1]) y) x) && !config.nacl -> (BTC(Q|L) x y) +(OR(Q|L) (SHL(Q|L) (MOV(Q|L)const [1]) y) x) -> (BTS(Q|L) x y) +(XOR(Q|L) (SHL(Q|L) (MOV(Q|L)const [1]) y) x) -> (BTC(Q|L) x y) // Convert ORconst into BTS, if the code gets smaller, with boundary being // (ORL $40,AX is 3 bytes, ORL $80,AX is 6 bytes). -((ORQ|XORQ)const [c] x) && isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl +((ORQ|XORQ)const [c] x) && isUint64PowerOfTwo(c) && uint64(c) >= 128 -> (BT(S|C)Qconst [log2(c)] x) -((ORL|XORL)const [c] x) && isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl +((ORL|XORL)const [c] x) && isUint32PowerOfTwo(c) && uint64(c) >= 128 -> (BT(S|C)Lconst [log2uint32(c)] x) -((ORQ|XORQ) (MOVQconst [c]) x) && isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl +((ORQ|XORQ) (MOVQconst [c]) x) && isUint64PowerOfTwo(c) && uint64(c) >= 128 -> (BT(S|C)Qconst [log2(c)] x) -((ORL|XORL) (MOVLconst [c]) x) && isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl +((ORL|XORL) (MOVLconst [c]) x) && isUint32PowerOfTwo(c) && uint64(c) >= 128 -> (BT(S|C)Lconst [log2uint32(c)] x) // Recognize bit clearing: a &^= 1< (BTR(Q|L) x y) -(ANDQconst [c] x) && isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl +(AND(Q|L) (NOT(Q|L) (SHL(Q|L) (MOV(Q|L)const [1]) y)) x) -> (BTR(Q|L) x y) +(ANDQconst [c] x) && isUint64PowerOfTwo(^c) && uint64(^c) >= 128 -> (BTRQconst [log2(^c)] x) -(ANDLconst [c] x) && isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl +(ANDLconst [c] x) && isUint32PowerOfTwo(^c) && uint64(^c) >= 128 -> (BTRLconst [log2uint32(^c)] x) -(ANDQ (MOVQconst [c]) x) && isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl +(ANDQ (MOVQconst [c]) x) && isUint64PowerOfTwo(^c) && uint64(^c) >= 128 -> (BTRQconst [log2(^c)] x) -(ANDL (MOVLconst [c]) x) && isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl +(ANDL (MOVLconst [c]) x) && isUint32PowerOfTwo(^c) && uint64(^c) >= 128 -> (BTRLconst [log2uint32(^c)] x) // Special-case bit patterns on first/last bit. @@ -677,40 +677,40 @@ // We thus special-case them, by detecting the shift patterns. // Special case resetting first/last bit -(SHL(L|Q)const [1] (SHR(L|Q)const [1] x)) && !config.nacl +(SHL(L|Q)const [1] (SHR(L|Q)const [1] x)) -> (BTR(L|Q)const [0] x) -(SHRLconst [1] (SHLLconst [1] x)) && !config.nacl +(SHRLconst [1] (SHLLconst [1] x)) -> (BTRLconst [31] x) -(SHRQconst [1] (SHLQconst [1] x)) && !config.nacl +(SHRQconst [1] (SHLQconst [1] x)) -> (BTRQconst [63] x) // Special case testing first/last bit (with double-shift generated by generic.rules) -((SETNE|SETEQ|NE|EQ) (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2)) && z1==z2 && !config.nacl +((SETNE|SETEQ|NE|EQ) (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2)) && z1==z2 -> ((SETB|SETAE|ULT|UGE) (BTQconst [63] x)) -((SETNE|SETEQ|NE|EQ) (TESTL z1:(SHLLconst [31] (SHRQconst [31] x)) z2)) && z1==z2 && !config.nacl +((SETNE|SETEQ|NE|EQ) (TESTL z1:(SHLLconst [31] (SHRQconst [31] x)) z2)) && z1==z2 -> ((SETB|SETAE|ULT|UGE) (BTQconst [31] x)) -(SET(NE|EQ)store [off] {sym} ptr (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2) mem) && z1==z2 && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2) mem) && z1==z2 -> (SET(B|AE)store [off] {sym} ptr (BTQconst [63] x) mem) -(SET(NE|EQ)store [off] {sym} ptr (TESTL z1:(SHLLconst [31] (SHRLconst [31] x)) z2) mem) && z1==z2 && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTL z1:(SHLLconst [31] (SHRLconst [31] x)) z2) mem) && z1==z2 -> (SET(B|AE)store [off] {sym} ptr (BTLconst [31] x) mem) -((SETNE|SETEQ|NE|EQ) (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2)) && z1==z2 && !config.nacl +((SETNE|SETEQ|NE|EQ) (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2)) && z1==z2 -> ((SETB|SETAE|ULT|UGE) (BTQconst [0] x)) -((SETNE|SETEQ|NE|EQ) (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2)) && z1==z2 && !config.nacl +((SETNE|SETEQ|NE|EQ) (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2)) && z1==z2 -> ((SETB|SETAE|ULT|UGE) (BTLconst [0] x)) -(SET(NE|EQ)store [off] {sym} ptr (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2) mem) && z1==z2 && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2) mem) && z1==z2 -> (SET(B|AE)store [off] {sym} ptr (BTQconst [0] x) mem) -(SET(NE|EQ)store [off] {sym} ptr (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2) mem) && z1==z2 && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2) mem) && z1==z2 -> (SET(B|AE)store [off] {sym} ptr (BTLconst [0] x) mem) // Special-case manually testing last bit with "a>>63 != 0" (without "&1") -((SETNE|SETEQ|NE|EQ) (TESTQ z1:(SHRQconst [63] x) z2)) && z1==z2 && !config.nacl +((SETNE|SETEQ|NE|EQ) (TESTQ z1:(SHRQconst [63] x) z2)) && z1==z2 -> ((SETB|SETAE|ULT|UGE) (BTQconst [63] x)) -((SETNE|SETEQ|NE|EQ) (TESTL z1:(SHRLconst [31] x) z2)) && z1==z2 && !config.nacl +((SETNE|SETEQ|NE|EQ) (TESTL z1:(SHRLconst [31] x) z2)) && z1==z2 -> ((SETB|SETAE|ULT|UGE) (BTLconst [31] x)) -(SET(NE|EQ)store [off] {sym} ptr (TESTQ z1:(SHRQconst [63] x) z2) mem) && z1==z2 && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTQ z1:(SHRQconst [63] x) z2) mem) && z1==z2 -> (SET(B|AE)store [off] {sym} ptr (BTQconst [63] x) mem) -(SET(NE|EQ)store [off] {sym} ptr (TESTL z1:(SHRLconst [31] x) z2) mem) && z1==z2 && !config.nacl +(SET(NE|EQ)store [off] {sym} ptr (TESTL z1:(SHRLconst [31] x) z2) mem) && z1==z2 -> (SET(B|AE)store [off] {sym} ptr (BTLconst [31] x) mem) // Fold combinations of bit ops on same bit. An example is math.Copysign(c,-1) diff --git a/src/cmd/compile/internal/ssa/gen/ARM.rules b/src/cmd/compile/internal/ssa/gen/ARM.rules index 0858b443da1..4ab388cae9c 100644 --- a/src/cmd/compile/internal/ssa/gen/ARM.rules +++ b/src/cmd/compile/internal/ssa/gen/ARM.rules @@ -1246,20 +1246,20 @@ ((ADDshiftLL|ORshiftLL|XORshiftLL) [8] (SRLconst [24] (SLLconst [16] x)) x) && objabi.GOARM>=6 -> (REV16 x) // use indexed loads and stores -(MOVWload [0] {sym} (ADD ptr idx) mem) && sym == nil && !config.nacl -> (MOVWloadidx ptr idx mem) -(MOVWstore [0] {sym} (ADD ptr idx) val mem) && sym == nil && !config.nacl -> (MOVWstoreidx ptr idx val mem) -(MOVWload [0] {sym} (ADDshiftLL ptr idx [c]) mem) && sym == nil && !config.nacl -> (MOVWloadshiftLL ptr idx [c] mem) -(MOVWload [0] {sym} (ADDshiftRL ptr idx [c]) mem) && sym == nil && !config.nacl -> (MOVWloadshiftRL ptr idx [c] mem) -(MOVWload [0] {sym} (ADDshiftRA ptr idx [c]) mem) && sym == nil && !config.nacl -> (MOVWloadshiftRA ptr idx [c] mem) -(MOVWstore [0] {sym} (ADDshiftLL ptr idx [c]) val mem) && sym == nil && !config.nacl -> (MOVWstoreshiftLL ptr idx [c] val mem) -(MOVWstore [0] {sym} (ADDshiftRL ptr idx [c]) val mem) && sym == nil && !config.nacl -> (MOVWstoreshiftRL ptr idx [c] val mem) -(MOVWstore [0] {sym} (ADDshiftRA ptr idx [c]) val mem) && sym == nil && !config.nacl -> (MOVWstoreshiftRA ptr idx [c] val mem) -(MOVBUload [0] {sym} (ADD ptr idx) mem) && sym == nil && !config.nacl -> (MOVBUloadidx ptr idx mem) -(MOVBload [0] {sym} (ADD ptr idx) mem) && sym == nil && !config.nacl -> (MOVBloadidx ptr idx mem) -(MOVBstore [0] {sym} (ADD ptr idx) val mem) && sym == nil && !config.nacl -> (MOVBstoreidx ptr idx val mem) -(MOVHUload [0] {sym} (ADD ptr idx) mem) && sym == nil && !config.nacl -> (MOVHUloadidx ptr idx mem) -(MOVHload [0] {sym} (ADD ptr idx) mem) && sym == nil && !config.nacl -> (MOVHloadidx ptr idx mem) -(MOVHstore [0] {sym} (ADD ptr idx) val mem) && sym == nil && !config.nacl -> (MOVHstoreidx ptr idx val mem) +(MOVWload [0] {sym} (ADD ptr idx) mem) && sym == nil -> (MOVWloadidx ptr idx mem) +(MOVWstore [0] {sym} (ADD ptr idx) val mem) && sym == nil -> (MOVWstoreidx ptr idx val mem) +(MOVWload [0] {sym} (ADDshiftLL ptr idx [c]) mem) && sym == nil -> (MOVWloadshiftLL ptr idx [c] mem) +(MOVWload [0] {sym} (ADDshiftRL ptr idx [c]) mem) && sym == nil -> (MOVWloadshiftRL ptr idx [c] mem) +(MOVWload [0] {sym} (ADDshiftRA ptr idx [c]) mem) && sym == nil -> (MOVWloadshiftRA ptr idx [c] mem) +(MOVWstore [0] {sym} (ADDshiftLL ptr idx [c]) val mem) && sym == nil -> (MOVWstoreshiftLL ptr idx [c] val mem) +(MOVWstore [0] {sym} (ADDshiftRL ptr idx [c]) val mem) && sym == nil -> (MOVWstoreshiftRL ptr idx [c] val mem) +(MOVWstore [0] {sym} (ADDshiftRA ptr idx [c]) val mem) && sym == nil -> (MOVWstoreshiftRA ptr idx [c] val mem) +(MOVBUload [0] {sym} (ADD ptr idx) mem) && sym == nil -> (MOVBUloadidx ptr idx mem) +(MOVBload [0] {sym} (ADD ptr idx) mem) && sym == nil -> (MOVBloadidx ptr idx mem) +(MOVBstore [0] {sym} (ADD ptr idx) val mem) && sym == nil -> (MOVBstoreidx ptr idx val mem) +(MOVHUload [0] {sym} (ADD ptr idx) mem) && sym == nil -> (MOVHUloadidx ptr idx mem) +(MOVHload [0] {sym} (ADD ptr idx) mem) && sym == nil -> (MOVHloadidx ptr idx mem) +(MOVHstore [0] {sym} (ADD ptr idx) val mem) && sym == nil -> (MOVHstoreidx ptr idx val mem) // constant folding in indexed loads and stores (MOVWloadidx ptr (MOVWconst [c]) mem) -> (MOVWload [c] ptr mem) diff --git a/src/cmd/compile/internal/ssa/gen/PPC64Ops.go b/src/cmd/compile/internal/ssa/gen/PPC64Ops.go index 5505db52225..a6bcc265432 100644 --- a/src/cmd/compile/internal/ssa/gen/PPC64Ops.go +++ b/src/cmd/compile/internal/ssa/gen/PPC64Ops.go @@ -416,13 +416,13 @@ func init() { // a loop is generated when there is more than one iteration // needed to clear 4 doublewords // + // XXLXOR VS32,VS32,VS32 // MOVD $len/32,R31 // MOVD R31,CTR + // MOVD $16,R31 // loop: - // MOVD R0,(R3) - // MOVD R0,8(R3) - // MOVD R0,16(R3) - // MOVD R0,24(R3) + // STXVD2X VS32,(R0)(R3) + // STXVD2X VS32,(R31),R3) // ADD R3,32 // BC loop @@ -448,33 +448,38 @@ func init() { typ: "Mem", faultOnNilArg0: true, }, + // R31 is temp register // Loop code: - // MOVD len/32,REG_TMP only for loop - // MOVD REG_TMP,CTR only for loop + // MOVD len/32,R31 set up loop ctr + // MOVD R31,CTR + // MOVD $16,R31 index register // loop: - // MOVD (R4),R7 - // MOVD 8(R4),R8 - // MOVD 16(R4),R9 - // MOVD 24(R4),R10 - // ADD R4,$32 only with loop - // MOVD R7,(R3) - // MOVD R8,8(R3) - // MOVD R9,16(R3) - // MOVD R10,24(R3) - // ADD R3,$32 only with loop - // BC 16,0,loop only with loop + // LXVD2X (R0)(R4),VS32 + // LXVD2X (R31)(R4),VS33 + // ADD R4,$32 increment src + // STXVD2X VS32,(R0)(R3) + // STXVD2X VS33,(R31)(R3) + // ADD R3,$32 increment dst + // BC 16,0,loop branch ctr + // For this purpose, VS32 and VS33 are treated as + // scratch registers. Since regalloc does not + // track vector registers, even if it could be marked + // as clobbered it would have no effect. + // TODO: If vector registers are managed by regalloc + // mark these as clobbered. + // // Bytes not moved by this loop are moved // with a combination of the following instructions, // starting with the largest sizes and generating as // many as needed, using the appropriate offset value. - // MOVD n(R4),R7 - // MOVD R7,n(R3) - // MOVW n1(R4),R7 - // MOVW R7,n1(R3) - // MOVH n2(R4),R7 - // MOVH R7,n2(R3) - // MOVB n3(R4),R7 - // MOVB R7,n3(R3) + // MOVD n(R4),R14 + // MOVD R14,n(R3) + // MOVW n1(R4),R14 + // MOVW R14,n1(R3) + // MOVH n2(R4),R14 + // MOVH R14,n2(R3) + // MOVB n3(R4),R14 + // MOVB R14,n3(R3) { name: "LoweredMove", @@ -482,7 +487,7 @@ func init() { argLength: 3, reg: regInfo{ inputs: []regMask{buildReg("R3"), buildReg("R4")}, - clobbers: buildReg("R3 R4 R7 R8 R9 R10"), + clobbers: buildReg("R3 R4 R14"), }, clobberFlags: true, typ: "Mem", diff --git a/src/cmd/compile/internal/ssa/gen/S390X.rules b/src/cmd/compile/internal/ssa/gen/S390X.rules index 83c3b358b5d..4e459043b11 100644 --- a/src/cmd/compile/internal/ssa/gen/S390X.rules +++ b/src/cmd/compile/internal/ssa/gen/S390X.rules @@ -416,7 +416,7 @@ (ITab (Load ptr mem)) -> (MOVDload ptr mem) // block rewrites -(If cond yes no) -> (BRC {s390x.NotEqual} (CMPWconst [0] (MOVBZreg cond)) yes no) +(If cond yes no) -> (CLIJ {s390x.LessOrGreater} (MOVBZreg cond) [0] yes no) // Write barrier. (WB {fn} destptr srcptr mem) -> (LoweredWB {fn} destptr srcptr mem) @@ -548,15 +548,60 @@ -> x // Fold boolean tests into blocks. -(BRC {c} (CMPWconst [0] (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp)) yes no) - && x != 0 - && c.(s390x.CCMask) == s390x.Equal - -> (BRC {d} cmp no yes) -(BRC {c} (CMPWconst [0] (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp)) yes no) - && x != 0 - && c.(s390x.CCMask) == s390x.NotEqual +// Note: this must match If statement lowering. +(CLIJ {s390x.LessOrGreater} (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp) [0] yes no) + && int32(x) != 0 -> (BRC {d} cmp yes no) +// Compare-and-branch. +// Note: bit 3 (unordered) must not be set so we mask out s390x.Unordered. +(BRC {c} (CMP x y) yes no) -> (CGRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) +(BRC {c} (CMPW x y) yes no) -> (CRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) +(BRC {c} (CMPU x y) yes no) -> (CLGRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) +(BRC {c} (CMPWU x y) yes no) -> (CLRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) + +// Compare-and-branch (immediate). +// Note: bit 3 (unordered) must not be set so we mask out s390x.Unordered. +(BRC {c} (CMPconst x [y]) yes no) && is8Bit(y) -> (CGIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) +(BRC {c} (CMPWconst x [y]) yes no) && is8Bit(y) -> (CIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) +(BRC {c} (CMPUconst x [y]) yes no) && isU8Bit(y) -> (CLGIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) +(BRC {c} (CMPWUconst x [y]) yes no) && isU8Bit(y) -> (CLIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) + +// Absorb immediate into compare-and-branch. +(C(R|GR)J {c} x (MOVDconst [y]) yes no) && is8Bit(y) -> (C(I|GI)J {c} x [int64(int8(y))] yes no) +(CL(R|GR)J {c} x (MOVDconst [y]) yes no) && isU8Bit(y) -> (CL(I|GI)J {c} x [int64(int8(y))] yes no) +(C(R|GR)J {c} (MOVDconst [x]) y yes no) && is8Bit(x) -> (C(I|GI)J {c.(s390x.CCMask).ReverseComparison()} y [int64(int8(x))] yes no) +(CL(R|GR)J {c} (MOVDconst [x]) y yes no) && isU8Bit(x) -> (CL(I|GI)J {c.(s390x.CCMask).ReverseComparison()} y [int64(int8(x))] yes no) + +// Prefer comparison with immediate to compare-and-branch. +(CGRJ {c} x (MOVDconst [y]) yes no) && !is8Bit(y) && is32Bit(y) -> (BRC {c} (CMPconst x [int64(int32(y))]) yes no) +(CRJ {c} x (MOVDconst [y]) yes no) && !is8Bit(y) && is32Bit(y) -> (BRC {c} (CMPWconst x [int64(int32(y))]) yes no) +(CLGRJ {c} x (MOVDconst [y]) yes no) && !isU8Bit(y) && isU32Bit(y) -> (BRC {c} (CMPUconst x [int64(int32(y))]) yes no) +(CLRJ {c} x (MOVDconst [y]) yes no) && !isU8Bit(y) && isU32Bit(y) -> (BRC {c} (CMPWUconst x [int64(int32(y))]) yes no) +(CGRJ {c} (MOVDconst [x]) y yes no) && !is8Bit(x) && is32Bit(x) -> (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPconst y [int64(int32(x))]) yes no) +(CRJ {c} (MOVDconst [x]) y yes no) && !is8Bit(x) && is32Bit(x) -> (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPWconst y [int64(int32(x))]) yes no) +(CLGRJ {c} (MOVDconst [x]) y yes no) && !isU8Bit(x) && isU32Bit(x) -> (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPUconst y [int64(int32(x))]) yes no) +(CLRJ {c} (MOVDconst [x]) y yes no) && !isU8Bit(x) && isU32Bit(x) -> (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPWUconst y [int64(int32(x))]) yes no) + +// Absorb sign/zero extensions into 32-bit compare-and-branch. +(CIJ {c} (MOV(W|WZ)reg x) [y] yes no) -> (CIJ {c} x [y] yes no) +(CLIJ {c} (MOV(W|WZ)reg x) [y] yes no) -> (CLIJ {c} x [y] yes no) + +// Bring out-of-range signed immediates into range by varying branch condition. +(BRC {s390x.Less} (CMPconst x [ 128]) yes no) -> (CGIJ {s390x.LessOrEqual} x [ 127] yes no) +(BRC {s390x.Less} (CMPWconst x [ 128]) yes no) -> (CIJ {s390x.LessOrEqual} x [ 127] yes no) +(BRC {s390x.LessOrEqual} (CMPconst x [-129]) yes no) -> (CGIJ {s390x.Less} x [-128] yes no) +(BRC {s390x.LessOrEqual} (CMPWconst x [-129]) yes no) -> (CIJ {s390x.Less} x [-128] yes no) +(BRC {s390x.Greater} (CMPconst x [-129]) yes no) -> (CGIJ {s390x.GreaterOrEqual} x [-128] yes no) +(BRC {s390x.Greater} (CMPWconst x [-129]) yes no) -> (CIJ {s390x.GreaterOrEqual} x [-128] yes no) +(BRC {s390x.GreaterOrEqual} (CMPconst x [ 128]) yes no) -> (CGIJ {s390x.Greater} x [ 127] yes no) +(BRC {s390x.GreaterOrEqual} (CMPWconst x [ 128]) yes no) -> (CIJ {s390x.Greater} x [ 127] yes no) + +// Bring out-of-range unsigned immediates into range by varying branch condition. +// Note: int64(int8(255)) == -1 +(BRC {s390x.Less} (CMP(WU|U)const x [256]) yes no) -> (C(L|LG)IJ {s390x.LessOrEqual} x [-1] yes no) +(BRC {s390x.GreaterOrEqual} (CMP(WU|U)const x [256]) yes no) -> (C(L|LG)IJ {s390x.Greater} x [-1] yes no) + // Fold constants into instructions. (ADD x (MOVDconst [c])) && is32Bit(c) -> (ADDconst [c] x) (ADDW x (MOVDconst [c])) -> (ADDWconst [int64(int32(c))] x) @@ -959,6 +1004,40 @@ (CMPWconst (ANDWconst _ [m]) [n]) && int32(m) >= 0 && int32(m) < int32(n) -> (FlagLT) (CMPWUconst (ANDWconst _ [m]) [n]) && uint32(m) < uint32(n) -> (FlagLT) +// Constant compare-and-branch with immediate. +(CGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal != 0 && int64(x) == int64( int8(y)) -> (First yes no) +(CGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less != 0 && int64(x) < int64( int8(y)) -> (First yes no) +(CGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater != 0 && int64(x) > int64( int8(y)) -> (First yes no) +(CIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal != 0 && int32(x) == int32( int8(y)) -> (First yes no) +(CIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less != 0 && int32(x) < int32( int8(y)) -> (First yes no) +(CIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater != 0 && int32(x) > int32( int8(y)) -> (First yes no) +(CLGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal != 0 && uint64(x) == uint64(uint8(y)) -> (First yes no) +(CLGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less != 0 && uint64(x) < uint64(uint8(y)) -> (First yes no) +(CLGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater != 0 && uint64(x) > uint64(uint8(y)) -> (First yes no) +(CLIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal != 0 && uint32(x) == uint32(uint8(y)) -> (First yes no) +(CLIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less != 0 && uint32(x) < uint32(uint8(y)) -> (First yes no) +(CLIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater != 0 && uint32(x) > uint32(uint8(y)) -> (First yes no) +(CGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal == 0 && int64(x) == int64( int8(y)) -> (First no yes) +(CGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less == 0 && int64(x) < int64( int8(y)) -> (First no yes) +(CGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater == 0 && int64(x) > int64( int8(y)) -> (First no yes) +(CIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal == 0 && int32(x) == int32( int8(y)) -> (First no yes) +(CIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less == 0 && int32(x) < int32( int8(y)) -> (First no yes) +(CIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater == 0 && int32(x) > int32( int8(y)) -> (First no yes) +(CLGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal == 0 && uint64(x) == uint64(uint8(y)) -> (First no yes) +(CLGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less == 0 && uint64(x) < uint64(uint8(y)) -> (First no yes) +(CLGIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater == 0 && uint64(x) > uint64(uint8(y)) -> (First no yes) +(CLIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Equal == 0 && uint32(x) == uint32(uint8(y)) -> (First no yes) +(CLIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Less == 0 && uint32(x) < uint32(uint8(y)) -> (First no yes) +(CLIJ {c} (MOVDconst [x]) [y] yes no) && c.(s390x.CCMask)&s390x.Greater == 0 && uint32(x) > uint32(uint8(y)) -> (First no yes) + +// Constant compare-and-branch with immediate when unsigned comparison with zero. +(C(L|LG)IJ {s390x.GreaterOrEqual} _ [0] yes no) -> (First yes no) +(C(L|LG)IJ {s390x.Less} _ [0] yes no) -> (First no yes) + +// Constant compare-and-branch when operands match. +(C(GR|R|LGR|LR)J {c} x y yes no) && x == y && c.(s390x.CCMask)&s390x.Equal != 0 -> (First yes no) +(C(GR|R|LGR|LR)J {c} x y yes no) && x == y && c.(s390x.CCMask)&s390x.Equal == 0 -> (First no yes) + // Convert 64-bit comparisons to 32-bit comparisons and signed comparisons // to unsigned comparisons. // Helps simplify constant comparison detection. diff --git a/src/cmd/compile/internal/ssa/gen/S390XOps.go b/src/cmd/compile/internal/ssa/gen/S390XOps.go index d34c250cf61..4689102c438 100644 --- a/src/cmd/compile/internal/ssa/gen/S390XOps.go +++ b/src/cmd/compile/internal/ssa/gen/S390XOps.go @@ -707,8 +707,41 @@ func init() { }, } + // All blocks on s390x have their condition code mask (s390x.CCMask) as the Aux value. + // The condition code mask is a 4-bit mask where each bit corresponds to a condition + // code value. If the value of the condition code matches a bit set in the condition + // code mask then the first successor is executed. Otherwise the second successor is + // executed. + // + // | condition code value | mask bit | + // +----------------------+------------+ + // | 0 (equal) | 0b1000 (8) | + // | 1 (less than) | 0b0100 (4) | + // | 2 (greater than) | 0b0010 (2) | + // | 3 (unordered) | 0b0001 (1) | + // + // Note: that compare-and-branch instructions must not have bit 3 (0b0001) set. var S390Xblocks = []blockData{ - {name: "BRC", controls: 1}, // aux is condition code mask (s390x.CCMask) + // branch on condition + {name: "BRC", controls: 1}, // condition code value (flags) is Controls[0] + + // compare-and-branch (register-register) + // - integrates comparison of Controls[0] with Controls[1] + // - both control values must be in general purpose registers + {name: "CRJ", controls: 2}, // signed 32-bit integer comparison + {name: "CGRJ", controls: 2}, // signed 64-bit integer comparison + {name: "CLRJ", controls: 2}, // unsigned 32-bit integer comparison + {name: "CLGRJ", controls: 2}, // unsigned 64-bit integer comparison + + // compare-and-branch (register-immediate) + // - integrates comparison of Controls[0] with AuxInt + // - control value must be in a general purpose register + // - the AuxInt value is sign-extended for signed comparisons + // and zero-extended for unsigned comparisons + {name: "CIJ", controls: 1, auxint: "Int8"}, // signed 32-bit integer comparison + {name: "CGIJ", controls: 1, auxint: "Int8"}, // signed 64-bit integer comparison + {name: "CLIJ", controls: 1, auxint: "UInt8"}, // unsigned 32-bit integer comparison + {name: "CLGIJ", controls: 1, auxint: "UInt8"}, // unsigned 64-bit integer comparison } archs = append(archs, arch{ diff --git a/src/cmd/compile/internal/ssa/gen/main.go b/src/cmd/compile/internal/ssa/gen/main.go index eef72284b95..55ba338efa7 100644 --- a/src/cmd/compile/internal/ssa/gen/main.go +++ b/src/cmd/compile/internal/ssa/gen/main.go @@ -70,6 +70,7 @@ type opData struct { type blockData struct { name string // the suffix for this block ("EQ", "LT", etc.) controls int // the number of control values this type of block requires + auxint string // the type of the AuxInt value, if any } type regInfo struct { @@ -219,6 +220,21 @@ func genOp() { fmt.Fprintln(w, "}") fmt.Fprintln(w, "func (k BlockKind) String() string {return blockString[k]}") + // generate block kind auxint method + fmt.Fprintln(w, "func (k BlockKind) AuxIntType() string {") + fmt.Fprintln(w, "switch k {") + for _, a := range archs { + for _, b := range a.blocks { + if b.auxint == "" { + continue + } + fmt.Fprintf(w, "case Block%s%s: return \"%s\"\n", a.Name(), b.name, b.auxint) + } + } + fmt.Fprintln(w, "}") + fmt.Fprintln(w, "return \"\"") + fmt.Fprintln(w, "}") + // generate Op* declarations fmt.Fprintln(w, "const (") fmt.Fprintln(w, "OpInvalid Op = iota") // make sure OpInvalid is 0. diff --git a/src/cmd/compile/internal/ssa/gen/rulegen.go b/src/cmd/compile/internal/ssa/gen/rulegen.go index 5c4c5ef1af0..444a8566c64 100644 --- a/src/cmd/compile/internal/ssa/gen/rulegen.go +++ b/src/cmd/compile/internal/ssa/gen/rulegen.go @@ -749,7 +749,7 @@ func breakf(format string, a ...interface{}) *CondBreak { func genBlockRewrite(rule Rule, arch arch, data blockData) *RuleRewrite { rr := &RuleRewrite{loc: rule.loc} rr.match, rr.cond, rr.result = rule.parse() - _, _, _, aux, s := extract(rr.match) // remove parens, then split + _, _, auxint, aux, s := extract(rr.match) // remove parens, then split // check match of control values if len(s) < data.controls { @@ -781,15 +781,28 @@ func genBlockRewrite(rule Rule, arch arch, data blockData) *RuleRewrite { pos[i] = arg + ".Pos" } } - if aux != "" { - rr.add(declf(aux, "b.Aux")) + for _, e := range []struct { + name, field string + }{ + {auxint, "AuxInt"}, + {aux, "Aux"}, + } { + if e.name == "" { + continue + } + if !token.IsIdentifier(e.name) || rr.declared(e.name) { + // code or variable + rr.add(breakf("b.%s != %s", e.field, e.name)) + } else { + rr.add(declf(e.name, "b.%s", e.field)) + } } if rr.cond != "" { rr.add(breakf("!(%s)", rr.cond)) } // Rule matches. Generate result. - outop, _, _, aux, t := extract(rr.result) // remove parens, then split + outop, _, auxint, aux, t := extract(rr.result) // remove parens, then split _, outdata := getBlockInfo(outop, arch) if len(t) < outdata.controls { log.Fatalf("incorrect number of output arguments in %s, got %v wanted at least %v", rule, len(s), outdata.controls) @@ -816,8 +829,7 @@ func genBlockRewrite(rule Rule, arch arch, data blockData) *RuleRewrite { } blockName, _ := getBlockInfo(outop, arch) - rr.add(stmtf("b.Kind = %s", blockName)) - rr.add(stmtf("b.ResetControls()")) + rr.add(stmtf("b.Reset(%s)", blockName)) for i, control := range t[:outdata.controls] { // Select a source position for any new control values. // TODO: does it always make sense to use the source position @@ -833,10 +845,11 @@ func genBlockRewrite(rule Rule, arch arch, data blockData) *RuleRewrite { v := genResult0(rr, arch, control, false, false, newpos) rr.add(stmtf("b.AddControl(%s)", v)) } + if auxint != "" { + rr.add(stmtf("b.AuxInt = %s", auxint)) + } if aux != "" { rr.add(stmtf("b.Aux = %s", aux)) - } else { - rr.add(stmtf("b.Aux = nil")) } succChanged := false diff --git a/src/cmd/compile/internal/ssa/loop_test.go b/src/cmd/compile/internal/ssa/loop_test.go deleted file mode 100644 index e96d3602704..00000000000 --- a/src/cmd/compile/internal/ssa/loop_test.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2017 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 ssa - -import ( - "cmd/compile/internal/types" - "cmd/internal/src" - "testing" -) - -func TestLoopConditionS390X(t *testing.T) { - // Test that a simple loop condition does not generate a conditional - // move (issue #19227). - // - // MOVDLT is generated when Less64 is lowered but should be - // optimized into an LT branch. - // - // For example, compiling the following loop: - // - // for i := 0; i < N; i++ { - // sum += 3 - // } - // - // should generate assembly similar to: - // loop: - // CMP R0, R1 - // BGE done - // ADD $3, R4 - // ADD $1, R1 - // BR loop - // done: - // - // rather than: - // loop: - // MOVD $0, R2 - // MOVD $1, R3 - // CMP R0, R1 - // LOCGR $(8+2) R2, R3 - // CMPW R2, $0 - // BNE done - // ADD $3, R4 - // ADD $1, R1 - // BR loop - // done: - // - c := testConfigS390X(t) - a := c.Frontend().Auto(src.NoXPos, c.config.Types.Int8) - fun := c.Fun("entry", - Bloc("entry", - Valu("mem", OpInitMem, types.TypeMem, 0, nil), - Valu("SP", OpSP, c.config.Types.Uintptr, 0, nil), - Valu("ret", OpLocalAddr, c.config.Types.Int64.PtrTo(), 0, nil, "SP", "mem"), - Valu("N", OpArg, c.config.Types.Int64, 0, c.Frontend().Auto(src.NoXPos, c.config.Types.Int64)), - Valu("starti", OpConst64, c.config.Types.Int64, 0, nil), - Valu("startsum", OpConst64, c.config.Types.Int64, 0, nil), - Goto("b1")), - Bloc("b1", - Valu("phii", OpPhi, c.config.Types.Int64, 0, nil, "starti", "i"), - Valu("phisum", OpPhi, c.config.Types.Int64, 0, nil, "startsum", "sum"), - Valu("cmp1", OpLess64, c.config.Types.Bool, 0, nil, "phii", "N"), - If("cmp1", "b2", "b3")), - Bloc("b2", - Valu("c1", OpConst64, c.config.Types.Int64, 1, nil), - Valu("i", OpAdd64, c.config.Types.Int64, 0, nil, "phii", "c1"), - Valu("c3", OpConst64, c.config.Types.Int64, 3, nil), - Valu("sum", OpAdd64, c.config.Types.Int64, 0, nil, "phisum", "c3"), - Goto("b1")), - Bloc("b3", - Valu("retdef", OpVarDef, types.TypeMem, 0, a, "mem"), - Valu("store", OpStore, types.TypeMem, 0, c.config.Types.Int64, "ret", "phisum", "retdef"), - Exit("store"))) - CheckFunc(fun.f) - Compile(fun.f) - CheckFunc(fun.f) - - checkOpcodeCounts(t, fun.f, map[Op]int{ - OpS390XLOCGR: 0, - OpS390XCMP: 1, - OpS390XCMPWconst: 0, - }) -} diff --git a/src/cmd/compile/internal/ssa/numberlines.go b/src/cmd/compile/internal/ssa/numberlines.go index 68195e9b656..6321d615372 100644 --- a/src/cmd/compile/internal/ssa/numberlines.go +++ b/src/cmd/compile/internal/ssa/numberlines.go @@ -15,7 +15,7 @@ func isPoorStatementOp(op Op) bool { switch op { // Note that Nilcheck often vanishes, but when it doesn't, you'd love to start the statement there // so that a debugger-user sees the stop before the panic, and can examine the value. - case OpAddr, OpLocalAddr, OpOffPtr, OpStructSelect, OpPhi, + case OpAddr, OpLocalAddr, OpOffPtr, OpStructSelect, OpPhi, OpITab, OpIData, OpIMake, OpStringMake, OpSliceMake, OpStructMake0, OpStructMake1, OpStructMake2, OpStructMake3, OpStructMake4, OpConstBool, OpConst8, OpConst16, OpConst32, OpConst64, OpConst32F, OpConst64F: return true diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index 442bef948eb..6ac86bbb9e9 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -112,6 +112,14 @@ const ( BlockPPC64FGE BlockS390XBRC + BlockS390XCRJ + BlockS390XCGRJ + BlockS390XCLRJ + BlockS390XCLGRJ + BlockS390XCIJ + BlockS390XCGIJ + BlockS390XCLIJ + BlockS390XCLGIJ BlockPlain BlockIf @@ -220,7 +228,15 @@ var blockString = [...]string{ BlockPPC64FGT: "FGT", BlockPPC64FGE: "FGE", - BlockS390XBRC: "BRC", + BlockS390XBRC: "BRC", + BlockS390XCRJ: "CRJ", + BlockS390XCGRJ: "CGRJ", + BlockS390XCLRJ: "CLRJ", + BlockS390XCLGRJ: "CLGRJ", + BlockS390XCIJ: "CIJ", + BlockS390XCGIJ: "CGIJ", + BlockS390XCLIJ: "CLIJ", + BlockS390XCLGIJ: "CLGIJ", BlockPlain: "Plain", BlockIf: "If", @@ -232,6 +248,19 @@ var blockString = [...]string{ } func (k BlockKind) String() string { return blockString[k] } +func (k BlockKind) AuxIntType() string { + switch k { + case BlockS390XCIJ: + return "Int8" + case BlockS390XCGIJ: + return "Int8" + case BlockS390XCLIJ: + return "UInt8" + case BlockS390XCLGIJ: + return "UInt8" + } + return "" +} const ( OpInvalid Op = iota @@ -24461,7 +24490,7 @@ var opcodeTable = [...]opInfo{ {0, 8}, // R3 {1, 16}, // R4 }, - clobbers: 1944, // R3 R4 R7 R8 R9 R10 + clobbers: 16408, // R3 R4 R14 }, }, { diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go index 6ffa1e38484..d7e931d0b89 100644 --- a/src/cmd/compile/internal/ssa/regalloc.go +++ b/src/cmd/compile/internal/ssa/regalloc.go @@ -625,15 +625,6 @@ func (s *regAllocState) init(f *Func) { s.f.fe.Fatalf(src.NoXPos, "arch %s not implemented", s.f.Config.arch) } } - if s.f.Config.nacl { - switch s.f.Config.arch { - case "arm": - s.allocatable &^= 1 << 9 // R9 is "thread pointer" on nacl/arm - case "amd64p32": - s.allocatable &^= 1 << 5 // BP - reserved for nacl - s.allocatable &^= 1 << 15 // R15 - reserved for nacl - } - } if s.f.Config.use387 { s.allocatable &^= 1 << 15 // X7 disallowed (one 387 register is used as scratch space during SSE->387 generation in ../x86/387.go) } @@ -1328,27 +1319,25 @@ func (s *regAllocState) regalloc(f *Func) { // arg0 is dead. We can clobber its register. goto ok } + if opcodeTable[v.Op].commutative && !s.liveAfterCurrentInstruction(v.Args[1]) { + args[0], args[1] = args[1], args[0] + goto ok + } if s.values[v.Args[0].ID].rematerializeable { // We can rematerialize the input, don't worry about clobbering it. goto ok } + if opcodeTable[v.Op].commutative && s.values[v.Args[1].ID].rematerializeable { + args[0], args[1] = args[1], args[0] + goto ok + } if countRegs(s.values[v.Args[0].ID].regs) >= 2 { // we have at least 2 copies of arg0. We can afford to clobber one. goto ok } - if opcodeTable[v.Op].commutative { - if !s.liveAfterCurrentInstruction(v.Args[1]) { - args[0], args[1] = args[1], args[0] - goto ok - } - if s.values[v.Args[1].ID].rematerializeable { - args[0], args[1] = args[1], args[0] - goto ok - } - if countRegs(s.values[v.Args[1].ID].regs) >= 2 { - args[0], args[1] = args[1], args[0] - goto ok - } + if opcodeTable[v.Op].commutative && countRegs(s.values[v.Args[1].ID].regs) >= 2 { + args[0], args[1] = args[1], args[0] + goto ok } // We can't overwrite arg0 (or arg1, if commutative). So we diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index 59d76015671..539941001dd 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -404,6 +404,16 @@ func is16Bit(n int64) bool { return n == int64(int16(n)) } +// is8Bit reports whether n can be represented as a signed 8 bit integer. +func is8Bit(n int64) bool { + return n == int64(int8(n)) +} + +// isU8Bit reports whether n can be represented as an unsigned 8 bit integer. +func isU8Bit(n int64) bool { + return n == int64(uint8(n)) +} + // isU12Bit reports whether n can be represented as an unsigned 12 bit integer. func isU12Bit(n int64) bool { return 0 <= n && n < (1<<12) @@ -1051,7 +1061,7 @@ func isInlinableMemmove(dst, src *Value, sz int64, c *Config) bool { // lowers them, so we only perform this optimization on platforms that we know to // have fast Move ops. switch c.arch { - case "amd64", "amd64p32": + case "amd64": return sz <= 16 || (sz < 1024 && disjoint(dst, sz, src, sz)) case "386", "ppc64", "ppc64le", "arm64": return sz <= 8 @@ -1067,7 +1077,7 @@ func isInlinableMemmove(dst, src *Value, sz int64, c *Config) bool { // for sizes < 32-bit. This is used to decide whether to promote some rotations. func hasSmallRotate(c *Config) bool { switch c.arch { - case "amd64", "amd64p32", "386": + case "amd64", "386": return true default: return false diff --git a/src/cmd/compile/internal/ssa/rewrite386.go b/src/cmd/compile/internal/ssa/rewrite386.go index bde41059f8f..a12977bc8bc 100644 --- a/src/cmd/compile/internal/ssa/rewrite386.go +++ b/src/cmd/compile/internal/ssa/rewrite386.go @@ -21982,53 +21982,41 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386EQ - b.ResetControls() + b.Reset(Block386EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (EQ (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -22038,52 +22026,40 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386LE - b.ResetControls() + b.Reset(Block386LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (GE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case Block386GT: @@ -22092,53 +22068,41 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386LT - b.ResetControls() + b.Reset(Block386LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (GT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockIf: @@ -22147,10 +22111,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETL { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386LT - b.ResetControls() + b.Reset(Block386LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETLE cmp) yes no) @@ -22158,10 +22120,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETLE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386LE - b.ResetControls() + b.Reset(Block386LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETG cmp) yes no) @@ -22169,10 +22129,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETG { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386GT - b.ResetControls() + b.Reset(Block386GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETGE cmp) yes no) @@ -22180,10 +22138,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETGE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386GE - b.ResetControls() + b.Reset(Block386GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETEQ cmp) yes no) @@ -22191,10 +22147,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETEQ { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386EQ - b.ResetControls() + b.Reset(Block386EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETNE cmp) yes no) @@ -22202,10 +22156,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETNE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386NE - b.ResetControls() + b.Reset(Block386NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETB cmp) yes no) @@ -22213,10 +22165,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETB { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386ULT - b.ResetControls() + b.Reset(Block386ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETBE cmp) yes no) @@ -22224,10 +22174,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETBE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386ULE - b.ResetControls() + b.Reset(Block386ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETA cmp) yes no) @@ -22235,10 +22183,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETA { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386UGT - b.ResetControls() + b.Reset(Block386UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETAE cmp) yes no) @@ -22246,10 +22192,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETAE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386UGE - b.ResetControls() + b.Reset(Block386UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETO cmp) yes no) @@ -22257,10 +22201,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETO { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386OS - b.ResetControls() + b.Reset(Block386OS) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETGF cmp) yes no) @@ -22268,10 +22210,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETGF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386UGT - b.ResetControls() + b.Reset(Block386UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETGEF cmp) yes no) @@ -22279,10 +22219,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETGEF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386UGE - b.ResetControls() + b.Reset(Block386UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETEQF cmp) yes no) @@ -22290,10 +22228,8 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETEQF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386EQF - b.ResetControls() + b.Reset(Block386EQF) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETNEF cmp) yes no) @@ -22301,23 +22237,19 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386SETNEF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386NEF - b.ResetControls() + b.Reset(Block386NEF) b.AddControl(cmp) - b.Aux = nil return true } // match: (If cond yes no) // result: (NE (TESTB cond cond) yes no) for { cond := b.Controls[0] - b.Kind = Block386NE - b.ResetControls() + b.Reset(Block386NE) v0 := b.NewValue0(cond.Pos, Op386TESTB, types.TypeFlags) v0.AddArg(cond) v0.AddArg(cond) b.AddControl(v0) - b.Aux = nil return true } case Block386LE: @@ -22326,51 +22258,39 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386GE - b.ResetControls() + b.Reset(Block386GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (LE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -22380,52 +22300,40 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386GT - b.ResetControls() + b.Reset(Block386GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (LT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -22444,10 +22352,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETL || cmp != v_0_1.Args[0] { break } - b.Kind = Block386LT - b.ResetControls() + b.Reset(Block386LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETL cmp) (SETL cmp)) yes no) @@ -22464,10 +22370,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETL || cmp != v_0_1.Args[0] { break } - b.Kind = Block386LT - b.ResetControls() + b.Reset(Block386LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no) @@ -22484,10 +22388,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETLE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386LE - b.ResetControls() + b.Reset(Block386LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no) @@ -22504,10 +22406,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETLE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386LE - b.ResetControls() + b.Reset(Block386LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETG cmp) (SETG cmp)) yes no) @@ -22524,10 +22424,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETG || cmp != v_0_1.Args[0] { break } - b.Kind = Block386GT - b.ResetControls() + b.Reset(Block386GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETG cmp) (SETG cmp)) yes no) @@ -22544,10 +22442,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETG || cmp != v_0_1.Args[0] { break } - b.Kind = Block386GT - b.ResetControls() + b.Reset(Block386GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no) @@ -22564,10 +22460,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETGE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386GE - b.ResetControls() + b.Reset(Block386GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no) @@ -22584,10 +22478,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETGE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386GE - b.ResetControls() + b.Reset(Block386GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no) @@ -22604,10 +22496,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETEQ || cmp != v_0_1.Args[0] { break } - b.Kind = Block386EQ - b.ResetControls() + b.Reset(Block386EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no) @@ -22624,10 +22514,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETEQ || cmp != v_0_1.Args[0] { break } - b.Kind = Block386EQ - b.ResetControls() + b.Reset(Block386EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no) @@ -22644,10 +22532,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETNE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386NE - b.ResetControls() + b.Reset(Block386NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no) @@ -22664,10 +22550,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETNE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386NE - b.ResetControls() + b.Reset(Block386NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETB cmp) (SETB cmp)) yes no) @@ -22684,10 +22568,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETB || cmp != v_0_1.Args[0] { break } - b.Kind = Block386ULT - b.ResetControls() + b.Reset(Block386ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETB cmp) (SETB cmp)) yes no) @@ -22704,10 +22586,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETB || cmp != v_0_1.Args[0] { break } - b.Kind = Block386ULT - b.ResetControls() + b.Reset(Block386ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no) @@ -22724,10 +22604,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETBE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386ULE - b.ResetControls() + b.Reset(Block386ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no) @@ -22744,10 +22622,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETBE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386ULE - b.ResetControls() + b.Reset(Block386ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETA cmp) (SETA cmp)) yes no) @@ -22764,10 +22640,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETA || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGT - b.ResetControls() + b.Reset(Block386UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETA cmp) (SETA cmp)) yes no) @@ -22784,10 +22658,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETA || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGT - b.ResetControls() + b.Reset(Block386UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no) @@ -22804,10 +22676,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETAE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGE - b.ResetControls() + b.Reset(Block386UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no) @@ -22824,10 +22694,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETAE || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGE - b.ResetControls() + b.Reset(Block386UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETO cmp) (SETO cmp)) yes no) @@ -22844,10 +22712,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETO || cmp != v_0_1.Args[0] { break } - b.Kind = Block386OS - b.ResetControls() + b.Reset(Block386OS) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETO cmp) (SETO cmp)) yes no) @@ -22864,10 +22730,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETO || cmp != v_0_1.Args[0] { break } - b.Kind = Block386OS - b.ResetControls() + b.Reset(Block386OS) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no) @@ -22884,10 +22748,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETGF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGT - b.ResetControls() + b.Reset(Block386UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no) @@ -22904,10 +22766,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETGF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGT - b.ResetControls() + b.Reset(Block386UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no) @@ -22924,10 +22784,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETGEF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGE - b.ResetControls() + b.Reset(Block386UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no) @@ -22944,10 +22802,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETGEF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386UGE - b.ResetControls() + b.Reset(Block386UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no) @@ -22964,10 +22820,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETEQF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386EQF - b.ResetControls() + b.Reset(Block386EQF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no) @@ -22984,10 +22838,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETEQF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386EQF - b.ResetControls() + b.Reset(Block386EQF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no) @@ -23004,10 +22856,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETNEF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386NEF - b.ResetControls() + b.Reset(Block386NEF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no) @@ -23024,10 +22874,8 @@ func rewriteBlock386(b *Block) bool { if v_0_1.Op != Op386SETNEF || cmp != v_0_1.Args[0] { break } - b.Kind = Block386NEF - b.ResetControls() + b.Reset(Block386NEF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (InvertFlags cmp) yes no) @@ -23035,51 +22883,39 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386NE - b.ResetControls() + b.Reset(Block386NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (NE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case Block386UGE: @@ -23088,52 +22924,40 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386ULE - b.ResetControls() + b.Reset(Block386ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (UGE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case Block386UGT: @@ -23142,53 +22966,41 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386ULT - b.ResetControls() + b.Reset(Block386ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (UGT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case Block386ULE: @@ -23197,51 +23009,39 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386UGE - b.ResetControls() + b.Reset(Block386UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (ULE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -23251,52 +23051,40 @@ func rewriteBlock386(b *Block) bool { for b.Controls[0].Op == Op386InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = Block386UGT - b.ResetControls() + b.Reset(Block386UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (ULT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == Op386FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == Op386FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go index 20443d2f487..0d5763b1bf6 100644 --- a/src/cmd/compile/internal/ssa/rewriteAMD64.go +++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go @@ -3298,10 +3298,7 @@ func rewriteValueAMD64_OpAMD64ADDSSload_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ANDL (NOTL (SHLL (MOVLconst [1]) y)) x) - // cond: !config.nacl // result: (BTRL x y) for { x := v.Args[1] @@ -3315,7 +3312,7 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { } y := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTRL) @@ -3324,7 +3321,6 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { return true } // match: (ANDL x (NOTL (SHLL (MOVLconst [1]) y))) - // cond: !config.nacl // result: (BTRL x y) for { _ = v.Args[1] @@ -3339,7 +3335,7 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { } y := v_1_0.Args[1] v_1_0_0 := v_1_0.Args[0] - if v_1_0_0.Op != OpAMD64MOVLconst || v_1_0_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0_0.Op != OpAMD64MOVLconst || v_1_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTRL) @@ -3348,7 +3344,7 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { return true } // match: (ANDL (MOVLconst [c]) x) - // cond: isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(^c) && uint64(^c) >= 128 // result: (BTRLconst [log2uint32(^c)] x) for { x := v.Args[1] @@ -3357,7 +3353,7 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { break } c := v_0.AuxInt - if !(isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(^c) && uint64(^c) >= 128) { break } v.reset(OpAMD64BTRLconst) @@ -3366,7 +3362,7 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { return true } // match: (ANDL x (MOVLconst [c])) - // cond: isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(^c) && uint64(^c) >= 128 // result: (BTRLconst [log2uint32(^c)] x) for { _ = v.Args[1] @@ -3376,7 +3372,7 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { break } c := v_1.AuxInt - if !(isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(^c) && uint64(^c) >= 128) { break } v.reset(OpAMD64BTRLconst) @@ -3477,15 +3473,13 @@ func rewriteValueAMD64_OpAMD64ANDL_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ANDLconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ANDLconst [c] x) - // cond: isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(^c) && uint64(^c) >= 128 // result: (BTRLconst [log2uint32(^c)] x) for { c := v.AuxInt x := v.Args[0] - if !(isUint32PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(^c) && uint64(^c) >= 128) { break } v.reset(OpAMD64BTRLconst) @@ -3771,10 +3765,7 @@ func rewriteValueAMD64_OpAMD64ANDLmodify_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ANDQ (NOTQ (SHLQ (MOVQconst [1]) y)) x) - // cond: !config.nacl // result: (BTRQ x y) for { x := v.Args[1] @@ -3788,7 +3779,7 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { } y := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTRQ) @@ -3797,7 +3788,6 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { return true } // match: (ANDQ x (NOTQ (SHLQ (MOVQconst [1]) y))) - // cond: !config.nacl // result: (BTRQ x y) for { _ = v.Args[1] @@ -3812,7 +3802,7 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { } y := v_1_0.Args[1] v_1_0_0 := v_1_0.Args[0] - if v_1_0_0.Op != OpAMD64MOVQconst || v_1_0_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0_0.Op != OpAMD64MOVQconst || v_1_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTRQ) @@ -3821,7 +3811,7 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { return true } // match: (ANDQ (MOVQconst [c]) x) - // cond: isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(^c) && uint64(^c) >= 128 // result: (BTRQconst [log2(^c)] x) for { x := v.Args[1] @@ -3830,7 +3820,7 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { break } c := v_0.AuxInt - if !(isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(^c) && uint64(^c) >= 128) { break } v.reset(OpAMD64BTRQconst) @@ -3839,7 +3829,7 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { return true } // match: (ANDQ x (MOVQconst [c])) - // cond: isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(^c) && uint64(^c) >= 128 // result: (BTRQconst [log2(^c)] x) for { _ = v.Args[1] @@ -3849,7 +3839,7 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { break } c := v_1.AuxInt - if !(isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(^c) && uint64(^c) >= 128) { break } v.reset(OpAMD64BTRQconst) @@ -3958,15 +3948,13 @@ func rewriteValueAMD64_OpAMD64ANDQ_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ANDQconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ANDQconst [c] x) - // cond: isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(^c) && uint64(^c) >= 128 // result: (BTRQconst [log2(^c)] x) for { c := v.AuxInt x := v.Args[0] - if !(isUint64PowerOfTwo(^c) && uint64(^c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(^c) && uint64(^c) >= 128) { break } v.reset(OpAMD64BTRQconst) @@ -23748,10 +23736,7 @@ func rewriteValueAMD64_OpAMD64NOTQ_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ORL (SHLL (MOVLconst [1]) y) x) - // cond: !config.nacl // result: (BTSL x y) for { x := v.Args[1] @@ -23761,7 +23746,7 @@ func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { } y := v_0.Args[1] v_0_0 := v_0.Args[0] - if v_0_0.Op != OpAMD64MOVLconst || v_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0.Op != OpAMD64MOVLconst || v_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTSL) @@ -23770,7 +23755,6 @@ func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { return true } // match: (ORL x (SHLL (MOVLconst [1]) y)) - // cond: !config.nacl // result: (BTSL x y) for { _ = v.Args[1] @@ -23781,7 +23765,7 @@ func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { } y := v_1.Args[1] v_1_0 := v_1.Args[0] - if v_1_0.Op != OpAMD64MOVLconst || v_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0.Op != OpAMD64MOVLconst || v_1_0.AuxInt != 1 { break } v.reset(OpAMD64BTSL) @@ -23790,7 +23774,7 @@ func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { return true } // match: (ORL (MOVLconst [c]) x) - // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 // result: (BTSLconst [log2uint32(c)] x) for { x := v.Args[1] @@ -23799,7 +23783,7 @@ func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { break } c := v_0.AuxInt - if !(isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTSLconst) @@ -23808,7 +23792,7 @@ func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { return true } // match: (ORL x (MOVLconst [c])) - // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 // result: (BTSLconst [log2uint32(c)] x) for { _ = v.Args[1] @@ -23818,7 +23802,7 @@ func rewriteValueAMD64_OpAMD64ORL_0(v *Value) bool { break } c := v_1.AuxInt - if !(isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTSLconst) @@ -30486,15 +30470,13 @@ func rewriteValueAMD64_OpAMD64ORL_130(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ORLconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ORLconst [c] x) - // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 // result: (BTSLconst [log2uint32(c)] x) for { c := v.AuxInt x := v.Args[0] - if !(isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTSLconst) @@ -30758,10 +30740,7 @@ func rewriteValueAMD64_OpAMD64ORLmodify_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ORQ (SHLQ (MOVQconst [1]) y) x) - // cond: !config.nacl // result: (BTSQ x y) for { x := v.Args[1] @@ -30771,7 +30750,7 @@ func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { } y := v_0.Args[1] v_0_0 := v_0.Args[0] - if v_0_0.Op != OpAMD64MOVQconst || v_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0.Op != OpAMD64MOVQconst || v_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTSQ) @@ -30780,7 +30759,6 @@ func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { return true } // match: (ORQ x (SHLQ (MOVQconst [1]) y)) - // cond: !config.nacl // result: (BTSQ x y) for { _ = v.Args[1] @@ -30791,7 +30769,7 @@ func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { } y := v_1.Args[1] v_1_0 := v_1.Args[0] - if v_1_0.Op != OpAMD64MOVQconst || v_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0.Op != OpAMD64MOVQconst || v_1_0.AuxInt != 1 { break } v.reset(OpAMD64BTSQ) @@ -30800,7 +30778,7 @@ func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { return true } // match: (ORQ (MOVQconst [c]) x) - // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 // result: (BTSQconst [log2(c)] x) for { x := v.Args[1] @@ -30809,7 +30787,7 @@ func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { break } c := v_0.AuxInt - if !(isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTSQconst) @@ -30818,7 +30796,7 @@ func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { return true } // match: (ORQ x (MOVQconst [c])) - // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 // result: (BTSQconst [log2(c)] x) for { _ = v.Args[1] @@ -30828,7 +30806,7 @@ func rewriteValueAMD64_OpAMD64ORQ_0(v *Value) bool { break } c := v_1.AuxInt - if !(isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTSQconst) @@ -39477,15 +39455,13 @@ func rewriteValueAMD64_OpAMD64ORQ_160(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64ORQconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (ORQconst [c] x) - // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 // result: (BTSQconst [log2(c)] x) for { c := v.AuxInt x := v.Args[0] - if !(isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTSQconst) @@ -42168,9 +42144,7 @@ func rewriteValueAMD64_OpAMD64SETBstore_0(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETEQ (TESTL (SHLL (MOVLconst [1]) x) y)) - // cond: !config.nacl // result: (SETAE (BTL x y)) for { v_0 := v.Args[0] @@ -42184,7 +42158,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETAE) @@ -42195,7 +42169,6 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { return true } // match: (SETEQ (TESTL y (SHLL (MOVLconst [1]) x))) - // cond: !config.nacl // result: (SETAE (BTL x y)) for { v_0 := v.Args[0] @@ -42210,7 +42183,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETAE) @@ -42221,7 +42194,6 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { return true } // match: (SETEQ (TESTQ (SHLQ (MOVQconst [1]) x) y)) - // cond: !config.nacl // result: (SETAE (BTQ x y)) for { v_0 := v.Args[0] @@ -42235,7 +42207,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETAE) @@ -42246,7 +42218,6 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { return true } // match: (SETEQ (TESTQ y (SHLQ (MOVQconst [1]) x))) - // cond: !config.nacl // result: (SETAE (BTQ x y)) for { v_0 := v.Args[0] @@ -42261,7 +42232,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETAE) @@ -42272,7 +42243,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { return true } // match: (SETEQ (TESTLconst [c] x)) - // cond: isUint32PowerOfTwo(c) && !config.nacl + // cond: isUint32PowerOfTwo(c) // result: (SETAE (BTLconst [log2uint32(c)] x)) for { v_0 := v.Args[0] @@ -42281,7 +42252,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { } c := v_0.AuxInt x := v_0.Args[0] - if !(isUint32PowerOfTwo(c) && !config.nacl) { + if !(isUint32PowerOfTwo(c)) { break } v.reset(OpAMD64SETAE) @@ -42292,7 +42263,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { return true } // match: (SETEQ (TESTQconst [c] x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETAE (BTQconst [log2(c)] x)) for { v_0 := v.Args[0] @@ -42301,7 +42272,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { } c := v_0.AuxInt x := v_0.Args[0] - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETAE) @@ -42312,7 +42283,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { return true } // match: (SETEQ (TESTQ (MOVQconst [c]) x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETAE (BTQconst [log2(c)] x)) for { v_0 := v.Args[0] @@ -42325,7 +42296,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { break } c := v_0_0.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETAE) @@ -42336,7 +42307,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { return true } // match: (SETEQ (TESTQ x (MOVQconst [c]))) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETAE (BTQconst [log2(c)] x)) for { v_0 := v.Args[0] @@ -42350,7 +42321,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { break } c := v_0_1.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETAE) @@ -42400,9 +42371,8 @@ func rewriteValueAMD64_OpAMD64SETEQ_0(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETEQ (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -42419,7 +42389,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42430,7 +42400,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTQ z2 z1:(SHLQconst [63] (SHRQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -42448,7 +42418,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42459,7 +42429,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTL z1:(SHLLconst [31] (SHRQconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [31] x)) for { v_0 := v.Args[0] @@ -42476,7 +42446,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42487,7 +42457,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTL z2 z1:(SHLLconst [31] (SHRQconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [31] x)) for { v_0 := v.Args[0] @@ -42505,7 +42475,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42516,7 +42486,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [0] x)) for { v_0 := v.Args[0] @@ -42533,7 +42503,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42544,7 +42514,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTQ z2 z1:(SHRQconst [63] (SHLQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [0] x)) for { v_0 := v.Args[0] @@ -42562,7 +42532,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42573,7 +42543,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTLconst [0] x)) for { v_0 := v.Args[0] @@ -42590,7 +42560,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42601,7 +42571,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTL z2 z1:(SHRLconst [31] (SHLLconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTLconst [0] x)) for { v_0 := v.Args[0] @@ -42619,7 +42589,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42630,7 +42600,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTQ z1:(SHRQconst [63] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -42643,7 +42613,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42654,7 +42624,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { return true } // match: (SETEQ (TESTQ z2 z1:(SHRQconst [63] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -42668,7 +42638,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42682,9 +42652,8 @@ func rewriteValueAMD64_OpAMD64SETEQ_10(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETEQ_20(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETEQ (TESTL z1:(SHRLconst [31] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTLconst [31] x)) for { v_0 := v.Args[0] @@ -42697,7 +42666,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42708,7 +42677,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_20(v *Value) bool { return true } // match: (SETEQ (TESTL z2 z1:(SHRLconst [31] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAE (BTLconst [31] x)) for { v_0 := v.Args[0] @@ -42722,7 +42691,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAE) @@ -42803,9 +42772,7 @@ func rewriteValueAMD64_OpAMD64SETEQ_20(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETEQstore [off] {sym} ptr (TESTL (SHLL (MOVLconst [1]) x) y) mem) - // cond: !config.nacl // result: (SETAEstore [off] {sym} ptr (BTL x y) mem) for { off := v.AuxInt @@ -42823,7 +42790,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { } x := v_1_0.Args[1] v_1_0_0 := v_1_0.Args[0] - if v_1_0_0.Op != OpAMD64MOVLconst || v_1_0_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0_0.Op != OpAMD64MOVLconst || v_1_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETAEstore) @@ -42838,7 +42805,6 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTL y (SHLL (MOVLconst [1]) x)) mem) - // cond: !config.nacl // result: (SETAEstore [off] {sym} ptr (BTL x y) mem) for { off := v.AuxInt @@ -42857,7 +42823,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { } x := v_1_1.Args[1] v_1_1_0 := v_1_1.Args[0] - if v_1_1_0.Op != OpAMD64MOVLconst || v_1_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_1_0.Op != OpAMD64MOVLconst || v_1_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETAEstore) @@ -42872,7 +42838,6 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ (SHLQ (MOVQconst [1]) x) y) mem) - // cond: !config.nacl // result: (SETAEstore [off] {sym} ptr (BTQ x y) mem) for { off := v.AuxInt @@ -42890,7 +42855,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { } x := v_1_0.Args[1] v_1_0_0 := v_1_0.Args[0] - if v_1_0_0.Op != OpAMD64MOVQconst || v_1_0_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0_0.Op != OpAMD64MOVQconst || v_1_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETAEstore) @@ -42905,7 +42870,6 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ y (SHLQ (MOVQconst [1]) x)) mem) - // cond: !config.nacl // result: (SETAEstore [off] {sym} ptr (BTQ x y) mem) for { off := v.AuxInt @@ -42924,7 +42888,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { } x := v_1_1.Args[1] v_1_1_0 := v_1_1.Args[0] - if v_1_1_0.Op != OpAMD64MOVQconst || v_1_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_1_0.Op != OpAMD64MOVQconst || v_1_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETAEstore) @@ -42939,7 +42903,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTLconst [c] x) mem) - // cond: isUint32PowerOfTwo(c) && !config.nacl + // cond: isUint32PowerOfTwo(c) // result: (SETAEstore [off] {sym} ptr (BTLconst [log2uint32(c)] x) mem) for { off := v.AuxInt @@ -42952,7 +42916,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { } c := v_1.AuxInt x := v_1.Args[0] - if !(isUint32PowerOfTwo(c) && !config.nacl) { + if !(isUint32PowerOfTwo(c)) { break } v.reset(OpAMD64SETAEstore) @@ -42967,7 +42931,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQconst [c] x) mem) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETAEstore [off] {sym} ptr (BTQconst [log2(c)] x) mem) for { off := v.AuxInt @@ -42980,7 +42944,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { } c := v_1.AuxInt x := v_1.Args[0] - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETAEstore) @@ -42995,7 +42959,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ (MOVQconst [c]) x) mem) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETAEstore [off] {sym} ptr (BTQconst [log2(c)] x) mem) for { off := v.AuxInt @@ -43012,7 +42976,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { break } c := v_1_0.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETAEstore) @@ -43027,7 +42991,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ x (MOVQconst [c])) mem) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETAEstore [off] {sym} ptr (BTQconst [log2(c)] x) mem) for { off := v.AuxInt @@ -43045,7 +43009,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { break } c := v_1_1.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETAEstore) @@ -43115,9 +43079,8 @@ func rewriteValueAMD64_OpAMD64SETEQstore_0(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETEQstore [off] {sym} ptr (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -43138,7 +43101,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43153,7 +43116,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ z2 z1:(SHLQconst [63] (SHRQconst [63] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -43175,7 +43138,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43190,7 +43153,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTL z1:(SHLLconst [31] (SHRLconst [31] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -43211,7 +43174,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43226,7 +43189,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTL z2 z1:(SHLLconst [31] (SHRLconst [31] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -43248,7 +43211,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43263,7 +43226,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTQconst [0] x) mem) for { off := v.AuxInt @@ -43284,7 +43247,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43299,7 +43262,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ z2 z1:(SHRQconst [63] (SHLQconst [63] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTQconst [0] x) mem) for { off := v.AuxInt @@ -43321,7 +43284,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43336,7 +43299,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTLconst [0] x) mem) for { off := v.AuxInt @@ -43357,7 +43320,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43372,7 +43335,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTL z2 z1:(SHRLconst [31] (SHLLconst [31] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTLconst [0] x) mem) for { off := v.AuxInt @@ -43394,7 +43357,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43409,7 +43372,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ z1:(SHRQconst [63] x) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -43426,7 +43389,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43441,7 +43404,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTQ z2 z1:(SHRQconst [63] x)) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -43459,7 +43422,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43477,10 +43440,9 @@ func rewriteValueAMD64_OpAMD64SETEQstore_10(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETEQstore_20(v *Value) bool { b := v.Block - config := b.Func.Config typ := &b.Func.Config.Types // match: (SETEQstore [off] {sym} ptr (TESTL z1:(SHRLconst [31] x) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -43497,7 +43459,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -43512,7 +43474,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_20(v *Value) bool { return true } // match: (SETEQstore [off] {sym} ptr (TESTL z2 z1:(SHRLconst [31] x)) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETAEstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -43530,7 +43492,7 @@ func rewriteValueAMD64_OpAMD64SETEQstore_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETAEstore) @@ -44728,9 +44690,7 @@ func rewriteValueAMD64_OpAMD64SETLstore_0(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETNE (TESTL (SHLL (MOVLconst [1]) x) y)) - // cond: !config.nacl // result: (SETB (BTL x y)) for { v_0 := v.Args[0] @@ -44744,7 +44704,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETB) @@ -44755,7 +44715,6 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { return true } // match: (SETNE (TESTL y (SHLL (MOVLconst [1]) x))) - // cond: !config.nacl // result: (SETB (BTL x y)) for { v_0 := v.Args[0] @@ -44770,7 +44729,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETB) @@ -44781,7 +44740,6 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { return true } // match: (SETNE (TESTQ (SHLQ (MOVQconst [1]) x) y)) - // cond: !config.nacl // result: (SETB (BTQ x y)) for { v_0 := v.Args[0] @@ -44795,7 +44753,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETB) @@ -44806,7 +44764,6 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { return true } // match: (SETNE (TESTQ y (SHLQ (MOVQconst [1]) x))) - // cond: !config.nacl // result: (SETB (BTQ x y)) for { v_0 := v.Args[0] @@ -44821,7 +44778,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETB) @@ -44832,7 +44789,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { return true } // match: (SETNE (TESTLconst [c] x)) - // cond: isUint32PowerOfTwo(c) && !config.nacl + // cond: isUint32PowerOfTwo(c) // result: (SETB (BTLconst [log2uint32(c)] x)) for { v_0 := v.Args[0] @@ -44841,7 +44798,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { } c := v_0.AuxInt x := v_0.Args[0] - if !(isUint32PowerOfTwo(c) && !config.nacl) { + if !(isUint32PowerOfTwo(c)) { break } v.reset(OpAMD64SETB) @@ -44852,7 +44809,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { return true } // match: (SETNE (TESTQconst [c] x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETB (BTQconst [log2(c)] x)) for { v_0 := v.Args[0] @@ -44861,7 +44818,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { } c := v_0.AuxInt x := v_0.Args[0] - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETB) @@ -44872,7 +44829,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { return true } // match: (SETNE (TESTQ (MOVQconst [c]) x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETB (BTQconst [log2(c)] x)) for { v_0 := v.Args[0] @@ -44885,7 +44842,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { break } c := v_0_0.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETB) @@ -44896,7 +44853,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { return true } // match: (SETNE (TESTQ x (MOVQconst [c]))) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETB (BTQconst [log2(c)] x)) for { v_0 := v.Args[0] @@ -44910,7 +44867,7 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { break } c := v_0_1.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETB) @@ -44960,9 +44917,8 @@ func rewriteValueAMD64_OpAMD64SETNE_0(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETNE (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -44979,7 +44935,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -44990,7 +44946,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTQ z2 z1:(SHLQconst [63] (SHRQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -45008,7 +44964,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45019,7 +44975,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTL z1:(SHLLconst [31] (SHRQconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [31] x)) for { v_0 := v.Args[0] @@ -45036,7 +44992,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45047,7 +45003,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTL z2 z1:(SHLLconst [31] (SHRQconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [31] x)) for { v_0 := v.Args[0] @@ -45065,7 +45021,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45076,7 +45032,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [0] x)) for { v_0 := v.Args[0] @@ -45093,7 +45049,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45104,7 +45060,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTQ z2 z1:(SHRQconst [63] (SHLQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [0] x)) for { v_0 := v.Args[0] @@ -45122,7 +45078,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45133,7 +45089,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTLconst [0] x)) for { v_0 := v.Args[0] @@ -45150,7 +45106,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45161,7 +45117,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTL z2 z1:(SHRLconst [31] (SHLLconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTLconst [0] x)) for { v_0 := v.Args[0] @@ -45179,7 +45135,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45190,7 +45146,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTQ z1:(SHRQconst [63] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -45203,7 +45159,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45214,7 +45170,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { return true } // match: (SETNE (TESTQ z2 z1:(SHRQconst [63] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTQconst [63] x)) for { v_0 := v.Args[0] @@ -45228,7 +45184,7 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45242,9 +45198,8 @@ func rewriteValueAMD64_OpAMD64SETNE_10(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETNE_20(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETNE (TESTL z1:(SHRLconst [31] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTLconst [31] x)) for { v_0 := v.Args[0] @@ -45257,7 +45212,7 @@ func rewriteValueAMD64_OpAMD64SETNE_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45268,7 +45223,7 @@ func rewriteValueAMD64_OpAMD64SETNE_20(v *Value) bool { return true } // match: (SETNE (TESTL z2 z1:(SHRLconst [31] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETB (BTLconst [31] x)) for { v_0 := v.Args[0] @@ -45282,7 +45237,7 @@ func rewriteValueAMD64_OpAMD64SETNE_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETB) @@ -45363,9 +45318,7 @@ func rewriteValueAMD64_OpAMD64SETNE_20(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETNEstore [off] {sym} ptr (TESTL (SHLL (MOVLconst [1]) x) y) mem) - // cond: !config.nacl // result: (SETBstore [off] {sym} ptr (BTL x y) mem) for { off := v.AuxInt @@ -45383,7 +45336,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { } x := v_1_0.Args[1] v_1_0_0 := v_1_0.Args[0] - if v_1_0_0.Op != OpAMD64MOVLconst || v_1_0_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0_0.Op != OpAMD64MOVLconst || v_1_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETBstore) @@ -45398,7 +45351,6 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTL y (SHLL (MOVLconst [1]) x)) mem) - // cond: !config.nacl // result: (SETBstore [off] {sym} ptr (BTL x y) mem) for { off := v.AuxInt @@ -45417,7 +45369,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { } x := v_1_1.Args[1] v_1_1_0 := v_1_1.Args[0] - if v_1_1_0.Op != OpAMD64MOVLconst || v_1_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_1_0.Op != OpAMD64MOVLconst || v_1_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETBstore) @@ -45432,7 +45384,6 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ (SHLQ (MOVQconst [1]) x) y) mem) - // cond: !config.nacl // result: (SETBstore [off] {sym} ptr (BTQ x y) mem) for { off := v.AuxInt @@ -45450,7 +45401,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { } x := v_1_0.Args[1] v_1_0_0 := v_1_0.Args[0] - if v_1_0_0.Op != OpAMD64MOVQconst || v_1_0_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0_0.Op != OpAMD64MOVQconst || v_1_0_0.AuxInt != 1 { break } v.reset(OpAMD64SETBstore) @@ -45465,7 +45416,6 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ y (SHLQ (MOVQconst [1]) x)) mem) - // cond: !config.nacl // result: (SETBstore [off] {sym} ptr (BTQ x y) mem) for { off := v.AuxInt @@ -45484,7 +45434,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { } x := v_1_1.Args[1] v_1_1_0 := v_1_1.Args[0] - if v_1_1_0.Op != OpAMD64MOVQconst || v_1_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_1_0.Op != OpAMD64MOVQconst || v_1_1_0.AuxInt != 1 { break } v.reset(OpAMD64SETBstore) @@ -45499,7 +45449,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTLconst [c] x) mem) - // cond: isUint32PowerOfTwo(c) && !config.nacl + // cond: isUint32PowerOfTwo(c) // result: (SETBstore [off] {sym} ptr (BTLconst [log2uint32(c)] x) mem) for { off := v.AuxInt @@ -45512,7 +45462,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { } c := v_1.AuxInt x := v_1.Args[0] - if !(isUint32PowerOfTwo(c) && !config.nacl) { + if !(isUint32PowerOfTwo(c)) { break } v.reset(OpAMD64SETBstore) @@ -45527,7 +45477,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQconst [c] x) mem) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETBstore [off] {sym} ptr (BTQconst [log2(c)] x) mem) for { off := v.AuxInt @@ -45540,7 +45490,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { } c := v_1.AuxInt x := v_1.Args[0] - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETBstore) @@ -45555,7 +45505,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ (MOVQconst [c]) x) mem) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETBstore [off] {sym} ptr (BTQconst [log2(c)] x) mem) for { off := v.AuxInt @@ -45572,7 +45522,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { break } c := v_1_0.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETBstore) @@ -45587,7 +45537,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ x (MOVQconst [c])) mem) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (SETBstore [off] {sym} ptr (BTQconst [log2(c)] x) mem) for { off := v.AuxInt @@ -45605,7 +45555,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { break } c := v_1_1.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } v.reset(OpAMD64SETBstore) @@ -45675,9 +45625,8 @@ func rewriteValueAMD64_OpAMD64SETNEstore_0(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { b := v.Block - config := b.Func.Config // match: (SETNEstore [off] {sym} ptr (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -45698,7 +45647,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45713,7 +45662,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ z2 z1:(SHLQconst [63] (SHRQconst [63] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -45735,7 +45684,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45750,7 +45699,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTL z1:(SHLLconst [31] (SHRLconst [31] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -45771,7 +45720,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45786,7 +45735,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTL z2 z1:(SHLLconst [31] (SHRLconst [31] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -45808,7 +45757,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45823,7 +45772,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTQconst [0] x) mem) for { off := v.AuxInt @@ -45844,7 +45793,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45859,7 +45808,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ z2 z1:(SHRQconst [63] (SHLQconst [63] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTQconst [0] x) mem) for { off := v.AuxInt @@ -45881,7 +45830,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45896,7 +45845,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTLconst [0] x) mem) for { off := v.AuxInt @@ -45917,7 +45866,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45932,7 +45881,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTL z2 z1:(SHRLconst [31] (SHLLconst [31] x))) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTLconst [0] x) mem) for { off := v.AuxInt @@ -45954,7 +45903,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -45969,7 +45918,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ z1:(SHRQconst [63] x) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -45986,7 +45935,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -46001,7 +45950,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTQ z2 z1:(SHRQconst [63] x)) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTQconst [63] x) mem) for { off := v.AuxInt @@ -46019,7 +45968,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -46037,10 +45986,9 @@ func rewriteValueAMD64_OpAMD64SETNEstore_10(v *Value) bool { } func rewriteValueAMD64_OpAMD64SETNEstore_20(v *Value) bool { b := v.Block - config := b.Func.Config typ := &b.Func.Config.Types // match: (SETNEstore [off] {sym} ptr (TESTL z1:(SHRLconst [31] x) z2) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -46057,7 +46005,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -46072,7 +46020,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_20(v *Value) bool { return true } // match: (SETNEstore [off] {sym} ptr (TESTL z2 z1:(SHRLconst [31] x)) mem) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (SETBstore [off] {sym} ptr (BTLconst [31] x) mem) for { off := v.AuxInt @@ -46090,7 +46038,7 @@ func rewriteValueAMD64_OpAMD64SETNEstore_20(v *Value) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } v.reset(OpAMD64SETBstore) @@ -46505,10 +46453,7 @@ func rewriteValueAMD64_OpAMD64SHLL_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64SHLLconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (SHLLconst [1] (SHRLconst [1] x)) - // cond: !config.nacl // result: (BTRLconst [0] x) for { if v.AuxInt != 1 { @@ -46519,9 +46464,6 @@ func rewriteValueAMD64_OpAMD64SHLLconst_0(v *Value) bool { break } x := v_0.Args[0] - if !(!config.nacl) { - break - } v.reset(OpAMD64BTRLconst) v.AuxInt = 0 v.AddArg(x) @@ -46764,10 +46706,7 @@ func rewriteValueAMD64_OpAMD64SHLQ_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64SHLQconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (SHLQconst [1] (SHRQconst [1] x)) - // cond: !config.nacl // result: (BTRQconst [0] x) for { if v.AuxInt != 1 { @@ -46778,9 +46717,6 @@ func rewriteValueAMD64_OpAMD64SHLQconst_0(v *Value) bool { break } x := v_0.Args[0] - if !(!config.nacl) { - break - } v.reset(OpAMD64BTRQconst) v.AuxInt = 0 v.AddArg(x) @@ -47113,10 +47049,7 @@ func rewriteValueAMD64_OpAMD64SHRL_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64SHRLconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (SHRLconst [1] (SHLLconst [1] x)) - // cond: !config.nacl // result: (BTRLconst [31] x) for { if v.AuxInt != 1 { @@ -47127,9 +47060,6 @@ func rewriteValueAMD64_OpAMD64SHRLconst_0(v *Value) bool { break } x := v_0.Args[0] - if !(!config.nacl) { - break - } v.reset(OpAMD64BTRLconst) v.AuxInt = 31 v.AddArg(x) @@ -47372,10 +47302,7 @@ func rewriteValueAMD64_OpAMD64SHRQ_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64SHRQconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (SHRQconst [1] (SHLQconst [1] x)) - // cond: !config.nacl // result: (BTRQconst [63] x) for { if v.AuxInt != 1 { @@ -47386,9 +47313,6 @@ func rewriteValueAMD64_OpAMD64SHRQconst_0(v *Value) bool { break } x := v_0.Args[0] - if !(!config.nacl) { - break - } v.reset(OpAMD64BTRQconst) v.AuxInt = 63 v.AddArg(x) @@ -48834,10 +48758,7 @@ func rewriteValueAMD64_OpAMD64XCHGQ_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (XORL (SHLL (MOVLconst [1]) y) x) - // cond: !config.nacl // result: (BTCL x y) for { x := v.Args[1] @@ -48847,7 +48768,7 @@ func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { } y := v_0.Args[1] v_0_0 := v_0.Args[0] - if v_0_0.Op != OpAMD64MOVLconst || v_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0.Op != OpAMD64MOVLconst || v_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTCL) @@ -48856,7 +48777,6 @@ func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { return true } // match: (XORL x (SHLL (MOVLconst [1]) y)) - // cond: !config.nacl // result: (BTCL x y) for { _ = v.Args[1] @@ -48867,7 +48787,7 @@ func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { } y := v_1.Args[1] v_1_0 := v_1.Args[0] - if v_1_0.Op != OpAMD64MOVLconst || v_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0.Op != OpAMD64MOVLconst || v_1_0.AuxInt != 1 { break } v.reset(OpAMD64BTCL) @@ -48876,7 +48796,7 @@ func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { return true } // match: (XORL (MOVLconst [c]) x) - // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 // result: (BTCLconst [log2uint32(c)] x) for { x := v.Args[1] @@ -48885,7 +48805,7 @@ func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { break } c := v_0.AuxInt - if !(isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTCLconst) @@ -48894,7 +48814,7 @@ func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { return true } // match: (XORL x (MOVLconst [c])) - // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 // result: (BTCLconst [log2uint32(c)] x) for { _ = v.Args[1] @@ -48904,7 +48824,7 @@ func rewriteValueAMD64_OpAMD64XORL_0(v *Value) bool { break } c := v_1.AuxInt - if !(isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTCLconst) @@ -49155,15 +49075,13 @@ func rewriteValueAMD64_OpAMD64XORL_10(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64XORLconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (XORLconst [c] x) - // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint32PowerOfTwo(c) && uint64(c) >= 128 // result: (BTCLconst [log2uint32(c)] x) for { c := v.AuxInt x := v.Args[0] - if !(isUint32PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint32PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTCLconst) @@ -49568,10 +49486,7 @@ func rewriteValueAMD64_OpAMD64XORLmodify_0(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (XORQ (SHLQ (MOVQconst [1]) y) x) - // cond: !config.nacl // result: (BTCQ x y) for { x := v.Args[1] @@ -49581,7 +49496,7 @@ func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { } y := v_0.Args[1] v_0_0 := v_0.Args[0] - if v_0_0.Op != OpAMD64MOVQconst || v_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0.Op != OpAMD64MOVQconst || v_0_0.AuxInt != 1 { break } v.reset(OpAMD64BTCQ) @@ -49590,7 +49505,6 @@ func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { return true } // match: (XORQ x (SHLQ (MOVQconst [1]) y)) - // cond: !config.nacl // result: (BTCQ x y) for { _ = v.Args[1] @@ -49601,7 +49515,7 @@ func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { } y := v_1.Args[1] v_1_0 := v_1.Args[0] - if v_1_0.Op != OpAMD64MOVQconst || v_1_0.AuxInt != 1 || !(!config.nacl) { + if v_1_0.Op != OpAMD64MOVQconst || v_1_0.AuxInt != 1 { break } v.reset(OpAMD64BTCQ) @@ -49610,7 +49524,7 @@ func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { return true } // match: (XORQ (MOVQconst [c]) x) - // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 // result: (BTCQconst [log2(c)] x) for { x := v.Args[1] @@ -49619,7 +49533,7 @@ func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { break } c := v_0.AuxInt - if !(isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTCQconst) @@ -49628,7 +49542,7 @@ func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { return true } // match: (XORQ x (MOVQconst [c])) - // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 // result: (BTCQconst [log2(c)] x) for { _ = v.Args[1] @@ -49638,7 +49552,7 @@ func rewriteValueAMD64_OpAMD64XORQ_0(v *Value) bool { break } c := v_1.AuxInt - if !(isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTCQconst) @@ -49797,15 +49711,13 @@ func rewriteValueAMD64_OpAMD64XORQ_10(v *Value) bool { return false } func rewriteValueAMD64_OpAMD64XORQconst_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (XORQconst [c] x) - // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl + // cond: isUint64PowerOfTwo(c) && uint64(c) >= 128 // result: (BTCQconst [log2(c)] x) for { c := v.AuxInt x := v.Args[0] - if !(isUint64PowerOfTwo(c) && uint64(c) >= 128 && !config.nacl) { + if !(isUint64PowerOfTwo(c) && uint64(c) >= 128) { break } v.reset(OpAMD64BTCQconst) @@ -58099,11 +58011,9 @@ func rewriteValueAMD64_OpZeroExt8to64_0(v *Value) bool { } } func rewriteBlockAMD64(b *Block) bool { - config := b.Func.Config switch b.Kind { case BlockAMD64EQ: // match: (EQ (TESTL (SHLL (MOVLconst [1]) x) y)) - // cond: !config.nacl // result: (UGE (BTL x y)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58114,20 +58024,17 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTL, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTL y (SHLL (MOVLconst [1]) x))) - // cond: !config.nacl // result: (UGE (BTL x y)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58139,20 +58046,17 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTL, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ (SHLQ (MOVQconst [1]) x) y)) - // cond: !config.nacl // result: (UGE (BTQ x y)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58163,20 +58067,17 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ y (SHLQ (MOVQconst [1]) x))) - // cond: !config.nacl // result: (UGE (BTQ x y)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58188,58 +58089,52 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTLconst [c] x)) - // cond: isUint32PowerOfTwo(c) && !config.nacl + // cond: isUint32PowerOfTwo(c) // result: (UGE (BTLconst [log2uint32(c)] x)) for b.Controls[0].Op == OpAMD64TESTLconst { v_0 := b.Controls[0] c := v_0.AuxInt x := v_0.Args[0] - if !(isUint32PowerOfTwo(c) && !config.nacl) { + if !(isUint32PowerOfTwo(c)) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = log2uint32(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQconst [c] x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (UGE (BTQconst [log2(c)] x)) for b.Controls[0].Op == OpAMD64TESTQconst { v_0 := b.Controls[0] c := v_0.AuxInt x := v_0.Args[0] - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = log2(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ (MOVQconst [c]) x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (UGE (BTQconst [log2(c)] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58249,20 +58144,18 @@ func rewriteBlockAMD64(b *Block) bool { break } c := v_0_0.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = log2(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ x (MOVQconst [c]))) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (UGE (BTQconst [log2(c)] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58273,20 +58166,18 @@ func rewriteBlockAMD64(b *Block) bool { break } c := v_0_1.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = log2(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58300,20 +58191,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ z2 z1:(SHLQconst [63] (SHRQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58328,20 +58217,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTL z1:(SHLLconst [31] (SHRQconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58355,20 +58242,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTL z2 z1:(SHLLconst [31] (SHRQconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58383,20 +58268,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [0] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58410,20 +58293,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ z2 z1:(SHRQconst [63] (SHLQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [0] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58438,20 +58319,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTLconst [0] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58465,20 +58344,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTL z2 z1:(SHRLconst [31] (SHLLconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTLconst [0] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58493,20 +58370,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ z1:(SHRQconst [63] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58516,20 +58391,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTQ z2 z1:(SHRQconst [63] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -58540,20 +58413,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTL z1:(SHRLconst [31] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTLconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58563,20 +58434,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TESTL z2 z1:(SHRLconst [31] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (UGE (BTLconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -58587,16 +58456,14 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (InvertFlags cmp) yes no) @@ -58604,53 +58471,41 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64EQ - b.ResetControls() + b.Reset(BlockAMD64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (EQ (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -58660,52 +58515,40 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64LE - b.ResetControls() + b.Reset(BlockAMD64LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (GE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockAMD64GT: @@ -58714,53 +58557,41 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64LT - b.ResetControls() + b.Reset(BlockAMD64LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (GT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockIf: @@ -58769,10 +58600,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETL { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64LT - b.ResetControls() + b.Reset(BlockAMD64LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETLE cmp) yes no) @@ -58780,10 +58609,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETLE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64LE - b.ResetControls() + b.Reset(BlockAMD64LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETG cmp) yes no) @@ -58791,10 +58618,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETG { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64GT - b.ResetControls() + b.Reset(BlockAMD64GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETGE cmp) yes no) @@ -58802,10 +58627,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETGE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64GE - b.ResetControls() + b.Reset(BlockAMD64GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETEQ cmp) yes no) @@ -58813,10 +58636,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETEQ { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64EQ - b.ResetControls() + b.Reset(BlockAMD64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETNE cmp) yes no) @@ -58824,10 +58645,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETNE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64NE - b.ResetControls() + b.Reset(BlockAMD64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETB cmp) yes no) @@ -58835,10 +58654,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETB { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETBE cmp) yes no) @@ -58846,10 +58663,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETBE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64ULE - b.ResetControls() + b.Reset(BlockAMD64ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETA cmp) yes no) @@ -58857,10 +58672,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETA { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64UGT - b.ResetControls() + b.Reset(BlockAMD64UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETAE cmp) yes no) @@ -58868,10 +58681,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETAE { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETO cmp) yes no) @@ -58879,10 +58690,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETO { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64OS - b.ResetControls() + b.Reset(BlockAMD64OS) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETGF cmp) yes no) @@ -58890,10 +58699,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETGF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64UGT - b.ResetControls() + b.Reset(BlockAMD64UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETGEF cmp) yes no) @@ -58901,10 +58708,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETGEF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETEQF cmp) yes no) @@ -58912,10 +58717,8 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETEQF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64EQF - b.ResetControls() + b.Reset(BlockAMD64EQF) b.AddControl(cmp) - b.Aux = nil return true } // match: (If (SETNEF cmp) yes no) @@ -58923,23 +58726,19 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64SETNEF { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64NEF - b.ResetControls() + b.Reset(BlockAMD64NEF) b.AddControl(cmp) - b.Aux = nil return true } // match: (If cond yes no) // result: (NE (TESTB cond cond) yes no) for { cond := b.Controls[0] - b.Kind = BlockAMD64NE - b.ResetControls() + b.Reset(BlockAMD64NE) v0 := b.NewValue0(cond.Pos, OpAMD64TESTB, types.TypeFlags) v0.AddArg(cond) v0.AddArg(cond) b.AddControl(v0) - b.Aux = nil return true } case BlockAMD64LE: @@ -58948,51 +58747,39 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64GE - b.ResetControls() + b.Reset(BlockAMD64GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (LE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -59002,52 +58789,40 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64GT - b.ResetControls() + b.Reset(BlockAMD64GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (LT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -59066,10 +58841,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETL || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64LT - b.ResetControls() + b.Reset(BlockAMD64LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETL cmp) (SETL cmp)) yes no) @@ -59086,10 +58859,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETL || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64LT - b.ResetControls() + b.Reset(BlockAMD64LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no) @@ -59106,10 +58877,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETLE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64LE - b.ResetControls() + b.Reset(BlockAMD64LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no) @@ -59126,10 +58895,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETLE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64LE - b.ResetControls() + b.Reset(BlockAMD64LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETG cmp) (SETG cmp)) yes no) @@ -59146,10 +58913,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETG || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64GT - b.ResetControls() + b.Reset(BlockAMD64GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETG cmp) (SETG cmp)) yes no) @@ -59166,10 +58931,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETG || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64GT - b.ResetControls() + b.Reset(BlockAMD64GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no) @@ -59186,10 +58949,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETGE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64GE - b.ResetControls() + b.Reset(BlockAMD64GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no) @@ -59206,10 +58967,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETGE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64GE - b.ResetControls() + b.Reset(BlockAMD64GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no) @@ -59226,10 +58985,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETEQ || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64EQ - b.ResetControls() + b.Reset(BlockAMD64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no) @@ -59246,10 +59003,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETEQ || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64EQ - b.ResetControls() + b.Reset(BlockAMD64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no) @@ -59266,10 +59021,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETNE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64NE - b.ResetControls() + b.Reset(BlockAMD64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no) @@ -59286,10 +59039,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETNE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64NE - b.ResetControls() + b.Reset(BlockAMD64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETB cmp) (SETB cmp)) yes no) @@ -59306,10 +59057,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETB || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETB cmp) (SETB cmp)) yes no) @@ -59326,10 +59075,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETB || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no) @@ -59346,10 +59093,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETBE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64ULE - b.ResetControls() + b.Reset(BlockAMD64ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no) @@ -59366,10 +59111,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETBE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64ULE - b.ResetControls() + b.Reset(BlockAMD64ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETA cmp) (SETA cmp)) yes no) @@ -59386,10 +59129,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETA || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGT - b.ResetControls() + b.Reset(BlockAMD64UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETA cmp) (SETA cmp)) yes no) @@ -59406,10 +59147,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETA || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGT - b.ResetControls() + b.Reset(BlockAMD64UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no) @@ -59426,10 +59165,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETAE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no) @@ -59446,10 +59183,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETAE || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETO cmp) (SETO cmp)) yes no) @@ -59466,10 +59201,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETO || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64OS - b.ResetControls() + b.Reset(BlockAMD64OS) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETO cmp) (SETO cmp)) yes no) @@ -59486,14 +59219,11 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETO || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64OS - b.ResetControls() + b.Reset(BlockAMD64OS) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTL (SHLL (MOVLconst [1]) x) y)) - // cond: !config.nacl // result: (ULT (BTL x y)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59504,20 +59234,17 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVLconst || v_0_0_0.AuxInt != 1 { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTL, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTL y (SHLL (MOVLconst [1]) x))) - // cond: !config.nacl // result: (ULT (BTL x y)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59529,20 +59256,17 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVLconst || v_0_1_0.AuxInt != 1 { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTL, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ (SHLQ (MOVQconst [1]) x) y)) - // cond: !config.nacl // result: (ULT (BTQ x y)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59553,20 +59277,17 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_0.Args[1] v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 || !(!config.nacl) { + if v_0_0_0.Op != OpAMD64MOVQconst || v_0_0_0.AuxInt != 1 { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ y (SHLQ (MOVQconst [1]) x))) - // cond: !config.nacl // result: (ULT (BTQ x y)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59578,58 +59299,52 @@ func rewriteBlockAMD64(b *Block) bool { } x := v_0_1.Args[1] v_0_1_0 := v_0_1.Args[0] - if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 || !(!config.nacl) { + if v_0_1_0.Op != OpAMD64MOVQconst || v_0_1_0.AuxInt != 1 { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTLconst [c] x)) - // cond: isUint32PowerOfTwo(c) && !config.nacl + // cond: isUint32PowerOfTwo(c) // result: (ULT (BTLconst [log2uint32(c)] x)) for b.Controls[0].Op == OpAMD64TESTLconst { v_0 := b.Controls[0] c := v_0.AuxInt x := v_0.Args[0] - if !(isUint32PowerOfTwo(c) && !config.nacl) { + if !(isUint32PowerOfTwo(c)) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = log2uint32(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQconst [c] x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (ULT (BTQconst [log2(c)] x)) for b.Controls[0].Op == OpAMD64TESTQconst { v_0 := b.Controls[0] c := v_0.AuxInt x := v_0.Args[0] - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = log2(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ (MOVQconst [c]) x)) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (ULT (BTQconst [log2(c)] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59639,20 +59354,18 @@ func rewriteBlockAMD64(b *Block) bool { break } c := v_0_0.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = log2(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ x (MOVQconst [c]))) - // cond: isUint64PowerOfTwo(c) && !config.nacl + // cond: isUint64PowerOfTwo(c) // result: (ULT (BTQconst [log2(c)] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59663,20 +59376,18 @@ func rewriteBlockAMD64(b *Block) bool { break } c := v_0_1.AuxInt - if !(isUint64PowerOfTwo(c) && !config.nacl) { + if !(isUint64PowerOfTwo(c)) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = log2(c) v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ z1:(SHLQconst [63] (SHRQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59690,20 +59401,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ z2 z1:(SHLQconst [63] (SHRQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59718,20 +59427,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTL z1:(SHLLconst [31] (SHRQconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59745,20 +59452,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTL z2 z1:(SHLLconst [31] (SHRQconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59773,20 +59478,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ z1:(SHRQconst [63] (SHLQconst [63] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [0] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59800,20 +59503,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ z2 z1:(SHRQconst [63] (SHLQconst [63] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [0] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59828,20 +59529,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTL z1:(SHRLconst [31] (SHLLconst [31] x)) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTLconst [0] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59855,20 +59554,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTL z2 z1:(SHRLconst [31] (SHLLconst [31] x)))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTLconst [0] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59883,20 +59580,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1_0.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ z1:(SHRQconst [63] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59906,20 +59601,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTQ z2 z1:(SHRQconst [63] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTQconst [63] x)) for b.Controls[0].Op == OpAMD64TESTQ { v_0 := b.Controls[0] @@ -59930,20 +59623,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTQconst, types.TypeFlags) v0.AuxInt = 63 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTL z1:(SHRLconst [31] x) z2)) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTLconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59953,20 +59644,18 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTL z2 z1:(SHRLconst [31] x))) - // cond: z1==z2 && !config.nacl + // cond: z1==z2 // result: (ULT (BTLconst [31] x)) for b.Controls[0].Op == OpAMD64TESTL { v_0 := b.Controls[0] @@ -59977,16 +59666,14 @@ func rewriteBlockAMD64(b *Block) bool { break } x := z1.Args[0] - if !(z1 == z2 && !config.nacl) { + if !(z1 == z2) { break } - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) v0 := b.NewValue0(v_0.Pos, OpAMD64BTLconst, types.TypeFlags) v0.AuxInt = 31 v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no) @@ -60003,10 +59690,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETGF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGT - b.ResetControls() + b.Reset(BlockAMD64UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no) @@ -60023,10 +59708,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETGF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGT - b.ResetControls() + b.Reset(BlockAMD64UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no) @@ -60043,10 +59726,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETGEF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no) @@ -60063,10 +59744,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETGEF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no) @@ -60083,10 +59762,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETEQF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64EQF - b.ResetControls() + b.Reset(BlockAMD64EQF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no) @@ -60103,10 +59780,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETEQF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64EQF - b.ResetControls() + b.Reset(BlockAMD64EQF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no) @@ -60123,10 +59798,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETNEF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64NEF - b.ResetControls() + b.Reset(BlockAMD64NEF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no) @@ -60143,10 +59816,8 @@ func rewriteBlockAMD64(b *Block) bool { if v_0_1.Op != OpAMD64SETNEF || cmp != v_0_1.Args[0] { break } - b.Kind = BlockAMD64NEF - b.ResetControls() + b.Reset(BlockAMD64NEF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (InvertFlags cmp) yes no) @@ -60154,51 +59825,39 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64NE - b.ResetControls() + b.Reset(BlockAMD64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (NE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockAMD64UGE: @@ -60207,52 +59866,40 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64ULE - b.ResetControls() + b.Reset(BlockAMD64ULE) b.AddControl(cmp) - b.Aux = nil return true } // match: (UGE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockAMD64UGT: @@ -60261,53 +59908,41 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64ULT - b.ResetControls() + b.Reset(BlockAMD64ULT) b.AddControl(cmp) - b.Aux = nil return true } // match: (UGT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockAMD64ULE: @@ -60316,51 +59951,39 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64UGE - b.ResetControls() + b.Reset(BlockAMD64UGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (ULE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -60370,52 +59993,40 @@ func rewriteBlockAMD64(b *Block) bool { for b.Controls[0].Op == OpAMD64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockAMD64UGT - b.ResetControls() + b.Reset(BlockAMD64UGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (ULT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpAMD64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpAMD64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } diff --git a/src/cmd/compile/internal/ssa/rewriteARM.go b/src/cmd/compile/internal/ssa/rewriteARM.go index b51799743bd..ece2fe4fe9c 100644 --- a/src/cmd/compile/internal/ssa/rewriteARM.go +++ b/src/cmd/compile/internal/ssa/rewriteARM.go @@ -6250,8 +6250,6 @@ func rewriteValueARM_OpARMLessThanU_0(v *Value) bool { return false } func rewriteValueARM_OpARMMOVBUload_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (MOVBUload [off1] {sym} (ADDconst [off2] ptr) mem) // result: (MOVBUload [off1+off2] {sym} ptr mem) for { @@ -6339,7 +6337,7 @@ func rewriteValueARM_OpARMMOVBUload_0(v *Value) bool { return true } // match: (MOVBUload [0] {sym} (ADD ptr idx) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVBUloadidx ptr idx mem) for { if v.AuxInt != 0 { @@ -6353,7 +6351,7 @@ func rewriteValueARM_OpARMMOVBUload_0(v *Value) bool { } idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVBUloadidx) @@ -6491,8 +6489,6 @@ func rewriteValueARM_OpARMMOVBUreg_0(v *Value) bool { return false } func rewriteValueARM_OpARMMOVBload_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (MOVBload [off1] {sym} (ADDconst [off2] ptr) mem) // result: (MOVBload [off1+off2] {sym} ptr mem) for { @@ -6580,7 +6576,7 @@ func rewriteValueARM_OpARMMOVBload_0(v *Value) bool { return true } // match: (MOVBload [0] {sym} (ADD ptr idx) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVBloadidx ptr idx mem) for { if v.AuxInt != 0 { @@ -6594,7 +6590,7 @@ func rewriteValueARM_OpARMMOVBload_0(v *Value) bool { } idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVBloadidx) @@ -6721,8 +6717,6 @@ func rewriteValueARM_OpARMMOVBreg_0(v *Value) bool { return false } func rewriteValueARM_OpARMMOVBstore_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem) // result: (MOVBstore [off1+off2] {sym} ptr val mem) for { @@ -6872,7 +6866,7 @@ func rewriteValueARM_OpARMMOVBstore_0(v *Value) bool { return true } // match: (MOVBstore [0] {sym} (ADD ptr idx) val mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVBstoreidx ptr idx val mem) for { if v.AuxInt != 0 { @@ -6887,7 +6881,7 @@ func rewriteValueARM_OpARMMOVBstore_0(v *Value) bool { idx := v_0.Args[1] ptr := v_0.Args[0] val := v.Args[1] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVBstoreidx) @@ -7350,7 +7344,7 @@ func rewriteValueARM_OpARMMOVHUload_0(v *Value) bool { return true } // match: (MOVHUload [0] {sym} (ADD ptr idx) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVHUloadidx ptr idx mem) for { if v.AuxInt != 0 { @@ -7364,7 +7358,7 @@ func rewriteValueARM_OpARMMOVHUload_0(v *Value) bool { } idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVHUloadidx) @@ -7525,8 +7519,6 @@ func rewriteValueARM_OpARMMOVHUreg_0(v *Value) bool { return false } func rewriteValueARM_OpARMMOVHload_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (MOVHload [off1] {sym} (ADDconst [off2] ptr) mem) // result: (MOVHload [off1+off2] {sym} ptr mem) for { @@ -7614,7 +7606,7 @@ func rewriteValueARM_OpARMMOVHload_0(v *Value) bool { return true } // match: (MOVHload [0] {sym} (ADD ptr idx) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVHloadidx ptr idx mem) for { if v.AuxInt != 0 { @@ -7628,7 +7620,7 @@ func rewriteValueARM_OpARMMOVHload_0(v *Value) bool { } idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVHloadidx) @@ -7801,8 +7793,6 @@ func rewriteValueARM_OpARMMOVHreg_0(v *Value) bool { return false } func rewriteValueARM_OpARMMOVHstore_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (MOVHstore [off1] {sym} (ADDconst [off2] ptr) val mem) // result: (MOVHstore [off1+off2] {sym} ptr val mem) for { @@ -7912,7 +7902,7 @@ func rewriteValueARM_OpARMMOVHstore_0(v *Value) bool { return true } // match: (MOVHstore [0] {sym} (ADD ptr idx) val mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVHstoreidx ptr idx val mem) for { if v.AuxInt != 0 { @@ -7927,7 +7917,7 @@ func rewriteValueARM_OpARMMOVHstore_0(v *Value) bool { idx := v_0.Args[1] ptr := v_0.Args[0] val := v.Args[1] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVHstoreidx) @@ -8069,7 +8059,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { return true } // match: (MOVWload [0] {sym} (ADD ptr idx) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWloadidx ptr idx mem) for { if v.AuxInt != 0 { @@ -8083,7 +8073,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { } idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWloadidx) @@ -8093,7 +8083,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { return true } // match: (MOVWload [0] {sym} (ADDshiftLL ptr idx [c]) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWloadshiftLL ptr idx [c] mem) for { if v.AuxInt != 0 { @@ -8108,7 +8098,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { c := v_0.AuxInt idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWloadshiftLL) @@ -8119,7 +8109,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { return true } // match: (MOVWload [0] {sym} (ADDshiftRL ptr idx [c]) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWloadshiftRL ptr idx [c] mem) for { if v.AuxInt != 0 { @@ -8134,7 +8124,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { c := v_0.AuxInt idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWloadshiftRL) @@ -8145,7 +8135,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { return true } // match: (MOVWload [0] {sym} (ADDshiftRA ptr idx [c]) mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWloadshiftRA ptr idx [c] mem) for { if v.AuxInt != 0 { @@ -8160,7 +8150,7 @@ func rewriteValueARM_OpARMMOVWload_0(v *Value) bool { c := v_0.AuxInt idx := v_0.Args[1] ptr := v_0.Args[0] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWloadshiftRA) @@ -8524,8 +8514,6 @@ func rewriteValueARM_OpARMMOVWreg_0(v *Value) bool { return false } func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { - b := v.Block - config := b.Func.Config // match: (MOVWstore [off1] {sym} (ADDconst [off2] ptr) val mem) // result: (MOVWstore [off1+off2] {sym} ptr val mem) for { @@ -8595,7 +8583,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { return true } // match: (MOVWstore [0] {sym} (ADD ptr idx) val mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWstoreidx ptr idx val mem) for { if v.AuxInt != 0 { @@ -8610,7 +8598,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { idx := v_0.Args[1] ptr := v_0.Args[0] val := v.Args[1] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWstoreidx) @@ -8621,7 +8609,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { return true } // match: (MOVWstore [0] {sym} (ADDshiftLL ptr idx [c]) val mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWstoreshiftLL ptr idx [c] val mem) for { if v.AuxInt != 0 { @@ -8637,7 +8625,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { idx := v_0.Args[1] ptr := v_0.Args[0] val := v.Args[1] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWstoreshiftLL) @@ -8649,7 +8637,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { return true } // match: (MOVWstore [0] {sym} (ADDshiftRL ptr idx [c]) val mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWstoreshiftRL ptr idx [c] val mem) for { if v.AuxInt != 0 { @@ -8665,7 +8653,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { idx := v_0.Args[1] ptr := v_0.Args[0] val := v.Args[1] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWstoreshiftRL) @@ -8677,7 +8665,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { return true } // match: (MOVWstore [0] {sym} (ADDshiftRA ptr idx [c]) val mem) - // cond: sym == nil && !config.nacl + // cond: sym == nil // result: (MOVWstoreshiftRA ptr idx [c] val mem) for { if v.AuxInt != 0 { @@ -8693,7 +8681,7 @@ func rewriteValueARM_OpARMMOVWstore_0(v *Value) bool { idx := v_0.Args[1] ptr := v_0.Args[0] val := v.Args[1] - if !(sym == nil && !config.nacl) { + if !(sym == nil) { break } v.reset(OpARMMOVWstoreshiftRA) @@ -20659,44 +20647,34 @@ func rewriteBlockARM(b *Block) bool { // match: (EQ (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (EQ (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -20705,10 +20683,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUB x y)) yes no) @@ -20728,13 +20704,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(MULS x y a)) yes no) @@ -20755,8 +20729,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -20764,7 +20737,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUBconst [c] x)) yes no) @@ -20784,13 +20756,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMPconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUBshiftLL x y [c])) yes no) @@ -20811,14 +20781,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUBshiftRL x y [c])) yes no) @@ -20839,14 +20807,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUBshiftRA x y [c])) yes no) @@ -20867,14 +20833,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUBshiftLLreg x y z)) yes no) @@ -20895,14 +20859,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUBshiftRLreg x y z)) yes no) @@ -20923,14 +20885,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(SUBshiftRAreg x y z)) yes no) @@ -20951,14 +20911,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADD x y)) yes no) @@ -20978,13 +20936,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(MULA x y a)) yes no) @@ -21005,8 +20961,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -21014,7 +20969,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADDconst [c] x)) yes no) @@ -21034,13 +20988,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADDshiftLL x y [c])) yes no) @@ -21061,14 +21013,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADDshiftRL x y [c])) yes no) @@ -21089,14 +21039,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADDshiftRA x y [c])) yes no) @@ -21117,14 +21065,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADDshiftLLreg x y z)) yes no) @@ -21145,14 +21091,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADDshiftRLreg x y z)) yes no) @@ -21173,14 +21117,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ADDshiftRAreg x y z)) yes no) @@ -21201,14 +21143,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(AND x y)) yes no) @@ -21228,13 +21168,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ANDconst [c] x)) yes no) @@ -21254,13 +21192,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ANDshiftLL x y [c])) yes no) @@ -21281,14 +21217,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ANDshiftRL x y [c])) yes no) @@ -21309,14 +21243,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ANDshiftRA x y [c])) yes no) @@ -21337,14 +21269,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ANDshiftLLreg x y z)) yes no) @@ -21365,14 +21295,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ANDshiftRLreg x y z)) yes no) @@ -21393,14 +21321,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(ANDshiftRAreg x y z)) yes no) @@ -21421,14 +21347,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XOR x y)) yes no) @@ -21448,13 +21372,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XORconst [c] x)) yes no) @@ -21474,13 +21396,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XORshiftLL x y [c])) yes no) @@ -21501,14 +21421,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XORshiftRL x y [c])) yes no) @@ -21529,14 +21447,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XORshiftRA x y [c])) yes no) @@ -21557,14 +21473,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XORshiftLLreg x y z)) yes no) @@ -21585,14 +21499,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XORshiftRLreg x y z)) yes no) @@ -21613,14 +21525,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] l:(XORshiftRAreg x y z)) yes no) @@ -21641,57 +21551,45 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } case BlockARMGE: // match: (GE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (InvertFlags cmp) yes no) @@ -21699,10 +21597,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) b.AddControl(cmp) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUB x y)) yes no) @@ -21722,13 +21618,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(MULS x y a)) yes no) @@ -21749,8 +21643,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -21758,7 +21651,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUBconst [c] x)) yes no) @@ -21778,13 +21670,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMPconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUBshiftLL x y [c])) yes no) @@ -21805,14 +21695,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUBshiftRL x y [c])) yes no) @@ -21833,14 +21721,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUBshiftRA x y [c])) yes no) @@ -21861,14 +21747,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUBshiftLLreg x y z)) yes no) @@ -21889,14 +21773,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUBshiftRLreg x y z)) yes no) @@ -21917,14 +21799,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(SUBshiftRAreg x y z)) yes no) @@ -21945,14 +21825,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADD x y)) yes no) @@ -21972,13 +21850,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(MULA x y a)) yes no) @@ -21999,8 +21875,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -22008,7 +21883,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADDconst [c] x)) yes no) @@ -22028,13 +21902,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADDshiftLL x y [c])) yes no) @@ -22055,14 +21927,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADDshiftRL x y [c])) yes no) @@ -22083,14 +21953,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADDshiftRA x y [c])) yes no) @@ -22111,14 +21979,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADDshiftLLreg x y z)) yes no) @@ -22139,14 +22005,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADDshiftRLreg x y z)) yes no) @@ -22167,14 +22031,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ADDshiftRAreg x y z)) yes no) @@ -22195,14 +22057,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(AND x y)) yes no) @@ -22222,13 +22082,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ANDconst [c] x)) yes no) @@ -22248,13 +22106,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ANDshiftLL x y [c])) yes no) @@ -22275,14 +22131,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ANDshiftRL x y [c])) yes no) @@ -22303,14 +22157,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ANDshiftRA x y [c])) yes no) @@ -22331,14 +22183,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ANDshiftLLreg x y z)) yes no) @@ -22359,14 +22209,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ANDshiftRLreg x y z)) yes no) @@ -22387,14 +22235,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(ANDshiftRAreg x y z)) yes no) @@ -22415,14 +22261,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XOR x y)) yes no) @@ -22442,13 +22286,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XORconst [c] x)) yes no) @@ -22468,13 +22310,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XORshiftLL x y [c])) yes no) @@ -22495,14 +22335,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XORshiftRL x y [c])) yes no) @@ -22523,14 +22361,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XORshiftRA x y [c])) yes no) @@ -22551,14 +22387,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XORshiftLLreg x y z)) yes no) @@ -22579,14 +22413,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XORshiftRLreg x y z)) yes no) @@ -22607,14 +22439,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] l:(XORshiftRAreg x y z)) yes no) @@ -22635,58 +22465,46 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } case BlockARMGT: // match: (GT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GT (InvertFlags cmp) yes no) @@ -22694,10 +22512,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) b.AddControl(cmp) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUB x y)) yes no) @@ -22717,13 +22533,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(MULS x y a)) yes no) @@ -22744,8 +22558,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -22753,7 +22566,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUBconst [c] x)) yes no) @@ -22773,13 +22585,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMPconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUBshiftLL x y [c])) yes no) @@ -22800,14 +22610,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUBshiftRL x y [c])) yes no) @@ -22828,14 +22636,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUBshiftRA x y [c])) yes no) @@ -22856,14 +22662,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUBshiftLLreg x y z)) yes no) @@ -22884,14 +22688,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUBshiftRLreg x y z)) yes no) @@ -22912,14 +22714,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(SUBshiftRAreg x y z)) yes no) @@ -22940,14 +22740,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADD x y)) yes no) @@ -22967,13 +22765,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADDconst [c] x)) yes no) @@ -22993,13 +22789,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADDshiftLL x y [c])) yes no) @@ -23020,14 +22814,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADDshiftRL x y [c])) yes no) @@ -23048,14 +22840,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADDshiftRA x y [c])) yes no) @@ -23076,14 +22866,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADDshiftLLreg x y z)) yes no) @@ -23104,14 +22892,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADDshiftRLreg x y z)) yes no) @@ -23132,14 +22918,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ADDshiftRAreg x y z)) yes no) @@ -23160,14 +22944,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(AND x y)) yes no) @@ -23187,13 +22969,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(MULA x y a)) yes no) @@ -23214,8 +22994,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -23223,7 +23002,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ANDconst [c] x)) yes no) @@ -23243,13 +23021,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ANDshiftLL x y [c])) yes no) @@ -23270,14 +23046,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ANDshiftRL x y [c])) yes no) @@ -23298,14 +23072,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ANDshiftRA x y [c])) yes no) @@ -23326,14 +23098,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ANDshiftLLreg x y z)) yes no) @@ -23354,14 +23124,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ANDshiftRLreg x y z)) yes no) @@ -23382,14 +23150,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(ANDshiftRAreg x y z)) yes no) @@ -23410,14 +23176,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XOR x y)) yes no) @@ -23437,13 +23201,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XORconst [c] x)) yes no) @@ -23463,13 +23225,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XORshiftLL x y [c])) yes no) @@ -23490,14 +23250,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XORshiftRL x y [c])) yes no) @@ -23518,14 +23276,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XORshiftRA x y [c])) yes no) @@ -23546,14 +23302,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XORshiftLLreg x y z)) yes no) @@ -23574,14 +23328,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XORshiftRLreg x y z)) yes no) @@ -23602,14 +23354,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] l:(XORshiftRAreg x y z)) yes no) @@ -23630,14 +23380,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } case BlockIf: @@ -23646,10 +23394,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) b.AddControl(cc) - b.Aux = nil return true } // match: (If (NotEqual cc) yes no) @@ -23657,10 +23403,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMNotEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessThan cc) yes no) @@ -23668,10 +23412,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMLessThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessThanU cc) yes no) @@ -23679,10 +23421,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMLessThanU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMULT - b.ResetControls() + b.Reset(BlockARMULT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessEqual cc) yes no) @@ -23690,10 +23430,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMLessEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessEqualU cc) yes no) @@ -23701,10 +23439,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMLessEqualU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMULE - b.ResetControls() + b.Reset(BlockARMULE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterThan cc) yes no) @@ -23712,10 +23448,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMGreaterThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterThanU cc) yes no) @@ -23723,10 +23457,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMGreaterThanU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMUGT - b.ResetControls() + b.Reset(BlockARMUGT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterEqual cc) yes no) @@ -23734,10 +23466,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMGreaterEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterEqualU cc) yes no) @@ -23745,65 +23475,51 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMGreaterEqualU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARMUGE - b.ResetControls() + b.Reset(BlockARMUGE) b.AddControl(cc) - b.Aux = nil return true } // match: (If cond yes no) // result: (NE (CMPconst [0] cond) yes no) for { cond := b.Controls[0] - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(cond.Pos, OpARMCMPconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(cond) b.AddControl(v0) - b.Aux = nil return true } case BlockARMLE: // match: (LE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -23812,10 +23528,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) b.AddControl(cmp) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUB x y)) yes no) @@ -23835,13 +23549,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(MULS x y a)) yes no) @@ -23862,8 +23574,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -23871,7 +23582,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUBconst [c] x)) yes no) @@ -23891,13 +23601,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMPconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUBshiftLL x y [c])) yes no) @@ -23918,14 +23626,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUBshiftRL x y [c])) yes no) @@ -23946,14 +23652,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUBshiftRA x y [c])) yes no) @@ -23974,14 +23678,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUBshiftLLreg x y z)) yes no) @@ -24002,14 +23704,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUBshiftRLreg x y z)) yes no) @@ -24030,14 +23730,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(SUBshiftRAreg x y z)) yes no) @@ -24058,14 +23756,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADD x y)) yes no) @@ -24085,13 +23781,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(MULA x y a)) yes no) @@ -24112,8 +23806,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -24121,7 +23814,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADDconst [c] x)) yes no) @@ -24141,13 +23833,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADDshiftLL x y [c])) yes no) @@ -24168,14 +23858,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADDshiftRL x y [c])) yes no) @@ -24196,14 +23884,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADDshiftRA x y [c])) yes no) @@ -24224,14 +23910,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADDshiftLLreg x y z)) yes no) @@ -24252,14 +23936,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADDshiftRLreg x y z)) yes no) @@ -24280,14 +23962,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ADDshiftRAreg x y z)) yes no) @@ -24308,14 +23988,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(AND x y)) yes no) @@ -24335,13 +24013,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ANDconst [c] x)) yes no) @@ -24361,13 +24037,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ANDshiftLL x y [c])) yes no) @@ -24388,14 +24062,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ANDshiftRL x y [c])) yes no) @@ -24416,14 +24088,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ANDshiftRA x y [c])) yes no) @@ -24444,14 +24114,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ANDshiftLLreg x y z)) yes no) @@ -24472,14 +24140,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ANDshiftRLreg x y z)) yes no) @@ -24500,14 +24166,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(ANDshiftRAreg x y z)) yes no) @@ -24528,14 +24192,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XOR x y)) yes no) @@ -24555,13 +24217,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XORconst [c] x)) yes no) @@ -24581,13 +24241,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XORshiftLL x y [c])) yes no) @@ -24608,14 +24266,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XORshiftRL x y [c])) yes no) @@ -24636,14 +24292,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XORshiftRA x y [c])) yes no) @@ -24664,14 +24318,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XORshiftLLreg x y z)) yes no) @@ -24692,14 +24344,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XORshiftRLreg x y z)) yes no) @@ -24720,14 +24370,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] l:(XORshiftRAreg x y z)) yes no) @@ -24748,57 +24396,45 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } case BlockARMLT: // match: (LT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -24807,10 +24443,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) b.AddControl(cmp) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUB x y)) yes no) @@ -24830,13 +24464,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(MULS x y a)) yes no) @@ -24857,8 +24489,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -24866,7 +24497,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUBconst [c] x)) yes no) @@ -24886,13 +24516,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMPconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUBshiftLL x y [c])) yes no) @@ -24913,14 +24541,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUBshiftRL x y [c])) yes no) @@ -24941,14 +24567,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUBshiftRA x y [c])) yes no) @@ -24969,14 +24593,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUBshiftLLreg x y z)) yes no) @@ -24997,14 +24619,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUBshiftRLreg x y z)) yes no) @@ -25025,14 +24645,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(SUBshiftRAreg x y z)) yes no) @@ -25053,14 +24671,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADD x y)) yes no) @@ -25080,13 +24696,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(MULA x y a)) yes no) @@ -25107,8 +24721,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -25116,7 +24729,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADDconst [c] x)) yes no) @@ -25136,13 +24748,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADDshiftLL x y [c])) yes no) @@ -25163,14 +24773,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADDshiftRL x y [c])) yes no) @@ -25191,14 +24799,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADDshiftRA x y [c])) yes no) @@ -25219,14 +24825,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADDshiftLLreg x y z)) yes no) @@ -25247,14 +24851,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADDshiftRLreg x y z)) yes no) @@ -25275,14 +24877,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ADDshiftRAreg x y z)) yes no) @@ -25303,14 +24903,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(AND x y)) yes no) @@ -25330,13 +24928,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ANDconst [c] x)) yes no) @@ -25356,13 +24952,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ANDshiftLL x y [c])) yes no) @@ -25383,14 +24977,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ANDshiftRL x y [c])) yes no) @@ -25411,14 +25003,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ANDshiftRA x y [c])) yes no) @@ -25439,14 +25029,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ANDshiftLLreg x y z)) yes no) @@ -25467,14 +25055,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ANDshiftRLreg x y z)) yes no) @@ -25495,14 +25081,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(ANDshiftRAreg x y z)) yes no) @@ -25523,14 +25107,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XOR x y)) yes no) @@ -25550,13 +25132,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XORconst [c] x)) yes no) @@ -25576,13 +25156,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XORshiftLL x y [c])) yes no) @@ -25603,14 +25181,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XORshiftRL x y [c])) yes no) @@ -25631,14 +25207,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XORshiftRA x y [c])) yes no) @@ -25659,14 +25233,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XORshiftLLreg x y z)) yes no) @@ -25687,14 +25259,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XORshiftRLreg x y z)) yes no) @@ -25715,14 +25285,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] l:(XORshiftRAreg x y z)) yes no) @@ -25743,14 +25311,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } case BlockARMNE: @@ -25766,10 +25332,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMEQ - b.ResetControls() + b.Reset(BlockARMEQ) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (NotEqual cc)) yes no) @@ -25784,10 +25348,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (LessThan cc)) yes no) @@ -25802,10 +25364,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMLT - b.ResetControls() + b.Reset(BlockARMLT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (LessThanU cc)) yes no) @@ -25820,10 +25380,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMULT - b.ResetControls() + b.Reset(BlockARMULT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (LessEqual cc)) yes no) @@ -25838,10 +25396,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMLE - b.ResetControls() + b.Reset(BlockARMLE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (LessEqualU cc)) yes no) @@ -25856,10 +25412,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMULE - b.ResetControls() + b.Reset(BlockARMULE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (GreaterThan cc)) yes no) @@ -25874,10 +25428,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMGT - b.ResetControls() + b.Reset(BlockARMGT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (GreaterThanU cc)) yes no) @@ -25892,10 +25444,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMUGT - b.ResetControls() + b.Reset(BlockARMUGT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (GreaterEqual cc)) yes no) @@ -25910,10 +25460,8 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMGE - b.ResetControls() + b.Reset(BlockARMGE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (GreaterEqualU cc)) yes no) @@ -25928,51 +25476,39 @@ func rewriteBlockARM(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockARMUGE - b.ResetControls() + b.Reset(BlockARMUGE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (NE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (InvertFlags cmp) yes no) @@ -25980,10 +25516,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUB x y)) yes no) @@ -26003,13 +25537,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(MULS x y a)) yes no) @@ -26030,8 +25562,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -26039,7 +25570,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUBconst [c] x)) yes no) @@ -26059,13 +25589,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMPconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUBshiftLL x y [c])) yes no) @@ -26086,14 +25614,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUBshiftRL x y [c])) yes no) @@ -26114,14 +25640,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUBshiftRA x y [c])) yes no) @@ -26142,14 +25666,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUBshiftLLreg x y z)) yes no) @@ -26170,14 +25692,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUBshiftRLreg x y z)) yes no) @@ -26198,14 +25718,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(SUBshiftRAreg x y z)) yes no) @@ -26226,14 +25744,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMPshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADD x y)) yes no) @@ -26253,13 +25769,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(MULA x y a)) yes no) @@ -26280,8 +25794,7 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARMMUL, x.Type) @@ -26289,7 +25802,6 @@ func rewriteBlockARM(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADDconst [c] x)) yes no) @@ -26309,13 +25821,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADDshiftLL x y [c])) yes no) @@ -26336,14 +25846,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADDshiftRL x y [c])) yes no) @@ -26364,14 +25872,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADDshiftRA x y [c])) yes no) @@ -26392,14 +25898,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADDshiftLLreg x y z)) yes no) @@ -26420,14 +25924,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADDshiftRLreg x y z)) yes no) @@ -26448,14 +25950,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ADDshiftRAreg x y z)) yes no) @@ -26476,14 +25976,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMCMNshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(AND x y)) yes no) @@ -26503,13 +26001,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ANDconst [c] x)) yes no) @@ -26529,13 +26025,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ANDshiftLL x y [c])) yes no) @@ -26556,14 +26050,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ANDshiftRL x y [c])) yes no) @@ -26584,14 +26076,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ANDshiftRA x y [c])) yes no) @@ -26612,14 +26102,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ANDshiftLLreg x y z)) yes no) @@ -26640,14 +26128,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ANDshiftRLreg x y z)) yes no) @@ -26668,14 +26154,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(ANDshiftRAreg x y z)) yes no) @@ -26696,14 +26180,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTSTshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XOR x y)) yes no) @@ -26723,13 +26205,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQ, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XORconst [c] x)) yes no) @@ -26749,13 +26229,11 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XORshiftLL x y [c])) yes no) @@ -26776,14 +26254,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XORshiftRL x y [c])) yes no) @@ -26804,14 +26280,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRL, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XORshiftRA x y [c])) yes no) @@ -26832,14 +26306,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRA, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XORshiftLLreg x y z)) yes no) @@ -26860,14 +26332,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftLLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XORshiftRLreg x y z)) yes no) @@ -26888,14 +26358,12 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRLreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] l:(XORshiftRAreg x y z)) yes no) @@ -26916,57 +26384,45 @@ func rewriteBlockARM(b *Block) bool { if !(l.Uses == 1) { break } - b.Kind = BlockARMNE - b.ResetControls() + b.Reset(BlockARMNE) v0 := b.NewValue0(v_0.Pos, OpARMTEQshiftRAreg, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) v0.AddArg(z) b.AddControl(v0) - b.Aux = nil return true } case BlockARMUGE: // match: (UGE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (InvertFlags cmp) yes no) @@ -26974,54 +26430,42 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMULE - b.ResetControls() + b.Reset(BlockARMULE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARMUGT: // match: (UGT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGT (InvertFlags cmp) yes no) @@ -27029,52 +26473,40 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMULT - b.ResetControls() + b.Reset(BlockARMULT) b.AddControl(cmp) - b.Aux = nil return true } case BlockARMULE: // match: (ULE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -27083,53 +26515,41 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMUGE - b.ResetControls() + b.Reset(BlockARMUGE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARMULT: // match: (ULT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARMFlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARMFlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -27138,10 +26558,8 @@ func rewriteBlockARM(b *Block) bool { for b.Controls[0].Op == OpARMInvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARMUGT - b.ResetControls() + b.Reset(BlockARMUGT) b.AddControl(cmp) - b.Aux = nil return true } } diff --git a/src/cmd/compile/internal/ssa/rewriteARM64.go b/src/cmd/compile/internal/ssa/rewriteARM64.go index 66db390e596..dfb5554f622 100644 --- a/src/cmd/compile/internal/ssa/rewriteARM64.go +++ b/src/cmd/compile/internal/ssa/rewriteARM64.go @@ -33299,13 +33299,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] z:(AND x y)) yes no) @@ -33325,13 +33323,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] z:(AND x y)) yes no) @@ -33351,13 +33347,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] x:(ANDconst [c] y)) yes no) @@ -33377,13 +33371,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] x:(ADDconst [c] y)) yes no) @@ -33403,13 +33395,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] x:(ADDconst [c] y)) yes no) @@ -33429,13 +33419,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] z:(ADD x y)) yes no) @@ -33455,13 +33443,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] z:(ADD x y)) yes no) @@ -33481,13 +33467,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMP x z:(NEG y)) yes no) @@ -33505,13 +33489,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPW x z:(NEG y)) yes no) @@ -33529,13 +33511,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] x) yes no) @@ -33546,10 +33526,8 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64Z - b.ResetControls() + b.Reset(BlockARM64Z) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] x) yes no) @@ -33560,10 +33538,8 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64ZW - b.ResetControls() + b.Reset(BlockARM64ZW) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (CMPconst [0] z:(MADD a x y)) yes no) @@ -33584,8 +33560,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -33593,7 +33568,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] z:(MSUB a x y)) yes no) @@ -33614,8 +33588,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -33623,7 +33596,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] z:(MADDW a x y)) yes no) @@ -33644,8 +33616,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -33653,7 +33624,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] z:(MSUBW a x y)) yes no) @@ -33674,8 +33644,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -33683,7 +33652,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (TSTconst [c] x) yes no) @@ -33696,8 +33664,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(c)) { break } - b.Kind = BlockARM64TBZ - b.ResetControls() + b.Reset(BlockARM64TBZ) b.AddControl(x) b.Aux = ntz(c) return true @@ -33712,8 +33679,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(int64(uint32(c)))) { break } - b.Kind = BlockARM64TBZ - b.ResetControls() + b.Reset(BlockARM64TBZ) b.AddControl(x) b.Aux = ntz(int64(uint32(c))) return true @@ -33721,44 +33687,34 @@ func rewriteBlockARM64(b *Block) bool { // match: (EQ (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (EQ (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -33767,10 +33723,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64FGE: @@ -33779,10 +33733,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64FLE - b.ResetControls() + b.Reset(BlockARM64FLE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64FGT: @@ -33791,10 +33743,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64FLT - b.ResetControls() + b.Reset(BlockARM64FLT) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64FLE: @@ -33803,10 +33753,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64FGE - b.ResetControls() + b.Reset(BlockARM64FGE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64FLT: @@ -33815,10 +33763,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64FGT - b.ResetControls() + b.Reset(BlockARM64FGT) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64GE: @@ -33839,13 +33785,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] z:(AND x y)) yes no) @@ -33865,13 +33809,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPWconst [0] z:(AND x y)) yes no) @@ -33891,13 +33833,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] x:(ANDconst [c] y)) yes no) @@ -33917,13 +33857,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] x:(ADDconst [c] y)) yes no) @@ -33943,13 +33881,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPWconst [0] x:(ADDconst [c] y)) yes no) @@ -33969,13 +33905,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] z:(ADD x y)) yes no) @@ -33995,13 +33929,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPWconst [0] z:(ADD x y)) yes no) @@ -34021,13 +33953,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMP x z:(NEG y)) yes no) @@ -34045,13 +33975,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPW x z:(NEG y)) yes no) @@ -34069,13 +33997,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] z:(MADD a x y)) yes no) @@ -34096,8 +34022,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -34105,7 +34030,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] z:(MSUB a x y)) yes no) @@ -34126,8 +34050,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -34135,7 +34058,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPWconst [0] z:(MADDW a x y)) yes no) @@ -34156,8 +34078,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -34165,7 +34086,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPWconst [0] z:(MSUBW a x y)) yes no) @@ -34186,8 +34106,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -34195,7 +34114,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPWconst [0] x) yes no) @@ -34206,8 +34124,7 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64TBZ - b.ResetControls() + b.Reset(BlockARM64TBZ) b.AddControl(x) b.Aux = int64(31) return true @@ -34220,8 +34137,7 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64TBZ - b.ResetControls() + b.Reset(BlockARM64TBZ) b.AddControl(x) b.Aux = int64(63) return true @@ -34229,43 +34145,33 @@ func rewriteBlockARM64(b *Block) bool { // match: (GE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (InvertFlags cmp) yes no) @@ -34273,10 +34179,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64GT: @@ -34297,13 +34201,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] z:(AND x y)) yes no) @@ -34323,13 +34225,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPWconst [0] z:(AND x y)) yes no) @@ -34349,13 +34249,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] x:(ANDconst [c] y)) yes no) @@ -34375,13 +34273,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] x:(ADDconst [c] y)) yes no) @@ -34401,13 +34297,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPWconst [0] x:(ADDconst [c] y)) yes no) @@ -34427,13 +34321,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] z:(ADD x y)) yes no) @@ -34453,13 +34345,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPWconst [0] z:(ADD x y)) yes no) @@ -34479,13 +34369,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMP x z:(NEG y)) yes no) @@ -34503,13 +34391,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPW x z:(NEG y)) yes no) @@ -34527,13 +34413,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] z:(MADD a x y)) yes no) @@ -34554,8 +34438,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -34563,7 +34446,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] z:(MSUB a x y)) yes no) @@ -34584,8 +34466,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -34593,7 +34474,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPWconst [0] z:(MADDW a x y)) yes no) @@ -34614,8 +34494,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -34623,7 +34502,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPWconst [0] z:(MSUBW a x y)) yes no) @@ -34644,8 +34522,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -34653,50 +34530,39 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GT (InvertFlags cmp) yes no) @@ -34704,10 +34570,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) b.AddControl(cmp) - b.Aux = nil return true } case BlockIf: @@ -34716,10 +34580,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64Equal { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) b.AddControl(cc) - b.Aux = nil return true } // match: (If (NotEqual cc) yes no) @@ -34727,10 +34589,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64NotEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessThan cc) yes no) @@ -34738,10 +34598,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessThanU cc) yes no) @@ -34749,10 +34607,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessThanU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64ULT - b.ResetControls() + b.Reset(BlockARM64ULT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessEqual cc) yes no) @@ -34760,10 +34616,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessEqualU cc) yes no) @@ -34771,10 +34625,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessEqualU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64ULE - b.ResetControls() + b.Reset(BlockARM64ULE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterThan cc) yes no) @@ -34782,10 +34634,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterThanU cc) yes no) @@ -34793,10 +34643,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterThanU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64UGT - b.ResetControls() + b.Reset(BlockARM64UGT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterEqual cc) yes no) @@ -34804,10 +34652,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterEqualU cc) yes no) @@ -34815,10 +34661,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterEqualU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64UGE - b.ResetControls() + b.Reset(BlockARM64UGE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessThanF cc) yes no) @@ -34826,10 +34670,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessThanF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FLT - b.ResetControls() + b.Reset(BlockARM64FLT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessEqualF cc) yes no) @@ -34837,10 +34679,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessEqualF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FLE - b.ResetControls() + b.Reset(BlockARM64FLE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterThanF cc) yes no) @@ -34848,10 +34688,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterThanF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FGT - b.ResetControls() + b.Reset(BlockARM64FGT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterEqualF cc) yes no) @@ -34859,20 +34697,16 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterEqualF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FGE - b.ResetControls() + b.Reset(BlockARM64FGE) b.AddControl(cc) - b.Aux = nil return true } // match: (If cond yes no) // result: (NZ cond yes no) for { cond := b.Controls[0] - b.Kind = BlockARM64NZ - b.ResetControls() + b.Reset(BlockARM64NZ) b.AddControl(cond) - b.Aux = nil return true } case BlockARM64LE: @@ -34893,13 +34727,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] z:(AND x y)) yes no) @@ -34919,13 +34751,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPWconst [0] z:(AND x y)) yes no) @@ -34945,13 +34775,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] x:(ANDconst [c] y)) yes no) @@ -34971,13 +34799,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] x:(ADDconst [c] y)) yes no) @@ -34997,13 +34823,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPWconst [0] x:(ADDconst [c] y)) yes no) @@ -35023,13 +34847,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] z:(ADD x y)) yes no) @@ -35049,13 +34871,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPWconst [0] z:(ADD x y)) yes no) @@ -35075,13 +34895,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMP x z:(NEG y)) yes no) @@ -35099,13 +34917,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPW x z:(NEG y)) yes no) @@ -35123,13 +34939,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] z:(MADD a x y)) yes no) @@ -35150,8 +34964,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -35159,7 +34972,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] z:(MSUB a x y)) yes no) @@ -35180,8 +34992,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -35189,7 +35000,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPWconst [0] z:(MADDW a x y)) yes no) @@ -35210,8 +35020,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -35219,7 +35028,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPWconst [0] z:(MSUBW a x y)) yes no) @@ -35240,8 +35048,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -35249,48 +35056,37 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -35299,10 +35095,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64LT: @@ -35323,13 +35117,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] z:(AND x y)) yes no) @@ -35349,13 +35141,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPWconst [0] z:(AND x y)) yes no) @@ -35375,13 +35165,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] x:(ANDconst [c] y)) yes no) @@ -35401,13 +35189,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] x:(ADDconst [c] y)) yes no) @@ -35427,13 +35213,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPWconst [0] x:(ADDconst [c] y)) yes no) @@ -35453,13 +35237,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] z:(ADD x y)) yes no) @@ -35479,13 +35261,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPWconst [0] z:(ADD x y)) yes no) @@ -35505,13 +35285,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMP x z:(NEG y)) yes no) @@ -35529,13 +35307,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPW x z:(NEG y)) yes no) @@ -35553,13 +35329,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] z:(MADD a x y)) yes no) @@ -35580,8 +35354,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -35589,7 +35362,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] z:(MSUB a x y)) yes no) @@ -35610,8 +35382,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -35619,7 +35390,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPWconst [0] z:(MADDW a x y)) yes no) @@ -35640,8 +35410,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -35649,7 +35418,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPWconst [0] z:(MSUBW a x y)) yes no) @@ -35670,8 +35438,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -35679,7 +35446,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPWconst [0] x) yes no) @@ -35690,8 +35456,7 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64TBNZ - b.ResetControls() + b.Reset(BlockARM64TBNZ) b.AddControl(x) b.Aux = int64(31) return true @@ -35704,8 +35469,7 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64TBNZ - b.ResetControls() + b.Reset(BlockARM64TBNZ) b.AddControl(x) b.Aux = int64(63) return true @@ -35713,43 +35477,33 @@ func rewriteBlockARM64(b *Block) bool { // match: (LT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -35758,10 +35512,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64NE: @@ -35782,13 +35534,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] z:(AND x y)) yes no) @@ -35808,13 +35558,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPWconst [0] z:(AND x y)) yes no) @@ -35834,13 +35582,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] x:(ANDconst [c] y)) yes no) @@ -35860,13 +35606,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] x:(ADDconst [c] y)) yes no) @@ -35886,13 +35630,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPWconst [0] x:(ADDconst [c] y)) yes no) @@ -35912,13 +35654,11 @@ func rewriteBlockARM64(b *Block) bool { if !(x.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] z:(ADD x y)) yes no) @@ -35938,13 +35678,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPWconst [0] z:(ADD x y)) yes no) @@ -35964,13 +35702,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMP x z:(NEG y)) yes no) @@ -35988,13 +35724,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPW x z:(NEG y)) yes no) @@ -36012,13 +35746,11 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] x) yes no) @@ -36029,10 +35761,8 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64NZ - b.ResetControls() + b.Reset(BlockARM64NZ) b.AddControl(x) - b.Aux = nil return true } // match: (NE (CMPWconst [0] x) yes no) @@ -36043,10 +35773,8 @@ func rewriteBlockARM64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockARM64NZW - b.ResetControls() + b.Reset(BlockARM64NZW) b.AddControl(x) - b.Aux = nil return true } // match: (NE (CMPconst [0] z:(MADD a x y)) yes no) @@ -36067,8 +35795,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -36076,7 +35803,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] z:(MSUB a x y)) yes no) @@ -36097,8 +35823,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type) @@ -36106,7 +35831,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPWconst [0] z:(MADDW a x y)) yes no) @@ -36127,8 +35851,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -36136,7 +35859,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPWconst [0] z:(MSUBW a x y)) yes no) @@ -36157,8 +35879,7 @@ func rewriteBlockARM64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags) v0.AddArg(a) v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type) @@ -36166,7 +35887,6 @@ func rewriteBlockARM64(b *Block) bool { v1.AddArg(y) v0.AddArg(v1) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (TSTconst [c] x) yes no) @@ -36179,8 +35899,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(c)) { break } - b.Kind = BlockARM64TBNZ - b.ResetControls() + b.Reset(BlockARM64TBNZ) b.AddControl(x) b.Aux = ntz(c) return true @@ -36195,8 +35914,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(int64(uint32(c)))) { break } - b.Kind = BlockARM64TBNZ - b.ResetControls() + b.Reset(BlockARM64TBNZ) b.AddControl(x) b.Aux = ntz(int64(uint32(c))) return true @@ -36204,42 +35922,32 @@ func rewriteBlockARM64(b *Block) bool { // match: (NE (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (NE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (InvertFlags cmp) yes no) @@ -36247,10 +35955,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64NZ: @@ -36259,10 +35965,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64Equal { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64EQ - b.ResetControls() + b.Reset(BlockARM64EQ) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (NotEqual cc) yes no) @@ -36270,10 +35974,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64NotEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64NE - b.ResetControls() + b.Reset(BlockARM64NE) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (LessThan cc) yes no) @@ -36281,10 +35983,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64LT - b.ResetControls() + b.Reset(BlockARM64LT) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (LessThanU cc) yes no) @@ -36292,10 +35992,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessThanU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64ULT - b.ResetControls() + b.Reset(BlockARM64ULT) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (LessEqual cc) yes no) @@ -36303,10 +36001,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64LE - b.ResetControls() + b.Reset(BlockARM64LE) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (LessEqualU cc) yes no) @@ -36314,10 +36010,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessEqualU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64ULE - b.ResetControls() + b.Reset(BlockARM64ULE) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (GreaterThan cc) yes no) @@ -36325,10 +36019,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64GT - b.ResetControls() + b.Reset(BlockARM64GT) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (GreaterThanU cc) yes no) @@ -36336,10 +36028,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterThanU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64UGT - b.ResetControls() + b.Reset(BlockARM64UGT) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (GreaterEqual cc) yes no) @@ -36347,10 +36037,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64GE - b.ResetControls() + b.Reset(BlockARM64GE) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (GreaterEqualU cc) yes no) @@ -36358,10 +36046,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterEqualU { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64UGE - b.ResetControls() + b.Reset(BlockARM64UGE) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (LessThanF cc) yes no) @@ -36369,10 +36055,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessThanF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FLT - b.ResetControls() + b.Reset(BlockARM64FLT) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (LessEqualF cc) yes no) @@ -36380,10 +36064,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64LessEqualF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FLE - b.ResetControls() + b.Reset(BlockARM64FLE) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (GreaterThanF cc) yes no) @@ -36391,10 +36073,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterThanF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FGT - b.ResetControls() + b.Reset(BlockARM64FGT) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (GreaterEqualF cc) yes no) @@ -36402,10 +36082,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64GreaterEqualF { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockARM64FGE - b.ResetControls() + b.Reset(BlockARM64FGE) b.AddControl(cc) - b.Aux = nil return true } // match: (NZ (ANDconst [c] x) yes no) @@ -36418,8 +36096,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(c)) { break } - b.Kind = BlockARM64TBNZ - b.ResetControls() + b.Reset(BlockARM64TBNZ) b.AddControl(x) b.Aux = ntz(c) return true @@ -36431,9 +36108,7 @@ func rewriteBlockARM64(b *Block) bool { if v_0.AuxInt != 0 { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36446,9 +36121,7 @@ func rewriteBlockARM64(b *Block) bool { if !(c != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockARM64NZW: @@ -36462,8 +36135,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(int64(uint32(c)))) { break } - b.Kind = BlockARM64TBNZ - b.ResetControls() + b.Reset(BlockARM64TBNZ) b.AddControl(x) b.Aux = ntz(int64(uint32(c))) return true @@ -36477,9 +36149,7 @@ func rewriteBlockARM64(b *Block) bool { if !(int32(c) == 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36492,52 +36162,40 @@ func rewriteBlockARM64(b *Block) bool { if !(int32(c) != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } case BlockARM64UGE: // match: (UGE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGE (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGE (InvertFlags cmp) yes no) @@ -36545,54 +36203,42 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64ULE - b.ResetControls() + b.Reset(BlockARM64ULE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64UGT: // match: (UGT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagLT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGT (FlagGT_ULT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (UGT (FlagGT_UGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (UGT (InvertFlags cmp) yes no) @@ -36600,52 +36246,40 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64ULT - b.ResetControls() + b.Reset(BlockARM64ULT) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64ULE: // match: (ULE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULE (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULE (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36654,53 +36288,41 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64UGE - b.ResetControls() + b.Reset(BlockARM64UGE) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64ULT: // match: (ULT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagLT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagLT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagLT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagLT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (ULT (FlagGT_ULT) yes no) // result: (First yes no) for b.Controls[0].Op == OpARM64FlagGT_ULT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ULT (FlagGT_UGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpARM64FlagGT_UGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36709,10 +36331,8 @@ func rewriteBlockARM64(b *Block) bool { for b.Controls[0].Op == OpARM64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockARM64UGT - b.ResetControls() + b.Reset(BlockARM64UGT) b.AddControl(cmp) - b.Aux = nil return true } case BlockARM64Z: @@ -36726,8 +36346,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(c)) { break } - b.Kind = BlockARM64TBZ - b.ResetControls() + b.Reset(BlockARM64TBZ) b.AddControl(x) b.Aux = ntz(c) return true @@ -36739,9 +36358,7 @@ func rewriteBlockARM64(b *Block) bool { if v_0.AuxInt != 0 { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (Z (MOVDconst [c]) yes no) @@ -36753,9 +36370,7 @@ func rewriteBlockARM64(b *Block) bool { if !(c != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36770,8 +36385,7 @@ func rewriteBlockARM64(b *Block) bool { if !(oneBit(int64(uint32(c)))) { break } - b.Kind = BlockARM64TBZ - b.ResetControls() + b.Reset(BlockARM64TBZ) b.AddControl(x) b.Aux = ntz(int64(uint32(c))) return true @@ -36785,9 +36399,7 @@ func rewriteBlockARM64(b *Block) bool { if !(int32(c) == 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (ZW (MOVDconst [c]) yes no) @@ -36799,9 +36411,7 @@ func rewriteBlockARM64(b *Block) bool { if !(int32(c) != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go index 3ae2a72457e..72e596517fc 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go @@ -9002,10 +9002,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSFPFlagTrue { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPSFPF - b.ResetControls() + b.Reset(BlockMIPSFPF) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (FPFlagFalse cmp) yes no) @@ -9013,10 +9011,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSFPFlagFalse { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPSFPT - b.ResetControls() + b.Reset(BlockMIPSFPT) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGT _ _)) yes no) @@ -9031,10 +9027,8 @@ func rewriteBlockMIPS(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTU _ _)) yes no) @@ -9049,10 +9043,8 @@ func rewriteBlockMIPS(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTconst _)) yes no) @@ -9066,10 +9058,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTconst { break } - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTUconst _)) yes no) @@ -9083,10 +9073,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTUconst { break } - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTzero _)) yes no) @@ -9100,10 +9088,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTzero { break } - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTUzero _)) yes no) @@ -9117,10 +9103,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTUzero { break } - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (SGTUconst [1] x) yes no) @@ -9131,10 +9115,8 @@ func rewriteBlockMIPS(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (SGTUzero x) yes no) @@ -9142,10 +9124,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSSGTUzero { v_0 := b.Controls[0] x := v_0.Args[0] - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (SGTconst [0] x) yes no) @@ -9156,10 +9136,8 @@ func rewriteBlockMIPS(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPSGEZ - b.ResetControls() + b.Reset(BlockMIPSGEZ) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (SGTzero x) yes no) @@ -9167,10 +9145,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSSGTzero { v_0 := b.Controls[0] x := v_0.Args[0] - b.Kind = BlockMIPSLEZ - b.ResetControls() + b.Reset(BlockMIPSLEZ) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (MOVWconst [0]) yes no) @@ -9180,9 +9156,7 @@ func rewriteBlockMIPS(b *Block) bool { if v_0.AuxInt != 0 { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (EQ (MOVWconst [c]) yes no) @@ -9194,9 +9168,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(c != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9210,9 +9182,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) >= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GEZ (MOVWconst [c]) yes no) @@ -9224,9 +9194,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) < 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9240,9 +9208,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) > 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GTZ (MOVWconst [c]) yes no) @@ -9254,9 +9220,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) <= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9265,10 +9229,8 @@ func rewriteBlockMIPS(b *Block) bool { // result: (NE cond yes no) for { cond := b.Controls[0] - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(cond) - b.Aux = nil return true } case BlockMIPSLEZ: @@ -9281,9 +9243,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) <= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LEZ (MOVWconst [c]) yes no) @@ -9295,9 +9255,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) > 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9311,9 +9269,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) < 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LTZ (MOVWconst [c]) yes no) @@ -9325,9 +9281,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(int32(c) >= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9337,10 +9291,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSFPFlagTrue { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPSFPT - b.ResetControls() + b.Reset(BlockMIPSFPT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (FPFlagFalse cmp) yes no) @@ -9348,10 +9300,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSFPFlagFalse { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPSFPF - b.ResetControls() + b.Reset(BlockMIPSFPF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGT _ _)) yes no) @@ -9366,10 +9316,8 @@ func rewriteBlockMIPS(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTU _ _)) yes no) @@ -9384,10 +9332,8 @@ func rewriteBlockMIPS(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTconst _)) yes no) @@ -9401,10 +9347,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTconst { break } - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTUconst _)) yes no) @@ -9418,10 +9362,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTUconst { break } - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTzero _)) yes no) @@ -9435,10 +9377,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTzero { break } - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTUzero _)) yes no) @@ -9452,10 +9392,8 @@ func rewriteBlockMIPS(b *Block) bool { if cmp.Op != OpMIPSSGTUzero { break } - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (SGTUconst [1] x) yes no) @@ -9466,10 +9404,8 @@ func rewriteBlockMIPS(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPSEQ - b.ResetControls() + b.Reset(BlockMIPSEQ) b.AddControl(x) - b.Aux = nil return true } // match: (NE (SGTUzero x) yes no) @@ -9477,10 +9413,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSSGTUzero { v_0 := b.Controls[0] x := v_0.Args[0] - b.Kind = BlockMIPSNE - b.ResetControls() + b.Reset(BlockMIPSNE) b.AddControl(x) - b.Aux = nil return true } // match: (NE (SGTconst [0] x) yes no) @@ -9491,10 +9425,8 @@ func rewriteBlockMIPS(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPSLTZ - b.ResetControls() + b.Reset(BlockMIPSLTZ) b.AddControl(x) - b.Aux = nil return true } // match: (NE (SGTzero x) yes no) @@ -9502,10 +9434,8 @@ func rewriteBlockMIPS(b *Block) bool { for b.Controls[0].Op == OpMIPSSGTzero { v_0 := b.Controls[0] x := v_0.Args[0] - b.Kind = BlockMIPSGTZ - b.ResetControls() + b.Reset(BlockMIPSGTZ) b.AddControl(x) - b.Aux = nil return true } // match: (NE (MOVWconst [0]) yes no) @@ -9515,9 +9445,7 @@ func rewriteBlockMIPS(b *Block) bool { if v_0.AuxInt != 0 { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9530,9 +9458,7 @@ func rewriteBlockMIPS(b *Block) bool { if !(c != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } } diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS64.go b/src/cmd/compile/internal/ssa/rewriteMIPS64.go index 226dc00952a..c9cc5ce4f9d 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS64.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS64.go @@ -9747,10 +9747,8 @@ func rewriteBlockMIPS64(b *Block) bool { for b.Controls[0].Op == OpMIPS64FPFlagTrue { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPS64FPF - b.ResetControls() + b.Reset(BlockMIPS64FPF) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (FPFlagFalse cmp) yes no) @@ -9758,10 +9756,8 @@ func rewriteBlockMIPS64(b *Block) bool { for b.Controls[0].Op == OpMIPS64FPFlagFalse { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPS64FPT - b.ResetControls() + b.Reset(BlockMIPS64FPT) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGT _ _)) yes no) @@ -9776,10 +9772,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPS64NE - b.ResetControls() + b.Reset(BlockMIPS64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTU _ _)) yes no) @@ -9794,10 +9788,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPS64NE - b.ResetControls() + b.Reset(BlockMIPS64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTconst _)) yes no) @@ -9811,10 +9803,8 @@ func rewriteBlockMIPS64(b *Block) bool { if cmp.Op != OpMIPS64SGTconst { break } - b.Kind = BlockMIPS64NE - b.ResetControls() + b.Reset(BlockMIPS64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (XORconst [1] cmp:(SGTUconst _)) yes no) @@ -9828,10 +9818,8 @@ func rewriteBlockMIPS64(b *Block) bool { if cmp.Op != OpMIPS64SGTUconst { break } - b.Kind = BlockMIPS64NE - b.ResetControls() + b.Reset(BlockMIPS64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (SGTUconst [1] x) yes no) @@ -9842,10 +9830,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPS64NE - b.ResetControls() + b.Reset(BlockMIPS64NE) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (SGTU x (MOVVconst [0])) yes no) @@ -9858,10 +9844,8 @@ func rewriteBlockMIPS64(b *Block) bool { if v_0_1.Op != OpMIPS64MOVVconst || v_0_1.AuxInt != 0 { break } - b.Kind = BlockMIPS64EQ - b.ResetControls() + b.Reset(BlockMIPS64EQ) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (SGTconst [0] x) yes no) @@ -9872,10 +9856,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPS64GEZ - b.ResetControls() + b.Reset(BlockMIPS64GEZ) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (SGT x (MOVVconst [0])) yes no) @@ -9888,10 +9870,8 @@ func rewriteBlockMIPS64(b *Block) bool { if v_0_1.Op != OpMIPS64MOVVconst || v_0_1.AuxInt != 0 { break } - b.Kind = BlockMIPS64LEZ - b.ResetControls() + b.Reset(BlockMIPS64LEZ) b.AddControl(x) - b.Aux = nil return true } // match: (EQ (MOVVconst [0]) yes no) @@ -9901,9 +9881,7 @@ func rewriteBlockMIPS64(b *Block) bool { if v_0.AuxInt != 0 { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (EQ (MOVVconst [c]) yes no) @@ -9915,9 +9893,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9931,9 +9907,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c >= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GEZ (MOVVconst [c]) yes no) @@ -9945,9 +9919,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c < 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9961,9 +9933,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c > 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GTZ (MOVVconst [c]) yes no) @@ -9975,9 +9945,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c <= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -9986,10 +9954,8 @@ func rewriteBlockMIPS64(b *Block) bool { // result: (NE cond yes no) for { cond := b.Controls[0] - b.Kind = BlockMIPS64NE - b.ResetControls() + b.Reset(BlockMIPS64NE) b.AddControl(cond) - b.Aux = nil return true } case BlockMIPS64LEZ: @@ -10002,9 +9968,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c <= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LEZ (MOVVconst [c]) yes no) @@ -10016,9 +9980,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c > 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -10032,9 +9994,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c < 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LTZ (MOVVconst [c]) yes no) @@ -10046,9 +10006,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c >= 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -10058,10 +10016,8 @@ func rewriteBlockMIPS64(b *Block) bool { for b.Controls[0].Op == OpMIPS64FPFlagTrue { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPS64FPT - b.ResetControls() + b.Reset(BlockMIPS64FPT) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (FPFlagFalse cmp) yes no) @@ -10069,10 +10025,8 @@ func rewriteBlockMIPS64(b *Block) bool { for b.Controls[0].Op == OpMIPS64FPFlagFalse { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockMIPS64FPF - b.ResetControls() + b.Reset(BlockMIPS64FPF) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGT _ _)) yes no) @@ -10087,10 +10041,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPS64EQ - b.ResetControls() + b.Reset(BlockMIPS64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTU _ _)) yes no) @@ -10105,10 +10057,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } _ = cmp.Args[1] - b.Kind = BlockMIPS64EQ - b.ResetControls() + b.Reset(BlockMIPS64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTconst _)) yes no) @@ -10122,10 +10072,8 @@ func rewriteBlockMIPS64(b *Block) bool { if cmp.Op != OpMIPS64SGTconst { break } - b.Kind = BlockMIPS64EQ - b.ResetControls() + b.Reset(BlockMIPS64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (XORconst [1] cmp:(SGTUconst _)) yes no) @@ -10139,10 +10087,8 @@ func rewriteBlockMIPS64(b *Block) bool { if cmp.Op != OpMIPS64SGTUconst { break } - b.Kind = BlockMIPS64EQ - b.ResetControls() + b.Reset(BlockMIPS64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (SGTUconst [1] x) yes no) @@ -10153,10 +10099,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPS64EQ - b.ResetControls() + b.Reset(BlockMIPS64EQ) b.AddControl(x) - b.Aux = nil return true } // match: (NE (SGTU x (MOVVconst [0])) yes no) @@ -10169,10 +10113,8 @@ func rewriteBlockMIPS64(b *Block) bool { if v_0_1.Op != OpMIPS64MOVVconst || v_0_1.AuxInt != 0 { break } - b.Kind = BlockMIPS64NE - b.ResetControls() + b.Reset(BlockMIPS64NE) b.AddControl(x) - b.Aux = nil return true } // match: (NE (SGTconst [0] x) yes no) @@ -10183,10 +10125,8 @@ func rewriteBlockMIPS64(b *Block) bool { break } x := v_0.Args[0] - b.Kind = BlockMIPS64LTZ - b.ResetControls() + b.Reset(BlockMIPS64LTZ) b.AddControl(x) - b.Aux = nil return true } // match: (NE (SGT x (MOVVconst [0])) yes no) @@ -10199,10 +10139,8 @@ func rewriteBlockMIPS64(b *Block) bool { if v_0_1.Op != OpMIPS64MOVVconst || v_0_1.AuxInt != 0 { break } - b.Kind = BlockMIPS64GTZ - b.ResetControls() + b.Reset(BlockMIPS64GTZ) b.AddControl(x) - b.Aux = nil return true } // match: (NE (MOVVconst [0]) yes no) @@ -10212,9 +10150,7 @@ func rewriteBlockMIPS64(b *Block) bool { if v_0.AuxInt != 0 { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -10227,9 +10163,7 @@ func rewriteBlockMIPS64(b *Block) bool { if !(c != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } } diff --git a/src/cmd/compile/internal/ssa/rewritePPC64.go b/src/cmd/compile/internal/ssa/rewritePPC64.go index 7743a2855ee..7f49d98bd11 100644 --- a/src/cmd/compile/internal/ssa/rewritePPC64.go +++ b/src/cmd/compile/internal/ssa/rewritePPC64.go @@ -26481,13 +26481,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -26503,38 +26501,30 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (EQ (FlagLT) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagLT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (EQ (FlagGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -26543,10 +26533,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) b.AddControl(cmp) - b.Aux = nil return true } // match: (EQ (CMPconst [0] (ANDconst [c] x)) yes no) @@ -26562,13 +26550,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -26584,13 +26570,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] z:(AND x y)) yes no) @@ -26610,13 +26594,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] z:(OR x y)) yes no) @@ -26636,13 +26618,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (EQ (CMPconst [0] z:(XOR x y)) yes no) @@ -26662,39 +26642,31 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } case BlockPPC64GE: // match: (GE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (FlagLT) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagLT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GE (FlagGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GE (InvertFlags cmp) yes no) @@ -26702,10 +26674,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) b.AddControl(cmp) - b.Aux = nil return true } // match: (GE (CMPconst [0] (ANDconst [c] x)) yes no) @@ -26721,13 +26691,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -26743,13 +26711,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] z:(AND x y)) yes no) @@ -26769,13 +26735,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] z:(OR x y)) yes no) @@ -26795,13 +26759,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GE (CMPconst [0] z:(XOR x y)) yes no) @@ -26821,40 +26783,32 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } case BlockPPC64GT: // match: (GT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagLT) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagLT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (GT (FlagGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (GT (InvertFlags cmp) yes no) @@ -26862,10 +26816,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) b.AddControl(cmp) - b.Aux = nil return true } // match: (GT (CMPconst [0] (ANDconst [c] x)) yes no) @@ -26881,13 +26833,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -26903,13 +26853,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] z:(AND x y)) yes no) @@ -26929,13 +26877,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] z:(OR x y)) yes no) @@ -26955,13 +26901,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (GT (CMPconst [0] z:(XOR x y)) yes no) @@ -26981,13 +26925,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } case BlockIf: @@ -26996,10 +26938,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64Equal { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) b.AddControl(cc) - b.Aux = nil return true } // match: (If (NotEqual cc) yes no) @@ -27007,10 +26947,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64NotEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessThan cc) yes no) @@ -27018,10 +26956,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64LessThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (LessEqual cc) yes no) @@ -27029,10 +26965,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64LessEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterThan cc) yes no) @@ -27040,10 +26974,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64GreaterThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (GreaterEqual cc) yes no) @@ -27051,10 +26983,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64GreaterEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (FLessThan cc) yes no) @@ -27062,10 +26992,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64FLessThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64FLT - b.ResetControls() + b.Reset(BlockPPC64FLT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (FLessEqual cc) yes no) @@ -27073,10 +27001,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64FLessEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64FLE - b.ResetControls() + b.Reset(BlockPPC64FLE) b.AddControl(cc) - b.Aux = nil return true } // match: (If (FGreaterThan cc) yes no) @@ -27084,10 +27010,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64FGreaterThan { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64FGT - b.ResetControls() + b.Reset(BlockPPC64FGT) b.AddControl(cc) - b.Aux = nil return true } // match: (If (FGreaterEqual cc) yes no) @@ -27095,48 +27019,38 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64FGreaterEqual { v_0 := b.Controls[0] cc := v_0.Args[0] - b.Kind = BlockPPC64FGE - b.ResetControls() + b.Reset(BlockPPC64FGE) b.AddControl(cc) - b.Aux = nil return true } // match: (If cond yes no) // result: (NE (CMPWconst [0] cond) yes no) for { cond := b.Controls[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(cond.Pos, OpPPC64CMPWconst, types.TypeFlags) v0.AuxInt = 0 v0.AddArg(cond) b.AddControl(v0) - b.Aux = nil return true } case BlockPPC64LE: // match: (LE (FlagEQ) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagLT) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagLT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LE (FlagGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -27145,10 +27059,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) b.AddControl(cmp) - b.Aux = nil return true } // match: (LE (CMPconst [0] (ANDconst [c] x)) yes no) @@ -27164,13 +27076,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -27186,13 +27096,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] z:(AND x y)) yes no) @@ -27212,13 +27120,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] z:(OR x y)) yes no) @@ -27238,13 +27144,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LE (CMPconst [0] z:(XOR x y)) yes no) @@ -27264,39 +27168,31 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } case BlockPPC64LT: // match: (LT (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (LT (FlagLT) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagLT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (LT (FlagGT) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -27305,10 +27201,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) b.AddControl(cmp) - b.Aux = nil return true } // match: (LT (CMPconst [0] (ANDconst [c] x)) yes no) @@ -27324,13 +27218,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -27346,13 +27238,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] z:(AND x y)) yes no) @@ -27372,13 +27262,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] z:(OR x y)) yes no) @@ -27398,13 +27286,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (LT (CMPconst [0] z:(XOR x y)) yes no) @@ -27424,13 +27310,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } case BlockPPC64NE: @@ -27446,10 +27330,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64EQ - b.ResetControls() + b.Reset(BlockPPC64EQ) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (NotEqual cc)) yes no) @@ -27464,10 +27346,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (LessThan cc)) yes no) @@ -27482,10 +27362,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64LT - b.ResetControls() + b.Reset(BlockPPC64LT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (LessEqual cc)) yes no) @@ -27500,10 +27378,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64LE - b.ResetControls() + b.Reset(BlockPPC64LE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (GreaterThan cc)) yes no) @@ -27518,10 +27394,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64GT - b.ResetControls() + b.Reset(BlockPPC64GT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (GreaterEqual cc)) yes no) @@ -27536,10 +27410,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64GE - b.ResetControls() + b.Reset(BlockPPC64GE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (FLessThan cc)) yes no) @@ -27554,10 +27426,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64FLT - b.ResetControls() + b.Reset(BlockPPC64FLT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (FLessEqual cc)) yes no) @@ -27572,10 +27442,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64FLE - b.ResetControls() + b.Reset(BlockPPC64FLE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (FGreaterThan cc)) yes no) @@ -27590,10 +27458,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64FGT - b.ResetControls() + b.Reset(BlockPPC64FGT) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (FGreaterEqual cc)) yes no) @@ -27608,10 +27474,8 @@ func rewriteBlockPPC64(b *Block) bool { break } cc := v_0_0.Args[0] - b.Kind = BlockPPC64FGE - b.ResetControls() + b.Reset(BlockPPC64FGE) b.AddControl(cc) - b.Aux = nil return true } // match: (NE (CMPconst [0] (ANDconst [c] x)) yes no) @@ -27627,13 +27491,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -27649,38 +27511,30 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (FlagEQ) yes no) // result: (First no yes) for b.Controls[0].Op == OpPPC64FlagEQ { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } // match: (NE (FlagLT) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagLT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (FlagGT) yes no) // result: (First yes no) for b.Controls[0].Op == OpPPC64FlagGT { - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (NE (InvertFlags cmp) yes no) @@ -27688,10 +27542,8 @@ func rewriteBlockPPC64(b *Block) bool { for b.Controls[0].Op == OpPPC64InvertFlags { v_0 := b.Controls[0] cmp := v_0.Args[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) b.AddControl(cmp) - b.Aux = nil return true } // match: (NE (CMPconst [0] (ANDconst [c] x)) yes no) @@ -27707,13 +27559,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPWconst [0] (ANDconst [c] x)) yes no) @@ -27729,13 +27579,11 @@ func rewriteBlockPPC64(b *Block) bool { } c := v_0_0.AuxInt x := v_0_0.Args[0] - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags) v0.AuxInt = c v0.AddArg(x) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] z:(AND x y)) yes no) @@ -27755,13 +27603,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] z:(OR x y)) yes no) @@ -27781,13 +27627,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } // match: (NE (CMPconst [0] z:(XOR x y)) yes no) @@ -27807,13 +27651,11 @@ func rewriteBlockPPC64(b *Block) bool { if !(z.Uses == 1) { break } - b.Kind = BlockPPC64NE - b.ResetControls() + b.Reset(BlockPPC64NE) v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags) v0.AddArg(x) v0.AddArg(y) b.AddControl(v0) - b.Aux = nil return true } } diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go index 9db0cc42e92..72bbdc0e57c 100644 --- a/src/cmd/compile/internal/ssa/rewriteS390X.go +++ b/src/cmd/compile/internal/ssa/rewriteS390X.go @@ -36451,71 +36451,328 @@ func rewriteBlockS390X(b *Block) bool { typ := &b.Func.Config.Types switch b.Kind { case BlockS390XBRC: - // match: (BRC {c} (CMPWconst [0] (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp)) yes no) - // cond: x != 0 && c.(s390x.CCMask) == s390x.Equal - // result: (BRC {d} cmp no yes) - for b.Controls[0].Op == OpS390XCMPWconst { + // match: (BRC {c} (CMP x y) yes no) + // result: (CGRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) + for b.Controls[0].Op == OpS390XCMP { v_0 := b.Controls[0] - if v_0.AuxInt != 0 { - break - } - v_0_0 := v_0.Args[0] - if v_0_0.Op != OpS390XLOCGR { - break - } - d := v_0_0.Aux - cmp := v_0_0.Args[2] - v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpS390XMOVDconst || v_0_0_0.AuxInt != 0 { - break - } - v_0_0_1 := v_0_0.Args[1] - if v_0_0_1.Op != OpS390XMOVDconst { - break - } - x := v_0_0_1.AuxInt + y := v_0.Args[1] + x := v_0.Args[0] c := b.Aux - if !(x != 0 && c.(s390x.CCMask) == s390x.Equal) { - break - } - b.Kind = BlockS390XBRC - b.ResetControls() - b.AddControl(cmp) - b.Aux = d - b.swapSuccessors() + b.Reset(BlockS390XCGRJ) + b.AddControl(x) + b.AddControl(y) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered return true } - // match: (BRC {c} (CMPWconst [0] (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp)) yes no) - // cond: x != 0 && c.(s390x.CCMask) == s390x.NotEqual - // result: (BRC {d} cmp yes no) + // match: (BRC {c} (CMPW x y) yes no) + // result: (CRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) + for b.Controls[0].Op == OpS390XCMPW { + v_0 := b.Controls[0] + y := v_0.Args[1] + x := v_0.Args[0] + c := b.Aux + b.Reset(BlockS390XCRJ) + b.AddControl(x) + b.AddControl(y) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered + return true + } + // match: (BRC {c} (CMPU x y) yes no) + // result: (CLGRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) + for b.Controls[0].Op == OpS390XCMPU { + v_0 := b.Controls[0] + y := v_0.Args[1] + x := v_0.Args[0] + c := b.Aux + b.Reset(BlockS390XCLGRJ) + b.AddControl(x) + b.AddControl(y) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered + return true + } + // match: (BRC {c} (CMPWU x y) yes no) + // result: (CLRJ {c.(s390x.CCMask)&^s390x.Unordered} x y yes no) + for b.Controls[0].Op == OpS390XCMPWU { + v_0 := b.Controls[0] + y := v_0.Args[1] + x := v_0.Args[0] + c := b.Aux + b.Reset(BlockS390XCLRJ) + b.AddControl(x) + b.AddControl(y) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered + return true + } + // match: (BRC {c} (CMPconst x [y]) yes no) + // cond: is8Bit(y) + // result: (CGIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) + for b.Controls[0].Op == OpS390XCMPconst { + v_0 := b.Controls[0] + y := v_0.AuxInt + x := v_0.Args[0] + c := b.Aux + if !(is8Bit(y)) { + break + } + b.Reset(BlockS390XCGIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered + return true + } + // match: (BRC {c} (CMPWconst x [y]) yes no) + // cond: is8Bit(y) + // result: (CIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) for b.Controls[0].Op == OpS390XCMPWconst { v_0 := b.Controls[0] - if v_0.AuxInt != 0 { - break - } - v_0_0 := v_0.Args[0] - if v_0_0.Op != OpS390XLOCGR { - break - } - d := v_0_0.Aux - cmp := v_0_0.Args[2] - v_0_0_0 := v_0_0.Args[0] - if v_0_0_0.Op != OpS390XMOVDconst || v_0_0_0.AuxInt != 0 { - break - } - v_0_0_1 := v_0_0.Args[1] - if v_0_0_1.Op != OpS390XMOVDconst { - break - } - x := v_0_0_1.AuxInt + y := v_0.AuxInt + x := v_0.Args[0] c := b.Aux - if !(x != 0 && c.(s390x.CCMask) == s390x.NotEqual) { + if !(is8Bit(y)) { break } - b.Kind = BlockS390XBRC - b.ResetControls() - b.AddControl(cmp) - b.Aux = d + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered + return true + } + // match: (BRC {c} (CMPUconst x [y]) yes no) + // cond: isU8Bit(y) + // result: (CLGIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) + for b.Controls[0].Op == OpS390XCMPUconst { + v_0 := b.Controls[0] + y := v_0.AuxInt + x := v_0.Args[0] + c := b.Aux + if !(isU8Bit(y)) { + break + } + b.Reset(BlockS390XCLGIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered + return true + } + // match: (BRC {c} (CMPWUconst x [y]) yes no) + // cond: isU8Bit(y) + // result: (CLIJ {c.(s390x.CCMask)&^s390x.Unordered} x [int64(int8(y))] yes no) + for b.Controls[0].Op == OpS390XCMPWUconst { + v_0 := b.Controls[0] + y := v_0.AuxInt + x := v_0.Args[0] + c := b.Aux + if !(isU8Bit(y)) { + break + } + b.Reset(BlockS390XCLIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c.(s390x.CCMask) &^ s390x.Unordered + return true + } + // match: (BRC {s390x.Less} (CMPconst x [ 128]) yes no) + // result: (CGIJ {s390x.LessOrEqual} x [ 127] yes no) + for b.Controls[0].Op == OpS390XCMPconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 128 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.Less { + break + } + b.Reset(BlockS390XCGIJ) + b.AddControl(x) + b.AuxInt = 127 + b.Aux = s390x.LessOrEqual + return true + } + // match: (BRC {s390x.Less} (CMPWconst x [ 128]) yes no) + // result: (CIJ {s390x.LessOrEqual} x [ 127] yes no) + for b.Controls[0].Op == OpS390XCMPWconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 128 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.Less { + break + } + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = 127 + b.Aux = s390x.LessOrEqual + return true + } + // match: (BRC {s390x.LessOrEqual} (CMPconst x [-129]) yes no) + // result: (CGIJ {s390x.Less} x [-128] yes no) + for b.Controls[0].Op == OpS390XCMPconst { + v_0 := b.Controls[0] + if v_0.AuxInt != -129 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.LessOrEqual { + break + } + b.Reset(BlockS390XCGIJ) + b.AddControl(x) + b.AuxInt = -128 + b.Aux = s390x.Less + return true + } + // match: (BRC {s390x.LessOrEqual} (CMPWconst x [-129]) yes no) + // result: (CIJ {s390x.Less} x [-128] yes no) + for b.Controls[0].Op == OpS390XCMPWconst { + v_0 := b.Controls[0] + if v_0.AuxInt != -129 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.LessOrEqual { + break + } + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = -128 + b.Aux = s390x.Less + return true + } + // match: (BRC {s390x.Greater} (CMPconst x [-129]) yes no) + // result: (CGIJ {s390x.GreaterOrEqual} x [-128] yes no) + for b.Controls[0].Op == OpS390XCMPconst { + v_0 := b.Controls[0] + if v_0.AuxInt != -129 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.Greater { + break + } + b.Reset(BlockS390XCGIJ) + b.AddControl(x) + b.AuxInt = -128 + b.Aux = s390x.GreaterOrEqual + return true + } + // match: (BRC {s390x.Greater} (CMPWconst x [-129]) yes no) + // result: (CIJ {s390x.GreaterOrEqual} x [-128] yes no) + for b.Controls[0].Op == OpS390XCMPWconst { + v_0 := b.Controls[0] + if v_0.AuxInt != -129 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.Greater { + break + } + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = -128 + b.Aux = s390x.GreaterOrEqual + return true + } + // match: (BRC {s390x.GreaterOrEqual} (CMPconst x [ 128]) yes no) + // result: (CGIJ {s390x.Greater} x [ 127] yes no) + for b.Controls[0].Op == OpS390XCMPconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 128 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.GreaterOrEqual { + break + } + b.Reset(BlockS390XCGIJ) + b.AddControl(x) + b.AuxInt = 127 + b.Aux = s390x.Greater + return true + } + // match: (BRC {s390x.GreaterOrEqual} (CMPWconst x [ 128]) yes no) + // result: (CIJ {s390x.Greater} x [ 127] yes no) + for b.Controls[0].Op == OpS390XCMPWconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 128 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.GreaterOrEqual { + break + } + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = 127 + b.Aux = s390x.Greater + return true + } + // match: (BRC {s390x.Less} (CMPWUconst x [256]) yes no) + // result: (CLIJ {s390x.LessOrEqual} x [-1] yes no) + for b.Controls[0].Op == OpS390XCMPWUconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 256 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.Less { + break + } + b.Reset(BlockS390XCLIJ) + b.AddControl(x) + b.AuxInt = -1 + b.Aux = s390x.LessOrEqual + return true + } + // match: (BRC {s390x.Less} (CMPUconst x [256]) yes no) + // result: (CLGIJ {s390x.LessOrEqual} x [-1] yes no) + for b.Controls[0].Op == OpS390XCMPUconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 256 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.Less { + break + } + b.Reset(BlockS390XCLGIJ) + b.AddControl(x) + b.AuxInt = -1 + b.Aux = s390x.LessOrEqual + return true + } + // match: (BRC {s390x.GreaterOrEqual} (CMPWUconst x [256]) yes no) + // result: (CLIJ {s390x.Greater} x [-1] yes no) + for b.Controls[0].Op == OpS390XCMPWUconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 256 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.GreaterOrEqual { + break + } + b.Reset(BlockS390XCLIJ) + b.AddControl(x) + b.AuxInt = -1 + b.Aux = s390x.Greater + return true + } + // match: (BRC {s390x.GreaterOrEqual} (CMPUconst x [256]) yes no) + // result: (CLGIJ {s390x.Greater} x [-1] yes no) + for b.Controls[0].Op == OpS390XCMPUconst { + v_0 := b.Controls[0] + if v_0.AuxInt != 256 { + break + } + x := v_0.Args[0] + if b.Aux != s390x.GreaterOrEqual { + break + } + b.Reset(BlockS390XCLGIJ) + b.AddControl(x) + b.AuxInt = -1 + b.Aux = s390x.Greater return true } // match: (BRC {c} (InvertFlags cmp) yes no) @@ -36524,8 +36781,7 @@ func rewriteBlockS390X(b *Block) bool { v_0 := b.Controls[0] cmp := v_0.Args[0] c := b.Aux - b.Kind = BlockS390XBRC - b.ResetControls() + b.Reset(BlockS390XBRC) b.AddControl(cmp) b.Aux = c.(s390x.CCMask).ReverseComparison() return true @@ -36538,9 +36794,7 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Equal != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (BRC {c} (FlagLT) yes no) @@ -36551,9 +36805,7 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Less != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (BRC {c} (FlagGT) yes no) @@ -36564,9 +36816,7 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Greater != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (BRC {c} (FlagOV) yes no) @@ -36577,9 +36827,7 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Unordered != 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (BRC {c} (FlagEQ) yes no) @@ -36590,9 +36838,7 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Equal == 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36604,9 +36850,7 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Less == 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36618,9 +36862,7 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Greater == 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } @@ -36632,26 +36874,887 @@ func rewriteBlockS390X(b *Block) bool { if !(c.(s390x.CCMask)&s390x.Unordered == 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCGIJ: + // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal != 0 && int64(x) == int64( int8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal != 0 && int64(x) == int64(int8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less != 0 && int64(x) < int64( int8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less != 0 && int64(x) < int64(int8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater != 0 && int64(x) > int64( int8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater != 0 && int64(x) > int64(int8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal == 0 && int64(x) == int64( int8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal == 0 && int64(x) == int64(int8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less == 0 && int64(x) < int64( int8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less == 0 && int64(x) < int64(int8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater == 0 && int64(x) > int64( int8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater == 0 && int64(x) > int64(int8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCGRJ: + // match: (CGRJ {c} x (MOVDconst [y]) yes no) + // cond: is8Bit(y) + // result: (CGIJ {c} x [int64(int8(y))] yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(is8Bit(y)) { + break + } + b.Reset(BlockS390XCGIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c + return true + } + // match: (CGRJ {c} (MOVDconst [x]) y yes no) + // cond: is8Bit(x) + // result: (CGIJ {c.(s390x.CCMask).ReverseComparison()} y [int64(int8(x))] yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(is8Bit(x)) { + break + } + b.Reset(BlockS390XCGIJ) + b.AddControl(y) + b.AuxInt = int64(int8(x)) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CGRJ {c} x (MOVDconst [y]) yes no) + // cond: !is8Bit(y) && is32Bit(y) + // result: (BRC {c} (CMPconst x [int64(int32(y))]) yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(!is8Bit(y) && is32Bit(y)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(x.Pos, OpS390XCMPconst, types.TypeFlags) + v0.AuxInt = int64(int32(y)) + v0.AddArg(x) + b.AddControl(v0) + b.Aux = c + return true + } + // match: (CGRJ {c} (MOVDconst [x]) y yes no) + // cond: !is8Bit(x) && is32Bit(x) + // result: (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPconst y [int64(int32(x))]) yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(!is8Bit(x) && is32Bit(x)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(v_0.Pos, OpS390XCMPconst, types.TypeFlags) + v0.AuxInt = int64(int32(x)) + v0.AddArg(y) + b.AddControl(v0) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CGRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal != 0 + // result: (First yes no) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal != 0) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CGRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal == 0 + // result: (First no yes) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal == 0) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCIJ: + // match: (CIJ {c} (MOVWreg x) [y] yes no) + // result: (CIJ {c} x [y] yes no) + for b.Controls[0].Op == OpS390XMOVWreg { + v_0 := b.Controls[0] + x := v_0.Args[0] + y := b.AuxInt + c := b.Aux + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = y + b.Aux = c + return true + } + // match: (CIJ {c} (MOVWZreg x) [y] yes no) + // result: (CIJ {c} x [y] yes no) + for b.Controls[0].Op == OpS390XMOVWZreg { + v_0 := b.Controls[0] + x := v_0.Args[0] + y := b.AuxInt + c := b.Aux + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = y + b.Aux = c + return true + } + // match: (CIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal != 0 && int32(x) == int32( int8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal != 0 && int32(x) == int32(int8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less != 0 && int32(x) < int32( int8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less != 0 && int32(x) < int32(int8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater != 0 && int32(x) > int32( int8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater != 0 && int32(x) > int32(int8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal == 0 && int32(x) == int32( int8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal == 0 && int32(x) == int32(int8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less == 0 && int32(x) < int32( int8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less == 0 && int32(x) < int32(int8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater == 0 && int32(x) > int32( int8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater == 0 && int32(x) > int32(int8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCLGIJ: + // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal != 0 && uint64(x) == uint64(uint8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal != 0 && uint64(x) == uint64(uint8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less != 0 && uint64(x) < uint64(uint8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less != 0 && uint64(x) < uint64(uint8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater != 0 && uint64(x) > uint64(uint8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater != 0 && uint64(x) > uint64(uint8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal == 0 && uint64(x) == uint64(uint8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal == 0 && uint64(x) == uint64(uint8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less == 0 && uint64(x) < uint64(uint8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less == 0 && uint64(x) < uint64(uint8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater == 0 && uint64(x) > uint64(uint8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater == 0 && uint64(x) > uint64(uint8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CLGIJ {s390x.GreaterOrEqual} _ [0] yes no) + // result: (First yes no) + for { + if b.AuxInt != 0 || b.Aux != s390x.GreaterOrEqual { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLGIJ {s390x.Less} _ [0] yes no) + // result: (First no yes) + for { + if b.AuxInt != 0 || b.Aux != s390x.Less { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCLGRJ: + // match: (CLGRJ {c} x (MOVDconst [y]) yes no) + // cond: isU8Bit(y) + // result: (CLGIJ {c} x [int64(int8(y))] yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(isU8Bit(y)) { + break + } + b.Reset(BlockS390XCLGIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c + return true + } + // match: (CLGRJ {c} (MOVDconst [x]) y yes no) + // cond: isU8Bit(x) + // result: (CLGIJ {c.(s390x.CCMask).ReverseComparison()} y [int64(int8(x))] yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(isU8Bit(x)) { + break + } + b.Reset(BlockS390XCLGIJ) + b.AddControl(y) + b.AuxInt = int64(int8(x)) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CLGRJ {c} x (MOVDconst [y]) yes no) + // cond: !isU8Bit(y) && isU32Bit(y) + // result: (BRC {c} (CMPUconst x [int64(int32(y))]) yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(!isU8Bit(y) && isU32Bit(y)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(x.Pos, OpS390XCMPUconst, types.TypeFlags) + v0.AuxInt = int64(int32(y)) + v0.AddArg(x) + b.AddControl(v0) + b.Aux = c + return true + } + // match: (CLGRJ {c} (MOVDconst [x]) y yes no) + // cond: !isU8Bit(x) && isU32Bit(x) + // result: (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPUconst y [int64(int32(x))]) yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(!isU8Bit(x) && isU32Bit(x)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(v_0.Pos, OpS390XCMPUconst, types.TypeFlags) + v0.AuxInt = int64(int32(x)) + v0.AddArg(y) + b.AddControl(v0) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CLGRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal != 0 + // result: (First yes no) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal != 0) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLGRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal == 0 + // result: (First no yes) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal == 0) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCLIJ: + // match: (CLIJ {s390x.LessOrGreater} (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp) [0] yes no) + // cond: int32(x) != 0 + // result: (BRC {d} cmp yes no) + for b.Controls[0].Op == OpS390XLOCGR { + v_0 := b.Controls[0] + d := v_0.Aux + cmp := v_0.Args[2] + v_0_0 := v_0.Args[0] + if v_0_0.Op != OpS390XMOVDconst || v_0_0.AuxInt != 0 { + break + } + v_0_1 := v_0.Args[1] + if v_0_1.Op != OpS390XMOVDconst { + break + } + x := v_0_1.AuxInt + if b.AuxInt != 0 || b.Aux != s390x.LessOrGreater || !(int32(x) != 0) { + break + } + b.Reset(BlockS390XBRC) + b.AddControl(cmp) + b.Aux = d + return true + } + // match: (CLIJ {c} (MOVWreg x) [y] yes no) + // result: (CLIJ {c} x [y] yes no) + for b.Controls[0].Op == OpS390XMOVWreg { + v_0 := b.Controls[0] + x := v_0.Args[0] + y := b.AuxInt + c := b.Aux + b.Reset(BlockS390XCLIJ) + b.AddControl(x) + b.AuxInt = y + b.Aux = c + return true + } + // match: (CLIJ {c} (MOVWZreg x) [y] yes no) + // result: (CLIJ {c} x [y] yes no) + for b.Controls[0].Op == OpS390XMOVWZreg { + v_0 := b.Controls[0] + x := v_0.Args[0] + y := b.AuxInt + c := b.Aux + b.Reset(BlockS390XCLIJ) + b.AddControl(x) + b.AuxInt = y + b.Aux = c + return true + } + // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal != 0 && uint32(x) == uint32(uint8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal != 0 && uint32(x) == uint32(uint8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less != 0 && uint32(x) < uint32(uint8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less != 0 && uint32(x) < uint32(uint8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater != 0 && uint32(x) > uint32(uint8(y)) + // result: (First yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater != 0 && uint32(x) > uint32(uint8(y))) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Equal == 0 && uint32(x) == uint32(uint8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Equal == 0 && uint32(x) == uint32(uint8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Less == 0 && uint32(x) < uint32(uint8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Less == 0 && uint32(x) < uint32(uint8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) + // cond: c.(s390x.CCMask)&s390x.Greater == 0 && uint32(x) > uint32(uint8(y)) + // result: (First no yes) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.AuxInt + c := b.Aux + if !(c.(s390x.CCMask)&s390x.Greater == 0 && uint32(x) > uint32(uint8(y))) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + // match: (CLIJ {s390x.GreaterOrEqual} _ [0] yes no) + // result: (First yes no) + for { + if b.AuxInt != 0 || b.Aux != s390x.GreaterOrEqual { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLIJ {s390x.Less} _ [0] yes no) + // result: (First no yes) + for { + if b.AuxInt != 0 || b.Aux != s390x.Less { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCLRJ: + // match: (CLRJ {c} x (MOVDconst [y]) yes no) + // cond: isU8Bit(y) + // result: (CLIJ {c} x [int64(int8(y))] yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(isU8Bit(y)) { + break + } + b.Reset(BlockS390XCLIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c + return true + } + // match: (CLRJ {c} (MOVDconst [x]) y yes no) + // cond: isU8Bit(x) + // result: (CLIJ {c.(s390x.CCMask).ReverseComparison()} y [int64(int8(x))] yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(isU8Bit(x)) { + break + } + b.Reset(BlockS390XCLIJ) + b.AddControl(y) + b.AuxInt = int64(int8(x)) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CLRJ {c} x (MOVDconst [y]) yes no) + // cond: !isU8Bit(y) && isU32Bit(y) + // result: (BRC {c} (CMPWUconst x [int64(int32(y))]) yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(!isU8Bit(y) && isU32Bit(y)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(x.Pos, OpS390XCMPWUconst, types.TypeFlags) + v0.AuxInt = int64(int32(y)) + v0.AddArg(x) + b.AddControl(v0) + b.Aux = c + return true + } + // match: (CLRJ {c} (MOVDconst [x]) y yes no) + // cond: !isU8Bit(x) && isU32Bit(x) + // result: (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPWUconst y [int64(int32(x))]) yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(!isU8Bit(x) && isU32Bit(x)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(v_0.Pos, OpS390XCMPWUconst, types.TypeFlags) + v0.AuxInt = int64(int32(x)) + v0.AddArg(y) + b.AddControl(v0) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CLRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal != 0 + // result: (First yes no) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal != 0) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CLRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal == 0 + // result: (First no yes) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal == 0) { + break + } + b.Reset(BlockFirst) + b.swapSuccessors() + return true + } + case BlockS390XCRJ: + // match: (CRJ {c} x (MOVDconst [y]) yes no) + // cond: is8Bit(y) + // result: (CIJ {c} x [int64(int8(y))] yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(is8Bit(y)) { + break + } + b.Reset(BlockS390XCIJ) + b.AddControl(x) + b.AuxInt = int64(int8(y)) + b.Aux = c + return true + } + // match: (CRJ {c} (MOVDconst [x]) y yes no) + // cond: is8Bit(x) + // result: (CIJ {c.(s390x.CCMask).ReverseComparison()} y [int64(int8(x))] yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(is8Bit(x)) { + break + } + b.Reset(BlockS390XCIJ) + b.AddControl(y) + b.AuxInt = int64(int8(x)) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CRJ {c} x (MOVDconst [y]) yes no) + // cond: !is8Bit(y) && is32Bit(y) + // result: (BRC {c} (CMPWconst x [int64(int32(y))]) yes no) + for b.Controls[1].Op == OpS390XMOVDconst { + x := b.Controls[0] + v_1 := b.Controls[1] + y := v_1.AuxInt + c := b.Aux + if !(!is8Bit(y) && is32Bit(y)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(x.Pos, OpS390XCMPWconst, types.TypeFlags) + v0.AuxInt = int64(int32(y)) + v0.AddArg(x) + b.AddControl(v0) + b.Aux = c + return true + } + // match: (CRJ {c} (MOVDconst [x]) y yes no) + // cond: !is8Bit(x) && is32Bit(x) + // result: (BRC {c.(s390x.CCMask).ReverseComparison()} (CMPWconst y [int64(int32(x))]) yes no) + for b.Controls[0].Op == OpS390XMOVDconst { + v_0 := b.Controls[0] + x := v_0.AuxInt + y := b.Controls[1] + c := b.Aux + if !(!is8Bit(x) && is32Bit(x)) { + break + } + b.Reset(BlockS390XBRC) + v0 := b.NewValue0(v_0.Pos, OpS390XCMPWconst, types.TypeFlags) + v0.AuxInt = int64(int32(x)) + v0.AddArg(y) + b.AddControl(v0) + b.Aux = c.(s390x.CCMask).ReverseComparison() + return true + } + // match: (CRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal != 0 + // result: (First yes no) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal != 0) { + break + } + b.Reset(BlockFirst) + return true + } + // match: (CRJ {c} x y yes no) + // cond: x == y && c.(s390x.CCMask)&s390x.Equal == 0 + // result: (First no yes) + for { + x := b.Controls[0] + y := b.Controls[1] + c := b.Aux + if !(x == y && c.(s390x.CCMask)&s390x.Equal == 0) { + break + } + b.Reset(BlockFirst) b.swapSuccessors() return true } case BlockIf: // match: (If cond yes no) - // result: (BRC {s390x.NotEqual} (CMPWconst [0] (MOVBZreg cond)) yes no) + // result: (CLIJ {s390x.LessOrGreater} (MOVBZreg cond) [0] yes no) for { cond := b.Controls[0] - b.Kind = BlockS390XBRC - b.ResetControls() - v0 := b.NewValue0(cond.Pos, OpS390XCMPWconst, types.TypeFlags) - v0.AuxInt = 0 - v1 := b.NewValue0(cond.Pos, OpS390XMOVBZreg, typ.Bool) - v1.AddArg(cond) - v0.AddArg(v1) + b.Reset(BlockS390XCLIJ) + v0 := b.NewValue0(cond.Pos, OpS390XMOVBZreg, typ.Bool) + v0.AddArg(cond) b.AddControl(v0) - b.Aux = s390x.NotEqual + b.AuxInt = 0 + b.Aux = s390x.LessOrGreater return true } } diff --git a/src/cmd/compile/internal/ssa/rewritegeneric.go b/src/cmd/compile/internal/ssa/rewritegeneric.go index 091dff60be5..d7e7974e2bb 100644 --- a/src/cmd/compile/internal/ssa/rewritegeneric.go +++ b/src/cmd/compile/internal/ssa/rewritegeneric.go @@ -47414,10 +47414,8 @@ func rewriteBlockgeneric(b *Block) bool { for b.Controls[0].Op == OpNot { v_0 := b.Controls[0] cond := v_0.Args[0] - b.Kind = BlockIf - b.ResetControls() + b.Reset(BlockIf) b.AddControl(cond) - b.Aux = nil b.swapSuccessors() return true } @@ -47430,9 +47428,7 @@ func rewriteBlockgeneric(b *Block) bool { if !(c == 1) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) return true } // match: (If (ConstBool [c]) yes no) @@ -47444,9 +47440,7 @@ func rewriteBlockgeneric(b *Block) bool { if !(c == 0) { break } - b.Kind = BlockFirst - b.ResetControls() - b.Aux = nil + b.Reset(BlockFirst) b.swapSuccessors() return true } diff --git a/src/cmd/compile/internal/ssa/sizeof_test.go b/src/cmd/compile/internal/ssa/sizeof_test.go index 8ba6a88b662..60ada011e3e 100644 --- a/src/cmd/compile/internal/ssa/sizeof_test.go +++ b/src/cmd/compile/internal/ssa/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package ssa import ( @@ -23,7 +21,7 @@ func TestSizeof(t *testing.T) { _64bit uintptr // size on 64bit platforms }{ {Value{}, 72, 112}, - {Block{}, 156, 296}, + {Block{}, 164, 304}, {LocalSlot{}, 32, 48}, {valState{}, 28, 40}, } diff --git a/src/cmd/compile/internal/ssa/writebarrier.go b/src/cmd/compile/internal/ssa/writebarrier.go index 4c51f9c7884..d246fb333c8 100644 --- a/src/cmd/compile/internal/ssa/writebarrier.go +++ b/src/cmd/compile/internal/ssa/writebarrier.go @@ -8,15 +8,19 @@ import ( "cmd/compile/internal/types" "cmd/internal/obj" "cmd/internal/src" + "fmt" "strings" ) -// A ZeroRegion records a range of an object which is known to be zero. +// A ZeroRegion records parts of an object which are known to be zero. // A ZeroRegion only applies to a single memory state. +// Each bit in mask is set if the corresponding pointer-sized word of +// the base object is known to be zero. +// In other words, if mask & (1<= z.min && off+size <= z.max { - return false + ptrSize := v.Block.Func.Config.PtrSize + if off%ptrSize != 0 || size%ptrSize != 0 { + v.Fatalf("unaligned pointer write") } + if off < 0 || off+size > 64*ptrSize { + // write goes off end of tracked offsets + return true + } + z := zeroes[v.MemoryArg().ID] + if ptr != z.base { + return true + } + for i := off; i < off+size; i += ptrSize { + if z.mask>>uint(i/ptrSize)&1 == 0 { + return true // not known to be zero + } + } + // All written locations are known to be zero - write barrier not needed. + return false } return true } @@ -375,10 +394,11 @@ func writebarrier(f *Func) { // computeZeroMap returns a map from an ID of a memory value to // a set of locations that are known to be zeroed at that memory value. func (f *Func) computeZeroMap() map[ID]ZeroRegion { + ptrSize := f.Config.PtrSize // Keep track of which parts of memory are known to be zero. // This helps with removing write barriers for various initialization patterns. // This analysis is conservative. We only keep track, for each memory state, of - // a single constant range of a single object which is known to be zero. + // which of the first 64 words of a single object are known to be zero. zeroes := map[ID]ZeroRegion{} // Find new objects. for _, b := range f.Blocks { @@ -388,7 +408,11 @@ func (f *Func) computeZeroMap() map[ID]ZeroRegion { } mem := v.MemoryArg() if IsNewObject(v, mem) { - zeroes[mem.ID] = ZeroRegion{v, 0, v.Type.Elem().Size()} + nptr := v.Type.Elem().Size() / ptrSize + if nptr > 64 { + nptr = 64 + } + zeroes[mem.ID] = ZeroRegion{base: v, mask: 1< z.max { - // Writing, at least partially, outside the known zeroes. - // We could salvage some zero information, but probably - // not worth it. + // Round to cover any partially written pointer slots. + // Pointer writes should never be unaligned like this, but non-pointer + // writes to pointer-containing types will do this. + if d := off % ptrSize; d != 0 { + off -= d + size += d + } + if d := size % ptrSize; d != 0 { + size += ptrSize - d + } + // Clip to the 64 words that we track. + min := off + max := off + size + if min < 0 { + min = 0 + } + if max > 64*ptrSize { + max = 64 * ptrSize + } + // Clear bits for parts that we are writing (and hence + // will no longer necessarily be zero). + for i := min; i < max; i += ptrSize { + bit := i / ptrSize + z.mask &^= 1 << uint(bit) + } + if z.mask == 0 { + // No more known zeros - don't bother keeping. continue } - // We now know we're storing to a zeroed area. - // We need to make a smaller zero range for the result of this store. - if off == z.min { - z.min += size - } else if off+size == z.max { - z.max -= size - } else { - // The store splits the known zero range in two. - // Keep track of the upper one, as we tend to initialize - // things in increasing memory order. - // TODO: keep track of larger one instead? - z.min = off + size - } - // Save updated zero range. + // Save updated known zero contents for new store. if zeroes[v.ID] != z { zeroes[v.ID] = z changed = true @@ -450,6 +484,12 @@ func (f *Func) computeZeroMap() map[ID]ZeroRegion { break } } + if f.pass.debug > 0 { + fmt.Printf("func %s\n", f.Name) + for mem, z := range zeroes { + fmt.Printf(" memory=v%d ptr=%v zeromask=%b\n", mem, z.base, z.mask) + } + } return zeroes } @@ -512,20 +552,23 @@ func IsGlobalAddr(v *Value) bool { if v.Op == OpConstNil { return true } + if v.Op == OpLoad && IsReadOnlyGlobalAddr(v.Args[0]) { + return true // loading from a read-only global - the resulting address can't be a heap address. + } return false } // IsReadOnlyGlobalAddr reports whether v is known to be an address of a read-only global. func IsReadOnlyGlobalAddr(v *Value) bool { - if !IsGlobalAddr(v) { - return false - } if v.Op == OpConstNil { // Nil pointers are read only. See issue 33438. return true } // See TODO in OpAddr case in IsSanitizerSafeAddr below. - return strings.HasPrefix(v.Aux.(*obj.LSym).Name, `""..stmp_`) + if v.Op == OpAddr && strings.HasPrefix(v.Aux.(*obj.LSym).Name, `""..stmp_`) { + return true + } + return false } // IsNewObject reports whether v is a pointer to a freshly allocated & zeroed object at memory state mem. diff --git a/src/cmd/compile/internal/types/sizeof_test.go b/src/cmd/compile/internal/types/sizeof_test.go index 09b852f3433..ea947d8f417 100644 --- a/src/cmd/compile/internal/types/sizeof_test.go +++ b/src/cmd/compile/internal/types/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package types import ( diff --git a/src/cmd/compile/internal/x86/ggen.go b/src/cmd/compile/internal/x86/ggen.go index 86bb782aab3..f247180a2ea 100644 --- a/src/cmd/compile/internal/x86/ggen.go +++ b/src/cmd/compile/internal/x86/ggen.go @@ -23,7 +23,7 @@ func zerorange(pp *gc.Progs, p *obj.Prog, off, cnt int64, ax *uint32) *obj.Prog for i := int64(0); i < cnt; i += int64(gc.Widthreg) { p = pp.Appendpp(p, x86.AMOVL, obj.TYPE_REG, x86.REG_AX, 0, obj.TYPE_MEM, x86.REG_SP, off+i) } - } else if !gc.Nacl && cnt <= int64(128*gc.Widthreg) { + } else if cnt <= int64(128*gc.Widthreg) { p = pp.Appendpp(p, x86.ALEAL, obj.TYPE_MEM, x86.REG_SP, off, obj.TYPE_REG, x86.REG_DI, 0) p = pp.Appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_ADDR, 0, 1*(128-cnt/int64(gc.Widthreg))) p.To.Sym = gc.Duffzero diff --git a/src/cmd/compile/main.go b/src/cmd/compile/main.go index bf4289e8f1c..e3ec3361f9e 100644 --- a/src/cmd/compile/main.go +++ b/src/cmd/compile/main.go @@ -24,7 +24,6 @@ import ( var archInits = map[string]func(*gc.Arch){ "386": x86.Init, "amd64": amd64.Init, - "amd64p32": amd64.Init, "arm": arm.Init, "arm64": arm64.Init, "mips": mips.Init, diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 9e503117ae6..ea290b10690 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -61,7 +61,6 @@ var ( var okgoarch = []string{ "386", "amd64", - "amd64p32", "arm", "arm64", "mips", @@ -86,7 +85,7 @@ var okgoos = []string{ "android", "solaris", "freebsd", - "nacl", + "nacl", // keep; "netbsd", "openbsd", "plan9", @@ -1505,9 +1504,6 @@ var cgoEnabled = map[string]bool{ "android/arm": true, "android/arm64": true, "js/wasm": false, - "nacl/386": false, - "nacl/amd64p32": false, - "nacl/arm": false, "netbsd/386": true, "netbsd/amd64": true, "netbsd/arm": true, diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 3be9754e674..273ef2e19ac 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -703,7 +703,7 @@ func (t *tester) registerTests() { // Doc tests only run on builders. // They find problems approximately never. - if t.hasBash() && goos != "nacl" && goos != "js" && goos != "android" && !t.iOS() && os.Getenv("GO_BUILDER_NAME") != "" { + if t.hasBash() && goos != "js" && goos != "android" && !t.iOS() && os.Getenv("GO_BUILDER_NAME") != "" { t.registerTest("doc_progs", "../doc/progs", "time", "go", "run", "run.go") t.registerTest("wiki", "../doc/articles/wiki", "./test.bash") t.registerTest("codewalk", "../doc/codewalk", "time", "./run") @@ -735,7 +735,7 @@ func (t *tester) registerTests() { }) } } - if goos != "nacl" && goos != "android" && !t.iOS() && goos != "js" { + if goos != "android" && !t.iOS() && goos != "js" { t.tests = append(t.tests, distTest{ name: "api", heading: "API check", diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go index e6a3887a72d..b9e8a513d96 100644 --- a/src/cmd/dist/util.go +++ b/src/cmd/dist/util.go @@ -383,10 +383,6 @@ func xsamefile(f1, f2 string) bool { } func xgetgoarm() string { - if goos == "nacl" { - // NaCl guarantees VFPv3 and is always cross-compiled. - return "7" - } if goos == "darwin" || goos == "android" { // Assume all darwin/arm and android devices have VFPv3. // These ports are also mostly cross-compiled, so it makes little diff --git a/src/cmd/doc/dirs.go b/src/cmd/doc/dirs.go index c6f5cd9af85..0f990f70175 100644 --- a/src/cmd/doc/dirs.go +++ b/src/cmd/doc/dirs.go @@ -162,7 +162,15 @@ func findCodeRoots() []Dir { // Check for use of modules by 'go env GOMOD', // which reports a go.mod file path if modules are enabled. stdout, _ := exec.Command("go", "env", "GOMOD").Output() - usingModules = len(bytes.TrimSpace(stdout)) > 0 + gomod := string(bytes.TrimSpace(stdout)) + usingModules = len(gomod) > 0 + if gomod == os.DevNull { + // Modules are enabled, but the working directory is outside any module. + // We can still access std, cmd, and packages specified as source files + // on the command line, but there are no module roots. + // Avoid 'go list -m all' below, since it will not work. + return list + } } if !usingModules { diff --git a/src/cmd/doc/doc_test.go b/src/cmd/doc/doc_test.go index 7bc5842cc6a..ef8152b0362 100644 --- a/src/cmd/doc/doc_test.go +++ b/src/cmd/doc/doc_test.go @@ -33,9 +33,6 @@ func TestMain(m *testing.M) { } func maybeSkip(t *testing.T) { - if strings.HasPrefix(runtime.GOOS, "nacl") { - t.Skip("nacl does not have a full file tree") - } if runtime.GOOS == "darwin" && strings.HasPrefix(runtime.GOARCH, "arm") { t.Skip("darwin/arm does not have a full file tree") } diff --git a/src/cmd/doc/main.go b/src/cmd/doc/main.go index dd15e801fb9..0f817b612ba 100644 --- a/src/cmd/doc/main.go +++ b/src/cmd/doc/main.go @@ -231,8 +231,8 @@ func parseArgs(args []string) (pkg *build.Package, path, symbol string, more boo // First, is it a complete package path as it is? If so, we are done. // This avoids confusion over package paths that have other // package paths as their prefix. - pkg, err = build.Import(arg, wd, build.ImportComment) - if err == nil { + pkg, importErr := build.Import(arg, wd, build.ImportComment) + if importErr == nil { return pkg, arg, "", false } // Another disambiguator: If the symbol starts with an upper @@ -286,7 +286,18 @@ func parseArgs(args []string) (pkg *build.Package, path, symbol string, more boo } // If it has a slash, we've failed. if slash >= 0 { - log.Fatalf("no such package %s", arg[0:period]) + // build.Import should always include the path in its error message, + // and we should avoid repeating it. Unfortunately, build.Import doesn't + // return a structured error. That can't easily be fixed, since it + // invokes 'go list' and returns the error text from the loaded package. + // TODO(golang.org/issue/34750): load using golang.org/x/tools/go/packages + // instead of go/build. + importErrStr := importErr.Error() + if strings.Contains(importErrStr, arg[:period]) { + log.Fatal(importErrStr) + } else { + log.Fatalf("no such package %s: %s", arg[:period], importErrStr) + } } // Guess it's a symbol in the current directory. return importDir(wd), "", arg, false diff --git a/src/cmd/go.mod b/src/cmd/go.mod index d8172ad2f52..e4a2eaa9082 100644 --- a/src/cmd/go.mod +++ b/src/cmd/go.mod @@ -1,6 +1,6 @@ module cmd -go 1.12 +go 1.14 require ( github.com/google/pprof v0.0.0-20190515194954-54271f7e092f diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 115eec4167f..2561f5b2f8d 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -435,6 +435,9 @@ // The -n flag prints commands that would be executed. // The -x flag prints commands as they are executed. // +// The -mod flag's value sets which module download mode +// to use: readonly or vendor. See 'go help modules' for more. +// // To run gofmt with specific options, run gofmt itself. // // See also: go fix, go vet. @@ -1235,7 +1238,7 @@ // If the -exec flag is not given, GOOS or GOARCH is different from the system // default, and a program named go_$GOOS_$GOARCH_exec can be found // on the current search path, 'go run' invokes the binary using that program, -// for example 'go_nacl_386_exec a.out arguments...'. This allows execution of +// for example 'go_js_wasm_exec a.out arguments...'. This allows execution of // cross-compiled programs when a simulator or other execution method is // available. // diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 71a2e01fa34..e4cf953b9e5 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -56,7 +56,7 @@ func tooSlow(t *testing.T) { func init() { switch runtime.GOOS { - case "android", "js", "nacl": + case "android", "js": canRun = false case "darwin": switch runtime.GOARCH { @@ -5604,7 +5604,7 @@ func TestTestCacheInputs(t *testing.T) { tg.grepStdout(`\(cached\)`, "did not cache") switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": // no shell scripts default: tg.run("test", "testcache", "-run=Exec") diff --git a/src/cmd/go/help_test.go b/src/cmd/go/help_test.go index 9c0fa8411ee..9bcab820ce6 100644 --- a/src/cmd/go/help_test.go +++ b/src/cmd/go/help_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package main_test import ( diff --git a/src/cmd/go/internal/base/flag.go b/src/cmd/go/internal/base/flag.go index 5e03e640588..6727196816b 100644 --- a/src/cmd/go/internal/base/flag.go +++ b/src/cmd/go/internal/base/flag.go @@ -33,3 +33,8 @@ func AddBuildFlagsNX(flags *flag.FlagSet) { flags.BoolVar(&cfg.BuildN, "n", false, "") flags.BoolVar(&cfg.BuildX, "x", false, "") } + +// AddLoadFlags adds the -mod build flag to the flag set. +func AddLoadFlags(flags *flag.FlagSet) { + flags.StringVar(&cfg.BuildMod, "mod", "", "") +} diff --git a/src/cmd/go/internal/base/signal_unix.go b/src/cmd/go/internal/base/signal_unix.go index c109eecadb3..342775a1182 100644 --- a/src/cmd/go/internal/base/signal_unix.go +++ b/src/cmd/go/internal/base/signal_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js linux netbsd openbsd solaris package base diff --git a/src/cmd/go/internal/fmtcmd/fmt.go b/src/cmd/go/internal/fmtcmd/fmt.go index 8e4ef372816..408af52ffa0 100644 --- a/src/cmd/go/internal/fmtcmd/fmt.go +++ b/src/cmd/go/internal/fmtcmd/fmt.go @@ -22,6 +22,7 @@ import ( func init() { base.AddBuildFlagsNX(&CmdFmt.Flag) + base.AddLoadFlags(&CmdFmt.Flag) } var CmdFmt = &base.Command{ @@ -38,6 +39,9 @@ For more about specifying packages, see 'go help packages'. The -n flag prints commands that would be executed. The -x flag prints commands as they are executed. +The -mod flag's value sets which module download mode +to use: readonly or vendor. See 'go help modules' for more. + To run gofmt with specific options, run gofmt itself. See also: go fix, go vet. @@ -68,7 +72,7 @@ func runFmt(cmd *base.Command, args []string) { continue } if pkg.Error != nil { - if strings.HasPrefix(pkg.Error.Err, "build constraints exclude all Go files") { + if strings.HasPrefix(pkg.Error.Err.Error(), "build constraints exclude all Go files") { // Skip this error, as we will format // all files regardless. } else { diff --git a/src/cmd/go/internal/get/get.go b/src/cmd/go/internal/get/get.go index 44fd316f353..421f1bab758 100644 --- a/src/cmd/go/internal/get/get.go +++ b/src/cmd/go/internal/get/get.go @@ -274,7 +274,7 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int) stk.Push(arg) err := downloadPackage(p) if err != nil { - base.Errorf("%s", &load.PackageError{ImportStack: stk.Copy(), Err: err.Error()}) + base.Errorf("%s", &load.PackageError{ImportStack: stk.Copy(), Err: err}) stk.Pop() return } @@ -355,7 +355,7 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int) stk.Push(path) err := &load.PackageError{ ImportStack: stk.Copy(), - Err: "must be imported as " + path[j+len("vendor/"):], + Err: load.ImportErrorf(path, "%s must be imported as %s", path, path[j+len("vendor/"):]), } stk.Pop() base.Errorf("%s", err) diff --git a/src/cmd/go/internal/imports/build.go b/src/cmd/go/internal/imports/build.go index 3e9fe357e07..eb070eef4c1 100644 --- a/src/cmd/go/internal/imports/build.go +++ b/src/cmd/go/internal/imports/build.go @@ -210,7 +210,7 @@ var KnownOS = map[string]bool{ "illumos": true, "js": true, "linux": true, - "nacl": true, + "nacl": true, // legacy; don't remove "netbsd": true, "openbsd": true, "plan9": true, @@ -222,7 +222,7 @@ var KnownOS = map[string]bool{ var KnownArch = map[string]bool{ "386": true, "amd64": true, - "amd64p32": true, + "amd64p32": true, // legacy; don't remove "arm": true, "armbe": true, "arm64": true, diff --git a/src/cmd/go/internal/list/list.go b/src/cmd/go/internal/list/list.go index 67819939e60..d8c75776bba 100644 --- a/src/cmd/go/internal/list/list.go +++ b/src/cmd/go/internal/list/list.go @@ -384,6 +384,9 @@ func runList(cmd *base.Command, args []string) { if modload.Init(); !modload.Enabled() { base.Fatalf("go list -m: not using modules") } + if cfg.BuildMod == "vendor" { + base.Fatalf("go list -m: can't list modules with -mod=vendor\n\tuse -mod=mod or -mod=readonly to ignore the vendor directory") + } modload.LoadBuildList() mods := modload.ListModules(args, *listU, *listVersions) diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index 115bc29694f..6b8ecc46b17 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -7,6 +7,7 @@ package load import ( "bytes" + "encoding/json" "errors" "fmt" "go/build" @@ -304,9 +305,9 @@ func (p *Package) copyBuild(pp *build.Package) { type PackageError struct { ImportStack []string // shortest path from package named on command line to this one Pos string // position of error - Err string // the error itself - IsImportCycle bool `json:"-"` // the error is an import cycle - Hard bool `json:"-"` // whether the error is soft or hard; soft errors are ignored in some places + Err error // the error itself + IsImportCycle bool // the error is an import cycle + Hard bool // whether the error is soft or hard; soft errors are ignored in some places } func (p *PackageError) Error() string { @@ -317,12 +318,77 @@ func (p *PackageError) Error() string { if p.Pos != "" { // Omit import stack. The full path to the file where the error // is the most important thing. - return p.Pos + ": " + p.Err + return p.Pos + ": " + p.Err.Error() } - if len(p.ImportStack) == 0 { - return p.Err + + // If the error is an ImportPathError, and the last path on the stack appears + // in the error message, omit that path from the stack to avoid repetition. + // If an ImportPathError wraps another ImportPathError that matches the + // last path on the stack, we don't omit the path. An error like + // "package A imports B: error loading C caused by B" would not be clearer + // if "imports B" were omitted. + stack := p.ImportStack + var ierr ImportPathError + if len(stack) > 0 && errors.As(p.Err, &ierr) && ierr.ImportPath() == stack[len(stack)-1] { + stack = stack[:len(stack)-1] } - return "package " + strings.Join(p.ImportStack, "\n\timports ") + ": " + p.Err + if len(stack) == 0 { + return p.Err.Error() + } + return "package " + strings.Join(stack, "\n\timports ") + ": " + p.Err.Error() +} + +// PackageError implements MarshalJSON so that Err is marshaled as a string +// and non-essential fields are omitted. +func (p *PackageError) MarshalJSON() ([]byte, error) { + perr := struct { + ImportStack []string + Pos string + Err string + }{p.ImportStack, p.Pos, p.Err.Error()} + return json.Marshal(perr) +} + +// ImportPathError is a type of error that prevents a package from being loaded +// for a given import path. When such a package is loaded, a *Package is +// returned with Err wrapping an ImportPathError: the error is attached to +// the imported package, not the importing package. +// +// The string returned by ImportPath must appear in the string returned by +// Error. Errors that wrap ImportPathError (such as PackageError) may omit +// the import path. +type ImportPathError interface { + error + ImportPath() string +} + +type importError struct { + importPath string + err error // created with fmt.Errorf +} + +var _ ImportPathError = (*importError)(nil) + +func ImportErrorf(path, format string, args ...interface{}) ImportPathError { + err := &importError{importPath: path, err: fmt.Errorf(format, args...)} + if errStr := err.Error(); !strings.Contains(errStr, path) { + panic(fmt.Sprintf("path %q not in error %q", path, errStr)) + } + return err +} + +func (e *importError) Error() string { + return e.err.Error() +} + +func (e *importError) Unwrap() error { + // Don't return e.err directly, since we're only wrapping an error if %w + // was passed to ImportErrorf. + return errors.Unwrap(e.err) +} + +func (e *importError) ImportPath() string { + return e.importPath } // An ImportStack is a stack of import paths, possibly with the suffix " (test)" appended. @@ -489,7 +555,7 @@ func loadImport(pre *preload, path, srcDir string, parent *Package, stk *ImportS ImportPath: path, Error: &PackageError{ ImportStack: stk.Copy(), - Err: err.Error(), + Err: err, }, }, } @@ -516,7 +582,7 @@ func loadImport(pre *preload, path, srcDir string, parent *Package, stk *ImportS if !cfg.ModulesEnabled && path != cleanImport(path) { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("non-canonical import path: %q should be %q", path, pathpkg.Clean(path)), + Err: fmt.Errorf("non-canonical import path: %q should be %q", path, pathpkg.Clean(path)), } p.Incomplete = true } @@ -536,20 +602,22 @@ func loadImport(pre *preload, path, srcDir string, parent *Package, stk *ImportS perr := *p perr.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("import %q is a program, not an importable package", path), + Err: ImportErrorf(path, "import %q is a program, not an importable package", path), } return setErrorPos(&perr, importPos) } if p.Internal.Local && parent != nil && !parent.Internal.Local { perr := *p - errMsg := fmt.Sprintf("local import %q in non-local package", path) + var err error if path == "." { - errMsg = "cannot import current directory" + err = ImportErrorf(path, "%s: cannot import current directory", path) + } else { + err = ImportErrorf(path, "local import %q in non-local package", path) } perr.Error = &PackageError{ ImportStack: stk.Copy(), - Err: errMsg, + Err: err, } return setErrorPos(&perr, importPos) } @@ -1125,7 +1193,7 @@ func reusePackage(p *Package, stk *ImportStack) *Package { if p.Error == nil { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: "import cycle not allowed", + Err: errors.New("import cycle not allowed"), IsImportCycle: true, } } @@ -1228,7 +1296,7 @@ func disallowInternal(srcDir string, importer *Package, importerPath string, p * perr := *p perr.Error = &PackageError{ ImportStack: stk.Copy(), - Err: "use of internal package " + p.ImportPath + " not allowed", + Err: ImportErrorf(p.ImportPath, "use of internal package "+p.ImportPath+" not allowed"), } perr.Incomplete = true return &perr @@ -1275,7 +1343,7 @@ func disallowVendor(srcDir string, importer *Package, importerPath, path string, perr := *p perr.Error = &PackageError{ ImportStack: stk.Copy(), - Err: "must be imported as " + path[i+len("vendor/"):], + Err: ImportErrorf(path, "%s must be imported as %s", path, path[i+len("vendor/"):]), } perr.Incomplete = true return &perr @@ -1329,7 +1397,7 @@ func disallowVendorVisibility(srcDir string, p *Package, stk *ImportStack) *Pack perr := *p perr.Error = &PackageError{ ImportStack: stk.Copy(), - Err: "use of vendored package not allowed", + Err: errors.New("use of vendored package not allowed"), } perr.Incomplete = true return &perr @@ -1455,7 +1523,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { err = base.ExpandScanner(err) p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: err.Error(), + Err: err, } return } @@ -1472,7 +1540,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { // Report an error when the old code.google.com/p/go.tools paths are used. if InstallTargetDir(p) == StalePath { newPath := strings.Replace(p.ImportPath, "code.google.com/p/go.", "golang.org/x/", 1) - e := fmt.Sprintf("the %v command has moved; use %v instead.", p.ImportPath, newPath) + e := ImportErrorf(p.ImportPath, "the %v command has moved; use %v instead.", p.ImportPath, newPath) p.Error = &PackageError{Err: e} return } @@ -1585,7 +1653,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { if f1 != "" { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("case-insensitive file name collision: %q and %q", f1, f2), + Err: fmt.Errorf("case-insensitive file name collision: %q and %q", f1, f2), } return } @@ -1601,7 +1669,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { if !SafeArg(file) || strings.HasPrefix(file, "_cgo_") { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("invalid input file name %q", file), + Err: fmt.Errorf("invalid input file name %q", file), } return } @@ -1609,14 +1677,14 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { if name := pathpkg.Base(p.ImportPath); !SafeArg(name) { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("invalid input directory name %q", name), + Err: fmt.Errorf("invalid input directory name %q", name), } return } if !SafeArg(p.ImportPath) { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: fmt.Sprintf("invalid import path %q", p.ImportPath), + Err: ImportErrorf(p.ImportPath, "invalid import path %q", p.ImportPath), } return } @@ -1662,31 +1730,31 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { // code; see issue #16050). } - setError := func(msg string) { + setError := func(err error) { p.Error = &PackageError{ ImportStack: stk.Copy(), - Err: msg, + Err: err, } } // The gc toolchain only permits C source files with cgo or SWIG. if len(p.CFiles) > 0 && !p.UsesCgo() && !p.UsesSwig() && cfg.BuildContext.Compiler == "gc" { - setError(fmt.Sprintf("C source files not allowed when not using cgo or SWIG: %s", strings.Join(p.CFiles, " "))) + setError(fmt.Errorf("C source files not allowed when not using cgo or SWIG: %s", strings.Join(p.CFiles, " "))) return } // C++, Objective-C, and Fortran source files are permitted only with cgo or SWIG, // regardless of toolchain. if len(p.CXXFiles) > 0 && !p.UsesCgo() && !p.UsesSwig() { - setError(fmt.Sprintf("C++ source files not allowed when not using cgo or SWIG: %s", strings.Join(p.CXXFiles, " "))) + setError(fmt.Errorf("C++ source files not allowed when not using cgo or SWIG: %s", strings.Join(p.CXXFiles, " "))) return } if len(p.MFiles) > 0 && !p.UsesCgo() && !p.UsesSwig() { - setError(fmt.Sprintf("Objective-C source files not allowed when not using cgo or SWIG: %s", strings.Join(p.MFiles, " "))) + setError(fmt.Errorf("Objective-C source files not allowed when not using cgo or SWIG: %s", strings.Join(p.MFiles, " "))) return } if len(p.FFiles) > 0 && !p.UsesCgo() && !p.UsesSwig() { - setError(fmt.Sprintf("Fortran source files not allowed when not using cgo or SWIG: %s", strings.Join(p.FFiles, " "))) + setError(fmt.Errorf("Fortran source files not allowed when not using cgo or SWIG: %s", strings.Join(p.FFiles, " "))) return } @@ -1695,7 +1763,7 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) { if other := foldPath[fold]; other == "" { foldPath[fold] = p.ImportPath } else if other != p.ImportPath { - setError(fmt.Sprintf("case-insensitive import collision: %q and %q", p.ImportPath, other)) + setError(ImportErrorf(p.ImportPath, "case-insensitive import collision: %q and %q", p.ImportPath, other)) return } @@ -2102,7 +2170,7 @@ func GoFilesPackage(gofiles []string) *Package { pkg.Internal.CmdlineFiles = true pkg.Name = f pkg.Error = &PackageError{ - Err: fmt.Sprintf("named files must be .go files: %s", pkg.Name), + Err: fmt.Errorf("named files must be .go files: %s", pkg.Name), } return pkg } diff --git a/src/cmd/go/internal/load/test.go b/src/cmd/go/internal/load/test.go index aac7d7d481f..fefc7d2e307 100644 --- a/src/cmd/go/internal/load/test.go +++ b/src/cmd/go/internal/load/test.go @@ -110,7 +110,7 @@ func TestPackagesAndErrors(p *Package, cover *TestCover) (pmain, ptest, pxtest * // non-test copy of a package. ptestErr = &PackageError{ ImportStack: testImportStack(stk[0], p1, p.ImportPath), - Err: "import cycle not allowed in test", + Err: errors.New("import cycle not allowed in test"), IsImportCycle: true, } } @@ -271,7 +271,7 @@ func TestPackagesAndErrors(p *Package, cover *TestCover) (pmain, ptest, pxtest * // afterward that gathers t.Cover information. t, err := loadTestFuncs(ptest) if err != nil && pmain.Error == nil { - pmain.Error = &PackageError{Err: err.Error()} + pmain.Error = &PackageError{Err: err} } t.Cover = cover if len(ptest.GoFiles)+len(ptest.CgoFiles) > 0 { @@ -322,7 +322,7 @@ func TestPackagesAndErrors(p *Package, cover *TestCover) (pmain, ptest, pxtest * data, err := formatTestmain(t) if err != nil && pmain.Error == nil { - pmain.Error = &PackageError{Err: err.Error()} + pmain.Error = &PackageError{Err: err} } if data != nil { pmain.Internal.TestmainGo = &data diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go index 581a978ef8e..faf73446f79 100644 --- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go +++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !js,!nacl,!plan9 +// +build !js,!plan9 package filelock_test diff --git a/src/cmd/go/internal/lockedfile/lockedfile_test.go b/src/cmd/go/internal/lockedfile/lockedfile_test.go index 6d5819efdb0..8f7a7d5604a 100644 --- a/src/cmd/go/internal/lockedfile/lockedfile_test.go +++ b/src/cmd/go/internal/lockedfile/lockedfile_test.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// js and nacl do not support inter-process file locking. -// +build !js,!nacl +// js does not support inter-process file locking. +// +build !js package lockedfile_test diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go index 75513f1d9ca..8509b8b1900 100644 --- a/src/cmd/go/internal/modcmd/vendor.go +++ b/src/cmd/go/internal/modcmd/vendor.go @@ -59,19 +59,24 @@ func runVendor(cmd *base.Command, args []string) { modpkgs[m] = append(modpkgs[m], pkg) } + isExplicit := map[module.Version]bool{} + for _, r := range modload.ModFile().Require { + isExplicit[r.Mod] = true + } + var buf bytes.Buffer for _, m := range modload.BuildList()[1:] { - if pkgs := modpkgs[m]; len(pkgs) > 0 { - repl := "" - if r := modload.Replacement(m); r.Path != "" { - repl = " => " + r.Path - if r.Version != "" { - repl += " " + r.Version - } - } - fmt.Fprintf(&buf, "# %s %s%s\n", m.Path, m.Version, repl) + if pkgs := modpkgs[m]; len(pkgs) > 0 || isExplicit[m] { + line := moduleLine(m, modload.Replacement(m)) + buf.WriteString(line) if cfg.BuildV { - fmt.Fprintf(os.Stderr, "# %s %s%s\n", m.Path, m.Version, repl) + os.Stderr.WriteString(line) + } + if isExplicit[m] { + buf.WriteString("## explicit\n") + if cfg.BuildV { + os.Stderr.WriteString("## explicit\n") + } } sort.Strings(pkgs) for _, pkg := range pkgs { @@ -83,6 +88,24 @@ func runVendor(cmd *base.Command, args []string) { } } } + + // Record unused and wildcard replacements at the end of the modules.txt file: + // without access to the complete build list, the consumer of the vendor + // directory can't otherwise determine that those replacements had no effect. + for _, r := range modload.ModFile().Replace { + if len(modpkgs[r.Old]) > 0 { + // We we already recorded this replacement in the entry for the replaced + // module with the packages it provides. + continue + } + + line := moduleLine(r.Old, r.New) + buf.WriteString(line) + if cfg.BuildV { + os.Stderr.WriteString(line) + } + } + if buf.Len() == 0 { fmt.Fprintf(os.Stderr, "go: no dependencies to vendor\n") return @@ -92,6 +115,26 @@ func runVendor(cmd *base.Command, args []string) { } } +func moduleLine(m, r module.Version) string { + b := new(strings.Builder) + b.WriteString("# ") + b.WriteString(m.Path) + if m.Version != "" { + b.WriteString(" ") + b.WriteString(m.Version) + } + if r.Path != "" { + b.WriteString(" => ") + b.WriteString(r.Path) + if r.Version != "" { + b.WriteString(" ") + b.WriteString(r.Version) + } + } + b.WriteString("\n") + return b.String() +} + func vendorPkg(vdir, pkg string) { realPath := modload.ImportMap(pkg) if realPath != pkg && modload.ImportMap(realPath) != "" { diff --git a/src/cmd/go/internal/modfile/rule.go b/src/cmd/go/internal/modfile/rule.go index e1f26878403..1b64216cff4 100644 --- a/src/cmd/go/internal/modfile/rule.go +++ b/src/cmd/go/internal/modfile/rule.go @@ -566,6 +566,9 @@ func (f *File) SetRequire(req []*Require) { var newLines []*Line for _, line := range stmt.Line { if p, err := parseString(&line.Token[0]); err == nil && need[p] != "" { + if len(line.Comments.Before) == 1 && len(line.Comments.Before[0].Token) == 0 { + line.Comments.Before = line.Comments.Before[:0] + } line.Token[1] = need[p] delete(need, p) setIndirect(line, indirect[p]) diff --git a/src/cmd/go/internal/modfile/rule_test.go b/src/cmd/go/internal/modfile/rule_test.go index b88ad629168..edd289053bd 100644 --- a/src/cmd/go/internal/modfile/rule_test.go +++ b/src/cmd/go/internal/modfile/rule_test.go @@ -8,6 +8,8 @@ import ( "bytes" "fmt" "testing" + + "cmd/go/internal/module" ) var addRequireTests = []struct { @@ -59,6 +61,40 @@ var addRequireTests = []struct { }, } +var setRequireTests = []struct { + in string + mods []struct { + path string + vers string + } + out string +}{ + { + `module m + require ( + x.y/b v1.2.3 + + x.y/a v1.2.3 + ) + `, + []struct { + path string + vers string + }{ + {"x.y/a", "v1.2.3"}, + {"x.y/b", "v1.2.3"}, + {"x.y/c", "v1.2.3"}, + }, + `module m + require ( + x.y/a v1.2.3 + x.y/b v1.2.3 + x.y/c v1.2.3 + ) + `, + }, +} + func TestAddRequire(t *testing.T) { for i, tt := range addRequireTests { t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { @@ -88,3 +124,40 @@ func TestAddRequire(t *testing.T) { }) } } + +func TestSetRequire(t *testing.T) { + for i, tt := range setRequireTests { + t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { + f, err := Parse("in", []byte(tt.in), nil) + if err != nil { + t.Fatal(err) + } + g, err := Parse("out", []byte(tt.out), nil) + if err != nil { + t.Fatal(err) + } + golden, err := g.Format() + if err != nil { + t.Fatal(err) + } + var mods []*Require + for _, mod := range tt.mods { + mods = append(mods, &Require{ + Mod: module.Version{ + Path: mod.path, + Version: mod.vers, + }, + }) + } + + f.SetRequire(mods) + out, err := f.Format() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(out, golden) { + t.Errorf("have:\n%s\nwant:\n%s", out, golden) + } + }) + } +} diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go index ced5abcc71b..6bb8cdf55ce 100644 --- a/src/cmd/go/internal/modget/get.go +++ b/src/cmd/go/internal/modget/get.go @@ -284,6 +284,10 @@ func runGet(cmd *base.Command, args []string) { // what was requested. modload.DisallowWriteGoMod() + // Allow looking up modules for import paths outside of a module. + // 'go get' is expected to do this, unlike other commands. + modload.AllowMissingModuleImports() + // Parse command-line arguments and report errors. The command-line // arguments are of the form path@version or simply path, with implicit // @upgrade. path@none is "downgrade away". @@ -354,6 +358,10 @@ func runGet(cmd *base.Command, args []string) { // upgrade golang.org/x/tools. case path == "all": + // If there is no main module, "all" is not meaningful. + if !modload.HasModRoot() { + base.Errorf(`go get %s: cannot match "all": working directory is not part of a module`, arg) + } // Don't query modules until we load packages. We'll automatically // look up any missing modules. diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go index 1309d1ad631..4105c47ba76 100644 --- a/src/cmd/go/internal/modload/build.go +++ b/src/cmd/go/internal/modload/build.go @@ -120,7 +120,8 @@ func moduleInfo(m module.Version, fromBuildList bool) *modinfo.ModulePublic { } if cfg.BuildMod == "vendor" { - info.Dir = filepath.Join(ModRoot(), "vendor", m.Path) + // The vendor directory doesn't contain enough information to reconstruct + // anything more about the module. return info } diff --git a/src/cmd/go/internal/modload/import.go b/src/cmd/go/internal/modload/import.go index 68e0b6504b3..cda56fa7c81 100644 --- a/src/cmd/go/internal/modload/import.go +++ b/src/cmd/go/internal/modload/import.go @@ -16,6 +16,7 @@ import ( "time" "cmd/go/internal/cfg" + "cmd/go/internal/load" "cmd/go/internal/modfetch" "cmd/go/internal/module" "cmd/go/internal/par" @@ -25,32 +26,38 @@ import ( ) type ImportMissingError struct { - ImportPath string - Module module.Version - QueryErr error + Path string + Module module.Version + QueryErr error // newMissingVersion is set to a newer version of Module if one is present // in the build list. When set, we can't automatically upgrade. newMissingVersion string } +var _ load.ImportPathError = (*ImportMissingError)(nil) + func (e *ImportMissingError) Error() string { if e.Module.Path == "" { - if str.HasPathPrefix(e.ImportPath, "cmd") { - return fmt.Sprintf("package %s is not in GOROOT (%s)", e.ImportPath, filepath.Join(cfg.GOROOT, "src", e.ImportPath)) + if str.HasPathPrefix(e.Path, "cmd") { + return fmt.Sprintf("package %s is not in GOROOT (%s)", e.Path, filepath.Join(cfg.GOROOT, "src", e.Path)) } if e.QueryErr != nil { - return fmt.Sprintf("cannot find module providing package %s: %v", e.ImportPath, e.QueryErr) + return fmt.Sprintf("cannot find module providing package %s: %v", e.Path, e.QueryErr) } - return "cannot find module providing package " + e.ImportPath + return "cannot find module providing package " + e.Path } - return fmt.Sprintf("missing module for import: %s@%s provides %s", e.Module.Path, e.Module.Version, e.ImportPath) + return fmt.Sprintf("missing module for import: %s@%s provides %s", e.Module.Path, e.Module.Version, e.Path) } func (e *ImportMissingError) Unwrap() error { return e.QueryErr } +func (e *ImportMissingError) ImportPath() string { + return e.Path +} + // An AmbiguousImportError indicates an import of a package found in multiple // modules in the build list, or found in both the main module and its vendor // directory. @@ -121,7 +128,7 @@ func Import(path string) (m module.Version, dir string, err error) { return module.Version{}, dir, nil } if str.HasPathPrefix(path, "cmd") { - return module.Version{}, "", &ImportMissingError{ImportPath: path} + return module.Version{}, "", &ImportMissingError{Path: path} } // -mod=vendor is special. @@ -139,7 +146,7 @@ func Import(path string) (m module.Version, dir string, err error) { return Target, mainDir, nil } readVendorList() - return vendorMap[path], vendorDir, nil + return vendorPkgModule[path], vendorDir, nil } // Check each module on the build list. @@ -178,6 +185,12 @@ func Import(path string) (m module.Version, dir string, err error) { if cfg.BuildMod == "readonly" { return module.Version{}, "", fmt.Errorf("import lookup disabled by -mod=%s", cfg.BuildMod) } + if modRoot == "" && !allowMissingModuleImports { + return module.Version{}, "", &ImportMissingError{ + Path: path, + QueryErr: errors.New("working directory is not part of a module"), + } + } // Not on build list. // To avoid spurious remote fetches, next try the latest replacement for each module. @@ -220,7 +233,7 @@ func Import(path string) (m module.Version, dir string, err error) { } _, ok := dirInModule(path, m.Path, root, isLocal) if ok { - return m, "", &ImportMissingError{ImportPath: path, Module: m} + return m, "", &ImportMissingError{Path: path, Module: m} } } } @@ -230,7 +243,7 @@ func Import(path string) (m module.Version, dir string, err error) { if errors.Is(err, os.ErrNotExist) { // Return "cannot find module providing package […]" instead of whatever // low-level error QueryPackage produced. - return module.Version{}, "", &ImportMissingError{ImportPath: path, QueryErr: err} + return module.Version{}, "", &ImportMissingError{Path: path, QueryErr: err} } else { return module.Version{}, "", err } @@ -255,7 +268,7 @@ func Import(path string) (m module.Version, dir string, err error) { } } } - return m, "", &ImportMissingError{ImportPath: path, Module: m, newMissingVersion: newMissingVersion} + return m, "", &ImportMissingError{Path: path, Module: m, newMissingVersion: newMissingVersion} } // maybeInModule reports whether, syntactically, diff --git a/src/cmd/go/internal/modload/import_test.go b/src/cmd/go/internal/modload/import_test.go index c58892e2ab2..accc60eecdf 100644 --- a/src/cmd/go/internal/modload/import_test.go +++ b/src/cmd/go/internal/modload/import_test.go @@ -44,6 +44,10 @@ var importTests = []struct { func TestImport(t *testing.T) { testenv.MustHaveExternalNetwork(t) testenv.MustHaveExecPath(t, "git") + defer func(old bool) { + allowMissingModuleImports = old + }(allowMissingModuleImports) + AllowMissingModuleImports() for _, tt := range importTests { t.Run(strings.ReplaceAll(tt.path, "/", "_"), func(t *testing.T) { diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index cd57d99de76..4872bc33906 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -30,6 +30,7 @@ import ( "cmd/go/internal/mvs" "cmd/go/internal/renameio" "cmd/go/internal/search" + "cmd/go/internal/semver" ) var ( @@ -56,6 +57,8 @@ var ( CmdModInit bool // running 'go mod init' CmdModModule string // module argument for 'go mod init' + + allowMissingModuleImports bool ) // ModFile returns the parsed go.mod file. @@ -198,28 +201,21 @@ func Init() { if modRoot == "" { // We're in module mode, but not inside a module. // - // If the command is 'go get' or 'go list' and all of the args are in the - // same existing module, we could use that module's download directory in - // the module cache as the module root, applying any replacements and/or - // exclusions specified by that module. However, that would leave us in a - // strange state: we want 'go get' to be consistent with 'go list', and 'go - // list' should be able to operate on multiple modules. Moreover, the 'get' - // target might specify relative file paths (e.g. in the same repository) as - // replacements, and we would not be able to apply those anyway: we would - // need to either error out or ignore just those replacements, when a build - // from an empty module could proceed without error. + // Commands like 'go build', 'go run', 'go list' have no go.mod file to + // read or write. They would need to find and download the latest versions + // of a potentially large number of modules with no way to save version + // information. We can succeed slowly (but not reproducibly), but that's + // not usually a good experience. // - // Instead, we'll operate as though we're in some ephemeral external module, - // ignoring all replacements and exclusions uniformly. - - // Normally we check sums using the go.sum file from the main module, but - // without a main module we do not have an authoritative go.sum file. + // Instead, we forbid resolving import paths to modules other than std and + // cmd. Users may still build packages specified with .go files on the + // command line, but they'll see an error if those files import anything + // outside std. // - // TODO(bcmills): In Go 1.13, check sums when outside the main module. + // This can be overridden by calling AllowMissingModuleImports. + // For example, 'go get' does this, since it is expected to resolve paths. // - // One possible approach is to merge the go.sum files from all of the - // modules we download: that doesn't protect us against bad top-level - // modules, but it at least ensures consistency for transitive dependencies. + // See golang.org/issue/32027. } else { modfetch.GoSumFile = filepath.Join(modRoot, "go.sum") search.SetModRoot(modRoot) @@ -349,8 +345,22 @@ func InitMod() { excluded[x.Mod] = true } modFileToBuildList() - stdVendorMode() - WriteGoMod() + setDefaultBuildMod() + if cfg.BuildMod == "vendor" { + readVendorList() + checkVendorConsistency() + } else { + // TODO(golang.org/issue/33326): if cfg.BuildMod != "readonly"? + WriteGoMod() + } +} + +// AllowMissingModuleImports allows import paths to be resolved to modules +// when there is no module root. Normally, this is forbidden because it's slow +// and there's no way to make the result reproducible, but some commands +// like 'go get' are expected to do this. +func AllowMissingModuleImports() { + allowMissingModuleImports = true } // modFileToBuildList initializes buildList from the modFile. @@ -371,40 +381,133 @@ func modFileToBuildList() { buildList = list } -// stdVendorMode applies inside $GOROOT/src. -// It checks that the go.mod matches vendor/modules.txt -// and then sets -mod=vendor unless this is a command -// that has to do explicitly with modules. -func stdVendorMode() { - if !targetInGorootSrc { +// setDefaultBuildMod sets a default value for cfg.BuildMod +// if it is currently empty. +func setDefaultBuildMod() { + if cfg.BuildMod != "" { + // Don't override an explicit '-mod=' argument. return } + cfg.BuildMod = "mod" if cfg.CmdName == "get" || strings.HasPrefix(cfg.CmdName, "mod ") { + // Don't set -mod implicitly for commands whose purpose is to + // manipulate the build list. return } + if modRoot != "" { + if fi, err := os.Stat(filepath.Join(modRoot, "vendor")); err == nil && fi.IsDir() { + modGo := "unspecified" + if modFile.Go != nil { + if semver.Compare("v"+modFile.Go.Version, "v1.14") >= 0 { + // The Go version is at least 1.14, and a vendor directory exists. + // Set -mod=vendor by default. + cfg.BuildMod = "vendor" + return + } else { + modGo = modFile.Go.Version + } + } + fmt.Fprintf(os.Stderr, "go: not defaulting to -mod=vendor because go.mod 'go' version is %s\n", modGo) + } + } + // TODO(golang.org/issue/33326): set -mod=readonly implicitly if the go.mod + // file is itself read-only? +} + +// checkVendorConsistency verifies that the vendor/modules.txt file matches (if +// go 1.14) or at least does not contradict (go 1.13 or earlier) the +// requirements and replacements listed in the main module's go.mod file. +func checkVendorConsistency() { readVendorList() -BuildList: - for _, m := range buildList { - if m.Path == "cmd" || m.Path == "std" { - continue + + pre114 := false + if modFile.Go == nil || semver.Compare("v"+modFile.Go.Version, "v1.14") < 0 { + // Go versions before 1.14 did not include enough information in + // vendor/modules.txt to check for consistency. + // If we know that we're on an earlier version, relax the consistency check. + pre114 = true + } + + vendErrors := new(strings.Builder) + vendErrorf := func(mod module.Version, format string, args ...interface{}) { + detail := fmt.Sprintf(format, args...) + if mod.Version == "" { + fmt.Fprintf(vendErrors, "\n\t%s: %s", mod.Path, detail) + } else { + fmt.Fprintf(vendErrors, "\n\t%s@%s: %s", mod.Path, mod.Version, detail) } - for _, v := range vendorList { - if m.Path == v.Path { - if m.Version != v.Version { - base.Fatalf("go: inconsistent vendoring in %s:\n"+ - "\tgo.mod requires %s %s but vendor/modules.txt has %s.\n"+ - "\trun 'go mod tidy; go mod vendor' to sync", - modRoot, m.Path, m.Version, v.Version) + } + + explicitInGoMod := make(map[module.Version]bool, len(modFile.Require)) + for _, r := range modFile.Require { + explicitInGoMod[r.Mod] = true + if !vendorMeta[r.Mod].Explicit { + if pre114 { + // Before 1.14, modules.txt did not indicate whether modules were listed + // explicitly in the main module's go.mod file. + // However, we can at least detect a version mismatch if packages were + // vendored from a non-matching version. + if vv, ok := vendorVersion[r.Mod.Path]; ok && vv != r.Mod.Version { + vendErrorf(r.Mod, fmt.Sprintf("is explicitly required in go.mod, but vendor/modules.txt indicates %s@%s", r.Mod.Path, vv)) } - continue BuildList + } else { + vendErrorf(r.Mod, "is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt") } } - base.Fatalf("go: inconsistent vendoring in %s:\n"+ - "\tgo.mod requires %s %s but vendor/modules.txt does not include it.\n"+ - "\trun 'go mod tidy; go mod vendor' to sync", modRoot, m.Path, m.Version) } - cfg.BuildMod = "vendor" + + describe := func(m module.Version) string { + if m.Version == "" { + return m.Path + } + return m.Path + "@" + m.Version + } + + // We need to verify *all* replacements that occur in modfile: even if they + // don't directly apply to any module in the vendor list, the replacement + // go.mod file can affect the selected versions of other (transitive) + // dependencies + goModReplacement := make(map[module.Version]module.Version, len(modFile.Replace)) + for _, r := range modFile.Replace { + goModReplacement[r.Old] = r.New + vr := vendorMeta[r.Old].Replacement + if vr == (module.Version{}) { + if pre114 && (r.Old.Version == "" || vendorVersion[r.Old.Path] != r.Old.Version) { + // Before 1.14, modules.txt omitted wildcard replacements and + // replacements for modules that did not have any packages to vendor. + } else { + vendErrorf(r.Old, "is replaced in go.mod, but not marked as replaced in vendor/modules.txt") + } + } else if vr != r.New { + vendErrorf(r.Old, "is replaced by %s in go.mod, but marked as replaced by %s in vendor/modules.txt", describe(r.New), describe(vr)) + } + } + + for _, mod := range vendorList { + meta := vendorMeta[mod] + if meta.Explicit && !explicitInGoMod[mod] { + vendErrorf(mod, "is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod") + } + } + + for _, mod := range vendorReplaced { + r, ok := goModReplacement[mod] + if !ok { + r, ok = goModReplacement[module.Version{Path: mod.Path}] + } + if !ok { + vendErrorf(mod, "is marked as replaced in vendor/modules.txt, but not replaced in go.mod") + continue + } + if meta := vendorMeta[mod]; r != meta.Replacement { + vendErrorf(mod, "is marked as replaced by %s in vendor/modules.txt, but replaced by %s in go.mod", describe(meta.Replacement), describe(r)) + } + } + + if vendErrors.Len() > 0 { + base.Fatalf("go: inconsistent vendoring in %s:%s\n\nrun 'go mod vendor' to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory", modRoot, vendErrors) + } } // Allowed reports whether module m is allowed (not excluded) by the main module's go.mod. diff --git a/src/cmd/go/internal/modload/list.go b/src/cmd/go/internal/modload/list.go index 35d0c28cde1..6c0b3945cb8 100644 --- a/src/cmd/go/internal/modload/list.go +++ b/src/cmd/go/internal/modload/list.go @@ -55,6 +55,9 @@ func listModules(args []string, listVersions bool) []*modinfo.ModulePublic { if search.IsRelativePath(arg) { base.Fatalf("go: cannot use relative path %s to specify module", arg) } + if !HasModRoot() && arg == "all" { + base.Fatalf(`go: cannot match "all": working directory is not part of a module`) + } if i := strings.Index(arg, "@"); i >= 0 { path := arg[:i] vers := arg[i+1:] diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go index 92e76a92460..5f6fd672ba8 100644 --- a/src/cmd/go/internal/modload/load.go +++ b/src/cmd/go/internal/modload/load.go @@ -1024,30 +1024,106 @@ func (r *mvsReqs) Required(mod module.Version) ([]module.Version, error) { var vendorOnce sync.Once +type vendorMetadata struct { + Explicit bool + Replacement module.Version +} + var ( - vendorList []module.Version - vendorMap map[string]module.Version + vendorList []module.Version // modules that contribute packages to the build, in order of appearance + vendorReplaced []module.Version // all replaced modules; may or may not also contribute packages + vendorVersion map[string]string // module path → selected version (if known) + vendorPkgModule map[string]module.Version // package → containing module + vendorMeta map[module.Version]vendorMetadata ) // readVendorList reads the list of vendored modules from vendor/modules.txt. func readVendorList() { vendorOnce.Do(func() { vendorList = nil - vendorMap = make(map[string]module.Version) - data, _ := ioutil.ReadFile(filepath.Join(ModRoot(), "vendor/modules.txt")) - var m module.Version + vendorPkgModule = make(map[string]module.Version) + vendorVersion = make(map[string]string) + vendorMeta = make(map[module.Version]vendorMetadata) + data, err := ioutil.ReadFile(filepath.Join(ModRoot(), "vendor/modules.txt")) + if err != nil { + if !errors.Is(err, os.ErrNotExist) { + base.Fatalf("go: %s", err) + } + return + } + + var mod module.Version for _, line := range strings.Split(string(data), "\n") { if strings.HasPrefix(line, "# ") { f := strings.Fields(line) - m = module.Version{} - if len(f) == 3 && semver.IsValid(f[2]) { - m = module.Version{Path: f[1], Version: f[2]} - vendorList = append(vendorList, m) + + if len(f) < 3 { + continue } - } else if m.Path != "" { - f := strings.Fields(line) - if len(f) == 1 { - vendorMap[f[0]] = m + if semver.IsValid(f[2]) { + // A module, but we don't yet know whether it is in the build list or + // only included to indicate a replacement. + mod = module.Version{Path: f[1], Version: f[2]} + f = f[3:] + } else if f[2] == "=>" { + // A wildcard replacement found in the main module's go.mod file. + mod = module.Version{Path: f[1]} + f = f[2:] + } else { + // Not a version or a wildcard replacement. + // We don't know how to interpret this module line, so ignore it. + mod = module.Version{} + continue + } + + if len(f) >= 2 && f[0] == "=>" { + meta := vendorMeta[mod] + if len(f) == 2 { + // File replacement. + meta.Replacement = module.Version{Path: f[1]} + vendorReplaced = append(vendorReplaced, mod) + } else if len(f) == 3 && semver.IsValid(f[2]) { + // Path and version replacement. + meta.Replacement = module.Version{Path: f[1], Version: f[2]} + vendorReplaced = append(vendorReplaced, mod) + } else { + // We don't understand this replacement. Ignore it. + } + vendorMeta[mod] = meta + } + continue + } + + // Not a module line. Must be a package within a module or a metadata + // directive, either of which requires a preceding module line. + if mod.Path == "" { + continue + } + + if strings.HasPrefix(line, "## ") { + // Metadata. Take the union of annotations across multiple lines, if present. + meta := vendorMeta[mod] + for _, entry := range strings.Split(strings.TrimPrefix(line, "## "), ";") { + entry = strings.TrimSpace(entry) + if entry == "explicit" { + meta.Explicit = true + } + // All other tokens are reserved for future use. + } + vendorMeta[mod] = meta + continue + } + + if f := strings.Fields(line); len(f) == 1 && module.CheckImportPath(f[0]) == nil { + // A package within the current module. + vendorPkgModule[f[0]] = mod + + // Since this module provides a package for the build, we know that it + // is in the build list and is the selected version of its path. + // If this information is new, record it. + if v, ok := vendorVersion[mod.Path]; !ok || semver.Compare(v, mod.Version) < 0 { + vendorList = append(vendorList, mod) + vendorVersion[mod.Path] = mod.Version } } } @@ -1078,19 +1154,6 @@ func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) { return append([]module.Version(nil), vendorList...), nil } - if targetInGorootSrc { - // When inside "std" or "cmd", only fetch and read go.mod files if we're - // explicitly running a command that can change the module graph. If we have - // to resolve a new dependency, we might pick the wrong version, but 'go mod - // tidy' will fix it — and new standard-library dependencies should be rare - // anyway. - // - // TODO(golang.org/issue/30240): Drop this special-case. - if cfg.CmdName != "get" && !strings.HasPrefix(cfg.CmdName, "mod ") { - return nil, nil - } - } - origPath := mod.Path if repl := Replacement(mod); repl.Path != "" { if repl.Version == "" { diff --git a/src/cmd/go/internal/modload/query.go b/src/cmd/go/internal/modload/query.go index 0359470d95e..75c18f25cc1 100644 --- a/src/cmd/go/internal/modload/query.go +++ b/src/cmd/go/internal/modload/query.go @@ -472,10 +472,10 @@ func queryPrefixModules(candidateModules []string, queryModule func(path string) notExistErr = rErr } } else if err == nil { - if len(found) > 0 { - // golang.org/issue/34094: If we have already found a module - // containing the target package, ignore errors for modules with - // shorter paths. + if len(found) > 0 || noPackage != nil { + // golang.org/issue/34094: If we have already found a module that + // could potentially contain the target package, ignore unclassified + // errors for modules with shorter paths. // golang.org/issue/34383 is a special case of this: if we have // already found example.com/foo/v2@v2.0.0 with a matching go.mod diff --git a/src/cmd/go/internal/renameio/umask_test.go b/src/cmd/go/internal/renameio/umask_test.go index 1d5e594e7eb..d75d67c9a93 100644 --- a/src/cmd/go/internal/renameio/umask_test.go +++ b/src/cmd/go/internal/renameio/umask_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!plan9,!windows,!js +// +build !plan9,!windows,!js package renameio diff --git a/src/cmd/go/internal/run/run.go b/src/cmd/go/internal/run/run.go index 648a87f6654..2edae38ccaa 100644 --- a/src/cmd/go/internal/run/run.go +++ b/src/cmd/go/internal/run/run.go @@ -33,7 +33,7 @@ If the -exec flag is given, 'go run' invokes the binary using xprog: If the -exec flag is not given, GOOS or GOARCH is different from the system default, and a program named go_$GOOS_$GOARCH_exec can be found on the current search path, 'go run' invokes the binary using that program, -for example 'go_nacl_386_exec a.out arguments...'. This allows execution of +for example 'go_js_wasm_exec a.out arguments...'. This allows execution of cross-compiled programs when a simulator or other execution method is available. diff --git a/src/cmd/go/internal/work/build_test.go b/src/cmd/go/internal/work/build_test.go index 55e1eea25ba..b60f4e27c04 100644 --- a/src/cmd/go/internal/work/build_test.go +++ b/src/cmd/go/internal/work/build_test.go @@ -221,8 +221,6 @@ func pkgImportPath(pkgpath string) *load.Package { // See https://golang.org/issue/18878. func TestRespectSetgidDir(t *testing.T) { switch runtime.GOOS { - case "nacl": - t.Skip("can't set SetGID bit with chmod on nacl") case "darwin": if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" { t.Skip("can't set SetGID bit with chmod on iOS") diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index b75c61b6f2d..71eb5d9cd3f 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -433,7 +433,7 @@ func (b *Builder) build(a *Action) (err error) { err = fmt.Errorf("go build %s: %v", a.Package.ImportPath, err) } if err != nil && b.IsCmdList && b.NeedError && p.Error == nil { - p.Error = &load.PackageError{Err: err.Error()} + p.Error = &load.PackageError{Err: err} } }() if cfg.BuildN { @@ -2390,7 +2390,7 @@ func (b *Builder) gccArchArgs() []string { switch cfg.Goarch { case "386": return []string{"-m32"} - case "amd64", "amd64p32": + case "amd64": return []string{"-m64"} case "arm": return []string{"-marm"} // not thumb diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go index 86322946a61..57024694cf6 100644 --- a/src/cmd/go/internal/work/gc.go +++ b/src/cmd/go/internal/work/gc.go @@ -92,8 +92,7 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg []byte, s if a.buildID != "" { gcargs = append(gcargs, "-buildid", a.buildID) } - platform := cfg.Goos + "/" + cfg.Goarch - if p.Internal.OmitDebug || platform == "nacl/amd64p32" || cfg.Goos == "plan9" || cfg.Goarch == "wasm" { + if p.Internal.OmitDebug || cfg.Goos == "plan9" || cfg.Goarch == "wasm" { gcargs = append(gcargs, "-dwarf=false") } if strings.HasPrefix(runtimeVersion, "go1") && !strings.Contains(os.Args[0], "go_bootstrap") { diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go index 548e73515fe..f3055b62937 100644 --- a/src/cmd/go/internal/work/init.go +++ b/src/cmd/go/internal/work/init.go @@ -247,12 +247,12 @@ func buildModeInit() { switch cfg.BuildMod { case "": // ok - case "readonly", "vendor": + case "readonly", "vendor", "mod": if load.ModLookup == nil && !inGOFLAGS("-mod") { base.Fatalf("build flag -mod=%s only valid when using modules", cfg.BuildMod) } default: - base.Fatalf("-mod=%s not supported (can be '', 'readonly', or 'vendor')", cfg.BuildMod) + base.Fatalf("-mod=%s not supported (can be '', 'mod', 'readonly', or 'vendor')", cfg.BuildMod) } } diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README index 66ab8515c33..46444d84d8f 100644 --- a/src/cmd/go/testdata/script/README +++ b/src/cmd/go/testdata/script/README @@ -79,7 +79,9 @@ should only run when the condition is satisfied. The available conditions are: - [exec:prog] for whether prog is available for execution (found by exec.LookPath) A condition can be negated: [!short] means to run the rest of the line -when testing.Short() is false. +when testing.Short() is false. Multiple conditions may be given for a single +command, for example, '[linux] [amd64] skip'. The command will run if all conditions +are satisfied. The commands are: diff --git a/src/cmd/go/testdata/script/build_trimpath.txt b/src/cmd/go/testdata/script/build_trimpath.txt index ec817a5ecd8..2c39e4cec48 100644 --- a/src/cmd/go/testdata/script/build_trimpath.txt +++ b/src/cmd/go/testdata/script/build_trimpath.txt @@ -21,9 +21,9 @@ go build -trimpath -o hello.exe hello.go # the current workspace or GOROOT. cd $WORK env GO111MODULE=on -go build -trimpath -o fortune.exe rsc.io/fortune -! grep -q $GOROOT_REGEXP fortune.exe -! grep -q $WORK_REGEXP fortune.exe +go get -trimpath rsc.io/fortune +! grep -q $GOROOT_REGEXP $GOPATH/bin/fortune$GOEXE +! grep -q $WORK_REGEXP $GOPATH/bin/fortune$GOEXE # Two binaries built from identical packages in different directories # should be identical. diff --git a/src/cmd/go/testdata/script/cmd_import_error.txt b/src/cmd/go/testdata/script/cmd_import_error.txt index ba94f9bd3eb..685c606a413 100644 --- a/src/cmd/go/testdata/script/cmd_import_error.txt +++ b/src/cmd/go/testdata/script/cmd_import_error.txt @@ -5,7 +5,7 @@ env GO111MODULE=on # a clear error in module mode. ! go list cmd/unknown -stderr '^can''t load package: package cmd/unknown: package cmd/unknown is not in GOROOT \('$GOROOT'[/\\]src[/\\]cmd[/\\]unknown\)$' +stderr '^can''t load package: package cmd/unknown is not in GOROOT \('$GOROOT'[/\\]src[/\\]cmd[/\\]unknown\)$' go list -f '{{range .DepsErrors}}{{.Err}}{{end}}' x.go stdout '^package cmd/unknown is not in GOROOT \('$GOROOT'[/\\]src[/\\]cmd[/\\]unknown\)$' diff --git a/src/cmd/go/testdata/script/mod_ambiguous_import.txt b/src/cmd/go/testdata/script/mod_ambiguous_import.txt index 9f9669c762a..61e632a29cc 100644 --- a/src/cmd/go/testdata/script/mod_ambiguous_import.txt +++ b/src/cmd/go/testdata/script/mod_ambiguous_import.txt @@ -20,7 +20,7 @@ stderr '^can.t load package: package example.com/m/importy: ambiguous import: fo -- $WORK/go.mod -- module example.com/m -go 1.14 +go 1.13 require ( example.com/a v0.1.0 example.com/a/x v0.1.0 diff --git a/src/cmd/go/testdata/script/mod_doc.txt b/src/cmd/go/testdata/script/mod_doc.txt index d7aa553c1d3..047e9f46eb2 100644 --- a/src/cmd/go/testdata/script/mod_doc.txt +++ b/src/cmd/go/testdata/script/mod_doc.txt @@ -36,6 +36,11 @@ go doc rsc.io/quote ! stdout 'Package quote is located in a GOPATH workspace.' stdout 'Package quote collects pithy sayings.' +# Check that a sensible error message is printed when a package is not found. +env GOPROXY=off +! go doc example.com/hello +stderr '^doc: cannot find module providing package example.com/hello: module lookup disabled by GOPROXY=off$' + -- go.mod -- module x require rsc.io/quote v1.5.2 diff --git a/src/cmd/go/testdata/script/mod_get_major.txt b/src/cmd/go/testdata/script/mod_get_major.txt index dd1cbe01a32..367ede9ded4 100644 --- a/src/cmd/go/testdata/script/mod_get_major.txt +++ b/src/cmd/go/testdata/script/mod_get_major.txt @@ -13,6 +13,11 @@ go get -d vcs-test.golang.org/git/v3pkg.git/v3@v3.0.0 go list -m vcs-test.golang.org/git/v3pkg.git/v3 stdout '^vcs-test.golang.org/git/v3pkg.git/v3 v3.0.0$' +go get -d vcs-test.golang.org/git/empty-v2-without-v1.git/v2@v2.0.0 + +go list -m vcs-test.golang.org/git/empty-v2-without-v1.git/v2 +stdout '^vcs-test.golang.org/git/empty-v2-without-v1.git/v2 v2.0.0$' + -- go.mod -- module example.com go 1.13 diff --git a/src/cmd/go/testdata/script/mod_get_svn.txt b/src/cmd/go/testdata/script/mod_get_svn.txt index cd19d99dbcc..1a5376dec0c 100644 --- a/src/cmd/go/testdata/script/mod_get_svn.txt +++ b/src/cmd/go/testdata/script/mod_get_svn.txt @@ -1,6 +1,19 @@ [!net] skip [!exec:svn] skip +# 'go get' will fall back to svn+ssh once svn fails over protocols like https. +# If vcs-test.golang.org isn't in the user's known_hosts file, this will result +# in an ssh prompt, which will stop 'go test' entirely +# +# Unfortunately, there isn't a way to globally disable host checking for ssh, +# without modifying the real system's or user's configs. Changing $HOME won't +# affect ssh either, as it ignores the environment variable entirely. +# +# However, a useful trick is pointing SVN_SSH to a program that doesn't exist, +# resulting in svn skipping ssh entirely. Alternatives like +# SVN_SSH="ssh -o StrictHostKeyChecking=no" didn't avoid the prompt. +env SVN_SSH="svn_do_not_use_ssh" + env GO111MODULE=on env GOPROXY=direct env GOSUMDB=off diff --git a/src/cmd/go/testdata/script/mod_getmode_vendor.txt b/src/cmd/go/testdata/script/mod_getmode_vendor.txt index c532cee9cbd..21fec5b85f9 100644 --- a/src/cmd/go/testdata/script/mod_getmode_vendor.txt +++ b/src/cmd/go/testdata/script/mod_getmode_vendor.txt @@ -6,12 +6,12 @@ env GOPATH=$WORK/empty env GOPROXY=file:///nonexist go list -mod=vendor -go list -mod=vendor -m -f '{{.Path}} {{.Version}} {{.Dir}}' all +go list -mod=vendor -f '{{with .Module}}{{.Path}} {{.Version}}{{end}} {{.Dir}}' all stdout '^rsc.io/quote v1.5.1 .*vendor[\\/]rsc.io[\\/]quote$' -stdout '^golang.org/x/text v0.0.0.* .*vendor[\\/]golang.org[\\/]x[\\/]text$' +stdout '^golang.org/x/text v0.0.0.* .*vendor[\\/]golang.org[\\/]x[\\/]text[\\/]language$' ! go list -mod=vendor -m rsc.io/quote@latest -stderr 'module lookup disabled by -mod=vendor' +stderr 'go list -m: can''t list modules with -mod=vendor\n\tuse -mod=mod or -mod=readonly to ignore the vendor directory' ! go get -mod=vendor -u stderr 'flag provided but not defined: -mod' diff --git a/src/cmd/go/testdata/script/mod_internal.txt b/src/cmd/go/testdata/script/mod_internal.txt index 5a361a4f424..1193d528ece 100644 --- a/src/cmd/go/testdata/script/mod_internal.txt +++ b/src/cmd/go/testdata/script/mod_internal.txt @@ -2,8 +2,7 @@ env GO111MODULE=on [short] skip # golang.org/x/internal should be importable from other golang.org/x modules. -rm go.mod -go mod init golang.org/x/anything +go mod edit -module=golang.org/x/anything go build . # ...and their tests... @@ -20,8 +19,7 @@ stderr 'use of internal package golang.org/x/.* not allowed' stderr 'use of internal package internal/testenv not allowed' # Dependencies should be able to use their own internal modules... -rm go.mod -go mod init golang.org/notx +go mod edit -module=golang.org/notx go build ./throughdep # ... but other modules should not, even if they have transitive dependencies. @@ -34,8 +32,7 @@ stderr golang.org[/\\]notx[/\\]useinternal stderr 'use of internal package golang.org/x/.* not allowed' # Replacing an internal module should keep it internal to the same paths. -rm go.mod -go mod init golang.org/notx +go mod edit -module=golang.org/notx go mod edit -replace golang.org/x/internal=./replace/golang.org/notx/internal go build ./throughdep @@ -50,6 +47,9 @@ go build ./throughdep stderr golang.org[/\\]notx[/\\]useinternal stderr 'use of internal package golang.org/x/.* not allowed' +-- go.mod -- +module TBD +go 1.12 -- useinternal.go -- package useinternal import _ "golang.org/x/internal/subtle" diff --git a/src/cmd/go/testdata/script/mod_missingpkg_prerelease.txt b/src/cmd/go/testdata/script/mod_missingpkg_prerelease.txt index 6203606c22d..319ff855872 100644 --- a/src/cmd/go/testdata/script/mod_missingpkg_prerelease.txt +++ b/src/cmd/go/testdata/script/mod_missingpkg_prerelease.txt @@ -3,6 +3,11 @@ env GO111MODULE=on ! go list use.go stderr 'example.com/missingpkg/deprecated: package provided by example.com/missingpkg at latest version v1.0.0 but not at required version v1.0.1-beta' +-- go.mod -- +module m + +go 1.14 + -- use.go -- package use diff --git a/src/cmd/go/testdata/script/mod_outside.txt b/src/cmd/go/testdata/script/mod_outside.txt index 4182e71dde1..815745e8bff 100644 --- a/src/cmd/go/testdata/script/mod_outside.txt +++ b/src/cmd/go/testdata/script/mod_outside.txt @@ -17,7 +17,7 @@ go list -m stdout '^command-line-arguments$' # 'go list' in the working directory should fail even if there is a a 'package # main' present: without a main module, we do not know its package path. -! go list ./foo +! go list ./needmod stderr 'cannot find main module' # 'go list all' lists the transitive import graph of the main module, @@ -25,8 +25,6 @@ stderr 'cannot find main module' go list all ! stdout . stderr 'warning: "all" matched no packages' -go list -m all -stderr 'warning: pattern "all" matched no module dependencies' # 'go list' on standard-library packages should work, since they do not depend # on the contents of any module. @@ -38,7 +36,7 @@ go list $GOROOT/src/fmt stdout '^fmt$' # 'go list' should work with file arguments. -go list ./foo/foo.go +go list ./needmod/needmod.go stdout 'command-line-arguments' # 'go list -m' with an explicit version should resolve that version. @@ -49,10 +47,13 @@ stdout 'example.com/version v1.1.0' go list -m -versions example.com/version stdout 'v1.0.0\s+v1.0.1\s+v1.1.0' -# 'go list -m all' does not include the dependencies of in the computation of 'all'. -go list -m example.com/printversion@v1.0.0 all -stdout 'example.com/printversion v1.0.0' -stderr 'warning: pattern "all" matched no module dependencies' +# 'go list -m all' should fail. "all" is not meaningful outside of a module. +! go list -m all +stderr 'go: cannot match "all": working directory is not part of a module' + +# 'go list -m all' should also fail. +! go list -m example.com/printversion@v1.0.0 all +stderr 'go: cannot match "all": working directory is not part of a module' ! stdout 'example.com/version' @@ -87,6 +88,10 @@ go mod download example.com/printversion@v1.0.0 exists $GOPATH/pkg/mod/cache/download/example.com/printversion/@v/v1.0.0.zip ! exists $GOPATH/pkg/mod/cache/download/example.com/version/@v/v1.0.0.zip +# 'go mod download all' should fail. "all" is not meaningful outside of a module. +! go mod download all +stderr 'go: cannot match "all": working directory is not part of a module' + # 'go mod vendor' should fail: it starts by clearing the existing vendor # directory, and we don't know where that is. ! go mod vendor @@ -104,14 +109,13 @@ stdout 'all modules verified' stderr 'cannot find main module' ! go get -u stderr 'cannot find main module' -! go get -u ./foo +! go get -u ./needmod stderr 'cannot find main module' # 'go get -u all' upgrades the transitive import graph of the main module, # which is empty. -go get -u all -! stdout . -stderr 'warning: "all" matched no packages' +! go get -u all +stderr 'go get all: cannot match "all": working directory is not part of a module' # 'go get' should check the proposed module graph for consistency, # even though we won't write it anywhere. @@ -126,35 +130,75 @@ exists $GOPATH/pkg/mod/example.com/version@v1.0.0 # 'go build' without arguments implicitly operates on the current directory, and should fail. -cd foo +cd needmod ! go build stderr 'cannot find main module' cd .. # 'go build' of a non-module directory should fail too. -! go build ./foo +! go build ./needmod stderr 'cannot find main module' -# However, 'go build' should succeed for standard-library packages. +# 'go build' of source files should fail if they import anything outside std. +! go build -n ./needmod/needmod.go +stderr 'needmod[/\\]needmod.go:10:2: cannot find module providing package example.com/version: working directory is not part of a module' + +# 'go build' of source files should succeed if they do not import anything outside std. +go build -n -o ignore ./stdonly/stdonly.go + +# 'go build' should succeed for standard-library packages. go build -n fmt -# TODO(golang.org/issue/28992): 'go doc' should document the latest version. -# For now it does not. +# 'go doc' without arguments implicitly operates on the current directory, and should fail. +# TODO(golang.org/issue/32027): currently, it succeeds. +cd needmod +go doc +cd .. + +# 'go doc' of a non-module directory should also succeed. +go doc ./needmod + +# 'go doc' should succeed for standard-library packages. +go doc fmt + +# 'go doc' should fail for a package path outside a module. ! go doc example.com/version -stderr 'no such package' +stderr 'doc: cannot find module providing package example.com/version: working directory is not part of a module' # 'go install' with a version should fail due to syntax. ! go install example.com/printversion@v1.0.0 stderr 'can only use path@version syntax with' +# 'go install' should fail if a package argument must be resolved to a module. +! go install example.com/printversion +stderr 'cannot find module providing package example.com/printversion: working directory is not part of a module' + +# 'go install' should fail if a source file imports a package that must be +# resolved to a module. +! go install ./needmod/needmod.go +stderr 'needmod[/\\]needmod.go:10:2: cannot find module providing package example.com/version: working directory is not part of a module' + + +# 'go run' with a verison should fail due to syntax. +! go run example.com/printversion@v1.0.0 +stderr 'can only use path@version syntax with' + +# 'go run' should fail if a package argument must be resolved to a module. +! go run example.com/printversion +stderr 'cannot find module providing package example.com/printversion: working directory is not part of a module' + +# 'go run' should fail if a source file imports a package that must be +# resolved to a module. +! go run ./needmod/needmod.go +stderr 'needmod[/\\]needmod.go:10:2: cannot find module providing package example.com/version: working directory is not part of a module' + # 'go fmt' should be able to format files outside of a module. -go fmt foo/foo.go +go fmt needmod/needmod.go # The remainder of the test checks dependencies by linking and running binaries. -[short] stop # 'go get' of a binary without a go.mod should install the requested version, # resolving outside dependencies to the latest available versions. @@ -180,39 +224,31 @@ stdout 'path is example.com/printversion' stdout 'main is example.com/printversion v1.0.0' stdout 'using example.com/version v1.0.1' -# 'go install' without a version should install the latest version -# using its minimal module requirements. -go install example.com/printversion -exec ../bin/printversion -stdout 'path is example.com/printversion' -stdout 'main is example.com/printversion v1.0.0' -stdout 'using example.com/version v1.0.0' - -# 'go run' should use 'main' as the effective module and import path. -go run ./foo/foo.go +# 'go run' should work with file arguments if they don't import anything +# outside std. +go run ./stdonly/stdonly.go stdout 'path is command-line-arguments$' stdout 'main is command-line-arguments \(devel\)' -stdout 'using example.com/version v1.1.0' # 'go generate' should work with file arguments. -[exec:touch] go generate ./foo/foo.go -[exec:touch] exists ./foo/gen.txt +[exec:touch] go generate ./needmod/needmod.go +[exec:touch] exists ./needmod/gen.txt # 'go install' should work with file arguments. -go install ./foo/foo.go +go install ./stdonly/stdonly.go # 'go test' should work with file arguments. -go test -v ./foo/foo_test.go -stdout 'foo was tested' +go test -v ./stdonly/stdonly_test.go +stdout 'stdonly was tested' # 'go vet' should work with file arguments. -go vet ./foo/foo.go +go vet ./stdonly/stdonly.go -- README.txt -- There is no go.mod file in the working directory. --- foo/foo.go -- +-- needmod/needmod.go -- //go:generate touch gen.txt package main @@ -237,7 +273,28 @@ func main() { } } --- foo/foo_test.go -- +-- stdonly/stdonly.go -- +package main + +import ( + "fmt" + "os" + "runtime/debug" +) + +func main() { + info, ok := debug.ReadBuildInfo() + if !ok { + panic("missing build info") + } + fmt.Fprintf(os.Stdout, "path is %s\n", info.Path) + fmt.Fprintf(os.Stdout, "main is %s %s\n", info.Main.Path, info.Main.Version) + for _, m := range info.Deps { + fmt.Fprintf(os.Stdout, "using %s %s\n", m.Path, m.Version) + } +} + +-- stdonly/stdonly_test.go -- package main import ( @@ -245,6 +302,7 @@ import ( "testing" ) -func TestFoo(t *testing.T) { - fmt.Println("foo was tested") +func Test(t *testing.T) { + fmt.Println("stdonly was tested") } + diff --git a/src/cmd/go/testdata/script/mod_test_files.txt b/src/cmd/go/testdata/script/mod_test_files.txt index 87aecb44f67..6f520c7720d 100644 --- a/src/cmd/go/testdata/script/mod_test_files.txt +++ b/src/cmd/go/testdata/script/mod_test_files.txt @@ -20,6 +20,7 @@ stderr 'use of internal package' -- foo/go.mod -- module example.com/foo +go 1.12 require example.com/internal v0.0.0 replace example.com/internal => ../internal diff --git a/src/cmd/go/testdata/script/mod_vendor.txt b/src/cmd/go/testdata/script/mod_vendor.txt index 5d872c3c80e..9b716906e59 100644 --- a/src/cmd/go/testdata/script/mod_vendor.txt +++ b/src/cmd/go/testdata/script/mod_vendor.txt @@ -1,15 +1,15 @@ env GO111MODULE=on -go list -m all -stdout '^x v1.0.0 => ./x' -stdout '^w' - +# Without vendoring, a build should succeed unless -mod=vendor is set. [!short] go build [!short] ! go build -mod=vendor +# Without vendoring, 'go list' should report the replacement directory for +# a package in a replaced module. go list -f {{.Dir}} x stdout 'src[\\/]x' +# 'go mod vendor' should copy all replaced modules to the vendor directory. go mod vendor -v stderr '^# x v1.0.0 => ./x' stderr '^x' @@ -20,28 +20,38 @@ stderr '^z' ! stderr '^w' grep 'a/foo/bar/b\na/foo/bar/c' vendor/modules.txt # must be sorted -go list -f {{.Dir}} x +# An explicit '-mod=mod' should ignore the vendor directory. +go list -mod=mod -f {{.Dir}} x stdout 'src[\\/]x' -go list -f {{.Dir}} -m x +go list -mod=mod -f {{.Dir}} -m x stdout 'src[\\/]x' +# An explicit '-mod=vendor' should report package directories within +# the vendor directory. go list -mod=vendor -f {{.Dir}} x stdout 'src[\\/]vendor[\\/]x' -go list -mod=vendor -f {{.Dir}} -m x -stdout 'src[\\/]vendor[\\/]x' +# 'go list -mod=vendor -m' does not have enough information to list modules +# accurately, and should fail. +! go list -mod=vendor -f {{.Dir}} -m x +stderr 'can''t list modules with -mod=vendor\n\tuse -mod=mod or -mod=readonly to ignore the vendor directory' -go list -f {{.Dir}} -m w +# 'go list -mod=mod' should report packages outside the import graph, +# but 'go list -mod=vendor' should error out for them. +go list -mod=mod -f {{.Dir}} w stdout 'src[\\/]w' ! go list -mod=vendor -f {{.Dir}} w stderr 'src[\\/]vendor[\\/]w' +# Test dependencies should not be copied. ! exists vendor/x/testdata ! exists vendor/a/foo/bar/b/ignored.go ! exists vendor/a/foo/bar/b/main_test.go +# Licenses and other metadata for each module should be copied +# if any package within their module is copied. exists vendor/a/foo/AUTHORS.txt exists vendor/a/foo/CONTRIBUTORS exists vendor/a/foo/LICENSE @@ -59,10 +69,12 @@ exists vendor/mysite/myname/mypkg/LICENSE.txt [short] stop -go build +# 'go build' and 'go test' using vendored packages should succeed. +go build -mod=mod go build -mod=vendor go test -mod=vendor . ./subdir go test -mod=vendor ./... +go fmt -mod=vendor ./... -- go.mod -- module m diff --git a/src/cmd/go/testdata/script/mod_vendor_auto.txt b/src/cmd/go/testdata/script/mod_vendor_auto.txt new file mode 100644 index 00000000000..c80aa6ad630 --- /dev/null +++ b/src/cmd/go/testdata/script/mod_vendor_auto.txt @@ -0,0 +1,244 @@ +# Integration test for golang.org/issue/33848: automatically check and use vendored packages. + +env GO111MODULE=on + +[short] skip + +cd $WORK/auto +cp go.mod go.mod.orig + +# An explicit -mod=vendor should force use of the vendor directory. +env GOFLAGS=-mod=vendor + +go list -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]printversion$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]version$' + +! go list -m all +stderr 'can''t list modules with -mod=vendor' + +! go list -m -f '{{.Dir}}' all +stderr 'can''t list modules with -mod=vendor' + +# An explicit -mod=mod should force the vendor directory to be ignored. +env GOFLAGS=-mod=mod + +go list -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$GOPATH'[/\\]pkg[/\\]mod[/\\]example.com[/\\]printversion@v1.0.0$' +stdout '^'$WORK'[/\\]auto[/\\]replacement-version$' + +go list -m all +stdout '^example.com/auto$' +stdout 'example.com/printversion v1.0.0' +stdout 'example.com/version v1.0.0' + +go list -m -f '{{.Dir}}' all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$GOPATH'[/\\]pkg[/\\]mod[/\\]example.com[/\\]printversion@v1.0.0$' +stdout '^'$WORK'[/\\]auto[/\\]replacement-version$' + +# If the main module's "go" directive says 1.13, we should default to -mod=mod. +env GOFLAGS= +go mod edit -go=1.13 + +go list -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$GOPATH'[/\\]pkg[/\\]mod[/\\]example.com[/\\]printversion@v1.0.0$' +stdout '^'$WORK'[/\\]auto[/\\]replacement-version$' +stderr '^go: not defaulting to -mod=vendor because go.mod .go. version is 1.13$' + +go list -m -f '{{.Dir}}' all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$GOPATH'[/\\]pkg[/\\]mod[/\\]example.com[/\\]printversion@v1.0.0$' +stdout '^'$WORK'[/\\]auto[/\\]replacement-version$' + +# A 'go 1.14' directive in the main module's go.mod file should enable +# -mod=vendor by default, along with stronger checks for consistency +# between the go.mod file and vendor/modules.txt. +# A 'go 1.13' vendor/modules.txt file is not usually sufficient +# to pass those checks. +go mod edit -go=1.14 + +! go list -f {{.Dir}} -tags tools all +stderr '^go: inconsistent vendoring in '$WORK/auto':$' +stderr '^\texample.com/printversion@v1.0.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt' +stderr '^\texample.com/unused: is replaced in go.mod, but not marked as replaced in vendor/modules.txt' +stderr '^\texample.com/version@v1.2.0: is replaced in go.mod, but not marked as replaced in vendor/modules.txt' +stderr '\n\nrun .go mod vendor. to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory$' + +# Module-specific subcommands should continue to load the full module graph. +go mod graph +stdout '^example.com/printversion@v1.0.0 example.com/version@v1.0.0$' + +# An explicit -mod=mod should still force the vendor directory to be ignored. +env GOFLAGS=-mod=mod + +go list -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$GOPATH'[/\\]pkg[/\\]mod[/\\]example.com[/\\]printversion@v1.0.0$' +stdout '^'$WORK'[/\\]auto[/\\]replacement-version$' + +go list -m all +stdout '^example.com/auto$' +stdout 'example.com/printversion v1.0.0' +stdout 'example.com/version v1.0.0' + +go list -m -f '{{.Dir}}' all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$GOPATH'[/\\]pkg[/\\]mod[/\\]example.com[/\\]printversion@v1.0.0$' +stdout '^'$WORK'[/\\]auto[/\\]replacement-version$' + +# 'go mod vendor' should repair vendor/modules.txt so that the implicit +# -mod=vendor works again. +env GOFLAGS= + +go mod edit -go=1.14 +go mod vendor + +go list -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]printversion$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]version$' + +# 'go mod init' should work if there is already a GOPATH-mode vendor directory +# present. If there are no module dependencies, -mod=vendor should be used by +# default and should not fail the consistency check even though no module +# information is present. + +rm go.mod +rm vendor/modules.txt + +go mod init example.com/auto +go list -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]printversion$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]version$' + +# If information about dependencies is added to a 1.14 go.mod file, subsequent +# list commands should error out if vendor/modules.txt is missing or incomplete. + +cp go.mod.orig go.mod +go mod edit -go=1.14 +! go list -f {{.Dir}} -tags tools all +stderr '^go: inconsistent vendoring in '$WORK/auto':$' +stderr '^\texample.com/printversion@v1.0.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt' +stderr '^\texample.com/unused: is replaced in go.mod, but not marked as replaced in vendor/modules.txt' +stderr '^\texample.com/version@v1.2.0: is replaced in go.mod, but not marked as replaced in vendor/modules.txt' +stderr '\n\nrun .go mod vendor. to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory$' + +# If -mod=vendor is set, limited consistency checks should apply even when +# the go version is 1.13 or earlier. +# An incomplete or missing vendor/modules.txt should resolve the vendored packages... +go mod edit -go=1.13 +go list -mod=vendor -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]printversion$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]version$' +! stderr 'not defaulting to -mod=vendor' + +# ...but a version mismatch for an explicit dependency should be noticed. +cp $WORK/modules-bad-1.13.txt vendor/modules.txt +! go list -mod=vendor -f {{.Dir}} -tags tools all +stderr '^go: inconsistent vendoring in '$WORK/auto':$' +stderr '^\texample.com/printversion@v1.0.0: is explicitly required in go.mod, but vendor/modules.txt indicates example.com/printversion@v1.1.0$' +stderr '\n\nrun .go mod vendor. to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory$' + +# 'go mod vendor' should write a 1.14 vendor/modules.txt even if +# the go version is still 1.13. +go mod vendor +cmp $WORK/modules-1.14.txt vendor/modules.txt + +go list -mod=vendor -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]printversion$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]version$' + +# When the version is upgraded to 1.14, -mod=vendor should kick in +# automatically and succeed. +go mod edit -go=1.14 +go list -f {{.Dir}} -tags tools all +stdout '^'$WORK'[/\\]auto$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]printversion$' +stdout '^'$WORK'[/\\]auto[/\\]vendor[/\\]example.com[/\\]version$' + +# 'go get' should update from the network or module cache, +# even if a vendor directory is present. +go get -u example.com/printversion +! go list -f {{.Dir}} -tags tools all +stderr '^go: inconsistent vendoring' + +-- $WORK/auto/go.mod -- +module example.com/auto + +go 1.13 + +require example.com/printversion v1.0.0 + +replace ( + example.com/unused => nonexistent.example.com/unused v1.0.0-whatever + example.com/version v1.0.0 => ./replacement-version + example.com/version v1.2.0 => nonexistent.example.com/version v1.2.0 +) +-- $WORK/auto/tools.go -- +// +build tools + +package auto + +import _ "example.com/printversion" +-- $WORK/auto/auto.go -- +package auto +-- $WORK/auto/replacement-version/go.mod -- +module example.com/version +-- $WORK/auto/replacement-version/version.go -- +package version + +const V = "v1.0.0-replaced" +-- $WORK/modules-1.14.txt -- +# example.com/printversion v1.0.0 +## explicit +example.com/printversion +# example.com/version v1.0.0 => ./replacement-version +example.com/version +# example.com/unused => nonexistent.example.com/unused v1.0.0-whatever +# example.com/version v1.2.0 => nonexistent.example.com/version v1.2.0 +-- $WORK/auto/vendor/modules.txt -- +# example.com/printversion v1.0.0 +example.com/printversion +# example.com/version v1.0.0 => ./replacement-version +example.com/version +-- $WORK/modules-bad-1.13.txt -- +# example.com/printversion v1.1.0 +example.com/printversion +# example.com/version v1.1.0 +example.com/version +-- $WORK/auto/vendor/example.com/printversion/go.mod -- +module example.com/printversion + +require example.com/version v1.0.0 +replace example.com/version v1.0.0 => ../oops v0.0.0 +exclude example.com/version v1.0.1 +-- $WORK/auto/vendor/example.com/printversion/printversion.go -- +package main + +import ( + "fmt" + "os" + "runtime/debug" + + _ "example.com/version" +) + +func main() { + info, _ := debug.ReadBuildInfo() + fmt.Fprintf(os.Stdout, "path is %s\n", info.Path) + fmt.Fprintf(os.Stdout, "main is %s %s\n", info.Main.Path, info.Main.Version) + for _, m := range info.Deps { + fmt.Fprintf(os.Stdout, "using %s %s\n", m.Path, m.Version) + } +} +-- $WORK/auto/vendor/example.com/version/version.go -- +package version + +const V = "v1.0.0-replaced" diff --git a/src/cmd/go/testdata/script/mod_vendor_build.txt b/src/cmd/go/testdata/script/mod_vendor_build.txt index 24920a36b66..0c359cea6e9 100644 --- a/src/cmd/go/testdata/script/mod_vendor_build.txt +++ b/src/cmd/go/testdata/script/mod_vendor_build.txt @@ -32,7 +32,7 @@ stdout m -- go.mod -- module m - +go 1.12 -- x.go -- package x import _ "rsc.io/quote" diff --git a/src/cmd/go/testdata/script/mod_vendor_replace.txt b/src/cmd/go/testdata/script/mod_vendor_replace.txt index 6bc1c77ed3d..a251daa6c14 100644 --- a/src/cmd/go/testdata/script/mod_vendor_replace.txt +++ b/src/cmd/go/testdata/script/mod_vendor_replace.txt @@ -1,7 +1,7 @@ env GO111MODULE=on # Before vendoring, we expect to see the original directory. -go list -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3 +go list -f '{{with .Module}}{{.Version}}{{end}} {{.Dir}}' rsc.io/quote/v3 stdout 'v3.0.0' stdout '.*[/\\]not-rsc.io[/\\]quote[/\\]v3' @@ -15,7 +15,7 @@ go mod vendor # without attempting to look up the non-replaced version. cmp vendor/rsc.io/quote/v3/quote.go local/not-rsc.io/quote/v3/quote.go -go list -mod=vendor -f '{{.Version}} {{.Dir}}' -m rsc.io/quote/v3 +go list -mod=vendor -f '{{with .Module}}{{.Version}}{{end}} {{.Dir}}' rsc.io/quote/v3 stdout 'v3.0.0' stdout '.*[/\\]vendor[/\\]rsc.io[/\\]quote[/\\]v3' ! stderr 'finding' diff --git a/src/cmd/go/testdata/script/mod_vendor_unused.txt b/src/cmd/go/testdata/script/mod_vendor_unused.txt new file mode 100644 index 00000000000..96251bb25ae --- /dev/null +++ b/src/cmd/go/testdata/script/mod_vendor_unused.txt @@ -0,0 +1,67 @@ +# Auxiliary test for inclusion of otherwise-unused replacements in +# vendor/modules.txt for golang.org/issue/33848. +# We need metadata about replacements in order to verify that modules.txt +# remains in sync with the main module's go.mod file. + +env GO111MODULE=on + +go mod vendor +cmp go1.14-modules.txt vendor/modules.txt + +-- go.mod -- +module example.com/foo +go 1.14 + +require ( + example.com/a v0.1.0 +) + +replace ( + example.com/a v0.1.0 => ./a + example.com/b v0.1.0 => ./b1 + example.com/b v0.2.0-unused => ./b2 + example.com/c => ./c + example.com/d v0.1.0 => ./d1 + example.com/d v0.2.0 => ./d2 + example.com/e => example.com/e v0.1.0-unused +) +-- foo.go -- +package foo +import _ "example.com/a" +-- a/go.mod -- +module example.com/a +require ( + example.com/b v0.1.0 // indirect + example.com/c v0.1.0 // indirect +) +-- a/a.go -- +package a +import _ "example.com/d" +-- b1/go.mod -- +module example.com/b +require example.com/d v0.1.0 +-- b2/go.mod -- +module example.com/b +require example.com/c v0.2.0 +-- c/go.mod -- +module example.com/c +require example.com/d v0.2.0 +-- d1/go.mod -- +module example.com/d +-- d1/d1.go -- +package d +-- d2/go.mod -- +module example.com/d +-- d2/d2.go -- +package d +-- go1.14-modules.txt -- +# example.com/a v0.1.0 => ./a +## explicit +example.com/a +# example.com/d v0.2.0 => ./d2 +example.com/d +# example.com/b v0.1.0 => ./b1 +# example.com/b v0.2.0-unused => ./b2 +# example.com/c => ./c +# example.com/d v0.1.0 => ./d1 +# example.com/e => example.com/e v0.1.0-unused diff --git a/src/cmd/go/testdata/src/testcache/testcache_test.go b/src/cmd/go/testdata/src/testcache/testcache_test.go index 9b2d1ea7824..3de7c42faea 100644 --- a/src/cmd/go/testdata/src/testcache/testcache_test.go +++ b/src/cmd/go/testdata/src/testcache/testcache_test.go @@ -72,7 +72,7 @@ func TestDirList(t *testing.T) { } func TestExec(t *testing.T) { - if runtime.GOOS == "plan9" || runtime.GOOS == "windows" || runtime.GOOS == "nacl" { + if runtime.GOOS == "plan9" || runtime.GOOS == "windows" { t.Skip("non-unix") } diff --git a/src/cmd/internal/obj/arm/asm5.go b/src/cmd/internal/obj/arm/asm5.go index b1fb1d39441..431b0aef972 100644 --- a/src/cmd/internal/obj/arm/asm5.go +++ b/src/cmd/internal/obj/arm/asm5.go @@ -365,276 +365,6 @@ var ( // The code that shifts the value << 28 has the responsibility // for XORing with C_SCOND_XOR too. -// asmoutnacl assembles the instruction p. It replaces asmout for NaCl. -// It returns the total number of bytes put in out, and it can change -// p->pc if extra padding is necessary. -// In rare cases, asmoutnacl might split p into two instructions. -// origPC is the PC for this Prog (no padding is taken into account). -func (c *ctxt5) asmoutnacl(origPC int32, p *obj.Prog, o *Optab, out []uint32) int { - size := int(o.size) - - // instruction specific - switch p.As { - default: - if out != nil { - c.asmout(p, o, out) - } - - case ADATABUNDLE, // align to 16-byte boundary - ADATABUNDLEEND: // zero width instruction, just to align next instruction to 16-byte boundary - p.Pc = (p.Pc + 15) &^ 15 - - if out != nil { - c.asmout(p, o, out) - } - - case obj.AUNDEF, - APLD: - size = 4 - if out != nil { - switch p.As { - case obj.AUNDEF: - out[0] = 0xe7fedef0 // NACL_INSTR_ARM_ABORT_NOW (UDF #0xEDE0) - - case APLD: - out[0] = 0xe1a01001 // (MOVW R1, R1) - } - } - - case AB, ABL: - if p.To.Type != obj.TYPE_MEM { - if out != nil { - c.asmout(p, o, out) - } - } else { - if p.To.Offset != 0 || size != 4 || p.To.Reg > REG_R15 || p.To.Reg < REG_R0 { - c.ctxt.Diag("unsupported instruction: %v", p) - } - if p.Pc&15 == 12 { - p.Pc += 4 - } - if out != nil { - out[0] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x03c0013f | (uint32(p.To.Reg)&15)<<12 | (uint32(p.To.Reg)&15)<<16 // BIC $0xc000000f, Rx - if p.As == AB { - out[1] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x012fff10 | (uint32(p.To.Reg)&15)<<0 // BX Rx - } else { // ABL - out[1] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x012fff30 | (uint32(p.To.Reg)&15)<<0 // BLX Rx - } - } - - size = 8 - } - - // align the last instruction (the actual BL) to the last instruction in a bundle - if p.As == ABL { - if p.To.Sym == deferreturn { - p.Pc = ((int64(origPC) + 15) &^ 15) + 16 - int64(size) - } else { - p.Pc += (16 - ((p.Pc + int64(size)) & 15)) & 15 - } - } - - case ALDREX, - ALDREXD, - AMOVB, - AMOVBS, - AMOVBU, - AMOVD, - AMOVF, - AMOVH, - AMOVHS, - AMOVHU, - AMOVM, - AMOVW, - ASTREX, - ASTREXD: - if p.To.Type == obj.TYPE_REG && p.To.Reg == REG_R15 && p.From.Reg == REG_R13 { // MOVW.W x(R13), PC - if out != nil { - c.asmout(p, o, out) - } - if size == 4 { - if out != nil { - // Note: 5c and 5g reg.c know that DIV/MOD smashes R12 - // so that this return instruction expansion is valid. - out[0] = out[0] &^ 0x3000 // change PC to R12 - out[1] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x03ccc13f // BIC $0xc000000f, R12 - out[2] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x012fff1c // BX R12 - } - - size += 8 - if (p.Pc+int64(size))&15 == 4 { - p.Pc += 4 - } - break - } else { - // if the instruction used more than 4 bytes, then it must have used a very large - // offset to update R13, so we need to additionally mask R13. - if out != nil { - out[size/4-1] &^= 0x3000 // change PC to R12 - out[size/4] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x03cdd103 // BIC $0xc0000000, R13 - out[size/4+1] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x03ccc13f // BIC $0xc000000f, R12 - out[size/4+2] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x012fff1c // BX R12 - } - - // p->pc+size is only ok at 4 or 12 mod 16. - if (p.Pc+int64(size))%8 == 0 { - p.Pc += 4 - } - size += 12 - break - } - } - - if p.To.Type == obj.TYPE_REG && p.To.Reg == REG_R15 { - c.ctxt.Diag("unsupported instruction (move to another register and use indirect jump instead): %v", p) - } - - if p.To.Type == obj.TYPE_MEM && p.To.Reg == REG_R13 && (p.Scond&C_WBIT != 0) && size > 4 { - // function prolog with very large frame size: MOVW.W R14,-100004(R13) - // split it into two instructions: - // ADD $-100004, R13 - // MOVW R14, 0(R13) - q := c.newprog() - - p.Scond &^= C_WBIT - *q = *p - a := &p.To - var a2 *obj.Addr - if p.To.Type == obj.TYPE_MEM { - a2 = &q.To - } else { - a2 = &q.From - } - nocache(q) - nocache(p) - - // insert q after p - q.Link = p.Link - - p.Link = q - q.Pcond = nil - - // make p into ADD $X, R13 - p.As = AADD - - p.From = *a - p.From.Reg = 0 - p.From.Type = obj.TYPE_CONST - p.To = obj.Addr{} - p.To.Type = obj.TYPE_REG - p.To.Reg = REG_R13 - - // make q into p but load/store from 0(R13) - q.Spadj = 0 - - *a2 = obj.Addr{} - a2.Type = obj.TYPE_MEM - a2.Reg = REG_R13 - a2.Sym = nil - a2.Offset = 0 - size = int(c.oplook(p).size) - break - } - - if (p.To.Type == obj.TYPE_MEM && p.To.Reg != REG_R9) || // MOVW Rx, X(Ry), y != 9 - (p.From.Type == obj.TYPE_MEM && p.From.Reg != REG_R9) { // MOVW X(Rx), Ry, x != 9 - var a *obj.Addr - if p.To.Type == obj.TYPE_MEM { - a = &p.To - } else { - a = &p.From - } - reg := int(a.Reg) - if size == 4 { - // if addr.reg == 0, then it is probably load from x(FP) with small x, no need to modify. - if reg == 0 { - if out != nil { - c.asmout(p, o, out) - } - } else { - if out != nil { - out[0] = ((uint32(p.Scond)&C_SCOND)^C_SCOND_XOR)<<28 | 0x03c00103 | (uint32(reg)&15)<<16 | (uint32(reg)&15)<<12 // BIC $0xc0000000, Rx - } - if p.Pc&15 == 12 { - p.Pc += 4 - } - size += 4 - if out != nil { - c.asmout(p, o, out[1:]) - } - } - - break - } else { - // if a load/store instruction takes more than 1 word to implement, then - // we need to separate the instruction into two: - // 1. explicitly load the address into R11. - // 2. load/store from R11. - // This won't handle .W/.P, so we should reject such code. - if p.Scond&(C_PBIT|C_WBIT) != 0 { - c.ctxt.Diag("unsupported instruction (.P/.W): %v", p) - } - q := c.newprog() - *q = *p - var a2 *obj.Addr - if p.To.Type == obj.TYPE_MEM { - a2 = &q.To - } else { - a2 = &q.From - } - nocache(q) - nocache(p) - - // insert q after p - q.Link = p.Link - - p.Link = q - q.Pcond = nil - - // make p into MOVW $X(R), R11 - p.As = AMOVW - - p.From = *a - p.From.Type = obj.TYPE_ADDR - p.To = obj.Addr{} - p.To.Type = obj.TYPE_REG - p.To.Reg = REG_R11 - - // make q into p but load/store from 0(R11) - *a2 = obj.Addr{} - - a2.Type = obj.TYPE_MEM - a2.Reg = REG_R11 - a2.Sym = nil - a2.Offset = 0 - size = int(c.oplook(p).size) - break - } - } else if out != nil { - c.asmout(p, o, out) - } - } - - // destination register specific - if p.To.Type == obj.TYPE_REG { - switch p.To.Reg { - case REG_R9: - c.ctxt.Diag("invalid instruction, cannot write to R9: %v", p) - - case REG_R13: - if out != nil { - out[size/4] = 0xe3cdd103 // BIC $0xc0000000, R13 - } - if (p.Pc+int64(size))&15 == 0 { - p.Pc += 4 - } - size += 4 - } - } - - return size -} - func checkSuffix(c *ctxt5, p *obj.Prog, o *Optab) { if p.Scond&C_SBIT != 0 && o.scond&C_SBIT == 0 { c.ctxt.Diag("invalid .S suffix: %v", p) @@ -685,13 +415,7 @@ func span5(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.Pc = int64(pc) o = c.oplook(p) - if ctxt.Headtype != objabi.Hnacl { - m = int(o.size) - } else { - m = c.asmoutnacl(pc, p, o, nil) - pc = int32(p.Pc) // asmoutnacl might change pc for alignment - o = c.oplook(p) // asmoutnacl might change p in rare cases - } + m = int(o.size) if m%4 != 0 || p.Pc%4 != 0 { ctxt.Diag("!pc invalid: %v size=%d", p, m) @@ -783,12 +507,7 @@ func span5(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { } */ opc = int32(p.Pc) - - if ctxt.Headtype != objabi.Hnacl { - m = int(o.size) - } else { - m = c.asmoutnacl(pc, p, o, nil) - } + m = int(o.size) if p.Pc != int64(opc) { bflag = 1 } @@ -844,15 +563,8 @@ func span5(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { c.pc = p.Pc o = c.oplook(p) opc = int32(p.Pc) - if ctxt.Headtype != objabi.Hnacl { - c.asmout(p, o, out[:]) - m = int(o.size) - } else { - m = c.asmoutnacl(pc, p, o, out[:]) - if int64(opc) != p.Pc { - ctxt.Diag("asmoutnacl broken: pc changed (%d->%d) in last stage: %v", opc, int32(p.Pc), p) - } - } + c.asmout(p, o, out[:]) + m = int(o.size) if m%4 != 0 || p.Pc%4 != 0 { ctxt.Diag("final stage: pc invalid: %v size=%d", p, m) @@ -934,14 +646,6 @@ func (c *ctxt5) flushpool(p *obj.Prog, skip int, force int) bool { } else if force == 0 && (p.Pc+int64(12+c.pool.size)-int64(c.pool.start) < 2048) { // 12 take into account the maximum nacl literal pool alignment padding size return false } - if c.ctxt.Headtype == objabi.Hnacl && c.pool.size%16 != 0 { - // if pool is not multiple of 16 bytes, add an alignment marker - q := c.newprog() - - q.As = ADATABUNDLEEND - c.elitrl.Link = q - c.elitrl = q - } // The line number for constant pool entries doesn't really matter. // We set it to the line number of the preceding instruction so that @@ -1002,22 +706,6 @@ func (c *ctxt5) addpool(p *obj.Prog, a *obj.Addr) { } } - if c.ctxt.Headtype == objabi.Hnacl && c.pool.size%16 == 0 { - // start a new data bundle - q := c.newprog() - q.As = ADATABUNDLE - q.Pc = int64(c.pool.size) - c.pool.size += 4 - if c.blitrl == nil { - c.blitrl = q - c.pool.start = uint32(p.Pc) - } else { - c.elitrl.Link = q - } - - c.elitrl = q - } - q := c.newprog() *q = *t q.Pc = int64(c.pool.size) @@ -1286,15 +974,11 @@ func (c *ctxt5) aclass(a *obj.Addr) int { if uint32(c.instoffset) <= 0xffff && objabi.GOARM == 7 { return C_SCON } - if c.ctxt.Headtype != objabi.Hnacl { - // Don't split instructions on NaCl. The validator is not - // happy with it. See Issue 20595. - if x, y := immrot2a(uint32(c.instoffset)); x != 0 && y != 0 { - return C_RCON2A - } - if y, x := immrot2s(uint32(c.instoffset)); x != 0 && y != 0 { - return C_RCON2S - } + if x, y := immrot2a(uint32(c.instoffset)); x != 0 && y != 0 { + return C_RCON2A + } + if y, x := immrot2s(uint32(c.instoffset)); x != 0 && y != 0 { + return C_RCON2S } return C_LCON diff --git a/src/cmd/internal/obj/arm64/a.out.go b/src/cmd/internal/obj/arm64/a.out.go index 4e5eb75a22e..bd9e9542b8d 100644 --- a/src/cmd/internal/obj/arm64/a.out.go +++ b/src/cmd/internal/obj/arm64/a.out.go @@ -195,11 +195,11 @@ const ( // Special registers, after subtracting obj.RBaseARM64, bit 12 indicates // a special register and the low bits select the register. -// AUTO_SYSREG_END is the last item in the automatically generated system register +// SYSREG_END is the last item in the automatically generated system register // declaration, and it is defined in the sysRegEnc.go file. const ( REG_SPECIAL = obj.RBaseARM64 + 1<<12 - REG_DAIFSet = AUTO_SYSREG_END + iota + REG_DAIFSet = SYSREG_END + iota REG_DAIFClr REG_PLDL1KEEP REG_PLDL1STRM diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go index c7fa943e7e7..7c3e1d18a54 100644 --- a/src/cmd/internal/obj/arm64/asm7.go +++ b/src/cmd/internal/obj/arm64/asm7.go @@ -3543,15 +3543,17 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) { case 35: /* mov SPR,R -> mrs */ o1 = c.oprrr(p, AMRS) - v := uint32(0) - // SysRegEnc function returns the system register encoding. - _, v = SysRegEnc(p.From.Reg) + // SysRegEnc function returns the system register encoding and accessFlags. + _, v, accessFlags := SysRegEnc(p.From.Reg) if v == 0 { c.ctxt.Diag("illegal system register:\n%v", p) } if (o1 & (v &^ (3 << 19))) != 0 { c.ctxt.Diag("MRS register value overlap\n%v", p) } + if accessFlags&SR_READ == 0 { + c.ctxt.Diag("system register is not readable: %v", p) + } o1 |= v o1 |= uint32(p.To.Reg & 31) @@ -3559,15 +3561,17 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) { case 36: /* mov R,SPR */ o1 = c.oprrr(p, AMSR) - v := uint32(0) - // SysRegEnc function returns the system register encoding. - _, v = SysRegEnc(p.To.Reg) + // SysRegEnc function returns the system register encoding and accessFlags. + _, v, accessFlags := SysRegEnc(p.To.Reg) if v == 0 { c.ctxt.Diag("illegal system register:\n%v", p) } if (o1 & (v &^ (3 << 19))) != 0 { c.ctxt.Diag("MSR register value overlap\n%v", p) } + if accessFlags&SR_WRITE == 0 { + c.ctxt.Diag("system register is not writable: %v", p) + } o1 |= v o1 |= uint32(p.From.Reg & 31) diff --git a/src/cmd/internal/obj/arm64/list7.go b/src/cmd/internal/obj/arm64/list7.go index a4bf00513fb..e63a4815f98 100644 --- a/src/cmd/internal/obj/arm64/list7.go +++ b/src/cmd/internal/obj/arm64/list7.go @@ -209,7 +209,7 @@ func rconv(r int) string { return fmt.Sprintf("V%d.%s", r&31, arrange((r>>5)&15)) } // Return system register name. - name, _ := SysRegEnc(int16(r)) + name, _, _ := SysRegEnc(int16(r)) if name != "" { return name } diff --git a/src/cmd/internal/obj/arm64/sysRegEnc.go b/src/cmd/internal/obj/arm64/sysRegEnc.go index ac6dcec3155..7760a4483cd 100644 --- a/src/cmd/internal/obj/arm64/sysRegEnc.go +++ b/src/cmd/internal/obj/arm64/sysRegEnc.go @@ -1,13 +1,9 @@ -// DO NOT EDIT -// This file is auto-generated by the following steps, and the sysreggen.go is located at x/arch/arm64/arm64spec/. -// 1. Get the system register xml files from https://developer.arm.com/-/media/Files/ATG/Beta10/SysReg_xml_v85A-2019-06.tar.gz -// 2. Extract SysReg_xml_v85A-2019-06.tar/SysReg_xml_v85A-2019-06/SysReg_xml_v85A-2019-06/AArch64-*.xml to ./files folder -// 3. Run the command: go run sysreggen.go +// Code generated by arm64gen -i ./files -o sysRegEnc.go. DO NOT EDIT. package arm64 const ( - AUTO_SYSREG_BEGIN = REG_SPECIAL + iota + SYSREG_BEGIN = REG_SPECIAL + iota REG_ACTLR_EL1 REG_AFSR0_EL1 REG_AFSR1_EL1 @@ -439,454 +435,461 @@ const ( REG_UAO REG_VBAR_EL1 REG_ZCR_EL1 - AUTO_SYSREG_END + SYSREG_END +) + +const ( + SR_READ = 1 << iota + SR_WRITE ) var SystemReg = []struct { Name string Reg int16 Enc uint32 + // AccessFlags is the readable and writeable property of system register. + AccessFlags uint8 }{ - {"ACTLR_EL1", REG_ACTLR_EL1, 0x181020}, - {"AFSR0_EL1", REG_AFSR0_EL1, 0x185100}, - {"AFSR1_EL1", REG_AFSR1_EL1, 0x185120}, - {"AIDR_EL1", REG_AIDR_EL1, 0x1900e0}, - {"AMAIR_EL1", REG_AMAIR_EL1, 0x18a300}, - {"AMCFGR_EL0", REG_AMCFGR_EL0, 0x1bd220}, - {"AMCGCR_EL0", REG_AMCGCR_EL0, 0x1bd240}, - {"AMCNTENCLR0_EL0", REG_AMCNTENCLR0_EL0, 0x1bd280}, - {"AMCNTENCLR1_EL0", REG_AMCNTENCLR1_EL0, 0x1bd300}, - {"AMCNTENSET0_EL0", REG_AMCNTENSET0_EL0, 0x1bd2a0}, - {"AMCNTENSET1_EL0", REG_AMCNTENSET1_EL0, 0x1bd320}, - {"AMCR_EL0", REG_AMCR_EL0, 0x1bd200}, - {"AMEVCNTR00_EL0", REG_AMEVCNTR00_EL0, 0x1bd400}, - {"AMEVCNTR01_EL0", REG_AMEVCNTR01_EL0, 0x1bd420}, - {"AMEVCNTR02_EL0", REG_AMEVCNTR02_EL0, 0x1bd440}, - {"AMEVCNTR03_EL0", REG_AMEVCNTR03_EL0, 0x1bd460}, - {"AMEVCNTR04_EL0", REG_AMEVCNTR04_EL0, 0x1bd480}, - {"AMEVCNTR05_EL0", REG_AMEVCNTR05_EL0, 0x1bd4a0}, - {"AMEVCNTR06_EL0", REG_AMEVCNTR06_EL0, 0x1bd4c0}, - {"AMEVCNTR07_EL0", REG_AMEVCNTR07_EL0, 0x1bd4e0}, - {"AMEVCNTR08_EL0", REG_AMEVCNTR08_EL0, 0x1bd500}, - {"AMEVCNTR09_EL0", REG_AMEVCNTR09_EL0, 0x1bd520}, - {"AMEVCNTR010_EL0", REG_AMEVCNTR010_EL0, 0x1bd540}, - {"AMEVCNTR011_EL0", REG_AMEVCNTR011_EL0, 0x1bd560}, - {"AMEVCNTR012_EL0", REG_AMEVCNTR012_EL0, 0x1bd580}, - {"AMEVCNTR013_EL0", REG_AMEVCNTR013_EL0, 0x1bd5a0}, - {"AMEVCNTR014_EL0", REG_AMEVCNTR014_EL0, 0x1bd5c0}, - {"AMEVCNTR015_EL0", REG_AMEVCNTR015_EL0, 0x1bd5e0}, - {"AMEVCNTR10_EL0", REG_AMEVCNTR10_EL0, 0x1bdc00}, - {"AMEVCNTR11_EL0", REG_AMEVCNTR11_EL0, 0x1bdc20}, - {"AMEVCNTR12_EL0", REG_AMEVCNTR12_EL0, 0x1bdc40}, - {"AMEVCNTR13_EL0", REG_AMEVCNTR13_EL0, 0x1bdc60}, - {"AMEVCNTR14_EL0", REG_AMEVCNTR14_EL0, 0x1bdc80}, - {"AMEVCNTR15_EL0", REG_AMEVCNTR15_EL0, 0x1bdca0}, - {"AMEVCNTR16_EL0", REG_AMEVCNTR16_EL0, 0x1bdcc0}, - {"AMEVCNTR17_EL0", REG_AMEVCNTR17_EL0, 0x1bdce0}, - {"AMEVCNTR18_EL0", REG_AMEVCNTR18_EL0, 0x1bdd00}, - {"AMEVCNTR19_EL0", REG_AMEVCNTR19_EL0, 0x1bdd20}, - {"AMEVCNTR110_EL0", REG_AMEVCNTR110_EL0, 0x1bdd40}, - {"AMEVCNTR111_EL0", REG_AMEVCNTR111_EL0, 0x1bdd60}, - {"AMEVCNTR112_EL0", REG_AMEVCNTR112_EL0, 0x1bdd80}, - {"AMEVCNTR113_EL0", REG_AMEVCNTR113_EL0, 0x1bdda0}, - {"AMEVCNTR114_EL0", REG_AMEVCNTR114_EL0, 0x1bddc0}, - {"AMEVCNTR115_EL0", REG_AMEVCNTR115_EL0, 0x1bdde0}, - {"AMEVTYPER00_EL0", REG_AMEVTYPER00_EL0, 0x1bd600}, - {"AMEVTYPER01_EL0", REG_AMEVTYPER01_EL0, 0x1bd620}, - {"AMEVTYPER02_EL0", REG_AMEVTYPER02_EL0, 0x1bd640}, - {"AMEVTYPER03_EL0", REG_AMEVTYPER03_EL0, 0x1bd660}, - {"AMEVTYPER04_EL0", REG_AMEVTYPER04_EL0, 0x1bd680}, - {"AMEVTYPER05_EL0", REG_AMEVTYPER05_EL0, 0x1bd6a0}, - {"AMEVTYPER06_EL0", REG_AMEVTYPER06_EL0, 0x1bd6c0}, - {"AMEVTYPER07_EL0", REG_AMEVTYPER07_EL0, 0x1bd6e0}, - {"AMEVTYPER08_EL0", REG_AMEVTYPER08_EL0, 0x1bd700}, - {"AMEVTYPER09_EL0", REG_AMEVTYPER09_EL0, 0x1bd720}, - {"AMEVTYPER010_EL0", REG_AMEVTYPER010_EL0, 0x1bd740}, - {"AMEVTYPER011_EL0", REG_AMEVTYPER011_EL0, 0x1bd760}, - {"AMEVTYPER012_EL0", REG_AMEVTYPER012_EL0, 0x1bd780}, - {"AMEVTYPER013_EL0", REG_AMEVTYPER013_EL0, 0x1bd7a0}, - {"AMEVTYPER014_EL0", REG_AMEVTYPER014_EL0, 0x1bd7c0}, - {"AMEVTYPER015_EL0", REG_AMEVTYPER015_EL0, 0x1bd7e0}, - {"AMEVTYPER10_EL0", REG_AMEVTYPER10_EL0, 0x1bde00}, - {"AMEVTYPER11_EL0", REG_AMEVTYPER11_EL0, 0x1bde20}, - {"AMEVTYPER12_EL0", REG_AMEVTYPER12_EL0, 0x1bde40}, - {"AMEVTYPER13_EL0", REG_AMEVTYPER13_EL0, 0x1bde60}, - {"AMEVTYPER14_EL0", REG_AMEVTYPER14_EL0, 0x1bde80}, - {"AMEVTYPER15_EL0", REG_AMEVTYPER15_EL0, 0x1bdea0}, - {"AMEVTYPER16_EL0", REG_AMEVTYPER16_EL0, 0x1bdec0}, - {"AMEVTYPER17_EL0", REG_AMEVTYPER17_EL0, 0x1bdee0}, - {"AMEVTYPER18_EL0", REG_AMEVTYPER18_EL0, 0x1bdf00}, - {"AMEVTYPER19_EL0", REG_AMEVTYPER19_EL0, 0x1bdf20}, - {"AMEVTYPER110_EL0", REG_AMEVTYPER110_EL0, 0x1bdf40}, - {"AMEVTYPER111_EL0", REG_AMEVTYPER111_EL0, 0x1bdf60}, - {"AMEVTYPER112_EL0", REG_AMEVTYPER112_EL0, 0x1bdf80}, - {"AMEVTYPER113_EL0", REG_AMEVTYPER113_EL0, 0x1bdfa0}, - {"AMEVTYPER114_EL0", REG_AMEVTYPER114_EL0, 0x1bdfc0}, - {"AMEVTYPER115_EL0", REG_AMEVTYPER115_EL0, 0x1bdfe0}, - {"AMUSERENR_EL0", REG_AMUSERENR_EL0, 0x1bd260}, - {"APDAKeyHi_EL1", REG_APDAKeyHi_EL1, 0x182220}, - {"APDAKeyLo_EL1", REG_APDAKeyLo_EL1, 0x182200}, - {"APDBKeyHi_EL1", REG_APDBKeyHi_EL1, 0x182260}, - {"APDBKeyLo_EL1", REG_APDBKeyLo_EL1, 0x182240}, - {"APGAKeyHi_EL1", REG_APGAKeyHi_EL1, 0x182320}, - {"APGAKeyLo_EL1", REG_APGAKeyLo_EL1, 0x182300}, - {"APIAKeyHi_EL1", REG_APIAKeyHi_EL1, 0x182120}, - {"APIAKeyLo_EL1", REG_APIAKeyLo_EL1, 0x182100}, - {"APIBKeyHi_EL1", REG_APIBKeyHi_EL1, 0x182160}, - {"APIBKeyLo_EL1", REG_APIBKeyLo_EL1, 0x182140}, - {"CCSIDR2_EL1", REG_CCSIDR2_EL1, 0x190040}, - {"CCSIDR_EL1", REG_CCSIDR_EL1, 0x190000}, - {"CLIDR_EL1", REG_CLIDR_EL1, 0x190020}, - {"CNTFRQ_EL0", REG_CNTFRQ_EL0, 0x1be000}, - {"CNTKCTL_EL1", REG_CNTKCTL_EL1, 0x18e100}, - {"CNTP_CTL_EL0", REG_CNTP_CTL_EL0, 0x1be220}, - {"CNTP_CVAL_EL0", REG_CNTP_CVAL_EL0, 0x1be240}, - {"CNTP_TVAL_EL0", REG_CNTP_TVAL_EL0, 0x1be200}, - {"CNTPCT_EL0", REG_CNTPCT_EL0, 0x1be020}, - {"CNTPS_CTL_EL1", REG_CNTPS_CTL_EL1, 0x1fe220}, - {"CNTPS_CVAL_EL1", REG_CNTPS_CVAL_EL1, 0x1fe240}, - {"CNTPS_TVAL_EL1", REG_CNTPS_TVAL_EL1, 0x1fe200}, - {"CNTV_CTL_EL0", REG_CNTV_CTL_EL0, 0x1be320}, - {"CNTV_CVAL_EL0", REG_CNTV_CVAL_EL0, 0x1be340}, - {"CNTV_TVAL_EL0", REG_CNTV_TVAL_EL0, 0x1be300}, - {"CNTVCT_EL0", REG_CNTVCT_EL0, 0x1be040}, - {"CONTEXTIDR_EL1", REG_CONTEXTIDR_EL1, 0x18d020}, - {"CPACR_EL1", REG_CPACR_EL1, 0x181040}, - {"CSSELR_EL1", REG_CSSELR_EL1, 0x1a0000}, - {"CTR_EL0", REG_CTR_EL0, 0x1b0020}, - {"CurrentEL", REG_CurrentEL, 0x184240}, - {"DAIF", REG_DAIF, 0x1b4220}, - {"DBGAUTHSTATUS_EL1", REG_DBGAUTHSTATUS_EL1, 0x107ec0}, - {"DBGBCR0_EL1", REG_DBGBCR0_EL1, 0x1000a0}, - {"DBGBCR1_EL1", REG_DBGBCR1_EL1, 0x1001a0}, - {"DBGBCR2_EL1", REG_DBGBCR2_EL1, 0x1002a0}, - {"DBGBCR3_EL1", REG_DBGBCR3_EL1, 0x1003a0}, - {"DBGBCR4_EL1", REG_DBGBCR4_EL1, 0x1004a0}, - {"DBGBCR5_EL1", REG_DBGBCR5_EL1, 0x1005a0}, - {"DBGBCR6_EL1", REG_DBGBCR6_EL1, 0x1006a0}, - {"DBGBCR7_EL1", REG_DBGBCR7_EL1, 0x1007a0}, - {"DBGBCR8_EL1", REG_DBGBCR8_EL1, 0x1008a0}, - {"DBGBCR9_EL1", REG_DBGBCR9_EL1, 0x1009a0}, - {"DBGBCR10_EL1", REG_DBGBCR10_EL1, 0x100aa0}, - {"DBGBCR11_EL1", REG_DBGBCR11_EL1, 0x100ba0}, - {"DBGBCR12_EL1", REG_DBGBCR12_EL1, 0x100ca0}, - {"DBGBCR13_EL1", REG_DBGBCR13_EL1, 0x100da0}, - {"DBGBCR14_EL1", REG_DBGBCR14_EL1, 0x100ea0}, - {"DBGBCR15_EL1", REG_DBGBCR15_EL1, 0x100fa0}, - {"DBGBVR0_EL1", REG_DBGBVR0_EL1, 0x100080}, - {"DBGBVR1_EL1", REG_DBGBVR1_EL1, 0x100180}, - {"DBGBVR2_EL1", REG_DBGBVR2_EL1, 0x100280}, - {"DBGBVR3_EL1", REG_DBGBVR3_EL1, 0x100380}, - {"DBGBVR4_EL1", REG_DBGBVR4_EL1, 0x100480}, - {"DBGBVR5_EL1", REG_DBGBVR5_EL1, 0x100580}, - {"DBGBVR6_EL1", REG_DBGBVR6_EL1, 0x100680}, - {"DBGBVR7_EL1", REG_DBGBVR7_EL1, 0x100780}, - {"DBGBVR8_EL1", REG_DBGBVR8_EL1, 0x100880}, - {"DBGBVR9_EL1", REG_DBGBVR9_EL1, 0x100980}, - {"DBGBVR10_EL1", REG_DBGBVR10_EL1, 0x100a80}, - {"DBGBVR11_EL1", REG_DBGBVR11_EL1, 0x100b80}, - {"DBGBVR12_EL1", REG_DBGBVR12_EL1, 0x100c80}, - {"DBGBVR13_EL1", REG_DBGBVR13_EL1, 0x100d80}, - {"DBGBVR14_EL1", REG_DBGBVR14_EL1, 0x100e80}, - {"DBGBVR15_EL1", REG_DBGBVR15_EL1, 0x100f80}, - {"DBGCLAIMCLR_EL1", REG_DBGCLAIMCLR_EL1, 0x1079c0}, - {"DBGCLAIMSET_EL1", REG_DBGCLAIMSET_EL1, 0x1078c0}, - {"DBGDTR_EL0", REG_DBGDTR_EL0, 0x130400}, - {"DBGDTRRX_EL0", REG_DBGDTRRX_EL0, 0x130500}, - {"DBGDTRTX_EL0", REG_DBGDTRTX_EL0, 0x130500}, - {"DBGPRCR_EL1", REG_DBGPRCR_EL1, 0x101480}, - {"DBGWCR0_EL1", REG_DBGWCR0_EL1, 0x1000e0}, - {"DBGWCR1_EL1", REG_DBGWCR1_EL1, 0x1001e0}, - {"DBGWCR2_EL1", REG_DBGWCR2_EL1, 0x1002e0}, - {"DBGWCR3_EL1", REG_DBGWCR3_EL1, 0x1003e0}, - {"DBGWCR4_EL1", REG_DBGWCR4_EL1, 0x1004e0}, - {"DBGWCR5_EL1", REG_DBGWCR5_EL1, 0x1005e0}, - {"DBGWCR6_EL1", REG_DBGWCR6_EL1, 0x1006e0}, - {"DBGWCR7_EL1", REG_DBGWCR7_EL1, 0x1007e0}, - {"DBGWCR8_EL1", REG_DBGWCR8_EL1, 0x1008e0}, - {"DBGWCR9_EL1", REG_DBGWCR9_EL1, 0x1009e0}, - {"DBGWCR10_EL1", REG_DBGWCR10_EL1, 0x100ae0}, - {"DBGWCR11_EL1", REG_DBGWCR11_EL1, 0x100be0}, - {"DBGWCR12_EL1", REG_DBGWCR12_EL1, 0x100ce0}, - {"DBGWCR13_EL1", REG_DBGWCR13_EL1, 0x100de0}, - {"DBGWCR14_EL1", REG_DBGWCR14_EL1, 0x100ee0}, - {"DBGWCR15_EL1", REG_DBGWCR15_EL1, 0x100fe0}, - {"DBGWVR0_EL1", REG_DBGWVR0_EL1, 0x1000c0}, - {"DBGWVR1_EL1", REG_DBGWVR1_EL1, 0x1001c0}, - {"DBGWVR2_EL1", REG_DBGWVR2_EL1, 0x1002c0}, - {"DBGWVR3_EL1", REG_DBGWVR3_EL1, 0x1003c0}, - {"DBGWVR4_EL1", REG_DBGWVR4_EL1, 0x1004c0}, - {"DBGWVR5_EL1", REG_DBGWVR5_EL1, 0x1005c0}, - {"DBGWVR6_EL1", REG_DBGWVR6_EL1, 0x1006c0}, - {"DBGWVR7_EL1", REG_DBGWVR7_EL1, 0x1007c0}, - {"DBGWVR8_EL1", REG_DBGWVR8_EL1, 0x1008c0}, - {"DBGWVR9_EL1", REG_DBGWVR9_EL1, 0x1009c0}, - {"DBGWVR10_EL1", REG_DBGWVR10_EL1, 0x100ac0}, - {"DBGWVR11_EL1", REG_DBGWVR11_EL1, 0x100bc0}, - {"DBGWVR12_EL1", REG_DBGWVR12_EL1, 0x100cc0}, - {"DBGWVR13_EL1", REG_DBGWVR13_EL1, 0x100dc0}, - {"DBGWVR14_EL1", REG_DBGWVR14_EL1, 0x100ec0}, - {"DBGWVR15_EL1", REG_DBGWVR15_EL1, 0x100fc0}, - {"DCZID_EL0", REG_DCZID_EL0, 0x1b00e0}, - {"DISR_EL1", REG_DISR_EL1, 0x18c120}, - {"DIT", REG_DIT, 0x1b42a0}, - {"DLR_EL0", REG_DLR_EL0, 0x1b4520}, - {"DSPSR_EL0", REG_DSPSR_EL0, 0x1b4500}, - {"ELR_EL1", REG_ELR_EL1, 0x184020}, - {"ERRIDR_EL1", REG_ERRIDR_EL1, 0x185300}, - {"ERRSELR_EL1", REG_ERRSELR_EL1, 0x185320}, - {"ERXADDR_EL1", REG_ERXADDR_EL1, 0x185460}, - {"ERXCTLR_EL1", REG_ERXCTLR_EL1, 0x185420}, - {"ERXFR_EL1", REG_ERXFR_EL1, 0x185400}, - {"ERXMISC0_EL1", REG_ERXMISC0_EL1, 0x185500}, - {"ERXMISC1_EL1", REG_ERXMISC1_EL1, 0x185520}, - {"ERXMISC2_EL1", REG_ERXMISC2_EL1, 0x185540}, - {"ERXMISC3_EL1", REG_ERXMISC3_EL1, 0x185560}, - {"ERXPFGCDN_EL1", REG_ERXPFGCDN_EL1, 0x1854c0}, - {"ERXPFGCTL_EL1", REG_ERXPFGCTL_EL1, 0x1854a0}, - {"ERXPFGF_EL1", REG_ERXPFGF_EL1, 0x185480}, - {"ERXSTATUS_EL1", REG_ERXSTATUS_EL1, 0x185440}, - {"ESR_EL1", REG_ESR_EL1, 0x185200}, - {"FAR_EL1", REG_FAR_EL1, 0x186000}, - {"FPCR", REG_FPCR, 0x1b4400}, - {"FPSR", REG_FPSR, 0x1b4420}, - {"GCR_EL1", REG_GCR_EL1, 0x1810c0}, - {"GMID_EL1", REG_GMID_EL1, 0x31400}, - {"ICC_AP0R0_EL1", REG_ICC_AP0R0_EL1, 0x18c880}, - {"ICC_AP0R1_EL1", REG_ICC_AP0R1_EL1, 0x18c8a0}, - {"ICC_AP0R2_EL1", REG_ICC_AP0R2_EL1, 0x18c8c0}, - {"ICC_AP0R3_EL1", REG_ICC_AP0R3_EL1, 0x18c8e0}, - {"ICC_AP1R0_EL1", REG_ICC_AP1R0_EL1, 0x18c900}, - {"ICC_AP1R1_EL1", REG_ICC_AP1R1_EL1, 0x18c920}, - {"ICC_AP1R2_EL1", REG_ICC_AP1R2_EL1, 0x18c940}, - {"ICC_AP1R3_EL1", REG_ICC_AP1R3_EL1, 0x18c960}, - {"ICC_ASGI1R_EL1", REG_ICC_ASGI1R_EL1, 0x18cbc0}, - {"ICC_BPR0_EL1", REG_ICC_BPR0_EL1, 0x18c860}, - {"ICC_BPR1_EL1", REG_ICC_BPR1_EL1, 0x18cc60}, - {"ICC_CTLR_EL1", REG_ICC_CTLR_EL1, 0x18cc80}, - {"ICC_DIR_EL1", REG_ICC_DIR_EL1, 0x18cb20}, - {"ICC_EOIR0_EL1", REG_ICC_EOIR0_EL1, 0x18c820}, - {"ICC_EOIR1_EL1", REG_ICC_EOIR1_EL1, 0x18cc20}, - {"ICC_HPPIR0_EL1", REG_ICC_HPPIR0_EL1, 0x18c840}, - {"ICC_HPPIR1_EL1", REG_ICC_HPPIR1_EL1, 0x18cc40}, - {"ICC_IAR0_EL1", REG_ICC_IAR0_EL1, 0x18c800}, - {"ICC_IAR1_EL1", REG_ICC_IAR1_EL1, 0x18cc00}, - {"ICC_IGRPEN0_EL1", REG_ICC_IGRPEN0_EL1, 0x18ccc0}, - {"ICC_IGRPEN1_EL1", REG_ICC_IGRPEN1_EL1, 0x18cce0}, - {"ICC_PMR_EL1", REG_ICC_PMR_EL1, 0x184600}, - {"ICC_RPR_EL1", REG_ICC_RPR_EL1, 0x18cb60}, - {"ICC_SGI0R_EL1", REG_ICC_SGI0R_EL1, 0x18cbe0}, - {"ICC_SGI1R_EL1", REG_ICC_SGI1R_EL1, 0x18cba0}, - {"ICC_SRE_EL1", REG_ICC_SRE_EL1, 0x18cca0}, - {"ICV_AP0R0_EL1", REG_ICV_AP0R0_EL1, 0x18c880}, - {"ICV_AP0R1_EL1", REG_ICV_AP0R1_EL1, 0x18c8a0}, - {"ICV_AP0R2_EL1", REG_ICV_AP0R2_EL1, 0x18c8c0}, - {"ICV_AP0R3_EL1", REG_ICV_AP0R3_EL1, 0x18c8e0}, - {"ICV_AP1R0_EL1", REG_ICV_AP1R0_EL1, 0x18c900}, - {"ICV_AP1R1_EL1", REG_ICV_AP1R1_EL1, 0x18c920}, - {"ICV_AP1R2_EL1", REG_ICV_AP1R2_EL1, 0x18c940}, - {"ICV_AP1R3_EL1", REG_ICV_AP1R3_EL1, 0x18c960}, - {"ICV_BPR0_EL1", REG_ICV_BPR0_EL1, 0x18c860}, - {"ICV_BPR1_EL1", REG_ICV_BPR1_EL1, 0x18cc60}, - {"ICV_CTLR_EL1", REG_ICV_CTLR_EL1, 0x18cc80}, - {"ICV_DIR_EL1", REG_ICV_DIR_EL1, 0x18cb20}, - {"ICV_EOIR0_EL1", REG_ICV_EOIR0_EL1, 0x18c820}, - {"ICV_EOIR1_EL1", REG_ICV_EOIR1_EL1, 0x18cc20}, - {"ICV_HPPIR0_EL1", REG_ICV_HPPIR0_EL1, 0x18c840}, - {"ICV_HPPIR1_EL1", REG_ICV_HPPIR1_EL1, 0x18cc40}, - {"ICV_IAR0_EL1", REG_ICV_IAR0_EL1, 0x18c800}, - {"ICV_IAR1_EL1", REG_ICV_IAR1_EL1, 0x18cc00}, - {"ICV_IGRPEN0_EL1", REG_ICV_IGRPEN0_EL1, 0x18ccc0}, - {"ICV_IGRPEN1_EL1", REG_ICV_IGRPEN1_EL1, 0x18cce0}, - {"ICV_PMR_EL1", REG_ICV_PMR_EL1, 0x184600}, - {"ICV_RPR_EL1", REG_ICV_RPR_EL1, 0x18cb60}, - {"ID_AA64AFR0_EL1", REG_ID_AA64AFR0_EL1, 0x180580}, - {"ID_AA64AFR1_EL1", REG_ID_AA64AFR1_EL1, 0x1805a0}, - {"ID_AA64DFR0_EL1", REG_ID_AA64DFR0_EL1, 0x180500}, - {"ID_AA64DFR1_EL1", REG_ID_AA64DFR1_EL1, 0x180520}, - {"ID_AA64ISAR0_EL1", REG_ID_AA64ISAR0_EL1, 0x180600}, - {"ID_AA64ISAR1_EL1", REG_ID_AA64ISAR1_EL1, 0x180620}, - {"ID_AA64MMFR0_EL1", REG_ID_AA64MMFR0_EL1, 0x180700}, - {"ID_AA64MMFR1_EL1", REG_ID_AA64MMFR1_EL1, 0x180720}, - {"ID_AA64MMFR2_EL1", REG_ID_AA64MMFR2_EL1, 0x180740}, - {"ID_AA64PFR0_EL1", REG_ID_AA64PFR0_EL1, 0x180400}, - {"ID_AA64PFR1_EL1", REG_ID_AA64PFR1_EL1, 0x180420}, - {"ID_AA64ZFR0_EL1", REG_ID_AA64ZFR0_EL1, 0x180480}, - {"ID_AFR0_EL1", REG_ID_AFR0_EL1, 0x180160}, - {"ID_DFR0_EL1", REG_ID_DFR0_EL1, 0x180140}, - {"ID_ISAR0_EL1", REG_ID_ISAR0_EL1, 0x180200}, - {"ID_ISAR1_EL1", REG_ID_ISAR1_EL1, 0x180220}, - {"ID_ISAR2_EL1", REG_ID_ISAR2_EL1, 0x180240}, - {"ID_ISAR3_EL1", REG_ID_ISAR3_EL1, 0x180260}, - {"ID_ISAR4_EL1", REG_ID_ISAR4_EL1, 0x180280}, - {"ID_ISAR5_EL1", REG_ID_ISAR5_EL1, 0x1802a0}, - {"ID_ISAR6_EL1", REG_ID_ISAR6_EL1, 0x1802e0}, - {"ID_MMFR0_EL1", REG_ID_MMFR0_EL1, 0x180180}, - {"ID_MMFR1_EL1", REG_ID_MMFR1_EL1, 0x1801a0}, - {"ID_MMFR2_EL1", REG_ID_MMFR2_EL1, 0x1801c0}, - {"ID_MMFR3_EL1", REG_ID_MMFR3_EL1, 0x1801e0}, - {"ID_MMFR4_EL1", REG_ID_MMFR4_EL1, 0x1802c0}, - {"ID_PFR0_EL1", REG_ID_PFR0_EL1, 0x180100}, - {"ID_PFR1_EL1", REG_ID_PFR1_EL1, 0x180120}, - {"ID_PFR2_EL1", REG_ID_PFR2_EL1, 0x180380}, - {"ISR_EL1", REG_ISR_EL1, 0x18c100}, - {"LORC_EL1", REG_LORC_EL1, 0x18a460}, - {"LOREA_EL1", REG_LOREA_EL1, 0x18a420}, - {"LORID_EL1", REG_LORID_EL1, 0x18a4e0}, - {"LORN_EL1", REG_LORN_EL1, 0x18a440}, - {"LORSA_EL1", REG_LORSA_EL1, 0x18a400}, - {"MAIR_EL1", REG_MAIR_EL1, 0x18a200}, - {"MDCCINT_EL1", REG_MDCCINT_EL1, 0x100200}, - {"MDCCSR_EL0", REG_MDCCSR_EL0, 0x130100}, - {"MDRAR_EL1", REG_MDRAR_EL1, 0x101000}, - {"MDSCR_EL1", REG_MDSCR_EL1, 0x100240}, - {"MIDR_EL1", REG_MIDR_EL1, 0x180000}, - {"MPAM0_EL1", REG_MPAM0_EL1, 0x18a520}, - {"MPAM1_EL1", REG_MPAM1_EL1, 0x18a500}, - {"MPAMIDR_EL1", REG_MPAMIDR_EL1, 0x18a480}, - {"MPIDR_EL1", REG_MPIDR_EL1, 0x1800a0}, - {"MVFR0_EL1", REG_MVFR0_EL1, 0x180300}, - {"MVFR1_EL1", REG_MVFR1_EL1, 0x180320}, - {"MVFR2_EL1", REG_MVFR2_EL1, 0x180340}, - {"NZCV", REG_NZCV, 0x1b4200}, - {"OSDLR_EL1", REG_OSDLR_EL1, 0x101380}, - {"OSDTRRX_EL1", REG_OSDTRRX_EL1, 0x100040}, - {"OSDTRTX_EL1", REG_OSDTRTX_EL1, 0x100340}, - {"OSECCR_EL1", REG_OSECCR_EL1, 0x100640}, - {"OSLAR_EL1", REG_OSLAR_EL1, 0x101080}, - {"OSLSR_EL1", REG_OSLSR_EL1, 0x101180}, - {"PAN", REG_PAN, 0x184260}, - {"PAR_EL1", REG_PAR_EL1, 0x187400}, - {"PMBIDR_EL1", REG_PMBIDR_EL1, 0x189ae0}, - {"PMBLIMITR_EL1", REG_PMBLIMITR_EL1, 0x189a00}, - {"PMBPTR_EL1", REG_PMBPTR_EL1, 0x189a20}, - {"PMBSR_EL1", REG_PMBSR_EL1, 0x189a60}, - {"PMCCFILTR_EL0", REG_PMCCFILTR_EL0, 0x1befe0}, - {"PMCCNTR_EL0", REG_PMCCNTR_EL0, 0x1b9d00}, - {"PMCEID0_EL0", REG_PMCEID0_EL0, 0x1b9cc0}, - {"PMCEID1_EL0", REG_PMCEID1_EL0, 0x1b9ce0}, - {"PMCNTENCLR_EL0", REG_PMCNTENCLR_EL0, 0x1b9c40}, - {"PMCNTENSET_EL0", REG_PMCNTENSET_EL0, 0x1b9c20}, - {"PMCR_EL0", REG_PMCR_EL0, 0x1b9c00}, - {"PMEVCNTR0_EL0", REG_PMEVCNTR0_EL0, 0x1be800}, - {"PMEVCNTR1_EL0", REG_PMEVCNTR1_EL0, 0x1be820}, - {"PMEVCNTR2_EL0", REG_PMEVCNTR2_EL0, 0x1be840}, - {"PMEVCNTR3_EL0", REG_PMEVCNTR3_EL0, 0x1be860}, - {"PMEVCNTR4_EL0", REG_PMEVCNTR4_EL0, 0x1be880}, - {"PMEVCNTR5_EL0", REG_PMEVCNTR5_EL0, 0x1be8a0}, - {"PMEVCNTR6_EL0", REG_PMEVCNTR6_EL0, 0x1be8c0}, - {"PMEVCNTR7_EL0", REG_PMEVCNTR7_EL0, 0x1be8e0}, - {"PMEVCNTR8_EL0", REG_PMEVCNTR8_EL0, 0x1be900}, - {"PMEVCNTR9_EL0", REG_PMEVCNTR9_EL0, 0x1be920}, - {"PMEVCNTR10_EL0", REG_PMEVCNTR10_EL0, 0x1be940}, - {"PMEVCNTR11_EL0", REG_PMEVCNTR11_EL0, 0x1be960}, - {"PMEVCNTR12_EL0", REG_PMEVCNTR12_EL0, 0x1be980}, - {"PMEVCNTR13_EL0", REG_PMEVCNTR13_EL0, 0x1be9a0}, - {"PMEVCNTR14_EL0", REG_PMEVCNTR14_EL0, 0x1be9c0}, - {"PMEVCNTR15_EL0", REG_PMEVCNTR15_EL0, 0x1be9e0}, - {"PMEVCNTR16_EL0", REG_PMEVCNTR16_EL0, 0x1bea00}, - {"PMEVCNTR17_EL0", REG_PMEVCNTR17_EL0, 0x1bea20}, - {"PMEVCNTR18_EL0", REG_PMEVCNTR18_EL0, 0x1bea40}, - {"PMEVCNTR19_EL0", REG_PMEVCNTR19_EL0, 0x1bea60}, - {"PMEVCNTR20_EL0", REG_PMEVCNTR20_EL0, 0x1bea80}, - {"PMEVCNTR21_EL0", REG_PMEVCNTR21_EL0, 0x1beaa0}, - {"PMEVCNTR22_EL0", REG_PMEVCNTR22_EL0, 0x1beac0}, - {"PMEVCNTR23_EL0", REG_PMEVCNTR23_EL0, 0x1beae0}, - {"PMEVCNTR24_EL0", REG_PMEVCNTR24_EL0, 0x1beb00}, - {"PMEVCNTR25_EL0", REG_PMEVCNTR25_EL0, 0x1beb20}, - {"PMEVCNTR26_EL0", REG_PMEVCNTR26_EL0, 0x1beb40}, - {"PMEVCNTR27_EL0", REG_PMEVCNTR27_EL0, 0x1beb60}, - {"PMEVCNTR28_EL0", REG_PMEVCNTR28_EL0, 0x1beb80}, - {"PMEVCNTR29_EL0", REG_PMEVCNTR29_EL0, 0x1beba0}, - {"PMEVCNTR30_EL0", REG_PMEVCNTR30_EL0, 0x1bebc0}, - {"PMEVTYPER0_EL0", REG_PMEVTYPER0_EL0, 0x1bec00}, - {"PMEVTYPER1_EL0", REG_PMEVTYPER1_EL0, 0x1bec20}, - {"PMEVTYPER2_EL0", REG_PMEVTYPER2_EL0, 0x1bec40}, - {"PMEVTYPER3_EL0", REG_PMEVTYPER3_EL0, 0x1bec60}, - {"PMEVTYPER4_EL0", REG_PMEVTYPER4_EL0, 0x1bec80}, - {"PMEVTYPER5_EL0", REG_PMEVTYPER5_EL0, 0x1beca0}, - {"PMEVTYPER6_EL0", REG_PMEVTYPER6_EL0, 0x1becc0}, - {"PMEVTYPER7_EL0", REG_PMEVTYPER7_EL0, 0x1bece0}, - {"PMEVTYPER8_EL0", REG_PMEVTYPER8_EL0, 0x1bed00}, - {"PMEVTYPER9_EL0", REG_PMEVTYPER9_EL0, 0x1bed20}, - {"PMEVTYPER10_EL0", REG_PMEVTYPER10_EL0, 0x1bed40}, - {"PMEVTYPER11_EL0", REG_PMEVTYPER11_EL0, 0x1bed60}, - {"PMEVTYPER12_EL0", REG_PMEVTYPER12_EL0, 0x1bed80}, - {"PMEVTYPER13_EL0", REG_PMEVTYPER13_EL0, 0x1beda0}, - {"PMEVTYPER14_EL0", REG_PMEVTYPER14_EL0, 0x1bedc0}, - {"PMEVTYPER15_EL0", REG_PMEVTYPER15_EL0, 0x1bede0}, - {"PMEVTYPER16_EL0", REG_PMEVTYPER16_EL0, 0x1bee00}, - {"PMEVTYPER17_EL0", REG_PMEVTYPER17_EL0, 0x1bee20}, - {"PMEVTYPER18_EL0", REG_PMEVTYPER18_EL0, 0x1bee40}, - {"PMEVTYPER19_EL0", REG_PMEVTYPER19_EL0, 0x1bee60}, - {"PMEVTYPER20_EL0", REG_PMEVTYPER20_EL0, 0x1bee80}, - {"PMEVTYPER21_EL0", REG_PMEVTYPER21_EL0, 0x1beea0}, - {"PMEVTYPER22_EL0", REG_PMEVTYPER22_EL0, 0x1beec0}, - {"PMEVTYPER23_EL0", REG_PMEVTYPER23_EL0, 0x1beee0}, - {"PMEVTYPER24_EL0", REG_PMEVTYPER24_EL0, 0x1bef00}, - {"PMEVTYPER25_EL0", REG_PMEVTYPER25_EL0, 0x1bef20}, - {"PMEVTYPER26_EL0", REG_PMEVTYPER26_EL0, 0x1bef40}, - {"PMEVTYPER27_EL0", REG_PMEVTYPER27_EL0, 0x1bef60}, - {"PMEVTYPER28_EL0", REG_PMEVTYPER28_EL0, 0x1bef80}, - {"PMEVTYPER29_EL0", REG_PMEVTYPER29_EL0, 0x1befa0}, - {"PMEVTYPER30_EL0", REG_PMEVTYPER30_EL0, 0x1befc0}, - {"PMINTENCLR_EL1", REG_PMINTENCLR_EL1, 0x189e40}, - {"PMINTENSET_EL1", REG_PMINTENSET_EL1, 0x189e20}, - {"PMMIR_EL1", REG_PMMIR_EL1, 0x189ec0}, - {"PMOVSCLR_EL0", REG_PMOVSCLR_EL0, 0x1b9c60}, - {"PMOVSSET_EL0", REG_PMOVSSET_EL0, 0x1b9e60}, - {"PMSCR_EL1", REG_PMSCR_EL1, 0x189900}, - {"PMSELR_EL0", REG_PMSELR_EL0, 0x1b9ca0}, - {"PMSEVFR_EL1", REG_PMSEVFR_EL1, 0x1899a0}, - {"PMSFCR_EL1", REG_PMSFCR_EL1, 0x189980}, - {"PMSICR_EL1", REG_PMSICR_EL1, 0x189940}, - {"PMSIDR_EL1", REG_PMSIDR_EL1, 0x1899e0}, - {"PMSIRR_EL1", REG_PMSIRR_EL1, 0x189960}, - {"PMSLATFR_EL1", REG_PMSLATFR_EL1, 0x1899c0}, - {"PMSWINC_EL0", REG_PMSWINC_EL0, 0x1b9c80}, - {"PMUSERENR_EL0", REG_PMUSERENR_EL0, 0x1b9e00}, - {"PMXEVCNTR_EL0", REG_PMXEVCNTR_EL0, 0x1b9d40}, - {"PMXEVTYPER_EL0", REG_PMXEVTYPER_EL0, 0x1b9d20}, - {"REVIDR_EL1", REG_REVIDR_EL1, 0x1800c0}, - {"RGSR_EL1", REG_RGSR_EL1, 0x1810a0}, - {"RMR_EL1", REG_RMR_EL1, 0x18c040}, - {"RNDR", REG_RNDR, 0x1b2400}, - {"RNDRRS", REG_RNDRRS, 0x1b2420}, - {"RVBAR_EL1", REG_RVBAR_EL1, 0x18c020}, - {"SCTLR_EL1", REG_SCTLR_EL1, 0x181000}, - {"SCXTNUM_EL0", REG_SCXTNUM_EL0, 0x1bd0e0}, - {"SCXTNUM_EL1", REG_SCXTNUM_EL1, 0x18d0e0}, - {"SP_EL0", REG_SP_EL0, 0x184100}, - {"SP_EL1", REG_SP_EL1, 0x1c4100}, - {"SPSel", REG_SPSel, 0x184200}, - {"SPSR_abt", REG_SPSR_abt, 0x1c4320}, - {"SPSR_EL1", REG_SPSR_EL1, 0x184000}, - {"SPSR_fiq", REG_SPSR_fiq, 0x1c4360}, - {"SPSR_irq", REG_SPSR_irq, 0x1c4300}, - {"SPSR_und", REG_SPSR_und, 0x1c4340}, - {"SSBS", REG_SSBS, 0x1b42c0}, - {"TCO", REG_TCO, 0x1b42e0}, - {"TCR_EL1", REG_TCR_EL1, 0x182040}, - {"TFSR_EL1", REG_TFSR_EL1, 0x185600}, - {"TFSRE0_EL1", REG_TFSRE0_EL1, 0x185620}, - {"TPIDR_EL0", REG_TPIDR_EL0, 0x1bd040}, - {"TPIDR_EL1", REG_TPIDR_EL1, 0x18d080}, - {"TPIDRRO_EL0", REG_TPIDRRO_EL0, 0x1bd060}, - {"TRFCR_EL1", REG_TRFCR_EL1, 0x181220}, - {"TTBR0_EL1", REG_TTBR0_EL1, 0x182000}, - {"TTBR1_EL1", REG_TTBR1_EL1, 0x182020}, - {"UAO", REG_UAO, 0x184280}, - {"VBAR_EL1", REG_VBAR_EL1, 0x18c000}, - {"ZCR_EL1", REG_ZCR_EL1, 0x181200}, + {"ACTLR_EL1", REG_ACTLR_EL1, 0x181020, SR_READ | SR_WRITE}, + {"AFSR0_EL1", REG_AFSR0_EL1, 0x185100, SR_READ | SR_WRITE}, + {"AFSR1_EL1", REG_AFSR1_EL1, 0x185120, SR_READ | SR_WRITE}, + {"AIDR_EL1", REG_AIDR_EL1, 0x1900e0, SR_READ}, + {"AMAIR_EL1", REG_AMAIR_EL1, 0x18a300, SR_READ | SR_WRITE}, + {"AMCFGR_EL0", REG_AMCFGR_EL0, 0x1bd220, SR_READ}, + {"AMCGCR_EL0", REG_AMCGCR_EL0, 0x1bd240, SR_READ}, + {"AMCNTENCLR0_EL0", REG_AMCNTENCLR0_EL0, 0x1bd280, SR_READ | SR_WRITE}, + {"AMCNTENCLR1_EL0", REG_AMCNTENCLR1_EL0, 0x1bd300, SR_READ | SR_WRITE}, + {"AMCNTENSET0_EL0", REG_AMCNTENSET0_EL0, 0x1bd2a0, SR_READ | SR_WRITE}, + {"AMCNTENSET1_EL0", REG_AMCNTENSET1_EL0, 0x1bd320, SR_READ | SR_WRITE}, + {"AMCR_EL0", REG_AMCR_EL0, 0x1bd200, SR_READ | SR_WRITE}, + {"AMEVCNTR00_EL0", REG_AMEVCNTR00_EL0, 0x1bd400, SR_READ | SR_WRITE}, + {"AMEVCNTR01_EL0", REG_AMEVCNTR01_EL0, 0x1bd420, SR_READ | SR_WRITE}, + {"AMEVCNTR02_EL0", REG_AMEVCNTR02_EL0, 0x1bd440, SR_READ | SR_WRITE}, + {"AMEVCNTR03_EL0", REG_AMEVCNTR03_EL0, 0x1bd460, SR_READ | SR_WRITE}, + {"AMEVCNTR04_EL0", REG_AMEVCNTR04_EL0, 0x1bd480, SR_READ | SR_WRITE}, + {"AMEVCNTR05_EL0", REG_AMEVCNTR05_EL0, 0x1bd4a0, SR_READ | SR_WRITE}, + {"AMEVCNTR06_EL0", REG_AMEVCNTR06_EL0, 0x1bd4c0, SR_READ | SR_WRITE}, + {"AMEVCNTR07_EL0", REG_AMEVCNTR07_EL0, 0x1bd4e0, SR_READ | SR_WRITE}, + {"AMEVCNTR08_EL0", REG_AMEVCNTR08_EL0, 0x1bd500, SR_READ | SR_WRITE}, + {"AMEVCNTR09_EL0", REG_AMEVCNTR09_EL0, 0x1bd520, SR_READ | SR_WRITE}, + {"AMEVCNTR010_EL0", REG_AMEVCNTR010_EL0, 0x1bd540, SR_READ | SR_WRITE}, + {"AMEVCNTR011_EL0", REG_AMEVCNTR011_EL0, 0x1bd560, SR_READ | SR_WRITE}, + {"AMEVCNTR012_EL0", REG_AMEVCNTR012_EL0, 0x1bd580, SR_READ | SR_WRITE}, + {"AMEVCNTR013_EL0", REG_AMEVCNTR013_EL0, 0x1bd5a0, SR_READ | SR_WRITE}, + {"AMEVCNTR014_EL0", REG_AMEVCNTR014_EL0, 0x1bd5c0, SR_READ | SR_WRITE}, + {"AMEVCNTR015_EL0", REG_AMEVCNTR015_EL0, 0x1bd5e0, SR_READ | SR_WRITE}, + {"AMEVCNTR10_EL0", REG_AMEVCNTR10_EL0, 0x1bdc00, SR_READ | SR_WRITE}, + {"AMEVCNTR11_EL0", REG_AMEVCNTR11_EL0, 0x1bdc20, SR_READ | SR_WRITE}, + {"AMEVCNTR12_EL0", REG_AMEVCNTR12_EL0, 0x1bdc40, SR_READ | SR_WRITE}, + {"AMEVCNTR13_EL0", REG_AMEVCNTR13_EL0, 0x1bdc60, SR_READ | SR_WRITE}, + {"AMEVCNTR14_EL0", REG_AMEVCNTR14_EL0, 0x1bdc80, SR_READ | SR_WRITE}, + {"AMEVCNTR15_EL0", REG_AMEVCNTR15_EL0, 0x1bdca0, SR_READ | SR_WRITE}, + {"AMEVCNTR16_EL0", REG_AMEVCNTR16_EL0, 0x1bdcc0, SR_READ | SR_WRITE}, + {"AMEVCNTR17_EL0", REG_AMEVCNTR17_EL0, 0x1bdce0, SR_READ | SR_WRITE}, + {"AMEVCNTR18_EL0", REG_AMEVCNTR18_EL0, 0x1bdd00, SR_READ | SR_WRITE}, + {"AMEVCNTR19_EL0", REG_AMEVCNTR19_EL0, 0x1bdd20, SR_READ | SR_WRITE}, + {"AMEVCNTR110_EL0", REG_AMEVCNTR110_EL0, 0x1bdd40, SR_READ | SR_WRITE}, + {"AMEVCNTR111_EL0", REG_AMEVCNTR111_EL0, 0x1bdd60, SR_READ | SR_WRITE}, + {"AMEVCNTR112_EL0", REG_AMEVCNTR112_EL0, 0x1bdd80, SR_READ | SR_WRITE}, + {"AMEVCNTR113_EL0", REG_AMEVCNTR113_EL0, 0x1bdda0, SR_READ | SR_WRITE}, + {"AMEVCNTR114_EL0", REG_AMEVCNTR114_EL0, 0x1bddc0, SR_READ | SR_WRITE}, + {"AMEVCNTR115_EL0", REG_AMEVCNTR115_EL0, 0x1bdde0, SR_READ | SR_WRITE}, + {"AMEVTYPER00_EL0", REG_AMEVTYPER00_EL0, 0x1bd600, SR_READ}, + {"AMEVTYPER01_EL0", REG_AMEVTYPER01_EL0, 0x1bd620, SR_READ}, + {"AMEVTYPER02_EL0", REG_AMEVTYPER02_EL0, 0x1bd640, SR_READ}, + {"AMEVTYPER03_EL0", REG_AMEVTYPER03_EL0, 0x1bd660, SR_READ}, + {"AMEVTYPER04_EL0", REG_AMEVTYPER04_EL0, 0x1bd680, SR_READ}, + {"AMEVTYPER05_EL0", REG_AMEVTYPER05_EL0, 0x1bd6a0, SR_READ}, + {"AMEVTYPER06_EL0", REG_AMEVTYPER06_EL0, 0x1bd6c0, SR_READ}, + {"AMEVTYPER07_EL0", REG_AMEVTYPER07_EL0, 0x1bd6e0, SR_READ}, + {"AMEVTYPER08_EL0", REG_AMEVTYPER08_EL0, 0x1bd700, SR_READ}, + {"AMEVTYPER09_EL0", REG_AMEVTYPER09_EL0, 0x1bd720, SR_READ}, + {"AMEVTYPER010_EL0", REG_AMEVTYPER010_EL0, 0x1bd740, SR_READ}, + {"AMEVTYPER011_EL0", REG_AMEVTYPER011_EL0, 0x1bd760, SR_READ}, + {"AMEVTYPER012_EL0", REG_AMEVTYPER012_EL0, 0x1bd780, SR_READ}, + {"AMEVTYPER013_EL0", REG_AMEVTYPER013_EL0, 0x1bd7a0, SR_READ}, + {"AMEVTYPER014_EL0", REG_AMEVTYPER014_EL0, 0x1bd7c0, SR_READ}, + {"AMEVTYPER015_EL0", REG_AMEVTYPER015_EL0, 0x1bd7e0, SR_READ}, + {"AMEVTYPER10_EL0", REG_AMEVTYPER10_EL0, 0x1bde00, SR_READ | SR_WRITE}, + {"AMEVTYPER11_EL0", REG_AMEVTYPER11_EL0, 0x1bde20, SR_READ | SR_WRITE}, + {"AMEVTYPER12_EL0", REG_AMEVTYPER12_EL0, 0x1bde40, SR_READ | SR_WRITE}, + {"AMEVTYPER13_EL0", REG_AMEVTYPER13_EL0, 0x1bde60, SR_READ | SR_WRITE}, + {"AMEVTYPER14_EL0", REG_AMEVTYPER14_EL0, 0x1bde80, SR_READ | SR_WRITE}, + {"AMEVTYPER15_EL0", REG_AMEVTYPER15_EL0, 0x1bdea0, SR_READ | SR_WRITE}, + {"AMEVTYPER16_EL0", REG_AMEVTYPER16_EL0, 0x1bdec0, SR_READ | SR_WRITE}, + {"AMEVTYPER17_EL0", REG_AMEVTYPER17_EL0, 0x1bdee0, SR_READ | SR_WRITE}, + {"AMEVTYPER18_EL0", REG_AMEVTYPER18_EL0, 0x1bdf00, SR_READ | SR_WRITE}, + {"AMEVTYPER19_EL0", REG_AMEVTYPER19_EL0, 0x1bdf20, SR_READ | SR_WRITE}, + {"AMEVTYPER110_EL0", REG_AMEVTYPER110_EL0, 0x1bdf40, SR_READ | SR_WRITE}, + {"AMEVTYPER111_EL0", REG_AMEVTYPER111_EL0, 0x1bdf60, SR_READ | SR_WRITE}, + {"AMEVTYPER112_EL0", REG_AMEVTYPER112_EL0, 0x1bdf80, SR_READ | SR_WRITE}, + {"AMEVTYPER113_EL0", REG_AMEVTYPER113_EL0, 0x1bdfa0, SR_READ | SR_WRITE}, + {"AMEVTYPER114_EL0", REG_AMEVTYPER114_EL0, 0x1bdfc0, SR_READ | SR_WRITE}, + {"AMEVTYPER115_EL0", REG_AMEVTYPER115_EL0, 0x1bdfe0, SR_READ | SR_WRITE}, + {"AMUSERENR_EL0", REG_AMUSERENR_EL0, 0x1bd260, SR_READ | SR_WRITE}, + {"APDAKeyHi_EL1", REG_APDAKeyHi_EL1, 0x182220, SR_READ | SR_WRITE}, + {"APDAKeyLo_EL1", REG_APDAKeyLo_EL1, 0x182200, SR_READ | SR_WRITE}, + {"APDBKeyHi_EL1", REG_APDBKeyHi_EL1, 0x182260, SR_READ | SR_WRITE}, + {"APDBKeyLo_EL1", REG_APDBKeyLo_EL1, 0x182240, SR_READ | SR_WRITE}, + {"APGAKeyHi_EL1", REG_APGAKeyHi_EL1, 0x182320, SR_READ | SR_WRITE}, + {"APGAKeyLo_EL1", REG_APGAKeyLo_EL1, 0x182300, SR_READ | SR_WRITE}, + {"APIAKeyHi_EL1", REG_APIAKeyHi_EL1, 0x182120, SR_READ | SR_WRITE}, + {"APIAKeyLo_EL1", REG_APIAKeyLo_EL1, 0x182100, SR_READ | SR_WRITE}, + {"APIBKeyHi_EL1", REG_APIBKeyHi_EL1, 0x182160, SR_READ | SR_WRITE}, + {"APIBKeyLo_EL1", REG_APIBKeyLo_EL1, 0x182140, SR_READ | SR_WRITE}, + {"CCSIDR2_EL1", REG_CCSIDR2_EL1, 0x190040, SR_READ}, + {"CCSIDR_EL1", REG_CCSIDR_EL1, 0x190000, SR_READ}, + {"CLIDR_EL1", REG_CLIDR_EL1, 0x190020, SR_READ}, + {"CNTFRQ_EL0", REG_CNTFRQ_EL0, 0x1be000, SR_READ | SR_WRITE}, + {"CNTKCTL_EL1", REG_CNTKCTL_EL1, 0x18e100, SR_READ | SR_WRITE}, + {"CNTP_CTL_EL0", REG_CNTP_CTL_EL0, 0x1be220, SR_READ | SR_WRITE}, + {"CNTP_CVAL_EL0", REG_CNTP_CVAL_EL0, 0x1be240, SR_READ | SR_WRITE}, + {"CNTP_TVAL_EL0", REG_CNTP_TVAL_EL0, 0x1be200, SR_READ | SR_WRITE}, + {"CNTPCT_EL0", REG_CNTPCT_EL0, 0x1be020, SR_READ}, + {"CNTPS_CTL_EL1", REG_CNTPS_CTL_EL1, 0x1fe220, SR_READ | SR_WRITE}, + {"CNTPS_CVAL_EL1", REG_CNTPS_CVAL_EL1, 0x1fe240, SR_READ | SR_WRITE}, + {"CNTPS_TVAL_EL1", REG_CNTPS_TVAL_EL1, 0x1fe200, SR_READ | SR_WRITE}, + {"CNTV_CTL_EL0", REG_CNTV_CTL_EL0, 0x1be320, SR_READ | SR_WRITE}, + {"CNTV_CVAL_EL0", REG_CNTV_CVAL_EL0, 0x1be340, SR_READ | SR_WRITE}, + {"CNTV_TVAL_EL0", REG_CNTV_TVAL_EL0, 0x1be300, SR_READ | SR_WRITE}, + {"CNTVCT_EL0", REG_CNTVCT_EL0, 0x1be040, SR_READ}, + {"CONTEXTIDR_EL1", REG_CONTEXTIDR_EL1, 0x18d020, SR_READ | SR_WRITE}, + {"CPACR_EL1", REG_CPACR_EL1, 0x181040, SR_READ | SR_WRITE}, + {"CSSELR_EL1", REG_CSSELR_EL1, 0x1a0000, SR_READ | SR_WRITE}, + {"CTR_EL0", REG_CTR_EL0, 0x1b0020, SR_READ}, + {"CurrentEL", REG_CurrentEL, 0x184240, SR_READ}, + {"DAIF", REG_DAIF, 0x1b4220, SR_READ | SR_WRITE}, + {"DBGAUTHSTATUS_EL1", REG_DBGAUTHSTATUS_EL1, 0x107ec0, SR_READ}, + {"DBGBCR0_EL1", REG_DBGBCR0_EL1, 0x1000a0, SR_READ | SR_WRITE}, + {"DBGBCR1_EL1", REG_DBGBCR1_EL1, 0x1001a0, SR_READ | SR_WRITE}, + {"DBGBCR2_EL1", REG_DBGBCR2_EL1, 0x1002a0, SR_READ | SR_WRITE}, + {"DBGBCR3_EL1", REG_DBGBCR3_EL1, 0x1003a0, SR_READ | SR_WRITE}, + {"DBGBCR4_EL1", REG_DBGBCR4_EL1, 0x1004a0, SR_READ | SR_WRITE}, + {"DBGBCR5_EL1", REG_DBGBCR5_EL1, 0x1005a0, SR_READ | SR_WRITE}, + {"DBGBCR6_EL1", REG_DBGBCR6_EL1, 0x1006a0, SR_READ | SR_WRITE}, + {"DBGBCR7_EL1", REG_DBGBCR7_EL1, 0x1007a0, SR_READ | SR_WRITE}, + {"DBGBCR8_EL1", REG_DBGBCR8_EL1, 0x1008a0, SR_READ | SR_WRITE}, + {"DBGBCR9_EL1", REG_DBGBCR9_EL1, 0x1009a0, SR_READ | SR_WRITE}, + {"DBGBCR10_EL1", REG_DBGBCR10_EL1, 0x100aa0, SR_READ | SR_WRITE}, + {"DBGBCR11_EL1", REG_DBGBCR11_EL1, 0x100ba0, SR_READ | SR_WRITE}, + {"DBGBCR12_EL1", REG_DBGBCR12_EL1, 0x100ca0, SR_READ | SR_WRITE}, + {"DBGBCR13_EL1", REG_DBGBCR13_EL1, 0x100da0, SR_READ | SR_WRITE}, + {"DBGBCR14_EL1", REG_DBGBCR14_EL1, 0x100ea0, SR_READ | SR_WRITE}, + {"DBGBCR15_EL1", REG_DBGBCR15_EL1, 0x100fa0, SR_READ | SR_WRITE}, + {"DBGBVR0_EL1", REG_DBGBVR0_EL1, 0x100080, SR_READ | SR_WRITE}, + {"DBGBVR1_EL1", REG_DBGBVR1_EL1, 0x100180, SR_READ | SR_WRITE}, + {"DBGBVR2_EL1", REG_DBGBVR2_EL1, 0x100280, SR_READ | SR_WRITE}, + {"DBGBVR3_EL1", REG_DBGBVR3_EL1, 0x100380, SR_READ | SR_WRITE}, + {"DBGBVR4_EL1", REG_DBGBVR4_EL1, 0x100480, SR_READ | SR_WRITE}, + {"DBGBVR5_EL1", REG_DBGBVR5_EL1, 0x100580, SR_READ | SR_WRITE}, + {"DBGBVR6_EL1", REG_DBGBVR6_EL1, 0x100680, SR_READ | SR_WRITE}, + {"DBGBVR7_EL1", REG_DBGBVR7_EL1, 0x100780, SR_READ | SR_WRITE}, + {"DBGBVR8_EL1", REG_DBGBVR8_EL1, 0x100880, SR_READ | SR_WRITE}, + {"DBGBVR9_EL1", REG_DBGBVR9_EL1, 0x100980, SR_READ | SR_WRITE}, + {"DBGBVR10_EL1", REG_DBGBVR10_EL1, 0x100a80, SR_READ | SR_WRITE}, + {"DBGBVR11_EL1", REG_DBGBVR11_EL1, 0x100b80, SR_READ | SR_WRITE}, + {"DBGBVR12_EL1", REG_DBGBVR12_EL1, 0x100c80, SR_READ | SR_WRITE}, + {"DBGBVR13_EL1", REG_DBGBVR13_EL1, 0x100d80, SR_READ | SR_WRITE}, + {"DBGBVR14_EL1", REG_DBGBVR14_EL1, 0x100e80, SR_READ | SR_WRITE}, + {"DBGBVR15_EL1", REG_DBGBVR15_EL1, 0x100f80, SR_READ | SR_WRITE}, + {"DBGCLAIMCLR_EL1", REG_DBGCLAIMCLR_EL1, 0x1079c0, SR_READ | SR_WRITE}, + {"DBGCLAIMSET_EL1", REG_DBGCLAIMSET_EL1, 0x1078c0, SR_READ | SR_WRITE}, + {"DBGDTR_EL0", REG_DBGDTR_EL0, 0x130400, SR_READ | SR_WRITE}, + {"DBGDTRRX_EL0", REG_DBGDTRRX_EL0, 0x130500, SR_READ}, + {"DBGDTRTX_EL0", REG_DBGDTRTX_EL0, 0x130500, SR_WRITE}, + {"DBGPRCR_EL1", REG_DBGPRCR_EL1, 0x101480, SR_READ | SR_WRITE}, + {"DBGWCR0_EL1", REG_DBGWCR0_EL1, 0x1000e0, SR_READ | SR_WRITE}, + {"DBGWCR1_EL1", REG_DBGWCR1_EL1, 0x1001e0, SR_READ | SR_WRITE}, + {"DBGWCR2_EL1", REG_DBGWCR2_EL1, 0x1002e0, SR_READ | SR_WRITE}, + {"DBGWCR3_EL1", REG_DBGWCR3_EL1, 0x1003e0, SR_READ | SR_WRITE}, + {"DBGWCR4_EL1", REG_DBGWCR4_EL1, 0x1004e0, SR_READ | SR_WRITE}, + {"DBGWCR5_EL1", REG_DBGWCR5_EL1, 0x1005e0, SR_READ | SR_WRITE}, + {"DBGWCR6_EL1", REG_DBGWCR6_EL1, 0x1006e0, SR_READ | SR_WRITE}, + {"DBGWCR7_EL1", REG_DBGWCR7_EL1, 0x1007e0, SR_READ | SR_WRITE}, + {"DBGWCR8_EL1", REG_DBGWCR8_EL1, 0x1008e0, SR_READ | SR_WRITE}, + {"DBGWCR9_EL1", REG_DBGWCR9_EL1, 0x1009e0, SR_READ | SR_WRITE}, + {"DBGWCR10_EL1", REG_DBGWCR10_EL1, 0x100ae0, SR_READ | SR_WRITE}, + {"DBGWCR11_EL1", REG_DBGWCR11_EL1, 0x100be0, SR_READ | SR_WRITE}, + {"DBGWCR12_EL1", REG_DBGWCR12_EL1, 0x100ce0, SR_READ | SR_WRITE}, + {"DBGWCR13_EL1", REG_DBGWCR13_EL1, 0x100de0, SR_READ | SR_WRITE}, + {"DBGWCR14_EL1", REG_DBGWCR14_EL1, 0x100ee0, SR_READ | SR_WRITE}, + {"DBGWCR15_EL1", REG_DBGWCR15_EL1, 0x100fe0, SR_READ | SR_WRITE}, + {"DBGWVR0_EL1", REG_DBGWVR0_EL1, 0x1000c0, SR_READ | SR_WRITE}, + {"DBGWVR1_EL1", REG_DBGWVR1_EL1, 0x1001c0, SR_READ | SR_WRITE}, + {"DBGWVR2_EL1", REG_DBGWVR2_EL1, 0x1002c0, SR_READ | SR_WRITE}, + {"DBGWVR3_EL1", REG_DBGWVR3_EL1, 0x1003c0, SR_READ | SR_WRITE}, + {"DBGWVR4_EL1", REG_DBGWVR4_EL1, 0x1004c0, SR_READ | SR_WRITE}, + {"DBGWVR5_EL1", REG_DBGWVR5_EL1, 0x1005c0, SR_READ | SR_WRITE}, + {"DBGWVR6_EL1", REG_DBGWVR6_EL1, 0x1006c0, SR_READ | SR_WRITE}, + {"DBGWVR7_EL1", REG_DBGWVR7_EL1, 0x1007c0, SR_READ | SR_WRITE}, + {"DBGWVR8_EL1", REG_DBGWVR8_EL1, 0x1008c0, SR_READ | SR_WRITE}, + {"DBGWVR9_EL1", REG_DBGWVR9_EL1, 0x1009c0, SR_READ | SR_WRITE}, + {"DBGWVR10_EL1", REG_DBGWVR10_EL1, 0x100ac0, SR_READ | SR_WRITE}, + {"DBGWVR11_EL1", REG_DBGWVR11_EL1, 0x100bc0, SR_READ | SR_WRITE}, + {"DBGWVR12_EL1", REG_DBGWVR12_EL1, 0x100cc0, SR_READ | SR_WRITE}, + {"DBGWVR13_EL1", REG_DBGWVR13_EL1, 0x100dc0, SR_READ | SR_WRITE}, + {"DBGWVR14_EL1", REG_DBGWVR14_EL1, 0x100ec0, SR_READ | SR_WRITE}, + {"DBGWVR15_EL1", REG_DBGWVR15_EL1, 0x100fc0, SR_READ | SR_WRITE}, + {"DCZID_EL0", REG_DCZID_EL0, 0x1b00e0, SR_READ}, + {"DISR_EL1", REG_DISR_EL1, 0x18c120, SR_READ | SR_WRITE}, + {"DIT", REG_DIT, 0x1b42a0, SR_READ | SR_WRITE}, + {"DLR_EL0", REG_DLR_EL0, 0x1b4520, SR_READ | SR_WRITE}, + {"DSPSR_EL0", REG_DSPSR_EL0, 0x1b4500, SR_READ | SR_WRITE}, + {"ELR_EL1", REG_ELR_EL1, 0x184020, SR_READ | SR_WRITE}, + {"ERRIDR_EL1", REG_ERRIDR_EL1, 0x185300, SR_READ}, + {"ERRSELR_EL1", REG_ERRSELR_EL1, 0x185320, SR_READ | SR_WRITE}, + {"ERXADDR_EL1", REG_ERXADDR_EL1, 0x185460, SR_READ | SR_WRITE}, + {"ERXCTLR_EL1", REG_ERXCTLR_EL1, 0x185420, SR_READ | SR_WRITE}, + {"ERXFR_EL1", REG_ERXFR_EL1, 0x185400, SR_READ}, + {"ERXMISC0_EL1", REG_ERXMISC0_EL1, 0x185500, SR_READ | SR_WRITE}, + {"ERXMISC1_EL1", REG_ERXMISC1_EL1, 0x185520, SR_READ | SR_WRITE}, + {"ERXMISC2_EL1", REG_ERXMISC2_EL1, 0x185540, SR_READ | SR_WRITE}, + {"ERXMISC3_EL1", REG_ERXMISC3_EL1, 0x185560, SR_READ | SR_WRITE}, + {"ERXPFGCDN_EL1", REG_ERXPFGCDN_EL1, 0x1854c0, SR_READ | SR_WRITE}, + {"ERXPFGCTL_EL1", REG_ERXPFGCTL_EL1, 0x1854a0, SR_READ | SR_WRITE}, + {"ERXPFGF_EL1", REG_ERXPFGF_EL1, 0x185480, SR_READ}, + {"ERXSTATUS_EL1", REG_ERXSTATUS_EL1, 0x185440, SR_READ | SR_WRITE}, + {"ESR_EL1", REG_ESR_EL1, 0x185200, SR_READ | SR_WRITE}, + {"FAR_EL1", REG_FAR_EL1, 0x186000, SR_READ | SR_WRITE}, + {"FPCR", REG_FPCR, 0x1b4400, SR_READ | SR_WRITE}, + {"FPSR", REG_FPSR, 0x1b4420, SR_READ | SR_WRITE}, + {"GCR_EL1", REG_GCR_EL1, 0x1810c0, SR_READ | SR_WRITE}, + {"GMID_EL1", REG_GMID_EL1, 0x31400, SR_READ}, + {"ICC_AP0R0_EL1", REG_ICC_AP0R0_EL1, 0x18c880, SR_READ | SR_WRITE}, + {"ICC_AP0R1_EL1", REG_ICC_AP0R1_EL1, 0x18c8a0, SR_READ | SR_WRITE}, + {"ICC_AP0R2_EL1", REG_ICC_AP0R2_EL1, 0x18c8c0, SR_READ | SR_WRITE}, + {"ICC_AP0R3_EL1", REG_ICC_AP0R3_EL1, 0x18c8e0, SR_READ | SR_WRITE}, + {"ICC_AP1R0_EL1", REG_ICC_AP1R0_EL1, 0x18c900, SR_READ | SR_WRITE}, + {"ICC_AP1R1_EL1", REG_ICC_AP1R1_EL1, 0x18c920, SR_READ | SR_WRITE}, + {"ICC_AP1R2_EL1", REG_ICC_AP1R2_EL1, 0x18c940, SR_READ | SR_WRITE}, + {"ICC_AP1R3_EL1", REG_ICC_AP1R3_EL1, 0x18c960, SR_READ | SR_WRITE}, + {"ICC_ASGI1R_EL1", REG_ICC_ASGI1R_EL1, 0x18cbc0, SR_WRITE}, + {"ICC_BPR0_EL1", REG_ICC_BPR0_EL1, 0x18c860, SR_READ | SR_WRITE}, + {"ICC_BPR1_EL1", REG_ICC_BPR1_EL1, 0x18cc60, SR_READ | SR_WRITE}, + {"ICC_CTLR_EL1", REG_ICC_CTLR_EL1, 0x18cc80, SR_READ | SR_WRITE}, + {"ICC_DIR_EL1", REG_ICC_DIR_EL1, 0x18cb20, SR_WRITE}, + {"ICC_EOIR0_EL1", REG_ICC_EOIR0_EL1, 0x18c820, SR_WRITE}, + {"ICC_EOIR1_EL1", REG_ICC_EOIR1_EL1, 0x18cc20, SR_WRITE}, + {"ICC_HPPIR0_EL1", REG_ICC_HPPIR0_EL1, 0x18c840, SR_READ}, + {"ICC_HPPIR1_EL1", REG_ICC_HPPIR1_EL1, 0x18cc40, SR_READ}, + {"ICC_IAR0_EL1", REG_ICC_IAR0_EL1, 0x18c800, SR_READ}, + {"ICC_IAR1_EL1", REG_ICC_IAR1_EL1, 0x18cc00, SR_READ}, + {"ICC_IGRPEN0_EL1", REG_ICC_IGRPEN0_EL1, 0x18ccc0, SR_READ | SR_WRITE}, + {"ICC_IGRPEN1_EL1", REG_ICC_IGRPEN1_EL1, 0x18cce0, SR_READ | SR_WRITE}, + {"ICC_PMR_EL1", REG_ICC_PMR_EL1, 0x184600, SR_READ | SR_WRITE}, + {"ICC_RPR_EL1", REG_ICC_RPR_EL1, 0x18cb60, SR_READ}, + {"ICC_SGI0R_EL1", REG_ICC_SGI0R_EL1, 0x18cbe0, SR_WRITE}, + {"ICC_SGI1R_EL1", REG_ICC_SGI1R_EL1, 0x18cba0, SR_WRITE}, + {"ICC_SRE_EL1", REG_ICC_SRE_EL1, 0x18cca0, SR_READ | SR_WRITE}, + {"ICV_AP0R0_EL1", REG_ICV_AP0R0_EL1, 0x18c880, SR_READ | SR_WRITE}, + {"ICV_AP0R1_EL1", REG_ICV_AP0R1_EL1, 0x18c8a0, SR_READ | SR_WRITE}, + {"ICV_AP0R2_EL1", REG_ICV_AP0R2_EL1, 0x18c8c0, SR_READ | SR_WRITE}, + {"ICV_AP0R3_EL1", REG_ICV_AP0R3_EL1, 0x18c8e0, SR_READ | SR_WRITE}, + {"ICV_AP1R0_EL1", REG_ICV_AP1R0_EL1, 0x18c900, SR_READ | SR_WRITE}, + {"ICV_AP1R1_EL1", REG_ICV_AP1R1_EL1, 0x18c920, SR_READ | SR_WRITE}, + {"ICV_AP1R2_EL1", REG_ICV_AP1R2_EL1, 0x18c940, SR_READ | SR_WRITE}, + {"ICV_AP1R3_EL1", REG_ICV_AP1R3_EL1, 0x18c960, SR_READ | SR_WRITE}, + {"ICV_BPR0_EL1", REG_ICV_BPR0_EL1, 0x18c860, SR_READ | SR_WRITE}, + {"ICV_BPR1_EL1", REG_ICV_BPR1_EL1, 0x18cc60, SR_READ | SR_WRITE}, + {"ICV_CTLR_EL1", REG_ICV_CTLR_EL1, 0x18cc80, SR_READ | SR_WRITE}, + {"ICV_DIR_EL1", REG_ICV_DIR_EL1, 0x18cb20, SR_WRITE}, + {"ICV_EOIR0_EL1", REG_ICV_EOIR0_EL1, 0x18c820, SR_WRITE}, + {"ICV_EOIR1_EL1", REG_ICV_EOIR1_EL1, 0x18cc20, SR_WRITE}, + {"ICV_HPPIR0_EL1", REG_ICV_HPPIR0_EL1, 0x18c840, SR_READ}, + {"ICV_HPPIR1_EL1", REG_ICV_HPPIR1_EL1, 0x18cc40, SR_READ}, + {"ICV_IAR0_EL1", REG_ICV_IAR0_EL1, 0x18c800, SR_READ}, + {"ICV_IAR1_EL1", REG_ICV_IAR1_EL1, 0x18cc00, SR_READ}, + {"ICV_IGRPEN0_EL1", REG_ICV_IGRPEN0_EL1, 0x18ccc0, SR_READ | SR_WRITE}, + {"ICV_IGRPEN1_EL1", REG_ICV_IGRPEN1_EL1, 0x18cce0, SR_READ | SR_WRITE}, + {"ICV_PMR_EL1", REG_ICV_PMR_EL1, 0x184600, SR_READ | SR_WRITE}, + {"ICV_RPR_EL1", REG_ICV_RPR_EL1, 0x18cb60, SR_READ}, + {"ID_AA64AFR0_EL1", REG_ID_AA64AFR0_EL1, 0x180580, SR_READ}, + {"ID_AA64AFR1_EL1", REG_ID_AA64AFR1_EL1, 0x1805a0, SR_READ}, + {"ID_AA64DFR0_EL1", REG_ID_AA64DFR0_EL1, 0x180500, SR_READ}, + {"ID_AA64DFR1_EL1", REG_ID_AA64DFR1_EL1, 0x180520, SR_READ}, + {"ID_AA64ISAR0_EL1", REG_ID_AA64ISAR0_EL1, 0x180600, SR_READ}, + {"ID_AA64ISAR1_EL1", REG_ID_AA64ISAR1_EL1, 0x180620, SR_READ}, + {"ID_AA64MMFR0_EL1", REG_ID_AA64MMFR0_EL1, 0x180700, SR_READ}, + {"ID_AA64MMFR1_EL1", REG_ID_AA64MMFR1_EL1, 0x180720, SR_READ}, + {"ID_AA64MMFR2_EL1", REG_ID_AA64MMFR2_EL1, 0x180740, SR_READ}, + {"ID_AA64PFR0_EL1", REG_ID_AA64PFR0_EL1, 0x180400, SR_READ}, + {"ID_AA64PFR1_EL1", REG_ID_AA64PFR1_EL1, 0x180420, SR_READ}, + {"ID_AA64ZFR0_EL1", REG_ID_AA64ZFR0_EL1, 0x180480, SR_READ}, + {"ID_AFR0_EL1", REG_ID_AFR0_EL1, 0x180160, SR_READ}, + {"ID_DFR0_EL1", REG_ID_DFR0_EL1, 0x180140, SR_READ}, + {"ID_ISAR0_EL1", REG_ID_ISAR0_EL1, 0x180200, SR_READ}, + {"ID_ISAR1_EL1", REG_ID_ISAR1_EL1, 0x180220, SR_READ}, + {"ID_ISAR2_EL1", REG_ID_ISAR2_EL1, 0x180240, SR_READ}, + {"ID_ISAR3_EL1", REG_ID_ISAR3_EL1, 0x180260, SR_READ}, + {"ID_ISAR4_EL1", REG_ID_ISAR4_EL1, 0x180280, SR_READ}, + {"ID_ISAR5_EL1", REG_ID_ISAR5_EL1, 0x1802a0, SR_READ}, + {"ID_ISAR6_EL1", REG_ID_ISAR6_EL1, 0x1802e0, SR_READ}, + {"ID_MMFR0_EL1", REG_ID_MMFR0_EL1, 0x180180, SR_READ}, + {"ID_MMFR1_EL1", REG_ID_MMFR1_EL1, 0x1801a0, SR_READ}, + {"ID_MMFR2_EL1", REG_ID_MMFR2_EL1, 0x1801c0, SR_READ}, + {"ID_MMFR3_EL1", REG_ID_MMFR3_EL1, 0x1801e0, SR_READ}, + {"ID_MMFR4_EL1", REG_ID_MMFR4_EL1, 0x1802c0, SR_READ}, + {"ID_PFR0_EL1", REG_ID_PFR0_EL1, 0x180100, SR_READ}, + {"ID_PFR1_EL1", REG_ID_PFR1_EL1, 0x180120, SR_READ}, + {"ID_PFR2_EL1", REG_ID_PFR2_EL1, 0x180380, SR_READ}, + {"ISR_EL1", REG_ISR_EL1, 0x18c100, SR_READ}, + {"LORC_EL1", REG_LORC_EL1, 0x18a460, SR_READ | SR_WRITE}, + {"LOREA_EL1", REG_LOREA_EL1, 0x18a420, SR_READ | SR_WRITE}, + {"LORID_EL1", REG_LORID_EL1, 0x18a4e0, SR_READ}, + {"LORN_EL1", REG_LORN_EL1, 0x18a440, SR_READ | SR_WRITE}, + {"LORSA_EL1", REG_LORSA_EL1, 0x18a400, SR_READ | SR_WRITE}, + {"MAIR_EL1", REG_MAIR_EL1, 0x18a200, SR_READ | SR_WRITE}, + {"MDCCINT_EL1", REG_MDCCINT_EL1, 0x100200, SR_READ | SR_WRITE}, + {"MDCCSR_EL0", REG_MDCCSR_EL0, 0x130100, SR_READ}, + {"MDRAR_EL1", REG_MDRAR_EL1, 0x101000, SR_READ}, + {"MDSCR_EL1", REG_MDSCR_EL1, 0x100240, SR_READ | SR_WRITE}, + {"MIDR_EL1", REG_MIDR_EL1, 0x180000, SR_READ}, + {"MPAM0_EL1", REG_MPAM0_EL1, 0x18a520, SR_READ | SR_WRITE}, + {"MPAM1_EL1", REG_MPAM1_EL1, 0x18a500, SR_READ | SR_WRITE}, + {"MPAMIDR_EL1", REG_MPAMIDR_EL1, 0x18a480, SR_READ}, + {"MPIDR_EL1", REG_MPIDR_EL1, 0x1800a0, SR_READ}, + {"MVFR0_EL1", REG_MVFR0_EL1, 0x180300, SR_READ}, + {"MVFR1_EL1", REG_MVFR1_EL1, 0x180320, SR_READ}, + {"MVFR2_EL1", REG_MVFR2_EL1, 0x180340, SR_READ}, + {"NZCV", REG_NZCV, 0x1b4200, SR_READ | SR_WRITE}, + {"OSDLR_EL1", REG_OSDLR_EL1, 0x101380, SR_READ | SR_WRITE}, + {"OSDTRRX_EL1", REG_OSDTRRX_EL1, 0x100040, SR_READ | SR_WRITE}, + {"OSDTRTX_EL1", REG_OSDTRTX_EL1, 0x100340, SR_READ | SR_WRITE}, + {"OSECCR_EL1", REG_OSECCR_EL1, 0x100640, SR_READ | SR_WRITE}, + {"OSLAR_EL1", REG_OSLAR_EL1, 0x101080, SR_WRITE}, + {"OSLSR_EL1", REG_OSLSR_EL1, 0x101180, SR_READ}, + {"PAN", REG_PAN, 0x184260, SR_READ | SR_WRITE}, + {"PAR_EL1", REG_PAR_EL1, 0x187400, SR_READ | SR_WRITE}, + {"PMBIDR_EL1", REG_PMBIDR_EL1, 0x189ae0, SR_READ}, + {"PMBLIMITR_EL1", REG_PMBLIMITR_EL1, 0x189a00, SR_READ | SR_WRITE}, + {"PMBPTR_EL1", REG_PMBPTR_EL1, 0x189a20, SR_READ | SR_WRITE}, + {"PMBSR_EL1", REG_PMBSR_EL1, 0x189a60, SR_READ | SR_WRITE}, + {"PMCCFILTR_EL0", REG_PMCCFILTR_EL0, 0x1befe0, SR_READ | SR_WRITE}, + {"PMCCNTR_EL0", REG_PMCCNTR_EL0, 0x1b9d00, SR_READ | SR_WRITE}, + {"PMCEID0_EL0", REG_PMCEID0_EL0, 0x1b9cc0, SR_READ}, + {"PMCEID1_EL0", REG_PMCEID1_EL0, 0x1b9ce0, SR_READ}, + {"PMCNTENCLR_EL0", REG_PMCNTENCLR_EL0, 0x1b9c40, SR_READ | SR_WRITE}, + {"PMCNTENSET_EL0", REG_PMCNTENSET_EL0, 0x1b9c20, SR_READ | SR_WRITE}, + {"PMCR_EL0", REG_PMCR_EL0, 0x1b9c00, SR_READ | SR_WRITE}, + {"PMEVCNTR0_EL0", REG_PMEVCNTR0_EL0, 0x1be800, SR_READ | SR_WRITE}, + {"PMEVCNTR1_EL0", REG_PMEVCNTR1_EL0, 0x1be820, SR_READ | SR_WRITE}, + {"PMEVCNTR2_EL0", REG_PMEVCNTR2_EL0, 0x1be840, SR_READ | SR_WRITE}, + {"PMEVCNTR3_EL0", REG_PMEVCNTR3_EL0, 0x1be860, SR_READ | SR_WRITE}, + {"PMEVCNTR4_EL0", REG_PMEVCNTR4_EL0, 0x1be880, SR_READ | SR_WRITE}, + {"PMEVCNTR5_EL0", REG_PMEVCNTR5_EL0, 0x1be8a0, SR_READ | SR_WRITE}, + {"PMEVCNTR6_EL0", REG_PMEVCNTR6_EL0, 0x1be8c0, SR_READ | SR_WRITE}, + {"PMEVCNTR7_EL0", REG_PMEVCNTR7_EL0, 0x1be8e0, SR_READ | SR_WRITE}, + {"PMEVCNTR8_EL0", REG_PMEVCNTR8_EL0, 0x1be900, SR_READ | SR_WRITE}, + {"PMEVCNTR9_EL0", REG_PMEVCNTR9_EL0, 0x1be920, SR_READ | SR_WRITE}, + {"PMEVCNTR10_EL0", REG_PMEVCNTR10_EL0, 0x1be940, SR_READ | SR_WRITE}, + {"PMEVCNTR11_EL0", REG_PMEVCNTR11_EL0, 0x1be960, SR_READ | SR_WRITE}, + {"PMEVCNTR12_EL0", REG_PMEVCNTR12_EL0, 0x1be980, SR_READ | SR_WRITE}, + {"PMEVCNTR13_EL0", REG_PMEVCNTR13_EL0, 0x1be9a0, SR_READ | SR_WRITE}, + {"PMEVCNTR14_EL0", REG_PMEVCNTR14_EL0, 0x1be9c0, SR_READ | SR_WRITE}, + {"PMEVCNTR15_EL0", REG_PMEVCNTR15_EL0, 0x1be9e0, SR_READ | SR_WRITE}, + {"PMEVCNTR16_EL0", REG_PMEVCNTR16_EL0, 0x1bea00, SR_READ | SR_WRITE}, + {"PMEVCNTR17_EL0", REG_PMEVCNTR17_EL0, 0x1bea20, SR_READ | SR_WRITE}, + {"PMEVCNTR18_EL0", REG_PMEVCNTR18_EL0, 0x1bea40, SR_READ | SR_WRITE}, + {"PMEVCNTR19_EL0", REG_PMEVCNTR19_EL0, 0x1bea60, SR_READ | SR_WRITE}, + {"PMEVCNTR20_EL0", REG_PMEVCNTR20_EL0, 0x1bea80, SR_READ | SR_WRITE}, + {"PMEVCNTR21_EL0", REG_PMEVCNTR21_EL0, 0x1beaa0, SR_READ | SR_WRITE}, + {"PMEVCNTR22_EL0", REG_PMEVCNTR22_EL0, 0x1beac0, SR_READ | SR_WRITE}, + {"PMEVCNTR23_EL0", REG_PMEVCNTR23_EL0, 0x1beae0, SR_READ | SR_WRITE}, + {"PMEVCNTR24_EL0", REG_PMEVCNTR24_EL0, 0x1beb00, SR_READ | SR_WRITE}, + {"PMEVCNTR25_EL0", REG_PMEVCNTR25_EL0, 0x1beb20, SR_READ | SR_WRITE}, + {"PMEVCNTR26_EL0", REG_PMEVCNTR26_EL0, 0x1beb40, SR_READ | SR_WRITE}, + {"PMEVCNTR27_EL0", REG_PMEVCNTR27_EL0, 0x1beb60, SR_READ | SR_WRITE}, + {"PMEVCNTR28_EL0", REG_PMEVCNTR28_EL0, 0x1beb80, SR_READ | SR_WRITE}, + {"PMEVCNTR29_EL0", REG_PMEVCNTR29_EL0, 0x1beba0, SR_READ | SR_WRITE}, + {"PMEVCNTR30_EL0", REG_PMEVCNTR30_EL0, 0x1bebc0, SR_READ | SR_WRITE}, + {"PMEVTYPER0_EL0", REG_PMEVTYPER0_EL0, 0x1bec00, SR_READ | SR_WRITE}, + {"PMEVTYPER1_EL0", REG_PMEVTYPER1_EL0, 0x1bec20, SR_READ | SR_WRITE}, + {"PMEVTYPER2_EL0", REG_PMEVTYPER2_EL0, 0x1bec40, SR_READ | SR_WRITE}, + {"PMEVTYPER3_EL0", REG_PMEVTYPER3_EL0, 0x1bec60, SR_READ | SR_WRITE}, + {"PMEVTYPER4_EL0", REG_PMEVTYPER4_EL0, 0x1bec80, SR_READ | SR_WRITE}, + {"PMEVTYPER5_EL0", REG_PMEVTYPER5_EL0, 0x1beca0, SR_READ | SR_WRITE}, + {"PMEVTYPER6_EL0", REG_PMEVTYPER6_EL0, 0x1becc0, SR_READ | SR_WRITE}, + {"PMEVTYPER7_EL0", REG_PMEVTYPER7_EL0, 0x1bece0, SR_READ | SR_WRITE}, + {"PMEVTYPER8_EL0", REG_PMEVTYPER8_EL0, 0x1bed00, SR_READ | SR_WRITE}, + {"PMEVTYPER9_EL0", REG_PMEVTYPER9_EL0, 0x1bed20, SR_READ | SR_WRITE}, + {"PMEVTYPER10_EL0", REG_PMEVTYPER10_EL0, 0x1bed40, SR_READ | SR_WRITE}, + {"PMEVTYPER11_EL0", REG_PMEVTYPER11_EL0, 0x1bed60, SR_READ | SR_WRITE}, + {"PMEVTYPER12_EL0", REG_PMEVTYPER12_EL0, 0x1bed80, SR_READ | SR_WRITE}, + {"PMEVTYPER13_EL0", REG_PMEVTYPER13_EL0, 0x1beda0, SR_READ | SR_WRITE}, + {"PMEVTYPER14_EL0", REG_PMEVTYPER14_EL0, 0x1bedc0, SR_READ | SR_WRITE}, + {"PMEVTYPER15_EL0", REG_PMEVTYPER15_EL0, 0x1bede0, SR_READ | SR_WRITE}, + {"PMEVTYPER16_EL0", REG_PMEVTYPER16_EL0, 0x1bee00, SR_READ | SR_WRITE}, + {"PMEVTYPER17_EL0", REG_PMEVTYPER17_EL0, 0x1bee20, SR_READ | SR_WRITE}, + {"PMEVTYPER18_EL0", REG_PMEVTYPER18_EL0, 0x1bee40, SR_READ | SR_WRITE}, + {"PMEVTYPER19_EL0", REG_PMEVTYPER19_EL0, 0x1bee60, SR_READ | SR_WRITE}, + {"PMEVTYPER20_EL0", REG_PMEVTYPER20_EL0, 0x1bee80, SR_READ | SR_WRITE}, + {"PMEVTYPER21_EL0", REG_PMEVTYPER21_EL0, 0x1beea0, SR_READ | SR_WRITE}, + {"PMEVTYPER22_EL0", REG_PMEVTYPER22_EL0, 0x1beec0, SR_READ | SR_WRITE}, + {"PMEVTYPER23_EL0", REG_PMEVTYPER23_EL0, 0x1beee0, SR_READ | SR_WRITE}, + {"PMEVTYPER24_EL0", REG_PMEVTYPER24_EL0, 0x1bef00, SR_READ | SR_WRITE}, + {"PMEVTYPER25_EL0", REG_PMEVTYPER25_EL0, 0x1bef20, SR_READ | SR_WRITE}, + {"PMEVTYPER26_EL0", REG_PMEVTYPER26_EL0, 0x1bef40, SR_READ | SR_WRITE}, + {"PMEVTYPER27_EL0", REG_PMEVTYPER27_EL0, 0x1bef60, SR_READ | SR_WRITE}, + {"PMEVTYPER28_EL0", REG_PMEVTYPER28_EL0, 0x1bef80, SR_READ | SR_WRITE}, + {"PMEVTYPER29_EL0", REG_PMEVTYPER29_EL0, 0x1befa0, SR_READ | SR_WRITE}, + {"PMEVTYPER30_EL0", REG_PMEVTYPER30_EL0, 0x1befc0, SR_READ | SR_WRITE}, + {"PMINTENCLR_EL1", REG_PMINTENCLR_EL1, 0x189e40, SR_READ | SR_WRITE}, + {"PMINTENSET_EL1", REG_PMINTENSET_EL1, 0x189e20, SR_READ | SR_WRITE}, + {"PMMIR_EL1", REG_PMMIR_EL1, 0x189ec0, SR_READ}, + {"PMOVSCLR_EL0", REG_PMOVSCLR_EL0, 0x1b9c60, SR_READ | SR_WRITE}, + {"PMOVSSET_EL0", REG_PMOVSSET_EL0, 0x1b9e60, SR_READ | SR_WRITE}, + {"PMSCR_EL1", REG_PMSCR_EL1, 0x189900, SR_READ | SR_WRITE}, + {"PMSELR_EL0", REG_PMSELR_EL0, 0x1b9ca0, SR_READ | SR_WRITE}, + {"PMSEVFR_EL1", REG_PMSEVFR_EL1, 0x1899a0, SR_READ | SR_WRITE}, + {"PMSFCR_EL1", REG_PMSFCR_EL1, 0x189980, SR_READ | SR_WRITE}, + {"PMSICR_EL1", REG_PMSICR_EL1, 0x189940, SR_READ | SR_WRITE}, + {"PMSIDR_EL1", REG_PMSIDR_EL1, 0x1899e0, SR_READ}, + {"PMSIRR_EL1", REG_PMSIRR_EL1, 0x189960, SR_READ | SR_WRITE}, + {"PMSLATFR_EL1", REG_PMSLATFR_EL1, 0x1899c0, SR_READ | SR_WRITE}, + {"PMSWINC_EL0", REG_PMSWINC_EL0, 0x1b9c80, SR_WRITE}, + {"PMUSERENR_EL0", REG_PMUSERENR_EL0, 0x1b9e00, SR_READ | SR_WRITE}, + {"PMXEVCNTR_EL0", REG_PMXEVCNTR_EL0, 0x1b9d40, SR_READ | SR_WRITE}, + {"PMXEVTYPER_EL0", REG_PMXEVTYPER_EL0, 0x1b9d20, SR_READ | SR_WRITE}, + {"REVIDR_EL1", REG_REVIDR_EL1, 0x1800c0, SR_READ}, + {"RGSR_EL1", REG_RGSR_EL1, 0x1810a0, SR_READ | SR_WRITE}, + {"RMR_EL1", REG_RMR_EL1, 0x18c040, SR_READ | SR_WRITE}, + {"RNDR", REG_RNDR, 0x1b2400, SR_READ}, + {"RNDRRS", REG_RNDRRS, 0x1b2420, SR_READ}, + {"RVBAR_EL1", REG_RVBAR_EL1, 0x18c020, SR_READ}, + {"SCTLR_EL1", REG_SCTLR_EL1, 0x181000, SR_READ | SR_WRITE}, + {"SCXTNUM_EL0", REG_SCXTNUM_EL0, 0x1bd0e0, SR_READ | SR_WRITE}, + {"SCXTNUM_EL1", REG_SCXTNUM_EL1, 0x18d0e0, SR_READ | SR_WRITE}, + {"SP_EL0", REG_SP_EL0, 0x184100, SR_READ | SR_WRITE}, + {"SP_EL1", REG_SP_EL1, 0x1c4100, SR_READ | SR_WRITE}, + {"SPSel", REG_SPSel, 0x184200, SR_READ | SR_WRITE}, + {"SPSR_abt", REG_SPSR_abt, 0x1c4320, SR_READ | SR_WRITE}, + {"SPSR_EL1", REG_SPSR_EL1, 0x184000, SR_READ | SR_WRITE}, + {"SPSR_fiq", REG_SPSR_fiq, 0x1c4360, SR_READ | SR_WRITE}, + {"SPSR_irq", REG_SPSR_irq, 0x1c4300, SR_READ | SR_WRITE}, + {"SPSR_und", REG_SPSR_und, 0x1c4340, SR_READ | SR_WRITE}, + {"SSBS", REG_SSBS, 0x1b42c0, SR_READ | SR_WRITE}, + {"TCO", REG_TCO, 0x1b42e0, SR_READ | SR_WRITE}, + {"TCR_EL1", REG_TCR_EL1, 0x182040, SR_READ | SR_WRITE}, + {"TFSR_EL1", REG_TFSR_EL1, 0x185600, SR_READ | SR_WRITE}, + {"TFSRE0_EL1", REG_TFSRE0_EL1, 0x185620, SR_READ | SR_WRITE}, + {"TPIDR_EL0", REG_TPIDR_EL0, 0x1bd040, SR_READ | SR_WRITE}, + {"TPIDR_EL1", REG_TPIDR_EL1, 0x18d080, SR_READ | SR_WRITE}, + {"TPIDRRO_EL0", REG_TPIDRRO_EL0, 0x1bd060, SR_READ | SR_WRITE}, + {"TRFCR_EL1", REG_TRFCR_EL1, 0x181220, SR_READ | SR_WRITE}, + {"TTBR0_EL1", REG_TTBR0_EL1, 0x182000, SR_READ | SR_WRITE}, + {"TTBR1_EL1", REG_TTBR1_EL1, 0x182020, SR_READ | SR_WRITE}, + {"UAO", REG_UAO, 0x184280, SR_READ | SR_WRITE}, + {"VBAR_EL1", REG_VBAR_EL1, 0x18c000, SR_READ | SR_WRITE}, + {"ZCR_EL1", REG_ZCR_EL1, 0x181200, SR_READ | SR_WRITE}, } -func SysRegEnc(r int16) (string, uint32) { +func SysRegEnc(r int16) (string, uint32, uint8) { // The automatic generator guarantees that the order // of Reg in SystemReg struct is consistent with the // order of system register declarations - if r <= AUTO_SYSREG_BEGIN || r >= AUTO_SYSREG_END { - return "", 0 + if r <= SYSREG_BEGIN || r >= SYSREG_END { + return "", 0, 0 } - v := SystemReg[r-AUTO_SYSREG_BEGIN-1] - return v.Name, v.Enc + v := SystemReg[r-SYSREG_BEGIN-1] + return v.Name, v.Enc, v.AccessFlags } diff --git a/src/cmd/internal/obj/dwarf.go b/src/cmd/internal/obj/dwarf.go index d8f3de3b692..4118c6442c1 100644 --- a/src/cmd/internal/obj/dwarf.go +++ b/src/cmd/internal/obj/dwarf.go @@ -8,6 +8,7 @@ package obj import ( "cmd/internal/dwarf" + "cmd/internal/src" "fmt" ) @@ -48,78 +49,45 @@ func (ctxt *Link) generateDebugLinesSymbol(s, lines *LSym) { // generating the line table. See below. // TODO: Once delve can support multiple DW_LNS_end_statements, we don't have // to do this. - is_stmt := uint8(1) + stmt := true + line := int64(1) pc := s.Func.Text.Pc - line := 1 - file := 1 + name := "" + prologue, wrotePrologue := false, false + // Walk the progs, generating the DWARF table. + for p := s.Func.Text; p != nil; p = p.Link { + prologue = prologue || (p.Pos.Xlogue() == src.PosPrologueEnd) + // If we're not at a real instruction, keep looping! + if p.Pos.Line() == 0 || (p.Link != nil && p.Link.Pc == p.Pc) { + continue + } + newStmt := p.Pos.IsStmt() != src.PosNotStmt + newName, newLine := linkgetlineFromPos(ctxt, p.Pos) - // The linker will insert the DW_LNE_set_address once determined; therefore, - // it's omitted here. - - // Generate the actual line information. - // We use the pcline and pcfile to generate this section, and it's suboptimal. - // Likely better would be to generate this dirrectly from the progs and not - // parse those tables. - // TODO: Generate from the progs if it's faster. - pcfile := NewPCIter(uint32(ctxt.Arch.Arch.MinLC)) - pcline := NewPCIter(uint32(ctxt.Arch.Arch.MinLC)) - pcstmt := NewPCIter(uint32(ctxt.Arch.Arch.MinLC)) - pcfile.Init(s.Func.Pcln.Pcfile.P) - pcline.Init(s.Func.Pcln.Pcline.P) - var pctostmtData Pcdata - funcpctab(ctxt, &pctostmtData, s, "pctostmt", pctostmt, nil) - pcstmt.Init(pctostmtData.P) - var thispc uint32 - - for !pcfile.Done && !pcline.Done { - // Only changed if it advanced - if int32(file) != pcfile.Value { + // Output debug info. + wrote := false + if name != newName { + newFile := ctxt.PosTable.FileIndex(newName) + 1 // 1 indexing for the table. dctxt.AddUint8(lines, dwarf.DW_LNS_set_file) - dwarf.Uleb128put(dctxt, lines, fileNums[pcfile.Value]) - file = int(pcfile.Value) + dwarf.Uleb128put(dctxt, lines, int64(newFile)) + name = newName + wrote = true + } + if prologue && !wrotePrologue { + dctxt.AddUint8(lines, uint8(dwarf.DW_LNS_set_prologue_end)) + wrotePrologue = true + wrote = true + } + if stmt != newStmt { + dctxt.AddUint8(lines, uint8(dwarf.DW_LNS_negate_stmt)) + stmt = newStmt + wrote = true } - // Only changed if it advanced - if is_stmt != uint8(pcstmt.Value) { - new_stmt := uint8(pcstmt.Value) - switch new_stmt &^ 1 { - case PrologueEnd: - dctxt.AddUint8(lines, uint8(dwarf.DW_LNS_set_prologue_end)) - case EpilogueBegin: - // TODO if there is a use for this, add it. - // Don't forget to increase OPCODE_BASE by 1 and add entry for standard_opcode_lengths[11] - panic("unsupported EpilogueBegin") - } - new_stmt &= 1 - if is_stmt != new_stmt { - is_stmt = new_stmt - dctxt.AddUint8(lines, uint8(dwarf.DW_LNS_negate_stmt)) - } - } - - // putpcldelta makes a row in the DWARF matrix, always, even if line is unchanged. - putpclcdelta(ctxt, dctxt, lines, uint64(s.Func.Text.Pc+int64(thispc)-pc), int64(pcline.Value)-int64(line)) - - pc = s.Func.Text.Pc + int64(thispc) - line = int(pcline.Value) - - // Take the minimum step forward for the three iterators - thispc = pcfile.NextPC - if pcline.NextPC < thispc { - thispc = pcline.NextPC - } - if !pcstmt.Done && pcstmt.NextPC < thispc { - thispc = pcstmt.NextPC - } - - if pcfile.NextPC == thispc { - pcfile.Next() - } - if !pcstmt.Done && pcstmt.NextPC == thispc { - pcstmt.Next() - } - if pcline.NextPC == thispc { - pcline.Next() + if line != int64(newLine) || wrote { + pcdelta := p.Pc - pc + putpclcdelta(ctxt, dctxt, lines, uint64(pcdelta), int64(newLine)-line) + line, pc = int64(newLine), p.Pc } } @@ -129,16 +97,16 @@ func (ctxt *Link) generateDebugLinesSymbol(s, lines *LSym) { // file = 1 // line = 1 // column = 0 - // is_stmt = set in header, we assume true + // stmt = set in header, we assume true // basic_block = false // Careful readers of the DWARF specification will note that we don't reset // the address of the state machine -- but this will happen at the beginning - // of the NEXT block of opcodes. (See the SetAddress call above.) + // of the NEXT block of opcodes. dctxt.AddUint8(lines, dwarf.DW_LNS_set_file) dwarf.Uleb128put(dctxt, lines, 1) dctxt.AddUint8(lines, dwarf.DW_LNS_advance_line) dwarf.Sleb128put(dctxt, lines, int64(1-line)) - if is_stmt != 1 { + if !stmt { dctxt.AddUint8(lines, dwarf.DW_LNS_negate_stmt) } dctxt.AddUint8(lines, dwarf.DW_LNS_copy) diff --git a/src/cmd/internal/obj/pcln.go b/src/cmd/internal/obj/pcln.go index ca1eda8d1ec..58552b9299f 100644 --- a/src/cmd/internal/obj/pcln.go +++ b/src/cmd/internal/obj/pcln.go @@ -5,16 +5,10 @@ package obj import ( - "cmd/internal/src" "encoding/binary" "log" ) -const ( - PrologueEnd = 2 + iota // overload "is_stmt" to include prologue_end - EpilogueBegin // overload "is_stmt" to include epilogue_end -) - // funcpctab writes to dst a pc-value table mapping the code in func to the values // returned by valfunc parameterized by arg. The invocation of valfunc to update the // current value is, for each p, @@ -249,34 +243,6 @@ func pctospadj(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg in return oldval + p.Spadj } -// pctostmt returns either, -// if phase==0, then whether the current instruction is a step-target (Dwarf is_stmt) -// bit-or'd with whether the current statement is a prologue end or epilogue begin -// else (phase == 1), zero. -// -func pctostmt(ctxt *Link, sym *LSym, oldval int32, p *Prog, phase int32, arg interface{}) int32 { - if phase == 1 { - return 0 // Ignored; also different from initial value of -1, if that ever matters. - } - s := p.Pos.IsStmt() - l := p.Pos.Xlogue() - - var is_stmt int32 - - // PrologueEnd, at least, is passed to the next instruction - switch l { - case src.PosPrologueEnd: - is_stmt = PrologueEnd - case src.PosEpilogueBegin: - is_stmt = EpilogueBegin - } - - if s != src.PosNotStmt { - is_stmt |= 1 // either PosDefaultStmt from asm, or PosIsStmt from go - } - return is_stmt -} - // pctopcdata computes the pcdata value in effect at p. // A PCDATA instruction sets the value in effect at future // non-PCDATA instructions. diff --git a/src/cmd/internal/obj/s390x/a.out.go b/src/cmd/internal/obj/s390x/a.out.go index b44531cfe62..7dcf3e8cfe7 100644 --- a/src/cmd/internal/obj/s390x/a.out.go +++ b/src/cmd/internal/obj/s390x/a.out.go @@ -409,6 +409,10 @@ const ( ABVS ASYSCALL + // branch on count + ABRCT + ABRCTG + // compare and branch ACRJ ACGRJ diff --git a/src/cmd/internal/obj/s390x/anames.go b/src/cmd/internal/obj/s390x/anames.go index dad710bc45e..c3a76a0df0b 100644 --- a/src/cmd/internal/obj/s390x/anames.go +++ b/src/cmd/internal/obj/s390x/anames.go @@ -155,6 +155,8 @@ var Anames = []string{ "BVC", "BVS", "SYSCALL", + "BRCT", + "BRCTG", "CRJ", "CGRJ", "CLRJ", diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go index ea254c74a84..3cc7d0b160e 100644 --- a/src/cmd/internal/obj/s390x/asmz.go +++ b/src/cmd/internal/obj/s390x/asmz.go @@ -256,6 +256,10 @@ var optab = []Optab{ {i: 90, as: ACLGIJ, a1: C_SCON, a2: C_REG, a3: C_ADDCON, a6: C_SBRA}, {i: 90, as: ACMPUBEQ, a1: C_REG, a3: C_ANDCON, a6: C_SBRA}, + // branch on count + {i: 41, as: ABRCT, a1: C_REG, a6: C_SBRA}, + {i: 41, as: ABRCTG, a1: C_REG, a6: C_SBRA}, + // move on condition {i: 17, as: AMOVDEQ, a1: C_REG, a6: C_REG}, @@ -3394,6 +3398,21 @@ func (c *ctxtz) asmout(p *obj.Prog, asm *[]byte) { *asm = append(*asm, uint8(wd)) } + case 41: // branch on count + r1 := p.From.Reg + ri2 := (p.Pcond.Pc - p.Pc) >> 1 + if int64(int16(ri2)) != ri2 { + c.ctxt.Diag("branch target too far away") + } + var opcode uint32 + switch p.As { + case ABRCT: + opcode = op_BRCT + case ABRCTG: + opcode = op_BRCTG + } + zRI(opcode, uint32(r1), uint32(ri2), asm) + case 47: // negate [reg] reg r := p.From.Reg if r == 0 { diff --git a/src/cmd/internal/obj/s390x/vector.go b/src/cmd/internal/obj/s390x/vector.go index 62adcf6d4a5..00f578340f9 100644 --- a/src/cmd/internal/obj/s390x/vector.go +++ b/src/cmd/internal/obj/s390x/vector.go @@ -978,9 +978,9 @@ func vop(as obj.As) (opcode, es, cs uint32) { case AVSUMQ: return op_VSUMQ, 0, 0 case AVSUMQF: - return op_VSUMQ, 1, 0 - case AVSUMQG: return op_VSUMQ, 2, 0 + case AVSUMQG: + return op_VSUMQ, 3, 0 case AVSUM: return op_VSUM, 0, 0 case AVSUMB: diff --git a/src/cmd/internal/obj/sizeof_test.go b/src/cmd/internal/obj/sizeof_test.go index 306bf10ee6b..ac65143b6b0 100644 --- a/src/cmd/internal/obj/sizeof_test.go +++ b/src/cmd/internal/obj/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package obj import ( diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go index e7c76d6da27..f5359493d06 100644 --- a/src/cmd/internal/obj/x86/asm6.go +++ b/src/cmd/internal/obj/x86/asm6.go @@ -1834,12 +1834,6 @@ func fillnop(p []byte, n int) { } } -func naclpad(ctxt *obj.Link, s *obj.LSym, c int32, pad int32) int32 { - s.Grow(int64(c) + int64(pad)) - fillnop(s.P[c:], int(pad)) - return c + pad -} - func spadjop(ctxt *obj.Link, l, q obj.As) obj.As { if ctxt.Arch.Family != sys.AMD64 || ctxt.Arch.PtrSize == 4 { return l @@ -1905,39 +1899,6 @@ func span6(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) { s.P = s.P[:0] c = 0 for p := s.Func.Text; p != nil; p = p.Link { - if ctxt.Headtype == objabi.Hnacl && p.Isize > 0 { - // pad everything to avoid crossing 32-byte boundary - if c>>5 != (c+int32(p.Isize)-1)>>5 { - c = naclpad(ctxt, s, c, -c&31) - } - - // pad call deferreturn to start at 32-byte boundary - // so that subtracting 5 in jmpdefer will jump back - // to that boundary and rerun the call. - if p.As == obj.ACALL && p.To.Sym == deferreturn { - c = naclpad(ctxt, s, c, -c&31) - } - - // pad call to end at 32-byte boundary - if p.As == obj.ACALL { - c = naclpad(ctxt, s, c, -(c+int32(p.Isize))&31) - } - - // the linker treats REP and STOSQ as different instructions - // but in fact the REP is a prefix on the STOSQ. - // make sure REP has room for 2 more bytes, so that - // padding will not be inserted before the next instruction. - if (p.As == AREP || p.As == AREPN) && c>>5 != (c+3-1)>>5 { - c = naclpad(ctxt, s, c, -c&31) - } - - // same for LOCK. - // various instructions follow; the longest is 4 bytes. - // give ourselves 8 bytes so as to avoid surprises. - if p.As == ALOCK && c>>5 != (c+8-1)>>5 { - c = naclpad(ctxt, s, c, -c&31) - } - } if (p.Back&branchLoopHead != 0) && c&(loopAlign-1) != 0 { // pad with NOPs @@ -1978,11 +1939,6 @@ func span6(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) { m := ab.Len() if int(p.Isize) != m { p.Isize = uint8(m) - // When building for NaCl, we currently need - // at least 2 rounds to ensure proper 32-byte alignment. - if ctxt.Headtype == objabi.Hnacl { - reAssemble = true - } } s.Grow(p.Pc + int64(m)) @@ -2003,10 +1959,6 @@ func span6(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) { } } - if ctxt.Headtype == objabi.Hnacl { - c = naclpad(ctxt, s, c, -c&31) - } - s.Size = int64(c) if false { /* debug['a'] > 1 */ @@ -2041,8 +1993,6 @@ func instinit(ctxt *obj.Link) { switch ctxt.Headtype { case objabi.Hplan9: plan9privates = ctxt.Lookup("_privates") - case objabi.Hnacl: - deferreturn = ctxt.LookupABI("runtime.deferreturn", obj.ABIInternal) } for i := range avxOptab { @@ -4878,8 +4828,7 @@ func (ab *AsmBuf) doasm(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog) { default: log.Fatalf("unknown TLS base location for %v", ctxt.Headtype) - case objabi.Hlinux, - objabi.Hnacl, objabi.Hfreebsd: + case objabi.Hlinux, objabi.Hfreebsd: if ctxt.Flag_shared { // Note that this is not generating the same insns as the other cases. // MOV TLS, dst @@ -5175,166 +5124,9 @@ func isbadbyte(a *obj.Addr) bool { return a.Type == obj.TYPE_REG && (REG_BP <= a.Reg && a.Reg <= REG_DI || REG_BPB <= a.Reg && a.Reg <= REG_DIB) } -var naclret = []uint8{ - 0x5e, // POPL SI - // 0x8b, 0x7d, 0x00, // MOVL (BP), DI - catch return to invalid address, for debugging - 0x83, - 0xe6, - 0xe0, // ANDL $~31, SI - 0x4c, - 0x01, - 0xfe, // ADDQ R15, SI - 0xff, - 0xe6, // JMP SI -} - -var naclret8 = []uint8{ - 0x5d, // POPL BP - // 0x8b, 0x7d, 0x00, // MOVL (BP), DI - catch return to invalid address, for debugging - 0x83, - 0xe5, - 0xe0, // ANDL $~31, BP - 0xff, - 0xe5, // JMP BP -} - -var naclspfix = []uint8{0x4c, 0x01, 0xfc} // ADDQ R15, SP - -var naclbpfix = []uint8{0x4c, 0x01, 0xfd} // ADDQ R15, BP - -var naclmovs = []uint8{ - 0x89, - 0xf6, // MOVL SI, SI - 0x49, - 0x8d, - 0x34, - 0x37, // LEAQ (R15)(SI*1), SI - 0x89, - 0xff, // MOVL DI, DI - 0x49, - 0x8d, - 0x3c, - 0x3f, // LEAQ (R15)(DI*1), DI -} - -var naclstos = []uint8{ - 0x89, - 0xff, // MOVL DI, DI - 0x49, - 0x8d, - 0x3c, - 0x3f, // LEAQ (R15)(DI*1), DI -} - -func (ab *AsmBuf) nacltrunc(ctxt *obj.Link, reg int) { - if reg >= REG_R8 { - ab.Put1(0x45) - } - reg = (reg - REG_AX) & 7 - ab.Put2(0x89, byte(3<<6|reg<<3|reg)) -} - func (ab *AsmBuf) asmins(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog) { ab.Reset() - if ctxt.Headtype == objabi.Hnacl && ctxt.Arch.Family == sys.I386 { - switch p.As { - case obj.ARET: - ab.Put(naclret8) - return - - case obj.ACALL, - obj.AJMP: - if p.To.Type == obj.TYPE_REG && REG_AX <= p.To.Reg && p.To.Reg <= REG_DI { - ab.Put3(0x83, byte(0xe0|(p.To.Reg-REG_AX)), 0xe0) - } - - case AINT: - ab.Put1(0xf4) - return - } - } - - if ctxt.Headtype == objabi.Hnacl && ctxt.Arch.Family == sys.AMD64 { - if p.As == AREP { - ab.rep = true - return - } - - if p.As == AREPN { - ab.repn = true - return - } - - if p.As == ALOCK { - ab.lock = true - return - } - - if p.As != ALEAQ && p.As != ALEAL { - if p.From.Index != REG_NONE && p.From.Scale > 0 { - ab.nacltrunc(ctxt, int(p.From.Index)) - } - if p.To.Index != REG_NONE && p.To.Scale > 0 { - ab.nacltrunc(ctxt, int(p.To.Index)) - } - } - - switch p.As { - case obj.ARET: - ab.Put(naclret) - return - - case obj.ACALL, - obj.AJMP: - if p.To.Type == obj.TYPE_REG && REG_AX <= p.To.Reg && p.To.Reg <= REG_DI { - // ANDL $~31, reg - ab.Put3(0x83, byte(0xe0|(p.To.Reg-REG_AX)), 0xe0) - // ADDQ R15, reg - ab.Put3(0x4c, 0x01, byte(0xf8|(p.To.Reg-REG_AX))) - } - - if p.To.Type == obj.TYPE_REG && REG_R8 <= p.To.Reg && p.To.Reg <= REG_R15 { - // ANDL $~31, reg - ab.Put4(0x41, 0x83, byte(0xe0|(p.To.Reg-REG_R8)), 0xe0) - // ADDQ R15, reg - ab.Put3(0x4d, 0x01, byte(0xf8|(p.To.Reg-REG_R8))) - } - - case AINT: - ab.Put1(0xf4) - return - - case ASCASB, - ASCASW, - ASCASL, - ASCASQ, - ASTOSB, - ASTOSW, - ASTOSL, - ASTOSQ: - ab.Put(naclstos) - - case AMOVSB, AMOVSW, AMOVSL, AMOVSQ: - ab.Put(naclmovs) - } - - if ab.rep { - ab.Put1(0xf3) - ab.rep = false - } - - if ab.repn { - ab.Put1(0xf2) - ab.repn = false - } - - if ab.lock { - ab.Put1(0xf0) - ab.lock = false - } - } - ab.rexflag = 0 ab.vexflag = false ab.evexflag = false @@ -5393,15 +5185,6 @@ func (ab *AsmBuf) asmins(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog) { } } - - if ctxt.Arch.Family == sys.AMD64 && ctxt.Headtype == objabi.Hnacl && p.As != ACMPL && p.As != ACMPQ && p.To.Type == obj.TYPE_REG { - switch p.To.Reg { - case REG_SP: - ab.Put(naclspfix) - case REG_BP: - ab.Put(naclbpfix) - } - } } // unpackOps4 extracts 4 operands from p. diff --git a/src/cmd/internal/obj/x86/obj6.go b/src/cmd/internal/obj/x86/obj6.go index d1ac707fd7a..4554d4a525f 100644 --- a/src/cmd/internal/obj/x86/obj6.go +++ b/src/cmd/internal/obj/x86/obj6.go @@ -48,7 +48,6 @@ func CanUse1InsnTLS(ctxt *obj.Link) bool { if ctxt.Arch.Family == sys.I386 { switch ctxt.Headtype { case objabi.Hlinux, - objabi.Hnacl, objabi.Hplan9, objabi.Hwindows: return false @@ -208,14 +207,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) { } } - if ctxt.Headtype == objabi.Hnacl && ctxt.Arch.Family == sys.AMD64 { - if p.GetFrom3() != nil { - nacladdr(ctxt, p, p.GetFrom3()) - } - nacladdr(ctxt, p, &p.From) - nacladdr(ctxt, p, &p.To) - } - // Rewrite float constants to values stored in memory. switch p.As { // Convert AMOVSS $(0), Xx to AXORPS Xx, Xx @@ -568,38 +559,6 @@ func rewriteToPcrel(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) { obj.Nopout(p) } -func nacladdr(ctxt *obj.Link, p *obj.Prog, a *obj.Addr) { - if p.As == ALEAL || p.As == ALEAQ { - return - } - - if a.Reg == REG_BP { - ctxt.Diag("invalid address: %v", p) - return - } - - if a.Reg == REG_TLS { - a.Reg = REG_BP - } - if a.Type == obj.TYPE_MEM && a.Name == obj.NAME_NONE { - switch a.Reg { - // all ok - case REG_BP, REG_SP, REG_R15: - break - - default: - if a.Index != REG_NONE { - ctxt.Diag("invalid address %v", p) - } - a.Index = a.Reg - if a.Index != REG_NONE { - a.Scale = 1 - } - a.Reg = REG_R15 - } - } -} - func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { if cursym.Func.Text == nil || cursym.Func.Text.Link == nil { return @@ -762,13 +721,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Offset = 4 * int64(ctxt.Arch.PtrSize) // g_panic p.To.Type = obj.TYPE_REG p.To.Reg = REG_BX - if ctxt.Headtype == objabi.Hnacl && ctxt.Arch.Family == sys.AMD64 { - p.As = AMOVL - p.From.Type = obj.TYPE_MEM - p.From.Reg = REG_R15 - p.From.Scale = 1 - p.From.Index = REG_CX - } if ctxt.Arch.Family == sys.I386 { p.As = AMOVL } @@ -780,7 +732,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Reg = REG_BX p.To.Type = obj.TYPE_REG p.To.Reg = REG_BX - if ctxt.Headtype == objabi.Hnacl || ctxt.Arch.Family == sys.I386 { + if ctxt.Arch.Family == sys.I386 { p.As = ATESTL } @@ -807,7 +759,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Offset = int64(autoffset) + int64(ctxt.Arch.RegSize) p.To.Type = obj.TYPE_REG p.To.Reg = REG_DI - if ctxt.Headtype == objabi.Hnacl || ctxt.Arch.Family == sys.I386 { + if ctxt.Arch.Family == sys.I386 { p.As = ALEAL } @@ -822,13 +774,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Offset = 0 // Panic.argp p.To.Type = obj.TYPE_REG p.To.Reg = REG_DI - if ctxt.Headtype == objabi.Hnacl && ctxt.Arch.Family == sys.AMD64 { - p.As = ACMPL - p.From.Type = obj.TYPE_MEM - p.From.Reg = REG_R15 - p.From.Scale = 1 - p.From.Index = REG_BX - } if ctxt.Arch.Family == sys.I386 { p.As = ACMPL } @@ -847,13 +792,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.To.Type = obj.TYPE_MEM p.To.Reg = REG_BX p.To.Offset = 0 // Panic.argp - if ctxt.Headtype == objabi.Hnacl && ctxt.Arch.Family == sys.AMD64 { - p.As = AMOVL - p.To.Type = obj.TYPE_MEM - p.To.Reg = REG_R15 - p.To.Scale = 1 - p.To.Index = REG_BX - } if ctxt.Arch.Family == sys.I386 { p.As = AMOVL } @@ -988,14 +926,6 @@ func isZeroArgRuntimeCall(s *obj.LSym) bool { } func indir_cx(ctxt *obj.Link, a *obj.Addr) { - if ctxt.Headtype == objabi.Hnacl && ctxt.Arch.Family == sys.AMD64 { - a.Type = obj.TYPE_MEM - a.Reg = REG_R15 - a.Index = REG_CX - a.Scale = 1 - return - } - a.Type = obj.TYPE_MEM a.Reg = REG_CX } @@ -1040,7 +970,7 @@ func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgA mov := AMOVQ sub := ASUBQ - if ctxt.Headtype == objabi.Hnacl || ctxt.Arch.Family == sys.I386 { + if ctxt.Arch.Family == sys.I386 { cmp = ACMPL lea = ALEAL mov = AMOVL @@ -1296,16 +1226,6 @@ var Linkamd64 = obj.LinkArch{ DWARFRegisters: AMD64DWARFRegisters, } -var Linkamd64p32 = obj.LinkArch{ - Arch: sys.ArchAMD64P32, - Init: instinit, - Preprocess: preprocess, - Assemble: span6, - Progedit: progedit, - UnaryDst: unaryDst, - DWARFRegisters: AMD64DWARFRegisters, -} - var Link386 = obj.LinkArch{ Arch: sys.Arch386, Init: instinit, diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go index a30bc3fa05a..fe54eba6631 100644 --- a/src/cmd/internal/objabi/funcid.go +++ b/src/cmd/internal/objabi/funcid.go @@ -37,6 +37,7 @@ const ( FuncID_debugCallV1 FuncID_gopanic FuncID_panicwrap + FuncID_handleAsyncEvents FuncID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.) ) @@ -82,6 +83,8 @@ func GetFuncID(name, file string) FuncID { return FuncID_gopanic case "runtime.panicwrap": return FuncID_panicwrap + case "runtime.handleAsyncEvents": + return FuncID_handleAsyncEvents } if file == "" { return FuncID_wrapper diff --git a/src/cmd/internal/objabi/head.go b/src/cmd/internal/objabi/head.go index 0a542282284..6836c338c93 100644 --- a/src/cmd/internal/objabi/head.go +++ b/src/cmd/internal/objabi/head.go @@ -42,7 +42,6 @@ const ( Hfreebsd Hjs Hlinux - Hnacl Hnetbsd Hopenbsd Hplan9 @@ -65,8 +64,6 @@ func (h *HeadType) Set(s string) error { *h = Hjs case "linux", "android": *h = Hlinux - case "nacl": - *h = Hnacl case "netbsd": *h = Hnetbsd case "openbsd": @@ -97,8 +94,6 @@ func (h *HeadType) String() string { return "js" case Hlinux: return "linux" - case Hnacl: - return "nacl" case Hnetbsd: return "netbsd" case Hopenbsd: diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go index 9e41b87aa46..4f8ba3d36c5 100644 --- a/src/cmd/internal/objabi/util.go +++ b/src/cmd/internal/objabi/util.go @@ -127,7 +127,7 @@ func init() { } func Framepointer_enabled(goos, goarch string) bool { - return framepointer_enabled != 0 && (goarch == "amd64" && goos != "nacl" || goarch == "arm64" && goos == "linux") + return framepointer_enabled != 0 && (goarch == "amd64" || goarch == "arm64" && goos == "linux") } func addexp(s string) { diff --git a/src/cmd/internal/objfile/disasm.go b/src/cmd/internal/objfile/disasm.go index 50fc51be877..b979a7f8aa0 100644 --- a/src/cmd/internal/objfile/disasm.go +++ b/src/cmd/internal/objfile/disasm.go @@ -241,7 +241,7 @@ func (d *Disasm) Print(w io.Writer, filter *regexp.Regexp, start, end uint64, pr fmt.Fprintf(tw, " %s:%d\t%#x\t", base(file), line, pc) } - if size%4 != 0 || d.goarch == "386" || d.goarch == "amd64" || d.goarch == "amd64p32" { + if size%4 != 0 || d.goarch == "386" || d.goarch == "amd64" { // Print instruction as bytes. fmt.Fprintf(tw, "%x", code[i:i+size]) } else { @@ -367,24 +367,22 @@ func disasm_ppc64(code []byte, pc uint64, lookup lookupFunc, byteOrder binary.By } var disasms = map[string]disasmFunc{ - "386": disasm_386, - "amd64": disasm_amd64, - "amd64p32": disasm_amd64, - "arm": disasm_arm, - "arm64": disasm_arm64, - "ppc64": disasm_ppc64, - "ppc64le": disasm_ppc64, + "386": disasm_386, + "amd64": disasm_amd64, + "arm": disasm_arm, + "arm64": disasm_arm64, + "ppc64": disasm_ppc64, + "ppc64le": disasm_ppc64, } var byteOrders = map[string]binary.ByteOrder{ - "386": binary.LittleEndian, - "amd64": binary.LittleEndian, - "amd64p32": binary.LittleEndian, - "arm": binary.LittleEndian, - "arm64": binary.LittleEndian, - "ppc64": binary.BigEndian, - "ppc64le": binary.LittleEndian, - "s390x": binary.BigEndian, + "386": binary.LittleEndian, + "amd64": binary.LittleEndian, + "arm": binary.LittleEndian, + "arm64": binary.LittleEndian, + "ppc64": binary.BigEndian, + "ppc64le": binary.LittleEndian, + "s390x": binary.BigEndian, } type Liner interface { diff --git a/src/cmd/internal/sys/arch.go b/src/cmd/internal/sys/arch.go index 2e07482c1a6..e8687363def 100644 --- a/src/cmd/internal/sys/arch.go +++ b/src/cmd/internal/sys/arch.go @@ -7,8 +7,7 @@ package sys import "encoding/binary" // ArchFamily represents a family of one or more related architectures. -// For example, amd64 and amd64p32 are both members of the AMD64 family, -// and ppc64 and ppc64le are both members of the PPC64 family. +// For example, ppc64 and ppc64le are both members of the PPC64 family. type ArchFamily byte const ( @@ -72,15 +71,6 @@ var ArchAMD64 = &Arch{ MinLC: 1, } -var ArchAMD64P32 = &Arch{ - Name: "amd64p32", - Family: AMD64, - ByteOrder: binary.LittleEndian, - PtrSize: 4, - RegSize: 8, - MinLC: 1, -} - var ArchARM = &Arch{ Name: "arm", Family: ARM, @@ -183,7 +173,6 @@ var ArchWasm = &Arch{ var Archs = [...]*Arch{ Arch386, ArchAMD64, - ArchAMD64P32, ArchARM, ArchARM64, ArchMIPS, diff --git a/src/cmd/link/internal/amd64/asm.go b/src/cmd/link/internal/amd64/asm.go index 7dbe99c581d..71e230e5335 100644 --- a/src/cmd/link/internal/amd64/asm.go +++ b/src/cmd/link/internal/amd64/asm.go @@ -731,8 +731,7 @@ func asmb2(ctxt *ld.Link) { objabi.Hsolaris: ld.Flag8 = true /* 64-bit addresses */ - case objabi.Hnacl, - objabi.Hwindows: + case objabi.Hwindows: break } @@ -758,8 +757,7 @@ func asmb2(ctxt *ld.Link) { objabi.Hnetbsd, objabi.Hopenbsd, objabi.Hdragonfly, - objabi.Hsolaris, - objabi.Hnacl: + objabi.Hsolaris: symo = int64(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen) symo = ld.Rnd(symo, int64(*ld.FlagRound)) @@ -838,8 +836,7 @@ func asmb2(ctxt *ld.Link) { objabi.Hnetbsd, objabi.Hopenbsd, objabi.Hdragonfly, - objabi.Hsolaris, - objabi.Hnacl: + objabi.Hsolaris: ld.Asmbelf(ctxt, symo) case objabi.Hwindows: diff --git a/src/cmd/link/internal/amd64/obj.go b/src/cmd/link/internal/amd64/obj.go index 23741eb4f65..029a24d7c1b 100644 --- a/src/cmd/link/internal/amd64/obj.go +++ b/src/cmd/link/internal/amd64/obj.go @@ -38,9 +38,6 @@ import ( func Init() (*sys.Arch, ld.Arch) { arch := sys.ArchAMD64 - if objabi.GOARCH == "amd64p32" { - arch = sys.ArchAMD64P32 - } theArch := ld.Arch{ Funcalign: funcAlign, @@ -113,18 +110,6 @@ func archinit(ctxt *ld.Link) { *ld.FlagRound = 4096 } - case objabi.Hnacl: - ld.Elfinit(ctxt) - *ld.FlagW = true // disable dwarf, which gets confused and is useless anyway - ld.HEADR = 0x10000 - ld.Funcalign = 32 - if *ld.FlagTextAddr == -1 { - *ld.FlagTextAddr = 0x20000 - } - if *ld.FlagRound == -1 { - *ld.FlagRound = 0x10000 - } - case objabi.Hwindows: /* PE executable */ // ld.HEADR, ld.FlagTextAddr, ld.FlagRound are set in ld.Peinit return diff --git a/src/cmd/link/internal/arm/asm.go b/src/cmd/link/internal/arm/asm.go index 43d387c862d..d8d01f6d279 100644 --- a/src/cmd/link/internal/arm/asm.go +++ b/src/cmd/link/internal/arm/asm.go @@ -894,8 +894,7 @@ func asmb2(ctxt *ld.Link) { case objabi.Hlinux, objabi.Hfreebsd, objabi.Hnetbsd, - objabi.Hopenbsd, - objabi.Hnacl: + objabi.Hopenbsd: ld.Asmbelf(ctxt, int64(symo)) case objabi.Hdarwin: diff --git a/src/cmd/link/internal/arm/obj.go b/src/cmd/link/internal/arm/obj.go index 45a406ec063..27246df21f4 100644 --- a/src/cmd/link/internal/arm/obj.go +++ b/src/cmd/link/internal/arm/obj.go @@ -100,17 +100,6 @@ func archinit(ctxt *ld.Link) { *ld.FlagRound = 0x10000 } - case objabi.Hnacl: - ld.Elfinit(ctxt) - ld.HEADR = 0x10000 - ld.Funcalign = 16 - if *ld.FlagTextAddr == -1 { - *ld.FlagTextAddr = 0x20000 - } - if *ld.FlagRound == -1 { - *ld.FlagRound = 0x10000 - } - case objabi.Hdarwin: /* apple MACH */ ld.HEADR = ld.INITIAL_MACHO_HEADR if *ld.FlagTextAddr == -1 { diff --git a/src/cmd/link/internal/arm64/asm.go b/src/cmd/link/internal/arm64/asm.go index e199b226511..e824627bf72 100644 --- a/src/cmd/link/internal/arm64/asm.go +++ b/src/cmd/link/internal/arm64/asm.go @@ -928,8 +928,7 @@ func asmb2(ctxt *ld.Link) { case objabi.Hlinux, objabi.Hfreebsd, objabi.Hnetbsd, - objabi.Hopenbsd, - objabi.Hnacl: + objabi.Hopenbsd: ld.Asmbelf(ctxt, int64(symo)) case objabi.Hdarwin: diff --git a/src/cmd/link/internal/arm64/obj.go b/src/cmd/link/internal/arm64/obj.go index 7c6662302f5..13157be4325 100644 --- a/src/cmd/link/internal/arm64/obj.go +++ b/src/cmd/link/internal/arm64/obj.go @@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) { Linuxdynld: "/lib/ld-linux-aarch64.so.1", - Freebsddynld: "XXX", + Freebsddynld: "/usr/libexec/ld-elf.so.1", Openbsddynld: "/usr/libexec/ld.so", Netbsddynld: "/libexec/ld.elf_so", Dragonflydynld: "XXX", @@ -85,6 +85,7 @@ func archinit(ctxt *ld.Link) { } case objabi.Hlinux, /* arm64 elf */ + objabi.Hfreebsd, objabi.Hnetbsd, objabi.Hopenbsd: ld.Elfinit(ctxt) @@ -104,16 +105,5 @@ func archinit(ctxt *ld.Link) { if *ld.FlagRound == -1 { *ld.FlagRound = 4096 } - - case objabi.Hnacl: - ld.Elfinit(ctxt) - ld.HEADR = 0x10000 - ld.Funcalign = 16 - if *ld.FlagTextAddr == -1 { - *ld.FlagTextAddr = 0x20000 - } - if *ld.FlagRound == -1 { - *ld.FlagRound = 0x10000 - } } } diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 1a8960e21ee..dbc7a59a1e0 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -2168,9 +2168,6 @@ func (ctxt *Link) address() []*sym.Segment { } Segtext.Length = va - uint64(*FlagTextAddr) - if ctxt.HeadType == objabi.Hnacl { - va += 32 // room for the "halt sled" - } if len(Segrodata.Sections) > 0 { // align to page boundary so as not to mix diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go index ef8804cf5f5..5fc20f37a3c 100644 --- a/src/cmd/link/internal/ld/elf.go +++ b/src/cmd/link/internal/ld/elf.go @@ -1822,9 +1822,8 @@ func Asmbelf(ctxt *Link, symo int64) { /* * PHDR must be in a loaded segment. Adjust the text * segment boundaries downwards to include it. - * Except on NaCl where it must not be loaded. */ - if ctxt.HeadType != objabi.Hnacl { + { o := int64(Segtext.Vaddr - pph.vaddr) Segtext.Vaddr -= uint64(o) Segtext.Length += uint64(o) diff --git a/src/cmd/link/internal/ld/sym.go b/src/cmd/link/internal/ld/sym.go index bf7a56aff22..eb48ac842a5 100644 --- a/src/cmd/link/internal/ld/sym.go +++ b/src/cmd/link/internal/ld/sym.go @@ -70,38 +70,23 @@ func (ctxt *Link) computeTLSOffset() { case objabi.Hplan9, objabi.Hwindows, objabi.Hjs, objabi.Haix: break - /* - * ELF uses TLS offset negative from FS. - * Translate 0(FS) and 8(FS) into -16(FS) and -8(FS). - * Known to low-level assembly in package runtime and runtime/cgo. - */ case objabi.Hlinux, objabi.Hfreebsd, objabi.Hnetbsd, objabi.Hopenbsd, objabi.Hdragonfly, objabi.Hsolaris: + /* + * ELF uses TLS offset negative from FS. + * Translate 0(FS) and 8(FS) into -16(FS) and -8(FS). + * Known to low-level assembly in package runtime and runtime/cgo. + */ ctxt.Tlsoffset = -1 * ctxt.Arch.PtrSize - case objabi.Hnacl: - switch ctxt.Arch.Family { - default: - log.Fatalf("unknown thread-local storage offset for nacl/%s", ctxt.Arch.Name) - - case sys.ARM: - ctxt.Tlsoffset = 0 - - case sys.AMD64: - ctxt.Tlsoffset = 0 - - case sys.I386: - ctxt.Tlsoffset = -8 - } - + case objabi.Hdarwin: /* * OS X system constants - offset from 0(GS) to our TLS. */ - case objabi.Hdarwin: switch ctxt.Arch.Family { default: log.Fatalf("unknown thread-local storage offset for darwin/%s", ctxt.Arch.Name) diff --git a/src/cmd/link/internal/mips64/asm.go b/src/cmd/link/internal/mips64/asm.go index 25a1d94dcc0..9697ea511bb 100644 --- a/src/cmd/link/internal/mips64/asm.go +++ b/src/cmd/link/internal/mips64/asm.go @@ -285,8 +285,7 @@ func asmb2(ctxt *ld.Link) { case objabi.Hlinux, objabi.Hfreebsd, objabi.Hnetbsd, - objabi.Hopenbsd, - objabi.Hnacl: + objabi.Hopenbsd: ld.Asmbelf(ctxt, int64(symo)) } diff --git a/src/cmd/link/internal/mips64/obj.go b/src/cmd/link/internal/mips64/obj.go index 96042083f6f..6abbb7674d4 100644 --- a/src/cmd/link/internal/mips64/obj.go +++ b/src/cmd/link/internal/mips64/obj.go @@ -94,16 +94,5 @@ func archinit(ctxt *ld.Link) { if *ld.FlagRound == -1 { *ld.FlagRound = 0x10000 } - - case objabi.Hnacl: - ld.Elfinit(ctxt) - ld.HEADR = 0x10000 - ld.Funcalign = 16 - if *ld.FlagTextAddr == -1 { - *ld.FlagTextAddr = 0x20000 - } - if *ld.FlagRound == -1 { - *ld.FlagRound = 0x10000 - } } } diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go index c315b4bfc2d..ad91be3dade 100644 --- a/src/cmd/link/internal/ppc64/asm.go +++ b/src/cmd/link/internal/ppc64/asm.go @@ -1183,8 +1183,7 @@ func asmb2(ctxt *ld.Link) { case objabi.Hlinux, objabi.Hfreebsd, objabi.Hnetbsd, - objabi.Hopenbsd, - objabi.Hnacl: + objabi.Hopenbsd: ld.Asmbelf(ctxt, int64(symo)) case objabi.Haix: diff --git a/src/cmd/link/internal/ppc64/obj.go b/src/cmd/link/internal/ppc64/obj.go index 51d1791f21a..49c7ec21034 100644 --- a/src/cmd/link/internal/ppc64/obj.go +++ b/src/cmd/link/internal/ppc64/obj.go @@ -100,17 +100,6 @@ func archinit(ctxt *ld.Link) { *ld.FlagRound = 0x10000 } - case objabi.Hnacl: - ld.Elfinit(ctxt) - ld.HEADR = 0x10000 - ld.Funcalign = 16 - if *ld.FlagTextAddr == -1 { - *ld.FlagTextAddr = 0x20000 - } - if *ld.FlagRound == -1 { - *ld.FlagRound = 0x10000 - } - case objabi.Haix: ld.Xcoffinit(ctxt) } diff --git a/src/cmd/link/internal/sym/sizeof_test.go b/src/cmd/link/internal/sym/sizeof_test.go index da4602a1619..e6e3916dad8 100644 --- a/src/cmd/link/internal/sym/sizeof_test.go +++ b/src/cmd/link/internal/sym/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package sym import ( diff --git a/src/cmd/link/internal/wasm/asm.go b/src/cmd/link/internal/wasm/asm.go index ee0a5176acf..bf22c28311d 100644 --- a/src/cmd/link/internal/wasm/asm.go +++ b/src/cmd/link/internal/wasm/asm.go @@ -296,10 +296,11 @@ func writeTableSec(ctxt *ld.Link, fns []*wasmFunc) { func writeMemorySec(ctxt *ld.Link) { sizeOffset := writeSecHeader(ctxt, sectionMemory) - const ( - initialSize = 16 << 20 // 16MB, enough for runtime init without growing - wasmPageSize = 64 << 10 // 64KB - ) + dataSection := ctxt.Syms.Lookup("runtime.data", 0).Sect + dataEnd := dataSection.Vaddr + dataSection.Length + var initialSize = dataEnd + 16<<20 // 16MB, enough for runtime init without growing + + const wasmPageSize = 64 << 10 // 64KB writeUleb128(ctxt.Out, 1) // number of memories ctxt.Out.WriteByte(0x00) // no maximum memory size diff --git a/src/cmd/link/internal/x86/asm.go b/src/cmd/link/internal/x86/asm.go index 427ccaf6297..aa4f99e9da7 100644 --- a/src/cmd/link/internal/x86/asm.go +++ b/src/cmd/link/internal/x86/asm.go @@ -760,8 +760,7 @@ func asmb2(ctxt *ld.Link) { case objabi.Hlinux, objabi.Hfreebsd, objabi.Hnetbsd, - objabi.Hopenbsd, - objabi.Hnacl: + objabi.Hopenbsd: ld.Asmbelf(ctxt, int64(symo)) case objabi.Hwindows: diff --git a/src/cmd/link/internal/x86/obj.go b/src/cmd/link/internal/x86/obj.go index f1fad20081b..f53ecc8fc0e 100644 --- a/src/cmd/link/internal/x86/obj.go +++ b/src/cmd/link/internal/x86/obj.go @@ -106,17 +106,6 @@ func archinit(ctxt *ld.Link) { *ld.FlagRound = 4096 } - case objabi.Hnacl: - ld.Elfinit(ctxt) - ld.HEADR = 0x10000 - ld.Funcalign = 32 - if *ld.FlagTextAddr == -1 { - *ld.FlagTextAddr = 0x20000 - } - if *ld.FlagRound == -1 { - *ld.FlagRound = 0x10000 - } - case objabi.Hwindows: /* PE executable */ // ld.HEADR, ld.FlagTextAddr, ld.FlagRound are set in ld.Peinit return diff --git a/src/cmd/link/main.go b/src/cmd/link/main.go index 4b8df11451f..99550b0584d 100644 --- a/src/cmd/link/main.go +++ b/src/cmd/link/main.go @@ -45,7 +45,7 @@ func main() { os.Exit(2) case "386": arch, theArch = x86.Init() - case "amd64", "amd64p32": + case "amd64": arch, theArch = amd64.Init() case "arm": arch, theArch = arm.Init() diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt index 43f539fd818..6ed3e16e2a7 100644 --- a/src/cmd/vendor/modules.txt +++ b/src/cmd/vendor/modules.txt @@ -1,4 +1,5 @@ # github.com/google/pprof v0.0.0-20190515194954-54271f7e092f +## explicit github.com/google/pprof/driver github.com/google/pprof/internal/binutils github.com/google/pprof/internal/driver @@ -15,18 +16,23 @@ github.com/google/pprof/third_party/d3 github.com/google/pprof/third_party/d3flamegraph github.com/google/pprof/third_party/svgpan # github.com/ianlancetaylor/demangle v0.0.0-20180524225900-fc6590592b44 +## explicit github.com/ianlancetaylor/demangle # golang.org/x/arch v0.0.0-20190815191158-8a70ba74b3a1 +## explicit golang.org/x/arch/arm/armasm golang.org/x/arch/arm64/arm64asm golang.org/x/arch/ppc64/ppc64asm golang.org/x/arch/x86/x86asm # golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c +## explicit golang.org/x/crypto/ssh/terminal # golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 +## explicit golang.org/x/sys/unix golang.org/x/sys/windows # golang.org/x/tools v0.0.0-20190925211824-e4ea94538f5b +## explicit golang.org/x/tools/go/analysis golang.org/x/tools/go/analysis/internal/analysisflags golang.org/x/tools/go/analysis/internal/facts diff --git a/src/crypto/md5/md5block_amd64p32.s b/src/crypto/md5/md5block_amd64p32.s deleted file mode 100644 index 7295942dc8d..00000000000 --- a/src/crypto/md5/md5block_amd64p32.s +++ /dev/null @@ -1,184 +0,0 @@ -// Original source: -// http://www.zorinaq.com/papers/md5-amd64.html -// http://www.zorinaq.com/papers/md5-amd64.tar.bz2 -// -// Translated from Perl generating GNU assembly into -// #defines generating 6a assembly by the Go Authors. -// -// Restrictions to make code safe for Native Client: -// replace BP with R11, reloaded before use at return. -// replace R15 with R11. - -#include "textflag.h" - -// MD5 optimized for AMD64. -// -// Author: Marc Bevand -// Licence: I hereby disclaim the copyright on this code and place it -// in the public domain. - -TEXT ·block(SB),NOSPLIT,$0-16 - MOVL dig+0(FP), R11 - MOVL p+4(FP), SI - MOVL p_len+8(FP), DX - SHRQ $6, DX - SHLQ $6, DX - - LEAQ (SI)(DX*1), DI - MOVL (0*4)(R11), AX - MOVL (1*4)(R11), BX - MOVL (2*4)(R11), CX - MOVL (3*4)(R11), DX - - CMPQ SI, DI - JEQ end - -loop: - MOVL AX, R12 - MOVL BX, R13 - MOVL CX, R14 - MOVL DX, R11 - - MOVL (0*4)(SI), R8 - MOVL DX, R9 - -#define ROUND1(a, b, c, d, index, const, shift) \ - XORL c, R9; \ - LEAL const(a)(R8*1), a; \ - ANDL b, R9; \ - XORL d, R9; \ - MOVL (index*4)(SI), R8; \ - ADDL R9, a; \ - ROLL $shift, a; \ - MOVL c, R9; \ - ADDL b, a - - ROUND1(AX,BX,CX,DX, 1,0xd76aa478, 7); - ROUND1(DX,AX,BX,CX, 2,0xe8c7b756,12); - ROUND1(CX,DX,AX,BX, 3,0x242070db,17); - ROUND1(BX,CX,DX,AX, 4,0xc1bdceee,22); - ROUND1(AX,BX,CX,DX, 5,0xf57c0faf, 7); - ROUND1(DX,AX,BX,CX, 6,0x4787c62a,12); - ROUND1(CX,DX,AX,BX, 7,0xa8304613,17); - ROUND1(BX,CX,DX,AX, 8,0xfd469501,22); - ROUND1(AX,BX,CX,DX, 9,0x698098d8, 7); - ROUND1(DX,AX,BX,CX,10,0x8b44f7af,12); - ROUND1(CX,DX,AX,BX,11,0xffff5bb1,17); - ROUND1(BX,CX,DX,AX,12,0x895cd7be,22); - ROUND1(AX,BX,CX,DX,13,0x6b901122, 7); - ROUND1(DX,AX,BX,CX,14,0xfd987193,12); - ROUND1(CX,DX,AX,BX,15,0xa679438e,17); - ROUND1(BX,CX,DX,AX, 0,0x49b40821,22); - - MOVL (1*4)(SI), R8 - MOVL DX, R9 - MOVL DX, R10 - -#define ROUND2(a, b, c, d, index, const, shift) \ - NOTL R9; \ - LEAL const(a)(R8*1),a; \ - ANDL b, R10; \ - ANDL c, R9; \ - MOVL (index*4)(SI),R8; \ - ORL R9, R10; \ - MOVL c, R9; \ - ADDL R10, a; \ - MOVL c, R10; \ - ROLL $shift, a; \ - ADDL b, a - - ROUND2(AX,BX,CX,DX, 6,0xf61e2562, 5); - ROUND2(DX,AX,BX,CX,11,0xc040b340, 9); - ROUND2(CX,DX,AX,BX, 0,0x265e5a51,14); - ROUND2(BX,CX,DX,AX, 5,0xe9b6c7aa,20); - ROUND2(AX,BX,CX,DX,10,0xd62f105d, 5); - ROUND2(DX,AX,BX,CX,15, 0x2441453, 9); - ROUND2(CX,DX,AX,BX, 4,0xd8a1e681,14); - ROUND2(BX,CX,DX,AX, 9,0xe7d3fbc8,20); - ROUND2(AX,BX,CX,DX,14,0x21e1cde6, 5); - ROUND2(DX,AX,BX,CX, 3,0xc33707d6, 9); - ROUND2(CX,DX,AX,BX, 8,0xf4d50d87,14); - ROUND2(BX,CX,DX,AX,13,0x455a14ed,20); - ROUND2(AX,BX,CX,DX, 2,0xa9e3e905, 5); - ROUND2(DX,AX,BX,CX, 7,0xfcefa3f8, 9); - ROUND2(CX,DX,AX,BX,12,0x676f02d9,14); - ROUND2(BX,CX,DX,AX, 0,0x8d2a4c8a,20); - - MOVL (5*4)(SI), R8 - MOVL CX, R9 - -#define ROUND3(a, b, c, d, index, const, shift) \ - LEAL const(a)(R8*1),a; \ - MOVL (index*4)(SI),R8; \ - XORL d, R9; \ - XORL b, R9; \ - ADDL R9, a; \ - ROLL $shift, a; \ - MOVL b, R9; \ - ADDL b, a - - ROUND3(AX,BX,CX,DX, 8,0xfffa3942, 4); - ROUND3(DX,AX,BX,CX,11,0x8771f681,11); - ROUND3(CX,DX,AX,BX,14,0x6d9d6122,16); - ROUND3(BX,CX,DX,AX, 1,0xfde5380c,23); - ROUND3(AX,BX,CX,DX, 4,0xa4beea44, 4); - ROUND3(DX,AX,BX,CX, 7,0x4bdecfa9,11); - ROUND3(CX,DX,AX,BX,10,0xf6bb4b60,16); - ROUND3(BX,CX,DX,AX,13,0xbebfbc70,23); - ROUND3(AX,BX,CX,DX, 0,0x289b7ec6, 4); - ROUND3(DX,AX,BX,CX, 3,0xeaa127fa,11); - ROUND3(CX,DX,AX,BX, 6,0xd4ef3085,16); - ROUND3(BX,CX,DX,AX, 9, 0x4881d05,23); - ROUND3(AX,BX,CX,DX,12,0xd9d4d039, 4); - ROUND3(DX,AX,BX,CX,15,0xe6db99e5,11); - ROUND3(CX,DX,AX,BX, 2,0x1fa27cf8,16); - ROUND3(BX,CX,DX,AX, 0,0xc4ac5665,23); - - MOVL (0*4)(SI), R8 - MOVL $0xffffffff, R9 - XORL DX, R9 - -#define ROUND4(a, b, c, d, index, const, shift) \ - LEAL const(a)(R8*1),a; \ - ORL b, R9; \ - XORL c, R9; \ - ADDL R9, a; \ - MOVL (index*4)(SI),R8; \ - MOVL $0xffffffff, R9; \ - ROLL $shift, a; \ - XORL c, R9; \ - ADDL b, a - - ROUND4(AX,BX,CX,DX, 7,0xf4292244, 6); - ROUND4(DX,AX,BX,CX,14,0x432aff97,10); - ROUND4(CX,DX,AX,BX, 5,0xab9423a7,15); - ROUND4(BX,CX,DX,AX,12,0xfc93a039,21); - ROUND4(AX,BX,CX,DX, 3,0x655b59c3, 6); - ROUND4(DX,AX,BX,CX,10,0x8f0ccc92,10); - ROUND4(CX,DX,AX,BX, 1,0xffeff47d,15); - ROUND4(BX,CX,DX,AX, 8,0x85845dd1,21); - ROUND4(AX,BX,CX,DX,15,0x6fa87e4f, 6); - ROUND4(DX,AX,BX,CX, 6,0xfe2ce6e0,10); - ROUND4(CX,DX,AX,BX,13,0xa3014314,15); - ROUND4(BX,CX,DX,AX, 4,0x4e0811a1,21); - ROUND4(AX,BX,CX,DX,11,0xf7537e82, 6); - ROUND4(DX,AX,BX,CX, 2,0xbd3af235,10); - ROUND4(CX,DX,AX,BX, 9,0x2ad7d2bb,15); - ROUND4(BX,CX,DX,AX, 0,0xeb86d391,21); - - ADDL R12, AX - ADDL R13, BX - ADDL R14, CX - ADDL R11, DX - - ADDQ $64, SI - CMPQ SI, DI - JB loop - -end: - MOVL dig+0(FP), R11 - MOVL AX, (0*4)(R11) - MOVL BX, (1*4)(R11) - MOVL CX, (2*4)(R11) - MOVL DX, (3*4)(R11) - RET diff --git a/src/crypto/md5/md5block_decl.go b/src/crypto/md5/md5block_decl.go index 1ac82cf08ca..f251e03d7ff 100644 --- a/src/crypto/md5/md5block_decl.go +++ b/src/crypto/md5/md5block_decl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 amd64p32 386 arm ppc64le ppc64 s390x arm64 +// +build amd64 386 arm ppc64le ppc64 s390x arm64 package md5 diff --git a/src/crypto/md5/md5block_generic.go b/src/crypto/md5/md5block_generic.go index 86e3b64e9fb..0b46e70b604 100644 --- a/src/crypto/md5/md5block_generic.go +++ b/src/crypto/md5/md5block_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !amd64,!amd64p32,!386,!arm,!ppc64le,!ppc64,!s390x,!arm64 +// +build !amd64,!386,!arm,!ppc64le,!ppc64,!s390x,!arm64 package md5 diff --git a/src/crypto/rand/eagain.go b/src/crypto/rand/eagain.go index 045d037d209..f251ba28fc7 100644 --- a/src/crypto/rand/eagain.go +++ b/src/crypto/rand/eagain.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package rand diff --git a/src/crypto/rand/rand_unix.go b/src/crypto/rand/rand_unix.go index f3091f51c5f..0610f691b0d 100644 --- a/src/crypto/rand/rand_unix.go +++ b/src/crypto/rand/rand_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd plan9 solaris // Unix cryptographically secure pseudorandom number // generator. diff --git a/src/crypto/sha1/sha1block_amd64p32.s b/src/crypto/sha1/sha1block_amd64p32.s deleted file mode 100644 index 32058ba01d1..00000000000 --- a/src/crypto/sha1/sha1block_amd64p32.s +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" - -// SHA-1 block routine. See sha1block.go for Go equivalent. -// -// There are 80 rounds of 4 types: -// - rounds 0-15 are type 1 and load data (ROUND1 macro). -// - rounds 16-19 are type 1 and do not load data (ROUND1x macro). -// - rounds 20-39 are type 2 and do not load data (ROUND2 macro). -// - rounds 40-59 are type 3 and do not load data (ROUND3 macro). -// - rounds 60-79 are type 4 and do not load data (ROUND4 macro). -// -// Each round loads or shuffles the data, then computes a per-round -// function of b, c, d, and then mixes the result into and rotates the -// five registers a, b, c, d, e holding the intermediate results. -// -// The register rotation is implemented by rotating the arguments to -// the round macros instead of by explicit move instructions. -// -// amd64p32 version. -// To ensure safety for Native Client, avoids use of BP and R15 -// as well as two-register addressing modes. - -#define LOAD(index) \ - MOVL (index*4)(SI), R10; \ - BSWAPL R10; \ - MOVL R10, (index*4)(SP) - -#define SHUFFLE(index) \ - MOVL (((index)&0xf)*4)(SP), R10; \ - XORL (((index-3)&0xf)*4)(SP), R10; \ - XORL (((index-8)&0xf)*4)(SP), R10; \ - XORL (((index-14)&0xf)*4)(SP), R10; \ - ROLL $1, R10; \ - MOVL R10, (((index)&0xf)*4)(SP) - -#define FUNC1(a, b, c, d, e) \ - MOVL d, R9; \ - XORL c, R9; \ - ANDL b, R9; \ - XORL d, R9 - -#define FUNC2(a, b, c, d, e) \ - MOVL b, R9; \ - XORL c, R9; \ - XORL d, R9 - -#define FUNC3(a, b, c, d, e) \ - MOVL b, R8; \ - ORL c, R8; \ - ANDL d, R8; \ - MOVL b, R9; \ - ANDL c, R9; \ - ORL R8, R9 - -#define FUNC4 FUNC2 - -#define MIX(a, b, c, d, e, const) \ - ROLL $30, b; \ - ADDL R9, e; \ - MOVL a, R8; \ - ROLL $5, R8; \ - LEAL const(e)(R10*1), e; \ - ADDL R8, e - -#define ROUND1(a, b, c, d, e, index) \ - LOAD(index); \ - FUNC1(a, b, c, d, e); \ - MIX(a, b, c, d, e, 0x5A827999) - -#define ROUND1x(a, b, c, d, e, index) \ - SHUFFLE(index); \ - FUNC1(a, b, c, d, e); \ - MIX(a, b, c, d, e, 0x5A827999) - -#define ROUND2(a, b, c, d, e, index) \ - SHUFFLE(index); \ - FUNC2(a, b, c, d, e); \ - MIX(a, b, c, d, e, 0x6ED9EBA1) - -#define ROUND3(a, b, c, d, e, index) \ - SHUFFLE(index); \ - FUNC3(a, b, c, d, e); \ - MIX(a, b, c, d, e, 0x8F1BBCDC) - -#define ROUND4(a, b, c, d, e, index) \ - SHUFFLE(index); \ - FUNC4(a, b, c, d, e); \ - MIX(a, b, c, d, e, 0xCA62C1D6) - -TEXT ·block(SB),NOSPLIT,$64-16 - MOVL dig+0(FP), R14 - MOVL p_base+4(FP), SI - MOVL p_len+8(FP), DX - SHRQ $6, DX - SHLQ $6, DX - - LEAQ (SI)(DX*1), DI - MOVL (0*4)(R14), AX - MOVL (1*4)(R14), BX - MOVL (2*4)(R14), CX - MOVL (3*4)(R14), DX - MOVL (4*4)(R14), R13 - - CMPQ SI, DI - JEQ end - -loop: -#define BP R13 /* keep diff from sha1block_amd64.s small */ - ROUND1(AX, BX, CX, DX, BP, 0) - ROUND1(BP, AX, BX, CX, DX, 1) - ROUND1(DX, BP, AX, BX, CX, 2) - ROUND1(CX, DX, BP, AX, BX, 3) - ROUND1(BX, CX, DX, BP, AX, 4) - ROUND1(AX, BX, CX, DX, BP, 5) - ROUND1(BP, AX, BX, CX, DX, 6) - ROUND1(DX, BP, AX, BX, CX, 7) - ROUND1(CX, DX, BP, AX, BX, 8) - ROUND1(BX, CX, DX, BP, AX, 9) - ROUND1(AX, BX, CX, DX, BP, 10) - ROUND1(BP, AX, BX, CX, DX, 11) - ROUND1(DX, BP, AX, BX, CX, 12) - ROUND1(CX, DX, BP, AX, BX, 13) - ROUND1(BX, CX, DX, BP, AX, 14) - ROUND1(AX, BX, CX, DX, BP, 15) - - ROUND1x(BP, AX, BX, CX, DX, 16) - ROUND1x(DX, BP, AX, BX, CX, 17) - ROUND1x(CX, DX, BP, AX, BX, 18) - ROUND1x(BX, CX, DX, BP, AX, 19) - - ROUND2(AX, BX, CX, DX, BP, 20) - ROUND2(BP, AX, BX, CX, DX, 21) - ROUND2(DX, BP, AX, BX, CX, 22) - ROUND2(CX, DX, BP, AX, BX, 23) - ROUND2(BX, CX, DX, BP, AX, 24) - ROUND2(AX, BX, CX, DX, BP, 25) - ROUND2(BP, AX, BX, CX, DX, 26) - ROUND2(DX, BP, AX, BX, CX, 27) - ROUND2(CX, DX, BP, AX, BX, 28) - ROUND2(BX, CX, DX, BP, AX, 29) - ROUND2(AX, BX, CX, DX, BP, 30) - ROUND2(BP, AX, BX, CX, DX, 31) - ROUND2(DX, BP, AX, BX, CX, 32) - ROUND2(CX, DX, BP, AX, BX, 33) - ROUND2(BX, CX, DX, BP, AX, 34) - ROUND2(AX, BX, CX, DX, BP, 35) - ROUND2(BP, AX, BX, CX, DX, 36) - ROUND2(DX, BP, AX, BX, CX, 37) - ROUND2(CX, DX, BP, AX, BX, 38) - ROUND2(BX, CX, DX, BP, AX, 39) - - ROUND3(AX, BX, CX, DX, BP, 40) - ROUND3(BP, AX, BX, CX, DX, 41) - ROUND3(DX, BP, AX, BX, CX, 42) - ROUND3(CX, DX, BP, AX, BX, 43) - ROUND3(BX, CX, DX, BP, AX, 44) - ROUND3(AX, BX, CX, DX, BP, 45) - ROUND3(BP, AX, BX, CX, DX, 46) - ROUND3(DX, BP, AX, BX, CX, 47) - ROUND3(CX, DX, BP, AX, BX, 48) - ROUND3(BX, CX, DX, BP, AX, 49) - ROUND3(AX, BX, CX, DX, BP, 50) - ROUND3(BP, AX, BX, CX, DX, 51) - ROUND3(DX, BP, AX, BX, CX, 52) - ROUND3(CX, DX, BP, AX, BX, 53) - ROUND3(BX, CX, DX, BP, AX, 54) - ROUND3(AX, BX, CX, DX, BP, 55) - ROUND3(BP, AX, BX, CX, DX, 56) - ROUND3(DX, BP, AX, BX, CX, 57) - ROUND3(CX, DX, BP, AX, BX, 58) - ROUND3(BX, CX, DX, BP, AX, 59) - - ROUND4(AX, BX, CX, DX, BP, 60) - ROUND4(BP, AX, BX, CX, DX, 61) - ROUND4(DX, BP, AX, BX, CX, 62) - ROUND4(CX, DX, BP, AX, BX, 63) - ROUND4(BX, CX, DX, BP, AX, 64) - ROUND4(AX, BX, CX, DX, BP, 65) - ROUND4(BP, AX, BX, CX, DX, 66) - ROUND4(DX, BP, AX, BX, CX, 67) - ROUND4(CX, DX, BP, AX, BX, 68) - ROUND4(BX, CX, DX, BP, AX, 69) - ROUND4(AX, BX, CX, DX, BP, 70) - ROUND4(BP, AX, BX, CX, DX, 71) - ROUND4(DX, BP, AX, BX, CX, 72) - ROUND4(CX, DX, BP, AX, BX, 73) - ROUND4(BX, CX, DX, BP, AX, 74) - ROUND4(AX, BX, CX, DX, BP, 75) - ROUND4(BP, AX, BX, CX, DX, 76) - ROUND4(DX, BP, AX, BX, CX, 77) - ROUND4(CX, DX, BP, AX, BX, 78) - ROUND4(BX, CX, DX, BP, AX, 79) -#undef BP - - ADDL (0*4)(R14), AX - ADDL (1*4)(R14), BX - ADDL (2*4)(R14), CX - ADDL (3*4)(R14), DX - ADDL (4*4)(R14), R13 - - MOVL AX, (0*4)(R14) - MOVL BX, (1*4)(R14) - MOVL CX, (2*4)(R14) - MOVL DX, (3*4)(R14) - MOVL R13, (4*4)(R14) - - ADDQ $64, SI - CMPQ SI, DI - JB loop - -end: - RET diff --git a/src/crypto/sha1/sha1block_decl.go b/src/crypto/sha1/sha1block_decl.go index 6d2d073d137..9c7df4e40a7 100644 --- a/src/crypto/sha1/sha1block_decl.go +++ b/src/crypto/sha1/sha1block_decl.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64p32 arm 386 s390x +// +build arm 386 s390x package sha1 diff --git a/src/crypto/sha1/sha1block_generic.go b/src/crypto/sha1/sha1block_generic.go index 5823e089410..f95ea0eee4d 100644 --- a/src/crypto/sha1/sha1block_generic.go +++ b/src/crypto/sha1/sha1block_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !amd64,!amd64p32,!386,!arm,!s390x,!arm64 +// +build !amd64,!386,!arm,!s390x,!arm64 package sha1 diff --git a/src/crypto/tls/generate_cert.go b/src/crypto/tls/generate_cert.go index 7329d97a9d0..f1d69c401ab 100644 --- a/src/crypto/tls/generate_cert.go +++ b/src/crypto/tls/generate_cert.go @@ -78,7 +78,7 @@ func main() { log.Fatalf("Unrecognized elliptic curve: %q", *ecdsaCurve) } if err != nil { - log.Fatalf("Failed to generate private key: %s", err) + log.Fatalf("Failed to generate private key: %v", err) } var notBefore time.Time @@ -87,7 +87,7 @@ func main() { } else { notBefore, err = time.Parse("Jan 2 15:04:05 2006", *validFrom) if err != nil { - log.Fatalf("Failed to parse creation date: %s", err) + log.Fatalf("Failed to parse creation date: %v", err) } } @@ -96,7 +96,7 @@ func main() { serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) if err != nil { - log.Fatalf("Failed to generate serial number: %s", err) + log.Fatalf("Failed to generate serial number: %v", err) } template := x509.Certificate{ @@ -128,24 +128,24 @@ func main() { derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) if err != nil { - log.Fatalf("Failed to create certificate: %s", err) + log.Fatalf("Failed to create certificate: %v", err) } certOut, err := os.Create("cert.pem") if err != nil { - log.Fatalf("Failed to open cert.pem for writing: %s", err) + log.Fatalf("Failed to open cert.pem for writing: %v", err) } if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { - log.Fatalf("Failed to write data to cert.pem: %s", err) + log.Fatalf("Failed to write data to cert.pem: %v", err) } if err := certOut.Close(); err != nil { - log.Fatalf("Error closing cert.pem: %s", err) + log.Fatalf("Error closing cert.pem: %v", err) } log.Print("wrote cert.pem\n") keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { - log.Fatalf("Failed to open key.pem for writing:", err) + log.Fatalf("Failed to open key.pem for writing: %v", err) return } privBytes, err := x509.MarshalPKCS8PrivateKey(priv) @@ -153,10 +153,10 @@ func main() { log.Fatalf("Unable to marshal private key: %v", err) } if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil { - log.Fatalf("Failed to write data to key.pem: %s", err) + log.Fatalf("Failed to write data to key.pem: %v", err) } if err := keyOut.Close(); err != nil { - log.Fatalf("Error closing key.pem: %s", err) + log.Fatalf("Error closing key.pem: %v", err) } log.Print("wrote key.pem\n") } diff --git a/src/crypto/x509/root_nacl.go b/src/crypto/x509/root_nacl.go deleted file mode 100644 index 4413f64738a..00000000000 --- a/src/crypto/x509/root_nacl.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2015 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 x509 - -// Possible certificate files; stop after finding one. -var certFiles = []string{} diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go index 48de50b4ea6..f1e174c8940 100644 --- a/src/crypto/x509/root_unix.go +++ b/src/crypto/x509/root_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris package x509 diff --git a/src/debug/elf/file_test.go b/src/debug/elf/file_test.go index b826a0ff050..42e575e182d 100644 --- a/src/debug/elf/file_test.go +++ b/src/debug/elf/file_test.go @@ -784,7 +784,7 @@ func TestCompressedSection(t *testing.T) { func TestNoSectionOverlaps(t *testing.T) { // Ensure cmd/link outputs sections without overlaps. switch runtime.GOOS { - case "aix", "android", "darwin", "js", "nacl", "plan9", "windows": + case "aix", "android", "darwin", "js", "plan9", "windows": t.Skipf("cmd/link doesn't produce ELF binaries on %s", runtime.GOOS) } _ = net.ResolveIPAddr // force dynamic linkage diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go index 407fbcedbe9..86d8a69db7e 100644 --- a/src/encoding/json/decode.go +++ b/src/encoding/json/decode.go @@ -773,14 +773,14 @@ func (d *decodeState) object(v reflect.Value) error { kt := t.Key() var kv reflect.Value switch { - case kt.Kind() == reflect.String: - kv = reflect.ValueOf(key).Convert(kt) case reflect.PtrTo(kt).Implements(textUnmarshalerType): kv = reflect.New(kt) if err := d.literalStore(item, kv, true); err != nil { return err } kv = kv.Elem() + case kt.Kind() == reflect.String: + kv = reflect.ValueOf(key).Convert(kt) default: switch kt.Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: diff --git a/src/encoding/json/decode_test.go b/src/encoding/json/decode_test.go index 4cbd2172d06..498bd97b46e 100644 --- a/src/encoding/json/decode_test.go +++ b/src/encoding/json/decode_test.go @@ -2411,3 +2411,23 @@ func TestUnmarshalRecursivePointer(t *testing.T) { t.Fatal(err) } } + +type textUnmarshalerString string + +func (m *textUnmarshalerString) UnmarshalText(text []byte) error { + *m = textUnmarshalerString(strings.ToLower(string(text))) + return nil +} + +// Test unmarshal to a map, with map key is a user defined type. +// See golang.org/issues/34437. +func TestUnmarshalMapWithTextUnmarshalerStringKey(t *testing.T) { + var p map[textUnmarshalerString]string + if err := Unmarshal([]byte(`{"FOO": "1"}`), &p); err != nil { + t.Fatalf("Unmarshal unexpected error: %v", err) + } + + if _, ok := p["foo"]; !ok { + t.Errorf(`Key "foo" is not existed in map: %v`, p) + } +} diff --git a/src/encoding/json/indent.go b/src/encoding/json/indent.go index fba19548c92..06adfc12635 100644 --- a/src/encoding/json/indent.go +++ b/src/encoding/json/indent.go @@ -28,7 +28,7 @@ func compact(dst *bytes.Buffer, src []byte, escape bool) error { start = i + 1 } // Convert U+2028 and U+2029 (E2 80 A8 and E2 80 A9). - if c == 0xE2 && i+2 < len(src) && src[i+1] == 0x80 && src[i+2]&^1 == 0xA8 { + if escape && c == 0xE2 && i+2 < len(src) && src[i+1] == 0x80 && src[i+2]&^1 == 0xA8 { if start < i { dst.Write(src[start:i]) } diff --git a/src/encoding/json/scanner_test.go b/src/encoding/json/scanner_test.go index 6cdbe7d301e..3737516a450 100644 --- a/src/encoding/json/scanner_test.go +++ b/src/encoding/json/scanner_test.go @@ -48,6 +48,7 @@ var examples = []example{ {`[1,2,3]`, "[\n\t1,\n\t2,\n\t3\n]"}, {`{"x":1}`, "{\n\t\"x\": 1\n}"}, {ex1, ex1i}, + {"{\"\":\"<>&\u2028\u2029\"}", "{\n\t\"\": \"<>&\u2028\u2029\"\n}"}, // See golang.org/issue/34070 } var ex1 = `[true,false,null,"x",1,1.5,0,-5e+2]` @@ -89,8 +90,8 @@ func TestCompactSeparators(t *testing.T) { tests := []struct { in, compact string }{ - {"{\"\u2028\": 1}", `{"\u2028":1}`}, - {"{\"\u2029\" :2}", `{"\u2029":2}`}, + {"{\"\u2028\": 1}", "{\"\u2028\":1}"}, + {"{\"\u2029\" :2}", "{\"\u2029\":2}"}, } for _, tt := range tests { var buf bytes.Buffer diff --git a/src/encoding/json/stream.go b/src/encoding/json/stream.go index 3d30322ce25..81f404f4267 100644 --- a/src/encoding/json/stream.go +++ b/src/encoding/json/stream.go @@ -56,7 +56,7 @@ func (dec *Decoder) Decode(v interface{}) error { } if !dec.tokenValueAllowed() { - return &SyntaxError{msg: "not at beginning of value", Offset: dec.offset()} + return &SyntaxError{msg: "not at beginning of value", Offset: dec.InputOffset()} } // Read whole value into buffer. @@ -314,7 +314,7 @@ func (dec *Decoder) tokenPrepareForDecode() error { return err } if c != ',' { - return &SyntaxError{"expected comma after array element", dec.offset()} + return &SyntaxError{"expected comma after array element", dec.InputOffset()} } dec.scanp++ dec.tokenState = tokenArrayValue @@ -324,7 +324,7 @@ func (dec *Decoder) tokenPrepareForDecode() error { return err } if c != ':' { - return &SyntaxError{"expected colon after object key", dec.offset()} + return &SyntaxError{"expected colon after object key", dec.InputOffset()} } dec.scanp++ dec.tokenState = tokenObjectValue @@ -477,7 +477,7 @@ func (dec *Decoder) tokenError(c byte) (Token, error) { case tokenObjectComma: context = " after object key:value pair" } - return nil, &SyntaxError{"invalid character " + quoteChar(c) + context, dec.offset()} + return nil, &SyntaxError{"invalid character " + quoteChar(c) + context, dec.InputOffset()} } // More reports whether there is another element in the @@ -506,6 +506,9 @@ func (dec *Decoder) peek() (byte, error) { } } -func (dec *Decoder) offset() int64 { +// InputOffset returns the input stream byte offset of the current decoder position. +// The offset gives the location of the end of the most recently returned token +// and the beginning of the next token. +func (dec *Decoder) InputOffset() int64 { return dec.scanned + int64(dec.scanp) } diff --git a/src/errors/wrap.go b/src/errors/wrap.go index 688c5853969..272d056b318 100644 --- a/src/errors/wrap.go +++ b/src/errors/wrap.go @@ -49,7 +49,7 @@ func Is(err, target error) bool { if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { return true } - // TODO: consider supporing target.Is(err). This would allow + // TODO: consider supporting target.Is(err). This would allow // user-definable predicates, but also may allow for coping with sloppy // APIs, thereby making it easier to get away with them. if err = Unwrap(err); err == nil { diff --git a/src/go.mod b/src/go.mod index 90af2a7ea0f..8d8c89b5fb6 100644 --- a/src/go.mod +++ b/src/go.mod @@ -1,6 +1,6 @@ module std -go 1.12 +go 1.14 require ( golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 diff --git a/src/go/build/build.go b/src/go/build/build.go index 722fead20ee..deeda35c2ac 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -1008,8 +1008,12 @@ func (ctxt *Context) importGo(p *Package, path, srcDir string, mode ImportMode, return errNoModules } - // If modules are not enabled, then the in-process code works fine and we should keep using it. - switch os.Getenv("GO111MODULE") { + // Predict whether module aware mode is enabled by checking the value of + // GO111MODULE and looking for a go.mod file in the source directory or + // one of its parents. Running 'go env GOMOD' in the source directory would + // give a canonical answer, but we'd prefer not to execute another command. + go111Module := os.Getenv("GO111MODULE") + switch go111Module { case "off": return errNoModules default: // "", "on", "auto", anything else @@ -1031,22 +1035,24 @@ func (ctxt *Context) importGo(p *Package, path, srcDir string, mode ImportMode, } } - // Look to see if there is a go.mod. + // Unless GO111MODULE=on, look to see if there is a go.mod. // Since go1.13, it doesn't matter if we're inside GOPATH. - parent := absSrcDir - for { - info, err := os.Stat(filepath.Join(parent, "go.mod")) - if err == nil && !info.IsDir() { - break + if go111Module != "on" { + parent := absSrcDir + for { + info, err := os.Stat(filepath.Join(parent, "go.mod")) + if err == nil && !info.IsDir() { + break + } + d := filepath.Dir(parent) + if len(d) >= len(parent) { + return errNoModules // reached top of file system, no go.mod + } + parent = d } - d := filepath.Dir(parent) - if len(d) >= len(parent) { - return errNoModules // reached top of file system, no go.mod - } - parent = d } - cmd := exec.Command("go", "list", "-compiler="+ctxt.Compiler, "-tags="+strings.Join(ctxt.BuildTags, ","), "-installsuffix="+ctxt.InstallSuffix, "-f={{.Dir}}\n{{.ImportPath}}\n{{.Root}}\n{{.Goroot}}\n", path) + cmd := exec.Command("go", "list", "-e", "-compiler="+ctxt.Compiler, "-tags="+strings.Join(ctxt.BuildTags, ","), "-installsuffix="+ctxt.InstallSuffix, "-f={{.Dir}}\n{{.ImportPath}}\n{{.Root}}\n{{.Goroot}}\n{{if .Error}}{{.Error}}{{end}}\n", "--", path) // TODO(bcmills): This is wrong if srcDir is in a vendor directory, or if // srcDir is in some module dependency of the main module. The main module @@ -1073,12 +1079,22 @@ func (ctxt *Context) importGo(p *Package, path, srcDir string, mode ImportMode, return fmt.Errorf("go/build: importGo %s: %v\n%s\n", path, err, stderr.String()) } - f := strings.Split(stdout.String(), "\n") - if len(f) != 5 || f[4] != "" { + f := strings.SplitN(stdout.String(), "\n", 5) + if len(f) != 5 { return fmt.Errorf("go/build: importGo %s: unexpected output:\n%s\n", path, stdout.String()) } + dir := f[0] + errStr := strings.TrimSpace(f[4]) + if errStr != "" && p.Dir == "" { + // If 'go list' could not locate the package, return the same error that + // 'go list' reported. + // If 'go list' did locate the package (p.Dir is not empty), ignore the + // error. It was probably related to loading source files, and we'll + // encounter it ourselves shortly. + return errors.New(errStr) + } - p.Dir = f[0] + p.Dir = dir p.ImportPath = f[1] p.Root = f[2] p.Goroot = f[3] == "true" @@ -1552,7 +1568,8 @@ func (ctxt *Context) makePathsAbsolute(args []string, srcDir string) { // The @ is for OS X. See golang.org/issue/13720. // The % is for Jenkins. See golang.org/issue/16959. // The ! is because module paths may use them. See golang.org/issue/26716. -const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%! " +// The ~ and ^ are for sr.ht. See golang.org/issue/32260. +const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%! ~^" func safeCgoName(s string) bool { if s == "" { diff --git a/src/go/build/build_test.go b/src/go/build/build_test.go index cfcb8167a1a..7040a1b85b7 100644 --- a/src/go/build/build_test.go +++ b/src/go/build/build_test.go @@ -7,6 +7,7 @@ package build import ( "internal/testenv" "io" + "io/ioutil" "os" "path/filepath" "reflect" @@ -295,7 +296,7 @@ func TestShellSafety(t *testing.T) { result bool }{ {"-I${SRCDIR}/../include", "/projects/src/issue 11868", "-I/projects/src/issue 11868/../include", true}, - {"-I${SRCDIR}", "wtf$@%", "-Iwtf$@%", true}, + {"-I${SRCDIR}", "~wtf$@%^", "-I~wtf$@%^", true}, {"-X${SRCDIR}/1,${SRCDIR}/2", "/projects/src/issue 11868", "-X/projects/src/issue 11868/1,/projects/src/issue 11868/2", true}, {"-I/tmp -I/tmp", "/tmp2", "-I/tmp -I/tmp", true}, {"-I/tmp", "/tmp/[0]", "-I/tmp", true}, @@ -419,6 +420,46 @@ func TestImportVendorParentFailure(t *testing.T) { } } +// Check that a package is loaded in module mode if GO111MODULE=on, even when +// no go.mod file is present. It should fail to resolve packages outside std. +// Verifies golang.org/issue/34669. +func TestImportPackageOutsideModule(t *testing.T) { + testenv.MustHaveGoBuild(t) + + // Disable module fetching for this test so that 'go list' fails quickly + // without trying to find the latest version of a module. + defer os.Setenv("GOPROXY", os.Getenv("GOPROXY")) + os.Setenv("GOPROXY", "off") + + // Create a GOPATH in a temporary directory. We don't use testdata + // because it's in GOROOT, which interferes with the module heuristic. + gopath, err := ioutil.TempDir("", "gobuild-notmodule") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(gopath) + if err := os.MkdirAll(filepath.Join(gopath, "src/example.com/p"), 0777); err != nil { + t.Fatal(err) + } + if err := ioutil.WriteFile(filepath.Join(gopath, "src/example.com/p/p.go"), []byte("package p"), 0666); err != nil { + t.Fatal(err) + } + + defer os.Setenv("GO111MODULE", os.Getenv("GO111MODULE")) + os.Setenv("GO111MODULE", "on") + defer os.Setenv("GOPATH", os.Getenv("GOPATH")) + os.Setenv("GOPATH", gopath) + ctxt := Default + ctxt.GOPATH = gopath + + want := "cannot find module providing package" + if _, err := ctxt.Import("example.com/p", gopath, FindOnly); err == nil { + t.Fatal("importing package when no go.mod is present succeeded unexpectedly") + } else if errStr := err.Error(); !strings.Contains(errStr, want) { + t.Fatalf("error when importing package when no go.mod is present: got %q; want %q", errStr, want) + } +} + func TestImportDirTarget(t *testing.T) { testenv.MustHaveGoBuild(t) // really must just have source ctxt := Default @@ -447,3 +488,29 @@ func TestIssue23594(t *testing.T) { t.Fatalf("incorrectly set .Doc to %q", p.Doc) } } + +// TestMissingImportErrorRepetition checks that when an unknown package is +// imported, the package path is only shown once in the error. +// Verifies golang.org/issue/34752. +func TestMissingImportErrorRepetition(t *testing.T) { + testenv.MustHaveGoBuild(t) // need 'go list' internally + tmp, err := ioutil.TempDir("", "") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tmp) + if err := ioutil.WriteFile(filepath.Join(tmp, "go.mod"), []byte("module m"), 0666); err != nil { + t.Fatal(err) + } + defer os.Setenv("GO111MODULE", os.Getenv("GO111MODULE")) + os.Setenv("GO111MODULE", "on") + defer os.Setenv("GOPROXY", os.Getenv("GOPROXY")) + os.Setenv("GOPROXY", "off") + + pkgPath := "example.com/hello" + if _, err = Import(pkgPath, tmp, FindOnly); err == nil { + t.Fatal("unexpected success") + } else if n := strings.Count(err.Error(), pkgPath); n != 1 { + t.Fatalf("package path %q appears in error %d times; should appear once\nerror: %v", pkgPath, n, err) + } +} diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go index cbb0c59127d..6443094515d 100644 --- a/src/go/build/deps_test.go +++ b/src/go/build/deps_test.go @@ -514,7 +514,7 @@ func listStdPkgs(goroot string) ([]string, error) { func TestDependencies(t *testing.T) { iOS := runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") - if runtime.GOOS == "nacl" || iOS { + if iOS { // Tests run in a limited file system and we do not // provide access to every source file. t.Skipf("skipping on %s/%s, missing full GOROOT", runtime.GOOS, runtime.GOARCH) diff --git a/src/go/build/syslist.go b/src/go/build/syslist.go index 197c646d5c0..fbfe4c46779 100644 --- a/src/go/build/syslist.go +++ b/src/go/build/syslist.go @@ -4,5 +4,8 @@ package build +// List of past, present, and future known GOOS and GOARCH values. +// Do not remove from this list, as these are used for go/build filename matching. + const goosList = "aix android darwin dragonfly freebsd hurd illumos js linux nacl netbsd openbsd plan9 solaris windows zos " const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm " diff --git a/src/go/internal/gccgoimporter/importer_test.go b/src/go/internal/gccgoimporter/importer_test.go index 37250fde413..a74a4568680 100644 --- a/src/go/internal/gccgoimporter/importer_test.go +++ b/src/go/internal/gccgoimporter/importer_test.go @@ -100,7 +100,7 @@ var importerTests = [...]importerTest{ } func TestGoxImporter(t *testing.T) { - testenv.MustHaveExec(t) // this is to skip nacl, js + testenv.MustHaveExec(t) initmap := make(map[*types.Package]InitData) imp := GetImporter([]string{"testdata"}, initmap) diff --git a/src/go/internal/gcimporter/gcimporter_test.go b/src/go/internal/gcimporter/gcimporter_test.go index 3b7636806e7..df93f3f0628 100644 --- a/src/go/internal/gcimporter/gcimporter_test.go +++ b/src/go/internal/gcimporter/gcimporter_test.go @@ -26,10 +26,7 @@ import ( // import. func skipSpecialPlatforms(t *testing.T) { switch platform := runtime.GOOS + "-" + runtime.GOARCH; platform { - case "nacl-amd64p32", - "nacl-386", - "nacl-arm", - "darwin-arm", + case "darwin-arm", "darwin-arm64": t.Skipf("no compiled packages available for import on %s", platform) } @@ -140,7 +137,7 @@ func TestImportTestdata(t *testing.T) { } func TestVersionHandling(t *testing.T) { - skipSpecialPlatforms(t) // we really only need to exclude nacl platforms, but this is fine + skipSpecialPlatforms(t) // This package only handles gc export data. if runtime.Compiler != "gc" { diff --git a/src/go/types/api.go b/src/go/types/api.go index 6699231fce1..2a21ad0c53f 100644 --- a/src/go/types/api.go +++ b/src/go/types/api.go @@ -259,9 +259,6 @@ type TypeAndValue struct { Value constant.Value } -// TODO(gri) Consider eliminating the IsVoid predicate. Instead, report -// "void" values as regular values but with the empty tuple type. - // IsVoid reports whether the corresponding expression // is a function call without results. func (tv TypeAndValue) IsVoid() bool { diff --git a/src/go/types/decl.go b/src/go/types/decl.go index 11d2ee4596a..a4fb2b81ccd 100644 --- a/src/go/types/decl.go +++ b/src/go/types/decl.go @@ -53,11 +53,11 @@ func pathString(path []Object) string { // For the meaning of def, see Checker.definedType, in typexpr.go. func (check *Checker) objDecl(obj Object, def *Named) { if trace { - check.trace(obj.Pos(), "-- checking %s %s (objPath = %s)", obj.color(), obj, pathString(check.objPath)) + check.trace(obj.Pos(), "-- checking %s (%s, objPath = %s)", obj, obj.color(), pathString(check.objPath)) check.indent++ defer func() { check.indent-- - check.trace(obj.Pos(), "=> %s", obj) + check.trace(obj.Pos(), "=> %s (%s)", obj, obj.color()) }() } @@ -125,17 +125,17 @@ func (check *Checker) objDecl(obj Object, def *Named) { // order code. switch obj := obj.(type) { case *Const: - if check.typeCycle(obj) || obj.typ == nil { + if check.cycle(obj) || obj.typ == nil { obj.typ = Typ[Invalid] } case *Var: - if check.typeCycle(obj) || obj.typ == nil { + if check.cycle(obj) || obj.typ == nil { obj.typ = Typ[Invalid] } case *TypeName: - if check.typeCycle(obj) { + if check.cycle(obj) { // break cycle // (without this, calling underlying() // below may lead to an endless loop @@ -145,7 +145,7 @@ func (check *Checker) objDecl(obj Object, def *Named) { } case *Func: - if check.typeCycle(obj) { + if check.cycle(obj) { // Don't set obj.typ to Typ[Invalid] here // because plenty of code type-asserts that // functions have a *Signature type. Grey @@ -198,18 +198,9 @@ func (check *Checker) objDecl(obj Object, def *Named) { } } -// indir is a sentinel type name that is pushed onto the object path -// to indicate an "indirection" in the dependency from one type name -// to the next. For instance, for "type p *p" the object path contains -// p followed by indir, indicating that there's an indirection *p. -// Indirections are used to break type cycles. -var indir = NewTypeName(token.NoPos, nil, "*", nil) - -// typeCycle checks if the cycle starting with obj is valid and +// cycle checks if the cycle starting with obj is valid and // reports an error if it is not. -// TODO(gri) rename s/typeCycle/cycle/ once we don't need the other -// cycle method anymore. -func (check *Checker) typeCycle(obj Object) (isCycle bool) { +func (check *Checker) cycle(obj Object) (isCycle bool) { // The object map contains the package scope objects and the non-interface methods. if debug { info := check.objMap[obj] @@ -221,52 +212,34 @@ func (check *Checker) typeCycle(obj Object) (isCycle bool) { } } - // Given the number of constants and variables (nval) in the cycle - // and the cycle length (ncycle = number of named objects in the cycle), - // we distinguish between cycles involving only constants and variables - // (nval = ncycle), cycles involving types (and functions) only - // (nval == 0), and mixed cycles (nval != 0 && nval != ncycle). - // We ignore functions at the moment (taking them into account correctly - // is complicated and it doesn't improve error reporting significantly). - // - // A cycle must have at least one indirection and one type definition - // to be permitted: If there is no indirection, the size of the type - // cannot be computed (it's either infinite or 0); if there is no type - // definition, we have a sequence of alias type names which will expand - // ad infinitum. - var nval, ncycle int - var hasIndir, hasTDef bool + // Count cycle objects. assert(obj.color() >= grey) start := obj.color() - grey // index of obj in objPath cycle := check.objPath[start:] - ncycle = len(cycle) // including indirections + nval := 0 // number of (constant or variable) values in the cycle + ndef := 0 // number of type definitions in the cycle for _, obj := range cycle { switch obj := obj.(type) { case *Const, *Var: nval++ case *TypeName: - if obj == indir { - ncycle-- // don't count (indirections are not objects) - hasIndir = true + // Determine if the type name is an alias or not. For + // package-level objects, use the object map which + // provides syntactic information (which doesn't rely + // on the order in which the objects are set up). For + // local objects, we can rely on the order, so use + // the object's predicate. + // TODO(gri) It would be less fragile to always access + // the syntactic information. We should consider storing + // this information explicitly in the object. + var alias bool + if d := check.objMap[obj]; d != nil { + alias = d.alias // package-level object } else { - // Determine if the type name is an alias or not. For - // package-level objects, use the object map which - // provides syntactic information (which doesn't rely - // on the order in which the objects are set up). For - // local objects, we can rely on the order, so use - // the object's predicate. - // TODO(gri) It would be less fragile to always access - // the syntactic information. We should consider storing - // this information explicitly in the object. - var alias bool - if d := check.objMap[obj]; d != nil { - alias = d.alias // package-level object - } else { - alias = obj.IsAlias() // function local object - } - if !alias { - hasTDef = true - } + alias = obj.IsAlias() // function local object + } + if !alias { + ndef++ } case *Func: // ignored for now @@ -276,8 +249,8 @@ func (check *Checker) typeCycle(obj Object) (isCycle bool) { } if trace { - check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", pathString(cycle), obj.Name(), ncycle) - check.trace(obj.Pos(), "## cycle contains: %d values, has indirection = %v, has type definition = %v", nval, hasIndir, hasTDef) + check.trace(obj.Pos(), "## cycle detected: objPath = %s->%s (len = %d)", pathString(cycle), obj.Name(), len(cycle)) + check.trace(obj.Pos(), "## cycle contains: %d values, %d type definitions", nval, ndef) defer func() { if isCycle { check.trace(obj.Pos(), "=> error: cycle is invalid") @@ -288,32 +261,116 @@ func (check *Checker) typeCycle(obj Object) (isCycle bool) { // A cycle involving only constants and variables is invalid but we // ignore them here because they are reported via the initialization // cycle check. - if nval == ncycle { + if nval == len(cycle) { return false } - // A cycle involving only types (and possibly functions) must have at - // least one indirection and one type definition to be permitted: If - // there is no indirection, the size of the type cannot be computed - // (it's either infinite or 0); if there is no type definition, we + // A cycle involving only types (and possibly functions) must have at least + // one type definition to be permitted: If there is no type definition, we // have a sequence of alias type names which will expand ad infinitum. - if nval == 0 && hasIndir && hasTDef { + if nval == 0 && ndef > 0 { return false // cycle is permitted } - // report cycle - check.errorf(obj.Pos(), "illegal cycle in declaration of %s", obj.Name()) - for _, obj := range cycle { - if obj == indir { - continue // don't print indir sentinels - } - check.errorf(obj.Pos(), "\t%s refers to", obj.Name()) // secondary error, \t indented - } - check.errorf(obj.Pos(), "\t%s", obj.Name()) + check.cycleError(cycle) return true } +type typeInfo uint + +// validType verifies that the given type does not "expand" infinitely +// producing a cycle in the type graph. Cycles are detected by marking +// defined types. +// (Cycles involving alias types, as in "type A = [10]A" are detected +// earlier, via the objDecl cycle detection mechanism.) +func (check *Checker) validType(typ Type, path []Object) typeInfo { + const ( + unknown typeInfo = iota + marked + valid + invalid + ) + + switch t := typ.(type) { + case *Array: + return check.validType(t.elem, path) + + case *Struct: + for _, f := range t.fields { + if check.validType(f.typ, path) == invalid { + return invalid + } + } + + case *Interface: + for _, etyp := range t.embeddeds { + if check.validType(etyp, path) == invalid { + return invalid + } + } + + case *Named: + // don't report a 2nd error if we already know the type is invalid + // (e.g., if a cycle was detected earlier, via Checker.underlying). + if t.underlying == Typ[Invalid] { + t.info = invalid + return invalid + } + switch t.info { + case unknown: + t.info = marked + t.info = check.validType(t.orig, append(path, t.obj)) + case marked: + // cycle detected + for i, tn := range path { + if tn == t.obj { + check.cycleError(path[i:]) + t.info = invalid + t.underlying = Typ[Invalid] + return t.info + } + } + panic("internal error: cycle start not found") + } + return t.info + } + + return valid +} + +// cycleError reports a declaration cycle starting with +// the object in cycle that is "first" in the source. +func (check *Checker) cycleError(cycle []Object) { + // TODO(gri) Should we start with the last (rather than the first) object in the cycle + // since that is the earliest point in the source where we start seeing the + // cycle? That would be more consistent with other error messages. + i := firstInSrc(cycle) + obj := cycle[i] + check.errorf(obj.Pos(), "illegal cycle in declaration of %s", obj.Name()) + for range cycle { + check.errorf(obj.Pos(), "\t%s refers to", obj.Name()) // secondary error, \t indented + i++ + if i >= len(cycle) { + i = 0 + } + obj = cycle[i] + } + check.errorf(obj.Pos(), "\t%s", obj.Name()) +} + +// firstInSrc reports the index of the object with the "smallest" +// source position in path. path must not be empty. +func firstInSrc(path []Object) int { + fst, pos := 0, path[0].Pos() + for i, t := range path[1:] { + if t.Pos() < pos { + fst, pos = i+1, t.Pos() + } + } + return fst +} + func (check *Checker) constDecl(obj *Const, typ, init ast.Expr) { assert(obj.typ == nil) @@ -409,15 +466,53 @@ func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init ast.Expr) { // underlying returns the underlying type of typ; possibly by following // forward chains of named types. Such chains only exist while named types -// are incomplete. -func underlying(typ Type) Type { +// are incomplete. If an underlying type is found, resolve the chain by +// setting the underlying type for each defined type in the chain before +// returning it. +// +// If no underlying type is found, a cycle error is reported and Typ[Invalid] +// is used as underlying type for each defined type in the chain and returned +// as result. +func (check *Checker) underlying(typ Type) Type { + // If typ is not a defined type, its underlying type is itself. + n0, _ := typ.(*Named) + if n0 == nil { + return typ // nothing to do + } + + // If the underlying type of a defined type is not a defined + // type, then that is the desired underlying type. + typ = n0.underlying + n, _ := typ.(*Named) + if n == nil { + return typ // common case + } + + // Otherwise, follow the forward chain. + seen := map[*Named]int{n0: 0, n: 1} + path := []Object{n0.obj, n.obj} for { - n, _ := typ.(*Named) + typ = n.underlying + n, _ = typ.(*Named) if n == nil { + break // end of chain + } + + if i, ok := seen[n]; ok { + // cycle + check.cycleError(path[i:]) + typ = Typ[Invalid] break } - typ = n.underlying + + seen[n] = len(seen) + path = append(path, n.obj) } + + for n := range seen { + n.underlying = typ + } + return typ } @@ -430,6 +525,10 @@ func (n *Named) setUnderlying(typ Type) { func (check *Checker) typeDecl(obj *TypeName, typ ast.Expr, def *Named, alias bool) { assert(obj.typ == nil) + check.later(func() { + check.validType(obj.typ, nil) + }) + if alias { obj.typ = Typ[Invalid] @@ -442,7 +541,7 @@ func (check *Checker) typeDecl(obj *TypeName, typ ast.Expr, def *Named, alias bo obj.typ = named // make sure recursive type declarations terminate // determine underlying type of named - check.definedType(typ, named) + named.orig = check.definedType(typ, named) // The underlying type of named may be itself a named type that is // incomplete: @@ -456,8 +555,8 @@ func (check *Checker) typeDecl(obj *TypeName, typ ast.Expr, def *Named, alias bo // The type of C is the (named) type of A which is incomplete, // and which has as its underlying type the named type B. // Determine the (final, unnamed) underlying type by resolving - // any forward chain (they always end in an unnamed type). - named.underlying = underlying(named.underlying) + // any forward chain. + named.underlying = check.underlying(named) } diff --git a/src/go/types/example_test.go b/src/go/types/example_test.go index 492127bbab5..b8fba7312ae 100644 --- a/src/go/types/example_test.go +++ b/src/go/types/example_test.go @@ -5,7 +5,7 @@ // Only run where builders (build.golang.org) have // access to compiled packages for import. // -// +build !arm,!arm64,!nacl +// +build !arm,!arm64 package types_test diff --git a/src/go/types/expr.go b/src/go/types/expr.go index 0edd2789fb7..d49ccdf67e7 100644 --- a/src/go/types/expr.go +++ b/src/go/types/expr.go @@ -1157,12 +1157,9 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind { } case *Array: - // Prevent crash if the array referred to is not yet set up. - // This is a stop-gap solution; a better approach would use the mechanism of - // Checker.ident (typexpr.go) using a path of types. But that would require - // passing the path everywhere (all expression-checking methods, not just - // type expression checking), and we're not set up for that (quite possibly - // an indication that cycle detection needs to be rethought). Was issue #18643. + // Prevent crash if the array referred to is not yet set up. Was issue #18643. + // This is a stop-gap solution. Should use Checker.objPath to report entire + // path starting with earliest declaration in the source. TODO(gri) fix this. if utyp.elem == nil { check.error(e.Pos(), "illegal cycle in type declaration") goto Error diff --git a/src/go/types/initorder.go b/src/go/types/initorder.go index 966dccb8289..9d5e9165ad8 100644 --- a/src/go/types/initorder.go +++ b/src/go/types/initorder.go @@ -69,7 +69,7 @@ func (check *Checker) initOrder() { // if n still depends on other nodes, we have a cycle if n.ndeps > 0 { - cycle := findPath(check.objMap, n.obj, n.obj, make(objSet)) + cycle := findPath(check.objMap, n.obj, n.obj, make(map[Object]bool)) // If n.obj is not part of the cycle (e.g., n.obj->b->c->d->c), // cycle will be nil. Don't report anything in that case since // the cycle is reported when the algorithm gets to an object @@ -130,17 +130,17 @@ func (check *Checker) initOrder() { // findPath returns the (reversed) list of objects []Object{to, ... from} // such that there is a path of object dependencies from 'from' to 'to'. // If there is no such path, the result is nil. -func findPath(objMap map[Object]*declInfo, from, to Object, visited objSet) []Object { - if visited[from] { - return nil // node already seen +func findPath(objMap map[Object]*declInfo, from, to Object, seen map[Object]bool) []Object { + if seen[from] { + return nil } - visited[from] = true + seen[from] = true for d := range objMap[from].deps { if d == to { return []Object{d} } - if P := findPath(objMap, d, to, visited); P != nil { + if P := findPath(objMap, d, to, seen); P != nil { return append(P, d) } } diff --git a/src/go/types/resolver.go b/src/go/types/resolver.go index 93de63b0593..d66a5428ff7 100644 --- a/src/go/types/resolver.go +++ b/src/go/types/resolver.go @@ -25,12 +25,9 @@ type declInfo struct { alias bool // type alias declaration // The deps field tracks initialization expression dependencies. - deps objSet // lazily initialized + deps map[Object]bool // lazily initialized } -// An objSet is simply a set of objects. -type objSet map[Object]bool - // hasInitializer reports whether the declared object has an initialization // expression or function body. func (d *declInfo) hasInitializer() bool { @@ -41,7 +38,7 @@ func (d *declInfo) hasInitializer() bool { func (d *declInfo) addDep(obj Object) { m := d.deps if m == nil { - m = make(objSet) + m = make(map[Object]bool) d.deps = m } m[obj] = true @@ -482,7 +479,7 @@ func (check *Checker) resolveBaseTypeName(typ ast.Expr) (ptr bool, base *TypeNam // non-alias type name. If we encounter anything but pointer types or // parentheses we're done. If we encounter more than one pointer type // we're done. - var path []*TypeName + var seen map[*TypeName]bool for { typ = unparen(typ) @@ -496,7 +493,7 @@ func (check *Checker) resolveBaseTypeName(typ ast.Expr) (ptr bool, base *TypeNam typ = unparen(pexpr.X) // continue with pointer base type } - // typ must be the name + // typ must be a name name, _ := typ.(*ast.Ident) if name == nil { return false, nil @@ -516,7 +513,7 @@ func (check *Checker) resolveBaseTypeName(typ ast.Expr) (ptr bool, base *TypeNam } // ... which we have not seen before - if check.cycle(tname, path, false) { + if seen[tname] { return false, nil } @@ -529,28 +526,11 @@ func (check *Checker) resolveBaseTypeName(typ ast.Expr) (ptr bool, base *TypeNam // otherwise, continue resolving typ = tdecl.typ - path = append(path, tname) - } -} - -// cycle reports whether obj appears in path or not. -// If it does, and report is set, it also reports a cycle error. -func (check *Checker) cycle(obj *TypeName, path []*TypeName, report bool) bool { - // (it's ok to iterate forward because each named type appears at most once in path) - for i, prev := range path { - if prev == obj { - if report { - check.errorf(obj.pos, "illegal cycle in declaration of %s", obj.name) - // print cycle - for _, obj := range path[i:] { - check.errorf(obj.Pos(), "\t%s refers to", obj.Name()) // secondary error, \t indented - } - check.errorf(obj.Pos(), "\t%s", obj.Name()) - } - return true + if seen == nil { + seen = make(map[*TypeName]bool) } + seen[tname] = true } - return false } // packageObjects typechecks all package objects, but not function bodies. diff --git a/src/go/types/testdata/cycles.src b/src/go/types/testdata/cycles.src index a9af46a9337..b2ee8ecd5f6 100644 --- a/src/go/types/testdata/cycles.src +++ b/src/go/types/testdata/cycles.src @@ -71,6 +71,15 @@ type ( C0 chan C0 ) +// test case for issue #34771 +type ( + AA /* ERROR cycle */ B + B C + C [10]D + D E + E AA +) + func _() { type ( t1 /* ERROR cycle */ t1 @@ -147,7 +156,7 @@ type ( // test cases for issue 18643 // (type cycle detection when non-type expressions are involved) type ( - T14 /* ERROR cycle */ [len(T14{})]int + T14 [len(T14 /* ERROR cycle */ {})]int T15 [][len(T15 /* ERROR cycle */ {})]int T16 map[[len(T16 /* ERROR cycle */ {1:2})]int]int T17 map[int][len(T17 /* ERROR cycle */ {1:2})]int diff --git a/src/go/types/testdata/cycles5.src b/src/go/types/testdata/cycles5.src index aa6528a6312..397adcce015 100644 --- a/src/go/types/testdata/cycles5.src +++ b/src/go/types/testdata/cycles5.src @@ -188,3 +188,13 @@ func h() [h /* ERROR no value */ ()[0]]int { panic(0) } var c14 /* ERROR cycle */ T14 type T14 [uintptr(unsafe.Sizeof(&c14))]byte + +// issue #34333 +type T15 /* ERROR cycle */ struct { + f func() T16 + b T16 +} + +type T16 struct { + T15 +} \ No newline at end of file diff --git a/src/go/types/testdata/decls0.src b/src/go/types/testdata/decls0.src index 5b84722cc9d..5501b659153 100644 --- a/src/go/types/testdata/decls0.src +++ b/src/go/types/testdata/decls0.src @@ -72,10 +72,6 @@ type ( a /* ERROR "illegal cycle" */ a a /* ERROR "redeclared" */ int - // where the cycle error appears depends on the - // order in which declarations are processed - // (which depends on the order in which a map - // is iterated through) b /* ERROR "illegal cycle" */ c c d d e diff --git a/src/go/types/type.go b/src/go/types/type.go index 6263da06f2b..087cda429d6 100644 --- a/src/go/types/type.go +++ b/src/go/types/type.go @@ -448,7 +448,9 @@ func (c *Chan) Elem() Type { return c.elem } // A Named represents a named type. type Named struct { + info typeInfo // for cycle detection obj *TypeName // corresponding declared object + orig Type // type (on RHS of declaration) this *Named type is derived of (for cycle reporting) underlying Type // possibly a *Named during setup; never a *Named once set up completely methods []*Func // methods declared for this type (not the method set of this type); signatures are type-checked lazily } @@ -460,7 +462,7 @@ func NewNamed(obj *TypeName, underlying Type, methods []*Func) *Named { if _, ok := underlying.(*Named); ok { panic("types.NewNamed: underlying type must not be *Named") } - typ := &Named{obj: obj, underlying: underlying, methods: methods} + typ := &Named{obj: obj, orig: underlying, underlying: underlying, methods: methods} if obj.typ == nil { obj.typ = typ } diff --git a/src/go/types/typexpr.go b/src/go/types/typexpr.go index b0d04f53634..d5837c4f0e1 100644 --- a/src/go/types/typexpr.go +++ b/src/go/types/typexpr.go @@ -142,16 +142,6 @@ func (check *Checker) definedType(e ast.Expr, def *Named) (T Type) { return } -// indirectType is like typ but it also breaks the (otherwise) infinite size of recursive -// types by introducing an indirection. It should be called for components of types that -// are not laid out in place in memory, such as pointer base types, slice or map element -// types, function parameter types, etc. -func (check *Checker) indirectType(e ast.Expr) Type { - check.push(indir) - defer check.pop() - return check.definedType(e, nil) -} - // funcType type-checks a function or method type. func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast.FuncType) { scope := NewScope(check.scope, token.NoPos, token.NoPos, "function") @@ -273,7 +263,7 @@ func (check *Checker) typInternal(e ast.Expr, def *Named) Type { } else { typ := new(Slice) def.setUnderlying(typ) - typ.elem = check.indirectType(e.Elt) + typ.elem = check.typ(e.Elt) return typ } @@ -286,7 +276,7 @@ func (check *Checker) typInternal(e ast.Expr, def *Named) Type { case *ast.StarExpr: typ := new(Pointer) def.setUnderlying(typ) - typ.base = check.indirectType(e.X) + typ.base = check.typ(e.X) return typ case *ast.FuncType: @@ -305,8 +295,8 @@ func (check *Checker) typInternal(e ast.Expr, def *Named) Type { typ := new(Map) def.setUnderlying(typ) - typ.key = check.indirectType(e.Key) - typ.elem = check.indirectType(e.Value) + typ.key = check.typ(e.Key) + typ.elem = check.typ(e.Value) // spec: "The comparison operators == and != must be fully defined // for operands of the key type; thus the key type must not be a @@ -340,7 +330,7 @@ func (check *Checker) typInternal(e ast.Expr, def *Named) Type { } typ.dir = dir - typ.elem = check.indirectType(e.Value) + typ.elem = check.typ(e.Value) return typ default: @@ -421,7 +411,7 @@ func (check *Checker) collectParams(scope *Scope, list *ast.FieldList, variadicO // ignore ... and continue } } - typ := check.indirectType(ftype) + typ := check.typ(ftype) // The parser ensures that f.Tag is nil and we don't // care if a constructed AST contains a non-nil tag. if len(field.Names) > 0 { @@ -483,7 +473,7 @@ func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, d continue // ignore } - typ := check.indirectType(f.Type) + typ := check.typ(f.Type) sig, _ := typ.(*Signature) if sig == nil { if typ != Typ[Invalid] { @@ -508,8 +498,9 @@ func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, d // it if it's a valid interface. typ := check.typ(f.Type) - if _, ok := underlying(typ).(*Interface); !ok { - if typ != Typ[Invalid] { + utyp := check.underlying(typ) + if _, ok := utyp.(*Interface); !ok { + if utyp != Typ[Invalid] { check.errorf(f.Type.Pos(), "%s is not an interface", typ) } continue @@ -555,7 +546,12 @@ func (check *Checker) completeInterface(ityp *Interface) { }() } - ityp.allMethods = markComplete // avoid infinite recursion + // An infinitely expanding interface (due to a cycle) is detected + // elsewhere (Checker.validType), so here we simply assume we only + // have valid interfaces. Mark the interface as complete to avoid + // infinite recursion if the validType check occurs later for some + // reason. + ityp.allMethods = markComplete // Methods of embedded interfaces are collected unchanged; i.e., the identity // of a method I.m's Func Object of an interface I is the same as that of @@ -599,7 +595,12 @@ func (check *Checker) completeInterface(ityp *Interface) { posList := check.posMap[ityp] for i, typ := range ityp.embeddeds { pos := posList[i] // embedding position - typ := underlying(typ).(*Interface) + typ, ok := check.underlying(typ).(*Interface) + if !ok { + // An error was reported when collecting the embedded types. + // Ignore it. + continue + } check.completeInterface(typ) for _, m := range typ.allMethods { addMethod(pos, m, false) // use embedding position pos rather than m.pos diff --git a/src/hash/crc32/crc32_amd64p32.go b/src/hash/crc32/crc32_amd64p32.go deleted file mode 100644 index 1ec44cb496a..00000000000 --- a/src/hash/crc32/crc32_amd64p32.go +++ /dev/null @@ -1,37 +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. - -package crc32 - -import "internal/cpu" - -// This file contains the code to call the SSE 4.2 version of the Castagnoli -// CRC. - -// castagnoliSSE42 is defined in crc32_amd64p32.s and uses the SSE4.2 CRC32 -// instruction. -//go:noescape -func castagnoliSSE42(crc uint32, p []byte) uint32 - -func archAvailableCastagnoli() bool { - return cpu.X86.HasSSE42 -} - -func archInitCastagnoli() { - if !cpu.X86.HasSSE42 { - panic("not available") - } - // No initialization necessary. -} - -func archUpdateCastagnoli(crc uint32, p []byte) uint32 { - if !cpu.X86.HasSSE42 { - panic("not available") - } - return castagnoliSSE42(crc, p) -} - -func archAvailableIEEE() bool { return false } -func archInitIEEE() { panic("not available") } -func archUpdateIEEE(crc uint32, p []byte) uint32 { panic("not available") } diff --git a/src/hash/crc32/crc32_amd64p32.s b/src/hash/crc32/crc32_amd64p32.s deleted file mode 100644 index 502bceac570..00000000000 --- a/src/hash/crc32/crc32_amd64p32.s +++ /dev/null @@ -1,53 +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. - -#include "textflag.h" - -// func castagnoliSSE42(crc uint32, p []byte) uint32 -TEXT ·castagnoliSSE42(SB),NOSPLIT,$0 - MOVL crc+0(FP), AX // CRC value - MOVL p+4(FP), SI // data pointer - MOVL p_len+8(FP), CX // len(p) - - NOTL AX - - /* If there's less than 8 bytes to process, we do it byte-by-byte. */ - CMPQ CX, $8 - JL cleanup - - /* Process individual bytes until the input is 8-byte aligned. */ -startup: - MOVQ SI, BX - ANDQ $7, BX - JZ aligned - - CRC32B (SI), AX - DECQ CX - INCQ SI - JMP startup - -aligned: - /* The input is now 8-byte aligned and we can process 8-byte chunks. */ - CMPQ CX, $8 - JL cleanup - - CRC32Q (SI), AX - ADDQ $8, SI - SUBQ $8, CX - JMP aligned - -cleanup: - /* We may have some bytes left over that we process one at a time. */ - CMPQ CX, $0 - JE done - - CRC32B (SI), AX - INCQ SI - DECQ CX - JMP cleanup - -done: - NOTL AX - MOVL AX, ret+16(FP) - RET diff --git a/src/hash/crc32/crc32_otherarch.go b/src/hash/crc32/crc32_otherarch.go index 6f3510a279b..1a5e542ab6d 100644 --- a/src/hash/crc32/crc32_otherarch.go +++ b/src/hash/crc32/crc32_otherarch.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !amd64,!amd64p32,!s390x,!ppc64le,!arm64 +// +build !amd64,!s390x,!ppc64le,!arm64 package crc32 diff --git a/src/internal/bytealg/compare_amd64p32.s b/src/internal/bytealg/compare_amd64p32.s deleted file mode 100644 index cb4107386ef..00000000000 --- a/src/internal/bytealg/compare_amd64p32.s +++ /dev/null @@ -1,142 +0,0 @@ -// 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. - -#include "go_asm.h" -#include "textflag.h" - -TEXT ·Compare(SB),NOSPLIT,$0-28 - MOVL a_base+0(FP), SI - MOVL a_len+4(FP), BX - MOVL b_base+12(FP), DI - MOVL b_len+16(FP), DX - CALL cmpbody<>(SB) - MOVL AX, ret+24(FP) - RET - -TEXT runtime·cmpstring(SB),NOSPLIT,$0-20 - MOVL a_base+0(FP), SI - MOVL a_len+4(FP), BX - MOVL b_base+8(FP), DI - MOVL b_len+12(FP), DX - CALL cmpbody<>(SB) - MOVL AX, ret+16(FP) - RET - -// input: -// SI = a -// DI = b -// BX = alen -// DX = blen -// output: -// AX = 1/0/-1 -TEXT cmpbody<>(SB),NOSPLIT,$0-0 - CMPQ SI, DI - JEQ allsame - CMPQ BX, DX - MOVQ DX, R8 - CMOVQLT BX, R8 // R8 = min(alen, blen) = # of bytes to compare - CMPQ R8, $8 - JB small - -loop: - CMPQ R8, $16 - JBE _0through16 - MOVOU (SI), X0 - MOVOU (DI), X1 - PCMPEQB X0, X1 - PMOVMSKB X1, AX - XORQ $0xffff, AX // convert EQ to NE - JNE diff16 // branch if at least one byte is not equal - ADDQ $16, SI - ADDQ $16, DI - SUBQ $16, R8 - JMP loop - - // AX = bit mask of differences -diff16: - BSFQ AX, BX // index of first byte that differs - XORQ AX, AX - ADDQ BX, SI - MOVB (SI), CX - ADDQ BX, DI - CMPB CX, (DI) - SETHI AX - LEAQ -1(AX*2), AX // convert 1/0 to +1/-1 - RET - - // 0 through 16 bytes left, alen>=8, blen>=8 -_0through16: - CMPQ R8, $8 - JBE _0through8 - MOVQ (SI), AX - MOVQ (DI), CX - CMPQ AX, CX - JNE diff8 -_0through8: - ADDQ R8, SI - ADDQ R8, DI - MOVQ -8(SI), AX - MOVQ -8(DI), CX - CMPQ AX, CX - JEQ allsame - - // AX and CX contain parts of a and b that differ. -diff8: - BSWAPQ AX // reverse order of bytes - BSWAPQ CX - XORQ AX, CX - BSRQ CX, CX // index of highest bit difference - SHRQ CX, AX // move a's bit to bottom - ANDQ $1, AX // mask bit - LEAQ -1(AX*2), AX // 1/0 => +1/-1 - RET - - // 0-7 bytes in common -small: - LEAQ (R8*8), CX // bytes left -> bits left - NEGQ CX // - bits lift (== 64 - bits left mod 64) - JEQ allsame - - // load bytes of a into high bytes of AX - CMPB SI, $0xf8 - JA si_high - MOVQ (SI), SI - JMP si_finish -si_high: - ADDQ R8, SI - MOVQ -8(SI), SI - SHRQ CX, SI -si_finish: - SHLQ CX, SI - - // load bytes of b in to high bytes of BX - CMPB DI, $0xf8 - JA di_high - MOVQ (DI), DI - JMP di_finish -di_high: - ADDQ R8, DI - MOVQ -8(DI), DI - SHRQ CX, DI -di_finish: - SHLQ CX, DI - - BSWAPQ SI // reverse order of bytes - BSWAPQ DI - XORQ SI, DI // find bit differences - JEQ allsame - BSRQ DI, CX // index of highest bit difference - SHRQ CX, SI // move a's bit to bottom - ANDQ $1, SI // mask bit - LEAQ -1(SI*2), AX // 1/0 => +1/-1 - RET - -allsame: - XORQ AX, AX - XORQ CX, CX - CMPQ BX, DX - SETGT AX // 1 if alen > blen - SETEQ CX // 1 if alen == blen - LEAQ -1(CX)(AX*2), AX // 1,0,-1 result - RET diff --git a/src/internal/bytealg/compare_generic.go b/src/internal/bytealg/compare_generic.go index 4839df9528f..bd4489a6b9c 100644 --- a/src/internal/bytealg/compare_generic.go +++ b/src/internal/bytealg/compare_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !386,!amd64,!amd64p32,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!wasm,!mips64,!mips64le +// +build !386,!amd64,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!wasm,!mips64,!mips64le package bytealg diff --git a/src/internal/bytealg/compare_native.go b/src/internal/bytealg/compare_native.go index 95486e85429..b53ba97463f 100644 --- a/src/internal/bytealg/compare_native.go +++ b/src/internal/bytealg/compare_native.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 amd64 amd64p32 s390x arm arm64 ppc64 ppc64le mips mipsle wasm mips64 mips64le +// +build 386 amd64 s390x arm arm64 ppc64 ppc64le mips mipsle wasm mips64 mips64le package bytealg diff --git a/src/internal/bytealg/compare_wasm.s b/src/internal/bytealg/compare_wasm.s index 2d28215b1a4..dc8fb33cfb3 100644 --- a/src/internal/bytealg/compare_wasm.s +++ b/src/internal/bytealg/compare_wasm.s @@ -45,9 +45,8 @@ TEXT cmpbody<>(SB), NOSPLIT, $0-0 I32WrapI64 Call memcmp<>(SB) I64ExtendI32S - Set R5 + Tee R5 - Get R5 I64Eqz If // check length diff --git a/src/internal/bytealg/equal_amd64p32.s b/src/internal/bytealg/equal_amd64p32.s deleted file mode 100644 index cd369c67312..00000000000 --- a/src/internal/bytealg/equal_amd64p32.s +++ /dev/null @@ -1,132 +0,0 @@ -// 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. - -#include "go_asm.h" -#include "textflag.h" - -// memequal(a, b unsafe.Pointer, size uintptr) bool -TEXT runtime·memequal(SB),NOSPLIT,$0-17 - MOVL a+0(FP), SI - MOVL b+4(FP), DI - CMPL SI, DI - JEQ eq - MOVL size+8(FP), BX - CALL memeqbody<>(SB) - MOVB AX, ret+16(FP) - RET -eq: - MOVB $1, ret+16(FP) - RET - -// memequal_varlen(a, b unsafe.Pointer) bool -TEXT runtime·memequal_varlen(SB),NOSPLIT,$0-9 - MOVL a+0(FP), SI - MOVL b+4(FP), DI - CMPL SI, DI - JEQ eq - MOVL 4(DX), BX // compiler stores size at offset 4 in the closure - CALL memeqbody<>(SB) - MOVB AX, ret+8(FP) - RET -eq: - MOVB $1, ret+8(FP) - RET - -// a in SI -// b in DI -// count in BX -TEXT memeqbody<>(SB),NOSPLIT,$0-0 - XORQ AX, AX - - CMPQ BX, $8 - JB small - - // 64 bytes at a time using xmm registers -hugeloop: - CMPQ BX, $64 - JB bigloop - MOVOU (SI), X0 - MOVOU (DI), X1 - MOVOU 16(SI), X2 - MOVOU 16(DI), X3 - MOVOU 32(SI), X4 - MOVOU 32(DI), X5 - MOVOU 48(SI), X6 - MOVOU 48(DI), X7 - PCMPEQB X1, X0 - PCMPEQB X3, X2 - PCMPEQB X5, X4 - PCMPEQB X7, X6 - PAND X2, X0 - PAND X6, X4 - PAND X4, X0 - PMOVMSKB X0, DX - ADDQ $64, SI - ADDQ $64, DI - SUBQ $64, BX - CMPL DX, $0xffff - JEQ hugeloop - RET - - // 8 bytes at a time using 64-bit register -bigloop: - CMPQ BX, $8 - JBE leftover - MOVQ (SI), CX - MOVQ (DI), DX - ADDQ $8, SI - ADDQ $8, DI - SUBQ $8, BX - CMPQ CX, DX - JEQ bigloop - RET - - // remaining 0-8 bytes -leftover: - ADDQ BX, SI - ADDQ BX, DI - MOVQ -8(SI), CX - MOVQ -8(DI), DX - CMPQ CX, DX - SETEQ AX - RET - -small: - CMPQ BX, $0 - JEQ equal - - LEAQ 0(BX*8), CX - NEGQ CX - - CMPB SI, $0xf8 - JA si_high - - // load at SI won't cross a page boundary. - MOVQ (SI), SI - JMP si_finish -si_high: - // address ends in 11111xxx. Load up to bytes we want, move to correct position. - MOVQ BX, DX - ADDQ SI, DX - MOVQ -8(DX), SI - SHRQ CX, SI -si_finish: - - // same for DI. - CMPB DI, $0xf8 - JA di_high - MOVQ (DI), DI - JMP di_finish -di_high: - MOVQ BX, DX - ADDQ DI, DX - MOVQ -8(DX), DI - SHRQ CX, DI -di_finish: - - SUBQ SI, DI - SHLQ CX, DI -equal: - SETEQ AX - RET diff --git a/src/internal/bytealg/indexbyte_amd64p32.s b/src/internal/bytealg/indexbyte_amd64p32.s deleted file mode 100644 index c445a7ebc13..00000000000 --- a/src/internal/bytealg/indexbyte_amd64p32.s +++ /dev/null @@ -1,113 +0,0 @@ -// 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. - -#include "go_asm.h" -#include "textflag.h" - -TEXT ·IndexByte(SB),NOSPLIT,$0-20 - MOVL b_base+0(FP), SI - MOVL b_len+4(FP), BX - MOVB c+12(FP), AL - CALL indexbytebody<>(SB) - MOVL AX, ret+16(FP) - RET - -TEXT ·IndexByteString(SB),NOSPLIT,$0-20 - MOVL s_base+0(FP), SI - MOVL s_len+4(FP), BX - MOVB c+8(FP), AL - CALL indexbytebody<>(SB) - MOVL AX, ret+16(FP) - RET - -// input: -// SI: data -// BX: data len -// AL: byte sought -// output: -// AX -TEXT indexbytebody<>(SB),NOSPLIT,$0 - MOVL SI, DI - - CMPL BX, $16 - JLT small - - // round up to first 16-byte boundary - TESTL $15, SI - JZ aligned - MOVL SI, CX - ANDL $~15, CX - ADDL $16, CX - - // search the beginning - SUBL SI, CX - REPN; SCASB - JZ success - -// DI is 16-byte aligned; get ready to search using SSE instructions -aligned: - // round down to last 16-byte boundary - MOVL BX, R11 - ADDL SI, R11 - ANDL $~15, R11 - - // shuffle X0 around so that each byte contains c - MOVD AX, X0 - PUNPCKLBW X0, X0 - PUNPCKLBW X0, X0 - PSHUFL $0, X0, X0 - JMP condition - -sse: - // move the next 16-byte chunk of the buffer into X1 - MOVO (DI), X1 - // compare bytes in X0 to X1 - PCMPEQB X0, X1 - // take the top bit of each byte in X1 and put the result in DX - PMOVMSKB X1, DX - TESTL DX, DX - JNZ ssesuccess - ADDL $16, DI - -condition: - CMPL DI, R11 - JNE sse - - // search the end - MOVL SI, CX - ADDL BX, CX - SUBL R11, CX - // if CX == 0, the zero flag will be set and we'll end up - // returning a false success - JZ failure - REPN; SCASB - JZ success - -failure: - MOVL $-1, AX - RET - -// handle for lengths < 16 -small: - MOVL BX, CX - REPN; SCASB - JZ success - MOVL $-1, AX - RET - -// we've found the chunk containing the byte -// now just figure out which specific byte it is -ssesuccess: - // get the index of the least significant set bit - BSFW DX, DX - SUBL SI, DI - ADDL DI, DX - MOVL DX, AX - RET - -success: - SUBL SI, DI - SUBL $1, DI - MOVL DI, AX - RET diff --git a/src/internal/bytealg/indexbyte_generic.go b/src/internal/bytealg/indexbyte_generic.go index 6bff31ceee4..fce1b0fc542 100644 --- a/src/internal/bytealg/indexbyte_generic.go +++ b/src/internal/bytealg/indexbyte_generic.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !386,!amd64,!amd64p32,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!mips64,!mips64le,!wasm +// +build !386,!amd64,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!mips64,!mips64le,!wasm package bytealg diff --git a/src/internal/bytealg/indexbyte_native.go b/src/internal/bytealg/indexbyte_native.go index b4ddc86ea90..157caa34c4a 100644 --- a/src/internal/bytealg/indexbyte_native.go +++ b/src/internal/bytealg/indexbyte_native.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 amd64 amd64p32 s390x arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le wasm +// +build 386 amd64 s390x arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le wasm package bytealg diff --git a/src/internal/cpu/cpu_amd64p32.go b/src/internal/cpu/cpu_amd64p32.go deleted file mode 100644 index 177b14e317b..00000000000 --- a/src/internal/cpu/cpu_amd64p32.go +++ /dev/null @@ -1,7 +0,0 @@ -// 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. - -package cpu - -const GOARCH = "amd64p32" diff --git a/src/internal/cpu/cpu_no_init.go b/src/internal/cpu/cpu_no_init.go index 777ea9de8bd..d4b2be8cf4f 100644 --- a/src/internal/cpu/cpu_no_init.go +++ b/src/internal/cpu/cpu_no_init.go @@ -4,7 +4,6 @@ // +build !386 // +build !amd64 -// +build !amd64p32 // +build !arm // +build !arm64 // +build !ppc64 diff --git a/src/internal/cpu/cpu_x86.go b/src/internal/cpu/cpu_x86.go index 5d357be62b2..da6cf672581 100644 --- a/src/internal/cpu/cpu_x86.go +++ b/src/internal/cpu/cpu_x86.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 amd64 amd64p32 +// +build 386 amd64 package cpu @@ -55,8 +55,8 @@ func doinit() { {Name: "sse42", Feature: &X86.HasSSE42}, {Name: "ssse3", Feature: &X86.HasSSSE3}, - // These capabilities should always be enabled on amd64(p32): - {Name: "sse2", Feature: &X86.HasSSE2, Required: GOARCH == "amd64" || GOARCH == "amd64p32"}, + // These capabilities should always be enabled on amd64: + {Name: "sse2", Feature: &X86.HasSSE2, Required: GOARCH == "amd64"}, } maxID, _, _, _ := cpuid(0, 0) diff --git a/src/internal/cpu/cpu_x86.s b/src/internal/cpu/cpu_x86.s index 228fbcf6d66..93c712d784c 100644 --- a/src/internal/cpu/cpu_x86.s +++ b/src/internal/cpu/cpu_x86.s @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 amd64 amd64p32 +// +build 386 amd64 #include "textflag.h" @@ -19,14 +19,8 @@ TEXT ·cpuid(SB), NOSPLIT, $0-24 // func xgetbv() (eax, edx uint32) TEXT ·xgetbv(SB),NOSPLIT,$0-8 -#ifdef GOOS_nacl - // nacl does not support XGETBV. - MOVL $0, eax+0(FP) - MOVL $0, edx+4(FP) -#else MOVL $0, CX XGETBV MOVL AX, eax+0(FP) MOVL DX, edx+4(FP) -#endif RET diff --git a/src/internal/cpu/cpu_x86_test.go b/src/internal/cpu/cpu_x86_test.go index 9e93d1af5d7..61db93bd517 100644 --- a/src/internal/cpu/cpu_x86_test.go +++ b/src/internal/cpu/cpu_x86_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 amd64 amd64p32 +// +build 386 amd64 package cpu_test diff --git a/src/internal/poll/export_posix_test.go b/src/internal/poll/export_posix_test.go index 6b9bb8b7d0d..abadf509300 100644 --- a/src/internal/poll/export_posix_test.go +++ b/src/internal/poll/export_posix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows // Export guts for testing on posix. // Since testing imports os and os imports internal/poll, diff --git a/src/internal/poll/fd_fsync_posix.go b/src/internal/poll/fd_fsync_posix.go index 6705a3e524c..0886d749d34 100644 --- a/src/internal/poll/fd_fsync_posix.go +++ b/src/internal/poll/fd_fsync_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris package poll diff --git a/src/internal/poll/fd_poll_nacljs.go b/src/internal/poll/fd_poll_js.go similarity index 99% rename from src/internal/poll/fd_poll_nacljs.go rename to src/internal/poll/fd_poll_js.go index 0871f342d42..2bfeb0a0b7a 100644 --- a/src/internal/poll/fd_poll_nacljs.go +++ b/src/internal/poll/fd_poll_js.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package poll diff --git a/src/internal/poll/fd_posix.go b/src/internal/poll/fd_posix.go index b43ad517996..d0bacdd4737 100644 --- a/src/internal/poll/fd_posix.go +++ b/src/internal/poll/fd_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package poll diff --git a/src/internal/poll/fd_posix_test.go b/src/internal/poll/fd_posix_test.go index 246d4989e1c..4449eb3a15f 100644 --- a/src/internal/poll/fd_posix_test.go +++ b/src/internal/poll/fd_posix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows package poll_test diff --git a/src/internal/poll/fd_unix.go b/src/internal/poll/fd_unix.go index 8185269c53c..41d6ef593db 100644 --- a/src/internal/poll/fd_unix.go +++ b/src/internal/poll/fd_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package poll diff --git a/src/internal/poll/hook_unix.go b/src/internal/poll/hook_unix.go index a7512b1255f..11f90e96968 100644 --- a/src/internal/poll/hook_unix.go +++ b/src/internal/poll/hook_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package poll diff --git a/src/internal/poll/sys_cloexec.go b/src/internal/poll/sys_cloexec.go index 64e46127d45..7b87f136dfe 100644 --- a/src/internal/poll/sys_cloexec.go +++ b/src/internal/poll/sys_cloexec.go @@ -5,7 +5,7 @@ // This file implements sysSocket and accept for platforms that do not // provide a fast path for setting SetNonblock and CloseOnExec. -// +build aix darwin js,wasm nacl solaris +// +build aix darwin js,wasm solaris package poll diff --git a/src/internal/reflectlite/reflect_mirror_test.go b/src/internal/reflectlite/reflect_mirror_test.go new file mode 100644 index 00000000000..fbb6fb397ef --- /dev/null +++ b/src/internal/reflectlite/reflect_mirror_test.go @@ -0,0 +1,131 @@ +// Copyright 2019 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 reflectlite_test + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "os" + "path/filepath" + "runtime" + "strings" + "sync" + "testing" +) + +var typeNames = []string{ + "rtype", + "uncommonType", + "arrayType", + "chanType", + "funcType", + "interfaceType", + "mapType", + "ptrType", + "sliceType", + "structType", +} + +type visitor struct { + m map[string]map[string]bool +} + +func newVisitor() visitor { + v := visitor{} + v.m = make(map[string]map[string]bool) + + return v +} +func (v visitor) filter(name string) bool { + for _, typeName := range typeNames { + if typeName == name { + return true + } + } + return false +} + +func (v visitor) Visit(n ast.Node) ast.Visitor { + switch x := n.(type) { + case *ast.TypeSpec: + if v.filter(x.Name.String()) { + if st, ok := x.Type.(*ast.StructType); ok { + v.m[x.Name.String()] = make(map[string]bool) + for _, field := range st.Fields.List { + k := fmt.Sprintf("%s", field.Type) + if len(field.Names) > 0 { + k = field.Names[0].Name + } + v.m[x.Name.String()][k] = true + } + } + } + } + return v +} + +func loadTypes(path, pkgName string, v visitor) { + fset := token.NewFileSet() + + filter := func(fi os.FileInfo) bool { + return strings.HasSuffix(fi.Name(), ".go") + } + pkgs, err := parser.ParseDir(fset, path, filter, 0) + if err != nil { + panic(err) + } + + pkg := pkgs[pkgName] + + for _, f := range pkg.Files { + ast.Walk(v, f) + } +} + +func TestMirrorWithReflect(t *testing.T) { + reflectDir := filepath.Join(runtime.GOROOT(), "src", "reflect") + if _, err := os.Stat(reflectDir); os.IsNotExist(err) { + // On some mobile builders, the test binary executes on a machine without a + // complete GOROOT source tree. + t.Skipf("GOROOT source not present") + } + + var wg sync.WaitGroup + rl, r := newVisitor(), newVisitor() + + for _, tc := range []struct { + path, pkg string + v visitor + }{ + {".", "reflectlite", rl}, + {reflectDir, "reflect", r}, + } { + tc := tc + wg.Add(1) + go func() { + defer wg.Done() + loadTypes(tc.path, tc.pkg, tc.v) + }() + } + wg.Wait() + + if len(rl.m) != len(r.m) { + t.Fatalf("number of types mismatch, reflect: %d, reflectlite: %d", len(r.m), len(rl.m)) + } + + for typName := range r.m { + if len(r.m[typName]) != len(rl.m[typName]) { + t.Errorf("type %s number of fields mismatch, reflect: %d, reflectlite: %d", typName, len(r.m[typName]), len(rl.m[typName])) + continue + } + for field := range r.m[typName] { + if _, ok := rl.m[typName][field]; !ok { + t.Errorf(`Field mismatch, reflect have "%s", relectlite does not.`, field) + } + } + } +} diff --git a/src/internal/reflectlite/set_test.go b/src/internal/reflectlite/set_test.go index 817e4beae1b..a610499d084 100644 --- a/src/internal/reflectlite/set_test.go +++ b/src/internal/reflectlite/set_test.go @@ -39,6 +39,8 @@ var implementsTests = []struct { {new(notASTExpr), new(ast.Expr), false}, {new(ast.Expr), new(notASTExpr), false}, {new(*notAnExpr), new(notASTExpr), true}, + {new(mapError), new(error), true}, + {new(*mapError), new(error), true}, } type notAnExpr struct{} @@ -53,6 +55,13 @@ type notASTExpr interface { exprNode() } +type mapError map[string]string + +func (mapError) Error() string { return "mapError" } + +var _ error = mapError{} +var _ error = new(mapError) + func TestImplements(t *testing.T) { for _, tt := range implementsTests { xv := TypeOf(tt.x).Elem() diff --git a/src/internal/reflectlite/type.go b/src/internal/reflectlite/type.go index c706319a8e2..e90071c67cf 100644 --- a/src/internal/reflectlite/type.go +++ b/src/internal/reflectlite/type.go @@ -137,6 +137,10 @@ const ( // tflagNamed means the type has a name. tflagNamed tflag = 1 << 2 + + // tflagRegularMemory means that equal and hash functions can treat + // this type as a single region of t.size bytes. + tflagRegularMemory tflag = 1 << 3 ) // rtype is the common implementation of most values. @@ -145,26 +149,18 @@ const ( // rtype must be kept in sync with ../runtime/type.go:/^type._type. type rtype struct { size uintptr - ptrdata uintptr // number of bytes in the type that can contain pointers - hash uint32 // hash of type; avoids computation in hash tables - tflag tflag // extra type information flags - align uint8 // alignment of variable with this type - fieldAlign uint8 // alignment of struct field with this type - kind uint8 // enumeration for C - alg *typeAlg // algorithm table - gcdata *byte // garbage collection data - str nameOff // string form - ptrToThis typeOff // type for pointer to this type, may be zero -} - -// a copy of runtime.typeAlg -type typeAlg struct { - // function for hashing objects of this type - // (ptr to object, seed) -> hash - hash func(unsafe.Pointer, uintptr) uintptr + ptrdata uintptr // number of bytes in the type that can contain pointers + hash uint32 // hash of type; avoids computation in hash tables + tflag tflag // extra type information flags + align uint8 // alignment of variable with this type + fieldAlign uint8 // alignment of struct field with this type + kind uint8 // enumeration for C // function for comparing objects of this type // (ptr to object A, ptr to object B) -> ==? - equal func(unsafe.Pointer, unsafe.Pointer) bool + equal func(unsafe.Pointer, unsafe.Pointer) bool + gcdata *byte // garbage collection data + str nameOff // string form + ptrToThis typeOff // type for pointer to this type, may be zero } // Method on non-interface type @@ -244,8 +240,11 @@ type interfaceType struct { // mapType represents a map type. type mapType struct { rtype - key *rtype // map key type - elem *rtype // map element (value) type + key *rtype // map key type + elem *rtype // map element (value) type + bucket *rtype // internal bucket structure + // function for hashing keys (ptr to key, seed) -> hash + hasher func(unsafe.Pointer, uintptr) uintptr keysize uint8 // size of key slot valuesize uint8 // size of value slot bucketsize uint16 // size of bucket @@ -685,7 +684,7 @@ func (t *rtype) AssignableTo(u Type) bool { } func (t *rtype) Comparable() bool { - return t.alg != nil && t.alg.equal != nil + return t.equal != nil } // implements reports whether the type V implements the interface type T. diff --git a/src/internal/syscall/unix/nonblocking_nacl.go b/src/internal/syscall/unix/nonblocking_nacl.go deleted file mode 100644 index ff67c75e81a..00000000000 --- a/src/internal/syscall/unix/nonblocking_nacl.go +++ /dev/null @@ -1,9 +0,0 @@ -// 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. - -package unix - -func IsNonblock(fd int) (nonblocking bool, err error) { - return false, nil -} diff --git a/src/internal/syscall/windows/mksyscall.go b/src/internal/syscall/windows/mksyscall.go index 0bf87dc95c2..95e36f7aa3c 100644 --- a/src/internal/syscall/windows/mksyscall.go +++ b/src/internal/syscall/windows/mksyscall.go @@ -6,4 +6,4 @@ package windows -//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go syscall_windows.go security_windows.go psapi_windows.go symlink_windows.go +//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go syscall_windows.go security_windows.go psapi_windows.go symlink_windows.go diff --git a/src/internal/syscall/windows/registry/mksyscall.go b/src/internal/syscall/windows/registry/mksyscall.go index fa8e27e8ff6..cb4906a7b26 100644 --- a/src/internal/syscall/windows/registry/mksyscall.go +++ b/src/internal/syscall/windows/registry/mksyscall.go @@ -6,4 +6,4 @@ package registry -//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go syscall.go +//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go syscall.go diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go index f7a9730ca6f..b036aa6ebc7 100644 --- a/src/internal/testenv/testenv.go +++ b/src/internal/testenv/testenv.go @@ -43,7 +43,7 @@ func HasGoBuild() bool { return false } switch runtime.GOOS { - case "android", "nacl", "js": + case "android", "js": return false case "darwin": if strings.HasPrefix(runtime.GOARCH, "arm") { @@ -122,7 +122,7 @@ func GoTool() (string, error) { // using os.StartProcess or (more commonly) exec.Command. func HasExec() bool { switch runtime.GOOS { - case "nacl", "js": + case "js": return false case "darwin": if strings.HasPrefix(runtime.GOARCH, "arm") { @@ -135,8 +135,6 @@ func HasExec() bool { // HasSrc reports whether the entire source tree is available under GOROOT. func HasSrc() bool { switch runtime.GOOS { - case "nacl": - return false case "darwin": if strings.HasPrefix(runtime.GOARCH, "arm") { return false @@ -175,14 +173,14 @@ func MustHaveExecPath(t testing.TB, path string) { // HasExternalNetwork reports whether the current system can use // external (non-localhost) networks. func HasExternalNetwork() bool { - return !testing.Short() && runtime.GOOS != "nacl" && runtime.GOOS != "js" + return !testing.Short() && runtime.GOOS != "js" } // MustHaveExternalNetwork checks that the current system can use // external (non-localhost) networks. // If not, MustHaveExternalNetwork calls t.Skip with an explanation. func MustHaveExternalNetwork(t testing.TB) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("skipping test: no external network on %s", runtime.GOOS) } if testing.Short() { diff --git a/src/internal/testenv/testenv_notwin.go b/src/internal/testenv/testenv_notwin.go index d8ce6cd3853..ccb5d5585f6 100644 --- a/src/internal/testenv/testenv_notwin.go +++ b/src/internal/testenv/testenv_notwin.go @@ -12,7 +12,7 @@ import ( func hasSymlink() (ok bool, reason string) { switch runtime.GOOS { - case "android", "nacl", "plan9": + case "android", "plan9": return false, "" } diff --git a/src/log/syslog/doc.go b/src/log/syslog/doc.go index 54585232498..bd12bea581f 100644 --- a/src/log/syslog/doc.go +++ b/src/log/syslog/doc.go @@ -22,5 +22,3 @@ package syslog // see https://golang.org/issue/1108. // BUG(akumar): This package is not implemented on Plan 9. - -// BUG(minux): This package is not implemented on NaCl (Native Client). diff --git a/src/log/syslog/example_test.go b/src/log/syslog/example_test.go index 3d5b76d219c..4288d37dee0 100644 --- a/src/log/syslog/example_test.go +++ b/src/log/syslog/example_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9 +// +build !windows,!plan9 package syslog_test diff --git a/src/log/syslog/syslog.go b/src/log/syslog/syslog.go index dfd0028e5c1..82dd4e7dd6d 100644 --- a/src/log/syslog/syslog.go +++ b/src/log/syslog/syslog.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9 +// +build !windows,!plan9 package syslog diff --git a/src/log/syslog/syslog_test.go b/src/log/syslog/syslog_test.go index 8a28d67c984..dd1a1c4988a 100644 --- a/src/log/syslog/syslog_test.go +++ b/src/log/syslog/syslog_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9,!js +// +build !windows,!plan9,!js package syslog diff --git a/src/log/syslog/syslog_unix.go b/src/log/syslog/syslog_unix.go index 6c17e1f2606..a64eed29f17 100644 --- a/src/log/syslog/syslog_unix.go +++ b/src/log/syslog/syslog_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9 +// +build !windows,!plan9 package syslog diff --git a/src/math/big/arith_amd64p32.s b/src/math/big/arith_amd64p32.s deleted file mode 100644 index 0a672386ccd..00000000000 --- a/src/math/big/arith_amd64p32.s +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013 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. - -// +build !math_big_pure_go - -#include "textflag.h" - -TEXT ·mulWW(SB),NOSPLIT,$0 - JMP ·mulWW_g(SB) - -TEXT ·divWW(SB),NOSPLIT,$0 - JMP ·divWW_g(SB) - -TEXT ·addVV(SB),NOSPLIT,$0 - JMP ·addVV_g(SB) - -TEXT ·subVV(SB),NOSPLIT,$0 - JMP ·subVV_g(SB) - -TEXT ·addVW(SB),NOSPLIT,$0 - JMP ·addVW_g(SB) - -TEXT ·subVW(SB),NOSPLIT,$0 - JMP ·subVW_g(SB) - -TEXT ·shlVU(SB),NOSPLIT,$0 - JMP ·shlVU_g(SB) - -TEXT ·shrVU(SB),NOSPLIT,$0 - JMP ·shrVU_g(SB) - -TEXT ·mulAddVWW(SB),NOSPLIT,$0 - JMP ·mulAddVWW_g(SB) - -TEXT ·addMulVVW(SB),NOSPLIT,$0 - JMP ·addMulVVW_g(SB) - -TEXT ·divWVW(SB),NOSPLIT,$0 - JMP ·divWVW_g(SB) diff --git a/src/math/dim_amd64p32.s b/src/math/dim_amd64p32.s deleted file mode 100644 index 2740aa91ca2..00000000000 --- a/src/math/dim_amd64p32.s +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2013 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. - -#include "dim_amd64.s" diff --git a/src/math/exp_amd64p32.s b/src/math/exp_amd64p32.s deleted file mode 100644 index d1f831295d3..00000000000 --- a/src/math/exp_amd64p32.s +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2013 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. - -#include "exp_amd64.s" diff --git a/src/math/exp_asm.go b/src/math/exp_asm.go index 421618eea91..8dad3c810b6 100644 --- a/src/math/exp_asm.go +++ b/src/math/exp_asm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 amd64p32 +// +build amd64 package math diff --git a/src/math/floor_amd64p32.s b/src/math/floor_amd64p32.s deleted file mode 100644 index 13be9a6a772..00000000000 --- a/src/math/floor_amd64p32.s +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2013 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. - -#include "floor_amd64.s" diff --git a/src/math/hypot_amd64p32.s b/src/math/hypot_amd64p32.s deleted file mode 100644 index 3f86bb724d4..00000000000 --- a/src/math/hypot_amd64p32.s +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2013 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. - -#include "hypot_amd64.s" diff --git a/src/math/log_amd64p32.s b/src/math/log_amd64p32.s deleted file mode 100644 index 80434c617c9..00000000000 --- a/src/math/log_amd64p32.s +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2013 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. - -#include "log_amd64.s" diff --git a/src/math/sqrt_amd64p32.s b/src/math/sqrt_amd64p32.s deleted file mode 100644 index 181114cc0bf..00000000000 --- a/src/math/sqrt_amd64p32.s +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2013 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. - -#include "sqrt_amd64.s" diff --git a/src/math/stubs_amd64p32.s b/src/math/stubs_amd64p32.s deleted file mode 100644 index 5a4fe14823a..00000000000 --- a/src/math/stubs_amd64p32.s +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2017 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. - -#include "stubs_amd64.s" diff --git a/src/mime/multipart/multipart.go b/src/mime/multipart/multipart.go index a222409d3ce..1750300fb53 100644 --- a/src/mime/multipart/multipart.go +++ b/src/mime/multipart/multipart.go @@ -36,11 +36,6 @@ type Part struct { // The headers of the body, if any, with the keys canonicalized // in the same fashion that the Go http.Request headers are. // For example, "foo-bar" changes case to "Foo-Bar" - // - // As a special case, if the "Content-Transfer-Encoding" header - // has a value of "quoted-printable", that header is instead - // hidden from this map and the body is transparently decoded - // during Read calls. Header textproto.MIMEHeader mr *Reader @@ -126,7 +121,7 @@ func (r *stickyErrorReader) Read(p []byte) (n int, _ error) { return n, r.err } -func newPart(mr *Reader) (*Part, error) { +func newPart(mr *Reader, rawPart bool) (*Part, error) { bp := &Part{ Header: make(map[string][]string), mr: mr, @@ -135,10 +130,14 @@ func newPart(mr *Reader) (*Part, error) { return nil, err } bp.r = partReader{bp} - const cte = "Content-Transfer-Encoding" - if strings.EqualFold(bp.Header.Get(cte), "quoted-printable") { - bp.Header.Del(cte) - bp.r = quotedprintable.NewReader(bp.r) + + // rawPart is used to switch between Part.NextPart and Part.NextRawPart. + if !rawPart { + const cte = "Content-Transfer-Encoding" + if strings.EqualFold(bp.Header.Get(cte), "quoted-printable") { + bp.Header.Del(cte) + bp.r = quotedprintable.NewReader(bp.r) + } } return bp, nil } @@ -300,7 +299,24 @@ type Reader struct { // NextPart returns the next part in the multipart or an error. // When there are no more parts, the error io.EOF is returned. +// +// As a special case, if the "Content-Transfer-Encoding" header +// has a value of "quoted-printable", that header is instead +// hidden and the body is transparently decoded during Read calls. func (r *Reader) NextPart() (*Part, error) { + return r.nextPart(false) +} + +// NextRawPart returns the next part in the multipart or an error. +// When there are no more parts, the error io.EOF is returned. +// +// Unlike NextPart, it does not have special handling for +// "Content-Transfer-Encoding: quoted-printable". +func (r *Reader) NextRawPart() (*Part, error) { + return r.nextPart(true) +} + +func (r *Reader) nextPart(rawPart bool) (*Part, error) { if r.currentPart != nil { r.currentPart.Close() } @@ -325,7 +341,7 @@ func (r *Reader) NextPart() (*Part, error) { if r.isBoundaryDelimiterLine(line) { r.partsRead++ - bp, err := newPart(r) + bp, err := newPart(r, rawPart) if err != nil { return nil, err } diff --git a/src/mime/multipart/multipart_test.go b/src/mime/multipart/multipart_test.go index 5dc74b5ffe1..b60c54a2042 100644 --- a/src/mime/multipart/multipart_test.go +++ b/src/mime/multipart/multipart_test.go @@ -449,6 +449,66 @@ func testQuotedPrintableEncoding(t *testing.T, cte string) { } } +func TestRawPart(t *testing.T) { + // https://github.com/golang/go/issues/29090 + + body := strings.Replace(`--0016e68ee29c5d515f04cedf6733 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: quoted-printable + +

Hello World.
+--0016e68ee29c5d515f04cedf6733 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: quoted-printable + +
Hello World.
+--0016e68ee29c5d515f04cedf6733--`, "\n", "\r\n", -1) + + r := NewReader(strings.NewReader(body), "0016e68ee29c5d515f04cedf6733") + + // This part is expected to be raw, bypassing the automatic handling + // of quoted-printable. + part, err := r.NextRawPart() + if err != nil { + t.Fatal(err) + } + if _, ok := part.Header["Content-Transfer-Encoding"]; !ok { + t.Errorf("missing Content-Transfer-Encoding") + } + var buf bytes.Buffer + _, err = io.Copy(&buf, part) + if err != nil { + t.Error(err) + } + got := buf.String() + // Data is still quoted-printable. + want := `
Hello World.
` + if got != want { + t.Errorf("wrong part value:\n got: %q\nwant: %q", got, want) + } + + // This part is expected to have automatic decoding of quoted-printable. + part, err = r.NextPart() + if err != nil { + t.Fatal(err) + } + if te, ok := part.Header["Content-Transfer-Encoding"]; ok { + t.Errorf("unexpected Content-Transfer-Encoding of %q", te) + } + + buf.Reset() + _, err = io.Copy(&buf, part) + if err != nil { + t.Error(err) + } + got = buf.String() + // QP data has been decoded. + want = `
Hello World.
` + if got != want { + t.Errorf("wrong part value:\n got: %q\nwant: %q", got, want) + } +} + // Test parsing an image attachment from gmail, which previously failed. func TestNested(t *testing.T) { // nested-mime is the body part of a multipart/mixed email diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go index dfc1f88b2ae..0b247b623a7 100644 --- a/src/mime/type_unix.go +++ b/src/mime/type_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package mime diff --git a/src/naclmake.bash b/src/naclmake.bash deleted file mode 100755 index 5e6c3ce05e6..00000000000 --- a/src/naclmake.bash +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2016 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. - -# naclmake.bash builds runs make.bash for nacl, but not does run any -# tests. This is used by the continuous build. - -# Assumes that sel_ldr binaries and go_nacl_$GOARCH_exec scripts are in $PATH; -# see ../misc/nacl/README. - -set -e -ulimit -c 0 - -# guess GOARCH if not set -naclGOARCH=$GOARCH -if [ -z "$naclGOARCH" ]; then - case "$(uname -m)" in - x86_64) - naclGOARCH=amd64p32 - ;; - armv7l) # NativeClient on ARM only supports ARMv7A. - naclGOARCH=arm - ;; - i?86) - naclGOARCH=386 - ;; - esac -fi - -unset GOOS GOARCH -if [ ! -f make.bash ]; then - echo 'nacltest.bash must be run from $GOROOT/src' 1>&2 - exit 1 -fi - -# the builder might have set GOROOT_FINAL. -export GOROOT=$(pwd)/.. - -# Build zip file embedded in package syscall. -echo "##### Building fake file system zip for nacl" -rm -f syscall/fstest_nacl.go -GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4} -gobin=$GOROOT_BOOTSTRAP/bin -GOROOT=$GOROOT_BOOTSTRAP $gobin/go run ../misc/nacl/mkzip.go -p syscall -r .. ../misc/nacl/testzip.proto syscall/fstest_nacl.go - -# Run standard build and tests. -GOOS=nacl GOARCH=$naclGOARCH ./make.bash "$@" diff --git a/src/nacltest.bash b/src/nacltest.bash deleted file mode 100755 index dc245b484cb..00000000000 --- a/src/nacltest.bash +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2014 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. - -# For testing Native Client on builders or locally. -# Builds a test file system and embeds it into package syscall -# in every generated binary. -# -# Assumes that sel_ldr binaries and go_nacl_$GOARCH_exec scripts are in $PATH; -# see ../misc/nacl/README. - -set -e -ulimit -c 0 - -. ./naclmake.bash "$@" - -# Check GOARCH. -case "$naclGOARCH" in -amd64p32) - if ! which sel_ldr_x86_64 >/dev/null; then - echo 'cannot find sel_ldr_x86_64' 1>&2 - exit 1 - fi - ;; -386) - if ! which sel_ldr_x86_32 >/dev/null; then - echo 'cannot find sel_ldr_x86_32' 1>&2 - exit 1 - fi - ;; -arm) - if ! which sel_ldr_arm >/dev/null; then - echo 'cannot find sel_ldr_arm' 1>&2 - exit 1 - fi - ;; -*) - echo 'unsupported $GOARCH for nacl: '"$naclGOARCH" 1>&2 - exit 1 -esac - -if ! which go_nacl_${naclGOARCH}_exec >/dev/null; then - echo "cannot find go_nacl_${naclGOARCH}_exec, see ../misc/nacl/README." 1>&2 - exit 1 -fi - -export PATH=$(pwd)/../bin:$(pwd)/../misc/nacl:$PATH -GOROOT=$(../bin/go env GOROOT) -GOOS=nacl GOARCH=$naclGOARCH go tool dist test --no-rebuild - -rm -f syscall/fstest_nacl.go diff --git a/src/net/dial_test.go b/src/net/dial_test.go index 1bf96fd3ce3..5a8d0e09cad 100644 --- a/src/net/dial_test.go +++ b/src/net/dial_test.go @@ -763,11 +763,6 @@ func TestDialCancel(t *testing.T) { } mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - // nacl doesn't have external network access. - t.Skipf("skipping on %s", runtime.GOOS) - } - blackholeIPPort := JoinHostPort(slowDst4, "1234") if !supportsIPv4() { blackholeIPPort = JoinHostPort(slowDst6, "1234") @@ -923,7 +918,7 @@ func TestDialListenerAddr(t *testing.T) { func TestDialerControl(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/error_nacl.go b/src/net/error_nacl.go deleted file mode 100644 index caad133b774..00000000000 --- a/src/net/error_nacl.go +++ /dev/null @@ -1,9 +0,0 @@ -// 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. - -package net - -func isConnError(err error) bool { - return false -} diff --git a/src/net/error_posix.go b/src/net/error_posix.go index 70efa4c66fb..d709a273b73 100644 --- a/src/net/error_posix.go +++ b/src/net/error_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/error_test.go b/src/net/error_test.go index c4fee5aa5e5..89dcc2e6e6e 100644 --- a/src/net/error_test.go +++ b/src/net/error_test.go @@ -185,7 +185,7 @@ func TestDialError(t *testing.T) { func TestProtocolDialError(t *testing.T) { switch runtime.GOOS { - case "nacl", "solaris", "illumos": + case "solaris", "illumos": t.Skipf("not supported on %s", runtime.GOOS) } @@ -214,7 +214,7 @@ func TestProtocolDialError(t *testing.T) { func TestDialAddrError(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv4() || !supportsIPv6() { @@ -376,7 +376,7 @@ func TestListenPacketError(t *testing.T) { func TestProtocolListenError(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/fd_unix.go b/src/net/fd_unix.go index 4f59871f49f..a6d64538102 100644 --- a/src/net/fd_unix.go +++ b/src/net/fd_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package net diff --git a/src/net/file.go b/src/net/file.go index 81a44e1f3f3..c13332c188a 100644 --- a/src/net/file.go +++ b/src/net/file.go @@ -6,7 +6,7 @@ package net import "os" -// BUG(mikio): On JS, NaCl and Windows, the FileConn, FileListener and +// BUG(mikio): On JS and Windows, the FileConn, FileListener and // FilePacketConn functions are not implemented. type fileAddr string diff --git a/src/net/file_stub.go b/src/net/file_stub.go index 22566083658..bfb8100f53c 100644 --- a/src/net/file_stub.go +++ b/src/net/file_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/file_test.go b/src/net/file_test.go index cd717747af6..8c09c0da1bd 100644 --- a/src/net/file_test.go +++ b/src/net/file_test.go @@ -31,7 +31,7 @@ var fileConnTests = []struct { func TestFileConn(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -138,7 +138,7 @@ var fileListenerTests = []struct { func TestFileListener(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -230,7 +230,7 @@ var filePacketConnTests = []struct { func TestFilePacketConn(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -297,7 +297,7 @@ func TestFilePacketConn(t *testing.T) { // Issue 24483. func TestFileCloseRace(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if !testableNetwork("tcp") { diff --git a/src/net/hook_unix.go b/src/net/hook_unix.go index a1568319f3c..a28f1e066da 100644 --- a/src/net/hook_unix.go +++ b/src/net/hook_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package net diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 53cc5bd1b8c..ad00f0611b6 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -3881,7 +3881,7 @@ type http2ServeConnOpts struct { } func (o *http2ServeConnOpts) context() context.Context { - if o.Context != nil { + if o != nil && o.Context != nil { return o.Context } return context.Background() @@ -5979,7 +5979,11 @@ func (rws *http2responseWriterState) writeChunk(p []byte) (n int, err error) { clen = strconv.Itoa(len(p)) } _, hasContentType := rws.snapHeader["Content-Type"] - if !hasContentType && http2bodyAllowedForStatus(rws.status) && len(p) > 0 { + // If the Content-Encoding is non-blank, we shouldn't + // sniff the body. See Issue golang.org/issue/31753. + ce := rws.snapHeader.Get("Content-Encoding") + hasCE := len(ce) > 0 + if !hasCE && !hasContentType && http2bodyAllowedForStatus(rws.status) && len(p) > 0 { ctype = DetectContentType(p) } var date string @@ -6088,7 +6092,7 @@ const http2TrailerPrefix = "Trailer:" // trailers. That worked for a while, until we found the first major // user of Trailers in the wild: gRPC (using them only over http2), // and gRPC libraries permit setting trailers mid-stream without -// predeclarnig them. So: change of plans. We still permit the old +// predeclaring them. So: change of plans. We still permit the old // way, but we also permit this hack: if a Header() key begins with // "Trailer:", the suffix of that key is a Trailer. Because ':' is an // invalid token byte anyway, there is no ambiguity. (And it's already @@ -6388,7 +6392,7 @@ func (sc *http2serverConn) startPush(msg *http2startPushRequest) { // PUSH_PROMISE frames MUST only be sent on a peer-initiated stream that // is in either the "open" or "half-closed (remote)" state. if msg.parent.state != http2stateOpen && msg.parent.state != http2stateHalfClosedRemote { - // responseWriter.Push checks that the stream is peer-initiaed. + // responseWriter.Push checks that the stream is peer-initiated. msg.done <- http2errStreamClosed return } @@ -7705,6 +7709,8 @@ var ( // abort request body write, but send stream reset of cancel. http2errStopReqBodyWriteAndCancel = errors.New("http2: canceling request") + + http2errReqBodyTooLong = errors.New("http2: request body larger than specified content length") ) func (cs *http2clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) { @@ -7727,10 +7733,32 @@ func (cs *http2clientStream) writeRequestBody(body io.Reader, bodyCloser io.Clos req := cs.req hasTrailers := req.Trailer != nil + remainLen := http2actualContentLength(req) + hasContentLen := remainLen != -1 var sawEOF bool for !sawEOF { - n, err := body.Read(buf) + n, err := body.Read(buf[:len(buf)-1]) + if hasContentLen { + remainLen -= int64(n) + if remainLen == 0 && err == nil { + // The request body's Content-Length was predeclared and + // we just finished reading it all, but the underlying io.Reader + // returned the final chunk with a nil error (which is one of + // the two valid things a Reader can do at EOF). Because we'd prefer + // to send the END_STREAM bit early, double-check that we're actually + // at EOF. Subsequent reads should return (0, EOF) at this point. + // If either value is different, we return an error in one of two ways below. + var n1 int + n1, err = body.Read(buf[n:]) + remainLen -= int64(n1) + } + if remainLen < 0 { + err = http2errReqBodyTooLong + cc.writeStreamReset(cs.ID, http2ErrCodeCancel, err) + return err + } + } if err == io.EOF { sawEOF = true err = nil @@ -9831,7 +9859,7 @@ func (n *http2priorityNode) addBytes(b int64) { } // walkReadyInOrder iterates over the tree in priority order, calling f for each node -// with a non-empty write queue. When f returns true, this funcion returns true and the +// with a non-empty write queue. When f returns true, this function returns true and the // walk halts. tmp is used as scratch space for sorting. // // f(n, openParent) takes two arguments: the node to visit, n, and a bool that is true @@ -10148,7 +10176,8 @@ type http2randomWriteScheduler struct { zero http2writeQueue // sq contains the stream-specific queues, keyed by stream ID. - // When a stream is idle or closed, it's deleted from the map. + // When a stream is idle, closed, or emptied, it's deleted + // from the map. sq map[uint32]*http2writeQueue // pool of empty queues for reuse. @@ -10192,8 +10221,12 @@ func (ws *http2randomWriteScheduler) Pop() (http2FrameWriteRequest, bool) { return ws.zero.shift(), true } // Iterate over all non-idle streams until finding one that can be consumed. - for _, q := range ws.sq { + for streamID, q := range ws.sq { if wr, ok := q.consume(math.MaxInt32); ok { + if q.empty() { + delete(ws.sq, streamID) + ws.queuePool.put(q) + } return wr, true } } diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index 1d1449aa659..d060aa4732d 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -10,6 +10,7 @@ import ( "bufio" "bytes" "compress/gzip" + "compress/zlib" "context" "crypto/tls" "encoding/json" @@ -6161,6 +6162,110 @@ func TestUnsupportedTransferEncodingsReturn501(t *testing.T) { } } +func TestContentEncodingNoSniffing_h1(t *testing.T) { + testContentEncodingNoSniffing(t, h1Mode) +} + +func TestContentEncodingNoSniffing_h2(t *testing.T) { + testContentEncodingNoSniffing(t, h2Mode) +} + +// Issue 31753: don't sniff when Content-Encoding is set +func testContentEncodingNoSniffing(t *testing.T, h2 bool) { + setParallel(t) + defer afterTest(t) + + type setting struct { + name string + body []byte + + // setting contentEncoding as an interface instead of a string + // directly, so as to differentiate between 3 states: + // unset, empty string "" and set string "foo/bar". + contentEncoding interface{} + wantContentType string + } + + settings := []*setting{ + { + name: "gzip content-encoding, gzipped", // don't sniff. + contentEncoding: "application/gzip", + wantContentType: "", + body: func() []byte { + buf := new(bytes.Buffer) + gzw := gzip.NewWriter(buf) + gzw.Write([]byte("doctype html>

Hello

")) + gzw.Close() + return buf.Bytes() + }(), + }, + { + name: "zlib content-encoding, zlibbed", // don't sniff. + contentEncoding: "application/zlib", + wantContentType: "", + body: func() []byte { + buf := new(bytes.Buffer) + zw := zlib.NewWriter(buf) + zw.Write([]byte("doctype html>

Hello

")) + zw.Close() + return buf.Bytes() + }(), + }, + { + name: "no content-encoding", // must sniff. + wantContentType: "application/x-gzip", + body: func() []byte { + buf := new(bytes.Buffer) + gzw := gzip.NewWriter(buf) + gzw.Write([]byte("doctype html>

Hello

")) + gzw.Close() + return buf.Bytes() + }(), + }, + { + name: "phony content-encoding", // don't sniff. + contentEncoding: "foo/bar", + body: []byte("doctype html>

Hello

"), + }, + { + name: "empty but set content-encoding", + contentEncoding: "", + wantContentType: "audio/mpeg", + body: []byte("ID3"), + }, + } + + for _, tt := range settings { + t.Run(tt.name, func(t *testing.T) { + cst := newClientServerTest(t, h2, HandlerFunc(func(rw ResponseWriter, r *Request) { + if tt.contentEncoding != nil { + rw.Header().Set("Content-Encoding", tt.contentEncoding.(string)) + } + rw.Write(tt.body) + })) + defer cst.close() + + res, err := cst.c.Get(cst.ts.URL) + if err != nil { + t.Fatalf("Failed to fetch URL: %v", err) + } + defer res.Body.Close() + + if g, w := res.Header.Get("Content-Encoding"), tt.contentEncoding; g != w { + if w != nil { // The case where contentEncoding was set explicitly. + t.Errorf("Content-Encoding mismatch\n\tgot: %q\n\twant: %q", g, w) + } else if g != "" { // "" should be the equivalent when the contentEncoding is unset. + t.Errorf("Unexpected Content-Encoding %q", g) + } + } + + if g, w := res.Header.Get("Content-Type"), tt.wantContentType; g != w { + t.Errorf("Content-Type mismatch\n\tgot: %q\n\twant: %q", g, w) + } + }) + } +} + // fetchWireResponse is a helper for dialing to host, // sending http1ReqBody as the payload and retrieving // the response as it was sent on the wire. diff --git a/src/net/http/server.go b/src/net/http/server.go index 9fd86ed7cd2..6e319711800 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -1379,7 +1379,12 @@ func (cw *chunkWriter) writeHeader(p []byte) { if bodyAllowedForStatus(code) { // If no content type, apply sniffing algorithm to body. _, haveType := header["Content-Type"] - if !haveType && !hasTE && len(p) > 0 { + + // If the Content-Encoding was set and is non-blank, + // we shouldn't sniff the body. See Issue 31753. + ce := header.Get("Content-Encoding") + hasCE := len(ce) > 0 + if !hasCE && !haveType && !hasTE && len(p) > 0 { setHeader.contentType = DetectContentType(p) } } else { @@ -2886,8 +2891,6 @@ func (srv *Server) Serve(l net.Listener) error { } defer srv.trackListener(&l, false) - var tempDelay time.Duration // how long to sleep on accept failure - baseCtx := context.Background() if srv.BaseContext != nil { baseCtx = srv.BaseContext(origListener) @@ -2896,16 +2899,18 @@ func (srv *Server) Serve(l net.Listener) error { } } + var tempDelay time.Duration // how long to sleep on accept failure + ctx := context.WithValue(baseCtx, ServerContextKey, srv) for { - rw, e := l.Accept() - if e != nil { + rw, err := l.Accept() + if err != nil { select { case <-srv.getDoneChan(): return ErrServerClosed default: } - if ne, ok := e.(net.Error); ok && ne.Temporary() { + if ne, ok := err.(net.Error); ok && ne.Temporary() { if tempDelay == 0 { tempDelay = 5 * time.Millisecond } else { @@ -2914,11 +2919,11 @@ func (srv *Server) Serve(l net.Listener) error { if max := 1 * time.Second; tempDelay > max { tempDelay = max } - srv.logf("http: Accept error: %v; retrying in %v", e, tempDelay) + srv.logf("http: Accept error: %v; retrying in %v", err, tempDelay) time.Sleep(tempDelay) continue } - return e + return err } if cc := srv.ConnContext; cc != nil { ctx = cc(ctx, rw) diff --git a/src/net/interface.go b/src/net/interface.go index 58248560a25..914aaa010f3 100644 --- a/src/net/interface.go +++ b/src/net/interface.go @@ -10,7 +10,7 @@ import ( "time" ) -// BUG(mikio): On JS and NaCl, methods and functions related to +// BUG(mikio): On JS, methods and functions related to // Interface are not implemented. // BUG(mikio): On AIX, DragonFly BSD, NetBSD, OpenBSD, Plan 9 and diff --git a/src/net/interface_stub.go b/src/net/interface_stub.go index 0afaa80d632..ec58665e195 100644 --- a/src/net/interface_stub.go +++ b/src/net/interface_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/interface_test.go b/src/net/interface_test.go index 6cdfb6265ff..c34cd7432f7 100644 --- a/src/net/interface_test.go +++ b/src/net/interface_test.go @@ -290,7 +290,7 @@ func checkUnicastStats(ifStats *ifStats, uniStats *routeStats) error { func checkMulticastStats(ifStats *ifStats, uniStats, multiStats *routeStats) error { switch runtime.GOOS { - case "aix", "dragonfly", "nacl", "netbsd", "openbsd", "plan9", "solaris", "illumos": + case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "illumos": default: // Test the existence of connected multicast route // clones for IPv4. Unlike IPv6, IPv4 multicast diff --git a/src/net/internal/socktest/switch_unix.go b/src/net/internal/socktest/switch_unix.go index 0626aa06c08..7dc35184105 100644 --- a/src/net/internal/socktest/switch_unix.go +++ b/src/net/internal/socktest/switch_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package socktest diff --git a/src/net/internal/socktest/sys_unix.go b/src/net/internal/socktest/sys_unix.go index b96075bfe42..0525512bff9 100644 --- a/src/net/internal/socktest/sys_unix.go +++ b/src/net/internal/socktest/sys_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package socktest diff --git a/src/net/iprawsock.go b/src/net/iprawsock.go index 8a9c26559bd..f18331a1fd5 100644 --- a/src/net/iprawsock.go +++ b/src/net/iprawsock.go @@ -21,7 +21,7 @@ import ( // change the behavior of these methods; use Read or ReadMsgIP // instead. -// BUG(mikio): On JS, NaCl and Plan 9, methods and functions related +// BUG(mikio): On JS and Plan 9, methods and functions related // to IPConn are not implemented. // BUG(mikio): On Windows, the File method of IPConn is not diff --git a/src/net/iprawsock_posix.go b/src/net/iprawsock_posix.go index 2a5d49f4902..e653f6ae17b 100644 --- a/src/net/iprawsock_posix.go +++ b/src/net/iprawsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/ipsock_posix.go b/src/net/ipsock_posix.go index 947f4ef6148..5570ed118d0 100644 --- a/src/net/ipsock_posix.go +++ b/src/net/ipsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net @@ -134,7 +134,7 @@ func favoriteAddrFamily(network string, laddr, raddr sockaddr, mode string) (fam } func internetSocket(ctx context.Context, net string, laddr, raddr sockaddr, sotype, proto int, mode string, ctrlFn func(string, string, syscall.RawConn) error) (fd *netFD, err error) { - if (runtime.GOOS == "aix" || runtime.GOOS == "windows" || runtime.GOOS == "openbsd" || runtime.GOOS == "nacl") && mode == "dial" && raddr.isWildcard() { + if (runtime.GOOS == "aix" || runtime.GOOS == "windows" || runtime.GOOS == "openbsd") && mode == "dial" && raddr.isWildcard() { raddr = raddr.toLocal(net) } family, ipv6only := favoriteAddrFamily(net, laddr, raddr, mode) diff --git a/src/net/listen_test.go b/src/net/listen_test.go index fef2b6405fa..d8c72096ed1 100644 --- a/src/net/listen_test.go +++ b/src/net/listen_test.go @@ -224,7 +224,7 @@ var dualStackTCPListenerTests = []struct { // to be greater than or equal to 4.4. func TestDualStackTCPListener(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv4() || !supportsIPv6() { @@ -314,7 +314,7 @@ var dualStackUDPListenerTests = []struct { // to be greater than or equal to 4.4. func TestDualStackUDPListener(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv4() || !supportsIPv6() { @@ -532,7 +532,7 @@ func TestIPv4MulticastListener(t *testing.T) { testenv.MustHaveExternalNetwork(t) switch runtime.GOOS { - case "android", "nacl", "plan9": + case "android", "plan9": t.Skipf("not supported on %s", runtime.GOOS) case "solaris", "illumos": t.Skipf("not supported on solaris or illumos, see golang.org/issue/7399") @@ -733,7 +733,7 @@ func TestClosingListener(t *testing.T) { func TestListenConfigControl(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/lookup.go b/src/net/lookup.go index 24d0d25c3a2..9cebd10c87a 100644 --- a/src/net/lookup.go +++ b/src/net/lookup.go @@ -27,8 +27,7 @@ var protocols = map[string]int{ } // services contains minimal mappings between services names and port -// numbers for platforms that don't have a complete list of port numbers -// (some Solaris distros, nacl, etc). +// numbers for platforms that don't have a complete list of port numbers. // // See https://www.iana.org/assignments/service-names-port-numbers // diff --git a/src/net/lookup_fake.go b/src/net/lookup_fake.go index 6c8a151bcac..3b3c39bc7da 100644 --- a/src/net/lookup_fake.go +++ b/src/net/lookup_fake.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go index e85605fa2f9..b933291cea8 100644 --- a/src/net/lookup_test.go +++ b/src/net/lookup_test.go @@ -858,10 +858,6 @@ func TestLookupProtocol_Minimal(t *testing.T) { } func TestLookupNonLDH(t *testing.T) { - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } - defer dnsWaitGroup.Wait() if fixup := forceGoDNS(); fixup != nil { @@ -886,10 +882,6 @@ func TestLookupNonLDH(t *testing.T) { func TestLookupContextCancel(t *testing.T) { mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } - defer dnsWaitGroup.Wait() ctx, ctxCancel := context.WithCancel(context.Background()) @@ -911,9 +903,6 @@ func TestLookupContextCancel(t *testing.T) { // crashes if nil is used. func TestNilResolverLookup(t *testing.T) { mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } var r *Resolver = nil ctx := context.Background() @@ -933,10 +922,6 @@ func TestNilResolverLookup(t *testing.T) { // canceled lookups (see golang.org/issue/24178 for details). func TestLookupHostCancel(t *testing.T) { mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } - const ( google = "www.google.com" invalidDomain = "invalid.invalid" // RFC 2606 reserves .invalid diff --git a/src/net/mail/message.go b/src/net/mail/message.go index 75207db4342..0781310ed3f 100644 --- a/src/net/mail/message.go +++ b/src/net/mail/message.go @@ -79,7 +79,7 @@ func buildDateLayouts() { years := [...]string{"2006", "06"} // year = 4*DIGIT / 2*DIGIT seconds := [...]string{":05", ""} // second // "-0700 (MST)" is not in RFC 5322, but is common. - zones := [...]string{"-0700", "MST", "-0700 (MST)"} // zone = (("+" / "-") 4DIGIT) / "GMT" / ... + zones := [...]string{"-0700", "MST"} // zone = (("+" / "-") 4DIGIT) / "GMT" / ... for _, dow := range dows { for _, day := range days { @@ -98,6 +98,29 @@ func buildDateLayouts() { // ParseDate parses an RFC 5322 date string. func ParseDate(date string) (time.Time, error) { dateLayoutsBuildOnce.Do(buildDateLayouts) + // CR and LF must match and are tolerated anywhere in the date field. + date = strings.ReplaceAll(date, "\r\n", "") + if strings.Index(date, "\r") != -1 { + return time.Time{}, errors.New("mail: header has a CR without LF") + } + // Re-using some addrParser methods which support obsolete text, i.e. non-printable ASCII + p := addrParser{date, nil} + p.skipSpace() + + // RFC 5322: zone = (FWS ( "+" / "-" ) 4DIGIT) / obs-zone + // zone length is always 5 chars unless obsolete (obs-zone) + if ind := strings.IndexAny(p.s, "+-"); ind != -1 && len(p.s) >= ind+5 { + date = p.s[:ind+5] + p.s = p.s[ind+5:] + } else if ind := strings.Index(p.s, "T"); ind != -1 && len(p.s) >= ind+1 { + // The last letter T of the obsolete time zone is checked when no standard time zone is found. + // If T is misplaced, the date to parse is garbage. + date = p.s[:ind+1] + p.s = p.s[ind+1:] + } + if !p.skipCFWS() { + return time.Time{}, errors.New("mail: misformatted parenthetical comment") + } for _, layout := range dateLayouts { t, err := time.Parse(layout, date) if err == nil { diff --git a/src/net/mail/message_test.go b/src/net/mail/message_test.go index 2950bc4de92..fbdc4f70f80 100644 --- a/src/net/mail/message_test.go +++ b/src/net/mail/message_test.go @@ -124,6 +124,151 @@ func TestDateParsing(t *testing.T) { } } +func TestDateParsingCFWS(t *testing.T) { + tests := []struct { + dateStr string + exp time.Time + valid bool + }{ + // FWS-only. No date. + { + " ", + // nil is not allowed + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // FWS is allowed before optional day of week. + { + " Fri, 21 Nov 1997 09:55:06 -0600", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + true, + }, + { + "21 Nov 1997 09:55:06 -0600", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + true, + }, + { + "Fri 21 Nov 1997 09:55:06 -0600", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, // missing , + }, + // FWS is allowed before day of month but HTAB fails. + { + "Fri, 21 Nov 1997 09:55:06 -0600", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + true, + }, + // FWS is allowed before and after year but HTAB fails. + { + "Fri, 21 Nov 1997 09:55:06 -0600", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + true, + }, + // FWS is allowed before zone but HTAB is not handled. Obsolete timezone is handled. + { + "Fri, 21 Nov 1997 09:55:06 CST", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("CST", 0)), + true, + }, + // FWS is allowed after date and a CRLF is already replaced. + { + "Fri, 21 Nov 1997 09:55:06 CST (no leading FWS and a trailing CRLF) \r\n", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("CST", 0)), + true, + }, + // CFWS is a reduced set of US-ASCII where space and accentuated are obsolete. No error. + { + "Fri, 21 Nov 1997 09:55:06 -0600 (MDT and non-US-ASCII signs éèç )", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + true, + }, + // CFWS is allowed after zone including a nested comment. + // Trailing FWS is allowed. + { + "Fri, 21 Nov 1997 09:55:06 -0600 \r\n (thisisa(valid)cfws) \t ", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + true, + }, + // CRLF is incomplete and misplaced. + { + "Fri, 21 Nov 1997 \r 09:55:06 -0600 \r\n (thisisa(valid)cfws) \t ", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // CRLF is complete but misplaced. No error is returned. + { + "Fri, 21 Nov 199\r\n7 09:55:06 -0600 \r\n (thisisa(valid)cfws) \t ", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + true, // should be false in the strict interpretation of RFC 5322. + }, + // Invalid ASCII in date. + { + "Fri, 21 Nov 1997 ù 09:55:06 -0600 \r\n (thisisa(valid)cfws) \t ", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // CFWS chars () in date. + { + "Fri, 21 Nov () 1997 09:55:06 -0600 \r\n (thisisa(valid)cfws) \t ", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // Timezone is invalid but T is found in comment. + { + "Fri, 21 Nov 1997 09:55:06 -060 \r\n (Thisisa(valid)cfws) \t ", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // Date has no month. + { + "Fri, 21 1997 09:55:06 -0600", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // Invalid month : OCT iso Oct + { + "Fri, 21 OCT 1997 09:55:06 CST", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // A too short time zone. + { + "Fri, 21 Nov 1997 09:55:06 -060", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + // A too short obsolete time zone. + { + "Fri, 21 1997 09:55:06 GT", + time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)), + false, + }, + } + for _, test := range tests { + hdr := Header{ + "Date": []string{test.dateStr}, + } + date, err := hdr.Date() + if err != nil && test.valid { + t.Errorf("Header(Date: %s).Date(): %v", test.dateStr, err) + } else if err == nil && !date.Equal(test.exp) && test.valid { + t.Errorf("Header(Date: %s).Date() = %+v, want %+v", test.dateStr, date, test.exp) + } else if err == nil && !test.valid { // an invalid expression was tested + t.Errorf("Header(Date: %s).Date() did not return an error but %v", test.dateStr, date) + } + + date, err = ParseDate(test.dateStr) + if err != nil && test.valid { + t.Errorf("ParseDate(%s): %v", test.dateStr, err) + } else if err == nil && !test.valid { // an invalid expression was tested + t.Errorf("ParseDate(%s) did not return an error but %v", test.dateStr, date) + } else if err == nil && test.valid && !date.Equal(test.exp) { + t.Errorf("ParseDate(%s) = %+v, want %+v", test.dateStr, date, test.exp) + } + } +} + func TestAddressParsingError(t *testing.T) { mustErrTestCases := [...]struct { text string diff --git a/src/net/main_conf_test.go b/src/net/main_conf_test.go index b535046bda1..a92dff56c2a 100644 --- a/src/net/main_conf_test.go +++ b/src/net/main_conf_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !js,!nacl,!plan9,!windows +// +build !js,!plan9,!windows package net diff --git a/src/net/main_noconf_test.go b/src/net/main_noconf_test.go index 55e37708354..bac84aa3002 100644 --- a/src/net/main_noconf_test.go +++ b/src/net/main_noconf_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build js,wasm nacl plan9 windows +// +build js,wasm plan9 windows package net diff --git a/src/net/main_unix_test.go b/src/net/main_unix_test.go index 34a8a104e82..8b9897699c5 100644 --- a/src/net/main_unix_test.go +++ b/src/net/main_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package net diff --git a/src/net/net_test.go b/src/net/net_test.go index 463ae8856d2..a7406740f52 100644 --- a/src/net/net_test.go +++ b/src/net/net_test.go @@ -72,7 +72,7 @@ func TestCloseRead(t *testing.T) { func TestCloseWrite(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } @@ -285,7 +285,6 @@ func TestPacketConnClose(t *testing.T) { } } -// nacl was previous failing to reuse an address. func TestListenCloseListen(t *testing.T) { const maxTries = 10 for tries := 0; tries < maxTries; tries++ { @@ -302,7 +301,7 @@ func TestListenCloseListen(t *testing.T) { } ln, err = Listen("tcp", addr) if err == nil { - // Success. nacl couldn't do this before. + // Success. (This test didn't always make it here earlier.) ln.Close() return } @@ -541,7 +540,7 @@ func TestNotTemporaryRead(t *testing.T) { if err == nil { return errors.New("Read succeeded unexpectedly") } else if err == io.EOF { - // This happens on NaCl and Plan 9. + // This happens on Plan 9. return nil } else if ne, ok := err.(Error); !ok { return fmt.Errorf("unexpected error %v", err) diff --git a/src/net/platform_test.go b/src/net/platform_test.go index 10f55c971df..d35dfaade3e 100644 --- a/src/net/platform_test.go +++ b/src/net/platform_test.go @@ -37,13 +37,9 @@ func testableNetwork(network string) bool { ss := strings.Split(network, ":") switch ss[0] { case "ip+nopriv": - switch runtime.GOOS { - case "nacl": - return false - } case "ip", "ip4", "ip6": switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": return false default: if os.Getuid() != 0 { @@ -52,7 +48,7 @@ func testableNetwork(network string) bool { } case "unix", "unixgram": switch runtime.GOOS { - case "android", "nacl", "plan9", "windows": + case "android", "plan9", "windows": return false case "aix": return unixEnabledOnAIX @@ -63,7 +59,7 @@ func testableNetwork(network string) bool { } case "unixpacket": switch runtime.GOOS { - case "aix", "android", "darwin", "nacl", "plan9", "windows": + case "aix", "android", "darwin", "plan9", "windows": return false case "netbsd": // It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown. diff --git a/src/net/port_unix.go b/src/net/port_unix.go index a6153c0c206..4fdd9a37bc6 100644 --- a/src/net/port_unix.go +++ b/src/net/port_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris nacl +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris // Read system port mappings from /etc/services diff --git a/src/net/rawconn.go b/src/net/rawconn.go index c40ea4a2e12..c7863545826 100644 --- a/src/net/rawconn.go +++ b/src/net/rawconn.go @@ -15,7 +15,7 @@ import ( // deadlines. If the user-provided callback returns false, the Write // method will fail immediately. -// BUG(mikio): On JS, NaCl and Plan 9, the Control, Read and Write +// BUG(mikio): On JS and Plan 9, the Control, Read and Write // methods of syscall.RawConn are not implemented. type rawConn struct { diff --git a/src/net/rawconn_stub_test.go b/src/net/rawconn_stub_test.go index 0a033c12fc5..cec977f75d9 100644 --- a/src/net/rawconn_stub_test.go +++ b/src/net/rawconn_stub_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build js,wasm nacl plan9 +// +build js,wasm plan9 package net diff --git a/src/net/rawconn_test.go b/src/net/rawconn_test.go index 11900dff8dd..9a82f8f78e0 100644 --- a/src/net/rawconn_test.go +++ b/src/net/rawconn_test.go @@ -15,7 +15,7 @@ import ( func TestRawConnReadWrite(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } @@ -175,7 +175,7 @@ func TestRawConnReadWrite(t *testing.T) { func TestRawConnControl(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/sendfile_stub.go b/src/net/sendfile_stub.go index 6d338da454f..53bc53af43b 100644 --- a/src/net/sendfile_stub.go +++ b/src/net/sendfile_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin js,wasm nacl netbsd openbsd +// +build aix darwin js,wasm netbsd openbsd package net diff --git a/src/net/sendfile_test.go b/src/net/sendfile_test.go index 911e6139c57..13842a1261f 100644 --- a/src/net/sendfile_test.go +++ b/src/net/sendfile_test.go @@ -218,7 +218,7 @@ func TestSendfileSeeked(t *testing.T) { // Test that sendfile doesn't put a pipe into blocking mode. func TestSendfilePipe(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": // These systems don't support deadlines on pipes. t.Skipf("skipping on %s", runtime.GOOS) } diff --git a/src/net/sock_posix.go b/src/net/sock_posix.go index 00ee61883cd..80b4169ec64 100644 --- a/src/net/sock_posix.go +++ b/src/net/sock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows package net diff --git a/src/net/sock_stub.go b/src/net/sock_stub.go index bbce61b6879..c9f86af4e7c 100644 --- a/src/net/sock_stub.go +++ b/src/net/sock_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix nacl js,wasm solaris +// +build aix js,wasm solaris package net diff --git a/src/net/sockaddr_posix.go b/src/net/sockaddr_posix.go index ae83b5ab196..a3710dd3f74 100644 --- a/src/net/sockaddr_posix.go +++ b/src/net/sockaddr_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/sockopt_stub.go b/src/net/sockopt_stub.go index bc0667504af..52624a35d81 100644 --- a/src/net/sockopt_stub.go +++ b/src/net/sockopt_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/sockoptip_stub.go b/src/net/sockoptip_stub.go index 3297969314e..57cd2890405 100644 --- a/src/net/sockoptip_stub.go +++ b/src/net/sockoptip_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/sys_cloexec.go b/src/net/sys_cloexec.go index e97fb21a1f4..89aad7066af 100644 --- a/src/net/sys_cloexec.go +++ b/src/net/sys_cloexec.go @@ -5,7 +5,7 @@ // This file implements sysSocket and accept for platforms that do not // provide a fast path for setting SetNonblock and CloseOnExec. -// +build aix darwin nacl solaris +// +build aix darwin solaris package net diff --git a/src/net/tcpsock.go b/src/net/tcpsock.go index b7b73d0d817..9a9b03a1e89 100644 --- a/src/net/tcpsock.go +++ b/src/net/tcpsock.go @@ -12,7 +12,7 @@ import ( "time" ) -// BUG(mikio): On JS, NaCl and Windows, the File method of TCPConn and +// BUG(mikio): On JS and Windows, the File method of TCPConn and // TCPListener is not implemented. // TCPAddr represents the address of a TCP end point. diff --git a/src/net/tcpsock_posix.go b/src/net/tcpsock_posix.go index e32d5d7ee35..257c11976f4 100644 --- a/src/net/tcpsock_posix.go +++ b/src/net/tcpsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/tcpsock_test.go b/src/net/tcpsock_test.go index f78675b185d..8a704966931 100644 --- a/src/net/tcpsock_test.go +++ b/src/net/tcpsock_test.go @@ -476,10 +476,6 @@ func TestTCPReadWriteAllocs(t *testing.T) { // I/O on Plan 9 allocates memory. // See net/fd_io_plan9.go. t.Skipf("not supported on %s", runtime.GOOS) - case "nacl": - // NaCl needs to allocate pseudo file descriptor - // stuff. See syscall/fd_nacl.go. - t.Skipf("not supported on %s", runtime.GOOS) } ln, err := Listen("tcp", "127.0.0.1:0") diff --git a/src/net/tcpsockopt_stub.go b/src/net/tcpsockopt_stub.go index fd7f57923ba..d043da123d6 100644 --- a/src/net/tcpsockopt_stub.go +++ b/src/net/tcpsockopt_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/textproto/reader.go b/src/net/textproto/reader.go index 87f901b4fce..a505da985c2 100644 --- a/src/net/textproto/reader.go +++ b/src/net/textproto/reader.go @@ -7,6 +7,7 @@ package textproto import ( "bufio" "bytes" + "fmt" "io" "io/ioutil" "strconv" @@ -90,7 +91,7 @@ func (r *Reader) readLineSlice() ([]byte, error) { // A line consisting of only white space is never continued. // func (r *Reader) ReadContinuedLine() (string, error) { - line, err := r.readContinuedLineSlice() + line, err := r.readContinuedLineSlice(noValidation) return string(line), err } @@ -111,7 +112,7 @@ func trim(s []byte) []byte { // ReadContinuedLineBytes is like ReadContinuedLine but // returns a []byte instead of a string. func (r *Reader) ReadContinuedLineBytes() ([]byte, error) { - line, err := r.readContinuedLineSlice() + line, err := r.readContinuedLineSlice(noValidation) if line != nil { buf := make([]byte, len(line)) copy(buf, line) @@ -120,7 +121,15 @@ func (r *Reader) ReadContinuedLineBytes() ([]byte, error) { return line, err } -func (r *Reader) readContinuedLineSlice() ([]byte, error) { +// readContinuedLineSlice reads continued lines from the reader buffer, +// returning a byte slice with all lines. The validateFirstLine function +// is run on the first read line, and if it returns an error then this +// error is returned from readContinuedLineSlice. +func (r *Reader) readContinuedLineSlice(validateFirstLine func([]byte) error) ([]byte, error) { + if validateFirstLine == nil { + return nil, fmt.Errorf("missing validateFirstLine func") + } + // Read the first line. line, err := r.readLineSlice() if err != nil { @@ -130,6 +139,10 @@ func (r *Reader) readContinuedLineSlice() ([]byte, error) { return line, nil } + if err := validateFirstLine(line); err != nil { + return nil, err + } + // Optimistically assume that we have started to buffer the next line // and it starts with an ASCII letter (the next header key), or a blank // line, so we can avoid copying that buffered data around in memory @@ -490,7 +503,7 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) { } for { - kv, err := r.readContinuedLineSlice() + kv, err := r.readContinuedLineSlice(mustHaveFieldNameColon) if len(kv) == 0 { return m, err } @@ -535,6 +548,20 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) { } } +// noValidation is a no-op validation func for readContinuedLineSlice +// that permits any lines. +func noValidation(_ []byte) error { return nil } + +// mustHaveFieldNameColon ensures that, per RFC 7230, the +// field-name is on a single line, so the first line must +// contain a colon. +func mustHaveFieldNameColon(line []byte) error { + if bytes.IndexByte(line, ':') < 0 { + return ProtocolError(fmt.Sprintf("malformed MIME header: missing colon: %q" + string(line))) + } + return nil +} + // upcomingHeaderNewlines returns an approximation of the number of newlines // that will be in this header. If it gets confused, it returns 0. func (r *Reader) upcomingHeaderNewlines() (n int) { diff --git a/src/net/textproto/reader_test.go b/src/net/textproto/reader_test.go index 97fb1ab0281..595d94f938a 100644 --- a/src/net/textproto/reader_test.go +++ b/src/net/textproto/reader_test.go @@ -218,6 +218,10 @@ func TestReadMIMEHeaderMalformed(t *testing.T) { " First: line with leading space\r\nFoo: foo\r\n\r\n", "\tFirst: line with leading tab\r\nFoo: foo\r\n\r\n", "Foo: foo\r\nNo colon second line\r\n\r\n", + "Foo-\n\tBar: foo\r\n\r\n", + "Foo-\r\n\tBar: foo\r\n\r\n", + "Foo\r\n\t: foo\r\n\r\n", + "Foo-\n\tBar", } for _, input := range inputs { diff --git a/src/net/timeout_test.go b/src/net/timeout_test.go index b4fc2c01981..e90c16f34b1 100644 --- a/src/net/timeout_test.go +++ b/src/net/timeout_test.go @@ -411,9 +411,6 @@ func TestReadTimeoutMustNotReturn(t *testing.T) { if perr := parseReadError(err); perr != nil { t.Error(perr) } - if err == io.EOF && runtime.GOOS == "nacl" { // see golang.org/issue/8044 - return - } if nerr, ok := err.(Error); !ok || nerr.Timeout() || nerr.Temporary() { t.Fatal(err) } @@ -432,11 +429,6 @@ var readFromTimeoutTests = []struct { } func TestReadFromTimeout(t *testing.T) { - switch runtime.GOOS { - case "nacl": - t.Skipf("not supported on %s", runtime.GOOS) // see golang.org/issue/8916 - } - ch := make(chan Addr) defer close(ch) handler := func(ls *localPacketServer, c PacketConn) { @@ -621,11 +613,6 @@ var writeToTimeoutTests = []struct { func TestWriteToTimeout(t *testing.T) { t.Parallel() - switch runtime.GOOS { - case "nacl": - t.Skipf("not supported on %s", runtime.GOOS) - } - c1, err := newLocalPacketListener("udp") if err != nil { t.Fatal(err) @@ -991,11 +978,6 @@ func TestReadWriteProlongedTimeout(t *testing.T) { func TestReadWriteDeadlineRace(t *testing.T) { t.Parallel() - switch runtime.GOOS { - case "nacl": - t.Skipf("not supported on %s", runtime.GOOS) - } - N := 1000 if testing.Short() { N = 50 diff --git a/src/net/udpsock.go b/src/net/udpsock.go index b234ed89abf..ec2bcfa607b 100644 --- a/src/net/udpsock.go +++ b/src/net/udpsock.go @@ -9,15 +9,12 @@ import ( "syscall" ) -// BUG(mikio): On NaCl and Plan 9, the ReadMsgUDP and +// BUG(mikio): On Plan 9, the ReadMsgUDP and // WriteMsgUDP methods of UDPConn are not implemented. // BUG(mikio): On Windows, the File method of UDPConn is not // implemented. -// BUG(mikio): On NaCl, the ListenMulticastUDP function is not -// implemented. - // BUG(mikio): On JS, methods and functions related to UDPConn are not // implemented. diff --git a/src/net/udpsock_posix.go b/src/net/udpsock_posix.go index 611fe51df91..bbfa4ed9c73 100644 --- a/src/net/udpsock_posix.go +++ b/src/net/udpsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/udpsock_test.go b/src/net/udpsock_test.go index 397b6649cda..947381a57b0 100644 --- a/src/net/udpsock_test.go +++ b/src/net/udpsock_test.go @@ -162,13 +162,8 @@ func testWriteToConn(t *testing.T, raddr string) { t.Fatalf("should fail as ErrWriteToConnected: %v", err) } _, _, err = c.(*UDPConn).WriteMsgUDP(b, nil, nil) - switch runtime.GOOS { - case "nacl": // see golang.org/issue/9252 - t.Skipf("not implemented yet on %s", runtime.GOOS) - default: - if err != nil { - t.Fatal(err) - } + if err != nil { + t.Fatal(err) } } @@ -205,13 +200,8 @@ func testWriteToPacketConn(t *testing.T, raddr string) { t.Fatalf("should fail as errMissingAddress: %v", err) } _, _, err = c.(*UDPConn).WriteMsgUDP(b, nil, ra) - switch runtime.GOOS { - case "nacl": // see golang.org/issue/9252 - t.Skipf("not implemented yet on %s", runtime.GOOS) - default: - if err != nil { - t.Fatal(err) - } + if err != nil { + t.Fatal(err) } } @@ -335,7 +325,7 @@ func TestIPv6LinkLocalUnicastUDP(t *testing.T) { func TestUDPZeroBytePayload(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) case "darwin": testenv.SkipFlaky(t, 29225) @@ -373,7 +363,7 @@ func TestUDPZeroBytePayload(t *testing.T) { func TestUDPZeroByteBuffer(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } @@ -410,7 +400,7 @@ func TestUDPZeroByteBuffer(t *testing.T) { func TestUDPReadSizeError(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/unixsock.go b/src/net/unixsock.go index ae912a46ddb..b38438c11a8 100644 --- a/src/net/unixsock.go +++ b/src/net/unixsock.go @@ -12,7 +12,7 @@ import ( "time" ) -// BUG(mikio): On JS, NaCl and Plan 9, methods and functions related +// BUG(mikio): On JS and Plan 9, methods and functions related // to UnixConn and UnixListener are not implemented. // BUG(mikio): On Windows, methods and functions related to UnixConn diff --git a/src/net/unixsock_posix.go b/src/net/unixsock_posix.go index 74f5cc231cf..275c7c936d1 100644 --- a/src/net/unixsock_posix.go +++ b/src/net/unixsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/unixsock_test.go b/src/net/unixsock_test.go index 48289903107..80cccf21e3d 100644 --- a/src/net/unixsock_test.go +++ b/src/net/unixsock_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !js,!nacl,!plan9,!windows +// +build !js,!plan9,!windows package net diff --git a/src/os/dir_unix.go b/src/os/dir_unix.go index b2c8fe6f151..e0c4989756b 100644 --- a/src/os/dir_unix.go +++ b/src/os/dir_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/error_posix.go b/src/os/error_posix.go index 0478ba676aa..2aeca823043 100644 --- a/src/os/error_posix.go +++ b/src/os/error_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package os diff --git a/src/os/error_unix_test.go b/src/os/error_unix_test.go index c47af563320..bfc83c98673 100644 --- a/src/os/error_unix_test.go +++ b/src/os/error_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os_test diff --git a/src/os/exec/lp_unix.go b/src/os/exec/lp_unix.go index 799e0b4eeb9..93793e0eee6 100644 --- a/src/os/exec/lp_unix.go +++ b/src/os/exec/lp_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package exec diff --git a/src/os/exec_posix.go b/src/os/exec_posix.go index 505931b4883..f6c7a49c1b3 100644 --- a/src/os/exec_posix.go +++ b/src/os/exec_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package os diff --git a/src/os/exec_unix.go b/src/os/exec_unix.go index abae5a2feb3..6e4ffe82d26 100644 --- a/src/os/exec_unix.go +++ b/src/os/exec_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/executable.go b/src/os/executable.go index 17eed10bc9f..cc3134af1c1 100644 --- a/src/os/executable.go +++ b/src/os/executable.go @@ -15,8 +15,6 @@ package os // // The main use case is finding resources located relative to an // executable. -// -// Executable is not supported on nacl. func Executable() (string, error) { return executable() } diff --git a/src/os/executable_procfs.go b/src/os/executable_procfs.go index 5bb63b9bdc5..2628223b8db 100644 --- a/src/os/executable_procfs.go +++ b/src/os/executable_procfs.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux netbsd dragonfly nacl js,wasm +// +build linux netbsd dragonfly js,wasm package os diff --git a/src/os/executable_test.go b/src/os/executable_test.go index d513c8760ee..f25ee0c95a1 100644 --- a/src/os/executable_test.go +++ b/src/os/executable_test.go @@ -17,7 +17,7 @@ import ( const executable_EnvVar = "OSTEST_OUTPUT_EXECPATH" func TestExecutable(t *testing.T) { - testenv.MustHaveExec(t) // will also exclude nacl, which doesn't support Executable anyway + testenv.MustHaveExec(t) ep, err := os.Executable() if err != nil { t.Fatalf("Executable failed: %v", err) diff --git a/src/os/export_unix_test.go b/src/os/export_unix_test.go index 032b1a9dbff..39866a68deb 100644 --- a/src/os/export_unix_test.go +++ b/src/os/export_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/file.go b/src/os/file.go index 9afc0ba360b..51e0993f367 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -475,8 +475,6 @@ func UserHomeDir() (string, error) { } // On some geese the home directory is not always defined. switch runtime.GOOS { - case "nacl": - return "/", nil case "android": return "/sdcard", nil case "darwin": diff --git a/src/os/file_posix.go b/src/os/file_posix.go index 23430792191..c3635ddd289 100644 --- a/src/os/file_posix.go +++ b/src/os/file_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package os diff --git a/src/os/file_unix.go b/src/os/file_unix.go index 754e8596453..042c2997db3 100644 --- a/src/os/file_unix.go +++ b/src/os/file_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/os_test.go b/src/os/os_test.go index 974374ec667..ae6bad1fee9 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -1159,9 +1159,7 @@ func testChtimes(t *testing.T, name string) { pmt := postStat.ModTime() if !pat.Before(at) { switch runtime.GOOS { - case "plan9", "nacl": - // Ignore. - // Plan 9, NaCl: + case "plan9": // Mtime is the time of the last change of // content. Similarly, atime is set whenever // the contents are accessed; also, it is set @@ -1351,10 +1349,6 @@ func TestSeek(t *testing.T) { {0, io.SeekCurrent, 2<<32 - 1}, } for i, tt := range tests { - if runtime.GOOS == "nacl" && tt.out > 1<<30 { - t.Logf("skipping test case #%d on nacl; https://golang.org/issue/21728", i) - continue - } off, err := f.Seek(tt.in, tt.whence) if off != tt.out || err != nil { if e, ok := err.(*PathError); ok && e.Err == syscall.EINVAL && tt.out > 1<<32 && runtime.GOOS == "linux" { @@ -1371,7 +1365,7 @@ func TestSeek(t *testing.T) { func TestSeekError(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9": + case "js", "plan9": t.Skipf("skipping test on %v", runtime.GOOS) } @@ -2254,8 +2248,6 @@ func TestPipeThreads(t *testing.T) { t.Skip("skipping on Plan 9; does not support runtime poller") case "js": t.Skip("skipping on js; no support for os.Pipe") - case "darwin": - t.Skip("skipping on Darwin; issue 33953") } threads := 100 diff --git a/src/os/path_unix.go b/src/os/path_unix.go index df423d2c9da..c99a8240c53 100644 --- a/src/os/path_unix.go +++ b/src/os/path_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/pipe_bsd.go b/src/os/pipe_bsd.go index dc4c951a286..0d2d82feb95 100644 --- a/src/os/pipe_bsd.go +++ b/src/os/pipe_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly js,wasm nacl solaris +// +build aix darwin dragonfly js,wasm solaris package os diff --git a/src/os/pipe_test.go b/src/os/pipe_test.go index 4c53bc985d2..114c181c4ae 100644 --- a/src/os/pipe_test.go +++ b/src/os/pipe_test.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Test broken pipes on Unix systems. -// +build !plan9,!nacl,!js +// +build !plan9,!js package os_test diff --git a/src/os/rawconn_test.go b/src/os/rawconn_test.go index 820150d959b..2554f5b0878 100644 --- a/src/os/rawconn_test.go +++ b/src/os/rawconn_test.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Test use of raw connections. -// +build !plan9,!nacl,!js +// +build !plan9,!js package os_test diff --git a/src/os/removeall_test.go b/src/os/removeall_test.go index 4d556f977e4..8700b6af178 100644 --- a/src/os/removeall_test.go +++ b/src/os/removeall_test.go @@ -289,7 +289,7 @@ func TestRemoveReadOnlyDir(t *testing.T) { // Issue #29983. func TestRemoveAllButReadOnlyAndPathError(t *testing.T) { switch runtime.GOOS { - case "nacl", "js", "windows": + case "js", "windows": t.Skipf("skipping test on %s", runtime.GOOS) } @@ -379,7 +379,7 @@ func TestRemoveAllButReadOnlyAndPathError(t *testing.T) { func TestRemoveUnreadableDir(t *testing.T) { switch runtime.GOOS { - case "nacl", "js", "windows": + case "js", "windows": t.Skipf("skipping test on %s", runtime.GOOS) } diff --git a/src/os/signal/signal_unix.go b/src/os/signal/signal_unix.go index 0bbf41bfde5..89ee2d9e185 100644 --- a/src/os/signal/signal_unix.go +++ b/src/os/signal/signal_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package signal diff --git a/src/os/stat_nacljs.go b/src/os/stat_js.go similarity index 98% rename from src/os/stat_nacljs.go rename to src/os/stat_js.go index f14add8674a..8d20ccddfcc 100644 --- a/src/os/stat_nacljs.go +++ b/src/os/stat_js.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build js,wasm nacl +// +build js,wasm package os diff --git a/src/os/stat_unix.go b/src/os/stat_unix.go index 4f85dcea077..0a7e6029ac2 100644 --- a/src/os/stat_unix.go +++ b/src/os/stat_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/sys_bsd.go b/src/os/sys_bsd.go index d820be2ab67..b1698f5d4c7 100644 --- a/src/os/sys_bsd.go +++ b/src/os/sys_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd js,wasm nacl netbsd openbsd +// +build darwin dragonfly freebsd js,wasm netbsd openbsd package os diff --git a/src/os/sys_nacl.go b/src/os/sys_nacl.go deleted file mode 100644 index 07907c84771..00000000000 --- a/src/os/sys_nacl.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2014 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 os - -// supportsCloseOnExec reports whether the platform supports the -// O_CLOEXEC flag. -const supportsCloseOnExec = false diff --git a/src/os/timeout_test.go b/src/os/timeout_test.go index 5d7ea7ea29c..0fe03fa517f 100644 --- a/src/os/timeout_test.go +++ b/src/os/timeout_test.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl // +build !js // +build !plan9 // +build !windows diff --git a/src/os/user/lookup_stubs.go b/src/os/user/lookup_stubs.go index 7164514828f..178d814dda0 100644 --- a/src/os/user/lookup_stubs.go +++ b/src/os/user/lookup_stubs.go @@ -35,15 +35,8 @@ func current() (*User, error) { Name: "", // ignored HomeDir: homeDir, } - // On NaCL and Android, return a dummy user instead of failing. + // On Android, return a dummy user instead of failing. switch runtime.GOOS { - case "nacl": - if u.Uid == "" { - u.Uid = "1" - } - if u.Username == "" { - u.Username = "nacl" - } case "android": if u.Uid == "" { u.Uid = "1" diff --git a/src/os/user/lookup_unix.go b/src/os/user/lookup_unix.go index be62f4d0c3e..0890cd8f2bf 100644 --- a/src/os/user/lookup_unix.go +++ b/src/os/user/lookup_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm !android,linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm !android,linux netbsd openbsd solaris // +build !cgo osusergo package user diff --git a/src/os/user/lookup_unix_test.go b/src/os/user/lookup_unix_test.go index 65fe0656de6..72d3b475344 100644 --- a/src/os/user/lookup_unix_test.go +++ b/src/os/user/lookup_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd !android,linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris // +build !cgo package user diff --git a/src/os/wait_unimp.go b/src/os/wait_unimp.go index 469abf76401..0f4cdc45339 100644 --- a/src/os/wait_unimp.go +++ b/src/os/wait_unimp.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly js,wasm nacl netbsd openbsd solaris +// +build aix darwin dragonfly js,wasm netbsd openbsd solaris package os diff --git a/src/path/filepath/path_unix.go b/src/path/filepath/path_unix.go index c10b3288a1e..ec497d9e26b 100644 --- a/src/path/filepath/path_unix.go +++ b/src/path/filepath/path_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package filepath diff --git a/src/plugin/plugin_test.go b/src/plugin/plugin_test.go index b334c5cf0ec..30b79edaad7 100644 --- a/src/plugin/plugin_test.go +++ b/src/plugin/plugin_test.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl // +build !linux linux,!arm64 package plugin_test diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 7c5dd59aa78..b6010f92654 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -6104,9 +6104,6 @@ var funcLayoutTests []funcLayoutTest func init() { var argAlign uintptr = PtrSize - if runtime.GOARCH == "amd64p32" { - argAlign = 2 * PtrSize - } roundup := func(x uintptr, a uintptr) uintptr { return (x + a - 1) / a * a } @@ -6416,7 +6413,7 @@ func TestGCBits(t *testing.T) { join(hdr, rep(8, lit(0, 1)), rep(8, lit(1)), lit(1))) verifyMapBucket(t, Tint64, Tptr, map[int64]Xptr(nil), - join(hdr, rep(8, rep(8/PtrSize, lit(0))), rep(8, lit(1)), naclpad(), lit(1))) + join(hdr, rep(8, rep(8/PtrSize, lit(0))), rep(8, lit(1)), lit(1))) verifyMapBucket(t, Tscalar, Tscalar, map[Xscalar]Xscalar(nil), @@ -6443,13 +6440,6 @@ func TestGCBits(t *testing.T) { join(hdr, rep(8, lit(1)), rep(8, lit(1)), lit(1))) } -func naclpad() []byte { - if runtime.GOARCH == "amd64p32" { - return lit(0) - } - return nil -} - func rep(n int, b []byte) []byte { return bytes.Repeat(b, n) } func join(b ...[]byte) []byte { return bytes.Join(b, nil) } func lit(x ...byte) []byte { return x } diff --git a/src/reflect/asm_amd64p32.s b/src/reflect/asm_amd64p32.s deleted file mode 100644 index e79beb6dc99..00000000000 --- a/src/reflect/asm_amd64p32.s +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 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. - -#include "textflag.h" -#include "funcdata.h" - -// makeFuncStub is the code half of the function returned by MakeFunc. -// See the comment on the declaration of makeFuncStub in makefunc.go -// for more details. -// No argsize here, gc generates argsize info at call site. -TEXT ·makeFuncStub(SB),(NOSPLIT|WRAPPER),$16 - NO_LOCAL_POINTERS - MOVL DX, 0(SP) - LEAL argframe+0(FP), CX - MOVL CX, 4(SP) - MOVB $0, 12(SP) - LEAL 12(SP), AX - MOVL AX, 8(SP) - CALL ·callReflect(SB) - RET - -// methodValueCall is the code half of the function returned by makeMethodValue. -// See the comment on the declaration of methodValueCall in makefunc.go -// for more details. -// No argsize here, gc generates argsize info at call site. -TEXT ·methodValueCall(SB),(NOSPLIT|WRAPPER),$16 - NO_LOCAL_POINTERS - MOVL DX, 0(SP) - LEAL argframe+0(FP), CX - MOVL CX, 4(SP) - MOVB $0, 12(SP) - LEAL 12(SP), AX - MOVL AX, 8(SP) - CALL ·callMethod(SB) - RET diff --git a/src/reflect/type.go b/src/reflect/type.go index f1f8ba93a44..231b38b898a 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -16,7 +16,6 @@ package reflect import ( - "runtime" "strconv" "sync" "unicode" @@ -2168,11 +2167,6 @@ func bucketOf(ktyp, etyp *rtype) *rtype { var ptrdata uintptr var overflowPad uintptr - // On NaCl, pad if needed to make overflow end at the proper struct alignment. - // On other systems, align > ptrSize is not possible. - if runtime.GOARCH == "amd64p32" && (ktyp.align > ptrSize || etyp.align > ptrSize) { - overflowPad = ptrSize - } size := bucketSize*(1+ktyp.size+etyp.size) + overflowPad + ptrSize if size&uintptr(ktyp.align-1) != 0 || size&uintptr(etyp.align-1) != 0 { panic("reflect: bad size computation in MapOf") @@ -3020,9 +3014,6 @@ func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset offset += arg.size } argSize = offset - if runtime.GOARCH == "amd64p32" { - offset += -offset & (8 - 1) - } offset += -offset & (ptrSize - 1) retOffset = offset for _, res := range t.out() { @@ -3038,9 +3029,6 @@ func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset size: offset, ptrdata: uintptr(ptrmap.n) * ptrSize, } - if runtime.GOARCH == "amd64p32" { - x.align = 8 - } if ptrmap.n > 0 { x.gcdata = &ptrmap.data[0] } diff --git a/src/reflect/value.go b/src/reflect/value.go index 7fec09962ce..ffcb204cda5 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -555,9 +555,6 @@ func callReflect(ctxt *makeFuncImpl, frame unsafe.Pointer, retValid *bool) { // Copy results back into argument frame. if numOut > 0 { off += -off & (ptrSize - 1) - if runtime.GOARCH == "amd64p32" { - off = align(off, 8) - } for i, typ := range ftyp.out() { v := out[i] if v.typ == nil { @@ -697,8 +694,7 @@ func callMethod(ctxt *methodValue, frame unsafe.Pointer, retValid *bool) { // Copy in receiver and rest of args. storeRcvr(rcvr, scratch) - // Align the first arg. Only on amd64p32 the alignment can be - // larger than ptrSize. + // Align the first arg. The alignment can't be larger than ptrSize. argOffset := uintptr(ptrSize) if len(t.in()) > 0 { argOffset = align(argOffset, uintptr(t.in()[0].align)) @@ -713,17 +709,11 @@ func callMethod(ctxt *methodValue, frame unsafe.Pointer, retValid *bool) { // and then copies the results back into scratch. call(frametype, fn, scratch, uint32(frametype.size), uint32(retOffset)) - // Copy return values. On amd64p32, the beginning of return values - // is 64-bit aligned, so the caller's frame layout (which doesn't have - // a receiver) is different from the layout of the fn call, which has - // a receiver. + // Copy return values. // Ignore any changes to args and just copy return values. // Avoid constructing out-of-bounds pointers if there are no return values. if frametype.size-retOffset > 0 { callerRetOffset := retOffset - argOffset - if runtime.GOARCH == "amd64p32" { - callerRetOffset = align(argSize-argOffset, 8) - } // This copies to the stack. Write barriers are not needed. memmove(add(frame, callerRetOffset, "frametype.size > retOffset"), add(scratch, retOffset, "frametype.size > retOffset"), diff --git a/src/runtime/alg.go b/src/runtime/alg.go index 935d45d5039..56a82129810 100644 --- a/src/runtime/alg.go +++ b/src/runtime/alg.go @@ -321,7 +321,6 @@ var hashkey [4]uintptr func alginit() { // Install AES hash algorithms if the instructions needed are present. if (GOARCH == "386" || GOARCH == "amd64") && - GOOS != "nacl" && cpu.X86.HasAES && // AESENC cpu.X86.HasSSSE3 && // PSHUFB cpu.X86.HasSSE41 { // PINSR{D,Q} diff --git a/src/runtime/asm.s b/src/runtime/asm.s index c886d4e7222..95a3424de26 100644 --- a/src/runtime/asm.s +++ b/src/runtime/asm.s @@ -19,9 +19,6 @@ GLOBL runtime·no_pointers_stackmap(SB),RODATA, $8 #ifdef GOARCH_386 #define SKIP4 BYTE $0x90; BYTE $0x90; BYTE $0x90; BYTE $0x90 #endif -#ifdef GOARCH_amd64p32 -#define SKIP4 BYTE $0x90; BYTE $0x90; BYTE $0x90; BYTE $0x90 -#endif #ifdef GOARCH_wasm #define SKIP4 UNDEF; UNDEF; UNDEF; UNDEF #endif diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index b31ea41ad4a..8f0ec08f80d 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -109,9 +109,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 MOVL SP, (g_stack+stack_hi)(BP) // find out information about the processor we're on -#ifdef GOOS_nacl // NaCl doesn't like PUSHFL/POPFL - JMP has_cpuid -#else // first see if CPUID instruction is supported. PUSHFL PUSHFL @@ -123,7 +120,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 POPFL // restore EFLAGS TESTL $(1<<21), AX JNE has_cpuid -#endif bad_proc: // show that the program requires MMX. MOVL $2, 0(SP) diff --git a/src/runtime/asm_amd64p32.s b/src/runtime/asm_amd64p32.s deleted file mode 100644 index 34c9c64af67..00000000000 --- a/src/runtime/asm_amd64p32.s +++ /dev/null @@ -1,759 +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. - -#include "go_asm.h" -#include "go_tls.h" -#include "funcdata.h" -#include "textflag.h" - -TEXT runtime·rt0_go(SB),NOSPLIT,$0 - // copy arguments forward on an even stack - MOVL SP, CX - MOVL 8(CX), AX // argc - MOVL 12(CX), BX // argv - SUBL $128, CX // plenty of scratch - ANDL $~15, CX - MOVL CX, SP - - MOVL AX, 16(SP) - MOVL BX, 24(SP) - - // create istack out of the given (operating system) stack. - MOVL $runtime·g0(SB), DI - LEAL (-64*1024+104)(SP), BX - MOVL BX, g_stackguard0(DI) - MOVL BX, g_stackguard1(DI) - MOVL BX, (g_stack+stack_lo)(DI) - MOVL SP, (g_stack+stack_hi)(DI) - - // find out information about the processor we're on - MOVL $0, AX - CPUID - CMPL AX, $0 - JE nocpuinfo - - CMPL BX, $0x756E6547 // "Genu" - JNE notintel - CMPL DX, $0x49656E69 // "ineI" - JNE notintel - CMPL CX, $0x6C65746E // "ntel" - JNE notintel - MOVB $1, runtime·isIntel(SB) -notintel: - - // Load EAX=1 cpuid flags - MOVL $1, AX - CPUID - MOVL AX, runtime·processorVersionInfo(SB) - -nocpuinfo: - LEAL runtime·m0+m_tls(SB), DI - CALL runtime·settls(SB) - - // store through it, to make sure it works - get_tls(BX) - MOVQ $0x123, g(BX) - MOVQ runtime·m0+m_tls(SB), AX - CMPQ AX, $0x123 - JEQ 2(PC) - CALL runtime·abort(SB) -ok: - // set the per-goroutine and per-mach "registers" - get_tls(BX) - LEAL runtime·g0(SB), CX - MOVL CX, g(BX) - LEAL runtime·m0(SB), AX - - // save m->g0 = g0 - MOVL CX, m_g0(AX) - // save m0 to g0->m - MOVL AX, g_m(CX) - - CLD // convention is D is always left cleared - CALL runtime·check(SB) - - MOVL 16(SP), AX // copy argc - MOVL AX, 0(SP) - MOVL 24(SP), AX // copy argv - MOVL AX, 4(SP) - CALL runtime·args(SB) - CALL runtime·osinit(SB) - CALL runtime·schedinit(SB) - - // create a new goroutine to start program - MOVL $runtime·mainPC(SB), AX // entry - MOVL $0, 0(SP) - MOVL AX, 4(SP) - CALL runtime·newproc(SB) - - // start this M - CALL runtime·mstart(SB) - - MOVL $0xf1, 0xf1 // crash - RET - -DATA runtime·mainPC+0(SB)/4,$runtime·main(SB) -GLOBL runtime·mainPC(SB),RODATA,$4 - -TEXT runtime·breakpoint(SB),NOSPLIT,$0-0 - INT $3 - RET - -TEXT runtime·asminit(SB),NOSPLIT,$0-0 - // No per-thread init. - RET - -/* - * go-routine - */ - -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT, $0-4 - MOVL buf+0(FP), AX // gobuf - LEAL buf+0(FP), BX // caller's SP - MOVL BX, gobuf_sp(AX) - MOVL 0(SP), BX // caller's PC - MOVL BX, gobuf_pc(AX) - MOVQ $0, gobuf_ret(AX) - // Assert ctxt is zero. See func save. - MOVL gobuf_ctxt(AX), BX - TESTL BX, BX - JZ 2(PC) - CALL runtime·badctxt(SB) - get_tls(CX) - MOVL g(CX), BX - MOVL BX, gobuf_g(AX) - RET - -// void gogo(Gobuf*) -// restore state from Gobuf; longjmp -TEXT runtime·gogo(SB), NOSPLIT, $8-4 - MOVL buf+0(FP), BX // gobuf - MOVL gobuf_g(BX), DX - MOVL 0(DX), CX // make sure g != nil - get_tls(CX) - MOVL DX, g(CX) - MOVL gobuf_sp(BX), SP // restore SP - MOVL gobuf_ctxt(BX), DX - MOVQ gobuf_ret(BX), AX - MOVL $0, gobuf_sp(BX) // clear to help garbage collector - MOVQ $0, gobuf_ret(BX) - MOVL $0, gobuf_ctxt(BX) - MOVL gobuf_pc(BX), BX - JMP BX - -// func mcall(fn func(*g)) -// Switch to m->g0's stack, call fn(g). -// Fn must never return. It should gogo(&g->sched) -// to keep running g. -TEXT runtime·mcall(SB), NOSPLIT, $0-4 - MOVL fn+0(FP), DI - - get_tls(CX) - MOVL g(CX), AX // save state in g->sched - MOVL 0(SP), BX // caller's PC - MOVL BX, (g_sched+gobuf_pc)(AX) - LEAL fn+0(FP), BX // caller's SP - MOVL BX, (g_sched+gobuf_sp)(AX) - MOVL AX, (g_sched+gobuf_g)(AX) - - // switch to m->g0 & its stack, call fn - MOVL g(CX), BX - MOVL g_m(BX), BX - MOVL m_g0(BX), SI - CMPL SI, AX // if g == m->g0 call badmcall - JNE 3(PC) - MOVL $runtime·badmcall(SB), AX - JMP AX - MOVL SI, g(CX) // g = m->g0 - MOVL (g_sched+gobuf_sp)(SI), SP // sp = m->g0->sched.sp - PUSHQ AX - MOVL DI, DX - MOVL 0(DI), DI - CALL DI - POPQ AX - MOVL $runtime·badmcall2(SB), AX - JMP AX - RET - -// systemstack_switch is a dummy routine that systemstack leaves at the bottom -// of the G stack. We need to distinguish the routine that -// lives at the bottom of the G stack from the one that lives -// at the top of the system stack because the one at the top of -// the system stack terminates the stack walk (see topofstack()). -TEXT runtime·systemstack_switch(SB), NOSPLIT, $0-0 - RET - -// func systemstack(fn func()) -TEXT runtime·systemstack(SB), NOSPLIT, $0-4 - MOVL fn+0(FP), DI // DI = fn - get_tls(CX) - MOVL g(CX), AX // AX = g - MOVL g_m(AX), BX // BX = m - - CMPL AX, m_gsignal(BX) - JEQ noswitch - - MOVL m_g0(BX), DX // DX = g0 - CMPL AX, DX - JEQ noswitch - - CMPL AX, m_curg(BX) - JNE bad - - // switch stacks - // save our state in g->sched. Pretend to - // be systemstack_switch if the G stack is scanned. - MOVL $runtime·systemstack_switch(SB), SI - MOVL SI, (g_sched+gobuf_pc)(AX) - MOVL SP, (g_sched+gobuf_sp)(AX) - MOVL AX, (g_sched+gobuf_g)(AX) - - // switch to g0 - MOVL DX, g(CX) - MOVL (g_sched+gobuf_sp)(DX), SP - - // call target function - MOVL DI, DX - MOVL 0(DI), DI - CALL DI - - // switch back to g - get_tls(CX) - MOVL g(CX), AX - MOVL g_m(AX), BX - MOVL m_curg(BX), AX - MOVL AX, g(CX) - MOVL (g_sched+gobuf_sp)(AX), SP - MOVL $0, (g_sched+gobuf_sp)(AX) - RET - -noswitch: - // already on m stack, just call directly - // Using a tail call here cleans up tracebacks since we won't stop - // at an intermediate systemstack. - MOVL DI, DX - MOVL 0(DI), DI - JMP DI - -bad: - // Not g0, not curg. Must be gsignal, but that's not allowed. - // Hide call from linker nosplit analysis. - MOVL $runtime·badsystemstack(SB), AX - CALL AX - INT $3 - -/* - * support for morestack - */ - -// Called during function prolog when more stack is needed. -// -// The traceback routines see morestack on a g0 as being -// the top of a stack (for example, morestack calling newstack -// calling the scheduler calling newm calling gc), so we must -// record an argument size. For that purpose, it has no arguments. -TEXT runtime·morestack(SB),NOSPLIT,$0-0 - get_tls(CX) - MOVL g(CX), BX - MOVL g_m(BX), BX - - // Cannot grow scheduler stack (m->g0). - MOVL m_g0(BX), SI - CMPL g(CX), SI - JNE 3(PC) - CALL runtime·badmorestackg0(SB) - MOVL 0, AX - - // Cannot grow signal stack (m->gsignal). - MOVL m_gsignal(BX), SI - CMPL g(CX), SI - JNE 3(PC) - CALL runtime·badmorestackgsignal(SB) - MOVL 0, AX - - // Called from f. - // Set m->morebuf to f's caller. - NOP SP // tell vet SP changed - stop checking offsets - MOVL 8(SP), AX // f's caller's PC - MOVL AX, (m_morebuf+gobuf_pc)(BX) - LEAL 16(SP), AX // f's caller's SP - MOVL AX, (m_morebuf+gobuf_sp)(BX) - get_tls(CX) - MOVL g(CX), SI - MOVL SI, (m_morebuf+gobuf_g)(BX) - - // Set g->sched to context in f. - MOVL 0(SP), AX // f's PC - MOVL AX, (g_sched+gobuf_pc)(SI) - MOVL SI, (g_sched+gobuf_g)(SI) - LEAL 8(SP), AX // f's SP - MOVL AX, (g_sched+gobuf_sp)(SI) - MOVL DX, (g_sched+gobuf_ctxt)(SI) - - // Call newstack on m->g0's stack. - MOVL m_g0(BX), BX - MOVL BX, g(CX) - MOVL (g_sched+gobuf_sp)(BX), SP - CALL runtime·newstack(SB) - MOVL $0, 0x1003 // crash if newstack returns - RET - -// morestack trampolines -TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0 - MOVL $0, DX - JMP runtime·morestack(SB) - -// reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). -// we don't have variable-sized frames, so we use a small number -// of constant-sized-frame functions to encode a few bits of size in the pc. -// Caution: ugly multiline assembly macros in your future! - -#define DISPATCH(NAME,MAXSIZE) \ - CMPL CX, $MAXSIZE; \ - JA 3(PC); \ - MOVL $NAME(SB), AX; \ - JMP AX -// Note: can't just "JMP NAME(SB)" - bad inlining results. - -TEXT ·reflectcall(SB), NOSPLIT, $0-20 - MOVLQZX argsize+12(FP), CX - DISPATCH(runtime·call16, 16) - DISPATCH(runtime·call32, 32) - DISPATCH(runtime·call64, 64) - DISPATCH(runtime·call128, 128) - DISPATCH(runtime·call256, 256) - DISPATCH(runtime·call512, 512) - DISPATCH(runtime·call1024, 1024) - DISPATCH(runtime·call2048, 2048) - DISPATCH(runtime·call4096, 4096) - DISPATCH(runtime·call8192, 8192) - DISPATCH(runtime·call16384, 16384) - DISPATCH(runtime·call32768, 32768) - DISPATCH(runtime·call65536, 65536) - DISPATCH(runtime·call131072, 131072) - DISPATCH(runtime·call262144, 262144) - DISPATCH(runtime·call524288, 524288) - DISPATCH(runtime·call1048576, 1048576) - DISPATCH(runtime·call2097152, 2097152) - DISPATCH(runtime·call4194304, 4194304) - DISPATCH(runtime·call8388608, 8388608) - DISPATCH(runtime·call16777216, 16777216) - DISPATCH(runtime·call33554432, 33554432) - DISPATCH(runtime·call67108864, 67108864) - DISPATCH(runtime·call134217728, 134217728) - DISPATCH(runtime·call268435456, 268435456) - DISPATCH(runtime·call536870912, 536870912) - DISPATCH(runtime·call1073741824, 1073741824) - MOVL $runtime·badreflectcall(SB), AX - JMP AX - -#define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ - NO_LOCAL_POINTERS; \ - /* copy arguments to stack */ \ - MOVL argptr+8(FP), SI; \ - MOVL argsize+12(FP), CX; \ - MOVL SP, DI; \ - REP;MOVSB; \ - /* call function */ \ - MOVL f+4(FP), DX; \ - MOVL (DX), AX; \ - CALL AX; \ - /* copy return values back */ \ - MOVL argtype+0(FP), DX; \ - MOVL argptr+8(FP), DI; \ - MOVL argsize+12(FP), CX; \ - MOVL retoffset+16(FP), BX; \ - MOVL SP, SI; \ - ADDL BX, DI; \ - ADDL BX, SI; \ - SUBL BX, CX; \ - CALL callRet<>(SB); \ - RET - -// callRet copies return values back at the end of call*. This is a -// separate function so it can allocate stack space for the arguments -// to reflectcallmove. It does not follow the Go ABI; it expects its -// arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $16-0 - MOVL DX, 0(SP) - MOVL DI, 4(SP) - MOVL SI, 8(SP) - MOVL CX, 12(SP) - CALL runtime·reflectcallmove(SB) - RET - -CALLFN(·call16, 16) -CALLFN(·call32, 32) -CALLFN(·call64, 64) -CALLFN(·call128, 128) -CALLFN(·call256, 256) -CALLFN(·call512, 512) -CALLFN(·call1024, 1024) -CALLFN(·call2048, 2048) -CALLFN(·call4096, 4096) -CALLFN(·call8192, 8192) -CALLFN(·call16384, 16384) -CALLFN(·call32768, 32768) -CALLFN(·call65536, 65536) -CALLFN(·call131072, 131072) -CALLFN(·call262144, 262144) -CALLFN(·call524288, 524288) -CALLFN(·call1048576, 1048576) -CALLFN(·call2097152, 2097152) -CALLFN(·call4194304, 4194304) -CALLFN(·call8388608, 8388608) -CALLFN(·call16777216, 16777216) -CALLFN(·call33554432, 33554432) -CALLFN(·call67108864, 67108864) -CALLFN(·call134217728, 134217728) -CALLFN(·call268435456, 268435456) -CALLFN(·call536870912, 536870912) -CALLFN(·call1073741824, 1073741824) - -TEXT runtime·procyield(SB),NOSPLIT,$0-0 - MOVL cycles+0(FP), AX -again: - PAUSE - SUBL $1, AX - JNZ again - RET - -TEXT ·publicationBarrier(SB),NOSPLIT,$0-0 - // Stores are already ordered on x86, so this is just a - // compile barrier. - RET - -// void jmpdefer(fn, sp); -// called from deferreturn. -// 1. pop the caller -// 2. sub 5 bytes from the callers return -// 3. jmp to the argument -TEXT runtime·jmpdefer(SB), NOSPLIT, $0-8 - MOVL fv+0(FP), DX - MOVL argp+4(FP), BX - LEAL -8(BX), SP // caller sp after CALL - SUBL $5, (SP) // return to CALL again - MOVL 0(DX), BX - JMP BX // but first run the deferred function - -// func asmcgocall(fn, arg unsafe.Pointer) int32 -// Not implemented. -TEXT runtime·asmcgocall(SB),NOSPLIT,$0-12 - MOVL 0, AX // crash - MOVL $0, ret+8(FP) // for vet - RET - -// cgocallback(void (*fn)(void*), void *frame, uintptr framesize) -// Not implemented. -TEXT runtime·cgocallback(SB),NOSPLIT,$0-16 - MOVL 0, AX - RET - -// cgocallback_gofunc(FuncVal*, void *frame, uintptr framesize) -// Not implemented. -TEXT ·cgocallback_gofunc(SB),NOSPLIT,$0-16 - MOVL 0, AX - RET - -// void setg(G*); set g. for use by needm. -// Not implemented. -TEXT runtime·setg(SB), NOSPLIT, $0-4 - MOVL 0, AX - RET - -TEXT runtime·abort(SB),NOSPLIT,$0-0 - INT $3 -loop: - JMP loop - -// check that SP is in range [g->stack.lo, g->stack.hi) -TEXT runtime·stackcheck(SB), NOSPLIT, $0-0 - get_tls(CX) - MOVL g(CX), AX - CMPL (g_stack+stack_hi)(AX), SP - JHI 2(PC) - MOVL 0, AX - CMPL SP, (g_stack+stack_lo)(AX) - JHI 2(PC) - MOVL 0, AX - RET - -// int64 runtime·cputicks(void) -TEXT runtime·cputicks(SB),NOSPLIT,$0-0 - RDTSC - SHLQ $32, DX - ADDQ DX, AX - MOVQ AX, ret+0(FP) - RET - -// hash function using AES hardware instructions -// For now, our one amd64p32 system (NaCl) does not -// support using AES instructions, so have not bothered to -// write the implementations. Can copy and adjust the ones -// in asm_amd64.s when the time comes. - -TEXT runtime·memhash(SB),NOSPLIT,$0-20 - JMP runtime·memhashFallback(SB) - -TEXT runtime·strhash(SB),NOSPLIT,$0-12 - JMP runtime·strhashFallback(SB) - -TEXT runtime·memhash32(SB),NOSPLIT,$0-12 - JMP runtime·memhash32Fallback(SB) - -TEXT runtime·memhash64(SB),NOSPLIT,$0-12 - JMP runtime·memhash64Fallback(SB) - -TEXT runtime·return0(SB), NOSPLIT, $0 - MOVL $0, AX - RET - -// The top-most function running on a goroutine -// returns to goexit+PCQuantum. -TEXT runtime·goexit(SB),NOSPLIT,$0-0 - BYTE $0x90 // NOP - CALL runtime·goexit1(SB) // does not return - // traceback from goexit1 must hit code range of goexit - BYTE $0x90 // NOP - -TEXT ·checkASM(SB),NOSPLIT,$0-1 - MOVB $1, ret+0(FP) - RET - -// gcWriteBarrier performs a heap pointer write and informs the GC. -// -// gcWriteBarrier does NOT follow the Go ABI. It takes two arguments: -// - DI is the destination of the write -// - AX is the value being written at DI -// It clobbers FLAGS and SI. It does not clobber any other general-purpose registers, -// but may clobber others (e.g., SSE registers). -TEXT runtime·gcWriteBarrier(SB),NOSPLIT,$88 - // Save the registers clobbered by the fast path. This is slightly - // faster than having the caller spill these. - MOVQ R14, 72(SP) - MOVQ R13, 80(SP) - // TODO: Consider passing g.m.p in as an argument so they can be shared - // across a sequence of write barriers. - get_tls(R13) - MOVL g(R13), R13 - MOVL g_m(R13), R13 - MOVL m_p(R13), R13 - MOVL (p_wbBuf+wbBuf_next)(R13), R14 - // Increment wbBuf.next position. - LEAL 8(R14), R14 - MOVL R14, (p_wbBuf+wbBuf_next)(R13) - CMPL R14, (p_wbBuf+wbBuf_end)(R13) - // Record the write. - MOVL AX, -8(R14) // Record value - MOVL (DI), R13 // TODO: This turns bad writes into bad reads. - MOVL R13, -4(R14) // Record *slot - // Is the buffer full? (flags set in CMPL above) - JEQ flush -ret: - MOVQ 72(SP), R14 - MOVQ 80(SP), R13 - // Do the write. - MOVL AX, (DI) - RET // Clobbers SI on NaCl - -flush: - // Save all general purpose registers since these could be - // clobbered by wbBufFlush and were not saved by the caller. - // It is possible for wbBufFlush to clobber other registers - // (e.g., SSE registers), but the compiler takes care of saving - // those in the caller if necessary. This strikes a balance - // with registers that are likely to be used. - // - // We don't have type information for these, but all code under - // here is NOSPLIT, so nothing will observe these. - // - // TODO: We could strike a different balance; e.g., saving X0 - // and not saving GP registers that are less likely to be used. - MOVL DI, 0(SP) // Also first argument to wbBufFlush - MOVL AX, 4(SP) // Also second argument to wbBufFlush - MOVQ BX, 8(SP) - MOVQ CX, 16(SP) - MOVQ DX, 24(SP) - // DI already saved - // SI is always clobbered on nacl - // BP is reserved on nacl - MOVQ R8, 32(SP) - MOVQ R9, 40(SP) - MOVQ R10, 48(SP) - MOVQ R11, 56(SP) - MOVQ R12, 64(SP) - // R13 already saved - // R14 already saved - // R15 is reserved on nacl - - // This takes arguments DI and AX - CALL runtime·wbBufFlush(SB) - - MOVL 0(SP), DI - MOVL 4(SP), AX - MOVQ 8(SP), BX - MOVQ 16(SP), CX - MOVQ 24(SP), DX - MOVQ 32(SP), R8 - MOVQ 40(SP), R9 - MOVQ 48(SP), R10 - MOVQ 56(SP), R11 - MOVQ 64(SP), R12 - JMP ret - -// Note: these functions use a special calling convention to save generated code space. -// Arguments are passed in registers, but the space for those arguments are allocated -// in the caller's stack frame. These stubs write the args into that stack space and -// then tail call to the corresponding runtime handler. -// The tail call makes these stubs disappear in backtraces. -TEXT runtime·panicIndex(SB),NOSPLIT,$0-8 - MOVL AX, x+0(FP) - MOVL CX, y+4(FP) - JMP runtime·goPanicIndex(SB) -TEXT runtime·panicIndexU(SB),NOSPLIT,$0-8 - MOVL AX, x+0(FP) - MOVL CX, y+4(FP) - JMP runtime·goPanicIndexU(SB) -TEXT runtime·panicSliceAlen(SB),NOSPLIT,$0-8 - MOVL CX, x+0(FP) - MOVL DX, y+4(FP) - JMP runtime·goPanicSliceAlen(SB) -TEXT runtime·panicSliceAlenU(SB),NOSPLIT,$0-8 - MOVL CX, x+0(FP) - MOVL DX, y+4(FP) - JMP runtime·goPanicSliceAlenU(SB) -TEXT runtime·panicSliceAcap(SB),NOSPLIT,$0-8 - MOVL CX, x+0(FP) - MOVL DX, y+4(FP) - JMP runtime·goPanicSliceAcap(SB) -TEXT runtime·panicSliceAcapU(SB),NOSPLIT,$0-8 - MOVL CX, x+0(FP) - MOVL DX, y+4(FP) - JMP runtime·goPanicSliceAcapU(SB) -TEXT runtime·panicSliceB(SB),NOSPLIT,$0-8 - MOVL AX, x+0(FP) - MOVL CX, y+4(FP) - JMP runtime·goPanicSliceB(SB) -TEXT runtime·panicSliceBU(SB),NOSPLIT,$0-8 - MOVL AX, x+0(FP) - MOVL CX, y+4(FP) - JMP runtime·goPanicSliceBU(SB) -TEXT runtime·panicSlice3Alen(SB),NOSPLIT,$0-8 - MOVL DX, x+0(FP) - MOVL BX, y+4(FP) - JMP runtime·goPanicSlice3Alen(SB) -TEXT runtime·panicSlice3AlenU(SB),NOSPLIT,$0-8 - MOVL DX, x+0(FP) - MOVL BX, y+4(FP) - JMP runtime·goPanicSlice3AlenU(SB) -TEXT runtime·panicSlice3Acap(SB),NOSPLIT,$0-8 - MOVL DX, x+0(FP) - MOVL BX, y+4(FP) - JMP runtime·goPanicSlice3Acap(SB) -TEXT runtime·panicSlice3AcapU(SB),NOSPLIT,$0-8 - MOVL DX, x+0(FP) - MOVL BX, y+4(FP) - JMP runtime·goPanicSlice3AcapU(SB) -TEXT runtime·panicSlice3B(SB),NOSPLIT,$0-8 - MOVL CX, x+0(FP) - MOVL DX, y+4(FP) - JMP runtime·goPanicSlice3B(SB) -TEXT runtime·panicSlice3BU(SB),NOSPLIT,$0-8 - MOVL CX, x+0(FP) - MOVL DX, y+4(FP) - JMP runtime·goPanicSlice3BU(SB) -TEXT runtime·panicSlice3C(SB),NOSPLIT,$0-8 - MOVL AX, x+0(FP) - MOVL CX, y+4(FP) - JMP runtime·goPanicSlice3C(SB) -TEXT runtime·panicSlice3CU(SB),NOSPLIT,$0-8 - MOVL AX, x+0(FP) - MOVL CX, y+4(FP) - JMP runtime·goPanicSlice3CU(SB) - -// Extended versions for 64-bit indexes. -TEXT runtime·panicExtendIndex(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL AX, lo+4(FP) - MOVL CX, y+8(FP) - JMP runtime·goPanicExtendIndex(SB) -TEXT runtime·panicExtendIndexU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL AX, lo+4(FP) - MOVL CX, y+8(FP) - JMP runtime·goPanicExtendIndexU(SB) -TEXT runtime·panicExtendSliceAlen(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL CX, lo+4(FP) - MOVL DX, y+8(FP) - JMP runtime·goPanicExtendSliceAlen(SB) -TEXT runtime·panicExtendSliceAlenU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL CX, lo+4(FP) - MOVL DX, y+8(FP) - JMP runtime·goPanicExtendSliceAlenU(SB) -TEXT runtime·panicExtendSliceAcap(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL CX, lo+4(FP) - MOVL DX, y+8(FP) - JMP runtime·goPanicExtendSliceAcap(SB) -TEXT runtime·panicExtendSliceAcapU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL CX, lo+4(FP) - MOVL DX, y+8(FP) - JMP runtime·goPanicExtendSliceAcapU(SB) -TEXT runtime·panicExtendSliceB(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL AX, lo+4(FP) - MOVL CX, y+8(FP) - JMP runtime·goPanicExtendSliceB(SB) -TEXT runtime·panicExtendSliceBU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL AX, lo+4(FP) - MOVL CX, y+8(FP) - JMP runtime·goPanicExtendSliceBU(SB) -TEXT runtime·panicExtendSlice3Alen(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL DX, lo+4(FP) - MOVL BX, y+8(FP) - JMP runtime·goPanicExtendSlice3Alen(SB) -TEXT runtime·panicExtendSlice3AlenU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL DX, lo+4(FP) - MOVL BX, y+8(FP) - JMP runtime·goPanicExtendSlice3AlenU(SB) -TEXT runtime·panicExtendSlice3Acap(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL DX, lo+4(FP) - MOVL BX, y+8(FP) - JMP runtime·goPanicExtendSlice3Acap(SB) -TEXT runtime·panicExtendSlice3AcapU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL DX, lo+4(FP) - MOVL BX, y+8(FP) - JMP runtime·goPanicExtendSlice3AcapU(SB) -TEXT runtime·panicExtendSlice3B(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL CX, lo+4(FP) - MOVL DX, y+8(FP) - JMP runtime·goPanicExtendSlice3B(SB) -TEXT runtime·panicExtendSlice3BU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL CX, lo+4(FP) - MOVL DX, y+8(FP) - JMP runtime·goPanicExtendSlice3BU(SB) -TEXT runtime·panicExtendSlice3C(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL AX, lo+4(FP) - MOVL CX, y+8(FP) - JMP runtime·goPanicExtendSlice3C(SB) -TEXT runtime·panicExtendSlice3CU(SB),NOSPLIT,$0-12 - MOVL SI, hi+0(FP) - MOVL AX, lo+4(FP) - MOVL CX, y+8(FP) - JMP runtime·goPanicExtendSlice3CU(SB) diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index ade39dfed87..51a50c604cc 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -185,14 +185,10 @@ GLOBL runtime·mainPC(SB),RODATA,$4 TEXT runtime·breakpoint(SB),NOSPLIT,$0-0 // gdb won't skip this breakpoint instruction automatically, // so you must manually "set $pc+=4" to skip it and continue. -#ifdef GOOS_nacl - WORD $0xe125be7f // BKPT 0x5bef, NACL_INSTR_ARM_BREAKPOINT -#else #ifdef GOOS_plan9 WORD $0xD1200070 // undefined instruction used as armv5 breakpoint in Plan 9 #else WORD $0xe7f001f0 // undefined instruction that gdb understands is a software breakpoint -#endif #endif RET @@ -327,9 +323,6 @@ switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. MOVW $runtime·systemstack_switch(SB), R3 -#ifdef GOOS_nacl - ADD $4, R3, R3 // get past nacl-insert bic instruction -#endif ADD $4, R3, R3 // get past push {lr} MOVW R3, (g_sched+gobuf_pc)(g) MOVW R13, (g_sched+gobuf_sp)(g) @@ -887,7 +880,6 @@ TEXT runtime·usplitR0(SB),NOSPLIT,$0 SUB R1, R3, R1 RET -#ifndef GOOS_nacl // This is called from .init_array and follows the platform, not Go, ABI. TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 MOVW R9, saver9-4(SP) // The access to global variables below implicitly uses R9, which is callee-save @@ -898,7 +890,6 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 MOVW saver11-8(SP), R11 MOVW saver9-4(SP), R9 RET -#endif TEXT ·checkASM(SB),NOSPLIT,$0-1 MOVW $1, R3 @@ -935,8 +926,6 @@ ret: MOVM.IA.W (R13), [R0,R1] // Do the write. MOVW R3, (R2) - // Normally RET on nacl clobbers R12, but because this - // function has no frame it doesn't have to usual epilogue. RET flush: diff --git a/src/runtime/cgo/asm_nacl_amd64p32.s b/src/runtime/cgo/asm_nacl_amd64p32.s deleted file mode 100644 index 82aaecd1f33..00000000000 --- a/src/runtime/cgo/asm_nacl_amd64p32.s +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" - -/* - * void crosscall2(void (*fn)(void*, int32), void*, int32) - * Save registers and call fn with two arguments. - */ -TEXT crosscall2(SB),NOSPLIT,$0 - INT $3 - RET diff --git a/src/runtime/chan.go b/src/runtime/chan.go index 2162c34a128..93afe90dadb 100644 --- a/src/runtime/chan.go +++ b/src/runtime/chan.go @@ -121,6 +121,21 @@ func chanbuf(c *hchan, i uint) unsafe.Pointer { return add(c.buf, uintptr(i)*uintptr(c.elemsize)) } +// full reports whether a send on c would block (that is, the channel is full). +// It uses a single word-sized read of mutable state, so although +// the answer is instantaneously true, the correct answer may have changed +// by the time the calling function receives the return value. +func full(c *hchan) bool { + // c.dataqsiz is immutable (never written after the channel is created) + // so it is safe to read at any time during channel operation. + if c.dataqsiz == 0 { + // Assumes that a pointer read is relaxed-atomic. + return c.recvq.first == nil + } + // Assumes that a uint read is relaxed-atomic. + return c.qcount == c.dataqsiz +} + // entry point for c <- x from compiled code //go:nosplit func chansend1(c *hchan, elem unsafe.Pointer) { @@ -160,7 +175,7 @@ func chansend(c *hchan, ep unsafe.Pointer, block bool, callerpc uintptr) bool { // // After observing that the channel is not closed, we observe that the channel is // not ready for sending. Each of these observations is a single word-sized read - // (first c.closed and second c.recvq.first or c.qcount depending on kind of channel). + // (first c.closed and second full()). // Because a closed channel cannot transition from 'ready for sending' to // 'not ready for sending', even if the channel is closed between the two observations, // they imply a moment between the two when the channel was both not yet closed @@ -169,9 +184,10 @@ func chansend(c *hchan, ep unsafe.Pointer, block bool, callerpc uintptr) bool { // // It is okay if the reads are reordered here: if we observe that the channel is not // ready for sending and then observe that it is not closed, that implies that the - // channel wasn't closed during the first observation. - if !block && c.closed == 0 && ((c.dataqsiz == 0 && c.recvq.first == nil) || - (c.dataqsiz > 0 && c.qcount == c.dataqsiz)) { + // channel wasn't closed during the first observation. However, nothing here + // guarantees forward progress. We rely on the side effects of lock release in + // chanrecv() and closechan() to update this thread's view of c.closed and full(). + if !block && c.closed == 0 && full(c) { return false } @@ -400,6 +416,16 @@ func closechan(c *hchan) { } } +// empty reports whether a read from c would block (that is, the channel is +// empty). It uses a single atomic read of mutable state. +func empty(c *hchan) bool { + // c.dataqsiz is immutable. + if c.dataqsiz == 0 { + return atomic.Loadp(unsafe.Pointer(&c.sendq.first)) == nil + } + return atomic.Loaduint(&c.qcount) == 0 +} + // entry points for <- c from compiled code //go:nosplit func chanrecv1(c *hchan, elem unsafe.Pointer) { @@ -435,21 +461,33 @@ func chanrecv(c *hchan, ep unsafe.Pointer, block bool) (selected, received bool) } // Fast path: check for failed non-blocking operation without acquiring the lock. - // - // After observing that the channel is not ready for receiving, we observe that the - // channel is not closed. Each of these observations is a single word-sized read - // (first c.sendq.first or c.qcount, and second c.closed). - // Because a channel cannot be reopened, the later observation of the channel - // being not closed implies that it was also not closed at the moment of the - // first observation. We behave as if we observed the channel at that moment - // and report that the receive cannot proceed. - // - // The order of operations is important here: reversing the operations can lead to - // incorrect behavior when racing with a close. - if !block && (c.dataqsiz == 0 && c.sendq.first == nil || - c.dataqsiz > 0 && atomic.Loaduint(&c.qcount) == 0) && - atomic.Load(&c.closed) == 0 { - return + if !block && empty(c) { + // After observing that the channel is not ready for receiving, we observe whether the + // channel is closed. + // + // Reordering of these checks could lead to incorrect behavior when racing with a close. + // For example, if the channel was open and not empty, was closed, and then drained, + // reordered reads could incorrectly indicate "open and empty". To prevent reordering, + // we use atomic loads for both checks, and rely on emptying and closing to happen in + // separate critical sections under the same lock. This assumption fails when closing + // an unbuffered channel with a blocked send, but that is an error condition anyway. + if atomic.Load(&c.closed) == 0 { + // Because a channel cannot be reopened, the later observation of the channel + // being not closed implies that it was also not closed at the moment of the + // first observation. We behave as if we observed the channel at that moment + // and report that the receive cannot proceed. + return + } + // The channel is irreversibly closed. Re-check whether the channel has any pending data + // to receive, which could have arrived between the empty and closed checks above. + // Sequential consistency is also required here, when racing with such a send. + if empty(c) { + // The channel is irreversibly closed and empty. + if ep != nil { + typedmemclr(c.elemtype, ep) + } + return true, false + } } var t0 int64 diff --git a/src/runtime/chan_test.go b/src/runtime/chan_test.go index b6188f5e871..f5a7a57ed89 100644 --- a/src/runtime/chan_test.go +++ b/src/runtime/chan_test.go @@ -1126,6 +1126,20 @@ func BenchmarkChanPopular(b *testing.B) { wg.Wait() } +func BenchmarkChanClosed(b *testing.B) { + c := make(chan struct{}) + close(c) + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + select { + case <-c: + default: + b.Error("Unreachable") + } + } + }) +} + var ( alwaysFalse = false workSink = 0 diff --git a/src/runtime/crash_nonunix_test.go b/src/runtime/crash_nonunix_test.go index bf349a5d89d..06c197ec2b2 100644 --- a/src/runtime/crash_nonunix_test.go +++ b/src/runtime/crash_nonunix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build windows plan9 nacl js,wasm +// +build windows plan9 js,wasm package runtime_test diff --git a/src/runtime/debug/heapdump_test.go b/src/runtime/debug/heapdump_test.go index c986efcb325..de1ec27d21e 100644 --- a/src/runtime/debug/heapdump_test.go +++ b/src/runtime/debug/heapdump_test.go @@ -13,7 +13,7 @@ import ( ) func TestWriteHeapDumpNonempty(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS) } f, err := ioutil.TempFile("", "heapdumptest") @@ -42,7 +42,7 @@ func objfin(x *Obj) { } func TestWriteHeapDumpFinalizers(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS) } f, err := ioutil.TempFile("", "heapdumptest") diff --git a/src/runtime/defs_nacl_386.go b/src/runtime/defs_nacl_386.go deleted file mode 100644 index 70dfcf2c515..00000000000 --- a/src/runtime/defs_nacl_386.go +++ /dev/null @@ -1,49 +0,0 @@ -package runtime - -const ( - // These values are referred to in the source code - // but really don't matter. Even so, use the standard numbers. - _SIGQUIT = 3 - _SIGTRAP = 5 - _SIGSEGV = 11 - _SIGPROF = 27 -) - -type timespec struct { - tv_sec int64 - tv_nsec int32 -} - -//go:nosplit -func (ts *timespec) setNsec(ns int64) { - ts.tv_sec = int64(timediv(ns, 1e9, &ts.tv_nsec)) -} - -type excregs386 struct { - eax uint32 - ecx uint32 - edx uint32 - ebx uint32 - esp uint32 - ebp uint32 - esi uint32 - edi uint32 - eip uint32 - eflags uint32 -} - -type exccontext struct { - size uint32 - portable_context_offset uint32 - portable_context_size uint32 - arch uint32 - regs_size uint32 - reserved [11]uint32 - regs excregs386 -} - -type excportablecontext struct { - pc uint32 - sp uint32 - fp uint32 -} diff --git a/src/runtime/defs_nacl_amd64p32.go b/src/runtime/defs_nacl_amd64p32.go deleted file mode 100644 index 37067483f46..00000000000 --- a/src/runtime/defs_nacl_amd64p32.go +++ /dev/null @@ -1,71 +0,0 @@ -package runtime - -const ( - // These values are referred to in the source code - // but really don't matter. Even so, use the standard numbers. - _SIGQUIT = 3 - _SIGTRAP = 5 - _SIGSEGV = 11 - _SIGPROF = 27 -) - -type timespec struct { - tv_sec int64 - tv_nsec int32 -} - -//go:nosplit -func (ts *timespec) setNsec(ns int64) { - ts.tv_sec = ns / 1e9 - ts.tv_nsec = int32(ns % 1e9) -} - -type excregs386 struct { - eax uint32 - ecx uint32 - edx uint32 - ebx uint32 - esp uint32 - ebp uint32 - esi uint32 - edi uint32 - eip uint32 - eflags uint32 -} - -type excregsamd64 struct { - rax uint64 - rcx uint64 - rdx uint64 - rbx uint64 - rsp uint64 - rbp uint64 - rsi uint64 - rdi uint64 - r8 uint64 - r9 uint64 - r10 uint64 - r11 uint64 - r12 uint64 - r13 uint64 - r14 uint64 - r15 uint64 - rip uint64 - rflags uint32 -} - -type exccontext struct { - size uint32 - portable_context_offset uint32 - portable_context_size uint32 - arch uint32 - regs_size uint32 - reserved [11]uint32 - regs excregsamd64 -} - -type excportablecontext struct { - pc uint32 - sp uint32 - fp uint32 -} diff --git a/src/runtime/defs_nacl_arm.go b/src/runtime/defs_nacl_arm.go deleted file mode 100644 index 89e539ea7b3..00000000000 --- a/src/runtime/defs_nacl_arm.go +++ /dev/null @@ -1,56 +0,0 @@ -package runtime - -const ( - // These values are referred to in the source code - // but really don't matter. Even so, use the standard numbers. - _SIGQUIT = 3 - _SIGTRAP = 5 - _SIGSEGV = 11 - _SIGPROF = 27 -) - -type timespec struct { - tv_sec int64 - tv_nsec int32 -} - -//go:nosplit -func (ts *timespec) setNsec(ns int64) { - ts.tv_sec = int64(timediv(ns, 1e9, &ts.tv_nsec)) -} - -type excregsarm struct { - r0 uint32 - r1 uint32 - r2 uint32 - r3 uint32 - r4 uint32 - r5 uint32 - r6 uint32 - r7 uint32 - r8 uint32 - r9 uint32 // the value reported here is undefined. - r10 uint32 - r11 uint32 - r12 uint32 - sp uint32 /* r13 */ - lr uint32 /* r14 */ - pc uint32 /* r15 */ - cpsr uint32 -} - -type exccontext struct { - size uint32 - portable_context_offset uint32 - portable_context_size uint32 - arch uint32 - regs_size uint32 - reserved [11]uint32 - regs excregsarm -} - -type excportablecontext struct { - pc uint32 - sp uint32 - fp uint32 -} diff --git a/src/runtime/env_posix.go b/src/runtime/env_posix.go index 03208c7c10f..f95ff685450 100644 --- a/src/runtime/env_posix.go +++ b/src/runtime/env_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package runtime diff --git a/src/runtime/export_mmap_test.go b/src/runtime/export_mmap_test.go index 6c4a4466de6..aeaf37f64be 100644 --- a/src/runtime/export_mmap_test.go +++ b/src/runtime/export_mmap_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // Export guts for testing. diff --git a/src/runtime/gcinfo_test.go b/src/runtime/gcinfo_test.go index 0741f6361cf..c228c779e48 100644 --- a/src/runtime/gcinfo_test.go +++ b/src/runtime/gcinfo_test.go @@ -187,14 +187,6 @@ func infoBigStruct() []byte { typeScalar, typeScalar, typeScalar, // t int; y uint16; u uint64 typePointer, typeScalar, // i string } - case "amd64p32": - return []byte{ - typePointer, // q *int - typeScalar, typeScalar, typeScalar, typeScalar, typeScalar, // w byte; e [17]byte - typePointer, typeScalar, typeScalar, // r []byte - typeScalar, typeScalar, typeScalar, typeScalar, typeScalar, // t int; y uint16; u uint64 - typePointer, typeScalar, // i string - } default: panic("unknown arch") } diff --git a/src/runtime/go_tls.h b/src/runtime/go_tls.h index 61f7dbef3c4..a47e798d9d5 100644 --- a/src/runtime/go_tls.h +++ b/src/runtime/go_tls.h @@ -11,11 +11,6 @@ #define g(r) 0(r)(TLS*1) #endif -#ifdef GOARCH_amd64p32 -#define get_tls(r) MOVL TLS, r -#define g(r) 0(r)(TLS*1) -#endif - #ifdef GOARCH_386 #define get_tls(r) MOVL TLS, r #define g(r) 0(r)(TLS*1) diff --git a/src/runtime/hash64.go b/src/runtime/hash64.go index e7908d7800c..798d6dcd9e8 100644 --- a/src/runtime/hash64.go +++ b/src/runtime/hash64.go @@ -6,7 +6,7 @@ // xxhash: https://code.google.com/p/xxhash/ // cityhash: https://code.google.com/p/cityhash/ -// +build amd64 amd64p32 arm64 mips64 mips64le ppc64 ppc64le s390x wasm +// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x wasm package runtime diff --git a/src/runtime/internal/atomic/asm_amd64p32.s b/src/runtime/internal/atomic/asm_amd64p32.s deleted file mode 100644 index 35b5ef205ec..00000000000 --- a/src/runtime/internal/atomic/asm_amd64p32.s +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2015 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. - -#include "textflag.h" - -// bool Cas(int32 *val, int32 old, int32 new) -// Atomically: -// if(*val == old){ -// *val = new; -// return 1; -// } else -// return 0; -TEXT runtime∕internal∕atomic·Cas(SB), NOSPLIT, $0-17 - MOVL ptr+0(FP), BX - MOVL old+4(FP), AX - MOVL new+8(FP), CX - LOCK - CMPXCHGL CX, 0(BX) - SETEQ ret+16(FP) - RET - -TEXT runtime∕internal∕atomic·Casuintptr(SB), NOSPLIT, $0-17 - JMP runtime∕internal∕atomic·Cas(SB) - -TEXT runtime∕internal∕atomic·CasRel(SB), NOSPLIT, $0-17 - JMP runtime∕internal∕atomic·Cas(SB) - -TEXT runtime∕internal∕atomic·Loaduintptr(SB), NOSPLIT, $0-12 - JMP runtime∕internal∕atomic·Load(SB) - -TEXT runtime∕internal∕atomic·Loaduint(SB), NOSPLIT, $0-12 - JMP runtime∕internal∕atomic·Load(SB) - -TEXT runtime∕internal∕atomic·Storeuintptr(SB), NOSPLIT, $0-8 - JMP runtime∕internal∕atomic·Store(SB) - -TEXT runtime∕internal∕atomic·Loadint64(SB), NOSPLIT, $0-16 - JMP runtime∕internal∕atomic·Load64(SB) - -TEXT runtime∕internal∕atomic·Xaddint64(SB), NOSPLIT, $0-24 - JMP runtime∕internal∕atomic·Xadd64(SB) - -// bool runtime∕internal∕atomic·cas64(uint64 *val, uint64 old, uint64 new) -// Atomically: -// if(*val == *old){ -// *val = new; -// return 1; -// } else { -// return 0; -// } -TEXT runtime∕internal∕atomic·Cas64(SB), NOSPLIT, $0-25 - MOVL ptr+0(FP), BX - MOVQ old+8(FP), AX - MOVQ new+16(FP), CX - LOCK - CMPXCHGQ CX, 0(BX) - SETEQ ret+24(FP) - RET - -// bool Casp1(void **val, void *old, void *new) -// Atomically: -// if(*val == old){ -// *val = new; -// return 1; -// } else -// return 0; -TEXT runtime∕internal∕atomic·Casp1(SB), NOSPLIT, $0-17 - MOVL ptr+0(FP), BX - MOVL old+4(FP), AX - MOVL new+8(FP), CX - LOCK - CMPXCHGL CX, 0(BX) - SETEQ ret+16(FP) - RET - -// uint32 Xadd(uint32 volatile *val, int32 delta) -// Atomically: -// *val += delta; -// return *val; -TEXT runtime∕internal∕atomic·Xadd(SB), NOSPLIT, $0-12 - MOVL ptr+0(FP), BX - MOVL delta+4(FP), AX - MOVL AX, CX - LOCK - XADDL AX, 0(BX) - ADDL CX, AX - MOVL AX, ret+8(FP) - RET - -TEXT runtime∕internal∕atomic·Xadd64(SB), NOSPLIT, $0-24 - MOVL ptr+0(FP), BX - MOVQ delta+8(FP), AX - MOVQ AX, CX - LOCK - XADDQ AX, 0(BX) - ADDQ CX, AX - MOVQ AX, ret+16(FP) - RET - -TEXT runtime∕internal∕atomic·Xadduintptr(SB), NOSPLIT, $0-12 - JMP runtime∕internal∕atomic·Xadd(SB) - -TEXT runtime∕internal∕atomic·Xchg(SB), NOSPLIT, $0-12 - MOVL ptr+0(FP), BX - MOVL new+4(FP), AX - XCHGL AX, 0(BX) - MOVL AX, ret+8(FP) - RET - -TEXT runtime∕internal∕atomic·Xchg64(SB), NOSPLIT, $0-24 - MOVL ptr+0(FP), BX - MOVQ new+8(FP), AX - TESTL $7, BX - JZ 2(PC) - MOVL 0, BX // crash when unaligned - XCHGQ AX, 0(BX) - MOVQ AX, ret+16(FP) - RET - -TEXT runtime∕internal∕atomic·Xchguintptr(SB), NOSPLIT, $0-12 - JMP runtime∕internal∕atomic·Xchg(SB) - -TEXT runtime∕internal∕atomic·StorepNoWB(SB), NOSPLIT, $0-8 - MOVL ptr+0(FP), BX - MOVL val+4(FP), AX - XCHGL AX, 0(BX) - RET - -TEXT runtime∕internal∕atomic·Store(SB), NOSPLIT, $0-8 - MOVL ptr+0(FP), BX - MOVL val+4(FP), AX - XCHGL AX, 0(BX) - RET - -TEXT runtime∕internal∕atomic·StoreRel(SB), NOSPLIT, $0-8 - JMP runtime∕internal∕atomic·Store(SB) - -TEXT runtime∕internal∕atomic·Store64(SB), NOSPLIT, $0-16 - MOVL ptr+0(FP), BX - MOVQ val+8(FP), AX - XCHGQ AX, 0(BX) - RET - -// void runtime∕internal∕atomic·Or8(byte volatile*, byte); -TEXT runtime∕internal∕atomic·Or8(SB), NOSPLIT, $0-5 - MOVL ptr+0(FP), BX - MOVB val+4(FP), AX - LOCK - ORB AX, 0(BX) - RET - -// void runtime∕internal∕atomic·And8(byte volatile*, byte); -TEXT runtime∕internal∕atomic·And8(SB), NOSPLIT, $0-5 - MOVL ptr+0(FP), BX - MOVB val+4(FP), AX - LOCK - ANDB AX, 0(BX) - RET diff --git a/src/runtime/internal/atomic/atomic_amd64x.go b/src/runtime/internal/atomic/atomic_amd64.go similarity index 98% rename from src/runtime/internal/atomic/atomic_amd64x.go rename to src/runtime/internal/atomic/atomic_amd64.go index 31c1636b2ef..fc865e892d0 100644 --- a/src/runtime/internal/atomic/atomic_amd64x.go +++ b/src/runtime/internal/atomic/atomic_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 amd64p32 - package atomic import "unsafe" diff --git a/src/runtime/internal/atomic/atomic_test.go b/src/runtime/internal/atomic/atomic_test.go index 0ba75447e8c..9e4461ce38a 100644 --- a/src/runtime/internal/atomic/atomic_test.go +++ b/src/runtime/internal/atomic/atomic_test.go @@ -86,14 +86,8 @@ func TestUnaligned64(t *testing.T) { // a continual source of pain. Test that on 32-bit systems they crash // instead of failing silently. - switch runtime.GOARCH { - default: - if unsafe.Sizeof(int(0)) != 4 { - t.Skip("test only runs on 32-bit systems") - } - case "amd64p32": - // amd64p32 can handle unaligned atomics. - t.Skipf("test not needed on %v", runtime.GOARCH) + if unsafe.Sizeof(int(0)) != 4 { + t.Skip("test only runs on 32-bit systems") } x := make([]uint32, 4) diff --git a/src/runtime/internal/sys/arch_386.go b/src/runtime/internal/sys/arch_386.go index 3426fd17021..b51f70a512f 100644 --- a/src/runtime/internal/sys/arch_386.go +++ b/src/runtime/internal/sys/arch_386.go @@ -7,7 +7,7 @@ package sys const ( ArchFamily = I386 BigEndian = false - DefaultPhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl + DefaultPhysPageSize = 4096 PCQuantum = 1 Int64Align = 4 MinFrameSize = 0 diff --git a/src/runtime/internal/sys/arch_amd64p32.go b/src/runtime/internal/sys/arch_amd64p32.go deleted file mode 100644 index d51c8a5354c..00000000000 --- a/src/runtime/internal/sys/arch_amd64p32.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 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 sys - -const ( - ArchFamily = AMD64 - BigEndian = false - DefaultPhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) - PCQuantum = 1 - Int64Align = 8 - MinFrameSize = 0 -) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/zgoarch_amd64p32.go b/src/runtime/internal/sys/zgoarch_amd64p32.go deleted file mode 100644 index 13dc2e756d6..00000000000 --- a/src/runtime/internal/sys/zgoarch_amd64p32.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by gengoos.go using 'go generate'. DO NOT EDIT. - -// +build amd64p32 - -package sys - -const GOARCH = `amd64p32` - -const Goarch386 = 0 -const GoarchAmd64 = 0 -const GoarchAmd64p32 = 1 -const GoarchArm = 0 -const GoarchArmbe = 0 -const GoarchArm64 = 0 -const GoarchArm64be = 0 -const GoarchPpc64 = 0 -const GoarchPpc64le = 0 -const GoarchMips = 0 -const GoarchMipsle = 0 -const GoarchMips64 = 0 -const GoarchMips64le = 0 -const GoarchMips64p32 = 0 -const GoarchMips64p32le = 0 -const GoarchPpc = 0 -const GoarchRiscv = 0 -const GoarchRiscv64 = 0 -const GoarchS390 = 0 -const GoarchS390x = 0 -const GoarchSparc = 0 -const GoarchSparc64 = 0 -const GoarchWasm = 0 diff --git a/src/runtime/internal/sys/zgoos_nacl.go b/src/runtime/internal/sys/zgoos_nacl.go deleted file mode 100644 index 9e65b6f1855..00000000000 --- a/src/runtime/internal/sys/zgoos_nacl.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by gengoos.go using 'go generate'. DO NOT EDIT. - -// +build nacl - -package sys - -const GOOS = `nacl` - -const GoosAix = 0 -const GoosAndroid = 0 -const GoosDarwin = 0 -const GoosDragonfly = 0 -const GoosFreebsd = 0 -const GoosHurd = 0 -const GoosIllumos = 0 -const GoosJs = 0 -const GoosLinux = 0 -const GoosNacl = 1 -const GoosNetbsd = 0 -const GoosOpenbsd = 0 -const GoosPlan9 = 0 -const GoosSolaris = 0 -const GoosWindows = 0 -const GoosZos = 0 diff --git a/src/runtime/lfstack_32bit.go b/src/runtime/lfstack_32bit.go index d36ca50971d..f07ff1c06b4 100644 --- a/src/runtime/lfstack_32bit.go +++ b/src/runtime/lfstack_32bit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 arm nacl mips mipsle +// +build 386 arm mips mipsle package runtime diff --git a/src/runtime/lock_js.go b/src/runtime/lock_js.go index c038499f2a9..d08238ce3cf 100644 --- a/src/runtime/lock_js.go +++ b/src/runtime/lock_js.go @@ -149,18 +149,20 @@ var returnedEventHandler *g func init() { // At the toplevel we need an extra goroutine that handles asynchronous events. initg := getg() - go func() { - returnedEventHandler = getg() - goready(initg, 1) - - gopark(nil, nil, waitReasonZero, traceEvNone, 1) - returnedEventHandler = nil - - pause(getcallersp() - 16) - }() + go handleAsyncEvents(initg) gopark(nil, nil, waitReasonZero, traceEvNone, 1) } +func handleAsyncEvents(initg *g) { + returnedEventHandler = getg() + goready(initg, 1) + + gopark(nil, nil, waitReasonZero, traceEvNone, 1) + returnedEventHandler = nil + + pause(getcallersp() - 16) +} + // beforeIdle gets called by the scheduler if no goroutine is awake. // We resume the event handler (if available) which will pause the execution. func beforeIdle() bool { diff --git a/src/runtime/lock_sema.go b/src/runtime/lock_sema.go index b36c97f71e8..9507d46f41c 100644 --- a/src/runtime/lock_sema.go +++ b/src/runtime/lock_sema.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin nacl netbsd openbsd plan9 solaris windows +// +build aix darwin netbsd openbsd plan9 solaris windows package runtime diff --git a/src/runtime/mem_bsd.go b/src/runtime/mem_bsd.go index 08a2391610b..ad235395232 100644 --- a/src/runtime/mem_bsd.go +++ b/src/runtime/mem_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build dragonfly freebsd nacl netbsd openbsd solaris +// +build dragonfly freebsd netbsd openbsd solaris package runtime diff --git a/src/runtime/memclr_amd64p32.s b/src/runtime/memclr_amd64p32.s deleted file mode 100644 index 71040f37505..00000000000 --- a/src/runtime/memclr_amd64p32.s +++ /dev/null @@ -1,24 +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. - -#include "textflag.h" - -// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) -TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8 - MOVL ptr+0(FP), DI - MOVL n+4(FP), CX - MOVQ CX, BX - ANDQ $3, BX - SHRQ $2, CX - MOVQ $0, AX - CLD - REP - STOSL - MOVQ BX, CX - REP - STOSB - // Note: we zero only 4 bytes at a time so that the tail is at most - // 3 bytes. That guarantees that we aren't zeroing pointers with STOSB. - // See issue 13160. - RET diff --git a/src/runtime/memmove_amd64p32.s b/src/runtime/memmove_amd64p32.s deleted file mode 100644 index 114077311ca..00000000000 --- a/src/runtime/memmove_amd64p32.s +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" - -// This could use MOVSQ, but we use MOVSL so that if an object ends in -// a 4 byte pointer, we copy it as a unit instead of byte by byte. - -// func memmove(to, from unsafe.Pointer, n uintptr) -TEXT runtime·memmove(SB), NOSPLIT, $0-12 - MOVL to+0(FP), DI - MOVL from+4(FP), SI - MOVL n+8(FP), BX - - CMPL SI, DI - JLS back - -forward: - MOVL BX, CX - SHRL $2, CX - ANDL $3, BX - REP; MOVSL - MOVL BX, CX - REP; MOVSB - RET - -back: - MOVL SI, CX - ADDL BX, CX - CMPL CX, DI - JLS forward - - ADDL BX, DI - ADDL BX, SI - STD - - MOVL BX, CX - SHRL $2, CX - ANDL $3, BX - SUBL $4, DI - SUBL $4, SI - REP; MOVSL - ADDL $3, DI - ADDL $3, SI - MOVL BX, CX - REP; MOVSB - CLD - - // Note: we copy only 4 bytes at a time so that the tail is at most - // 3 bytes. That guarantees that we aren't copying pointers with MOVSB. - // See issue 13160. - RET diff --git a/src/runtime/mknacl.sh b/src/runtime/mknacl.sh deleted file mode 100644 index 306ae3d9c15..00000000000 --- a/src/runtime/mknacl.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2013 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. - -cat /Users/rsc/pub/native_client/src/trusted/service_runtime/include/bits/nacl_syscalls.h | - awk ' - BEGIN { - printf("// Code generated by mknacl.sh; DO NOT EDIT.\n") - } - NF==3 && $1=="#define" && $2~/^NACL_sys_/ { - name=$2 - sub(/^NACL_sys_/, "SYS_", name) - printf("#define %s %s\n", name, $3) - }' >syscall_nacl.h diff --git a/src/runtime/mmap.go b/src/runtime/mmap.go index 2868f3fd4e5..9fe31cb4166 100644 --- a/src/runtime/mmap.go +++ b/src/runtime/mmap.go @@ -5,7 +5,6 @@ // +build !plan9 // +build !solaris // +build !windows -// +build !nacl // +build !linux !amd64 // +build !linux !arm64 // +build !js diff --git a/src/runtime/netpoll.go b/src/runtime/netpoll.go index 73bbc5e3c7b..adb072db38b 100644 --- a/src/runtime/netpoll.go +++ b/src/runtime/netpoll.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package runtime diff --git a/src/runtime/netpoll_fake.go b/src/runtime/netpoll_fake.go index 5b1a63a8787..0d247e57df2 100644 --- a/src/runtime/netpoll_fake.go +++ b/src/runtime/netpoll_fake.go @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Fake network poller for NaCl and wasm/js. -// Should never be used, because NaCl and wasm/js network connections do not honor "SetNonblock". +// Fake network poller for wasm/js. +// Should never be used, because wasm/js network connections do not honor "SetNonblock". -// +build nacl js,wasm +// +build js,wasm package runtime diff --git a/src/runtime/os2_nacl.go b/src/runtime/os2_nacl.go deleted file mode 100644 index b84cb18bb26..00000000000 --- a/src/runtime/os2_nacl.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2014 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 - -const ( - _NSIG = 32 - _SI_USER = 1 - - // native_client/src/trusted/service_runtime/include/sys/errno.h - // The errors are mainly copied from Linux. - _EPERM = 1 /* Operation not permitted */ - _ENOENT = 2 /* No such file or directory */ - _ESRCH = 3 /* No such process */ - _EINTR = 4 /* Interrupted system call */ - _EIO = 5 /* I/O error */ - _ENXIO = 6 /* No such device or address */ - _E2BIG = 7 /* Argument list too long */ - _ENOEXEC = 8 /* Exec format error */ - _EBADF = 9 /* Bad file number */ - _ECHILD = 10 /* No child processes */ - _EAGAIN = 11 /* Try again */ - // _ENOMEM is defined in mem_bsd.go for nacl. - // _ENOMEM = 12 /* Out of memory */ - _EACCES = 13 /* Permission denied */ - _EFAULT = 14 /* Bad address */ - _EBUSY = 16 /* Device or resource busy */ - _EEXIST = 17 /* File exists */ - _EXDEV = 18 /* Cross-device link */ - _ENODEV = 19 /* No such device */ - _ENOTDIR = 20 /* Not a directory */ - _EISDIR = 21 /* Is a directory */ - _EINVAL = 22 /* Invalid argument */ - _ENFILE = 23 /* File table overflow */ - _EMFILE = 24 /* Too many open files */ - _ENOTTY = 25 /* Not a typewriter */ - _EFBIG = 27 /* File too large */ - _ENOSPC = 28 /* No space left on device */ - _ESPIPE = 29 /* Illegal seek */ - _EROFS = 30 /* Read-only file system */ - _EMLINK = 31 /* Too many links */ - _EPIPE = 32 /* Broken pipe */ - _ENAMETOOLONG = 36 /* File name too long */ - _ENOSYS = 38 /* Function not implemented */ - _EDQUOT = 122 /* Quota exceeded */ - _EDOM = 33 /* Math arg out of domain of func */ - _ERANGE = 34 /* Math result not representable */ - _EDEADLK = 35 /* Deadlock condition */ - _ENOLCK = 37 /* No record locks available */ - _ENOTEMPTY = 39 /* Directory not empty */ - _ELOOP = 40 /* Too many symbolic links */ - _ENOMSG = 42 /* No message of desired type */ - _EIDRM = 43 /* Identifier removed */ - _ECHRNG = 44 /* Channel number out of range */ - _EL2NSYNC = 45 /* Level 2 not synchronized */ - _EL3HLT = 46 /* Level 3 halted */ - _EL3RST = 47 /* Level 3 reset */ - _ELNRNG = 48 /* Link number out of range */ - _EUNATCH = 49 /* Protocol driver not attached */ - _ENOCSI = 50 /* No CSI structure available */ - _EL2HLT = 51 /* Level 2 halted */ - _EBADE = 52 /* Invalid exchange */ - _EBADR = 53 /* Invalid request descriptor */ - _EXFULL = 54 /* Exchange full */ - _ENOANO = 55 /* No anode */ - _EBADRQC = 56 /* Invalid request code */ - _EBADSLT = 57 /* Invalid slot */ - _EDEADLOCK = _EDEADLK /* File locking deadlock error */ - _EBFONT = 59 /* Bad font file fmt */ - _ENOSTR = 60 /* Device not a stream */ - _ENODATA = 61 /* No data (for no delay io) */ - _ETIME = 62 /* Timer expired */ - _ENOSR = 63 /* Out of streams resources */ - _ENONET = 64 /* Machine is not on the network */ - _ENOPKG = 65 /* Package not installed */ - _EREMOTE = 66 /* The object is remote */ - _ENOLINK = 67 /* The link has been severed */ - _EADV = 68 /* Advertise error */ - _ESRMNT = 69 /* Srmount error */ - _ECOMM = 70 /* Communication error on send */ - _EPROTO = 71 /* Protocol error */ - _EMULTIHOP = 72 /* Multihop attempted */ - _EDOTDOT = 73 /* Cross mount point (not really error) */ - _EBADMSG = 74 /* Trying to read unreadable message */ - _EOVERFLOW = 75 /* Value too large for defined data type */ - _ENOTUNIQ = 76 /* Given log. name not unique */ - _EBADFD = 77 /* f.d. invalid for this operation */ - _EREMCHG = 78 /* Remote address changed */ - _ELIBACC = 79 /* Can't access a needed shared lib */ - _ELIBBAD = 80 /* Accessing a corrupted shared lib */ - _ELIBSCN = 81 /* .lib section in a.out corrupted */ - _ELIBMAX = 82 /* Attempting to link in too many libs */ - _ELIBEXEC = 83 /* Attempting to exec a shared library */ - _EILSEQ = 84 - _EUSERS = 87 - _ENOTSOCK = 88 /* Socket operation on non-socket */ - _EDESTADDRREQ = 89 /* Destination address required */ - _EMSGSIZE = 90 /* Message too long */ - _EPROTOTYPE = 91 /* Protocol wrong type for socket */ - _ENOPROTOOPT = 92 /* Protocol not available */ - _EPROTONOSUPPORT = 93 /* Unknown protocol */ - _ESOCKTNOSUPPORT = 94 /* Socket type not supported */ - _EOPNOTSUPP = 95 /* Operation not supported on transport endpoint */ - _EPFNOSUPPORT = 96 /* Protocol family not supported */ - _EAFNOSUPPORT = 97 /* Address family not supported by protocol family */ - _EADDRINUSE = 98 /* Address already in use */ - _EADDRNOTAVAIL = 99 /* Address not available */ - _ENETDOWN = 100 /* Network interface is not configured */ - _ENETUNREACH = 101 /* Network is unreachable */ - _ENETRESET = 102 - _ECONNABORTED = 103 /* Connection aborted */ - _ECONNRESET = 104 /* Connection reset by peer */ - _ENOBUFS = 105 /* No buffer space available */ - _EISCONN = 106 /* Socket is already connected */ - _ENOTCONN = 107 /* Socket is not connected */ - _ESHUTDOWN = 108 /* Can't send after socket shutdown */ - _ETOOMANYREFS = 109 - _ETIMEDOUT = 110 /* Connection timed out */ - _ECONNREFUSED = 111 /* Connection refused */ - _EHOSTDOWN = 112 /* Host is down */ - _EHOSTUNREACH = 113 /* Host is unreachable */ - _EALREADY = 114 /* Socket already connected */ - _EINPROGRESS = 115 /* Connection already in progress */ - _ESTALE = 116 - _ENOTSUP = _EOPNOTSUPP /* Not supported */ - _ENOMEDIUM = 123 /* No medium (in tape drive) */ - _ECANCELED = 125 /* Operation canceled. */ - _ELBIN = 2048 /* Inode is remote (not really error) */ - _EFTYPE = 2049 /* Inappropriate file type or format */ - _ENMFILE = 2050 /* No more files */ - _EPROCLIM = 2051 - _ENOSHARE = 2052 /* No such host or network path */ - _ECASECLASH = 2053 /* Filename exists with different case */ - _EWOULDBLOCK = _EAGAIN /* Operation would block */ - - // native_client/src/trusted/service_runtime/include/bits/mman.h. - // NOTE: DO NOT USE native_client/src/shared/imc/nacl_imc_c.h. - // Those MAP_*values are different from these. - _PROT_NONE = 0x0 - _PROT_READ = 0x1 - _PROT_WRITE = 0x2 - _PROT_EXEC = 0x4 - - _MAP_SHARED = 0x1 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 - _MAP_ANON = 0x20 - - _MADV_FREE = 0 - _SIGFPE = 8 - _FPE_INTDIV = 0 -) - -type siginfo struct{} diff --git a/src/runtime/os_nacl.go b/src/runtime/os_nacl.go deleted file mode 100644 index 8cda597ca5e..00000000000 --- a/src/runtime/os_nacl.go +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright 2010 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 "unsafe" - -type mOS struct { - waitsema int32 // semaphore for parking on locks - waitsemacount int32 - waitsemalock int32 -} - -func nacl_exception_stack(p uintptr, size int32) int32 -func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32 -func nacl_sem_create(flag int32) int32 -func nacl_sem_wait(sem int32) int32 -func nacl_sem_post(sem int32) int32 -func nacl_mutex_create(flag int32) int32 -func nacl_mutex_lock(mutex int32) int32 -func nacl_mutex_trylock(mutex int32) int32 -func nacl_mutex_unlock(mutex int32) int32 -func nacl_cond_create(flag int32) int32 -func nacl_cond_wait(cond, n int32) int32 -func nacl_cond_signal(cond int32) int32 -func nacl_cond_broadcast(cond int32) int32 - -//go:noescape -func nacl_cond_timed_wait_abs(cond, lock int32, ts *timespec) int32 -func nacl_thread_create(fn uintptr, stk, tls, xx unsafe.Pointer) int32 - -//go:noescape -func nacl_nanosleep(ts, extra *timespec) int32 -func nanotime() int64 -func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (p unsafe.Pointer, err int) -func exit(code int32) -func osyield() - -//go:noescape -func write(fd uintptr, p unsafe.Pointer, n int32) int32 - -//go:linkname os_sigpipe os.sigpipe -func os_sigpipe() { - throw("too many writes on closed pipe") -} - -func dieFromSignal(sig uint32) { - exit(2) -} - -func sigpanic() { - g := getg() - if !canpanic(g) { - throw("unexpected signal during runtime execution") - } - - // Native Client only invokes the exception handler for memory faults. - g.sig = _SIGSEGV - panicmem() -} - -func raiseproc(sig uint32) { -} - -// Stubs so tests can link correctly. These should never be called. -func open(name *byte, mode, perm int32) int32 -func closefd(fd int32) int32 -func read(fd int32, p unsafe.Pointer, n int32) int32 - -type sigset struct{} - -// Called to initialize a new m (including the bootstrap m). -// Called on the parent thread (main thread in case of bootstrap), can allocate memory. -func mpreinit(mp *m) { - mp.gsignal = malg(32 * 1024) - mp.gsignal.m = mp -} - -func sigtramp(ctxt byte) - -//go:nosplit -func msigsave(mp *m) { -} - -//go:nosplit -func msigrestore(sigmask sigset) { -} - -//go:nosplit -//go:nowritebarrierrec -func clearSignalHandlers() { -} - -//go:nosplit -func sigblock() { -} - -// Called to initialize a new m (including the bootstrap m). -// Called on the new thread, cannot allocate memory. -func minit() { - _g_ := getg() - - // Initialize signal handling - ret := nacl_exception_stack(_g_.m.gsignal.stack.lo, 32*1024) - if ret < 0 { - print("runtime: nacl_exception_stack: error ", -ret, "\n") - } - - ret = nacl_exception_handler(funcPC(sigtramp), nil) - if ret < 0 { - print("runtime: nacl_exception_handler: error ", -ret, "\n") - } -} - -// Called from dropm to undo the effect of an minit. -func unminit() { -} - -func osinit() { - ncpu = 1 - getg().m.procid = 2 - //nacl_exception_handler(funcPC(sigtramp), nil); - physPageSize = 65536 -} - -func signame(sig uint32) string { - if sig >= uint32(len(sigtable)) { - return "" - } - return sigtable[sig].name -} - -//go:nosplit -func crash() { - *(*int32)(nil) = 0 -} - -//go:noescape -func getRandomData([]byte) - -func goenvs() { - goenvs_unix() -} - -func initsig(preinit bool) { -} - -//go:nosplit -func usleep(us uint32) { - var ts timespec - - ts.tv_sec = int64(us / 1e6) - ts.tv_nsec = int32(us%1e6) * 1e3 - nacl_nanosleep(&ts, nil) -} - -func mstart_nacl() - -// May run with m.p==nil, so write barriers are not allowed. -//go:nowritebarrier -func newosproc(mp *m) { - stk := unsafe.Pointer(mp.g0.stack.hi) - mp.tls[0] = uintptr(unsafe.Pointer(mp.g0)) - mp.tls[1] = uintptr(unsafe.Pointer(mp)) - ret := nacl_thread_create(funcPC(mstart_nacl), stk, unsafe.Pointer(&mp.tls[2]), nil) - if ret < 0 { - print("nacl_thread_create: error ", -ret, "\n") - throw("newosproc") - } -} - -//go:noescape -func exitThread(wait *uint32) - -//go:nosplit -func semacreate(mp *m) { - if mp.waitsema != 0 { - return - } - systemstack(func() { - mu := nacl_mutex_create(0) - if mu < 0 { - print("nacl_mutex_create: error ", -mu, "\n") - throw("semacreate") - } - c := nacl_cond_create(0) - if c < 0 { - print("nacl_cond_create: error ", -c, "\n") - throw("semacreate") - } - mp.waitsema = c - mp.waitsemalock = mu - }) -} - -//go:nosplit -func semasleep(ns int64) int32 { - var ret int32 - systemstack(func() { - _g_ := getg() - if nacl_mutex_lock(_g_.m.waitsemalock) < 0 { - throw("semasleep") - } - var ts timespec - if ns >= 0 { - end := ns + nanotime() - ts.tv_sec = end / 1e9 - ts.tv_nsec = int32(end % 1e9) - } - for _g_.m.waitsemacount == 0 { - if ns < 0 { - if nacl_cond_wait(_g_.m.waitsema, _g_.m.waitsemalock) < 0 { - throw("semasleep") - } - } else { - r := nacl_cond_timed_wait_abs(_g_.m.waitsema, _g_.m.waitsemalock, &ts) - if r == -_ETIMEDOUT { - nacl_mutex_unlock(_g_.m.waitsemalock) - ret = -1 - return - } - if r < 0 { - throw("semasleep") - } - } - } - - _g_.m.waitsemacount = 0 - nacl_mutex_unlock(_g_.m.waitsemalock) - ret = 0 - }) - return ret -} - -//go:nosplit -func semawakeup(mp *m) { - systemstack(func() { - if nacl_mutex_lock(mp.waitsemalock) < 0 { - throw("semawakeup") - } - if mp.waitsemacount != 0 { - throw("semawakeup") - } - mp.waitsemacount = 1 - nacl_cond_signal(mp.waitsema) - nacl_mutex_unlock(mp.waitsemalock) - }) -} - -// This runs on a foreign stack, without an m or a g. No stack split. -//go:nosplit -//go:norace -//go:nowritebarrierrec -func badsignal(sig uintptr) { - cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0) -} - -func badsignalgo(sig uintptr) { - if !sigsend(uint32(sig)) { - // A foreign thread received the signal sig, and the - // Go code does not want to handle it. - raisebadsignal(uint32(sig)) - } -} - -// This runs on a foreign stack, without an m or a g. No stack split. -//go:nosplit -func badsignal2() { - write(2, unsafe.Pointer(&badsignal1[0]), int32(len(badsignal1))) - exit(2) -} - -var badsignal1 = []byte("runtime: signal received on thread not created by Go.\n") - -func raisebadsignal(sig uint32) { - badsignal2() -} - -func madvise(addr unsafe.Pointer, n uintptr, flags int32) {} -func munmap(addr unsafe.Pointer, n uintptr) {} -func setProcessCPUProfiler(hz int32) {} -func setThreadCPUProfiler(hz int32) {} -func sigdisable(uint32) {} -func sigenable(uint32) {} -func sigignore(uint32) {} -func closeonexec(int32) {} - -// gsignalStack is unused on nacl. -type gsignalStack struct{} - -// nacl fake time support - time in nanoseconds since 1970 -var faketime int64 - -var writelock uint32 // test-and-set spin lock for write - -// lastfaketime stores the last faketime value written to fd 1 or 2. -var lastfaketime int64 - -// lastfaketimefd stores the fd to which lastfaketime was written. -// -// Subsequent writes to the same fd may use the same timestamp, -// but the timestamp must increase if the fd changes. -var lastfaketimefd int32 - -func walltime() (sec int64, nsec int32) - -/* -An attempt at IRT. Doesn't work. See end of sys_nacl_amd64.s. - -void (*nacl_irt_query)(void); - -int8 nacl_irt_basic_v0_1_str[] = "nacl-irt-basic-0.1"; -void *nacl_irt_basic_v0_1[6]; // exit, gettod, clock, nanosleep, sched_yield, sysconf -int32 nacl_irt_basic_v0_1_size = sizeof(nacl_irt_basic_v0_1); - -int8 nacl_irt_memory_v0_3_str[] = "nacl-irt-memory-0.3"; -void *nacl_irt_memory_v0_3[3]; // mmap, munmap, mprotect -int32 nacl_irt_memory_v0_3_size = sizeof(nacl_irt_memory_v0_3); - -int8 nacl_irt_thread_v0_1_str[] = "nacl-irt-thread-0.1"; -void *nacl_irt_thread_v0_1[3]; // thread_create, thread_exit, thread_nice -int32 nacl_irt_thread_v0_1_size = sizeof(nacl_irt_thread_v0_1); -*/ - -// The following functions are implemented in runtime assembly. -// Provide a Go declaration to go with its assembly definitions. - -//go:linkname syscall_naclWrite syscall.naclWrite -func syscall_naclWrite(fd int, b []byte) int - -//go:linkname syscall_now syscall.now -func syscall_now() (sec int64, nsec int32) diff --git a/src/runtime/os_nacl_arm.go b/src/runtime/os_nacl_arm.go deleted file mode 100644 index 8669ee75b46..00000000000 --- a/src/runtime/os_nacl_arm.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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 checkgoarm() { - // TODO(minux): FP checks like in os_linux_arm.go. - - // NaCl/ARM only supports ARMv7 - if goarm != 7 { - print("runtime: NaCl requires ARMv7. Recompile using GOARM=7.\n") - exit(1) - } -} - -//go:nosplit -func cputicks() int64 { - // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand(). - // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler. - // TODO: need more entropy to better seed fastrand. - return nanotime() -} diff --git a/src/runtime/panic32.go b/src/runtime/panic32.go index b89ce9d5636..aea8401a37b 100644 --- a/src/runtime/panic32.go +++ b/src/runtime/panic32.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 amd64p32 arm mips mipsle +// +build 386 arm mips mipsle package runtime diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index 53496371a01..ed04fe06acf 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!js +// +build !js package pprof diff --git a/src/runtime/rt0_nacl_386.s b/src/runtime/rt0_nacl_386.s deleted file mode 100644 index 4c990022f11..00000000000 --- a/src/runtime/rt0_nacl_386.s +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" - -// NaCl entry has: -// 0(FP) - arg block == SP+8 -// 4(FP) - cleanup function pointer, always 0 -// 8(FP) - envc -// 12(FP) - argc -// 16(FP) - argv, then 0, then envv, then 0, then auxv -TEXT _rt0_386_nacl(SB),NOSPLIT,$8 - MOVL argc+12(FP), AX - LEAL argv+16(FP), BX - MOVL AX, 0(SP) - MOVL BX, 4(SP) - JMP runtime·rt0_go(SB) - -TEXT main(SB),NOSPLIT,$0 - // Remove the return address from the stack. - // rt0_go doesn't expect it to be there. - ADDL $4, SP - JMP runtime·rt0_go(SB) diff --git a/src/runtime/rt0_nacl_amd64p32.s b/src/runtime/rt0_nacl_amd64p32.s deleted file mode 100644 index 38583c58b27..00000000000 --- a/src/runtime/rt0_nacl_amd64p32.s +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" - -// NaCl entry on 32-bit x86 has DI pointing at the arg block, which contains: -// -// 0(DI) - cleanup function pointer, always 0 -// 4(DI) - envc -// 8(DI) - argc -// 12(DI) - argv, then 0, then envv, then 0, then auxv -// NaCl entry here is almost the same, except that there -// is no saved caller PC, so 0(FP) is -8(FP) and so on. -TEXT _rt0_amd64p32_nacl(SB),NOSPLIT,$16 - MOVL DI, 0(SP) - CALL runtime·nacl_sysinfo(SB) - MOVL 0(SP), DI - MOVL 8(DI), AX - LEAL 12(DI), BX - MOVL AX, 0(SP) - MOVL BX, 4(SP) - CALL main(SB) - INT $3 - -TEXT main(SB),NOSPLIT,$0 - // Uncomment for fake time like on Go Playground. - //MOVQ $1257894000000000000, AX - //MOVQ AX, runtime·faketime(SB) - JMP runtime·rt0_go(SB) diff --git a/src/runtime/rt0_nacl_arm.s b/src/runtime/rt0_nacl_arm.s deleted file mode 100644 index a52c0d86195..00000000000 --- a/src/runtime/rt0_nacl_arm.s +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 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. - -#include "textflag.h" - -// NaCl entry has: -// 0(FP) - 0 -// 4(FP) - cleanup function pointer, always 0 -// 8(FP) - envc -// 12(FP) - argc -// 16(FP) - argv, then 0, then envv, then 0, then auxv -TEXT _rt0_arm_nacl(SB),NOSPLIT|NOFRAME,$0 - MOVW 8(R13), R0 - MOVW $12(R13), R1 - B runtime·rt0_go(SB) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 2d68721701a..dd399e00a69 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -922,7 +922,7 @@ var ( // Information about what cpu features are available. // Packages outside the runtime should not use these // as they are not an external api. - // Set on startup in asm_{386,amd64,amd64p32}.s + // Set on startup in asm_{386,amd64}.s processorVersionInfo uint32 isIntel bool lfenceBeforeRdtsc bool diff --git a/src/runtime/runtime_mmap_test.go b/src/runtime/runtime_mmap_test.go index 6741e1da8dd..bb0b747606b 100644 --- a/src/runtime/runtime_mmap_test.go +++ b/src/runtime/runtime_mmap_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package runtime_test diff --git a/src/runtime/runtime_test.go b/src/runtime/runtime_test.go index 37eacfea646..ab7a03b2d16 100644 --- a/src/runtime/runtime_test.go +++ b/src/runtime/runtime_test.go @@ -193,9 +193,6 @@ func TestSetPanicOnFault(t *testing.T) { } func testSetPanicOnFault(t *testing.T, addr uintptr, nfault *int) { - if GOOS == "nacl" { - t.Skip("nacl doesn't seem to fault on high addresses") - } if GOOS == "js" { t.Skip("js does not support catching faults") } @@ -294,7 +291,7 @@ func TestTrailingZero(t *testing.T) { } func TestBadOpen(t *testing.T) { - if GOOS == "windows" || GOOS == "nacl" || GOOS == "js" { + if GOOS == "windows" || GOOS == "js" { t.Skip("skipping OS that doesn't have open/read/write/close") } // make sure we get the correct error code if open fails. Same for diff --git a/src/runtime/sema.go b/src/runtime/sema.go index 30c8959473a..530af5baa6b 100644 --- a/src/runtime/sema.go +++ b/src/runtime/sema.go @@ -373,19 +373,11 @@ Found: func (root *semaRoot) rotateLeft(x *sudog) { // p -> (x a (y b c)) p := x.parent - a, y := x.prev, x.next - b, c := y.prev, y.next + y := x.next + b := y.prev y.prev = x x.parent = y - y.next = c - if c != nil { - c.parent = y - } - x.prev = a - if a != nil { - a.parent = x - } x.next = b if b != nil { b.parent = x @@ -409,23 +401,15 @@ func (root *semaRoot) rotateLeft(x *sudog) { func (root *semaRoot) rotateRight(y *sudog) { // p -> (y (x a b) c) p := y.parent - x, c := y.prev, y.next - a, b := x.prev, x.next + x := y.prev + b := x.next - x.prev = a - if a != nil { - a.parent = x - } x.next = y y.parent = x y.prev = b if b != nil { b.parent = y } - y.next = c - if c != nil { - c.parent = y - } x.parent = p if p == nil { diff --git a/src/runtime/semasleep_test.go b/src/runtime/semasleep_test.go index 3eb7c6a6d14..9b371b07324 100644 --- a/src/runtime/semasleep_test.go +++ b/src/runtime/semasleep_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!plan9,!windows,!js +// +build !plan9,!windows,!js package runtime_test diff --git a/src/runtime/signal_386.go b/src/runtime/signal_386.go index 143deb9de78..ef979797965 100644 --- a/src/runtime/signal_386.go +++ b/src/runtime/signal_386.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux nacl netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package runtime diff --git a/src/runtime/signal_amd64x.go b/src/runtime/signal_amd64.go similarity index 96% rename from src/runtime/signal_amd64x.go rename to src/runtime/signal_amd64.go index 9d59e262de3..9e9bb9ca335 100644 --- a/src/runtime/signal_amd64x.go +++ b/src/runtime/signal_amd64.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 amd64p32 -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build amd64 +// +build darwin dragonfly freebsd linux netbsd openbsd solaris package runtime diff --git a/src/runtime/signal_arm.go b/src/runtime/signal_arm.go index bb597c5608e..97742206c77 100644 --- a/src/runtime/signal_arm.go +++ b/src/runtime/signal_arm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux nacl netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package runtime diff --git a/src/runtime/signal_nacl.go b/src/runtime/signal_nacl.go deleted file mode 100644 index ad321d8b759..00000000000 --- a/src/runtime/signal_nacl.go +++ /dev/null @@ -1,45 +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 - -type sigTabT struct { - flags int32 - name string -} - -var sigtable = [...]sigTabT{ - /* 0 */ {0, "SIGNONE: no trap"}, - /* 1 */ {_SigNotify + _SigKill, "SIGHUP: terminal line hangup"}, - /* 2 */ {_SigNotify + _SigKill, "SIGINT: interrupt"}, - /* 3 */ {_SigNotify + _SigThrow, "SIGQUIT: quit"}, - /* 4 */ {_SigThrow, "SIGILL: illegal instruction"}, - /* 5 */ {_SigThrow, "SIGTRAP: trace trap"}, - /* 6 */ {_SigNotify + _SigThrow, "SIGABRT: abort"}, - /* 7 */ {_SigThrow, "SIGEMT: emulate instruction executed"}, - /* 8 */ {_SigPanic, "SIGFPE: floating-point exception"}, - /* 9 */ {0, "SIGKILL: kill"}, - /* 10 */ {_SigPanic, "SIGBUS: bus error"}, - /* 11 */ {_SigPanic, "SIGSEGV: segmentation violation"}, - /* 12 */ {_SigThrow, "SIGSYS: bad system call"}, - /* 13 */ {_SigNotify, "SIGPIPE: write to broken pipe"}, - /* 14 */ {_SigNotify, "SIGALRM: alarm clock"}, - /* 15 */ {_SigNotify + _SigKill, "SIGTERM: termination"}, - /* 16 */ {_SigNotify + _SigIgn, "SIGURG: urgent condition on socket"}, - /* 17 */ {0, "SIGSTOP: stop"}, - /* 18 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTSTP: keyboard stop"}, - /* 19 */ {_SigNotify + _SigDefault + _SigIgn, "SIGCONT: continue after stop"}, - /* 20 */ {_SigNotify + _SigIgn, "SIGCHLD: child status has changed"}, - /* 21 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTTIN: background read from tty"}, - /* 22 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTTOU: background write to tty"}, - /* 23 */ {_SigNotify, "SIGIO: i/o now possible"}, - /* 24 */ {_SigNotify, "SIGXCPU: cpu limit exceeded"}, - /* 25 */ {_SigNotify, "SIGXFSZ: file size limit exceeded"}, - /* 26 */ {_SigNotify, "SIGVTALRM: virtual alarm clock"}, - /* 27 */ {_SigNotify, "SIGPROF: profiling alarm clock"}, - /* 28 */ {_SigNotify, "SIGWINCH: window size change"}, - /* 29 */ {_SigNotify, "SIGINFO: status request from keyboard"}, - /* 30 */ {_SigNotify, "SIGUSR1: user-defined signal 1"}, - /* 31 */ {_SigNotify, "SIGUSR2: user-defined signal 2"}, -} diff --git a/src/runtime/signal_nacl_386.go b/src/runtime/signal_nacl_386.go deleted file mode 100644 index 1a30a89c767..00000000000 --- a/src/runtime/signal_nacl_386.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 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 "unsafe" - -type sigctxt struct { - info *siginfo - ctxt unsafe.Pointer -} - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) regs() *excregs386 { return &(*exccontext)(c.ctxt).regs } - -func (c *sigctxt) eax() uint32 { return c.regs().eax } -func (c *sigctxt) ebx() uint32 { return c.regs().ebx } -func (c *sigctxt) ecx() uint32 { return c.regs().ecx } -func (c *sigctxt) edx() uint32 { return c.regs().edx } -func (c *sigctxt) edi() uint32 { return c.regs().edi } -func (c *sigctxt) esi() uint32 { return c.regs().esi } -func (c *sigctxt) ebp() uint32 { return c.regs().ebp } -func (c *sigctxt) esp() uint32 { return c.regs().esp } - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) eip() uint32 { return c.regs().eip } - -func (c *sigctxt) eflags() uint32 { return c.regs().eflags } -func (c *sigctxt) cs() uint32 { return ^uint32(0) } -func (c *sigctxt) fs() uint32 { return ^uint32(0) } -func (c *sigctxt) gs() uint32 { return ^uint32(0) } -func (c *sigctxt) sigcode() uint32 { return ^uint32(0) } -func (c *sigctxt) sigaddr() uint32 { return 0 } - -func (c *sigctxt) set_eip(x uint32) { c.regs().eip = x } -func (c *sigctxt) set_esp(x uint32) { c.regs().esp = x } -func (c *sigctxt) set_sigcode(x uint32) {} -func (c *sigctxt) set_sigaddr(x uint32) {} diff --git a/src/runtime/signal_nacl_amd64p32.go b/src/runtime/signal_nacl_amd64p32.go deleted file mode 100644 index 81bbdc5f560..00000000000 --- a/src/runtime/signal_nacl_amd64p32.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 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 "unsafe" - -func nacl_sysinfo(di uint32) // cross-assembly-file call; declared for vet - -type sigctxt struct { - info *siginfo - ctxt unsafe.Pointer -} - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) regs() *excregsamd64 { - return &(*exccontext)(c.ctxt).regs -} - -func (c *sigctxt) rax() uint64 { return c.regs().rax } -func (c *sigctxt) rbx() uint64 { return c.regs().rbx } -func (c *sigctxt) rcx() uint64 { return c.regs().rcx } -func (c *sigctxt) rdx() uint64 { return c.regs().rdx } -func (c *sigctxt) rdi() uint64 { return c.regs().rdi } -func (c *sigctxt) rsi() uint64 { return c.regs().rsi } -func (c *sigctxt) rbp() uint64 { return c.regs().rbp } -func (c *sigctxt) rsp() uint64 { return c.regs().rsp } -func (c *sigctxt) r8() uint64 { return c.regs().r8 } -func (c *sigctxt) r9() uint64 { return c.regs().r9 } -func (c *sigctxt) r10() uint64 { return c.regs().r10 } -func (c *sigctxt) r11() uint64 { return c.regs().r11 } -func (c *sigctxt) r12() uint64 { return c.regs().r12 } -func (c *sigctxt) r13() uint64 { return c.regs().r13 } -func (c *sigctxt) r14() uint64 { return c.regs().r14 } -func (c *sigctxt) r15() uint64 { return c.regs().r15 } - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) rip() uint64 { return c.regs().rip } - -func (c *sigctxt) rflags() uint64 { return uint64(c.regs().rflags) } -func (c *sigctxt) cs() uint64 { return ^uint64(0) } -func (c *sigctxt) fs() uint64 { return ^uint64(0) } -func (c *sigctxt) gs() uint64 { return ^uint64(0) } -func (c *sigctxt) sigcode() uint64 { return ^uint64(0) } -func (c *sigctxt) sigaddr() uint64 { return 0 } - -func (c *sigctxt) set_rip(x uint64) { c.regs().rip = x } -func (c *sigctxt) set_rsp(x uint64) { c.regs().rsp = x } -func (c *sigctxt) set_sigcode(x uint64) {} -func (c *sigctxt) set_sigaddr(x uint64) {} diff --git a/src/runtime/signal_nacl_arm.go b/src/runtime/signal_nacl_arm.go deleted file mode 100644 index b8312324ac9..00000000000 --- a/src/runtime/signal_nacl_arm.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 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 "unsafe" - -type sigctxt struct { - info *siginfo - ctxt unsafe.Pointer -} - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) regs() *excregsarm { return &(*exccontext)(c.ctxt).regs } - -func (c *sigctxt) r0() uint32 { return c.regs().r0 } -func (c *sigctxt) r1() uint32 { return c.regs().r1 } -func (c *sigctxt) r2() uint32 { return c.regs().r2 } -func (c *sigctxt) r3() uint32 { return c.regs().r3 } -func (c *sigctxt) r4() uint32 { return c.regs().r4 } -func (c *sigctxt) r5() uint32 { return c.regs().r5 } -func (c *sigctxt) r6() uint32 { return c.regs().r6 } -func (c *sigctxt) r7() uint32 { return c.regs().r7 } -func (c *sigctxt) r8() uint32 { return c.regs().r8 } -func (c *sigctxt) r9() uint32 { return c.regs().r9 } -func (c *sigctxt) r10() uint32 { return c.regs().r10 } -func (c *sigctxt) fp() uint32 { return c.regs().r11 } -func (c *sigctxt) ip() uint32 { return c.regs().r12 } -func (c *sigctxt) sp() uint32 { return c.regs().sp } -func (c *sigctxt) lr() uint32 { return c.regs().lr } - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) pc() uint32 { return c.regs().pc } - -func (c *sigctxt) cpsr() uint32 { return c.regs().cpsr } -func (c *sigctxt) fault() uintptr { return ^uintptr(0) } -func (c *sigctxt) trap() uint32 { return ^uint32(0) } -func (c *sigctxt) error() uint32 { return ^uint32(0) } -func (c *sigctxt) oldmask() uint32 { return ^uint32(0) } - -func (c *sigctxt) sigcode() uint32 { return 0 } -func (c *sigctxt) sigaddr() uint32 { return 0 } - -func (c *sigctxt) set_pc(x uint32) { c.regs().pc = x } -func (c *sigctxt) set_sp(x uint32) { c.regs().sp = x } -func (c *sigctxt) set_lr(x uint32) { c.regs().lr = x } -func (c *sigctxt) set_r10(x uint32) { c.regs().r10 = x } - -func (c *sigctxt) set_sigcode(x uint32) {} -func (c *sigctxt) set_sigaddr(x uint32) {} diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go deleted file mode 100644 index bec46532188..00000000000 --- a/src/runtime/signal_sighandler.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2013 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. - -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris - -package runtime - -import ( - "unsafe" -) - -// crashing is the number of m's we have waited for when implementing -// GOTRACEBACK=crash when a signal is received. -var crashing int32 - -// testSigtrap is used by the runtime tests. If non-nil, it is called -// on SIGTRAP. If it returns true, the normal behavior on SIGTRAP is -// suppressed. -var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool - -// 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 -// when the signal occurred. The sig, info, and ctxt parameters are -// from the system signal handler: they are the parameters passed when -// the SA is passed to the sigaction system call. -// -// The garbage collector may have stopped the world, so write barriers -// are not allowed. -// -//go:nowritebarrierrec -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) - return - } - - if sig == _SIGTRAP && testSigtrap != nil && testSigtrap(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp) { - return - } - - flags := int32(_SigThrow) - if sig < uint32(len(sigtable)) { - flags = sigtable[sig].flags - } - if flags&_SigPanic != 0 && gp.throwsplit { - // We can't safely sigpanic because it may grow the - // stack. Abort in the signal handler instead. - flags = (flags &^ _SigPanic) | _SigThrow - } - if isAbortPC(c.sigpc()) { - // On many architectures, the abort function just - // causes a memory fault. Don't turn that into a panic. - flags = _SigThrow - } - if c.sigcode() != _SI_USER && flags&_SigPanic != 0 { - // The signal is going to cause a panic. - // Arrange the stack so that it looks like the point - // where the signal occurred made a call to the - // function sigpanic. Then set the PC to sigpanic. - - // Have to pass arguments out of band since - // augmenting the stack frame would break - // the unwinding code. - gp.sig = sig - gp.sigcode0 = uintptr(c.sigcode()) - gp.sigcode1 = uintptr(c.fault()) - gp.sigpc = c.sigpc() - - c.preparePanic(sig, gp) - return - } - - if c.sigcode() == _SI_USER || flags&_SigNotify != 0 { - if sigsend(sig) { - return - } - } - - if c.sigcode() == _SI_USER && signal_ignored(sig) { - return - } - - if flags&_SigKill != 0 { - dieFromSignal(sig) - } - - if flags&_SigThrow == 0 { - return - } - - _g_.m.throwing = 1 - _g_.m.caughtsig.set(gp) - - if crashing == 0 { - startpanic_m() - } - - if sig < uint32(len(sigtable)) { - print(sigtable[sig].name, "\n") - } else { - print("Signal ", sig, "\n") - } - - print("PC=", hex(c.sigpc()), " m=", _g_.m.id, " sigcode=", c.sigcode(), "\n") - if _g_.m.lockedg != 0 && _g_.m.ncgo > 0 && gp == _g_.m.g0 { - print("signal arrived during cgo execution\n") - gp = _g_.m.lockedg.ptr() - } - print("\n") - - level, _, docrash := gotraceback() - if level > 0 { - goroutineheader(gp) - tracebacktrap(c.sigpc(), c.sigsp(), c.siglr(), gp) - if crashing > 0 && gp != _g_.m.curg && _g_.m.curg != nil && readgstatus(_g_.m.curg)&^_Gscan == _Grunning { - // tracebackothers on original m skipped this one; trace it now. - goroutineheader(_g_.m.curg) - traceback(^uintptr(0), ^uintptr(0), 0, _g_.m.curg) - } else if crashing == 0 { - tracebackothers(gp) - print("\n") - } - dumpregs(c) - } - - if docrash { - crashing++ - if crashing < mcount()-int32(extraMCount) { - // There are other m's that need to dump their stacks. - // Relay SIGQUIT to the next m by sending it to the current process. - // All m's that have already received SIGQUIT have signal masks blocking - // receipt of any signals, so the SIGQUIT will go to an m that hasn't seen it yet. - // When the last m receives the SIGQUIT, it will fall through to the call to - // crash below. Just in case the relaying gets botched, each m involved in - // the relay sleeps for 5 seconds and then does the crash/exit itself. - // In expected operation, the last m has received the SIGQUIT and run - // crash/exit and the process is gone, all long before any of the - // 5-second sleeps have finished. - print("\n-----\n\n") - raiseproc(_SIGQUIT) - usleep(5 * 1000 * 1000) - } - crash() - } - - printDebugLog() - - exit(2) -} diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 6a8b5b7ace5..a9a65d51640 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -370,6 +370,149 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { } } +// crashing is the number of m's we have waited for when implementing +// GOTRACEBACK=crash when a signal is received. +var crashing int32 + +// testSigtrap is used by the runtime tests. If non-nil, it is called +// on SIGTRAP. If it returns true, the normal behavior on SIGTRAP is +// suppressed. +var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool + +// 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 +// when the signal occurred. The sig, info, and ctxt parameters are +// from the system signal handler: they are the parameters passed when +// the SA is passed to the sigaction system call. +// +// The garbage collector may have stopped the world, so write barriers +// are not allowed. +// +//go:nowritebarrierrec +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) + return + } + + if sig == _SIGTRAP && testSigtrap != nil && testSigtrap(info, (*sigctxt)(noescape(unsafe.Pointer(c))), gp) { + return + } + + flags := int32(_SigThrow) + if sig < uint32(len(sigtable)) { + flags = sigtable[sig].flags + } + if flags&_SigPanic != 0 && gp.throwsplit { + // We can't safely sigpanic because it may grow the + // stack. Abort in the signal handler instead. + flags = (flags &^ _SigPanic) | _SigThrow + } + if isAbortPC(c.sigpc()) { + // On many architectures, the abort function just + // causes a memory fault. Don't turn that into a panic. + flags = _SigThrow + } + if c.sigcode() != _SI_USER && flags&_SigPanic != 0 { + // The signal is going to cause a panic. + // Arrange the stack so that it looks like the point + // where the signal occurred made a call to the + // function sigpanic. Then set the PC to sigpanic. + + // Have to pass arguments out of band since + // augmenting the stack frame would break + // the unwinding code. + gp.sig = sig + gp.sigcode0 = uintptr(c.sigcode()) + gp.sigcode1 = uintptr(c.fault()) + gp.sigpc = c.sigpc() + + c.preparePanic(sig, gp) + return + } + + if c.sigcode() == _SI_USER || flags&_SigNotify != 0 { + if sigsend(sig) { + return + } + } + + if c.sigcode() == _SI_USER && signal_ignored(sig) { + return + } + + if flags&_SigKill != 0 { + dieFromSignal(sig) + } + + if flags&_SigThrow == 0 { + return + } + + _g_.m.throwing = 1 + _g_.m.caughtsig.set(gp) + + if crashing == 0 { + startpanic_m() + } + + if sig < uint32(len(sigtable)) { + print(sigtable[sig].name, "\n") + } else { + print("Signal ", sig, "\n") + } + + print("PC=", hex(c.sigpc()), " m=", _g_.m.id, " sigcode=", c.sigcode(), "\n") + if _g_.m.lockedg != 0 && _g_.m.ncgo > 0 && gp == _g_.m.g0 { + print("signal arrived during cgo execution\n") + gp = _g_.m.lockedg.ptr() + } + print("\n") + + level, _, docrash := gotraceback() + if level > 0 { + goroutineheader(gp) + tracebacktrap(c.sigpc(), c.sigsp(), c.siglr(), gp) + if crashing > 0 && gp != _g_.m.curg && _g_.m.curg != nil && readgstatus(_g_.m.curg)&^_Gscan == _Grunning { + // tracebackothers on original m skipped this one; trace it now. + goroutineheader(_g_.m.curg) + traceback(^uintptr(0), ^uintptr(0), 0, _g_.m.curg) + } else if crashing == 0 { + tracebackothers(gp) + print("\n") + } + dumpregs(c) + } + + if docrash { + crashing++ + if crashing < mcount()-int32(extraMCount) { + // There are other m's that need to dump their stacks. + // Relay SIGQUIT to the next m by sending it to the current process. + // All m's that have already received SIGQUIT have signal masks blocking + // receipt of any signals, so the SIGQUIT will go to an m that hasn't seen it yet. + // When the last m receives the SIGQUIT, it will fall through to the call to + // crash below. Just in case the relaying gets botched, each m involved in + // the relay sleeps for 5 seconds and then does the crash/exit itself. + // In expected operation, the last m has received the SIGQUIT and run + // crash/exit and the process is gone, all long before any of the + // 5-second sleeps have finished. + print("\n-----\n\n") + raiseproc(_SIGQUIT) + usleep(5 * 1000 * 1000) + } + crash() + } + + printDebugLog() + + exit(2) +} + // sigpanic turns a synchronous signal into a run-time panic. // If the signal handler sees a synchronous panic, it arranges the // stack to look like the function where the signal occurred called diff --git a/src/runtime/sizeof_test.go b/src/runtime/sizeof_test.go index 830055e2aa9..852244d4252 100644 --- a/src/runtime/sizeof_test.go +++ b/src/runtime/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package runtime_test import ( diff --git a/src/runtime/stubs2.go b/src/runtime/stubs2.go index 77513386b7d..cf2b1248125 100644 --- a/src/runtime/stubs2.go +++ b/src/runtime/stubs2.go @@ -5,7 +5,6 @@ // +build !plan9 // +build !solaris // +build !windows -// +build !nacl // +build !js // +build !darwin // +build !aix diff --git a/src/runtime/stubs3.go b/src/runtime/stubs3.go index f81372805e8..95eecc7ecaf 100644 --- a/src/runtime/stubs3.go +++ b/src/runtime/stubs3.go @@ -4,7 +4,6 @@ // +build !plan9 // +build !solaris -// +build !nacl // +build !freebsd // +build !darwin // +build !aix diff --git a/src/runtime/stubs32.go b/src/runtime/stubs32.go index 149560fd931..a7f52f6b9e2 100644 --- a/src/runtime/stubs32.go +++ b/src/runtime/stubs32.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 arm amd64p32 mips mipsle +// +build 386 arm mips mipsle package runtime diff --git a/src/runtime/stubs_amd64x.go b/src/runtime/stubs_amd64.go similarity index 93% rename from src/runtime/stubs_amd64x.go rename to src/runtime/stubs_amd64.go index e7a1be81359..b4c0df11532 100644 --- a/src/runtime/stubs_amd64x.go +++ b/src/runtime/stubs_amd64.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 amd64p32 - package runtime // stackcheck checks that SP is in range [g->stack.lo, g->stack.hi). diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index 367e06003ae..8296a8590db 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -253,6 +253,7 @@ const ( funcID_debugCallV1 funcID_gopanic funcID_panicwrap + funcID_handleAsyncEvents funcID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.) ) diff --git a/src/runtime/sys_nacl_386.s b/src/runtime/sys_nacl_386.s deleted file mode 100644 index 8460aabce32..00000000000 --- a/src/runtime/sys_nacl_386.s +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2013 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. - -#include "go_asm.h" -#include "go_tls.h" -#include "textflag.h" -#include "syscall_nacl.h" - -#define NACL_SYSCALL(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; CALL AX - -TEXT runtime·exit(SB),NOSPLIT,$4 - MOVL code+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_exit) - JMP 0(PC) - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$4-4 - MOVL wait+0(FP), AX - // SYS_thread_exit will clear *wait when the stack is free. - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_thread_exit) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$12 - MOVL name+0(FP), AX - MOVL AX, 0(SP) - MOVL mode+4(FP), AX - MOVL AX, 4(SP) - MOVL perm+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_open) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$4 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_close) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$12 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - MOVL p+4(FP), AX - MOVL AX, 4(SP) - MOVL n+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_read) - MOVL AX, ret+12(FP) - RET - -TEXT syscall·naclWrite(SB), NOSPLIT, $16-16 - MOVL arg1+0(FP), DI - MOVL arg2+4(FP), SI - MOVL arg3+8(FP), DX - MOVL DI, 0(SP) - MOVL SI, 4(SP) - MOVL DX, 8(SP) - CALL runtime·write(SB) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·write(SB),NOSPLIT,$12 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - MOVL p+4(FP), AX - MOVL AX, 4(SP) - MOVL n+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_write) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·nacl_exception_stack(SB),NOSPLIT,$8 - MOVL p+0(FP), AX - MOVL AX, 0(SP) - MOVL size+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_exception_stack) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_exception_handler(SB),NOSPLIT,$8 - MOVL fn+0(FP), AX - MOVL AX, 0(SP) - MOVL arg+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_exception_handler) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_sem_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_sem_wait(SB),NOSPLIT,$4 - MOVL sem+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_wait) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_sem_post(SB),NOSPLIT,$4 - MOVL sem+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_post) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_lock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_lock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_trylock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_trylock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_unlock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_unlock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_wait(SB),NOSPLIT,$8 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - MOVL n+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_cond_wait) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_signal(SB),NOSPLIT,$4 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_signal) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_broadcast(SB),NOSPLIT,$4 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_broadcast) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_timed_wait_abs(SB),NOSPLIT,$12 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - MOVL lock+4(FP), AX - MOVL AX, 4(SP) - MOVL ts+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_cond_timed_wait_abs) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·nacl_thread_create(SB),NOSPLIT,$16 - MOVL fn+0(FP), AX - MOVL AX, 0(SP) - MOVL stk+4(FP), AX - MOVL AX, 4(SP) - MOVL tls+8(FP), AX - MOVL AX, 8(SP) - MOVL xx+12(FP), AX - MOVL AX, 12(SP) - NACL_SYSCALL(SYS_thread_create) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·mstart_nacl(SB),NOSPLIT,$0 - JMP runtime·mstart(SB) - -TEXT runtime·nacl_nanosleep(SB),NOSPLIT,$8 - MOVL ts+0(FP), AX - MOVL AX, 0(SP) - MOVL extra+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_nanosleep) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·osyield(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_sched_yield) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$32 - MOVL addr+0(FP), AX - MOVL AX, 0(SP) - MOVL n+4(FP), AX - MOVL AX, 4(SP) - MOVL prot+8(FP), AX - MOVL AX, 8(SP) - MOVL flags+12(FP), AX - MOVL AX, 12(SP) - MOVL fd+16(FP), AX - MOVL AX, 16(SP) - MOVL off+20(FP), AX - MOVL AX, 24(SP) - MOVL $0, 28(SP) - LEAL 24(SP), AX - MOVL AX, 20(SP) - NACL_SYSCALL(SYS_mmap) - CMPL AX, $-4095 - JNA ok - NEGL AX - MOVL $0, p+24(FP) - MOVL AX, err+28(FP) - RET -ok: - MOVL AX, p+24(FP) - MOVL $0, err+28(FP) - RET - -TEXT runtime·walltime(SB),NOSPLIT,$20 - MOVL $0, 0(SP) // real time clock - LEAL 8(SP), AX - MOVL AX, 4(SP) // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVL 8(SP), AX // low 32 sec - MOVL 12(SP), CX // high 32 sec - MOVL 16(SP), BX // nsec - - // sec is in AX, nsec in BX - MOVL AX, sec_lo+0(FP) - MOVL CX, sec_hi+4(FP) - MOVL BX, nsec+8(FP) - RET - -TEXT syscall·now(SB),NOSPLIT,$0 - JMP runtime·walltime(SB) - -TEXT runtime·nanotime(SB),NOSPLIT,$20 - MOVL $0, 0(SP) // real time clock - LEAL 8(SP), AX - MOVL AX, 4(SP) // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVL 8(SP), AX // low 32 sec - MOVL 16(SP), BX // nsec - - // sec is in AX, nsec in BX - // convert to DX:AX nsec - MOVL $1000000000, CX - MULL CX - ADDL BX, AX - ADCL $0, DX - - MOVL AX, ret_lo+0(FP) - MOVL DX, ret_hi+4(FP) - RET - -TEXT runtime·setldt(SB),NOSPLIT,$8 - MOVL base+4(FP), BX - ADDL $0x8, BX - MOVL BX, 0(SP) - NACL_SYSCALL(SYS_tls_init) - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$0 - get_tls(CX) - - // check that g exists - MOVL g(CX), DI - CMPL DI, $0 - JNE 6(PC) - MOVL $11, BX - MOVL $0, 0(SP) - MOVL $runtime·badsignal(SB), AX - CALL AX - JMP ret - - // save g - NOP SP // tell vet SP changed - stop checking offsets - MOVL DI, 20(SP) - - // g = m->gsignal - MOVL g_m(DI), BX - MOVL m_gsignal(BX), BX - MOVL BX, g(CX) - - // copy arguments for sighandler - MOVL $11, 0(SP) // signal - MOVL $0, 4(SP) // siginfo - LEAL 8(SP), AX - MOVL AX, 8(SP) // context - MOVL DI, 12(SP) // g - - CALL runtime·sighandler(SB) - - // restore g - get_tls(CX) - MOVL 20(SP), BX - MOVL BX, g(CX) - -ret: - // Enable exceptions again. - NACL_SYSCALL(SYS_exception_clear_flag) - - // NaCl has abdicated its traditional operating system responsibility - // and declined to implement 'sigreturn'. Instead the only way to return - // to the execution of our program is to restore the registers ourselves. - // Unfortunately, that is impossible to do with strict fidelity, because - // there is no way to do the final update of PC that ends the sequence - // without either (1) jumping to a register, in which case the register ends - // holding the PC value instead of its intended value or (2) storing the PC - // on the stack and using RET, which imposes the requirement that SP is - // valid and that is okay to smash the word below it. The second would - // normally be the lesser of the two evils, except that on NaCl, the linker - // must rewrite RET into "POP reg; AND $~31, reg; JMP reg", so either way - // we are going to lose a register as a result of the incoming signal. - // Similarly, there is no way to restore EFLAGS; the usual way is to use - // POPFL, but NaCl rejects that instruction. We could inspect the bits and - // execute a sequence of instructions designed to recreate those flag - // settings, but that's a lot of work. - // - // Thankfully, Go's signal handlers never try to return directly to the - // executing code, so all the registers and EFLAGS are dead and can be - // smashed. The only registers that matter are the ones that are setting - // up for the simulated call that the signal handler has created. - // Today those registers are just PC and SP, but in case additional registers - // are relevant in the future (for example DX is the Go func context register) - // we restore as many registers as possible. - // - // We smash BP, because that's what the linker smashes during RET. - // - LEAL 72(SP), BP - MOVL 0(BP), AX - MOVL 4(BP), CX - MOVL 8(BP), DX - MOVL 12(BP), BX - MOVL 16(BP), SP - // 20(BP) is saved BP, never to be seen again - MOVL 24(BP), SI - MOVL 28(BP), DI - // 36(BP) is saved EFLAGS, never to be seen again - MOVL 32(BP), BP // saved PC - JMP BP - -// func getRandomData([]byte) -TEXT runtime·getRandomData(SB),NOSPLIT,$8-12 - MOVL arg_base+0(FP), AX - MOVL AX, 0(SP) - MOVL arg_len+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_get_random_bytes) - RET diff --git a/src/runtime/sys_nacl_amd64p32.s b/src/runtime/sys_nacl_amd64p32.s deleted file mode 100644 index 9f4f69cfc24..00000000000 --- a/src/runtime/sys_nacl_amd64p32.s +++ /dev/null @@ -1,482 +0,0 @@ -// Copyright 2013 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. - -#include "go_asm.h" -#include "go_tls.h" -#include "textflag.h" -#include "syscall_nacl.h" - -#define NACL_SYSCALL(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; CALL AX - -TEXT runtime·settls(SB),NOSPLIT,$0 - MOVL DI, TLS // really BP - RET - -TEXT runtime·exit(SB),NOSPLIT,$0 - MOVL code+0(FP), DI - NACL_SYSCALL(SYS_exit) - RET - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$0-4 - MOVL wait+0(FP), DI - // SYS_thread_exit will clear *wait when the stack is free. - NACL_SYSCALL(SYS_thread_exit) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$0 - MOVL name+0(FP), DI - MOVL mode+4(FP), SI - MOVL perm+8(FP), DX - NACL_SYSCALL(SYS_open) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI - NACL_SYSCALL(SYS_close) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI - MOVL p+4(FP), SI - MOVL n+8(FP), DX - NACL_SYSCALL(SYS_read) - MOVL AX, ret+16(FP) - RET - -TEXT syscall·naclWrite(SB), NOSPLIT, $24-20 - MOVL arg1+0(FP), DI - MOVL arg2+4(FP), SI - MOVL arg3+8(FP), DX - MOVL DI, 0(SP) - MOVL SI, 4(SP) - MOVL DX, 8(SP) - CALL runtime·write(SB) - MOVL 16(SP), AX - MOVL AX, ret+16(FP) - RET - -TEXT runtime·write(SB),NOSPLIT,$16-20 - // If using fake time and writing to stdout or stderr, - // emit playback header before actual data. - MOVQ runtime·faketime(SB), AX - CMPQ AX, $0 - JEQ write - MOVL fd+0(FP), DI - CMPL DI, $1 - JEQ playback - CMPL DI, $2 - JEQ playback - -write: - // Ordinary write. - MOVL fd+0(FP), DI - MOVL p+4(FP), SI - MOVL n+8(FP), DX - NACL_SYSCALL(SYS_write) - MOVL AX, ret+16(FP) - RET - - // Write with playback header. - // First, lock to avoid interleaving writes. -playback: - MOVL $1, BX - XCHGL runtime·writelock(SB), BX - CMPL BX, $0 - JNE playback - - MOVQ runtime·lastfaketime(SB), CX - MOVL runtime·lastfaketimefd(SB), BX - CMPL DI, BX - JE samefd - - // If the current fd doesn't match the fd of the previous write, - // ensure that the timestamp is strictly greater. That way, we can - // recover the original order even if we read the fds separately. - INCQ CX - MOVL DI, runtime·lastfaketimefd(SB) - -samefd: - CMPQ AX, CX - CMOVQLT CX, AX - MOVQ AX, runtime·lastfaketime(SB) - - // Playback header: 0 0 P B <8-byte time> <4-byte data length> - MOVL $(('B'<<24) | ('P'<<16)), 0(SP) - BSWAPQ AX - MOVQ AX, 4(SP) - MOVL n+8(FP), DX - BSWAPL DX - MOVL DX, 12(SP) - MOVL fd+0(FP), DI - MOVL SP, SI - MOVL $16, DX - NACL_SYSCALL(SYS_write) - - // Write actual data. - MOVL fd+0(FP), DI - MOVL p+4(FP), SI - MOVL n+8(FP), DX - NACL_SYSCALL(SYS_write) - - // Unlock. - MOVL $0, runtime·writelock(SB) - - MOVL AX, ret+16(FP) - RET - -TEXT runtime·nacl_exception_stack(SB),NOSPLIT,$0 - MOVL p+0(FP), DI - MOVL size+4(FP), SI - NACL_SYSCALL(SYS_exception_stack) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_exception_handler(SB),NOSPLIT,$0 - MOVL fn+0(FP), DI - MOVL arg+4(FP), SI - NACL_SYSCALL(SYS_exception_handler) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_sem_create(SB),NOSPLIT,$0 - MOVL flag+0(FP), DI - NACL_SYSCALL(SYS_sem_create) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_sem_wait(SB),NOSPLIT,$0 - MOVL sem+0(FP), DI - NACL_SYSCALL(SYS_sem_wait) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_sem_post(SB),NOSPLIT,$0 - MOVL sem+0(FP), DI - NACL_SYSCALL(SYS_sem_post) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_mutex_create(SB),NOSPLIT,$0 - MOVL flag+0(FP), DI - NACL_SYSCALL(SYS_mutex_create) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_mutex_lock(SB),NOSPLIT,$0 - MOVL mutex+0(FP), DI - NACL_SYSCALL(SYS_mutex_lock) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_mutex_trylock(SB),NOSPLIT,$0 - MOVL mutex+0(FP), DI - NACL_SYSCALL(SYS_mutex_trylock) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_mutex_unlock(SB),NOSPLIT,$0 - MOVL mutex+0(FP), DI - NACL_SYSCALL(SYS_mutex_unlock) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_create(SB),NOSPLIT,$0 - MOVL flag+0(FP), DI - NACL_SYSCALL(SYS_cond_create) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_wait(SB),NOSPLIT,$0 - MOVL cond+0(FP), DI - MOVL n+4(FP), SI - NACL_SYSCALL(SYS_cond_wait) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_signal(SB),NOSPLIT,$0 - MOVL cond+0(FP), DI - NACL_SYSCALL(SYS_cond_signal) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_broadcast(SB),NOSPLIT,$0 - MOVL cond+0(FP), DI - NACL_SYSCALL(SYS_cond_broadcast) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_timed_wait_abs(SB),NOSPLIT,$0 - MOVL cond+0(FP), DI - MOVL lock+4(FP), SI - MOVL ts+8(FP), DX - NACL_SYSCALL(SYS_cond_timed_wait_abs) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·nacl_thread_create(SB),NOSPLIT,$0 - MOVL fn+0(FP), DI - MOVL stk+4(FP), SI - MOVL tls+8(FP), DX - MOVL xx+12(FP), CX - NACL_SYSCALL(SYS_thread_create) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·mstart_nacl(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_tls_get) - SUBL $8, AX - MOVL AX, TLS - JMP runtime·mstart(SB) - -TEXT runtime·nacl_nanosleep(SB),NOSPLIT,$0 - MOVL ts+0(FP), DI - MOVL extra+4(FP), SI - NACL_SYSCALL(SYS_nanosleep) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·osyield(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_sched_yield) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$8 - MOVL addr+0(FP), DI - MOVL n+4(FP), SI - MOVL prot+8(FP), DX - MOVL flags+12(FP), CX - MOVL fd+16(FP), R8 - MOVL off+20(FP), AX - MOVQ AX, 0(SP) - MOVL SP, R9 - NACL_SYSCALL(SYS_mmap) - CMPL AX, $-4095 - JNA ok - NEGL AX - MOVL $0, p+24(FP) - MOVL AX, err+28(FP) - RET -ok: - MOVL AX, p+24(FP) - MOVL $0, err+28(FP) - RET - -TEXT runtime·walltime(SB),NOSPLIT,$16 - MOVQ runtime·faketime(SB), AX - CMPQ AX, $0 - JEQ realtime - MOVQ $0, DX - MOVQ $1000000000, CX - DIVQ CX - MOVQ AX, sec+0(FP) - MOVL DX, nsec+8(FP) - RET -realtime: - MOVL $0, DI // real time clock - LEAL 0(SP), AX - MOVL AX, SI // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVL 0(SP), AX // low 32 sec - MOVL 4(SP), CX // high 32 sec - MOVL 8(SP), BX // nsec - - // sec is in AX, nsec in BX - MOVL AX, sec_lo+0(FP) - MOVL CX, sec_hi+4(FP) - MOVL BX, nsec+8(FP) - RET - -TEXT syscall·now(SB),NOSPLIT,$0 - JMP runtime·walltime(SB) - -TEXT runtime·nanotime(SB),NOSPLIT,$16 - MOVQ runtime·faketime(SB), AX - CMPQ AX, $0 - JEQ 3(PC) - MOVQ AX, ret+0(FP) - RET - MOVL $0, DI // real time clock - LEAL 0(SP), AX - MOVL AX, SI // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVQ 0(SP), AX // sec - MOVL 8(SP), DX // nsec - - // sec is in AX, nsec in DX - // return nsec in AX - IMULQ $1000000000, AX - ADDQ DX, AX - MOVQ AX, ret+0(FP) - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$80 - // restore TLS register at time of execution, - // in case it's been smashed. - // the TLS register is really BP, but for consistency - // with non-NaCl systems it is referred to here as TLS. - // NOTE: Cannot use SYS_tls_get here (like we do in mstart_nacl), - // because the main thread never calls tls_set. - LEAL ctxt+0(FP), AX - MOVL (16*4+5*8)(AX), AX - MOVL AX, TLS - - // check that g exists - get_tls(CX) - MOVL g(CX), DI - - CMPL DI, $0 - JEQ nog - - // save g - MOVL DI, 20(SP) - - // g = m->gsignal - MOVL g_m(DI), BX - MOVL m_gsignal(BX), BX - MOVL BX, g(CX) - -//JMP debughandler - - // copy arguments for sighandler - MOVL $11, 0(SP) // signal - MOVL $0, 4(SP) // siginfo - LEAL ctxt+0(FP), AX - MOVL AX, 8(SP) // context - MOVL DI, 12(SP) // g - - CALL runtime·sighandler(SB) - - // restore g - get_tls(CX) - MOVL 20(SP), BX - MOVL BX, g(CX) - - // Enable exceptions again. - NACL_SYSCALL(SYS_exception_clear_flag) - - // Restore registers as best we can. Impossible to do perfectly. - // See comment in sys_nacl_386.s for extended rationale. - LEAL ctxt+0(FP), SI - ADDL $64, SI - MOVQ 0(SI), AX - MOVQ 8(SI), CX - MOVQ 16(SI), DX - MOVQ 24(SI), BX - MOVL 32(SI), SP // MOVL for SP sandboxing - // 40(SI) is saved BP aka TLS, already restored above - // 48(SI) is saved SI, never to be seen again - MOVQ 56(SI), DI - MOVQ 64(SI), R8 - MOVQ 72(SI), R9 - MOVQ 80(SI), R10 - MOVQ 88(SI), R11 - MOVQ 96(SI), R12 - MOVQ 104(SI), R13 - MOVQ 112(SI), R14 - // 120(SI) is R15, which is owned by Native Client and must not be modified - MOVQ 128(SI), SI // saved PC - // 136(SI) is saved EFLAGS, never to be seen again - JMP SI - -//debughandler: - //// print basic information - //LEAL ctxt+0(FP), DI - //MOVL $runtime·sigtrampf(SB), AX - //MOVL AX, 0(SP) - //MOVQ (16*4+16*8)(DI), BX // rip - //MOVQ BX, 8(SP) - //MOVQ (16*4+0*8)(DI), BX // rax - //MOVQ BX, 16(SP) - //MOVQ (16*4+1*8)(DI), BX // rcx - //MOVQ BX, 24(SP) - //MOVQ (16*4+2*8)(DI), BX // rdx - //MOVQ BX, 32(SP) - //MOVQ (16*4+3*8)(DI), BX // rbx - //MOVQ BX, 40(SP) - //MOVQ (16*4+7*8)(DI), BX // rdi - //MOVQ BX, 48(SP) - //MOVQ (16*4+15*8)(DI), BX // r15 - //MOVQ BX, 56(SP) - //MOVQ (16*4+4*8)(DI), BX // rsp - //MOVQ 0(BX), BX - //MOVQ BX, 64(SP) - //CALL runtime·printf(SB) - // - //LEAL ctxt+0(FP), DI - //MOVQ (16*4+16*8)(DI), BX // rip - //MOVL BX, 0(SP) - //MOVQ (16*4+4*8)(DI), BX // rsp - //MOVL BX, 4(SP) - //MOVL $0, 8(SP) // lr - //get_tls(CX) - //MOVL g(CX), BX - //MOVL BX, 12(SP) // gp - //CALL runtime·traceback(SB) - -notls: - MOVL 0, AX - RET - -nog: - MOVL 0, AX - RET - -// cannot do real signal handling yet, because gsignal has not been allocated. -MOVL $1, DI; NACL_SYSCALL(SYS_exit) - -// func getRandomData([]byte) -TEXT runtime·getRandomData(SB),NOSPLIT,$0-12 - MOVL arg_base+0(FP), DI - MOVL arg_len+4(FP), SI - NACL_SYSCALL(SYS_get_random_bytes) - RET - -TEXT runtime·nacl_sysinfo(SB),NOSPLIT,$16 -/* - MOVL di+0(FP), DI - LEAL 12(DI), BX - MOVL 8(DI), AX - ADDL 4(DI), AX - ADDL $2, AX - LEAL (BX)(AX*4), BX - MOVL BX, runtime·nacl_irt_query(SB) -auxloop: - MOVL 0(BX), DX - CMPL DX, $0 - JNE 2(PC) - RET - CMPL DX, $32 - JEQ auxfound - ADDL $8, BX - JMP auxloop -auxfound: - MOVL 4(BX), BX - MOVL BX, runtime·nacl_irt_query(SB) - - LEAL runtime·nacl_irt_basic_v0_1_str(SB), DI - LEAL runtime·nacl_irt_basic_v0_1(SB), SI - MOVL runtime·nacl_irt_basic_v0_1_size(SB), DX - MOVL runtime·nacl_irt_query(SB), BX - CALL BX - - LEAL runtime·nacl_irt_memory_v0_3_str(SB), DI - LEAL runtime·nacl_irt_memory_v0_3(SB), SI - MOVL runtime·nacl_irt_memory_v0_3_size(SB), DX - MOVL runtime·nacl_irt_query(SB), BX - CALL BX - - LEAL runtime·nacl_irt_thread_v0_1_str(SB), DI - LEAL runtime·nacl_irt_thread_v0_1(SB), SI - MOVL runtime·nacl_irt_thread_v0_1_size(SB), DX - MOVL runtime·nacl_irt_query(SB), BX - CALL BX - - // TODO: Once we have a NaCl SDK with futex syscall support, - // try switching to futex syscalls and here load the - // nacl-irt-futex-0.1 table. -*/ - RET diff --git a/src/runtime/sys_nacl_arm.s b/src/runtime/sys_nacl_arm.s deleted file mode 100644 index 90201683b7c..00000000000 --- a/src/runtime/sys_nacl_arm.s +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright 2014 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. - -#include "go_asm.h" -#include "go_tls.h" -#include "textflag.h" -#include "syscall_nacl.h" - -#define NACL_SYSCALL(code) \ - MOVW $(0x10000 + ((code)<<5)), R8; BL (R8) - -TEXT runtime·exit(SB),NOSPLIT,$0 - MOVW code+0(FP), R0 - NACL_SYSCALL(SYS_exit) - RET - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$4-4 - MOVW wait+0(FP), R0 - // SYS_thread_exit will clear *wait when the stack is free. - NACL_SYSCALL(SYS_thread_exit) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$0 - MOVW name+0(FP), R0 - MOVW name+0(FP), R1 - MOVW name+0(FP), R2 - NACL_SYSCALL(SYS_open) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - NACL_SYSCALL(SYS_close) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - MOVW p+4(FP), R1 - MOVW n+8(FP), R2 - NACL_SYSCALL(SYS_read) - MOVW R0, ret+12(FP) - RET - -// func naclWrite(fd int, b []byte) int -TEXT syscall·naclWrite(SB),NOSPLIT,$0 - MOVW arg1+0(FP), R0 - MOVW arg2+4(FP), R1 - MOVW arg3+8(FP), R2 - NACL_SYSCALL(SYS_write) - MOVW R0, ret+16(FP) - RET - -TEXT runtime·write(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - MOVW p+4(FP), R1 - MOVW n+8(FP), R2 - NACL_SYSCALL(SYS_write) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·nacl_exception_stack(SB),NOSPLIT,$0 - MOVW p+0(FP), R0 - MOVW size+4(FP), R1 - NACL_SYSCALL(SYS_exception_stack) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_exception_handler(SB),NOSPLIT,$0 - MOVW fn+0(FP), R0 - MOVW arg+4(FP), R1 - NACL_SYSCALL(SYS_exception_handler) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_sem_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_sem_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_sem_wait(SB),NOSPLIT,$0 - MOVW sem+0(FP), R0 - NACL_SYSCALL(SYS_sem_wait) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_sem_post(SB),NOSPLIT,$0 - MOVW sem+0(FP), R0 - NACL_SYSCALL(SYS_sem_post) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_mutex_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_lock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_lock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_trylock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_trylock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_unlock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_unlock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_cond_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_wait(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - MOVW n+4(FP), R1 - NACL_SYSCALL(SYS_cond_wait) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_cond_signal(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - NACL_SYSCALL(SYS_cond_signal) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_broadcast(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - NACL_SYSCALL(SYS_cond_broadcast) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_timed_wait_abs(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - MOVW lock+4(FP), R1 - MOVW ts+8(FP), R2 - NACL_SYSCALL(SYS_cond_timed_wait_abs) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·nacl_thread_create(SB),NOSPLIT,$0 - MOVW fn+0(FP), R0 - MOVW stk+4(FP), R1 - MOVW tls+8(FP), R2 - MOVW xx+12(FP), R3 - NACL_SYSCALL(SYS_thread_create) - MOVW R0, ret+16(FP) - RET - -TEXT runtime·mstart_nacl(SB),NOSPLIT,$0 - MOVW 0(R9), R0 // TLS - MOVW -8(R0), R1 // g - MOVW -4(R0), R2 // m - MOVW R2, g_m(R1) - MOVW R1, g - B runtime·mstart(SB) - -TEXT runtime·nacl_nanosleep(SB),NOSPLIT,$0 - MOVW ts+0(FP), R0 - MOVW extra+4(FP), R1 - NACL_SYSCALL(SYS_nanosleep) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·osyield(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_sched_yield) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$8 - MOVW addr+0(FP), R0 - MOVW n+4(FP), R1 - MOVW prot+8(FP), R2 - MOVW flags+12(FP), R3 - MOVW fd+16(FP), R4 - // arg6:offset should be passed as a pointer (to int64) - MOVW off+20(FP), R5 - MOVW R5, 4(R13) - MOVW $0, R6 - MOVW R6, 8(R13) - MOVW $4(R13), R5 - MOVM.DB.W [R4,R5], (R13) // arg5 and arg6 are passed on stack - NACL_SYSCALL(SYS_mmap) - MOVM.IA.W (R13), [R4, R5] - CMP $-4095, R0 - MOVW $0, R1 - RSB.HI $0, R0 - MOVW.HI R0, R1 // if error, put in R1 - MOVW.HI $0, R0 - MOVW R0, p+24(FP) - MOVW R1, err+28(FP) - RET - -TEXT runtime·walltime(SB),NOSPLIT,$16 - MOVW $0, R0 // real time clock - MOVW $4(R13), R1 - NACL_SYSCALL(SYS_clock_gettime) - MOVW 4(R13), R0 // low 32-bit sec - MOVW 8(R13), R1 // high 32-bit sec - MOVW 12(R13), R2 // nsec - MOVW R0, sec_lo+0(FP) - MOVW R1, sec_hi+4(FP) - MOVW R2, nsec+8(FP) - RET - -TEXT syscall·now(SB),NOSPLIT,$0 - B runtime·walltime(SB) - -// int64 nanotime(void) so really -// void nanotime(int64 *nsec) -TEXT runtime·nanotime(SB),NOSPLIT,$16 - MOVW $0, R0 // real time clock - MOVW $4(R13), R1 - NACL_SYSCALL(SYS_clock_gettime) - MOVW 4(R13), R0 // low 32-bit sec - MOVW 8(R13), R1 // high 32-bit sec (ignored for now) - MOVW 12(R13), R2 // nsec - MOVW $1000000000, R3 - MULLU R0, R3, (R1, R0) - MOVW $0, R4 - ADD.S R2, R0 - ADC R4, R1 - MOVW R0, ret_lo+0(FP) - MOVW R1, ret_hi+4(FP) - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$80 - // load g from thread context - MOVW $ctxt+-4(FP), R0 - MOVW (16*4+10*4)(R0), g - - // check that g exists - CMP $0, g - BNE 4(PC) - MOVW $runtime·badsignal2(SB), R11 - BL (R11) - RET - - // save g - MOVW g, R3 - MOVW g, 20(R13) - - // g = m->gsignal - MOVW g_m(g), R8 - MOVW m_gsignal(R8), g - - // copy arguments for call to sighandler - MOVW $11, R0 - MOVW R0, 4(R13) // signal - MOVW $0, R0 - MOVW R0, 8(R13) // siginfo - MOVW $ctxt+-4(FP), R0 - MOVW R0, 12(R13) // context - MOVW R3, 16(R13) // g - - BL runtime·sighandler(SB) - - // restore g - MOVW 20(R13), g - - // Enable exceptions again. - NACL_SYSCALL(SYS_exception_clear_flag) - - // Restore registers as best we can. Impossible to do perfectly. - // See comment in sys_nacl_386.s for extended rationale. - MOVW $ctxt+-4(FP), R1 - ADD $64, R1 - MOVW (0*4)(R1), R0 - MOVW (2*4)(R1), R2 - MOVW (3*4)(R1), R3 - MOVW (4*4)(R1), R4 - MOVW (5*4)(R1), R5 - MOVW (6*4)(R1), R6 - MOVW (7*4)(R1), R7 - MOVW (8*4)(R1), R8 - // cannot write to R9 - MOVW (10*4)(R1), g - MOVW (11*4)(R1), R11 - MOVW (12*4)(R1), R12 - MOVW (13*4)(R1), R13 - MOVW (14*4)(R1), R14 - MOVW (15*4)(R1), R1 - B (R1) - -nog: - MOVW $0, R0 - RET - -// func getRandomData([]byte) -TEXT runtime·getRandomData(SB),NOSPLIT,$0-12 - MOVW arg_base+0(FP), R0 - MOVW arg_len+4(FP), R1 - NACL_SYSCALL(SYS_get_random_bytes) - RET - -// Likewise, this is only valid for ARMv7+, but that's okay. -TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0 - B runtime·armPublicationBarrier(SB) - -TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 - WORD $0xe7fedef0 // NACL_INSTR_ARM_ABORT_NOW (UDF #0xEDE0) diff --git a/src/runtime/sys_wasm.s b/src/runtime/sys_wasm.s index 0cd1fe50808..41260bdf23e 100644 --- a/src/runtime/sys_wasm.s +++ b/src/runtime/sys_wasm.s @@ -17,10 +17,9 @@ loop: Get R2 I32Const $1 I32Sub - Set R2 + Tee R2 // n == 0 - Get R2 I32Eqz If Return @@ -54,10 +53,9 @@ loop: Get R1 I32Const $1 I32Sub - Set R1 + Tee R1 // n == 0 - Get R1 I32Eqz If Return diff --git a/src/runtime/sys_x86.go b/src/runtime/sys_x86.go index 2b4ed8bdf56..f917cb8bd7a 100644 --- a/src/runtime/sys_x86.go +++ b/src/runtime/sys_x86.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64 amd64p32 386 +// +build amd64 386 package runtime diff --git a/src/runtime/syscall_nacl.h b/src/runtime/syscall_nacl.h deleted file mode 100644 index 5ee75abdd61..00000000000 --- a/src/runtime/syscall_nacl.h +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by mknacl.sh; DO NOT EDIT. -#define SYS_null 1 -#define SYS_nameservice 2 -#define SYS_dup 8 -#define SYS_dup2 9 -#define SYS_open 10 -#define SYS_close 11 -#define SYS_read 12 -#define SYS_write 13 -#define SYS_lseek 14 -#define SYS_stat 16 -#define SYS_fstat 17 -#define SYS_chmod 18 -#define SYS_isatty 19 -#define SYS_brk 20 -#define SYS_mmap 21 -#define SYS_munmap 22 -#define SYS_getdents 23 -#define SYS_mprotect 24 -#define SYS_list_mappings 25 -#define SYS_exit 30 -#define SYS_getpid 31 -#define SYS_sched_yield 32 -#define SYS_sysconf 33 -#define SYS_gettimeofday 40 -#define SYS_clock 41 -#define SYS_nanosleep 42 -#define SYS_clock_getres 43 -#define SYS_clock_gettime 44 -#define SYS_mkdir 45 -#define SYS_rmdir 46 -#define SYS_chdir 47 -#define SYS_getcwd 48 -#define SYS_unlink 49 -#define SYS_imc_makeboundsock 60 -#define SYS_imc_accept 61 -#define SYS_imc_connect 62 -#define SYS_imc_sendmsg 63 -#define SYS_imc_recvmsg 64 -#define SYS_imc_mem_obj_create 65 -#define SYS_imc_socketpair 66 -#define SYS_mutex_create 70 -#define SYS_mutex_lock 71 -#define SYS_mutex_trylock 72 -#define SYS_mutex_unlock 73 -#define SYS_cond_create 74 -#define SYS_cond_wait 75 -#define SYS_cond_signal 76 -#define SYS_cond_broadcast 77 -#define SYS_cond_timed_wait_abs 79 -#define SYS_thread_create 80 -#define SYS_thread_exit 81 -#define SYS_tls_init 82 -#define SYS_thread_nice 83 -#define SYS_tls_get 84 -#define SYS_second_tls_set 85 -#define SYS_second_tls_get 86 -#define SYS_exception_handler 87 -#define SYS_exception_stack 88 -#define SYS_exception_clear_flag 89 -#define SYS_sem_create 100 -#define SYS_sem_wait 101 -#define SYS_sem_post 102 -#define SYS_sem_get_value 103 -#define SYS_dyncode_create 104 -#define SYS_dyncode_modify 105 -#define SYS_dyncode_delete 106 -#define SYS_test_infoleak 109 -#define SYS_test_crash 110 -#define SYS_test_syscall_1 111 -#define SYS_test_syscall_2 112 -#define SYS_futex_wait_abs 120 -#define SYS_futex_wake 121 -#define SYS_pread 130 -#define SYS_pwrite 131 -#define SYS_truncate 140 -#define SYS_lstat 141 -#define SYS_link 142 -#define SYS_rename 143 -#define SYS_symlink 144 -#define SYS_access 145 -#define SYS_readlink 146 -#define SYS_utimes 147 -#define SYS_get_random_bytes 150 diff --git a/src/runtime/testdata/testprog/signal.go b/src/runtime/testdata/testprog/signal.go index 2ccbada57b3..417e105c68a 100644 --- a/src/runtime/testdata/testprog/signal.go +++ b/src/runtime/testdata/testprog/signal.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9,!nacl +// +build !windows,!plan9 package main diff --git a/src/runtime/testdata/testprognet/signal.go b/src/runtime/testdata/testprognet/signal.go index a1559fe6163..4d2de79d97c 100644 --- a/src/runtime/testdata/testprognet/signal.go +++ b/src/runtime/testdata/testprognet/signal.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9,!nacl +// +build !windows,!plan9 // This is in testprognet instead of testprog because testprog // must not import anything (like net, but also like os/signal) diff --git a/src/runtime/time.go b/src/runtime/time.go index ac2a9aae8f5..d667d11244e 100644 --- a/src/runtime/time.go +++ b/src/runtime/time.go @@ -13,8 +13,6 @@ import ( // Package time knows the layout of this structure. // If this struct changes, adjust ../time/sleep.go:/runtimeTimer. -// For GOOS=nacl, package syscall knows the layout of this structure. -// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer. type timer struct { tb *timersBucket // the bucket the timer lives in i int // heap index diff --git a/src/runtime/time_fake.go b/src/runtime/time_fake.go index bef3a658735..c64d2994a90 100644 --- a/src/runtime/time_fake.go +++ b/src/runtime/time_fake.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // +build faketime -// +build !nacl // +build !windows // Faketime isn't currently supported on Windows. This would require: diff --git a/src/runtime/time_nofake.go b/src/runtime/time_nofake.go index 0b153b9583a..1912a94e873 100644 --- a/src/runtime/time_nofake.go +++ b/src/runtime/time_nofake.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // +build !faketime -// +build !nacl package runtime diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s index 350089abc6a..bed78913689 100644 --- a/src/runtime/tls_arm.s +++ b/src/runtime/tls_arm.s @@ -33,11 +33,6 @@ // runtime.mcall assumes this function only clobbers R0 and R11. // Returns with g in R0. TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 -#ifdef GOOS_nacl - // nothing to do as nacl/arm does not use TLS at all. - MOVW g, R0 // preserve R0 across call to setg<> - RET -#else // If the host does not support MRC the linker will replace it with // a call to runtime.read_tls_fallback which jumps to __kuser_get_tls. // The replacement function saves LR in R11 over the call to read_tls_fallback. @@ -48,16 +43,11 @@ TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 MOVW g, 0(R0) MOVW g, R0 // preserve R0 across call to setg<> RET -#endif // load_g loads the g register from pthread-provided // thread-local memory, for use after calling externally compiled // ARM code that overwrote those registers. TEXT runtime·load_g(SB),NOSPLIT,$0 -#ifdef GOOS_nacl - // nothing to do as nacl/arm does not use TLS at all. - RET -#else // See save_g MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer BIC $3, R0 // Darwin/ARM might return unaligned pointer @@ -65,7 +55,6 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 ADD R11, R0 MOVW 0(R0), g RET -#endif // This is called from rt0_go, which runs on the system stack // using the initial stack allocated by the OS. @@ -78,7 +67,6 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 // Declare a dummy word ($4, not $0) to make sure the // frame is 8 bytes and stays 8-byte-aligned. TEXT runtime·_initcgo(SB),NOSPLIT,$4 -#ifndef GOOS_nacl // if there is an _cgo_init, call it. MOVW _cgo_init(SB), R4 CMP $0, R4 @@ -93,7 +81,6 @@ TEXT runtime·_initcgo(SB),NOSPLIT,$4 MOVW $setg_gcc<>(SB), R1 // arg 1: setg MOVW g, R0 // arg 0: G BL (R4) // will clobber R0-R3 -#endif nocgo: RET diff --git a/src/runtime/trace.go b/src/runtime/trace.go index d074783550e..f919362be86 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -84,7 +84,7 @@ const ( // and ppc64le. // Tracing won't work reliably for architectures where cputicks is emulated // by nanotime, so the value doesn't matter for those architectures. - traceTickDiv = 16 + 48*(sys.Goarch386|sys.GoarchAmd64|sys.GoarchAmd64p32) + traceTickDiv = 16 + 48*(sys.Goarch386|sys.GoarchAmd64) // Maximum number of PCs in a single stack trace. // Since events contain only stack id rather than whole stack trace, // we can allow quite large values here. diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index ef48c9fa1f9..96fb33c04b2 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -26,8 +26,8 @@ import ( // takes up only 4 bytes on the stack, while on 64-bit systems it takes up 8 bytes. // Typically this is ptrSize. // -// As an exception, amd64p32 has ptrSize == 4 but the CALL instruction still -// stores an 8-byte return PC onto the stack. To accommodate this, we use regSize +// As an exception, amd64p32 had ptrSize == 4 but the CALL instruction still +// stored an 8-byte return PC onto the stack. To accommodate this, we used regSize // as the size of the architecture-pushed return PC. // // usesLR is defined below in terms of minFrameSize, which is defined in @@ -997,8 +997,8 @@ func topofstack(f funcInfo, g0 bool) bool { // isSystemGoroutine reports whether the goroutine g must be omitted // in stack dumps and deadlock detector. This is any goroutine that -// starts at a runtime.* entry point, except for runtime.main and -// sometimes runtime.runfinq. +// starts at a runtime.* entry point, except for runtime.main, +// runtime.handleAsyncEvents (wasm only) and sometimes runtime.runfinq. // // If fixed is true, any goroutine that can vary between user and // system (that is, the finalizer goroutine) is considered a user @@ -1009,7 +1009,7 @@ func isSystemGoroutine(gp *g, fixed bool) bool { if !f.valid() { return false } - if f.funcID == funcID_runtime_main { + if f.funcID == funcID_runtime_main || f.funcID == funcID_handleAsyncEvents { return false } if f.funcID == funcID_runfinq { diff --git a/src/runtime/type.go b/src/runtime/type.go index 9fb6558a32f..af1fa2e1ca9 100644 --- a/src/runtime/type.go +++ b/src/runtime/type.go @@ -14,6 +14,7 @@ import "unsafe" // cmd/compile/internal/gc/reflect.go // cmd/link/internal/ld/decodesym.go // reflect/type.go +// internal/reflectlite/type.go type tflag uint8 const ( @@ -26,6 +27,7 @@ const ( // Needs to be in sync with ../cmd/link/internal/ld/decodesym.go:/^func.commonsize, // ../cmd/compile/internal/gc/reflect.go:/^func.dcommontype and // ../reflect/type.go:/^type.rtype. +// ../internal/reflectlite/type.go:/^type.rtype. type _type struct { size uintptr ptrdata uintptr // size of memory prefix holding all pointers diff --git a/src/runtime/vlop_arm.s b/src/runtime/vlop_arm.s index 41d285874dd..3f28f03c482 100644 --- a/src/runtime/vlop_arm.s +++ b/src/runtime/vlop_arm.s @@ -40,9 +40,7 @@ #define Ra R11 // Be careful: Ra == R11 will be used by the linker for synthesized instructions. -// Note: this function does not have a frame. If it ever needs a frame, -// the RET instruction will clobber R12 on nacl, and the compiler's register -// allocator needs to know. +// Note: this function does not have a frame. TEXT runtime·udiv(SB),NOSPLIT|NOFRAME,$0 MOVBU internal∕cpu·ARM+const_offsetARMHasIDIVA(SB), Ra CMP $0, Ra diff --git a/src/sync/atomic/atomic_test.go b/src/sync/atomic/atomic_test.go index 39c40c6aaf5..135f02a726a 100644 --- a/src/sync/atomic/atomic_test.go +++ b/src/sync/atomic/atomic_test.go @@ -1391,15 +1391,8 @@ func TestUnaligned64(t *testing.T) { // Unaligned 64-bit atomics on 32-bit systems are // a continual source of pain. Test that on 32-bit systems they crash // instead of failing silently. - - switch runtime.GOARCH { - default: - if !arch32 { - t.Skip("test only runs on 32-bit systems") - } - case "amd64p32": - // amd64p32 can handle unaligned atomics. - t.Skipf("test not needed on %v", runtime.GOARCH) + if !arch32 { + t.Skip("test only runs on 32-bit systems") } x := make([]uint32, 4) diff --git a/src/syscall/asm_freebsd_arm64.s b/src/syscall/asm_freebsd_arm64.s new file mode 100644 index 00000000000..7a0809b8ec9 --- /dev/null +++ b/src/syscall/asm_freebsd_arm64.s @@ -0,0 +1,128 @@ +// Copyright 2019 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. + +#include "textflag.h" + +// +// System call support for ARM64, FreeBSD +// + +#define SYS_syscall 0 + +// func Syscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr) +TEXT ·Syscall(SB),NOSPLIT,$0-56 + BL runtime·entersyscall(SB) + MOVD trap+0(FP), R8 // syscall entry + MOVD a1+8(FP), R0 + MOVD a2+16(FP), R1 + MOVD a3+24(FP), R2 + SVC $SYS_syscall + BCC ok + MOVD $-1, R1 + MOVD R1, r1+32(FP) + MOVD ZR, r2+40(FP) + MOVD R0, err+48(FP) + BL runtime·exitsyscall(SB) + RET +ok: + MOVD R0, r1+32(FP) + MOVD R1, r2+40(FP) + MOVD ZR, err+48(FP) + BL runtime·exitsyscall(SB) + RET + +// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr) +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + MOVD trap+0(FP), R8 // syscall entry + MOVD a1+8(FP), R0 + MOVD a2+16(FP), R1 + MOVD a3+24(FP), R2 + SVC $SYS_syscall + BCC ok + MOVD $-1, R1 + MOVD R1, r1+32(FP) + MOVD ZR, r2+40(FP) + MOVD R0, err+48(FP) + RET +ok: + MOVD R0, r1+32(FP) + MOVD R1, r2+40(FP) + MOVD ZR, err+48(FP) + RET + +// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + BL runtime·entersyscall(SB) + MOVD trap+0(FP), R8 // syscall entry + MOVD a1+8(FP), R0 + MOVD a2+16(FP), R1 + MOVD a3+24(FP), R2 + MOVD a4+32(FP), R3 + MOVD a5+40(FP), R4 + MOVD a6+48(FP), R5 + SVC $SYS_syscall + BCC ok + MOVD $-1, R1 + MOVD R1, r1+56(FP) + MOVD ZR, r2+64(FP) + MOVD R0, err+72(FP) + BL runtime·exitsyscall(SB) + RET +ok: + MOVD R0, r1+56(FP) + MOVD R1, r2+64(FP) + MOVD ZR, err+72(FP) + BL runtime·exitsyscall(SB) + RET + +// func RawSyscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + MOVD trap+0(FP), R8 // syscall entry + MOVD a1+8(FP), R0 + MOVD a2+16(FP), R1 + MOVD a3+24(FP), R2 + MOVD a4+32(FP), R3 + MOVD a5+40(FP), R4 + MOVD a6+48(FP), R5 + SVC $SYS_syscall + BCC ok + MOVD $-1, R1 + MOVD R1, r1+56(FP) + MOVD ZR, r2+64(FP) + MOVD R0, err+72(FP) + RET +ok: + MOVD R0, r1+56(FP) + MOVD R1, r2+64(FP) + MOVD ZR, err+72(FP) + RET + +// Actually Syscall7 +// func Syscall9(num uintptr, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr) +TEXT ·Syscall9(SB),NOSPLIT,$0-104 + BL runtime·entersyscall(SB) + MOVD num+0(FP), R8 // syscall entry + MOVD a1+8(FP), R0 + MOVD a2+16(FP), R1 + MOVD a3+24(FP), R2 + MOVD a4+32(FP), R3 + MOVD a5+40(FP), R4 + MOVD a6+48(FP), R5 + MOVD a7+56(FP), R6 + // MOVD a8+64(FP), R7 + // MOVD a9+72(FP), R8 + SVC $SYS_syscall + BCC ok + MOVD $-1, R1 + MOVD R1, r1+80(FP) + MOVD ZR, r2+88(FP) + MOVD R0, err+96(FP) + BL runtime·exitsyscall(SB) + RET +ok: + MOVD R0, r1+80(FP) + MOVD R1, r2+88(FP) + MOVD ZR, err+96(FP) + BL runtime·exitsyscall(SB) + RET diff --git a/src/syscall/asm_nacl_386.s b/src/syscall/asm_nacl_386.s deleted file mode 100644 index b9891711200..00000000000 --- a/src/syscall/asm_nacl_386.s +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" -#include "funcdata.h" -#include "../runtime/syscall_nacl.h" - -// -// System call support for 386, Native Client -// - -#define NACL_SYSCALL(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; CALL AX - -#define NACL_SYSJMP(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; JMP AX - -TEXT ·Syscall(SB),NOSPLIT,$12-28 - NO_LOCAL_POINTERS - CALL runtime·entersyscall(SB) - MOVL trap+0(FP), AX - MOVL a1+4(FP), BX - MOVL BX, 0(SP) - MOVL a2+8(FP), BX - MOVL BX, 4(SP) - MOVL a3+12(FP), BX - MOVL BX, 8(SP) - SHLL $5, AX - ADDL $0x10000, AX - CALL AX - CMPL AX, $0 - JGE ok - MOVL $-1, r1+16(FP) - MOVL $-1, r2+20(FP) - NEGL AX - MOVL AX, err+24(FP) - CALL runtime·exitsyscall(SB) - RET -ok: - MOVL AX, r1+16(FP) - MOVL DX, r2+20(FP) - MOVL $0, err+24(FP) - CALL runtime·exitsyscall(SB) - RET diff --git a/src/syscall/asm_nacl_amd64p32.s b/src/syscall/asm_nacl_amd64p32.s deleted file mode 100644 index 816f7dccfbf..00000000000 --- a/src/syscall/asm_nacl_amd64p32.s +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" -#include "funcdata.h" -#include "../runtime/syscall_nacl.h" - -// -// System call support for amd64, Native Client -// - -#define NACL_SYSCALL(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; CALL AX - -#define NACL_SYSJMP(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; JMP AX - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - CALL runtime·entersyscall(SB) - MOVL trap+0(FP), AX - MOVL a1+4(FP), DI - MOVL a2+8(FP), SI - MOVL a3+12(FP), DX - // more args would use CX, R8, R9 - SHLL $5, AX - ADDL $0x10000, AX - CALL AX - CMPL AX, $0 - JGE ok - MOVL $-1, r1+16(FP) - MOVL $-1, r2+20(FP) - NEGL AX - MOVL AX, err+24(FP) - CALL runtime·exitsyscall(SB) - RET -ok: - MOVL AX, r1+16(FP) - MOVL DX, r2+20(FP) - MOVL $0, err+24(FP) - CALL runtime·exitsyscall(SB) - RET diff --git a/src/syscall/asm_nacl_arm.s b/src/syscall/asm_nacl_arm.s deleted file mode 100644 index 6092afd9e6c..00000000000 --- a/src/syscall/asm_nacl_arm.s +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 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. - -#include "textflag.h" -#include "funcdata.h" -#include "../runtime/syscall_nacl.h" - -// -// System call support for ARM, Native Client -// - -#define NACL_SYSCALL(code) \ - MOVW $(0x10000 + ((code)<<5)), R8; BL (R8) - -#define NACL_SYSJMP(code) \ - MOVW $(0x10000 + ((code)<<5)), R8; B (R8) - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - BL runtime·entersyscall(SB) - MOVW trap+0(FP), R8 - MOVW a1+4(FP), R0 - MOVW a2+8(FP), R1 - MOVW a3+12(FP), R2 - // more args would use R3, and then stack. - MOVW $0x10000, R7 - ADD R8<<5, R7 - BL (R7) - CMP $0, R0 - BGE ok - MOVW $-1, R1 - MOVW R1, r1+16(FP) - MOVW R1, r2+20(FP) - RSB $0, R0 - MOVW R0, err+24(FP) - BL runtime·exitsyscall(SB) - RET -ok: - MOVW R0, r1+16(FP) - MOVW R1, r2+20(FP) - MOVW $0, R2 - MOVW R2, err+24(FP) - BL runtime·exitsyscall(SB) - RET diff --git a/src/syscall/dirent.go b/src/syscall/dirent.go index 5c7af42b0c9..fab123d4a7d 100644 --- a/src/syscall/dirent.go +++ b/src/syscall/dirent.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package syscall diff --git a/src/syscall/endian_little.go b/src/syscall/endian_little.go index 013d878b8df..b633490b717 100644 --- a/src/syscall/endian_little.go +++ b/src/syscall/endian_little.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // -// +build 386 amd64 amd64p32 arm arm64 ppc64le mips64le mipsle wasm +// +build 386 amd64 arm arm64 ppc64le mips64le mipsle wasm package syscall diff --git a/src/syscall/env_unix.go b/src/syscall/env_unix.go index 0b6b711a8ff..e80a3ff1c96 100644 --- a/src/syscall/env_unix.go +++ b/src/syscall/env_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris // Unix environment variables. diff --git a/src/syscall/fd_nacl.go b/src/syscall/fd_nacl.go deleted file mode 100644 index b31aa58c498..00000000000 --- a/src/syscall/fd_nacl.go +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright 2013 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. - -// File descriptor support for Native Client. -// We want to provide access to a broader range of (simulated) files than -// Native Client allows, so we maintain our own file descriptor table exposed -// to higher-level packages. - -package syscall - -import ( - "io" - "sync" -) - -// files is the table indexed by a file descriptor. -var files struct { - sync.RWMutex - tab []*file -} - -// A file is an open file, something with a file descriptor. -// A particular *file may appear in files multiple times, due to use of Dup or Dup2. -type file struct { - fdref int // uses in files.tab - impl fileImpl // underlying implementation -} - -// A fileImpl is the implementation of something that can be a file. -type fileImpl interface { - // Standard operations. - // These can be called concurrently from multiple goroutines. - stat(*Stat_t) error - read([]byte) (int, error) - write([]byte) (int, error) - seek(int64, int) (int64, error) - pread([]byte, int64) (int, error) - pwrite([]byte, int64) (int, error) - - // Close is called when the last reference to a *file is removed - // from the file descriptor table. It may be called concurrently - // with active operations such as blocked read or write calls. - close() error -} - -// newFD adds impl to the file descriptor table, -// returning the new file descriptor. -// Like Unix, it uses the lowest available descriptor. -func newFD(impl fileImpl) int { - files.Lock() - defer files.Unlock() - f := &file{impl: impl, fdref: 1} - for fd, oldf := range files.tab { - if oldf == nil { - files.tab[fd] = f - return fd - } - } - fd := len(files.tab) - files.tab = append(files.tab, f) - return fd -} - -// Install Native Client stdin, stdout, stderr. -func init() { - newFD(&naclFile{naclFD: 0}) - newFD(&naclFile{naclFD: 1}) - newFD(&naclFile{naclFD: 2}) -} - -// fdToFile retrieves the *file corresponding to a file descriptor. -func fdToFile(fd int) (*file, error) { - files.Lock() - defer files.Unlock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil { - return nil, EBADF - } - return files.tab[fd], nil -} - -func Close(fd int) error { - files.Lock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil { - files.Unlock() - return EBADF - } - f := files.tab[fd] - files.tab[fd] = nil - f.fdref-- - fdref := f.fdref - files.Unlock() - if fdref > 0 { - return nil - } - return f.impl.close() -} - -func CloseOnExec(fd int) { - // nothing to do - no exec -} - -func Dup(fd int) (int, error) { - files.Lock() - defer files.Unlock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil { - return -1, EBADF - } - f := files.tab[fd] - f.fdref++ - for newfd, oldf := range files.tab { - if oldf == nil { - files.tab[newfd] = f - return newfd, nil - } - } - newfd := len(files.tab) - files.tab = append(files.tab, f) - return newfd, nil -} - -func Dup2(fd, newfd int) error { - files.Lock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil || newfd < 0 || newfd >= len(files.tab)+100 { - files.Unlock() - return EBADF - } - f := files.tab[fd] - f.fdref++ - for cap(files.tab) <= newfd { - files.tab = append(files.tab[:cap(files.tab)], nil) - } - oldf := files.tab[newfd] - var oldfdref int - if oldf != nil { - oldf.fdref-- - oldfdref = oldf.fdref - } - files.tab[newfd] = f - files.Unlock() - if oldf != nil { - if oldfdref == 0 { - oldf.impl.close() - } - } - return nil -} - -func Fstat(fd int, st *Stat_t) error { - f, err := fdToFile(fd) - if err != nil { - return err - } - return f.impl.stat(st) -} - -func Read(fd int, b []byte) (int, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.read(b) -} - -var zerobuf [0]byte - -func Write(fd int, b []byte) (int, error) { - if b == nil { - // avoid nil in syscalls; nacl doesn't like that. - b = zerobuf[:] - } - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.write(b) -} - -func Pread(fd int, b []byte, offset int64) (int, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.pread(b, offset) -} - -func Pwrite(fd int, b []byte, offset int64) (int, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.pwrite(b, offset) -} - -func Seek(fd int, offset int64, whence int) (int64, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.seek(offset, whence) -} - -// defaulFileImpl implements fileImpl. -// It can be embedded to complete a partial fileImpl implementation. -type defaultFileImpl struct{} - -func (*defaultFileImpl) close() error { return nil } -func (*defaultFileImpl) stat(*Stat_t) error { return ENOSYS } -func (*defaultFileImpl) read([]byte) (int, error) { return 0, ENOSYS } -func (*defaultFileImpl) write([]byte) (int, error) { return 0, ENOSYS } -func (*defaultFileImpl) seek(int64, int) (int64, error) { return 0, ENOSYS } -func (*defaultFileImpl) pread([]byte, int64) (int, error) { return 0, ENOSYS } -func (*defaultFileImpl) pwrite([]byte, int64) (int, error) { return 0, ENOSYS } - -// naclFile is the fileImpl implementation for a Native Client file descriptor. -type naclFile struct { - defaultFileImpl - naclFD int -} - -func (f *naclFile) stat(st *Stat_t) error { - return naclFstat(f.naclFD, st) -} - -func (f *naclFile) read(b []byte) (int, error) { - n, err := naclRead(f.naclFD, b) - if err != nil { - n = 0 - } - return n, err -} - -// implemented in package runtime, to add time header on playground -func naclWrite(fd int, b []byte) int - -func (f *naclFile) write(b []byte) (int, error) { - n := naclWrite(f.naclFD, b) - if n < 0 { - return 0, Errno(-n) - } - return n, nil -} - -func (f *naclFile) seek(off int64, whence int) (int64, error) { - old := off - err := naclSeek(f.naclFD, &off, whence) - if err != nil { - return old, err - } - return off, nil -} - -func (f *naclFile) prw(b []byte, offset int64, rw func([]byte) (int, error)) (int, error) { - // NaCl has no pread; simulate with seek and hope for no races. - old, err := f.seek(0, io.SeekCurrent) - if err != nil { - return 0, err - } - if _, err := f.seek(offset, io.SeekStart); err != nil { - return 0, err - } - n, err := rw(b) - f.seek(old, io.SeekStart) - return n, err -} - -func (f *naclFile) pread(b []byte, offset int64) (int, error) { - return f.prw(b, offset, f.read) -} - -func (f *naclFile) pwrite(b []byte, offset int64) (int, error) { - return f.prw(b, offset, f.write) -} - -func (f *naclFile) close() error { - err := naclClose(f.naclFD) - f.naclFD = -1 - return err -} - -// A pipeFile is an in-memory implementation of a pipe. -// The byteq implementation is in net_nacl.go. -type pipeFile struct { - defaultFileImpl - rd *byteq - wr *byteq -} - -func (f *pipeFile) close() error { - if f.rd != nil { - f.rd.close() - } - if f.wr != nil { - f.wr.close() - } - return nil -} - -func (f *pipeFile) read(b []byte) (int, error) { - if f.rd == nil { - return 0, EINVAL - } - n, err := f.rd.read(b, 0) - if err == EAGAIN { - err = nil - } - return n, err -} - -func (f *pipeFile) write(b []byte) (int, error) { - if f.wr == nil { - return 0, EINVAL - } - n, err := f.wr.write(b, 0) - if err == EAGAIN { - err = EPIPE - } - return n, err -} - -func Pipe(fd []int) error { - q := newByteq() - fd[0] = newFD(&pipeFile{rd: q}) - fd[1] = newFD(&pipeFile{wr: q}) - return nil -} diff --git a/src/syscall/fs_nacl.go b/src/syscall/fs_nacl.go deleted file mode 100644 index dfe13d92a13..00000000000 --- a/src/syscall/fs_nacl.go +++ /dev/null @@ -1,846 +0,0 @@ -// Copyright 2013 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. - -// A simulated Unix-like file system for use within NaCl. -// -// The simulation is not particularly tied to NaCl other than the reuse -// of NaCl's definition for the Stat_t structure. -// -// The file system need never be written to disk, so it is represented as -// in-memory Go data structures, never in a serialized form. -// -// TODO: Perhaps support symlinks, although they muck everything up. - -package syscall - -import ( - "io" - "sync" - "unsafe" -) - -// Provided by package runtime. -func now() (sec int64, nsec int32) - -// An fsys is a file system. -// Since there is no I/O (everything is in memory), -// the global lock mu protects the whole file system state, -// and that's okay. -type fsys struct { - mu sync.Mutex - root *inode // root directory - cwd *inode // process current directory - inum uint64 // number of inodes created - dev []func() (devFile, error) // table for opening devices -} - -// A devFile is the implementation required of device files -// like /dev/null or /dev/random. -type devFile interface { - pread([]byte, int64) (int, error) - pwrite([]byte, int64) (int, error) -} - -// An inode is a (possibly special) file in the file system. -type inode struct { - Stat_t - data []byte - dir []dirent -} - -// A dirent describes a single directory entry. -type dirent struct { - name string - inode *inode -} - -// An fsysFile is the fileImpl implementation backed by the file system. -type fsysFile struct { - defaultFileImpl - fsys *fsys - inode *inode - openmode int - offset int64 - dev devFile -} - -// newFsys creates a new file system. -func newFsys() *fsys { - fs := &fsys{} - fs.mu.Lock() - defer fs.mu.Unlock() - ip := fs.newInode() - ip.Mode = 0555 | S_IFDIR - fs.dirlink(ip, ".", ip) - fs.dirlink(ip, "..", ip) - fs.cwd = ip - fs.root = ip - return fs -} - -var fs = newFsys() -var fsinit = func() {} - -func init() { - // do not trigger loading of zipped file system here - oldFsinit := fsinit - defer func() { fsinit = oldFsinit }() - fsinit = func() {} - Mkdir("/dev", 0555) - Mkdir("/tmp", 0777) - mkdev("/dev/null", 0666, openNull) - mkdev("/dev/random", 0444, openRandom) - mkdev("/dev/urandom", 0444, openRandom) - mkdev("/dev/zero", 0666, openZero) - chdirEnv() -} - -func chdirEnv() { - pwd, ok := Getenv("NACLPWD") - if ok { - chdir(pwd) - } -} - -// Except where indicated otherwise, unexported methods on fsys -// expect fs.mu to have been locked by the caller. - -// newInode creates a new inode. -func (fs *fsys) newInode() *inode { - fs.inum++ - ip := &inode{ - Stat_t: Stat_t{ - Ino: fs.inum, - Blksize: 512, - }, - } - return ip -} - -// atime sets ip.Atime to the current time. -func (fs *fsys) atime(ip *inode) { - sec, nsec := now() - ip.Atime, ip.AtimeNsec = sec, int64(nsec) -} - -// mtime sets ip.Mtime to the current time. -func (fs *fsys) mtime(ip *inode) { - sec, nsec := now() - ip.Mtime, ip.MtimeNsec = sec, int64(nsec) -} - -// dirlookup looks for an entry in the directory dp with the given name. -// It returns the directory entry and its index within the directory. -func (fs *fsys) dirlookup(dp *inode, name string) (de *dirent, index int, err error) { - fs.atime(dp) - for i := range dp.dir { - de := &dp.dir[i] - if de.name == name { - fs.atime(de.inode) - return de, i, nil - } - } - return nil, 0, ENOENT -} - -// dirlink adds to the directory dp an entry for name pointing at the inode ip. -// If dp already contains an entry for name, that entry is overwritten. -func (fs *fsys) dirlink(dp *inode, name string, ip *inode) { - fs.mtime(dp) - fs.atime(ip) - ip.Nlink++ - for i := range dp.dir { - if dp.dir[i].name == name { - dp.dir[i] = dirent{name, ip} - return - } - } - dp.dir = append(dp.dir, dirent{name, ip}) - dp.dirSize() -} - -func (dp *inode) dirSize() { - dp.Size = int64(len(dp.dir)) * (8 + 8 + 2 + 256) // Dirent -} - -// skipelem splits path into the first element and the remainder. -// the returned first element contains no slashes, and the returned -// remainder does not begin with a slash. -func skipelem(path string) (elem, rest string) { - for len(path) > 0 && path[0] == '/' { - path = path[1:] - } - if len(path) == 0 { - return "", "" - } - i := 0 - for i < len(path) && path[i] != '/' { - i++ - } - elem, path = path[:i], path[i:] - for len(path) > 0 && path[0] == '/' { - path = path[1:] - } - return elem, path -} - -// namei translates a file system path name into an inode. -// If parent is false, the returned ip corresponds to the given name, and elem is the empty string. -// If parent is true, the walk stops at the next-to-last element in the name, -// so that ip is the parent directory and elem is the final element in the path. -func (fs *fsys) namei(path string, parent bool) (ip *inode, elem string, err error) { - // Reject NUL in name. - for i := 0; i < len(path); i++ { - if path[i] == '\x00' { - return nil, "", EINVAL - } - } - - // Reject empty name. - if path == "" { - return nil, "", EINVAL - } - - if path[0] == '/' { - ip = fs.root - } else { - ip = fs.cwd - } - - for len(path) > 0 && path[len(path)-1] == '/' { - path = path[:len(path)-1] - } - - for { - elem, rest := skipelem(path) - if elem == "" { - if parent && ip.Mode&S_IFMT == S_IFDIR { - return ip, ".", nil - } - break - } - if ip.Mode&S_IFMT != S_IFDIR { - return nil, "", ENOTDIR - } - if len(elem) >= 256 { - return nil, "", ENAMETOOLONG - } - if parent && rest == "" { - // Stop one level early. - return ip, elem, nil - } - de, _, err := fs.dirlookup(ip, elem) - if err != nil { - return nil, "", err - } - ip = de.inode - path = rest - } - if parent { - return nil, "", ENOTDIR - } - return ip, "", nil -} - -// open opens or creates a file with the given name, open mode, -// and permission mode bits. -func (fs *fsys) open(name string, openmode int, mode uint32) (fileImpl, error) { - dp, elem, err := fs.namei(name, true) - if err != nil { - return nil, err - } - var ( - ip *inode - dev devFile - ) - de, _, err := fs.dirlookup(dp, elem) - if err != nil { - if openmode&O_CREATE == 0 { - return nil, err - } - ip = fs.newInode() - ip.Mode = mode - fs.dirlink(dp, elem, ip) - if ip.Mode&S_IFMT == S_IFDIR { - fs.dirlink(ip, ".", ip) - fs.dirlink(ip, "..", dp) - } - } else { - ip = de.inode - if openmode&(O_CREATE|O_EXCL) == O_CREATE|O_EXCL { - return nil, EEXIST - } - if openmode&O_TRUNC != 0 { - if ip.Mode&S_IFMT == S_IFDIR { - return nil, EISDIR - } - ip.data = nil - } - if ip.Mode&S_IFMT == S_IFCHR { - if ip.Rdev < 0 || ip.Rdev >= int64(len(fs.dev)) || fs.dev[ip.Rdev] == nil { - return nil, ENODEV - } - dev, err = fs.dev[ip.Rdev]() - if err != nil { - return nil, err - } - } - } - - switch openmode & O_ACCMODE { - case O_WRONLY, O_RDWR: - if ip.Mode&S_IFMT == S_IFDIR { - return nil, EISDIR - } - } - - switch ip.Mode & S_IFMT { - case S_IFDIR: - if openmode&O_ACCMODE != O_RDONLY { - return nil, EISDIR - } - - case S_IFREG: - // ok - - case S_IFCHR: - // handled above - - default: - // TODO: some kind of special file - return nil, EPERM - } - - f := &fsysFile{ - fsys: fs, - inode: ip, - openmode: openmode, - dev: dev, - } - if openmode&O_APPEND != 0 { - f.offset = ip.Size - } - return f, nil -} - -// fsysFile methods to implement fileImpl. - -func (f *fsysFile) stat(st *Stat_t) error { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - *st = f.inode.Stat_t - return nil -} - -func (f *fsysFile) read(b []byte) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - n, err := f.preadLocked(b, f.offset) - f.offset += int64(n) - return n, err -} - -func ReadDirent(fd int, buf []byte) (int, error) { - f, err := fdToFsysFile(fd) - if err != nil { - return 0, err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - if f.inode.Mode&S_IFMT != S_IFDIR { - return 0, EINVAL - } - n, err := f.preadLocked(buf, f.offset) - f.offset += int64(n) - return n, err -} - -func (f *fsysFile) write(b []byte) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - n, err := f.pwriteLocked(b, f.offset) - f.offset += int64(n) - return n, err -} - -func (f *fsysFile) seek(offset int64, whence int) (int64, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - switch whence { - case io.SeekCurrent: - offset += f.offset - case io.SeekEnd: - offset += f.inode.Size - } - if offset < 0 { - return 0, EINVAL - } - if offset > f.inode.Size { - return 0, EINVAL - } - f.offset = offset - return offset, nil -} - -func (f *fsysFile) pread(b []byte, offset int64) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - return f.preadLocked(b, offset) -} - -func (f *fsysFile) pwrite(b []byte, offset int64) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - return f.pwriteLocked(b, offset) -} - -func (f *fsysFile) preadLocked(b []byte, offset int64) (int, error) { - if f.openmode&O_ACCMODE == O_WRONLY { - return 0, EINVAL - } - if offset < 0 { - return 0, EINVAL - } - if f.dev != nil { - f.fsys.atime(f.inode) - f.fsys.mu.Unlock() - defer f.fsys.mu.Lock() - return f.dev.pread(b, offset) - } - if offset > f.inode.Size { - return 0, nil - } - if int64(len(b)) > f.inode.Size-offset { - b = b[:f.inode.Size-offset] - } - - if f.inode.Mode&S_IFMT == S_IFDIR { - if offset%direntSize != 0 || len(b) != 0 && len(b) < direntSize { - return 0, EINVAL - } - fs.atime(f.inode) - n := 0 - for len(b) >= direntSize { - src := f.inode.dir[int(offset/direntSize)] - dst := (*Dirent)(unsafe.Pointer(&b[0])) - dst.Ino = int64(src.inode.Ino) - dst.Off = offset - dst.Reclen = direntSize - for i := range dst.Name { - dst.Name[i] = 0 - } - copy(dst.Name[:], src.name) - n += direntSize - offset += direntSize - b = b[direntSize:] - } - return n, nil - } - - fs.atime(f.inode) - n := copy(b, f.inode.data[offset:]) - return n, nil -} - -func (f *fsysFile) pwriteLocked(b []byte, offset int64) (int, error) { - if f.openmode&O_ACCMODE == O_RDONLY { - return 0, EINVAL - } - if offset < 0 { - return 0, EINVAL - } - if f.dev != nil { - f.fsys.atime(f.inode) - f.fsys.mu.Unlock() - defer f.fsys.mu.Lock() - return f.dev.pwrite(b, offset) - } - if offset > f.inode.Size { - return 0, EINVAL - } - f.fsys.mtime(f.inode) - n := copy(f.inode.data[offset:], b) - if n < len(b) { - f.inode.data = append(f.inode.data, b[n:]...) - f.inode.Size = int64(len(f.inode.data)) - } - return len(b), nil -} - -// Standard Unix system calls. - -func Open(path string, openmode int, perm uint32) (fd int, err error) { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - f, err := fs.open(path, openmode, perm&0777|S_IFREG) - if err != nil { - return -1, err - } - return newFD(f), nil -} - -func Mkdir(path string, perm uint32) error { - fs.mu.Lock() - defer fs.mu.Unlock() - _, err := fs.open(path, O_CREATE|O_EXCL, perm&0777|S_IFDIR) - return err -} - -func Getcwd(buf []byte) (n int, err error) { - // Force package os to default to the old algorithm using .. and directory reads. - return 0, ENOSYS -} - -func Stat(path string, st *Stat_t) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - *st = ip.Stat_t - return nil -} - -func Lstat(path string, st *Stat_t) error { - return Stat(path, st) -} - -func unlink(path string, isdir bool) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - dp, elem, err := fs.namei(path, true) - if err != nil { - return err - } - if elem == "." || elem == ".." { - return EINVAL - } - de, _, err := fs.dirlookup(dp, elem) - if err != nil { - return err - } - if isdir { - if de.inode.Mode&S_IFMT != S_IFDIR { - return ENOTDIR - } - if len(de.inode.dir) != 2 { - return ENOTEMPTY - } - } else { - if de.inode.Mode&S_IFMT == S_IFDIR { - return EISDIR - } - } - de.inode.Nlink-- - *de = dp.dir[len(dp.dir)-1] - dp.dir = dp.dir[:len(dp.dir)-1] - dp.dirSize() - return nil -} - -func Unlink(path string) error { - return unlink(path, false) -} - -func Rmdir(path string) error { - return unlink(path, true) -} - -func Chmod(path string, mode uint32) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - ip.Mode = ip.Mode&^0777 | mode&0777 - return nil -} - -func Fchmod(fd int, mode uint32) error { - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - f.inode.Mode = f.inode.Mode&^0777 | mode&0777 - return nil -} - -func Chown(path string, uid, gid int) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - if uid != -1 { - ip.Uid = uint32(uid) - } - if gid != -1 { - ip.Gid = uint32(gid) - } - return nil -} - -func Fchown(fd int, uid, gid int) error { - fs.mu.Lock() - defer fs.mu.Unlock() - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - f.inode.Uid = uint32(uid) - f.inode.Gid = uint32(gid) - return nil -} - -func Lchown(path string, uid, gid int) error { - return Chown(path, uid, gid) -} - -func UtimesNano(path string, ts []Timespec) error { - if len(ts) != 2 { - return EINVAL - } - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - ip.Atime = ts[0].Sec - ip.AtimeNsec = int64(ts[0].Nsec) - ip.Mtime = ts[1].Sec - ip.MtimeNsec = int64(ts[1].Nsec) - return nil -} - -func Link(path, link string) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - dp, elem, err := fs.namei(link, true) - if err != nil { - return err - } - if ip.Mode&S_IFMT == S_IFDIR { - return EPERM - } - _, _, err = fs.dirlookup(dp, elem) - if err == nil { - return EEXIST - } - fs.dirlink(dp, elem, ip) - return nil -} - -func Rename(from, to string) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - fdp, felem, err := fs.namei(from, true) - if err != nil { - return err - } - fde, _, err := fs.dirlookup(fdp, felem) - if err != nil { - return err - } - tdp, telem, err := fs.namei(to, true) - if err != nil { - return err - } - fs.dirlink(tdp, telem, fde.inode) - fde.inode.Nlink-- - *fde = fdp.dir[len(fdp.dir)-1] - fdp.dir = fdp.dir[:len(fdp.dir)-1] - fdp.dirSize() - return nil -} - -func (fs *fsys) truncate(ip *inode, length int64) error { - if length > 1e9 || ip.Mode&S_IFMT != S_IFREG { - return EINVAL - } - if length < int64(len(ip.data)) { - ip.data = ip.data[:length] - } else { - data := make([]byte, length) - copy(data, ip.data) - ip.data = data - } - ip.Size = int64(len(ip.data)) - return nil -} - -func Truncate(path string, length int64) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - return fs.truncate(ip, length) -} - -func Ftruncate(fd int, length int64) error { - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - return f.fsys.truncate(f.inode, length) -} - -func Chdir(path string) error { - fsinit() - return chdir(path) -} - -func chdir(path string) error { - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - fs.cwd = ip - return nil -} - -func Fchdir(fd int) error { - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - if f.inode.Mode&S_IFMT != S_IFDIR { - return ENOTDIR - } - fs.cwd = f.inode - return nil -} - -func Readlink(path string, buf []byte) (n int, err error) { - return 0, ENOSYS -} - -func Symlink(path, link string) error { - return ENOSYS -} - -func Fsync(fd int) error { - return nil -} - -// Special devices. - -func mkdev(path string, mode uint32, open func() (devFile, error)) error { - f, err := fs.open(path, O_CREATE|O_RDONLY|O_EXCL, S_IFCHR|mode) - if err != nil { - return err - } - ip := f.(*fsysFile).inode - ip.Rdev = int64(len(fs.dev)) - fs.dev = append(fs.dev, open) - return nil -} - -type nullFile struct{} - -func openNull() (devFile, error) { return &nullFile{}, nil } -func (f *nullFile) close() error { return nil } -func (f *nullFile) pread(b []byte, offset int64) (int, error) { return 0, nil } -func (f *nullFile) pwrite(b []byte, offset int64) (int, error) { return len(b), nil } - -type zeroFile struct{} - -func openZero() (devFile, error) { return &zeroFile{}, nil } -func (f *zeroFile) close() error { return nil } -func (f *zeroFile) pwrite(b []byte, offset int64) (int, error) { return len(b), nil } - -func (f *zeroFile) pread(b []byte, offset int64) (int, error) { - for i := range b { - b[i] = 0 - } - return len(b), nil -} - -type randomFile struct{} - -func openRandom() (devFile, error) { - return randomFile{}, nil -} - -func (f randomFile) close() error { - return nil -} - -func (f randomFile) pread(b []byte, offset int64) (int, error) { - if err := naclGetRandomBytes(b); err != nil { - return 0, err - } - return len(b), nil -} - -func (f randomFile) pwrite(b []byte, offset int64) (int, error) { - return 0, EPERM -} - -func fdToFsysFile(fd int) (*fsysFile, error) { - f, err := fdToFile(fd) - if err != nil { - return nil, err - } - impl := f.impl - fsysf, ok := impl.(*fsysFile) - if !ok { - return nil, EINVAL - } - return fsysf, nil -} - -// create creates a file in the file system with the given name, mode, time, and data. -// It is meant to be called when initializing the file system image. -func create(name string, mode uint32, sec int64, data []byte) error { - fs.mu.Lock() - defer fs.mu.Unlock() - f, err := fs.open(name, O_CREATE|O_EXCL, mode) - if err != nil { - if mode&S_IFMT == S_IFDIR { - ip, _, err := fs.namei(name, false) - if err == nil && (ip.Mode&S_IFMT) == S_IFDIR { - return nil // directory already exists - } - } - return err - } - ip := f.(*fsysFile).inode - ip.Atime = sec - ip.Mtime = sec - ip.Ctime = sec - if len(data) > 0 { - ip.Size = int64(len(data)) - ip.data = data - } - return nil -} diff --git a/src/syscall/mkall.sh b/src/syscall/mkall.sh index cbf5540e044..79e77d6e596 100755 --- a/src/syscall/mkall.sh +++ b/src/syscall/mkall.sh @@ -174,6 +174,13 @@ freebsd_arm) # API consistent between platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; +freebsd_arm64) + mkerrors="$mkerrors" + mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl" + # Let the type of C char be signed to make the bare syscall + # API consistent between platforms. + mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + ;; linux_386) mkerrors="$mkerrors -m32" mksyscall="./mksyscall.pl -l32" @@ -258,18 +265,6 @@ linux_s390x) mksysnum="./mksysnum_linux.pl $unistd_h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; -nacl_386) - mkerrors="" - mksyscall="./mksyscall.pl -l32 -nacl" - mksysnum="" - mktypes="" - ;; -nacl_amd64p32) - mkerrors="" - mksyscall="./mksyscall.pl -nacl" - mksysnum="" - mktypes="" - ;; netbsd_386) mkerrors="$mkerrors -m32" mksyscall="./mksyscall.pl -l32 -netbsd" diff --git a/src/syscall/mksyscall.pl b/src/syscall/mksyscall.pl index 2a82145a62a..25b40d7ba23 100755 --- a/src/syscall/mksyscall.pl +++ b/src/syscall/mksyscall.pl @@ -29,7 +29,6 @@ my $darwin = 0; my $openbsd = 0; my $netbsd = 0; my $dragonfly = 0; -my $nacl = 0; my $arm = 0; # 64-bit value should use (even, odd)-pair my $tags = ""; # build tags @@ -60,10 +59,6 @@ if($ARGV[0] eq "-dragonfly") { $dragonfly = 1; shift; } -if($ARGV[0] eq "-nacl") { - $nacl = 1; - shift; -} if($ARGV[0] eq "-arm") { $arm = 1; shift; @@ -262,9 +257,6 @@ while(<>) { $sysname = "SYS_$func"; $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar $sysname =~ y/a-z/A-Z/; - if($nacl) { - $sysname =~ y/A-Z/a-z/; - } if($darwin) { $sysname =~ y/A-Z/a-z/; $sysname = substr $sysname, 4; diff --git a/src/syscall/net_js.go b/src/syscall/net_js.go index d5bf1f4f993..25f171bda87 100644 --- a/src/syscall/net_js.go +++ b/src/syscall/net_js.go @@ -42,7 +42,7 @@ const ( const ( _ = iota F_DUPFD_CLOEXEC - SYS_FCNTL = 500 // unsupported; same value as net_nacl.go + SYS_FCNTL = 500 // unsupported ) type Sockaddr interface { diff --git a/src/syscall/net_nacl.go b/src/syscall/net_nacl.go deleted file mode 100644 index 409a7a4e277..00000000000 --- a/src/syscall/net_nacl.go +++ /dev/null @@ -1,973 +0,0 @@ -// Copyright 2013 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. - -// A simulated network for use within NaCl. -// The simulation is not particularly tied to NaCl, -// but other systems have real networks. - -// All int64 times are UnixNanos. - -package syscall - -import ( - "sync" - "sync/atomic" -) - -// Interface to timers implemented in package runtime. -// Must be in sync with ../runtime/time.go:/^type timer -// Really for use by package time, but we cannot import time here. - -type runtimeTimer struct { - tb uintptr - i int - - when int64 - period int64 - f func(interface{}, uintptr) // NOTE: must not be closure - arg interface{} - seq uintptr -} - -func startTimer(*runtimeTimer) -func stopTimer(*runtimeTimer) bool - -type timer struct { - expired bool - q *queue - r runtimeTimer -} - -func (t *timer) start(q *queue, deadline int64) { - if deadline == 0 { - return - } - t.q = q - t.r.when = deadline - t.r.f = timerExpired - t.r.arg = t - startTimer(&t.r) -} - -func (t *timer) stop() { - if t.r.f == nil { - return - } - stopTimer(&t.r) -} - -func (t *timer) reset(q *queue, deadline int64) { - t.stop() - if deadline == 0 { - return - } - if t.r.f == nil { - t.q = q - t.r.f = timerExpired - t.r.arg = t - } - t.r.when = deadline - startTimer(&t.r) -} - -func timerExpired(i interface{}, seq uintptr) { - t := i.(*timer) - go func() { - t.q.Lock() - defer t.q.Unlock() - t.expired = true - t.q.canRead.Broadcast() - t.q.canWrite.Broadcast() - }() -} - -// Network constants and data structures. These match the traditional values. - -const ( - AF_UNSPEC = iota - AF_UNIX - AF_INET - AF_INET6 -) - -const ( - SHUT_RD = iota - SHUT_WR - SHUT_RDWR -) - -const ( - SOCK_STREAM = 1 + iota - SOCK_DGRAM - SOCK_RAW - SOCK_SEQPACKET -) - -const ( - IPPROTO_IP = 0 - IPPROTO_IPV4 = 4 - IPPROTO_IPV6 = 0x29 - IPPROTO_TCP = 6 - IPPROTO_UDP = 0x11 -) - -// Misc constants expected by package net but not supported. -const ( - _ = iota - SOL_SOCKET - SO_TYPE - NET_RT_IFLIST - IFNAMSIZ - IFF_UP - IFF_BROADCAST - IFF_LOOPBACK - IFF_POINTOPOINT - IFF_MULTICAST - IPV6_V6ONLY - SOMAXCONN - F_DUPFD_CLOEXEC - SO_BROADCAST - SO_REUSEADDR - SO_REUSEPORT - SO_RCVBUF - SO_SNDBUF - SO_KEEPALIVE - SO_LINGER - SO_ERROR - IP_PORTRANGE - IP_PORTRANGE_DEFAULT - IP_PORTRANGE_LOW - IP_PORTRANGE_HIGH - IP_MULTICAST_IF - IP_MULTICAST_LOOP - IP_ADD_MEMBERSHIP - IPV6_PORTRANGE - IPV6_PORTRANGE_DEFAULT - IPV6_PORTRANGE_LOW - IPV6_PORTRANGE_HIGH - IPV6_MULTICAST_IF - IPV6_MULTICAST_LOOP - IPV6_JOIN_GROUP - TCP_NODELAY - TCP_KEEPINTVL - TCP_KEEPIDLE - - SYS_FCNTL = 500 // unsupported -) - -var SocketDisableIPv6 bool - -// A Sockaddr is one of the SockaddrXxx structs. -type Sockaddr interface { - // copy returns a copy of the underlying data. - copy() Sockaddr - - // key returns the value of the underlying data, - // for comparison as a map key. - key() interface{} -} - -type SockaddrInet4 struct { - Port int - Addr [4]byte -} - -func (sa *SockaddrInet4) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrInet4) key() interface{} { return *sa } - -func isIPv4Localhost(sa Sockaddr) bool { - sa4, ok := sa.(*SockaddrInet4) - return ok && sa4.Addr == [4]byte{127, 0, 0, 1} -} - -type SockaddrInet6 struct { - Port int - ZoneId uint32 - Addr [16]byte -} - -func (sa *SockaddrInet6) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrInet6) key() interface{} { return *sa } - -type SockaddrUnix struct { - Name string -} - -func (sa *SockaddrUnix) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrUnix) key() interface{} { return *sa } - -type SockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -func (sa *SockaddrDatalink) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrDatalink) key() interface{} { return *sa } - -// RoutingMessage represents a routing message. -type RoutingMessage interface { - unimplemented() -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Linger struct { - Onoff int32 - Linger int32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -// A queue is the bookkeeping for a synchronized buffered queue. -// We do not use channels because we need to be able to handle -// writes after and during close, and because a chan byte would -// require too many send and receive operations in real use. -type queue struct { - sync.Mutex - canRead sync.Cond - canWrite sync.Cond - rtimer *timer // non-nil if in read - wtimer *timer // non-nil if in write - r int // total read index - w int // total write index - m int // index mask - closed bool -} - -func (q *queue) init(size int) { - if size&(size-1) != 0 { - panic("invalid queue size - must be power of two") - } - q.canRead.L = &q.Mutex - q.canWrite.L = &q.Mutex - q.m = size - 1 -} - -func past(deadline int64) bool { - sec, nsec := now() - return deadline > 0 && deadline < sec*1e9+int64(nsec) -} - -func (q *queue) waitRead(n int, deadline int64) (int, error) { - if past(deadline) { - return 0, EAGAIN - } - var t timer - t.start(q, deadline) - q.rtimer = &t - for q.w-q.r == 0 && !q.closed && !t.expired { - q.canRead.Wait() - } - q.rtimer = nil - t.stop() - m := q.w - q.r - if m == 0 && t.expired { - return 0, EAGAIN - } - if m > n { - m = n - q.canRead.Signal() // wake up next reader too - } - q.canWrite.Signal() - return m, nil -} - -func (q *queue) waitWrite(n int, deadline int64) (int, error) { - if past(deadline) { - return 0, EAGAIN - } - var t timer - t.start(q, deadline) - q.wtimer = &t - for q.w-q.r > q.m && !q.closed && !t.expired { - q.canWrite.Wait() - } - q.wtimer = nil - t.stop() - m := q.m + 1 - (q.w - q.r) - if m == 0 && t.expired { - return 0, EAGAIN - } - if m == 0 { - return 0, EAGAIN - } - if m > n { - m = n - q.canWrite.Signal() // wake up next writer too - } - q.canRead.Signal() - return m, nil -} - -func (q *queue) close() { - q.Lock() - defer q.Unlock() - q.closed = true - q.canRead.Broadcast() - q.canWrite.Broadcast() -} - -// A byteq is a byte queue. -type byteq struct { - queue - data []byte -} - -func newByteq() *byteq { - q := &byteq{ - data: make([]byte, 4096), - } - q.init(len(q.data)) - return q -} - -func (q *byteq) read(b []byte, deadline int64) (int, error) { - q.Lock() - defer q.Unlock() - n, err := q.waitRead(len(b), deadline) - if err != nil { - return 0, err - } - b = b[:n] - for len(b) > 0 { - m := copy(b, q.data[q.r&q.m:]) - q.r += m - b = b[m:] - } - return n, nil -} - -func (q *byteq) write(b []byte, deadline int64) (n int, err error) { - q.Lock() - defer q.Unlock() - for n < len(b) { - nn, err := q.waitWrite(len(b[n:]), deadline) - if err != nil { - return n, err - } - bb := b[n : n+nn] - n += nn - for len(bb) > 0 { - m := copy(q.data[q.w&q.m:], bb) - q.w += m - bb = bb[m:] - } - } - return n, nil -} - -// A msgq is a queue of messages. -type msgq struct { - queue - data []interface{} -} - -func newMsgq() *msgq { - q := &msgq{ - data: make([]interface{}, 32), - } - q.init(len(q.data)) - return q -} - -func (q *msgq) read(deadline int64) (interface{}, error) { - q.Lock() - defer q.Unlock() - n, err := q.waitRead(1, deadline) - if err != nil { - return nil, err - } - if n == 0 { - return nil, nil - } - m := q.data[q.r&q.m] - q.r++ - return m, nil -} - -func (q *msgq) write(m interface{}, deadline int64) error { - q.Lock() - defer q.Unlock() - _, err := q.waitWrite(1, deadline) - if err != nil { - return err - } - q.data[q.w&q.m] = m - q.w++ - return nil -} - -// An addr is a sequence of bytes uniquely identifying a network address. -// It is not human-readable. -type addr string - -// A conn is one side of a stream-based network connection. -// That is, a stream-based network connection is a pair of cross-connected conns. -type conn struct { - rd *byteq - wr *byteq - local addr - remote addr -} - -// A pktconn is one side of a packet-based network connection. -// That is, a packet-based network connection is a pair of cross-connected pktconns. -type pktconn struct { - rd *msgq - wr *msgq - local addr - remote addr -} - -// A listener accepts incoming stream-based network connections. -type listener struct { - rd *msgq - local addr -} - -// A netFile is an open network file. -type netFile struct { - defaultFileImpl - proto *netproto - sotype int - listener *msgq - packet *msgq - rd *byteq - wr *byteq - rddeadline int64 - wrdeadline int64 - addr Sockaddr - raddr Sockaddr -} - -// A netAddr is a network address in the global listener map. -// All the fields must have defined == operations. -type netAddr struct { - proto *netproto - sotype int - addr interface{} -} - -// net records the state of the network. -// It maps a network address to the listener on that address. -var net = struct { - sync.Mutex - listener map[netAddr]*netFile -}{ - listener: make(map[netAddr]*netFile), -} - -// TODO(rsc): Some day, do a better job with port allocation. -// For playground programs, incrementing is fine. -var nextport = 2 - -// A netproto contains protocol-specific functionality -// (one for AF_INET, one for AF_INET6 and so on). -// It is a struct instead of an interface because the -// implementation needs no state, and I expect to -// add some data fields at some point. -type netproto struct { - bind func(*netFile, Sockaddr) error -} - -var netprotoAF_INET = &netproto{ - bind: func(f *netFile, sa Sockaddr) error { - if sa == nil { - f.addr = &SockaddrInet4{ - Port: nextport, - Addr: [4]byte{127, 0, 0, 1}, - } - nextport++ - return nil - } - addr, ok := sa.(*SockaddrInet4) - if !ok { - return EINVAL - } - addr = addr.copy().(*SockaddrInet4) - if addr.Port == 0 { - addr.Port = nextport - nextport++ - } - f.addr = addr - return nil - }, -} - -var netprotos = map[int]*netproto{ - AF_INET: netprotoAF_INET, -} - -// These functions implement the usual BSD socket operations. - -func (f *netFile) bind(sa Sockaddr) error { - if f.addr != nil { - return EISCONN - } - if err := f.proto.bind(f, sa); err != nil { - return err - } - if f.sotype == SOCK_DGRAM { - _, ok := net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] - if ok { - f.addr = nil - return EADDRINUSE - } - net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] = f - f.packet = newMsgq() - } - return nil -} - -func (f *netFile) listen(backlog int) error { - net.Lock() - defer net.Unlock() - if f.listener != nil { - return EINVAL - } - old, ok := net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] - if ok && !old.listenerClosed() { - return EADDRINUSE - } - net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] = f - f.listener = newMsgq() - return nil -} - -func (f *netFile) accept() (fd int, sa Sockaddr, err error) { - msg, err := f.listener.read(f.readDeadline()) - if err != nil { - return -1, nil, err - } - newf, ok := msg.(*netFile) - if !ok { - // must be eof - return -1, nil, EAGAIN - } - return newFD(newf), newf.raddr.copy(), nil -} - -func (f *netFile) connect(sa Sockaddr) error { - if past(f.writeDeadline()) { - return EAGAIN - } - if f.addr == nil { - if err := f.bind(nil); err != nil { - return err - } - } - net.Lock() - if sa == nil { - net.Unlock() - return EINVAL - } - sa = sa.copy() - if f.raddr != nil { - net.Unlock() - return EISCONN - } - if f.sotype == SOCK_DGRAM { - net.Unlock() - f.raddr = sa - return nil - } - if f.listener != nil { - net.Unlock() - return EISCONN - } - l, ok := net.listener[netAddr{f.proto, f.sotype, sa.key()}] - if !ok { - // If we're dialing 127.0.0.1 but found nothing, try - // 0.0.0.0 also. (Issue 20611) - if isIPv4Localhost(sa) { - sa = &SockaddrInet4{Port: sa.(*SockaddrInet4).Port} - l, ok = net.listener[netAddr{f.proto, f.sotype, sa.key()}] - } - } - if !ok || l.listenerClosed() { - net.Unlock() - return ECONNREFUSED - } - f.raddr = sa - f.rd = newByteq() - f.wr = newByteq() - newf := &netFile{ - proto: f.proto, - sotype: f.sotype, - addr: f.raddr, - raddr: f.addr, - rd: f.wr, - wr: f.rd, - } - net.Unlock() - l.listener.write(newf, f.writeDeadline()) - return nil -} - -func (f *netFile) read(b []byte) (int, error) { - if f.rd == nil { - if f.raddr != nil { - n, _, err := f.recvfrom(b, 0) - return n, err - } - return 0, ENOTCONN - } - return f.rd.read(b, f.readDeadline()) -} - -func (f *netFile) write(b []byte) (int, error) { - if f.wr == nil { - if f.raddr != nil { - err := f.sendto(b, 0, f.raddr) - var n int - if err == nil { - n = len(b) - } - return n, err - } - return 0, ENOTCONN - } - return f.wr.write(b, f.writeDeadline()) -} - -type pktmsg struct { - buf []byte - addr Sockaddr -} - -func (f *netFile) recvfrom(p []byte, flags int) (n int, from Sockaddr, err error) { - if f.sotype != SOCK_DGRAM { - return 0, nil, EINVAL - } - if f.packet == nil { - return 0, nil, ENOTCONN - } - msg1, err := f.packet.read(f.readDeadline()) - if err != nil { - return 0, nil, err - } - msg, ok := msg1.(*pktmsg) - if !ok { - return 0, nil, EAGAIN - } - return copy(p, msg.buf), msg.addr, nil -} - -func (f *netFile) sendto(p []byte, flags int, to Sockaddr) error { - if f.sotype != SOCK_DGRAM { - return EINVAL - } - if f.packet == nil { - if err := f.bind(nil); err != nil { - return err - } - } - net.Lock() - if to == nil { - net.Unlock() - return EINVAL - } - to = to.copy() - l, ok := net.listener[netAddr{f.proto, f.sotype, to.key()}] - if !ok || l.packet == nil { - net.Unlock() - return ECONNREFUSED - } - net.Unlock() - msg := &pktmsg{ - buf: make([]byte, len(p)), - addr: f.addr, - } - copy(msg.buf, p) - l.packet.write(msg, f.writeDeadline()) - return nil -} - -func (f *netFile) listenerClosed() bool { - f.listener.Lock() - defer f.listener.Unlock() - return f.listener.closed -} - -func (f *netFile) close() error { - if f.listener != nil { - f.listener.close() - } - if f.packet != nil { - f.packet.close() - } - if f.rd != nil { - f.rd.close() - } - if f.wr != nil { - f.wr.close() - } - return nil -} - -func fdToNetFile(fd int) (*netFile, error) { - f, err := fdToFile(fd) - if err != nil { - return nil, err - } - impl := f.impl - netf, ok := impl.(*netFile) - if !ok { - return nil, EINVAL - } - return netf, nil -} - -func Socket(proto, sotype, unused int) (fd int, err error) { - p := netprotos[proto] - if p == nil { - return -1, EPROTONOSUPPORT - } - if sotype != SOCK_STREAM && sotype != SOCK_DGRAM { - return -1, ESOCKTNOSUPPORT - } - f := &netFile{ - proto: p, - sotype: sotype, - } - return newFD(f), nil -} - -func Bind(fd int, sa Sockaddr) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.bind(sa) -} - -func StopIO(fd int) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - f.close() - return nil -} - -func Listen(fd int, backlog int) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.listen(backlog) -} - -func Accept(fd int) (newfd int, sa Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, nil, err - } - return f.accept() -} - -func Getsockname(fd int) (sa Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return nil, err - } - if f.addr == nil { - return nil, ENOTCONN - } - return f.addr.copy(), nil -} - -func Getpeername(fd int) (sa Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return nil, err - } - if f.raddr == nil { - return nil, ENOTCONN - } - return f.raddr.copy(), nil -} - -func Connect(fd int, sa Sockaddr) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.connect(sa) -} - -func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, nil, err - } - return f.recvfrom(p, flags) -} - -func Sendto(fd int, p []byte, flags int, to Sockaddr) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.sendto(p, flags, to) -} - -func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn, recvflags int, from Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return - } - n, from, err = f.recvfrom(p, flags) - return -} - -func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) error { - _, err := SendmsgN(fd, p, oob, to, flags) - return err -} - -func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, err - } - switch f.sotype { - case SOCK_STREAM: - n, err = f.write(p) - case SOCK_DGRAM: - n = len(p) - err = f.sendto(p, flags, to) - } - if err != nil { - return 0, err - } - return n, nil -} - -func GetsockoptInt(fd, level, opt int) (value int, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, err - } - switch { - case level == SOL_SOCKET && opt == SO_TYPE: - return f.sotype, nil - } - return 0, ENOTSUP -} - -func SetsockoptInt(fd, level, opt int, value int) error { - return nil -} - -func SetsockoptByte(fd, level, opt int, value byte) error { - _, err := fdToNetFile(fd) - if err != nil { - return err - } - return ENOTSUP -} - -func SetsockoptLinger(fd, level, opt int, l *Linger) error { - return nil -} - -func SetReadDeadline(fd int, t int64) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - atomic.StoreInt64(&f.rddeadline, t) - if bq := f.rd; bq != nil { - bq.Lock() - if timer := bq.rtimer; timer != nil { - timer.reset(&bq.queue, t) - } - bq.Unlock() - } - return nil -} - -func (f *netFile) readDeadline() int64 { - return atomic.LoadInt64(&f.rddeadline) -} - -func SetWriteDeadline(fd int, t int64) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - atomic.StoreInt64(&f.wrdeadline, t) - if bq := f.wr; bq != nil { - bq.Lock() - if timer := bq.wtimer; timer != nil { - timer.reset(&bq.queue, t) - } - bq.Unlock() - } - return nil -} - -func (f *netFile) writeDeadline() int64 { - return atomic.LoadInt64(&f.wrdeadline) -} - -func Shutdown(fd int, how int) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - switch how { - case SHUT_RD: - f.rd.close() - case SHUT_WR: - f.wr.close() - case SHUT_RDWR: - f.rd.close() - f.wr.close() - } - return nil -} - -func SetsockoptICMPv6Filter(fd, level, opt int, filter *ICMPv6Filter) error { panic("SetsockoptICMPv") } -func SetsockoptIPMreq(fd, level, opt int, mreq *IPMreq) error { panic("SetsockoptIPMreq") } -func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) error { panic("SetsockoptIPv") } -func SetsockoptInet4Addr(fd, level, opt int, value [4]byte) error { panic("SetsockoptInet") } -func SetsockoptString(fd, level, opt int, s string) error { panic("SetsockoptString") } -func SetsockoptTimeval(fd, level, opt int, tv *Timeval) error { panic("SetsockoptTimeval") } -func Socketpair(domain, typ, proto int) (fd [2]int, err error) { panic("Socketpair") } - -func SetNonblock(fd int, nonblocking bool) error { return nil } diff --git a/src/syscall/route_freebsd_64bit.go b/src/syscall/route_freebsd_64bit.go index 728837ebb5a..e70ba3df896 100644 --- a/src/syscall/route_freebsd_64bit.go +++ b/src/syscall/route_freebsd_64bit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build freebsd,amd64 +// +build freebsd,amd64 freebsd,arm64 package syscall diff --git a/src/syscall/syscall.go b/src/syscall/syscall.go index e02fc502c7f..980ef9d27fa 100644 --- a/src/syscall/syscall.go +++ b/src/syscall/syscall.go @@ -26,7 +26,7 @@ // package syscall -//go:generate go run mksyscall_windows.go -systemdll -output zsyscall_windows.go syscall_windows.go security_windows.go +//go:generate go run golang.org/x/sys/windows/mkwinsyscall -systemdll -output zsyscall_windows.go syscall_windows.go security_windows.go // StringByteSlice converts a string to a NUL-terminated []byte, // If s contains a NUL byte this function panics instead of diff --git a/src/syscall/syscall_freebsd_arm64.go b/src/syscall/syscall_freebsd_arm64.go new file mode 100644 index 00000000000..95b75392a3c --- /dev/null +++ b/src/syscall/syscall_freebsd_arm64.go @@ -0,0 +1,47 @@ +// Copyright 2019 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 syscall + +import "unsafe" + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = int16(mode) + k.Flags = uint16(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + var writtenOut uint64 = 0 + _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) + + written = int(writtenOut) + + if e1 != 0 { + err = e1 + } + return +} + +func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) diff --git a/src/syscall/syscall_js.go b/src/syscall/syscall_js.go index 987dd4a7961..dfb4a275e30 100644 --- a/src/syscall/syscall_js.go +++ b/src/syscall/syscall_js.go @@ -303,9 +303,10 @@ func Getegid() int { return jsProcess.Call("getegid").Int() } -func Getgroups() ([]int, error) { +func Getgroups() (groups []int, err error) { + defer recoverErr(&err) array := jsProcess.Call("getgroups") - groups := make([]int, array.Length()) + groups = make([]int, array.Length()) for i := range groups { groups[i] = array.Index(i).Int() } diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go index ec3021cd23f..ed57c93b1f5 100644 --- a/src/syscall/syscall_linux.go +++ b/src/syscall/syscall_linux.go @@ -174,8 +174,6 @@ func Unlinkat(dirfd int, path string) error { return unlinkat(dirfd, path, 0) } -//sys utimes(path string, times *[2]Timeval) (err error) - func Utimes(path string, tv []Timeval) (err error) { if len(tv) != 2 { return EINVAL @@ -203,17 +201,11 @@ func UtimesNano(path string, ts []Timespec) (err error) { return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } -//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) - func Futimesat(dirfd int, path string, tv []Timeval) (err error) { if len(tv) != 2 { return EINVAL } - pathp, err := BytePtrFromString(path) - if err != nil { - return err - } - return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) + return futimesat(dirfd, path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } func Futimes(fd int, tv []Timeval) (err error) { @@ -908,7 +900,6 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri //sys Close(fd int) (err error) //sys Dup(oldfd int) (fd int, err error) //sys Dup3(oldfd int, newfd int, flags int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sysnb EpollCreate1(flag int) (fd int, err error) //sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) //sys Fallocate(fd int, mode uint32, off int64, len int64) (err error) @@ -942,7 +933,6 @@ func Getpgrp() (pid int) { //sys Mkdirat(dirfd int, path string, mode uint32) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) -//sys Pause() (err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT //sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 //sys read(fd int, p []byte) (n int, err error) @@ -977,8 +967,6 @@ func Setgid(gid int) (err error) { //sysnb Uname(buf *Utsname) (err error) //sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2 //sys Unshare(flags int) (err error) -//sys Ustat(dev int, ubuf *Ustat_t) (err error) -//sys Utime(path string, buf *Utimbuf) (err error) //sys write(fd int, p []byte) (n int, err error) //sys exitThread(code int) (err error) = SYS_EXIT //sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go index 7a41ed8edf5..3c1e6e4218c 100644 --- a/src/syscall/syscall_linux_386.go +++ b/src/syscall/syscall_linux_386.go @@ -51,6 +51,7 @@ func Pipe2(p []int, flags int) (err error) { // 64-bit file system and 32-bit uid calls // (386 default is 32-bit file system and 16-bit uid). //sys Dup2(oldfd int, newfd int) (err error) +//sysnb EpollCreate(size int) (fd int, err error) //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 @@ -62,6 +63,7 @@ func Pipe2(p []int, flags int) (err error) { //sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) +//sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -75,6 +77,7 @@ func Pipe2(p []int, flags int) (err error) { //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) //sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 +//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) = SYS_GETGROUPS32 //sysnb setgroups(n int, list *_Gid_t) (err error) = SYS_SETGROUPS32 //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT @@ -177,9 +180,11 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return newoffset, nil } -// Vsyscalls on amd64. +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) //sysnb Gettimeofday(tv *Timeval) (err error) //sysnb Time(t *Time_t) (tt Time_t, err error) +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) // On x86 Linux, all the socket calls go through an extra indirection, // I think because the 5-register system call interface can't handle diff --git a/src/syscall/syscall_linux_amd64.go b/src/syscall/syscall_linux_amd64.go index 447676946e2..0f28b55d473 100644 --- a/src/syscall/syscall_linux_amd64.go +++ b/src/syscall/syscall_linux_amd64.go @@ -10,6 +10,7 @@ const ( ) //sys Dup2(oldfd int, newfd int) (err error) +//sysnb EpollCreate(size int) (fd int, err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatfs(fd int, buf *Statfs_t) (err error) @@ -23,6 +24,7 @@ const ( //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Listen(s int, n int) (err error) +//sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -41,6 +43,7 @@ const ( //sys Statfs(path string, buf *Statfs_t) (err error) //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) //sys Truncate(path string, length int64) (err error) +//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) @@ -73,6 +76,8 @@ func Lstat(path string, stat *Stat_t) (err error) { return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW) } +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) + //go:noescape func gettimeofday(tv *Timeval) (err Errno) @@ -96,6 +101,9 @@ func Time(t *Time_t) (tt Time_t, err error) { return Time_t(tv.Sec), nil } +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) + func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} } diff --git a/src/syscall/syscall_linux_arm.go b/src/syscall/syscall_linux_arm.go index 9ba6eec11f4..d346029a1f3 100644 --- a/src/syscall/syscall_linux_arm.go +++ b/src/syscall/syscall_linux_arm.go @@ -81,6 +81,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { // 64-bit file system and 32-bit uid calls // (16-bit uid calls are not always supported in newer kernels) //sys Dup2(oldfd int, newfd int) (err error) +//sysnb EpollCreate(size int) (fd int, err error) //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 @@ -90,6 +91,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sysnb Getuid() (uid int) = SYS_GETUID32 //sysnb InotifyInit() (fd int, err error) //sys Listen(s int, n int) (err error) +//sys Pause() (err error) //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT @@ -101,10 +103,13 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32 //sys Shutdown(fd int, how int) (err error) //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) +//sys Ustat(dev int, ubuf *Ustat_t) (err error) -// Vsyscalls on amd64. +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) //sysnb Gettimeofday(tv *Timeval) (err error) //sysnb Time(t *Time_t) (tt Time_t, err error) +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 diff --git a/src/syscall/syscall_linux_arm64.go b/src/syscall/syscall_linux_arm64.go index 95065bfe2d8..6d3b3dfde40 100644 --- a/src/syscall/syscall_linux_arm64.go +++ b/src/syscall/syscall_linux_arm64.go @@ -4,11 +4,20 @@ package syscall +import "unsafe" + const ( _SYS_dup = SYS_DUP3 _SYS_setgroups = SYS_SETGROUPS ) +func EpollCreate(size int) (fd int, err error) { + if size <= 0 { + return -1, EINVAL + } + return EpollCreate1(0) +} + //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) @@ -85,7 +94,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err } //sysnb Gettimeofday(tv *Timeval) (err error) -//sysnb Time(t *Time_t) (tt Time_t, err error) func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} @@ -95,6 +103,50 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } +func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) { + if tv == nil { + return utimensat(dirfd, path, nil, 0) + } + + ts := []Timespec{ + NsecToTimespec(TimevalToNsec(tv[0])), + NsecToTimespec(TimevalToNsec(tv[1])), + } + return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) +} + +func Time(t *Time_t) (Time_t, error) { + var tv Timeval + err := Gettimeofday(&tv) + if err != nil { + return 0, err + } + if t != nil { + *t = Time_t(tv.Sec) + } + return Time_t(tv.Sec), nil +} + +func Utime(path string, buf *Utimbuf) error { + tv := []Timeval{ + {Sec: buf.Actime}, + {Sec: buf.Modtime}, + } + return Utimes(path, tv) +} + +func utimes(path string, tv *[2]Timeval) (err error) { + if tv == nil { + return utimensat(_AT_FDCWD, path, nil, 0) + } + + ts := []Timespec{ + NsecToTimespec(TimevalToNsec(tv[0])), + NsecToTimespec(TimevalToNsec(tv[1])), + } + return utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) +} + func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL @@ -139,20 +191,11 @@ func InotifyInit() (fd int, err error) { return InotifyInit1(0) } -// TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove -// these when the deprecated syscalls that the syscall package relies on -// are removed. -const ( - SYS_GETPGRP = 1060 - SYS_UTIMES = 1037 - SYS_FUTIMESAT = 1066 - SYS_PAUSE = 1061 - SYS_USTAT = 1070 - SYS_UTIME = 1063 - SYS_LCHOWN = 1032 - SYS_TIME = 1062 - SYS_EPOLL_CREATE = 1042 - SYS_EPOLL_WAIT = 1069 -) +//sys ppoll(fds *pollFd, nfds int, timeout *Timespec, sigmask *sigset_t) (n int, err error) + +func Pause() error { + _, err := ppoll(nil, 0, nil, nil) + return err +} func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno) diff --git a/src/syscall/syscall_linux_mips64x.go b/src/syscall/syscall_linux_mips64x.go index 59add3f8678..157c32326b7 100644 --- a/src/syscall/syscall_linux_mips64x.go +++ b/src/syscall/syscall_linux_mips64x.go @@ -13,6 +13,7 @@ const ( ) //sys Dup2(oldfd int, newfd int) (err error) +//sysnb EpollCreate(size int) (fd int, err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstatfs(fd int, buf *Statfs_t) (err error) //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT @@ -25,6 +26,7 @@ const ( //sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) +//sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -42,6 +44,7 @@ const ( //sys Statfs(path string, buf *Statfs_t) (err error) //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) //sys Truncate(path string, length int64) (err error) +//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) @@ -75,6 +78,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return pselect(nfd, r, w, e, ts, nil) } +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) //sysnb Gettimeofday(tv *Timeval) (err error) func Time(t *Time_t) (tt Time_t, err error) { @@ -89,6 +93,9 @@ func Time(t *Time_t) (tt Time_t, err error) { return Time_t(tv.Sec), nil } +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) + func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} } diff --git a/src/syscall/syscall_linux_mipsx.go b/src/syscall/syscall_linux_mipsx.go index 070be3bd63e..f2fea71aac3 100644 --- a/src/syscall/syscall_linux_mipsx.go +++ b/src/syscall/syscall_linux_mipsx.go @@ -17,6 +17,7 @@ const ( func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) //sys Dup2(oldfd int, newfd int) (err error) +//sysnb EpollCreate(size int) (fd int, err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 //sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 @@ -26,6 +27,7 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sysnb Getuid() (uid int) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) +//sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -43,6 +45,7 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) //sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 +//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) @@ -64,8 +67,11 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) //sysnb Gettimeofday(tv *Timeval) (err error) //sysnb Time(t *Time_t) (tt Time_t, err error) +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 diff --git a/src/syscall/syscall_linux_ppc64x.go b/src/syscall/syscall_linux_ppc64x.go index 30956c48045..22d6e560103 100644 --- a/src/syscall/syscall_linux_ppc64x.go +++ b/src/syscall/syscall_linux_ppc64x.go @@ -13,6 +13,8 @@ const ( ) //sys Dup2(oldfd int, newfd int) (err error) +//sysnb EpollCreate(size int) (fd int, err error) +//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT @@ -29,6 +31,7 @@ const ( //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) +//sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -47,6 +50,7 @@ const ( //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, buf *Statfs_t) (err error) //sys Truncate(path string, length int64) (err error) +//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) @@ -65,9 +69,11 @@ const ( //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) //sysnb Gettimeofday(tv *Timeval) (err error) //sysnb Time(t *Time_t) (tt Time_t, err error) -//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} diff --git a/src/syscall/syscall_linux_s390x.go b/src/syscall/syscall_linux_s390x.go index 1a9c952cdc0..fcedf5909a4 100644 --- a/src/syscall/syscall_linux_s390x.go +++ b/src/syscall/syscall_linux_s390x.go @@ -12,6 +12,8 @@ const ( ) //sys Dup2(oldfd int, newfd int) (err error) +//sysnb EpollCreate(size int) (fd int, err error) +//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT @@ -25,6 +27,7 @@ const ( //sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) +//sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -43,11 +46,12 @@ const ( //sys Statfs(path string, buf *Statfs_t) (err error) //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE //sys Truncate(path string, length int64) (err error) +//sys Ustat(dev int, ubuf *Ustat_t) (err error) //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) //sysnb setgroups(n int, list *_Gid_t) (err error) +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) //sysnb Gettimeofday(tv *Timeval) (err error) -//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) func Time(t *Time_t) (tt Time_t, err error) { var tv Timeval @@ -61,6 +65,9 @@ func Time(t *Time_t) (tt Time_t, err error) { return Time_t(tv.Sec), nil } +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) + func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} } diff --git a/src/syscall/syscall_nacl.go b/src/syscall/syscall_nacl.go deleted file mode 100644 index c784d372a15..00000000000 --- a/src/syscall/syscall_nacl.go +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright 2013 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 syscall - -import ( - "internal/oserror" - "sync" - "unsafe" -) - -//sys naclClose(fd int) (err error) = sys_close -//sys naclFstat(fd int, stat *Stat_t) (err error) = sys_fstat -//sys naclRead(fd int, b []byte) (n int, err error) = sys_read -//sys naclSeek(fd int, off *int64, whence int) (err error) = sys_lseek -//sys naclGetRandomBytes(b []byte) (err error) = sys_get_random_bytes - -const direntSize = 8 + 8 + 2 + 256 - -// native_client/src/trusted/service_runtime/include/sys/dirent.h -type Dirent struct { - Ino int64 - Off int64 - Reclen uint16 - Name [256]byte -} - -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false - } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true -} - -const PathMax = 256 - -// An Errno is an unsigned number describing an error condition. -// It implements the error interface. The zero Errno is by convention -// a non-error, so code to convert from Errno to error should use: -// err = nil -// if errno != 0 { -// err = errno -// } -// -// Errno values can be tested against error values from the os package -// using errors.Is. For example: -// -// _, _, err := syscall.Syscall(...) -// if errors.Is(err, os.ErrNotExist) ... -type Errno uintptr - -func (e Errno) Error() string { - if 0 <= int(e) && int(e) < len(errorstr) { - s := errorstr[e] - if s != "" { - return s - } - } - return "errno " + itoa(int(e)) -} - -func (e Errno) Is(target error) bool { - switch target { - case oserror.ErrPermission: - return e == EACCES || e == EPERM - case oserror.ErrExist: - return e == EEXIST || e == ENOTEMPTY - case oserror.ErrNotExist: - return e == ENOENT - } - return false -} - -func (e Errno) Temporary() bool { - return e == EINTR || e == EMFILE || e.Timeout() -} - -func (e Errno) Timeout() bool { - return e == EAGAIN || e == EWOULDBLOCK || e == ETIMEDOUT -} - -// A Signal is a number describing a process signal. -// It implements the os.Signal interface. -type Signal int - -const ( - _ Signal = iota - SIGCHLD - SIGINT - SIGKILL - SIGTRAP - SIGQUIT -) - -func (s Signal) Signal() {} - -func (s Signal) String() string { - if 0 <= s && int(s) < len(signals) { - str := signals[s] - if str != "" { - return str - } - } - return "signal " + itoa(int(s)) -} - -var signals = [...]string{} - -// File system - -const ( - Stdin = 0 - Stdout = 1 - Stderr = 2 -) - -// native_client/src/trusted/service_runtime/include/sys/fcntl.h -const ( - O_RDONLY = 0 - O_WRONLY = 1 - O_RDWR = 2 - O_ACCMODE = 3 - - O_CREAT = 0100 - O_CREATE = O_CREAT // for ken - O_TRUNC = 01000 - O_APPEND = 02000 - O_EXCL = 0200 - O_NONBLOCK = 04000 - O_NDELAY = O_NONBLOCK - O_SYNC = 010000 - O_FSYNC = O_SYNC - O_ASYNC = 020000 - - O_CLOEXEC = 0 - - FD_CLOEXEC = 1 -) - -// native_client/src/trusted/service_runtime/include/sys/fcntl.h -const ( - F_DUPFD = 0 - F_GETFD = 1 - F_SETFD = 2 - F_GETFL = 3 - F_SETFL = 4 - F_GETOWN = 5 - F_SETOWN = 6 - F_GETLK = 7 - F_SETLK = 8 - F_SETLKW = 9 - F_RGETLK = 10 - F_RSETLK = 11 - F_CNVT = 12 - F_RSETLKW = 13 - - F_RDLCK = 1 - F_WRLCK = 2 - F_UNLCK = 3 - F_UNLKSYS = 4 -) - -// native_client/src/trusted/service_runtime/include/bits/stat.h -const ( - S_IFMT = 0000370000 - S_IFSHM_SYSV = 0000300000 - S_IFSEMA = 0000270000 - S_IFCOND = 0000260000 - S_IFMUTEX = 0000250000 - S_IFSHM = 0000240000 - S_IFBOUNDSOCK = 0000230000 - S_IFSOCKADDR = 0000220000 - S_IFDSOCK = 0000210000 - - S_IFSOCK = 0000140000 - S_IFLNK = 0000120000 - S_IFREG = 0000100000 - S_IFBLK = 0000060000 - S_IFDIR = 0000040000 - S_IFCHR = 0000020000 - S_IFIFO = 0000010000 - - S_UNSUP = 0000370000 - - S_ISUID = 0004000 - S_ISGID = 0002000 - S_ISVTX = 0001000 - - S_IREAD = 0400 - S_IWRITE = 0200 - S_IEXEC = 0100 - - S_IRWXU = 0700 - S_IRUSR = 0400 - S_IWUSR = 0200 - S_IXUSR = 0100 - - S_IRWXG = 070 - S_IRGRP = 040 - S_IWGRP = 020 - S_IXGRP = 010 - - S_IRWXO = 07 - S_IROTH = 04 - S_IWOTH = 02 - S_IXOTH = 01 -) - -// native_client/src/trusted/service_runtime/include/sys/stat.h -// native_client/src/trusted/service_runtime/include/machine/_types.h -type Stat_t struct { - Dev int64 - Ino uint64 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev int64 - Size int64 - Blksize int32 - Blocks int32 - Atime int64 - AtimeNsec int64 - Mtime int64 - MtimeNsec int64 - Ctime int64 - CtimeNsec int64 -} - -// Processes -// Not supported on NaCl - just enough for package os. - -var ForkLock sync.RWMutex - -type WaitStatus uint32 - -func (w WaitStatus) Exited() bool { return false } -func (w WaitStatus) ExitStatus() int { return 0 } -func (w WaitStatus) Signaled() bool { return false } -func (w WaitStatus) Signal() Signal { return 0 } -func (w WaitStatus) CoreDump() bool { return false } -func (w WaitStatus) Stopped() bool { return false } -func (w WaitStatus) Continued() bool { return false } -func (w WaitStatus) StopSignal() Signal { return 0 } -func (w WaitStatus) TrapCause() int { return 0 } - -// XXX made up -type Rusage struct { - Utime Timeval - Stime Timeval -} - -// XXX made up -type ProcAttr struct { - Dir string - Env []string - Files []uintptr - Sys *SysProcAttr -} - -type SysProcAttr struct { -} - -// System - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) -func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { return 0, 0, ENOSYS } -func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { return 0, 0, ENOSYS } -func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { - return 0, 0, ENOSYS -} - -func Sysctl(key string) (string, error) { - if key == "kern.hostname" { - return "naclbox", nil - } - return "", ENOSYS -} - -// Unimplemented Unix midden heap. - -const ImplementsGetwd = false - -func Getwd() (wd string, err error) { return "", ENOSYS } -func Getegid() int { return 1 } -func Geteuid() int { return 1 } -func Getgid() int { return 1 } -func Getgroups() ([]int, error) { return []int{1}, nil } -func Getppid() int { return 2 } -func Getpid() int { return 3 } -func Gettimeofday(tv *Timeval) error { return ENOSYS } -func Getuid() int { return 1 } -func Kill(pid int, signum Signal) error { return ENOSYS } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - return 0, ENOSYS -} -func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) { - return 0, 0, ENOSYS -} -func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { - return 0, ENOSYS -} -func RouteRIB(facility, param int) ([]byte, error) { return nil, ENOSYS } -func ParseRoutingMessage(b []byte) ([]RoutingMessage, error) { return nil, ENOSYS } -func ParseRoutingSockaddr(msg RoutingMessage) ([]Sockaddr, error) { return nil, ENOSYS } -func SysctlUint32(name string) (value uint32, err error) { return 0, ENOSYS } - -type Iovec struct{} // dummy diff --git a/src/syscall/syscall_nacl_386.go b/src/syscall/syscall_nacl_386.go deleted file mode 100644 index 39112ebcc37..00000000000 --- a/src/syscall/syscall_nacl_386.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 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 syscall - -type Timespec struct { - Sec int64 - Nsec int32 -} - -type Timeval struct { - Sec int64 - Usec int32 -} - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: sec, Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: sec, Usec: int32(usec)} -} diff --git a/src/syscall/syscall_nacl_amd64p32.go b/src/syscall/syscall_nacl_amd64p32.go deleted file mode 100644 index 39112ebcc37..00000000000 --- a/src/syscall/syscall_nacl_amd64p32.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 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 syscall - -type Timespec struct { - Sec int64 - Nsec int32 -} - -type Timeval struct { - Sec int64 - Usec int32 -} - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: sec, Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: sec, Usec: int32(usec)} -} diff --git a/src/syscall/syscall_nacl_arm.go b/src/syscall/syscall_nacl_arm.go deleted file mode 100644 index dec97b546a5..00000000000 --- a/src/syscall/syscall_nacl_arm.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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 syscall - -type Timespec struct { - Sec int64 - Nsec int32 -} - -type Timeval struct { - Sec int64 - Usec int32 -} - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: sec, Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: sec, Usec: int32(usec)} -} diff --git a/src/syscall/syscall_test.go b/src/syscall/syscall_test.go index 2a9d90e64c6..5390f8aace9 100644 --- a/src/syscall/syscall_test.go +++ b/src/syscall/syscall_test.go @@ -62,7 +62,7 @@ func TestExecErrPermutedFds(t *testing.T) { } func TestGettimeofday(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skip("not implemented on " + runtime.GOOS) } tv := &syscall.Timeval{} diff --git a/src/syscall/tables_nacljs.go b/src/syscall/tables_js.go similarity index 98% rename from src/syscall/tables_nacljs.go rename to src/syscall/tables_js.go index 1c265f25c7a..a7c4f8c890f 100644 --- a/src/syscall/tables_nacljs.go +++ b/src/syscall/tables_js.go @@ -2,13 +2,17 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package syscall import "runtime" -// TODO: generate with runtime/mknacl.sh, allow override with IRT. +// These were originally used by Nacl, then later also used by +// js/wasm. Now that they're only used by js/wasm, these numbers are +// just arbitrary. +// +// TODO: delete? replace with something meaningful? const ( sys_null = 1 sys_nameservice = 2 diff --git a/src/syscall/time_nacl_386.s b/src/syscall/time_nacl_386.s deleted file mode 100644 index 90cf366bb3c..00000000000 --- a/src/syscall/time_nacl_386.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" - -TEXT ·startTimer(SB),NOSPLIT,$0 - JMP time·startTimer(SB) - -TEXT ·stopTimer(SB),NOSPLIT,$0 - JMP time·stopTimer(SB) diff --git a/src/syscall/time_nacl_amd64p32.s b/src/syscall/time_nacl_amd64p32.s deleted file mode 100644 index 90cf366bb3c..00000000000 --- a/src/syscall/time_nacl_amd64p32.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 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. - -#include "textflag.h" - -TEXT ·startTimer(SB),NOSPLIT,$0 - JMP time·startTimer(SB) - -TEXT ·stopTimer(SB),NOSPLIT,$0 - JMP time·stopTimer(SB) diff --git a/src/syscall/time_nacl_arm.s b/src/syscall/time_nacl_arm.s deleted file mode 100644 index 7864ec9d3e3..00000000000 --- a/src/syscall/time_nacl_arm.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 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. - -#include "textflag.h" - -TEXT ·startTimer(SB),NOSPLIT,$0 - B time·startTimer(SB) - -TEXT ·stopTimer(SB),NOSPLIT,$0 - B time·stopTimer(SB) diff --git a/src/syscall/timestruct.go b/src/syscall/timestruct.go index 09be22c971a..682c68cf9be 100644 --- a/src/syscall/timestruct.go +++ b/src/syscall/timestruct.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package syscall diff --git a/src/syscall/types_linux.go b/src/syscall/types_linux.go index ccc5c54f0bf..fd8ad94c886 100644 --- a/src/syscall/types_linux.go +++ b/src/syscall/types_linux.go @@ -416,6 +416,8 @@ const ( _AT_EACCESS = C.AT_EACCESS ) +type pollFd C.struct_pollfd + // Terminal handling type Termios C.struct_termios diff --git a/src/syscall/unzip_nacl.go b/src/syscall/unzip_nacl.go deleted file mode 100644 index 14b5bd154ff..00000000000 --- a/src/syscall/unzip_nacl.go +++ /dev/null @@ -1,685 +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. - -// Small in-memory unzip implementation. -// A simplified copy of the pre-Go 1 compress/flate/inflate.go -// and a modified copy of the zip reader in package time. -// (The one in package time does not support decompression; this one does.) - -package syscall - -const ( - maxCodeLen = 16 // max length of Huffman code - maxHist = 32768 // max history required - maxLit = 286 - maxDist = 32 - numCodes = 19 // number of codes in Huffman meta-code -) - -type decompressor struct { - in string // compressed input - out []byte // uncompressed output - b uint32 // input bits, at top of b - nb uint - err bool // invalid input - eof bool // reached EOF - - h1, h2 huffmanDecoder // decoders for literal/length, distance - bits [maxLit + maxDist]int // lengths defining Huffman codes - codebits [numCodes]int -} - -func (f *decompressor) nextBlock() { - for f.nb < 1+2 { - if f.moreBits(); f.err { - return - } - } - f.eof = f.b&1 == 1 - f.b >>= 1 - typ := f.b & 3 - f.b >>= 2 - f.nb -= 1 + 2 - switch typ { - case 0: - f.dataBlock() - case 1: - // compressed, fixed Huffman tables - f.huffmanBlock(&fixedHuffmanDecoder, nil) - case 2: - // compressed, dynamic Huffman tables - if f.readHuffman(); f.err { - break - } - f.huffmanBlock(&f.h1, &f.h2) - default: - // 3 is reserved. - f.err = true - } -} - -// RFC 1951 section 3.2.7. -// Compression with dynamic Huffman codes - -var codeOrder = [...]int{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15} - -func (f *decompressor) readHuffman() { - // HLIT[5], HDIST[5], HCLEN[4]. - for f.nb < 5+5+4 { - if f.moreBits(); f.err { - return - } - } - nlit := int(f.b&0x1F) + 257 - f.b >>= 5 - ndist := int(f.b&0x1F) + 1 - f.b >>= 5 - nclen := int(f.b&0xF) + 4 - f.b >>= 4 - f.nb -= 5 + 5 + 4 - - // (HCLEN+4)*3 bits: code lengths in the magic codeOrder order. - for i := 0; i < nclen; i++ { - for f.nb < 3 { - if f.moreBits(); f.err { - return - } - } - f.codebits[codeOrder[i]] = int(f.b & 0x7) - f.b >>= 3 - f.nb -= 3 - } - for i := nclen; i < len(codeOrder); i++ { - f.codebits[codeOrder[i]] = 0 - } - if !f.h1.init(f.codebits[0:]) { - f.err = true - return - } - - // HLIT + 257 code lengths, HDIST + 1 code lengths, - // using the code length Huffman code. - for i, n := 0, nlit+ndist; i < n; { - x := f.huffSym(&f.h1) - if f.err { - return - } - if x < 16 { - // Actual length. - f.bits[i] = x - i++ - continue - } - // Repeat previous length or zero. - var rep int - var nb uint - var b int - switch x { - default: - f.err = true - return - case 16: - rep = 3 - nb = 2 - if i == 0 { - f.err = true - return - } - b = f.bits[i-1] - case 17: - rep = 3 - nb = 3 - b = 0 - case 18: - rep = 11 - nb = 7 - b = 0 - } - for f.nb < nb { - if f.moreBits(); f.err { - return - } - } - rep += int(f.b & uint32(1<>= nb - f.nb -= nb - if i+rep > n { - f.err = true - return - } - for j := 0; j < rep; j++ { - f.bits[i] = b - i++ - } - } - - if !f.h1.init(f.bits[0:nlit]) || !f.h2.init(f.bits[nlit:nlit+ndist]) { - f.err = true - return - } -} - -// Decode a single Huffman block from f. -// hl and hd are the Huffman states for the lit/length values -// and the distance values, respectively. If hd == nil, using the -// fixed distance encoding associated with fixed Huffman blocks. -func (f *decompressor) huffmanBlock(hl, hd *huffmanDecoder) { - for { - v := f.huffSym(hl) - if f.err { - return - } - var n uint // number of bits extra - var length int - switch { - case v < 256: - f.out = append(f.out, byte(v)) - continue - case v == 256: - // Done with huffman block; read next block. - return - // otherwise, reference to older data - case v < 265: - length = v - (257 - 3) - n = 0 - case v < 269: - length = v*2 - (265*2 - 11) - n = 1 - case v < 273: - length = v*4 - (269*4 - 19) - n = 2 - case v < 277: - length = v*8 - (273*8 - 35) - n = 3 - case v < 281: - length = v*16 - (277*16 - 67) - n = 4 - case v < 285: - length = v*32 - (281*32 - 131) - n = 5 - default: - length = 258 - n = 0 - } - if n > 0 { - for f.nb < n { - if f.moreBits(); f.err { - return - } - } - length += int(f.b & uint32(1<>= n - f.nb -= n - } - - var dist int - if hd == nil { - for f.nb < 5 { - if f.moreBits(); f.err { - return - } - } - dist = int(reverseByte[(f.b&0x1F)<<3]) - f.b >>= 5 - f.nb -= 5 - } else { - if dist = f.huffSym(hd); f.err { - return - } - } - - switch { - case dist < 4: - dist++ - case dist >= 30: - f.err = true - return - default: - nb := uint(dist-2) >> 1 - // have 1 bit in bottom of dist, need nb more. - extra := (dist & 1) << nb - for f.nb < nb { - if f.moreBits(); f.err { - return - } - } - extra |= int(f.b & uint32(1<>= nb - f.nb -= nb - dist = 1<<(nb+1) + 1 + extra - } - - // Copy [-dist:-dist+length] into output. - // Encoding can be prescient, so no check on length. - if dist > len(f.out) { - f.err = true - return - } - - p := len(f.out) - dist - for i := 0; i < length; i++ { - f.out = append(f.out, f.out[p]) - p++ - } - } -} - -// Copy a single uncompressed data block from input to output. -func (f *decompressor) dataBlock() { - // Uncompressed. - // Discard current half-byte. - f.nb = 0 - f.b = 0 - - if len(f.in) < 4 { - f.err = true - return - } - - buf := f.in[:4] - f.in = f.in[4:] - n := int(buf[0]) | int(buf[1])<<8 - nn := int(buf[2]) | int(buf[3])<<8 - if uint16(nn) != uint16(^n) { - f.err = true - return - } - - if len(f.in) < n { - f.err = true - return - } - f.out = append(f.out, f.in[:n]...) - f.in = f.in[n:] -} - -func (f *decompressor) moreBits() { - if len(f.in) == 0 { - f.err = true - return - } - c := f.in[0] - f.in = f.in[1:] - f.b |= uint32(c) << f.nb - f.nb += 8 -} - -// Read the next Huffman-encoded symbol from f according to h. -func (f *decompressor) huffSym(h *huffmanDecoder) int { - for n := uint(h.min); n <= uint(h.max); n++ { - lim := h.limit[n] - if lim == -1 { - continue - } - for f.nb < n { - if f.moreBits(); f.err { - return 0 - } - } - v := int(f.b & uint32(1<>8]) | int(reverseByte[v&0xFF])<<8 // reverse bits - if v <= lim { - f.b >>= n - f.nb -= n - return h.codes[v-h.base[n]] - } - } - f.err = true - return 0 -} - -var reverseByte = [256]byte{ - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -} - -// Hard-coded Huffman tables for DEFLATE algorithm. -// See RFC 1951, section 3.2.6. -var fixedHuffmanDecoder = huffmanDecoder{ - 7, 9, - [maxCodeLen + 1]int{7: 23, 199, 511}, - [maxCodeLen + 1]int{7: 0, 24, 224}, - []int{ - // length 7: 256-279 - 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, - - // length 8: 0-143 - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, - - // length 8: 280-287 - 280, 281, 282, 283, 284, 285, 286, 287, - - // length 9: 144-255 - 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, - }, -} - -// Huffman decoder is based on -// J. Brian Connell, ``A Huffman-Shannon-Fano Code,'' -// Proceedings of the IEEE, 61(7) (July 1973), pp 1046-1047. -type huffmanDecoder struct { - // min, max code length - min, max int - - // limit[i] = largest code word of length i - // Given code v of length n, - // need more bits if v > limit[n]. - limit [maxCodeLen + 1]int - - // base[i] = smallest code word of length i - seq number - base [maxCodeLen + 1]int - - // codes[seq number] = output code. - // Given code v of length n, value is - // codes[v - base[n]]. - codes []int -} - -// Initialize Huffman decoding tables from array of code lengths. -func (h *huffmanDecoder) init(bits []int) bool { - // Count number of codes of each length, - // compute min and max length. - var count [maxCodeLen + 1]int - var min, max int - for _, n := range bits { - if n == 0 { - continue - } - if min == 0 || n < min { - min = n - } - if n > max { - max = n - } - count[n]++ - } - if max == 0 { - return false - } - - h.min = min - h.max = max - - // For each code range, compute - // nextcode (first code of that length), - // limit (last code of that length), and - // base (offset from first code to sequence number). - code := 0 - seq := 0 - var nextcode [maxCodeLen]int - for i := min; i <= max; i++ { - n := count[i] - nextcode[i] = code - h.base[i] = code - seq - code += n - seq += n - h.limit[i] = code - 1 - code <<= 1 - } - - // Make array mapping sequence numbers to codes. - if len(h.codes) < len(bits) { - h.codes = make([]int, len(bits)) - } - for i, n := range bits { - if n == 0 { - continue - } - code := nextcode[n] - nextcode[n]++ - seq := code - h.base[n] - h.codes[seq] = i - } - return true -} - -func inflate(in string) (out []byte) { - var d decompressor - d.in = in - for !d.err && !d.eof { - d.nextBlock() - } - if len(d.in) != 0 { - println("fs unzip: junk at end of compressed data") - return nil - } - return d.out -} - -// get4 returns the little-endian 32-bit value in b. -func zget4(b string) int { - if len(b) < 4 { - return 0 - } - return int(b[0]) | int(b[1])<<8 | int(b[2])<<16 | int(b[3])<<24 -} - -// get2 returns the little-endian 16-bit value in b. -func zget2(b string) int { - if len(b) < 2 { - return 0 - } - return int(b[0]) | int(b[1])<<8 -} - -func unzip(data string) { - const ( - zecheader = 0x06054b50 - zcheader = 0x02014b50 - ztailsize = 22 - zheadersize = 30 - zheader = 0x04034b50 - ) - - buf := data[len(data)-ztailsize:] - n := zget2(buf[10:]) - size := zget4(buf[12:]) - off := zget4(buf[16:]) - - hdr := data[off : off+size] - for i := 0; i < n; i++ { - // zip entry layout: - // 0 magic[4] - // 4 madevers[1] - // 5 madeos[1] - // 6 extvers[1] - // 7 extos[1] - // 8 flags[2] - // 10 meth[2] - // 12 modtime[2] - // 14 moddate[2] - // 16 crc[4] - // 20 csize[4] - // 24 uncsize[4] - // 28 namelen[2] - // 30 xlen[2] - // 32 fclen[2] - // 34 disknum[2] - // 36 iattr[2] - // 38 eattr[4] - // 42 off[4] - // 46 name[namelen] - // 46+namelen+xlen+fclen - next header - // - if zget4(hdr) != zcheader { - println("fs unzip: bad magic") - break - } - meth := zget2(hdr[10:]) - mtime := zget2(hdr[12:]) - mdate := zget2(hdr[14:]) - csize := zget4(hdr[20:]) - size := zget4(hdr[24:]) - namelen := zget2(hdr[28:]) - xlen := zget2(hdr[30:]) - fclen := zget2(hdr[32:]) - xattr := uint32(zget4(hdr[38:])) >> 16 - off := zget4(hdr[42:]) - name := hdr[46 : 46+namelen] - hdr = hdr[46+namelen+xlen+fclen:] - - // zip per-file header layout: - // 0 magic[4] - // 4 extvers[1] - // 5 extos[1] - // 6 flags[2] - // 8 meth[2] - // 10 modtime[2] - // 12 moddate[2] - // 14 crc[4] - // 18 csize[4] - // 22 uncsize[4] - // 26 namelen[2] - // 28 xlen[2] - // 30 name[namelen] - // 30+namelen+xlen - file data - // - buf := data[off : off+zheadersize+namelen] - if zget4(buf) != zheader || - zget2(buf[8:]) != meth || - zget2(buf[26:]) != namelen || - buf[30:30+namelen] != name { - println("fs unzip: inconsistent zip file") - return - } - xlen = zget2(buf[28:]) - - off += zheadersize + namelen + xlen - - var fdata []byte - switch meth { - case 0: - // buf is uncompressed - buf = data[off : off+size] - fdata = []byte(buf) - case 8: - // buf is deflate-compressed - buf = data[off : off+csize] - fdata = inflate(buf) - if len(fdata) != size { - println("fs unzip: inconsistent size in zip file") - return - } - } - - if xattr&S_IFMT == 0 { - if xattr&0777 == 0 { - xattr |= 0666 - } - if len(name) > 0 && name[len(name)-1] == '/' { - xattr |= S_IFDIR - xattr |= 0111 - } else { - xattr |= S_IFREG - } - } - - if err := create(name, xattr, zipToTime(mdate, mtime), fdata); err != nil { - print("fs unzip: create ", name, ": ", err.Error(), "\n") - } - } - - chdirEnv() -} - -func zipToTime(date, time int) int64 { - dd := date & 0x1f - mm := date >> 5 & 0xf - yy := date >> 9 // since 1980 - - sec := int64(315532800) // jan 1 1980 - sec += int64(yy) * 365 * 86400 - sec += int64(yy) / 4 * 86400 - if yy%4 > 0 || mm >= 3 { - sec += 86400 - } - sec += int64(daysBeforeMonth[mm]) * 86400 - sec += int64(dd-1) * 86400 - - h := time >> 11 - m := time >> 5 & 0x3F - s := time & 0x1f * 2 - sec += int64(h*3600 + m*60 + s) - - return sec -} - -var daysBeforeMonth = [...]int32{ - 0, - 0, - 31, - 31 + 28, - 31 + 28 + 31, - 31 + 28 + 31 + 30, - 31 + 28 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31, -} diff --git a/src/syscall/zerrors_freebsd_arm64.go b/src/syscall/zerrors_freebsd_arm64.go new file mode 100644 index 00000000000..82ee1584789 --- /dev/null +++ b/src/syscall/zerrors_freebsd_arm64.go @@ -0,0 +1,1718 @@ +// mkerrors.sh -m64 +// Code generated by the command above; DO NOT EDIT. + +// +build freebsd,arm64 + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package syscall + +const ( + AF_APPLETALK = 0x10 + AF_ARP = 0x23 + AF_ATM = 0x1e + AF_BLUETOOTH = 0x24 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_HYLINK = 0xf + AF_IEEE80211 = 0x25 + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x1c + AF_INET6_SDP = 0x2a + AF_INET_SDP = 0x28 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x2a + AF_NATM = 0x1d + AF_NETBIOS = 0x6 + AF_NETGRAPH = 0x20 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SCLUSTER = 0x22 + AF_SIP = 0x18 + AF_SLOW = 0x21 + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_VENDOR00 = 0x27 + AF_VENDOR01 = 0x29 + AF_VENDOR02 = 0x2b + AF_VENDOR03 = 0x2d + AF_VENDOR04 = 0x2f + AF_VENDOR05 = 0x31 + AF_VENDOR06 = 0x33 + AF_VENDOR07 = 0x35 + AF_VENDOR08 = 0x37 + AF_VENDOR09 = 0x39 + AF_VENDOR10 = 0x3b + AF_VENDOR11 = 0x3d + AF_VENDOR12 = 0x3f + AF_VENDOR13 = 0x41 + AF_VENDOR14 = 0x43 + AF_VENDOR15 = 0x45 + AF_VENDOR16 = 0x47 + AF_VENDOR17 = 0x49 + AF_VENDOR18 = 0x4b + AF_VENDOR19 = 0x4d + AF_VENDOR20 = 0x4f + AF_VENDOR21 = 0x51 + AF_VENDOR22 = 0x53 + AF_VENDOR23 = 0x55 + AF_VENDOR24 = 0x57 + AF_VENDOR25 = 0x59 + AF_VENDOR26 = 0x5b + AF_VENDOR27 = 0x5d + AF_VENDOR28 = 0x5f + AF_VENDOR29 = 0x61 + AF_VENDOR30 = 0x63 + AF_VENDOR31 = 0x65 + AF_VENDOR32 = 0x67 + AF_VENDOR33 = 0x69 + AF_VENDOR34 = 0x6b + AF_VENDOR35 = 0x6d + AF_VENDOR36 = 0x6f + AF_VENDOR37 = 0x71 + AF_VENDOR38 = 0x73 + AF_VENDOR39 = 0x75 + AF_VENDOR40 = 0x77 + AF_VENDOR41 = 0x79 + AF_VENDOR42 = 0x7b + AF_VENDOR43 = 0x7d + AF_VENDOR44 = 0x7f + AF_VENDOR45 = 0x81 + AF_VENDOR46 = 0x83 + AF_VENDOR47 = 0x85 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B460800 = 0x70800 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B921600 = 0xe1000 + B9600 = 0x2580 + BIOCFEEDBACK = 0x8004427c + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRECTION = 0x40044276 + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc0104279 + BIOCGETBUFMODE = 0x4004427d + BIOCGETIF = 0x4020426b + BIOCGETZMAX = 0x4008427f + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044272 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSEESENT = 0x40044276 + BIOCGSTATS = 0x4008426f + BIOCGTSTAMP = 0x40044283 + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x2000427a + BIOCPROMISC = 0x20004269 + BIOCROTZBUF = 0x40184280 + BIOCSBLEN = 0xc0044266 + BIOCSDIRECTION = 0x80044277 + BIOCSDLT = 0x80044278 + BIOCSETBUFMODE = 0x8004427e + BIOCSETF = 0x80104267 + BIOCSETFNR = 0x80104282 + BIOCSETIF = 0x8020426c + BIOCSETWF = 0x8010427b + BIOCSETZBUF = 0x80184281 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044273 + BIOCSRTIMEOUT = 0x8010426d + BIOCSSEESENT = 0x80044277 + BIOCSTSTAMP = 0x80044284 + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x8 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_BUFMODE_BUFFER = 0x1 + BPF_BUFMODE_ZBUF = 0x2 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x80000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_T_BINTIME = 0x2 + BPF_T_BINTIME_FAST = 0x102 + BPF_T_BINTIME_MONOTONIC = 0x202 + BPF_T_BINTIME_MONOTONIC_FAST = 0x302 + BPF_T_FAST = 0x100 + BPF_T_FLAG_MASK = 0x300 + BPF_T_FORMAT_MASK = 0x3 + BPF_T_MICROTIME = 0x0 + BPF_T_MICROTIME_FAST = 0x100 + BPF_T_MICROTIME_MONOTONIC = 0x200 + BPF_T_MICROTIME_MONOTONIC_FAST = 0x300 + BPF_T_MONOTONIC = 0x200 + BPF_T_MONOTONIC_FAST = 0x300 + BPF_T_NANOTIME = 0x1 + BPF_T_NANOTIME_FAST = 0x101 + BPF_T_NANOTIME_MONOTONIC = 0x201 + BPF_T_NANOTIME_MONOTONIC_FAST = 0x301 + BPF_T_NONE = 0x3 + BPF_T_NORMAL = 0x0 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CREAD = 0x800 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0x14 + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_MAXNAME = 0x18 + CTL_NET = 0x4 + DLT_A429 = 0xb8 + DLT_A653_ICM = 0xb9 + DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde + DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DLT_ARCNET = 0x7 + DLT_ARCNET_LINUX = 0x81 + DLT_ATM_CLIP = 0x13 + DLT_ATM_RFC1483 = 0xb + DLT_AURORA = 0x7e + DLT_AX25 = 0x3 + DLT_AX25_KISS = 0xca + DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_HCI_H4 = 0xbb + DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 + DLT_CHAOS = 0x5 + DLT_CHDLC = 0x68 + DLT_CISCO_IOS = 0x76 + DLT_C_HDLC = 0x68 + DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd + DLT_DOCSIS = 0x8f + DLT_DVB_CI = 0xeb + DLT_ECONET = 0x73 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0x6d + DLT_ERF = 0xc5 + DLT_ERF_ETH = 0xaf + DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_FDDI = 0xa + DLT_FLEXRAY = 0xd2 + DLT_FRELAY = 0x6b + DLT_FRELAY_WITH_DIR = 0xce + DLT_GCOM_SERIAL = 0xad + DLT_GCOM_T1E1 = 0xac + DLT_GPF_F = 0xab + DLT_GPF_T = 0xaa + DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 + DLT_HHDLC = 0x79 + DLT_IBM_SN = 0x92 + DLT_IBM_SP = 0x91 + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_IEEE802_11_RADIO_AVS = 0xa3 + DLT_IEEE802_15_4 = 0xc3 + DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 + DLT_IEEE802_15_4_NONASK_PHY = 0xd7 + DLT_IEEE802_16_MAC_CPS = 0xbc + DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_IPFILTER = 0x74 + DLT_IPMB = 0xc7 + DLT_IPMB_LINUX = 0xd1 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 + DLT_IP_OVER_FC = 0x7a + DLT_JUNIPER_ATM1 = 0x89 + DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee + DLT_JUNIPER_CHDLC = 0xb5 + DLT_JUNIPER_ES = 0x84 + DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea + DLT_JUNIPER_FRELAY = 0xb4 + DLT_JUNIPER_GGSN = 0x85 + DLT_JUNIPER_ISM = 0xc2 + DLT_JUNIPER_MFR = 0x86 + DLT_JUNIPER_MLFR = 0x83 + DLT_JUNIPER_MLPPP = 0x82 + DLT_JUNIPER_MONITOR = 0xa4 + DLT_JUNIPER_PIC_PEER = 0xae + DLT_JUNIPER_PPP = 0xb3 + DLT_JUNIPER_PPPOE = 0xa7 + DLT_JUNIPER_PPPOE_ATM = 0xa8 + DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 + DLT_JUNIPER_ST = 0xc8 + DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 + DLT_LAPB_WITH_DIR = 0xcf + DLT_LAPD = 0xcb + DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 + DLT_LINUX_IRDA = 0x90 + DLT_LINUX_LAPD = 0xb1 + DLT_LINUX_PPP_WITHDIRECTION = 0xa6 + DLT_LINUX_SLL = 0x71 + DLT_LOOP = 0x6c + DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0xf6 + DLT_MATCHING_MIN = 0x68 + DLT_MFR = 0xb6 + DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb + DLT_MTP2 = 0x8c + DLT_MTP2_WITH_PHDR = 0x8b + DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 + DLT_NULL = 0x0 + DLT_PCI_EXP = 0x7d + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x79 + DLT_PPI = 0xc0 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_PPPD = 0xa6 + DLT_PPP_SERIAL = 0x32 + DLT_PPP_WITH_DIR = 0xcc + DLT_PPP_WITH_DIRECTION = 0xa6 + DLT_PRISM_HEADER = 0x77 + DLT_PRONET = 0x4 + DLT_RAIF1 = 0xc6 + DLT_RAW = 0xc + DLT_RIO = 0x7c + DLT_SCCP = 0x8e + DLT_SITA = 0xc4 + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_STANAG_5066_D_PDU = 0xed + DLT_SUNATM = 0x7b + DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TZSP = 0x80 + DLT_USB = 0xba + DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_WIHART = 0xdf + DLT_X2E_SERIAL = 0xd5 + DLT_X2E_XORAYA = 0xd6 + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EVFILT_AIO = -0x3 + EVFILT_FS = -0x9 + EVFILT_LIO = -0xa + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0xb + EVFILT_TIMER = -0x7 + EVFILT_USER = -0xb + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_DROP = 0x1000 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_CANCEL = 0x5 + F_DUP2FD = 0xa + F_DUP2FD_CLOEXEC = 0x12 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x11 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0xb + F_GETOWN = 0x5 + F_OGETLK = 0x7 + F_OK = 0x0 + F_OSETLK = 0x8 + F_OSETLKW = 0x9 + F_RDAHEAD = 0x10 + F_RDLCK = 0x1 + F_READAHEAD = 0xf + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0xc + F_SETLKW = 0xd + F_SETLK_REMOTE = 0xe + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_UNLCKSYS = 0x4 + F_WRLCK = 0x3 + HUPCL = 0x4000 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_ALTPHYS = 0x4000 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x218f72 + IFF_CANTCONFIG = 0x10000 + IFF_DEBUG = 0x4 + IFF_DRV_OACTIVE = 0x400 + IFF_DRV_RUNNING = 0x40 + IFF_DYING = 0x200000 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MONITOR = 0x40000 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PPROMISC = 0x20000 + IFF_PROMISC = 0x100 + IFF_RENAMING = 0x400000 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_SMART = 0x20 + IFF_STATICARP = 0x80000 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf8 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf2 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_IPXIP = 0xf9 + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf6 + IFT_PFSYNC = 0xf7 + IFT_PLC = 0xae + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf1 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_STF = 0xd7 + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VOICEEM = 0x64 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_RFC3021_MASK = 0xfffffffe + IPPROTO_3PC = 0x22 + IPPROTO_ADFS = 0x44 + IPPROTO_AH = 0x33 + IPPROTO_AHIP = 0x3d + IPPROTO_APES = 0x63 + IPPROTO_ARGUS = 0xd + IPPROTO_AX25 = 0x5d + IPPROTO_BHA = 0x31 + IPPROTO_BLT = 0x1e + IPPROTO_BRSATMON = 0x4c + IPPROTO_CARP = 0x70 + IPPROTO_CFTP = 0x3e + IPPROTO_CHAOS = 0x10 + IPPROTO_CMTP = 0x26 + IPPROTO_CPHB = 0x49 + IPPROTO_CPNX = 0x48 + IPPROTO_DDP = 0x25 + IPPROTO_DGP = 0x56 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_EMCON = 0xe + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GMTP = 0x64 + IPPROTO_GRE = 0x2f + IPPROTO_HELLO = 0x3f + IPPROTO_HMP = 0x14 + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IDPR = 0x23 + IPPROTO_IDRP = 0x2d + IPPROTO_IGMP = 0x2 + IPPROTO_IGP = 0x55 + IPPROTO_IGRP = 0x58 + IPPROTO_IL = 0x28 + IPPROTO_INLSP = 0x34 + IPPROTO_INP = 0x20 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPCV = 0x47 + IPPROTO_IPEIP = 0x5e + IPPROTO_IPIP = 0x4 + IPPROTO_IPPC = 0x43 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_IRTP = 0x1c + IPPROTO_KRYPTOLAN = 0x41 + IPPROTO_LARP = 0x5b + IPPROTO_LEAF1 = 0x19 + IPPROTO_LEAF2 = 0x1a + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x34 + IPPROTO_MEAS = 0x13 + IPPROTO_MH = 0x87 + IPPROTO_MHRP = 0x30 + IPPROTO_MICP = 0x5f + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_MTP = 0x5c + IPPROTO_MUX = 0x12 + IPPROTO_ND = 0x4d + IPPROTO_NHRP = 0x36 + IPPROTO_NONE = 0x3b + IPPROTO_NSP = 0x1f + IPPROTO_NVPII = 0xb + IPPROTO_OLD_DIVERT = 0xfe + IPPROTO_OSPFIGP = 0x59 + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PGM = 0x71 + IPPROTO_PIGP = 0x9 + IPPROTO_PIM = 0x67 + IPPROTO_PRM = 0x15 + IPPROTO_PUP = 0xc + IPPROTO_PVP = 0x4b + IPPROTO_RAW = 0xff + IPPROTO_RCCMON = 0xa + IPPROTO_RDP = 0x1b + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_RVD = 0x42 + IPPROTO_SATEXPAK = 0x40 + IPPROTO_SATMON = 0x45 + IPPROTO_SCCSP = 0x60 + IPPROTO_SCTP = 0x84 + IPPROTO_SDRP = 0x2a + IPPROTO_SEND = 0x103 + IPPROTO_SEP = 0x21 + IPPROTO_SKIP = 0x39 + IPPROTO_SPACER = 0x7fff + IPPROTO_SRPC = 0x5a + IPPROTO_ST = 0x7 + IPPROTO_SVMTP = 0x52 + IPPROTO_SWIPE = 0x35 + IPPROTO_TCF = 0x57 + IPPROTO_TCP = 0x6 + IPPROTO_TLSP = 0x38 + IPPROTO_TP = 0x1d + IPPROTO_TPXX = 0x27 + IPPROTO_TRUNK1 = 0x17 + IPPROTO_TRUNK2 = 0x18 + IPPROTO_TTP = 0x54 + IPPROTO_UDP = 0x11 + IPPROTO_VINES = 0x53 + IPPROTO_VISA = 0x46 + IPPROTO_VMTP = 0x51 + IPPROTO_WBEXPAK = 0x4f + IPPROTO_WBMON = 0x4e + IPPROTO_WSN = 0x4a + IPPROTO_XNET = 0xf + IPPROTO_XTP = 0x24 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_BINDANY = 0x40 + IPV6_BINDV6ONLY = 0x1b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FRAGTTL = 0x78 + IPV6_FW_ADD = 0x1e + IPV6_FW_DEL = 0x1f + IPV6_FW_FLUSH = 0x20 + IPV6_FW_GET = 0x22 + IPV6_FW_ZERO = 0x21 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXOPTHDR = 0x800 + IPV6_MAXPACKET = 0xffff + IPV6_MAX_GROUP_SRC_FILTER = 0x200 + IPV6_MAX_MEMBERSHIPS = 0xfff + IPV6_MAX_SOCK_SRC_FILTER = 0x80 + IPV6_MIN_MEMBERSHIPS = 0x1f + IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_ADD_SOURCE_MEMBERSHIP = 0x46 + IP_BINDANY = 0x18 + IP_BLOCK_SOURCE = 0x48 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DONTFRAG = 0x43 + IP_DROP_MEMBERSHIP = 0xd + IP_DROP_SOURCE_MEMBERSHIP = 0x47 + IP_DUMMYNET3 = 0x31 + IP_DUMMYNET_CONFIGURE = 0x3c + IP_DUMMYNET_DEL = 0x3d + IP_DUMMYNET_FLUSH = 0x3e + IP_DUMMYNET_GET = 0x40 + IP_FAITH = 0x16 + IP_FW3 = 0x30 + IP_FW_ADD = 0x32 + IP_FW_DEL = 0x33 + IP_FW_FLUSH = 0x34 + IP_FW_GET = 0x36 + IP_FW_NAT_CFG = 0x38 + IP_FW_NAT_DEL = 0x39 + IP_FW_NAT_GET_CONFIG = 0x3a + IP_FW_NAT_GET_LOG = 0x3b + IP_FW_RESETLOG = 0x37 + IP_FW_TABLE_ADD = 0x28 + IP_FW_TABLE_DEL = 0x29 + IP_FW_TABLE_FLUSH = 0x2a + IP_FW_TABLE_GETSIZE = 0x2b + IP_FW_TABLE_LIST = 0x2c + IP_FW_ZERO = 0x35 + IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x15 + IP_MAXPACKET = 0xffff + IP_MAX_GROUP_SRC_FILTER = 0x200 + IP_MAX_MEMBERSHIPS = 0xfff + IP_MAX_SOCK_MUTE_FILTER = 0x80 + IP_MAX_SOCK_SRC_FILTER = 0x80 + IP_MAX_SOURCE_FILTER = 0x400 + IP_MF = 0x2000 + IP_MINTTL = 0x42 + IP_MIN_MEMBERSHIPS = 0x1f + IP_MSFILTER = 0x4a + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_MULTICAST_VIF = 0xe + IP_OFFMASK = 0x1fff + IP_ONESBCAST = 0x17 + IP_OPTIONS = 0x1 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVIF = 0x14 + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x44 + IP_RECVTTL = 0x41 + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RSVP_OFF = 0x10 + IP_RSVP_ON = 0xf + IP_RSVP_VIF_OFF = 0x12 + IP_RSVP_VIF_ON = 0x11 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + IP_UNBLOCK_SOURCE = 0x49 + ISIG = 0x80 + ISTRIP = 0x20 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_AUTOSYNC = 0x7 + MADV_CORE = 0x9 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x5 + MADV_NOCORE = 0x8 + MADV_NORMAL = 0x0 + MADV_NOSYNC = 0x6 + MADV_PROTECT = 0xa + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_WILLNEED = 0x3 + MAP_32BIT = 0x80000 + MAP_ALIGNED_SUPER = 0x1000000 + MAP_ALIGNMENT_MASK = -0x1000000 + MAP_ALIGNMENT_SHIFT = 0x18 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_HASSEMAPHORE = 0x200 + MAP_NOCORE = 0x20000 + MAP_NORESERVE = 0x40 + MAP_NOSYNC = 0x800 + MAP_PREFAULT_READ = 0x40000 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_RESERVED0080 = 0x80 + MAP_RESERVED0100 = 0x100 + MAP_SHARED = 0x1 + MAP_STACK = 0x400 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MSG_CMSG_CLOEXEC = 0x40000 + MSG_COMPAT = 0x8000 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOF = 0x100 + MSG_EOR = 0x8 + MSG_NBIO = 0x4000 + MSG_NOSIGNAL = 0x20000 + MSG_NOTIFICATION = 0x2000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x2 + MS_SYNC = 0x0 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFLISTL = 0x5 + NET_RT_IFMALIST = 0x4 + NET_RT_MAXID = 0x6 + NOFLSH = 0x80000000 + NOTE_ATTRIB = 0x8 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FFAND = 0x40000000 + NOTE_FFCOPY = 0xc0000000 + NOTE_FFCTRLMASK = 0xc0000000 + NOTE_FFLAGSMASK = 0xffffff + NOTE_FFNOP = 0x0 + NOTE_FFOR = 0x80000000 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRIGGER = 0x1000000 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + ONLCR = 0x2 + ONLRET = 0x40 + ONOCR = 0x20 + ONOEOT = 0x8 + OPOST = 0x1 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x100000 + O_CREAT = 0x200 + O_DIRECT = 0x10000 + O_DIRECTORY = 0x20000 + O_EXCL = 0x800 + O_EXEC = 0x40000 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_TTY_INIT = 0x80000 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_AS = 0xa + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_NOFILE = 0x8 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BRD = 0x7 + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_MAX = 0x8 + RTAX_NETMASK = 0x2 + RTA_AUTHOR = 0x40 + RTA_BRD = 0x80 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_NETMASK = 0x4 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x1004d808 + RTF_GATEWAY = 0x2 + RTF_GWFLAG_COMPAT = 0x80000000 + RTF_HOST = 0x4 + RTF_LLDATA = 0x400 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MULTICAST = 0x800000 + RTF_PINNED = 0x100000 + RTF_PRCLONING = 0x10000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x40000 + RTF_REJECT = 0x8 + RTF_RNH_LOCKED = 0x40000000 + RTF_STATIC = 0x800 + RTF_STICKY = 0x10000000 + RTF_UP = 0x1 + RTF_XRESOLVE = 0x200 + RTM_ADD = 0x1 + RTM_CHANGE = 0x3 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DELMADDR = 0x10 + RTM_GET = 0x4 + RTM_IEEE80211 = 0x12 + RTM_IFANNOUNCE = 0x11 + RTM_IFINFO = 0xe + RTM_LOCK = 0x8 + RTM_LOSING = 0x5 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_NEWMADDR = 0xf + RTM_OLDADD = 0x9 + RTM_OLDDEL = 0xa + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RTV_WEIGHT = 0x100 + RT_CACHING_CONTEXT = 0x1 + RT_DEFAULT_FIB = 0x0 + RT_NORTREF = 0x2 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_BINTIME = 0x4 + SCM_CREDS = 0x3 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x2 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCADDRT = 0x8040720a + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCALIFADDR = 0x8118691b + SIOCATMARK = 0x40047307 + SIOCDELMULTI = 0x80206932 + SIOCDELRT = 0x8040720b + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPHYADDR = 0x80206949 + SIOCDLIFADDR = 0x8118691d + SIOCGDRVSPEC = 0xc028697b + SIOCGETSGCNT = 0xc0207210 + SIOCGETVIFCNT = 0xc028720f + SIOCGHIWAT = 0x40047301 + SIOCGIFADDR = 0xc0206921 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCAP = 0xc020691f + SIOCGIFCONF = 0xc0106924 + SIOCGIFDESCR = 0xc020692a + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFIB = 0xc020695c + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFINDEX = 0xc0206920 + SIOCGIFMAC = 0xc0206926 + SIOCGIFMEDIA = 0xc0306938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc0206933 + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPDSTADDR = 0xc0206948 + SIOCGIFPHYS = 0xc0206935 + SIOCGIFPSRCADDR = 0xc0206947 + SIOCGIFSTATUS = 0xc331693b + SIOCGLIFADDR = 0xc118691c + SIOCGLIFPHYADDR = 0xc118694b + SIOCGLOWAT = 0x40047303 + SIOCGPGRP = 0x40047309 + SIOCGPRIVATE_0 = 0xc0206950 + SIOCGPRIVATE_1 = 0xc0206951 + SIOCIFCREATE = 0xc020697a + SIOCIFCREATE2 = 0xc020697c + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSDRVSPEC = 0x8028697b + SIOCSHIWAT = 0x80047300 + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFCAP = 0x8020691e + SIOCSIFDESCR = 0x80206929 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFIB = 0x8020695d + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020693c + SIOCSIFMAC = 0x80206927 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x80206934 + SIOCSIFNAME = 0x80206928 + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPHYADDR = 0x80406946 + SIOCSIFPHYS = 0x80206936 + SIOCSIFRVNET = 0xc020695b + SIOCSIFVNET = 0xc020695a + SIOCSLIFPHYADDR = 0x8118694a + SIOCSLOWAT = 0x80047302 + SIOCSPGRP = 0x80047308 + SOCK_CLOEXEC = 0x10000000 + SOCK_DGRAM = 0x2 + SOCK_MAXADDRLEN = 0xff + SOCK_NONBLOCK = 0x20000000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_ACCEPTFILTER = 0x1000 + SO_BINTIME = 0x2000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LABEL = 0x1009 + SO_LINGER = 0x80 + SO_LISTENINCQLEN = 0x1013 + SO_LISTENQLEN = 0x1012 + SO_LISTENQLIMIT = 0x1011 + SO_NOSIGPIPE = 0x800 + SO_NO_DDP = 0x8000 + SO_NO_OFFLOAD = 0x4000 + SO_OOBINLINE = 0x100 + SO_PEERLABEL = 0x1010 + SO_PROTOCOL = 0x1016 + SO_PROTOTYPE = 0x1016 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_SETFIB = 0x1014 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TIMESTAMP = 0x400 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_USER_COOKIE = 0x1015 + SO_VENDOR = 0x80000000 + TCIFLUSH = 0x1 + TCIOFLUSH = 0x3 + TCOFLUSH = 0x2 + TCP_CA_NAME_MAX = 0x10 + TCP_CONGESTION = 0x40 + TCP_INFO = 0x20 + TCP_KEEPCNT = 0x400 + TCP_KEEPIDLE = 0x100 + TCP_KEEPINIT = 0x80 + TCP_KEEPINTVL = 0x200 + TCP_MAXBURST = 0x4 + TCP_MAXHLEN = 0x3c + TCP_MAXOLEN = 0x28 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x4 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x10 + TCP_MINMSS = 0xd8 + TCP_MSS = 0x218 + TCP_NODELAY = 0x1 + TCP_NOOPT = 0x8 + TCP_NOPUSH = 0x4 + TCP_VENDOR = 0x80000000 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGPTN = 0x4004740f + TIOCGSID = 0x40047463 + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DCD = 0x40 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTMASTER = 0x2000741c + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VERASE2 = 0x7 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WCONTINUED = 0x4 + WCOREFLAG = 0x80 + WEXITED = 0x10 + WLINUXCLONE = 0x80000000 + WNOHANG = 0x1 + WNOWAIT = 0x8 + WSTOPPED = 0x2 + WTRAPPED = 0x20 + WUNTRACED = 0x2 +) + +// Errors +const ( + E2BIG = Errno(0x7) + EACCES = Errno(0xd) + EADDRINUSE = Errno(0x30) + EADDRNOTAVAIL = Errno(0x31) + EAFNOSUPPORT = Errno(0x2f) + EAGAIN = Errno(0x23) + EALREADY = Errno(0x25) + EAUTH = Errno(0x50) + EBADF = Errno(0x9) + EBADMSG = Errno(0x59) + EBADRPC = Errno(0x48) + EBUSY = Errno(0x10) + ECANCELED = Errno(0x55) + ECAPMODE = Errno(0x5e) + ECHILD = Errno(0xa) + ECONNABORTED = Errno(0x35) + ECONNREFUSED = Errno(0x3d) + ECONNRESET = Errno(0x36) + EDEADLK = Errno(0xb) + EDESTADDRREQ = Errno(0x27) + EDOM = Errno(0x21) + EDOOFUS = Errno(0x58) + EDQUOT = Errno(0x45) + EEXIST = Errno(0x11) + EFAULT = Errno(0xe) + EFBIG = Errno(0x1b) + EFTYPE = Errno(0x4f) + EHOSTDOWN = Errno(0x40) + EHOSTUNREACH = Errno(0x41) + EIDRM = Errno(0x52) + EILSEQ = Errno(0x56) + EINPROGRESS = Errno(0x24) + EINTR = Errno(0x4) + EINVAL = Errno(0x16) + EIO = Errno(0x5) + EISCONN = Errno(0x38) + EISDIR = Errno(0x15) + ELAST = Errno(0x60) + ELOOP = Errno(0x3e) + EMFILE = Errno(0x18) + EMLINK = Errno(0x1f) + EMSGSIZE = Errno(0x28) + EMULTIHOP = Errno(0x5a) + ENAMETOOLONG = Errno(0x3f) + ENEEDAUTH = Errno(0x51) + ENETDOWN = Errno(0x32) + ENETRESET = Errno(0x34) + ENETUNREACH = Errno(0x33) + ENFILE = Errno(0x17) + ENOATTR = Errno(0x57) + ENOBUFS = Errno(0x37) + ENODEV = Errno(0x13) + ENOENT = Errno(0x2) + ENOEXEC = Errno(0x8) + ENOLCK = Errno(0x4d) + ENOLINK = Errno(0x5b) + ENOMEM = Errno(0xc) + ENOMSG = Errno(0x53) + ENOPROTOOPT = Errno(0x2a) + ENOSPC = Errno(0x1c) + ENOSYS = Errno(0x4e) + ENOTBLK = Errno(0xf) + ENOTCAPABLE = Errno(0x5d) + ENOTCONN = Errno(0x39) + ENOTDIR = Errno(0x14) + ENOTEMPTY = Errno(0x42) + ENOTRECOVERABLE = Errno(0x5f) + ENOTSOCK = Errno(0x26) + ENOTSUP = Errno(0x2d) + ENOTTY = Errno(0x19) + ENXIO = Errno(0x6) + EOPNOTSUPP = Errno(0x2d) + EOVERFLOW = Errno(0x54) + EOWNERDEAD = Errno(0x60) + EPERM = Errno(0x1) + EPFNOSUPPORT = Errno(0x2e) + EPIPE = Errno(0x20) + EPROCLIM = Errno(0x43) + EPROCUNAVAIL = Errno(0x4c) + EPROGMISMATCH = Errno(0x4b) + EPROGUNAVAIL = Errno(0x4a) + EPROTO = Errno(0x5c) + EPROTONOSUPPORT = Errno(0x2b) + EPROTOTYPE = Errno(0x29) + ERANGE = Errno(0x22) + EREMOTE = Errno(0x47) + EROFS = Errno(0x1e) + ERPCMISMATCH = Errno(0x49) + ESHUTDOWN = Errno(0x3a) + ESOCKTNOSUPPORT = Errno(0x2c) + ESPIPE = Errno(0x1d) + ESRCH = Errno(0x3) + ESTALE = Errno(0x46) + ETIMEDOUT = Errno(0x3c) + ETOOMANYREFS = Errno(0x3b) + ETXTBSY = Errno(0x1a) + EUSERS = Errno(0x44) + EWOULDBLOCK = Errno(0x23) + EXDEV = Errno(0x12) +) + +// Signals +const ( + SIGABRT = Signal(0x6) + SIGALRM = Signal(0xe) + SIGBUS = Signal(0xa) + SIGCHLD = Signal(0x14) + SIGCONT = Signal(0x13) + SIGEMT = Signal(0x7) + SIGFPE = Signal(0x8) + SIGHUP = Signal(0x1) + SIGILL = Signal(0x4) + SIGINFO = Signal(0x1d) + SIGINT = Signal(0x2) + SIGIO = Signal(0x17) + SIGIOT = Signal(0x6) + SIGKILL = Signal(0x9) + SIGLIBRT = Signal(0x21) + SIGLWP = Signal(0x20) + SIGPIPE = Signal(0xd) + SIGPROF = Signal(0x1b) + SIGQUIT = Signal(0x3) + SIGSEGV = Signal(0xb) + SIGSTOP = Signal(0x11) + SIGSYS = Signal(0xc) + SIGTERM = Signal(0xf) + SIGTHR = Signal(0x20) + SIGTRAP = Signal(0x5) + SIGTSTP = Signal(0x12) + SIGTTIN = Signal(0x15) + SIGTTOU = Signal(0x16) + SIGURG = Signal(0x10) + SIGUSR1 = Signal(0x1e) + SIGUSR2 = Signal(0x1f) + SIGVTALRM = Signal(0x1a) + SIGWINCH = Signal(0x1c) + SIGXCPU = Signal(0x18) + SIGXFSZ = Signal(0x19) +) + +// Error table +var errors = [...]string{ + 1: "operation not permitted", + 2: "no such file or directory", + 3: "no such process", + 4: "interrupted system call", + 5: "input/output error", + 6: "device not configured", + 7: "argument list too long", + 8: "exec format error", + 9: "bad file descriptor", + 10: "no child processes", + 11: "resource deadlock avoided", + 12: "cannot allocate memory", + 13: "permission denied", + 14: "bad address", + 15: "block device required", + 16: "device busy", + 17: "file exists", + 18: "cross-device link", + 19: "operation not supported by device", + 20: "not a directory", + 21: "is a directory", + 22: "invalid argument", + 23: "too many open files in system", + 24: "too many open files", + 25: "inappropriate ioctl for device", + 26: "text file busy", + 27: "file too large", + 28: "no space left on device", + 29: "illegal seek", + 30: "read-only file system", + 31: "too many links", + 32: "broken pipe", + 33: "numerical argument out of domain", + 34: "result too large", + 35: "resource temporarily unavailable", + 36: "operation now in progress", + 37: "operation already in progress", + 38: "socket operation on non-socket", + 39: "destination address required", + 40: "message too long", + 41: "protocol wrong type for socket", + 42: "protocol not available", + 43: "protocol not supported", + 44: "socket type not supported", + 45: "operation not supported", + 46: "protocol family not supported", + 47: "address family not supported by protocol family", + 48: "address already in use", + 49: "can't assign requested address", + 50: "network is down", + 51: "network is unreachable", + 52: "network dropped connection on reset", + 53: "software caused connection abort", + 54: "connection reset by peer", + 55: "no buffer space available", + 56: "socket is already connected", + 57: "socket is not connected", + 58: "can't send after socket shutdown", + 59: "too many references: can't splice", + 60: "operation timed out", + 61: "connection refused", + 62: "too many levels of symbolic links", + 63: "file name too long", + 64: "host is down", + 65: "no route to host", + 66: "directory not empty", + 67: "too many processes", + 68: "too many users", + 69: "disc quota exceeded", + 70: "stale NFS file handle", + 71: "too many levels of remote in path", + 72: "RPC struct is bad", + 73: "RPC version wrong", + 74: "RPC prog. not avail", + 75: "program version wrong", + 76: "bad procedure for program", + 77: "no locks available", + 78: "function not implemented", + 79: "inappropriate file type or format", + 80: "authentication error", + 81: "need authenticator", + 82: "identifier removed", + 83: "no message of desired type", + 84: "value too large to be stored in data type", + 85: "operation canceled", + 86: "illegal byte sequence", + 87: "attribute not found", + 88: "programming error", + 89: "bad message", + 90: "multihop attempted", + 91: "link has been severed", + 92: "protocol error", + 93: "capabilities insufficient", + 94: "not permitted in capability mode", + 95: "state not recoverable", + 96: "previous owner died", +} + +// Signal table +var signals = [...]string{ + 1: "hangup", + 2: "interrupt", + 3: "quit", + 4: "illegal instruction", + 5: "trace/BPT trap", + 6: "abort trap", + 7: "EMT trap", + 8: "floating point exception", + 9: "killed", + 10: "bus error", + 11: "segmentation fault", + 12: "bad system call", + 13: "broken pipe", + 14: "alarm clock", + 15: "terminated", + 16: "urgent I/O condition", + 17: "suspended (signal)", + 18: "suspended", + 19: "continued", + 20: "child exited", + 21: "stopped (tty input)", + 22: "stopped (tty output)", + 23: "I/O possible", + 24: "cputime limit exceeded", + 25: "filesize limit exceeded", + 26: "virtual timer expired", + 27: "profiling timer expired", + 28: "window size changes", + 29: "information request", + 30: "user defined signal 1", + 31: "user defined signal 2", + 32: "unknown signal", + 33: "unknown signal", +} diff --git a/src/syscall/zsyscall_freebsd_arm64.go b/src/syscall/zsyscall_freebsd_arm64.go new file mode 100644 index 00000000000..1b177383c21 --- /dev/null +++ b/src/syscall/zsyscall_freebsd_arm64.go @@ -0,0 +1,1420 @@ +// mksyscall.pl -tags freebsd,arm64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm64.go +// Code generated by the command above; DO NOT EDIT. + +// +build freebsd,arm64 + +package syscall + +import "unsafe" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(ngid int, gid *_Gid_t) (n int, err error) { + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(ngid int, gid *_Gid_t) (err error) { + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(s int, how int) (err error) { + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimes(fd int, timeval *[2]Timeval) (err error) { + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chflags(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Close(fd int) (err error) { + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(fd int) (nfd int, err error) { + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(from int, to int) (err error) { + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchflags(fd int, flags int) (err error) { + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Flock(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fpathconf(fd int, name int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstat(fd int, stat *stat_freebsd11_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstat_freebsd12(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(_SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(_SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(_SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getdtablesize() (size int) { + r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) + size = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgrp() (pgrp int) { + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + pgrp = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (ppid int) { + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + ppid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrusage(who int, rusage *Rusage) (err error) { + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Issetugid() (tainted bool) { + r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + tainted = bool(r0 != 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, signum Signal) (err error) { + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kqueue() (fd int, err error) { + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, backlog int) (err error) { + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func lstat(path string, stat *stat_freebsd11_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(_SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pathconf(path string, name int) (val int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Revoke(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) + newoffset = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { + _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setegid(egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seteuid(euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(gid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setlogin(name string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(name) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Settimeofday(tp *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func stat(path string, stat *stat_freebsd11_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func statfs(path string, stat *statfs_freebsd11_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func statfs_freebsd12(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(_SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() (err error) { + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(newmask int) (oldmask int) { + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + oldmask = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Undelete(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unmount(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writelen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { + r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/src/syscall/zsyscall_linux_386.go b/src/syscall/zsyscall_linux_386.go index f25eb2512a7..cdf0bfb86e7 100644 --- a/src/syscall/zsyscall_linux_386.go +++ b/src/syscall/zsyscall_linux_386.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1148,6 +1077,17 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1256,6 +1196,16 @@ func Iopl(level int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1417,6 +1367,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) @@ -1497,6 +1457,21 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1515,3 +1490,33 @@ func Time(t *Time_t) (tt Time_t, err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/src/syscall/zsyscall_linux_amd64.go b/src/syscall/zsyscall_linux_amd64.go index a994b2397f2..a7d55e6894a 100644 --- a/src/syscall/zsyscall_linux_amd64.go +++ b/src/syscall/zsyscall_linux_amd64.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,17 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1251,6 +1191,16 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1469,6 +1419,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -1691,6 +1651,51 @@ func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { diff --git a/src/syscall/zsyscall_linux_arm.go b/src/syscall/zsyscall_linux_arm.go index a7c978766ce..1a9a21a4f3d 100644 --- a/src/syscall/zsyscall_linux_arm.go +++ b/src/syscall/zsyscall_linux_arm.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1327,6 +1256,17 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1415,6 +1355,16 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1538,6 +1488,31 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1559,6 +1534,36 @@ func Time(t *Time_t) (tt Time_t, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/src/syscall/zsyscall_linux_arm64.go b/src/syscall/zsyscall_linux_arm64.go index 17875dfb39f..b62383e703f 100644 --- a/src/syscall/zsyscall_linux_arm64.go +++ b/src/syscall/zsyscall_linux_arm64.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1675,9 +1604,8 @@ func Gettimeofday(tv *Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Time(t *Time_t) (tt Time_t, err error) { - r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) - tt = Time_t(r0) +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } @@ -1686,8 +1614,9 @@ func Time(t *Time_t) (tt Time_t, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) +func ppoll(fds *pollFd, nfds int, timeout *Timespec, sigmask *sigset_t) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + n = int(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/src/syscall/zsyscall_linux_mips.go b/src/syscall/zsyscall_linux_mips.go index cb5ab684fc8..7945b556421 100644 --- a/src/syscall/zsyscall_linux_mips.go +++ b/src/syscall/zsyscall_linux_mips.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,17 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1220,6 +1160,16 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1402,6 +1352,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -1612,6 +1572,21 @@ func Iopl(level int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1633,6 +1608,36 @@ func Time(t *Time_t) (tt Time_t, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/src/syscall/zsyscall_linux_mips64.go b/src/syscall/zsyscall_linux_mips64.go index b808c1e27c9..c0aad6439fa 100644 --- a/src/syscall/zsyscall_linux_mips64.go +++ b/src/syscall/zsyscall_linux_mips64.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,17 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1251,6 +1191,16 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1458,6 +1408,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -1676,6 +1636,21 @@ func pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask * // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1686,6 +1661,36 @@ func Gettimeofday(tv *Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { diff --git a/src/syscall/zsyscall_linux_mips64le.go b/src/syscall/zsyscall_linux_mips64le.go index 053c718ab77..271684137d5 100644 --- a/src/syscall/zsyscall_linux_mips64le.go +++ b/src/syscall/zsyscall_linux_mips64le.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,17 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1251,6 +1191,16 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1458,6 +1408,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -1676,6 +1636,21 @@ func pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask * // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1686,6 +1661,36 @@ func Gettimeofday(tv *Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { diff --git a/src/syscall/zsyscall_linux_mipsle.go b/src/syscall/zsyscall_linux_mipsle.go index 94a5327b63c..f0ee48f9be1 100644 --- a/src/syscall/zsyscall_linux_mipsle.go +++ b/src/syscall/zsyscall_linux_mipsle.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,17 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1220,6 +1160,16 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1402,6 +1352,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -1612,6 +1572,21 @@ func Iopl(level int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1633,6 +1608,36 @@ func Time(t *Time_t) (tt Time_t, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/src/syscall/zsyscall_linux_ppc64.go b/src/syscall/zsyscall_linux_ppc64.go index b92e4d691af..7bdf981dcda 100644 --- a/src/syscall/zsyscall_linux_ppc64.go +++ b/src/syscall/zsyscall_linux_ppc64.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,34 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + var _p0 unsafe.Pointer + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1296,6 +1253,16 @@ func Lstat(path string, stat *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1519,6 +1486,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -1709,6 +1686,21 @@ func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int6 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1730,15 +1722,28 @@ func Time(t *Time_t) (tt Time_t, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - var _p0 unsafe.Pointer - if len(events) > 0 { - _p0 = unsafe.Pointer(&events[0]) - } else { - _p0 = unsafe.Pointer(&_zero) +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) - n = int(r0) + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/src/syscall/zsyscall_linux_ppc64le.go b/src/syscall/zsyscall_linux_ppc64le.go index add09e4705f..c45eebf4ad3 100644 --- a/src/syscall/zsyscall_linux_ppc64le.go +++ b/src/syscall/zsyscall_linux_ppc64le.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,34 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + var _p0 unsafe.Pointer + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1296,6 +1253,16 @@ func Lstat(path string, stat *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1519,6 +1486,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -1709,6 +1686,21 @@ func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int6 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1730,15 +1722,28 @@ func Time(t *Time_t) (tt Time_t, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - var _p0 unsafe.Pointer - if len(events) > 0 { - _p0 = unsafe.Pointer(&events[0]) - } else { - _p0 = unsafe.Pointer(&_zero) +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) - n = int(r0) + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/src/syscall/zsyscall_linux_s390x.go b/src/syscall/zsyscall_linux_s390x.go index b91cb63da4d..9ada8dc5341 100644 --- a/src/syscall/zsyscall_linux_s390x.go +++ b/src/syscall/zsyscall_linux_s390x.go @@ -132,21 +132,6 @@ func unlinkat(dirfd int, path string, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimes(path string, times *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -162,16 +147,6 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -337,17 +312,6 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) @@ -682,16 +646,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pause() (err error) { - _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) @@ -950,31 +904,6 @@ func Unshare(flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ustat(dev int, ubuf *Ustat_t) (err error) { - _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Utime(path string, buf *Utimbuf) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1128,6 +1057,34 @@ func Dup2(oldfd int, newfd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func EpollCreate(size int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + var _p0 unsafe.Pointer + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -1266,6 +1223,16 @@ func Lstat(path string, stat *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1489,6 +1456,16 @@ func Truncate(path string, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) @@ -1510,6 +1487,21 @@ func setgroups(n int, list *_Gid_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { @@ -1520,15 +1512,28 @@ func Gettimeofday(tv *Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { - var _p0 unsafe.Pointer - if len(events) > 0 { - _p0 = unsafe.Pointer(&events[0]) - } else { - _p0 = unsafe.Pointer(&_zero) +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return } - r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) - n = int(r0) + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/src/syscall/zsyscall_nacl_386.go b/src/syscall/zsyscall_nacl_386.go deleted file mode 100644 index fb286ba4d3d..00000000000 --- a/src/syscall/zsyscall_nacl_386.go +++ /dev/null @@ -1,71 +0,0 @@ -// mksyscall.pl -l32 -nacl -tags nacl,386 syscall_nacl.go syscall_nacl_386.go -// Code generated by the command above; DO NOT EDIT. - -// +build nacl,386 - -package syscall - -import "unsafe" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclClose(fd int) (err error) { - _, _, e1 := Syscall(sys_close, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclFstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(sys_fstat, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclRead(fd int, b []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(sys_read, uintptr(fd), uintptr(_p0), uintptr(len(b))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclSeek(fd int, off *int64, whence int) (err error) { - _, _, e1 := Syscall(sys_lseek, uintptr(fd), uintptr(unsafe.Pointer(off)), uintptr(whence)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclGetRandomBytes(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(sys_get_random_bytes, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/src/syscall/zsyscall_nacl_amd64p32.go b/src/syscall/zsyscall_nacl_amd64p32.go deleted file mode 100644 index 799b24dea33..00000000000 --- a/src/syscall/zsyscall_nacl_amd64p32.go +++ /dev/null @@ -1,71 +0,0 @@ -// mksyscall.pl -nacl -tags nacl,amd64p32 syscall_nacl.go syscall_nacl_amd64p32.go -// Code generated by the command above; DO NOT EDIT. - -// +build nacl,amd64p32 - -package syscall - -import "unsafe" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclClose(fd int) (err error) { - _, _, e1 := Syscall(sys_close, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclFstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(sys_fstat, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclRead(fd int, b []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(sys_read, uintptr(fd), uintptr(_p0), uintptr(len(b))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclSeek(fd int, off *int64, whence int) (err error) { - _, _, e1 := Syscall(sys_lseek, uintptr(fd), uintptr(unsafe.Pointer(off)), uintptr(whence)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclGetRandomBytes(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(sys_get_random_bytes, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/src/syscall/zsyscall_nacl_arm.go b/src/syscall/zsyscall_nacl_arm.go deleted file mode 100644 index d06d02c2974..00000000000 --- a/src/syscall/zsyscall_nacl_arm.go +++ /dev/null @@ -1,71 +0,0 @@ -// mksyscall.pl -l32 -nacl -arm -tags nacl,arm syscall_nacl.go syscall_nacl_arm.go -// Code generated by the command above; DO NOT EDIT. - -// +build nacl,arm - -package syscall - -import "unsafe" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclClose(fd int) (err error) { - _, _, e1 := Syscall(sys_close, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclFstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(sys_fstat, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclRead(fd int, b []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(sys_read, uintptr(fd), uintptr(_p0), uintptr(len(b))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclSeek(fd int, off *int64, whence int) (err error) { - _, _, e1 := Syscall(sys_lseek, uintptr(fd), uintptr(unsafe.Pointer(off)), uintptr(whence)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclGetRandomBytes(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(sys_get_random_bytes, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/src/syscall/zsysnum_freebsd_arm64.go b/src/syscall/zsysnum_freebsd_arm64.go new file mode 100644 index 00000000000..0ce3d05cf22 --- /dev/null +++ b/src/syscall/zsysnum_freebsd_arm64.go @@ -0,0 +1,396 @@ +// mksysnum_freebsd.pl +// Code generated by the command above; DO NOT EDIT. + +// +build arm64,freebsd + +package syscall + +const ( + // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int + SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void + SYS_FORK = 2 // { int fork(void); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } + SYS_CLOSE = 6 // { int close(int fd); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } + SYS_LINK = 9 // { int link(char *path, char *link); } + SYS_UNLINK = 10 // { int unlink(char *path); } + SYS_CHDIR = 12 // { int chdir(char *path); } + SYS_FCHDIR = 13 // { int fchdir(int fd); } + SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } + SYS_CHMOD = 15 // { int chmod(char *path, int mode); } + SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } + SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_GETPID = 20 // { pid_t getpid(void); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } + SYS_SETUID = 23 // { int setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t getuid(void); } + SYS_GETEUID = 25 // { uid_t geteuid(void); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); } + SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); } + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_ACCESS = 33 // { int access(char *path, int amode); } + SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } + SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } + SYS_SYNC = 36 // { int sync(void); } + SYS_KILL = 37 // { int kill(int pid, int signum); } + SYS_GETPPID = 39 // { pid_t getppid(void); } + SYS_DUP = 41 // { int dup(u_int fd); } + SYS_PIPE = 42 // { int pipe(void); } + SYS_GETEGID = 43 // { gid_t getegid(void); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_GETGID = 47 // { gid_t getgid(void); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } + SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } + SYS_ACCT = 51 // { int acct(char *path); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_REBOOT = 55 // { int reboot(int opt); } + SYS_REVOKE = 56 // { int revoke(char *path); } + SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } + SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_CHROOT = 61 // { int chroot(char *path); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_VFORK = 66 // { int vfork(void); } + SYS_SBRK = 69 // { int sbrk(int incr); } + SYS_SSTK = 70 // { int sstk(int incr); } + SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int + SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_GETPGRP = 81 // { int getpgrp(void); } + SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SWAPON = 85 // { int swapon(char *name); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } + SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } + SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_FSYNC = 95 // { int fsync(int fd); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } + SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_LISTEN = 106 // { int listen(int s, int backlog); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } + SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } + SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } + SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } + SYS_RENAME = 128 // { int rename(char *from, char *to); } + SYS_FLOCK = 131 // { int flock(int fd, int how); } + SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } + SYS_RMDIR = 137 // { int rmdir(char *path); } + SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_SETSID = 147 // { int setsid(void); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } + SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } + SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); } + SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } + SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } + SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } + SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } + SYS_SETFIB = 175 // { int setfib(int fibnum); } + SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } + SYS_SETGID = 181 // { int setgid(gid_t gid); } + SYS_SETEGID = 182 // { int setegid(gid_t egid); } + SYS_SETEUID = 183 // { int seteuid(uid_t euid); } + SYS_STAT = 188 // { int stat(char *path, struct stat *ub); } + SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); } + SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } + SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } + SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int + SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } + SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int + SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } + SYS_UNDELETE = 205 // { int undelete(char *path); } + SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } + SYS_GETPGID = 207 // { int getpgid(pid_t pid); } + SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } + SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } + SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } + SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } + SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } + SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } + SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); } + SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } + SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } + SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } + SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } + SYS_RFORK = 251 // { int rfork(int flags); } + SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_ISSETUGID = 253 // { int issetugid(void); } + SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } + SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } + SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } + SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } + SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } + SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } + SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } + SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } + SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } + SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } + SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } + SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } + SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } + SYS_MODNEXT = 300 // { int modnext(int modid); } + SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } + SYS_MODFNEXT = 302 // { int modfnext(int modid); } + SYS_MODFIND = 303 // { int modfind(const char *name); } + SYS_KLDLOAD = 304 // { int kldload(const char *file); } + SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } + SYS_KLDFIND = 306 // { int kldfind(const char *file); } + SYS_KLDNEXT = 307 // { int kldnext(int fileid); } + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } + SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } + SYS_GETSID = 310 // { int getsid(pid_t pid); } + SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } + SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } + SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } + SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } + SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } + SYS_YIELD = 321 // { int yield(void); } + SYS_MLOCKALL = 324 // { int mlockall(int how); } + SYS_MUNLOCKALL = 325 // { int munlockall(void); } + SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } + SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } + SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } + SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } + SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } + SYS_SCHED_YIELD = 331 // { int sched_yield (void); } + SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } + SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } + SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } + SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } + SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } + SYS_JAIL = 338 // { int jail(struct jail *jail); } + SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } + SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } + SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } + SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); } + SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); } + SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } + SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } + SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_KQUEUE = 362 // { int kqueue(void); } + SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } + SYS___SETUGID = 374 // { int __setugid(int flag); } + SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } + SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } + SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } + SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); } + SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); } + SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); } + SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); } + SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } + SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } + SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } + SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } + SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } + SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } + SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } + SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } + SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } + SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } + SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); } + SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); } + SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } + SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } + SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } + SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } + SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } + SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } + SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } + SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } + SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } + SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } + SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } + SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } + SYS_SWAPOFF = 424 // { int swapoff(const char *name); } + SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); } + SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); } + SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); } + SYS_THR_EXIT = 431 // { void thr_exit(long *state); } + SYS_THR_SELF = 432 // { int thr_self(long *id); } + SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } + SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } + SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } + SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } + SYS_THR_WAKE = 443 // { int thr_wake(long id); } + SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } + SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } + SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); } + SYS_GETAUID = 447 // { int getauid(uid_t *auid); } + SYS_SETAUID = 448 // { int setauid(uid_t *auid); } + SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } + SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_AUDITCTL = 453 // { int auditctl(char *path); } + SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } + SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } + SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } + SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } + SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } + SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } + SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } + SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } + SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); } + SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } + SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } + SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } + SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } + SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } + SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } + SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); } + SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } + SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } + SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } + SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); } + SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } + SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } + SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); } + SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); } + SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); } + SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); } + SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); } + SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } + SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } + SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } + SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } + SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } + SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } + SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } + SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } + SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } + SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } + SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } + SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } + SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } + SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } + SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } + SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } + SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } + SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); } + SYS_CAP_ENTER = 516 // { int cap_enter(void); } + SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } + SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } + SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } + SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } + SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); } + SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); } + SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } + SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); } + SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); } + SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } + SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); } + SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); } + SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); } + SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); } + SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); } + SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); } + SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); } + SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); } + SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); } + SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } + SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } + SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); } + SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } + SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } + SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } + SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } + SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } + SYS_FDATASYNC = 550 // { int fdatasync(int fd); } +) diff --git a/src/syscall/ztypes_freebsd_arm64.go b/src/syscall/ztypes_freebsd_arm64.go new file mode 100644 index 00000000000..6d56fc85cff --- /dev/null +++ b/src/syscall/ztypes_freebsd_arm64.go @@ -0,0 +1,572 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs types_freebsd.go | go run mkpost.go + +// +build arm64,freebsd + +package syscall + +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur int64 + Max int64 +} + +type _Gid_t uint32 + +const ( + S_IFMT = 0xf000 + S_IFIFO = 0x1000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFBLK = 0x6000 + S_IFREG = 0x8000 + S_IFLNK = 0xa000 + S_IFSOCK = 0xc000 + S_ISUID = 0x800 + S_ISGID = 0x400 + S_ISVTX = 0x200 + S_IRUSR = 0x100 + S_IWUSR = 0x80 + S_IXUSR = 0x40 + S_IRWXG = 0x38 + S_IRWXO = 0x7 +) + +const ( + _statfsVersion = 0x20140518 + _dirblksiz = 0x400 +) + +type Stat_t struct { + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint16 + Padding0 int16 + Uid uint32 + Gid uint32 + Padding1 int32 + Rdev uint64 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint64 + Spare [10]uint64 +} + +type stat_freebsd11_t struct { + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Birthtimespec Timespec +} + +type Statfs_t struct { + Version uint32 + Type uint32 + Flags uint64 + Bsize uint64 + Iosize uint64 + Blocks uint64 + Bfree uint64 + Bavail int64 + Files uint64 + Ffree int64 + Syncwrites uint64 + Asyncwrites uint64 + Syncreads uint64 + Asyncreads uint64 + Spare [10]uint64 + Namemax uint32 + Owner uint32 + Fsid Fsid + Charspare [80]int8 + Fstypename [16]int8 + Mntfromname [1024]int8 + Mntonname [1024]int8 +} + +type statfs_freebsd11_t struct { + Version uint32 + Type uint32 + Flags uint64 + Bsize uint64 + Iosize uint64 + Blocks uint64 + Bfree uint64 + Bavail int64 + Files uint64 + Ffree int64 + Syncwrites uint64 + Asyncwrites uint64 + Syncreads uint64 + Asyncreads uint64 + Spare [10]uint64 + Namemax uint32 + Owner uint32 + Fsid Fsid + Charspare [80]int8 + Fstypename [16]int8 + Mntfromname [88]int8 + Mntonname [88]int8 +} + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 + Sysid int32 + Pad_cgo_0 [4]byte +} + +type Dirent struct { + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Pad0 uint8 + Namlen uint16 + Pad1 uint16 + Name [256]int8 +} + +type dirent_freebsd11 struct { + Fileno uint32 + Reclen uint16 + Type uint8 + Namlen uint8 + Name [256]int8 +} + +type Fsid struct { + Val [2]int32 +} + +const ( + pathMax = 0x400 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [46]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPMreqn struct { + Multiaddr [4]byte /* in_addr */ + Address [4]byte /* in_addr */ + Ifindex int32 +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Pad_cgo_0 [4]byte + Iov *Iovec + Iovlen int32 + Pad_cgo_1 [4]byte + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x36 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type Kevent_t struct { + Ident uint64 + Filter int16 + Flags uint16 + Fflags uint32 + Data int64 + Udata *byte +} + +type FdSet struct { + X__fds_bits [16]uint64 +} + +const ( + sizeofIfMsghdr = 0xa8 + SizeofIfMsghdr = 0xa8 + sizeofIfData = 0x98 + SizeofIfData = 0x98 + SizeofIfaMsghdr = 0x14 + SizeofIfmaMsghdr = 0x10 + SizeofIfAnnounceMsghdr = 0x18 + SizeofRtMsghdr = 0x98 + SizeofRtMetrics = 0x70 +) + +type ifMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data ifData +} + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data IfData +} + +type ifData struct { + Type uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Vhid uint8 + Baudrate_pf uint8 + Datalen uint8 + Mtu uint64 + Metric uint64 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Noproto uint64 + Hwassist uint64 + Epoch int64 + Lastchange Timeval +} + +type IfData struct { + Type uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Spare_char1 uint8 + Spare_char2 uint8 + Datalen uint8 + Mtu uint64 + Metric uint64 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Noproto uint64 + Hwassist uint64 + Epoch int64 + Lastchange Timeval +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Metric int32 +} + +type IfmaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Name [16]int8 + What uint16 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Pad_cgo_0 [2]byte + Flags int32 + Addrs int32 + Pid int32 + Seq int32 + Errno int32 + Fmask int32 + Inits uint64 + Rmx RtMetrics +} + +type RtMetrics struct { + Locks uint64 + Mtu uint64 + Hopcount uint64 + Expire uint64 + Recvpipe uint64 + Sendpipe uint64 + Ssthresh uint64 + Rtt uint64 + Rttvar uint64 + Pksent uint64 + Weight uint64 + Filler [3]uint64 +} + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x8 + SizeofBpfZbuf = 0x18 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x20 + SizeofBpfZbufHeader = 0x20 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint32 + Drop uint32 +} + +type BpfZbuf struct { + Bufa *byte + Bufb *byte + Buflen uint64 +} + +type BpfProgram struct { + Len uint32 + Pad_cgo_0 [4]byte + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp Timeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Pad_cgo_0 [6]byte +} + +type BpfZbufHeader struct { + Kernel_gen uint32 + Kernel_len uint32 + User_gen uint32 + X_bzh_pad [5]uint32 +} + +const ( + _AT_FDCWD = -0x64 + _AT_SYMLINK_FOLLOW = 0x400 + _AT_SYMLINK_NOFOLLOW = 0x200 +) + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed uint32 + Ospeed uint32 +} diff --git a/src/syscall/ztypes_linux_386.go b/src/syscall/ztypes_linux_386.go index c92dfad1146..0252620f48c 100644 --- a/src/syscall/ztypes_linux_386.go +++ b/src/syscall/ztypes_linux_386.go @@ -579,6 +579,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_amd64.go b/src/syscall/ztypes_linux_amd64.go index 623585a6392..1fb0ee566f1 100644 --- a/src/syscall/ztypes_linux_amd64.go +++ b/src/syscall/ztypes_linux_amd64.go @@ -597,6 +597,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_arm.go b/src/syscall/ztypes_linux_arm.go index 0c0a94a52f8..a88b577bede 100644 --- a/src/syscall/ztypes_linux_arm.go +++ b/src/syscall/ztypes_linux_arm.go @@ -568,6 +568,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_arm64.go b/src/syscall/ztypes_linux_arm64.go index ea682c4efa7..d7e3526af6d 100644 --- a/src/syscall/ztypes_linux_arm64.go +++ b/src/syscall/ztypes_linux_arm64.go @@ -575,6 +575,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_mips.go b/src/syscall/ztypes_linux_mips.go index 6d42e48d60f..621ef2d5a85 100644 --- a/src/syscall/ztypes_linux_mips.go +++ b/src/syscall/ztypes_linux_mips.go @@ -574,6 +574,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_mips64.go b/src/syscall/ztypes_linux_mips64.go index 397ded1f4d0..cfcfd85b354 100644 --- a/src/syscall/ztypes_linux_mips64.go +++ b/src/syscall/ztypes_linux_mips64.go @@ -580,6 +580,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_mips64le.go b/src/syscall/ztypes_linux_mips64le.go index 397ded1f4d0..cfcfd85b354 100644 --- a/src/syscall/ztypes_linux_mips64le.go +++ b/src/syscall/ztypes_linux_mips64le.go @@ -580,6 +580,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_mipsle.go b/src/syscall/ztypes_linux_mipsle.go index 6d42e48d60f..621ef2d5a85 100644 --- a/src/syscall/ztypes_linux_mipsle.go +++ b/src/syscall/ztypes_linux_mipsle.go @@ -574,6 +574,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_ppc64.go b/src/syscall/ztypes_linux_ppc64.go index 3d295390f65..8b6be21e2ea 100644 --- a/src/syscall/ztypes_linux_ppc64.go +++ b/src/syscall/ztypes_linux_ppc64.go @@ -586,6 +586,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_ppc64le.go b/src/syscall/ztypes_linux_ppc64le.go index 220083d9c54..a9c3ee26266 100644 --- a/src/syscall/ztypes_linux_ppc64le.go +++ b/src/syscall/ztypes_linux_ppc64le.go @@ -586,6 +586,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/syscall/ztypes_linux_s390x.go b/src/syscall/ztypes_linux_s390x.go index 28059667743..91f5ceff201 100644 --- a/src/syscall/ztypes_linux_s390x.go +++ b/src/syscall/ztypes_linux_s390x.go @@ -600,6 +600,12 @@ const ( _AT_EACCESS = 0x200 ) +type pollFd struct { + Fd int32 + Events int16 + Revents int16 +} + type Termios struct { Iflag uint32 Oflag uint32 diff --git a/src/time/sys_unix.go b/src/time/sys_unix.go index f4756b18a62..97b1140bbcf 100644 --- a/src/time/sys_unix.go +++ b/src/time/sys_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package time diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go index d6bcabfb808..74aa5212a1f 100644 --- a/src/time/zoneinfo_unix.go +++ b/src/time/zoneinfo_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin,386 darwin,amd64 dragonfly freebsd linux,!android nacl netbsd openbsd solaris +// +build aix darwin,386 darwin,amd64 dragonfly freebsd linux,!android netbsd openbsd solaris // Parse "zoneinfo" time zone file. // This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others. diff --git a/src/unicode/utf8/utf8.go b/src/unicode/utf8/utf8.go index eae4ead0dae..b722a039239 100644 --- a/src/unicode/utf8/utf8.go +++ b/src/unicode/utf8/utf8.go @@ -4,6 +4,7 @@ // Package utf8 implements functions and constants to support text encoded in // UTF-8. It includes functions to translate between runes and UTF-8 byte sequences. +// See https://en.wikipedia.org/wiki/UTF-8 package utf8 // The conditions RuneError==unicode.ReplacementChar and diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 453a3126613..c0f37845b01 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -1,4 +1,5 @@ # golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 +## explicit golang.org/x/crypto/chacha20poly1305 golang.org/x/crypto/cryptobyte golang.org/x/crypto/cryptobyte/asn1 @@ -8,6 +9,7 @@ golang.org/x/crypto/internal/chacha20 golang.org/x/crypto/internal/subtle golang.org/x/crypto/poly1305 # golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 +## explicit golang.org/x/net/dns/dnsmessage golang.org/x/net/http/httpguts golang.org/x/net/http/httpproxy @@ -17,8 +19,10 @@ golang.org/x/net/lif golang.org/x/net/nettest golang.org/x/net/route # golang.org/x/sys v0.0.0-20190529130038-5219a1e1c5f8 +## explicit golang.org/x/sys/cpu # golang.org/x/text v0.3.2 +## explicit golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi diff --git a/test/codegen/compare_and_branch.go b/test/codegen/compare_and_branch.go new file mode 100644 index 00000000000..33d8d7bd524 --- /dev/null +++ b/test/codegen/compare_and_branch.go @@ -0,0 +1,154 @@ +// asmcheck + +// Copyright 2019 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 codegen + +//go:noinline +func dummy() {} + +// Signed 64-bit compare-and-branch. +func si64(x, y chan int64) { + // s390x:"CGRJ\t[$]4, R[0-9]+, R[0-9]+, " + for <-x < <-y { + dummy() + } + + // s390x:"CL?GRJ\t[$]8, R[0-9]+, R[0-9]+, " + for <-x == <-y { + dummy() + } +} + +// Signed 64-bit compare-and-branch with 8-bit immediate. +func si64x8() { + // s390x:"CGIJ\t[$]12, R[0-9]+, [$]127, " + for i := int64(0); i < 128; i++ { + dummy() + } + + // s390x:"CGIJ\t[$]10, R[0-9]+, [$]-128, " + for i := int64(0); i > -129; i-- { + dummy() + } + + // s390x:"CGIJ\t[$]2, R[0-9]+, [$]127, " + for i := int64(0); i >= 128; i++ { + dummy() + } + + // s390x:"CGIJ\t[$]4, R[0-9]+, [$]-128, " + for i := int64(0); i <= -129; i-- { + dummy() + } +} + +// Unsigned 64-bit compare-and-branch. +func ui64(x, y chan uint64) { + // s390x:"CLGRJ\t[$]2, R[0-9]+, R[0-9]+, " + for <-x > <-y { + dummy() + } + + // s390x:"CL?GRJ\t[$]6, R[0-9]+, R[0-9]+, " + for <-x != <-y { + dummy() + } +} + +// Unsigned 64-bit comparison with 8-bit immediate. +func ui64x8() { + // s390x:"CLGIJ\t[$]4, R[0-9]+, [$]128, " + for i := uint64(0); i < 128; i++ { + dummy() + } + + // s390x:"CLGIJ\t[$]12, R[0-9]+, [$]255, " + for i := uint64(0); i < 256; i++ { + dummy() + } + + // s390x:"CLGIJ\t[$]2, R[0-9]+, [$]255, " + for i := uint64(0); i >= 256; i-- { + dummy() + } + + // s390x:"CLGIJ\t[$]2, R[0-9]+, [$]0, " + for i := uint64(1024); i > 0; i-- { + dummy() + } +} + +// Signed 32-bit compare-and-branch. +func si32(x, y chan int32) { + // s390x:"CRJ\t[$]4, R[0-9]+, R[0-9]+, " + for <-x < <-y { + dummy() + } + + // s390x:"CL?RJ\t[$]8, R[0-9]+, R[0-9]+, " + for <-x == <-y { + dummy() + } +} + +// Signed 32-bit compare-and-branch with 8-bit immediate. +func si32x8() { + // s390x:"CIJ\t[$]12, R[0-9]+, [$]127, " + for i := int32(0); i < 128; i++ { + dummy() + } + + // s390x:"CIJ\t[$]10, R[0-9]+, [$]-128, " + for i := int32(0); i > -129; i-- { + dummy() + } + + // s390x:"CIJ\t[$]2, R[0-9]+, [$]127, " + for i := int32(0); i >= 128; i++ { + dummy() + } + + // s390x:"CIJ\t[$]4, R[0-9]+, [$]-128, " + for i := int32(0); i <= -129; i-- { + dummy() + } +} + +// Unsigned 32-bit compare-and-branch. +func ui32(x, y chan uint32) { + // s390x:"CLRJ\t[$]2, R[0-9]+, R[0-9]+, " + for <-x > <-y { + dummy() + } + + // s390x:"CL?RJ\t[$]6, R[0-9]+, R[0-9]+, " + for <-x != <-y { + dummy() + } +} + +// Unsigned 32-bit comparison with 8-bit immediate. +func ui32x8() { + // s390x:"CLIJ\t[$]4, R[0-9]+, [$]128, " + for i := uint32(0); i < 128; i++ { + dummy() + } + + // s390x:"CLIJ\t[$]12, R[0-9]+, [$]255, " + for i := uint32(0); i < 256; i++ { + dummy() + } + + // s390x:"CLIJ\t[$]2, R[0-9]+, [$]255, " + for i := uint32(0); i >= 256; i-- { + dummy() + } + + // s390x:"CLIJ\t[$]2, R[0-9]+, [$]0, " + for i := uint32(1024); i > 0; i-- { + dummy() + } +} diff --git a/test/codegen/issue33580.go b/test/codegen/issue33580.go new file mode 100644 index 00000000000..1ded944c33a --- /dev/null +++ b/test/codegen/issue33580.go @@ -0,0 +1,25 @@ +// asmcheck + +// Copyright 2019 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. + +// Make sure we reuse large constant loads, if we can. +// See issue 33580. + +package codegen + +const ( + A = 7777777777777777 + B = 8888888888888888 +) + +func f(x, y uint64) uint64 { + p := x & A + q := y & A + r := x & B + // amd64:-"MOVQ.*8888888888888888" + s := y & B + + return p * q * r * s +} diff --git a/test/codegen/slices.go b/test/codegen/slices.go index fccd711d717..cf569e27fbd 100644 --- a/test/codegen/slices.go +++ b/test/codegen/slices.go @@ -113,3 +113,54 @@ func SliceNilCheck(s []int) { // amd64:-`TESTB` _ = *p } + +// ---------------------- // +// Init slice literal // +// ---------------------- // +// See issue 21561 +func InitSmallSliceLiteral() []int { + // amd64:`MOVQ\t[$]42` + return []int{42} +} + +func InitNotSmallSliceLiteral() []int { + // amd64:`MOVQ\t.*autotmp_` + return []int{ + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + } +} diff --git a/test/escape_param.go b/test/escape_param.go index 5e81de9f467..d8fafc53f87 100644 --- a/test/escape_param.go +++ b/test/escape_param.go @@ -205,7 +205,7 @@ 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$" + p := &i p2 := &p param7(&p2) } diff --git a/test/fixedbugs/issue21576.go b/test/fixedbugs/issue21576.go index 79baec94e8e..b7a32f07acc 100644 --- a/test/fixedbugs/issue21576.go +++ b/test/fixedbugs/issue21576.go @@ -44,7 +44,9 @@ func main() { log.Fatalf("Write error %v", err) } - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + // Using a timeout of 1 minute in case other factors might slow + // down the start of "go run". See https://golang.org/issue/34836. + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() cmd := exec.CommandContext(ctx, "go", "run", file) @@ -55,6 +57,6 @@ func main() { want := []byte("fatal error: all goroutines are asleep - deadlock!") if !bytes.Contains(output, want) { - log.Fatalf("Unmatched error message %q:\nin\n%s", want, output) + log.Fatalf("Unmatched error message %q:\nin\n%s\nError: %v", want, output, err) } } diff --git a/test/fixedbugs/issue34395.go b/test/fixedbugs/issue34395.go new file mode 100644 index 00000000000..eb5a8558e18 --- /dev/null +++ b/test/fixedbugs/issue34395.go @@ -0,0 +1,17 @@ +// run + +// Copyright 2019 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. + +// Test that a binary with a large data section can load. This failed on wasm. + +package main + +var test = [100 * 1024 * 1024]byte{42} + +func main() { + if test[0] != 42 { + panic("bad") + } +} diff --git a/test/fixedbugs/issue34577.dir/a.go b/test/fixedbugs/issue34577.dir/a.go new file mode 100644 index 00000000000..c0203818c14 --- /dev/null +++ b/test/fixedbugs/issue34577.dir/a.go @@ -0,0 +1,14 @@ +// Copyright 2019 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 a + +type A struct { + x int +} + +//go:noinline +func W(a A, k, v interface{}) A { + return A{3} +} diff --git a/test/fixedbugs/issue34577.dir/b.go b/test/fixedbugs/issue34577.dir/b.go new file mode 100644 index 00000000000..8f07c621752 --- /dev/null +++ b/test/fixedbugs/issue34577.dir/b.go @@ -0,0 +1,19 @@ +// Copyright 2019 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 b + +import "a" + +type B struct { + s string +} + +func (b B) Func(x a.A) a.A { + return a.W(x, k, b) +} + +type ktype int + +const k ktype = 0 diff --git a/test/fixedbugs/issue34577.go b/test/fixedbugs/issue34577.go new file mode 100644 index 00000000000..b4caaebb66c --- /dev/null +++ b/test/fixedbugs/issue34577.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 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. + +// Issue 34577: gccgo compiler error emitting export data + +package ignored diff --git a/test/fixedbugs/issue34723.go b/test/fixedbugs/issue34723.go new file mode 100644 index 00000000000..402d465aa40 --- /dev/null +++ b/test/fixedbugs/issue34723.go @@ -0,0 +1,70 @@ +// errorcheck -0 -d=wb + +// Copyright 2019 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. + +// Make sure we don't introduce write barriers where we +// don't need them. These cases are writing pointers to +// globals to zeroed memory. + +package main + +func f1() []string { + return []string{"a"} +} + +func f2() []string { + return []string{"a", "b"} +} + +type T struct { + a [6]*int +} + +func f3() *T { + t := new(T) + t.a[0] = &g + t.a[1] = &g + t.a[2] = &g + t.a[3] = &g + t.a[4] = &g + t.a[5] = &g + return t +} + +func f4() *T { + t := new(T) + t.a[5] = &g + t.a[4] = &g + t.a[3] = &g + t.a[2] = &g + t.a[1] = &g + t.a[0] = &g + return t +} + +func f5() *T { + t := new(T) + t.a[4] = &g + t.a[2] = &g + t.a[0] = &g + t.a[3] = &g + t.a[1] = &g + t.a[5] = &g + return t +} + +type U struct { + a [65]*int +} + +func f6() *U { + u := new(U) + u.a[63] = &g + // This offset is too large: we only track the first 64 pointers for zeroness. + u.a[64] = &g // ERROR "write barrier" + return u +} + +var g int diff --git a/test/goprint.go b/test/goprint.go index 57eeac53a80..d44b259081e 100644 --- a/test/goprint.go +++ b/test/goprint.go @@ -9,13 +9,24 @@ package main import ( + "log" "runtime" "time" ) func main() { + numg0 := runtime.NumGoroutine() + deadline := time.Now().Add(10 * time.Second) 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) + for { + numg := runtime.NumGoroutine() + if numg > numg0 { + if time.Now().After(deadline) { + log.Fatalf("%d goroutines > initial %d after deadline", numg, numg0) + } + runtime.Gosched() + continue + } + break } }